coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
vboot_common.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #ifndef __VBOOT_VBOOT_COMMON_H__
3 #define __VBOOT_VBOOT_COMMON_H__
4 
5 #include <commonlib/region.h>
6 #include <cbfs.h>
7 #include <vb2_api.h>
8 
9 /*
10  * Function to check if there is a request to enter recovery mode. Returns
11  * reason code if request to enter recovery mode is present, otherwise 0.
12  */
14 
15 /* ============================ VBOOT REBOOT ============================== */
16 /*
17  * vboot_reboot handles the reboot requests made by vboot_reference library. It
18  * allows the platform to run any preparation steps before the reboot and then
19  * does a hard reset.
20  */
21 void vboot_reboot(void);
22 
23 /* Allow the platform to do any clean up work when vboot requests a reboot. */
25 
26 /* ============================ VBOOT RESUME ============================== */
27 /*
28  * Save the provided hash digest to a secure location to check against in
29  * the resume path. Returns 0 on success, < 0 on error.
30  */
31 int vboot_save_hash(void *digest, size_t digest_size);
32 
33 /*
34  * Retrieve the previously saved hash digest. Returns 0 on success,
35  * < 0 on error.
36  */
37 int vboot_retrieve_hash(void *digest, size_t digest_size);
38 
39 /* ============================= VERSTAGE ================================== */
40 /*
41  * Main logic for verified boot. verstage_main() is just the core vboot logic.
42  * If the verstage is a separate stage, it should be entered via main().
43  */
44 void verstage_main(void);
46 void verstage_mainboard_init(void);
47 
48 /* Check boot modes */
49 #if CONFIG(VBOOT) && !ENV_SMM
52 int vboot_can_enable_udc(void);
53 void vboot_run_logic(void);
55 #else /* !CONFIG_VBOOT */
56 static inline int vboot_developer_mode_enabled(void) { return 0; }
57 static inline int vboot_recovery_mode_enabled(void) { return 0; }
58 /* If VBOOT is not enabled, we are okay enabling USB device controller (UDC). */
59 static inline int vboot_can_enable_udc(void) { return 1; }
60 static inline void vboot_run_logic(void) {}
61 static inline const struct cbfs_boot_device *vboot_get_cbfs_boot_device(void)
62 {
63  return NULL;
64 }
65 #endif
66 
67 void vboot_save_data(struct vb2_context *ctx);
68 
69 /*
70  * The API for performing EC software sync. Does not support
71  * "slow" updates or Auxiliary FW sync.
72  */
73 void vboot_sync_ec(void);
74 
75 #endif /* __VBOOT_VBOOT_COMMON_H__ */
#define NULL
Definition: stddef.h:19
void vboot_save_data(struct vb2_context *ctx)
Definition: vboot_common.c:12
static const struct cbfs_boot_device * vboot_get_cbfs_boot_device(void)
Definition: vboot_common.h:61
void vboot_platform_prepare_reboot(void)
Definition: vboot.c:52
static int vboot_developer_mode_enabled(void)
Definition: vboot_common.h:56
int vboot_check_recovery_request(void)
Definition: bootmode.c:16
int vboot_retrieve_hash(void *digest, size_t digest_size)
Definition: vboot_storage.c:43
static int vboot_recovery_mode_enabled(void)
Definition: vboot_common.h:57
static int vboot_can_enable_udc(void)
Definition: vboot_common.h:59
static void vboot_run_logic(void)
Definition: vboot_common.h:60
void verstage_mainboard_early_init(void)
Definition: verstage.c:11
void vboot_sync_ec(void)
Definition: ec_sync.c:40
void vboot_reboot(void)
Definition: vboot_common.c:60
int vboot_save_hash(void *digest, size_t digest_size)
Definition: vboot_storage.c:11
void verstage_mainboard_init(void)
Definition: verstage.c:41
void verstage_main(void)
Verify and select the firmware in the RW image.
Definition: vboot_logic.c:245