summary refs log tree commit diff stats
path: root/hw/acpi/generic_event_device.c
diff options
context:
space:
mode:
authorBibo Mao <maobibo@loongson.cn>2024-09-18 09:42:05 +0800
committerSong Gao <gaosong@loongson.cn>2024-10-16 15:56:42 +0800
commitedafc90ba481c586d0a649f34dcb8cd1f29c4259 (patch)
tree6e17abd047fc87b7ac54756eab4beb3736d8f222 /hw/acpi/generic_event_device.c
parentf774a677507966222624a9b2859f06ede7608100 (diff)
downloadfocaccia-qemu-edafc90ba481c586d0a649f34dcb8cd1f29c4259.tar.gz
focaccia-qemu-edafc90ba481c586d0a649f34dcb8cd1f29c4259.zip
acpi: ged: Add macro for acpi sleep control register
Macro definition is added for acpi sleep control register, ged emulation
driver can use the macro , also it can be used in FDT table if ged is
exposed with FDT table.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20240918014206.2165821-2-maobibo@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
Diffstat (limited to 'hw/acpi/generic_event_device.c')
-rw-r--r--hw/acpi/generic_event_device.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c
index 15b4c3ebbf..d00f5a6c1c 100644
--- a/hw/acpi/generic_event_device.c
+++ b/hw/acpi/generic_event_device.c
@@ -201,9 +201,9 @@ static void ged_regs_write(void *opaque, hwaddr addr, uint64_t data,
 
     switch (addr) {
     case ACPI_GED_REG_SLEEP_CTL:
-        slp_typ = (data >> 2) & 0x07;
-        slp_en  = (data >> 5) & 0x01;
-        if (slp_en && slp_typ == 5) {
+        slp_typ = (data >> ACPI_GED_SLP_TYP_POS) & ACPI_GED_SLP_TYP_MASK;
+        slp_en  = !!(data & ACPI_GED_SLP_EN);
+        if (slp_en && slp_typ == ACPI_GED_SLP_TYP_S5) {
             qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
         }
         return;