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