summaryrefslogtreecommitdiff
path: root/src/cpu/intel/microcode/microcode.c
diff options
context:
space:
mode:
authorSubrata Banik <subratabanik@google.com>2022-06-15 21:24:13 +0530
committerFelix Held <felix-coreboot@felixheld.de>2022-06-22 12:35:53 +0000
commitbd0aef0f2a9a9cee1258aa22e026f1b6054c3d64 (patch)
treef5cdd186d540ff8ef63c7ce58816d5e1544825dc /src/cpu/intel/microcode/microcode.c
parentd36aca5e22d3c5410c953af7a8e9db9ec86082bb (diff)
cpu/intel/microcode: Have API to re-load microcode patch
This patch introduces a newer API to reload the microcode patch when SoC selects RELOAD_MICROCODE_PATCH config. Expected to call this API being independent of CPU MP Init regular flow hence, doesn't regress the boot time. BUG=b:233199592 TEST=Build and boot google/kano to ChromeOS. Signed-off-by: Subrata Banik <subratabanik@google.com> Change-Id: If480e44b88d04e5cb25d7104961b70f7be041a23 Reviewed-on: https://review.coreboot.org/c/coreboot/+/65156 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Werner Zeh <werner.zeh@siemens.com> Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Diffstat (limited to 'src/cpu/intel/microcode/microcode.c')
-rw-r--r--src/cpu/intel/microcode/microcode.c32
1 files changed, 32 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(&microcode_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)