mb/google/nissa/var/rull: add ssd timing and modify ssd GPIO pins of rtd3
[coreboot2.git] / src / security / vboot / vboot_common.h
blob2399bf30cec5547bebe40d03dec82241ca948643
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #ifndef __VBOOT_VBOOT_COMMON_H__
3 #define __VBOOT_VBOOT_COMMON_H__
5 #include <commonlib/region.h>
6 #include <cbfs.h>
7 #include <vb2_api.h>
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.
13 int vboot_check_recovery_request(void);
15 /* ============================ VBOOT REBOOT ============================== */
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.
21 void vboot_reboot(void);
24 * Save vboot data and reboot device. Subcode will only be printed. To store
25 * failure reason and subcode vb2api_fail() should be called before this
26 * function or vboot_fail_and_reboot() should be used instead.
28 void vboot_save_and_reboot(struct vb2_context *ctx, uint8_t subcode);
30 /* Call vb2api_fail() with reason and subcode, save vboot data and reboot. */
31 void vboot_fail_and_reboot(struct vb2_context *ctx, uint8_t reason, uint8_t subcode);
33 /* Allow the platform to do any clean up work when vboot requests a reboot. */
34 void vboot_platform_prepare_reboot(void);
36 /* ============================ VBOOT RESUME ============================== */
38 * Save the provided hash digest to a secure location to check against in
39 * the resume path. Returns 0 on success, < 0 on error.
41 int vboot_save_hash(void *digest, size_t digest_size);
44 * Retrieve the previously saved hash digest. Returns 0 on success,
45 * < 0 on error.
47 int vboot_retrieve_hash(void *digest, size_t digest_size);
49 /* ============================= VERSTAGE ================================== */
51 * Main logic for verified boot. verstage_main() is just the core vboot logic.
52 * If the verstage is a separate stage, it should be entered via main().
54 void verstage_main(void);
55 void verstage_mainboard_early_init(void);
56 void verstage_mainboard_init(void);
58 /* Check boot modes */
59 #if CONFIG(VBOOT) && !ENV_SMM
60 int vboot_developer_mode_enabled(void);
61 int vboot_recovery_mode_enabled(void);
62 int vboot_can_enable_udc(void);
63 void vboot_run_logic(void);
64 const struct cbfs_boot_device *vboot_get_cbfs_boot_device(void);
65 #else /* !CONFIG_VBOOT */
66 static inline int vboot_developer_mode_enabled(void) { return 0; }
67 static inline int vboot_recovery_mode_enabled(void) { return 0; }
68 /* If VBOOT is not enabled, we are okay enabling USB device controller (UDC). */
69 static inline int vboot_can_enable_udc(void) { return 1; }
70 static inline void vboot_run_logic(void) {}
71 static inline const struct cbfs_boot_device *vboot_get_cbfs_boot_device(void)
73 return NULL;
75 #endif
77 void vboot_save_data(struct vb2_context *ctx);
80 * The API for performing EC software sync. Does not support
81 * "slow" updates or Auxiliary FW sync.
83 void vboot_sync_ec(void);
85 #endif /* __VBOOT_VBOOT_COMMON_H__ */