From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web10.3756.1585102275300815489 for ; Tue, 24 Mar 2020 19:11:15 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: zhiguang.liu@intel.com) IronPort-SDR: f52YXmm8094NSlpWH6eez1oNEVyCWdee2Bc8c64B3aJ8IPMnBg4pkFNU9dksFSMCYHJJOIobCn x42CJ7vs0z3A== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2020 19:11:14 -0700 IronPort-SDR: a2Hn7tx+jxnvQJZw4AJzcgaQeR8bwa8QU9wmexln3pF0wMH56g7k1LUoLQzwLPLrqLOycIycM3 aF1/nUkWhEvw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,302,1580803200"; d="scan'208";a="250278130" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga006.jf.intel.com with ESMTP; 24 Mar 2020 19:11:14 -0700 Received: from shsmsx605.ccr.corp.intel.com (10.109.6.215) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 24 Mar 2020 19:11:14 -0700 Received: from shsmsx602.ccr.corp.intel.com (10.109.6.142) 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; Wed, 25 Mar 2020 10:11:11 +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; Wed, 25 Mar 2020 10:11:11 +0800 From: "Zhiguang Liu" To: "devel@edk2.groups.io" , "Zurcher, Christopher J" CC: "Kinney, Michael D" , "Wang, Jian J" , "Gao, Liming" Subject: Re: [edk2-devel] [PATCH 1/1] MdePkg/UefiScsiLib: Set FUA bit for synchronous SCSI Write operations Thread-Topic: [edk2-devel] [PATCH 1/1] MdePkg/UefiScsiLib: Set FUA bit for synchronous SCSI Write operations Thread-Index: AQHV6SV7+kCVX2V0j02Rron1ROziu6hYtN1g Date: Wed, 25 Mar 2020 02:11:11 +0000 Message-ID: <5f69104e300b47edb4a46a099ba0487a@intel.com> References: <20200222021152.23016-1-christopher.j.zurcher@intel.com> <20200222021152.23016-2-christopher.j.zurcher@intel.com> In-Reply-To: <20200222021152.23016-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 Hi Christopher Could you please give more information about this code change? For example, which Spec the code change is based on. Thanks Zhiguang > -----Original Message----- > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of > Zurcher, Christopher J > Sent: Saturday, February 22, 2020 10:12 AM > To: devel@edk2.groups.io > Cc: Kinney, Michael D ; Wang, Jian J > ; Gao, Liming > Subject: [edk2-devel] [PATCH 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 di= sk > instead of the write cache. This prevents data from being lost if a shut= down > or reset is requested immediately after a SCSI write operation. >=20 > Cc: Michael D Kinney > Cc: Jian J Wang > Cc: Liming Gao > Signed-off-by: Christopher J Zurcher > --- > MdePkg/Library/UefiScsiLib/UefiScsiLib.c | 14 ++++++++------ > 1 file changed, 8 insertions(+), 6 deletions(-) >=20 > diff --git a/MdePkg/Library/UefiScsiLib/UefiScsiLib.c > b/MdePkg/Library/UefiScsiLib/UefiScsiLib.c > index 13a2a1912c..cf78f131bd 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 BIT3; //FUA bit (Force Unit Access) > 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 BIT3; //FUA bit (Force Unit Access) > WriteUnaligned64 ((UINT64 *)&Cdb[2], SwapBytes64 (StartLba)); > WriteUnaligned32 ((UINT32 *)&Cdb[10], SwapBytes32 (SectorSize)); >=20 > -- > 2.16.2.windows.1 >=20 >=20 >=20