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

@ -75,7 +75,7 @@ PartitionSetCrc (
IN OUT EFI_TABLE_HEADER *Hdr
);
BOOLEAN
EFI_STATUS
PartitionInstallGptChildHandles (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Handle,
@ -96,8 +96,9 @@ Arguments:
DevicePath - Parent Device Path
Returns:
TRUE - Valid GPT disk
FALSE - Not a valid GPT disk
EFI_SUCCESS - Valid GPT disk
EFI_MEDIA_CHANGED - Media changed Detected
!EFI_SUCCESS - Not a valid GPT disk
--*/
{
@ -110,7 +111,7 @@ Returns:
EFI_PARTITION_ENTRY *PartEntry;
EFI_PARTITION_ENTRY_STATUS *PEntryStatus;
UINTN Index;
BOOLEAN GptValid;
EFI_STATUS GptValid;
HARDDRIVE_DEVICE_PATH HdDev;
ProtectiveMbr = NULL;
@ -125,14 +126,14 @@ Returns:
DEBUG ((EFI_D_INFO, " BlockSize : %d \n", BlockSize));
DEBUG ((EFI_D_INFO, " LastBlock : %x \n", LastBlock));
GptValid = FALSE;
GptValid = EFI_NOT_FOUND;
//
// Allocate a buffer for the Protective MBR
//
ProtectiveMbr = AllocatePool (BlockSize);
if (ProtectiveMbr == NULL) {
return FALSE;
return EFI_NOT_FOUND;
}
//
@ -146,6 +147,7 @@ Returns:
ProtectiveMbr
);
if (EFI_ERROR (Status)) {
GptValid = Status;
goto Done;
}
//
@ -224,6 +226,7 @@ Returns:
PartEntry
);
if (EFI_ERROR (Status)) {
GptValid = Status;
DEBUG ((EFI_D_INFO, " Partition Entry ReadBlocks error\n"));
goto Done;
}
@ -246,7 +249,7 @@ Returns:
//
// If we got this far the GPT layout of the disk is valid and we should return true
//
GptValid = TRUE;
GptValid = EFI_SUCCESS;
//
// Create child device handles