+/** @file\r
+ Guid & data structure used for EFI System Resource Table (ESRT)\r
+\r
+ Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ @par Revision Reference:\r
+ GUIDs defined in UEFI 2.5 spec.\r
+\r
+**/\r
+\r
+\r
+#ifndef _SYSTEM_RESOURCE_TABLE_H__\r
+#define _SYSTEM_RESOURCE_TABLE_H__\r
+\r
+#define EFI_SYSTEM_RESOURCE_TABLE_GUID \\r
+ { \\r
+ 0xb122a263, 0x3661, 0x4f68, {0x99, 0x29, 0x78, 0xf8, 0xb0, 0xd6, 0x21, 0x80 } \\r
+ }\r
+\r
+///\r
+/// Current Entry Version\r
+///\r
+#define EFI_SYSTEM_RESOURCE_TABLE_FIRMWARE_RESOURCE_VERSION 1\r
+\r
+///\r
+/// Firmware Type Definitions\r
+///\r
+#define ESRT_FW_TYPE_UNKNOWN 0x00000000\r
+#define ESRT_FW_TYPE_SYSTEMFIRMWARE 0x00000001\r
+#define ESRT_FW_TYPE_DEVICEFIRMWARE 0x00000002\r
+#define ESRT_FW_TYPE_UEFIDRIVER 0x00000003\r
+\r
+///\r
+/// Last Attempt Status Values\r
+///\r
+#define LAST_ATTEMPT_STATUS_SUCCESS 0x00000000\r
+#define LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL 0x00000001\r
+#define LAST_ATTEMPT_STATUS_ERROR_INSUFFICIENT_RESOURCES 0x00000002\r
+#define LAST_ATTEMPT_STATUS_ERROR_INCORRECT_VERSION 0x00000003\r
+#define LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT 0x00000004\r
+#define LAST_ATTEMPT_STATUS_ERROR_AUTH_ERROR 0x00000005\r
+#define LAST_ATTEMPT_STATUS_ERROR_PWR_EVT_AC 0x00000006\r
+#define LAST_ATTEMPT_STATUS_ERROR_PWR_EVT_BATT 0x00000007\r
+\r
+typedef struct {\r
+ ///\r
+ /// The firmware class field contains a GUID that identifies a firmware component\r
+ /// that can be updated via UpdateCapsule(). This GUID must be unique within all\r
+ /// entries of the ESRT.\r
+ ///\r
+ EFI_GUID FwClass;\r
+ ///\r
+ /// Identifies the type of firmware resource.\r
+ ///\r
+ UINT32 FwType;\r
+ ///\r
+ /// The firmware version field represents the current version of the firmware\r
+ /// resource, value must always increase as a larger number represents a newer\r
+ /// version.\r
+ ///\r
+ UINT32 FwVersion;\r
+ ///\r
+ /// The lowest firmware resource version to which a firmware resource can be\r
+ /// rolled back for the given system/device. Generally this is used to protect\r
+ /// against known and fixed security issues.\r
+ ///\r
+ UINT32 LowestSupportedFwVersion;\r
+ ///\r
+ /// The capsule flags field contains the CapsuleGuid flags (bits 0- 15) as defined\r
+ /// in the EFI_CAPSULE_HEADER that will be set in the capsule header.\r
+ ///\r
+ UINT32 CapsuleFlags;\r
+ ///\r
+ /// The last attempt version field describes the last firmware version for which\r
+ /// an update was attempted (uses the same format as Firmware Version).\r
+ /// Last Attempt Version is updated each time an UpdateCapsule() is attempted for\r
+ /// an ESRT entry and is preserved across reboots (non-volatile). However, in\r
+ /// cases where the attempt version is not recorded due to limitations in the\r
+ /// update process, the field shall set to zero after a failed update. Similarly,\r
+ /// in the case of a removable device, this value is set to 0 in cases where the\r
+ /// device has not been updated since being added to the system.\r
+ ///\r
+ UINT32 LastAttemptVersion;\r
+ ///\r
+ /// The last attempt status field describes the result of the last firmware update\r
+ /// attempt for the firmware resource entry.\r
+ /// LastAttemptStatus is updated each time an UpdateCapsule() is attempted for an\r
+ /// ESRT entry and is preserved across reboots (non-volatile).\r
+ /// If a firmware update has never been attempted or is unknown, for example after\r
+ /// fresh insertion of a removable device, LastAttemptStatus must be set to Success.\r
+ ///\r
+ UINT32 LastAttemptStatus;\r
+} EFI_SYSTEM_RESOURCE_ENTRY;\r
+\r
+typedef struct {\r
+ ///\r
+ /// The number of firmware resources in the table, must not be zero.\r
+ ///\r
+ UINT32 FwResourceCount;\r
+ ///\r
+ /// The maximum number of resource array entries that can be within the table\r
+ /// without reallocating the table, must not be zero.\r
+ ///\r
+ UINT32 FwResourceCountMax;\r
+ ///\r
+ /// The version of the EFI_SYSTEM_RESOURCE_ENTRY entities used in this table.\r
+ /// This field should be set to 1.\r
+ ///\r
+ UINT64 FwResourceVersion;\r
+ ///\r
+ /// Array of EFI_SYSTEM_RESOURCE_ENTRY\r
+ ///\r
+ //EFI_SYSTEM_RESOURCE_ENTRY Entries[];\r
+} EFI_SYSTEM_RESOURCE_TABLE;\r
+\r
+extern EFI_GUID gEfiSystemResourceTableGuid;\r
+\r
+#endif\r