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