From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web10.50548.1585576277979421352 for ; Mon, 30 Mar 2020 06:51:18 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: liming.gao@intel.com) IronPort-SDR: e/6Y04ANUdaeYMvLumRhSBLun23MbNaiqJJc3EOSWkYb0ChVvdjK9jQWjS3ar4Hn7lPLUUNQ3/ hMnK0s504qVg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2020 06:51:17 -0700 IronPort-SDR: NZBZAXSbBqgBZuvrOrZ7NAKzRbNW9lmn4/UGpSr12vKcRHxgpPni5vMKAfS2tB8Mvgkqd62YGl TX8Co18Uheag== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,324,1580803200"; d="scan'208";a="272375187" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga004.fm.intel.com with ESMTP; 30 Mar 2020 06:51:17 -0700 Received: from shsmsx605.ccr.corp.intel.com (10.109.6.215) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 30 Mar 2020 06:51:17 -0700 Received: from shsmsx606.ccr.corp.intel.com (10.109.6.216) by SHSMSX605.ccr.corp.intel.com (10.109.6.215) 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 21:51:14 +0800 Received: from shsmsx606.ccr.corp.intel.com ([10.109.6.216]) by SHSMSX606.ccr.corp.intel.com ([10.109.6.216]) with mapi id 15.01.1713.004; Mon, 30 Mar 2020 21:51:14 +0800 From: "Liming Gao" To: "Liu, Zhiguang" , "Zurcher, Christopher J" , "devel@edk2.groups.io" CC: "Kinney, Michael D" , "Wang, Jian J" 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: AQHWA0D7bYEiAZ6q406VVQDwvW8TW6hf3xEAgAFO3oA= Date: Mon, 30 Mar 2020 13:51:14 +0000 Message-ID: <07f70d5a0ea8442eb776b37aed9f359b@intel.com> References: <20200326073424.69960-1-christopher.j.zurcher@intel.com> <20200326073424.69960-2-christopher.j.zurcher@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.2.0.6 dlp-product: dlpe-windows dlp-reaction: no-action x-originating-ip: [10.239.127.36] MIME-Version: 1.0 Return-Path: liming.gao@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Zurcher: What functionality test has been done for this test? Thanks Liming > -----Original Message----- > From: Liu, Zhiguang > Sent: Monday, March 30, 2020 9:52 AM > 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 synchrono= us SCSI Write operations >=20 > Reviewed-by: Zhiguang Liu >=20 > > -----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, Zhigu= ang > > > > Subject: [PATCH v2 1/1] 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 > > 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(-) > > > > 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 > > > > - 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 > > > > **/ > > @@ -175,6 +175,12 @@ > > #define EFI_SCSI_DATA_IN 0 > > #define EFI_SCSI_DATA_OUT 1 > > > > +// > > +// 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 > > > > - 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 > > > > **/ > > @@ -1055,15 +1055,16 @@ ScsiWrite10Command ( > > ZeroMem (&CommandPacket, sizeof > > (EFI_SCSI_IO_SCSI_REQUEST_PACKET)); > > ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_TEN); > > > > - 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)); > > > > @@ -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)); > > > > -- > > 2.16.2.windows.1