From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40801) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a4Ucf-0004fd-7r for qemu-devel@nongnu.org; Thu, 03 Dec 2015 09:12:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a4Uce-0007MZ-Dh for qemu-devel@nongnu.org; Thu, 03 Dec 2015 09:12:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40388) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a4Uce-0007MO-9E for qemu-devel@nongnu.org; Thu, 03 Dec 2015 09:12:36 -0500 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 (Postfix) with ESMTPS id DAAEC4C503 for ; Thu, 3 Dec 2015 14:12:35 +0000 (UTC) From: Eduardo Habkost Date: Wed, 2 Dec 2015 20:22:53 -0200 Message-Id: <1449094978-22986-9-git-send-email-ehabkost@redhat.com> In-Reply-To: <1449094978-22986-1-git-send-email-ehabkost@redhat.com> References: <1449094978-22986-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [PATCH 08/13] acpi: Always try to init PCI hotplug I/O base List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Igor Mammedov , Marcel Apfelbaum , "Michael S. Tsirkin" Instead of making pcihp_io_base/pcihp_io_len initialization specific to piix4, just check if ACPI_PCIHP_IO_BASE_PROP property is present. No behavior is changed, as only piix4 initializes the ACPI_PCIHP_IO_BASE_PROP property today. Signed-off-by: Eduardo Habkost --- hw/i386/acpi-build.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 6774ced..617cd53 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -141,6 +141,11 @@ static void acpi_get_cpu_info(AcpiCpuInfo *cpu) object_child_foreach(root, acpi_add_cpu_info, cpu); } +static bool acpi_pci_hotplug_enabled(Object *acpi_dev) +{ + return object_property_find(acpi_dev, ACPI_PCIHP_IO_BASE_PROP, NULL); +} + static void acpi_get_pm_info(AcpiPmInfo *pm) { Object *piix = piix4_pm_find(); @@ -151,6 +156,13 @@ static void acpi_get_pm_info(AcpiPmInfo *pm) pm->pcihp_io_len = 0; if (piix) { obj = piix; + } + if (lpc) { + obj = lpc; + } + assert(obj); + + if (acpi_pci_hotplug_enabled(obj)) { pm->pcihp_io_base = object_property_get_int(obj, ACPI_PCIHP_IO_BASE_PROP, &error_abort); @@ -158,10 +170,6 @@ static void acpi_get_pm_info(AcpiPmInfo *pm) object_property_get_int(obj, ACPI_PCIHP_IO_LEN_PROP, &error_abort); } - if (lpc) { - obj = lpc; - } - assert(obj); pm->cpu_hp_io_base = object_property_get_int(obj, ACPI_CPUHP_IO_BASE_PROP, &error_abort); -- 2.1.0