summaryrefslogtreecommitdiffstats
path: root/payloads/libpayload/include
diff options
context:
space:
mode:
authorJakub Czapiga <jacz@semihalf.com>2023-09-08 13:19:00 +0000
committerMartin L Roth <gaumless@gmail.com>2023-09-18 15:42:31 +0000
commitb2163ea84b683d6dc4630125b9921a5c681ed434 (patch)
tree14d3c06e3be256aa22d60a2e04244eb1114e3822 /payloads/libpayload/include
parent971c9442f6d240b0d6af78674fced4001fc50f57 (diff)
downloadcoreboot-b2163ea84b683d6dc4630125b9921a5c681ed434.tar.gz
coreboot-b2163ea84b683d6dc4630125b9921a5c681ed434.tar.bz2
coreboot-b2163ea84b683d6dc4630125b9921a5c681ed434.zip
libpayload: Add vboot and reboot utility functions
Patch adds: - vboot_fail_and_reboot() for vboot failures handling. - reboot() weak implementation for payloads to implement, used by vboot_fail_and_reboot(). - vboot_recovery_mode_enabled() to check if recovery mode flag is set in vboot context. Implemented for future libcbfs implementation of VBOOT_CBFS_INTEGRATION in libpayload. BUG=b:197114807 TEST=none Change-Id: I53d1955573d54bc56d05f7780c18dcc8ac1fd399 Signed-off-by: Jakub Czapiga <jacz@semihalf.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/77725 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Yu-Ping Wu <yupingso@google.com> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
Diffstat (limited to 'payloads/libpayload/include')
-rw-r--r--payloads/libpayload/include/libpayload.h7
-rw-r--r--payloads/libpayload/include/lp_vboot.h9
2 files changed, 16 insertions, 0 deletions
diff --git a/payloads/libpayload/include/libpayload.h b/payloads/libpayload/include/libpayload.h
index 35f2bd735b9c..e3c60ac18917 100644
--- a/payloads/libpayload/include/libpayload.h
+++ b/payloads/libpayload/include/libpayload.h
@@ -414,6 +414,13 @@ void mouse_cursor_add_input_driver(struct mouse_cursor_input_driver *in);
* @{
*/
int exec(long addr, int argc, char **argv);
+
+/*
+ * reboot() handles reboot requests made by libpayload. It has weak implementation
+ * which should be overridden by payload.
+ */
+void __noreturn reboot(void);
+
/** @} */
/**
diff --git a/payloads/libpayload/include/lp_vboot.h b/payloads/libpayload/include/lp_vboot.h
index 56ec46024e50..bdbdc74c3795 100644
--- a/payloads/libpayload/include/lp_vboot.h
+++ b/payloads/libpayload/include/lp_vboot.h
@@ -7,4 +7,13 @@
struct vb2_context *vboot_get_context(void);
+/*
+ * Call vb2api_fail() with reason and subcode, save vboot data with vb2ex_commit_data()
+ * and reboot with vboot_reboot().
+ */
+void vboot_fail_and_reboot(struct vb2_context *ctx, uint8_t reason, uint8_t subcode);
+
+/* Returns non-zero if recovery mode is enabled. */
+int vboot_recovery_mode_enabled(void);
+
#endif /* _LP_VBOOT_H_ */