diff options
author | Zurcher, Christopher J <christopher.j.zurcher@intel.com> | 2020-03-26 15:34:24 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2020-04-15 01:13:04 +0000 |
commit | 8c654bb3ec0b5232dec2b2b07234c5479eb14d62 (patch) | |
tree | d366c9b0f3c7266f2213f6e58131db43533739be /MdePkg/Library/UefiScsiLib | |
parent | bd6aa93296de36c5afabd34e4fa4083bccb8488d (diff) | |
download | edk2-8c654bb3ec0b5232dec2b2b07234c5479eb14d62.tar.gz edk2-8c654bb3ec0b5232dec2b2b07234c5479eb14d62.tar.bz2 edk2-8c654bb3ec0b5232dec2b2b07234c5479eb14d62.zip |
MdePkg/UefiScsiLib: Set FUA bit for synchronous SCSI Write operations
The FUA (Force Unit Access) bit forces data to be written directly to
disk instead of the write cache. This prevents data from being lost if a
shutdown or reset is requested immediately after a SCSI write operation.
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Christopher J Zurcher <christopher.j.zurcher@intel.com>
Diffstat (limited to 'MdePkg/Library/UefiScsiLib')
-rw-r--r-- | MdePkg/Library/UefiScsiLib/UefiScsiLib.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/MdePkg/Library/UefiScsiLib/UefiScsiLib.c b/MdePkg/Library/UefiScsiLib/UefiScsiLib.c index 13a2a1912c..512bec500c 100644 --- a/MdePkg/Library/UefiScsiLib/UefiScsiLib.c +++ b/MdePkg/Library/UefiScsiLib/UefiScsiLib.c @@ -1,7 +1,7 @@ /** @file
UEFI SCSI Library implementation
- Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -1055,15 +1055,16 @@ ScsiWrite10Command ( ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_TEN);
- CommandPacket.Timeout = Timeout;
- CommandPacket.OutDataBuffer = DataBuffer;
- CommandPacket.SenseData = SenseData;
- CommandPacket.OutTransferLength= *DataLength;
- CommandPacket.Cdb = Cdb;
+ CommandPacket.Timeout = Timeout;
+ CommandPacket.OutDataBuffer = DataBuffer;
+ CommandPacket.SenseData = SenseData;
+ CommandPacket.OutTransferLength = *DataLength;
+ CommandPacket.Cdb = Cdb;
//
// Fill Cdb for Write (10) Command
//
Cdb[0] = EFI_SCSI_OP_WRITE10;
+ Cdb[1] = EFI_SCSI_BLOCK_FUA;
WriteUnaligned32 ((UINT32 *)&Cdb[2], SwapBytes32 (StartLba));
WriteUnaligned16 ((UINT16 *)&Cdb[7], SwapBytes16 ((UINT16) SectorSize));
@@ -1263,6 +1264,7 @@ ScsiWrite16Command ( // Fill Cdb for Write (16) Command
//
Cdb[0] = EFI_SCSI_OP_WRITE16;
+ Cdb[1] = EFI_SCSI_BLOCK_FUA;
WriteUnaligned64 ((UINT64 *)&Cdb[2], SwapBytes64 (StartLba));
WriteUnaligned32 ((UINT32 *)&Cdb[10], SwapBytes32 (SectorSize));
|