diff options
author | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-01-20 05:54:35 +0000 |
---|---|---|
committer | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-01-20 05:54:35 +0000 |
commit | bee73f768c3fd4da1f49f0403c6aea51437eff17 (patch) | |
tree | 44e5358bf259ee9635fd0cdfd4c9dcef102207ec | |
parent | 07c63f5050fedecf387500d2d7055e6b0fb55d21 (diff) | |
download | edk2-bee73f768c3fd4da1f49f0403c6aea51437eff17.tar.gz |
Sync patch r12203 from main trunk.
Raise TPL to prevent the BlockIo instance for USB device is removed during the locating the instance and using it.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/branches/UDK2010@12947 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r-- | IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c index ed42cc02b2..38603b93a2 100644 --- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c +++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c @@ -1422,6 +1422,7 @@ BdsLibGetBootableHandle ( )
{
EFI_STATUS Status;
+ EFI_TPL OldTpl;
EFI_DEVICE_PATH_PROTOCOL *UpdatedDevicePath;
EFI_DEVICE_PATH_PROTOCOL *DupDevicePath;
EFI_HANDLE Handle;
@@ -1442,6 +1443,12 @@ BdsLibGetBootableHandle ( UpdatedDevicePath = DevicePath;
//
+ // Enter to critical section to protect the acquired BlockIo instance
+ // from getting released due to the USB mass storage hotplug event
+ //
+ OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
+
+ //
// Check whether the device is connected
//
Status = gBS->LocateDevicePath (&gEfiBlockIoProtocolGuid, &UpdatedDevicePath, &Handle);
@@ -1468,6 +1475,8 @@ BdsLibGetBootableHandle ( // Get BlockIo protocol and check removable attribute
//
Status = gBS->HandleProtocol (Handle, &gEfiBlockIoProtocolGuid, (VOID **)&BlockIo);
+ ASSERT_EFI_ERROR (Status);
+
//
// Issue a dummy read to the device to check for media change.
// When the removable media is changed, any Block IO read/write will
@@ -1564,6 +1573,8 @@ BdsLibGetBootableHandle ( FreePool(SimpleFileSystemHandles);
}
+ gBS->RestoreTPL (OldTpl);
+
return ReturnHandle;
}
|