Fixed bug in partition driver:
When Block I/O detects the media changed, block driver will reinstall block I/O protocol. If it happened during start() of partition driver, the reinstall protocol would results in the reentrant of the start(). In the patch, we check status of child detection to see whether need clean up the opened block I/O protocol in Start(). Besides, some checking of return status added in usbbus driver to improve robusticiy of the driver. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2288 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -71,6 +71,15 @@ EFI_DRIVER_BINDING_PROTOCOL gPartitionDriverBinding = {
|
||||
NULL
|
||||
};
|
||||
|
||||
STATIC
|
||||
PARTITION_DETECT_ROUTINE mPartitionDetectRoutineTable[] = {
|
||||
PartitionInstallGptChildHandles,
|
||||
PartitionInstallElToritoChildHandles,
|
||||
PartitionInstallMbrChildHandles,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PartitionDriverBindingSupported (
|
||||
@@ -212,6 +221,7 @@ PartitionDriverBindingStart (
|
||||
EFI_BLOCK_IO_PROTOCOL *BlockIo;
|
||||
EFI_DISK_IO_PROTOCOL *DiskIo;
|
||||
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
|
||||
PARTITION_DETECT_ROUTINE *Routine;
|
||||
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
@@ -269,32 +279,19 @@ PartitionDriverBindingStart (
|
||||
// media supports a given partition type install child handles to represent
|
||||
// the partitions described by the media.
|
||||
//
|
||||
if (PartitionInstallGptChildHandles (
|
||||
This,
|
||||
ControllerHandle,
|
||||
DiskIo,
|
||||
BlockIo,
|
||||
ParentDevicePath
|
||||
) ||
|
||||
|
||||
PartitionInstallElToritoChildHandles (
|
||||
This,
|
||||
ControllerHandle,
|
||||
DiskIo,
|
||||
BlockIo,
|
||||
ParentDevicePath
|
||||
) ||
|
||||
|
||||
PartitionInstallMbrChildHandles (
|
||||
This,
|
||||
ControllerHandle,
|
||||
DiskIo,
|
||||
BlockIo,
|
||||
ParentDevicePath
|
||||
)) {
|
||||
Status = EFI_SUCCESS;
|
||||
} else {
|
||||
Status = EFI_NOT_FOUND;
|
||||
Routine = &mPartitionDetectRoutineTable[0];
|
||||
while (*Routine != NULL) {
|
||||
Status = (*Routine) (
|
||||
This,
|
||||
ControllerHandle,
|
||||
DiskIo,
|
||||
BlockIo,
|
||||
ParentDevicePath
|
||||
);
|
||||
if (!EFI_ERROR (Status) || Status == EFI_MEDIA_CHANGED) {
|
||||
break;
|
||||
}
|
||||
Routine++;
|
||||
}
|
||||
}
|
||||
//
|
||||
@@ -303,7 +300,7 @@ PartitionDriverBindingStart (
|
||||
// driver. So don't try to close them. Otherwise, we will break the dependency
|
||||
// between the controller and the driver set up before.
|
||||
//
|
||||
if (EFI_ERROR (Status) && !EFI_ERROR (OpenStatus)) {
|
||||
if (EFI_ERROR (Status) && !EFI_ERROR (OpenStatus) && Status != EFI_MEDIA_CHANGED) {
|
||||
gBS->CloseProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiDiskIoProtocolGuid,
|
||||
|
Reference in New Issue
Block a user