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