From patchwork Wed May 29 01:47:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liguang X-Patchwork-Id: 247089 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 75F542C033F for ; Wed, 29 May 2013 12:01:03 +1000 (EST) Received: from localhost ([::1]:36379 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UhVhF-00042J-NH for incoming@patchwork.ozlabs.org; Tue, 28 May 2013 22:01:01 -0400 Received: from eggs.gnu.org ([208.118.235.92]:44462) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UhVgb-00041x-G3 for qemu-devel@nongnu.org; Tue, 28 May 2013 22:00:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UhVgW-0007GT-R7 for qemu-devel@nongnu.org; Tue, 28 May 2013 22:00:21 -0400 Received: from [222.73.24.84] (port=20154 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UhVgW-0007G9-Ge for qemu-devel@nongnu.org; Tue, 28 May 2013 22:00:16 -0400 X-IronPort-AV: E=Sophos;i="4.87,762,1363104000"; d="scan'208";a="7396034" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 29 May 2013 09:57:23 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id r4T1nPrt025488; Wed, 29 May 2013 09:49:26 +0800 Received: from liguang.fnst.cn.fujitsu.com ([10.167.233.147]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2013052909475660-1617895 ; Wed, 29 May 2013 09:47:56 +0800 From: liguang To: qemu-devel@nongnu.org Date: Wed, 29 May 2013 09:47:37 +0800 Message-Id: <1369792062-14269-3-git-send-email-lig.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1369792062-14269-1-git-send-email-lig.fnst@cn.fujitsu.com> References: <1369792062-14269-1-git-send-email-lig.fnst@cn.fujitsu.com> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/05/29 09:47:56, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/05/29 09:48:03, Serialize complete at 2013/05/29 09:48:03 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 222.73.24.84 Cc: Kevin Wolf , Anthony Liguori , Juan Quintela , Stefan Berger , "Michael S. Tsirkin" , Markus Armbruster , Christian Borntraeger , Alexander Graf , Joel Schopp , Gerd Hoffmann , Igor Mammedov , Paolo Bonzini , Luiz Capitulino , =?UTF-8?q?Andreas=20F=C3=A4rber?= , liguang , Isaku Yamahata Subject: [Qemu-devel] [PATCH RFC 2/7] ich9: add notifer for ec to generate sci X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: liguang --- hw/acpi/ich9.c | 15 +++++++++++++++ include/hw/acpi/ich9.h | 1 + 2 files changed, 16 insertions(+), 0 deletions(-) diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c index 4a17f32..f1583ef 100644 --- a/hw/acpi/ich9.c +++ b/hw/acpi/ich9.c @@ -33,6 +33,7 @@ #include "exec/address-spaces.h" #include "hw/i386/ich9.h" +#include "hw/acpi/ec.h" //#define DEBUG @@ -43,6 +44,8 @@ do { printf("%s "fmt, __func__, ## __VA_ARGS__); } while (0) #define ICH9_DEBUG(fmt, ...) do { } while (0) #endif +#define GPE_EC_SCI_STATUS 8 + static void pm_update_sci(ICH9LPCPMRegs *pm) { int sci_level, pm1a_sts; @@ -202,6 +205,15 @@ static void pm_powerdown_req(Notifier *n, void *opaque) acpi_pm1_evt_power_down(&pm->acpi_regs); } +static void pm_ec_sci_req(Notifier *n, void *opaque) +{ + ICH9LPCPMRegs *pm = container_of(n, ICH9LPCPMRegs, ec_sci_notifier); + ACPIGPE *gpe = &pm->acpi_regs.gpe; + + *gpe->sts |= GPE_EC_SCI_STATUS; + pm_update_sci(pm); +} + void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, qemu_irq sci_irq) { @@ -227,4 +239,7 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, qemu_register_reset(pm_reset, pm); pm->powerdown_notifier.notify = pm_powerdown_req; qemu_register_powerdown_notifier(&pm->powerdown_notifier); + + pm->ec_sci_notifier.notify = pm_ec_sci_req; + qemu_register_ec_sci_notifier(&pm->ec_sci_notifier); } diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h index b1fe71f..f358deb 100644 --- a/include/hw/acpi/ich9.h +++ b/include/hw/acpi/ich9.h @@ -42,6 +42,7 @@ typedef struct ICH9LPCPMRegs { uint32_t pm_io_base; Notifier powerdown_notifier; + Notifier ec_sci_notifier; } ICH9LPCPMRegs; void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm,