From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web11.304.1649698961274812647 for ; Mon, 11 Apr 2022 10:42:41 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@linux.microsoft.com header.s=default header.b=NwWWty5L; spf=pass (domain: linux.microsoft.com, ip: 13.77.154.182, mailfrom: mikuback@linux.microsoft.com) Received: from localhost.localdomain (unknown [47.201.46.36]) by linux.microsoft.com (Postfix) with ESMTPSA id 0113020B9CEF; Mon, 11 Apr 2022 10:42:39 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 0113020B9CEF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1649698960; bh=k4izWjdtqXlnoUmrGQA2ASzF5qunzuwPxcxi116TZZ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NwWWty5LqFvcFwfbVc4zB2OTtLTgEDkcbjyYRhpWRNBWR3FftfpXuOejSp0xs/u5r pn+WKYCvEDz8TfK4Mo0j1rSQU4u7aa/NtF2ZYZVP5Y2l1nuMgss2nCLvFuL2/3ucLV /9H8zUMpifk382g1+UphGmY3C9FxWtLWNl2V8RyI= From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu , Liming Gao Subject: [PATCH v3 1/8] MdeModulePkg: Add Variable Flash Info HOB Date: Mon, 11 Apr 2022 13:42:02 -0400 Message-Id: <20220411174209.2804-2-mikuback@linux.microsoft.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20220411174209.2804-1-mikuback@linux.microsoft.com> References: <20220411174209.2804-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 --- MdeModulePkg/Include/Guid/VariableFlashInfo.h | 78 ++++++++++++++++++++ MdeModulePkg/MdeModulePkg.dec | 4 + 2 files changed, 82 insertions(+) diff --git a/MdeModulePkg/Include/Guid/VariableFlashInfo.h b/MdeModulePkg= /Include/Guid/VariableFlashInfo.h new file mode 100644 index 000000000000..7520953cd0f2 --- /dev/null +++ b/MdeModulePkg/Include/Guid/VariableFlashInfo.h @@ -0,0 +1,78 @@ +/** @file + This file defines the GUID and data structure used to pass information= about + a variable store mapped on flash (i.e. a MMIO firmware volume) to the = DXE and MM environment. + + 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, 0x= fc, 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; + /// + /// Base address of the non-volatile variable range in the flash devic= e. + /// + /// Note that this address should align with the block size requiremen= ts 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 FtwSpareLengt= h to support reclaim of + /// entire variable store area. + /// Note that this address should align with the block size requiremen= ts 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 requiremen= ts 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 NvVariable= Length. + /// Note that this address should align with the block size requiremen= ts 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 v= alue 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 shoul= d not span blocks. + /// Note that if the value is larger than one block size, this value s= hould be block size aligned. + /// + UINT64 FtwWorkingLength; +} VARIABLE_FLASH_INFO; + +#pragma pack (pop) + +#endif diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.de= c 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,= 0xe7, 0xdc, 0xaa, 0x3b, 0xbd, 0xf3 }} =20 + ## Guid of the variable flash information HOB. + # Include/Guid/VariableFlashInfo.h + gVariableFlashInfoHobGuid =3D { 0x5d11c653, 0x8154, 0x4ac3, { 0xa8, 0x= c2, 0xfb, 0xa2, 0x89, 0x20, 0xfc, 0x90 }} + ## Performance protocol guid that also acts as the performance HOB gui= d and performance variable GUID # Include/Guid/Performance.h gPerformanceProtocolGuid =3D { 0x76B6BDFA, 0x2ACD, 0x4462, { 0x9= E, 0x3F, 0xCB, 0x58, 0xC9, 0x69, 0xD9, 0x37 } } --=20 2.28.0.windows.1