iPXE
ucode.h
Go to the documentation of this file.
1#ifndef _IPXE_UCODE_H
2#define _IPXE_UCODE_H
4/** @file
5 *
6 * Microcode updates
7 *
8 */
10FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
12#include <stdint.h>
13#include <ipxe/mp.h>
14
15/** Platform ID MSR */
16#define MSR_PLATFORM_ID 0x00000017UL
18/** Extract platform ID from MSR value */
19#define MSR_PLATFORM_ID_VALUE( value ) ( ( (value) >> 50 ) & 0x7 )
20
21/** Intel microcode load trigger MSR */
22#define MSR_UCODE_TRIGGER_INTEL 0x00000079UL
23
24/** AMD microcode load trigger MSR */
25#define MSR_UCODE_TRIGGER_AMD 0xc0010020UL
26
27/** CPUID signature applicability mask
28 *
29 * We assume that only steppings may vary between the boot CPU and any
30 * application processors.
31 */
32#define UCODE_SIGNATURE_MASK 0xfffffff0UL
33
34/** Minimum possible microcode version */
35#define UCODE_VERSION_MIN -0x80000000L
36
37/** Maximum possible microcode version */
38#define UCODE_VERSION_MAX 0x7fffffffL
39
40/** A microcode update control
41 *
42 * This must match the layout as used by the assembly code in
43 * ucode_mp.S.
44 */
46 /** Microcode descriptor list physical address */
48 /** Microcode status array physical address */
50 /** Microcode load trigger MSR */
52 /** Maximum expected APIC ID */
54 /** Unexpected APIC ID
55 *
56 * Any application processor may set this to indicate that its
57 * APIC ID was higher than the maximum expected APIC ID.
58 */
60 /** APIC ID eligibility mask bits */
62 /** APIC ID eligibility test bits */
64 /** Microcode version requires manual clear */
66 /** Microcode version is reported via high dword */
68} __attribute__ (( packed ));
69
70/** A microcode update descriptor
71 *
72 * This must match the layout as used by the assembly code in
73 * ucode_mp.S.
74 */
76 /** CPUID signature (or 0 to terminate list) */
78 /** Microcode version */
80 /** Microcode physical address */
82} __attribute__ (( packed ));
83
84/** A microcode update status report
85 *
86 * This must match the layout as used by the assembly code in
87 * ucode_mp.S.
88 */
90 /** CPU signature */
92 /** APIC ID (for sanity checking) */
94 /** Initial microcode version */
96 /** Final microcode version */
98} __attribute__ (( packed ));
99
100/** A microcode date */
102 /** Year (BCD) */
104 /** Century (BCD) */
106 /** Day (BCD) */
108 /** Month (BCD) */
110} __attribute__ (( packed ));
111
112/** An Intel microcode update file header */
114 /** Header version number */
116 /** Microcode version */
118 /** Date */
120 /** CPUID signature */
122 /** Checksum */
124 /** Loader version */
126 /** Supported platforms */
128 /** Microcode data size (or 0 to indicate 2000 bytes) */
130 /** Total size (or 0 to indicate 2048 bytes) */
132 /** Reserved */
134} __attribute__ (( packed ));
135
136/** Intel microcode header version number */
137#define INTEL_UCODE_HVER 0x00000001UL
138
139/** Intel microcode loader version number */
140#define INTEL_UCODE_LVER 0x00000001UL
141
142/** Intel microcode default data length */
143#define INTEL_UCODE_DATA_LEN 2000
144
145/** Intel microcode file alignment */
146#define INTEL_UCODE_ALIGN 1024
147
148/** An Intel microcode update file extended header */
150 /** Extended signature count */
152 /** Extended checksum */
154 /** Reserved */
156} __attribute__ (( packed ));
157
158/** An Intel microcode extended signature */
160 /** CPUID signature */
162 /** Supported platforms */
164 /** Checksum */
166} __attribute__ (( packed ));
167
168/** An AMD microcode update file header */
170 /** Magic signature */
172 /** Equivalence table type */
174 /** Equivalence table length */
176} __attribute__ (( packed ));
177
178/** AMD microcode magic signature */
179#define AMD_UCODE_MAGIC ( ( 'A' << 16 ) | ( 'M' << 8 ) | ( 'D' << 0 ) )
180
181/** AMD microcode equivalence table type */
182#define AMD_UCODE_EQUIV_TYPE 0x00000000UL
183
184/** An AMD microcode equivalence table entry */
186 /** CPU signature */
188 /** Reserved */
190 /** Equivalence ID */
192 /** Reserved */
194} __attribute__ (( packed ));
195
196/** An AMD microcode patch header */
198 /** Patch type */
200 /** Patch length */
202} __attribute__ (( packed ));
203
204/** An AMD microcode patch */
206 /** Date */
208 /** Microcode version */
210 /** Reserved */
212 /** Equivalence ID */
214 /** Reserved */
216} __attribute__ (( packed ));
217
218/** AMD patch type */
219#define AMD_UCODE_PATCH_TYPE 0x00000001UL
220
222
223#endif /* _IPXE_UCODE_H */
unsigned short uint16_t
Definition stdint.h:11
unsigned int uint32_t
Definition stdint.h:12
unsigned long long uint64_t
Definition stdint.h:13
signed int int32_t
Definition stdint.h:17
unsigned char uint8_t
Definition stdint.h:10
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define __attribute__(x)
Definition compiler.h:10
Multiprocessor functions.
void mp_func_t(mp_addr_t opaque, unsigned int cpuid)
A multiprocessor function.
Definition mp.h:51
An AMD microcode equivalence table entry.
Definition ucode.h:185
uint8_t reserved_a[8]
Reserved.
Definition ucode.h:189
uint32_t signature
CPU signature.
Definition ucode.h:187
uint16_t id
Equivalence ID.
Definition ucode.h:191
uint8_t reserved_b[2]
Reserved.
Definition ucode.h:193
An AMD microcode update file header.
Definition ucode.h:169
uint32_t len
Equivalence table length.
Definition ucode.h:175
uint32_t type
Equivalence table type.
Definition ucode.h:173
uint32_t magic
Magic signature.
Definition ucode.h:171
An AMD microcode patch header.
Definition ucode.h:197
uint32_t type
Patch type.
Definition ucode.h:199
uint32_t len
Patch length.
Definition ucode.h:201
An AMD microcode patch.
Definition ucode.h:205
uint8_t reserved_b[14]
Reserved.
Definition ucode.h:215
struct ucode_date date
Date.
Definition ucode.h:207
uint8_t reserved_a[16]
Reserved.
Definition ucode.h:211
int32_t version
Microcode version.
Definition ucode.h:209
uint16_t id
Equivalence ID.
Definition ucode.h:213
An Intel microcode update file extended header.
Definition ucode.h:149
uint32_t count
Extended signature count.
Definition ucode.h:151
uint8_t reserved[12]
Reserved.
Definition ucode.h:155
uint32_t checksum
Extended checksum.
Definition ucode.h:153
An Intel microcode extended signature.
Definition ucode.h:159
uint32_t checksum
Checksum.
Definition ucode.h:165
uint32_t platforms
Supported platforms.
Definition ucode.h:163
uint32_t signature
CPUID signature.
Definition ucode.h:161
An Intel microcode update file header.
Definition ucode.h:113
uint8_t reserved[12]
Reserved.
Definition ucode.h:133
uint32_t checksum
Checksum.
Definition ucode.h:123
uint32_t data_len
Microcode data size (or 0 to indicate 2000 bytes)
Definition ucode.h:129
uint32_t len
Total size (or 0 to indicate 2048 bytes)
Definition ucode.h:131
int32_t version
Microcode version.
Definition ucode.h:117
uint32_t platforms
Supported platforms.
Definition ucode.h:127
uint32_t lver
Loader version.
Definition ucode.h:125
struct ucode_date date
Date.
Definition ucode.h:119
uint32_t signature
CPUID signature.
Definition ucode.h:121
uint32_t hver
Header version number.
Definition ucode.h:115
A microcode update control.
Definition ucode.h:45
uint64_t status
Microcode status array physical address.
Definition ucode.h:49
uint32_t apic_max
Maximum expected APIC ID.
Definition ucode.h:53
uint32_t trigger_msr
Microcode load trigger MSR.
Definition ucode.h:51
uint32_t apic_test
APIC ID eligibility test bits.
Definition ucode.h:63
uint8_t ver_clear
Microcode version requires manual clear.
Definition ucode.h:65
uint32_t apic_mask
APIC ID eligibility mask bits.
Definition ucode.h:61
uint64_t desc
Microcode descriptor list physical address.
Definition ucode.h:47
uint32_t apic_unexpected
Unexpected APIC ID.
Definition ucode.h:59
uint8_t ver_high
Microcode version is reported via high dword.
Definition ucode.h:67
A microcode date.
Definition ucode.h:101
uint8_t month
Month (BCD)
Definition ucode.h:109
uint8_t year
Year (BCD)
Definition ucode.h:103
uint8_t day
Day (BCD)
Definition ucode.h:107
uint8_t century
Century (BCD)
Definition ucode.h:105
A microcode update descriptor.
Definition ucode.h:75
uint64_t address
Microcode physical address.
Definition ucode.h:81
uint32_t signature
CPUID signature (or 0 to terminate list)
Definition ucode.h:77
int32_t version
Microcode version.
Definition ucode.h:79
A microcode update status report.
Definition ucode.h:89
uint32_t id
APIC ID (for sanity checking)
Definition ucode.h:93
int32_t after
Final microcode version.
Definition ucode.h:97
int32_t before
Initial microcode version.
Definition ucode.h:95
uint32_t signature
CPU signature.
Definition ucode.h:91
A microcode update.
Definition ucode.c:87