1*1370a723SSascha Wildner /** @file 2*1370a723SSascha Wildner This includes some definitions introduced in UEFI that will be used in both PEI and DXE phases. 3*1370a723SSascha Wildner 4*1370a723SSascha Wildner Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> 5*1370a723SSascha Wildner SPDX-License-Identifier: BSD-2-Clause-Patent 6*1370a723SSascha Wildner 7*1370a723SSascha Wildner **/ 8*1370a723SSascha Wildner 9*1370a723SSascha Wildner #ifndef __UEFI_MULTIPHASE_H__ 10*1370a723SSascha Wildner #define __UEFI_MULTIPHASE_H__ 11*1370a723SSascha Wildner 12*1370a723SSascha Wildner /// 13*1370a723SSascha Wildner /// Attributes of variable. 14*1370a723SSascha Wildner /// 15*1370a723SSascha Wildner #define EFI_VARIABLE_NON_VOLATILE 0x00000001 16*1370a723SSascha Wildner #define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002 17*1370a723SSascha Wildner #define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004 18*1370a723SSascha Wildner /// 19*1370a723SSascha Wildner /// This attribute is identified by the mnemonic 'HR' 20*1370a723SSascha Wildner /// elsewhere in this specification. 21*1370a723SSascha Wildner /// 22*1370a723SSascha Wildner #define EFI_VARIABLE_HARDWARE_ERROR_RECORD 0x00000008 23*1370a723SSascha Wildner /// 24*1370a723SSascha Wildner /// Attributes of Authenticated Variable 25*1370a723SSascha Wildner /// 26*1370a723SSascha Wildner #define EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS 0x00000020 27*1370a723SSascha Wildner #define EFI_VARIABLE_APPEND_WRITE 0x00000040 28*1370a723SSascha Wildner /// 29*1370a723SSascha Wildner /// NOTE: EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is deprecated and should be considered reserved. 30*1370a723SSascha Wildner /// 31*1370a723SSascha Wildner #define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 0x00000010 32*1370a723SSascha Wildner 33*1370a723SSascha Wildner #ifndef VFRCOMPILE 34*1370a723SSascha Wildner #include <Guid/WinCertificate.h> 35*1370a723SSascha Wildner /// 36*1370a723SSascha Wildner /// Enumeration of memory types introduced in UEFI. 37*1370a723SSascha Wildner /// 38*1370a723SSascha Wildner typedef enum { 39*1370a723SSascha Wildner /// 40*1370a723SSascha Wildner /// Not used. 41*1370a723SSascha Wildner /// 42*1370a723SSascha Wildner EfiReservedMemoryType, 43*1370a723SSascha Wildner /// 44*1370a723SSascha Wildner /// The code portions of a loaded application. 45*1370a723SSascha Wildner /// (Note that UEFI OS loaders are UEFI applications.) 46*1370a723SSascha Wildner /// 47*1370a723SSascha Wildner EfiLoaderCode, 48*1370a723SSascha Wildner /// 49*1370a723SSascha Wildner /// The data portions of a loaded application and the default data allocation 50*1370a723SSascha Wildner /// type used by an application to allocate pool memory. 51*1370a723SSascha Wildner /// 52*1370a723SSascha Wildner EfiLoaderData, 53*1370a723SSascha Wildner /// 54*1370a723SSascha Wildner /// The code portions of a loaded Boot Services Driver. 55*1370a723SSascha Wildner /// 56*1370a723SSascha Wildner EfiBootServicesCode, 57*1370a723SSascha Wildner /// 58*1370a723SSascha Wildner /// The data portions of a loaded Boot Serves Driver, and the default data 59*1370a723SSascha Wildner /// allocation type used by a Boot Services Driver to allocate pool memory. 60*1370a723SSascha Wildner /// 61*1370a723SSascha Wildner EfiBootServicesData, 62*1370a723SSascha Wildner /// 63*1370a723SSascha Wildner /// The code portions of a loaded Runtime Services Driver. 64*1370a723SSascha Wildner /// 65*1370a723SSascha Wildner EfiRuntimeServicesCode, 66*1370a723SSascha Wildner /// 67*1370a723SSascha Wildner /// The data portions of a loaded Runtime Services Driver and the default 68*1370a723SSascha Wildner /// data allocation type used by a Runtime Services Driver to allocate pool memory. 69*1370a723SSascha Wildner /// 70*1370a723SSascha Wildner EfiRuntimeServicesData, 71*1370a723SSascha Wildner /// 72*1370a723SSascha Wildner /// Free (unallocated) memory. 73*1370a723SSascha Wildner /// 74*1370a723SSascha Wildner EfiConventionalMemory, 75*1370a723SSascha Wildner /// 76*1370a723SSascha Wildner /// Memory in which errors have been detected. 77*1370a723SSascha Wildner /// 78*1370a723SSascha Wildner EfiUnusableMemory, 79*1370a723SSascha Wildner /// 80*1370a723SSascha Wildner /// Memory that holds the ACPI tables. 81*1370a723SSascha Wildner /// 82*1370a723SSascha Wildner EfiACPIReclaimMemory, 83*1370a723SSascha Wildner /// 84*1370a723SSascha Wildner /// Address space reserved for use by the firmware. 85*1370a723SSascha Wildner /// 86*1370a723SSascha Wildner EfiACPIMemoryNVS, 87*1370a723SSascha Wildner /// 88*1370a723SSascha Wildner /// Used by system firmware to request that a memory-mapped IO region 89*1370a723SSascha Wildner /// be mapped by the OS to a virtual address so it can be accessed by EFI runtime services. 90*1370a723SSascha Wildner /// 91*1370a723SSascha Wildner EfiMemoryMappedIO, 92*1370a723SSascha Wildner /// 93*1370a723SSascha Wildner /// System memory-mapped IO region that is used to translate memory 94*1370a723SSascha Wildner /// cycles to IO cycles by the processor. 95*1370a723SSascha Wildner /// 96*1370a723SSascha Wildner EfiMemoryMappedIOPortSpace, 97*1370a723SSascha Wildner /// 98*1370a723SSascha Wildner /// Address space reserved by the firmware for code that is part of the processor. 99*1370a723SSascha Wildner /// 100*1370a723SSascha Wildner EfiPalCode, 101*1370a723SSascha Wildner /// 102*1370a723SSascha Wildner /// A memory region that operates as EfiConventionalMemory, 103*1370a723SSascha Wildner /// however it happens to also support byte-addressable non-volatility. 104*1370a723SSascha Wildner /// 105*1370a723SSascha Wildner EfiPersistentMemory, 106*1370a723SSascha Wildner /// 107*1370a723SSascha Wildner /// A memory region that describes system memory that has not been accepted 108*1370a723SSascha Wildner /// by a corresponding call to the underlying isolation architecture. 109*1370a723SSascha Wildner /// 110*1370a723SSascha Wildner EfiUnacceptedMemoryType, 111*1370a723SSascha Wildner EfiMaxMemoryType 112*1370a723SSascha Wildner } EFI_MEMORY_TYPE; 113*1370a723SSascha Wildner 114*1370a723SSascha Wildner /// 115*1370a723SSascha Wildner /// Enumeration of reset types. 116*1370a723SSascha Wildner /// 117*1370a723SSascha Wildner typedef enum { 118*1370a723SSascha Wildner /// 119*1370a723SSascha Wildner /// Used to induce a system-wide reset. This sets all circuitry within the 120*1370a723SSascha Wildner /// system to its initial state. This type of reset is asynchronous to system 121*1370a723SSascha Wildner /// operation and operates withgout regard to cycle boundaries. EfiColdReset 122*1370a723SSascha Wildner /// is tantamount to a system power cycle. 123*1370a723SSascha Wildner /// 124*1370a723SSascha Wildner EfiResetCold, 125*1370a723SSascha Wildner /// 126*1370a723SSascha Wildner /// Used to induce a system-wide initialization. The processors are set to their 127*1370a723SSascha Wildner /// initial state, and pending cycles are not corrupted. If the system does 128*1370a723SSascha Wildner /// not support this reset type, then an EfiResetCold must be performed. 129*1370a723SSascha Wildner /// 130*1370a723SSascha Wildner EfiResetWarm, 131*1370a723SSascha Wildner /// 132*1370a723SSascha Wildner /// Used to induce an entry into a power state equivalent to the ACPI G2/S5 or G3 133*1370a723SSascha Wildner /// state. If the system does not support this reset type, then when the system 134*1370a723SSascha Wildner /// is rebooted, it should exhibit the EfiResetCold attributes. 135*1370a723SSascha Wildner /// 136*1370a723SSascha Wildner EfiResetShutdown, 137*1370a723SSascha Wildner /// 138*1370a723SSascha Wildner /// Used to induce a system-wide reset. The exact type of the reset is defined by 139*1370a723SSascha Wildner /// the EFI_GUID that follows the Null-terminated Unicode string passed into 140*1370a723SSascha Wildner /// ResetData. If the platform does not recognize the EFI_GUID in ResetData the 141*1370a723SSascha Wildner /// platform must pick a supported reset type to perform. The platform may 142*1370a723SSascha Wildner /// optionally log the parameters from any non-normal reset that occurs. 143*1370a723SSascha Wildner /// 144*1370a723SSascha Wildner EfiResetPlatformSpecific 145*1370a723SSascha Wildner } EFI_RESET_TYPE; 146*1370a723SSascha Wildner 147*1370a723SSascha Wildner /// 148*1370a723SSascha Wildner /// Data structure that precedes all of the standard EFI table types. 149*1370a723SSascha Wildner /// 150*1370a723SSascha Wildner typedef struct { 151*1370a723SSascha Wildner /// 152*1370a723SSascha Wildner /// A 64-bit signature that identifies the type of table that follows. 153*1370a723SSascha Wildner /// Unique signatures have been generated for the EFI System Table, 154*1370a723SSascha Wildner /// the EFI Boot Services Table, and the EFI Runtime Services Table. 155*1370a723SSascha Wildner /// 156*1370a723SSascha Wildner UINT64 Signature; 157*1370a723SSascha Wildner /// 158*1370a723SSascha Wildner /// The revision of the EFI Specification to which this table 159*1370a723SSascha Wildner /// conforms. The upper 16 bits of this field contain the major 160*1370a723SSascha Wildner /// revision value, and the lower 16 bits contain the minor revision 161*1370a723SSascha Wildner /// value. The minor revision values are limited to the range of 00..99. 162*1370a723SSascha Wildner /// 163*1370a723SSascha Wildner UINT32 Revision; 164*1370a723SSascha Wildner /// 165*1370a723SSascha Wildner /// The size, in bytes, of the entire table including the EFI_TABLE_HEADER. 166*1370a723SSascha Wildner /// 167*1370a723SSascha Wildner UINT32 HeaderSize; 168*1370a723SSascha Wildner /// 169*1370a723SSascha Wildner /// The 32-bit CRC for the entire table. This value is computed by 170*1370a723SSascha Wildner /// setting this field to 0, and computing the 32-bit CRC for HeaderSize bytes. 171*1370a723SSascha Wildner /// 172*1370a723SSascha Wildner UINT32 CRC32; 173*1370a723SSascha Wildner /// 174*1370a723SSascha Wildner /// Reserved field that must be set to 0. 175*1370a723SSascha Wildner /// 176*1370a723SSascha Wildner UINT32 Reserved; 177*1370a723SSascha Wildner } EFI_TABLE_HEADER; 178*1370a723SSascha Wildner 179*1370a723SSascha Wildner /// 180*1370a723SSascha Wildner /// AuthInfo is a WIN_CERTIFICATE using the wCertificateType 181*1370a723SSascha Wildner /// WIN_CERTIFICATE_UEFI_GUID and the CertType 182*1370a723SSascha Wildner /// EFI_CERT_TYPE_RSA2048_SHA256_GUID. If the attribute specifies 183*1370a723SSascha Wildner /// authenticated access, then the Data buffer should begin with an 184*1370a723SSascha Wildner /// authentication descriptor prior to the data payload and DataSize 185*1370a723SSascha Wildner /// should reflect the the data.and descriptor size. The caller 186*1370a723SSascha Wildner /// shall digest the Monotonic Count value and the associated data 187*1370a723SSascha Wildner /// for the variable update using the SHA-256 1-way hash algorithm. 188*1370a723SSascha Wildner /// The ensuing the 32-byte digest will be signed using the private 189*1370a723SSascha Wildner /// key associated w/ the public/private 2048-bit RSA key-pair. The 190*1370a723SSascha Wildner /// WIN_CERTIFICATE shall be used to describe the signature of the 191*1370a723SSascha Wildner /// Variable data *Data. In addition, the signature will also 192*1370a723SSascha Wildner /// include the MonotonicCount value to guard against replay attacks. 193*1370a723SSascha Wildner /// 194*1370a723SSascha Wildner typedef struct { 195*1370a723SSascha Wildner /// 196*1370a723SSascha Wildner /// Included in the signature of 197*1370a723SSascha Wildner /// AuthInfo.Used to ensure freshness/no 198*1370a723SSascha Wildner /// replay. Incremented during each 199*1370a723SSascha Wildner /// "Write" access. 200*1370a723SSascha Wildner /// 201*1370a723SSascha Wildner UINT64 MonotonicCount; 202*1370a723SSascha Wildner /// 203*1370a723SSascha Wildner /// Provides the authorization for the variable 204*1370a723SSascha Wildner /// access. It is a signature across the 205*1370a723SSascha Wildner /// variable data and the Monotonic Count 206*1370a723SSascha Wildner /// value. Caller uses Private key that is 207*1370a723SSascha Wildner /// associated with a public key that has been 208*1370a723SSascha Wildner /// provisioned via the key exchange. 209*1370a723SSascha Wildner /// 210*1370a723SSascha Wildner WIN_CERTIFICATE_UEFI_GUID AuthInfo; 211*1370a723SSascha Wildner } EFI_VARIABLE_AUTHENTICATION; 212*1370a723SSascha Wildner 213*1370a723SSascha Wildner /// 214*1370a723SSascha Wildner /// When the attribute EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS is 215*1370a723SSascha Wildner /// set, then the Data buffer shall begin with an instance of a complete (and serialized) 216*1370a723SSascha Wildner /// EFI_VARIABLE_AUTHENTICATION_2 descriptor. The descriptor shall be followed by the new 217*1370a723SSascha Wildner /// variable value and DataSize shall reflect the combined size of the descriptor and the new 218*1370a723SSascha Wildner /// variable value. The authentication descriptor is not part of the variable data and is not 219*1370a723SSascha Wildner /// returned by subsequent calls to GetVariable(). 220*1370a723SSascha Wildner /// 221*1370a723SSascha Wildner typedef struct { 222*1370a723SSascha Wildner /// 223*1370a723SSascha Wildner /// For the TimeStamp value, components Pad1, Nanosecond, TimeZone, Daylight and 224*1370a723SSascha Wildner /// Pad2 shall be set to 0. This means that the time shall always be expressed in GMT. 225*1370a723SSascha Wildner /// 226*1370a723SSascha Wildner EFI_TIME TimeStamp; 227*1370a723SSascha Wildner /// 228*1370a723SSascha Wildner /// Only a CertType of EFI_CERT_TYPE_PKCS7_GUID is accepted. 229*1370a723SSascha Wildner /// 230*1370a723SSascha Wildner WIN_CERTIFICATE_UEFI_GUID AuthInfo; 231*1370a723SSascha Wildner } EFI_VARIABLE_AUTHENTICATION_2; 232*1370a723SSascha Wildner #endif // VFRCOMPILE 233*1370a723SSascha Wildner 234*1370a723SSascha Wildner #endif 235