summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorSuman Prakash <suman.p@samsung.com>2017-04-20 18:01:42 +0800
committerHao Wu <hao.a.wu@intel.com>2017-04-25 09:10:13 +0800
commit5794c3a92c5059f63d56c015ea44cfee3174d246 (patch)
tree1e75bf6bfa9a8108138d899d2911fd3d4401a310 /MdeModulePkg
parent844a25f983c8b452d097dae4bf658252252a013a (diff)
downloadedk2-5794c3a92c5059f63d56c015ea44cfee3174d246.tar.gz
MdeModulePkg/NvmExpressDxe: Handling return of write to sq and cq db
In case of an async command if updating the submission queue tail doorbell fails then the command will not be picked up by device and no completion response will be created. This scenario has to be handled. Also if we create an AsyncRequest element and insert in the async queue, it will never receive a completion so in the timer routine this element won't be freed, resulting in memory leak. Also in case of blocking calls we should capture the status of updating completion queue head doorbell register and return it to caller of PassThru. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Suman Prakash <suman.p@samsung.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> (cherry picked from commit f6b139bde7e0a39f83ffad30af58136d5b0738a7)
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c
index ef3d772cc2..fb80f39ce8 100644
--- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c
+++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c
@@ -603,7 +603,7 @@ NvmExpressPassThru (
Private->SqTdbl[QueueId].Sqt ^= 1;
}
Data = ReadUnaligned32 ((UINT32*)&Private->SqTdbl[QueueId]);
- PciIo->Mem.Write (
+ Status = PciIo->Mem.Write (
PciIo,
EfiPciIoWidthUint32,
NVME_BAR,
@@ -612,6 +612,10 @@ NvmExpressPassThru (
&Data
);
+ if (EFI_ERROR (Status)) {
+ goto EXIT;
+ }
+
//
// For non-blocking requests, return directly if the command is placed
// in the submission queue.
@@ -695,7 +699,7 @@ NvmExpressPassThru (
}
Data = ReadUnaligned32 ((UINT32*)&Private->CqHdbl[QueueId]);
- PciIo->Mem.Write (
+ Status = PciIo->Mem.Write (
PciIo,
EfiPciIoWidthUint32,
NVME_BAR,