summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.c13
-rw-r--r--IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBus.c59
-rw-r--r--MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c51
-rw-r--r--Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIo.c13
-rw-r--r--UnixPkg/UnixSerialIoDxe/UnixSerialIo.c11
5 files changed, 90 insertions, 57 deletions
diff --git a/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.c b/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.c
index a5ee000..d5b5cfb 100644
--- a/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.c
+++ b/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.c
@@ -385,18 +385,9 @@ SerialControllerDriverStart (
break;
}
}
- FreePool (OpenInfoBuffer);
- if (Index < EntryCount) {
- //
- // If gEfiSerialIoProtocolGuid is opened by one child device, return
- //
- return Status;
- }
- //
- // If gEfiSerialIoProtocolGuid is not opened by any child device,
- // go further to create child device handle based on RemainingDevicePath
- //
+ FreePool (OpenInfoBuffer);
+ return Status;
}
if (RemainingDevicePath != NULL) {
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBus.c b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBus.c
index 7af1b10..1a4adf5 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,
diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
index 375f07a..fa9f3e3 100644
--- a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
+++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
@@ -69,22 +69,35 @@ PartitionDriverBindingSupported (
EFI_DISK_IO_PROTOCOL *DiskIo;
EFI_DEV_PATH *Node;
+ //
+ // Check RemainingDevicePath validation
+ //
if (RemainingDevicePath != NULL) {
- Node = (EFI_DEV_PATH *) RemainingDevicePath;
- if (Node->DevPath.Type != MEDIA_DEVICE_PATH ||
+ //
+ // 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 = (EFI_DEV_PATH *) RemainingDevicePath;
+ if (Node->DevPath.Type != MEDIA_DEVICE_PATH ||
Node->DevPath.SubType != MEDIA_HARDDRIVE_DP ||
- DevicePathNodeLength (&Node->DevPath) != sizeof (HARDDRIVE_DEVICE_PATH)
- ) {
+ DevicePathNodeLength (&Node->DevPath) != sizeof (HARDDRIVE_DEVICE_PATH)) {
return EFI_UNSUPPORTED;
+ }
}
}
+
//
// Open the IO Abstraction(s) needed to perform the supported test
//
Status = gBS->OpenProtocol (
ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &ParentDevicePath,
+ &gEfiDiskIoProtocolGuid,
+ (VOID **) &DiskIo,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -101,18 +114,18 @@ PartitionDriverBindingSupported (
//
gBS->CloseProtocol (
ControllerHandle,
- &gEfiDevicePathProtocolGuid,
+ &gEfiDiskIoProtocolGuid,
This->DriverBindingHandle,
ControllerHandle
);
//
- // Open the IO Abstraction(s) needed to perform the supported test
+ // Open the EFI Device Path protocol needed to perform the supported test
//
Status = gBS->OpenProtocol (
ControllerHandle,
- &gEfiDiskIoProtocolGuid,
- (VOID **) &DiskIo,
+ &gEfiDevicePathProtocolGuid,
+ (VOID **) &ParentDevicePath,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -124,12 +137,13 @@ PartitionDriverBindingSupported (
if (EFI_ERROR (Status)) {
return Status;
}
+
//
- // Close the I/O Abstraction(s) used to perform the supported test
+ // Close protocol, don't use device path protocol in the Support() function
//
gBS->CloseProtocol (
ControllerHandle,
- &gEfiDiskIoProtocolGuid,
+ &gEfiDevicePathProtocolGuid,
This->DriverBindingHandle,
ControllerHandle
);
@@ -181,6 +195,19 @@ PartitionDriverBindingStart (
PARTITION_DETECT_ROUTINE *Routine;
BOOLEAN MediaPresent;
+ //
+ // 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->OpenProtocol (
ControllerHandle,
&gEfiBlockIoProtocolGuid,
diff --git a/Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIo.c b/Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIo.c
index 52d7ee8..17e4fda 100644
--- a/Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIo.c
+++ b/Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIo.c
@@ -372,18 +372,9 @@ Returns:
break;
}
}
+
FreePool (OpenInfoBuffer);
-
- if (Index < EntryCount) {
- //
- // If gEfiWinNtIoProtocolGuid is opened by one child device, return
- //
- return Status;
- }
- //
- // If gEfiWinNtIoProtocolGuid is not opened by any child device,
- // go further to create child device handle based on RemainingDevicePath
- //
+ return Status;
}
if (RemainingDevicePath == NULL) {
diff --git a/UnixPkg/UnixSerialIoDxe/UnixSerialIo.c b/UnixPkg/UnixSerialIoDxe/UnixSerialIo.c
index ff9bced..e41e749 100644
--- a/UnixPkg/UnixSerialIoDxe/UnixSerialIo.c
+++ b/UnixPkg/UnixSerialIoDxe/UnixSerialIo.c
@@ -466,16 +466,7 @@ Returns:
}
FreePool (OpenInfoBuffer);
- if (Index < EntryCount) {
- //
- // If gEfiUnixIoProtocolGuid is opened by one child device, return
- //
- return Status;
- }
- //
- // If gEfiUnixIoProtocolGuid is not opened by any child device,
- // go further to create child device handle based on RemainingDevicePath
- //
+ return Status;
}
if (RemainingDevicePath == NULL) {