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
This commit is contained in:
Laszlo Ersek 2015-07-14 12:01:52 +00:00 committed by lersek
parent 7730ad6e5d
commit 2c34f3bc54
4 changed files with 18 additions and 75 deletions

View File

@ -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 "

View File

@ -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
//

View File

@ -64,4 +64,4 @@
[Protocols]
gEfiDecompressProtocolGuid
gEfiPciRootBridgeIoProtocolGuid

View File

@ -25,19 +25,6 @@ ACPI_HID_DEVICE_PATH gPnp16550ComPortDeviceNode = gPnp16550ComPort;
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
//