yshang1 | 959ccb2 | 2007-06-08 11:31:52 +0000 | [diff] [blame] | 1 | /** @file
|
AJFISH | 00edb21 | 2007-06-18 20:28:02 +0000 | [diff] [blame] | 2 | This includes some definitions introduced in UEFI that will be used in both PEI and DXE phases.
|
yshang1 | 959ccb2 | 2007-06-08 11:31:52 +0000 | [diff] [blame] | 3 |
|
hhuan13 | ab0eece | 2011-08-16 07:16:02 +0000 | [diff] [blame] | 4 | Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
myronporter | af2dc6a | 2010-03-12 22:19:12 +0000 | [diff] [blame] | 5 | This program and the accompanying materials are licensed and made available under
|
| 6 | the terms and conditions of the BSD License that accompanies this distribution.
|
| 7 | 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.
|
yshang1 | 959ccb2 | 2007-06-08 11:31:52 +0000 | [diff] [blame] | 12 |
|
yshang1 | 959ccb2 | 2007-06-08 11:31:52 +0000 | [diff] [blame] | 13 | **/
|
| 14 |
|
| 15 | #ifndef __UEFI_MULTIPHASE_H__
|
| 16 | #define __UEFI_MULTIPHASE_H__
|
| 17 |
|
lgao4 | bd86cb0 | 2009-09-02 09:23:28 +0000 | [diff] [blame] | 18 | #include <Guid/WinCertificate.h>
|
klu2 | 8b13229 | 2008-06-24 07:14:18 +0000 | [diff] [blame] | 19 | ///
|
| 20 | /// Enumeration of memory types introduced in UEFI.
|
| 21 | ///
|
yshang1 | 959ccb2 | 2007-06-08 11:31:52 +0000 | [diff] [blame] | 22 | typedef enum {
|
lgao4 | 1bf7937 | 2008-12-10 08:22:03 +0000 | [diff] [blame] | 23 | ///
|
| 24 | /// Not used.
|
| 25 | ///
|
AJFISH | 00edb21 | 2007-06-18 20:28:02 +0000 | [diff] [blame] | 26 | EfiReservedMemoryType,
|
lgao4 | 1bf7937 | 2008-12-10 08:22:03 +0000 | [diff] [blame] | 27 | ///
|
| 28 | /// The code portions of a loaded application.
|
| 29 | /// (Note that UEFI OS loaders are UEFI applications.)
|
| 30 | ///
|
AJFISH | 00edb21 | 2007-06-18 20:28:02 +0000 | [diff] [blame] | 31 | EfiLoaderCode,
|
lgao4 | 1bf7937 | 2008-12-10 08:22:03 +0000 | [diff] [blame] | 32 | ///
|
| 33 | /// The data portions of a loaded application and the default data allocation
|
| 34 | /// type used by an application to allocate pool memory.
|
| 35 | ///
|
AJFISH | 00edb21 | 2007-06-18 20:28:02 +0000 | [diff] [blame] | 36 | EfiLoaderData,
|
lgao4 | 1bf7937 | 2008-12-10 08:22:03 +0000 | [diff] [blame] | 37 | ///
|
myronporter | af2dc6a | 2010-03-12 22:19:12 +0000 | [diff] [blame] | 38 | /// The code portions of a loaded Boot Services Driver.
|
lgao4 | 1bf7937 | 2008-12-10 08:22:03 +0000 | [diff] [blame] | 39 | ///
|
AJFISH | 00edb21 | 2007-06-18 20:28:02 +0000 | [diff] [blame] | 40 | EfiBootServicesCode,
|
lgao4 | 1bf7937 | 2008-12-10 08:22:03 +0000 | [diff] [blame] | 41 | ///
|
| 42 | /// The data portions of a loaded Boot Serves Driver, and the default data
|
| 43 | /// allocation type used by a Boot Services Driver to allocate pool memory.
|
| 44 | ///
|
AJFISH | 00edb21 | 2007-06-18 20:28:02 +0000 | [diff] [blame] | 45 | EfiBootServicesData,
|
lgao4 | 1bf7937 | 2008-12-10 08:22:03 +0000 | [diff] [blame] | 46 | ///
|
| 47 | /// The code portions of a loaded Runtime Services Driver.
|
| 48 | ///
|
AJFISH | 00edb21 | 2007-06-18 20:28:02 +0000 | [diff] [blame] | 49 | EfiRuntimeServicesCode,
|
lgao4 | 1bf7937 | 2008-12-10 08:22:03 +0000 | [diff] [blame] | 50 | ///
|
| 51 | /// The data portions of a loaded Runtime Services Driver and the default
|
| 52 | /// data allocation type used by a Runtime Services Driver to allocate pool memory.
|
| 53 | ///
|
AJFISH | 00edb21 | 2007-06-18 20:28:02 +0000 | [diff] [blame] | 54 | EfiRuntimeServicesData,
|
lgao4 | 1bf7937 | 2008-12-10 08:22:03 +0000 | [diff] [blame] | 55 | ///
|
| 56 | /// Free (unallocated) memory.
|
| 57 | ///
|
AJFISH | 00edb21 | 2007-06-18 20:28:02 +0000 | [diff] [blame] | 58 | EfiConventionalMemory,
|
lgao4 | 1bf7937 | 2008-12-10 08:22:03 +0000 | [diff] [blame] | 59 | ///
|
| 60 | /// Memory in which errors have been detected.
|
| 61 | ///
|
AJFISH | 00edb21 | 2007-06-18 20:28:02 +0000 | [diff] [blame] | 62 | EfiUnusableMemory,
|
lgao4 | 1bf7937 | 2008-12-10 08:22:03 +0000 | [diff] [blame] | 63 | ///
|
| 64 | /// Memory that holds the ACPI tables.
|
| 65 | ///
|
AJFISH | 00edb21 | 2007-06-18 20:28:02 +0000 | [diff] [blame] | 66 | EfiACPIReclaimMemory,
|
lgao4 | 1bf7937 | 2008-12-10 08:22:03 +0000 | [diff] [blame] | 67 | ///
|
| 68 | /// Address space reserved for use by the firmware.
|
| 69 | ///
|
AJFISH | 00edb21 | 2007-06-18 20:28:02 +0000 | [diff] [blame] | 70 | EfiACPIMemoryNVS,
|
lgao4 | 1bf7937 | 2008-12-10 08:22:03 +0000 | [diff] [blame] | 71 | ///
|
| 72 | /// Used by system firmware to request that a memory-mapped IO region
|
| 73 | /// be mapped by the OS to a virtual address so it can be accessed by EFI runtime services.
|
| 74 | ///
|
AJFISH | 00edb21 | 2007-06-18 20:28:02 +0000 | [diff] [blame] | 75 | EfiMemoryMappedIO,
|
lgao4 | 1bf7937 | 2008-12-10 08:22:03 +0000 | [diff] [blame] | 76 | ///
|
| 77 | /// System memory-mapped IO region that is used to translate memory
|
| 78 | /// cycles to IO cycles by the processor.
|
| 79 | ///
|
AJFISH | 00edb21 | 2007-06-18 20:28:02 +0000 | [diff] [blame] | 80 | EfiMemoryMappedIOPortSpace,
|
lgao4 | 1bf7937 | 2008-12-10 08:22:03 +0000 | [diff] [blame] | 81 | ///
|
| 82 | /// Address space reserved by the firmware for code that is part of the processor.
|
| 83 | ///
|
AJFISH | 00edb21 | 2007-06-18 20:28:02 +0000 | [diff] [blame] | 84 | EfiPalCode,
|
| 85 | EfiMaxMemoryType
|
yshang1 | 959ccb2 | 2007-06-08 11:31:52 +0000 | [diff] [blame] | 86 | } EFI_MEMORY_TYPE;
|
| 87 |
|
klu2 | 8b13229 | 2008-06-24 07:14:18 +0000 | [diff] [blame] | 88 | ///
|
| 89 | /// Data structure that precedes all of the standard EFI table types.
|
| 90 | ///
|
yshang1 | 959ccb2 | 2007-06-08 11:31:52 +0000 | [diff] [blame] | 91 | typedef struct {
|
lgao4 | 1bf7937 | 2008-12-10 08:22:03 +0000 | [diff] [blame] | 92 | ///
|
| 93 | /// A 64-bit signature that identifies the type of table that follows.
|
| 94 | /// Unique signatures have been generated for the EFI System Table,
|
| 95 | /// the EFI Boot Services Table, and the EFI Runtime Services Table.
|
| 96 | ///
|
AJFISH | 00edb21 | 2007-06-18 20:28:02 +0000 | [diff] [blame] | 97 | UINT64 Signature;
|
lgao4 | 1bf7937 | 2008-12-10 08:22:03 +0000 | [diff] [blame] | 98 | ///
|
| 99 | /// The revision of the EFI Specification to which this table
|
| 100 | /// conforms. The upper 16 bits of this field contain the major
|
| 101 | /// revision value, and the lower 16 bits contain the minor revision
|
| 102 | /// value. The minor revision values are limited to the range of 00..99.
|
| 103 | ///
|
AJFISH | 00edb21 | 2007-06-18 20:28:02 +0000 | [diff] [blame] | 104 | UINT32 Revision;
|
lgao4 | 1bf7937 | 2008-12-10 08:22:03 +0000 | [diff] [blame] | 105 | ///
|
| 106 | /// The size, in bytes, of the entire table including the EFI_TABLE_HEADER.
|
| 107 | ///
|
AJFISH | 00edb21 | 2007-06-18 20:28:02 +0000 | [diff] [blame] | 108 | UINT32 HeaderSize;
|
lgao4 | 1bf7937 | 2008-12-10 08:22:03 +0000 | [diff] [blame] | 109 | ///
|
| 110 | /// The 32-bit CRC for the entire table. This value is computed by
|
| 111 | /// setting this field to 0, and computing the 32-bit CRC for HeaderSize bytes.
|
| 112 | ///
|
AJFISH | 00edb21 | 2007-06-18 20:28:02 +0000 | [diff] [blame] | 113 | UINT32 CRC32;
|
lgao4 | 1bf7937 | 2008-12-10 08:22:03 +0000 | [diff] [blame] | 114 | ///
|
| 115 | /// Reserved field that must be set to 0.
|
| 116 | ///
|
AJFISH | 00edb21 | 2007-06-18 20:28:02 +0000 | [diff] [blame] | 117 | UINT32 Reserved;
|
yshang1 | 959ccb2 | 2007-06-08 11:31:52 +0000 | [diff] [blame] | 118 | } EFI_TABLE_HEADER;
|
| 119 |
|
klu2 | 8b13229 | 2008-06-24 07:14:18 +0000 | [diff] [blame] | 120 | ///
|
| 121 | /// Attributes of variable.
|
| 122 | ///
|
hhuan13 | ab0eece | 2011-08-16 07:16:02 +0000 | [diff] [blame] | 123 | #define EFI_VARIABLE_NON_VOLATILE 0x00000001
|
| 124 | #define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002
|
| 125 | #define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004
|
klu2 | 8b13229 | 2008-06-24 07:14:18 +0000 | [diff] [blame] | 126 | ///
|
| 127 | /// This attribute is identified by the mnemonic 'HR'
|
| 128 | /// elsewhere in this specification.
|
| 129 | ///
|
hhuan13 | ab0eece | 2011-08-16 07:16:02 +0000 | [diff] [blame] | 130 | #define EFI_VARIABLE_HARDWARE_ERROR_RECORD 0x00000008
|
| 131 | ///
|
| 132 | /// Attributes of Authenticated Variable
|
| 133 | ///
|
| 134 | #define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 0x00000010
|
| 135 | #define EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS 0x00000020
|
| 136 | #define EFI_VARIABLE_APPEND_WRITE 0x00000040
|
| 137 |
|
yshang1 | 959ccb2 | 2007-06-08 11:31:52 +0000 | [diff] [blame] | 138 |
|
vanjeff | 3ed785e | 2008-10-22 09:27:42 +0000 | [diff] [blame] | 139 | ///
|
| 140 | /// AuthInfo is a WIN_CERTIFICATE using the wCertificateType
|
| 141 | /// WIN_CERTIFICATE_UEFI_GUID and the CertType
|
sfu5 | 8556091 | 2011-12-09 07:22:59 +0000 | [diff] [blame^] | 142 | /// EFI_CERT_TYPE_RSA2048_SHA256_GUID. If the attribute specifies
|
vanjeff | 3ed785e | 2008-10-22 09:27:42 +0000 | [diff] [blame] | 143 | /// authenticated access, then the Data buffer should begin with an
|
| 144 | /// authentication descriptor prior to the data payload and DataSize
|
| 145 | /// should reflect the the data.and descriptor size. The caller
|
| 146 | /// shall digest the Monotonic Count value and the associated data
|
| 147 | /// for the variable update using the SHA-256 1-way hash algorithm.
|
| 148 | /// The ensuing the 32-byte digest will be signed using the private
|
| 149 | /// key associated w/ the public/private 2048-bit RSA key-pair. The
|
| 150 | /// WIN_CERTIFICATE shall be used to describe the signature of the
|
| 151 | /// Variable data *Data. In addition, the signature will also
|
myronporter | af2dc6a | 2010-03-12 22:19:12 +0000 | [diff] [blame] | 152 | /// include the MonotonicCount value to guard against replay attacks.
|
vanjeff | 3ed785e | 2008-10-22 09:27:42 +0000 | [diff] [blame] | 153 | ///
|
yshang1 | 959ccb2 | 2007-06-08 11:31:52 +0000 | [diff] [blame] | 154 | typedef struct {
|
vanjeff | 3ed785e | 2008-10-22 09:27:42 +0000 | [diff] [blame] | 155 | ///
|
| 156 | /// Included in the signature of
|
| 157 | /// AuthInfo.Used to ensure freshness/no
|
| 158 | /// replay. Incremented during each
|
| 159 | /// "Write" access.
|
| 160 | ///
|
AJFISH | 00edb21 | 2007-06-18 20:28:02 +0000 | [diff] [blame] | 161 | UINT64 MonotonicCount;
|
vanjeff | 3ed785e | 2008-10-22 09:27:42 +0000 | [diff] [blame] | 162 | ///
|
| 163 | /// Provides the authorization for the variable
|
| 164 | /// access. It is a signature across the
|
| 165 | /// variable data and the Monotonic Count
|
| 166 | /// value. Caller uses Private key that is
|
| 167 | /// associated with a public key that has been
|
| 168 | /// provisioned via the key exchange.
|
| 169 | ///
|
AJFISH | 00edb21 | 2007-06-18 20:28:02 +0000 | [diff] [blame] | 170 | WIN_CERTIFICATE_UEFI_GUID AuthInfo;
|
yshang1 | 959ccb2 | 2007-06-08 11:31:52 +0000 | [diff] [blame] | 171 | } EFI_VARIABLE_AUTHENTICATION;
|
| 172 |
|
hhuan13 | ab0eece | 2011-08-16 07:16:02 +0000 | [diff] [blame] | 173 | ///
|
| 174 | /// When the attribute EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS is
|
| 175 | /// set, then the Data buffer shall begin with an instance of a complete (and serialized)
|
| 176 | /// EFI_VARIABLE_AUTHENTICATION_2 descriptor. The descriptor shall be followed by the new
|
| 177 | /// variable value and DataSize shall reflect the combined size of the descriptor and the new
|
| 178 | /// variable value. The authentication descriptor is not part of the variable data and is not
|
| 179 | /// returned by subsequent calls to GetVariable().
|
| 180 | ///
|
| 181 | typedef struct {
|
| 182 | ///
|
| 183 | /// For the TimeStamp value, components Pad1, Nanosecond, TimeZone, Daylight and
|
| 184 | /// Pad2 shall be set to 0. This means that the time shall always be expressed in GMT.
|
| 185 | ///
|
| 186 | EFI_TIME TimeStamp;
|
| 187 | ///
|
| 188 | /// Only a CertType of EFI_CERT_TYPE_PKCS7_GUID is accepted.
|
| 189 | ///
|
| 190 | WIN_CERTIFICATE_UEFI_GUID AuthInfo;
|
| 191 | } EFI_VARIABLE_AUTHENTICATION_2;
|
yshang1 | 959ccb2 | 2007-06-08 11:31:52 +0000 | [diff] [blame] | 192 |
|
hhuan13 | ab0eece | 2011-08-16 07:16:02 +0000 | [diff] [blame] | 193 | #endif
|