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