From nobody Sat May 18 23:23:19 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+89297+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+89297+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1650936587; cv=none; d=zohomail.com; s=zohoarc; b=AObNB11bv8bZ+fS4x+IT3bbVKrdh5v1qkS7Qca1e5+mOHkJxabtkkvrMrZcnGaKK2KXj+hmHet+ukfCKkBQT6x+hAkBdE6HgBZxdoFrf6TG7u7bAxorUVnCMXsUrgHGcgRX2oVwgxy3F7Nf6zrlCXfH8jX82V13GLsfXq9AyUrY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650936587; 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=wsOhxCSPR+cupczSMgXNfCJHUW0azA/UhDhPr1gRG44=; b=npHvtaE4MWmm2kcRoyk8CsW02z2wxh9PmXyR3lEj4WQGlFYaSPw7XJXSC+R+MmLtFzyKRmqh/wexMIDRqF7lRdHFuqRf/UnjUMaHFpTpBvFOSvXZ4pC5DU3Yl0ye3/SMzUHVrGIfndC5gofjaSwnwwuABlPq/HW+NoL1uTB6MuY= 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+89297+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 16509365873944.558829010447539; Mon, 25 Apr 2022 18:29:47 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id nhKjYY1788612x9GWUuGA964; Mon, 25 Apr 2022 18:29:46 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web11.954.1650936586126015079 for ; Mon, 25 Apr 2022 18:29:46 -0700 X-Received: from localhost.localdomain (unknown [47.195.228.134]) by linux.microsoft.com (Postfix) with ESMTPSA id BDB0820E8CAE; Mon, 25 Apr 2022 18:29:44 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com BDB0820E8CAE From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu , Liming Gao , Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [PATCH v5 1/8] MdeModulePkg: Add Variable Flash Info HOB Date: Mon, 25 Apr 2022 21:29:11 -0400 Message-Id: <20220426012918.1216-2-mikuback@linux.microsoft.com> In-Reply-To: <20220426012918.1216-1-mikuback@linux.microsoft.com> References: <20220426012918.1216-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: Li7Ir7Z2E0PqHAWbfa6nOYQXx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1650936586; bh=9Xca/hRiqjF3jrywfYo+HA73d3KQMflzeBiVnjhvsAI=; h=Cc:Date:From:Reply-To:Subject:To; b=lssNKXqkH9nXe7SKfXd11eBRvkmUk+j7LMsJwzDlrO3Sk4XvWhNcg3Pi8IgbCX0ymQU 74BLIF+kzWNQJ4zQlF2juBKHCWqWxvpkqV64E4R2tOp3AXx9H5LC5TlipvGEYCwYgQr2L XaWmTCwdLaseApQeMuRTOfH6iBhRt9Key/I= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1650936588642100003 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: Liming Gao 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 (#89297): https://edk2.groups.io/g/devel/message/89297 Mute This Topic: https://groups.io/mt/90699666/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 Sat May 18 23:23:19 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+89298+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+89298+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1650936591; cv=none; d=zohomail.com; s=zohoarc; b=LDBflkWOgQqwjOEw9FUTzk3m9xLDgGdfMQLT2wS39SmHYHjZKsQ3llj8dYq59uavdiESKwYtli9qLmhB1fp1XYn9R6Kv04eIIyIrsLKdnUR47BNAsCpj5InZTWm7xDDuWABLSMcEj8LloVYbF4cauD1nERgqCMyBbDGTxYN4okk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650936591; 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=f+l1CLC8U32D5mQP9jwJMR7ptQtexsK86AcdGFT1PjI=; b=Y5SOLq23idSM1Zxy9CLk5nDO6gRRTZGcs3wOaasELNRmZcaBlfPVDtSW/0cmjzhwq+5tCKTXxHvioe+6CxYu6FZ88z38c6JTXSMUCn4Z5WL2CtGczeczFayGnJSP34wBh+GfNbtTegfo3dlbW0CoT9gguoi2HTwuht4iN8q6nes= 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+89298+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 1650936591808940.7641764176607; Mon, 25 Apr 2022 18:29:51 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id jwH0YY1788612xAzUUGzWyWY; Mon, 25 Apr 2022 18:29:51 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web12.947.1650936590502377208 for ; Mon, 25 Apr 2022 18:29:50 -0700 X-Received: from localhost.localdomain (unknown [47.195.228.134]) by linux.microsoft.com (Postfix) with ESMTPSA id 7094E20E8CAE; Mon, 25 Apr 2022 18:29:49 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 7094E20E8CAE From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu , Liming Gao , Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [PATCH v5 2/8] MdeModulePkg/VariableFlashInfoLib: Add initial library Date: Mon, 25 Apr 2022 21:29:12 -0400 Message-Id: <20220426012918.1216-3-mikuback@linux.microsoft.com> In-Reply-To: <20220426012918.1216-1-mikuback@linux.microsoft.com> References: <20220426012918.1216-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: 2jllDdOJRjTgdVfun9L0v0ztx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1650936591; bh=hHmRpmh3jL6mU4Qyny6uniSJbIfUYl8nFyROYqUUIuA=; h=Cc:Date:From:Reply-To:Subject:To; b=ZfCimarWmy6yQ12nxufUtPdW0WhNI9K2rkVVQEueK9fu1ugy4VxMOftUI2t2XTp9Kio hRfSP0t8odJh2F4E63AIMSPWbGwFKn9j2xse0uovJIaOUO1EGPx+Xh74elx+C5M00Uw6B tzq2pUTbzicU54sebdcOMyGSbpEO7VyzdpM= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1650936592462100001 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: Liming Gao Reviewed-by: Sami Mujawar --- MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.c = | 179 ++++++++++++++++++++ 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, 313 insertions(+) diff --git a/MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlas= hInfoLib.c b/MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlas= hInfoLib.c new file mode 100644 index 000000000000..d5897225897b --- /dev/null +++ b/MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLi= b.c @@ -0,0 +1,179 @@ +/** @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. + +**/ +STATIC +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 (#89298): https://edk2.groups.io/g/devel/message/89298 Mute This Topic: https://groups.io/mt/90699669/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 Sat May 18 23:23:19 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+89299+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+89299+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1650936596; cv=none; d=zohomail.com; s=zohoarc; b=WRNbkB9qTdxuv4emnZrYXa6FdcCg1gBeWwILMsAPQtbB0uT5vWM88NYKIzvEkAYqpnr26vSdl1Hw+UhCuvoQ8UI446qCTHtL3XpNWpellFpcEsRS0ZHozKm3NyFPt3viroTToO/3jv9RLw2ORrkrQxcBOGZdzluNhAJI+TaWdXQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650936596; 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=2JErW8wGw6k9pN8asTWq1Pz1jGoe2PBIw2XvCXtD7Ag=; b=ghhHOhCMznU37A6ChLaWBSMYgA0QsPXCVVJJpQNqoDZAOC0Yp4ADtzRK0zfKDCrn8+t0w2BYIvNITXe5h0gUL5kXYAepuLdjdnGGrJEgvzLcuV0S+i2nt5YFbuEsM8wqVPxUA8Ius9UwQlA+5QTnMxaO+2eeB2ulMIqe5igNFpo= 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+89299+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 1650936596754768.7040352022561; Mon, 25 Apr 2022 18:29:56 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id j8TvYY1788612xhJJNovCO3x; Mon, 25 Apr 2022 18:29:56 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web12.948.1650936595763155233 for ; Mon, 25 Apr 2022 18:29:55 -0700 X-Received: from localhost.localdomain (unknown [47.195.228.134]) by linux.microsoft.com (Postfix) with ESMTPSA id 9629720E8CAE; Mon, 25 Apr 2022 18:29:54 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 9629720E8CAE From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu , Liming Gao , Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [PATCH v5 3/8] MdeModulePkg/Variable: Consume Variable Flash Info Date: Mon, 25 Apr 2022 21:29:13 -0400 Message-Id: <20220426012918.1216-4-mikuback@linux.microsoft.com> In-Reply-To: <20220426012918.1216-1-mikuback@linux.microsoft.com> References: <20220426012918.1216-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: DYtFxY8ILy2UQzadQT9zzZodx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1650936596; bh=atl9U+tVXRCuB3lrTYP/duSs0zXgeqDgmuU4/9WvaLQ=; h=Cc:Date:From:Reply-To:Subject:To; b=XcR2mytkyzPkjcWj8rWAHAdH3NK4bYFLG0mJ2RBuM7T0F/bObUMXPtEAGyV/UjyeUei Z+VDaCTmpt41Tat2dqLUkl0iBQPk8uF9BQ7IiN+0MjmOj+F07boMA+9mZcjaNJNGQ36wW AKbeFu8MD0bIYdQNiPeiZwX10aUPcD1prXE= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1650936598514100003 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. Note: This introduces a dependency on VariableFlashInfoLib in these modules. Therefore, a platform building the variable modules must specify an instance of VariableFlashInfoLib in their platform build. Cc: Jian J Wang Cc: Hao A Wu Cc: Liming Gao Signed-off-by: Michael Kubacki Acked-by: Ard Biesheuvel Reviewed-by: Liming Gao 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 (#89299): https://edk2.groups.io/g/devel/message/89299 Mute This Topic: https://groups.io/mt/90699672/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 Sat May 18 23:23:19 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+89300+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+89300+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1650936600; cv=none; d=zohomail.com; s=zohoarc; b=FHThwwjMbyAdcUDZNALWuwL0wHRDeXoWt1hwfU89nIrqNRSyjk1pTqmqMt0RWymFX8JWHbDqmzzUBCz/aw8qAKd+AIT+lxo/P+Nt1y7lk+8i5S8h/SKJwFwfHnILsZDYG6U6RaE2E2dgLEuWxTZ2dB/6UUtqHhSjx520p5rFR2M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650936600; 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=kYaFCzEyrUirOA+EI1DCh5tGfOnFgMv4I/NCql66Xuo=; b=kRnnz7dLBCXqEKz/gq20RlO1/dIVNnHW6RgO9t0w/2PBGSJLbtiYk4Uj4ks6ACpU6e98RVo7B6N6ksSk4HP0Y2XGrrSnWwWcxMC+ngz0kFsD45ovLkSvrBFzLM8cuDYRDy4ZLVwyyB1/d4tbFI+gnptYZKSGDtpZZw1+3iMECIU= 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+89300+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 1650936600565815.2426885733255; Mon, 25 Apr 2022 18:30:00 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id KaS8YY1788612xhVHzPSTIIL; Mon, 25 Apr 2022 18:30:00 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web08.962.1650936599657262247 for ; Mon, 25 Apr 2022 18:29:59 -0700 X-Received: from localhost.localdomain (unknown [47.195.228.134]) by linux.microsoft.com (Postfix) with ESMTPSA id 9CEDF20E8CAE; Mon, 25 Apr 2022 18:29:58 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 9CEDF20E8CAE From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu , Liming Gao , Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [PATCH v5 4/8] MdeModulePkg/FaultTolerantWrite: Consume Variable Flash Info Date: Mon, 25 Apr 2022 21:29:14 -0400 Message-Id: <20220426012918.1216-5-mikuback@linux.microsoft.com> In-Reply-To: <20220426012918.1216-1-mikuback@linux.microsoft.com> References: <20220426012918.1216-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: K4ObgqlRAf8vCdHpFedbrSYGx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1650936600; bh=akVkMcHyQEUTPSML6EdDyvz80ExF7YOBFSojiiBV+bE=; h=Cc:Date:From:Reply-To:Subject:To; b=K6osO0patTZZXmOqmIbTwYF4pfx3yHkC1yUCP+f83jGvgedDTT9ikukeKufZDVuxivX lTX2ayNp52sfuBJrhrr/YwpsKWam+VXd9s5xK80UeLQU7CU+CWN8/RX1uJmo+tKkyrQhH H5aBjJGVqBbGCtHvz3mF7i6QDhDTYpxBKMY= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1650936602547100003 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: Liming Gao 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 (#89300): https://edk2.groups.io/g/devel/message/89300 Mute This Topic: https://groups.io/mt/90699674/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 Sat May 18 23:23:19 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+89302+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+89302+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1650936605; cv=none; d=zohomail.com; s=zohoarc; b=njp65yoUn3PmLzDHkapAfdjP0AZce8tYys9AUEYUznYXLxWsCMJI6CBlNjEmRpO8/OVTbWnWoiNNmyTvTsP4Bw12+kl5hGTM7olRggyZ5CuJgJWfGuCFLYfJCUTb5DTalFB8HfagOglC4oV4hATiEcS7C1wlyZ+e9O9NFy4ZfrU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650936605; 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=5GLsvXAqco8liiOQgIGKcVSjd7T9z2JSNcWDt8q0kSk=; b=QmVNO2Kz6TlFh/jvM3SPsg6y1AxyBTnufBJJuLTGAUGUe13Dwr7LOg28mZgaZbDREAlL4UqKqlM3DFsg/EuREPETwkPcL6y86SNknFL+N+E9UswBQ5XkGOjAuhSIr1rHjYh50DtlkhbeNdRkJRtHneYRN/dbEOYVx1kfAraiVR0= 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+89302+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 1650936605736347.7975263567748; Mon, 25 Apr 2022 18:30:05 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id m5SYYY1788612xvEXTvLHLT7; Mon, 25 Apr 2022 18:30:05 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web10.989.1650936604285586857 for ; Mon, 25 Apr 2022 18:30:04 -0700 X-Received: from localhost.localdomain (unknown [47.195.228.134]) by linux.microsoft.com (Postfix) with ESMTPSA id 04D2620DEE20; Mon, 25 Apr 2022 18:30:02 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 04D2620DEE20 From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Sami Mujawar , Gerd Hoffmann , Julien Grall , Ard Biesheuvel , Liming Gao Subject: [edk2-devel] [PATCH v5 5/8] ArmVirtPkg/ArmVirt.dsc.inc: Add VariableFlashInfoLib Date: Mon, 25 Apr 2022 21:29:15 -0400 Message-Id: <20220426012918.1216-6-mikuback@linux.microsoft.com> In-Reply-To: <20220426012918.1216-1-mikuback@linux.microsoft.com> References: <20220426012918.1216-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: x41SOWodE33a49pSltGiYlU3x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1650936605; bh=4UWARxDXK/0L5vBOZsR1nh1GHOkwZmz3LkNcNsG4zS4=; h=Cc:Date:From:Reply-To:Subject:To; b=oP7zhdaipYWNfS4bh4uTbj2dSErpeLhXlqw2TdmbdVK9t0WJf6K1Vp/a8XNkemzF36N CZc/gh8MA61/jsnFRNW8MtyteIK2aoLMQB8lhVVmb0+qYS4PFvMwHnPcn4YMBSQ9K/W+N wVvvUtJ0312X3BGxEAzna0BggkJuwqbO++Y= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1650936606515100009 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: Liming Gao 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 (#89302): https://edk2.groups.io/g/devel/message/89302 Mute This Topic: https://groups.io/mt/90699681/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 Sat May 18 23:23:19 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+89303+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+89303+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1650936609; cv=none; d=zohomail.com; s=zohoarc; b=d1rwQra1S42XHPE5b/DYyS2Sj6bM8HNc3sUQ+lqaebkyUiyHh5QzB2gu7OOFJMOT2Mk4orxb0IprM5T/hqrdhdoSvgTf5oIp0FkcRxWtIIPNhGaLk5yHElH5DuXSaPnFbtxEXlnMhT5lWw2siTPOHztjXRi3ZxuP65wDDOKhuhQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650936609; 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=2WZkpQSmpd7eQ6/zhW/Za3Wymjw8OOZuYaHYwPZxa2M=; b=VB8RFoFMDItQvpACmralFqijCFxOZYpWKTjlgSHyFGuKWyV91e7NonQTXdiFt7anzsP1wiY2CaCdTV9pd9n9N3mbFxTF2jvchUNptothnLYQ/QFizsPccJEjR0B9aBXhM+eLho/F2r9grOvF9nP1+6+/YeTVLE2hZQANrLRse8E= 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+89303+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 1650936609701864.4310585816087; Mon, 25 Apr 2022 18:30:09 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 5OkLYY1788612x5YxxpwPEvc; Mon, 25 Apr 2022 18:30:09 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web12.951.1650936608446410724 for ; Mon, 25 Apr 2022 18:30:08 -0700 X-Received: from localhost.localdomain (unknown [47.195.228.134]) by linux.microsoft.com (Postfix) with ESMTPSA id 45DE520E8CB3; Mon, 25 Apr 2022 18:30:07 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 45DE520E8CB3 From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Andrew Fish , Ray Ni , Abner Chang , Nickle Wang , Ard Biesheuvel , Liming Gao Subject: [edk2-devel] [PATCH v5 6/8] EmulatorPkg: Add VariableFlashInfoLib Date: Mon, 25 Apr 2022 21:29:16 -0400 Message-Id: <20220426012918.1216-7-mikuback@linux.microsoft.com> In-Reply-To: <20220426012918.1216-1-mikuback@linux.microsoft.com> References: <20220426012918.1216-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: cofbvig98GOr366N0cfp68Gsx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1650936609; bh=qEXy33UmBi/J91C4AvrQ4mdU/u179uYn0hJxXV9tPB8=; h=Cc:Date:From:Reply-To:Subject:To; b=LKNLXoMactda4XMZuwsamCefex0UcL8r3rNu3KpXZHZktmHyHXXBpDlBJqEelqlRTj/ Aw42iL9qgPcGyGEmIyY3/mVOpaA6pUcJT082OZKcZu1p8qp4mLmNI/6XTRfUYMLhjSGhr uUYmG41L7Laq9MiYB3aDbuoSu1mkC6X/Hss= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1650936610533100015 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 Reviewed-by: Liming Gao Reviewed-by: Abner Chang --- 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 (#89303): https://edk2.groups.io/g/devel/message/89303 Mute This Topic: https://groups.io/mt/90699683/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 Sat May 18 23:23:19 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+89304+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+89304+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1650936614; cv=none; d=zohomail.com; s=zohoarc; b=dGZCWN+PX6BAhZsNm6JWdEMSljwQ09aYY+eFysXHqO6VJVIUPN9WQ19gfpI1czymEbuePIi0koLMmj/aTYyZz/afFjE5VTChoWet9u8HyGzNEp2SRJlMDGv7aC7uPByXcaJaR3y7z12nBtnDIITniZ9JM1ILh6K4WfswjvpeeA4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650936614; 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=C3A1VruiaiWqA+60bRZK94sn10QgV2VTwzU9jmY/AMg=; b=KRQZ07bY1+FIPJzA4hG63koWa9nTgo55+uBTWZ2yfi6IvGk2DWr8cQZ3jsJCvRMS0iaqrG9RMCWZJDMxDA7SzVGjCq8NuuCZEm1SYRy2WoPAlH/8laOBxfcxM3SibOpsbRqmt6e4EJF8jHihRH1RR9HWZ4kpING2EgpGrwgYbr8= 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+89304+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 1650936614909183.12147390506516; Mon, 25 Apr 2022 18:30:14 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id Fi2LYY1788612xmxAbAzv67V; Mon, 25 Apr 2022 18:30:14 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web10.995.1650936614008332289 for ; Mon, 25 Apr 2022 18:30:14 -0700 X-Received: from localhost.localdomain (unknown [47.195.228.134]) by linux.microsoft.com (Postfix) with ESMTPSA id 8D26720DEE20; Mon, 25 Apr 2022 18:30:11 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8D26720DEE20 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 , Ard Biesheuvel , Liming Gao Subject: [edk2-devel] [PATCH v5 7/8] OvmfPkg: Add VariableFlashInfoLib Date: Mon, 25 Apr 2022 21:29:17 -0400 Message-Id: <20220426012918.1216-8-mikuback@linux.microsoft.com> In-Reply-To: <20220426012918.1216-1-mikuback@linux.microsoft.com> References: <20220426012918.1216-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: fbPcy5La9KOucb3lXocjaWm2x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1650936614; bh=noSXGh62Vu798nQJLUQUxoje32ywpGU9Y5UPmYqKV9g=; h=Cc:Date:From:Reply-To:Subject:To; b=bopUdOlT+aDyWRJq77m0wgHrypIEsUsaqGEQsqN5y3qfkK1CfnSXOTnIt16ubsWJQOG FiGWfExGkGclRFrwiJ7XyYQFReiv0H9YIA1cmnvJjjXUSFtXdOp2Rt46FYJDWxlRzTIQS p1CueoeQEFdWnOXwZUOcQJanlFOSITU9/r0= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1650936616600100003 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: Liming Gao Reviewed-by: Rebecca Cran Reviewed-by: Jiewen Yao --- 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 f0700035c116..bead9722eab8 100644 --- a/OvmfPkg/AmdSev/AmdSevX64.dsc +++ b/OvmfPkg/AmdSev/AmdSevX64.dsc @@ -196,6 +196,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 a8fa4d38ab60..d33728cbe773 100644 --- a/OvmfPkg/Bhyve/BhyveX64.dsc +++ b/OvmfPkg/Bhyve/BhyveX64.dsc @@ -207,6 +207,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 d1c85f60c768..92664f319be2 100644 --- a/OvmfPkg/CloudHv/CloudHvX64.dsc +++ b/OvmfPkg/CloudHv/CloudHvX64.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/IntelTdx/IntelTdxX64.dsc b/OvmfPkg/IntelTdx/IntelTdxX6= 4.dsc index 73a6c30096a8..01e0ae0ad40a 100644 --- a/OvmfPkg/IntelTdx/IntelTdxX64.dsc +++ b/OvmfPkg/IntelTdx/IntelTdxX64.dsc @@ -185,6 +185,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 20c3c9c4d862..f8fc977cb205 100644 --- a/OvmfPkg/Microvm/MicrovmX64.dsc +++ b/OvmfPkg/Microvm/MicrovmX64.dsc @@ -207,6 +207,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 f02b371f7427..892ed6c64cf1 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc @@ -214,6 +214,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 cb68e612bd35..d3a80cb56892 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -218,6 +218,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 45ffa2dbe35f..c05f345a40e1 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -226,6 +226,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 a1626d06dfc3..6ba4bd729ae7 100644 --- a/OvmfPkg/OvmfXen.dsc +++ b/OvmfPkg/OvmfXen.dsc @@ -196,6 +196,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 (#89304): https://edk2.groups.io/g/devel/message/89304 Mute This Topic: https://groups.io/mt/90699684/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 Sat May 18 23:23:19 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+89305+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+89305+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1650936619; cv=none; d=zohomail.com; s=zohoarc; b=m9RAWFGJ2zUXWBS96959X/KVc+db3YkfEXTrNKv7LO7rMboJdmT32D00lpmY4uzevzzALsemI8oeVjZi8AOneUOgZu6KHAKUMkonH3HQ4mSW3BUfe+FKewdWXVmZtO1LOgR++UO5cBt2A/zCxEQ/W0YLCOpVx5rLrzGqlod+R08= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650936619; 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=d0XSktwqerZRvBoApXImOgd2YcrC1a/O7P3QoKgGov0=; b=nb7YlT6lqSLz8ZaMc1MAXpSbTEQpYOwoe5CM4VdDNAMM7GuZZQyaQa2bJN8aVAZw5REh+b8viRWDu2MQEUyjWFnVJPWGYDjPBM80QjC+elpYKgYfuuvJHj94/i2c9VeOVTnjbz9sGNa7LwL6HdlQPOTCQQt9nIJOdMpi77NyDhg= 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+89305+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 1650936619853425.1222595756227; Mon, 25 Apr 2022 18:30:19 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id iNBiYY1788612xntQ6GR0ASV; Mon, 25 Apr 2022 18:30:19 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web12.956.1650936618494313097 for ; Mon, 25 Apr 2022 18:30:18 -0700 X-Received: from localhost.localdomain (unknown [47.195.228.134]) by linux.microsoft.com (Postfix) with ESMTPSA id 2CABD20DEE20; Mon, 25 Apr 2022 18:30:17 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 2CABD20DEE20 From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Guo Dong , Ray Ni , Maurice Ma , Benjamin You , Sean Rhodes , Ard Biesheuvel , Liming Gao Subject: [edk2-devel] [PATCH v5 8/8] UefiPayloadPkg: Add VariableFlashInfoLib Date: Mon, 25 Apr 2022 21:29:18 -0400 Message-Id: <20220426012918.1216-9-mikuback@linux.microsoft.com> In-Reply-To: <20220426012918.1216-1-mikuback@linux.microsoft.com> References: <20220426012918.1216-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: alBGdD1npKG8nuOgzpG4X6H7x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1650936619; bh=N9QrF9su1ryFiz8CrkSqRLzvvnTKCc6oCy7k7mWJ8OE=; h=Cc:Date:From:Reply-To:Subject:To; b=dYnmYuT/JdQSXDBaA3SZaZ/+/3YQZhNcwCCSaUAJhOVmU916zXB9WOLb0FnE+PRJRAb j19HRfRfc2x/1mA8dZv3vWH1gvxqCGRVQArOhLz0ZzTmlPvuf8cGnwdzgHFo9m639lDcH 3V6G0sU5vc2mW2/9m4GaCyDf+yeKJlVUxnY= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1650936620568100001 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: Liming Gao 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 (#89305): https://edk2.groups.io/g/devel/message/89305 Mute This Topic: https://groups.io/mt/90699686/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-