diff options
author | Simon Glass <sjg@chromium.org> | 2025-01-15 18:27:08 -0700 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2025-01-22 09:47:49 -0600 |
commit | 47e56185084941f3bccc8b8352260ba2ee5e5e56 (patch) | |
tree | e9fe386597e64d7305c82beab6c8b737e32ec5de /boot/vbe_simple.c | |
parent | 190b128252b3861865d63c73ac9f13731aeb950f (diff) |
vbe: Move reading the version into the common file
All VBE methods read a version string, so move this function into a
common file.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'boot/vbe_simple.c')
-rw-r--r-- | boot/vbe_simple.c | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/boot/vbe_simple.c b/boot/vbe_simple.c index 8a370cf02ef..ad98ac37197 100644 --- a/boot/vbe_simple.c +++ b/boot/vbe_simple.c @@ -21,33 +21,6 @@ #include <u-boot/crc.h> #include "vbe_simple.h" -static int simple_read_version(const struct simple_priv *priv, - struct udevice *blk, u8 *buf, - struct simple_state *state) -{ - int start; - - /* we can use an assert() here since we already read only one block */ - assert(priv->version_size <= MMC_MAX_BLOCK_LEN); - - start = priv->area_start + priv->version_offset; - - /* - * we can use an assert() here since reading the wrong block will just - * cause an invalid version-string to be (safely) read - */ - assert(!(start & (MMC_MAX_BLOCK_LEN - 1))); - - start /= MMC_MAX_BLOCK_LEN; - - if (blk_read(blk, start, 1, buf) != 1) - return log_msg_ret("read", -EIO); - strlcpy(state->fw_version, buf, MAX_VERSION_LEN); - log_debug("version=%s\n", state->fw_version); - - return 0; -} - static int simple_read_nvdata(const struct simple_priv *priv, struct udevice *blk, u8 *buf, struct simple_state *state) @@ -105,7 +78,8 @@ int vbe_simple_read_state(struct udevice *dev, struct simple_state *state) if (ret) return log_msg_ret("blk", ret); - ret = simple_read_version(priv, blk, buf, state); + ret = vbe_read_version(blk, priv->area_start + priv->version_offset, + state->fw_version, MAX_VERSION_LEN); if (ret) return log_msg_ret("ver", ret); |