From nobody Tue Apr 23 08:38:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+56368+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+56368+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1585208068; cv=none; d=zohomail.com; s=zohoarc; b=J2kHwUWe7hU+jFWxpp9RbC3oiXAl7vdWABNsIScZ1RcJub4Eoq5ScVqntqA4pIrYZkq0vBJKYDn3N38vl0iaCPMcG0cTKyvOA1ysbdFe6cZcsAkxWPy+3IP7L4OijiVX7SJOA45IG11zj2MJtnvf3Yh+m02MtF3TwkTWZEoxBtw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585208068; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=gSuUHUvZQo6gWCi3TgT3+8bulZGthF2uszzZHR7mP7w=; b=AGZCzLWqLUezJBWxb9IKkE3pygc2ilbABal1TYoW9TdO6x3Pq35YYvb5POWXGNf43bnExA2BAlcfzFTxzYtKyKxEemVHuWZJpDDdG/l20FklhqQ75fecLuzracHR1svuJTLLicX1cxsGhrdwi27Opfoxp1QEWRkzdWWReKaI/r0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+56368+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1585208068069245.35591346301226; Thu, 26 Mar 2020 00:34:28 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id WOHFYY1788612xEGnDLeY1rl; Thu, 26 Mar 2020 00:34:27 -0700 X-Received: from mga01.intel.com (mga01.intel.com []) by mx.groups.io with SMTP id smtpd.web10.32258.1585208066963607856 for ; Thu, 26 Mar 2020 00:34:27 -0700 IronPort-SDR: TzQynDcNtkt/y6V61pFK+/O3VMNjKLkbUetuF8FKrmAPBtVbia8WVFowgOCMwBOEOXHxPg19/4 wZwslKRyiVgA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2020 00:34:26 -0700 IronPort-SDR: h0IY2Hu1D4Q17mxuLS+Jk/9eNb54+Nmpa6GM+X6+RRcVhVNZKSSHiM/cxZS/ZIWQhy8l70hh9O 7dzt4BQOlZAA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,307,1580803200"; d="scan'208";a="393889986" X-Received: from cjzurch-desk.amr.corp.intel.com ([10.9.70.181]) by orsmga004.jf.intel.com with ESMTP; 26 Mar 2020 00:34:25 -0700 From: "Zurcher, Christopher J" To: devel@edk2.groups.io Cc: Michael D Kinney , Jian J Wang , Liming Gao , Zhiguang Liu Subject: [edk2-devel] [PATCH v2 1/1] MdePkg/UefiScsiLib: Set FUA bit for synchronous SCSI Write operations Date: Thu, 26 Mar 2020 00:34:24 -0700 Message-Id: <20200326073424.69960-2-christopher.j.zurcher@intel.com> In-Reply-To: <20200326073424.69960-1-christopher.j.zurcher@intel.com> References: <20200326073424.69960-1-christopher.j.zurcher@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,christopher.j.zurcher@intel.com X-Gm-Message-State: AYL6edZFIyj7wg70cPLhPbSpx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1585208067; bh=vL//8/pq3QUy9WwD6/iU8JDyKJdouq71vvgrzVkSFHU=; h=Cc:Date:From:Reply-To:Subject:To; b=aIsAttd0TRVgSK9BzIfRU07DghLoJ1h1u0Nv/DQjCdyb7EiU8+fHDCK1o82VvRW6akn eNnXsfSBXlX9CWZTByhIpBxLsFyNam5V+3zza6L+t3apRJ0Ukg8tlRIKoN+HytnYaTlqv 9UjXry/AwkqTHoHZ14L+ARdBMixJ1I2rbFM= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Liming Gao Reviewed-by: Zhiguang Liu --- 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/Indust= ryStandard/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/Uefi= ScsiLib/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 --=20 2.16.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#56368): https://edk2.groups.io/g/devel/message/56368 Mute This Topic: https://groups.io/mt/72559353/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-