summaryrefslogtreecommitdiffstats
path: root/MdePkg/Library/UefiScsiLib
diff options
context:
space:
mode:
authorHao Wu <hao.a.wu@intel.com>2015-12-22 13:55:59 +0000
committerhwu1225 <hwu1225@Edk2>2015-12-22 13:55:59 +0000
commitfbbb3ff3e03ba6ea31f14e7061e1db00cb73ed67 (patch)
tree645d6af906ec815ed7ca3c13c42ad1511eb36e82 /MdePkg/Library/UefiScsiLib
parent9f840a9ea33cd2ce533a3fa923ab5be73c40bed7 (diff)
downloadedk2-fbbb3ff3e03ba6ea31f14e7061e1db00cb73ed67.tar.gz
edk2-fbbb3ff3e03ba6ea31f14e7061e1db00cb73ed67.tar.bz2
edk2-fbbb3ff3e03ba6ea31f14e7061e1db00cb73ed67.zip
MdePkg UefiScsiLib: Close event when SCSI command fails
The ScsiExecuteSCSICommand() function in ScsiBusDxe driver will not signal the event passed from UefiScsiLib when error occurs. In this case, UefiScsiLib should close the event passing to ScsiExecuteSCSICommand(). 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/trunk/edk2@19448 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library/UefiScsiLib')
-rw-r--r--MdePkg/Library/UefiScsiLib/UefiScsiLib.c48
1 files changed, 44 insertions, 4 deletions
diff --git a/MdePkg/Library/UefiScsiLib/UefiScsiLib.c b/MdePkg/Library/UefiScsiLib/UefiScsiLib.c
index d8babcee40..0a08e4468e 100644
--- a/MdePkg/Library/UefiScsiLib/UefiScsiLib.c
+++ b/MdePkg/Library/UefiScsiLib/UefiScsiLib.c
@@ -1494,7 +1494,17 @@ ScsiRead10CommandEx (
goto ErrorExit;
}
- return ScsiIo->ExecuteScsiCommand (ScsiIo, CommandPacket, SelfEvent);
+ Status = ScsiIo->ExecuteScsiCommand (ScsiIo, CommandPacket, SelfEvent);
+ if (EFI_ERROR(Status)) {
+ //
+ // Since ScsiLibNotify() will not be signaled if ExecuteScsiCommand()
+ // returns with error, close the event here.
+ //
+ gBS->CloseEvent (SelfEvent);
+ goto ErrorExit;
+ } else {
+ return EFI_SUCCESS;
+ }
ErrorExit:
if (Context != NULL) {
@@ -1668,7 +1678,17 @@ ScsiWrite10CommandEx (
goto ErrorExit;
}
- return ScsiIo->ExecuteScsiCommand (ScsiIo, CommandPacket, Event);
+ Status = ScsiIo->ExecuteScsiCommand (ScsiIo, CommandPacket, SelfEvent);
+ if (EFI_ERROR(Status)) {
+ //
+ // Since ScsiLibNotify() will not be signaled if ExecuteScsiCommand()
+ // returns with error, close the event here.
+ //
+ gBS->CloseEvent (SelfEvent);
+ goto ErrorExit;
+ } else {
+ return EFI_SUCCESS;
+ }
ErrorExit:
if (Context != NULL) {
@@ -1842,7 +1862,17 @@ ScsiRead16CommandEx (
goto ErrorExit;
}
- return ScsiIo->ExecuteScsiCommand (ScsiIo, CommandPacket, Event);
+ Status = ScsiIo->ExecuteScsiCommand (ScsiIo, CommandPacket, SelfEvent);
+ if (EFI_ERROR(Status)) {
+ //
+ // Since ScsiLibNotify() will not be signaled if ExecuteScsiCommand()
+ // returns with error, close the event here.
+ //
+ gBS->CloseEvent (SelfEvent);
+ goto ErrorExit;
+ } else {
+ return EFI_SUCCESS;
+ }
ErrorExit:
if (Context != NULL) {
@@ -2016,7 +2046,17 @@ ScsiWrite16CommandEx (
goto ErrorExit;
}
- return ScsiIo->ExecuteScsiCommand (ScsiIo, CommandPacket, Event);
+ Status = ScsiIo->ExecuteScsiCommand (ScsiIo, CommandPacket, SelfEvent);
+ if (EFI_ERROR(Status)) {
+ //
+ // Since ScsiLibNotify() will not be signaled if ExecuteScsiCommand()
+ // returns with error, close the event here.
+ //
+ gBS->CloseEvent (SelfEvent);
+ goto ErrorExit;
+ } else {
+ return EFI_SUCCESS;
+ }
ErrorExit:
if (Context != NULL) {