]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Uefi/UefiMultiPhase.h
Update to make end-of-line consistent for all source files in MdePkg. There are no...
[mirror_edk2.git] / MdePkg / Include / Uefi / UefiMultiPhase.h
CommitLineData
959ccb23 1/** @file\r
00edb218 2 This includes some definitions introduced in UEFI that will be used in both PEI and DXE phases.\r
959ccb23 3\r
d7dfd027 4 Copyright (c) 2006 - 2009, Intel Corporation \r
00edb218
A
5 All rights reserved. This program and the accompanying materials \r
6 are licensed and made available under the terms and conditions of the BSD License \r
7 which accompanies this distribution. The full text of the license may be found at \r
8 http://opensource.org/licenses/bsd-license.php \r
959ccb23 9\r
00edb218
A
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
959ccb23 12\r
959ccb23 13**/\r
14\r
15#ifndef __UEFI_MULTIPHASE_H__\r
16#define __UEFI_MULTIPHASE_H__\r
17\r
8b13229b 18///\r
19/// Enumeration of memory types introduced in UEFI.\r
20/// \r
959ccb23 21typedef enum {\r
1bf79370
LG
22 ///\r
23 /// Not used.\r
24 ///\r
00edb218 25 EfiReservedMemoryType,\r
1bf79370
LG
26 ///\r
27 /// The code portions of a loaded application. \r
28 /// (Note that UEFI OS loaders are UEFI applications.)\r
29 ///\r
00edb218 30 EfiLoaderCode,\r
1bf79370
LG
31 ///\r
32 /// The data portions of a loaded application and the default data allocation\r
33 /// type used by an application to allocate pool memory.\r
34 ///\r
00edb218 35 EfiLoaderData,\r
1bf79370
LG
36 ///\r
37 /// The code portions of a loaded Boot Services Driver\r
38 ///\r
00edb218 39 EfiBootServicesCode,\r
1bf79370
LG
40 ///\r
41 /// The data portions of a loaded Boot Serves Driver, and the default data\r
42 /// allocation type used by a Boot Services Driver to allocate pool memory.\r
43 ///\r
00edb218 44 EfiBootServicesData,\r
1bf79370
LG
45 ///\r
46 /// The code portions of a loaded Runtime Services Driver.\r
47 ///\r
00edb218 48 EfiRuntimeServicesCode,\r
1bf79370
LG
49 ///\r
50 /// The data portions of a loaded Runtime Services Driver and the default\r
51 /// data allocation type used by a Runtime Services Driver to allocate pool memory.\r
52 ///\r
00edb218 53 EfiRuntimeServicesData,\r
1bf79370
LG
54 ///\r
55 /// Free (unallocated) memory.\r
56 ///\r
00edb218 57 EfiConventionalMemory,\r
1bf79370
LG
58 ///\r
59 /// Memory in which errors have been detected.\r
60 ///\r
00edb218 61 EfiUnusableMemory,\r
1bf79370
LG
62 ///\r
63 /// Memory that holds the ACPI tables.\r
64 ///\r
00edb218 65 EfiACPIReclaimMemory,\r
1bf79370
LG
66 ///\r
67 /// Address space reserved for use by the firmware.\r
68 ///\r
00edb218 69 EfiACPIMemoryNVS,\r
1bf79370
LG
70 ///\r
71 /// Used by system firmware to request that a memory-mapped IO region\r
72 /// be mapped by the OS to a virtual address so it can be accessed by EFI runtime services.\r
73 ///\r
00edb218 74 EfiMemoryMappedIO,\r
1bf79370
LG
75 ///\r
76 /// System memory-mapped IO region that is used to translate memory\r
77 /// cycles to IO cycles by the processor.\r
78 ///\r
00edb218 79 EfiMemoryMappedIOPortSpace,\r
1bf79370
LG
80 ///\r
81 /// Address space reserved by the firmware for code that is part of the processor.\r
82 ///\r
00edb218
A
83 EfiPalCode,\r
84 EfiMaxMemoryType\r
959ccb23 85} EFI_MEMORY_TYPE;\r
86\r
8b13229b 87///\r
88/// Data structure that precedes all of the standard EFI table types.\r
89/// \r
959ccb23 90typedef struct {\r
1bf79370
LG
91 ///\r
92 /// A 64-bit signature that identifies the type of table that follows.\r
93 /// Unique signatures have been generated for the EFI System Table,\r
94 /// the EFI Boot Services Table, and the EFI Runtime Services Table.\r
95 ///\r
00edb218 96 UINT64 Signature;\r
1bf79370
LG
97 ///\r
98 /// The revision of the EFI Specification to which this table\r
99 /// conforms. The upper 16 bits of this field contain the major\r
100 /// revision value, and the lower 16 bits contain the minor revision\r
101 /// value. The minor revision values are limited to the range of 00..99.\r
102 ///\r
00edb218 103 UINT32 Revision;\r
1bf79370
LG
104 ///\r
105 /// The size, in bytes, of the entire table including the EFI_TABLE_HEADER.\r
106 ///\r
00edb218 107 UINT32 HeaderSize;\r
1bf79370
LG
108 ///\r
109 /// The 32-bit CRC for the entire table. This value is computed by\r
110 /// setting this field to 0, and computing the 32-bit CRC for HeaderSize bytes.\r
111 ///\r
00edb218 112 UINT32 CRC32;\r
1bf79370
LG
113 ///\r
114 /// Reserved field that must be set to 0.\r
115 ///\r
00edb218 116 UINT32 Reserved;\r
959ccb23 117} EFI_TABLE_HEADER;\r
118\r
8b13229b 119///\r
120/// Attributes of variable.\r
121/// \r
00edb218
A
122#define EFI_VARIABLE_NON_VOLATILE 0x00000001\r
123#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002\r
124#define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004\r
125#define EFI_VARIABLE_HARDWARE_ERROR_RECORD 0x00000008\r
959ccb23 126\r
8b13229b 127///\r
128/// This attribute is identified by the mnemonic 'HR' \r
129/// elsewhere in this specification.\r
130/// \r
00edb218 131#define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 0x00000010\r
959ccb23 132\r
959ccb23 133//\r
134// _WIN_CERTIFICATE.wCertificateType\r
135// \r
00edb218
A
136#define WIN_CERT_TYPE_EFI_PKCS115 0x0EF0\r
137#define WIN_CERT_TYPE_EFI_GUID 0x0EF1\r
959ccb23 138\r
3ed785e9 139///\r
140/// The WIN_CERTIFICATE structure is part of the PE/COFF specification.\r
141///\r
959ccb23 142typedef struct _WIN_CERTIFICATE {\r
3ed785e9 143 ///\r
144 /// The length of the entire certificate, \r
145 /// including the length of the header, in bytes. \r
146 ///\r
00edb218 147 UINT32 dwLength;\r
3ed785e9 148 ///\r
149 /// The revision level of the WIN_CERTIFICATE \r
150 /// structure. The current revision level is 0x0200. \r
151 ///\r
00edb218 152 UINT16 wRevision;\r
3ed785e9 153 ///\r
154 /// The certificate type. See WIN_CERT_TYPE_xxx for the UEFI \r
155 /// certificate types. The UEFI specification reserves the range of \r
156 /// certificate type values from 0x0EF0 to 0x0EFF. \r
157 ///\r
00edb218 158 UINT16 wCertificateType;\r
3ed785e9 159 ///\r
160 /// The following is the actual certificate. The format of \r
161 /// the certificate depends on wCertificateType.\r
162 ///\r
163 /// UINT8 bCertificate[ANYSIZE_ARRAY];\r
164 ///\r
959ccb23 165} WIN_CERTIFICATE;\r
166\r
fb5148a0 167///\r
168/// WIN_CERTIFICATE_UEFI_GUID.CertType\r
169/// \r
959ccb23 170#define EFI_CERT_TYPE_RSA2048_SHA256_GUID \\r
00edb218 171 {0xa7717414, 0xc616, 0x4977, {0x94, 0x20, 0x84, 0x47, 0x12, 0xa7, 0x35, 0xbf } }\r
959ccb23 172\r
1bf79370
LG
173///\r
174/// WIN_CERTIFICATE_UEFI_GUID.CertData\r
175/// \r
959ccb23 176typedef struct _EFI_CERT_BLOCK_RSA_2048_SHA256 {\r
00edb218
A
177 UINT32 HashType;\r
178 UINT8 PublicKey[256];\r
179 UINT8 Signature[256];\r
959ccb23 180} EFI_CERT_BLOCK_RSA_2048_SHA256;\r
181\r
182\r
3ed785e9 183///\r
184/// Certificate which encapsulates a GUID-specific digital signature\r
185///\r
959ccb23 186typedef struct _WIN_CERTIFICATE_UEFI_GUID {\r
3ed785e9 187 ///\r
188 /// This is the standard WIN_CERTIFICATE header, where\r
189 /// wCertificateType is set to WIN_CERT_TYPE_UEFI_GUID. \r
190 /// \r
00edb218 191 WIN_CERTIFICATE Hdr;\r
3ed785e9 192 ///\r
193 /// This is the unique id which determines the \r
194 /// format of the CertData. In this case, the \r
195 /// value is EFI_CERT_TYPE_RSA2048_SHA256_GUID.\r
196 ///\r
00edb218 197 EFI_GUID CertType;\r
3ed785e9 198 /// \r
199 /// The following is the certificate data. The format of\r
200 /// the data is determined by the CertType. In this case the value is \r
201 /// EFI_CERT_BLOCK_RSA_2048_SHA256. \r
202 ///\r
203 /// UINT8 CertData[ANYSIZE_ARRAY];\r
204 ///\r
959ccb23 205} WIN_CERTIFICATE_UEFI_GUID;\r
206\r
207\r
3ed785e9 208/// \r
209/// Certificate which encapsulates the RSASSA_PKCS1-v1_5 digital signature.\r
210/// \r
211/// The WIN_CERTIFICATE_UEFI_PKCS1_15 structure is derived from\r
212/// WIN_CERTIFICATE and encapsulate the information needed to \r
213/// implement the RSASSA-PKCS1-v1_5 digital signature algorithm as \r
214/// specified in RFC2437. \r
215/// \r
216typedef struct _WIN_CERTIFICATE_EFI_PKCS1_15 { \r
217 ///\r
218 /// This is the standard WIN_CERTIFICATE header, where \r
219 /// wCertificateType is set to WIN_CERT_TYPE_UEFI_PKCS1_15. \r
220 ///\r
00edb218 221 WIN_CERTIFICATE Hdr;\r
3ed785e9 222 ///\r
223 /// This is the hashing algorithm which was performed on the\r
224 /// UEFI executable when creating the digital signature. \r
225 ///\r
00edb218 226 EFI_GUID HashAlgorithm;\r
3ed785e9 227 ///\r
228 /// The following is the actual digital signature. The \r
229 /// size of the signature is the same size as the key \r
230 /// (1024-bit key is 128 bytes) and can be determined by \r
231 /// subtracting the length of the other parts of this header\r
232 /// from the total length of the certificate as found in \r
233 /// Hdr.dwLength. \r
234 ///\r
235 /// UINT8 Signature[ANYSIZE_ARRAY];\r
236 ///\r
959ccb23 237} WIN_CERTIFICATE_EFI_PKCS1_15;\r
238\r
239\r
959ccb23 240\r
3ed785e9 241/// \r
242/// AuthInfo is a WIN_CERTIFICATE using the wCertificateType\r
243/// WIN_CERTIFICATE_UEFI_GUID and the CertType\r
244/// EFI_CERT_TYPE_RSA2048_SHA256. If the attribute specifies\r
245/// authenticated access, then the Data buffer should begin with an\r
246/// authentication descriptor prior to the data payload and DataSize\r
247/// should reflect the the data.and descriptor size. The caller\r
248/// shall digest the Monotonic Count value and the associated data\r
249/// for the variable update using the SHA-256 1-way hash algorithm.\r
250/// The ensuing the 32-byte digest will be signed using the private\r
251/// key associated w/ the public/private 2048-bit RSA key-pair. The\r
252/// WIN_CERTIFICATE shall be used to describe the signature of the\r
253/// Variable data *Data. In addition, the signature will also\r
254/// include the MonotonicCount value to guard against replay attacks\r
255/// \r
959ccb23 256typedef struct {\r
3ed785e9 257 ///\r
258 /// Included in the signature of \r
259 /// AuthInfo.Used to ensure freshness/no\r
260 /// replay. Incremented during each \r
261 /// "Write" access. \r
262 /// \r
00edb218 263 UINT64 MonotonicCount;\r
3ed785e9 264 ///\r
265 /// Provides the authorization for the variable \r
266 /// access. It is a signature across the \r
267 /// variable data and the Monotonic Count \r
268 /// value. Caller uses Private key that is \r
269 /// associated with a public key that has been \r
270 /// provisioned via the key exchange. \r
271 ///\r
00edb218 272 WIN_CERTIFICATE_UEFI_GUID AuthInfo;\r
959ccb23 273} EFI_VARIABLE_AUTHENTICATION;\r
274\r
275#endif\r
276\r