From aec53afb83893dc3ebb971ab5a714e276a81ff62 Mon Sep 17 00:00:00 2001 From: Hao Wu Date: Thu, 1 Sep 2016 10:17:43 +0800 Subject: [PATCH] MdeModulePkg NvmExpressDxe: Fix 'Event' won't be signaled for Admin cmds 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 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu Reviewed-by: Feng Tian --- .../Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c index 96e9d88e52..2c30009945 100644 --- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c +++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c @@ -596,7 +596,7 @@ NvmExpressPassThru ( // // Ring the submission queue doorbell. // - if (Event != NULL) { + if ((Event != NULL) && (QueueId != 0)) { Private->SqTdbl[QueueId].Sqt = (Private->SqTdbl[QueueId].Sqt + 1) % (NVME_ASYNC_CSQ_SIZE + 1); } else { @@ -616,7 +616,7 @@ NvmExpressPassThru ( // For non-blocking requests, return directly if the command is placed // in the submission queue. // - if (Event != NULL) { + if ((Event != NULL) && (QueueId != 0)) { AsyncRequest = AllocateZeroPool (sizeof (NVME_PASS_THRU_ASYNC_REQ)); if (AsyncRequest == NULL) { Status = EFI_DEVICE_ERROR; @@ -699,6 +699,15 @@ NvmExpressPassThru ( &Data ); + // + // For now, the code does not support the non-blocking feature for admin queue. + // If Event is not NULL for admin queue, signal the caller's event here. + // + if (Event != NULL) { + ASSERT (QueueId == 0); + gBS->SignalEvent (Event); + } + EXIT: if (MapData != NULL) { PciIo->Unmap (