From nobody Wed May 15 14:12:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+88788+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88788+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1649781014; cv=none; d=zohomail.com; s=zohoarc; b=m7qmPD6Xh1XV46e0Hd6F101jGTxAWIDzBzAZ9DD3q/KfoA2x13l3bdmULuiNJGsNRapnJco9F8gMGUcv2opRvCUkzNiHMdUwtfjUZeVqQ5RkN94u+QO6ULvYbE2ieOkC9FcPb8ANdQ4qFAMs/T5KJg9XX4M7Mqd4SGkNNu1UP6I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1649781014; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=aKcmINFpcYr4VN8PhV2o1+qxNWyQx4VzjuS3bQaIqf0=; b=dnhWEEschqPb4Q1tYbvkPthhEBm2+y8C6pxQcKCS8A3RkeTxDmdbv0nkkRxQQQeby0BhUy68D9VsvbxuxZlEWeHMxRIC/Z00BZ70TLIM1oTETR3nOedRzg0OWvDmhGh2CeLXbfJnFNFNACtbF0BJJ8l3DqYU27HW/VSs5vPnbCU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88788+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1649781014564497.3335067233911; Tue, 12 Apr 2022 09:30:14 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id xG9VYY1788612xx8yKBotwy0; Tue, 12 Apr 2022 09:30:14 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web08.12893.1649781013456492832 for ; Tue, 12 Apr 2022 09:30:13 -0700 X-Received: from localhost.localdomain (unknown [47.201.46.36]) by linux.microsoft.com (Postfix) with ESMTPSA id 3E2B720B9CF0; Tue, 12 Apr 2022 09:30:12 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 3E2B720B9CF0 From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu , Liming Gao Subject: [edk2-devel] [PATCH v4 1/8] MdeModulePkg: Add Variable Flash Info HOB Date: Tue, 12 Apr 2022 12:29:33 -0400 Message-Id: <20220412162940.4978-2-mikuback@linux.microsoft.com> In-Reply-To: <20220412162940.4978-1-mikuback@linux.microsoft.com> References: <20220412162940.4978-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,mikuback@linux.microsoft.com X-Gm-Message-State: CAWO5eQMcgCrTcwAf42rNCqEx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1649781014; bh=BPLkUciuw+jESOt5Zc24Pn+XFcQT2MoXJh1B/x7BqhM=; h=Cc:Date:From:Reply-To:Subject:To; b=ZFz43pcSNqNFsnt6qqk5PRnT30W7B+eXbw1UBKtRkTrnjEu7LmfWE9R157Vlc7iZ5Ho ac85WFcmdwhvYG+zcVPBs4jlJYTvA/3LJWv+MXkXUEk0H1DLRhi2tsQzYSyrTVZrt9EC0 LJKscNphgTS9dCB84z92D5XBDKWD596DLgA= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1649781015051100005 Content-Type: text/plain; charset="utf-8" From: Michael Kubacki REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3479 Adds a new GUID that is used to identify a HOB that passes variable flash information to UEFI variable drivers in HOB consumption phases such as DXE, Traditional MM, and Standalone MM. This information was previously passed directly with PCDs such as EfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase and gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize. However, the Standalone MM variable driver instance does not have direct access to the PCD database. Therefore, this HOB will first be considered as the source for variable flash information and if platforms do not produce the HOB, reading the information from the PCDs directly will be a backup to provide backward compatibility. Cc: Jian J Wang Cc: Hao A Wu Cc: Liming Gao Signed-off-by: Michael Kubacki Acked-by: Ard Biesheuvel Reviewed-by: Sami Mujawar --- MdeModulePkg/Include/Guid/VariableFlashInfo.h | 111 ++++++++++++++++++++ MdeModulePkg/MdeModulePkg.dec | 4 + 2 files changed, 115 insertions(+) diff --git a/MdeModulePkg/Include/Guid/VariableFlashInfo.h b/MdeModulePkg/I= nclude/Guid/VariableFlashInfo.h new file mode 100644 index 000000000000..992a0dcdd384 --- /dev/null +++ b/MdeModulePkg/Include/Guid/VariableFlashInfo.h @@ -0,0 +1,111 @@ +/** @file + This file defines the GUID and data structure used to pass information a= bout + a variable store mapped on flash (i.e. a MMIO firmware volume) to the mo= dules + that consume that information such as the DXE and MM UEFI variable drive= rs. + + The HOB described in this file is currently optional. It is primarily pr= ovided + to allow a platform to dynamically describe the flash information to env= ironments + such as Standalone MM that cannot access the prior method using dynamic = PCDs. + + Even for platforms that use Standalone MM, if the information is only st= ored + statically such as with FixedAtBuild PCDs, the HOB is not required. + + Every point of consumption in this package that uses the PCDs will first= check + for the HOB and use its value if present. + + Early modules such as the PEI UEFI variable driver might also consume th= is + information. For modules such as these, that execute early in the boot f= low, + at least two approaches are possible depending on platform design. + + 1. If the information in the HOB exactly matches the information in the = PCDs, + (i.e. the HOB values are set using the PCD values), let the driver re= ad + the information from the PCD and produce the HOB later in boot. + + 2. Produce the HOB very early in boot. For example, the earliest point t= he HOB + is currently consumed is in FaultTolerantWritePei. Note that FaultTol= erantWritePei + produces gEdkiiFaultTolerantWriteGuid which is a dependency for Varia= blePei. + + Therefore, attaching a NULL class library to FaultTolerantWritePei wi= th a + constructor that produces the HOB will guarantee it is produced befor= e the first + point of consumption as the constructor is executed before the module= entry point. + + Copyright (c) Microsoft Corporation.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef VARIABLE_FLASH_INFO_H_ +#define VARIABLE_FLASH_INFO_H_ + +#define VARIABLE_FLASH_INFO_HOB_GUID \ + { 0x5d11c653, 0x8154, 0x4ac3, { 0xa8, 0xc2, 0xfb, 0xa2, 0x89, 0x20, 0xfc= , 0x90 }} + +#define VARIABLE_FLASH_INFO_HOB_VERSION 1 + +extern EFI_GUID gVariableFlashInfoHobGuid; + +#pragma pack (push, 1) + +/// +/// This structure can be used to describe UEFI variable +/// flash information. +/// +typedef struct { + /// + /// Version of this structure. + /// + /// Increment the value when the structure is modified. + /// + UINT32 Version; + /// + /// Reserved field. + /// + /// Currently reserved for natural alignment. + /// + UINT32 Reserved; + /// + /// Base address of the non-volatile variable range in the flash device. + /// + /// Note that this address should align with the block size requirements= of the flash device. + /// + EFI_PHYSICAL_ADDRESS NvVariableBaseAddress; + /// + /// Size of the non-volatile variable range in the flash device. + /// + /// Note that this value should be less than or equal to FtwSpareLength = to support reclaim of + /// entire variable store area. + /// Note that this address should align with the block size requirements= of the flash device. + /// + UINT64 NvVariableLength; + /// + /// Base address of the FTW spare block range in the flash device. + /// + /// Note that this address should align with the block size requirements= of the flash device. + /// + EFI_PHYSICAL_ADDRESS FtwSpareBaseAddress; + /// + /// Size of the FTW spare block range in the flash device. + /// + /// Note that this value should be greater than or equal to NvVariableLe= ngth. + /// Note that this address should align with the block size requirements= of the flash device. + /// + UINT64 FtwSpareLength; + /// + /// Base address of the FTW working block range in the flash device. + /// + /// Note that if FtwWorkingLength is larger than on block size, this val= ue should be block size aligned. + /// + EFI_PHYSICAL_ADDRESS FtwWorkingBaseAddress; + /// + /// Size of the FTW working block range in the flash device. + /// + /// Note that if the value is less than on block size, the range should = not span blocks. + /// Note that if the value is larger than one block size, this value sho= uld be block size aligned. + /// + UINT64 FtwWorkingLength; +} VARIABLE_FLASH_INFO; + +#pragma pack (pop) + +#endif diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index cf79292ec877..4e82f5836096 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -226,6 +226,10 @@ [Guids] # Include/Guid/SmmVariableCommon.h gSmmVariableWriteGuid =3D { 0x93ba1826, 0xdffb, 0x45dd, { 0x82, 0xa7, 0= xe7, 0xdc, 0xaa, 0x3b, 0xbd, 0xf3 }} =20 + ## Guid of the variable flash information HOB. + # Include/Guid/VariableFlashInfo.h + gVariableFlashInfoHobGuid =3D { 0x5d11c653, 0x8154, 0x4ac3, { 0xa8, 0xc2= , 0xfb, 0xa2, 0x89, 0x20, 0xfc, 0x90 }} + ## Performance protocol guid that also acts as the performance HOB guid = and performance variable GUID # Include/Guid/Performance.h gPerformanceProtocolGuid =3D { 0x76B6BDFA, 0x2ACD, 0x4462, { 0x9E,= 0x3F, 0xCB, 0x58, 0xC9, 0x69, 0xD9, 0x37 } } --=20 2.28.0.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 (#88788): https://edk2.groups.io/g/devel/message/88788 Mute This Topic: https://groups.io/mt/90421970/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- From nobody Wed May 15 14:12:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+88789+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88789+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1649781017; cv=none; d=zohomail.com; s=zohoarc; b=oI8FDnT9cnI3rS8ZwUY0opYaNATRGciuwSlx8KwXET+WX0k1A8PR0O7quAOhAqNhLKSRl99SLWH4zi2eYowtPTDNIqJSbmlNVJ+oIRby59dEAa/GRZtDN7/8axrVAnfdlx1J/hZBPLgOF8FHkcD0mWCAjO4/xn0o2Zcs+wh5oeg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1649781017; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=XR7hXr+VGRpSyw2BFwNEJGAsw1djzy1uJX2ZY0Y0KxY=; b=VfuxuPZFhGjWtSVqLH/+w0pVSPAt1chFZPC+dGWeLZKu9iqfBo+xjznrjh4IuxFCLL1nb7TrquZlbZedRFIz1lhzJkhSEim4Hli5mRTRWlxEf2VBaMahOzhHLg35FZ85m2V/eT4s85rQxBd+1/hnch61bNGkGBfMc4ncSxkepGo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88789+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 164978101774722.802367141934837; Tue, 12 Apr 2022 09:30:17 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id u6abYY1788612xQewgpU6oiE; Tue, 12 Apr 2022 09:30:17 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web11.12884.1649781016418287139 for ; Tue, 12 Apr 2022 09:30:16 -0700 X-Received: from localhost.localdomain (unknown [47.201.46.36]) by linux.microsoft.com (Postfix) with ESMTPSA id 7BB1C20B36F7; Tue, 12 Apr 2022 09:30:15 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 7BB1C20B36F7 From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu , Liming Gao Subject: [edk2-devel] [PATCH v4 2/8] MdeModulePkg/VariableFlashInfoLib: Add initial library Date: Tue, 12 Apr 2022 12:29:34 -0400 Message-Id: <20220412162940.4978-3-mikuback@linux.microsoft.com> In-Reply-To: <20220412162940.4978-1-mikuback@linux.microsoft.com> References: <20220412162940.4978-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,mikuback@linux.microsoft.com X-Gm-Message-State: 01idPT9ENyurHfITPEJ0qw7dx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1649781017; bh=gCeMyNTynbiPUFed21LW7DyQvhVI+Dp/7JkTkJMbV5Y=; h=Cc:Date:From:Reply-To:Subject:To; b=fp9Usq+R5ofdfFBFTnrqiPfxVI7qliuCRhKz/Yaq3sFBbaSSLFk7zMVgwXOU1i8q8Zo rgfrOYdDF77cILhUfvLfRjTfTFcamAWpmr7pYH16FrXuyNA2wg1nUHqOSNYtKCUaXy4NP Lq1EShdBmj+aeen3d/g19uahF5ZWkrIoR34= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1649781018881100001 Content-Type: text/plain; charset="utf-8" From: Michael Kubacki REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3479 Adds a new library class VariableFlashInfoLib that abstracts access to variable flash information. The instance provided first attempts to retrieve information from the Variable Flash Info HOB. If that HOB is not present, it falls back to the PCDs defined in MdeModulePkg. This fall back behavior provides backward compatibility for platforms that only provide PCDs but also allows platforms that need to dynamically provide the information using the Variable Flash Info HOB to do so at runtime. Cc: Jian J Wang Cc: Hao A Wu Cc: Liming Gao Signed-off-by: Michael Kubacki Acked-by: Ard Biesheuvel Reviewed-by: Sami Mujawar --- MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.c = | 178 ++++++++++++++++++++ MdeModulePkg/Include/Library/VariableFlashInfoLib.h = | 68 ++++++++ MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf= | 48 ++++++ MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.uni= | 12 ++ MdeModulePkg/MdeModulePkg.dec = | 4 + MdeModulePkg/MdeModulePkg.dsc = | 2 + 6 files changed, 312 insertions(+) diff --git a/MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlas= hInfoLib.c b/MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlas= hInfoLib.c new file mode 100644 index 000000000000..a1db97bdf218 --- /dev/null +++ b/MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLi= b.c @@ -0,0 +1,178 @@ +/** @file + Variable Flash Information Library + + Copyright (c) Microsoft Corporation
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include + +/** + Get the HOB that contains variable flash information. + + @param[out] VariableFlashInfo Pointer to a pointer to set to the varia= ble flash information structure. + + @retval EFI_SUCCESS Variable flash information was found suc= cessfully. + @retval EFI_INVALID_PARAMETER The VariableFlashInfo pointer given is N= ULL. + @retval EFI_NOT_FOUND Variable flash information could not be = found. + +**/ +EFI_STATUS +GetVariableFlashInfoFromHob ( + OUT VARIABLE_FLASH_INFO **VariableFlashInfo + ) +{ + EFI_HOB_GUID_TYPE *GuidHob; + + if (VariableFlashInfo =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + GuidHob =3D GetFirstGuidHob (&gVariableFlashInfoHobGuid); + if (GuidHob =3D=3D NULL) { + return EFI_NOT_FOUND; + } + + *VariableFlashInfo =3D GET_GUID_HOB_DATA (GuidHob); + + // + // Assert if more than one variable flash information HOB is present. + // + DEBUG_CODE ( + if ((GetNextGuidHob (&gVariableFlashInfoHobGuid, GET_NEXT_HOB (GuidHob= )) !=3D NULL)) { + DEBUG ((DEBUG_ERROR, "ERROR: Found two variable flash information HOBs= \n")); + ASSERT (FALSE); + } + + ); + + return EFI_SUCCESS; +} + +/** + Get the base address and size for the NV storage area used for UEFI vari= able storage. + + @param[out] BaseAddress The NV storage base address. + @param[out] Length The NV storage length in bytes. + + @retval EFI_SUCCESS NV storage information was found success= fully. + @retval EFI_INVALID_PARAMETER A required pointer parameter is NULL. + +**/ +EFI_STATUS +EFIAPI +GetVariableFlashNvStorageInfo ( + OUT EFI_PHYSICAL_ADDRESS *BaseAddress, + OUT UINT64 *Length + ) +{ + EFI_STATUS Status; + VARIABLE_FLASH_INFO *VariableFlashInfo; + + if ((BaseAddress =3D=3D NULL) || (Length =3D=3D NULL)) { + return EFI_INVALID_PARAMETER; + } + + Status =3D GetVariableFlashInfoFromHob (&VariableFlashInfo); + if (!EFI_ERROR (Status)) { + *BaseAddress =3D VariableFlashInfo->NvVariableBaseAddress; + *Length =3D VariableFlashInfo->NvVariableLength; + } else { + *BaseAddress =3D (EFI_PHYSICAL_ADDRESS)(PcdGet64 (PcdFlashNvStorageVar= iableBase64) !=3D 0 ? + PcdGet64 (PcdFlashNvStorageVaria= bleBase64) : + PcdGet32 (PcdFlashNvStorageVaria= bleBase) + ); + *Length =3D (UINT64)PcdGet32 (PcdFlashNvStorageVariableSize); + } + + return EFI_SUCCESS; +} + +/** + Get the base address and size for the fault tolerant write (FTW) spare + area used for UEFI variable storage. + + @param[out] BaseAddress The FTW spare base address. + @param[out] Length The FTW spare length in bytes. + + @retval EFI_SUCCESS FTW spare information was found successf= ully. + @retval EFI_INVALID_PARAMETER A required pointer parameter is NULL. + @retval EFI_NOT_FOUND FTW spare information could not be found. + +**/ +EFI_STATUS +EFIAPI +GetVariableFlashFtwSpareInfo ( + OUT EFI_PHYSICAL_ADDRESS *BaseAddress, + OUT UINT64 *Length + ) +{ + EFI_STATUS Status; + VARIABLE_FLASH_INFO *VariableFlashInfo; + + if ((BaseAddress =3D=3D NULL) || (Length =3D=3D NULL)) { + return EFI_INVALID_PARAMETER; + } + + Status =3D GetVariableFlashInfoFromHob (&VariableFlashInfo); + if (!EFI_ERROR (Status)) { + *BaseAddress =3D VariableFlashInfo->FtwSpareBaseAddress; + *Length =3D VariableFlashInfo->FtwSpareLength; + } else { + *BaseAddress =3D (EFI_PHYSICAL_ADDRESS)(PcdGet64 (PcdFlashNvStorageFtw= SpareBase64) !=3D 0 ? + PcdGet64 (PcdFlashNvStorageFtwSp= areBase64) : + PcdGet32 (PcdFlashNvStorageFtwSp= areBase) + ); + *Length =3D (UINT64)PcdGet32 (PcdFlashNvStorageFtwSpareSize); + } + + return EFI_SUCCESS; +} + +/** + Get the base address and size for the fault tolerant write (FTW) working + area used for UEFI variable storage. + + @param[out] BaseAddress The FTW working area base address. + @param[out] Length The FTW working area length in bytes. + + @retval EFI_SUCCESS FTW working information was found succes= sfully. + @retval EFI_INVALID_PARAMETER A required pointer parameter is NULL. + @retval EFI_NOT_FOUND FTW working information could not be fou= nd. + +**/ +EFI_STATUS +EFIAPI +GetVariableFlashFtwWorkingInfo ( + OUT EFI_PHYSICAL_ADDRESS *BaseAddress, + OUT UINT64 *Length + ) +{ + EFI_STATUS Status; + VARIABLE_FLASH_INFO *VariableFlashInfo; + + if ((BaseAddress =3D=3D NULL) || (Length =3D=3D NULL)) { + return EFI_INVALID_PARAMETER; + } + + Status =3D GetVariableFlashInfoFromHob (&VariableFlashInfo); + if (!EFI_ERROR (Status)) { + *BaseAddress =3D VariableFlashInfo->FtwWorkingBaseAddress; + *Length =3D VariableFlashInfo->FtwWorkingLength; + } else { + *BaseAddress =3D (EFI_PHYSICAL_ADDRESS)(PcdGet64 (PcdFlashNvStorageFtw= WorkingBase64) !=3D 0 ? + PcdGet64 (PcdFlashNvStorageFtwWo= rkingBase64) : + PcdGet32 (PcdFlashNvStorageFtwWo= rkingBase) + ); + *Length =3D (UINT64)PcdGet32 (PcdFlashNvStorageFtwWorkingSize); + } + + return EFI_SUCCESS; +} diff --git a/MdeModulePkg/Include/Library/VariableFlashInfoLib.h b/MdeModul= ePkg/Include/Library/VariableFlashInfoLib.h new file mode 100644 index 000000000000..1367be9376ea --- /dev/null +++ b/MdeModulePkg/Include/Library/VariableFlashInfoLib.h @@ -0,0 +1,68 @@ +/** @file + Variable Flash Information Library + +Copyright (c) Microsoft Corporation
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef VARIABLE_FLASH_INFO_LIB_H_ +#define VARIABLE_FLASH_INFO_LIB_H_ + +/** + Get the base address and size for the NV storage area used for UEFI vari= able storage. + + @param[out] BaseAddress The NV storage base address. + @param[out] Length The NV storage length in bytes. + + @retval EFI_SUCCESS NV storage information was found success= fully. + @retval EFI_INVALID_PARAMETER A required pointer parameter is NULL. + @retval EFI_NOT_FOUND NV storage information could not be foun= d. + +**/ +EFI_STATUS +EFIAPI +GetVariableFlashNvStorageInfo ( + OUT EFI_PHYSICAL_ADDRESS *BaseAddress, + OUT UINT64 *Length + ); + +/** + Get the base address and size for the fault tolerant write (FTW) spare + area used for UEFI variable storage. + + @param[out] BaseAddress The FTW spare base address. + @param[out] Length The FTW spare length in bytes. + + @retval EFI_SUCCESS FTW spare information was found successf= ully. + @retval EFI_INVALID_PARAMETER A required pointer parameter is NULL. + @retval EFI_NOT_FOUND FTW spare information could not be found. + +**/ +EFI_STATUS +EFIAPI +GetVariableFlashFtwSpareInfo ( + OUT EFI_PHYSICAL_ADDRESS *BaseAddress, + OUT UINT64 *Length + ); + +/** + Get the base address and size for the fault tolerant write (FTW) working + area used for UEFI variable storage. + + @param[out] BaseAddress The FTW working area base address. + @param[out] Length The FTW working area length in bytes. + + @retval EFI_SUCCESS FTW working information was found succes= sfully. + @retval EFI_INVALID_PARAMETER A required pointer parameter is NULL. + @retval EFI_NOT_FOUND FTW working information could not be fou= nd. + +**/ +EFI_STATUS +EFIAPI +GetVariableFlashFtwWorkingInfo ( + OUT EFI_PHYSICAL_ADDRESS *BaseAddress, + OUT UINT64 *Length + ); + +#endif diff --git a/MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlas= hInfoLib.inf b/MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFl= ashInfoLib.inf new file mode 100644 index 000000000000..70175e75f9b1 --- /dev/null +++ b/MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLi= b.inf @@ -0,0 +1,48 @@ +## @file +# Variable Flash Information Library +# +# Provides services to access UEFI variable flash information. +# +# Copyright (c) Microsoft Corporation
+# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D BaseVariableFlashInfoLib + MODULE_UNI_FILE =3D BaseVariableFlashInfoLib.uni + FILE_GUID =3D DEC426C9-C92E-4BAD-8E93-3F61C261118B + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D VariableFlashInfoLib + +# +# The following information is for reference only and not required by the = build tools. +# +# VALID_ARCHITECTURES =3D ANY +# + +[Sources] + BaseVariableFlashInfoLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[LibraryClasses] + DebugLib + HobLib + +[Guids] + gVariableFlashInfoHobGuid ## CONSUMES ## HOB + +[Pcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase ## SOM= ETIMES_CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 ## SOM= ETIMES_CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize ## SOM= ETIMES_CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase ## SOM= ETIMES_CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64 ## SOM= ETIMES_CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize ## SOM= ETIMES_CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase ## SOM= ETIMES_CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64 ## SOM= ETIMES_CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize ## SOM= ETIMES_CONSUMES diff --git a/MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlas= hInfoLib.uni b/MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFl= ashInfoLib.uni new file mode 100644 index 000000000000..9a5348fa02a0 --- /dev/null +++ b/MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLi= b.uni @@ -0,0 +1,12 @@ +// /** @file +// Variable Flash Information Library +// +// Copyright (c) Microsoft Corporation
+// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// **/ + +#string STR_MODULE_ABSTRACT #language en-US "UEFI variable flash infor= mation library" + +#string STR_MODULE_DESCRIPTION #language en-US "Provides services to acce= ss UEFI variable flash information." diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 4e82f5836096..2bcb9f9453af 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -154,6 +154,10 @@ [LibraryClasses] # VariablePolicyHelperLib|Include/Library/VariablePolicyHelperLib.h =20 + ## @libraryclass Provides services to access UEFI variable flash infor= mation. + # + VariableFlashInfoLib|Include/Library/VariableFlashInfoLib.h + [Guids] ## MdeModule package token space guid # Include/Guid/MdeModulePkgTokenSpace.h diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc index b1d83461865e..90a0a7ec4a7c 100644 --- a/MdeModulePkg/MdeModulePkg.dsc +++ b/MdeModulePkg/MdeModulePkg.dsc @@ -103,6 +103,7 @@ [LibraryClasses] DisplayUpdateProgressLib|MdeModulePkg/Library/DisplayUpdateProgressLibGr= aphics/DisplayUpdateProgressLibGraphics.inf VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Var= iablePolicyHelperLib.inf MmUnblockMemoryLib|MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibN= ull.inf + VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseV= ariableFlashInfoLib.inf =20 [LibraryClasses.EBC.PEIM] IoLib|MdePkg/Library/PeiIoLibCpuIo/PeiIoLibCpuIo.inf @@ -440,6 +441,7 @@ [Components] MdeModulePkg/Library/FmpAuthenticationLibNull/FmpAuthenticationLibNull.i= nf MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf + MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.i= nf =20 [Components.IA32, Components.X64, Components.AARCH64] MdeModulePkg/Universal/EbcDxe/EbcDxe.inf --=20 2.28.0.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 (#88789): https://edk2.groups.io/g/devel/message/88789 Mute This Topic: https://groups.io/mt/90421972/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- From nobody Wed May 15 14:12:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+88790+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88790+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1649781020; cv=none; d=zohomail.com; s=zohoarc; b=QjSGkrwHKZh52VQqsDwqYwX5Kfv/SKbSO5C2T1u1RSG02U0DcQIdCgjt3ucJAzsfPVnbe/wuTiZH9O5UXsZJIvKae4ytbEovQMeNeswBPhtfQgdcnLnRIGgEqMbuy9/0c3sSuWBwuC6v8fxH6Q/wTeQoQdmVL3G5LPYpgyDTNgQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1649781020; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=IJ4J9MEGZAkQguOC4VPY/CaIKve1FCu/VyjDTj9HYlo=; b=SBmp6wcbxbNnttV/IUf07T8kJmmlotm/k2T6z23/EwBP9lLPqWRSbKDjPCLtAkOA2S9Gh6fJaoCtkCrf5cn9+nO/CmMQ5L5510MbuZyMkWcoDMYbwgOXZF09433su9z2ZNYa9SvlwKykqzrrd9aKAPB5QdFD+FGrBeio0Y48Z+4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88790+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1649781020929442.3905748982269; Tue, 12 Apr 2022 09:30:20 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id yRT3YY1788612xrLKqioNfFI; Tue, 12 Apr 2022 09:30:20 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web10.12890.1649781019589430366 for ; Tue, 12 Apr 2022 09:30:19 -0700 X-Received: from localhost.localdomain (unknown [47.201.46.36]) by linux.microsoft.com (Postfix) with ESMTPSA id 7ED5820BE4A2; Tue, 12 Apr 2022 09:30:18 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 7ED5820BE4A2 From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu , Liming Gao Subject: [edk2-devel] [PATCH v4 3/8] MdeModulePkg/Variable: Consume Variable Flash Info Date: Tue, 12 Apr 2022 12:29:35 -0400 Message-Id: <20220412162940.4978-4-mikuback@linux.microsoft.com> In-Reply-To: <20220412162940.4978-1-mikuback@linux.microsoft.com> References: <20220412162940.4978-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,mikuback@linux.microsoft.com X-Gm-Message-State: QR3DfLlLdHgGmal0JG1KuzYhx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1649781020; bh=G+VJfeYlVBAr3ShBYEyrv/xQvemH5cefJooKjXIZXgU=; h=Cc:Date:From:Reply-To:Subject:To; b=VWUhUJsQMD32iF7EsaUAAZyPH0aIxaqXdtoxZSHz30otoufxBjab6W2bS9JzCQDt8Mv QR8wnJJgPH6DGFSxR9xcG9K+9tELsf60p7GxLsIo+JKTXDNTtMvodTO1qDBOXhz6rlWUY JdXqdl5Nt/5bW7SdC/egPDGPbSa/8ErxIUI= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1649781022869100007 Content-Type: text/plain; charset="utf-8" From: Michael Kubacki REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3479 Updates VariableRuntimeDxe, VariableSmm, and VariableStandaloneMm to acquire variable flash information from the Variable Flash Information library. Cc: Jian J Wang Cc: Hao A Wu Cc: Liming Gao Signed-off-by: Michael Kubacki Acked-by: Ard Biesheuvel Reviewed-by: Sami Mujawar --- MdeModulePkg/Universal/Variable/Pei/Variable.c | 14 += ++++++++----- MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c | 16 += +++++++++++---- MdeModulePkg/Universal/Variable/RuntimeDxe/VariableNonVolatile.c | 14 += +++++++++---- MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c | 17 += ++++++++++++---- MdeModulePkg/Universal/Variable/Pei/Variable.h | 2 ++ MdeModulePkg/Universal/Variable/Pei/VariablePei.inf | 5 += +--- MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.h | 7 += +----- MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf | 5 += +--- MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf | 5 += +--- MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf | 5 += +--- 10 files changed, 56 insertions(+), 34 deletions(-) diff --git a/MdeModulePkg/Universal/Variable/Pei/Variable.c b/MdeModulePkg/= Universal/Variable/Pei/Variable.c index b36dd0de67b2..26a4c73b45a5 100644 --- a/MdeModulePkg/Universal/Variable/Pei/Variable.c +++ b/MdeModulePkg/Universal/Variable/Pei/Variable.c @@ -567,11 +567,13 @@ GetVariableStore ( OUT VARIABLE_STORE_INFO *StoreInfo ) { + EFI_STATUS Status; EFI_HOB_GUID_TYPE *GuidHob; EFI_FIRMWARE_VOLUME_HEADER *FvHeader; VARIABLE_STORE_HEADER *VariableStoreHeader; EFI_PHYSICAL_ADDRESS NvStorageBase; UINT32 NvStorageSize; + UINT64 NvStorageSize64; FAULT_TOLERANT_WRITE_LAST_WRITE_DATA *FtwLastWriteData; UINT32 BackUpOffset; =20 @@ -591,11 +593,13 @@ GetVariableStore ( // Emulated non-volatile variable mode is not enabled. // =20 - NvStorageSize =3D PcdGet32 (PcdFlashNvStorageVariableSize); - NvStorageBase =3D (EFI_PHYSICAL_ADDRESS)(PcdGet64 (PcdFlashNvStora= geVariableBase64) !=3D 0 ? - PcdGet64 (PcdFlashNvStorage= VariableBase64) : - PcdGet32 (PcdFlashNvStorage= VariableBase) - ); + Status =3D GetVariableFlashNvStorageInfo (&NvStorageBase, &NvStora= geSize64); + ASSERT_EFI_ERROR (Status); + + Status =3D SafeUint64ToUint32 (NvStorageSize64, &NvStorageSize); + // This driver currently assumes the size will be UINT32 so assert= the value is safe for now. + ASSERT_EFI_ERROR (Status); + ASSERT (NvStorageBase !=3D 0); =20 // diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c b/Mde= ModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c index 03fec3048dc4..d5c409c914d1 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c @@ -423,6 +423,8 @@ FtwNotificationEvent ( EFI_PHYSICAL_ADDRESS VariableStoreBase; UINT64 VariableStoreLength; UINTN FtwMaxBlockSize; + UINT32 NvStorageVariableSize; + UINT64 NvStorageVariableSize64; =20 // // Ensure FTW protocol is installed. @@ -432,14 +434,20 @@ FtwNotificationEvent ( return; } =20 + Status =3D GetVariableFlashNvStorageInfo (&NvStorageVariableBase, &NvSto= rageVariableSize64); + ASSERT_EFI_ERROR (Status); + + Status =3D SafeUint64ToUint32 (NvStorageVariableSize64, &NvStorageVariab= leSize); + // This driver currently assumes the size will be UINT32 so assert the v= alue is safe for now. + ASSERT_EFI_ERROR (Status); + + VariableStoreBase =3D NvStorageVariableBase + mNvFvHeaderCache->HeaderLe= ngth; + Status =3D FtwProtocol->GetMaxBlockSize (FtwProtocol, &FtwMaxBlockSize); if (!EFI_ERROR (Status)) { - ASSERT (PcdGet32 (PcdFlashNvStorageVariableSize) <=3D FtwMaxBlockSize); + ASSERT (NvStorageVariableSize <=3D FtwMaxBlockSize); } =20 - NvStorageVariableBase =3D NV_STORAGE_VARIABLE_BASE; - VariableStoreBase =3D NvStorageVariableBase + mNvFvHeaderCache->Head= erLength; - // // Let NonVolatileVariableBase point to flash variable store base direct= ly after FTW ready. // diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableNonVolatile= .c b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableNonVolatile.c index 5e9d40b67ac2..9e2d8fe0fe0c 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableNonVolatile.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableNonVolatile.c @@ -142,6 +142,7 @@ InitRealNonVolatileVariableStore ( EFI_PHYSICAL_ADDRESS NvStorageBase; UINT8 *NvStorageData; UINT32 NvStorageSize; + UINT64 NvStorageSize64; FAULT_TOLERANT_WRITE_LAST_WRITE_DATA *FtwLastWriteData; UINT32 BackUpOffset; UINT32 BackUpSize; @@ -153,19 +154,24 @@ InitRealNonVolatileVariableStore ( =20 mVariableModuleGlobal->FvbInstance =3D NULL; =20 + Status =3D GetVariableFlashNvStorageInfo (&NvStorageBase, &NvStorageSize= 64); + ASSERT_EFI_ERROR (Status); + + Status =3D SafeUint64ToUint32 (NvStorageSize64, &NvStorageSize); + // This driver currently assumes the size will be UINT32 so assert the v= alue is safe for now. + ASSERT_EFI_ERROR (Status); + + ASSERT (NvStorageBase !=3D 0); + // // Allocate runtime memory used for a memory copy of the FLASH region. // Keep the memory and the FLASH in sync as updates occur. // - NvStorageSize =3D PcdGet32 (PcdFlashNvStorageVariableSize); NvStorageData =3D AllocateRuntimeZeroPool (NvStorageSize); if (NvStorageData =3D=3D NULL) { return EFI_OUT_OF_RESOURCES; } =20 - NvStorageBase =3D NV_STORAGE_VARIABLE_BASE; - ASSERT (NvStorageBase !=3D 0); - // // Copy NV storage data to the memory buffer. // diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c b/Mde= ModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c index 517cae7b00f8..5253c328dcd9 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c @@ -1084,6 +1084,8 @@ SmmFtwNotificationEvent ( EFI_SMM_FAULT_TOLERANT_WRITE_PROTOCOL *FtwProtocol; EFI_PHYSICAL_ADDRESS NvStorageVariableBase; UINTN FtwMaxBlockSize; + UINT32 NvStorageVariableSize; + UINT64 NvStorageVariableSize64; =20 if (mVariableModuleGlobal->FvbInstance !=3D NULL) { return EFI_SUCCESS; @@ -1097,14 +1099,21 @@ SmmFtwNotificationEvent ( return Status; } =20 + Status =3D GetVariableFlashNvStorageInfo (&NvStorageVariableBase, &NvSto= rageVariableSize64); + ASSERT_EFI_ERROR (Status); + + Status =3D SafeUint64ToUint32 (NvStorageVariableSize64, &NvStorageVariab= leSize); + // This driver currently assumes the size will be UINT32 so assert the v= alue is safe for now. + ASSERT_EFI_ERROR (Status); + + ASSERT (NvStorageVariableBase !=3D 0); + VariableStoreBase =3D NvStorageVariableBase + mNvFvHeaderCache->HeaderLe= ngth; + Status =3D FtwProtocol->GetMaxBlockSize (FtwProtocol, &FtwMaxBlockSize); if (!EFI_ERROR (Status)) { - ASSERT (PcdGet32 (PcdFlashNvStorageVariableSize) <=3D FtwMaxBlockSize); + ASSERT (NvStorageVariableSize <=3D FtwMaxBlockSize); } =20 - NvStorageVariableBase =3D NV_STORAGE_VARIABLE_BASE; - VariableStoreBase =3D NvStorageVariableBase + mNvFvHeaderCache->Head= erLength; - // // Let NonVolatileVariableBase point to flash variable store base direct= ly after FTW ready. // diff --git a/MdeModulePkg/Universal/Variable/Pei/Variable.h b/MdeModulePkg/= Universal/Variable/Pei/Variable.h index 7f9ad5bfc357..51effbf79987 100644 --- a/MdeModulePkg/Universal/Variable/Pei/Variable.h +++ b/MdeModulePkg/Universal/Variable/Pei/Variable.h @@ -20,6 +20,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include +#include =20 #include #include diff --git a/MdeModulePkg/Universal/Variable/Pei/VariablePei.inf b/MdeModul= ePkg/Universal/Variable/Pei/VariablePei.inf index 7cbdd2385e8f..7264a24bdf71 100644 --- a/MdeModulePkg/Universal/Variable/Pei/VariablePei.inf +++ b/MdeModulePkg/Universal/Variable/Pei/VariablePei.inf @@ -39,6 +39,8 @@ [LibraryClasses] DebugLib PeiServicesTablePointerLib PeiServicesLib + SafeIntLib + VariableFlashInfoLib =20 [Guids] ## CONSUMES ## GUID # Variable store header @@ -59,9 +61,6 @@ [Ppis] gEfiPeiReadOnlyVariable2PpiGuid ## PRODUCES =20 [Pcd] - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase ## SOM= ETIMES_CONSUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 ## CON= SUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize ## CON= SUMES gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable ## SOM= ETIMES_CONSUMES =20 [Depex] diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.h b/MdeMod= ulePkg/Universal/Variable/RuntimeDxe/Variable.h index 31e408976a35..a668abb82b15 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.h +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.h @@ -31,6 +31,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include +#include #include #include #include @@ -40,11 +42,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent =20 #include "PrivilegePolymorphic.h" =20 -#define NV_STORAGE_VARIABLE_BASE (EFI_PHYSICAL_ADDRESS)\ - (PcdGet64 (PcdFlashNvStorageVariableBas= e64) !=3D 0 ? \ - PcdGet64 (PcdFlashNvStorageVariableBas= e64) : \ - PcdGet32 (PcdFlashNvStorageVariableBas= e)) - #define EFI_VARIABLE_ATTRIBUTES_MASK (EFI_VARIABLE_NON_VOLATILE |\ EFI_VARIABLE_BOOTSERVICE_ACCESS | \ EFI_VARIABLE_RUNTIME_ACCESS | \ diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.= inf b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf index c9434df631ee..3858adf6739d 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf @@ -71,8 +71,10 @@ [LibraryClasses] TpmMeasurementLib AuthVariableLib VarCheckLib + VariableFlashInfoLib VariablePolicyLib VariablePolicyHelperLib + SafeIntLib =20 [Protocols] gEfiFirmwareVolumeBlockProtocolGuid ## CONSUMES @@ -125,9 +127,6 @@ [Guids] gEfiImageSecurityDatabaseGuid =20 [Pcd] - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize ## CON= SUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase ## SOM= ETIMES_CONSUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 ## CON= SUMES gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize ## CON= SUMES gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize ## CON= SUMES gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVolatileVariableSize ## CON= SUMES diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf b/M= deModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf index eaa97a01c6e5..8c552b87e080 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf @@ -80,8 +80,10 @@ [LibraryClasses] AuthVariableLib VarCheckLib UefiBootServicesTableLib + VariableFlashInfoLib VariablePolicyLib VariablePolicyHelperLib + SafeIntLib =20 [Protocols] gEfiSmmFirmwareVolumeBlockProtocolGuid ## CONSUMES @@ -127,9 +129,6 @@ [Guids] gEdkiiVarErrorFlagGuid =20 [Pcd] - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize ## CO= NSUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase ## SO= METIMES_CONSUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 ## CO= NSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize ## CO= NSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize ## CO= NSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVolatileVariableSize ## CO= NSUMES diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneM= m.inf b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf index d8c4f77e7f1f..f09bed40cf51 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf @@ -73,9 +73,11 @@ [LibraryClasses] HobLib MemoryAllocationLib MmServicesTableLib + SafeIntLib StandaloneMmDriverEntryPoint SynchronizationLib VarCheckLib + VariableFlashInfoLib VariablePolicyLib VariablePolicyHelperLib =20 @@ -120,9 +122,6 @@ [Guids] gEdkiiVarErrorFlagGuid =20 [Pcd] - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase ## SO= METIMES_CONSUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 ## CO= NSUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize ## CO= NSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize ## CO= NSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize ## CO= NSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVolatileVariableSize ## CO= NSUMES --=20 2.28.0.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 (#88790): https://edk2.groups.io/g/devel/message/88790 Mute This Topic: https://groups.io/mt/90421973/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- From nobody Wed May 15 14:12:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+88791+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88791+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1649781024; cv=none; d=zohomail.com; s=zohoarc; b=F3KqK4f1VZ7SLPAuZnFkWaxQo3+bZZDVmOQDRZ7ctMqfk39VKjbU/+n1dQFUX+nug93OrxdQHPtA0yxwPuKynXzGmBAITdjC/f/j35cato6SQBf8AMHGSHZwtaa7FJ/zTP7xZSZNlfPcDTFyeEarYiomSxBxQgFBZtBBZgophZk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1649781024; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=NoIJwFodUN/DO73d4ZA0YsTFxMcHax2+jh03s9NJfYE=; b=SqtCoqCUABfdIVT66rARCBbfS67Bewx86vqhUGtg1JOS63W/RAVqyTAy3LlS2EpkBbiB6Xqvyuj6BrRbfny+V/Pa6WHRbFBfHFIuEDAaJcjRQcg0I8NTF/MsPfHbiEkrO1YE8n+YqOq+lY/Gv+d0VXtguofuewHE05i5N8CaPag= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88791+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1649781024046513.9917182729818; Tue, 12 Apr 2022 09:30:24 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 2M4qYY1788612xsqyCecWB86; Tue, 12 Apr 2022 09:30:23 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web12.12993.1649781021914163964 for ; Tue, 12 Apr 2022 09:30:22 -0700 X-Received: from localhost.localdomain (unknown [47.201.46.36]) by linux.microsoft.com (Postfix) with ESMTPSA id 1C9BD2034C46; Tue, 12 Apr 2022 09:30:21 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 1C9BD2034C46 From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu , Liming Gao Subject: [edk2-devel] [PATCH v4 4/8] MdeModulePkg/FaultTolerantWrite: Consume Variable Flash Info Date: Tue, 12 Apr 2022 12:29:36 -0400 Message-Id: <20220412162940.4978-5-mikuback@linux.microsoft.com> In-Reply-To: <20220412162940.4978-1-mikuback@linux.microsoft.com> References: <20220412162940.4978-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,mikuback@linux.microsoft.com X-Gm-Message-State: MClQqyQRB9InbJKthi4GQXifx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1649781023; bh=NtlJYjEnLERM6k6dQr3rIBJ3CT3CqzLhoamXqjzOH1A=; h=Cc:Date:From:Reply-To:Subject:To; b=Lo56CAeEBLJapoeWW8Vrdj1C04JpzTE6QUr0vVYRmusrSNSUXHRqvjqw+zBhyhdJ0gI XZPpd0zlWhqxBG7dFZyd9b9s29F0IS59YQBwVV08jB0Hrszh8ELM5Q3PFOX9rw+HWT2iz hfKCmxDd7U9FaX4r3VN3de5dj507ZkBoE+U= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1649781025103100003 Content-Type: text/plain; charset="utf-8" From: Michael Kubacki REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3479 Adds support to the UEFI variable fault tolerant write (FTW) drivers to receive FTW base and size information dynamically via the Variable Flash Information library. Cc: Jian J Wang Cc: Hao A Wu Cc: Liming Gao Signed-off-by: Michael Kubacki Acked-by: Ard Biesheuvel Reviewed-by: Sami Mujawar --- MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c = | 41 +++++++++++++------- MdeModulePkg/Universal/FaultTolerantWriteDxe/UpdateWorkingBlock.c = | 7 +++- MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.c = | 28 ++++++++----- MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite.h = | 7 +++- MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf = | 10 +---- MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf = | 10 +---- MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStandaloneM= m.inf | 10 +---- MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.inf = | 10 +---- 8 files changed, 63 insertions(+), 60 deletions(-) diff --git a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c b/MdeMo= dulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c index 661e1487673b..f1335870e797 100644 --- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c +++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c @@ -987,22 +987,43 @@ InitFtwDevice ( OUT EFI_FTW_DEVICE **FtwData ) { - EFI_FTW_DEVICE *FtwDevice; + EFI_STATUS Status; + EFI_PHYSICAL_ADDRESS WorkSpaceAddress; + UINT64 Size; + UINTN FtwWorkingSize; + EFI_FTW_DEVICE *FtwDevice; + + FtwWorkingSize =3D 0; + + Status =3D GetVariableFlashFtwWorkingInfo (&WorkSpaceAddress, &Size); + ASSERT_EFI_ERROR (Status); + + Status =3D SafeUint64ToUintn (Size, &FtwWorkingSize); + // This driver currently assumes the size will be UINTN so assert the va= lue is safe for now. + ASSERT_EFI_ERROR (Status); =20 // // Allocate private data of this driver, // Including the FtwWorkSpace[FTW_WORK_SPACE_SIZE]. // - FtwDevice =3D AllocateZeroPool (sizeof (EFI_FTW_DEVICE) + PcdGet32 (PcdF= lashNvStorageFtwWorkingSize)); + FtwDevice =3D AllocateZeroPool (sizeof (EFI_FTW_DEVICE) + FtwWorkingSize= ); if (FtwDevice =3D=3D NULL) { return EFI_OUT_OF_RESOURCES; } =20 + FtwDevice->WorkSpaceAddress =3D WorkSpaceAddress; + FtwDevice->WorkSpaceLength =3D FtwWorkingSize; + + Status =3D GetVariableFlashFtwSpareInfo (&FtwDevice->SpareAreaAddress, &= Size); + ASSERT_EFI_ERROR (Status); + + Status =3D SafeUint64ToUintn (Size, &FtwDevice->SpareAreaLength); + // This driver currently assumes the size will be UINTN so assert the va= lue is safe for now. + ASSERT_EFI_ERROR (Status); + // // Initialize other parameters, and set WorkSpace as FTW_ERASED_BYTE. // - FtwDevice->WorkSpaceLength =3D (UINTN)PcdGet32 (PcdFlashNvStorageFtwWork= ingSize); - FtwDevice->SpareAreaLength =3D (UINTN)PcdGet32 (PcdFlashNvStorageFtwSpar= eSize); if ((FtwDevice->WorkSpaceLength =3D=3D 0) || (FtwDevice->SpareAreaLength= =3D=3D 0)) { DEBUG ((DEBUG_ERROR, "Ftw: Workspace or Spare block does not exist!\n"= )); FreePool (FtwDevice); @@ -1015,16 +1036,6 @@ InitFtwDevice ( FtwDevice->FtwWorkSpaceLba =3D (EFI_LBA)(-1); FtwDevice->FtwSpareLba =3D (EFI_LBA)(-1); =20 - FtwDevice->WorkSpaceAddress =3D (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdFlash= NvStorageFtwWorkingBase64); - if (FtwDevice->WorkSpaceAddress =3D=3D 0) { - FtwDevice->WorkSpaceAddress =3D (EFI_PHYSICAL_ADDRESS)PcdGet32 (PcdFla= shNvStorageFtwWorkingBase); - } - - FtwDevice->SpareAreaAddress =3D (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdFlash= NvStorageFtwSpareBase64); - if (FtwDevice->SpareAreaAddress =3D=3D 0) { - FtwDevice->SpareAreaAddress =3D (EFI_PHYSICAL_ADDRESS)PcdGet32 (PcdFla= shNvStorageFtwSpareBase); - } - *FtwData =3D FtwDevice; return EFI_SUCCESS; } @@ -1277,7 +1288,7 @@ InitFtwProtocol ( FtwDevice->FtwLastWriteHeader =3D NULL; FtwDevice->FtwLastWriteRecord =3D NULL; =20 - InitializeLocalWorkSpaceHeader (); + InitializeLocalWorkSpaceHeader (FtwDevice->WorkSpaceLength); =20 // // Refresh the working space data from working block diff --git a/MdeModulePkg/Universal/FaultTolerantWriteDxe/UpdateWorkingBloc= k.c b/MdeModulePkg/Universal/FaultTolerantWriteDxe/UpdateWorkingBlock.c index 61e7a92ccea1..fd563643eb63 100644 --- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/UpdateWorkingBlock.c +++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/UpdateWorkingBlock.c @@ -16,10 +16,13 @@ EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER mWorkingBlockH= eader =3D { ZERO_GUID, 0, 0 =20 Since Signature and WriteQueueSize have been known, Crc can be calculate= d out, then the work space header will be fixed. + + @param[in] WorkSpaceLength Length in bytes of the FTW workspace are= a. + **/ VOID InitializeLocalWorkSpaceHeader ( - VOID + IN UINTN WorkSpaceLength ) { // @@ -46,7 +49,7 @@ InitializeLocalWorkSpaceHeader ( &gEdkiiWorkingBlockSignatureGuid, sizeof (EFI_GUID) ); - mWorkingBlockHeader.WriteQueueSize =3D PcdGet32 (PcdFlashNvStorageFtwWor= kingSize) - sizeof (EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER); + mWorkingBlockHeader.WriteQueueSize =3D WorkSpaceLength - sizeof (EFI_FAU= LT_TOLERANT_WORKING_BLOCK_HEADER); =20 // // Crc is calculated with all the fields except Crc and STATE, so leave = them as FTW_ERASED_BYTE. diff --git a/MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWrit= ePei.c b/MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei= .c index 15543f12ed29..8c152dcbad98 100644 --- a/MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.c +++ b/MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.c @@ -16,6 +16,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include +#include =20 EFI_PEI_PPI_DESCRIPTOR mPpiListVariable =3D { (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), @@ -212,25 +214,31 @@ PeimFaultTolerantWriteInitialize ( EFI_PHYSICAL_ADDRESS SpareAreaAddress; UINTN SpareAreaLength; EFI_PHYSICAL_ADDRESS WorkSpaceInSpareArea; + UINT64 Size; FAULT_TOLERANT_WRITE_LAST_WRITE_DATA FtwLastWrite; =20 FtwWorkingBlockHeader =3D NULL; FtwLastWriteHeader =3D NULL; FtwLastWriteRecord =3D NULL; =20 - WorkSpaceAddress =3D (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdFlashNvStorageFt= wWorkingBase64); - if (WorkSpaceAddress =3D=3D 0) { - WorkSpaceAddress =3D (EFI_PHYSICAL_ADDRESS)PcdGet32 (PcdFlashNvStorage= FtwWorkingBase); - } + SpareAreaAddress =3D 0; + SpareAreaLength =3D 0; + WorkSpaceAddress =3D 0; + WorkSpaceLength =3D 0; =20 - WorkSpaceLength =3D (UINTN)PcdGet32 (PcdFlashNvStorageFtwWorkingSize); + Status =3D GetVariableFlashFtwWorkingInfo (&WorkSpaceAddress, &Size); + ASSERT_EFI_ERROR (Status); =20 - SpareAreaAddress =3D (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdFlashNvStorageFt= wSpareBase64); - if (SpareAreaAddress =3D=3D 0) { - SpareAreaAddress =3D (EFI_PHYSICAL_ADDRESS)PcdGet32 (PcdFlashNvStorage= FtwSpareBase); - } + Status =3D SafeUint64ToUintn (Size, &WorkSpaceLength); + // This driver currently assumes the size will be UINTN so assert the va= lue is safe for now. + ASSERT_EFI_ERROR (Status); =20 - SpareAreaLength =3D (UINTN)PcdGet32 (PcdFlashNvStorageFtwSpareSize); + Status =3D GetVariableFlashFtwSpareInfo (&SpareAreaAddress, &Size); + ASSERT_EFI_ERROR (Status); + + Status =3D SafeUint64ToUintn (Size, &SpareAreaLength); + // This driver currently assumes the size will be UINTN so assert the va= lue is safe for now. + ASSERT_EFI_ERROR (Status); =20 // // The address of FTW working base and spare base must not be 0. diff --git a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrit= e.h b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite.h index c14e47b5c7b2..5b84d062c294 100644 --- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite.h +++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite.h @@ -26,6 +26,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include +#include =20 // // Flash erase polarity is 1 @@ -708,10 +710,13 @@ InitFtwProtocol ( =20 Since Signature and WriteQueueSize have been known, Crc can be calculate= d out, then the work space header will be fixed. + + @param[in] WorkSpaceLength Length in bytes of the FTW workspace are= a. + **/ VOID InitializeLocalWorkSpaceHeader ( - VOID + IN UINTN WorkSpaceLength ); =20 /** diff --git a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrit= eDxe.inf b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteD= xe.inf index 96165614d178..d524e1849a2e 100644 --- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf +++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf @@ -46,6 +46,8 @@ [LibraryClasses] UefiLib PcdLib ReportStatusCodeLib + SafeIntLib + VariableFlashInfoLib =20 [Guids] # @@ -65,14 +67,6 @@ [Protocols] [FeaturePcd] gEfiMdeModulePkgTokenSpaceGuid.PcdFullFtwServiceEnable ## CONSUMES =20 -[Pcd] - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase ## SOM= ETIMES_CONSUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64 ## CON= SUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize ## CON= SUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase ## SOM= ETIMES_CONSUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64 ## CON= SUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize ## CON= SUMES - # # gBS->CalculateCrc32() is consumed in EntryPoint. # PI spec said: When the DXE Foundation is notified that the EFI_RUNTIME_A= RCH_PROTOCOL diff --git a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrit= eSmm.inf b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteS= mm.inf index 8cc6028470d8..8a4b9ad24657 100644 --- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf +++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf @@ -52,6 +52,8 @@ [LibraryClasses] ReportStatusCodeLib SmmMemLib BaseLib + SafeIntLib + VariableFlashInfoLib =20 [Guids] # @@ -74,14 +76,6 @@ [Protocols] [FeaturePcd] gEfiMdeModulePkgTokenSpaceGuid.PcdFullFtwServiceEnable ## CONSUMES =20 -[Pcd] - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase ## SOM= ETIMES_CONSUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64 ## CON= SUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize ## CON= SUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase ## SOM= ETIMES_CONSUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64 ## CON= SUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize ## CON= SUMES - # # gBS->CalculateCrc32() is consumed in EntryPoint. # PI spec said: When the DXE Foundation is notified that the EFI_RUNTIME_A= RCH_PROTOCOL diff --git a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrit= eStandaloneMm.inf b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultToler= antWriteStandaloneMm.inf index d0fab7d9414f..0ac6edf771ab 100644 --- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStanda= loneMm.inf +++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStanda= loneMm.inf @@ -50,7 +50,9 @@ [LibraryClasses] MmServicesTableLib PcdLib ReportStatusCodeLib + SafeIntLib StandaloneMmDriverEntryPoint + VariableFlashInfoLib =20 [Guids] # @@ -73,13 +75,5 @@ [Protocols] [FeaturePcd] gEfiMdeModulePkgTokenSpaceGuid.PcdFullFtwServiceEnable ## CONSUMES =20 -[Pcd] - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase ## SOM= ETIMES_CONSUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64 ## CON= SUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize ## CON= SUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase ## SOM= ETIMES_CONSUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64 ## CON= SUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize ## CON= SUMES - [Depex] TRUE diff --git a/MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWrit= ePei.inf b/MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWriteP= ei.inf index f90892ad4493..230138272c3a 100644 --- a/MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.inf +++ b/MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.inf @@ -39,6 +39,8 @@ [LibraryClasses] HobLib BaseMemoryLib PcdLib + SafeIntLib + VariableFlashInfoLib =20 [Guids] ## SOMETIMES_PRODUCES ## HOB @@ -47,14 +49,6 @@ [Guids] gEdkiiWorkingBlockSignatureGuid ## SOMETIMES_CONSUMES ##= GUID gEfiSystemNvDataFvGuid ## SOMETIMES_CONSUMES ##= GUID =20 -[Pcd] - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase ## SOM= ETIMES_CONSUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64 ## CON= SUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize ## CON= SUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase ## SOM= ETIMES_CONSUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64 ## CON= SUMES - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize ## CON= SUMES - [Depex] TRUE =20 --=20 2.28.0.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 (#88791): https://edk2.groups.io/g/devel/message/88791 Mute This Topic: https://groups.io/mt/90421974/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- From nobody Wed May 15 14:12:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+88792+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88792+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1649781026; cv=none; d=zohomail.com; s=zohoarc; b=dTvshBfX5CGJbZiDTwOBOrBRvAIPjEqFdWUt3gumfE06qGgRfn+OGqIw+RWp28QxUDClLtgOgwpEsVEOodpz5cvKv5bqFpnxn0ry/RqKWOId3zCxTmWsE0qVWWJtPGqHIuDOgdpYGGHRjJh7ATsAhHPUe0m5guxabxvPU+g3LI4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1649781026; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=If5nKRtnpKDexIugAw6CUQwycUIp9THNbhbHyzJps+0=; b=Rs5xxBerIiQ9vLWWDkRR0Xk+nJWeQJpEGUCSIdJzib82N2DeSdK21IW33Ub6OfXReABDZ3cJyu/8nMRK/+JL+eLVV1NZ2aSTARh6dZbGkCoj8+gBX+BtpJCa1eK39udkK7kxPGFvCPa9FmTpyLJxXTjv7NMrlFkJhSLLzrNL1OY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88792+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1649781026147941.1016173053964; Tue, 12 Apr 2022 09:30:26 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id FPGjYY1788612xYC6kQ32Y0Z; Tue, 12 Apr 2022 09:30:25 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web10.12892.1649781025134070846 for ; Tue, 12 Apr 2022 09:30:25 -0700 X-Received: from localhost.localdomain (unknown [47.201.46.36]) by linux.microsoft.com (Postfix) with ESMTPSA id 0822D20BA5AC; Tue, 12 Apr 2022 09:30:23 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 0822D20BA5AC From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Sami Mujawar , Gerd Hoffmann , Julien Grall Subject: [edk2-devel] [PATCH v4 5/8] ArmVirtPkg/ArmVirt.dsc.inc: Add VariableFlashInfoLib Date: Tue, 12 Apr 2022 12:29:37 -0400 Message-Id: <20220412162940.4978-6-mikuback@linux.microsoft.com> In-Reply-To: <20220412162940.4978-1-mikuback@linux.microsoft.com> References: <20220412162940.4978-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,mikuback@linux.microsoft.com X-Gm-Message-State: JAnsSsqCMXxiaPdSfEIc1Zbqx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1649781025; bh=OGhgo34C8lRevwpny6fyJhKZXP8I/FFQM63jZpX9jzU=; h=Cc:Date:From:Reply-To:Subject:To; b=hJHu5qySZN62I2mN35NZ01bKsesjdB81ctpu12YFraZI5QQvMHfC42NeSLpWzqpOAUI ydZRGimyDADizMyOrbooxdqZXyJNB+Eyh37WJZFmd31nz/YQIiixxjdJg/ICCuMXJDmy7 Z4x/sG2JFIZgVZX8bm1v4IXUaGYncZN+SJo= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1649781026893100005 Content-Type: text/plain; charset="utf-8" From: Michael Kubacki REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3479 Adds an instance of VariableFlashInfoLib to the platform build as it is a new library class introduced in MdeModulePkg. Cc: Ard Biesheuvel Cc: Leif Lindholm Cc: Sami Mujawar Cc: Gerd Hoffmann Cc: Julien Grall Signed-off-by: Michael Kubacki Acked-by: Ard Biesheuvel Reviewed-by: Sami Mujawar --- ArmVirtPkg/ArmVirt.dsc.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc index ba711deac025..988c1eb75529 100644 --- a/ArmVirtPkg/ArmVirt.dsc.inc +++ b/ArmVirtPkg/ArmVirt.dsc.inc @@ -177,6 +177,7 @@ [LibraryClasses.common] AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLib= Null.inf !endif VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf + VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseV= ariableFlashInfoLib.inf VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyL= ib.inf VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Var= iablePolicyHelperLib.inf UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManag= erLib.inf --=20 2.28.0.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 (#88792): https://edk2.groups.io/g/devel/message/88792 Mute This Topic: https://groups.io/mt/90421975/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- From nobody Wed May 15 14:12:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+88793+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88793+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1649781029; cv=none; d=zohomail.com; s=zohoarc; b=Bpo9diJ0xOrBKjLqo50xwZ8jdqbN47ga4CN8pqrtj43BZ4LB0lGrLIbwanUZ5UdU6wCXQZn/k/SxtmFQQfJ6Xhskbi+AunwZzX5M5H8EO6vuQADvwNHz+Lg7mMZ/9/mppzZzEh6lhUIvKMvRie9ytXmdasGS6kD8zCZwV4HS0J4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1649781029; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=W+OcYIdWPJLTiVIYClV86g8MnEVUXYk2tchCiTEdPzo=; b=cYUGS2W9o2UepvQnxcF3bV+hSOVHD16mtPRhZ/MkslT0PwN4n0suNKwlgOaNSH9LPWVn/eAsesFORfFSMEZQVUTmQBJ+cMGzfeYfU84LT/bSIb60lFSLx2Q+PXAaQuHjQ7Ub1GqNGZlcjiO2/gPUmRB/skbBu4Cq8uwCMYy3IZM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88793+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1649781029292766.121856213543; Tue, 12 Apr 2022 09:30:29 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id AKeiYY1788612xaSx0AgRqUv; Tue, 12 Apr 2022 09:30:29 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web09.13086.1649781028288736910 for ; Tue, 12 Apr 2022 09:30:28 -0700 X-Received: from localhost.localdomain (unknown [47.201.46.36]) by linux.microsoft.com (Postfix) with ESMTPSA id 1C93B20A6936; Tue, 12 Apr 2022 09:30:27 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 1C93B20A6936 From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Andrew Fish , Ray Ni , Abner Chang , Nickle Wang Subject: [edk2-devel] [PATCH v4 6/8] EmulatorPkg: Add VariableFlashInfoLib Date: Tue, 12 Apr 2022 12:29:38 -0400 Message-Id: <20220412162940.4978-7-mikuback@linux.microsoft.com> In-Reply-To: <20220412162940.4978-1-mikuback@linux.microsoft.com> References: <20220412162940.4978-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,mikuback@linux.microsoft.com X-Gm-Message-State: KprMcnblnsNFMtBEYA0HwzQVx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1649781029; bh=hutOHwO13BxPw4YJBRp2FmbDpHz+Z1vOEfYGVSA10kw=; h=Cc:Date:From:Reply-To:Subject:To; b=RRh6a4KlkQnhaNg1doFaFD3zOoS+yBPlks3T1oloqbz+RKefirVT0hcktirkO5p463L h5EmgIGWvL41QILNuLbOMTNxvau973NbJtIWw9cBXIx+CSwBb9SW7yPYxDL3l9mNRhvan sZqxjy1OWSNs9HuLncOkyTFtnBnWAIf7fVc= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1649781030913100001 Content-Type: text/plain; charset="utf-8" From: Michael Kubacki REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3479 Adds an instance of VariableFlashInfoLib to the platform build as it is a new library class introduced in MdeModulePkg. Cc: Andrew Fish Cc: Ray Ni Cc: Abner Chang Cc: Nickle Wang Signed-off-by: Michael Kubacki Acked-by: Ard Biesheuvel --- EmulatorPkg/EmulatorPkg.dsc | 1 + 1 file changed, 1 insertion(+) diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc index 554c13ddb500..4cf886b9eac7 100644 --- a/EmulatorPkg/EmulatorPkg.dsc +++ b/EmulatorPkg/EmulatorPkg.dsc @@ -122,6 +122,7 @@ [LibraryClasses] VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyL= ibRuntimeDxe.inf VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Var= iablePolicyHelperLib.inf + VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseV= ariableFlashInfoLib.inf SortLib|MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf --=20 2.28.0.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 (#88793): https://edk2.groups.io/g/devel/message/88793 Mute This Topic: https://groups.io/mt/90421978/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- From nobody Wed May 15 14:12:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+88794+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88794+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1649781033; cv=none; d=zohomail.com; s=zohoarc; b=mEK3il74ksEEa4QqTLSjQGsEXa+8iPPBG2GR3dtTAgNm9S5XJNMwp+zZjvS7a5HQLeUF1Tzb4PIFfaAOlc/KxeZjlSMrTimLtt3SdvT7RejVOTRW//++wamGLaXKB+fyy3cLu6821iSQ0gPgZUGjvSFHtkypnBrnU0McNfpkB4E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1649781033; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=9Y1stAMQD9cMO9eE/cBMm/6KQv2cjV63PpsPcK/L0P4=; b=asb+OaRSuCI38PW/SZCq1jiY/WmBrBTmXpVKmZKC8uwLhQwjYGa1IQHa6n79AWuJ+xaXy7YjHSZJ2Emdu4aeMKinIsQ1NoH3hBrv6oPbJCYXxgF/J8AtuIwk+EMrwhTlK2ZKI6OmzDZINDCQwcP+qoGSZco2a9BVjowEhP4BKN8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88794+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1649781033523263.59428115270975; Tue, 12 Apr 2022 09:30:33 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id uMigYY1788612xrRD2zTxUYI; Tue, 12 Apr 2022 09:30:33 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web09.13088.1649781032552712567 for ; Tue, 12 Apr 2022 09:30:32 -0700 X-Received: from localhost.localdomain (unknown [47.201.46.36]) by linux.microsoft.com (Postfix) with ESMTPSA id 90B2F20A6937; Tue, 12 Apr 2022 09:30:30 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 90B2F20A6937 From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Anthony Perard , Ard Biesheuvel , Brijesh Singh , Erdem Aktas , Gerd Hoffmann , James Bottomley , Jiewen Yao , Jordan Justen , Julien Grall , Min Xu , Peter Grehan , Rebecca Cran , Sebastien Boeuf , Tom Lendacky Subject: [edk2-devel] [PATCH v4 7/8] OvmfPkg: Add VariableFlashInfoLib Date: Tue, 12 Apr 2022 12:29:39 -0400 Message-Id: <20220412162940.4978-8-mikuback@linux.microsoft.com> In-Reply-To: <20220412162940.4978-1-mikuback@linux.microsoft.com> References: <20220412162940.4978-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,mikuback@linux.microsoft.com X-Gm-Message-State: kQvuMAlJT4wKa6rRIsNs2d1Fx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1649781033; bh=gttNe4vZ8OCLoTPpaL/zymT2vOMUNeL41XPkxsLi0OQ=; h=Cc:Date:From:Reply-To:Subject:To; b=SoanGhUmH7ChYnZ2ay9PKyJ4FPO1WRkq40JTCmnLOUoSnMI2hxTLzYiX+AfMFCIHudM gHiUyCvjB7uvpe2Oc+nNP8jpTgnFk+vvw5/ElQ5hs2zIOo+O3s4hV5pUBUB0MxN5uPNWe 9k74KbQQSoMPOeXOrlxW7rYUJAJOMxWUA7g= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1649781035013100001 Content-Type: text/plain; charset="utf-8" From: Michael Kubacki REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3479 Adds an instance of VariableFlashInfoLib to the platform build as it is a new library class introduced in MdeModulePkg. Cc: Anthony Perard Cc: Ard Biesheuvel Cc: Brijesh Singh Cc: Erdem Aktas Cc: Gerd Hoffmann Cc: James Bottomley Cc: Jiewen Yao Cc: Jordan Justen Cc: Julien Grall Cc: Min Xu Cc: Peter Grehan Cc: Rebecca Cran Cc: Sebastien Boeuf Cc: Tom Lendacky Signed-off-by: Michael Kubacki Acked-by: Ard Biesheuvel Reviewed-by: Rebecca Cran --- OvmfPkg/AmdSev/AmdSevX64.dsc | 1 + OvmfPkg/Bhyve/BhyveX64.dsc | 1 + OvmfPkg/CloudHv/CloudHvX64.dsc | 1 + OvmfPkg/IntelTdx/IntelTdxX64.dsc | 1 + OvmfPkg/Microvm/MicrovmX64.dsc | 1 + OvmfPkg/OvmfPkgIa32.dsc | 1 + OvmfPkg/OvmfPkgIa32X64.dsc | 1 + OvmfPkg/OvmfPkgX64.dsc | 1 + OvmfPkg/OvmfXen.dsc | 1 + 9 files changed, 9 insertions(+) diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc index fcdc3efab204..3868c577fe39 100644 --- a/OvmfPkg/AmdSev/AmdSevX64.dsc +++ b/OvmfPkg/AmdSev/AmdSevX64.dsc @@ -195,6 +195,7 @@ [LibraryClasses] VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyL= ib.inf VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Var= iablePolicyHelperLib.inf + VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseV= ariableFlashInfoLib.inf =20 !if $(BUILD_SHELL) =3D=3D TRUE ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc index e1b6b8e15f36..3df49e54de8a 100644 --- a/OvmfPkg/Bhyve/BhyveX64.dsc +++ b/OvmfPkg/Bhyve/BhyveX64.dsc @@ -206,6 +206,7 @@ [LibraryClasses] VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyL= ib.inf VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Var= iablePolicyHelperLib.inf + VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseV= ariableFlashInfoLib.inf =20 # # Network libraries diff --git a/OvmfPkg/CloudHv/CloudHvX64.dsc b/OvmfPkg/CloudHv/CloudHvX64.dsc index 20f3bc340807..19b84275eba3 100644 --- a/OvmfPkg/CloudHv/CloudHvX64.dsc +++ b/OvmfPkg/CloudHv/CloudHvX64.dsc @@ -216,6 +216,7 @@ [LibraryClasses] VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyL= ib.inf VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Var= iablePolicyHelperLib.inf + VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseV= ariableFlashInfoLib.inf =20 =20 # diff --git a/OvmfPkg/IntelTdx/IntelTdxX64.dsc b/OvmfPkg/IntelTdx/IntelTdxX6= 4.dsc index 245155d41b30..f21a33ed6ba3 100644 --- a/OvmfPkg/IntelTdx/IntelTdxX64.dsc +++ b/OvmfPkg/IntelTdx/IntelTdxX64.dsc @@ -184,6 +184,7 @@ [LibraryClasses] VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyL= ib.inf VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Var= iablePolicyHelperLib.inf + VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseV= ariableFlashInfoLib.inf =20 ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf diff --git a/OvmfPkg/Microvm/MicrovmX64.dsc b/OvmfPkg/Microvm/MicrovmX64.dsc index 59580ccd4691..d8603f016a0c 100644 --- a/OvmfPkg/Microvm/MicrovmX64.dsc +++ b/OvmfPkg/Microvm/MicrovmX64.dsc @@ -206,6 +206,7 @@ [LibraryClasses] VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyL= ib.inf VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Var= iablePolicyHelperLib.inf + VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseV= ariableFlashInfoLib.inf =20 =20 # diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc index e4218b01f0fc..c689d4707046 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc @@ -213,6 +213,7 @@ [LibraryClasses] VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyL= ib.inf VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Var= iablePolicyHelperLib.inf + VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseV= ariableFlashInfoLib.inf =20 =20 # diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index a80cdaacb8bc..44c75639aa5d 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -217,6 +217,7 @@ [LibraryClasses] VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyL= ib.inf VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Var= iablePolicyHelperLib.inf + VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseV= ariableFlashInfoLib.inf =20 =20 # diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index fb2899f8a1be..60e7e3724a6b 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -225,6 +225,7 @@ [LibraryClasses] VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyL= ib.inf VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Var= iablePolicyHelperLib.inf + VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseV= ariableFlashInfoLib.inf =20 =20 # diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc index 7bd594c6e263..01d832323585 100644 --- a/OvmfPkg/OvmfXen.dsc +++ b/OvmfPkg/OvmfXen.dsc @@ -195,6 +195,7 @@ [LibraryClasses] VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyL= ib.inf VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Var= iablePolicyHelperLib.inf + VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseV= ariableFlashInfoLib.inf =20 =20 # --=20 2.28.0.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 (#88794): https://edk2.groups.io/g/devel/message/88794 Mute This Topic: https://groups.io/mt/90421982/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- From nobody Wed May 15 14:12:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+88795+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88795+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1649781036; cv=none; d=zohomail.com; s=zohoarc; b=CwVOjzy+TU/IvetEJ+t3Wj9m0yuleoVAQ8g9G06e3vHbiR6AFiP9BWqorVsDCEJG53n3NxSb54MFyos7FdTtjFUiz/N/OHORBBFVkzJ1ZnD1H5oNk+d6BhEubklAG3ZU+xxd3sSbfxb09SZ6QTmTt4e30kvT1c/FMlEclqA/d7M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1649781036; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=8WN/3CU6otKEova6XyKuGhUxADBQ9wXVBeV8Kk9RUfM=; b=cvkL747cZfmP/9Tod2+JYtT4MCkP3fC2L8j7UWRxwpuibErOb0y7Pqb30Yn7dMCpdz+nvUIJWkDGjDtN9moVmkVEwWmaUD1XWWeGsL8P9hVNdj0pbvlR+/73OXLQOl0StXNJH2mRNmeALmp3uHcXX42m0+035UP4lm8Ohfaj/kc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88795+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1649781036866766.8826916738518; Tue, 12 Apr 2022 09:30:36 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id MnxkYY1788612xrGcbOoMfWz; Tue, 12 Apr 2022 09:30:36 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web10.12897.1649781035931134839 for ; Tue, 12 Apr 2022 09:30:36 -0700 X-Received: from localhost.localdomain (unknown [47.201.46.36]) by linux.microsoft.com (Postfix) with ESMTPSA id DE4502034C46; Tue, 12 Apr 2022 09:30:34 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com DE4502034C46 From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Guo Dong , Ray Ni , Maurice Ma , Benjamin You , Sean Rhodes Subject: [edk2-devel] [PATCH v4 8/8] UefiPayloadPkg: Add VariableFlashInfoLib Date: Tue, 12 Apr 2022 12:29:40 -0400 Message-Id: <20220412162940.4978-9-mikuback@linux.microsoft.com> In-Reply-To: <20220412162940.4978-1-mikuback@linux.microsoft.com> References: <20220412162940.4978-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,mikuback@linux.microsoft.com X-Gm-Message-State: 24YnV8s7c8FFB0gaXGDGFXl0x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1649781036; bh=WZyMyQECL2q2zsHA5FOS6nWbiRX3YzOdIbnex8HKFpM=; h=Cc:Date:From:Reply-To:Subject:To; b=bc5uFEitapLG/ppM1vgLWEbcyRnlcIi4A0jlMD77K8JsUIZNOS2PTNXk65AkZyK9aSJ GE8Z0p3PndO7lnxgMnjUuUAlSKyaW3d9D8GZDsVzcza+pELceY3vRRjzb61lGkdrlWB9A fTrfAcsUp62gXOljd8LXeZvb1PwE84KwSIw= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1649781039100100002 Content-Type: text/plain; charset="utf-8" From: Michael Kubacki REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3479 Adds an instance of VariableFlashInfoLib to the platform build as it is a new library class introduced in MdeModulePkg. Cc: Guo Dong Cc: Ray Ni Cc: Maurice Ma Cc: Benjamin You Cc: Sean Rhodes Signed-off-by: Michael Kubacki Acked-by: Ard Biesheuvel Reviewed-by: Guo Dong --- UefiPayloadPkg/UefiPayloadPkg.dsc | 1 + 1 file changed, 1 insertion(+) diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayload= Pkg.dsc index 17b30589e77c..4d9bbc80c866 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.dsc +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc @@ -272,6 +272,7 @@ [LibraryClasses] VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyL= ib.inf VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Var= iablePolicyHelperLib.inf + VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseV= ariableFlashInfoLib.inf VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf =20 --=20 2.28.0.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 (#88795): https://edk2.groups.io/g/devel/message/88795 Mute This Topic: https://groups.io/mt/90421985/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-