iPXE
UefiMultiPhase.h
Go to the documentation of this file.
00001 /** @file
00002   This includes some definitions introduced in UEFI that will be used in both PEI and DXE phases.
00003 
00004 Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
00005 This program and the accompanying materials are licensed and made available under
00006 the terms and conditions of the BSD License that accompanies this distribution.
00007 The full text of the license may be found at
00008 http://opensource.org/licenses/bsd-license.php.
00009 
00010 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
00011 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
00012 
00013 **/
00014 
00015 #ifndef __UEFI_MULTIPHASE_H__
00016 #define __UEFI_MULTIPHASE_H__
00017 
00018 FILE_LICENCE ( BSD3 );
00019 
00020 #include <ipxe/efi/Guid/WinCertificate.h>
00021 ///
00022 /// Enumeration of memory types introduced in UEFI.
00023 ///
00024 typedef enum {
00025   ///
00026   /// Not used.
00027   ///
00028   EfiReservedMemoryType,
00029   ///
00030   /// The code portions of a loaded application.
00031   /// (Note that UEFI OS loaders are UEFI applications.)
00032   ///
00033   EfiLoaderCode,
00034   ///
00035   /// The data portions of a loaded application and the default data allocation
00036   /// type used by an application to allocate pool memory.
00037   ///
00038   EfiLoaderData,
00039   ///
00040   /// The code portions of a loaded Boot Services Driver.
00041   ///
00042   EfiBootServicesCode,
00043   ///
00044   /// The data portions of a loaded Boot Serves Driver, and the default data
00045   /// allocation type used by a Boot Services Driver to allocate pool memory.
00046   ///
00047   EfiBootServicesData,
00048   ///
00049   /// The code portions of a loaded Runtime Services Driver.
00050   ///
00051   EfiRuntimeServicesCode,
00052   ///
00053   /// The data portions of a loaded Runtime Services Driver and the default
00054   /// data allocation type used by a Runtime Services Driver to allocate pool memory.
00055   ///
00056   EfiRuntimeServicesData,
00057   ///
00058   /// Free (unallocated) memory.
00059   ///
00060   EfiConventionalMemory,
00061   ///
00062   /// Memory in which errors have been detected.
00063   ///
00064   EfiUnusableMemory,
00065   ///
00066   /// Memory that holds the ACPI tables.
00067   ///
00068   EfiACPIReclaimMemory,
00069   ///
00070   /// Address space reserved for use by the firmware.
00071   ///
00072   EfiACPIMemoryNVS,
00073   ///
00074   /// Used by system firmware to request that a memory-mapped IO region
00075   /// be mapped by the OS to a virtual address so it can be accessed by EFI runtime services.
00076   ///
00077   EfiMemoryMappedIO,
00078   ///
00079   /// System memory-mapped IO region that is used to translate memory
00080   /// cycles to IO cycles by the processor.
00081   ///
00082   EfiMemoryMappedIOPortSpace,
00083   ///
00084   /// Address space reserved by the firmware for code that is part of the processor.
00085   ///
00086   EfiPalCode,
00087   ///
00088   /// A memory region that operates as EfiConventionalMemory,
00089   /// however it happens to also support byte-addressable non-volatility.
00090   ///
00091   EfiPersistentMemory,
00092   EfiMaxMemoryType
00093 } EFI_MEMORY_TYPE;
00094 
00095 ///
00096 /// Enumeration of reset types.
00097 ///
00098 typedef enum {
00099   ///
00100   /// Used to induce a system-wide reset. This sets all circuitry within the
00101   /// system to its initial state.  This type of reset is asynchronous to system
00102   /// operation and operates withgout regard to cycle boundaries.  EfiColdReset
00103   /// is tantamount to a system power cycle.
00104   ///
00105   EfiResetCold,
00106   ///
00107   /// Used to induce a system-wide initialization. The processors are set to their
00108   /// initial state, and pending cycles are not corrupted.  If the system does
00109   /// not support this reset type, then an EfiResetCold must be performed.
00110   ///
00111   EfiResetWarm,
00112   ///
00113   /// Used to induce an entry into a power state equivalent to the ACPI G2/S5 or G3
00114   /// state.  If the system does not support this reset type, then when the system
00115   /// is rebooted, it should exhibit the EfiResetCold attributes.
00116   ///
00117   EfiResetShutdown,
00118   ///
00119   /// Used to induce a system-wide reset. The exact type of the reset is defined by
00120   /// the EFI_GUID that follows the Null-terminated Unicode string passed into
00121   /// ResetData. If the platform does not recognize the EFI_GUID in ResetData the
00122   /// platform must pick a supported reset type to perform. The platform may
00123   /// optionally log the parameters from any non-normal reset that occurs.
00124   ///
00125   EfiResetPlatformSpecific
00126 } EFI_RESET_TYPE;
00127 
00128 ///
00129 /// Data structure that precedes all of the standard EFI table types.
00130 ///
00131 typedef struct {
00132   ///
00133   /// A 64-bit signature that identifies the type of table that follows.
00134   /// Unique signatures have been generated for the EFI System Table,
00135   /// the EFI Boot Services Table, and the EFI Runtime Services Table.
00136   ///
00137   UINT64  Signature;
00138   ///
00139   /// The revision of the EFI Specification to which this table
00140   /// conforms. The upper 16 bits of this field contain the major
00141   /// revision value, and the lower 16 bits contain the minor revision
00142   /// value. The minor revision values are limited to the range of 00..99.
00143   ///
00144   UINT32  Revision;
00145   ///
00146   /// The size, in bytes, of the entire table including the EFI_TABLE_HEADER.
00147   ///
00148   UINT32  HeaderSize;
00149   ///
00150   /// The 32-bit CRC for the entire table. This value is computed by
00151   /// setting this field to 0, and computing the 32-bit CRC for HeaderSize bytes.
00152   ///
00153   UINT32  CRC32;
00154   ///
00155   /// Reserved field that must be set to 0.
00156   ///
00157   UINT32  Reserved;
00158 } EFI_TABLE_HEADER;
00159 
00160 ///
00161 /// Attributes of variable.
00162 ///
00163 #define EFI_VARIABLE_NON_VOLATILE                            0x00000001
00164 #define EFI_VARIABLE_BOOTSERVICE_ACCESS                      0x00000002
00165 #define EFI_VARIABLE_RUNTIME_ACCESS                          0x00000004
00166 ///
00167 /// This attribute is identified by the mnemonic 'HR'
00168 /// elsewhere in this specification.
00169 ///
00170 #define EFI_VARIABLE_HARDWARE_ERROR_RECORD                   0x00000008
00171 ///
00172 /// Attributes of Authenticated Variable
00173 ///
00174 #define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS              0x00000010
00175 #define EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS   0x00000020
00176 #define EFI_VARIABLE_APPEND_WRITE                            0x00000040
00177 
00178 
00179 ///
00180 /// AuthInfo is a WIN_CERTIFICATE using the wCertificateType
00181 /// WIN_CERTIFICATE_UEFI_GUID and the CertType
00182 /// EFI_CERT_TYPE_RSA2048_SHA256_GUID. If the attribute specifies
00183 /// authenticated access, then the Data buffer should begin with an
00184 /// authentication descriptor prior to the data payload and DataSize
00185 /// should reflect the the data.and descriptor size. The caller
00186 /// shall digest the Monotonic Count value and the associated data
00187 /// for the variable update using the SHA-256 1-way hash algorithm.
00188 /// The ensuing the 32-byte digest will be signed using the private
00189 /// key associated w/ the public/private 2048-bit RSA key-pair. The
00190 /// WIN_CERTIFICATE shall be used to describe the signature of the
00191 /// Variable data *Data. In addition, the signature will also
00192 /// include the MonotonicCount value to guard against replay attacks.
00193 ///
00194 typedef struct {
00195   ///
00196   /// Included in the signature of
00197   /// AuthInfo.Used to ensure freshness/no
00198   /// replay. Incremented during each
00199   /// "Write" access.
00200   ///
00201   UINT64                      MonotonicCount;
00202   ///
00203   /// Provides the authorization for the variable
00204   /// access. It is a signature across the
00205   /// variable data and the  Monotonic Count
00206   /// value. Caller uses Private key that is
00207   /// associated with a public key that has been
00208   /// provisioned via the key exchange.
00209   ///
00210   WIN_CERTIFICATE_UEFI_GUID   AuthInfo;
00211 } EFI_VARIABLE_AUTHENTICATION;
00212 
00213 ///
00214 /// When the attribute EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS is
00215 /// set, then the Data buffer shall begin with an instance of a complete (and serialized)
00216 /// EFI_VARIABLE_AUTHENTICATION_2 descriptor. The descriptor shall be followed by the new
00217 /// variable value and DataSize shall reflect the combined size of the descriptor and the new
00218 /// variable value. The authentication descriptor is not part of the variable data and is not
00219 /// returned by subsequent calls to GetVariable().
00220 ///
00221 typedef struct {
00222   ///
00223   /// For the TimeStamp value, components Pad1, Nanosecond, TimeZone, Daylight and
00224   /// Pad2 shall be set to 0. This means that the time shall always be expressed in GMT.
00225   ///
00226   EFI_TIME                    TimeStamp;
00227   ///
00228   /// Only a CertType of  EFI_CERT_TYPE_PKCS7_GUID is accepted.
00229   ///
00230   WIN_CERTIFICATE_UEFI_GUID   AuthInfo;
00231  } EFI_VARIABLE_AUTHENTICATION_2;
00232 
00233 #endif