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