12 #include <smp/spinlock.h>
52 "xorl %%eax, %%eax\n\t"
53 "xorl %%edx, %%edx\n\t"
54 "movl $0x8b, %%ecx\n\t"
56 "movl $0x01, %%eax\n\t"
58 "movl $0x08b, %%ecx\n\t"
61 "=a" (msr.
lo),
"=d" (msr.
hi)
69 #define MICROCODE_CBFS_FILE "cpu_microcode_blob.bin"
83 if (current_rev ==
m->rev) {
101 if (current_rev ==
m->rev) {
104 m->date & 0xffff, (
m->date >> 24) & 0xff,
105 (
m->date >> 16) & 0xff);
157 size_t microcode_len;
159 u32 pf, rev, sig, update_size;
164 if (ucode_updates ==
NULL)
173 if ((
c.x86_model >= 5) || (
c.x86 > 6)) {
175 pf = 1 << ((msr.
hi >> 18) & 7);
181 while (microcode_len >=
sizeof(*ucode_updates)) {
192 if (update_size > microcode_len) {
197 if ((ucode_updates->
sig == sig) && (ucode_updates->
pf & pf))
198 return ucode_updates;
204 if (ext_tbl !=
NULL) {
208 for (i = 0; i < ext_tbl->
ext_sig_cnt; i++, entry++) {
210 if ((
sig == entry->
sig) && (
pf & entry->
pf)) {
211 return ucode_updates;
216 ucode_updates = (
void *)((
char *)ucode_updates + update_size);
217 microcode_len -= update_size;
225 static bool microcode_checked;
226 static const void *ucode_update;
228 if (microcode_checked)
237 microcode_checked =
true;
static unsigned int cpuid_eax(unsigned int op)
static void get_fms(struct cpuinfo_x86 *c, uint32_t tfms)
#define DECLARE_SPIN_LOCK(x)
static void * cbfs_map(const char *name, size_t *size_out)
#define printk(level,...)
static const void * microcode_patch
static __always_inline msr_t rdmsr(unsigned int index)
#define IA32_BIOS_UPDT_TRIG
static __always_inline void wrmsr(unsigned int index, msr_t msr)
#define spin_unlock(lock)
int soc_skip_ucode_update(u32 current_patch_id, u32 new_patch_id)
#define BIOS_INFO
BIOS_INFO - Expected events.
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
#define BIOS_SPEW
BIOS_SPEW - Excessively verbose output.
#define BIOS_WARNING
BIOS_WARNING - Bad configuration.
static const void * find_cbfs_microcode(void)
void intel_microcode_load_unlocked(const void *microcode_patch)
static u32 read_microcode_rev(void)
uint32_t get_microcode_size(const void *microcode)
uint32_t get_microcode_checksum(const void *microcode)
#define MICROCODE_CBFS_FILE
uint32_t get_microcode_rev(const void *microcode)
void intel_update_microcode_from_cbfs(void)
uint32_t get_current_microcode_rev(void)
const void * intel_microcode_find(void)
static struct ext_sig_table * ucode_get_ext_sig_table(const struct microcode *ucode)
const struct smm_save_state_ops *legacy_ops __weak
#define m(clkreg, src_bits, pmcreg, dst_bits)
#define c(value, pmcreg, dst_bits)