diff mbox

[RFC,v2,4/8] piix4: add notifer for ec to generate sci

Message ID 1370488621-6915-5-git-send-email-lig.fnst@cn.fujitsu.com
State New
Headers show

Commit Message

liguang June 6, 2013, 3:16 a.m. UTC
Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
---
 hw/acpi/piix4.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index e6525ac..aae1c88 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -29,6 +29,7 @@ 
 #include "exec/ioport.h"
 #include "hw/nvram/fw_cfg.h"
 #include "exec/address-spaces.h"
+#include "hw/acpi/ec.h"
 
 //#define DEBUG
 
@@ -53,6 +54,7 @@ 
 
 #define PIIX4_PCI_HOTPLUG_STATUS 2
 #define PIIX4_CPU_HOTPLUG_STATUS 4
+#define GPE_EC_SCI_STATUS 8
 
 struct pci_status {
     uint32_t up; /* deprecated, maintained for migration compatibility */
@@ -94,6 +96,7 @@  typedef struct PIIX4PMState {
 
     CPUStatus gpe_cpu;
     Notifier cpu_added_notifier;
+    Notifier ec_sci_notifier;
 } PIIX4PMState;
 
 static void piix4_acpi_system_hot_add_init(MemoryRegion *parent,
@@ -622,6 +625,15 @@  static const MemoryRegionOps cpu_hotplug_ops = {
     },
 };
 
+static void pm_ec_sci_req(Notifier *n, void *opaque)
+{
+    PIIX4PMState *s = container_of(n, PIIX4PMState, ec_sci_notifier);
+    ACPIGPE *gpe = &s->ar.gpe;
+
+    *gpe->sts |= GPE_EC_SCI_STATUS;
+    pm_update_sci(s);
+}
+
 typedef enum {
     PLUG,
     UNPLUG,
@@ -686,6 +698,8 @@  static void piix4_acpi_system_hot_add_init(MemoryRegion *parent,
     memory_region_add_subregion(parent, PIIX4_PROC_BASE, &s->io_cpu);
     s->cpu_added_notifier.notify = piix4_cpu_added_req;
     qemu_register_cpu_added_notifier(&s->cpu_added_notifier);
+    s->ec_sci_notifier.notify = pm_ec_sci_req;
+    qemu_register_ec_sci_notifier(&s->ec_sci_notifier);
 }
 
 static void enable_device(PIIX4PMState *s, int slot)