1 /* SPDX-License-Identifier: BSD-3-Clause */
3 #include <libpayload-config.h>
4 #include <arch/virtual.h>
6 #include <libpayload.h>
13 struct vb2_context
*vboot_get_context(void)
15 static struct vb2_context
*ctx
;
20 die_if(lib_sysinfo
.vboot_workbuf
== 0, "vboot workbuf pointer is not set\n");
22 /* Use the firmware verification workbuf from coreboot. */
23 vb2_error_t rv
= vb2api_reinit(phys_to_virt(lib_sysinfo
.vboot_workbuf
), &ctx
);
25 die_if(rv
, "vboot workbuf could not be initialized, error: %#x\n", rv
);
30 void vboot_fail_and_reboot(struct vb2_context
*ctx
, uint8_t reason
, uint8_t subcode
)
33 vb2api_fail(ctx
, reason
, subcode
);
35 printf("vboot: reboot requested (reason: %#x, subcode %#x)", reason
, subcode
);
36 vb2ex_commit_data(ctx
);
40 int vboot_recovery_mode_enabled(void)
42 return !!(vboot_get_context()->flags
& VB2_CONTEXT_RECOVERY_MODE
);