From c96d9286a6d70452e5fa4f1e3f840715e325be95 Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Thu, 11 Jun 2015 02:37:58 +0200 Subject: i386/acpi-build: more traditional _UID and _HID for PXB root buses The ACPI specification permits the _HID and _UID objects to evaluate to strings. (See "6.1.5 _HID (Hardware ID)" and "6.1.12 _UID (Unique ID)" in the ACPI v6.0 spec.) With regard to related standards, the UEFI specification can also express a device address composed from string _HID and _UID identifiers, inside the Expanded ACPI Device Path Node. (See "9.3.3 ACPI Device Path", Table 49, in the UEFI v2.5 spec.) However, numeric (integer) contents for both _HID and _UID are more traditional. They are recommended by the UEFI spec for size reasons: [...] the ACPI Device Path node is smaller and should be used if possible to reduce the size of device paths that may potentially be stored in nonvolatile storage [...] External tools support them better (for example the --acpi_hid and --acpi_uid options of "efibootmgr" only take numeric identifiers). Finally, numeric _HID and _UID contents are existing practice in the QEMU source. This patch was tested with a Fedora 20 LiveCD and a preexistent Windows Server 2012 R2 guest. Using "acpidump" and "iasl" in the Fedora guest, we get, in the SSDT: > Scope (\_SB) > { > Device (PC04) > { > Name (_UID, 0x04) // _UID: Unique ID > Name (_HID, EisaId ("PNP0A03") /* PCI Bus */) // _HID: Hardware ID Cc: Marcel Apfelbaum Cc: Michael S. Tsirkin Signed-off-by: Laszlo Ersek Reviewed-by: Marcel Apfelbaum Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'hw/i386') diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index db32fd1..8fae3b9 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -944,9 +944,8 @@ build_ssdt(GArray *table_data, GArray *linker, scope = aml_scope("\\_SB"); dev = aml_device("PC%.02X", bus_num); - aml_append(dev, - aml_name_decl("_UID", aml_string("PC%.02X", bus_num))); - aml_append(dev, aml_name_decl("_HID", aml_string("PNP0A03"))); + aml_append(dev, aml_name_decl("_UID", aml_int(bus_num))); + aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A03"))); aml_append(dev, aml_name_decl("_BBN", aml_int(bus_num))); if (numa_node != NUMA_NODE_UNASSIGNED) { -- cgit v1.1 From 4ebc736e9938a7e88ecc785734b17145bf802a56 Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Thu, 11 Jun 2015 02:37:59 +0200 Subject: i386/acpi-build: fix PXB workarounds for unsupported BIOSes The patch apci: fix PXB behaviour if used with unsupported BIOS uses the following condition to see if a "PXB mem/IO chunk" has *not* been configured by the BIOS: (!range_base || range_base > range_limit) When this condition evaluates to true, said patch *omits* the corresponding entry from the _CRS. Later on the patch checks for the opposite condition (with the intent of *adding* entries to the _CRS if the "PXB mem/IO chunks" *have* been configured). Unfortunately, the condition was negated incorrectly: only the first ! operator was removed, which led to the nonsensical expression (range_base || range_base > range_limit) leading to bogus entries in the _CRS, and causing BSOD in Windows Server 2012 R2 when it runs on OVMF. The correct negative of the condition seen at the top is (range_base && range_base <= range_limit) Fix the expressions. Cc: Marcel Apfelbaum Cc: Michael S. Tsirkin Signed-off-by: Laszlo Ersek Reviewed-by: Marcel Apfelbaum Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'hw/i386') diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 8fae3b9..8e88ade 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -832,7 +832,7 @@ static Aml *build_crs(PCIHostState *host, * Work-around for old bioses * that do not support multiple root buses */ - if (range_base || range_base > range_limit) { + if (range_base && range_base <= range_limit) { aml_append(crs, aml_word_io(AML_MIN_FIXED, AML_MAX_FIXED, AML_POS_DECODE, AML_ENTIRE_RANGE, @@ -853,7 +853,7 @@ static Aml *build_crs(PCIHostState *host, * Work-around for old bioses * that do not support multiple root buses */ - if (range_base || range_base > range_limit) { + if (range_base && range_base <= range_limit) { aml_append(crs, aml_dword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED, AML_NON_CACHEABLE, @@ -864,7 +864,7 @@ static Aml *build_crs(PCIHostState *host, 0, range_limit - range_base + 1)); crs_range_insert(mem_ranges, range_base, range_limit); - } + } range_base = pci_bridge_get_base(dev, PCI_BASE_ADDRESS_MEM_PREFETCH); @@ -875,7 +875,7 @@ static Aml *build_crs(PCIHostState *host, * Work-around for old bioses * that do not support multiple root buses */ - if (range_base || range_base > range_limit) { + if (range_base && range_base <= range_limit) { aml_append(crs, aml_dword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED, AML_NON_CACHEABLE, -- cgit v1.1