From patchwork Wed Jul 24 16:02:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 261464 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D33C72C008A for ; Thu, 25 Jul 2013 02:44:10 +1000 (EST) Received: from localhost ([::1]:34198 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V21XQ-0005St-UO for incoming@patchwork.ozlabs.org; Wed, 24 Jul 2013 12:03:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40556) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V21Ul-00029W-4M for qemu-devel@nongnu.org; Wed, 24 Jul 2013 12:01:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V21Ui-0002PM-9J for qemu-devel@nongnu.org; Wed, 24 Jul 2013 12:00:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50495) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V21Uh-0002PB-GI for qemu-devel@nongnu.org; Wed, 24 Jul 2013 12:00:52 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r6OG0nNo026307 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 24 Jul 2013 12:00:49 -0400 Received: from redhat.com (vpn-201-81.tlv.redhat.com [10.35.201.81]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id r6OG0kv5031230 for ; Wed, 24 Jul 2013 12:00:47 -0400 Date: Wed, 24 Jul 2013 19:02:09 +0300 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <1374681580-17439-11-git-send-email-mst@redhat.com> References: <1374681580-17439-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1374681580-17439-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 10/14] ich9: APIs for pc guest info 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 This adds APIs that will be used to fill in guest info table, implemented using QOM, to various ich9 components. Signed-off-by: Michael S. Tsirkin Reviewed-by: Gerd Hoffmann --- hw/acpi/ich9.c | 6 ++++++ hw/isa/lpc_ich9.c | 19 +++++++++++++++++++ hw/pci-host/q35.c | 10 ++++++++++ include/hw/acpi/ich9.h | 2 ++ include/hw/i386/ich9.h | 3 +++ include/hw/pci-host/q35.h | 2 ++ 6 files changed, 42 insertions(+) diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c index 3fb443d..7ea55e1 100644 --- a/hw/acpi/ich9.c +++ b/hw/acpi/ich9.c @@ -228,3 +228,9 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, pm->powerdown_notifier.notify = pm_powerdown_req; qemu_register_powerdown_notifier(&pm->powerdown_notifier); } + +void ich9_pm_get_acpi_pm_info(ICH9LPCPMRegs *pm, AcpiPmInfo *info) +{ + info->gpe0_blk = PC_GUEST_PORT_ACPI_PM_BASE + ICH9_PMIO_GPE0_STS; + info->gpe0_blk_len = ICH9_PMIO_GPE0_LEN; +} diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c index d1921aa..12d4a23 100644 --- a/hw/isa/lpc_ich9.c +++ b/hw/isa/lpc_ich9.c @@ -562,6 +562,25 @@ static bool ich9_rst_cnt_needed(void *opaque) return (lpc->rst_cnt != 0); } +ICH9LPCState *ich9_lpc_find(void) +{ + bool ambig; + Object *o = object_resolve_path_type("", TYPE_ICH9_LPC_DEVICE, &ambig); + + if (ambig) { + return NULL; + } + return ICH9_LPC_DEVICE(o); +} + +void ich9_lpc_get_acpi_pm_info(ICH9LPCState *lpc, AcpiPmInfo *info) +{ + info->sci_int = 9; + info->acpi_enable_cmd = ICH9_APM_ACPI_ENABLE; + info->acpi_disable_cmd = ICH9_APM_ACPI_DISABLE; + ich9_pm_get_acpi_pm_info(&lpc->pm, info); +} + static const VMStateDescription vmstate_ich9_rst_cnt = { .name = "ICH9LPC/rst_cnt", .version_id = 1, diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c index 6b1b3b7..ca6f495 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@ -298,6 +298,16 @@ static int mch_init(PCIDevice *d) return 0; } +uint64_t mch_mcfg_base(void) +{ + bool ambiguous; + Object *o = object_resolve_path_type("", TYPE_MCH_PCI_DEVICE, &ambiguous); + if (!o) { + return 0; + } + return MCH_HOST_BRIDGE_PCIEXBAR_DEFAULT; +} + static void mch_class_init(ObjectClass *klass, void *data) { PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h index b1fe71f..f5e8a88 100644 --- a/include/hw/acpi/ich9.h +++ b/include/hw/acpi/ich9.h @@ -49,4 +49,6 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, void ich9_pm_iospace_update(ICH9LPCPMRegs *pm, uint32_t pm_io_base); extern const VMStateDescription vmstate_ich9_pm; +void ich9_pm_get_acpi_pm_info(ICH9LPCPMRegs *, AcpiPmInfo *); + #endif /* HW_ACPI_ICH9_H */ diff --git a/include/hw/i386/ich9.h b/include/hw/i386/ich9.h index c5f637b..6528dc0 100644 --- a/include/hw/i386/ich9.h +++ b/include/hw/i386/ich9.h @@ -66,6 +66,9 @@ typedef struct ICH9LPCState { qemu_irq *ioapic; } ICH9LPCState; +ICH9LPCState *ich9_lpc_find(void); +void ich9_lpc_get_acpi_pm_info(ICH9LPCState *, AcpiPmInfo *); + #define Q35_MASK(bit, ms_bit, ls_bit) \ ((uint##bit##_t)(((1ULL << ((ms_bit) + 1)) - 1) & ~((1ULL << ls_bit) - 1))) diff --git a/include/hw/pci-host/q35.h b/include/hw/pci-host/q35.h index 3cb631e..6337dcf 100644 --- a/include/hw/pci-host/q35.h +++ b/include/hw/pci-host/q35.h @@ -154,4 +154,6 @@ typedef struct Q35PCIHost { #define MCH_PCIE_DEV 1 #define MCH_PCIE_FUNC 0 +uint64_t mch_mcfg_base(void); + #endif /* HW_Q35_H */