From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48920) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YEJ6u-00044A-CH for qemu-devel@nongnu.org; Thu, 22 Jan 2015 09:52:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YEJ6m-0003nt-Q0 for qemu-devel@nongnu.org; Thu, 22 Jan 2015 09:51:52 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48449) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YEJ6l-0003nG-VD for qemu-devel@nongnu.org; Thu, 22 Jan 2015 09:51:44 -0500 From: Igor Mammedov Date: Thu, 22 Jan 2015 14:50:24 +0000 Message-Id: <1421938231-25698-41-git-send-email-imammedo@redhat.com> In-Reply-To: <1421938231-25698-1-git-send-email-imammedo@redhat.com> References: <1421938231-25698-1-git-send-email-imammedo@redhat.com> Subject: [Qemu-devel] [PATCH v2 40/47] pc: acpi-build: reserve PCIHP MMIO resources List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, drjones@redhat.com, marcel.a@redhat.com, claudio.fontana@huawei.com, mst@redhat.com Signed-off-by: Igor Mammedov --- hw/i386/acpi-build.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index b26bc6d..a09bf28 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -105,6 +105,8 @@ typedef struct AcpiPmInfo { uint16_t cpu_hp_io_len; uint16_t mem_hp_io_base; uint16_t mem_hp_io_len; + uint16_t pcihp_io_base; + uint16_t pcihp_io_len; } AcpiPmInfo; typedef struct AcpiMiscInfo { @@ -182,6 +184,10 @@ static void acpi_get_pm_info(AcpiPmInfo *pm) if (piix) { obj = piix; pm->cpu_hp_io_base = PIIX4_CPU_HOTPLUG_IO_BASE; + pm->pcihp_io_base = + object_property_get_int(obj, ACPI_PCIHP_IO_BASE_PROP, NULL); + pm->pcihp_io_len = + object_property_get_int(obj, ACPI_PCIHP_IO_LEN_PROP, NULL); } if (lpc) { obj = lpc; @@ -700,6 +706,25 @@ build_ssdt(GArray *table_data, GArray *linker, patch_pci_windows(pci, ssdt_ptr, sizeof(ssdp_misc_aml)); + scope = acpi_scope("\\_SB.PCI0"); + /* reserve PCIHP resources */ + if (pm->pcihp_io_len) { + dev = acpi_device("PHPR"); + aml_append(&dev, acpi_name_decl("_HID", acpi_string("PNP0A06"))); + aml_append(&dev, + acpi_name_decl("_UID", acpi_string("PCI Hotplug resources"))); + /* device present, functioning, decoding, not shown in UI */ + aml_append(&dev, acpi_name_decl("_STA", acpi_int(0xB))); + crs = acpi_resource_template(); + aml_append(&crs, + acpi_io(acpi_decode16, pm->pcihp_io_base, pm->pcihp_io_base, + 1, pm->pcihp_io_len) + ); + aml_append(&dev, acpi_name_decl("_CRS", crs)); + aml_append(&scope, dev); + } + aml_append(&table_aml, scope); + /* create S3_ / S4_ / S5_ packages if necessary */ scope = acpi_scope("\\"); if (!pm->s3_disabled) { -- 1.8.3.1