diff options
author | Laszlo Ersek <lersek@redhat.com> | 2015-07-14 12:01:52 +0000 |
---|---|---|
committer | lersek <lersek@Edk2> | 2015-07-14 12:01:52 +0000 |
commit | 2c34f3bc54338ff40d617f42df7390fcbfcae32f (patch) | |
tree | 7724934e1a3752146c5cc06a04b146bba941166a /OvmfPkg | |
parent | 7730ad6e5d754e4d536a1fe610379697b66e5323 (diff) | |
download | edk2-2c34f3bc54338ff40d617f42df7390fcbfcae32f.zip edk2-2c34f3bc54338ff40d617f42df7390fcbfcae32f.tar.gz edk2-2c34f3bc54338ff40d617f42df7390fcbfcae32f.tar.bz2 |
OvmfPkg: PlatformBdsLib: connect all PCI root buses
Currently we only connect the root bus with bus number 0, by device path.
Soon we will possibly have several extra root buses, so connect all root
buses up-front (bus number zero and otherwise), by protocol GUID.
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Regression-tested-by: Gabriel Somlo <somlo@cmu.edu>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17954 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'OvmfPkg')
-rw-r--r-- | OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c | 53 | ||||
-rw-r--r-- | OvmfPkg/Library/PlatformBdsLib/BdsPlatform.h | 25 | ||||
-rw-r--r-- | OvmfPkg/Library/PlatformBdsLib/PlatformBdsLib.inf | 2 | ||||
-rw-r--r-- | OvmfPkg/Library/PlatformBdsLib/PlatformData.c | 13 |
4 files changed, 18 insertions, 75 deletions
diff --git a/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c index 243db44..de13c6b 100644 --- a/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c +++ b/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c @@ -116,49 +116,27 @@ Returns: EFI_STATUS
+EFIAPI
ConnectRootBridge (
- VOID
+ IN EFI_HANDLE RootBridgeHandle,
+ IN VOID *Instance,
+ IN VOID *Context
)
-/*++
-
-Routine Description:
-
- Connect RootBridge
-
-Arguments:
-
- None.
-
-Returns:
-
- EFI_SUCCESS - Connect RootBridge successfully.
- EFI_STATUS - Connect RootBridge fail.
-
---*/
{
- EFI_STATUS Status;
- EFI_HANDLE RootHandle;
+ EFI_STATUS Status;
//
- // Make all the PCI_IO protocols on PCI Seg 0 show up
+ // Make the PCI bus driver connect the root bridge, non-recursively. This
+ // will produce a number of child handles with PciIo on them.
//
- BdsLibConnectDevicePath (gPlatformRootBridges[0]);
-
- Status = gBS->LocateDevicePath (
- &gEfiDevicePathProtocolGuid,
- &gPlatformRootBridges[0],
- &RootHandle
+ Status = gBS->ConnectController (
+ RootBridgeHandle, // ControllerHandle
+ NULL, // DriverImageHandle
+ NULL, // RemainingDevicePath -- produce all
+ // children
+ FALSE // Recursive
);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = gBS->ConnectController (RootHandle, NULL, NULL, FALSE);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return EFI_SUCCESS;
+ return Status;
}
@@ -1222,7 +1200,8 @@ Returns: DEBUG ((EFI_D_INFO, "PlatformBdsPolicyBehavior\n"));
- ConnectRootBridge ();
+ VisitAllInstancesOfProtocol (&gEfiPciRootBridgeIoProtocolGuid,
+ ConnectRootBridge, NULL);
if (PcdGetBool (PcdOvmfFlashVariablesEnable)) {
DEBUG ((EFI_D_INFO, "PlatformBdsPolicyBehavior: not restoring NvVars "
diff --git a/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.h b/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.h index 7006fb3..e3e950e 100644 --- a/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.h +++ b/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.h @@ -52,6 +52,7 @@ Abstract: #include <Protocol/PciIo.h>
#include <Protocol/FirmwareVolume2.h>
#include <Protocol/SimpleFileSystem.h>
+#include <Protocol/PciRootBridgeIo.h>
#include <Guid/Acpi.h>
#include <Guid/SmBios.h>
@@ -64,7 +65,6 @@ Abstract: extern BDS_CONSOLE_CONNECT_ENTRY gPlatformConsole[];
extern EFI_DEVICE_PATH_PROTOCOL *gPlatformConnectSequence[];
extern EFI_DEVICE_PATH_PROTOCOL *gPlatformDriverOption[];
-extern EFI_DEVICE_PATH_PROTOCOL *gPlatformRootBridges[];
extern ACPI_HID_DEVICE_PATH gPnpPs2KeyboardDeviceNode;
extern ACPI_HID_DEVICE_PATH gPnp16550ComPortDeviceNode;
extern UART_DEVICE_PATH gUartDeviceNode;
@@ -107,9 +107,6 @@ extern VENDOR_DEVICE_PATH gTerminalTypeDeviceNode; 0 \
}
-#define gPciRootBridge \
- PNPID_DEVICE_PATH_NODE(0x0A03)
-
#define gPciIsaBridge \
PCI_DEVICE_PATH_NODE(0, 0x1f)
@@ -152,16 +149,6 @@ extern VENDOR_DEVICE_PATH gTerminalTypeDeviceNode; DEVICE_PATH_MESSAGING_PC_ANSI \
}
-#define gEndEntire \
- { \
- END_DEVICE_PATH_TYPE, \
- END_ENTIRE_DEVICE_PATH_SUBTYPE, \
- { \
- END_DEVICE_PATH_LENGTH, \
- 0 \
- } \
- }
-
#define PCI_CLASS_SCC 0x07
#define PCI_SUBCLASS_SERIAL 0x00
#define PCI_IF_16550 0x02
@@ -172,14 +159,6 @@ extern VENDOR_DEVICE_PATH gTerminalTypeDeviceNode; #define IS_PCI_ISA_PDECODE(_p) IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_ISA_PDECODE, 0)
-//
-// Platform Root Bridge
-//
-typedef struct {
- ACPI_HID_DEVICE_PATH PciRootBridge;
- EFI_DEVICE_PATH_PROTOCOL End;
-} PLATFORM_ROOT_BRIDGE_DEVICE_PATH;
-
typedef struct {
ACPI_HID_DEVICE_PATH PciRootBridge;
PCI_DEVICE_PATH IsaBridge;
@@ -223,8 +202,6 @@ typedef struct { EFI_DEVICE_PATH_PROTOCOL End;
} USB_CLASS_FORMAT_DEVICE_PATH;
-extern PLATFORM_ROOT_BRIDGE_DEVICE_PATH gPlatformRootBridge0;
-
//
// Platform BDS Functions
//
diff --git a/OvmfPkg/Library/PlatformBdsLib/PlatformBdsLib.inf b/OvmfPkg/Library/PlatformBdsLib/PlatformBdsLib.inf index 5a28d78..ce29720 100644 --- a/OvmfPkg/Library/PlatformBdsLib/PlatformBdsLib.inf +++ b/OvmfPkg/Library/PlatformBdsLib/PlatformBdsLib.inf @@ -64,4 +64,4 @@ [Protocols]
gEfiDecompressProtocolGuid
-
+ gEfiPciRootBridgeIoProtocolGuid
diff --git a/OvmfPkg/Library/PlatformBdsLib/PlatformData.c b/OvmfPkg/Library/PlatformBdsLib/PlatformData.c index 1a30531..f69c1a8 100644 --- a/OvmfPkg/Library/PlatformBdsLib/PlatformData.c +++ b/OvmfPkg/Library/PlatformBdsLib/PlatformData.c @@ -26,19 +26,6 @@ UART_DEVICE_PATH gUartDeviceNode = gUart; VENDOR_DEVICE_PATH gTerminalTypeDeviceNode = gPcAnsiTerminal;
//
-// Predefined platform root bridge
-//
-PLATFORM_ROOT_BRIDGE_DEVICE_PATH gPlatformRootBridge0 = {
- gPciRootBridge,
- gEndEntire
-};
-
-EFI_DEVICE_PATH_PROTOCOL *gPlatformRootBridges[] = {
- (EFI_DEVICE_PATH_PROTOCOL *) &gPlatformRootBridge0,
- NULL
-};
-
-//
// Platform specific keyboard device path
//
|