Received: from eggs.gnu.org ([2001:4830:134:3::10]:37029) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkQih-00026Y-I8 for qemu-devel@nongnu.org; Wed, 05 Jun 2013 23:18:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UkQig-0004AD-Ij for qemu-devel@nongnu.org; Wed, 05 Jun 2013 23:18:35 -0400 Received: from [222.73.24.84] (port=30254 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkQig-00049h-7v for qemu-devel@nongnu.org; Wed, 05 Jun 2013 23:18:34 -0400 From: liguang Date: Thu, 6 Jun 2013 11:16:57 +0800 Message-Id: <1370488621-6915-5-git-send-email-lig.fnst@cn.fujitsu.com> In-Reply-To: <1370488621-6915-1-git-send-email-lig.fnst@cn.fujitsu.com> References: <1370488621-6915-1-git-send-email-lig.fnst@cn.fujitsu.com> Subject: [Qemu-devel] [PATCH RFC v2 4/8] piix4: add notifer for ec to generate sci List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: Kevin Wolf , Alexander Graf , Anthony Liguori , Stefan Berger , "Michael S. Tsirkin" , qemu-devel@nongnu.org, Christian Borntraeger , Markus Armbruster , Joel Schopp , Gerd Hoffmann , Paolo Bonzini , Luiz Capitulino , Laszlo Ersek , =?UTF-8?q?Andreas=20F=C3=A4rber?= , liguang , Isaku Yamahata Signed-off-by: liguang --- hw/acpi/piix4.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) 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) -- 1.7.2.5