]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg NvmExpressDxe: Fix 'Event' won't be signaled for Admin cmds
authorHao Wu <hao.a.wu@intel.com>
Thu, 1 Sep 2016 02:17:43 +0000 (10:17 +0800)
committerHao Wu <hao.a.wu@intel.com>
Tue, 6 Sep 2016 07:31:43 +0000 (15:31 +0800)
This commit fixes the issue that the caller event passed to
EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL.PassThru() will not be signaled for
NVME Admin commands.

Cc: Feng Tian <feng.tian@intel.com>
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>
MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c

index 96e9d88e5267399f3ea37a1da70464cc02b0b8cc..2c300099455b49bc222cc63ba16f51bb465b691d 100644 (file)
@@ -596,7 +596,7 @@ NvmExpressPassThru (
   //\r
   // Ring the submission queue doorbell.\r
   //\r
-  if (Event != NULL) {\r
+  if ((Event != NULL) && (QueueId != 0)) {\r
     Private->SqTdbl[QueueId].Sqt =\r
       (Private->SqTdbl[QueueId].Sqt + 1) % (NVME_ASYNC_CSQ_SIZE + 1);\r
   } else {\r
@@ -616,7 +616,7 @@ NvmExpressPassThru (
   // For non-blocking requests, return directly if the command is placed\r
   // in the submission queue.\r
   //\r
-  if (Event != NULL) {\r
+  if ((Event != NULL) && (QueueId != 0)) {\r
     AsyncRequest = AllocateZeroPool (sizeof (NVME_PASS_THRU_ASYNC_REQ));\r
     if (AsyncRequest == NULL) {\r
       Status = EFI_DEVICE_ERROR;\r
@@ -699,6 +699,15 @@ NvmExpressPassThru (
                &Data\r
                );\r
 \r
+  //\r
+  // For now, the code does not support the non-blocking feature for admin queue.\r
+  // If Event is not NULL for admin queue, signal the caller's event here.\r
+  //\r
+  if (Event != NULL) {\r
+    ASSERT (QueueId == 0);\r
+    gBS->SignalEvent (Event);\r
+  }\r
+\r
 EXIT:\r
   if (MapData != NULL) {\r
     PciIo->Unmap (\r