audk/MdeModulePkg/Bus/Pci/NvmExpressDxe
Heyi Guo 9a77210b43 MdeModulePkg/NvmExpressDxe: fix error status override
Commit f6b139b added return status handling to PciIo->Mem.Write.
However, the second status handling will override EFI_DEVICE_ERROR
returned in this branch:

  //
  // Check the NVMe cmd execution result
  //
  if (Status != EFI_TIMEOUT) {
    if ((Cq->Sct == 0) && (Cq->Sc == 0)) {
      Status = EFI_SUCCESS;
    } else {
      Status = EFI_DEVICE_ERROR;
               ^^^^^^^^^^^^^^^^

Since PciIo->Mem.Write will probably return SUCCESS, it causes
NvmExpressPassThru to return SUCCESS even when DEVICE_ERROR occurs.
Callers of NvmExpressPassThru will then continue executing which may
cause further unexpected results, e.g. DiscoverAllNamespaces couldn't
break out the loop.

So we save previous status before calling PciIo->Mem.Write and restore
the previous one if it already contains error.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
2017-12-05 08:28:37 +08:00
..
ComponentName.c
NvmExpress.c MdeModulePkg/NvmExpressDxe: Notify NVME HW when system reset happens 2017-08-09 15:59:13 +08:00
NvmExpress.h MdeModulePkg/NvmExpressDxe: Notify NVME HW when system reset happens 2017-08-09 15:59:13 +08:00
NvmExpressBlockIo.c MdeModulePkg NvmExpressDxe: Add BlockIo2 support 2016-05-19 12:37:59 +08:00
NvmExpressBlockIo.h MdeModulePkg NvmExpressDxe: Add BlockIo2 support 2016-05-19 12:37:59 +08:00
NvmExpressDiskInfo.c
NvmExpressDiskInfo.h
NvmExpressDxe.inf MdeModulePkg/NvmExpressDxe: Notify NVME HW when system reset happens 2017-08-09 15:59:13 +08:00
NvmExpressDxe.uni
NvmExpressDxeExtra.uni
NvmExpressHci.c MdeModulePkg/NvmExpressDxe: Notify NVME HW when system reset happens 2017-08-09 15:59:13 +08:00
NvmExpressHci.h MdeModulePkg: Move/Replace NvmExpressHci.h definitions to Nvme.h. 2016-05-27 13:31:35 +08:00
NvmExpressPassthru.c MdeModulePkg/NvmExpressDxe: fix error status override 2017-12-05 08:28:37 +08:00