summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fd1e959)
raw | patch | inline | side by side (parent: fd1e959)
author | Simon Glass <sjg@chromium.org> | |
Thu, 3 Aug 2017 18:22:12 +0000 (12:22 -0600) | ||
committer | Tom Rini <trini@konsulko.com> | |
Wed, 16 Aug 2017 12:30:24 +0000 (08:30 -0400) |
We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.
Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.
Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
two functions for consistency. Also add function comments in common.h.
Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.
Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
213 files changed:
index 3fdb89cc79a6d8249374f68c59f8e7466a9c1623..1a7a788c4bf9dd9857cdede7b724faa94a827ada 100644 (file)
--- a/README
+++ b/README
Please note that the environment is read-only until the monitor
has been relocated to RAM and a RAM copy of the environment has been
-created; also, when using EEPROM you will have to use getenv_f()
+created; also, when using EEPROM you will have to use env_get_f()
until then to read environment variables.
The environment is protected by a CRC32 checksum. Before the monitor
diff --git a/api/api.c b/api/api.c
index 23fa1774c3c33ea7845bf24749b6659048ab3a9c..7eee2fc083affa349f393b529c917dd7ea5b76e7 100644 (file)
--- a/api/api.c
+++ b/api/api.c
if ((value = (char **)va_arg(ap, uintptr_t)) == NULL)
return API_EINVAL;
- *value = getenv(name);
+ *value = env_get(name);
return 0;
}
diff --git a/arch/arc/lib/bootm.c b/arch/arc/lib/bootm.c
index 57981490467a817c64f1bd75dc77cf4a9c85c6b7..a498ce5b297c69724f9c59bf2b486f1d0414da23 100644 (file)
--- a/arch/arc/lib/bootm.c
+++ b/arch/arc/lib/bootm.c
r2 = (unsigned int)images->ft_addr;
} else {
r0 = 1;
- r2 = (unsigned int)getenv("bootargs");
+ r2 = (unsigned int)env_get("bootargs");
}
smp_set_core_boot_addr((unsigned long)kernel_entry, -1);
index aee1ffa7d43eb049b708d287a5e8bd8ecd564834..639e9d2ddc8d643904f22872b42fbd21a66d29ff 100644 (file)
static unsigned long get_internval_val_mhz(void)
{
- char *interval = getenv(PLATFORM_CYCLE_ENV_VAR);
+ char *interval = env_get(PLATFORM_CYCLE_ENV_VAR);
/*
* interval is the number of platform cycles(MHz) between
* wake up events generated by EPU.
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 704849bd0c7e4dc659ee07c89dc1885be1d845ca..5c62d9c144061aa888730a3dda682042e77a4208 100644 (file)
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
/* Subcommand: PREP */
static void boot_prep_linux(bootm_headers_t *images)
{
- char *commandline = getenv("bootargs");
+ char *commandline = env_get("bootargs");
if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len) {
#ifdef CONFIG_OF_LIBFDT
#ifdef CONFIG_ARMV7_NONSEC
bool armv7_boot_nonsec(void)
{
- char *s = getenv("bootm_boot_mode");
+ char *s = env_get("bootm_boot_mode");
bool nonsec = armv7_boot_nonsec_default();
if (s && !strcmp(s, "sec"))
ulong addr = (ulong)kernel_entry | 1;
kernel_entry = (void *)addr;
#endif
- s = getenv("machid");
+ s = env_get("machid");
if (s) {
if (strict_strtoul(s, 16, &machid) < 0) {
debug("strict_strtoul failed!\n");
index 55242f0eaabaedad4a8dce5ef4cec0e996eb7f74..c670c5dfc9c23e9459caec50704315e52829d5ca 100644 (file)
{
int i;
int ret;
- char const *panel = getenv("panel");
+ char const *panel = env_get("panel");
if (!panel) {
for (i = 0; i < display_count; i++) {
index 4cad6a2d81c33a508f1623be9f847d81ff2874f9..b2f5414a5c6c31cf59f8445579ecb22c183af013 100644 (file)
int ecc_test = 0;
u32 value = __raw_readl(base + KS2_DDR3_ECC_INT_STATUS_OFFSET);
- env = getenv("ecc_test");
+ env = env_get("ecc_test");
if (env)
ecc_test = simple_strtol(env, NULL, 0);
index beb8a767c44a7bcd0dc13f8c54393d391f37c77e..fcabfbd5c3907c8a92da76bd632beac918e7d515 100644 (file)
char *env;
long ks2_debug = 0;
- env = getenv("ks2_debug");
+ env = env_get("ks2_debug");
if (env)
ks2_debug = simple_strtol(env, NULL, 0);
index 4c9d3fde47f58af4915676505bd0cb80d2cd1f45..db2ff0311cfd0dac58cd3d7c7d353ea7c483a1f1 100644 (file)
static void kw_sysrst_action(void)
{
int ret;
- char *s = getenv("sysrstcmd");
+ char *s = env_get("sysrstcmd");
if (!s) {
debug("Error.. %s failed, check sysrstcmd\n",
/*
* no action if sysrstdelay environment variable is not defined
*/
- s = getenv("sysrstdelay");
+ s = env_get("sysrstdelay");
if (s == NULL)
return;
index c03e93878de5995daabda94ee835981967285d0b..0b0bf1837c9cb89ac074356f9c3e081b858a63ff 100644 (file)
{
const char *board_rev;
- board_rev = getenv("board_rev");
+ board_rev = env_get("board_rev");
if (board_rev == NULL)
printf("Warning: fastboot.board_rev: unknown board revision\n");
omap_die_id((unsigned int *)&die_id);
- if (!getenv("serial#")) {
+ if (!env_get("serial#")) {
snprintf(serial_string, sizeof(serial_string),
"%08x%08x", die_id[0], die_id[3]);
char *serial_string;
unsigned long long serial;
- serial_string = getenv("serial#");
+ serial_string = env_get("serial#");
if (serial_string) {
serial = simple_strtoull(serial_string, NULL, 16);
omap_die_id((unsigned int *)&die_id);
- if (!getenv("usbethaddr")) {
+ if (!env_get("usbethaddr")) {
/*
* Create a fake MAC address from the processor ID code.
* First byte is 0x02 to signify locally administered.
diff --git a/arch/arm/mach-tegra/tegra186/nvtboot_board.c b/arch/arm/mach-tegra/tegra186/nvtboot_board.c
index 9cd3fe2f305d61f2e84916a0c65f374eec3fd83b..b94eb424aaa2bbc9d8e46dbfd86dfa5cde3290f0 100644 (file)
const u32 *prop;
/* Already a valid address in the environment? If so, keep it */
- if (getenv("ethaddr"))
+ if (env_get("ethaddr"))
return 0;
node = fdt_path_offset(nvtboot_blob, "/chosen");
index e6d600e41fcdc2a33a501ba2d07c4e201e96c7d2..b9a2cbe14865454f7939d774a8177ed2ca3e0211 100644 (file)
char dtb_name[256];
int buf_len = sizeof(dtb_name);
- if (getenv("fdt_file"))
+ if (env_get("fdt_file"))
return 0; /* do nothing if it is already set */
compat = fdt_stringlist_get(gd->fdt_blob, 0, "compatible", 0, NULL);
diff --git a/arch/m68k/lib/bootm.c b/arch/m68k/lib/bootm.c
index fa9c4930814e470a058419ded5878386c246bd6b..c976904fa9ca5d198a06278af9da82a0e90cb4eb 100644 (file)
--- a/arch/m68k/lib/bootm.c
+++ b/arch/m68k/lib/bootm.c
{
char *s;
- if ((s = getenv("clocks_in_mhz")) != NULL) {
+ s = env_get("clocks_in_mhz");
+ if (s) {
/* convert all clock information to MHz */
kbd->bi_intfreq /= 1000000L;
kbd->bi_busfreq /= 1000000L;
index 2732203b93e7f30489aa97b3d31f401ad28ee045..0a286e82c2be8d6e45b559a51cb389b3251f5644 100644 (file)
{
/* First parameter is mapped to $r5 for kernel boot args */
void (*thekernel) (char *, ulong, ulong);
- char *commandline = getenv("bootargs");
+ char *commandline = env_get("bootargs");
ulong rd_data_start, rd_data_end;
/*
diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
index 2b6790524c80a03268a86ccab8a8a6b6bdcc3b34..5a9a2811ffb5b86e0bb410025c1b6276a93d4c3e 100644 (file)
--- a/arch/mips/lib/bootm.c
+++ b/arch/mips/lib/bootm.c
linux_cmdline_init();
- bootargs = getenv("bootargs");
+ bootargs = env_get("bootargs");
if (!bootargs)
return;
sprintf(env_buf, "0x%X", (uint) (gd->bd->bi_flashsize));
linux_env_set("flash_size", env_buf);
- cp = getenv("ethaddr");
+ cp = env_get("ethaddr");
if (cp)
linux_env_set("ethaddr", cp);
- cp = getenv("eth1addr");
+ cp = env_get("eth1addr");
if (cp)
linux_env_set("eth1addr", cp);
diff --git a/arch/nds32/lib/bootm.c b/arch/nds32/lib/bootm.c
index 21aadf284f11843d74b104ac4f0f0e074fe2dcf9..e834329e0b68db16f3f9ae726d5a0816162b5c5b 100644 (file)
--- a/arch/nds32/lib/bootm.c
+++ b/arch/nds32/lib/bootm.c
void (*theKernel)(int zero, int arch, uint params);
#ifdef CONFIG_CMDLINE_TAG
- char *commandline = getenv("bootargs");
+ char *commandline = env_get("bootargs");
#endif
/*
theKernel = (void (*)(int, int, uint))images->ep;
- s = getenv("machid");
+ s = env_get("machid");
if (s) {
machid = simple_strtoul(s, NULL, 16);
printf("Using machid 0x%x from environment\n", machid);
diff --git a/arch/nios2/lib/bootm.c b/arch/nios2/lib/bootm.c
index 4e5c269193d9d32ee7dc83650a6d7a88e47aedb6..00ade2c57319a5f34e450f93329e9e44fff80b94 100644 (file)
--- a/arch/nios2/lib/bootm.c
+++ b/arch/nios2/lib/bootm.c
int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *images)
{
void (*kernel)(int, int, int, char *) = (void *)images->ep;
- char *commandline = getenv("bootargs");
+ char *commandline = env_get("bootargs");
ulong initrd_start = images->rd_start;
ulong initrd_end = images->rd_end;
char *of_flat_tree = NULL;
index a3076d8d71005a16d0d166d9c8c9ea55b78c0d83..ea46e498534910efa09ce80536ccda890a9a15fb 100644 (file)
* is not setup properly yet. Search for tdm entry in
* hwconfig.
*/
- ret = getenv_f("hwconfig", buffer, sizeof(buffer));
+ ret = env_get_f("hwconfig", buffer, sizeof(buffer));
if (ret > 0) {
tdm_hwconfig_enabled = hwconfig_f("tdm", buffer);
/* If tdm is defined in hwconfig, set law for tdm workaround */
cpc_corenet_t *cpc = (cpc_corenet_t *)CONFIG_SYS_FSL_CPC_ADDR;
/* Extract hwconfig from environment */
- ret = getenv_f("hwconfig", buffer, sizeof(buffer));
+ ret = env_get_f("hwconfig", buffer, sizeof(buffer));
if (ret > 0) {
/*
* If "en_cpc" is not defined in hwconfig then by default all
char *buf = NULL;
int n, res;
- n = getenv_f("hwconfig", buffer, sizeof(buffer));
+ n = env_get_f("hwconfig", buffer, sizeof(buffer));
if (n > 0)
buf = buffer;
#endif
#if defined(CONFIG_PPC_SPINTABLE_COMPATIBLE) && defined(CONFIG_MP)
- spin = getenv("spin_table_compat");
+ spin = env_get("spin_table_compat");
if (spin && (*spin == 'n'))
spin_table_compat = 0;
else
#ifdef CONFIG_SYS_SRIO
srio_init();
#ifdef CONFIG_SRIO_PCIE_BOOT_MASTER
- char *s = getenv("bootmaster");
+ char *s = env_get("bootmaster");
if (s) {
if (!strcmp(s, "SRIO1")) {
srio_boot_master(1);
index caa0bf9bdc1d889876f4b9a61ac99675c2b0b4b4..64b0a51f75e74fa15a866205a657859155278aa2 100644 (file)
* Extract hwconfig from environment.
* Search for tdm entry in hwconfig.
*/
- ret = getenv_f("hwconfig", buffer, sizeof(buffer));
+ ret = env_get_f("hwconfig", buffer, sizeof(buffer));
if (ret > 0)
tdm_hwconfig_enabled = hwconfig_f("tdm", buffer);
diff --git a/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c b/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c
index 1bc0c64cfc30ebcce129bd0c14d5ee5c0497acb7..79d6544a09805da4267016058300278e519ce503 100644 (file)
* Extract hwconfig from environment since we have not properly setup
* the environment but need it for ddr config params
*/
- if (getenv_f("hwconfig", buffer, sizeof(buffer)) > 0)
+ if (env_get_f("hwconfig", buffer, sizeof(buffer)) > 0)
buf = buffer;
#endif
if (serdes_prtcl_map & (1 << NONE))
index 0e204027af21491b258010030cee9a688135ec47..932c38ab4c2bcd2e342bb98e04602ba91a44f60b 100644 (file)
--- a/arch/powerpc/lib/bootm.c
+++ b/arch/powerpc/lib/bootm.c
{
char *s;
- if ((s = getenv ("clocks_in_mhz")) != NULL) {
+ s = env_get("clocks_in_mhz");
+ if (s) {
/* convert all clock information to MHz */
kbd->bi_intfreq /= 1000000L;
kbd->bi_busfreq /= 1000000L;
diff --git a/arch/sh/lib/bootm.c b/arch/sh/lib/bootm.c
index 8a0010be23797d4ac075e0b5818d7d7e11e3e284..09fbd5e5df8ddae7e0e6797069a7732d829b346f 100644 (file)
--- a/arch/sh/lib/bootm.c
+++ b/arch/sh/lib/bootm.c
char *cmdline = (char *)param + COMMAND_LINE;
/* PAGE_SIZE */
unsigned long size = images->ep - (unsigned long)param;
- char *bootargs = getenv("bootargs");
+ char *bootargs = env_get("bootargs");
/*
* allow the PREP bootm subcommand, it is required for bootm to work
index 3fea5f5b532108c124123ba32f996118991b5d51..cd4abba10aa3e9f364e12330b45e3006a2eba394 100644 (file)
--- a/arch/sh/lib/zimageboot.c
+++ b/arch/sh/lib/zimageboot.c
/* Linux kernel command line */
cmdline = (char *)param + COMMAND_LINE;
- bootargs = getenv("bootargs");
+ bootargs = env_get("bootargs");
/* Clear zero page */
/* cppcheck-suppress nullPointer */
diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c
index aafbeb01f907ea4d49a9f343085b6d3e9f491d1b..00172dc7c130180fbd5062a791975f9419c23adb 100644 (file)
--- a/arch/x86/lib/zimage.c
+++ b/arch/x86/lib/zimage.c
command_line[0] = '\0';
- env_command_line = getenv("bootargs");
+ env_command_line = env_get("bootargs");
/* set console= argument if we use a serial console */
if (!strstr(env_command_line, "console=")) {
- if (!strcmp(getenv("stdout"), "serial")) {
+ if (!strcmp(env_get("stdout"), "serial")) {
/* We seem to use serial console */
sprintf(command_line, "console=ttyS0,%s ",
- getenv("baudrate"));
+ env_get("baudrate"));
}
}
/* argv[1] holds the address of the bzImage */
s = argv[1];
} else {
- s = getenv("fileaddr");
+ s = env_get("fileaddr");
}
if (s)
index 1604bb95368879e319dd01cbf937faf63d2ea9b9..16961acba5dd1e0f9b541e536e79425b3292ca7b 100644 (file)
--- a/arch/xtensa/lib/bootm.c
+++ b/arch/xtensa/lib/bootm.c
{
struct bp_tag *params, *params_start;
ulong initrd_start, initrd_end;
- char *commandline = getenv("bootargs");
+ char *commandline = env_get("bootargs");
if (!(flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)))
return 0;
index c32f7df4546cdd04a5c459b79f7a2e68a310173b..0d3ac88fffea84975cd98428f75999f534ad7207 100644 (file)
if (smac[2][0] == 0xFF) {
printf("\t<not found>\n");
} else {
- char *ret = getenv("ethaddr");
+ char *ret = env_get("ethaddr");
if (strcmp(ret, __stringify(CONFIG_ETHADDR)) == 0) {
env_set("ethaddr", smac[2]);
if (smac[1][0] == 0xFF) {
printf("\t<not found>\n");
} else {
- char *ret = getenv("eth1addr");
+ char *ret = env_get("eth1addr");
if (strcmp(ret, __stringify(CONFIG_ETH1ADDR)) == 0) {
env_set("eth1addr", smac[1]);
if (smac[0][0] == 0xFF) {
printf("\t<not found>\n");
} else {
- char *ret = getenv("eth2addr");
+ char *ret = env_get("eth2addr");
if (strcmp(ret, __stringify(CONFIG_ETH2ADDR)) == 0) {
env_set("eth2addr", smac[0]);
index 2cc2e54d5b66a51199e03c4e666a7cd2cf081b1b..dfdaf0441c98ab7822419e6c3a2bee516ac6564a 100644 (file)
for (i = 0; i < GPIO_MAX_NUM; i++) {
sprintf(envname, "GPIO%d", i);
- val = getenv(envname);
+ val = env_get(envname);
if (val) {
char direction = toupper(val[0]);
char level = toupper(val[1]);
}
}
- val = getenv("PCIE_OFF");
+ val = env_get("PCIE_OFF");
if (val) {
gpio_direction_input(GPIO_PCIE1_EN);
gpio_direction_input(GPIO_PCIE2_EN);
gpio_direction_output(GPIO_PCIE2_EN, 1);
}
- val = getenv("SDHC_CDWP_OFF");
+ val = env_get("SDHC_CDWP_OFF");
if (!val) {
ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
else
printf("NCT72(0x%x): ready\n", id2);
- kval = getenv("kernelargs");
+ kval = env_get("kernelargs");
mmc = find_mmc_device(0);
if (mmc)
get_arc_info();
if (kval) {
- sval = getenv("SERIAL");
+ sval = env_get("SERIAL");
if (sval) {
strcpy(newkernelargs, "SN=");
strcat(newkernelargs, sval);
index 3a584021ac71dc5225c33f75defa481638fdbff9..d203429738e3b84f345111c3933bcb04f6e57730 100644 (file)
u32 maxcpuclk = CONFIG_DA850_EVM_MAX_CPU_CLK;
u32 rev = 0;
- s = getenv("maxcpuclk");
+ s = env_get("maxcpuclk");
if (s)
maxcpuclk = simple_strtoul(s, NULL, 10);
index eb34de931ec3ee36f84f0cf992c41f6725bfb58f..39a600b5c178011cd6a39f5e6a0311d117500f68 100644 (file)
(size_t *)&dtbsize,
NULL, 0x20000, (u_char *)dtbaddr);
#else
- char *dtbname = getenv("dtb");
- char *dtbdev = getenv("dtbdev");
- char *dtbpart = getenv("dtbpart");
+ char *dtbname = env_get("dtb");
+ char *dtbdev = env_get("dtbdev");
+ char *dtbpart = env_get("dtbpart");
if (!dtbdev || !dtbpart || !dtbname) {
printf("%s: <dtbdev>/<dtbpart>/<dtb> missing.\n", __func__);
return -1;
char *name, char *altname,
char *suffix)
{
- char *envval = getenv(name);
+ char *envval = env_get(name);
if (0 != envval) {
lcd_printf("%s %s %s", prefix, envval, suffix);
} else if (0 != altname) {
- envval = getenv(altname);
+ envval = env_get(altname);
if (0 != envval)
lcd_printf("%s %s %s", prefix, envval, suffix);
} else {
mac_addr[4] = mac_lo & 0xFF;
mac_addr[5] = (mac_lo & 0xFF00) >> 8;
- if (!getenv("ethaddr")) {
+ if (!env_get("ethaddr")) {
#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_USE_FDT)
printf("<ethaddr> not set. trying DTB ... ");
mac = dtbmacaddr(0);
index a00a83a4a545a2c9d7385b46368e79448669caab..d23b9f3a4f32e263df6e27e52fee744586cbd0a2 100644 (file)
int enable;
enable = 1;
- s = getenv("watchdog");
+ s = env_get("watchdog");
if (s != NULL)
if ((strncmp(s, "off", 3) == 0) || (strncmp(s, "0", 1) == 0))
enable = 0;
unsigned long splash;
#endif
printf("Init Video as ");
- s = getenv("displaywidth");
+ s = env_get("displaywidth");
if (s != NULL)
display_width = simple_strtoul(s, NULL, 10);
else
display_width = 256;
- s = getenv("displayheight");
+ s = env_get("displayheight");
if (s != NULL)
display_height = simple_strtoul(s, NULL, 10);
else
vcxk_init(display_width, display_height);
#ifdef CONFIG_SPLASH_SCREEN
- s = getenv("splashimage");
+ s = env_get("splashimage");
if (s != NULL) {
splash = simple_strtoul(s, NULL, 16);
vcxk_acknowledge_wait();
index 3cd4dc95fe32c111f507ca42c5c09eca3b8830a3..5e75eb0b6438e8d11e26b00925632ec890c1423a 100644 (file)
{ "mxc_nand", MTD_DEV_TYPE_NAND, }, /* NAND flash */
};
- if (getenv("fdt_noauto")) {
+ if (env_get("fdt_noauto")) {
puts(" Skiping ft_board_setup (fdt_noauto defined)\n");
return 0;
}
index 416af469fa731e17ee443fb4e1c8e0dd15c1e420..f639a37d4da01416dc26f6ad63198c1716c14345 100644 (file)
{
init_fan();
#if defined(CONFIG_CMD_I2C) && defined(CONFIG_SYS_I2C_EEPROM_ADDR)
- if (!getenv("ethaddr")) {
+ if (!env_get("ethaddr")) {
uchar mac[6];
if (lacie_read_mac_address(mac) == 0)
eth_env_set_enetaddr("ethaddr", mac);
index fa07288d6e27ba994cb88449c98babe4b008a666..52f36644a3ea7c6dc8d18cb8eff3df61a02b7fda 100644 (file)
int misc_init_r(void)
{
#if defined(CONFIG_CMD_I2C) && defined(CONFIG_SYS_I2C_EEPROM_ADDR)
- if (!getenv("ethaddr")) {
+ if (!env_get("ethaddr")) {
uchar mac[6];
if (lacie_read_mac_address(mac) == 0)
eth_env_set_enetaddr("ethaddr", mac);
diff --git a/board/amazon/kc1/kc1.c b/board/amazon/kc1/kc1.c
index 2d8be1804ae0fc678c531c6a817ce3b4e63bfe00..eead98b24eb39aabf732f096fba3a44987007292 100644 (file)
--- a/board/amazon/kc1/kc1.c
+++ b/board/amazon/kc1/kc1.c
}
if (reboot_mode[0] > 0 && isascii(reboot_mode[0])) {
- if (!getenv("reboot-mode"))
+ if (!env_get("reboot-mode"))
env_set("reboot-mode", (char *)reboot_mode);
}
index ca9c13bcc1eac180f67601bab10d6ceb269915be..611155d3e555221f68a8d47f765f7910a56f99e4 100644 (file)
eth_env_set_enetaddr("ethaddr", mac_addr);
}
- if (!getenv("serial#")) {
+ if (!env_get("serial#")) {
len = meson_sm_read_efuse(EFUSE_SN_OFFSET, serial,
EFUSE_SN_SIZE);
if (len == EFUSE_SN_SIZE)
index bdf41b99c8745777f7e4e674a9cf3cc1aa9f5885..698715ca20698af270a8b599ebea59e95583b9fd 100644 (file)
{
char *my_bootdelay;
char bootmode = 0;
- char const *panel = getenv("panel");
+ char const *panel = env_get("panel");
/*
* Check the boot-source. If booting from NOR Flash,
bootmode |= (gpio_get_value(IMX_GPIO_NR(7, 1)) ? 1 : 0) << 2;
if (bootmode == 7) {
- my_bootdelay = getenv("nor_bootdelay");
+ my_bootdelay = env_get("nor_bootdelay");
if (my_bootdelay != NULL)
env_set("bootdelay", my_bootdelay);
else
diff --git a/board/atmel/sama5d2_xplained/sama5d2_xplained.c b/board/atmel/sama5d2_xplained/sama5d2_xplained.c
index 4a06cda6f4a50fa8cc1ba3170d9eb4d09f130ef0..3f0860c555a5d464eb44a1d164450d1900ff1e0f 100644 (file)
const char *ETHADDR_NAME = "ethaddr";
struct udevice *bus, *dev;
- if (getenv(ETHADDR_NAME))
+ if (env_get(ETHADDR_NAME))
return 0;
if (uclass_get_device_by_seq(UCLASS_I2C, 1, &bus)) {
index a9d9ce6fa5bb76f33a18bc9f826eea4c620f1400..e174336e2c9c918dabfb697ebe18f6efc560c38b 100644 (file)
#if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \
(defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD))
- if (!getenv("ethaddr")) {
+ if (!env_get("ethaddr")) {
printf("<ethaddr> not set. Validating first E-fuse MAC\n");
if (is_valid_ethaddr(mac_addr))
index 2215c29c9c625c1ffddb4508b86ddc8b740eff37..25e5c3d80cd989b9f64adb383933393178ba1103 100644 (file)
#ifdef CONFIG_REVISION_TAG
u32 get_board_rev(void)
{
- if (getenv("revision#") != NULL)
- return simple_strtoul(getenv("revision#"), NULL, 10);
+ if (env_get("revision#") != NULL)
+ return simple_strtoul(env_get("revision#"), NULL, 10);
return 0;
}
#endif
index e82c6918414088fbc53691f09eedf05ea1ee1295..8733a9af163b1489eb3a0d1f4e0f03aee1a911d3 100644 (file)
at91_set_A_periph(AT91_PIN_PE6, 1); /* power up */
/* Select the second timing index for board rev 2 */
- rev_str = getenv("board_rev");
+ rev_str = env_get("board_rev");
if (rev_str && !strncmp(rev_str, "2", 1)) {
struct udevice *dev;
* Set MAC address so we do not need to init Ethernet before Linux
* boot
*/
- env_str = getenv("ethaddr");
+ env_str = env_get("ethaddr");
if (env_str) {
struct at91_emac *emac = (struct at91_emac *)ATMEL_BASE_EMAC;
/* Parse MAC address */
&emac->sa2l);
writel((env_enetaddr[4] | env_enetaddr[5] << 8), &emac->sa2h);
- printf("MAC: %s\n", getenv("ethaddr"));
+ printf("MAC: %s\n", env_get("ethaddr"));
} else {
/* Not set in environment */
printf("MAC: not set\n");
index b4c6a0b45d35a71fd1a363aaa23014f125db3e84..999ed95c31d95a804fc57f8222be81d1938c1e59 100644 (file)
--- a/board/bosch/shc/board.c
+++ b/board/bosch/shc/board.c
#if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \
(defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD))
- if (!getenv("ethaddr")) {
+ if (!env_get("ethaddr")) {
printf("<ethaddr> not set. Validating first E-fuse MAC\n");
if (is_valid_ethaddr(mac_addr))
index 0e2c4fc0ef4a472f5e991496d396fde288b81172..3b92b64f6a40bcd8a3fefa85d9ba87659e8a92b8 100644 (file)
int board_cfb_skip(void)
{
- return NULL != getenv("novideo");
+ return NULL != env_get("novideo");
}
static void setup_display(void)
char keypress[ARRAY_SIZE(buttons)+1];
numpressed = read_keys(keypress);
if (numpressed) {
- char *kbd_magic_keys = getenv("magic_keys");
+ char *kbd_magic_keys = env_get("magic_keys");
char *suffix;
/*
* loop over all magic keys
char *keys;
char magic[sizeof(kbd_magic_prefix) + 1];
sprintf(magic, "%s%c", kbd_magic_prefix, *suffix);
- keys = getenv(magic);
+ keys = env_get(magic);
if (keys) {
if (!strcmp(keys, keypress))
break;
char cmd_name[sizeof(kbd_command_prefix) + 1];
char *cmd;
sprintf(cmd_name, "%s%c", kbd_command_prefix, *suffix);
- cmd = getenv(cmd_name);
+ cmd = env_get(cmd_name);
if (cmd) {
env_set("preboot", cmd);
return;
diff --git a/board/broadcom/bcm23550_w1d/bcm23550_w1d.c b/board/broadcom/bcm23550_w1d/bcm23550_w1d.c
index 5f4c634362abef66b8fd293e8b046314934e77d6..0267582186a64df83435e95547e2e0895b2f269e 100644 (file)
int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
{
debug("%s\n", __func__);
- if (!getenv("serial#"))
+ if (!env_get("serial#"))
g_dnl_set_serialnumber(CONFIG_USB_SERIALNO);
return 0;
}
index f5b94f6430fe80f049aa8228a171a2bff9c6ca27..8f48ccbf1c5f814adb6abeb391324f7527141c04 100644 (file)
int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
{
debug("%s\n", __func__);
- if (!getenv("serial#"))
+ if (!env_get("serial#"))
g_dnl_set_serialnumber(CONFIG_USB_SERIALNO);
return 0;
}
index 83244c3ad4195e5b00385bbde94d7cb9ba6b1538..f81fa95c18ae9b9e8b4ea43e8ac1f359ba3b045d 100644 (file)
* Default MAC address comes from CONFIG_ETHADDR + DIP switches 1-6.
*/
- char *s = getenv("ethaddr");
+ char *s = env_get("ethaddr");
if (s == 0) {
unsigned int x;
char s[] = __stringify(CONFIG_ETHBASE);
index d2992d3a6335dd28350ff7b2efc85943f4ea4037..0ad10056fe965d7ec727c160545d8d7900550536 100644 (file)
gpio_set_value(CL_SOM_AM57X_GPIO_PHY1_RST, 1);
mdelay(20);
- cpsw_phy_envval = getenv("cpsw_phy");
+ cpsw_phy_envval = env_get("cpsw_phy");
if (cpsw_phy_envval != NULL)
cpsw_act_phy = simple_strtoul(cpsw_phy_envval, NULL, 0);
index 236822654657a9c0cf89988054f5aa3241391349..5a8ee13c8b748901944c6cc1f2e27c54abcff957 100644 (file)
{
int ret;
struct display_info_t *preset;
- char const *panel = getenv("displaytype");
+ char const *panel = env_get("displaytype");
if (!panel) /* Also accept panel for backward compatibility */
- panel = getenv("panel");
+ panel = env_get("panel");
if (!panel)
return -ENOENT;
index 61707f5b900e2f0278773592c72ce83bb3e6fb52..ed2077e3617904c32f1d49cc09a52292df5015a9 100644 (file)
{
struct prcm *prcm = (struct prcm *)PRCM_BASE;
char *custom_lcd;
- char *displaytype = getenv("displaytype");
+ char *displaytype = env_get("displaytype");
if (displaytype == NULL)
return;
lcd_def = env_parse_displaytype(displaytype);
/* If we did not recognize the preset, check if it's an env variable */
if (lcd_def == NONE) {
- custom_lcd = getenv(displaytype);
+ custom_lcd = env_get(displaytype);
if (custom_lcd == NULL || parse_customlcd(custom_lcd) < 0)
return;
}
index ac66248b3ff794181cd345f0a96a99fc94479513..8cd0090887a82ef2f1be2ecea52ff7bfda426e4f 100644 (file)
return 0;
/* set level of MIPI if specified */
- lv_mipi = getenv("lv_mipi");
+ lv_mipi = env_get("lv_mipi");
if (lv_mipi)
return 0;
{
int i;
int ret;
- char const *panel = getenv("panel");
+ char const *panel = env_get("panel");
if (!panel) {
for (i = 0; i < ARRAY_SIZE(displays); i++) {
struct display_info_t const *dev = displays + i;
index 8cab357a9268a9809975c8084ba9d50eec3395f5..f8c8bff64c235abe692d552d4a07957233ea1f25 100644 (file)
u32 maxcpuclk = CONFIG_DA850_EVM_MAX_CPU_CLK;
u32 rev = 0;
- s = getenv("maxcpuclk");
+ s = env_get("maxcpuclk");
if (s)
maxcpuclk = simple_strtoul(s, NULL, 10);
index 29296b04781dfff797072e04946bb2814c9d9082..565020760d5591a7511b47a6bcc3a5fa57dfa103 100644 (file)
if ((REG(CHIP_REV_ID_REG) & 0x3f) == 0x10)
return;
- if (!strcmp(getenv("dspwake"), "no"))
+ if (!strcmp(env_get("dspwake"), "no"))
return;
*resetvect++ = 0x1E000; /* DSP Idle */
uint8_t tmp[20], addr[10];
- if (getenv("ethaddr") == NULL) {
+ if (env_get("ethaddr") == NULL) {
/* Read Ethernet MAC address from EEPROM */
if (dvevm_read_mac_address(addr)) {
/* Set Ethernet MAC address from EEPROM */
index 93a02ab0eedeb18382106dc3b98c8b3463cae416..0c5900a15a425cf28180a227a3a2c9cb46505fb0 100644 (file)
--- a/board/esd/meesc/meesc.c
+++ b/board/esd/meesc/meesc.c
puts("Board: EtherCAN/2 Gateway");
break;
}
- if (getenv_f("serial#", str, sizeof(str)) > 0) {
+ if (env_get_f("serial#", str, sizeof(str)) > 0) {
puts(", serial# ");
puts(str);
}
{
char *str;
- char *serial = getenv("serial#");
+ char *serial = env_get("serial#");
if (serial) {
str = strchr(serial, '_');
if (str && (strlen(str) >= 4)) {
* In some cases this this needs to be set to 4.
* Check the user has set environment mdiv to 4 to change the divisor.
*/
- if ((str = getenv("mdiv")) && (strcmp(str, "4") == 0)) {
+ str = env_get("mdiv");
+ if (str && (strcmp(str, "4") == 0)) {
writel((readl(&pmc->mckr) & ~AT91_PMC_MDIV) |
AT91SAM9_PMC_MDIV_4, &pmc->mckr);
at91_clock_init(CONFIG_SYS_AT91_MAIN_CLOCK);
index 83a70153e875491bd9577a94693f08d749422b71..1fea91b3b5e955f732b3e50239c8dd88d7185c5a 100644 (file)
vid, vdd_target/10);
/* check override variable for overriding VDD */
- vdd_string = getenv("b4qds_vdd_mv");
+ vdd_string = env_get("b4qds_vdd_mv");
if (vdd_override == 0 && vdd_string &&
!strict_strtoul(vdd_string, 10, &vdd_string_override))
vdd_override = vdd_string_override;
* Extract hwconfig from environment since environment
* is not setup properly yet
*/
- getenv_f("hwconfig", buffer, sizeof(buffer));
+ env_get_f("hwconfig", buffer, sizeof(buffer));
buf = buffer;
if (hwconfig_subarg_cmp_f("fsl_b4860_serdes2",
index c593cff5e703c656706026f1d50ee5c803807643..152ad84672a48607b98fdffebec6839bde910e3d 100644 (file)
/* Only initialize environment variables that are blank
* (i.e. have not yet been set)
*/
- if (!getenv(enetvar))
+ if (!env_get(enetvar))
env_set(enetvar, ethaddr);
}
}
index 9b65c13b1ab5a7f4c95004c8d59c8ae9e87dc97b..d6d1bfc861677948ab79586c24ac273433962d08 100644 (file)
vdd_target = vdd[vid];
/* check override variable for overriding VDD */
- vdd_string = getenv(CONFIG_VID_FLS_ENV);
+ vdd_string = env_get(CONFIG_VID_FLS_ENV);
if (vdd_override == 0 && vdd_string &&
!strict_strtoul(vdd_string, 10, &vdd_string_override))
vdd_override = vdd_string_override;
vdd_target = vdd[vid];
/* check override variable for overriding VDD */
- vdd_string = getenv(CONFIG_VID_FLS_ENV);
+ vdd_string = env_get(CONFIG_VID_FLS_ENV);
if (vdd_override == 0 && vdd_string &&
!strict_strtoul(vdd_string, 10, &vdd_string_override))
vdd_override = vdd_string_override;
index defcac52634fac2be3f595b935673df1b17560f5..aca29bc3613e8d6404b2d9b5e11efb261b25bf25 100644 (file)
>> FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_SHIFT;
char *env_hwconfig;
- env_hwconfig = getenv("hwconfig");
+ env_hwconfig = env_get("hwconfig");
switch (serdes1_prtcl) {
case 0x07:
>> FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_SHIFT;
int *riser_phy_addr;
- char *env_hwconfig = getenv("hwconfig");
+ char *env_hwconfig = env_get("hwconfig");
if (hwconfig_f("xqsgmii", env_hwconfig))
riser_phy_addr = &xqsgii_riser_phy_addr[0];
unsigned int i;
char *env_hwconfig;
- env_hwconfig = getenv("hwconfig");
+ env_hwconfig = env_get("hwconfig");
initialize_dpmac_to_slot();
index f36fb9810bd2d7a365fd540a24a3560a63a73f90..83773d0af5dd1b07f832eba250bf12575836fa2f 100644 (file)
val = in_le32(dcfg_ccsr + DCFG_RCWSR13 / 4);
- env_hwconfig = getenv("hwconfig");
+ env_hwconfig = env_get("hwconfig");
if (hwconfig_f("dspi", env_hwconfig) &&
DCFG_RCWSR13_DSPI == (val & (u32)(0xf << 8)))
index d7122b3dfcafccbd987deceb8c62009d840ee669..07ba0266d57cc64fe761dd488de05b56ea753f49 100644 (file)
val = in_le32(dcfg_ccsr + DCFG_RCWSR13 / 4);
- env_hwconfig = getenv("hwconfig");
+ env_hwconfig = env_get("hwconfig");
if (hwconfig_f("dspi", env_hwconfig) &&
DCFG_RCWSR13_DSPI == (val & (u32)(0xf << 8)))
index 39c40e5cc95fdcc61905df799cb821b6424588dc..e5d3dfd4545ec87ab9b88f7dc517fbb8a9ad1253 100644 (file)
static int is_pex_x2(void)
{
- const char *pex_x2 = getenv("pex_x2");
+ const char *pex_x2 = env_get("pex_x2");
if (pex_x2 && !strcmp(pex_x2, "yes"))
return 1;
index 319f0479e2c246e454f5c260463ec20916569c19..9a0ab7f2ad2af93d58fc80ab5f7aaa2317b88e00 100644 (file)
char buffer[HWCONFIG_BUFFER_SIZE] = {0};
int esdhc_hwconfig_enabled = 0;
- if (getenv_f("hwconfig", buffer, sizeof(buffer)) > 0)
+ if (env_get_f("hwconfig", buffer, sizeof(buffer)) > 0)
esdhc_hwconfig_enabled = hwconfig_f("esdhc", buffer);
if (esdhc_hwconfig_enabled == 0)
index 86ec7508dbbb27390c7fca4763043e39456266b4..cc2c855b88f9428a17ea21067162acd5ae7df5c1 100644 (file)
int board_video_skip(void)
{
int ret;
- char const *e = getenv("panel");
+ char const *e = env_get("panel");
if (e) {
if (strcmp(e, "claa") == 0) {
index bc5e8a9d3e0f63de4f983086550a4a2b483d5199..5fb0f0438761174cc1a357b2f983b2a8a312dbde 100644 (file)
int board_video_skip(void)
{
int ret;
- char const *e = getenv("panel");
+ char const *e = env_get("panel");
if (e) {
if (strcmp(e, "seiko") == 0) {
diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
index 51217c58e5782ef5630fcbcd9701dff04fa4d05c..9ae38ce1154303bc377ee0d8d9217827d9d63b50 100644 (file)
#ifdef CONFIG_VSC7385_ENET
/* If a VSC7385 microcode image is present, then upload it. */
- if ((tmp = getenv("vscfw_addr")) != NULL) {
+ tmp = env_get("vscfw_addr");
+ if (tmp) {
vscfw_addr = simple_strtoul(tmp, NULL, 16);
printf("uploading VSC7385 microcode from %x\n", vscfw_addr);
if (vsc7385_upload_firmware((void *) vscfw_addr,
index 8f9e7e82550dfd340803a8fe9faa8f41e37751d1..2bdd6a349d7991af5e9f0ea2f9218ada5a6fca7a 100644 (file)
vdd_target = vdd[vid];
/* check override variable for overriding VDD */
- vdd_string = getenv("t4240qds_vdd_mv");
+ vdd_string = env_get("t4240qds_vdd_mv");
if (vdd_override == 0 && vdd_string &&
!strict_strtoul(vdd_string, 10, &vdd_string_override))
vdd_override = vdd_string_override;
index 46404b4d59f6f3bc8a13fa998e6211bda2a03390..e9865b4adbfd4a8a7785241e3f67eab198c91d31 100644 (file)
char arg[10];
size_t len;
int i;
- int quiet = simple_strtol(getenv("quiet"), NULL, 10);
+ int quiet = simple_strtol(env_get("quiet"), NULL, 10);
if (board >= GW_UNKNOWN)
return;
index 61298ab2fd62da8bb7b4312c8691ce640266df7c..4ddc7e1fa218613c023360c886b1fcda91b5c0fe 100644 (file)
#endif
/* default to the first detected enet dev */
- if (!getenv("ethprime")) {
+ if (!env_get("ethprime")) {
struct eth_device *dev = eth_get_dev_by_index(0);
if (dev) {
env_set("ethprime", dev->name);
- printf("set ethprime to %s\n", getenv("ethprime"));
+ printf("set ethprime to %s\n", env_get("ethprime"));
}
}
*/
void get_board_serial(struct tag_serialnr *serialnr)
{
- char *serial = getenv("serial#");
+ char *serial = env_get("serial#");
if (serial) {
serialnr->high = 0;
int quiet; /* Quiet or minimal output mode */
quiet = 0;
- p = getenv("quiet");
+ p = env_get("quiet");
if (p)
quiet = simple_strtol(p, NULL, 10);
else
for (i = 0; i < (sizeof(str)-1) && info->model[i]; i++)
str[i] = tolower(info->model[i]);
env_set("model", str);
- if (!getenv("fdt_file")) {
+ if (!env_get("fdt_file")) {
sprintf(fdt, "%s-%s.dtb", cputype, str);
env_set("fdt_file", fdt);
}
/* initialize env from EEPROM */
if (test_bit(EECONFIG_ETH0, info->config) &&
- !getenv("ethaddr")) {
+ !env_get("ethaddr")) {
eth_env_set_enetaddr("ethaddr", info->mac0);
}
if (test_bit(EECONFIG_ETH1, info->config) &&
- !getenv("eth1addr")) {
+ !env_get("eth1addr")) {
eth_env_set_enetaddr("eth1addr", info->mac1);
}
}
/* Set a non-initialized hwconfig based on board configuration */
- if (!strcmp(getenv("hwconfig"), "_UNKNOWN_")) {
+ if (!strcmp(env_get("hwconfig"), "_UNKNOWN_")) {
buf[0] = 0;
if (gpio_cfg[board_type].rs232_en)
strcat(buf, "rs232;");
int j;
sprintf(mac, "eth1addr");
- tmp = getenv(mac);
+ tmp = env_get(mac);
if (tmp) {
for (j = 0; j < 6; j++) {
mac_addr[j] = tmp ?
{ "sst,w25q256", MTD_DEV_TYPE_NOR, }, /* SPI flash */
{ "fsl,imx6q-gpmi-nand", MTD_DEV_TYPE_NAND, }, /* NAND flash */
};
- const char *model = getenv("model");
- const char *display = getenv("display");
+ const char *model = env_get("model");
+ const char *display = env_get("display");
int i;
char rev = 0;
}
}
- if (getenv("fdt_noauto")) {
+ if (env_get("fdt_noauto")) {
puts(" Skiping ft_board_setup (fdt_noauto defined)\n");
return 0;
}
printf(" Adjusting FDT per EEPROM for %s...\n", model);
/* board serial number */
- fdt_setprop(blob, 0, "system-serial", getenv("serial#"),
- strlen(getenv("serial#")) + 1);
+ fdt_setprop(blob, 0, "system-serial", env_get("serial#"),
+ strlen(env_get("serial#")) + 1);
/* board (model contains model from device-tree) */
fdt_setprop(blob, 0, "board", info->model,
strlen((const char *)info->model) + 1);
/* set desired digital video capture format */
- ft_sethdmiinfmt(blob, getenv("hdmiinfmt"));
+ ft_sethdmiinfmt(blob, env_get("hdmiinfmt"));
/*
* Board model specific fixups
}
#if defined(CONFIG_CMD_PCI)
- if (!getenv("nopcifixup"))
+ if (!env_get("nopcifixup"))
ft_board_pci_fixup(blob, bd);
#endif
* remove nodes by alias path if EEPROM config tells us the
* peripheral is not loaded on the board.
*/
- if (getenv("fdt_noconfig")) {
+ if (env_get("fdt_noconfig")) {
puts(" Skiping periperhal config (fdt_noconfig defined)\n");
return 0;
}
diff --git a/board/gateworks/gw_ventana/gw_ventana_spl.c b/board/gateworks/gw_ventana/gw_ventana_spl.c
index baa8480b6c440909e4589d3f041e53613f9ecc43..feea228b3d61a3ebe39a367904aed72b4b6346c1 100644 (file)
#ifdef CONFIG_SPL_ENV_SUPPORT
env_init();
env_load();
- debug("boot_os=%s\n", getenv("boot_os"));
+ debug("boot_os=%s\n", env_get("boot_os"));
if (getenv_yesno("boot_os") == 1)
ret = 0;
#else
index a4a6f1cca5ed38998e0f750b22ef9ac335abdee3..d75e08b39f5b58adf8c754783085910d0401b4b7 100644 (file)
char *hexprog;
struct key_program *prog;
- cmd = getenv("loadkeyprogram");
+ cmd = env_get("loadkeyprogram");
if (!cmd || run_command(cmd, 0))
return 1;
- hexprog = getenv("keyprogram");
+ hexprog = env_get("keyprogram");
if (decode_hexstr(hexprog, &binprog))
return 1;
index c6566e9196ca17d3d6700161ca8ece90c1f2ac08..7e485074ce027bc9165c87e731e9700f70e04476 100644 (file)
int checkboard(void)
{
- char *s = getenv("serial#");
+ char *s = env_get("serial#");
bool hw_type_cat = pca9698_get_value(0x20, 20);
puts("Board: ");
index 34e9d1956e2e5462c3f563f015631cc2c0a0cabf..fec691515d4597016c4bbfa5d4f7748e371b3238 100644 (file)
int checkboard(void)
{
- char *s = getenv("serial#");
+ char *s = env_get("serial#");
bool hw_type_cat = pca9698_get_value(0x20, 18);
puts("Board: ");
index 95f11fb69f36dd5d01d713205bb7444c53285fe4..61c030a4588c5b566c11b2bae26c3f1917b13787 100644 (file)
goto failure;
/* run "prepboot" from env to get "mmcdev" set */
- cptr = getenv("prepboot");
+ cptr = env_get("prepboot");
if (cptr && !run_command(cptr, 0))
- mmcdev = getenv("mmcdev");
+ mmcdev = env_get("mmcdev");
if (!mmcdev)
goto failure;
- cptr = getenv("ramdiskimage");
+ cptr = env_get("ramdiskimage");
if (cptr)
image_path = cptr;
index 01064dcfde10a8e131726ebb145155e2c8c1e2fc..24e58cbf0013e4d5762febdde987668a3dd2ef98 100644 (file)
#ifdef CONFIG_TRAILBLAZER
int do_bootd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
- return run_command(getenv("bootcmd"), flag);
+ return run_command(env_get("bootcmd"), flag);
}
int board_early_init_r(void)
index 2900109bbd3ba7c37b96371630c665e48d40a429..2f5974a246aa0f30c8227147da5ba3436796a13e 100644 (file)
mac_addr[4] = mac_lo & 0xFF;
mac_addr[5] = (mac_lo & 0xFF00) >> 8;
- if (!getenv("ethaddr")) {
+ if (!env_get("ethaddr")) {
printf("<ethaddr> not set. Validating first E-fuse MAC\n");
if (is_valid_ethaddr(mac_addr))
mac_addr[4] = mac_lo & 0xFF;
mac_addr[5] = (mac_lo & 0xFF00) >> 8;
- if (!getenv("eth1addr")) {
+ if (!env_get("eth1addr")) {
if (is_valid_ethaddr(mac_addr))
eth_env_set_enetaddr("eth1addr", mac_addr);
}
index 24956927ac44d16039d4b3e33f86e185558e8023..941e7ea2c8ed8019b33dfb4bcc74b1c515e75372 100644 (file)
static int check_mmc_autodetect(void)
{
- char *autodetect_str = getenv("mmcautodetect");
+ char *autodetect_str = env_get("mmcautodetect");
if ((autodetect_str != NULL) &&
(strcmp(autodetect_str, "yes") == 0)) {
index e51043aa91472ed221b93c7ee2b34cecfd9abec4..f7c05ab08fa23d427b83f5509e9c081af6ddb56d 100644 (file)
boot_choice = readl(HB_SREG_A9_BOOT_SRC_STAT) & 0xff;
sprintf(envbuffer, "bootcmd%d", boot_choice);
- if (getenv(envbuffer)) {
+ if (env_get(envbuffer)) {
sprintf(envbuffer, "run bootcmd%d", boot_choice);
env_set("bootcmd", envbuffer);
} else
index aaafae86a80fcf2eee4c3ae97fc5086dd7123a11..4b1e6d0f471f6f7d7fdeb14cb24dd97cc989eee5 100644 (file)
int board_late_init(void)
{
- if (!getenv("serial#"))
+ if (!env_get("serial#"))
assign_serial();
- if (!getenv("hardware_id"))
+ if (!env_get("hardware_id"))
assign_hardware_id();
return 0;
index 56d304424108f4897a3da0705537ebd99f486021..6cd281218ee124a9cef8e912b2fc768595ca1ddd 100644 (file)
env_set("pnvramaddr", (char *)buf);
/* try to read rootfssize (ram image) from environment */
- p = getenv("rootfssize");
+ p = env_get("rootfssize");
if (p != NULL)
strict_strtoul(p, 16, &rootfssize);
pram = (rootfssize + CONFIG_KM_RESERVED_PRAM + CONFIG_KM_PHRAM +
}
/* now try to read values from environment if available */
- p = getenv("boardid");
+ p = env_get("boardid");
if (p != NULL)
rc = strict_strtoul(p, 16, &envbid);
- p = getenv("hwkey");
+ p = env_get("hwkey");
if (p != NULL)
rc = strict_strtoul(p, 16, &envhwkey);
* BoardId/HWkey not available in the environment, so try the
* environment variable for BoardId/HWkey list
*/
- char *bidhwklist = getenv("boardIdListHex");
+ char *bidhwklist = env_get("boardIdListHex");
if (bidhwklist) {
int found = 0;
#if defined(CONFIG_POST)
testpin = post_hotkeys_pressed();
#endif
- s = getenv("test_bank");
+ s = env_get("test_bank");
/* when test_bank is not set, act as if testpin is not asserted */
testboot = (testpin != 0) && (s);
if (verbose) {
index dc40a83fc08c247915196a344f1895b0a9739ae1..f1321d9899f84e63dc05faf91ad6d03523c5d792 100644 (file)
GET_STRING("IVM_Symbol", IVM_POS_SYMBOL_ONLY, 8)
GET_STRING("IVM_DeviceName", IVM_POS_SHORT_TEXT, 64)
- tmp = (unsigned char *) getenv("IVM_DeviceName");
+ tmp = (unsigned char *)env_get("IVM_DeviceName");
if (tmp) {
int len = strlen((char *)tmp);
int i = 0;
index 08ae9ae3467937607172ea58f27de816dce6b639..af1ebc4101e885a5aa2bf14d7a117920542755fa 100644 (file)
#if defined(CONFIG_KM_MGCOGE3UN)
char *wait_for_ne;
u8 dip_switch = kw_gpio_get_value(KM_FLASH_ERASE_ENABLE);
- wait_for_ne = getenv("waitforne");
+ wait_for_ne = env_get("waitforne");
if ((wait_for_ne != NULL) && (dip_switch == 0)) {
if (strcmp(wait_for_ne, "true") == 0) {
index 095e467ac0b3f285938e39837c42700a8af98b23..671bddfa1cdf309867d7cb36a029d8200cb86c46 100644 (file)
unsigned char mac_addr[6];
/* get the mac addr from env */
- tmp = getenv("ethaddr");
+ tmp = env_get("ethaddr");
if (!tmp) {
printf("ethaddr env variable not defined\n");
return;
index baca7223fa34f03e611167296f3888b9b5d9a939..f0ace03009e79d9b8d550d242dc1d16739f0c0c8 100644 (file)
int ret;
/* If 'ethaddr' is already set, do nothing. */
- if (getenv("ethaddr"))
+ if (env_get("ethaddr"))
return 0;
/* EEPROM is at bus 2. */
index 4906e4f9d223cb8178c46fe4f33a2c2635df51cc..a299f761f96e0606d89a26d8c3d6843937ebfcde 100644 (file)
--- a/board/lg/sniper/sniper.c
+++ b/board/lg/sniper/sniper.c
}
if (reboot_mode[0] > 0 && isascii(reboot_mode[0])) {
- if (!getenv("reboot-mode"))
+ if (!env_get("reboot-mode"))
env_set("reboot-mode", (char *)reboot_mode);
}
index 8d0a66621d89fe5daeb325d17770dded50c36353..4f7e018deabbf0cf86105b90b97535218c2d2830 100644 (file)
return 1;
env_init();
- ret = getenv_f("boot_os", s, sizeof(s));
+ ret = env_get_f("boot_os", s, sizeof(s));
if ((ret != -1) && (strcmp(s, "no") == 0))
return 1;
* recovery_status = <any value> -> start SWUpdate
*
*/
- ret = getenv_f("recovery_status", s, sizeof(s));
+ ret = env_get_f("recovery_status", s, sizeof(s));
if (ret != -1)
return 1;
index e86e0c30276474db53f3200d988f289d89a1d0ff..fe3f9e664f982e7c51bcbe0c4ab5ab56eec95c77 100644 (file)
gd->bd->bi_arch_number = board->machine_id;
/* If the user has not set fdtimage, set the default */
- if (!getenv("fdtimage"))
+ if (!env_get("fdtimage"))
env_set("fdtimage", board->fdtfile);
}
index 8bf8d5f4e813fe0693267d296fbe9bd45454108c..510746d35cb1829ef602ceacfad41f9e9c043441 100644 (file)
--- a/board/micronas/vct/vct.c
+++ b/board/micronas/vct/vct.c
int checkboard(void)
{
char buf[64];
- int i = getenv_f("serial#", buf, sizeof(buf));
+ int i = env_get_f("serial#", buf, sizeof(buf));
u32 config0 = read_c0_prid();
if ((config0 & 0xff0000) == PRID_COMP_LEGACY
index 889e748f983e9f12f591cdf16652916ca80027d9..7764288811718d02cd0d27cda108a26e75a5588f 100644 (file)
--- a/board/nokia/rx51/rx51.c
+++ b/board/nokia/rx51/rx51.c
params->u.core.rootdev = 0x0;
/* append omap atag only if env setup_omap_atag is set to 1 */
- str = getenv("setup_omap_atag");
+ str = env_get("setup_omap_atag");
if (!str || str[0] != '1')
return;
- str = getenv("setup_console_atag");
+ str = env_get("setup_console_atag");
if (str && str[0] == '1')
setup_console_atag = 1;
else
setup_console_atag = 0;
- setup_boot_reason_atag = getenv("setup_boot_reason_atag");
- setup_boot_mode_atag = getenv("setup_boot_mode_atag");
+ setup_boot_reason_atag = env_get("setup_boot_reason_atag");
+ setup_boot_mode_atag = env_get("setup_boot_mode_atag");
params = *in_params;
t = (struct tag_omap *)¶ms->u;
index 7ff7b269f9c6680acbc0dfd8fe521587838ec97d..530f1496171b406875b2d31d6c08f30aeadf306b 100644 (file)
{
const char *fdtfile;
- if (getenv("fdtfile"))
+ if (env_get("fdtfile"))
return;
fdtfile = model->fdtfile;
*/
static void set_fdt_addr(void)
{
- if (getenv("fdt_addr"))
+ if (env_get("fdt_addr"))
return;
if (fdt_magic(fw_dtb_pointer) != FDT_MAGIC)
if (!model->has_onboard_eth)
return;
- if (getenv("usbethaddr"))
+ if (env_get("usbethaddr"))
return;
BCM2835_MBOX_INIT_HDR(msg);
eth_env_set_enetaddr("usbethaddr", msg->get_mac_address.body.resp.mac);
- if (!getenv("ethaddr"))
- env_set("ethaddr", getenv("usbethaddr"));
+ if (!env_get("ethaddr"))
+ env_set("ethaddr", env_get("usbethaddr"));
return;
}
int ret;
char serial_string[17] = { 0 };
- if (getenv("serial#"))
+ if (env_get("serial#"))
return;
BCM2835_MBOX_INIT_HDR(msg);
index 44f412db5d82cdc36dc6c3c978a49993e4e4892c..ae2a6e6bfa637a82d8aa80b2de3b6b56edf97cdf 100644 (file)
if (board_is_odroidxu4())
return info;
- return getenv("dfu_alt_system");
+ return env_get("dfu_alt_system");
}
char *get_dfu_alt_boot(char *interface, char *devstr)
index b4cb33240e18dbf431f04d4e0e40bdb6a115580c..e40a2f6e3a6909663ad45d57ebe4f69ebb5841f4 100644 (file)
#ifdef CONFIG_SET_DFU_ALT_INFO
char *get_dfu_alt_system(char *interface, char *devstr)
{
- return getenv("dfu_alt_system");
+ return env_get("dfu_alt_system");
}
char *get_dfu_alt_boot(char *interface, char *devstr)
index 125f6e70700ef33b8c2b50a807f6f22f5cc49a9e..af1a3e75cb508c672c6d5d478948c94943327ffc 100644 (file)
/* just to get secound mac address */
imx_get_mac_from_fuse(1, eth1addr);
- if (!getenv("eth1addr") && is_valid_ethaddr(eth1addr))
+ if (!env_get("eth1addr") && is_valid_ethaddr(eth1addr))
eth_env_set_enetaddr("eth1addr", eth1addr);
imx_iomux_v3_setup_multiple_pads(fec1_pads, ARRAY_SIZE(fec1_pads));
index 760fc71217eb5984b4fe16b53cf23e9a83748691..229b12f308c92597bb56ed4e387a280a206baf61 100644 (file)
}
/* If 'unit_serial' is already set, do nothing. */
- if (!getenv("unit_serial")) {
+ if (!env_get("unit_serial")) {
/* This field is Big Endian ! */
serial = (data[0x54] << 24) | (data[0x55] << 16) |
(data[0x56] << 8) | (data[0x57] << 0);
env_set("unit_serial", str);
}
- if (!getenv("unit_ident")) {
+ if (!env_get("unit_ident")) {
memset(str, 0, sizeof(str));
memcpy(str, &data[0x2e], 18);
env_set("unit_ident", str);
}
/* Set ethernet address from EEPROM. */
- if (!getenv("ethaddr") && is_valid_ethaddr(&data[0x62]))
+ if (!env_get("ethaddr") && is_valid_ethaddr(&data[0x62]))
eth_env_set_enetaddr("ethaddr", &data[0x62]);
return 0;
index b9672274117d38574ca988e61504cfa94b920577..65fa6af2d444eafb330a8c56018e821786b15840 100644 (file)
char *ptr_env;
/* If button is not found we take default */
- ptr_env = getenv(envname);
+ ptr_env = env_get(envname);
if (NULL == ptr_env) {
gpio = def;
} else {
strcat(str_tmp, num);
/* If env var is not found we stop */
- ptr_env = getenv(str_tmp);
+ ptr_env = env_get(str_tmp);
if (NULL == ptr_env)
break;
index d877a9c77145994d19bd888112fc1e20618d8987..8390bdd5f812f60004a0262b0b1ee67dfc29b3fb 100644 (file)
char *kern_size;
char *kern_size_fb;
- partitionset_active = getenv("partitionset_active");
+ partitionset_active = env_get("partitionset_active");
if (partitionset_active) {
if (partitionset_active[0] == 'A')
env_set("partitionset_active", "B");
return -ENOENT;
}
- rootfs = getenv("rootfs");
- rootfs_fallback = getenv("rootfs_fallback");
+ rootfs = env_get("rootfs");
+ rootfs_fallback = env_get("rootfs_fallback");
env_set("rootfs", rootfs_fallback);
env_set("rootfs_fallback", rootfs);
- kern_size = getenv("kernel_size");
- kern_size_fb = getenv("kernel_size_fallback");
+ kern_size = env_get("kernel_size");
+ kern_size_fb = env_get("kernel_size_fallback");
env_set("kernel_size", kern_size_fb);
env_set("kernel_size_fallback", kern_size);
- kern_off = getenv("kernel_Off");
- kern_off_fb = getenv("kernel_Off_fallback");
+ kern_off = env_get("kernel_Off");
+ kern_off_fb = env_get("kernel_Off_fallback");
env_set("kernel_Off", kern_off_fb);
env_set("kernel_Off_fallback", kern_off);
unsigned long boot_retry = 0;
char boot_buf[10];
- upgrade_available = simple_strtoul(getenv("upgrade_available"), NULL,
+ upgrade_available = simple_strtoul(env_get("upgrade_available"), NULL,
10);
if (upgrade_available) {
- boot_retry = simple_strtoul(getenv("boot_retries"), NULL, 10);
+ boot_retry = simple_strtoul(env_get("boot_retries"), NULL, 10);
boot_retry++;
sprintf(boot_buf, "%lx", boot_retry);
env_set("boot_retries", boot_buf);
index fb691c22d961862001f7a895793d10d74101d947..004f37009ae1940dcda657dafda5d5237a37d4b4 100644 (file)
volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
char buf[64];
int f;
- int i = getenv_f("serial#", buf, sizeof(buf));
+ int i = env_get_f("serial#", buf, sizeof(buf));
#ifdef CONFIG_PCI
char *src;
#endif
printf ("hwmon IC init failed\n");
if (flag) {
- param = getenv("brightness");
+ param = env_get("brightness");
rc = param ? simple_strtol(param, NULL, 10) : -1;
if (rc < 0)
rc = DEFAULT_BRIGHTNESS;
diff --git a/board/st/stm32f429-discovery/stm32f429-discovery.c b/board/st/stm32f429-discovery/stm32f429-discovery.c
index 673e7728f1d69f1ce6a59c03a81cfb77bd31eb5b..d6763c306f830350ce599cbd4f28036c4e609601 100644 (file)
char serialno[25];
uint32_t u_id_low, u_id_mid, u_id_high;
- if (!getenv("serial#")) {
+ if (!env_get("serial#")) {
u_id_low = readl(&STM32_U_ID->u_id_low);
u_id_mid = readl(&STM32_U_ID->u_id_mid);
u_id_high = readl(&STM32_U_ID->u_id_high);
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 26732dc40f575ceec58ec0a6b47fdec9bc194e1a..70e01437c4f4efb9b6f4c1417be7133151983ac4 100644 (file)
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
char *serial_string;
unsigned long long serial;
- serial_string = getenv("serial#");
+ serial_string = env_get("serial#");
if (serial_string) {
serial = simple_strtoull(serial_string, NULL, 16);
else
sprintf(ethaddr, "eth%daddr", i);
- if (getenv(ethaddr))
+ if (env_get(ethaddr))
continue;
/* Non OUI / registered MAC address */
eth_env_set_enetaddr(ethaddr, mac_addr);
}
- if (!getenv("serial#")) {
+ if (!env_get("serial#")) {
snprintf(serial_string, sizeof(serial_string),
"%08x%08x", sid[0], sid[3]);
index e02dcf299506f3b99b4db42f01c4e3e90c73f46c..85fda13188d640285cb416ab13bfdc45a0668930 100644 (file)
udelay(5000);
#endif
- e = getenv("gs_base_board");
+ e = env_get("gs_base_board");
if (e != NULL) {
if (strcmp(e, "G283") == 0) {
int key = gpio_get_value(IMX_GPIO_NR(2, 29));
diff --git a/board/tcl/sl50/board.c b/board/tcl/sl50/board.c
index cc65c7b84bf761952c0f3e520cc7d05ebd5759d7..08af279751ac5e1fdce0c8cb38757adffa434fc0 100644 (file)
--- a/board/tcl/sl50/board.c
+++ b/board/tcl/sl50/board.c
#if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \
(defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD))
- if (!getenv("ethaddr")) {
+ if (!env_get("ethaddr")) {
printf("<ethaddr> not set. Validating first E-fuse MAC\n");
if (is_valid_ethaddr(mac_addr))
mac_addr[4] = mac_lo & 0xFF;
mac_addr[5] = (mac_lo & 0xFF00) >> 8;
- if (!getenv("eth1addr")) {
+ if (!env_get("eth1addr")) {
if (is_valid_ethaddr(mac_addr))
eth_env_set_enetaddr("eth1addr", mac_addr);
}
index 25aeebc8d0e9543bf08c6443c83fdc58b6cb1064..8c38f14cded0b45ace3e575e5d58327361a6e4f5 100644 (file)
omap_die_id_display();
- eth_addr = getenv("ethaddr");
+ eth_addr = env_get("ethaddr");
if (eth_addr)
return 0;
index 6e73ae114a65903a5c8772537d356399bb245598..9eaae50f27a0be3ab9a5c0cc3878a4e825089975 100644 (file)
if (ret)
return 0;
- eth_addr = getenv("ethaddr");
+ eth_addr = env_get("ethaddr");
if (!eth_addr)
TAM3517_READ_MAC_FROM_EEPROM(&info);
fb = (void *)0x88000000;
- s = getenv("panel");
+ s = env_get("panel");
if (s) {
index = simple_strtoul(s, NULL, 10);
if (index < ARRAY_SIZE(lcd_cfg))
diff --git a/board/theobroma-systems/puma_rk3399/puma-rk3399.c b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
index 733fe96726bbb360d470293a621b86adac646db1..c6f8eed0c98821ab10941cfecc02ae994986bdae 100644 (file)
{
#if CONFIG_IS_ENABLED(CMD_NET)
int ret;
- const char *cpuid = getenv("cpuid#");
+ const char *cpuid = env_get("cpuid#");
u8 hash[SHA256_SUM_LEN];
int size = sizeof(hash);
u8 mac_addr[6];
/* Only generate a MAC address, if none is set in the environment */
- if (getenv("ethaddr"))
+ if (env_get("ethaddr"))
return;
if (!cpuid) {
char *serial_string;
u64 serial = 0;
- serial_string = getenv("serial#");
+ serial_string = env_get("serial#");
if (serial_string)
serial = simple_strtoull(serial_string, NULL, 16);
index 7bdbc89d5e67e358d3ccb010cb68cdfbfb934365..ab835856e5fee3352f723d74e4651e539d2f40e7 100644 (file)
--- a/board/ti/am335x/board.c
+++ b/board/ti/am335x/board.c
mac_addr[4] = mac_lo & 0xFF;
mac_addr[5] = (mac_lo & 0xFF00) >> 8;
- if (!getenv("ethaddr")) {
+ if (!env_get("ethaddr")) {
printf("<ethaddr> not set. Validating first E-fuse MAC\n");
if (is_valid_ethaddr(mac_addr))
mac_addr[4] = mac_lo & 0xFF;
mac_addr[5] = (mac_lo & 0xFF00) >> 8;
- if (!getenv("eth1addr")) {
+ if (!env_get("eth1addr")) {
if (is_valid_ethaddr(mac_addr))
eth_env_set_enetaddr("eth1addr", mac_addr);
}
index 933ff31a8ef385863a063dc251beab55381ec22b..2c417e75459c7741123bddc6d4f493bb4990f776 100644 (file)
--- a/board/ti/am43xx/board.c
+++ b/board/ti/am43xx/board.c
mac_addr[4] = mac_lo & 0xFF;
mac_addr[5] = (mac_lo & 0xFF00) >> 8;
- if (!getenv("ethaddr")) {
+ if (!env_get("ethaddr")) {
puts("<ethaddr> not set. Validating first E-fuse MAC\n");
if (is_valid_ethaddr(mac_addr))
eth_env_set_enetaddr("ethaddr", mac_addr);
mac_addr[4] = mac_lo & 0xFF;
mac_addr[5] = (mac_lo & 0xFF00) >> 8;
- if (!getenv("eth1addr")) {
+ if (!env_get("eth1addr")) {
if (is_valid_ethaddr(mac_addr))
eth_env_set_enetaddr("eth1addr", mac_addr);
}
index aaa14642736f2a3ce5da36c0cf3c0138372a4806..7bcbc31042f2c05cc01efc73eab970b13f3c7112 100644 (file)
--- a/board/ti/am57xx/board.c
+++ b/board/ti/am57xx/board.c
mac_addr[4] = (mac_lo & 0xFF00) >> 8;
mac_addr[5] = mac_lo & 0xFF;
- if (!getenv("ethaddr")) {
+ if (!env_get("ethaddr")) {
printf("<ethaddr> not set. Validating first E-fuse MAC\n");
if (is_valid_ethaddr(mac_addr))
mac_addr[4] = (mac_lo & 0xFF00) >> 8;
mac_addr[5] = mac_lo & 0xFF;
- if (!getenv("eth1addr")) {
+ if (!env_get("eth1addr")) {
if (is_valid_ethaddr(mac_addr))
eth_env_set_enetaddr("eth1addr", mac_addr);
}
diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c
index 4252074e74c4b0896305c003751ff875c6045369..bdbf7f67969438d7dd4a90e2fce4d2d8d4cf6234 100644 (file)
--- a/board/ti/dra7xx/evm.c
+++ b/board/ti/dra7xx/evm.c
mac_addr[4] = (mac_lo & 0xFF00) >> 8;
mac_addr[5] = mac_lo & 0xFF;
- if (!getenv("ethaddr")) {
+ if (!env_get("ethaddr")) {
printf("<ethaddr> not set. Validating first E-fuse MAC\n");
if (is_valid_ethaddr(mac_addr))
mac_addr[4] = (mac_lo & 0xFF00) >> 8;
mac_addr[5] = mac_lo & 0xFF;
- if (!getenv("eth1addr")) {
+ if (!env_get("eth1addr")) {
if (is_valid_ethaddr(mac_addr))
eth_env_set_enetaddr("eth1addr", mac_addr);
}
index c61baeeb8cf5d76093160db0408caf48120a71fe..ae86dfbe0aabeeed1ed4a66d2125e8427b028259 100644 (file)
--- a/board/ti/ks2_evm/board.c
+++ b/board/ti/ks2_evm/board.c
char *env;
int res = -1;
- env = getenv(env_name);
+ env = env_get(env_name);
if (env)
res = simple_strtol(env, NULL, 0);
u32 ddr3a_size;
int unitrd_fixup = 0;
- env = getenv("mem_lpae");
+ env = env_get("mem_lpae");
lpae = env && simple_strtol(env, NULL, 0);
- env = getenv("uinitrd_fixup");
+ env = env_get("uinitrd_fixup");
unitrd_fixup = env && simple_strtol(env, NULL, 0);
ddr3a_size = 0;
}
/* reserve memory at start of bank */
- env = getenv("mem_reserve_head");
+ env = env_get("mem_reserve_head");
if (env) {
start[0] += ustrtoul(env, &endp, 0);
size[0] -= ustrtoul(env, &endp, 0);
}
- env = getenv("mem_reserve");
+ env = env_get("mem_reserve");
if (env)
size[0] -= ustrtoul(env, &endp, 0);
char *env;
u64 *reserve_start;
- env = getenv("mem_lpae");
+ env = env_get("mem_lpae");
lpae = env && simple_strtol(env, NULL, 0);
if (lpae) {
index 86a7a159e8cddac6b32f385facaf03a03c99de56..7a3e493faf168a908f73463501d434f8cb9da1a1 100644 (file)
setup_iomux_dce_uart();
/* if using the default device tree, use version for V1.0 HW */
- fdt_env = getenv("fdt_file");
+ fdt_env = env_get("fdt_file");
if ((fdt_env != NULL) && (strcmp(FDT_FILE, fdt_env) == 0)) {
env_set("fdt_file", FDT_FILE_V1_0);
printf("patching fdt_file to " FDT_FILE_V1_0 "\n");
index 1bf8ca8f76d9ad17f12dd52ea2ee00ad753d5a6d..328c4c0200d09198177b9941c52f2b30c1ba8429 100644 (file)
len = cli_readline(message);
it = console_buffer[0];
- soc = getenv("soc");
+ soc = env_get("soc");
if (!strcmp("mx6", soc)) {
#ifdef CONFIG_MACH_TYPE
if (it == 'y' || it == 'Y')
index d23589731113760d496ab0ee7c88820d96a697e4..69f596a4ccf185827ed9057b1875826a4b534559 100644 (file)
/* Only initialize environment variables that are blank
* (i.e. have not yet been set)
*/
- if (!getenv(enetvar))
+ if (!env_get(enetvar))
env_set(enetvar, ethaddr);
}
}
index 2e3baeb1188c6a3631952c985c9e97f13dfcb6ec..cb39190c286ae7d8ac33d344477ef7b5e3b500a4 100644 (file)
#if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \
(defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD))
- if (!getenv("ethaddr")) {
+ if (!env_get("ethaddr")) {
printf("<ethaddr> not set. Validating first E-fuse MAC\n");
if (is_valid_ethaddr(mac_addr))
diff --git a/board/work-microwave/work_92105/work_92105_display.c b/board/work-microwave/work_92105/work_92105_display.c
index 37a736351cb02acd5aeb4ac644e507798fd8d645..c997cea6f0d971d9466e90118f291f9e5dd58d6c 100644 (file)
i2c_write(0x2c, 0x01, 1, &enable_backlight, 1);
/* set display contrast */
- display_contrast_str = getenv("fwopt_dispcontrast");
+ display_contrast_str = env_get("fwopt_dispcontrast");
if (display_contrast_str)
display_contrast = simple_strtoul(display_contrast_str,
NULL, 10);
index 4ed6f50e5cf8f023dd40b235ff8b2d768b77ee3b..b76eb948d50ccec8a7ebdf8532c32d7c1ffcd946 100644 (file)
--- a/board/xes/common/board.c
+++ b/board/xes/common/board.c
/* Display board specific information */
puts(" ");
- i = getenv_f("board_rev", buf, sizeof(buf));
+ i = env_get_f("board_rev", buf, sizeof(buf));
if (i > 0)
printf("Rev %s, ", buf);
- i = getenv_f("serial#", buf, sizeof(buf));
+ i = env_get_f("serial#", buf, sizeof(buf));
if (i > 0)
printf("Serial# %s, ", buf);
- i = getenv_f("board_cfg", buf, sizeof(buf));
+ i = env_get_f("board_cfg", buf, sizeof(buf));
if (i > 0)
printf("Cfg %s", buf);
puts("\n");
index b9e8649eb34a5beddda34f9edb499e85ba551987..d17868b0c2b7cec23997f89982008d6a208fb3cc 100644 (file)
* and default boot_targets
*/
new_targets = calloc(1, strlen(mode) +
- strlen(getenv("boot_targets")) + 2);
+ strlen(env_get("boot_targets")) + 2);
- sprintf(new_targets, "%s %s", mode, getenv("boot_targets"));
+ sprintf(new_targets, "%s %s", mode, env_get("boot_targets"));
env_set("boot_targets", new_targets);
return 0;
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 96d7b72df2333cc5be9400a350daa860896dc1ca..27ffcd55bcec3a3f0ae2c01fb6bddbd7ea5c5d52 100644 (file)
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
sprintf(name, "eth%iaddr", idx);
else
strcpy(name, "ethaddr");
- val = getenv(name);
+ val = env_get(name);
if (!val)
val = "(not set)";
printf("%-12s= %s\n", name, val);
} while (dev);
printf("current eth = %s\n", eth_get_name());
- printf("ip_addr = %s\n", getenv("ipaddr"));
+ printf("ip_addr = %s\n", env_get("ipaddr"));
}
#endif
#if defined(CONFIG_HAS_ETH5)
print_eth(5);
#endif
- printf("IP addr = %s\n", getenv("ipaddr"));
+ printf("IP addr = %s\n", env_get("ipaddr"));
#endif
}
diff --git a/cmd/bootm.c b/cmd/bootm.c
index daf15d9e80fcb71be0e93cb0fed7eb214d0c213c..df0bbe19ca2ad88a81b477871f5af8c37deaf855 100644 (file)
--- a/cmd/bootm.c
+++ b/cmd/bootm.c
int bootm_maybe_autostart(cmd_tbl_t *cmdtp, const char *cmd)
{
- const char *ep = getenv("autostart");
+ const char *ep = env_get("autostart");
if (ep && !strcmp(ep, "yes")) {
char *local_args[2];
#if defined(CONFIG_CMD_BOOTD)
int do_bootd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
- return run_command(getenv("bootcmd"), flag);
+ return run_command(env_get("bootcmd"), flag);
}
U_BOOT_CMD(
diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c
index 5879065c2ea45cc7b9731884aad1aa9a95128340..870db7c1dea39084d38cb5824350f5bb1a3aa5ed 100644 (file)
--- a/cmd/bootmenu.c
+++ b/cmd/bootmenu.c
return NULL;
sprintf(name, "bootmenu_%d", n);
- return getenv(name);
+ return env_get(name);
}
static void bootmenu_print_entry(void *data)
delay_str = argv[1];
if (!delay_str)
- delay_str = getenv("bootmenu_delay");
+ delay_str = env_get("bootmenu_delay");
if (delay_str)
delay = (int)simple_strtol(delay_str, NULL, 10);
diff --git a/cmd/cramfs.c b/cmd/cramfs.c
index 7b23c5b3dd5538a1ac7a4589d4b4039b6fbcd0fe..86f1bac272cce1a1e1033ca141f1bc86f349413c 100644 (file)
--- a/cmd/cramfs.c
+++ b/cmd/cramfs.c
struct mtdids id;
ulong addr;
- addr = simple_strtoul(getenv("cramfsaddr"), NULL, 16);
+ addr = simple_strtoul(env_get("cramfsaddr"), NULL, 16);
/* hack! */
/* cramfs_* only supports NOR flash chips */
part.offset = (u64)(uintptr_t) map_sysmem(addr - OFFSET_ADJUSTMENT, 0);
/* pre-set Boot file name */
- if ((filename = getenv("bootfile")) == NULL) {
+ filename = env_get("bootfile");
+ if (!filename)
filename = "uImage";
- }
if (argc == 2) {
filename = argv[1];
struct mtdids id;
ulong addr;
- addr = simple_strtoul(getenv("cramfsaddr"), NULL, 16);
+ addr = simple_strtoul(env_get("cramfsaddr"), NULL, 16);
/* hack! */
/* cramfs_* only supports NOR flash chips */
diff --git a/cmd/elf.c b/cmd/elf.c
index ed9625b221fe1d76abf424840e80dc6ab920b0ab..5d071ee26c44b65b293ca0897c173644900cd3d1 100644 (file)
--- a/cmd/elf.c
+++ b/cmd/elf.c
unsigned long addr; /* Address of the ELF image */
unsigned long rc; /* Return value from user code */
char *sload = NULL;
- const char *ep = getenv("autostart");
+ const char *ep = env_get("autostart");
int rcode = 0;
/* Consume 'bootelf' */
* (LOCAL_MEM_LOCAL_ADRS + BOOT_LINE_OFFSET) as defined by
* VxWorks BSP. For example, on PowerPC it defaults to 0x4200.
*/
- tmp = getenv("bootaddr");
+ tmp = env_get("bootaddr");
if (!tmp) {
printf("## VxWorks bootline address not specified\n");
} else {
* parameter. If it is not defined, we may be able to
* construct the info.
*/
- bootline = getenv("bootargs");
+ bootline = env_get("bootargs");
if (bootline) {
memcpy((void *)bootaddr, bootline,
max(strlen(bootline), (size_t)255));
flush_cache(bootaddr, max(strlen(bootline),
(size_t)255));
} else {
- tmp = getenv("bootdev");
+ tmp = env_get("bootdev");
if (tmp) {
strcpy(build_buf, tmp);
ptr = strlen(tmp);
} else
printf("## VxWorks boot device not specified\n");
- tmp = getenv("bootfile");
+ tmp = env_get("bootfile");
if (tmp)
ptr += sprintf(build_buf + ptr,
"host:%s ", tmp);
* The following parameters are only needed if 'bootdev'
* is an ethernet device, otherwise they are optional.
*/
- tmp = getenv("ipaddr");
+ tmp = env_get("ipaddr");
if (tmp) {
ptr += sprintf(build_buf + ptr, "e=%s", tmp);
- tmp = getenv("netmask");
+ tmp = env_get("netmask");
if (tmp) {
u32 mask = getenv_ip("netmask").s_addr;
ptr += sprintf(build_buf + ptr,
}
}
- tmp = getenv("serverip");
+ tmp = env_get("serverip");
if (tmp)
ptr += sprintf(build_buf + ptr, "h=%s ", tmp);
- tmp = getenv("gatewayip");
+ tmp = env_get("gatewayip");
if (tmp)
ptr += sprintf(build_buf + ptr, "g=%s ", tmp);
- tmp = getenv("hostname");
+ tmp = env_get("hostname");
if (tmp)
ptr += sprintf(build_buf + ptr, "tn=%s ", tmp);
- tmp = getenv("othbootargs");
+ tmp = env_get("othbootargs");
if (tmp) {
strcpy(build_buf + ptr, tmp);
ptr += strlen(tmp);
* Since E820 information is critical to the kernel, if we don't
* specify these in the environments, use a default one.
*/
- tmp = getenv("e820data");
+ tmp = env_get("e820data");
if (tmp)
data = (struct e820entry *)simple_strtoul(tmp, NULL, 16);
else
data = (struct e820entry *)VXWORKS_E820_DATA_ADDR;
- tmp = getenv("e820info");
+ tmp = env_get("e820info");
if (tmp)
info = (struct e820info *)simple_strtoul(tmp, NULL, 16);
else
diff --git a/cmd/fpga.c b/cmd/fpga.c
index 016349f5608695ebdd6ec2f48bad36f018a35278..ac6f504140613b6753b42e66f9fd5f86ba971cc2 100644 (file)
--- a/cmd/fpga.c
+++ b/cmd/fpga.c
int op, dev = FPGA_INVALID_DEVICE;
size_t data_size = 0;
void *fpga_data = NULL;
- char *devstr = getenv("fpga");
- char *datastr = getenv("fpgadata");
+ char *devstr = env_get("fpga");
+ char *datastr = env_get("fpgadata");
int rc = FPGA_FAIL;
int wrong_parms = 0;
#if defined(CONFIG_FIT)
diff --git a/cmd/gpt.c b/cmd/gpt.c
index fbfbe7b1aae0b6f02d57cf0481a2a73e0c022992..638aa198267be46c365b4a5956ff858b4210e83a 100644 (file)
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
memset(s + strlen(s) - 1, '\0', 1);
memmove(s, s + 2, strlen(s) - 1);
- e = getenv(s);
+ e = env_get(s);
if (e == NULL) {
#ifdef CONFIG_RANDOM_UUID
debug("%s unset. ", str);
gen_rand_uuid_str(uuid_str, UUID_STR_FORMAT_GUID);
env_set(s, uuid_str);
- e = getenv(s);
+ e = env_get(s);
if (e) {
debug("Set to random.\n");
ret = 0;
diff --git a/cmd/ini.c b/cmd/ini.c
index 449f6e9f51b108b6132774b57b756cf0d7077b79..8656299447b6b6b35ba53b8ccb3cdbaf23e4ac73 100644 (file)
--- a/cmd/ini.c
+++ b/cmd/ini.c
section = argv[1];
file_address = (char *)simple_strtoul(
- argc < 3 ? getenv("loadaddr") : argv[2], NULL, 16);
+ argc < 3 ? env_get("loadaddr") : argv[2], NULL, 16);
file_size = (size_t)simple_strtoul(
- argc < 4 ? getenv("filesize") : argv[3], NULL, 16);
+ argc < 4 ? env_get("filesize") : argv[3], NULL, 16);
return ini_parse(file_address, file_size, ini_handler, (void *)section);
}
diff --git a/cmd/itest.c b/cmd/itest.c
index e1896d9f9728df3f8195d6d4a11321c5f67723b1..70db04a04f239e917e5f867a41804b965d62fd89 100644 (file)
--- a/cmd/itest.c
+++ b/cmd/itest.c
i++;
}
s[i] = 0;
- return getenv((const char *)&s[2]);
+ return env_get((const char *)&s[2]);
} else {
return s;
}
diff --git a/cmd/jffs2.c b/cmd/jffs2.c
index add89dee6ab5dbe1ad006b86fdd7f232562b5f68..aee2f4513d44220006cc8b6b5695337ead7c8995 100644 (file)
--- a/cmd/jffs2.c
+++ b/cmd/jffs2.c
ulong offset = load_addr;
/* pre-set Boot file name */
- if ((filename = getenv("bootfile")) == NULL) {
+ filename = env_get("bootfile");
+ if (!filename)
filename = "uImage";
- }
if (argc == 2) {
filename = argv[1];
diff --git a/cmd/load.c b/cmd/load.c
index ec3730e0f6c0f37055db7f11fb7a898214c1373a..519c309a61cda77dac4daf4d8b08e6dd9fcf3f50 100644 (file)
--- a/cmd/load.c
+++ b/cmd/load.c
load_baudrate = current_baudrate = gd->baudrate;
#endif
- if (((env_echo = getenv("loads_echo")) != NULL) && (*env_echo == '1')) {
+ env_echo = env_get("loads_echo");
+ if (env_echo && *env_echo == '1')
do_echo = 1;
- } else {
+ else
do_echo = 0;
- }
#ifdef CONFIG_SYS_LOADS_BAUD_CHANGE
if (argc >= 2) {
offset = CONFIG_SYS_LOAD_ADDR;
/* pre-set offset from $loadaddr */
- if ((s = getenv("loadaddr")) != NULL) {
+ s = env_get("loadaddr");
+ if (s)
offset = simple_strtoul(s, NULL, 16);
- }
load_baudrate = current_baudrate = gd->baudrate;
diff --git a/cmd/log.c b/cmd/log.c
index 873ee4037196e1488ac78b9e21b6d9cb44208cdf..7a3bd5cd690d08df58907a124ec7c0d37e43e520 100644 (file)
--- a/cmd/log.c
+++ b/cmd/log.c
#endif
/* Set up log version */
- if ((s = getenv ("logversion")) != NULL)
+ s = env_get("logversion");
+ if (s)
log_version = (int)simple_strtoul(s, NULL, 10);
if (log_version == 2)
log->v2.start = log->v2.con;
/* Initialize default loglevel if present */
- if ((s = getenv ("loglevel")) != NULL)
+ s = env_get("loglevel");
+ if (s)
console_loglevel = (int)simple_strtoul(s, NULL, 10);
gd->flags |= GD_FLG_LOGINIT;
diff --git a/cmd/md5sum.c b/cmd/md5sum.c
index 1b2352ea5538df7792f8402c67e122b94c52f07f..c737cb23b5e27ee4203cf2290e2068599ac40203 100644 (file)
--- a/cmd/md5sum.c
+++ b/cmd/md5sum.c
if (strlen(verify_str) == 32)
vsum_str = verify_str;
else {
- vsum_str = getenv(verify_str);
+ vsum_str = env_get(verify_str);
if (vsum_str == NULL || strlen(vsum_str) != 32)
return 1;
}
diff --git a/cmd/mtdparts.c b/cmd/mtdparts.c
index d3fde77ef0cb91587fb462bbd40f23e47b5a2f76..a72668119deae5bb3532d172417b17cddec69001 100644 (file)
--- a/cmd/mtdparts.c
+++ b/cmd/mtdparts.c
static const char *getenv_mtdparts(char *buf)
{
if (gd->flags & GD_FLG_ENV_READY)
- return getenv("mtdparts");
- if (getenv_f("mtdparts", buf, MTDPARTS_MAXLEN) != -1)
+ return env_get("mtdparts");
+ if (env_get_f("mtdparts", buf, MTDPARTS_MAXLEN) != -1)
return buf;
return NULL;
}
}
/* get variables */
- ids = getenv("mtdids");
+ ids = env_get("mtdids");
parts = getenv_mtdparts(tmp_parts);
- current_partition = getenv("partition");
+ current_partition = env_get("partition");
/* save it for later parsing, cannot rely on current partition pointer
* as 'partition' variable may be updated during init */
current_mtd_partnum = pnum;
current_save();
}
- } else if (getenv("partition") == NULL) {
+ } else if (env_get("partition") == NULL) {
debug("no partition variable set, setting...\n");
current_save();
}
diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c
index ea46e7b108608ce963283c09e79a5d288be30d64..a1997ac0d34416dfa4d82081bc7154ad0e0068f6 100644 (file)
--- a/cmd/mvebu/bubt.c
+++ b/cmd/mvebu/bubt.c
const char *addr_str;
unsigned long addr;
- addr_str = getenv("loadaddr");
+ addr_str = env_get("loadaddr");
if (addr_str)
addr = simple_strtoul(addr_str, NULL, 16);
else
diff --git a/cmd/nand.c b/cmd/nand.c
index 0f5d431e5c42323eb0b6b768b6f8051be7e779a5..a22945d144b32b9a8f37f734b837ffb34ab81629 100644 (file)
--- a/cmd/nand.c
+++ b/cmd/nand.c
#else
int quiet = 0;
#endif
- const char *quiet_str = getenv("quiet");
+ const char *quiet_str = env_get("quiet");
int dev = nand_curr_device;
int repeat = flag & CMD_FLAG_REPEAT;
switch (argc) {
case 1:
addr = CONFIG_SYS_LOAD_ADDR;
- boot_device = getenv("bootdevice");
+ boot_device = env_get("bootdevice");
break;
case 2:
addr = simple_strtoul(argv[1], NULL, 16);
- boot_device = getenv("bootdevice");
+ boot_device = env_get("bootdevice");
break;
case 3:
addr = simple_strtoul(argv[1], NULL, 16);
diff --git a/cmd/net.c b/cmd/net.c
index ae8eeb79b258edce441b031ad3e72f615adbb31d..3b77c8952f173409b42391cd166830a25f55a862 100644 (file)
--- a/cmd/net.c
+++ b/cmd/net.c
ulong addr;
/* pre-set load_addr */
- s = getenv("loadaddr");
+ s = env_get("loadaddr");
if (s != NULL)
load_addr = simple_strtoul(s, NULL, 16);
}
}
- toff = getenv("timeoffset");
+ toff = env_get("timeoffset");
if (toff == NULL)
net_ntp_time_offset = 0;
else
diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index a649004850c5e0b6b3c33dd29c4381e1791e8783..0468a4b7e9abba393e8ff402897bf9c52e4bee0f 100644 (file)
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
ulong value;
char *endp;
- s = getenv(varname);
+ s = env_get(varname);
if (s)
value = simple_strtoul(s, &endp, 16);
if (!s || endp == s)
return 1;
/* Set read buffer to initial value or empty sting */
- init_val = getenv(argv[1]);
+ init_val = env_get(argv[1]);
if (init_val)
snprintf(buffer, CONFIG_SYS_CBSIZE, "%s", init_val);
else
* return address of storage for that variable,
* or NULL if not found
*/
-char *getenv(const char *name)
+char *env_get(const char *name)
{
if (gd->flags & GD_FLG_ENV_READY) { /* after import into hashtable */
ENTRY e, *ep;
}
/* restricted capabilities before import */
- if (getenv_f(name, (char *)(gd->env_buf), sizeof(gd->env_buf)) > 0)
+ if (env_get_f(name, (char *)(gd->env_buf), sizeof(gd->env_buf)) > 0)
return (char *)(gd->env_buf);
return NULL;
/*
* Look up variable from environment for restricted C runtime env.
*/
-int getenv_f(const char *name, char *buf, unsigned len)
+int env_get_f(const char *name, char *buf, unsigned len)
{
int i, nxt;
ulong getenv_ulong(const char *name, int base, ulong default_val)
{
/*
- * We can use getenv() here, even before relocation, since the
+ * We can use env_get() here, even before relocation, since the
* environment variable value is an integer and thus short.
*/
- const char *str = getenv(name);
+ const char *str = env_get(name);
return str ? simple_strtoul(str, NULL, base) : default_val;
}
diff --git a/cmd/pxe.c b/cmd/pxe.c
index 357b96940c0da203fd6455cdc5da5ae77eaac160..c0579079b8a63fb3aca2b66faa75033ec1cd6e32 100644 (file)
--- a/cmd/pxe.c
+++ b/cmd/pxe.c
static bool is_pxe;
/*
- * Like getenv, but prints an error if envvar isn't defined in the
- * environment. It always returns what getenv does, so it can be used in
- * place of getenv without changing error handling otherwise.
+ * Like env_get, but prints an error if envvar isn't defined in the
+ * environment. It always returns what env_get does, so it can be used in
+ * place of env_get without changing error handling otherwise.
*/
static char *from_env(const char *envvar)
{
char *ret;
- ret = getenv(envvar);
+ ret = env_get(envvar);
if (!ret)
printf("missing environment variable: %s\n", envvar);
}
bootm_argv[2] = initrd_str;
- strcpy(bootm_argv[2], getenv("ramdisk_addr_r"));
+ strcpy(bootm_argv[2], env_get("ramdisk_addr_r"));
strcat(bootm_argv[2], ":");
- strcat(bootm_argv[2], getenv("filesize"));
+ strcat(bootm_argv[2], env_get("filesize"));
}
if (get_relfile_envaddr(cmdtp, label->kernel, "kernel_addr_r") < 0) {
if (label->ipappend & 0x1) {
sprintf(ip_str, " ip=%s:%s:%s:%s",
- getenv("ipaddr"), getenv("serverip"),
- getenv("gatewayip"), getenv("netmask"));
+ env_get("ipaddr"), env_get("serverip"),
+ env_get("gatewayip"), env_get("netmask"));
}
#ifdef CONFIG_CMD_NET
printf("append: %s\n", finalbootargs);
}
- bootm_argv[1] = getenv("kernel_addr_r");
+ bootm_argv[1] = env_get("kernel_addr_r");
/*
* fdt usage is optional:
*
* Scenario 3: fdt blob is not available.
*/
- bootm_argv[3] = getenv("fdt_addr_r");
+ bootm_argv[3] = env_get("fdt_addr_r");
/* if fdt label is defined then get fdt from server */
if (bootm_argv[3]) {
} else if (label->fdtdir) {
char *f1, *f2, *f3, *f4, *slash;
- f1 = getenv("fdtfile");
+ f1 = env_get("fdtfile");
if (f1) {
f2 = "";
f3 = "";
* or the boot scripts should set $fdtfile
* before invoking "pxe" or "sysboot".
*/
- f1 = getenv("soc");
+ f1 = env_get("soc");
f2 = "-";
- f3 = getenv("board");
+ f3 = env_get("board");
f4 = ".dtb";
}
}
if (!bootm_argv[3])
- bootm_argv[3] = getenv("fdt_addr");
+ bootm_argv[3] = env_get("fdt_addr");
if (bootm_argv[3]) {
if (!bootm_argv[2])
@@ -1671,7 +1671,7 @@ static int do_sysboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
if (argc < 6)
- filename = getenv("bootfile");
+ filename = env_get("bootfile");
else {
filename = argv[5];
env_set("bootfile", filename);
diff --git a/cmd/qfw.c b/cmd/qfw.c
index 9b12ab40ca22f4579efb6259a4d932ad767ab762..b38026ba81b76fd8d1685137f0967c728d928fda 100644 (file)
--- a/cmd/qfw.c
+++ b/cmd/qfw.c
void *load_addr;
void *initrd_addr;
- env = getenv("loadaddr");
+ env = env_get("loadaddr");
load_addr = env ?
(void *)simple_strtoul(env, NULL, 16) :
#ifdef CONFIG_LOADADDR
NULL;
#endif
- env = getenv("ramdiskaddr");
+ env = env_get("ramdiskaddr");
initrd_addr = env ?
(void *)simple_strtoul(env, NULL, 16) :
#ifdef CONFIG_RAMDISK_ADDR
diff --git a/cmd/reiser.c b/cmd/reiser.c
index 4df9c5f5db119e1f696b9f26e145b11d35197116..e10c7b9ebad76b69f3fb2f4a661306684e5c27b2 100644 (file)
--- a/cmd/reiser.c
+++ b/cmd/reiser.c
switch (argc) {
case 3:
- addr_str = getenv("loadaddr");
+ addr_str = env_get("loadaddr");
if (addr_str != NULL) {
addr = simple_strtoul (addr_str, NULL, 16);
} else {
addr = CONFIG_SYS_LOAD_ADDR;
}
- filename = getenv ("bootfile");
+ filename = env_get("bootfile");
count = 0;
break;
case 4:
addr = simple_strtoul (argv[3], NULL, 16);
- filename = getenv ("bootfile");
+ filename = env_get("bootfile");
count = 0;
break;
case 5:
diff --git a/cmd/setexpr.c b/cmd/setexpr.c
index 91a5a9a770b47184282c8d231442f7ebbb707d4b..af210225f1438727e846a17ccaa88f60b10f0372 100644 (file)
--- a/cmd/setexpr.c
+++ b/cmd/setexpr.c
}
if (t == NULL) {
- value = getenv(name);
+ value = env_get(name);
if (value == NULL) {
printf("## Error: variable \"%s\" not defined\n", name);
diff --git a/cmd/zfs.c b/cmd/zfs.c
index 08b0062c1058d195fa9e46bf7e4bf32197f46768..6913043d7f408c61a11d216b6ccfedc85c63a53a 100644 (file)
--- a/cmd/zfs.c
+++ b/cmd/zfs.c
@@ -51,10 +51,10 @@ static int do_zfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
count = 0;
addr = simple_strtoul(argv[3], NULL, 16);
- filename = getenv("bootfile");
+ filename = env_get("bootfile");
switch (argc) {
case 3:
- addr_str = getenv("loadaddr");
+ addr_str = env_get("loadaddr");
if (addr_str != NULL)
addr = simple_strtoul(addr_str, NULL, 16);
else
diff --git a/common/autoboot.c b/common/autoboot.c
index 41f18208c383698071bb7a7d943924c174dd1160..35c1e972c6593e0998f1ff92ab56cd371d4042b4 100644 (file)
--- a/common/autoboot.c
+++ b/common/autoboot.c
static int passwd_abort(uint64_t etime)
{
- const char *sha_env_str = getenv("bootstopkeysha256");
+ const char *sha_env_str = env_get("bootstopkeysha256");
u8 sha_env[SHA256_SUM_LEN];
u8 sha[SHA256_SUM_LEN];
char presskey[MAX_DELAY_STOP_STR];
int retry;
}
delaykey[] = {
- { .str = getenv("bootdelaykey"), .retry = 1 },
- { .str = getenv("bootstopkey"), .retry = 0 },
+ { .str = env_get("bootdelaykey"), .retry = 1 },
+ { .str = env_get("bootstopkey"), .retry = 0 },
};
char presskey[MAX_DELAY_STOP_STR];
bootlimit = getenv_ulong("bootlimit", 10, 0);
#endif /* CONFIG_BOOTCOUNT_LIMIT */
- s = getenv("bootdelay");
+ s = env_get("bootdelay");
bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY;
#ifdef CONFIG_OF_CONTROL
#ifdef CONFIG_POST
if (gd->flags & GD_FLG_POSTFAIL) {
- s = getenv("failbootcmd");
+ s = env_get("failbootcmd");
} else
#endif /* CONFIG_POST */
#ifdef CONFIG_BOOTCOUNT_LIMIT
if (bootlimit && (bootcount > bootlimit)) {
printf("Warning: Bootlimit (%u) exceeded. Using altbootcmd.\n",
(unsigned)bootlimit);
- s = getenv("altbootcmd");
+ s = env_get("altbootcmd");
} else
#endif /* CONFIG_BOOTCOUNT_LIMIT */
- s = getenv("bootcmd");
+ s = env_get("bootcmd");
process_fdt_options(gd->fdt_blob);
stored_bootdelay = bootdelay;
#ifdef CONFIG_MENUKEY
if (menukey == CONFIG_MENUKEY) {
- s = getenv("menucmd");
+ s = env_get("menucmd");
if (s)
run_command_list(s, -1, 0);
}
diff --git a/common/bootm.c b/common/bootm.c
index e34617a145ccbe1526e55b0b998416c25d734cff..0c380e742f3f24c2c4fdc95bdaa22f9bcb5bbebc 100644 (file)
--- a/common/bootm.c
+++ b/common/bootm.c
{
char *buf;
const char *env_val;
- char *cmdline = getenv("bootargs");
+ char *cmdline = env_get("bootargs");
int want_silent;
/*
#ifdef CONFIG_TRACE
/* Pretend to run the OS, then run a user command */
if (!ret && (states & BOOTM_STATE_OS_FAKE_GO)) {
- char *cmd_list = getenv("fakegocmd");
+ char *cmd_list = env_get("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 86a37cb925af9250e21353d68663e47a42162c9d..1feea8af175481fe0b10c2e47e84dedd7b22e744 100644 (file)
--- a/common/bootm_os.c
+++ b/common/bootm_os.c
int (*appl)(int, char *const[]);
/* Don't start if "autostart" is set to "no" */
- s = getenv("autostart");
+ s = env_get("autostart");
if ((s != NULL) && !strcmp(s, "no")) {
env_set_hex("filesize", images->os.image_len);
return 0;
cmdline = malloc(len);
copy_args(cmdline, argc, argv, ' ');
} else {
- cmdline = getenv("bootargs");
+ cmdline = env_get("bootargs");
if (cmdline == NULL)
cmdline = "";
}
#endif
/* See README.plan9 */
- s = getenv("confaddr");
+ s = env_get("confaddr");
if (s != NULL) {
char *confaddr = (char *)simple_strtoul(s, NULL, 16);
if (argc > 0) {
copy_args(confaddr, argc, argv, '\n');
} else {
- s = getenv("bootargs");
+ s = env_get("bootargs");
if (s != NULL)
strcpy(confaddr, s);
}
ret = fdt_add_subnode(*of_flat_tree, 0, "chosen");
if ((ret >= 0 || ret == -FDT_ERR_EXISTS)) {
- bootline = getenv("bootargs");
+ bootline = env_get("bootargs");
if (bootline) {
ret = fdt_find_and_setprop(*of_flat_tree,
"/chosen", "bootargs",
diff --git a/common/bootretry.c b/common/bootretry.c
index 2d82798cd04bc6ba004d2382ceaab79637c79a85..b3b8271a92391d5f73a7a9c0d1202259aac9113c 100644 (file)
--- a/common/bootretry.c
+++ b/common/bootretry.c
*/
void bootretry_init_cmd_timeout(void)
{
- char *s = getenv("bootretry");
+ char *s = env_get("bootretry");
if (s != NULL)
retry_time = (int)simple_strtol(s, NULL, 10);
diff --git a/common/cli.c b/common/cli.c
index a433ef21663cfb112cb6acd40e38057f22acab1e..57874d87977b7263c773bc41467922eda2ebee52 100644 (file)
--- a/common/cli.c
+++ b/common/cli.c
for (i = 1; i < argc; ++i) {
char *arg;
- arg = getenv(argv[i]);
+ arg = env_get(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 280289639c041ccd512dc0857d0ea44a52020f3c..07c048ec6a97a7ccd713d8dc0780244a8c98889a 100644 (file)
--- a/common/cli_hush.c
+++ b/common/cli_hush.c
{
char *newdir;
if (child->argv[1] == NULL)
- newdir = getenv("HOME");
+ newdir = env_get("HOME");
else
newdir = child->argv[1];
if (chdir(newdir)) {
#ifndef CONFIG_FEATURE_SH_FANCY_PROMPT
PS1 = NULL;
#else
- PS1 = getenv("PS1");
+ PS1 = env_get("PS1");
if(PS1==0)
PS1 = "\\w \\$ ";
#endif
#ifdef CONFIG_CMDLINE_PS_SUPPORT
if (i->promptmode == 1)
- ps_prompt = getenv("PS1");
+ ps_prompt = env_get("PS1");
else
- ps_prompt = getenv("PS2");
+ ps_prompt = env_get("PS2");
if (ps_prompt)
prompt = ps_prompt;
#endif
name=strdup(s);
#ifdef __U_BOOT__
- if (getenv(name) != NULL) {
+ if (env_get(name) != NULL) {
printf ("ERROR: "
"There is a global environment variable with the same name.\n");
free(name);
}
}
- p = getenv(src);
+ p = env_get(src);
if (!p)
p = get_local_var(src);
static void update_ifs_map(void)
{
/* char *ifs and char map[256] are both globals. */
- ifs = (uchar *)getenv("IFS");
+ ifs = (uchar *)env_get("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 bb96aaead60452b87cf44979b9dc586630855cf7..cb642d2ff3bc93cedd2434ae37e4008a2ebbc371 100644 (file)
--- a/common/cli_simple.c
+++ b/common/cli_simple.c
envname[i] = 0;
/* Get its value */
- envval = getenv(envname);
+ envval = env_get(envname);
/* Copy into the line if it exists */
if (envval != NULL)
* WARNING:
*
* We must create a temporary copy of the command since the command we get
- * may be the result from getenv(), which returns a pointer directly to
+ * may be the result from env_get(), which returns a pointer directly to
* the environment data, which may change magicly when the command we run
* creates or modifies environment variables (like "bootp" does).
*/
diff --git a/common/console.c b/common/console.c
index 3f7ca2baa7ad429c54414da7b4d7ec4d78e604bc..3167921ec9aedd32c34f5191bc441bdecb3b735f 100644 (file)
--- a/common/console.c
+++ b/common/console.c
static void console_update_silent(void)
{
#ifdef CONFIG_SILENT_CONSOLE
- if (getenv("silent") != NULL)
+ if (env_get("silent") != NULL)
gd->flags |= GD_FLG_SILENT;
else
gd->flags &= ~GD_FLG_SILENT;
/* stdin stdout and stderr are in environment */
/* scan for it */
- stdinname = getenv("stdin");
- stdoutname = getenv("stdout");
- stderrname = getenv("stderr");
+ stdinname = env_get("stdin");
+ stdoutname = env_get("stdout");
+ stderrname = env_get("stderr");
if (OVERWRITE_CONSOLE == 0) { /* if not overwritten by config switch */
inputdev = search_device(DEV_FLAGS_INPUT, stdinname);
* console to serial console in this case or suppress it if
* "silent" mode was requested.
*/
- if (getenv("splashimage") != NULL) {
+ if (env_get("splashimage") != NULL) {
if (!(gd->flags & GD_FLG_SILENT))
outputdev = search_device (DEV_FLAGS_OUTPUT, "serial");
}
diff --git a/common/fb_mmc.c b/common/fb_mmc.c
index 2113b6c3723978f31372e1562010e76defb6f800..5065ad5f73b624801ba425bf9b2feee91954e60a 100644 (file)
--- a/common/fb_mmc.c
+++ b/common/fb_mmc.c
/* check for alias */
strcpy(env_alias_name, "fastboot_partition_alias_");
strncat(env_alias_name, name, 32);
- aliased_part_name = getenv(env_alias_name);
+ aliased_part_name = env_get(env_alias_name);
if (aliased_part_name != NULL)
ret = part_get_info_by_name(dev_desc,
aliased_part_name, info);
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 7ccf8b19fd10e857cfd9f309218fcb52f2d4bbe7..916a448c11d43a82e25155f001c919cd8b5e9541 100644 (file)
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
return err;
}
- serial = getenv("serial#");
+ serial = env_get("serial#");
if (serial) {
err = fdt_setprop(fdt, 0, "serial-number", serial,
strlen(serial) + 1);
if (nodeoffset < 0)
return nodeoffset;
- str = getenv("bootargs");
+ str = env_get("bootargs");
if (str) {
err = fdt_setprop(fdt, nodeoffset, "bootargs", str,
strlen(str) + 1);
} else {
continue;
}
- tmp = getenv(mac);
+ tmp = env_get(mac);
if (!tmp)
continue;
diff --git a/common/hash.c b/common/hash.c
index fda636d34aff934f98790e227b669cc94552350e..dcf016d8a78119413cb8c0ef1bbf556b84b88d1e 100644 (file)
--- a/common/hash.c
+++ b/common/hash.c
if (strlen(verify_str) == digits)
vsum_str = verify_str;
else {
- vsum_str = getenv(verify_str);
+ vsum_str = env_get(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 85aaabbb85529eb9413cc6548848e9f402eb0cfb..e5186d77968f80d96ac1458f649ad2576512f1ef 100644 (file)
--- a/common/hwconfig.c
+++ b/common/hwconfig.c
"and before environment is ready\n");
return NULL;
}
- env_hwconfig = getenv("hwconfig");
+ env_hwconfig = env_get("hwconfig");
}
if (env_hwconfig) {
diff --git a/common/image-android.c b/common/image-android.c
index 018c7594fe71026b9be0f9d446c98577392a348a..e74d0aafca57e3d74ed2c7f898dfbc2f5ebfab08 100644 (file)
--- a/common/image-android.c
+++ b/common/image-android.c
len += strlen(hdr->cmdline);
}
- char *bootargs = getenv("bootargs");
+ char *bootargs = env_get("bootargs");
if (bootargs)
len += strlen(bootargs);
diff --git a/common/image-fdt.c b/common/image-fdt.c
index c6e8832d66887af9615db5c5fff18492f4b083a8..2c499467c32499dc10082a38f479c08739457494 100644 (file)
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
of_len = *of_size + CONFIG_SYS_FDT_PAD;
/* If fdt_high is set use it to select the relocation address */
- fdt_high = getenv("fdt_high");
+ fdt_high = env_get("fdt_high");
if (fdt_high) {
void *desired_addr = (void *)simple_strtoul(fdt_high, NULL, 16);
diff --git a/common/image.c b/common/image.c
index 0f88984f2d40212fe8bdafd124a8de97846cbc86..98c0eaa4c70f886a7a53857257c7157981abd582 100644 (file)
--- a/common/image.c
+++ b/common/image.c
ulong getenv_bootm_low(void)
{
- char *s = getenv("bootm_low");
+ char *s = env_get("bootm_low");
if (s) {
ulong tmp = simple_strtoul(s, NULL, 16);
return tmp;
{
phys_size_t tmp, size;
phys_addr_t start;
- char *s = getenv("bootm_size");
+ char *s = env_get("bootm_size");
if (s) {
tmp = (phys_size_t)simple_strtoull(s, NULL, 16);
return tmp;
size = gd->bd->bi_memsize;
#endif
- s = getenv("bootm_low");
+ s = env_get("bootm_low");
if (s)
tmp = (phys_size_t)simple_strtoull(s, NULL, 16);
else
phys_size_t getenv_bootm_mapsize(void)
{
phys_size_t tmp;
- char *s = getenv("bootm_mapsize");
+ char *s = env_get("bootm_mapsize");
if (s) {
tmp = (phys_size_t)simple_strtoull(s, NULL, 16);
return tmp;
ulong initrd_high;
int initrd_copy_to_ram = 1;
- if ((s = getenv("initrd_high")) != NULL) {
+ s = env_get("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.
*/
if (cmdline == NULL)
return -1;
- if ((s = getenv("bootargs")) == NULL)
+ s = env_get("bootargs");
+ if (!s)
s = "";
strcpy(cmdline, s);
diff --git a/common/lcd.c b/common/lcd.c
index 7e399cee2de6822a56703870302aa4eec987cc59..c3ff9599ed89cc0e03d60d8ff9a63f44c0e5afd1 100644 (file)
--- a/common/lcd.c
+++ b/common/lcd.c
/* Paint the logo and retrieve LCD base address */
debug("[LCD] Drawing the logo...\n");
if (do_splash) {
- s = getenv("splashimage");
+ s = env_get("splashimage");
if (s) {
do_splash = 0;
addr = simple_strtoul(s, NULL, 16);
diff --git a/common/main.c b/common/main.c
index 07fc31b716eead0722549675fb41681cdfaafa29..6a1159879edc4abb98a415bf369be8b02e621ca3 100644 (file)
--- a/common/main.c
+++ b/common/main.c
#ifdef CONFIG_PREBOOT
char *p;
- p = getenv("preboot");
+ p = env_get("preboot");
if (p != NULL) {
# ifdef CONFIG_AUTOBOOT_KEYED
int prev = disable_ctrlc(1); /* disable Control C checking */
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 3c887b34050a603df3706bcf1e1dca6e11dbc280..582b685dad36b9cea6298481d49ceb214e8a5926 100644 (file)
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
needed in SPL as it has a much simpler task with less
configuration. But some boards use this to support 'Falcon' boot
on EXT2 and FAT, where SPL boots directly into Linux without
- starting U-Boot first. Enabling this option will make getenv()
+ starting U-Boot first. Enabling this option will make env_get()
and env_set() available in SPL.
config SPL_SAVEENV
diff --git a/common/spl/spl_dfu.c b/common/spl/spl_dfu.c
index f5ec0fb396b3c3fc49746457a0d42dfd804ed1e6..2c974735b11a8daf4eccdd3289307a488ffaaeba 100644 (file)
--- a/common/spl/spl_dfu.c
+++ b/common/spl/spl_dfu.c
/* set default environment */
set_default_env(0);
- str_env = getenv(dfu_alt_info);
+ str_env = env_get(dfu_alt_info);
if (!str_env) {
error("\"dfu_alt_info\" env variable not defined!\n");
return -EINVAL;
diff --git a/common/spl/spl_ext.c b/common/spl/spl_ext.c
index f17c6b949416c271c3172abb5d03856ca7b0b18e..559ba0b797126dc788ef243a67528771a90147d2 100644 (file)
--- a/common/spl/spl_ext.c
+++ b/common/spl/spl_ext.c
return -1;
}
#if defined(CONFIG_SPL_ENV_SUPPORT)
- file = getenv("falcon_args_file");
+ file = env_get("falcon_args_file");
if (file) {
err = ext4fs_open(file, &filelen);
if (err < 0) {
file, err);
goto defaults;
}
- file = getenv("falcon_image_file");
+ file = env_get("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 5e312160d95d20530e6ed310a216a06dc9974275..60b85f082d45843de509bce8a0367ddcb1a49d3c 100644 (file)
--- a/common/spl/spl_fat.c
+++ b/common/spl/spl_fat.c
return err;
#if defined(CONFIG_SPL_ENV_SUPPORT) && defined(CONFIG_SPL_OS_BOOT)
- file = getenv("falcon_args_file");
+ file = env_get("falcon_args_file");
if (file) {
err = file_fat_read(file, (void *)CONFIG_SYS_SPL_ARGS_ADDR, 0);
if (err <= 0) {
file, err);
goto defaults;
}
- file = getenv("falcon_image_file");
+ file = env_get("falcon_image_file");
if (file) {
err = spl_load_image_fat(spl_image, block_dev,
partition, file);
diff --git a/common/splash.c b/common/splash.c
index 89af437f2cafec3c648b13dc273e1fe4c1e4d287..d251b3b6547018f75faca2da742e89edd53af319 100644 (file)
--- a/common/splash.c
+++ b/common/splash.c
#ifdef CONFIG_SPLASH_SCREEN_ALIGN
void splash_get_pos(int *x, int *y)
{
- char *s = getenv("splashpos");
+ char *s = env_get("splashpos");
if (!s)
return;
diff --git a/common/splash_source.c b/common/splash_source.c
index 867a7984870ddeae0e167d55911627f846ae7783..8c0ac581f7309f5bbf780970646e28e138e08a3f 100644 (file)
--- a/common/splash_source.c
+++ b/common/splash_source.c
loff_t actread;
char *splash_file;
- splash_file = getenv("splashfile");
+ splash_file = env_get("splashfile");
if (!splash_file)
splash_file = SPLASH_SOURCE_DEFAULT_FILE_NAME;
if (!locations || size == 0)
return NULL;
- env_splashsource = getenv("splashsource");
+ env_splashsource = env_get("splashsource");
if (env_splashsource == NULL)
return &locations[0];
char *env_splashimage_value;
u32 bmp_load_addr;
- env_splashimage_value = getenv("splashimage");
+ env_splashimage_value = env_get("splashimage");
if (env_splashimage_value == NULL)
return -ENOENT;
diff --git a/common/update.c b/common/update.c
index 061a5541b1d86bfca65c40781246ac30476e46b6..974f4655e7ef1d492b9c589cdfe02738a9fd1134 100644 (file)
--- a/common/update.c
+++ b/common/update.c
/* save used globals and env variable */
saved_timeout_msecs = tftp_timeout_ms;
saved_timeout_count = tftp_timeout_count_max;
- saved_netretry = strdup(getenv("netretry"));
+ saved_netretry = strdup(env_get("netretry"));
saved_bootfile = strdup(net_boot_file_name);
/* set timeouts for auto-update */
printf("Auto-update from TFTP: ");
/* get the file name of the update file */
- filename = getenv(UPDATE_FILE_ENV);
+ filename = env_get(UPDATE_FILE_ENV);
if (filename == NULL) {
printf("failed, env. variable '%s' not found\n",
UPDATE_FILE_ENV);
printf("trying update file '%s'\n", filename);
/* get load address of downloaded update file */
- if ((env_addr = getenv("loadaddr")) != NULL)
+ env_addr = env_get("loadaddr");
+ if (env_addr)
addr = simple_strtoul(env_addr, NULL, 16);
else
addr = CONFIG_UPDATE_LOAD_ADDR;
diff --git a/common/usb_hub.c b/common/usb_hub.c
index 70bc6e2931164d31fd0f86ad71a314b713870c9b..86a347766432467dcd67f078d963fce1bffa561c 100644 (file)
--- a/common/usb_hub.c
+++ b/common/usb_hub.c
* but allow this time to be increased via env variable as some
* devices break the spec and require longer warm-up times
*/
- env = getenv("usb_pgood_delay");
+ env = env_get("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 d2d29cc98f5ed3e8cf7f91f13daa2d6619756df5..8cbdba6ac2984fd667e6e7130311249126ca6c78 100644 (file)
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
if (error)
return error;
- stdinname = getenv("stdin");
+ stdinname = env_get("stdin");
#if CONFIG_IS_ENABLED(CONSOLE_MUX)
error = iomux_doenv(stdin, stdinname);
if (error)
if (stdio_deregister_dev(dev, force) != 0)
return 1;
#if CONFIG_IS_ENABLED(CONSOLE_MUX)
- if (iomux_doenv(stdin, getenv("stdin")) != 0)
+ if (iomux_doenv(stdin, env_get("stdin")) != 0)
return 1;
#endif
#ifdef CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE
goto err;
}
#if CONFIG_IS_ENABLED(CONSOLE_MUX)
- if (iomux_doenv(stdin, getenv("stdin"))) {
+ if (iomux_doenv(stdin, env_get("stdin"))) {
ret = -ENOLINK;
goto err;
}
diff --git a/disk/part.c b/disk/part.c
index d76aa903a8c6deba137d710e6be320fe566056bb..c67fdacc79257f12b64583de2bd845cb98445151 100644 (file)
--- a/disk/part.c
+++ b/disk/part.c
/* If no dev_part_str, use bootdevice environment variable */
if (!dev_part_str || !strlen(dev_part_str) ||
!strcmp(dev_part_str, "-"))
- dev_part_str = getenv("bootdevice");
+ dev_part_str = env_get("bootdevice");
/* If still no dev_part_str, it's an error */
if (!dev_part_str) {
diff --git a/disk/part_amiga.c b/disk/part_amiga.c
index 25fe56ce4242a8e6e48f42ce3b4e1839253d7bbb..f8dae008d74a8202d6cfcea56b0eba789ea3ead4 100644 (file)
--- a/disk/part_amiga.c
+++ b/disk/part_amiga.c
int limit;
char *s;
- s = getenv("amiga_scanlimit");
+ s = env_get("amiga_scanlimit");
if (s)
limit = simple_strtoul(s, NULL, 10);
else
int limit;
char *s;
- s = getenv("amiga_scanlimit");
+ s = env_get("amiga_scanlimit");
if (s)
limit = simple_strtoul(s, NULL, 10);
else
index 3349fc5c3b5907a4195c74b539dbb3002614d4e2..058c9b9da8cbf663ee184862e15337b4ba425d63 100644 (file)
#define CTLR_INTLV_MASK 0x20000000
/* Perform build-in test on memory. Three-way interleaving is not yet
* supported by this code. */
- if (getenv_f("ddr_bist", buffer, CONFIG_SYS_CBSIZE) >= 0) {
+ if (env_get_f("ddr_bist", buffer, CONFIG_SYS_CBSIZE) >= 0) {
puts("Running BIST test. This will take a while...");
cs0_config = ddr_in32(&ddr->cs0_config);
cs0_bnds = ddr_in32(&ddr->cs0_bnds);
index 653bbabc95623d96244c58aa1b47353ae2b43b3f..c99bd2fb6d014ffa306a42fc6f8c8c179a61bb18 100644 (file)
{
char buffer[CONFIG_SYS_CBSIZE];
- if (getenv_f("ddr_interactive", buffer, CONFIG_SYS_CBSIZE) >= 0)
+ if (env_get_f("ddr_interactive", buffer, CONFIG_SYS_CBSIZE) >= 0)
return 1;
return 0;
@@ -1891,11 +1891,11 @@ unsigned long long fsl_ddr_interactive(fsl_ddr_info_t *pinfo, int var_is_set)
};
if (var_is_set) {
- if (getenv_f("ddr_interactive", buffer2, CONFIG_SYS_CBSIZE) > 0) {
+ if (env_get_f("ddr_interactive", buffer2,
+ CONFIG_SYS_CBSIZE) > 0)
p = buffer2;
- } else {
+ else
var_is_set = 0;
- }
}
/*
index 20edd2dc28e54b48318af47e8cb9786daf483407..a7eaed1bd74e6c2b656e5cef9dd5afe635ed74e0 100644 (file)
* Use our own stack based buffer before relocation to allow accessing longer
* hwconfig strings that might be in the environment before we've relocated.
* This is pretty fragile on both the use of stack and if the buffer is big
- * enough. However we will get a warning from getenv_f for the later.
+ * enough. However we will get a warning from env_get_f() for the latter.
*/
/* Board-specific functions defined in each board's ddr.c */
* Extract hwconfig from environment since we have not properly setup
* the environment but need it for ddr config params
*/
- if (getenv_f("hwconfig", buffer, sizeof(buffer)) > 0)
+ if (env_get_f("hwconfig", buffer, sizeof(buffer)) > 0)
buf = buffer;
#if defined(CONFIG_SYS_FSL_DDR3) || \
* Extract hwconfig from environment since we have not properly setup
* the environment but need it for ddr config params
*/
- if (getenv_f("hwconfig", buffer, sizeof(buffer)) > 0)
+ if (env_get_f("hwconfig", buffer, sizeof(buffer)) > 0)
buf = buffer;
/* if hwconfig is not enabled, or "sdram" is not defined, use spd */
diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
index f6281f4baad42aba448d55f05268fbd4a0524749..ff732ac309fe2aa1604652fbd43a4a2a3caffb0d 100644 (file)
--- a/drivers/dfu/dfu.c
+++ b/drivers/dfu/dfu.c
#ifdef CONFIG_SET_DFU_ALT_INFO
set_dfu_alt_info(interface, devstr);
#endif
- str_env = getenv("dfu_alt_info");
+ str_env = env_get("dfu_alt_info");
if (!str_env) {
error("\"dfu_alt_info\" env variable not defined!\n");
return -EINVAL;
if (dfu_buf != NULL)
return dfu_buf;
- s = getenv("dfu_bufsiz");
+ s = env_get("dfu_bufsiz");
if (s)
dfu_buf_size = (unsigned long)simple_strtol(s, NULL, 0);
{
char *s;
- s = getenv("dfu_hash_algo");
+ s = env_get("dfu_hash_algo");
if (!s)
return NULL;
diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
index bb23e7fdcb08e8f683e575d2264c994cef45cc50..39e10b1a5a67ea209af02245c7e5b2437af4905c 100644 (file)
--- a/drivers/dfu/dfu_mmc.c
+++ b/drivers/dfu/dfu_mmc.c
}
if (op != DFU_OP_WRITE) {
- str_env = getenv("filesize");
+ str_env = env_get("filesize");
if (str_env == NULL) {
puts("dfu: Wrong file size!\n");
return -1;
diff --git a/drivers/input/i8042.c b/drivers/input/i8042.c
index 0fd25b17ec0878a0ebe06b0ecc4ff7348a3eba1a..18476e97d1886d8569e1343a1d9129c73835b4ce 100644 (file)
--- a/drivers/input/i8042.c
+++ b/drivers/input/i8042.c
/* Init keyboard device (default US layout) */
keymap = KBD_US;
- penv = getenv("keymap");
+ penv = env_get("keymap");
if (penv != NULL) {
if (strncmp(penv, "de", 3) == 0)
keymap = KBD_GER;
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 011667fedda4269a26dedfa8b1f83a9486086519..26da3a95ff02f1775be22f438a76355f277438e9 100644 (file)
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
error = stdio_register(dev);
/* check if this is the standard input device */
- if (!error && strcmp(getenv("stdin"), dev->name) == 0) {
+ if (!error && strcmp(env_get("stdin"), dev->name) == 0) {
/* reassign the console */
if (OVERWRITE_CONSOLE ||
console_assign(stdin, dev->name))
index 048a51785ebcf6d1515fd38c7ea3d0648f502e5c..42bc2efd90d7820f29a3e321abbade99644510f5 100644 (file)
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
#ifdef CONFIG_SYS_FLASH_PROTECTION
/* read environment from EEPROM */
char s[64];
- getenv_f("unlock", s, sizeof(s));
+ env_get_f("unlock", s, sizeof(s));
#endif
#ifdef CONFIG_CFI_FLASH /* for driver model */
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 424c347e0e9353669f49589d237b52f33b45af4c..797e34f7cc27d0c4ef2d3ee6dc6643148a94b816 100644 (file)
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
sprintf(mac, "eth%daddr", fec->dev_id);
else
strcpy(mac, "ethaddr");
- if (!getenv(mac))
+ if (!env_get(mac))
eth_env_set_enetaddr(mac, ethaddr);
}
return ret;
diff --git a/drivers/net/fm/b4860.c b/drivers/net/fm/b4860.c
index 5aeeb872824826b4c5fb8a243487d604e1e6c453..3245bee473a1a3052b89ed03ac268ba1226ffe33 100644 (file)
--- a/drivers/net/fm/b4860.c
+++ b/drivers/net/fm/b4860.c
* Extract hwconfig from environment since environment
* is not setup yet
*/
- getenv_f("hwconfig", buffer, sizeof(buffer));
+ env_get_f("hwconfig", buffer, sizeof(buffer));
buf = buffer;
/* check if XFI interface enable in hwconfig for 10g */
diff --git a/drivers/net/fm/fdt.c b/drivers/net/fm/fdt.c
index 9918d8089a1fa993776ebcb14b849657fe922d98..5920fecea125d3c02b5115028d75f89b532256a3 100644 (file)
--- a/drivers/net/fm/fdt.c
+++ b/drivers/net/fm/fdt.c
return;
/* If the environment variable is not set, then exit silently */
- p = getenv("fman_ucode");
+ p = env_get("fman_ucode");
if (!p)
return;
index 3a30c03b8530c2ac90383865f80480f90a73f507..be823717665420b80ae803391ee85f0aa797e9c2 100644 (file)
--- a/drivers/net/fsl-mc/mc.c
+++ b/drivers/net/fsl-mc/mc.c
{
unsigned long timeout_ms = CONFIG_SYS_LS_MC_BOOT_TIMEOUT_MS;
- char *timeout_ms_env_var = getenv(MC_BOOT_TIMEOUT_ENV_VAR);
+ char *timeout_ms_env_var = env_get(MC_BOOT_TIMEOUT_ENV_VAR);
if (timeout_ms_env_var) {
timeout_ms = simple_strtoul(timeout_ms_env_var, NULL, 10);
{
unsigned long dram_block_size = CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE;
- char *dram_block_size_env_var = getenv(MC_MEM_SIZE_ENV_VAR);
+ char *dram_block_size_env_var = env_get(MC_MEM_SIZE_ENV_VAR);
if (dram_block_size_env_var) {
dram_block_size = simple_strtoul(dram_block_size_env_var, NULL,
* address info properly. Without MAC addresses, the MC code
* can not properly initialize the DPC.
*/
- mc_boot_env_var = getenv(MC_BOOT_ENV_VAR);
+ mc_boot_env_var = env_get(MC_BOOT_ENV_VAR);
if (mc_boot_env_var)
run_command_list(mc_boot_env_var, -1, 0);
#endif /* CONFIG_FSL_MC_ENET */
index 350004757715011de9de0bb5b9176e36059dea1a..2210c57a64e816ba484d40631631e414874adc86 100644 (file)
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
/* update only when the environment has changed */
if (env_changed_id != env_id) {
- if (getenv("ncip")) {
+ if (env_get("ncip")) {
nc_ip = getenv_ip("ncip");
if (!nc_ip.s_addr)
return -1; /* ncip is 0.0.0.0 */
- p = strchr(getenv("ncip"), ':');
+ p = strchr(env_get("ncip"), ':');
if (p != NULL) {
nc_out_port = simple_strtoul(p + 1, NULL, 10);
nc_in_port = nc_out_port;
nc_ip.s_addr = ~0; /* ncip is not set, so broadcast */
}
- p = getenv("ncoutport");
+ p = env_get("ncoutport");
if (p != NULL)
nc_out_port = simple_strtoul(p, NULL, 10);
- p = getenv("ncinport");
+ p = env_get("ncinport");
if (p != NULL)
nc_in_port = simple_strtoul(p, NULL, 10);
index 20f8a551963cee8c4efc2c7c46fa97e244f6ec06..0bb99e6bc6ba4194558c195cbfadfb304ef4be35 100644 (file)
if (ret)
return ret;
- if (getenv("disable_giga"))
+ if (env_get("disable_giga"))
features &= ~(SUPPORTED_1000baseT_Half |
SUPPORTED_1000baseT_Full);
/* force master mode for 1000BaseT due to chip errata */
return ret;
/* add an option to disable the gigabit feature of this PHY */
- if (getenv("disable_giga")) {
+ if (env_get("disable_giga")) {
unsigned features;
unsigned bmcr;
index af20cf0f3e7db183f2333a894e9f082443a1c4c2..df76a9414455047c41768aae902f5f90138ce64a 100644 (file)
#ifdef CONFIG_SRIO_PCIE_BOOT_MASTER
/* boot from PCIE --master */
- char *s = getenv("bootmaster");
+ char *s = env_get("bootmaster");
char pcie[6];
sprintf(pcie, "PCIE%d", pci_info->pci_num);
#ifdef CONFIG_SRIO_PCIE_BOOT_MASTER
} else {
/* boot from PCIE --master releases slave's core 0 */
- char *s = getenv("bootmaster");
+ char *s = env_get("bootmaster");
char pcie[6];
sprintf(pcie, "PCIE%d", pci_info->pci_num);
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 6b36c187b522740e75efb7366330a974b2acf1fc..bbc7dab366d321bdeb4092a2a8be1922b1703efe 100644 (file)
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
if (!gd->pcidelay_done) {
/* wait "pcidelay" ms (if defined)... */
- s = getenv("pcidelay");
+ s = env_get("pcidelay");
if (s) {
int val = simple_strtoul(s, NULL, 10);
for (i = 0; i < val; i++)
hose_head = NULL;
/* allow env to disable pci init/enum */
- if (getenv("pcidisable") != NULL)
+ if (env_get("pcidisable") != NULL)
return;
/* now call board specific pci_init()... */
index 6526de80db89160bb51230c973e44b0113808a14..faf25d96cbcaa6a6cdb80c8bb11d487269fe8b9b 100644 (file)
--- a/drivers/pci/pci_common.c
+++ b/drivers/pci/pci_common.c
/*
* Only skip configuration if "pciconfighost" is not set
*/
- if (getenv("pciconfighost") == NULL)
+ if (env_get("pciconfighost") == NULL)
return 1;
#else
return 1;
diff --git a/drivers/rtc/m41t60.c b/drivers/rtc/m41t60.c
index 95083f0d7202e036d8c53757654e670709f45e27..2ddfd4ea5cbaa6b7b4dbfcb60fdb410c232500aa 100644 (file)
--- a/drivers/rtc/m41t60.c
+++ b/drivers/rtc/m41t60.c
void rtc_reset(void)
{
uchar *const data = rtc_validate();
- char const *const s = getenv("rtccal");
+ char const *const s = env_get("rtccal");
if (!data)
return;
index 29799dce93a00fa1a547118fc16d493ad4323da7..353109c0700af1e66641bca0451685a7c66cc0a4 100644 (file)
--- a/drivers/serial/usbtty.c
+++ b/drivers/serial/usbtty.c
int snlen;
/* Ger seiral number */
- if (!(sn = getenv("serial#"))) {
+ sn = env_get("serial#");
+ if (!sn)
sn = "000000000000";
- }
snlen = strlen(sn);
if (snlen > sizeof(serial_number) - 1) {
printf ("Warning: serial number %s is too long (%d > %lu)\n",
/* Decide on which type of UDC device to be.
*/
-
- if(!(tt = getenv("usbtty"))) {
+ tt = env_get("usbtty");
+ if (!tt)
tt = "generic";
- }
usbtty_init_terminal_type(strcmp(tt,"cdc_acm"));
/* prepare buffers... */
index 0db7a3b6c15566b65b4d7260603a30c59284b43f..a25f5019e8a70b482f9f3a6fe35e7340053bef2e 100644 (file)
if ((ep != 0) && (udc_device->device_state < STATE_ADDRESSED))
return;
- tt = getenv("usbtty");
+ tt = env_get("usbtty");
if (!tt)
tt = "generic";
index d0105372cf3e7edc549d91e36f97445c10f33b04..2cf5c8d31e25acb1c8a557d8e38e2ec7e84fa1ad 100644 (file)
strlcpy(host_addr, CONFIG_USBNET_HOST_ADDR, sizeof(host_addr));
#endif
/* Check if the user overruled the MAC addresses */
- if (getenv("usbnet_devaddr"))
- strlcpy(dev_addr, getenv("usbnet_devaddr"),
+ if (env_get("usbnet_devaddr"))
+ strlcpy(dev_addr, env_get("usbnet_devaddr"),
sizeof(dev_addr));
- if (getenv("usbnet_hostaddr"))
- strlcpy(host_addr, getenv("usbnet_hostaddr"),
+ if (env_get("usbnet_hostaddr"))
+ strlcpy(host_addr, env_get("usbnet_hostaddr"),
sizeof(host_addr));
if (!is_eth_addr_valid(dev_addr)) {
gadget = dev->gadget;
usb_gadget_connect(gadget);
- if (getenv("cdc_connect_timeout"))
- timeout = simple_strtoul(getenv("cdc_connect_timeout"),
+ if (env_get("cdc_connect_timeout"))
+ timeout = simple_strtoul(env_get("cdc_connect_timeout"),
NULL, 10) * CONFIG_SYS_HZ;
ts = get_timer(0);
while (!dev->network_started) {
index dfa435957793db6ec2783ad3776e69c5f94bbdbd..bc4be712da7f08ac8b8ba61692e5a6fc60983560 100644 (file)
cdev->req->context = f_dfu;
- s = getenv("serial#");
+ s = env_get("serial#");
if (s)
g_dnl_set_serialnumber((char *)s);
index 7cd6d24bf50ea5839d0af1fb17738c2df1ae5381..d05b74b2d2afe2270e77d532a5ab459e7b785b90 100644 (file)
f->hs_descriptors = fb_hs_function;
}
- s = getenv("serial#");
+ s = env_get("serial#");
if (s)
g_dnl_set_serialnumber((char *)s);
sprintf(str_num, "0x%08x", CONFIG_FASTBOOT_BUF_SIZE);
strncat(response, str_num, chars_left);
} else if (!strcmp_l1("serialno", cmd)) {
- s = getenv("serial#");
+ s = env_get("serial#");
if (s)
strncat(response, s, chars_left);
else
}
sprintf(envstr, "fastboot.%s", cmd);
- s = getenv(envstr);
+ s = env_get(envstr);
if (s) {
strncat(response, s, chars_left);
} else {
index b57c6cd35ac36b003a1ba9b71c9d81c658fde880..62c431b99f7bb62eaf0a52f44cf97759be5c73b0 100644 (file)
"phy_type", &len);
#endif
else
- phy_type = getenv("usb_phy_type");
+ phy_type = env_get("usb_phy_type");
if (!phy_type) {
#ifdef CONFIG_SYS_FSL_USB_INTERNAL_UTMI_PHY
index 07a29eaba1c1841dfc5095026a8123a4f207b9ae..5b6c42291cb0c482a29f0b1afd05fe436cc358b5 100644 (file)
videomode = CONFIG_SYS_DEFAULT_VIDEO_MODE;
/* get video mode via environment */
- if ((penv = getenv ("videomode")) != NULL) {
+ penv = env_get("videomode");
+ if (penv) {
/* deceide if it is a string */
if (penv[0] <= '9') {
videomode = (int) simple_strtoul (penv, NULL, 16);
index b6fc7e145b42cba79fa321d04ee09502361f1c43..6c5425c195e927d4594d6f4ccc97cbb56f88bbfa 100644 (file)
splash_get_pos(&video_logo_xpos, &video_logo_ypos);
#ifdef CONFIG_SPLASH_SCREEN
- s = getenv("splashimage");
+ s = env_get("splashimage");
if (s != NULL) {
ret = splash_screen_prepare();
if (ret < 0)
index 1c74e97c5e9d955de8b21bf2cb99735f9a877231..e0565e1d2e51e67ebc96cb781f324e8a35e8ab10 100644 (file)
--- a/drivers/video/mb862xx.c
+++ b/drivers/video/mb862xx.c
tmp = 0;
videomode = 0x310;
/* get video mode via environment */
- if ((penv = getenv ("videomode")) != NULL) {
+ penv = env_get("videomode");
+ if (penv) {
/* decide if it is a string */
if (penv[0] <= '9') {
videomode = (int) simple_strtoul (penv, NULL, 16);
diff --git a/drivers/video/mx3fb.c b/drivers/video/mx3fb.c
index 51d06d6677a1757b5a2e2aa9ec582cbf0ef47966..78e595ea4a27460033200fb328dd8a55305a8718 100644 (file)
--- a/drivers/video/mx3fb.c
+++ b/drivers/video/mx3fb.c
videomode = CONFIG_SYS_DEFAULT_VIDEO_MODE;
/* get video mode via environment */
- penv = getenv("videomode");
+ penv = env_get("videomode");
if (penv) {
/* decide if it is a string */
if (penv[0] <= '9') {
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
index 0ddce3db58bd1a4b7d1bac8d538c18a4527363a1..9d810bab31dee19a24241f9f75f78ad3e8686c07 100644 (file)
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
puts("Video: ");
/* Suck display configuration from "videomode" variable */
- penv = getenv("videomode");
+ penv = env_get("videomode");
if (!penv) {
puts("MXSFB: 'videomode' variable not set!\n");
return NULL;
index cf71ad120ecef3ab2fe49ff4fdb09db5123fdcae..6d96b33f20d0f2e532b77c70e0c177b663da9eaa 100644 (file)
/* first search for the environment containing the real param string */
s = penv;
- if ((p = getenv (s)) != NULL)
+ p = env_get(s);
+ if (p)
s = p;
/*
int video_get_video_mode(unsigned int *xres, unsigned int *yres,
unsigned int *depth, unsigned int *freq, const char **options)
{
- char *p = getenv("video-mode");
+ char *p = env_get("video-mode");
if (!p)
return 0;
diff --git a/env/callback.c b/env/callback.c
index 1957cc199648b715a0d7ef81fe614fa775a590db..be70980f04e46c8efac81a6dbbbdaba7a1f8abfe 100644 (file)
--- a/env/callback.c
+++ b/env/callback.c
int ret = 1;
if (first_call) {
- callback_list = getenv(ENV_CALLBACK_VAR);
+ callback_list = env_get(ENV_CALLBACK_VAR);
first_call = 0;
}
diff --git a/env/common.c b/env/common.c
index 0cc8829d0d07d6533776510e30dc691e156f7d3c..110323ecea7cc6f67163708a326c2d54c9397cb9 100644 (file)
--- a/env/common.c
+++ b/env/common.c
*/
int getenv_yesno(const char *var)
{
- char *s = getenv(var);
+ char *s = env_get(var);
if (s == NULL)
return -1;
/* Pretend that the image is bad. */
gd->flags &= ~GD_FLG_ENV_READY;
gd->env_valid = 0;
- ret_val = getenv(name);
+ ret_val = env_get(name);
gd->env_valid = really_valid;
gd->flags = real_gd_flags;
return ret_val;
diff --git a/env/flags.c b/env/flags.c
index 3c50620cb34df8b527131d3809e4ce5cddf3ff12..85a344fa517f1289c3605c5768bc573eff36b0d1 100644 (file)
--- a/env/flags.c
+++ b/env/flags.c
#include "fw_env.h"
#include <env_attr.h>
#include <env_flags.h>
-#define getenv fw_getenv
+#define env_get fw_getenv
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#else
#include <common.h>
*/
enum env_flags_vartype env_flags_get_type(const char *name)
{
- const char *flags_list = getenv(ENV_FLAGS_VAR);
+ const char *flags_list = env_get(ENV_FLAGS_VAR);
char flags[ENV_FLAGS_ATTR_MAX_LEN + 1];
if (env_flags_lookup(flags_list, name, flags))
*/
enum env_flags_varaccess env_flags_get_varaccess(const char *name)
{
- const char *flags_list = getenv(ENV_FLAGS_VAR);
+ const char *flags_list = env_get(ENV_FLAGS_VAR);
char flags[ENV_FLAGS_ATTR_MAX_LEN + 1];
if (env_flags_lookup(flags_list, name, flags))
int ret = 1;
if (first_call) {
- flags_list = getenv(ENV_FLAGS_VAR);
+ flags_list = env_get(ENV_FLAGS_VAR);
first_call = 0;
}
/* look in the ".flags" and static for a reference to this variable */
index 055dffdafdf023fa39bd4865550630537a988652..13cd3626c6f811248553ef625b7f64e02e27dfc0 100644 (file)
--- a/fs/fs.c
+++ b/fs/fs.c
if (ep == argv[3] || *ep != '\0')
return CMD_RET_USAGE;
} else {
- addr_str = getenv("loadaddr");
+ addr_str = env_get("loadaddr");
if (addr_str != NULL)
addr = simple_strtoul(addr_str, NULL, 16);
else
if (argc >= 5) {
filename = argv[4];
} else {
- filename = getenv("bootfile");
+ filename = env_get("bootfile");
if (!filename) {
puts("** No boot file defined **\n");
return 1;
diff --git a/include/_exports.h b/include/_exports.h
index 9deed7737814bd9cefb012bf02f772b4676415a7..5416041243d67c025b6c79f9f58b1bde40bb2680 100644 (file)
--- a/include/_exports.h
+++ b/include/_exports.h
EXPORT_FUNC(vprintf, int, vprintf, const char *, va_list)
EXPORT_FUNC(do_reset, int, do_reset, cmd_tbl_t *,
int , int , char * const [])
- EXPORT_FUNC(getenv, char *, getenv, const char*)
+ EXPORT_FUNC(env_get, char *, env_get, const char*)
EXPORT_FUNC(env_set, int, env_set, const char *, const char *)
EXPORT_FUNC(simple_strtoul, unsigned long, simple_strtoul,
const char *, char **, unsigned int)
index 8b32d514c344e680b0aeefd78951aa67ac70439a..944f58195cafb767672b9c6a360c6c96912b5181 100644 (file)
struct device_node *of_root;
#endif
struct jt_funcs *jt; /* jump table */
- char env_buf[32]; /* buffer for getenv() before reloc. */
+ char env_buf[32]; /* buffer for env_get() before reloc. */
#ifdef CONFIG_TRACE
void *trace_buff; /* The trace buffer */
#endif
diff --git a/include/common.h b/include/common.h
index 3f884d536e5d52efbb40b896a9826535894ba0a9..7574ca754c2f552f5bd5fb99e231a7a4bd93ed89 100644 (file)
--- a/include/common.h
+++ b/include/common.h
void env_relocate (void);
int envmatch (uchar *, int);
-/* Avoid unfortunate conflict with libc's getenv() */
-#ifdef CONFIG_SANDBOX
-#define getenv uboot_getenv
-#endif
-char *getenv (const char *);
-int getenv_f (const char *name, char *buf, unsigned len);
+/**
+ * env_get() - Look up the value of an environment variable
+ *
+ * In U-Boot proper this can be called before relocation (which is when the
+ * environment is loaded from storage, i.e. GD_FLG_ENV_READY is 0). In that
+ * case this function calls env_get_f().
+ *
+ * @varname: Variable to look up
+ * @return value of variable, or NULL if not found
+ */
+char *env_get(const char *varname);
+
+/**
+ * env_get_f() - Look up the value of an environment variable (early)
+ *
+ * This function is called from env_get() if the environment has not been
+ * loaded yet (GD_FLG_ENV_READY flag is 0). Some environment locations will
+ * support reading the value (slowly) and some will not.
+ *
+ * @varname: Variable to look up
+ * @return value of variable, or NULL if not found
+ */
+int env_get_f(const char *name, char *buf, unsigned len);
+
ulong getenv_ulong(const char *name, int base, ulong default_val);
/**
#include <net.h>
static inline struct in_addr getenv_ip(char *var)
{
- return string_to_ip(getenv(var));
+ return string_to_ip(env_get(var));
}
int pcmcia_init (void);
diff --git a/include/exports.h b/include/exports.h
index 6522d78facb43d1f667489670abcdc9040192f0f..ebe81d914cb226256730bece027cc6fceb28dc68 100644 (file)
--- a/include/exports.h
+++ b/include/exports.h
int vprintf(const char *, va_list);
unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base);
int strict_strtoul(const char *cp, unsigned int base, unsigned long *res);
-char *getenv (const char *name);
+char *env_get(const char *name);
int env_set(const char *varname, const char *value);
long simple_strtol(const char *cp, char **endp, unsigned int base);
int strcmp(const char *cs, const char *ct);
diff --git a/include/image.h b/include/image.h
index c6f1513220a31d29a0bf68a2879afd97eb3a62ab..c4fe4cfb8b155fe422980530ead18040920e3fe6 100644 (file)
--- a/include/image.h
+++ b/include/image.h
bd_t *kbd;
#endif
- int verify; /* getenv("verify")[0] != 'n' */
+ int verify; /* env_get("verify")[0] != 'n' */
#define BOOTM_STATE_START (0x00000001)
#define BOOTM_STATE_FINDOS (0x00000002)
diff --git a/lib/smbios.c b/lib/smbios.c
index 22ca247fec8881ba3dcc87ffc831769f85cf1a4a..8f19ad89c121ebbc2ae1a7842edc8a8e432e3b8b 100644 (file)
--- a/lib/smbios.c
+++ b/lib/smbios.c
{
struct smbios_type1 *t = (struct smbios_type1 *)*current;
int len = sizeof(struct smbios_type1);
- char *serial_str = getenv("serial#");
+ char *serial_str = env_get("serial#");
memset(t, 0, sizeof(struct smbios_type1));
fill_smbios_header(t, SMBIOS_SYSTEM_INFORMATION, len, handle);
diff --git a/net/bootp.c b/net/bootp.c
index 579515687b7567e0e2069ff316ac60129f0da846..6c869ef8560b45a83bdf0c7e0932567b6122b708 100644 (file)
--- a/net/bootp.c
+++ b/net/bootp.c
static u8 *add_vci(u8 *e)
{
char *vci = NULL;
- char *env_vci = getenv("bootp_vci");
+ char *env_vci = env_get("bootp_vci");
#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_NET_VCI_STRING)
vci = CONFIG_SPL_NET_VCI_STRING;
*e++ = tmp & 0xff;
}
#if defined(CONFIG_BOOTP_SEND_HOSTNAME)
- hostname = getenv("hostname");
+ hostname = env_get("hostname");
if (hostname) {
int hostnamelen = strlen(hostname);
clientarch = CONFIG_BOOTP_PXE_CLIENTARCH;
#endif
- if (getenv("bootp_arch"))
+ if (env_get("bootp_arch"))
clientarch = getenv_ulong("bootp_arch", 16, clientarch);
if (clientarch > 0) {
*e++ = 0; /* minor revision */
#ifdef CONFIG_LIB_UUID
- uuid = getenv("pxeuuid");
+ uuid = env_get("pxeuuid");
if (uuid) {
if (uuid_str_valid(uuid)) {
dhcp_state = INIT;
#endif
- ep = getenv("bootpretryperiod");
+ ep = env_get("bootpretryperiod");
if (ep != NULL)
time_taken_max = simple_strtoul(ep, NULL, 10);
else
diff --git a/net/eth-uclass.c b/net/eth-uclass.c
index d35657621005c22d27468bc38a8effe935349065..6051a6ab6f51c4b932f21d30c68972e64f48038e 100644 (file)
--- a/net/eth-uclass.c
+++ b/net/eth-uclass.c
int eth_init(void)
{
- char *ethact = getenv("ethact");
- char *ethrotate = getenv("ethrotate");
+ char *ethact = env_get("ethact");
+ char *ethrotate = env_get("ethrotate");
struct udevice *current = NULL;
struct udevice *old_current;
int ret = -ENODEV;
printf("No ethernet found.\n");
bootstage_error(BOOTSTAGE_ID_NET_ETH_START);
} else {
- char *ethprime = getenv("ethprime");
+ char *ethprime = env_get("ethprime");
struct udevice *prime_dev = NULL;
if (ethprime)
diff --git a/net/eth_common.c b/net/eth_common.c
index 7b36532ee1b100bfd32c38ebe1e8de7d0c215273..bde3b88322b992c06a1f4847b6ec7a3653ca5ce5 100644 (file)
--- a/net/eth_common.c
+++ b/net/eth_common.c
int eth_getenv_enetaddr(const char *name, uchar *enetaddr)
{
- eth_parse_enetaddr(getenv(name), enetaddr);
+ eth_parse_enetaddr(env_get(name), enetaddr);
return is_valid_ethaddr(enetaddr);
}
char *skip_state;
sprintf(enetvar, index ? "eth%dmacskip" : "ethmacskip", index);
- skip_state = getenv(enetvar);
+ skip_state = env_get(enetvar);
return skip_state != NULL;
}
void eth_current_changed(void)
{
- char *act = getenv("ethact");
+ char *act = env_get("ethact");
char *ethrotate;
/*
* ethernet device if uc_priv->current == NULL. This is not what
* we want when 'ethrotate' variable is 'no'.
*/
- ethrotate = getenv("ethrotate");
+ ethrotate = env_get("ethrotate");
if ((ethrotate != NULL) && (strcmp(ethrotate, "no") == 0))
return;
* Do not rotate between network interfaces when
* 'ethrotate' variable is set to 'no'.
*/
- ethrotate = getenv("ethrotate");
+ ethrotate = env_get("ethrotate");
if ((ethrotate != NULL) && (strcmp(ethrotate, "no") == 0))
return;
env_id = get_env_id();
if ((act == NULL) || (env_changed_id != env_id)) {
- act = getenv("ethact");
+ act = env_get("ethact");
env_changed_id = env_id;
}
if (act == NULL) {
- char *ethprime = getenv("ethprime");
+ char *ethprime = env_get("ethprime");
void *dev = NULL;
if (ethprime)
diff --git a/net/eth_legacy.c b/net/eth_legacy.c
index 2608302648f8d4e9eaa9cd992bbf8948e74a1fd0..5d29d3483b1e399551dcf609d9da52074517f36a 100644 (file)
--- a/net/eth_legacy.c
+++ b/net/eth_legacy.c
bootstage_error(BOOTSTAGE_ID_NET_ETH_START);
} else {
struct eth_device *dev = eth_devices;
- char *ethprime = getenv("ethprime");
+ char *ethprime = env_get("ethprime");
bootstage_mark(BOOTSTAGE_ID_NET_ETH_INIT);
do {
diff --git a/net/net.c b/net/net.c
index be33c66b3ac6ab8e6dd80be8c735cfbbda338efc..4f82a7e46b204c507c550ea2dc756b6814d14e5f 100644 (file)
--- a/net/net.c
+++ b/net/net.c
void net_auto_load(void)
{
#if defined(CONFIG_CMD_NFS)
- const char *s = getenv("autoload");
+ const char *s = env_get("autoload");
if (s != NULL && strcmp(s, "NFS") == 0) {
/*
unsigned long retrycnt = 0;
int ret;
- nretry = getenv("netretry");
+ nretry = env_get("netretry");
if (nretry) {
if (!strcmp(nretry, "yes"))
retry_forever = 1;
ushort getenv_vlan(char *var)
{
- return string_to_vlan(getenv(var));
+ return string_to_vlan(env_get(var));
}
diff --git a/net/tftp.c b/net/tftp.c
index 61e1671068039f2be225e5a8b0af9164237fbaa9..a5ed8c5d0a3507b5f8dc270aae53194db4c0deb7 100644 (file)
--- a/net/tftp.c
+++ b/net/tftp.c
* TFTP protocol has a minimal timeout of 1 second.
*/
- ep = getenv("tftpblocksize");
+ ep = env_get("tftpblocksize");
if (ep != NULL)
tftp_block_size_option = simple_strtol(ep, NULL, 10);
- ep = getenv("tftptimeout");
+ ep = env_get("tftptimeout");
if (ep != NULL)
timeout_ms = simple_strtol(ep, NULL, 10);
timeout_ms = 1000;
}
- ep = getenv("tftptimeoutcountmax");
+ ep = env_get("tftptimeoutcountmax");
if (ep != NULL)
tftp_timeout_count_max = simple_strtol(ep, NULL, 10);
tftp_our_port = 1024 + (get_timer(0) % 3072);
#ifdef CONFIG_TFTP_PORT
- ep = getenv("tftpdstp");
+ ep = env_get("tftpdstp");
if (ep != NULL)
tftp_remote_port = simple_strtol(ep, NULL, 10);
- ep = getenv("tftpsrcp");
+ ep = env_get("tftpsrcp");
if (ep != NULL)
tftp_our_port = simple_strtol(ep, NULL, 10);
#endif
diff --git a/post/post.c b/post/post.c
index 8c2c822acbd2c51e6a814f5125ef96fafc8bf253..8fef0c34127d2a635cbe83db5895ad1f819ff8a9 100644 (file)
--- a/post/post.c
+++ b/post/post.c
int i, j;
for (i = 0; i < varnum; i++) {
- if (getenv_f(var[i], list, sizeof(list)) <= 0)
+ if (env_get_f(var[i], list, sizeof(list)) <= 0)
continue;
for (j = 0; j < post_list_size; j++)
diff --git a/test/command_ut.c b/test/command_ut.c
index 21283eb35732568abd464f10a1d8fa32aac3f931..f76d52569da70a64c1445ef41203fca158d635a3 100644 (file)
--- a/test/command_ut.c
+++ b/test/command_ut.c
/* commands separated by \n */
run_command_list("setenv list 1\n setenv list ${list}1", -1, 0);
- assert(!strcmp("11", getenv("list")));
+ assert(!strcmp("11", env_get("list")));
/* command followed by \n and nothing else */
run_command_list("setenv list 1${list}\n", -1, 0);
- assert(!strcmp("111", getenv("list")));
+ assert(!strcmp("111", env_get("list")));
/* a command string with \0 in it. Stuff after \0 should be ignored */
run_command("setenv list", 0);
run_command_list(test_cmd, sizeof(test_cmd), 0);
- assert(!strcmp("123", getenv("list")));
+ assert(!strcmp("123", env_get("list")));
/*
* a command list where we limit execution to only the first command
*/
run_command_list("setenv list 1\n setenv list ${list}2; "
"setenv list ${list}3", strlen("setenv list 1"), 0);
- assert(!strcmp("1", getenv("list")));
+ assert(!strcmp("1", env_get("list")));
assert(run_command("false", 0) == 1);
assert(run_command("echo", 0) == 0);
#ifdef CONFIG_HUSH_PARSER
run_command("setenv foo 'setenv black 1\nsetenv adder 2'", 0);
run_command("run foo", 0);
- assert(getenv("black") != NULL);
- assert(!strcmp("1", getenv("black")));
- assert(getenv("adder") != NULL);
- assert(!strcmp("2", getenv("adder")));
+ assert(env_get("black") != NULL);
+ assert(!strcmp("1", env_get("black")));
+ assert(env_get("adder") != NULL);
+ assert(!strcmp("2", env_get("adder")));
#endif
assert(run_command("", 0) == 0);
diff --git a/test/dm/eth.c b/test/dm/eth.c
index f824d704c69f36ca4ad6d23e4e4345f3703a89e5..122fab924d6ac4491cb87907029b50a3d5cd259e 100644 (file)
--- a/test/dm/eth.c
+++ b/test/dm/eth.c
env_set("ethact", "eth@10002000");
ut_assertok(net_loop(PING));
- ut_asserteq_str("eth@10002000", getenv("ethact"));
+ ut_asserteq_str("eth@10002000", env_get("ethact"));
env_set("ethact", "eth@10003000");
ut_assertok(net_loop(PING));
- ut_asserteq_str("eth@10003000", getenv("ethact"));
+ ut_asserteq_str("eth@10003000", env_get("ethact"));
env_set("ethact", "eth@10004000");
ut_assertok(net_loop(PING));
- ut_asserteq_str("eth@10004000", getenv("ethact"));
+ ut_asserteq_str("eth@10004000", env_get("ethact"));
return 0;
}
net_ping_ip = string_to_ip("1.1.2.2");
env_set("ethact", "eth0");
ut_assertok(net_loop(PING));
- ut_asserteq_str("eth@10002000", getenv("ethact"));
+ ut_asserteq_str("eth@10002000", env_get("ethact"));
env_set("ethact", "eth1");
ut_assertok(net_loop(PING));
- ut_asserteq_str("eth@10004000", getenv("ethact"));
+ ut_asserteq_str("eth@10004000", env_get("ethact"));
/* Expected to fail since eth2 is not defined in the device tree */
env_set("ethact", "eth2");
ut_assertok(net_loop(PING));
- ut_asserteq_str("eth@10002000", getenv("ethact"));
+ ut_asserteq_str("eth@10002000", env_get("ethact"));
env_set("ethact", "eth5");
ut_assertok(net_loop(PING));
- ut_asserteq_str("eth@10003000", getenv("ethact"));
+ ut_asserteq_str("eth@10003000", env_get("ethact"));
return 0;
}
env_set("ethact", NULL);
env_set("ethprime", "eth5");
ut_assertok(net_loop(PING));
- ut_asserteq_str("eth@10003000", getenv("ethact"));
+ ut_asserteq_str("eth@10003000", env_get("ethact"));
/* Expected to be "eth@10002000" because it is first */
env_set("ethact", NULL);
env_set("ethprime", NULL);
ut_assertok(net_loop(PING));
- ut_asserteq_str("eth@10002000", getenv("ethact"));
+ ut_asserteq_str("eth@10002000", env_get("ethact"));
return 0;
}
ut_assertok(device_remove(dev[i], DM_REMOVE_NORMAL));
/* Invalidate MAC address */
- strcpy(ethaddr[i], getenv(addrname[i]));
+ strcpy(ethaddr[i], env_get(addrname[i]));
/* Must disable access protection for ethaddr before clearing */
env_set(".flags", addrname[i]);
env_set(addrname[i], NULL);
/* Make sure that the default is to rotate to the next interface */
env_set("ethact", "eth@10004000");
ut_assertok(net_loop(PING));
- ut_asserteq_str("eth@10002000", getenv("ethact"));
+ ut_asserteq_str("eth@10002000", env_get("ethact"));
/* If ethrotate is no, then we should fail on a bad MAC */
env_set("ethact", "eth@10004000");
env_set("ethrotate", "no");
ut_asserteq(-EINVAL, net_loop(PING));
- ut_asserteq_str("eth@10004000", getenv("ethact"));
+ ut_asserteq_str("eth@10004000", env_get("ethact"));
return 0;
}
/* Make sure we can skip invalid devices */
env_set("ethact", "eth@10004000");
ut_assertok(net_loop(PING));
- ut_asserteq_str("eth@10004000", getenv("ethact"));
+ ut_asserteq_str("eth@10004000", env_get("ethact"));
/* Make sure we can handle device name which is not eth# */
env_set("ethact", "sbe5");
ut_assertok(net_loop(PING));
- ut_asserteq_str("sbe5", getenv("ethact"));
+ ut_asserteq_str("sbe5", env_get("ethact"));
return 0;
}
net_ping_ip = string_to_ip("1.1.2.2");
/* Invalidate eth1's MAC address */
- strcpy(ethaddr, getenv("eth1addr"));
+ strcpy(ethaddr, env_get("eth1addr"));
/* Must disable access protection for eth1addr before clearing */
env_set(".flags", "eth1addr");
env_set("eth1addr", NULL);
if (!retval) {
/* Invalidate eth0's MAC address */
- strcpy(ethaddr, getenv("ethaddr"));
+ strcpy(ethaddr, env_get("ethaddr"));
/* Must disable access protection for ethaddr before clearing */
env_set(".flags", "ethaddr");
env_set("ethaddr", NULL);
env_set("netretry", "yes");
sandbox_eth_skip_timeout();
ut_assertok(net_loop(PING));
- ut_asserteq_str("eth@10002000", getenv("ethact"));
+ ut_asserteq_str("eth@10002000", env_get("ethact"));
/*
* eth1 is disabled and netretry is no, so the ping should fail and the
env_set("netretry", "no");
sandbox_eth_skip_timeout();
ut_asserteq(-ETIMEDOUT, net_loop(PING));
- ut_asserteq_str("eth@10004000", getenv("ethact"));
+ ut_asserteq_str("eth@10004000", env_get("ethact"));
return 0;
}