aboutsummaryrefslogtreecommitdiff
path: root/src/security/vboot/vboot_common.c
diff options
context:
space:
mode:
authorJakub Czapiga <jacz@semihalf.com>2022-11-04 12:18:04 +0000
committerFelix Held <felix-coreboot@felixheld.de>2022-11-08 14:44:54 +0000
commit605f793af84733eda416533ccf5b220c0f5a171b (patch)
tree1ef966bbab9c4295fe08e76041492e1a7f8f572e /src/security/vboot/vboot_common.c
parent699b833bd778954c0b3b8a3b856cf7af0668ad4c (diff)
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>
Diffstat (limited to 'src/security/vboot/vboot_common.c')
-rw-r--r--src/security/vboot/vboot_common.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/security/vboot/vboot_common.c b/src/security/vboot/vboot_common.c
index c557f25c14..8ecb5d81eb 100644
--- a/src/security/vboot/vboot_common.c
+++ b/src/security/vboot/vboot_common.c
@@ -64,3 +64,18 @@ void vboot_reboot(void)
vboot_platform_prepare_reboot();
board_reset();
}
+
+void vboot_save_and_reboot(struct vb2_context *ctx, uint8_t subcode)
+{
+ printk(BIOS_INFO, "vboot: reboot requested (%#x)\n", subcode);
+ vboot_save_data(ctx);
+ vboot_reboot();
+}
+
+void vboot_fail_and_reboot(struct vb2_context *ctx, uint8_t reason, uint8_t subcode)
+{
+ if (reason)
+ vb2api_fail(ctx, reason, subcode);
+
+ vboot_save_and_reboot(ctx, subcode);
+}