diff options
author | Hao Wu <hao.a.wu@intel.com> | 2015-12-11 07:36:06 +0000 |
---|---|---|
committer | vanjeff <vanjeff@Edk2> | 2015-12-11 07:36:06 +0000 |
commit | 12c0612023fc1f6f1d62f21810ab146f8e3c6016 (patch) | |
tree | 583f3100f28767cd1ae0e69ac6165f1d049786fb /MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c | |
parent | c3a1d5980474c31dcdb0742a190f35fe7251aca3 (diff) | |
download | edk2-platforms-12c0612023fc1f6f1d62f21810ab146f8e3c6016.tar.xz |
MdeModulePkg ScsiBusDxe: Fix caller event may nerver be signaled
For function ScsiExecuteSCSICommand(), when the 'Event' parameter is not
NULL but the target SCSI device does not support non-blocking I/O, it will
execute a blocking I/O operation instead.
However, after the SCSI operation is done, the 'Event' is not signaled to
inform the caller.
(Sync patch r19217 from main trunk.)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/branches/UDK2015@19224 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c')
-rw-r--r-- | MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c | 46 |
1 files changed, 37 insertions, 9 deletions
diff --git a/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c b/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c index 3e49ffba68..8eb73e7673 100644 --- a/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c +++ b/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c @@ -2,7 +2,7 @@ SCSI Bus driver that layers on every SCSI Pass Thru and
Extended SCSI Pass Thru protocol in the system.
-Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -986,13 +986,34 @@ ScsiExecuteSCSICommand ( if (ScsiIoDevice->ExtScsiSupport) {
ExtRequestPacket = (EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *) Packet;
- Status = ScsiIoDevice->ExtScsiPassThru->PassThru (
- ScsiIoDevice->ExtScsiPassThru,
- Target,
- ScsiIoDevice->Lun,
- ExtRequestPacket,
- Event
- );
+
+ if (((ScsiIoDevice->ExtScsiPassThru->Mode->Attributes & EFI_SCSI_PASS_THRU_ATTRIBUTES_NONBLOCKIO) != 0) && (Event != NULL)) {
+ Status = ScsiIoDevice->ExtScsiPassThru->PassThru (
+ ScsiIoDevice->ExtScsiPassThru,
+ Target,
+ ScsiIoDevice->Lun,
+ ExtRequestPacket,
+ Event
+ );
+ } else {
+ //
+ // If there's no event or the SCSI Device doesn't support NON-BLOCKING,
+ // let the 'Event' parameter for PassThru() be NULL.
+ //
+ Status = ScsiIoDevice->ExtScsiPassThru->PassThru (
+ ScsiIoDevice->ExtScsiPassThru,
+ Target,
+ ScsiIoDevice->Lun,
+ ExtRequestPacket,
+ NULL
+ );
+ if (Event != NULL) {
+ //
+ // Signal Event to tell caller to pick up the SCSI IO Packet.
+ //
+ gBS->SignalEvent (Event);
+ }
+ }
} else {
mWorkingBuffer = AllocatePool (sizeof(EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET));
@@ -1052,7 +1073,7 @@ ScsiExecuteSCSICommand ( ScsiIoDevice->Pun.ScsiId.Scsi,
ScsiIoDevice->Lun,
mWorkingBuffer,
- Event
+ NULL
);
if (EFI_ERROR(Status)) {
FreePool(mWorkingBuffer);
@@ -1065,6 +1086,13 @@ ScsiExecuteSCSICommand ( // free mWorkingBuffer.
//
FreePool(mWorkingBuffer);
+
+ //
+ // Signal Event to tell caller to pick up the SCSI IO Packet.
+ //
+ if (Event != NULL) {
+ gBS->SignalEvent (Event);
+ }
}
}
return Status;
|