blob: dc3f70052b0f6a0e071bade5eb0e48f989671d21 [file] [log] [blame]
Simon Glassd78aa752022-10-20 18:23:10 -06001/* 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
Simon Glassfdacd502025-01-15 18:27:03 -070012#include <linux/types.h>
13#include "vbe_common.h"
Simon Glass39db1992022-10-20 18:23:11 -060014
Simon Glassd78aa752022-10-20 18:23:10 -060015/** struct simple_priv - information read from the device tree */
16struct 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
Simon Glass39db1992022-10-20 18:23:11 -060027/** struct simple_state - state information read from media
28 *
29 * @fw_version: Firmware version string
30 * @fw_vernum: Firmware version number
31 */
32struct simple_state {
33 char fw_version[MAX_VERSION_LEN];
34 u32 fw_vernum;
35};
36
Simon Glassd78aa752022-10-20 18:23:10 -060037/**
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 */
48int vbe_simple_read_bootflow_fw(struct udevice *dev, struct bootflow *bflow);
49
Simon Glass39db1992022-10-20 18:23:11 -060050/**
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 */
57int vbe_simple_read_state(struct udevice *dev, struct simple_state *state);
58
Simon Glassd78aa752022-10-20 18:23:10 -060059#endif /* __VBE_SIMPLE_H */