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 <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>
This commit is contained in:
Hao Wu 2016-09-01 10:17:43 +08:00
parent 80b405a642
commit aec53afb83
1 changed files with 11 additions and 2 deletions

View File

@ -596,7 +596,7 @@ NvmExpressPassThru (
// //
// Ring the submission queue doorbell. // Ring the submission queue doorbell.
// //
if (Event != NULL) { if ((Event != NULL) && (QueueId != 0)) {
Private->SqTdbl[QueueId].Sqt = Private->SqTdbl[QueueId].Sqt =
(Private->SqTdbl[QueueId].Sqt + 1) % (NVME_ASYNC_CSQ_SIZE + 1); (Private->SqTdbl[QueueId].Sqt + 1) % (NVME_ASYNC_CSQ_SIZE + 1);
} else { } else {
@ -616,7 +616,7 @@ NvmExpressPassThru (
// For non-blocking requests, return directly if the command is placed // For non-blocking requests, return directly if the command is placed
// in the submission queue. // in the submission queue.
// //
if (Event != NULL) { if ((Event != NULL) && (QueueId != 0)) {
AsyncRequest = AllocateZeroPool (sizeof (NVME_PASS_THRU_ASYNC_REQ)); AsyncRequest = AllocateZeroPool (sizeof (NVME_PASS_THRU_ASYNC_REQ));
if (AsyncRequest == NULL) { if (AsyncRequest == NULL) {
Status = EFI_DEVICE_ERROR; Status = EFI_DEVICE_ERROR;
@ -699,6 +699,15 @@ NvmExpressPassThru (
&Data &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: EXIT:
if (MapData != NULL) { if (MapData != NULL) {
PciIo->Unmap ( PciIo->Unmap (