diff options
Diffstat (limited to 'IntelFrameworkModulePkg/Bus/Pci')
-rw-r--r-- | IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBus.c | 59 |
1 files changed, 46 insertions, 13 deletions
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBus.c b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBus.c index 7af1b10f7e..1a4adf54b9 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBus.c +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBus.c @@ -132,21 +132,35 @@ PciBusDriverBindingSupported ( EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
EFI_DEV_PATH_PTR Node;
+ //
+ // Check RemainingDevicePath validation
+ //
if (RemainingDevicePath != NULL) {
- Node.DevPath = RemainingDevicePath;
- if (Node.DevPath->Type != HARDWARE_DEVICE_PATH ||
- Node.DevPath->SubType != HW_PCI_DP ||
- DevicePathNodeLength(Node.DevPath) != sizeof(PCI_DEVICE_PATH)) {
- return EFI_UNSUPPORTED;
+ //
+ // Check if RemainingDevicePath is the End of Device Path Node,
+ // if yes, go on checking other conditions
+ //
+ if (!IsDevicePathEnd (RemainingDevicePath)) {
+ //
+ // If RemainingDevicePath isn't the End of Device Path Node,
+ // check its validation
+ //
+ Node.DevPath = RemainingDevicePath;
+ if (Node.DevPath->Type != HARDWARE_DEVICE_PATH ||
+ Node.DevPath->SubType != HW_PCI_DP ||
+ DevicePathNodeLength(Node.DevPath) != sizeof(PCI_DEVICE_PATH)) {
+ return EFI_UNSUPPORTED;
+ }
}
}
+
//
- // Open the IO Abstraction(s) needed to perform the supported test
+ // Check if Pci Root Bridge IO protocol is installed by platform
//
Status = gBS->OpenProtocol (
Controller,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &ParentDevicePath,
+ &gEfiPciRootBridgeIoProtocolGuid,
+ (VOID **) &PciRootBridgeIo,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -159,20 +173,23 @@ PciBusDriverBindingSupported ( return Status;
}
+ //
+ // Close the I/O Abstraction(s) used to perform the supported test
+ //
gBS->CloseProtocol (
Controller,
- &gEfiDevicePathProtocolGuid,
+ &gEfiPciRootBridgeIoProtocolGuid,
This->DriverBindingHandle,
Controller
);
//
- // Check if Pci Root Bridge IO protocol is installed by platform
+ // Open the EFI Device Path protocol needed to perform the supported test
//
Status = gBS->OpenProtocol (
Controller,
- &gEfiPciRootBridgeIoProtocolGuid,
- (VOID **) &PciRootBridgeIo,
+ &gEfiDevicePathProtocolGuid,
+ (VOID **) &ParentDevicePath,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -185,9 +202,12 @@ PciBusDriverBindingSupported ( return Status;
}
+ //
+ // Close protocol, don't use device path protocol in the Support() function
+ //
gBS->CloseProtocol (
Controller,
- &gEfiPciRootBridgeIoProtocolGuid,
+ &gEfiDevicePathProtocolGuid,
This->DriverBindingHandle,
Controller
);
@@ -219,6 +239,19 @@ PciBusDriverBindingStart ( {
EFI_STATUS Status;
+ //
+ // Check RemainingDevicePath validation
+ //
+ if (RemainingDevicePath != NULL) {
+ //
+ // Check if RemainingDevicePath is the End of Device Path Node,
+ // if yes, return EFI_SUCCESS
+ //
+ if (IsDevicePathEnd (RemainingDevicePath)) {
+ return EFI_SUCCESS;
+ }
+ }
+
Status = gBS->LocateProtocol (
&gEfiIncompatiblePciDeviceSupportProtocolGuid,
NULL,
|