vboot: Introduce handy vboot reboot functions

This patch groups vboot context, recovery reason and subcode saving, and
reboot calls into two handy functions:
- vboot_save_and_reboot() - save context and reboot
- vboot_fail_and_reboot() - store recovery reason and call function
  above

Signed-off-by: Jakub Czapiga <jacz@semihalf.com>
Change-Id: Ie29410e8985e7cf19bd8d4cccc393b050ca1f1c5
Reviewed-on: https://review.coreboot.org/c/coreboot/+/69208
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
This commit is contained in:
Jakub Czapiga
2022-11-04 12:18:04 +00:00
committed by Felix Held
parent 699b833bd7
commit 605f793af8
5 changed files with 42 additions and 44 deletions

View File

@@ -931,15 +931,10 @@ void cse_trigger_vboot_recovery(enum csme_failure_reason reason)
"HFSTS3: 0x%x\n", me_read_config32(PCI_ME_HFSTS1),
me_read_config32(PCI_ME_HFSTS2), me_read_config32(PCI_ME_HFSTS3));
if (CONFIG(VBOOT)) {
struct vb2_context *ctx = vboot_get_context();
if (ctx == NULL)
goto failure;
vb2api_fail(ctx, VB2_RECOVERY_INTEL_CSE_LITE_SKU, reason);
vboot_save_data(ctx);
vboot_reboot();
}
failure:
if (CONFIG(VBOOT))
vboot_fail_and_reboot(vboot_get_context(), VB2_RECOVERY_INTEL_CSE_LITE_SKU,
reason);
die("cse: Failed to trigger recovery mode(recovery subcode:%d)\n", reason);
}