Sugnan Prabhu S has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/46844 )
Change subject: soc/intel/jasperlake: Add support for calling microcode update API ......................................................................
soc/intel/jasperlake: Add support for calling microcode update API
This adds the entry function to call the main microcode update interface to enable microcode update for Jasperlake SoC and also implements the reboot function required.
BUG=b:149547271 TEST=Build and boot JSLRVP to OS
Change-Id: I49dec0f764f74fbd8caa0e15a932dcc4d4b90aaa Signed-off-by: Sugnan Prabhu S sugnan.prabhu.s@intel.com --- M src/soc/intel/jasperlake/Makefile.inc A src/soc/intel/jasperlake/ucode_update.c 2 files changed, 51 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/44/46844/1
diff --git a/src/soc/intel/jasperlake/Makefile.inc b/src/soc/intel/jasperlake/Makefile.inc index 1cba218..d32bf86 100644 --- a/src/soc/intel/jasperlake/Makefile.inc +++ b/src/soc/intel/jasperlake/Makefile.inc @@ -44,6 +44,7 @@ ramstage-y += systemagent.c ramstage-y += sd.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/jasperlake/ucode_update.c b/src/soc/intel/jasperlake/ucode_update.c new file mode 100644 index 0000000..cfe894b --- /dev/null +++ b/src/soc/intel/jasperlake/ucode_update.c @@ -0,0 +1,50 @@ + +/* 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) +{ + struct vb2_context *ctx; + + 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"); + 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); +