]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
x86: zboot: Move environment setting into zboot_load()
authorSimon Glass <sjg@chromium.org>
Mon, 4 Dec 2023 00:29:31 +0000 (17:29 -0700)
committerTom Rini <trini@konsulko.com>
Wed, 10 Apr 2024 19:49:16 +0000 (13:49 -0600)
The only difference between the command and the underlying logic is the
setting of envrionment variables. Move this out of the command
processing since it needs to be done in any case.

Signed-off-by: Simon Glass <sjg@chromium.org>
arch/x86/lib/zimage.c
cmd/x86/zboot.c

index 1d1249fc25acc74b92452a3b878297115845c38e..b72e2f01bd578c32fb84c3f9ef7c5eece520a886 100644 (file)
@@ -370,6 +370,7 @@ int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot,
 int zboot_load(void)
 {
        struct boot_params *base_ptr;
+       int ret;
 
        if (state.base_ptr) {
                struct boot_params *from = (struct boot_params *)state.base_ptr;
@@ -389,6 +390,12 @@ int zboot_load(void)
        }
        state.base_ptr = base_ptr;
 
+       ret = env_set_hex("zbootbase", map_to_sysmem(state.base_ptr));
+       if (!ret)
+               ret = env_set_hex("zbootaddr", state.load_address);
+       if (ret)
+               return ret;
+
        return 0;
 }
 
index f5c90a8ba8964cd3503676f4eeb1f0e3d5ca8115..d39ab6a9698f66ade0910cb5e61e4885ea028ab8 100644 (file)
@@ -62,30 +62,18 @@ static int do_zboot_start(struct cmd_tbl *cmdtp, int flag, int argc,
        return 0;
 }
 
-static int _zboot_load(void)
+static int do_zboot_load(struct cmd_tbl *cmdtp, int flag, int argc,
+                        char *const argv[])
 {
        int ret;
 
        ret = zboot_load();
-       if (!ret)
-               ret = env_set_hex("zbootbase", map_to_sysmem(state.base_ptr));
-       if (!ret)
-               ret = env_set_hex("zbootaddr", state.load_address);
        if (ret)
                return ret;
 
        return 0;
 }
 
-static int do_zboot_load(struct cmd_tbl *cmdtp, int flag, int argc,
-                        char *const argv[])
-{
-       if (_zboot_load())
-               return CMD_RET_FAILURE;
-
-       return 0;
-}
-
 static int _zboot_setup(void)
 {
        struct boot_params *base_ptr = state.base_ptr;