Prepare v2025.01
[u-boot.git] / include / vbe.h
blob56bff63362f2c89c56d02b8967b6f1b98fe833de
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3 * Verified Boot for Embedded (VBE) support
4 * See doc/develop/vbe.rst
6 * Copyright 2022 Google LLC
7 * Written by Simon Glass <sjg@chromium.org>
8 */
10 #ifndef __VBE_H
11 #define __VBE_H
13 /**
14 * enum vbe_phase_t - current phase of VBE
16 * VBE operates in two distinct phases. In VPL it has to choose which firmware
17 * to run (SPL, U-Boot, OP-TEE, etc.). It then carries on running until it gets
18 * to U-Boot, where it decides which OS to run
20 * @VBE_PHASE_FIRMWARE: Selecting the firmware to run
21 * @VBE_PHASE_OS: Selecting the Operating System to run
23 enum vbe_phase_t {
24 VBE_PHASE_FIRMWARE,
25 VBE_PHASE_OS,
28 /**
29 * struct vbe_handoff - information about VBE progress
31 * @phases: Indicates which phases used the VBE bootmeth (1 << PHASE_...)
33 struct vbe_handoff {
34 u8 phases;
37 /**
38 * vbe_phase() - get current VBE phase
40 * Returns: Current VBE phase
42 static inline enum vbe_phase_t vbe_phase(void)
44 if (IS_ENABLED(CONFIG_XPL_BUILD))
45 return VBE_PHASE_FIRMWARE;
47 return VBE_PHASE_OS;
50 /**
51 * vbe_list() - List the VBE bootmeths
53 * This shows a list of the VBE bootmeth devices
55 * @return 0 (always)
57 int vbe_list(void);
59 /**
60 * vbe_find_by_any() - Find a VBE bootmeth by name or sequence
62 * @name: name (e.g. "vbe-simple"), or sequence ("2") to find
63 * @devp: returns the device found, on success
64 * Return: 0 if OK, -ve on error
66 int vbe_find_by_any(const char *name, struct udevice **devp);
68 /**
69 * vbe_find_first_device() - Find the first VBE bootmeth
71 * @devp: Returns first available VBE bootmeth, or NULL if none
72 * Returns: 0 (always)
74 int vbe_find_first_device(struct udevice **devp);
76 /**
77 * vbe_find_next_device() - Find the next available VBE bootmeth
79 * @devp: Previous device to start from. Returns next available VBE bootmeth,
80 * or NULL if none
81 * Returns: 0 (always)
83 int vbe_find_next_device(struct udevice **devp);
85 #endif