Define device insertion OST event and status, and add a function to handle memory insertion.
Signed-off-by: Tang Chen <tangc...@cn.fujitsu.com> --- hw/acpi/memory_hotplug.c | 18 ++++++++++++++++++ include/hw/acpi/acpi.h | 10 +++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c index 1b21191..fddb0fd 100644 --- a/hw/acpi/memory_hotplug.c +++ b/hw/acpi/memory_hotplug.c @@ -85,6 +85,20 @@ static uint64_t acpi_memory_hotplug_read(void *opaque, hwaddr addr, return val; } +static void acpi_handle_insert(MemStatus *mdev) +{ + switch (mdev->ost_status) { + case ACPI_SUCCESS: + case ACPI_FAILURE: + case ACPI_UNRECOGNIZED_NOTIFY: + case ACPI_INSERT_DRIVER_LOAD_FAILURE: + case ACPI_INSERT_NOT_SUPPORTED: + case ACPI_INSERT_IN_PROGRESS: + default: + break; + } +} + static void acpi_handle_eject(MemStatus *mdev) { switch (mdev->ost_status) { @@ -121,6 +135,10 @@ static void acpi_handle_eject(MemStatus *mdev) static void acpi_handle_ost_event(MemStatus *mdev) { switch (mdev->ost_event) { + case ACPI_NOTIFY_DEVICE_CHECK: + case ACPI_OSPM_INSERT: + acpi_handle_insert(mdev); + break; case ACPI_NOTIFY_EJECT_REQUEST: /* Ejection triggered by hardware. */ case ACPI_OSPM_EJECT: /* Ejection triggered by guest OS. */ acpi_handle_eject(mdev); diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h index e8499f6..ad706d8 100644 --- a/include/hw/acpi/acpi.h +++ b/include/hw/acpi/acpi.h @@ -93,21 +93,29 @@ /* OST_EVENT */ #define ACPI_OSPM_EJECT 0x103 +#define ACPI_OSPM_INSERT 0x200 /* NOTIFY_EVENT */ #define ACPI_NOTIFY_DEVICE_CHECK 0x1 #define ACPI_NOTIFY_EJECT_REQUEST 0x3 -/* OST_STATUS */ +/* general processing OST_STATUS */ #define ACPI_SUCCESS 0x0 #define ACPI_FAILURE 0x1 #define ACPI_UNRECOGNIZED_NOTIFY 0x2 + +/* ejection processing OST_STATUS */ #define ACPI_EJECT_NOT_SUPPORTED 0x80 #define ACPI_EJECT_DEVICE_IN_USE 0x81 #define ACPI_EJECT_DEVICE_BUSY 0x82 #define ACPI_EJECT_DEPENDENCY_BUSY 0x83 #define ACPI_EJECT_IN_PROGRESS 0x84 +/* insertion processing OST_STATUS */ +#define ACPI_INSERT_IN_PROGRESS 0x80 +#define ACPI_INSERT_DRIVER_LOAD_FAILURE 0x81 +#define ACPI_INSERT_NOT_SUPPORTED 0x82 + /* structs */ typedef struct ACPIPMTimer ACPIPMTimer; typedef struct ACPIPM1EVT ACPIPM1EVT; -- 1.8.4.2