1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Verified Boot for Embedded (VBE) vbe-simple common file
4  *
5  * Copyright 2022 Google LLC
6  * Written by Simon Glass <sjg@chromium.org>
7  */
8 
9 #ifndef __VBE_SIMPLE_H
10 #define __VBE_SIMPLE_H
11 
12 #include <linux/types.h>
13 #include "vbe_common.h"
14 
15 /** struct simple_priv - information read from the device tree */
16 struct simple_priv {
17 	u32 area_start;
18 	u32 area_size;
19 	u32 skip_offset;
20 	u32 state_offset;
21 	u32 state_size;
22 	u32 version_offset;
23 	u32 version_size;
24 	const char *storage;
25 };
26 
27 /** struct simple_state - state information read from media
28  *
29  * @fw_version: Firmware version string
30  * @fw_vernum: Firmware version number
31  */
32 struct simple_state {
33 	char fw_version[MAX_VERSION_LEN];
34 	u32 fw_vernum;
35 };
36 
37 /**
38  * vbe_simple_read_fw_bootflow() - Read a bootflow for firmware
39  *
40  * Locates and loads the firmware image (FIT) needed for the next phase. The FIT
41  * should ideally use external data, to reduce the amount of it that needs to be
42  * read.
43  *
44  * @bdev: bootdev device containing the firmwre
45  * @blow: Place to put the created bootflow, on success
46  * @return 0 if OK, -ve on error
47  */
48 int vbe_simple_read_bootflow_fw(struct udevice *dev, struct bootflow *bflow);
49 
50 /**
51  * vbe_simple_read_state() - Read the VBE simple state information
52  *
53  * @dev: VBE bootmeth
54  * @state: Place to put the state
55  * @return 0 if OK, -ve on error
56  */
57 int vbe_simple_read_state(struct udevice *dev, struct simple_state *state);
58 
59 #endif /* __VBE_SIMPLE_H */
60