diff options
-rw-r--r-- | src/cpu/intel/microcode/microcode.c | 32 | ||||
-rw-r--r-- | src/include/cpu/intel/microcode.h | 4 |
2 files changed, 36 insertions, 0 deletions
diff --git a/src/cpu/intel/microcode/microcode.c b/src/cpu/intel/microcode/microcode.c index 469bd25496..5ed6190e26 100644 --- a/src/cpu/intel/microcode/microcode.c +++ b/src/cpu/intel/microcode/microcode.c @@ -250,6 +250,38 @@ void intel_update_microcode_from_cbfs(void) spin_unlock(µcode_lock); } +void intel_reload_microcode(void) +{ + if (!CONFIG(RELOAD_MICROCODE_PATCH)) + return; + + u32 current_rev; + msr_t msr; + const struct microcode *m = intel_microcode_find(); + + if (!m) { + printk(BIOS_ERR, "microcode: failed because no ucode was found\n"); + return; + } + + printk(BIOS_INFO, "microcode: Re-load microcode patch\n"); + + msr.lo = (unsigned long)m + sizeof(struct microcode); + msr.hi = 0; + wrmsr(IA32_BIOS_UPDT_TRIG, msr); + + current_rev = read_microcode_rev(); + if (current_rev == m->rev) { + printk(BIOS_INFO, "microcode: updated to revision " + "0x%x date=%04x-%02x-%02x\n", read_microcode_rev(), + m->date & 0xffff, (m->date >> 24) & 0xff, + (m->date >> 16) & 0xff); + return; + } + + printk(BIOS_ERR, "microcode: Re-load failed\n"); +} + #if ENV_RAMSTAGE __weak int soc_skip_ucode_update(u32 current_patch_id, u32 new_patch_id) diff --git a/src/include/cpu/intel/microcode.h b/src/include/cpu/intel/microcode.h index d977e5836f..5a6c27ecbe 100644 --- a/src/include/cpu/intel/microcode.h +++ b/src/include/cpu/intel/microcode.h @@ -4,6 +4,10 @@ #include <stdint.h> +/* Find the microcode and reload the microcode if SoC has RELOAD_MICROCODE_PATCH + * config selected. */ +void intel_reload_microcode(void); + void intel_update_microcode_from_cbfs(void); /* Find a microcode that matches the revision and platform family returning * NULL if none found. The found microcode is cached for faster access on |