mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-08 17:05:09 +02:00
Raise TPL to prevent the BlockIo instance for USB device is removed during the locating the instance and using it.
Signed-off-by: niruiyu Reviewed-by: erictian git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12203 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
670a64e7b7
commit
ef949581ea
@ -1904,6 +1904,7 @@ BdsLibGetBootableHandle (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
EFI_TPL OldTpl;
|
||||||
EFI_DEVICE_PATH_PROTOCOL *UpdatedDevicePath;
|
EFI_DEVICE_PATH_PROTOCOL *UpdatedDevicePath;
|
||||||
EFI_DEVICE_PATH_PROTOCOL *DupDevicePath;
|
EFI_DEVICE_PATH_PROTOCOL *DupDevicePath;
|
||||||
EFI_HANDLE Handle;
|
EFI_HANDLE Handle;
|
||||||
@ -1923,6 +1924,12 @@ BdsLibGetBootableHandle (
|
|||||||
|
|
||||||
UpdatedDevicePath = DevicePath;
|
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
|
// Check whether the device is connected
|
||||||
//
|
//
|
||||||
@ -1950,6 +1957,8 @@ BdsLibGetBootableHandle (
|
|||||||
// Get BlockIo protocol and check removable attribute
|
// Get BlockIo protocol and check removable attribute
|
||||||
//
|
//
|
||||||
Status = gBS->HandleProtocol (Handle, &gEfiBlockIoProtocolGuid, (VOID **)&BlockIo);
|
Status = gBS->HandleProtocol (Handle, &gEfiBlockIoProtocolGuid, (VOID **)&BlockIo);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Issue a dummy read to the device to check for media change.
|
// Issue a dummy read to the device to check for media change.
|
||||||
// When the removable media is changed, any Block IO read/write will
|
// When the removable media is changed, any Block IO read/write will
|
||||||
@ -2046,6 +2055,8 @@ BdsLibGetBootableHandle (
|
|||||||
FreePool(SimpleFileSystemHandles);
|
FreePool(SimpleFileSystemHandles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gBS->RestoreTPL (OldTpl);
|
||||||
|
|
||||||
return ReturnHandle;
|
return ReturnHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user