From patchwork Tue Jan 19 13:06:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Mammedov X-Patchwork-Id: 8061351 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7CDD0BEEE5 for ; Tue, 19 Jan 2016 13:06:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8F33120397 for ; Tue, 19 Jan 2016 13:06:49 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9965520392 for ; Tue, 19 Jan 2016 13:06:48 +0000 (UTC) Received: from localhost ([::1]:36833 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLVzj-0001iC-U3 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 19 Jan 2016 08:06:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38767) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLVzY-0001hr-Vj for qemu-devel@nongnu.org; Tue, 19 Jan 2016 08:06:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLVzX-0005Rq-5V for qemu-devel@nongnu.org; Tue, 19 Jan 2016 08:06:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49608) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLVzW-0005Rl-UQ for qemu-devel@nongnu.org; Tue, 19 Jan 2016 08:06:35 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id A489D8D3B5 for ; Tue, 19 Jan 2016 13:06:34 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0JD6Ub7020252; Tue, 19 Jan 2016 08:06:33 -0500 From: Igor Mammedov To: qemu-devel@nongnu.org Date: Tue, 19 Jan 2016 14:06:21 +0100 Message-Id: <1453208789-42479-2-git-send-email-imammedo@redhat.com> In-Reply-To: <1453208789-42479-1-git-send-email-imammedo@redhat.com> References: <1453208789-42479-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: ehabkost@redhat.com, mst@redhat.com, ghammer@redhat.com, lcapitulino@redhat.com, pbonzini@redhat.com, lersek@redhat.com Subject: [Qemu-devel] [PATCH v17 1/9] acpi: extend ACPI interface to provide access to ACPI registers and SCI irq 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP so that we don't have to always add proxy wrappers in piix4pm/ich9 to access ACPI regs and SCI kept in piix4pm/lcp_ich9 devices and call acpi_foo() API directly. Signed-off-by: Igor Mammedov --- hw/acpi/piix4.c | 17 +++++++++++++++++ hw/isa/lpc_ich9.c | 16 ++++++++++++++++ hw/isa/vt82c686.c | 19 +++++++++++++++++++ include/hw/acpi/acpi_dev_interface.h | 9 +++++++++ 4 files changed, 61 insertions(+) diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c index 2cd2fee..5e29be4 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -583,6 +583,21 @@ static void piix4_ospm_status(AcpiDeviceIf *adev, ACPIOSTInfoList ***list) acpi_memory_ospm_status(&s->acpi_memory_hotplug, list); } +static ACPIREGS *piix4_acpi_regs(AcpiDeviceIf *adev) +{ + PIIX4PMState *s = PIIX4_PM(adev); + + return &s->ar; +} + +static qemu_irq piix4_acpi_irq(AcpiDeviceIf *adev) +{ + PIIX4PMState *s = PIIX4_PM(adev); + + return s->irq; +} + + static Property piix4_pm_properties[] = { DEFINE_PROP_UINT32("smb_io_base", PIIX4PMState, smb_io_base, 0), DEFINE_PROP_UINT8(ACPI_PM_PROP_S3_DISABLED, PIIX4PMState, disable_s3, 0), @@ -621,6 +636,8 @@ static void piix4_pm_class_init(ObjectClass *klass, void *data) hc->unplug_request = piix4_device_unplug_request_cb; hc->unplug = piix4_device_unplug_cb; adevc->ospm_status = piix4_ospm_status; + adevc->regs = piix4_acpi_regs; + adevc->sci = piix4_acpi_irq; } static const TypeInfo piix4_pm_info = { diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c index ed9907d..9d60caa 100644 --- a/hw/isa/lpc_ich9.c +++ b/hw/isa/lpc_ich9.c @@ -700,6 +700,20 @@ static Property ich9_lpc_properties[] = { DEFINE_PROP_END_OF_LIST(), }; +static ACPIREGS *ich9_acpi_regs(AcpiDeviceIf *adev) +{ + ICH9LPCState *s = ICH9_LPC_DEVICE(adev); + + return &s->pm.acpi_regs; +} + +static qemu_irq ich9_acpi_irq(AcpiDeviceIf *adev) +{ + ICH9LPCState *s = ICH9_LPC_DEVICE(adev); + + return s->pm.irq; +} + static void ich9_lpc_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); @@ -727,6 +741,8 @@ static void ich9_lpc_class_init(ObjectClass *klass, void *data) hc->unplug_request = ich9_device_unplug_request_cb; hc->unplug = ich9_device_unplug_cb; adevc->ospm_status = ich9_pm_ospm_status; + adevc->regs = ich9_acpi_regs; + adevc->sci = ich9_acpi_irq; } static const TypeInfo ich9_lpc_info = { diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index 6c2190b..58707d4 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -391,6 +391,18 @@ I2CBus *vt82c686b_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base, return s->smb.smbus; } +static ACPIREGS *via_pm_acpi_regs(AcpiDeviceIf *adev) +{ + VT686PMState *s = VT82C686B_PM_DEVICE(adev); + + return &s->ar; +} + +static qemu_irq via_pm_acpi_irq(AcpiDeviceIf *adev) +{ + return NULL; +} + static Property via_pm_properties[] = { DEFINE_PROP_UINT32("smb_io_base", VT686PMState, smb_io_base, 0), DEFINE_PROP_END_OF_LIST(), @@ -400,6 +412,7 @@ static void via_pm_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); + AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_CLASS(klass); k->realize = vt82c686b_pm_realize; k->config_write = pm_write_config; @@ -411,6 +424,8 @@ static void via_pm_class_init(ObjectClass *klass, void *data) dc->vmsd = &vmstate_acpi; set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); dc->props = via_pm_properties; + adevc->regs = via_pm_acpi_regs; + adevc->sci = via_pm_acpi_irq; } static const TypeInfo via_pm_info = { @@ -418,6 +433,10 @@ static const TypeInfo via_pm_info = { .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(VT686PMState), .class_init = via_pm_class_init, + .interfaces = (InterfaceInfo[]) { + { TYPE_ACPI_DEVICE_IF }, + { } + }, }; static const VMStateDescription vmstate_via = { diff --git a/include/hw/acpi/acpi_dev_interface.h b/include/hw/acpi/acpi_dev_interface.h index f245f8d..e3f1bad 100644 --- a/include/hw/acpi/acpi_dev_interface.h +++ b/include/hw/acpi/acpi_dev_interface.h @@ -3,6 +3,9 @@ #include "qom/object.h" #include "qapi-types.h" +#include "hw/irq.h" + +typedef struct ACPIREGS ACPIREGS; #define TYPE_ACPI_DEVICE_IF "acpi-device-interface" @@ -28,6 +31,10 @@ typedef struct AcpiDeviceIf { * ospm_status: returns status of ACPI device objects, reported * via _OST method if device supports it. * + * regs: returns pointer to ACPI registers block + * + * sci: return pointer to IRQ object associated with SCI + * * Interface is designed for providing unified interface * to generic ACPI functionality that could be used without * knowledge about internals of actual device that implements @@ -39,5 +46,7 @@ typedef struct AcpiDeviceIfClass { /* */ void (*ospm_status)(AcpiDeviceIf *adev, ACPIOSTInfoList ***list); + ACPIREGS *(*regs)(AcpiDeviceIf *adev); + qemu_irq (*sci)(AcpiDeviceIf *adev); } AcpiDeviceIfClass; #endif