diff options
author | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-09-16 03:05:46 +0000 |
---|---|---|
committer | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-09-16 03:05:46 +0000 |
commit | 9be29006683dd5fa6c02059691735715d28070c7 (patch) | |
tree | 0e49d52b592e181c7876b26b4f2adbda3a0c8b2a /MdeModulePkg | |
parent | 919df8e6d2b8d9c9c2438c73676b8224eecc1d4b (diff) | |
download | edk2-9be29006683dd5fa6c02059691735715d28070c7.tar.gz edk2-9be29006683dd5fa6c02059691735715d28070c7.tar.bz2 edk2-9be29006683dd5fa6c02059691735715d28070c7.zip |
1. updated "the Bus Driver that creates all of its child handles on the first call to Start()" not to create any child handle if RemainingDeviepath is the End of Device Path Node, per UEFI 2.3.
The others changes include:
a. Check RemainingDevicePath at beginning of Supported(), make sure it has been verified before Start() is called.
b. Check IO protocol firstly rather than EfiDevicePathProtocolGuid, reduce the times entering into Start() function because EfiDevicePathProtocolGuid existed on most of handle.
2. roll back serial drivers not to create child device, if the device speicifed by remainingdevicepath cannot find in the created devices list.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9267 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg')
-rw-r--r-- | MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c | 51 |
1 files changed, 39 insertions, 12 deletions
diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c index 375f07aa18..fa9f3e3cc4 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,
|