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