From 60cfeeb3b656e746f98620cb99a971ee6310b028 Mon Sep 17 00:00:00 2001 From: Hao Wu Date: Fri, 25 Mar 2016 09:46:58 +0800 Subject: [PATCH] MdeModulePkg NvmExpressDxe: Ensure write-through for NVMe write command 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 Reviewed-by: Feng Tian --- MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressBlockIo.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressBlockIo.c b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressBlockIo.c index 5ac90745bd..92d7d923df 100644 --- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressBlockIo.c +++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressBlockIo.c @@ -127,7 +127,10 @@ WriteSectors ( CommandPacket.NvmeCmd->Cdw10 = (UINT32)Lba; CommandPacket.NvmeCmd->Cdw11 = (UINT32)RShiftU64(Lba, 32); - CommandPacket.NvmeCmd->Cdw12 = (Blocks - 1) & 0xFFFF; + // + // Set Force Unit Access bit (bit 30) to use write-through behaviour + // + CommandPacket.NvmeCmd->Cdw12 = ((Blocks - 1) & 0xFFFF) | BIT30; CommandPacket.MetadataBuffer = NULL; CommandPacket.MetadataLength = 0;