]>
Commit | Line | Data |
---|---|---|
d2b22ae2 SG |
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 <[email protected]> | |
7 | */ | |
8 | ||
9 | #ifndef __VBE_SIMPLE_H | |
10 | #define __VBE_SIMPLE_H | |
11 | ||
c263e21b SG |
12 | enum { |
13 | MAX_VERSION_LEN = 256, | |
14 | ||
15 | NVD_HDR_VER_SHIFT = 0, | |
16 | NVD_HDR_VER_MASK = 0xf, | |
17 | NVD_HDR_SIZE_SHIFT = 4, | |
18 | NVD_HDR_SIZE_MASK = 0xf << NVD_HDR_SIZE_SHIFT, | |
19 | ||
20 | /* Firmware key-version is in the top 16 bits of fw_ver */ | |
21 | FWVER_KEY_SHIFT = 16, | |
22 | FWVER_FW_MASK = 0xffff, | |
23 | ||
24 | NVD_HDR_VER_CUR = 1, /* current version */ | |
25 | }; | |
26 | ||
d2b22ae2 SG |
27 | /** struct simple_priv - information read from the device tree */ |
28 | struct simple_priv { | |
29 | u32 area_start; | |
30 | u32 area_size; | |
31 | u32 skip_offset; | |
32 | u32 state_offset; | |
33 | u32 state_size; | |
34 | u32 version_offset; | |
35 | u32 version_size; | |
36 | const char *storage; | |
37 | }; | |
38 | ||
c263e21b SG |
39 | /** struct simple_state - state information read from media |
40 | * | |
41 | * @fw_version: Firmware version string | |
42 | * @fw_vernum: Firmware version number | |
43 | */ | |
44 | struct simple_state { | |
45 | char fw_version[MAX_VERSION_LEN]; | |
46 | u32 fw_vernum; | |
47 | }; | |
48 | ||
d2b22ae2 SG |
49 | /** |
50 | * vbe_simple_read_fw_bootflow() - Read a bootflow for firmware | |
51 | * | |
52 | * Locates and loads the firmware image (FIT) needed for the next phase. The FIT | |
53 | * should ideally use external data, to reduce the amount of it that needs to be | |
54 | * read. | |
55 | * | |
56 | * @bdev: bootdev device containing the firmwre | |
57 | * @blow: Place to put the created bootflow, on success | |
58 | * @return 0 if OK, -ve on error | |
59 | */ | |
60 | int vbe_simple_read_bootflow_fw(struct udevice *dev, struct bootflow *bflow); | |
61 | ||
c263e21b SG |
62 | /** |
63 | * vbe_simple_read_state() - Read the VBE simple state information | |
64 | * | |
65 | * @dev: VBE bootmeth | |
66 | * @state: Place to put the state | |
67 | * @return 0 if OK, -ve on error | |
68 | */ | |
69 | int vbe_simple_read_state(struct udevice *dev, struct simple_state *state); | |
70 | ||
d2b22ae2 | 71 | #endif /* __VBE_SIMPLE_H */ |