[U-Boot] [PATCH v5 11/19] common: converted with new env interfaces
AKASHI Takahiro
takahiro.akashi at linaro.org
Thu Sep 5 08:21:25 UTC 2019
env_xxx(...) -> env_xxx(ctx_uboot, ...)
Signed-off-by: AKASHI Takahiro <takahiro.akashi at linaro.org>
---
common/autoboot.c | 22 ++++++++++++----------
common/board_f.c | 3 ++-
common/board_r.c | 10 +++++-----
common/bootm.c | 12 +++++++-----
common/bootm_os.c | 12 ++++++------
common/bootretry.c | 2 +-
common/cli.c | 2 +-
common/cli_hush.c | 14 +++++++-------
common/cli_simple.c | 2 +-
common/command.c | 2 +-
common/console.c | 14 +++++++-------
common/fdt_support.c | 6 +++---
common/hash.c | 4 ++--
common/hwconfig.c | 5 +++--
common/image-android.c | 4 ++--
common/image-fdt.c | 4 ++--
common/image.c | 15 ++++++++-------
common/main.c | 5 +++--
common/spl/spl_dfu.c | 6 +++---
common/spl/spl_ext.c | 4 ++--
common/spl/spl_fat.c | 4 ++--
common/spl/spl_net.c | 4 ++--
common/splash.c | 4 ++--
common/splash_source.c | 8 ++++----
common/update.c | 10 +++++-----
common/usb_hub.c | 2 +-
common/usb_kbd.c | 6 +++---
27 files changed, 97 insertions(+), 89 deletions(-)
diff --git a/common/autoboot.c b/common/autoboot.c
index b28bd6823d82..d28ea5f97a62 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -71,7 +71,7 @@ static int slow_equals(u8 *a, u8 *b, int len)
*/
static int passwd_abort_sha256(uint64_t etime)
{
- const char *sha_env_str = env_get("bootstopkeysha256");
+ const char *sha_env_str = env_get(ctx_uboot, "bootstopkeysha256");
u8 sha_env[SHA256_SUM_LEN];
u8 *sha;
char *presskey;
@@ -146,8 +146,8 @@ static int passwd_abort_key(uint64_t etime)
int retry;
}
delaykey[] = {
- { .str = env_get("bootdelaykey"), .retry = 1 },
- { .str = env_get("bootstopkey"), .retry = 0 },
+ { .str = env_get(ctx_uboot, "bootdelaykey"), .retry = 1 },
+ { .str = env_get(ctx_uboot, "bootstopkey"), .retry = 0 },
};
char presskey[MAX_DELAY_STOP_STR];
@@ -308,12 +308,14 @@ static void process_fdt_options(const void *blob)
/* Add an env variable to point to a kernel payload, if available */
addr = fdtdec_get_config_int(gd->fdt_blob, "kernel-offset", 0);
if (addr)
- env_set_addr("kernaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr));
+ env_set_addr(ctx_uboot, "kernaddr",
+ (void *)(CONFIG_SYS_TEXT_BASE + addr));
/* Add an env variable to point to a root disk, if available */
addr = fdtdec_get_config_int(gd->fdt_blob, "rootdisk-offset", 0);
if (addr)
- env_set_addr("rootaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr));
+ env_set_addr(ctx_uboot, "rootaddr",
+ (void *)(CONFIG_SYS_TEXT_BASE + addr));
#endif /* CONFIG_SYS_TEXT_BASE */
}
@@ -324,7 +326,7 @@ const char *bootdelay_process(void)
bootcount_inc();
- s = env_get("bootdelay");
+ s = env_get(ctx_uboot, "bootdelay");
bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY;
if (IS_ENABLED(CONFIG_OF_CONTROL))
@@ -339,13 +341,13 @@ const char *bootdelay_process(void)
#ifdef CONFIG_POST
if (gd->flags & GD_FLG_POSTFAIL) {
- s = env_get("failbootcmd");
+ s = env_get(ctx_uboot, "failbootcmd");
} else
#endif /* CONFIG_POST */
if (bootcount_error())
- s = env_get("altbootcmd");
+ s = env_get(ctx_uboot, "altbootcmd");
else
- s = env_get("bootcmd");
+ s = env_get(ctx_uboot, "bootcmd");
if (IS_ENABLED(CONFIG_OF_CONTROL))
process_fdt_options(gd->fdt_blob);
@@ -375,7 +377,7 @@ void autoboot_command(const char *s)
if (IS_ENABLED(CONFIG_USE_AUTOBOOT_MENUKEY) &&
menukey == AUTOBOOT_MENUKEY) {
- s = env_get("menucmd");
+ s = env_get(ctx_uboot, "menucmd");
if (s)
run_command_list(s, -1, 0);
}
diff --git a/common/board_f.c b/common/board_f.c
index 6867abc8e679..cb0ccdd80cab 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -122,7 +122,8 @@ __weak void board_add_ram_info(int use_default)
static int init_baud_rate(void)
{
- gd->baudrate = env_get_ulong("baudrate", 10, CONFIG_BAUDRATE);
+ gd->baudrate = env_get_ulong(ctx_uboot, "baudrate", 10,
+ CONFIG_BAUDRATE);
return 0;
}
diff --git a/common/board_r.c b/common/board_r.c
index b7f68bba4a7e..b2941c58599d 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -448,14 +448,14 @@ static int initr_env(void)
if (should_load_env())
env_relocate();
else
- env_set_default(NULL, 0);
+ env_set_default(ctx_uboot, NULL, 0);
#ifdef CONFIG_OF_CONTROL
- env_set_hex("fdtcontroladdr",
+ env_set_hex(ctx_uboot, "fdtcontroladdr",
(unsigned long)map_to_sysmem(gd->fdt_blob));
#endif
/* Initialize from environment */
- load_addr = env_get_ulong("loadaddr", 16, load_addr);
+ load_addr = env_get_ulong(ctx_uboot, "loadaddr", 16, load_addr);
return 0;
}
@@ -607,9 +607,9 @@ int initr_mem(void)
ulong pram = 0;
char memsz[32];
- pram = env_get_ulong("pram", 10, CONFIG_PRAM);
+ pram = env_get_ulong(ctx_uboot, "pram", 10, CONFIG_PRAM);
sprintf(memsz, "%ldk", (long int)((gd->ram_size / 1024) - pram));
- env_set("mem", memsz);
+ env_set(ctx_uboot, "mem", memsz);
return 0;
}
diff --git a/common/bootm.c b/common/bootm.c
index 02295daf79f1..c367b409f29d 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -440,7 +440,7 @@ static void fixup_silent_linux(void)
{
char *buf;
const char *env_val;
- char *cmdline = env_get("bootargs");
+ char *cmdline = env_get(ctx_uboot, "bootargs");
int want_silent;
/*
@@ -485,7 +485,7 @@ static void fixup_silent_linux(void)
env_val = CONSOLE_ARG;
}
- env_set("bootargs", env_val);
+ env_set(ctx_uboot, "bootargs", env_val);
debug("after silent fix-up: %s\n", env_val);
free(buf);
}
@@ -556,8 +556,10 @@ int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
ret = boot_ramdisk_high(&images->lmb, images->rd_start,
rd_len, &images->initrd_start, &images->initrd_end);
if (!ret) {
- env_set_hex("initrd_start", images->initrd_start);
- env_set_hex("initrd_end", images->initrd_end);
+ env_set_hex(ctx_uboot, "initrd_start",
+ images->initrd_start);
+ env_set_hex(ctx_uboot, "initrd_end",
+ images->initrd_end);
}
}
#endif
@@ -602,7 +604,7 @@ int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
#ifdef CONFIG_TRACE
/* Pretend to run the OS, then run a user command */
if (!ret && (states & BOOTM_STATE_OS_FAKE_GO)) {
- char *cmd_list = env_get("fakegocmd");
+ char *cmd_list = env_get(ctx_uboot, "fakegocmd");
ret = boot_selected_os(argc, argv, BOOTM_STATE_OS_FAKE_GO,
images, boot_fn);
diff --git a/common/bootm_os.c b/common/bootm_os.c
index 6fb7d658da69..19b728d2cc7c 100644
--- a/common/bootm_os.c
+++ b/common/bootm_os.c
@@ -22,9 +22,9 @@ static int do_bootm_standalone(int flag, int argc, char * const argv[],
int (*appl)(int, char *const[]);
/* Don't start if "autostart" is set to "no" */
- s = env_get("autostart");
+ s = env_get(ctx_uboot, "autostart");
if ((s != NULL) && !strcmp(s, "no")) {
- env_set_hex("filesize", images->os.image_len);
+ env_set_hex(ctx_uboot, "filesize", images->os.image_len);
return 0;
}
appl = (int (*)(int, char * const []))images->ep;
@@ -97,7 +97,7 @@ static int do_bootm_netbsd(int flag, int argc, char * const argv[],
cmdline = malloc(len);
copy_args(cmdline, argc, argv, ' ');
} else {
- cmdline = env_get("bootargs");
+ cmdline = env_get(ctx_uboot, "bootargs");
if (cmdline == NULL)
cmdline = "";
}
@@ -228,14 +228,14 @@ static int do_bootm_plan9(int flag, int argc, char * const argv[],
#endif
/* See README.plan9 */
- s = env_get("confaddr");
+ s = env_get(ctx_uboot, "confaddr");
if (s != NULL) {
char *confaddr = (char *)simple_strtoul(s, NULL, 16);
if (argc > 0) {
copy_args(confaddr, argc, argv, '\n');
} else {
- s = env_get("bootargs");
+ s = env_get(ctx_uboot, "bootargs");
if (s != NULL)
strcpy(confaddr, s);
}
@@ -282,7 +282,7 @@ static void do_bootvx_fdt(bootm_headers_t *images)
ret = fdt_add_subnode(*of_flat_tree, 0, "chosen");
if ((ret >= 0 || ret == -FDT_ERR_EXISTS)) {
- bootline = env_get("bootargs");
+ bootline = env_get(ctx_uboot, "bootargs");
if (bootline) {
ret = fdt_find_and_setprop(*of_flat_tree,
"/chosen", "bootargs",
diff --git a/common/bootretry.c b/common/bootretry.c
index 47aaaa82201e..ede7613fb9ce 100644
--- a/common/bootretry.c
+++ b/common/bootretry.c
@@ -23,7 +23,7 @@ static int retry_time = -1; /* -1 so can call readline before main_loop */
*/
void bootretry_init_cmd_timeout(void)
{
- char *s = env_get("bootretry");
+ char *s = env_get(ctx_uboot, "bootretry");
if (s != NULL)
retry_time = (int)simple_strtol(s, NULL, 10);
diff --git a/common/cli.c b/common/cli.c
index 49b910666b9f..4c588f862b5d 100644
--- a/common/cli.c
+++ b/common/cli.c
@@ -129,7 +129,7 @@ int do_run(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
for (i = 1; i < argc; ++i) {
char *arg;
- arg = env_get(argv[i]);
+ arg = env_get(ctx_uboot, argv[i]);
if (arg == NULL) {
printf("## Error: \"%s\" not defined\n", argv[i]);
return 1;
diff --git a/common/cli_hush.c b/common/cli_hush.c
index 8f86e4aa4a49..cf2306b76e66 100644
--- a/common/cli_hush.c
+++ b/common/cli_hush.c
@@ -560,7 +560,7 @@ static int builtin_cd(struct child_prog *child)
{
char *newdir;
if (child->argv[1] == NULL)
- newdir = env_get("HOME");
+ newdir = env_get(ctx_uboot, "HOME");
else
newdir = child->argv[1];
if (chdir(newdir)) {
@@ -948,7 +948,7 @@ static inline void cmdedit_set_initial_prompt(void)
#ifndef CONFIG_FEATURE_SH_FANCY_PROMPT
PS1 = NULL;
#else
- PS1 = env_get("PS1");
+ PS1 = env_get(ctx_uboot, "PS1");
if(PS1==0)
PS1 = "\\w \\$ ";
#endif
@@ -987,9 +987,9 @@ static int uboot_cli_readline(struct in_str *i)
#ifdef CONFIG_CMDLINE_PS_SUPPORT
if (i->promptmode == 1)
- ps_prompt = env_get("PS1");
+ ps_prompt = env_get(ctx_uboot, "PS1");
else
- ps_prompt = env_get("PS2");
+ ps_prompt = env_get(ctx_uboot, "PS2");
if (ps_prompt)
prompt = ps_prompt;
#endif
@@ -2172,7 +2172,7 @@ int set_local_var(const char *s, int flg_export)
name=strdup(s);
#ifdef __U_BOOT__
- if (env_get(name) != NULL) {
+ if (env_get(ctx_uboot, name)) {
printf ("ERROR: "
"There is a global environment variable with the same name.\n");
free(name);
@@ -2793,7 +2793,7 @@ static char *lookup_param(char *src)
}
}
- p = env_get(src);
+ p = env_get(ctx_uboot, src);
if (!p)
p = get_local_var(src);
@@ -3157,7 +3157,7 @@ static void mapset(const unsigned char *set, int code)
static void update_ifs_map(void)
{
/* char *ifs and char map[256] are both globals. */
- ifs = (uchar *)env_get("IFS");
+ ifs = (uchar *)env_get(ctx_uboot, "IFS");
if (ifs == NULL) ifs=(uchar *)" \t\n";
/* Precompute a list of 'flow through' behavior so it can be treated
* quickly up front. Computation is necessary because of IFS.
diff --git a/common/cli_simple.c b/common/cli_simple.c
index 6c881c133c61..4c04667faa6e 100644
--- a/common/cli_simple.c
+++ b/common/cli_simple.c
@@ -131,7 +131,7 @@ void cli_simple_process_macros(const char *input, char *output)
envname[i] = 0;
/* Get its value */
- envval = env_get(envname);
+ envval = env_get(ctx_uboot, envname);
/* Copy into the line if it exists */
if (envval != NULL)
diff --git a/common/command.c b/common/command.c
index 4b887a267fb6..736bedfbdeac 100644
--- a/common/command.c
+++ b/common/command.c
@@ -583,7 +583,7 @@ enum command_ret_t cmd_process(int flag, int argc, char * const argv[],
#if defined(CONFIG_SYS_XTRACE)
char *xtrace;
- xtrace = env_get("xtrace");
+ xtrace = env_get(ctx_uboot, "xtrace");
if (xtrace) {
puts("+");
for (int i = 0; i < argc; i++) {
diff --git a/common/console.c b/common/console.c
index 89b1e9590cad..5888a6aade08 100644
--- a/common/console.c
+++ b/common/console.c
@@ -736,7 +736,7 @@ int console_assign(int file, const char *devname)
static bool console_update_silent(void)
{
#ifdef CONFIG_SILENT_CONSOLE
- if (env_get("silent")) {
+ if (env_get(ctx_uboot, "silent")) {
gd->flags |= GD_FLG_SILENT;
} else {
unsigned long flags = gd->flags;
@@ -829,9 +829,9 @@ int console_init_r(void)
/* stdin stdout and stderr are in environment */
/* scan for it */
- stdinname = env_get("stdin");
- stdoutname = env_get("stdout");
- stderrname = env_get("stderr");
+ stdinname = env_get(ctx_uboot, "stdin");
+ stdoutname = env_get(ctx_uboot, "stdout");
+ stderrname = env_get(ctx_uboot, "stderr");
if (OVERWRITE_CONSOLE == 0) { /* if not overwritten by config switch */
inputdev = search_device(DEV_FLAGS_INPUT, stdinname);
@@ -885,7 +885,7 @@ done:
#ifdef CONFIG_SYS_CONSOLE_ENV_OVERWRITE
/* set the environment variables (will overwrite previous env settings) */
for (i = 0; i < MAX_FILES; i++) {
- env_set(stdio_names[i], stdio_devices[i]->name);
+ env_set(ctx_uboot, stdio_names[i], stdio_devices[i]->name);
}
#endif /* CONFIG_SYS_CONSOLE_ENV_OVERWRITE */
@@ -925,7 +925,7 @@ int console_init_r(void)
* console to serial console in this case or suppress it if
* "silent" mode was requested.
*/
- if (env_get("splashimage") != NULL) {
+ if (env_get(ctx_uboot, "splashimage")) {
if (!(gd->flags & GD_FLG_SILENT))
outputdev = search_device (DEV_FLAGS_OUTPUT, "serial");
}
@@ -969,7 +969,7 @@ int console_init_r(void)
/* Setting environment variables */
for (i = 0; i < MAX_FILES; i++) {
- env_set(stdio_names[i], stdio_devices[i]->name);
+ env_set(ctx_uboot, stdio_names[i], stdio_devices[i]->name);
}
gd->flags |= GD_FLG_DEVINIT; /* device initialization completed */
diff --git a/common/fdt_support.c b/common/fdt_support.c
index baf7924ff612..023e2acb5b71 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -197,7 +197,7 @@ int fdt_root(void *fdt)
return err;
}
- serial = env_get("serial#");
+ serial = env_get(ctx_uboot, "serial#");
if (serial) {
err = fdt_setprop(fdt, 0, "serial-number", serial,
strlen(serial) + 1);
@@ -289,7 +289,7 @@ int fdt_chosen(void *fdt)
if (nodeoffset < 0)
return nodeoffset;
- str = env_get("bootargs");
+ str = env_get(ctx_uboot, "bootargs");
if (str) {
err = fdt_setprop(fdt, nodeoffset, "bootargs", str,
strlen(str) + 1);
@@ -533,7 +533,7 @@ void fdt_fixup_ethernet(void *fdt)
continue;
i++;
#endif
- tmp = env_get(mac);
+ tmp = env_get(ctx_uboot, mac);
if (!tmp)
continue;
diff --git a/common/hash.c b/common/hash.c
index d33e329897e1..b87402ac1e4f 100644
--- a/common/hash.c
+++ b/common/hash.c
@@ -331,7 +331,7 @@ static void store_result(struct hash_algo *algo, const uint8_t *sum,
str_ptr += 2;
}
*str_ptr = '\0';
- env_set(dest, str_output);
+ env_set(ctx_uboot, dest, str_output);
} else {
ulong addr;
void *buf;
@@ -391,7 +391,7 @@ static int parse_verify_sum(struct hash_algo *algo, char *verify_str,
if (strlen(verify_str) == digits)
vsum_str = verify_str;
else {
- vsum_str = env_get(verify_str);
+ vsum_str = env_get(ctx_uboot, verify_str);
if (vsum_str == NULL || strlen(vsum_str) != digits) {
printf("Expected %d hex digits in env var\n",
digits);
diff --git a/common/hwconfig.c b/common/hwconfig.c
index 72f3c4e0faa6..5d2fdea9c91f 100644
--- a/common/hwconfig.c
+++ b/common/hwconfig.c
@@ -81,7 +81,7 @@ static const char *__hwconfig(const char *opt, size_t *arglen,
"and before environment is ready\n");
return NULL;
}
- env_hwconfig = env_get("hwconfig");
+ env_hwconfig = env_get(ctx_uboot, "hwconfig");
}
if (env_hwconfig) {
@@ -243,7 +243,8 @@ int main()
const char *ret;
size_t len;
- env_set("hwconfig", "key1:subkey1=value1,subkey2=value2;key2:value3;;;;"
+ env_set(ctx_uboot, "hwconfig",
+ "key1:subkey1=value1,subkey2=value2;key2:value3;;;;"
"key3;:,:=;key4", 1);
ret = hwconfig_arg("key1", &len);
diff --git a/common/image-android.c b/common/image-android.c
index 264bf90007e9..5d47c955df76 100644
--- a/common/image-android.c
+++ b/common/image-android.c
@@ -75,7 +75,7 @@ int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify,
len += strlen(hdr->cmdline);
}
- char *bootargs = env_get("bootargs");
+ char *bootargs = env_get(ctx_uboot, "bootargs");
if (bootargs)
len += strlen(bootargs);
@@ -93,7 +93,7 @@ int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify,
if (*hdr->cmdline)
strcat(newbootargs, hdr->cmdline);
- env_set("bootargs", newbootargs);
+ env_set(ctx_uboot, "bootargs", newbootargs);
if (os_data) {
if (image_get_magic(ihdr) == IH_MAGIC) {
diff --git a/common/image-fdt.c b/common/image-fdt.c
index 4247dcee0c4f..f735b3a02ff0 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -172,7 +172,7 @@ int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size)
of_len = *of_size + CONFIG_SYS_FDT_PAD;
/* If fdt_high is set use it to select the relocation address */
- fdt_high = env_get("fdt_high");
+ fdt_high = env_get(ctx_uboot, "fdt_high");
if (fdt_high) {
void *desired_addr = (void *)simple_strtoul(fdt_high, NULL, 16);
@@ -470,7 +470,7 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
debug("## Using FDT in Android image second area\n");
} else {
- fdt_addr = env_get_hex("fdtaddr", 0);
+ fdt_addr = env_get_hex(ctx_uboot, "fdtaddr", 0);
if (!fdt_addr)
goto no_fdt;
diff --git a/common/image.c b/common/image.c
index 645584b5ba22..fca910ac5019 100644
--- a/common/image.c
+++ b/common/image.c
@@ -573,7 +573,7 @@ U_BOOT_ENV_CALLBACK(loadaddr, on_loadaddr);
ulong env_get_bootm_low(void)
{
- char *s = env_get("bootm_low");
+ char *s = env_get(ctx_uboot, "bootm_low");
if (s) {
ulong tmp = simple_strtoul(s, NULL, 16);
return tmp;
@@ -592,7 +592,7 @@ phys_size_t env_get_bootm_size(void)
{
phys_size_t tmp, size;
phys_addr_t start;
- char *s = env_get("bootm_size");
+ char *s = env_get(ctx_uboot, "bootm_size");
if (s) {
tmp = (phys_size_t)simple_strtoull(s, NULL, 16);
return tmp;
@@ -606,7 +606,7 @@ phys_size_t env_get_bootm_size(void)
size = gd->bd->bi_memsize;
#endif
- s = env_get("bootm_low");
+ s = env_get(ctx_uboot, "bootm_low");
if (s)
tmp = (phys_size_t)simple_strtoull(s, NULL, 16);
else
@@ -618,7 +618,7 @@ phys_size_t env_get_bootm_size(void)
phys_size_t env_get_bootm_mapsize(void)
{
phys_size_t tmp;
- char *s = env_get("bootm_mapsize");
+ char *s = env_get(ctx_uboot, "bootm_mapsize");
if (s) {
tmp = (phys_size_t)simple_strtoull(s, NULL, 16);
return tmp;
@@ -1070,7 +1070,8 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
*/
buf = map_sysmem(images->os.start, 0);
if (buf && genimg_get_format(buf) == IMAGE_FORMAT_ANDROID)
- select = (argc == 0) ? env_get("loadaddr") : argv[0];
+ select = (argc == 0) ? env_get(ctx_uboot, "loadaddr")
+ : argv[0];
#endif
if (argc >= 2)
@@ -1257,7 +1258,7 @@ int boot_ramdisk_high(struct lmb *lmb, ulong rd_data, ulong rd_len,
ulong initrd_high;
int initrd_copy_to_ram = 1;
- s = env_get("initrd_high");
+ s = env_get(ctx_uboot, "initrd_high");
if (s) {
/* a value of "no" or a similar string will act like 0,
* turning the "load high" feature off. This is intentional.
@@ -1548,7 +1549,7 @@ int boot_get_cmdline(struct lmb *lmb, ulong *cmd_start, ulong *cmd_end)
if (cmdline == NULL)
return -1;
- s = env_get("bootargs");
+ s = env_get(ctx_uboot, "bootargs");
if (!s)
s = "";
diff --git a/common/main.c b/common/main.c
index 3a657c3d9a39..cb9bd8256413 100644
--- a/common/main.c
+++ b/common/main.c
@@ -22,7 +22,7 @@ static void run_preboot_environment_command(void)
{
char *p;
- p = env_get("preboot");
+ p = env_get(ctx_uboot, "preboot");
if (p != NULL) {
int prev = 0;
@@ -44,7 +44,8 @@ void main_loop(void)
bootstage_mark_name(BOOTSTAGE_ID_MAIN_LOOP, "main_loop");
if (IS_ENABLED(CONFIG_VERSION_VARIABLE))
- env_set("ver", version_string); /* set version variable */
+ /* set version variable */
+ env_set(ctx_uboot, "ver", version_string);
cli_init();
diff --git a/common/spl/spl_dfu.c b/common/spl/spl_dfu.c
index 5728d43ad3f2..4febdb54482f 100644
--- a/common/spl/spl_dfu.c
+++ b/common/spl/spl_dfu.c
@@ -38,14 +38,14 @@ int spl_dfu_cmd(int usbctrl, char *dfu_alt_info, char *interface, char *devstr)
int ret;
/* set default environment */
- env_set_default(NULL, 0);
- str_env = env_get(dfu_alt_info);
+ env_set_default(ctx_uboot, NULL, 0);
+ str_env = env_get(ctx_uboot, dfu_alt_info);
if (!str_env) {
pr_err("\"%s\" env variable not defined!\n", dfu_alt_info);
return -EINVAL;
}
- ret = env_set("dfu_alt_info", str_env);
+ ret = env_set(ctx_uboot, "dfu_alt_info", str_env);
if (ret) {
pr_err("unable to set env variable \"dfu_alt_info\"!\n");
return -EINVAL;
diff --git a/common/spl/spl_ext.c b/common/spl/spl_ext.c
index 2a6252229ca1..a2f0fcb89eb8 100644
--- a/common/spl/spl_ext.c
+++ b/common/spl/spl_ext.c
@@ -87,7 +87,7 @@ int spl_load_image_ext_os(struct spl_image_info *spl_image,
return -1;
}
#if defined(CONFIG_SPL_ENV_SUPPORT)
- file = env_get("falcon_args_file");
+ file = env_get(ctx_uboot, "falcon_args_file");
if (file) {
err = ext4fs_open(file, &filelen);
if (err < 0) {
@@ -100,7 +100,7 @@ int spl_load_image_ext_os(struct spl_image_info *spl_image,
file, err);
goto defaults;
}
- file = env_get("falcon_image_file");
+ file = env_get(ctx_uboot, "falcon_image_file");
if (file) {
err = spl_load_image_ext(spl_image, block_dev,
partition, file);
diff --git a/common/spl/spl_fat.c b/common/spl/spl_fat.c
index aa371ab52c56..10c1d02e02fe 100644
--- a/common/spl/spl_fat.c
+++ b/common/spl/spl_fat.c
@@ -123,7 +123,7 @@ int spl_load_image_fat_os(struct spl_image_info *spl_image,
return err;
#if defined(CONFIG_SPL_ENV_SUPPORT) && defined(CONFIG_SPL_OS_BOOT)
- file = env_get("falcon_args_file");
+ file = env_get(ctx_uboot, "falcon_args_file");
if (file) {
err = file_fat_read(file, (void *)CONFIG_SYS_SPL_ARGS_ADDR, 0);
if (err <= 0) {
@@ -131,7 +131,7 @@ int spl_load_image_fat_os(struct spl_image_info *spl_image,
file, err);
goto defaults;
}
- file = env_get("falcon_image_file");
+ file = env_get(ctx_uboot, "falcon_image_file");
if (file) {
err = spl_load_image_fat(spl_image, block_dev,
partition, file);
diff --git a/common/spl/spl_net.c b/common/spl/spl_net.c
index 803303249c72..141014506a0a 100644
--- a/common/spl/spl_net.c
+++ b/common/spl/spl_net.c
@@ -31,14 +31,14 @@ static int spl_net_load_image(struct spl_image_info *spl_image,
env_init();
env_relocate();
- env_set("autoload", "yes");
+ env_set(ctx_uboot, "autoload", "yes");
rv = eth_initialize();
if (rv == 0) {
printf("No Ethernet devices found\n");
return -ENODEV;
}
if (bootdev->boot_device_name)
- env_set("ethact", bootdev->boot_device_name);
+ env_set(ctx_uboot, "ethact", bootdev->boot_device_name);
rv = net_loop(BOOTP);
if (rv < 0) {
printf("Problem booting with BOOTP\n");
diff --git a/common/splash.c b/common/splash.c
index e15cc847b68c..439667a40f64 100644
--- a/common/splash.c
+++ b/common/splash.c
@@ -61,7 +61,7 @@ __weak int splash_screen_prepare(void)
#ifdef CONFIG_SPLASH_SCREEN_ALIGN
void splash_get_pos(int *x, int *y)
{
- char *s = env_get("splashpos");
+ char *s = env_get(ctx_uboot, "splashpos");
if (!s)
return;
@@ -93,7 +93,7 @@ int splash_display(void)
char *s;
int x = 0, y = 0, ret;
- s = env_get("splashimage");
+ s = env_get(ctx_uboot, "splashimage");
if (!s)
return -EINVAL;
diff --git a/common/splash_source.c b/common/splash_source.c
index d37b4b304c2c..a99519a1f80c 100644
--- a/common/splash_source.c
+++ b/common/splash_source.c
@@ -220,7 +220,7 @@ static int splash_load_fs(struct splash_location *location, u32 bmp_load_addr)
loff_t actread;
char *splash_file;
- splash_file = env_get("splashfile");
+ splash_file = env_get(ctx_uboot, "splashfile");
if (!splash_file)
splash_file = SPLASH_SOURCE_DEFAULT_FILE_NAME;
@@ -286,7 +286,7 @@ static struct splash_location *select_splash_location(
if (!locations || size == 0)
return NULL;
- env_splashsource = env_get("splashsource");
+ env_splashsource = env_get(ctx_uboot, "splashsource");
if (env_splashsource == NULL)
return &locations[0];
@@ -341,7 +341,7 @@ static int splash_load_fit(struct splash_location *location, u32 bmp_load_addr)
}
/* Get the splash image node */
- splash_file = env_get("splashfile");
+ splash_file = env_get(ctx_uboot, "splashfile");
if (!splash_file)
splash_file = SPLASH_SOURCE_DEFAULT_FILE_NAME;
@@ -407,7 +407,7 @@ int splash_source_load(struct splash_location *locations, uint size)
char *env_splashimage_value;
u32 bmp_load_addr;
- env_splashimage_value = env_get("splashimage");
+ env_splashimage_value = env_get(ctx_uboot, "splashimage");
if (env_splashimage_value == NULL)
return -ENOENT;
diff --git a/common/update.c b/common/update.c
index 457b29f42aa3..8ba5f70401b8 100644
--- a/common/update.c
+++ b/common/update.c
@@ -60,7 +60,7 @@ static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr)
/* save used globals and env variable */
saved_timeout_msecs = tftp_timeout_ms;
saved_timeout_count = tftp_timeout_count_max;
- saved_netretry = strdup(env_get("netretry"));
+ saved_netretry = strdup(env_get(ctx_uboot, "netretry"));
saved_bootfile = strdup(net_boot_file_name);
/* set timeouts for auto-update */
@@ -68,7 +68,7 @@ static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr)
tftp_timeout_count_max = cnt_max;
/* we don't want to retry the connection if errors occur */
- env_set("netretry", "no");
+ env_set(ctx_uboot, "netretry", "no");
/* download the update file */
load_addr = addr;
@@ -84,7 +84,7 @@ static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr)
tftp_timeout_ms = saved_timeout_msecs;
tftp_timeout_count_max = saved_timeout_count;
- env_set("netretry", saved_netretry);
+ env_set(ctx_uboot, "netretry", saved_netretry);
if (saved_netretry != NULL)
free(saved_netretry);
@@ -255,7 +255,7 @@ int update_tftp(ulong addr, char *interface, char *devstring)
printf("Auto-update from TFTP: ");
/* get the file name of the update file */
- filename = env_get(UPDATE_FILE_ENV);
+ filename = env_get(ctx_uboot, UPDATE_FILE_ENV);
if (filename == NULL) {
printf("failed, env. variable '%s' not found\n",
UPDATE_FILE_ENV);
@@ -265,7 +265,7 @@ int update_tftp(ulong addr, char *interface, char *devstring)
printf("trying update file '%s'\n", filename);
/* get load address of downloaded update file */
- env_addr = env_get("loadaddr");
+ env_addr = env_get(ctx_uboot, "loadaddr");
if (env_addr)
addr = simple_strtoul(env_addr, NULL, 16);
else
diff --git a/common/usb_hub.c b/common/usb_hub.c
index 25c2ac43450d..82fe6149429f 100644
--- a/common/usb_hub.c
+++ b/common/usb_hub.c
@@ -187,7 +187,7 @@ static void usb_hub_power_on(struct usb_hub_device *hub)
* but allow this time to be increased via env variable as some
* devices break the spec and require longer warm-up times
*/
- env = env_get("usb_pgood_delay");
+ env = env_get(ctx_uboot, "usb_pgood_delay");
if (env)
pgood_delay = max(pgood_delay,
(unsigned)simple_strtol(env, NULL, 0));
diff --git a/common/usb_kbd.c b/common/usb_kbd.c
index 387373746147..8bba3897e239 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -540,7 +540,7 @@ static int probe_usb_keyboard(struct usb_device *dev)
if (error)
return error;
- stdinname = env_get("stdin");
+ stdinname = env_get(ctx_uboot, "stdin");
#if CONFIG_IS_ENABLED(CONSOLE_MUX)
error = iomux_doenv(stdin, stdinname);
if (error)
@@ -607,7 +607,7 @@ int usb_kbd_deregister(int force)
if (stdio_deregister_dev(dev, force) != 0)
return 1;
#if CONFIG_IS_ENABLED(CONSOLE_MUX)
- if (iomux_doenv(stdin, env_get("stdin")) != 0)
+ if (iomux_doenv(stdin, env_get(ctx_uboot, "stdin")) != 0)
return 1;
#endif
#ifdef CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE
@@ -652,7 +652,7 @@ static int usb_kbd_remove(struct udevice *dev)
goto err;
}
#if CONFIG_IS_ENABLED(CONSOLE_MUX)
- if (iomux_doenv(stdin, env_get("stdin"))) {
+ if (iomux_doenv(stdin, env_get(ctx_uboot, "stdin"))) {
ret = -ENOLINK;
goto err;
}
--
2.21.0
More information about the U-Boot
mailing list