summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/AcpiPlatformDxe
diff options
context:
space:
mode:
authorVolker RĂ¼melin <vr_qemu@t-online.de>2016-04-18 21:51:30 +0200
committerLaszlo Ersek <lersek@redhat.com>2016-04-19 13:18:34 +0200
commit90bb4c577d055e7ac6f0488b21885f65617eec82 (patch)
tree9e323c6ed89d7d4260b11f04c3af8a7bc33cf248 /OvmfPkg/AcpiPlatformDxe
parent61ee1dff160dabbb0855d56c925985030af702bc (diff)
downloadedk2-90bb4c577d055e7ac6f0488b21885f65617eec82.tar.gz
edk2-90bb4c577d055e7ac6f0488b21885f65617eec82.tar.bz2
edk2-90bb4c577d055e7ac6f0488b21885f65617eec82.zip
OvmfPkg: AcpiPlatformDxe: Don't enable unsupported PCI attributes
Current code in PciEnableDecoding tries to unconditionally enable EFI_PCI_IO_ATTRIBUTE_IO and EFI_PCI_IO_ATTRIBUTE_MEMORY even if they are unsupported attributes. This fails on devices which don't support both attributes. This patch masks out unsupported attributes. Information to reproduce the bug. Host lspci -s 0000:04:00.0 -vnn: 04:00.0 USB controller [0c03]: Renesas Technology Corp. uPD720201 USB 3.0 Host Controller [1912:0014] (rev 03) (prog-if 30 [XHCI]) Flags: fast devsel, IRQ 19 Memory at ef900000 (64-bit, non-prefetchable) [size=8K] Capabilities: [50] Power Management version 3 Capabilities: [70] MSI: Enable- Count=1/8 Maskable- 64bit+ Capabilities: [90] MSI-X: Enable- Count=8 Masked- Capabilities: [a0] Express Endpoint, MSI 00 Capabilities: [100] Advanced Error Reporting Capabilities: [150] Latency Tolerance Reporting Kernel driver in use: pci-stub Kernel modules: xhci_pci libvirt xml: <hostdev mode='subsystem' type='pci' managed='yes'> <driver name='vfio'/> <source> <address domain='0x0000' bus='0x04' slot='0x00' function='0'/> </source> <address type='pci' domain='0x0000' bus='0x00' slot='0x11' function='0'/> </hostdev> OVMF debug log with additional DEBUG statement: OnRootBridgesConnected: root bridges have been connected, installing ACPI tables Select Item: 0x19 EnablePciDecoding: GetLocation: D=0000:00:00.0 OrigAttr=0000000000004000 SuppAttr=000000000000E700 EnablePciDecoding: GetLocation: D=0000:00:10.0 OrigAttr=0000000000004000 SuppAttr=000000000000E700 EnablePciDecoding: GetLocation: D=0000:00:11.0 OrigAttr=0000000000004000 SuppAttr=000000000000E600 EnablePciDecoding: EfiPciIoAttributeOperationEnable: Unsupported Select Item: 0x28 Select Item: 0x19 Select Item: 0x2A Select Item: 0x19 Select Item: 0x27 InstallQemuFwCfgTables: installed 6 tables Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Volker RĂ¼melin <vr_qemu@t-online.de> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Laszlo Ersek <lersek@redhat.com>
Diffstat (limited to 'OvmfPkg/AcpiPlatformDxe')
-rw-r--r--OvmfPkg/AcpiPlatformDxe/PciDecoding.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/OvmfPkg/AcpiPlatformDxe/PciDecoding.c b/OvmfPkg/AcpiPlatformDxe/PciDecoding.c
index 3b9b12ccc8..d63b57e701 100644
--- a/OvmfPkg/AcpiPlatformDxe/PciDecoding.c
+++ b/OvmfPkg/AcpiPlatformDxe/PciDecoding.c
@@ -89,6 +89,7 @@ EnablePciDecoding (
for (Idx = 0; Idx < NoHandles; ++Idx) {
EFI_PCI_IO_PROTOCOL *PciIo;
+ UINT64 Attributes;
//
// Look up PciIo on the handle and stash it
@@ -110,11 +111,22 @@ EnablePciDecoding (
}
//
+ // Retrieve supported attributes
+ //
+ Status = PciIo->Attributes (PciIo, EfiPciIoAttributeOperationSupported, 0,
+ &Attributes);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_WARN, "%a: EfiPciIoAttributeOperationSupported: %r\n",
+ __FUNCTION__, Status));
+ goto RestoreAttributes;
+ }
+
+ //
// Enable IO and MMIO decoding
//
+ Attributes &= EFI_PCI_IO_ATTRIBUTE_IO | EFI_PCI_IO_ATTRIBUTE_MEMORY;
Status = PciIo->Attributes (PciIo, EfiPciIoAttributeOperationEnable,
- EFI_PCI_IO_ATTRIBUTE_IO | EFI_PCI_IO_ATTRIBUTE_MEMORY,
- NULL);
+ Attributes, NULL);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_WARN, "%a: EfiPciIoAttributeOperationEnable: %r\n",
__FUNCTION__, Status));