diff mbox

[RFC,v1,1/4] Use macro to define ACPI notification event.

Message ID 1409126988-22287-2-git-send-email-tangchen@cn.fujitsu.com
State New
Headers show

Commit Message

Tang Chen Aug. 27, 2014, 8:09 a.m. UTC
According to ACPI spec, device object notification values define insertion
request (Device Check) as 1, and ejection request as 3.

Use macro to define them.

Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
---
 hw/acpi/memory_hotplug.c | 7 +++++--
 include/hw/acpi/acpi.h   | 5 ++++-
 2 files changed, 9 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c
index f29715a..1b21191 100644
--- a/hw/acpi/memory_hotplug.c
+++ b/hw/acpi/memory_hotplug.c
@@ -155,10 +155,13 @@  static void acpi_memory_hotplug_write(void *opaque, hwaddr addr, uint64_t data,
         break;
     case 0x4: /* _OST event  */
         mdev = &mem_st->devs[mem_st->selector];
-        if (data == 1) {
+        switch (data) {
+        case ACPI_NOTIFY_DEVICE_CHECK:
             /* TODO: handle device insert OST event */
-        } else if (data == 3) {
+            break;
+        case ACPI_NOTIFY_EJECT_REQUEST:
             /* TODO: handle device remove OST event */
+            break;
         }
         mdev->ost_event = data;
         trace_mhp_acpi_write_ost_ev(mem_st->selector, mdev->ost_event);
diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h
index e105e45..e8499f6 100644
--- a/include/hw/acpi/acpi.h
+++ b/include/hw/acpi/acpi.h
@@ -92,9 +92,12 @@ 
 #define ACPI_BITMASK_ARB_DISABLE                0x0001
 
 /* OST_EVENT */
-#define ACPI_NOTIFY_EJECT_REQUEST               0x03
 #define ACPI_OSPM_EJECT                         0x103
 
+/* NOTIFY_EVENT */
+#define ACPI_NOTIFY_DEVICE_CHECK                0x1
+#define ACPI_NOTIFY_EJECT_REQUEST               0x3
+
 /* OST_STATUS */
 #define ACPI_SUCCESS                            0x0
 #define ACPI_FAILURE                            0x1