diff options
author | Simon Glass <sjg@chromium.org> | 2022-10-20 18:23:10 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-10-31 11:03:18 -0400 |
commit | d2b22ae23196604fda88e1ad9ec9f0e8fd285d07 (patch) | |
tree | de0c2bdf2ab67e2f95be3b1194ce1db53fe87f5e /boot/vbe_simple.c | |
parent | 70b26e4356f9153d2d8195748a0e146c35b0c42e (diff) |
vbe: Support reading the next SPL phase via VBE
Add an SPL loader to obtain the next-phase binary from a FIT provided
by the VBE driver.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'boot/vbe_simple.c')
-rw-r--r-- | boot/vbe_simple.c | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/boot/vbe_simple.c b/boot/vbe_simple.c index 076b650c25a..1ccd416e4bb 100644 --- a/boot/vbe_simple.c +++ b/boot/vbe_simple.c @@ -9,18 +9,19 @@ #define LOG_CATEGORY LOGC_BOOT #include <common.h> -#include <log.h> -#include <memalign.h> -#include <part.h> +#include <bootdev.h> #include <bootflow.h> #include <bootmeth.h> #include <dm.h> +#include <log.h> +#include <memalign.h> #include <mmc.h> #include <vbe.h> #include <version_string.h> #include <dm/device-internal.h> #include <dm/ofnode.h> #include <u-boot/crc.h> +#include "vbe_simple.h" enum { MAX_VERSION_LEN = 256, @@ -37,18 +38,6 @@ enum { NVD_HDR_VER_CUR = 1, /* current version */ }; -/** struct simple_priv - information read from the device tree */ -struct simple_priv { - u32 area_start; - u32 area_size; - u32 skip_offset; - u32 state_offset; - u32 state_size; - u32 version_offset; - u32 version_size; - const char *storage; -}; - /** struct simple_state - state information read from media * * @fw_version: Firmware version string @@ -183,15 +172,38 @@ static int vbe_simple_get_state_desc(struct udevice *dev, char *buf, static int vbe_simple_read_bootflow(struct udevice *dev, struct bootflow *bflow) { - /* To be implemented */ + int ret; + + if (vbe_phase() == VBE_PHASE_FIRMWARE) { + ret = vbe_simple_read_bootflow_fw(dev, bflow); + if (ret) + return log_msg_ret("fw", ret); + return 0; + } return -EINVAL; } +static int vbe_simple_read_file(struct udevice *dev, struct bootflow *bflow, + const char *file_path, ulong addr, ulong *sizep) +{ + int ret; + + if (vbe_phase() == VBE_PHASE_OS) { + ret = bootmeth_common_read_file(dev, bflow, file_path, addr, + sizep); + if (ret) + return log_msg_ret("os", ret); + } + + /* To be implemented */ + return -EINVAL; +} + static struct bootmeth_ops bootmeth_vbe_simple_ops = { .get_state_desc = vbe_simple_get_state_desc, .read_bootflow = vbe_simple_read_bootflow, - .read_file = bootmeth_common_read_file, + .read_file = vbe_simple_read_file, }; int vbe_simple_fixup_node(ofnode node, struct simple_state *state) |