1*888e2fdcSAaron LI /** @file 2*888e2fdcSAaron LI Guid & data structure used for EFI System Resource Table (ESRT) 3*888e2fdcSAaron LI 4*888e2fdcSAaron LI Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.<BR> 5*888e2fdcSAaron LI Copyright (c) Microsoft Corporation.<BR> 6*888e2fdcSAaron LI SPDX-License-Identifier: BSD-2-Clause-Patent 7*888e2fdcSAaron LI 8*888e2fdcSAaron LI @par Revision Reference: 9*888e2fdcSAaron LI GUIDs defined in UEFI 2.5 spec. 10*888e2fdcSAaron LI 11*888e2fdcSAaron LI **/ 12*888e2fdcSAaron LI 13*888e2fdcSAaron LI #ifndef _SYSTEM_RESOURCE_TABLE_H__ 14*888e2fdcSAaron LI #define _SYSTEM_RESOURCE_TABLE_H__ 15*888e2fdcSAaron LI 16*888e2fdcSAaron LI #define EFI_SYSTEM_RESOURCE_TABLE_GUID \ 17*888e2fdcSAaron LI { \ 18*888e2fdcSAaron LI 0xb122a263, 0x3661, 0x4f68, {0x99, 0x29, 0x78, 0xf8, 0xb0, 0xd6, 0x21, 0x80 } \ 19*888e2fdcSAaron LI } 20*888e2fdcSAaron LI 21*888e2fdcSAaron LI /// 22*888e2fdcSAaron LI /// Current Entry Version 23*888e2fdcSAaron LI /// 24*888e2fdcSAaron LI #define EFI_SYSTEM_RESOURCE_TABLE_FIRMWARE_RESOURCE_VERSION 1 25*888e2fdcSAaron LI 26*888e2fdcSAaron LI /// 27*888e2fdcSAaron LI /// Firmware Type Definitions 28*888e2fdcSAaron LI /// 29*888e2fdcSAaron LI #define ESRT_FW_TYPE_UNKNOWN 0x00000000 30*888e2fdcSAaron LI #define ESRT_FW_TYPE_SYSTEMFIRMWARE 0x00000001 31*888e2fdcSAaron LI #define ESRT_FW_TYPE_DEVICEFIRMWARE 0x00000002 32*888e2fdcSAaron LI #define ESRT_FW_TYPE_UEFIDRIVER 0x00000003 33*888e2fdcSAaron LI 34*888e2fdcSAaron LI /// 35*888e2fdcSAaron LI /// Last Attempt Status Values 36*888e2fdcSAaron LI /// 37*888e2fdcSAaron LI #define LAST_ATTEMPT_STATUS_SUCCESS 0x00000000 38*888e2fdcSAaron LI #define LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL 0x00000001 39*888e2fdcSAaron LI #define LAST_ATTEMPT_STATUS_ERROR_INSUFFICIENT_RESOURCES 0x00000002 40*888e2fdcSAaron LI #define LAST_ATTEMPT_STATUS_ERROR_INCORRECT_VERSION 0x00000003 41*888e2fdcSAaron LI #define LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT 0x00000004 42*888e2fdcSAaron LI #define LAST_ATTEMPT_STATUS_ERROR_AUTH_ERROR 0x00000005 43*888e2fdcSAaron LI #define LAST_ATTEMPT_STATUS_ERROR_PWR_EVT_AC 0x00000006 44*888e2fdcSAaron LI #define LAST_ATTEMPT_STATUS_ERROR_PWR_EVT_BATT 0x00000007 45*888e2fdcSAaron LI #define LAST_ATTEMPT_STATUS_ERROR_UNSATISFIED_DEPENDENCIES 0x00000008 46*888e2fdcSAaron LI 47*888e2fdcSAaron LI /// 48*888e2fdcSAaron LI /// LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL_VENDOR_RANGE_MAX is defined as 49*888e2fdcSAaron LI /// 0x4000 as of UEFI Specification 2.8B. This will be modified in the 50*888e2fdcSAaron LI /// future to the correct value 0x3FFF. To ensure correct implementation, 51*888e2fdcSAaron LI /// this change is preemptively made in the value defined below. 52*888e2fdcSAaron LI /// 53*888e2fdcSAaron LI /// When the UEFI Specification is updated, this comment block can be 54*888e2fdcSAaron LI /// removed. 55*888e2fdcSAaron LI /// 56*888e2fdcSAaron LI #define LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL_VENDOR_RANGE_MIN 0x00001000 57*888e2fdcSAaron LI #define LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL_VENDOR_RANGE_MAX 0x00003FFF 58*888e2fdcSAaron LI 59*888e2fdcSAaron LI typedef struct { 60*888e2fdcSAaron LI /// 61*888e2fdcSAaron LI /// The firmware class field contains a GUID that identifies a firmware component 62*888e2fdcSAaron LI /// that can be updated via UpdateCapsule(). This GUID must be unique within all 63*888e2fdcSAaron LI /// entries of the ESRT. 64*888e2fdcSAaron LI /// 65*888e2fdcSAaron LI EFI_GUID FwClass; 66*888e2fdcSAaron LI /// 67*888e2fdcSAaron LI /// Identifies the type of firmware resource. 68*888e2fdcSAaron LI /// 69*888e2fdcSAaron LI UINT32 FwType; 70*888e2fdcSAaron LI /// 71*888e2fdcSAaron LI /// The firmware version field represents the current version of the firmware 72*888e2fdcSAaron LI /// resource, value must always increase as a larger number represents a newer 73*888e2fdcSAaron LI /// version. 74*888e2fdcSAaron LI /// 75*888e2fdcSAaron LI UINT32 FwVersion; 76*888e2fdcSAaron LI /// 77*888e2fdcSAaron LI /// The lowest firmware resource version to which a firmware resource can be 78*888e2fdcSAaron LI /// rolled back for the given system/device. Generally this is used to protect 79*888e2fdcSAaron LI /// against known and fixed security issues. 80*888e2fdcSAaron LI /// 81*888e2fdcSAaron LI UINT32 LowestSupportedFwVersion; 82*888e2fdcSAaron LI /// 83*888e2fdcSAaron LI /// The capsule flags field contains the CapsuleGuid flags (bits 0- 15) as defined 84*888e2fdcSAaron LI /// in the EFI_CAPSULE_HEADER that will be set in the capsule header. 85*888e2fdcSAaron LI /// 86*888e2fdcSAaron LI UINT32 CapsuleFlags; 87*888e2fdcSAaron LI /// 88*888e2fdcSAaron LI /// The last attempt version field describes the last firmware version for which 89*888e2fdcSAaron LI /// an update was attempted (uses the same format as Firmware Version). 90*888e2fdcSAaron LI /// Last Attempt Version is updated each time an UpdateCapsule() is attempted for 91*888e2fdcSAaron LI /// an ESRT entry and is preserved across reboots (non-volatile). However, in 92*888e2fdcSAaron LI /// cases where the attempt version is not recorded due to limitations in the 93*888e2fdcSAaron LI /// update process, the field shall set to zero after a failed update. Similarly, 94*888e2fdcSAaron LI /// in the case of a removable device, this value is set to 0 in cases where the 95*888e2fdcSAaron LI /// device has not been updated since being added to the system. 96*888e2fdcSAaron LI /// 97*888e2fdcSAaron LI UINT32 LastAttemptVersion; 98*888e2fdcSAaron LI /// 99*888e2fdcSAaron LI /// The last attempt status field describes the result of the last firmware update 100*888e2fdcSAaron LI /// attempt for the firmware resource entry. 101*888e2fdcSAaron LI /// LastAttemptStatus is updated each time an UpdateCapsule() is attempted for an 102*888e2fdcSAaron LI /// ESRT entry and is preserved across reboots (non-volatile). 103*888e2fdcSAaron LI /// If a firmware update has never been attempted or is unknown, for example after 104*888e2fdcSAaron LI /// fresh insertion of a removable device, LastAttemptStatus must be set to Success. 105*888e2fdcSAaron LI /// 106*888e2fdcSAaron LI UINT32 LastAttemptStatus; 107*888e2fdcSAaron LI } EFI_SYSTEM_RESOURCE_ENTRY; 108*888e2fdcSAaron LI 109*888e2fdcSAaron LI typedef struct { 110*888e2fdcSAaron LI /// 111*888e2fdcSAaron LI /// The number of firmware resources in the table, must not be zero. 112*888e2fdcSAaron LI /// 113*888e2fdcSAaron LI UINT32 FwResourceCount; 114*888e2fdcSAaron LI /// 115*888e2fdcSAaron LI /// The maximum number of resource array entries that can be within the table 116*888e2fdcSAaron LI /// without reallocating the table, must not be zero. 117*888e2fdcSAaron LI /// 118*888e2fdcSAaron LI UINT32 FwResourceCountMax; 119*888e2fdcSAaron LI /// 120*888e2fdcSAaron LI /// The version of the EFI_SYSTEM_RESOURCE_ENTRY entities used in this table. 121*888e2fdcSAaron LI /// This field should be set to 1. 122*888e2fdcSAaron LI /// 123*888e2fdcSAaron LI UINT64 FwResourceVersion; 124*888e2fdcSAaron LI /// 125*888e2fdcSAaron LI /// Array of EFI_SYSTEM_RESOURCE_ENTRY 126*888e2fdcSAaron LI /// 127*888e2fdcSAaron LI // EFI_SYSTEM_RESOURCE_ENTRY Entries[]; 128*888e2fdcSAaron LI } EFI_SYSTEM_RESOURCE_TABLE; 129*888e2fdcSAaron LI 130*888e2fdcSAaron LI extern EFI_GUID gEfiSystemResourceTableGuid; 131*888e2fdcSAaron LI 132*888e2fdcSAaron LI #endif 133