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