This adds support to use GED for system power down event. Signed-off-by: Shameer Kolothum <shameerali.kolothum.th...@huawei.com> Reviewed-by: Eric Auger <eric.au...@redhat.com> --- hw/acpi/generic_event_device.c | 6 ++++++ include/hw/acpi/generic_event_device.h | 3 +++ 2 files changed, 9 insertions(+)
diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c index 7902e9d706..0b3214eff4 100644 --- a/hw/acpi/generic_event_device.c +++ b/hw/acpi/generic_event_device.c @@ -19,6 +19,7 @@ static const uint32_t ged_supported_events[] = { ACPI_GED_MEM_HOTPLUG_EVT, + ACPI_GED_PWR_DOWN_EVT, }; /* @@ -103,6 +104,11 @@ void build_ged_aml(Aml *table, const char *name, HotplugHandler *hotplug_dev, aml_append(if_ctx, aml_call0(MEMORY_DEVICES_CONTAINER "." MEMORY_SLOT_SCAN_METHOD)); break; + case ACPI_GED_PWR_DOWN_EVT: + aml_append(if_ctx, + aml_notify(aml_name(ACPI_POWER_BUTTON_DEVICE), + aml_int(0x80))); + break; default: /* * Please make sure all the events in ged_supported_events[] diff --git a/include/hw/acpi/generic_event_device.h b/include/hw/acpi/generic_event_device.h index f0152b0018..63104f1344 100644 --- a/include/hw/acpi/generic_event_device.h +++ b/include/hw/acpi/generic_event_device.h @@ -61,6 +61,8 @@ #include "hw/acpi/memory_hotplug.h" +#define ACPI_POWER_BUTTON_DEVICE "PWRB" + #define TYPE_ACPI_GED "acpi-ged" #define ACPI_GED(obj) \ OBJECT_CHECK(AcpiGedState, (obj), TYPE_ACPI_GED) @@ -78,6 +80,7 @@ * through GED. */ #define ACPI_GED_MEM_HOTPLUG_EVT 0x1 +#define ACPI_GED_PWR_DOWN_EVT 0x2 typedef struct GEDState { MemoryRegion io; -- 2.17.1