edk2/MdeModulePkg/Bus
Heyi Guo acaa5d7382 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>
(cherry picked from commit 9a77210b43)
2018-09-20 15:21:29 +08:00
..
Ata MdeModulePkg/AtaAtapiPassThru: Ensure GHC.AE bit is always set in Ahci 2016-11-24 15:54:55 +00:00
I2c/I2cDxe MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
Isa MdeModulePkg Ps2KbDxe: Execute key notify func at TPL_CALLBACK 2016-12-26 18:17:00 +08:00
Pci MdeModulePkg/NvmExpressDxe: fix error status override 2018-09-20 15:21:29 +08:00
Scsi MdeModulePkg/ScsiDiskDxe: Fix undefined behavior in signed left shift 2017-04-13 09:10:48 +08:00
Sd MdeModulePkg/SdBlockIoPei: Support IoMmu 2018-05-10 11:48:37 +08:00
Ufs MdeModulePkg/UfsBlockIoPei: Support IoMmu 2018-05-10 11:48:35 +08:00
Usb MdeModulePkg/UsbBus: Correct debug message 2017-06-02 13:02:01 +08:00