From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR03-VE1-obe.outbound.protection.outlook.com (EUR03-VE1-obe.outbound.protection.outlook.com [40.107.5.62]) by mx.groups.io with SMTP id smtpd.web09.31899.1650902741656156900 for ; Mon, 25 Apr 2022 09:05:42 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=f0vjqKfl; spf=pass (domain: arm.com, ip: 40.107.5.62, mailfrom: sami.mujawar@arm.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=d+Ftfs6/y5hpp4owGIQo+CpovdSuUpqlwBEtzgdDN3Y=; b=f0vjqKflORm1wMe+hU9hVXcxNcWVZ9UV18OmJYGjBr4VRVh3qurMy670k1B4nCgKlh3LR+UprCc+WlH1xluWho2ByZS6e7kKXWfwTBtx50C/a++eM7WiDVPCLNw3elzxc5VMw0ghawgjUjm+OgL1qRzxhc/kXRdhD62V66eLet4= Received: from AM6PR08CA0030.eurprd08.prod.outlook.com (2603:10a6:20b:c0::18) by VI1PR08MB2654.eurprd08.prod.outlook.com (2603:10a6:802:25::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.19; Mon, 25 Apr 2022 16:05:32 +0000 Received: from AM5EUR03FT013.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:c0:cafe::5d) by AM6PR08CA0030.outlook.office365.com (2603:10a6:20b:c0::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.13 via Frontend Transport; Mon, 25 Apr 2022 16:05:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT013.mail.protection.outlook.com (10.152.16.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.14 via Frontend Transport; Mon, 25 Apr 2022 16:05:32 +0000 Received: ("Tessian outbound 2d401af10eb3:v118"); Mon, 25 Apr 2022 16:05:32 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: ae7dd2422a584615 X-CR-MTA-TID: 64aa7808 Received: from 1f6db08648c9.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id B69EA74E-2F56-4106-89E5-676528094C9C.1; Mon, 25 Apr 2022 16:05:24 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 1f6db08648c9.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 25 Apr 2022 16:05:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NBZXk0LMpcV79bQBUNU/lIsWIW7Ieeq3Wce1ASKhDYa6l23EATE4DOw+nGJyohJSsa2TRpK8VbPU+M/coVLUm05BqiyAC2PmPNt6gAcMH8Bdaqy649Xh5paSpRFB4dS0DVXZckq+ayt+YyZ+iCed5UpmBctWtRg23hkLk5G44+m7T5PL+diHSD7FvDOS12Evgb034AQEeYcfjJvU9x+1HuOxXADMqoEkaUgRBlW+PdeUJUG7Hs16IW5SEeG3VRS2gHheIcrnCvTjpujpGGsDMyDfFmiDPJtIVdMGNrNCj3YAhCj5dDD6f+4sABY30nlfBaa3oo3/zuUZ7ycfq2RznQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=d+Ftfs6/y5hpp4owGIQo+CpovdSuUpqlwBEtzgdDN3Y=; b=W/IpXYtdwrSHTmZ3g8ZxuPNvimGdoj8s+E88WG/4BofOjxJqP9iRK3g5i91RVEltZmaamhUntrakTrNcEp/lG7L05UTLRDWlz6jClfIjsIMv7m06psQAbLHHSVYad2/ZqxOGSLfxMJJ2XNeMt8RlCH68xn7h65UxxIawP0bSVnn5BQbz9VgFN8AagrCFuz9ORxIFpnKS5xCNwfIC+kUgUZBrf5JfWkCwKgxcoV+YORP6OrRWUD0ZkUpd4MkVsTDUZvNwtHaa79Ymh2EuDe19wHHGGNx+VRb9v1GKVOjYaUwFX3nLSNv7WZAENs9MQJ7/7h4fb1lfcl6Me6/J3mF3KA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=d+Ftfs6/y5hpp4owGIQo+CpovdSuUpqlwBEtzgdDN3Y=; b=f0vjqKflORm1wMe+hU9hVXcxNcWVZ9UV18OmJYGjBr4VRVh3qurMy670k1B4nCgKlh3LR+UprCc+WlH1xluWho2ByZS6e7kKXWfwTBtx50C/a++eM7WiDVPCLNw3elzxc5VMw0ghawgjUjm+OgL1qRzxhc/kXRdhD62V66eLet4= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) by HE1PR0802MB2153.eurprd08.prod.outlook.com (2603:10a6:3:c2::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.15; Mon, 25 Apr 2022 16:05:22 +0000 Received: from AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::fd9a:40d3:976a:5a95]) by AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::fd9a:40d3:976a:5a95%4]) with mapi id 15.20.5186.021; Mon, 25 Apr 2022 16:05:22 +0000 Message-ID: <1da46c45-1cd8-e581-349e-6ff0fbf90f5f@arm.com> Date: Mon, 25 Apr 2022 17:05:22 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [edk2-devel] [PATCH v4 1/8] MdeModulePkg: Add Variable Flash Info HOB To: devel@edk2.groups.io, mikuback@linux.microsoft.com Cc: Jian J Wang , Hao A Wu , Liming Gao , nd@arm.com References: <20220412162940.4978-1-mikuback@linux.microsoft.com> <20220412162940.4978-2-mikuback@linux.microsoft.com> From: "Sami Mujawar" In-Reply-To: <20220412162940.4978-2-mikuback@linux.microsoft.com> X-ClientProxiedBy: LO2P265CA0270.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a1::18) To AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 76d11c9b-5a9e-4ac2-9c03-08da26d56cf3 X-MS-TrafficTypeDiagnostic: HE1PR0802MB2153:EE_|AM5EUR03FT013:EE_|VI1PR08MB2654:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: c4lKAth/kuEftBNnrTgu2MKs/fECf7ye4YAzZz+HQtKE9i9vRfh5A7ayhNJxNocgZqTuicpZ3t2bTbq8732j2oOa8h/BN8tpWBtRE3XqGAmEnQKvUDdmvvQ2oaB3ohv8Kl8Pufq9+L1qh9JI0yhM7B2kPfgLVgmMwObYgQOSRRL7sKHuozTGpqT0XeoAN0eWsIYG1TjuoloNmDPnhgRWIvjoYCf5Kj9ABdVbHhBaxoKDMR1CCteRWwagIzzeMXP+t9/wpouVykYgb9Q+3ZlTXyZH4JPXlJAHY5jCZo8igE14YbJm+jA/4nzzyyzvwIinlBZZsDpMlV+eB6wdHIfng9fWfHf8tPx+5FSLIlKhZQ3xZcy1Yn1SmQYFe1HLNqZYvGOc4NkhFRPPb80LyJ0bKJbTBLpqrQyFrKPFEwvGuWbvUIMdDC9JphtmD6KuObZ4xkK9ztFDNTRySzqeu2TaQH9CCUnhDPpDhjakSz3i13wg4kvaL/Qko+PYCM2Rj0hYRiRbSZwgsoMhg9xvsN3HQ/Bu5Wjd25ABZbY4T7obiH20ibenTGi/GgBmtY8yirjN1z9dR39CzunCvWYqZcaLat+eHjBLvpJLTdA1IDqGXmtYSUbgUk7PwRYC7DF+fHlt8UpSWd6mdslgsyoNxHOidjdWC7bvsfT59JZJpln4/cwyjXQHYWlqSVxXKNlmBuTilMb3IfYJEogNWk0ZH1CviNRpX1aZyXRn1MkS2BeJLNCA8Dal0KCiubp8tePqAwReuuk8XRkhl8GDZMD3NAxCEo1Oy+jsmFHBgF5ZedFCJo3IdB8u4Txyv2VP50J31an6 X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR08MB6806.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(8936002)(44832011)(83380400001)(31686004)(6512007)(26005)(86362001)(54906003)(316002)(5660300002)(45080400002)(36756003)(186003)(6506007)(53546011)(2616005)(2906002)(38100700002)(31696002)(508600001)(6486002)(66946007)(8676002)(4326008)(66556008)(66476007)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0802MB2153 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Return-Path: Sami.Mujawar@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT013.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 50ac1d2d-7dd6-44e6-f227-08da26d56719 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2QKInes2bqehUNzRkvbuleGv9pEpdmORyv78ufcK78ErltKO50QQ3Ds1ubChs9tds6LlLdkbOlPBF1fsGoPlWWT5i6BdycRt7zSteljWphnXMwVnXzF0aECRGRw0cP2tyaQL07YWNzAnUp3B7WCXw/JKcOHoutG84E6aYsmiza0TOriWSapZ+K0nyXRQDlYFY5aHJ9CSHObCgDwhjWrKiQW1+gmxGQ3jIG9goi8+DKV3xI5y8Vk6OHgF1ed/urH3WlRDKqOUhGfHOamZDGOmngb0cHmcJE4Rs2NzOpWCFhTSy/1Zf8ioNuiJKOEPidFq/GknY8nAOlafd++XUE4QF6KMoYP8vt9iA8tAUSh/L0mWS1AVw8fOl3S1sbIN03k1kkGO0ltltBTWZs9fN3N4GfKHQZSpRnV2xWGRRs8Wc+Z65o0Li4P0neSDx+HwgdOk4Ci46IRgzk+Ksr0EUMyNtkIXCVWLdhb21XMGgpdd5vbaxAPUnbn5xmFZB1h3xEoip0zf/0a/Ek2EfddaQX+fxJPkup89OdAbx6Lfm5TowAqLkMuLHzyuhzSclD1rPXUQoRa2iye4B3gkfV2XNa8kR7hnm5IL+Wx39pNMw8l/mY5GfUZSLpFjdufVGT36q/dI5kaP3DznISj3gd7IEO1SToD9YY8iu2j26me0HFHCAVUNVKnZw6ptDatM+3v/L8B3UMqX7Xy+Wxzm48jmViBD4ZwUXCpCNMdqbfaVfwqF/BOUrIUKcmlEMi5PH7b6YDJlGKtb3Rmfw875SfXfZy7Pv4JisXvAA8Ir2TkogzFRBwA= X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(186003)(83380400001)(81166007)(356005)(86362001)(508600001)(47076005)(53546011)(336012)(31686004)(36756003)(5660300002)(8936002)(2906002)(44832011)(6506007)(26005)(54906003)(31696002)(4326008)(2616005)(8676002)(6512007)(70206006)(70586007)(36860700001)(40460700003)(316002)(45080400002)(82310400005)(6486002)(43740500002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Apr 2022 16:05:32.3359 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 76d11c9b-5a9e-4ac2-9c03-08da26d56cf3 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT013.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB2654 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Michael, Thank you for this patch. These changes look good to me. Reviewed-by: Sami Mujawar Regards, Sami Mujawar On 12/04/2022 05:29 pm, Michael Kubacki via groups.io wrote: > From: Michael Kubacki > > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3479 > > 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 | 111 ++++++++++++++++++++ > MdeModulePkg/MdeModulePkg.dec | 4 + > 2 files changed, 115 insertions(+) > > diff --git a/MdeModulePkg/Include/Guid/VariableFlashInfo.h b/MdeModulePkg/Include/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 about > + a variable store mapped on flash (i.e. a MMIO firmware volume) to the modules > + that consume that information such as the DXE and MM UEFI variable drivers. > + > + The HOB described in this file is currently optional. It is primarily provided > + to allow a platform to dynamically describe the flash information to environments > + 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 stored > + 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 this > + information. For modules such as these, that execute early in the boot flow, > + 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 read > + 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 the HOB > + is currently consumed is in FaultTolerantWritePei. Note that FaultTolerantWritePei > + produces gEdkiiFaultTolerantWriteGuid which is a dependency for VariablePei. > + > + Therefore, attaching a NULL class library to FaultTolerantWritePei with a > + constructor that produces the HOB will guarantee it is produced before 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 NvVariableLength. > + /// 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 value 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 should 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 = { 0x93ba1826, 0xdffb, 0x45dd, { 0x82, 0xa7, 0xe7, 0xdc, 0xaa, 0x3b, 0xbd, 0xf3 }} > > + ## Guid of the variable flash information HOB. > + # Include/Guid/VariableFlashInfo.h > + gVariableFlashInfoHobGuid = { 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 = { 0x76B6BDFA, 0x2ACD, 0x4462, { 0x9E, 0x3F, 0xCB, 0x58, 0xC9, 0x69, 0xD9, 0x37 } }