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