Jones: EFI System Resource Table is a GUID definition. We suggest using a separate head file to include its definition and place this header file into MdePkg/Include/Guid directory.
And, you also add a protocol definition to manage its contents. But, I can't find this protocol from UEFI spec. By design, MdePkg only includes UEFI/PI/IndustryStand definitions. If this protocol is not defined in any public specification, it should be the implement protocol and be placed into other packages. Thanks Liming -----Original Message----- From: Peter Jones [mailto:pjo...@redhat.com] Sent: Saturday, April 11, 2015 3:02 AM To: edk2-devel@lists.sourceforge.net Subject: [edk2] [PATCH 06/11] MdePkg: Add definitions related to UEFI 2.5's ESRT feature. This adds definitions for the EFI System Resource Table, as well as a protocol definition to manage its contents. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Peter Jones <pjo...@redhat.com> --- MdePkg/Include/Library/Esrt.h | 59 +++++++++++ MdePkg/Include/Uefi/UefiSpec.h | 108 ++++++++++++++++++++ MdePkg/MdePkg.dec | 14 +++ 3 files changed, 181 insertions(+) diff --git a/MdePkg/Include/Library/Esrt.h b/MdePkg/Include/Library/Esrt.h new file mode 100644 index 0000000..f29fbb4 --- /dev/null +++ b/MdePkg/Include/Library/Esrt.h @@ -0,0 +1,59 @@ +/*++ + + Copyright (c) 2004 - 2014, Intel Corporation. All rights + reserved.<BR> + + This program and the accompanying materials are licensed and made + available under the terms and conditions of the BSD License that + accompanies this distribution. The full text of the license may be + found at http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR + IMPLIED. + +Module Name: + + Esrt.h + +Abstract: + +--*/ + +#ifndef _DFU_ESRT_H_ +#define _DFU_ESRT_H_ + +typedef struct { + UINT32 NumEntries; + EFI_SYSTEM_RESOURCE_ENTRY FwEntries[256]; } +EFI_SYSTEM_RESOURCE_ENTRY_LIST; + +typedef +EFI_STATUS +(EFIAPI *ESRT_POPULATE_TABLE) ( +); + +typedef +EFI_STATUS +(EFIAPI *ESRT_UPDATE_TABLE_ENTRY_BY_GUID) ( + IN EFI_GUID FwEntryGuid, + IN EFI_SYSTEM_RESOURCE_ENTRY *FwEntry ); + +typedef +EFI_STATUS +(EFIAPI *ESRT_GET_FW_ENTRY_BY_GUID) ( + IN EFI_GUID FwEntryGuid, + OUT EFI_SYSTEM_RESOURCE_ENTRY *FwEntry ); + +#pragma pack(1) +typedef struct _ESRT_OPERATION_PROTOCOL { + ESRT_POPULATE_TABLE EsrtPopulateTable; + ESRT_UPDATE_TABLE_ENTRY_BY_GUID EsrtUpdateTableEntryByGuid; + ESRT_GET_FW_ENTRY_BY_GUID EsrtGetFwEntryByGuid; +} ESRT_OPERATION_PROTOCOL; + +extern EFI_GUID gEfiEsrtOperationProtocolGuid; extern EFI_GUID +gEfiEsrtTableGuid; + +#endif diff --git a/MdePkg/Include/Uefi/UefiSpec.h b/MdePkg/Include/Uefi/UefiSpec.h index d157532..e9d1670 100644 --- a/MdePkg/Include/Uefi/UefiSpec.h +++ b/MdePkg/Include/Uefi/UefiSpec.h @@ -1578,6 +1578,113 @@ EFI_STATUS OUT VOID **Interface ); +#pragma pack(1) +typedef struct { + /// + /// The number of firmware resources in the table, must not be zero. + /// + UINT32 FwResourceCount; + /// + /// The maximum number of resource array entries that can be + /// within the table without reallocating the table, must not be + /// zero. + /// + UINT32 FwResourceMax; + /// + /// The version of the EFI_SYSTEM_RESOURCE_ENTRY entities used in + /// this table. This field should be set to 1. See + /// EFI_SYSTEM_RESOURCE_TABLE_FIRMWARE_RESOURCE_VERSION. + /// + UINT64 FwResourceVersion; + /// + /// Array of EFI_SYSTEM_RESOURCE_ENTRY + /// + //EFI_SYSTEM_RESOURCE_ENTRY Entries[]; } EFI_SYSTEM_RESOURCE_TABLE; + +/// Current Entry Version +#define EFI_SYSTEM_RESOURCE_TABLE_FIRMWARE_RESOURCE_VERSION 1 + +/// +/// EFI System Resource Entry +/// +typedef struct { + /// + /// The firmware class field contains a GUID that identifies a + /// firmware component that can be updated via + /// UpdateCapsule(). This GUID must be unique within all + /// entries of the ESRT. + /// + EFI_GUID FwClass; + /// + /// Identifies the type of firmware resource. + /// + UINT32 FwType; + /// + /// The firmware version field represents the current version of the + /// firmware resource, value must always increase as a larger number + /// represents a newer version. + /// + UINT32 FwVersion; + /// + /// The lowest firmware resource version to which a firmware + /// resource can be rolled back for the given system/device. + /// Generally this is used to protect against known and fixed +security + /// issues. + /// + UINT32 LowestSupportedFwVersion; + /// + /// The capsule flags field contains the CapsuleGuid flags (bits + /// 0-15) as defined in the EFI_CAPSULE_HEADER that will be set in + /// the capsule header. + /// + UINT32 CapsuleFlags; + /// + /// The last attempt version field describes the last firmware +version + /// for which an update was attempted (uses the same format as / + /// Firmware Version). + /// Last Attempt Version is updated each time an UpdateCapsule() is + /// attempted for an ESRT entry and is preserved across reboots + /// (non-volatile). However, in cases where the attempt version is +not + /// recorded due to limitations in the update process, the field +shall + /// set to zero after a failed update. Similarly, in the case of a + /// removable device, this value is set to 0 in cases where the +device + /// has not been updated since being added to the system. + /// + UINT32 LastAttemptVersion; + /// + /// The last attempt status field describes the result of the last + /// firmware update attempt for the firmware resource entry. + /// LastAttemptStatus is updated each time an UpdateCapsule() is + /// attempted for an ESRT entry and is preserved across reboots + /// (non-volatile). + /// If a firmware update has never been attempted or is unknown, for + /// example after fresh insertion of a removable device, +LastAttemptStatus + /// must be set to Success. + /// + UINT32 LastAttemptStatus; +} EFI_SYSTEM_RESOURCE_ENTRY; + +// +// Firmware Type Definitions +// +#define ESRT_FW_TYPE_UNKNOWN 0x00000000 +#define ESRT_FW_TYPE_SYSTEMFIRMWARE 0x00000001 #define +ESRT_FW_TYPE_DEVICEFIRMWARE 0x00000002 +#define ESRT_FW_TYPE_UEFIDRIVER 0x00000003 + +// +// Last Attempt Status Values +// +#define LAST_ATTEMPT_STATUS_SUCCESS 0x00000000 +#define LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL 0x00000001 +#define LAST_ATTEMPT_STATUS_ERROR_INSUFFICIENT_RESOURCES 0x00000002 +#define LAST_ATTEMPT_STATUS_ERROR_INCORRECT_VERSION 0x00000003 +#define LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT 0x00000004 +#define LAST_ATTEMPT_STATUS_ERROR_AUTH_ERROR 0x00000005 +#define LAST_ATTEMPT_STATUS_ERROR_PWR_EVT_AC 0x00000006 +#define LAST_ATTEMPT_STATUS_ERROR_PWR_EVT_BATT 0x00000007 + /// /// EFI Capsule Block Descriptor /// @@ -1627,6 +1734,7 @@ typedef struct { /// UINT32 CapsuleImageSize; } EFI_CAPSULE_HEADER; +#pragma pack() #define CAPSULE_FLAGS_PERSIST_ACROSS_RESET 0x00010000 #define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE 0x00020000 diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index 494dfba..eeb1630 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -555,6 +555,13 @@ gEfiAdapterInfoSanMacAddressGuid = { 0x114da5ef, 0x2cf1, 0x4e12, {0x9b, 0xbb, 0xc4, 0x70, 0xb5, 0x52, 0x5, 0xd9 }} # + # GUIDs defined in UEFI 2.5 + # + ## ESRT configuration table guid + # Include/Library/Esrt.h + gEfiEsrtTableGuid = {0xb122a263, 0x3661, 0x4f68, {0x99, 0x29, 0x78, 0xf8, 0xb0, 0xd6, 0x21, 0x80}} + + # # GUID defined in PI1.0 # ## Include/Guid/AprioriFileName.h @@ -1393,6 +1400,13 @@ ## Include/Protocol/AdapterInformation.h gEfiAdapterInformationProtocolGuid = { 0xE5DD1403, 0xD622, 0xC24E, {0x84, 0x88, 0xC7, 0x1B, 0x17, 0xF5, 0xE8, 0x02 }} + # + # Protocols to support UEFI 2.5 features # ## + ESRT_OPERATIONS_PROTOCOL # Include/Protocol/Esrt.h + gEfiEsrtOperationProtocolGuid = { 0x4549AB47, 0x6E60, 0x4293, { 0xB9, 0x1D, 0x31, 0xB6, 0x10, 0xAD, 0x80, 0x56 }} + # # [Error.gEfiMdePkgTokenSpaceGuid] # 0x80000001 | Invalid value provided. -- 2.3.5 ------------------------------------------------------------------------------ BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT Develop your own process in accordance with the BPMN 2 standard Learn Process modeling best practices with Bonita BPM through live exercises http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel ------------------------------------------------------------------------------ BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT Develop your own process in accordance with the BPMN 2 standard Learn Process modeling best practices with Bonita BPM through live exercises http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel