From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web11.41814.1585533141735248390 for ; Sun, 29 Mar 2020 18:52:21 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: zhiguang.liu@intel.com) IronPort-SDR: gra3RqZpM/ujkTY9TieiXlpdD2z4ny5T/OtHJA/eiLTaSettwfRNMUFUkxCpzE1656e1ltnjAU 8G90zz3lt7nA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2020 18:52:21 -0700 IronPort-SDR: rhHLSjr/ElAcT+1MZmV1Tu7nuqKxhnVeCY5LYBa/5asDL1RcV21qT4EkhDYrm9TZktR2V1ZFQv +tH9mUX5W3eg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,322,1580803200"; d="scan'208";a="237205998" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga007.jf.intel.com with ESMTP; 29 Mar 2020 18:52:21 -0700 Received: from shsmsx601.ccr.corp.intel.com (10.109.6.141) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 29 Mar 2020 18:52:21 -0700 Received: from shsmsx602.ccr.corp.intel.com (10.109.6.142) by SHSMSX601.ccr.corp.intel.com (10.109.6.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 30 Mar 2020 09:52:18 +0800 Received: from shsmsx602.ccr.corp.intel.com ([10.109.6.142]) by SHSMSX602.ccr.corp.intel.com ([10.109.6.142]) with mapi id 15.01.1713.004; Mon, 30 Mar 2020 09:52:18 +0800 From: "Zhiguang Liu" To: "Zurcher, Christopher J" , "devel@edk2.groups.io" CC: "Kinney, Michael D" , "Wang, Jian J" , "Gao, Liming" Subject: Re: [PATCH v2 1/1] MdePkg/UefiScsiLib: Set FUA bit for synchronous SCSI Write operations Thread-Topic: [PATCH v2 1/1] MdePkg/UefiScsiLib: Set FUA bit for synchronous SCSI Write operations Thread-Index: AQHWA0D7sjdf8x9C4kmiMx9MX7JmRKhgZPcw Date: Mon, 30 Mar 2020 01:52:18 +0000 Message-ID: References: <20200326073424.69960-1-christopher.j.zurcher@intel.com> <20200326073424.69960-2-christopher.j.zurcher@intel.com> In-Reply-To: <20200326073424.69960-2-christopher.j.zurcher@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.36] MIME-Version: 1.0 Return-Path: zhiguang.liu@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Zhiguang Liu > -----Original Message----- > From: Zurcher, Christopher J > Sent: Thursday, March 26, 2020 3:34 PM > To: devel@edk2.groups.io > Cc: Kinney, Michael D ; Wang, Jian J > ; Gao, Liming ; Liu, Zhiguan= g > > Subject: [PATCH v2 1/1] MdePkg/UefiScsiLib: Set FUA bit for synchronous > SCSI Write operations >=20 > 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. >=20 > Cc: Michael D Kinney > Cc: Jian J Wang > Cc: Liming Gao > Cc: Zhiguang Liu > Signed-off-by: Christopher J Zurcher > --- > MdePkg/Include/IndustryStandard/Scsi.h | 8 +++++++- > MdePkg/Library/UefiScsiLib/UefiScsiLib.c | 14 ++++++++------ > 2 files changed, 15 insertions(+), 7 deletions(-) >=20 > diff --git a/MdePkg/Include/IndustryStandard/Scsi.h > b/MdePkg/Include/IndustryStandard/Scsi.h > index 3e966520a1..64b9918b82 100644 > --- a/MdePkg/Include/IndustryStandard/Scsi.h > +++ b/MdePkg/Include/IndustryStandard/Scsi.h > @@ -1,7 +1,7 @@ > /** @file > Support for SCSI-2 standard >=20 > - Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
> + Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > **/ > @@ -175,6 +175,12 @@ > #define EFI_SCSI_DATA_IN 0 > #define EFI_SCSI_DATA_OUT 1 >=20 > +// > +// SCSI Block Command Cache Control Parameters > +// > +#define EFI_SCSI_BLOCK_FUA BIT3 ///< Force Unit Access > +#define EFI_SCSI_BLOCK_DPO BIT4 ///< Disable Page Out > + > // > // Peripheral Device Type Definitions > // > 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 >=20 > - Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
> + Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > **/ > @@ -1055,15 +1055,16 @@ ScsiWrite10Command ( > ZeroMem (&CommandPacket, sizeof > (EFI_SCSI_IO_SCSI_REQUEST_PACKET)); > ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_TEN); >=20 > - CommandPacket.Timeout =3D Timeout; > - CommandPacket.OutDataBuffer =3D DataBuffer; > - CommandPacket.SenseData =3D SenseData; > - CommandPacket.OutTransferLength=3D *DataLength; > - CommandPacket.Cdb =3D Cdb; > + CommandPacket.Timeout =3D Timeout; > + CommandPacket.OutDataBuffer =3D DataBuffer; > + CommandPacket.SenseData =3D SenseData; > + CommandPacket.OutTransferLength =3D *DataLength; > + CommandPacket.Cdb =3D Cdb; > // > // Fill Cdb for Write (10) Command > // > Cdb[0] =3D EFI_SCSI_OP_WRITE10; > + Cdb[1] =3D EFI_SCSI_BLOCK_FUA; > WriteUnaligned32 ((UINT32 *)&Cdb[2], SwapBytes32 (StartLba)); > WriteUnaligned16 ((UINT16 *)&Cdb[7], SwapBytes16 ((UINT16) > SectorSize)); >=20 > @@ -1263,6 +1264,7 @@ ScsiWrite16Command ( > // Fill Cdb for Write (16) Command > // > Cdb[0] =3D EFI_SCSI_OP_WRITE16; > + Cdb[1] =3D EFI_SCSI_BLOCK_FUA; > WriteUnaligned64 ((UINT64 *)&Cdb[2], SwapBytes64 (StartLba)); > WriteUnaligned32 ((UINT32 *)&Cdb[10], SwapBytes32 (SectorSize)); >=20 > -- > 2.16.2.windows.1