1 /** @file 2 Microcode Definitions. 3 4 Microcode Definitions based on contents of the 5 Intel(R) 64 and IA-32 Architectures Software Developer's Manual 6 Volume 3A, Section 9.11 Microcode Definitions 7 8 Copyright (c) 2016, Intel Corporation. All rights reserved.<BR> 9 SPDX-License-Identifier: BSD-2-Clause-Patent 10 11 @par Specification Reference: 12 Intel(R) 64 and IA-32 Architectures Software Developer's Manual, Volume 3A, 13 June 2016, Chapter 9 Processor Management and Initialization, Section 9-11. 14 15 **/ 16 17 #ifndef __MICROCODE_H__ 18 #define __MICROCODE_H__ 19 20 /// 21 /// CPU Microcode Date in BCD format 22 /// 23 typedef union { 24 struct { 25 UINT32 Year:16; 26 UINT32 Day:8; 27 UINT32 Month:8; 28 } Bits; 29 UINT32 Uint32; 30 } CPU_MICROCODE_DATE; 31 32 /// 33 /// CPU Microcode Processor Signature format 34 /// 35 typedef union { 36 struct { 37 UINT32 Stepping:4; 38 UINT32 Model:4; 39 UINT32 Family:4; 40 UINT32 Type:2; 41 UINT32 Reserved1:2; 42 UINT32 ExtendedModel:4; 43 UINT32 ExtendedFamily:8; 44 UINT32 Reserved2:4; 45 } Bits; 46 UINT32 Uint32; 47 } CPU_MICROCODE_PROCESSOR_SIGNATURE; 48 49 #pragma pack (1) 50 51 /// 52 /// Microcode Update Format definition 53 /// 54 typedef struct { 55 /// 56 /// Version number of the update header 57 /// 58 UINT32 HeaderVersion; 59 /// 60 /// Unique version number for the update, the basis for the update 61 /// signature provided by the processor to indicate the current update 62 /// functioning within the processor. Used by the BIOS to authenticate 63 /// the update and verify that the processor loads successfully. The 64 /// value in this field cannot be used for processor stepping identification 65 /// alone. This is a signed 32-bit number. 66 /// 67 UINT32 UpdateRevision; 68 /// 69 /// Date of the update creation in binary format: mmddyyyy (e.g. 70 /// 07/18/98 is 07181998H). 71 /// 72 CPU_MICROCODE_DATE Date; 73 /// 74 /// Extended family, extended model, type, family, model, and stepping 75 /// of processor that requires this particular update revision (e.g., 76 /// 00000650H). Each microcode update is designed specifically for a 77 /// given extended family, extended model, type, family, model, and 78 /// stepping of the processor. 79 /// The BIOS uses the processor signature field in conjunction with the 80 /// CPUID instruction to determine whether or not an update is 81 /// appropriate to load on a processor. The information encoded within 82 /// this field exactly corresponds to the bit representations returned by 83 /// the CPUID instruction. 84 /// 85 CPU_MICROCODE_PROCESSOR_SIGNATURE ProcessorSignature; 86 /// 87 /// Checksum of Update Data and Header. Used to verify the integrity of 88 /// the update header and data. Checksum is correct when the 89 /// summation of all the DWORDs (including the extended Processor 90 /// Signature Table) that comprise the microcode update result in 91 /// 00000000H. 92 /// 93 UINT32 Checksum; 94 /// 95 /// Version number of the loader program needed to correctly load this 96 /// update. The initial version is 00000001H 97 /// 98 UINT32 LoaderRevision; 99 /// 100 /// Platform type information is encoded in the lower 8 bits of this 4- 101 /// byte field. Each bit represents a particular platform type for a given 102 /// CPUID. The BIOS uses the processor flags field in conjunction with 103 /// the platform Id bits in MSR (17H) to determine whether or not an 104 /// update is appropriate to load on a processor. Multiple bits may be set 105 /// representing support for multiple platform IDs. 106 /// 107 UINT32 ProcessorFlags; 108 /// 109 /// Specifies the size of the encrypted data in bytes, and must be a 110 /// multiple of DWORDs. If this value is 00000000H, then the microcode 111 /// update encrypted data is 2000 bytes (or 500 DWORDs). 112 /// 113 UINT32 DataSize; 114 /// 115 /// Specifies the total size of the microcode update in bytes. It is the 116 /// summation of the header size, the encrypted data size and the size of 117 /// the optional extended signature table. This value is always a multiple 118 /// of 1024. 119 /// 120 UINT32 TotalSize; 121 /// 122 /// Reserved fields for future expansion. 123 /// 124 UINT8 Reserved[12]; 125 } CPU_MICROCODE_HEADER; 126 127 /// 128 /// Extended Signature Table Header Field Definitions 129 /// 130 typedef struct { 131 /// 132 /// Specifies the number of extended signature structures (Processor 133 /// Signature[n], processor flags[n] and checksum[n]) that exist in this 134 /// microcode update 135 /// 136 UINT32 ExtendedSignatureCount; 137 /// 138 /// Checksum of update extended processor signature table. Used to 139 /// verify the integrity of the extended processor signature table. 140 /// Checksum is correct when the summation of the DWORDs that 141 /// comprise the extended processor signature table results in 142 /// 00000000H. 143 /// 144 UINT32 ExtendedChecksum; 145 /// 146 /// Reserved fields. 147 /// 148 UINT8 Reserved[12]; 149 } CPU_MICROCODE_EXTENDED_TABLE_HEADER; 150 151 /// 152 /// Extended Signature Table Field Definitions 153 /// 154 typedef struct { 155 /// 156 /// Extended family, extended model, type, family, model, and stepping 157 /// of processor that requires this particular update revision (e.g., 158 /// 00000650H). Each microcode update is designed specifically for a 159 /// given extended family, extended model, type, family, model, and 160 /// stepping of the processor. 161 /// The BIOS uses the processor signature field in conjunction with the 162 /// CPUID instruction to determine whether or not an update is 163 /// appropriate to load on a processor. The information encoded within 164 /// this field exactly corresponds to the bit representations returned by 165 /// the CPUID instruction. 166 /// 167 CPU_MICROCODE_PROCESSOR_SIGNATURE ProcessorSignature; 168 /// 169 /// Platform type information is encoded in the lower 8 bits of this 4- 170 /// byte field. Each bit represents a particular platform type for a given 171 /// CPUID. The BIOS uses the processor flags field in conjunction with 172 /// the platform Id bits in MSR (17H) to determine whether or not an 173 /// update is appropriate to load on a processor. Multiple bits may be set 174 /// representing support for multiple platform IDs. 175 /// 176 UINT32 ProcessorFlag; 177 /// 178 /// Used by utility software to decompose a microcode update into 179 /// multiple microcode updates where each of the new updates is 180 /// constructed without the optional Extended Processor Signature 181 /// Table. 182 /// To calculate the Checksum, substitute the Primary Processor 183 /// Signature entry and the Processor Flags entry with the 184 /// corresponding Extended Patch entry. Delete the Extended Processor 185 /// Signature Table entries. The Checksum is correct when the 186 /// summation of all DWORDs that comprise the created Extended 187 /// Processor Patch results in 00000000H. 188 /// 189 UINT32 Checksum; 190 } CPU_MICROCODE_EXTENDED_TABLE; 191 192 #pragma pack () 193 194 #endif 195