Jamie Ryu has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/46644 )
Change subject: [WIP] soc/intel/tigerlake: Add support for calling microcode update API ......................................................................
[WIP] soc/intel/tigerlake: Add support for calling microcode update API
This adds the entry function to call the main microcode update interface to enable microcode update for Tigerlake SoC and also implements the reboot function required.
BUG=b:149547271 TEST=Build and boot volteer2 to OS
Signed-off-by: Jamie Ryu jamie.m.ryu@intel.com Change-Id: Id60b9828498d1474193e238ec26da26ac322620e --- M src/soc/intel/tigerlake/Makefile.inc A src/soc/intel/tigerlake/ucode_update.c 2 files changed, 49 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/44/46644/1
diff --git a/src/soc/intel/tigerlake/Makefile.inc b/src/soc/intel/tigerlake/Makefile.inc index c4f71c7..b9b0e8c 100644 --- a/src/soc/intel/tigerlake/Makefile.inc +++ b/src/soc/intel/tigerlake/Makefile.inc @@ -44,6 +44,7 @@ ramstage-y += soundwire.c ramstage-y += systemagent.c ramstage-y += me.c +ramstage-$(CONFIG_INTEL_TOP_SWAP_MULTI_FIT_UCODE_UPDATE) += ucode_update.c
smm-y += gpio.c smm-y += p2sb.c diff --git a/src/soc/intel/tigerlake/ucode_update.c b/src/soc/intel/tigerlake/ucode_update.c new file mode 100644 index 0000000..d24e487 --- /dev/null +++ b/src/soc/intel/tigerlake/ucode_update.c @@ -0,0 +1,48 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <bootstate.h> +#include <console/console.h> +#include <halt.h> +#include <intelbasecode/ucode_update.h> +#include <reset.h> +#include <security/vboot/misc.h> +#include <security/vboot/vboot_common.h> +#include <soc/intel/common/reset.h> +#include <vb2_api.h> + +static void update_ucode(void *unused) +{ + if (CONFIG(INTEL_TOP_SWAP_MULTI_FIT_UCODE_UPDATE)) { + if (update_ucode_and_topswap_state()) { + /* Update failed */ + if (CONFIG(VBOOT)) { + printk(BIOS_DEBUG, "ucode: Failed to update microcode\n"); + struct vb2_context *ctx = vboot_get_context(); + if (ctx == NULL) + die("ucode: Failed to trigger recovery mode\n"); + vb2api_fail(ctx, 0x36, 0x0); + vboot_save_data(ctx); + vboot_reboot(); + } + } + } +} + + +void ucode_update_reboot(void) +{ + if (CONFIG(VBOOT)) + vboot_reboot(); + else + do_board_reset(); + + die("ucode: Failed to reset the system\n"); + halt(); +} + +int ucode_update_rec_mode_enabled(void) +{ + return vboot_recovery_mode_enabled(); +} + +BOOT_STATE_INIT_ENTRY(BS_PRE_DEVICE, BS_ON_ENTRY, update_ucode, NULL);