]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/PciHostBridgeLib: remove Bhyve and Xen support
authorLaszlo Ersek <lersek@redhat.com>
Wed, 26 May 2021 20:14:35 +0000 (22:14 +0200)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 4 Jun 2021 16:01:50 +0000 (16:01 +0000)
The "OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf" instance is
used by the following platforms in edk2:

  OvmfPkg/AmdSev/AmdSevX64.dsc
  OvmfPkg/OvmfPkgIa32.dsc
  OvmfPkg/OvmfPkgIa32X64.dsc
  OvmfPkg/OvmfPkgX64.dsc

All these platforms statically inherit PcdPciDisableBusEnumeration=FALSE
from "MdeModulePkg.dec". Remove the the PCD and everything that depends on
it from the PciHostBridgeLib instance. Namely, remove the logic that
determines the root bridge apertures by (a) scanning the entire bus,
device and function number space, and (b) parsing the BAR values that were
pre-set by the Bhyve or Xen machinery.

"XenSupport.c" used to be listed explicitly in "Maintainers.txt", remove
it from that spot too.

Cc: Andrew Fish <afish@apple.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20210526201446.12554-33-lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
Maintainers.txt
OvmfPkg/Library/PciHostBridgeLib/PciHostBridge.h [deleted file]
OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
OvmfPkg/Library/PciHostBridgeLib/XenSupport.c [deleted file]

index e0c3472b4b72cf7cc7f104e328633ca088ece3ea..0a98227587c504bbc471cfb96ca850d5a8d325e3 100644 (file)
@@ -484,7 +484,6 @@ F: OvmfPkg/Include/Library/XenIoMmioLib.h
 F: OvmfPkg/Include/Library/XenPlatformLib.h\r
 F: OvmfPkg/Include/Protocol/XenBus.h\r
 F: OvmfPkg/Include/Protocol/XenIo.h\r
-F: OvmfPkg/Library/PciHostBridgeLib/XenSupport.c\r
 F: OvmfPkg/Library/PciHostBridgeLibScan/\r
 F: OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c\r
 F: OvmfPkg/Library/XenConsoleSerialPortLib/\r
diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridge.h b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridge.h
deleted file mode 100644 (file)
index a2e4d86..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/** @file\r
-  Header file of OVMF instance of PciHostBridgeLib.\r
-\r
-  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
-\r
-  SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-PCI_ROOT_BRIDGE *\r
-ScanForRootBridges (\r
-  UINTN      *NumberOfRootBridges\r
-);\r
index 6db91fb7e20c6e0765dda8044f77fdba08837e5b..835efffccaf596637db3a26ebcfe41336dbb66cd 100644 (file)
@@ -16,8 +16,6 @@
 #include <Protocol/PciHostBridgeResourceAllocation.h> // EFI_PCI_HOST_BRIDGE...\r
 #include <Protocol/PciRootBridgeIo.h>                 // EFI_PCI_ATTRIBUTE_I...\r
 \r
-#include "PciHostBridge.h"\r
-\r
 STATIC PCI_ROOT_BRIDGE_APERTURE mNonExistAperture = { MAX_UINT64, 0 };\r
 \r
 \r
@@ -42,10 +40,6 @@ PciHostBridgeGetRootBridges (
   PCI_ROOT_BRIDGE_APERTURE Mem;\r
   PCI_ROOT_BRIDGE_APERTURE MemAbove4G;\r
 \r
-  if (PcdGetBool (PcdPciDisableBusEnumeration)) {\r
-    return ScanForRootBridges (Count);\r
-  }\r
-\r
   ZeroMem (&Io, sizeof (Io));\r
   ZeroMem (&Mem, sizeof (Mem));\r
   ZeroMem (&MemAbove4G, sizeof (MemAbove4G));\r
index 6227808884726594eedbc3f0fded7c5e9c005656..f9f1825574539c1656ef8b6fe06f52c4af9e7929 100644 (file)
@@ -25,9 +25,7 @@
 #\r
 \r
 [Sources]\r
-  PciHostBridge.h\r
   PciHostBridgeLib.c\r
-  XenSupport.c\r
 \r
 [Packages]\r
   MdeModulePkg/MdeModulePkg.dec\r
   OvmfPkg/OvmfPkg.dec\r
 \r
 [LibraryClasses]\r
-  BaseLib\r
   BaseMemoryLib\r
-  DebugLib\r
-  MemoryAllocationLib\r
   PcdLib\r
   PciHostBridgeUtilityLib\r
-  PciLib\r
 \r
 [Pcd]\r
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration\r
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId\r
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase\r
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize\r
diff --git a/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c b/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c
deleted file mode 100644 (file)
index 07c498d..0000000
+++ /dev/null
@@ -1,471 +0,0 @@
-/** @file\r
-  Scan the entire PCI bus for root bridges to support OVMF above Xen.\r
-\r
-  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
-\r
-  SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-#include <IndustryStandard/Pci.h>            // EFI_PCI_COMMAND_IO_SPACE\r
-#include <IndustryStandard/Q35MchIch9.h>     // INTEL_Q35_MCH_DEVICE_ID\r
-#include <Library/BaseLib.h>                 // DisableInterrupts()\r
-#include <Library/BaseMemoryLib.h>           // ZeroMem()\r
-#include <Library/DebugLib.h>                // ASSERT()\r
-#include <Library/MemoryAllocationLib.h>     // ReallocatePool()\r
-#include <Library/PcdLib.h>                  // PcdGet16()\r
-#include <Library/PciHostBridgeLib.h>        // PCI_ROOT_BRIDGE_APERTURE\r
-#include <Library/PciHostBridgeUtilityLib.h> // PciHostBridgeUtilityInitRoot...\r
-#include <Library/PciLib.h>                  // PciRead32()\r
-#include <Protocol/PciRootBridgeIo.h>        // EFI_PCI_ATTRIBUTE_ISA_IO\r
-\r
-#include "PciHostBridge.h"\r
-\r
-STATIC\r
-VOID\r
-PcatPciRootBridgeBarExisted (\r
-  IN  UINTN                          Address,\r
-  OUT UINT32                         *OriginalValue,\r
-  OUT UINT32                         *Value\r
-  )\r
-{\r
-  //\r
-  // Preserve the original value\r
-  //\r
-  *OriginalValue = PciRead32 (Address);\r
-\r
-  //\r
-  // Disable timer interrupt while the BAR is probed\r
-  //\r
-  DisableInterrupts ();\r
-\r
-  PciWrite32 (Address, 0xFFFFFFFF);\r
-  *Value = PciRead32 (Address);\r
-  PciWrite32 (Address, *OriginalValue);\r
-\r
-  //\r
-  // Enable interrupt\r
-  //\r
-  EnableInterrupts ();\r
-}\r
-\r
-#define PCI_COMMAND_DECODE ((UINT16)(EFI_PCI_COMMAND_IO_SPACE | \\r
-                                     EFI_PCI_COMMAND_MEMORY_SPACE))\r
-STATIC\r
-VOID\r
-PcatPciRootBridgeDecodingDisable (\r
-  IN  UINTN                          Address\r
-  )\r
-{\r
-  UINT16                             Value;\r
-\r
-  Value = PciRead16 (Address);\r
-  if (Value & PCI_COMMAND_DECODE) {\r
-    PciWrite16 (Address, Value & ~(UINT32)PCI_COMMAND_DECODE);\r
-  }\r
-}\r
-\r
-STATIC\r
-VOID\r
-PcatPciRootBridgeParseBars (\r
-  IN UINT16                         Command,\r
-  IN UINTN                          Bus,\r
-  IN UINTN                          Device,\r
-  IN UINTN                          Function,\r
-  IN UINTN                          BarOffsetBase,\r
-  IN UINTN                          BarOffsetEnd,\r
-  IN PCI_ROOT_BRIDGE_APERTURE       *Io,\r
-  IN PCI_ROOT_BRIDGE_APERTURE       *Mem,\r
-  IN PCI_ROOT_BRIDGE_APERTURE       *MemAbove4G\r
-\r
-)\r
-{\r
-  UINT32                            OriginalValue;\r
-  UINT32                            Value;\r
-  UINT32                            OriginalUpperValue;\r
-  UINT32                            UpperValue;\r
-  UINT64                            Mask;\r
-  UINTN                             Offset;\r
-  UINT64                            Base;\r
-  UINT64                            Length;\r
-  UINT64                            Limit;\r
-  PCI_ROOT_BRIDGE_APERTURE          *MemAperture;\r
-\r
-  // Disable address decoding for every device before OVMF starts sizing it\r
-  PcatPciRootBridgeDecodingDisable (\r
-    PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET)\r
-  );\r
-\r
-  for (Offset = BarOffsetBase; Offset < BarOffsetEnd; Offset += sizeof (UINT32)) {\r
-    PcatPciRootBridgeBarExisted (\r
-      PCI_LIB_ADDRESS (Bus, Device, Function, Offset),\r
-      &OriginalValue, &Value\r
-    );\r
-    if (Value == 0) {\r
-      continue;\r
-    }\r
-    if ((Value & BIT0) == BIT0) {\r
-      //\r
-      // IO Bar\r
-      //\r
-      if (Command & EFI_PCI_COMMAND_IO_SPACE) {\r
-        Mask = 0xfffffffc;\r
-        Base = OriginalValue & Mask;\r
-        Length = ((~(Value & Mask)) & Mask) + 0x04;\r
-        if (!(Value & 0xFFFF0000)) {\r
-          Length &= 0x0000FFFF;\r
-        }\r
-        Limit = Base + Length - 1;\r
-\r
-        if (Base < Limit) {\r
-          if (Io->Base > Base) {\r
-            Io->Base = Base;\r
-          }\r
-          if (Io->Limit < Limit) {\r
-            Io->Limit = Limit;\r
-          }\r
-        }\r
-      }\r
-    } else {\r
-      //\r
-      // Mem Bar\r
-      //\r
-      if (Command & EFI_PCI_COMMAND_MEMORY_SPACE) {\r
-\r
-        Mask = 0xfffffff0;\r
-        Base = OriginalValue & Mask;\r
-        Length = Value & Mask;\r
-\r
-        if ((Value & (BIT1 | BIT2)) == 0) {\r
-          //\r
-          // 32bit\r
-          //\r
-          Length = ((~Length) + 1) & 0xffffffff;\r
-\r
-          MemAperture = Mem;\r
-        } else {\r
-          //\r
-          // 64bit\r
-          //\r
-          Offset += 4;\r
-          PcatPciRootBridgeBarExisted (\r
-            PCI_LIB_ADDRESS (Bus, Device, Function, Offset),\r
-            &OriginalUpperValue,\r
-            &UpperValue\r
-          );\r
-\r
-          Base = Base | LShiftU64 ((UINT64) OriginalUpperValue, 32);\r
-          Length = Length | LShiftU64 ((UINT64) UpperValue, 32);\r
-          Length = (~Length) + 1;\r
-\r
-          if (Base < BASE_4GB) {\r
-            MemAperture = Mem;\r
-          } else {\r
-            MemAperture = MemAbove4G;\r
-          }\r
-        }\r
-\r
-        Limit = Base + Length - 1;\r
-        if (Base < Limit) {\r
-          if (MemAperture->Base > Base) {\r
-            MemAperture->Base = Base;\r
-          }\r
-          if (MemAperture->Limit < Limit) {\r
-            MemAperture->Limit = Limit;\r
-          }\r
-        }\r
-      }\r
-    }\r
-  }\r
-}\r
-\r
-STATIC PCI_ROOT_BRIDGE_APERTURE mNonExistAperture = { MAX_UINT64, 0 };\r
-\r
-PCI_ROOT_BRIDGE *\r
-ScanForRootBridges (\r
-  UINTN      *NumberOfRootBridges\r
-  )\r
-{\r
-  UINTN      PrimaryBus;\r
-  UINTN      SubBus;\r
-  UINT8      Device;\r
-  UINT8      Function;\r
-  UINTN      NumberOfDevices;\r
-  UINTN      Address;\r
-  PCI_TYPE01 Pci;\r
-  UINT64     Attributes;\r
-  UINT64     Base;\r
-  UINT64     Limit;\r
-  UINT64     Value;\r
-  PCI_ROOT_BRIDGE_APERTURE Io, Mem, MemAbove4G, *MemAperture;\r
-  PCI_ROOT_BRIDGE *RootBridges;\r
-  UINTN      BarOffsetEnd;\r
-\r
-\r
-  *NumberOfRootBridges = 0;\r
-  RootBridges = NULL;\r
-\r
-  //\r
-  // After scanning all the PCI devices on the PCI root bridge's primary bus,\r
-  // update the Primary Bus Number for the next PCI root bridge to be this PCI\r
-  // root bridge's subordinate bus number + 1.\r
-  //\r
-  for (PrimaryBus = 0; PrimaryBus <= PCI_MAX_BUS; PrimaryBus = SubBus + 1) {\r
-    SubBus = PrimaryBus;\r
-    Attributes = 0;\r
-\r
-    ZeroMem (&Io, sizeof (Io));\r
-    ZeroMem (&Mem, sizeof (Mem));\r
-    ZeroMem (&MemAbove4G, sizeof (MemAbove4G));\r
-    Io.Base = Mem.Base = MemAbove4G.Base = MAX_UINT64;\r
-    //\r
-    // Scan all the PCI devices on the primary bus of the PCI root bridge\r
-    //\r
-    for (Device = 0, NumberOfDevices = 0; Device <= PCI_MAX_DEVICE; Device++) {\r
-\r
-      for (Function = 0; Function <= PCI_MAX_FUNC; Function++) {\r
-\r
-        //\r
-        // Compute the PCI configuration address of the PCI device to probe\r
-        //\r
-        Address = PCI_LIB_ADDRESS (PrimaryBus, Device, Function, 0);\r
-\r
-        //\r
-        // Read the Vendor ID from the PCI Configuration Header\r
-        //\r
-        if (PciRead16 (Address) == MAX_UINT16) {\r
-          if (Function == 0) {\r
-            //\r
-            // If the PCI Configuration Read fails, or a PCI device does not\r
-            // exist, then skip this entire PCI device\r
-            //\r
-            break;\r
-          } else {\r
-            //\r
-            // If PCI function != 0, VendorId == 0xFFFF, we continue to search\r
-            // PCI function.\r
-            //\r
-            continue;\r
-          }\r
-        }\r
-\r
-        //\r
-        // Read the entire PCI Configuration Header\r
-        //\r
-        PciReadBuffer (Address, sizeof (Pci), &Pci);\r
-\r
-        //\r
-        // Increment the number of PCI device found on the primary bus of the\r
-        // PCI root bridge\r
-        //\r
-        NumberOfDevices++;\r
-\r
-        //\r
-        // Look for devices with the VGA Palette Snoop enabled in the COMMAND\r
-        // register of the PCI Config Header\r
-        //\r
-        if ((Pci.Hdr.Command & EFI_PCI_COMMAND_VGA_PALETTE_SNOOP) != 0) {\r
-          Attributes |= EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO;\r
-          Attributes |= EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO_16;\r
-        }\r
-\r
-        BarOffsetEnd = 0;\r
-\r
-        //\r
-        // PCI-PCI Bridge\r
-        //\r
-        if (IS_PCI_BRIDGE (&Pci)) {\r
-          //\r
-          // Get the Bus range that the PPB is decoding\r
-          //\r
-          if (Pci.Bridge.SubordinateBus > SubBus) {\r
-            //\r
-            // If the subordinate bus number of the PCI-PCI bridge is greater\r
-            // than the PCI root bridge's current subordinate bus number,\r
-            // then update the PCI root bridge's subordinate bus number\r
-            //\r
-            SubBus = Pci.Bridge.SubordinateBus;\r
-          }\r
-\r
-          //\r
-          // Get the I/O range that the PPB is decoding\r
-          //\r
-          Value = Pci.Bridge.IoBase & 0x0f;\r
-          Base = ((UINT32) Pci.Bridge.IoBase & 0xf0) << 8;\r
-          Limit = (((UINT32) Pci.Bridge.IoLimit & 0xf0) << 8) | 0x0fff;\r
-          if (Value == BIT0) {\r
-            Base |= ((UINT32) Pci.Bridge.IoBaseUpper16 << 16);\r
-            Limit |= ((UINT32) Pci.Bridge.IoLimitUpper16 << 16);\r
-          }\r
-          if (Base < Limit) {\r
-            if (Io.Base > Base) {\r
-              Io.Base = Base;\r
-            }\r
-            if (Io.Limit < Limit) {\r
-              Io.Limit = Limit;\r
-            }\r
-          }\r
-\r
-          //\r
-          // Get the Memory range that the PPB is decoding\r
-          //\r
-          Base = ((UINT32) Pci.Bridge.MemoryBase & 0xfff0) << 16;\r
-          Limit = (((UINT32) Pci.Bridge.MemoryLimit & 0xfff0) << 16) | 0xfffff;\r
-          if (Base < Limit) {\r
-            if (Mem.Base > Base) {\r
-              Mem.Base = Base;\r
-            }\r
-            if (Mem.Limit < Limit) {\r
-              Mem.Limit = Limit;\r
-            }\r
-          }\r
-\r
-          //\r
-          // Get the Prefetchable Memory range that the PPB is decoding\r
-          // and merge it into Memory range\r
-          //\r
-          Value = Pci.Bridge.PrefetchableMemoryBase & 0x0f;\r
-          Base = ((UINT32) Pci.Bridge.PrefetchableMemoryBase & 0xfff0) << 16;\r
-          Limit = (((UINT32) Pci.Bridge.PrefetchableMemoryLimit & 0xfff0)\r
-                   << 16) | 0xfffff;\r
-          MemAperture = &Mem;\r
-          if (Value == BIT0) {\r
-            Base |= LShiftU64 (Pci.Bridge.PrefetchableBaseUpper32, 32);\r
-            Limit |= LShiftU64 (Pci.Bridge.PrefetchableLimitUpper32, 32);\r
-            MemAperture = &MemAbove4G;\r
-          }\r
-          if (Base < Limit) {\r
-            if (MemAperture->Base > Base) {\r
-              MemAperture->Base = Base;\r
-            }\r
-            if (MemAperture->Limit < Limit) {\r
-              MemAperture->Limit = Limit;\r
-            }\r
-          }\r
-\r
-          //\r
-          // Look at the PPB Configuration for legacy decoding attributes\r
-          //\r
-          if ((Pci.Bridge.BridgeControl & EFI_PCI_BRIDGE_CONTROL_ISA)\r
-              == EFI_PCI_BRIDGE_CONTROL_ISA) {\r
-            Attributes |= EFI_PCI_ATTRIBUTE_ISA_IO;\r
-            Attributes |= EFI_PCI_ATTRIBUTE_ISA_IO_16;\r
-            Attributes |= EFI_PCI_ATTRIBUTE_ISA_MOTHERBOARD_IO;\r
-          }\r
-          if ((Pci.Bridge.BridgeControl & EFI_PCI_BRIDGE_CONTROL_VGA)\r
-              == EFI_PCI_BRIDGE_CONTROL_VGA) {\r
-            Attributes |= EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO;\r
-            Attributes |= EFI_PCI_ATTRIBUTE_VGA_MEMORY;\r
-            Attributes |= EFI_PCI_ATTRIBUTE_VGA_IO;\r
-            if ((Pci.Bridge.BridgeControl & EFI_PCI_BRIDGE_CONTROL_VGA_16)\r
-                != 0) {\r
-              Attributes |= EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO_16;\r
-              Attributes |= EFI_PCI_ATTRIBUTE_VGA_IO_16;\r
-            }\r
-          }\r
-\r
-          BarOffsetEnd = OFFSET_OF (PCI_TYPE01, Bridge.Bar[2]);\r
-        } else {\r
-          //\r
-          // Parse the BARs of the PCI device to get what I/O Ranges, Memory\r
-          // Ranges, and Prefetchable Memory Ranges the device is decoding\r
-          //\r
-          if ((Pci.Hdr.HeaderType & HEADER_LAYOUT_CODE) == HEADER_TYPE_DEVICE) {\r
-            BarOffsetEnd = OFFSET_OF (PCI_TYPE00, Device.Bar[6]);\r
-          }\r
-        }\r
-\r
-        PcatPciRootBridgeParseBars (\r
-          Pci.Hdr.Command,\r
-          PrimaryBus,\r
-          Device,\r
-          Function,\r
-          OFFSET_OF (PCI_TYPE00, Device.Bar),\r
-          BarOffsetEnd,\r
-          &Io,\r
-          &Mem, &MemAbove4G\r
-        );\r
-\r
-        //\r
-        // See if the PCI device is an IDE controller\r
-        //\r
-        if (IS_CLASS2 (&Pci, PCI_CLASS_MASS_STORAGE,\r
-                       PCI_CLASS_MASS_STORAGE_IDE)) {\r
-          if (Pci.Hdr.ClassCode[0] & 0x80) {\r
-            Attributes |= EFI_PCI_ATTRIBUTE_IDE_PRIMARY_IO;\r
-            Attributes |= EFI_PCI_ATTRIBUTE_IDE_SECONDARY_IO;\r
-          }\r
-          if (Pci.Hdr.ClassCode[0] & 0x01) {\r
-            Attributes |= EFI_PCI_ATTRIBUTE_IDE_PRIMARY_IO;\r
-          }\r
-          if (Pci.Hdr.ClassCode[0] & 0x04) {\r
-            Attributes |= EFI_PCI_ATTRIBUTE_IDE_SECONDARY_IO;\r
-          }\r
-        }\r
-\r
-        //\r
-        // See if the PCI device is a legacy VGA controller or\r
-        // a standard VGA controller\r
-        //\r
-        if (IS_CLASS2 (&Pci, PCI_CLASS_OLD, PCI_CLASS_OLD_VGA) ||\r
-            IS_CLASS2 (&Pci, PCI_CLASS_DISPLAY, PCI_CLASS_DISPLAY_VGA)\r
-            ) {\r
-          Attributes |= EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO;\r
-          Attributes |= EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO_16;\r
-          Attributes |= EFI_PCI_ATTRIBUTE_VGA_MEMORY;\r
-          Attributes |= EFI_PCI_ATTRIBUTE_VGA_IO;\r
-          Attributes |= EFI_PCI_ATTRIBUTE_VGA_IO_16;\r
-        }\r
-\r
-        //\r
-        // See if the PCI Device is a PCI - ISA or PCI - EISA\r
-        // or ISA_POSITIVE_DECODE Bridge device\r
-        //\r
-        if (Pci.Hdr.ClassCode[2] == PCI_CLASS_BRIDGE) {\r
-          if (Pci.Hdr.ClassCode[1] == PCI_CLASS_BRIDGE_ISA ||\r
-              Pci.Hdr.ClassCode[1] == PCI_CLASS_BRIDGE_EISA ||\r
-              Pci.Hdr.ClassCode[1] == PCI_CLASS_BRIDGE_ISA_PDECODE) {\r
-            Attributes |= EFI_PCI_ATTRIBUTE_ISA_IO;\r
-            Attributes |= EFI_PCI_ATTRIBUTE_ISA_IO_16;\r
-            Attributes |= EFI_PCI_ATTRIBUTE_ISA_MOTHERBOARD_IO;\r
-          }\r
-        }\r
-\r
-        //\r
-        // If this device is not a multi function device, then skip the rest\r
-        // of this PCI device\r
-        //\r
-        if (Function == 0 && !IS_PCI_MULTI_FUNC (&Pci)) {\r
-          break;\r
-        }\r
-      }\r
-    }\r
-\r
-    //\r
-    // If at least one PCI device was found on the primary bus of this PCI\r
-    // root bridge, then the PCI root bridge exists.\r
-    //\r
-    if (NumberOfDevices > 0) {\r
-      RootBridges = ReallocatePool (\r
-        (*NumberOfRootBridges) * sizeof (PCI_ROOT_BRIDGE),\r
-        (*NumberOfRootBridges + 1) * sizeof (PCI_ROOT_BRIDGE),\r
-        RootBridges\r
-      );\r
-      ASSERT (RootBridges != NULL);\r
-      PciHostBridgeUtilityInitRootBridge (\r
-        Attributes, Attributes, 0,\r
-        FALSE, PcdGet16 (PcdOvmfHostBridgePciDevId) != INTEL_Q35_MCH_DEVICE_ID,\r
-        (UINT8) PrimaryBus, (UINT8) SubBus,\r
-        &Io, &Mem, &MemAbove4G, &mNonExistAperture, &mNonExistAperture,\r
-        &RootBridges[*NumberOfRootBridges]\r
-      );\r
-      RootBridges[*NumberOfRootBridges].ResourceAssigned = TRUE;\r
-      //\r
-      // Increment the index for the next PCI Root Bridge\r
-      //\r
-      (*NumberOfRootBridges)++;\r
-    }\r
-  }\r
-\r
-  return RootBridges;\r
-}\r