From nobody Sat May 18 10:48:48 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+91476+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+91476+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1658175452; cv=none; d=zohomail.com; s=zohoarc; b=bDPk/oLXDPX3io9zgluukNgBB+HLGilqttRs+NwF6ekwiujZSkS7/IcsUmg0bhv+Y4JGn8Ue9OSeyaiDPWlqqpXb/bpiUU4fHsVUIJnIhbVyd2OPJv/RzW/s8jMxYK80Tf8qun3gPpFSsJvdI19Ur5jY2SERXmGbzOFwDzHf2fM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658175452; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=2+Mgbi9EyL7mQULJ3j+2YSJq4VS8PgEXRZyPZQ67Aro=; b=Jo1Jowph8ZWdjhnYUDYiAhodcJ/D6d8+27XrtCCdu7eo218sBnjG0JmTLwSlyu/reoAJFeXSq5HQFJtebFP39XbiW2hZQN4uqRAaoBz6h7aKs1DF/sALucKT4qFS+LHSWgL/TDDcCQj8qb65cbZWLMxvSVyORwuD+qs+yW/ttZc= 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+91476+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 16581754524850.3607382401717132; Mon, 18 Jul 2022 13:17:32 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 9cICYY1788612xheWqp1hJGz; Mon, 18 Jul 2022 13:17:32 -0700 X-Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web12.32404.1658175450819156435 for ; Mon, 18 Jul 2022 13:17:31 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10412"; a="287462669" X-IronPort-AV: E=Sophos;i="5.92,282,1650956400"; d="scan'208";a="287462669" X-Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jul 2022 13:17:30 -0700 X-IronPort-AV: E=Sophos;i="5.92,282,1650956400"; d="scan'208";a="597386319" X-Received: from nldesimo-desk1.amr.corp.intel.com ([10.7.159.54]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jul 2022 13:17:30 -0700 From: "Nate DeSimone" To: devel@edk2.groups.io Cc: Chasel Chiu Subject: [edk2-devel] [PATCH V1] IntelFsp2Pkg: Add Definition of EDKII_PEI_VARIABLE_PPI Date: Mon, 18 Jul 2022 13:17:25 -0700 Message-Id: <20220718201725.5017-1-nathaniel.l.desimone@intel.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,nathaniel.l.desimone@intel.com X-Gm-Message-State: 3OxuVAyyRC1aOyPIjyImktJFx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1658175452; bh=ldbRTrUWBoTHgOc1xL4iKq/7fSayG2lcvC3I6gZ1lUk=; h=Cc:Date:From:Reply-To:Subject:To; b=A3MrYQmJJiMzQwgDiKu/UzmhqwgVBnuRI5+wBkNgqBriypz17wHxc4nKeJ5D03QRW7M V7ogCXm2JZgDGBZewZRMlbaE0/KTTr6ueQLLyepfGZTeOKGkNDbcne0DIm3l1cxNkmT/m Cc9qTj9SZ013Nyr0fK7VIKpLuIRQXOqEd9w= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1658175453755100001 Content-Type: text/plain; charset="utf-8" Adds definition of EDKII_PEI_VARIABLE_PPI. Cc: Chasel Chiu Signed-off-by: Nate DeSimone Reviewed-by: Chasel Chiu --- IntelFsp2Pkg/Include/Ppi/Variable.h | 195 ++++++++++++++++++++++++++++ IntelFsp2Pkg/IntelFsp2Pkg.dec | 8 +- 2 files changed, 202 insertions(+), 1 deletion(-) create mode 100644 IntelFsp2Pkg/Include/Ppi/Variable.h diff --git a/IntelFsp2Pkg/Include/Ppi/Variable.h b/IntelFsp2Pkg/Include/Ppi= /Variable.h new file mode 100644 index 0000000000..3e1f4b98a9 --- /dev/null +++ b/IntelFsp2Pkg/Include/Ppi/Variable.h @@ -0,0 +1,195 @@ +/** @file + EDKII PEI Variable PPI provides an implementation of variables + intended for use as a means to store data in the PEI environment. + + Copyright (c) 2022, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef EDKII_PEI_VARIABLE_PPI_H_ +#define EDKII_PEI_VARIABLE_PPI_H_ + +#define EDKII_PEI_VARIABLE_PPI_GUID \ + { \ + 0xe7b2cd04, 0x4b14, 0x44c2, { 0xb7, 0x48, 0xce, 0xaf, 0x2b, 0x66, 0x4a= , 0xb0 } \ + } + +typedef struct _EDKII_PEI_VARIABLE_PPI EDKII_PEI_VARIABLE_PPI; + +/** + This service retrieves a variable's value using its name and GUID. + + Read the specified variable from the UEFI variable store. If the Data + buffer is too small to hold the contents of the variable, + the error EFI_BUFFER_TOO_SMALL is returned and DataSize is set to the + required buffer size to obtain the data. + + @param[in] This A pointer to this instance of the ED= KII_PEI_VARIABLE_PPI. + @param[in] VariableName A pointer to a null-terminated strin= g that is the variable's name. + @param[in] VariableGuid A pointer to an EFI_GUID that is the= variable's GUID. The combination of + VariableGuid and VariableName must b= e unique. + @param[out] Attributes If non-NULL, on return, points to th= e variable's attributes. + @param[in, out] DataSize On entry, points to the size in byte= s of the Data buffer. + On return, points to the size of the= data returned in Data. + @param[out] Data Points to the buffer which will hold= the returned variable value. + May be NULL with a zero DataSize in = order to determine the size of the + buffer needed. + + @retval EFI_SUCCESS The variable was read successfully. + @retval EFI_NOT_FOUND The variable was not found. + @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the re= sulting data. + DataSize is updated with the size re= quired for + the specified variable. + @retval EFI_INVALID_PARAMETER VariableName, VariableGuid, DataSize= or Data is NULL. + @retval EFI_DEVICE_ERROR The variable could not be retrieved = because of a device error. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_GET_VARIABLE)( + IN CONST EDKII_PEI_VARIABLE_PPI *This, + IN CONST CHAR16 *VariableName, + IN CONST EFI_GUID *VariableGuid, + OUT UINT32 *Attributes OPTIONAL, + IN OUT UINTN *DataSize, + OUT VOID *Data OPTIONAL + ); + +/** + Return the next variable name and GUID. + + This function is called multiple times to retrieve the VariableName + and VariableGuid of all variables currently available in the system. + On each call, the previous results are passed into the interface, + and, on return, the interface returns the data for the next + variable. To get started, VariableName should initially contain L"\0" + and VariableNameSize should be sizeof(CHAR16). When the entire + variable list has been returned, EFI_NOT_FOUND is returned. + + @param[in] This A pointer to this instance of the ED= KII_PEI_VARIABLE_PPI. + @param[in, out] VariableNameSize On entry, points to the size of the = buffer pointed to by VariableName. + On return, the size of the variable = name buffer. + @param[in, out] VariableName On entry, a pointer to a null-termin= ated string that is the variable's name. + On return, points to the next variab= le's null-terminated name string. + @param[in, out] VariableGuid On entry, a pointer to an EFI_GUID t= hat is the variable's GUID. + On return, a pointer to the next var= iable's GUID. + + @retval EFI_SUCCESS The next variable name was read succ= essfully. + @retval EFI_NOT_FOUND All variables have been enumerated. + @retval EFI_BUFFER_TOO_SMALL The VariableNameSize is too small fo= r the resulting + data. VariableNameSize is updated wi= th the size + required for the specified variable. + @retval EFI_INVALID_PARAMETER VariableName, VariableGuid or + VariableNameSize is NULL. + @retval EFI_DEVICE_ERROR The variable could not be retrieved = because of a device error. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_GET_NEXT_VARIABLE_NAME)( + IN CONST EDKII_PEI_VARIABLE_PPI *This, + IN OUT UINTN *VariableNameSize, + IN OUT CHAR16 *VariableName, + IN OUT EFI_GUID *VariableGuid + ); + +/** + Sets the value of a variable. + + @param[in] This A pointer to this instance of the ED= KII_PEI_VARIABLE_PPI. + @param[in] VariableName A Null-terminated string that is the= name of the vendor's variable. + Each VariableName is unique for each= VendorGuid. VariableName must + contain 1 or more characters. If Var= iableName is an empty string, + then EFI_INVALID_PARAMETER is return= ed. + @param[in] VendorGuid A unique identifier for the vendor. + @param[in] Attributes Attributes bitmask to set for the va= riable. + @param[in] DataSize The size in bytes of the Data buffer= . Unless the EFI_VARIABLE_APPEND_WRITE + attribute is set, a size of zero cau= ses the variable to be deleted. When the + EFI_VARIABLE_APPEND_WRITE attribute = is set, then a SetVariable() call with a + DataSize of zero will not cause any = change to the variable value. + @param[in] Data The contents for the variable. + + @retval EFI_SUCCESS The firmware has successfully stored= the variable and its data as + defined by the Attributes. + @retval EFI_INVALID_PARAMETER An invalid combination of attribute = bits, name, and GUID was supplied, or the + DataSize exceeds the maximum allowed. + @retval EFI_INVALID_PARAMETER VariableName is an empty string. + @retval EFI_OUT_OF_RESOURCES Not enough storage is available to h= old the variable and its data. + @retval EFI_DEVICE_ERROR The variable could not be stored due= to a hardware error. + @retval EFI_WRITE_PROTECTED The variable in question is read-onl= y. + @retval EFI_WRITE_PROTECTED The variable in question cannot be d= eleted. + @retval EFI_SECURITY_VIOLATION The variable could not be written du= e to EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS, + or EFI_VARIABLE_TIME_BASED_AUTHENTIC= ATED_WRITE_ACCESS, or + EFI_VARIABLE_ENHANCED_AUTHENTICATED_= ACCESS being set. Writing to authenticated + variables is not supported in the PE= I environment. Updates to authenticated + variables can be requested during PE= I via the EFI_AUTHENTICATED_VARIABLE_HOB, but + these updates won't be written to no= n-volatile storage until later in DXE. + The EFI_AUTHENTICATED_VARIABLE_HOB i= s a HOB with the GUID + gEfiAuthenticatedVariableGuid. This = HOB contains a VARIABLE_STORE_HEADER followed + by one or more UEFI variables, which= are stored as DWORD aligned tuples of + (VARIABLE_HEADER + CHAR16 VariableNa= me + VariableData). + See MdeModulePkg/Include/Guid/Variab= leFormat.h for these data structure + definitions and MdeModulePkg/Univers= al/Variable/RuntimeDxe/VariableParsing.c for + an example of how to parse these dat= a structures. + @retval EFI_NOT_FOUND The variable trying to be updated or= deleted was not found. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_SET_VARIABLE)( + IN CONST EDKII_PEI_VARIABLE_PPI *This, + IN CHAR16 *VariableName, + IN EFI_GUID *VendorGuid, + IN UINT32 Attributes, + IN UINTN DataSize, + IN VOID *Data + ); + +/** + Returns information about the UEFI variables. + + @param[in] This A pointer to this instan= ce of the EDKII_PEI_VARIABLE_PPI. + @param[in] Attributes Attributes bitmask to sp= ecify the type of variables on + which to return informat= ion. + @param[out] MaximumVariableStorageSize On output the maximum si= ze of the storage space + available for the EFI va= riables associated with the + attributes specified. + @param[out] RemainingVariableStorageSize Returns the remaining si= ze of the storage space + available for the EFI va= riables associated with the + attributes specified. + @param[out] MaximumVariableSize Returns the maximum size= of the individual EFI + variables associated wit= h the attributes specified. + + @retval EFI_SUCCESS Valid answer returned. + @retval EFI_INVALID_PARAMETER An invalid combination o= f attribute bits was supplied + @retval EFI_UNSUPPORTED The attribute is not sup= ported on this platform, and the + MaximumVariableStorageSi= ze, + RemainingVariableStorage= Size, MaximumVariableSize + are undefined. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_QUERY_VARIABLE_INFO)( + IN CONST EDKII_PEI_VARIABLE_PPI *This, + IN UINT32 Attributes, + OUT UINT64 *MaximumVariableStorageSize, + OUT UINT64 *RemainingVariableStorageSize, + OUT UINT64 *MaximumVariableSize + ); + +/// +/// PEI Variable PPI is intended for use as a means +/// to store data in the PEI environment. +/// +struct _EDKII_PEI_VARIABLE_PPI { + EDKII_PEI_GET_VARIABLE GetVariable; + EDKII_PEI_GET_NEXT_VARIABLE_NAME GetNextVariableName; + EDKII_PEI_SET_VARIABLE SetVariable; + EDKII_PEI_QUERY_VARIABLE_INFO QueryVariableInfo; +}; + +extern EFI_GUID gEdkiiPeiVariablePpiGuid; + +#endif diff --git a/IntelFsp2Pkg/IntelFsp2Pkg.dec b/IntelFsp2Pkg/IntelFsp2Pkg.dec index 58eac7220d..2d3eb708b9 100644 --- a/IntelFsp2Pkg/IntelFsp2Pkg.dec +++ b/IntelFsp2Pkg/IntelFsp2Pkg.dec @@ -1,7 +1,7 @@ ## @file # Provides driver and definitions to build fsp in EDKII bios. # -# Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.
+# Copyright (c) 2014 - 2022, Intel Corporation. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -59,6 +59,12 @@ # gFspTempRamExitPpiGuid =3D { 0xbc1cfbdb, 0x7e50, 0x42be, = {0xb4, 0x87, 0x22, 0xe0, 0xa9, 0x0c, 0xb0, 0x52}} =20 + # + # PPI for Variable Services + # + gEdkiiPeiVariablePpiGuid =3D { 0xe7b2cd04, 0x4b14, 0x44c2, = {0xb7, 0x48, 0xce, 0xaf, 0x2b, 0x66, 0x4a, 0xb0}} + + [Guids] # # GUID defined in package --=20 2.27.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 (#91476): https://edk2.groups.io/g/devel/message/91476 Mute This Topic: https://groups.io/mt/92467919/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-