mirror of https://github.com/acidanthera/audk.git
Fix 3 bugs in DiskIoDxe and PartitionDxe drivers introduced in DiskIo2 implementation.
1. DiskIo2 shouldn't signal the event when the *Ex interface returns failure status per the UEFI spec. 2. PartitionDxe should close DiskIo2 protocol when error happens in DriverBindingStart() otherwise Fat driver cannot open the DiskIo2 BY_DRIVER. 3. PartitionDxe should create event using TPL_NOTIFY instead of TPL_CALLBACK otherwise asynchronous FileIo may be blocked. Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14680 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
cb1366a8c4
commit
80c83a6995
|
@ -403,8 +403,6 @@ DiskIo2OnReadWriteComplete (
|
||||||
EFI_STATUS TransactionStatus;
|
EFI_STATUS TransactionStatus;
|
||||||
DISK_IO_PRIVATE_DATA *Instance;
|
DISK_IO_PRIVATE_DATA *Instance;
|
||||||
|
|
||||||
gBS->CloseEvent (Event);
|
|
||||||
|
|
||||||
Subtask = (DISK_IO_SUBTASK *) Context;
|
Subtask = (DISK_IO_SUBTASK *) Context;
|
||||||
TransactionStatus = Subtask->BlockIo2Token.TransactionStatus;
|
TransactionStatus = Subtask->BlockIo2Token.TransactionStatus;
|
||||||
Task = Subtask->Task;
|
Task = Subtask->Task;
|
||||||
|
@ -414,26 +412,13 @@ DiskIo2OnReadWriteComplete (
|
||||||
ASSERT (Instance->Signature == DISK_IO_PRIVATE_DATA_SIGNATURE);
|
ASSERT (Instance->Signature == DISK_IO_PRIVATE_DATA_SIGNATURE);
|
||||||
ASSERT (Task->Signature == DISK_IO2_TASK_SIGNATURE);
|
ASSERT (Task->Signature == DISK_IO2_TASK_SIGNATURE);
|
||||||
|
|
||||||
if (Subtask->WorkingBuffer != NULL) {
|
if ((Subtask->WorkingBuffer != NULL) && !EFI_ERROR (TransactionStatus) &&
|
||||||
if (!EFI_ERROR (TransactionStatus) && (Task->Token != NULL) && !Subtask->Write) {
|
(Task->Token != NULL) && !Subtask->Write
|
||||||
CopyMem (Subtask->Buffer, Subtask->WorkingBuffer + Subtask->Offset, Subtask->Length);
|
) {
|
||||||
}
|
CopyMem (Subtask->Buffer, Subtask->WorkingBuffer + Subtask->Offset, Subtask->Length);
|
||||||
|
|
||||||
//
|
|
||||||
// The WorkingBuffer of blocking subtask either points to SharedWorkingBuffer
|
|
||||||
// or will be used by non-blocking subtask which will be freed below.
|
|
||||||
//
|
|
||||||
if (!Subtask->Blocking) {
|
|
||||||
FreeAlignedPages (
|
|
||||||
Subtask->WorkingBuffer,
|
|
||||||
Subtask->Length < Instance->BlockIo->Media->BlockSize
|
|
||||||
? EFI_SIZE_TO_PAGES (Instance->BlockIo->Media->BlockSize)
|
|
||||||
: EFI_SIZE_TO_PAGES (Subtask->Length)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
RemoveEntryList (&Subtask->Link);
|
|
||||||
FreePool (Subtask);
|
DiskIoDestroySubtask (Instance, Subtask);
|
||||||
|
|
||||||
if (EFI_ERROR (TransactionStatus) || IsListEmpty (&Task->Subtasks)) {
|
if (EFI_ERROR (TransactionStatus) || IsListEmpty (&Task->Subtasks)) {
|
||||||
if (Task->Token != NULL) {
|
if (Task->Token != NULL) {
|
||||||
|
@ -961,7 +946,7 @@ DiskIo2ReadWriteDisk (
|
||||||
RemoveEntryList (&Task->Link);
|
RemoveEntryList (&Task->Link);
|
||||||
EfiReleaseLock (&Instance->TaskQueueLock);
|
EfiReleaseLock (&Instance->TaskQueueLock);
|
||||||
|
|
||||||
if (Task->Token != NULL) {
|
if (!EFI_ERROR (Status) && (Task->Token != NULL)) {
|
||||||
//
|
//
|
||||||
// Task->Token should be set to NULL by the DiskIo2OnReadWriteComplete
|
// Task->Token should be set to NULL by the DiskIo2OnReadWriteComplete
|
||||||
// It it's not, that means the non-blocking request was downgraded to blocking request.
|
// It it's not, that means the non-blocking request was downgraded to blocking request.
|
||||||
|
|
|
@ -352,11 +352,11 @@ PartitionDriverBindingStart (
|
||||||
ControllerHandle
|
ControllerHandle
|
||||||
);
|
);
|
||||||
//
|
//
|
||||||
// Close Parent BlockIO2 if has.
|
// Close Parent DiskIo2 if has.
|
||||||
//
|
//
|
||||||
gBS->CloseProtocol (
|
gBS->CloseProtocol (
|
||||||
ControllerHandle,
|
ControllerHandle,
|
||||||
&gEfiBlockIo2ProtocolGuid,
|
&gEfiDiskIo2ProtocolGuid,
|
||||||
This->DriverBindingHandle,
|
This->DriverBindingHandle,
|
||||||
ControllerHandle
|
ControllerHandle
|
||||||
);
|
);
|
||||||
|
@ -822,7 +822,7 @@ PartitionCreateAccessTask (
|
||||||
|
|
||||||
Status = gBS->CreateEvent (
|
Status = gBS->CreateEvent (
|
||||||
EVT_NOTIFY_SIGNAL,
|
EVT_NOTIFY_SIGNAL,
|
||||||
TPL_CALLBACK,
|
TPL_NOTIFY,
|
||||||
PartitionOnAccessComplete,
|
PartitionOnAccessComplete,
|
||||||
Task,
|
Task,
|
||||||
&Task->DiskIo2Token.Event
|
&Task->DiskIo2Token.Event
|
||||||
|
|
Loading…
Reference in New Issue