From: Hao Wu Date: Fri, 25 Mar 2016 01:46:58 +0000 (+0800) Subject: MdeModulePkg NvmExpressDxe: Ensure write-through for NVMe write command X-Git-Tag: edk2-stable201903~7298 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=60cfeeb3b656e746f98620cb99a971ee6310b028 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 --- 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;