MdeModulePkg NvmExpressDxe: Ensure write-through for NVMe write command
authorHao Wu <hao.a.wu@intel.com>
Fri, 25 Mar 2016 01:46:58 +0000 (09:46 +0800)
committerHao Wu <hao.a.wu@intel.com>
Mon, 18 Apr 2016 01:09:33 +0000 (09:09 +0800)
Set the Force Unit Access (FUA) bit in NVMe Write - Command Dword 12 to
ensure write-through behavior.

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>
MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressBlockIo.c

index 5ac9074..92d7d92 100644 (file)
@@ -127,7 +127,10 @@ WriteSectors (
 \r
   CommandPacket.NvmeCmd->Cdw10 = (UINT32)Lba;\r
   CommandPacket.NvmeCmd->Cdw11 = (UINT32)RShiftU64(Lba, 32);\r
-  CommandPacket.NvmeCmd->Cdw12 = (Blocks - 1) & 0xFFFF;\r
+  //\r
+  // Set Force Unit Access bit (bit 30) to use write-through behaviour\r
+  //\r
+  CommandPacket.NvmeCmd->Cdw12 = ((Blocks - 1) & 0xFFFF) | BIT30;\r
 \r
   CommandPacket.MetadataBuffer = NULL;\r
   CommandPacket.MetadataLength = 0;\r