]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/NvmExpressDxe: Always copy CQ entry to PassThru packet
authorHao Wu <hao.a.wu@intel.com>
Thu, 18 Oct 2018 04:52:04 +0000 (12:52 +0800)
committerHao Wu <hao.a.wu@intel.com>
Thu, 25 Oct 2018 04:41:19 +0000 (12:41 +0800)
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1259

According to the the NVM Express spec Revision 1.1, for some commands,
command-related information will be stored in the Dword 0 of the
completion queue entry.

One case is for the Get Features Command (Section 5.9.2 of the spec),
Dword 0 of the completion queue entry may contain feature information.

Hence, this commit will always copy the content of completion queue entry
to the PassThru packet regardless of the execution result of the command.

Cc: Liangcheng Tang <liangcheng.tang@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c

index bfcd3497949af1d2515e1e1a3a5ee986bb886931..c52e960771eff652fd276a4ad1404c4893aafc0d 100644 (file)
@@ -780,11 +780,6 @@ NvmExpressPassThru (
       Status = EFI_SUCCESS;\r
     } else {\r
       Status = EFI_DEVICE_ERROR;\r
-      //\r
-      // Copy the Respose Queue entry for this command to the callers response buffer\r
-      //\r
-      CopyMem(Packet->NvmeCompletion, Cq, sizeof(EFI_NVM_EXPRESS_COMPLETION));\r
-\r
       //\r
       // Dump every completion entry status for debugging.\r
       //\r
@@ -792,6 +787,10 @@ NvmExpressPassThru (
         NvmeDumpStatus(Cq);\r
       DEBUG_CODE_END();\r
     }\r
+    //\r
+    // Copy the Respose Queue entry for this command to the callers response buffer\r
+    //\r
+    CopyMem(Packet->NvmeCompletion, Cq, sizeof(EFI_NVM_EXPRESS_COMPLETION));\r
   } else {\r
     //\r
     // Timeout occurs for an NVMe command. Reset the controller to abort the\r