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:
yshang1
2007-01-23 10:28:32 +00:00
parent 6c2c7b7460
commit c7c02fabf1
6 changed files with 79 additions and 60 deletions

View File

@@ -108,7 +108,7 @@ Returns:
return MbrValid;
}
BOOLEAN
EFI_STATUS
PartitionInstallMbrChildHandles (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Handle,
@@ -129,8 +129,9 @@ Arguments:
DevicePath - Parent Device Path
Returns:
EFI_SUCCESS - If a child handle was added
other - A child handle was not added
EFI_SUCCESS - If a child handle was added
EFI_MEDIA_CHANGED - Media changed Detected
!EFI_SUCCESS - Not found MBR partition.
--*/
{
@@ -140,13 +141,13 @@ Returns:
UINTN Index;
HARDDRIVE_DEVICE_PATH HdDev;
HARDDRIVE_DEVICE_PATH ParentHdDev;
BOOLEAN Found;
EFI_STATUS Found;
UINT32 PartitionNumber;
EFI_DEVICE_PATH_PROTOCOL *DevicePathNode;
EFI_DEVICE_PATH_PROTOCOL *LastDevicePathNode;
Mbr = NULL;
Found = FALSE;
Found = EFI_NOT_FOUND;
Mbr = AllocatePool (BlockIo->Media->BlockSize);
if (Mbr == NULL) {
@@ -161,6 +162,7 @@ Returns:
Mbr
);
if (EFI_ERROR (Status) || !PartitionValidMbr (Mbr, BlockIo->Media->LastBlock)) {
Found = Status;
goto Done;
}
//
@@ -237,7 +239,7 @@ Returns:
);
if (!EFI_ERROR (Status)) {
Found = TRUE;
Found = EFI_SUCCESS;
}
}
} else {
@@ -257,6 +259,7 @@ Returns:
Mbr
);
if (EFI_ERROR (Status)) {
Found = Status;
goto Done;
}
@@ -295,7 +298,7 @@ Returns:
(BOOLEAN) (Mbr->Partition[0].OSIndicator == EFI_PARTITION)
);
if (!EFI_ERROR (Status)) {
Found = TRUE;
Found = EFI_SUCCESS;
}
if ((Mbr->Partition[1].OSIndicator != EXTENDED_DOS_PARTITION) &&