[U-Boot] [PATCH v2 32/34] env: Rename getenv() and friends to env_get()

Simon Glass
2017-07-24T03:20:07Z

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2:
- Add new patch to rename getenv() and friends to env_get()

README | 2 +-
api/api.c | 2 +-
arch/arc/lib/bootm.c | 2 +-
arch/arm/cpu/armv8/fsl-layerscape/soc.c | 2 +-
arch/arm/lib/bootm.c | 6 +--
arch/arm/mach-davinci/misc.c | 2 +-
arch/arm/mach-imx/video.c | 2 +-
arch/arm/mach-keystone/ddr3.c | 2 +-
arch/arm/mach-keystone/keystone.c | 2 +-
arch/arm/mach-kirkwood/cpu.c | 4 +-
arch/arm/mach-omap2/utils.c | 8 ++--
arch/arm/mach-tegra/tegra186/nvtboot_board.c | 2 +-
arch/arm/mach-uniphier/board_late_init.c | 2 +-
arch/m68k/lib/bootm.c | 3 +-
arch/microblaze/lib/bootm.c | 2 +-
arch/mips/lib/bootm.c | 6 +--
arch/nds32/lib/bootm.c | 4 +-
arch/nios2/lib/bootm.c | 2 +-
arch/powerpc/cpu/mpc85xx/cpu_init.c | 10 ++--
arch/powerpc/cpu/mpc85xx/fdt.c | 4 +-
arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c | 2 +-
arch/powerpc/cpu/mpc85xx/mp.c | 2 +-
arch/powerpc/lib/bootm.c | 11 +++--
arch/sh/lib/bootm.c | 2 +-
arch/sh/lib/zimageboot.c | 2 +-
arch/x86/lib/zimage.c | 8 ++--
arch/xtensa/lib/bootm.c | 2 +-
board/Arcturus/ucp1020/cmd_arc.c | 6 +--
board/Arcturus/ucp1020/ucp1020.c | 14 +++---
board/Barix/ipam390/ipam390.c | 2 +-
board/BuR/brxre1/board.c | 6 +--
board/BuR/common/common.c | 52 ++++++++++-----------
board/BuS/eb_cpu5282/eb_cpu5282.c | 8 ++--
board/CarMediaLab/flea3/flea3.c | 2 +-
board/LaCie/net2big_v2/net2big_v2.c | 2 +-
board/LaCie/netspace_v2/netspace_v2.c | 2 +-
board/amazon/kc1/kc1.c | 2 +-
board/amlogic/odroid-c2/odroid-c2.c | 4 +-
board/aristainetos/aristainetos-v2.c | 4 +-
board/atmel/sama5d2_xplained/sama5d2_xplained.c | 2 +-
board/birdland/bav335x/board.c | 4 +-
board/bluegiga/apx4devkit/apx4devkit.c | 4 +-
board/bluewater/gurnard/gurnard.c | 6 +--
board/bosch/shc/board.c | 2 +-
board/boundary/nitrogen6x/nitrogen6x.c | 8 ++--
board/broadcom/bcm23550_w1d/bcm23550_w1d.c | 2 +-
board/broadcom/bcm28155_ap/bcm28155_ap.c | 2 +-
board/buffalo/lsxl/lsxl.c | 2 +-
board/cadence/xtfpga/xtfpga.c | 2 +-
board/compulab/cl-som-am57x/eth.c | 4 +-
board/compulab/cm_fx6/cm_fx6.c | 10 ++--
board/compulab/cm_t335/cm_t335.c | 2 +-
board/compulab/cm_t35/cm_t35.c | 2 +-
board/compulab/cm_t3517/cm_t3517.c | 2 +-
board/compulab/cm_t54/cm_t54.c | 4 +-
board/compulab/common/omap3_display.c | 4 +-
board/congatec/cgtqmx6eval/cgtqmx6eval.c | 4 +-
board/davinci/da8xxevm/da850evm.c | 4 +-
board/davinci/da8xxevm/omapl138_lcdk.c | 4 +-
board/esd/meesc/meesc.c | 7 +--
board/freescale/b4860qds/b4860qds.c | 8 ++--
board/freescale/bsc9131rdb/bsc9131rdb.c | 4 +-
board/freescale/bsc9132qds/bsc9132qds.c | 4 +-
board/freescale/c29xpcie/c29xpcie.c | 4 +-
board/freescale/common/sys_eeprom.c | 2 +-
board/freescale/common/vid.c | 4 +-
board/freescale/corenet_ds/corenet_ds.c | 4 +-
board/freescale/ls2080aqds/eth.c | 6 +--
board/freescale/ls2080aqds/ls2080aqds.c | 2 +-
board/freescale/ls2080ardb/ls2080ardb.c | 2 +-
board/freescale/mpc837xemds/pci.c | 2 +-
board/freescale/mpc837xerdb/mpc837xerdb.c | 2 +-
board/freescale/mpc8572ds/mpc8572ds.c | 4 +-
board/freescale/mx51evk/mx51evk_video.c | 2 +-
board/freescale/mx53loco/mx53loco_video.c | 2 +-
board/freescale/p1010rdb/p1010rdb.c | 4 +-
board/freescale/p1022ds/p1022ds.c | 4 +-
board/freescale/p1023rdb/p1023rdb.c | 4 +-
board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 7 +--
board/freescale/p1_twr/p1_twr.c | 4 +-
board/freescale/p2041rdb/p2041rdb.c | 4 +-
board/freescale/t102xqds/t102xqds.c | 4 +-
board/freescale/t102xrdb/t102xrdb.c | 4 +-
board/freescale/t1040qds/t1040qds.c | 4 +-
board/freescale/t104xrdb/t104xrdb.c | 4 +-
board/freescale/t208xqds/t208xqds.c | 4 +-
board/freescale/t208xrdb/t208xrdb.c | 4 +-
board/freescale/t4qds/t4240emu.c | 4 +-
board/freescale/t4qds/t4240qds.c | 6 +--
board/freescale/t4rdb/t4240rdb.c | 4 +-
board/gateworks/gw_ventana/common.c | 2 +-
board/gateworks/gw_ventana/gw_ventana.c | 34 +++++++-------
board/gateworks/gw_ventana/gw_ventana_spl.c | 4 +-
board/gdsys/a38x/keyprogram.c | 4 +-
board/gdsys/mpc8308/hrcon.c | 2 +-
board/gdsys/mpc8308/strider.c | 2 +-
board/gdsys/p1022/controlcenterd-id.c | 10 ++--
board/gdsys/p1022/controlcenterd.c | 6 +--
board/grinn/chiliboard/board.c | 4 +-
board/grinn/liteboard/board.c | 2 +-
board/gumstix/pepper/board.c | 2 +-
board/highbank/highbank.c | 2 +-
board/isee/igep003x/board.c | 2 +-
board/keymile/common/common.c | 10 ++--
board/keymile/common/ivm.c | 6 +--
board/keymile/km_arm/km_arm.c | 2 +-
board/keymile/kmp204x/kmp204x.c | 6 +--
board/kosagi/novena/novena.c | 2 +-
board/lg/sniper/sniper.c | 2 +-
board/liebherr/mccmon6/mccmon6.c | 4 +-
board/logicpd/omap3som/omap3logic.c | 2 +-
board/logicpd/zoom1/zoom1.c | 2 +-
board/micronas/vct/vct.c | 2 +-
board/nokia/rx51/rx51.c | 8 ++--
board/phytec/pcm051/board.c | 2 +-
board/raspberrypi/rpi/rpi.c | 12 ++---
board/renesas/alt/alt.c | 2 +-
board/renesas/blanche/blanche.c | 2 +-
board/renesas/gose/gose.c | 2 +-
board/renesas/koelsch/koelsch.c | 2 +-
board/renesas/lager/lager.c | 2 +-
board/renesas/porter/porter.c | 2 +-
board/renesas/silk/silk.c | 2 +-
board/renesas/stout/stout.c | 2 +-
board/samsung/common/exynos5-dt.c | 2 +-
board/samsung/odroid/odroid.c | 2 +-
board/samtec/vining_2000/vining_2000.c | 2 +-
board/samtec/vining_fpga/socfpga.c | 6 +--
board/siemens/common/board.c | 4 +-
board/siemens/taurus/taurus.c | 18 ++++----
board/silica/pengwyn/board.c | 2 +-
board/socrates/socrates.c | 4 +-
board/spear/common/spr_misc.c | 2 +-
board/st/stm32f429-discovery/stm32f429-discovery.c | 2 +-
board/sunxi/board.c | 6 +--
board/syteco/zmx25/zmx25.c | 2 +-
board/tcl/sl50/board.c | 6 +--
board/technexion/twister/twister.c | 2 +-
board/teejet/mt_ventoux/mt_ventoux.c | 4 +-
board/theobroma-systems/puma_rk3399/puma-rk3399.c | 6 +--
board/ti/am335x/board.c | 6 +--
board/ti/am43xx/board.c | 4 +-
board/ti/am57xx/board.c | 6 +--
board/ti/dra7xx/evm.c | 6 +--
board/ti/evm/evm.c | 2 +-
board/ti/ks2_evm/board.c | 12 ++---
board/ti/ti814x/evm.c | 2 +-
board/ti/ti816x/evm.c | 2 +-
board/timll/devkit8000/devkit8000.c | 2 +-
board/toradex/apalis_imx6/apalis_imx6.c | 2 +-
board/toradex/common/tdx-cfg-block.c | 2 +-
board/toradex/common/tdx-common.c | 4 +-
board/varisys/common/sys_eeprom.c | 2 +-
board/varisys/cyrus/cyrus.c | 4 +-
board/vscom/baltos/board.c | 2 +-
.../work-microwave/work_92105/work_92105_display.c | 2 +-
board/xes/common/board.c | 6 +--
board/xilinx/zynqmp/zynqmp.c | 4 +-
cmd/bdinfo.c | 6 +--
cmd/bootm.c | 4 +-
cmd/bootmenu.c | 4 +-
cmd/cramfs.c | 8 ++--
cmd/elf.c | 32 ++++++-------
cmd/fdt.c | 2 +-
cmd/fpga.c | 4 +-
cmd/gpt.c | 4 +-
cmd/ini.c | 4 +-
cmd/itest.c | 2 +-
cmd/jffs2.c | 4 +-
cmd/load.c | 10 ++--
cmd/log.c | 6 ++-
cmd/md5sum.c | 2 +-
cmd/mtdparts.c | 16 +++----
cmd/mvebu/bubt.c | 2 +-
cmd/nand.c | 6 +--
cmd/net.c | 6 +--
cmd/nvedit.c | 18 ++++----
cmd/pxe.c | 27 ++++++-----
cmd/qfw.c | 4 +-
cmd/reiser.c | 6 +--
cmd/setexpr.c | 2 +-
cmd/source.c | 2 +-
cmd/trace.c | 6 +--
cmd/ximg.c | 2 +-
cmd/zfs.c | 4 +-
common/autoboot.c | 18 ++++----
common/board_f.c | 4 +-
common/board_r.c | 18 ++++----
common/bootm.c | 12 ++---
common/bootm_os.c | 10 ++--
common/bootretry.c | 2 +-
common/cli.c | 2 +-
common/cli_hush.c | 14 +++---
common/cli_simple.c | 4 +-
common/console.c | 10 ++--
common/fb_mmc.c | 2 +-
common/fdt_support.c | 6 +--
common/hash.c | 2 +-
common/hwconfig.c | 2 +-
common/image-android.c | 2 +-
common/image-fdt.c | 6 +--
common/image.c | 32 +++++++------
common/lcd.c | 2 +-
common/main.c | 2 +-
common/spl/Kconfig | 2 +-
common/spl/spl_dfu.c | 2 +-
common/spl/spl_ext.c | 4 +-
common/spl/spl_fat.c | 4 +-
common/splash.c | 2 +-
common/splash_source.c | 6 +--
common/update.c | 7 +--
common/usb_hub.c | 2 +-
common/usb_kbd.c | 6 +--
disk/part.c | 2 +-
disk/part_amiga.c | 4 +-
doc/README.enetaddr | 4 +-
drivers/bootcount/bootcount_env.c | 6 +--
drivers/ddr/fsl/fsl_ddr_gen4.c | 2 +-
drivers/ddr/fsl/interactive.c | 8 ++--
drivers/ddr/fsl/options.c | 6 +--
drivers/dfu/dfu.c | 6 +--
drivers/dfu/dfu_mmc.c | 2 +-
drivers/input/i8042.c | 2 +-
drivers/input/input.c | 2 +-
drivers/mtd/cfi_flash.c | 2 +-
drivers/net/dc2114x.c | 2 +-
drivers/net/fec_mxc.c | 2 +-
drivers/net/fm/b4860.c | 2 +-
drivers/net/fm/fdt.c | 2 +-
drivers/net/fsl-mc/mc.c | 10 ++--
drivers/net/fsl_mcdmafec.c | 4 +-
drivers/net/ftgmac100.c | 2 +-
drivers/net/ftmac100.c | 2 +-
drivers/net/lan91c96.c | 2 +-
drivers/net/mcffec.c | 8 ++--
drivers/net/ne2000_base.c | 4 +-
drivers/net/netconsole.c | 14 +++---
drivers/net/phy/micrel.c | 2 +-
drivers/net/sh_eth.c | 2 +-
drivers/pci/fsl_pci_init.c | 4 +-
drivers/pci/pci.c | 4 +-
drivers/pci/pci_common.c | 2 +-
drivers/rtc/m41t60.c | 2 +-
drivers/serial/usbtty.c | 9 ++--
drivers/usb/gadget/designware_udc.c | 2 +-
drivers/usb/gadget/ether.c | 12 ++---
drivers/usb/gadget/f_dfu.c | 2 +-
drivers/usb/gadget/f_fastboot.c | 6 +--
drivers/usb/host/ehci-fsl.c | 2 +-
drivers/video/ati_radeon_fb.c | 3 +-
drivers/video/cfb_console.c | 2 +-
drivers/video/ct69000.c | 3 +-
drivers/video/mb862xx.c | 3 +-
drivers/video/mx3fb.c | 2 +-
drivers/video/mxsfb.c | 2 +-
drivers/video/videomodes.c | 5 +-
env/callback.c | 2 +-
env/common.c | 8 ++--
env/flags.c | 10 ++--
fs/fs.c | 4 +-
include/_exports.h | 2 +-
include/asm-generic/global_data.h | 2 +-
include/common.h | 53 +++++++++++++++++-----
include/environment.h | 2 +-
include/exports.h | 2 +-
include/image.h | 8 ++--
include/net.h | 6 +--
lib/fdtdec.c | 2 +-
lib/smbios.c | 2 +-
net/bootp.c | 12 ++---
net/eth-uclass.c | 8 ++--
net/eth_common.c | 22 ++++-----
net/eth_legacy.c | 4 +-
net/link_local.c | 2 +-
net/net.c | 10 ++--
net/net_rand.h | 2 +-
net/tftp.c | 10 ++--
post/post.c | 2 +-
test/command_ut.c | 16 +++----
test/dm/eth.c | 36 +++++++--------
tools/env/fw_env.c | 2 +-
tools/env/fw_env.h | 4 +-
282 files changed, 756 insertions(+), 716 deletions(-)

diff --git a/README b/README
index 6084b8e553..dc4b17f6ac 100644
--- a/README
+++ b/README
@@ -3455,7 +3455,7 @@ but it can not erase, write this NOR flash by SRIO or PCIE interface.

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 2e620e2a0f..24be170148 100644
--- a/api/api.c
+++ b/api/api.c
@@ -458,7 +458,7 @@ static int API_env_get(va_list ap)
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 5798149046..a498ce5b29 100644
--- a/arch/arc/lib/bootm.c
+++ b/arch/arc/lib/bootm.c
@@ -85,7 +85,7 @@ static void boot_jump_linux(bootm_headers_t *images, int flag)
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);
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/soc.c b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
index 23f3809418..d33a6c636c 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/soc.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
@@ -95,7 +95,7 @@ static void erratum_a008514(void)

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 704849bd0c..5c62d9c144 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -216,7 +216,7 @@ static void do_nonsec_virt_switch(void)
/* 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
@@ -273,7 +273,7 @@ __weak bool armv7_boot_nonsec_default(void)
#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"))
@@ -361,7 +361,7 @@ static void boot_jump_linux(bootm_headers_t *images, int flag)
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");
diff --git a/arch/arm/mach-davinci/misc.c b/arch/arm/mach-davinci/misc.c
index 4441242cc7..461ff778c2 100644
--- a/arch/arm/mach-davinci/misc.c
+++ b/arch/arm/mach-davinci/misc.c
@@ -90,7 +90,7 @@ void davinci_sync_env_enetaddr(uint8_t *rom_enetaddr)
uint8_t env_enetaddr[6];
int ret;

- ret = eth_getenv_enetaddr_by_index("eth", 0, env_enetaddr);
+ ret = eth_env_get_enetaddr_by_index("eth", 0, env_enetaddr);
if (!ret) {
/*
* There is no MAC address in the environment, so we
diff --git a/arch/arm/mach-imx/video.c b/arch/arm/mach-imx/video.c
index 55242f0eaa..c670c5dfc9 100644
--- a/arch/arm/mach-imx/video.c
+++ b/arch/arm/mach-imx/video.c
@@ -10,7 +10,7 @@ int board_video_skip(void)
{
int i;
int ret;
- char const *panel = getenv("panel");
+ char const *panel = env_get("panel");

if (!panel) {
for (i = 0; i < display_count; i++) {
diff --git a/arch/arm/mach-keystone/ddr3.c b/arch/arm/mach-keystone/ddr3.c
index 4cad6a2d81..b2f5414a5c 100644
--- a/arch/arm/mach-keystone/ddr3.c
+++ b/arch/arm/mach-keystone/ddr3.c
@@ -331,7 +331,7 @@ void ddr3_check_ecc_int(u32 base)
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);

diff --git a/arch/arm/mach-keystone/keystone.c b/arch/arm/mach-keystone/keystone.c
index beb8a767c4..fcabfbd5c3 100644
--- a/arch/arm/mach-keystone/keystone.c
+++ b/arch/arm/mach-keystone/keystone.c
@@ -46,7 +46,7 @@ int misc_init_r(void)
char *env;
long ks2_debug = 0;

- env = getenv("ks2_debug");
+ env = env_get("ks2_debug");

if (env)
ks2_debug = simple_strtol(env, NULL, 0);
diff --git a/arch/arm/mach-kirkwood/cpu.c b/arch/arm/mach-kirkwood/cpu.c
index 4c9d3fde47..db2ff0311c 100644
--- a/arch/arm/mach-kirkwood/cpu.c
+++ b/arch/arm/mach-kirkwood/cpu.c
@@ -129,7 +129,7 @@ int kw_config_adr_windows(void)
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",
@@ -153,7 +153,7 @@ static void kw_sysrst_check(void)
/*
* no action if sysrstdelay environment variable is not defined
*/
- s = getenv("sysrstdelay");
+ s = env_get("sysrstdelay");
if (s == NULL)
return;

diff --git a/arch/arm/mach-omap2/utils.c b/arch/arm/mach-omap2/utils.c
index c03e93878d..0b0bf1837c 100644
--- a/arch/arm/mach-omap2/utils.c
+++ b/arch/arm/mach-omap2/utils.c
@@ -70,7 +70,7 @@ static void omap_set_fastboot_board_rev(void)
{
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");

@@ -169,7 +169,7 @@ void omap_die_id_serial(void)

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]);

@@ -182,7 +182,7 @@ void omap_die_id_get_board_serial(struct tag_serialnr *serialnr)
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);
@@ -202,7 +202,7 @@ void omap_die_id_usbethaddr(void)

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 9cd3fe2f30..b94eb424aa 100644
--- a/arch/arm/mach-tegra/tegra186/nvtboot_board.c
+++ b/arch/arm/mach-tegra/tegra186/nvtboot_board.c
@@ -35,7 +35,7 @@ static int set_ethaddr_from_nvtboot(void)
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");
diff --git a/arch/arm/mach-uniphier/board_late_init.c b/arch/arm/mach-uniphier/board_late_init.c
index e6d600e41f..b9a2cbe148 100644
--- a/arch/arm/mach-uniphier/board_late_init.c
+++ b/arch/arm/mach-uniphier/board_late_init.c
@@ -37,7 +37,7 @@ static int uniphier_set_fdt_file(void)
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 fa9c493081..c976904fa9 100644
--- a/arch/m68k/lib/bootm.c
+++ b/arch/m68k/lib/bootm.c
@@ -113,7 +113,8 @@ static void set_clocks_in_mhz (bd_t *kbd)
{
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/microblaze/lib/bootm.c b/arch/microblaze/lib/bootm.c
index 2732203b93..0a286e82c2 100644
--- a/arch/microblaze/lib/bootm.c
+++ b/arch/microblaze/lib/bootm.c
@@ -27,7 +27,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[],
{
/* 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 be877625a8..e53d0cb8d5 100644
--- a/arch/mips/lib/bootm.c
+++ b/arch/mips/lib/bootm.c
@@ -80,7 +80,7 @@ static void linux_cmdline_legacy(bootm_headers_t *images)

linux_cmdline_init();

- bootargs = getenv("bootargs");
+ bootargs = env_get("bootargs");
if (!bootargs)
return;

@@ -202,11 +202,11 @@ static void linux_env_legacy(bootm_headers_t *images)
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 21aadf284f..e834329e0b 100644
--- a/arch/nds32/lib/bootm.c
+++ b/arch/nds32/lib/bootm.c
@@ -50,7 +50,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
void (*theKernel)(int zero, int arch, uint params);

#ifdef CONFIG_CMDLINE_TAG
- char *commandline = getenv("bootargs");
+ char *commandline = env_get("bootargs");
#endif

/*
@@ -64,7 +64,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)

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 4e5c269193..00ade2c573 100644
--- a/arch/nios2/lib/bootm.c
+++ b/arch/nios2/lib/bootm.c
@@ -12,7 +12,7 @@
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;
diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init.c b/arch/powerpc/cpu/mpc85xx/cpu_init.c
index 52a33ec53f..2a5699152f 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu_init.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu_init.c
@@ -256,7 +256,7 @@ static void enable_tdm_law(void)
* 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 */
@@ -280,7 +280,7 @@ void enable_cpc(void)
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
@@ -754,7 +754,7 @@ int cpu_init_r(void)
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;

@@ -794,7 +794,7 @@ int cpu_init_r(void)
#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
@@ -845,7 +845,7 @@ int cpu_init_r(void)
#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);
diff --git a/arch/powerpc/cpu/mpc85xx/fdt.c b/arch/powerpc/cpu/mpc85xx/fdt.c
index a9ea947305..599839d0ff 100644
--- a/arch/powerpc/cpu/mpc85xx/fdt.c
+++ b/arch/powerpc/cpu/mpc85xx/fdt.c
@@ -92,7 +92,7 @@ void ft_fixup_cpu(void *blob, u64 memory_limit)
* 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);

@@ -580,7 +580,7 @@ static void fdt_fixup_l2_switch(void *blob)
return;

/* Get MAC address for the l2switch from "l2switchaddr"*/
- if (!eth_getenv_enetaddr("l2switchaddr", l2swaddr)) {
+ if (!eth_env_get_enetaddr("l2switchaddr", l2swaddr)) {
printf("Warning: MAC address for l2switch not found\n");
memset(l2swaddr, 0, sizeof(l2swaddr));
}
diff --git a/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c b/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c
index 1bc0c64cfc..79d6544a09 100644
--- a/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c
+++ b/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c
@@ -514,7 +514,7 @@ void fsl_serdes_init(void)
* 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))
diff --git a/arch/powerpc/cpu/mpc85xx/mp.c b/arch/powerpc/cpu/mpc85xx/mp.c
index 0addf8493c..2ea9f5c7be 100644
--- a/arch/powerpc/cpu/mpc85xx/mp.c
+++ b/arch/powerpc/cpu/mpc85xx/mp.c
@@ -31,7 +31,7 @@ u32 get_my_id()
int hold_cores_in_reset(int verbose)
{
/* Default to no, overridden by 'y', 'yes', 'Y', 'Yes', or '1' */
- if (getenv_yesno("mp_holdoff") == 1) {
+ if (env_get_yesno("mp_holdoff") == 1) {
if (verbose) {
puts("Secondary cores are being held in reset.\n");
puts("See 'mp_holdoff' environment variable\n");
diff --git a/arch/powerpc/lib/bootm.c b/arch/powerpc/lib/bootm.c
index 42a6afbc31..93754c4363 100644
--- a/arch/powerpc/lib/bootm.c
+++ b/arch/powerpc/lib/bootm.c
@@ -84,7 +84,7 @@ static void boot_jump_linux(bootm_headers_t *images)
debug (" Booting using OF flat tree...\n");
WATCHDOG_RESET ();
(*kernel) ((bd_t *)of_flat_tree, 0, 0, EPAPR_MAGIC,
- getenv_bootm_mapsize(), 0, 0);
+ env_get_bootm_mapsize(), 0, 0);
/* does not return */
} else
#endif
@@ -119,8 +119,8 @@ void arch_lmb_reserve(struct lmb *lmb)
phys_size_t bootm_size;
ulong size, sp, bootmap_base;

- bootmap_base = getenv_bootm_low();
- bootm_size = getenv_bootm_size();
+ bootmap_base = env_get_bootm_low();
+ bootm_size = env_get_bootm_size();

#ifdef DEBUG
if (((u64)bootmap_base + bootm_size) >
@@ -273,7 +273,8 @@ static void set_clocks_in_mhz (bd_t *kbd)
{
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;
@@ -337,6 +338,6 @@ void boot_jump_vxworks(bootm_headers_t *images)

((void (*)(void *, ulong, ulong, ulong,
ulong, ulong, ulong))images->ep)(images->ft_addr,
- 0, 0, EPAPR_MAGIC, getenv_bootm_mapsize(), 0, 0);
+ 0, 0, EPAPR_MAGIC, env_get_bootm_mapsize(), 0, 0);
}
#endif
diff --git a/arch/sh/lib/bootm.c b/arch/sh/lib/bootm.c
index 8a0010be23..09fbd5e5df 100644
--- a/arch/sh/lib/bootm.c
+++ b/arch/sh/lib/bootm.c
@@ -61,7 +61,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima
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
diff --git a/arch/sh/lib/zimageboot.c b/arch/sh/lib/zimageboot.c
index 3fea5f5b53..cd4abba10a 100644
--- a/arch/sh/lib/zimageboot.c
+++ b/arch/sh/lib/zimageboot.c
@@ -42,7 +42,7 @@ int do_sh_zimageboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])

/* 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 aafbeb01f9..00172dc7c1 100644
--- a/arch/x86/lib/zimage.c
+++ b/arch/x86/lib/zimage.c
@@ -48,15 +48,15 @@ static void build_command_line(char *command_line, int auto_boot)

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"));
}
}

@@ -285,7 +285,7 @@ int do_zboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
/* argv[1] holds the address of the bzImage */
s = argv[1];
} else {
- s = getenv("fileaddr");
+ s = env_get("fileaddr");
}

if (s)
diff --git a/arch/xtensa/lib/bootm.c b/arch/xtensa/lib/bootm.c
index 1604bb9536..16961acba5 100644
--- a/arch/xtensa/lib/bootm.c
+++ b/arch/xtensa/lib/bootm.c
@@ -136,7 +136,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
{
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;
diff --git a/board/Arcturus/ucp1020/cmd_arc.c b/board/Arcturus/ucp1020/cmd_arc.c
index c32f7df454..0d3ac88fff 100644
--- a/board/Arcturus/ucp1020/cmd_arc.c
+++ b/board/Arcturus/ucp1020/cmd_arc.c
@@ -149,7 +149,7 @@ int get_arc_info(void)
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]);
@@ -169,7 +169,7 @@ int get_arc_info(void)
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]);
@@ -188,7 +188,7 @@ int get_arc_info(void)
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]);
diff --git a/board/Arcturus/ucp1020/ucp1020.c b/board/Arcturus/ucp1020/ucp1020.c
index 2cc2e54d5b..3f786a2014 100644
--- a/board/Arcturus/ucp1020/ucp1020.c
+++ b/board/Arcturus/ucp1020/ucp1020.c
@@ -64,7 +64,7 @@ void board_gpio_init(void)

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]);
@@ -82,7 +82,7 @@ void board_gpio_init(void)
}
}

- val = getenv("PCIE_OFF");
+ val = env_get("PCIE_OFF");
if (val) {
gpio_direction_input(GPIO_PCIE1_EN);
gpio_direction_input(GPIO_PCIE2_EN);
@@ -91,7 +91,7 @@ void board_gpio_init(void)
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);

@@ -214,7 +214,7 @@ int last_stage_init(void)
else
printf("NCT72(0x%x): ready\n", id2);

- kval = getenv("kernelargs");
+ kval = env_get("kernelargs");

mmc = find_mmc_device(0);
if (mmc)
@@ -238,7 +238,7 @@ int last_stage_init(void)
get_arc_info();

if (kval) {
- sval = getenv("SERIAL");
+ sval = env_get("SERIAL");
if (sval) {
strcpy(newkernelargs, "SN=");
strcat(newkernelargs, sval);
@@ -307,8 +307,8 @@ int ft_board_setup(void *blob, bd_t *bd)

ft_cpu_setup(blob, bd);

- base = getenv_bootm_low();
- size = getenv_bootm_size();
+ base = env_get_bootm_low();
+ size = env_get_bootm_size();

fdt_fixup_memory(blob, (u64)base, (u64)size);

diff --git a/board/Barix/ipam390/ipam390.c b/board/Barix/ipam390/ipam390.c
index 3a584021ac..d203429738 100644
--- a/board/Barix/ipam390/ipam390.c
+++ b/board/Barix/ipam390/ipam390.c
@@ -157,7 +157,7 @@ u32 get_board_rev(void)
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);

diff --git a/board/BuR/brxre1/board.c b/board/BuR/brxre1/board.c
index cdbc93a8ec..ca08f3cd90 100644
--- a/board/BuR/brxre1/board.c
+++ b/board/BuR/brxre1/board.c
@@ -282,9 +282,9 @@ int board_late_init(void)
snprintf(othbootargs, sizeof(othbootargs),
"u=vxWorksFTP pw=vxWorks o=0x%08x;0x%08x;0x%08x;0x%08x",
(unsigned int) gd->fb_base-0x20,
- (u32)getenv_ulong("vx_memtop", 16, gd->fb_base-0x20),
- (u32)getenv_ulong("vx_romfsbase", 16, 0),
- (u32)getenv_ulong("vx_romfssize", 16, 0));
+ (u32)env_get_ulong("vx_memtop", 16, gd->fb_base-0x20),
+ (u32)env_get_ulong("vx_romfsbase", 16, 0),
+ (u32)env_get_ulong("vx_romfssize", 16, 0));
env_set("othbootargs", othbootargs);
/*
* reset VBAR registers to its reset location, VxWorks 6.9.3.2 does
diff --git a/board/BuR/common/common.c b/board/BuR/common/common.c
index eb34de931e..c1cd010023 100644
--- a/board/BuR/common/common.c
+++ b/board/BuR/common/common.c
@@ -58,9 +58,9 @@ void lcdbacklight(int on)
unsigned int bright = FDTPROP(PATHINF, "brightdef");
unsigned int pwmfrq = FDTPROP(PATHINF, "brightfdim");
#else
- unsigned int driver = getenv_ulong("ds1_bright_drv", 16, 0UL);
- unsigned int bright = getenv_ulong("ds1_bright_def", 10, 50);
- unsigned int pwmfrq = getenv_ulong("ds1_pwmfreq", 10, ~0UL);
+ unsigned int driver = env_get_ulong("ds1_bright_drv", 16, 0UL);
+ unsigned int bright = env_get_ulong("ds1_bright_def", 10, 50);
+ unsigned int pwmfrq = env_get_ulong("ds1_pwmfreq", 10, ~0UL);
#endif
unsigned int tmp;
struct gptimer *timerhw;
@@ -186,20 +186,20 @@ int load_lcdtiming(struct am335x_lcdpanel *panel)
snprintf(buf, sizeof(buf), "fbcon=rotate:%d", panel_info.vl_rot);
env_set("optargs_rot", buf);
#else
- pnltmp.hactive = getenv_ulong("ds1_hactive", 10, ~0UL);
- pnltmp.vactive = getenv_ulong("ds1_vactive", 10, ~0UL);
- pnltmp.bpp = getenv_ulong("ds1_bpp", 10, ~0UL);
- pnltmp.hfp = getenv_ulong("ds1_hfp", 10, ~0UL);
- pnltmp.hbp = getenv_ulong("ds1_hbp", 10, ~0UL);
- pnltmp.hsw = getenv_ulong("ds1_hsw", 10, ~0UL);
- pnltmp.vfp = getenv_ulong("ds1_vfp", 10, ~0UL);
- pnltmp.vbp = getenv_ulong("ds1_vbp", 10, ~0UL);
- pnltmp.vsw = getenv_ulong("ds1_vsw", 10, ~0UL);
- pnltmp.pxl_clk_div = getenv_ulong("ds1_pxlclkdiv", 10, ~0UL);
- pnltmp.pol = getenv_ulong("ds1_pol", 16, ~0UL);
- pnltmp.pup_delay = getenv_ulong("ds1_pupdelay", 10, ~0UL);
- pnltmp.pon_delay = getenv_ulong("ds1_tondelay", 10, ~0UL);
- panel_info.vl_rot = getenv_ulong("ds1_rotation", 10, 0);
+ pnltmp.hactive = env_get_ulong("ds1_hactive", 10, ~0UL);
+ pnltmp.vactive = env_get_ulong("ds1_vactive", 10, ~0UL);
+ pnltmp.bpp = env_get_ulong("ds1_bpp", 10, ~0UL);
+ pnltmp.hfp = env_get_ulong("ds1_hfp", 10, ~0UL);
+ pnltmp.hbp = env_get_ulong("ds1_hbp", 10, ~0UL);
+ pnltmp.hsw = env_get_ulong("ds1_hsw", 10, ~0UL);
+ pnltmp.vfp = env_get_ulong("ds1_vfp", 10, ~0UL);
+ pnltmp.vbp = env_get_ulong("ds1_vbp", 10, ~0UL);
+ pnltmp.vsw = env_get_ulong("ds1_vsw", 10, ~0UL);
+ pnltmp.pxl_clk_div = env_get_ulong("ds1_pxlclkdiv", 10, ~0UL);
+ pnltmp.pol = env_get_ulong("ds1_pol", 16, ~0UL);
+ pnltmp.pup_delay = env_get_ulong("ds1_pupdelay", 10, ~0UL);
+ pnltmp.pon_delay = env_get_ulong("ds1_tondelay", 10, ~0UL);
+ panel_info.vl_rot = env_get_ulong("ds1_rotation", 10, 0);
#endif
if (
~0UL == (pnltmp.hactive) ||
@@ -251,7 +251,7 @@ static int load_devicetree(void)
{
int rc;
loff_t dtbsize;
- u32 dtbaddr = getenv_ulong("dtbaddr", 16, 0UL);
+ u32 dtbaddr = env_get_ulong("dtbaddr", 16, 0UL);

if (dtbaddr == 0) {
printf("%s: don't have a valid <dtbaddr> in env!\n", __func__);
@@ -263,9 +263,9 @@ static int load_devicetree(void)
(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;
@@ -375,7 +375,7 @@ int ft_board_setup(void *blob, bd_t *bd)
* if no simplefb is requested through environment, we don't set up
* one, instead we turn off backlight.
*/
- if (getenv_ulong("simplefb", 10, 0) == 0) {
+ if (env_get_ulong("simplefb", 10, 0) == 0) {
lcdbacklight(0);
return 0;
}
@@ -405,11 +405,11 @@ static void br_summaryscreen_printenv(char *prefix,
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 {
@@ -447,7 +447,7 @@ void lcdpower(int on)
}
pin = FDTPROP(PATHINF, "pwrpin");
#else
- pin = getenv_ulong("ds1_pwr", 16, ~0UL);
+ pin = env_get_ulong("ds1_pwr", 16, ~0UL);
#endif
if (pin == ~0UL) {
puts("no pwrpin in dtb/env, cannot powerup display!\n");
@@ -657,7 +657,7 @@ int board_eth_init(bd_t *bis)
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);
diff --git a/board/BuS/eb_cpu5282/eb_cpu5282.c b/board/BuS/eb_cpu5282/eb_cpu5282.c
index a00a83a4a5..d23b9f3a4f 100644
--- a/board/BuS/eb_cpu5282/eb_cpu5282.c
+++ b/board/BuS/eb_cpu5282/eb_cpu5282.c
@@ -139,7 +139,7 @@ void hw_watchdog_init(void)
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;
@@ -191,13 +191,13 @@ int drv_video_init(void)
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
@@ -211,7 +211,7 @@ int drv_video_init(void)
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();
diff --git a/board/CarMediaLab/flea3/flea3.c b/board/CarMediaLab/flea3/flea3.c
index 3cd4dc95fe..5e75eb0b64 100644
--- a/board/CarMediaLab/flea3/flea3.c
+++ b/board/CarMediaLab/flea3/flea3.c
@@ -211,7 +211,7 @@ int ft_board_setup(void *blob, bd_t *bd)
{ "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;
}
diff --git a/board/LaCie/net2big_v2/net2big_v2.c b/board/LaCie/net2big_v2/net2big_v2.c
index 416af469fa..f639a37d4d 100644
--- a/board/LaCie/net2big_v2/net2big_v2.c
+++ b/board/LaCie/net2big_v2/net2big_v2.c
@@ -221,7 +221,7 @@ int misc_init_r(void)
{
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);
diff --git a/board/LaCie/netspace_v2/netspace_v2.c b/board/LaCie/netspace_v2/netspace_v2.c
index fa07288d6e..52f36644a3 100644
--- a/board/LaCie/netspace_v2/netspace_v2.c
+++ b/board/LaCie/netspace_v2/netspace_v2.c
@@ -83,7 +83,7 @@ int board_init(void)
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 2d8be1804a..eead98b24e 100644
--- a/board/amazon/kc1/kc1.c
+++ b/board/amazon/kc1/kc1.c
@@ -118,7 +118,7 @@ int misc_init_r(void)
}

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);
}

diff --git a/board/amlogic/odroid-c2/odroid-c2.c b/board/amlogic/odroid-c2/odroid-c2.c
index ca9c13bcc1..eac04d8178 100644
--- a/board/amlogic/odroid-c2/odroid-c2.c
+++ b/board/amlogic/odroid-c2/odroid-c2.c
@@ -44,14 +44,14 @@ int misc_init_r(void)
mdelay(10);
setbits_le32(GXBB_GPIO_OUT(3), BIT(14));

- if (!eth_getenv_enetaddr("ethaddr", mac_addr)) {
+ if (!eth_env_get_enetaddr("ethaddr", mac_addr)) {
len = meson_sm_read_efuse(EFUSE_MAC_OFFSET,
mac_addr, EFUSE_MAC_SIZE);
if (len == EFUSE_MAC_SIZE && is_valid_ethaddr(mac_addr))
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)
diff --git a/board/aristainetos/aristainetos-v2.c b/board/aristainetos/aristainetos-v2.c
index bdf41b99c8..698715ca20 100644
--- a/board/aristainetos/aristainetos-v2.c
+++ b/board/aristainetos/aristainetos-v2.c
@@ -651,7 +651,7 @@ int board_late_init(void)
{
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,
@@ -668,7 +668,7 @@ int board_late_init(void)
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 4a06cda6f4..3f0860c555 100644
--- a/board/atmel/sama5d2_xplained/sama5d2_xplained.c
+++ b/board/atmel/sama5d2_xplained/sama5d2_xplained.c
@@ -169,7 +169,7 @@ static int set_ethaddr_from_eeprom(void)
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)) {
diff --git a/board/birdland/bav335x/board.c b/board/birdland/bav335x/board.c
index a9d9ce6fa5..f284568ec9 100644
--- a/board/birdland/bav335x/board.c
+++ b/board/birdland/bav335x/board.c
@@ -163,7 +163,7 @@ int spl_start_uboot(void)
#ifdef CONFIG_SPL_ENV_SUPPORT
env_init();
env_load();
- if (getenv_yesno("boot_os") != 1)
+ if (env_get_yesno("boot_os") != 1)
return 1;
#endif

@@ -392,7 +392,7 @@ int board_eth_init(bd_t *bis)
#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/bluegiga/apx4devkit/apx4devkit.c b/board/bluegiga/apx4devkit/apx4devkit.c
index 2215c29c9c..25e5c3d80c 100644
--- a/board/bluegiga/apx4devkit/apx4devkit.c
+++ b/board/bluegiga/apx4devkit/apx4devkit.c
@@ -133,8 +133,8 @@ void get_board_serial(struct tag_serialnr *serialnr)
#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
diff --git a/board/bluewater/gurnard/gurnard.c b/board/bluewater/gurnard/gurnard.c
index e82c691841..8733a9af16 100644
--- a/board/bluewater/gurnard/gurnard.c
+++ b/board/bluewater/gurnard/gurnard.c
@@ -341,7 +341,7 @@ int board_init(void)
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;

@@ -368,7 +368,7 @@ int board_late_init(void)
* 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 */
@@ -385,7 +385,7 @@ int board_late_init(void)
&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");
diff --git a/board/bosch/shc/board.c b/board/bosch/shc/board.c
index b4c6a0b45d..999ed95c31 100644
--- a/board/bosch/shc/board.c
+++ b/board/bosch/shc/board.c
@@ -545,7 +545,7 @@ int board_eth_init(bd_t *bis)

#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/boundary/nitrogen6x/nitrogen6x.c b/board/boundary/nitrogen6x/nitrogen6x.c
index 0e2c4fc0ef..3b92b64f6a 100644
--- a/board/boundary/nitrogen6x/nitrogen6x.c
+++ b/board/boundary/nitrogen6x/nitrogen6x.c
@@ -749,7 +749,7 @@ size_t display_count = ARRAY_SIZE(displays);

int board_cfb_skip(void)
{
- return NULL != getenv("novideo");
+ return NULL != env_get("novideo");
}

static void setup_display(void)
@@ -974,7 +974,7 @@ static void preboot_keys(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
@@ -983,7 +983,7 @@ static void preboot_keys(void)
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;
@@ -993,7 +993,7 @@ static void preboot_keys(void)
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 5f4c634362..0267582186 100644
--- a/board/broadcom/bcm23550_w1d/bcm23550_w1d.c
+++ b/board/broadcom/bcm23550_w1d/bcm23550_w1d.c
@@ -103,7 +103,7 @@ int board_usb_init(int index, enum usb_init_type init)
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;
}
diff --git a/board/broadcom/bcm28155_ap/bcm28155_ap.c b/board/broadcom/bcm28155_ap/bcm28155_ap.c
index f5b94f6430..8f48ccbf1c 100644
--- a/board/broadcom/bcm28155_ap/bcm28155_ap.c
+++ b/board/broadcom/bcm28155_ap/bcm28155_ap.c
@@ -110,7 +110,7 @@ int board_usb_init(int index, enum usb_init_type init)
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;
}
diff --git a/board/buffalo/lsxl/lsxl.c b/board/buffalo/lsxl/lsxl.c
index 5b31e056ba..2d01ac25d8 100644
--- a/board/buffalo/lsxl/lsxl.c
+++ b/board/buffalo/lsxl/lsxl.c
@@ -203,7 +203,7 @@ void check_enetaddr(void)
{
uchar enetaddr[6];

- if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
+ if (!eth_env_get_enetaddr("ethaddr", enetaddr)) {
/* signal unset/invalid ethaddr to user */
set_led(LED_INFO_BLINKING);
}
diff --git a/board/cadence/xtfpga/xtfpga.c b/board/cadence/xtfpga/xtfpga.c
index 83244c3ad4..f81fa95c18 100644
--- a/board/cadence/xtfpga/xtfpga.c
+++ b/board/cadence/xtfpga/xtfpga.c
@@ -86,7 +86,7 @@ int misc_init_r(void)
* 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);
diff --git a/board/compulab/cl-som-am57x/eth.c b/board/compulab/cl-som-am57x/eth.c
index d2992d3a63..b615fb9e7e 100644
--- a/board/compulab/cl-som-am57x/eth.c
+++ b/board/compulab/cl-som-am57x/eth.c
@@ -95,7 +95,7 @@ static int cl_som_am57x_handle_mac_address(char *env_name, uint port_num)
int ret;
uint8_t enetaddr[6];

- ret = eth_getenv_enetaddr(env_name, enetaddr);
+ ret = eth_env_get_enetaddr(env_name, enetaddr);
if (ret)
return 0;

@@ -181,7 +181,7 @@ int board_eth_init(bd_t *bis)
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);

diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c
index 2368226546..a1da2780aa 100644
--- a/board/compulab/cm_fx6/cm_fx6.c
+++ b/board/compulab/cm_fx6/cm_fx6.c
@@ -114,10 +114,10 @@ int board_video_skip(void)
{
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;
@@ -470,7 +470,7 @@ static int handle_mac_address(char *env_var, uint eeprom_bus)
unsigned char enetaddr[6];
int rc;

- rc = eth_getenv_enetaddr(env_var, enetaddr);
+ rc = eth_env_get_enetaddr(env_var, enetaddr);
if (rc)
return 0;

@@ -605,13 +605,13 @@ int ft_board_setup(void *blob, bd_t *bd)
fdt_shrink_to_minimum(blob, 0); /* Make room for new properties */

/* MAC addr */
- if (eth_getenv_enetaddr("ethaddr", enetaddr)) {
+ if (eth_env_get_enetaddr("ethaddr", enetaddr)) {
fdt_find_and_setprop(blob,
"/soc/aips-bus at 02100000/ethernet at 02188000",
"local-mac-address", enetaddr, 6, 1);
}

- if (eth_getenv_enetaddr("eth1addr", enetaddr)) {
+ if (eth_env_get_enetaddr("eth1addr", enetaddr)) {
fdt_find_and_setprop(blob, "/eth at pcie", "local-mac-address",
enetaddr, 6, 1);
}
diff --git a/board/compulab/cm_t335/cm_t335.c b/board/compulab/cm_t335/cm_t335.c
index f6030ddf29..6f6ba49af5 100644
--- a/board/compulab/cm_t335/cm_t335.c
+++ b/board/compulab/cm_t335/cm_t335.c
@@ -106,7 +106,7 @@ static int handle_mac_address(void)
uchar enetaddr[6];
int rv;

- rv = eth_getenv_enetaddr("ethaddr", enetaddr);
+ rv = eth_env_get_enetaddr("ethaddr", enetaddr);
if (rv)
return 0;

diff --git a/board/compulab/cm_t35/cm_t35.c b/board/compulab/cm_t35/cm_t35.c
index a8696aea83..1e37e392ec 100644
--- a/board/compulab/cm_t35/cm_t35.c
+++ b/board/compulab/cm_t35/cm_t35.c
@@ -434,7 +434,7 @@ static int handle_mac_address(void)
unsigned char enetaddr[6];
int rc;

- rc = eth_getenv_enetaddr("ethaddr", enetaddr);
+ rc = eth_env_get_enetaddr("ethaddr", enetaddr);
if (rc)
return 0;

diff --git a/board/compulab/cm_t3517/cm_t3517.c b/board/compulab/cm_t3517/cm_t3517.c
index 0568234f66..0ff49dcdcc 100644
--- a/board/compulab/cm_t3517/cm_t3517.c
+++ b/board/compulab/cm_t3517/cm_t3517.c
@@ -168,7 +168,7 @@ static int cm_t3517_handle_mac_address(void)
unsigned char enetaddr[6];
int ret;

- ret = eth_getenv_enetaddr("ethaddr", enetaddr);
+ ret = eth_env_get_enetaddr("ethaddr", enetaddr);
if (ret)
return 0;

diff --git a/board/compulab/cm_t54/cm_t54.c b/board/compulab/cm_t54/cm_t54.c
index 582512dbe4..31730a4d1c 100644
--- a/board/compulab/cm_t54/cm_t54.c
+++ b/board/compulab/cm_t54/cm_t54.c
@@ -126,7 +126,7 @@ int ft_board_setup(void *blob, bd_t *bd)
uint8_t enetaddr[6];

/* MAC addr */
- if (eth_getenv_enetaddr("usbethaddr", enetaddr)) {
+ if (eth_env_get_enetaddr("usbethaddr", enetaddr)) {
fdt_find_and_setprop(blob, "/smsc95xx at 0", "mac-address",
enetaddr, 6, 1);
}
@@ -161,7 +161,7 @@ static int handle_mac_address(void)
uint8_t enetaddr[6];
int ret;

- ret = eth_getenv_enetaddr("usbethaddr", enetaddr);
+ ret = eth_env_get_enetaddr("usbethaddr", enetaddr);
if (ret)
return 0;

diff --git a/board/compulab/common/omap3_display.c b/board/compulab/common/omap3_display.c
index 61707f5b90..ed2077e361 100644
--- a/board/compulab/common/omap3_display.c
+++ b/board/compulab/common/omap3_display.c
@@ -400,7 +400,7 @@ void lcd_ctrl_init(void *lcdbase)
{
struct prcm *prcm = (struct prcm *)PRCM_BASE;
char *custom_lcd;
- char *displaytype = getenv("displaytype");
+ char *displaytype = env_get("displaytype");

if (displaytype == NULL)
return;
@@ -408,7 +408,7 @@ void lcd_ctrl_init(void *lcdbase)
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;
}
diff --git a/board/congatec/cgtqmx6eval/cgtqmx6eval.c b/board/congatec/cgtqmx6eval/cgtqmx6eval.c
index ac66248b3f..8cd0090887 100644
--- a/board/congatec/cgtqmx6eval/cgtqmx6eval.c
+++ b/board/congatec/cgtqmx6eval/cgtqmx6eval.c
@@ -235,7 +235,7 @@ int power_init_board(void)
return 0;

/* set level of MIPI if specified */
- lv_mipi = getenv("lv_mipi");
+ lv_mipi = env_get("lv_mipi");
if (lv_mipi)
return 0;

@@ -583,7 +583,7 @@ int board_video_skip(void)
{
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;
diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c
index 8cab357a92..c2d2e8e882 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -131,7 +131,7 @@ int misc_init_r(void)
uchar env_enetaddr[6];
int enetaddr_found;

- enetaddr_found = eth_getenv_enetaddr("ethaddr", env_enetaddr);
+ enetaddr_found = eth_env_get_enetaddr("ethaddr", env_enetaddr);

#ifdef CONFIG_MAC_ADDR_IN_SPIFLASH
int spi_mac_read;
@@ -292,7 +292,7 @@ u32 get_board_rev(void)
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);

diff --git a/board/davinci/da8xxevm/omapl138_lcdk.c b/board/davinci/da8xxevm/omapl138_lcdk.c
index 29296b0478..565020760d 100644
--- a/board/davinci/da8xxevm/omapl138_lcdk.c
+++ b/board/davinci/da8xxevm/omapl138_lcdk.c
@@ -293,7 +293,7 @@ static void dspwake(void)
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 */
@@ -323,7 +323,7 @@ int misc_init_r(void)
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 */
diff --git a/board/esd/meesc/meesc.c b/board/esd/meesc/meesc.c
index e4bda7909a..7cc3fdd2f2 100644
--- a/board/esd/meesc/meesc.c
+++ b/board/esd/meesc/meesc.c
@@ -181,7 +181,7 @@ int checkboard(void)
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);
}
@@ -198,7 +198,7 @@ void get_board_serial(struct tag_serialnr *serialnr)
{
char *str;

- char *serial = getenv("serial#");
+ char *serial = env_get("serial#");
if (serial) {
str = strchr(serial, '_');
if (str && (strlen(str) >= 4)) {
@@ -231,7 +231,8 @@ int misc_init_r(void)
* 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);
diff --git a/board/freescale/b4860qds/b4860qds.c b/board/freescale/b4860qds/b4860qds.c
index 83a70153e8..5d872fdfd9 100644
--- a/board/freescale/b4860qds/b4860qds.c
+++ b/board/freescale/b4860qds/b4860qds.c
@@ -195,7 +195,7 @@ static int adjust_vdd(ulong vdd_override)
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;
@@ -542,7 +542,7 @@ int configure_vsc3316_3308(void)
* 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",
@@ -1197,8 +1197,8 @@ int ft_board_setup(void *blob, bd_t *bd)

ft_cpu_setup(blob, bd);

- base = getenv_bootm_low();
- size = getenv_bootm_size();
+ base = env_get_bootm_low();
+ size = env_get_bootm_size();

fdt_fixup_memory(blob, (u64)base, (u64)size);

diff --git a/board/freescale/bsc9131rdb/bsc9131rdb.c b/board/freescale/bsc9131rdb/bsc9131rdb.c
index fb8bb39d87..c642e88a09 100644
--- a/board/freescale/bsc9131rdb/bsc9131rdb.c
+++ b/board/freescale/bsc9131rdb/bsc9131rdb.c
@@ -65,8 +65,8 @@ int ft_board_setup(void *blob, bd_t *bd)

ft_cpu_setup(blob, bd);

- base = getenv_bootm_low();
- size = getenv_bootm_size();
+ base = env_get_bootm_low();
+ size = env_get_bootm_size();

fdt_fixup_memory(blob, (u64)base, (u64)size);
#ifdef CONFIG_FDT_FIXUP_PARTITIONS
diff --git a/board/freescale/bsc9132qds/bsc9132qds.c b/board/freescale/bsc9132qds/bsc9132qds.c
index a7772c4bf4..ed0b453e54 100644
--- a/board/freescale/bsc9132qds/bsc9132qds.c
+++ b/board/freescale/bsc9132qds/bsc9132qds.c
@@ -370,8 +370,8 @@ int ft_board_setup(void *blob, bd_t *bd)

ft_cpu_setup(blob, bd);

- base = getenv_bootm_low();
- size = getenv_bootm_size();
+ base = env_get_bootm_low();
+ size = env_get_bootm_size();

#if defined(CONFIG_PCI)
FT_FSL_PCI_SETUP;
diff --git a/board/freescale/c29xpcie/c29xpcie.c b/board/freescale/c29xpcie/c29xpcie.c
index 45f463f01f..23901a4f96 100644
--- a/board/freescale/c29xpcie/c29xpcie.c
+++ b/board/freescale/c29xpcie/c29xpcie.c
@@ -138,8 +138,8 @@ int ft_board_setup(void *blob, bd_t *bd)

ft_cpu_setup(blob, bd);

- base = getenv_bootm_low();
- size = getenv_bootm_size();
+ base = env_get_bootm_low();
+ size = env_get_bootm_size();

#if defined(CONFIG_PCI)
FT_FSL_PCI_SETUP;
diff --git a/board/freescale/common/sys_eeprom.c b/board/freescale/common/sys_eeprom.c
index c593cff5e7..152ad84672 100644
--- a/board/freescale/common/sys_eeprom.c
+++ b/board/freescale/common/sys_eeprom.c
@@ -478,7 +478,7 @@ int mac_read_from_eeprom(void)
/* 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);
}
}
diff --git a/board/freescale/common/vid.c b/board/freescale/common/vid.c
index 9b65c13b1a..d6d1bfc861 100644
--- a/board/freescale/common/vid.c
+++ b/board/freescale/common/vid.c
@@ -376,7 +376,7 @@ int adjust_vdd(ulong vdd_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;
@@ -560,7 +560,7 @@ int adjust_vdd(ulong vdd_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;
diff --git a/board/freescale/corenet_ds/corenet_ds.c b/board/freescale/corenet_ds/corenet_ds.c
index 93e1258295..132650c938 100644
--- a/board/freescale/corenet_ds/corenet_ds.c
+++ b/board/freescale/corenet_ds/corenet_ds.c
@@ -191,8 +191,8 @@ int ft_board_setup(void *blob, bd_t *bd)

ft_cpu_setup(blob, bd);

- base = getenv_bootm_low();
- size = getenv_bootm_size();
+ base = env_get_bootm_low();
+ size = env_get_bootm_size();

fdt_fixup_memory(blob, (u64)base, (u64)size);

diff --git a/board/freescale/ls2080aqds/eth.c b/board/freescale/ls2080aqds/eth.c
index defcac5263..aca29bc361 100644
--- a/board/freescale/ls2080aqds/eth.c
+++ b/board/freescale/ls2080aqds/eth.c
@@ -449,7 +449,7 @@ static void initialize_dpmac_to_slot(void)
>> FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_SHIFT;

char *env_hwconfig;
- env_hwconfig = getenv("hwconfig");
+ env_hwconfig = env_get("hwconfig");

switch (serdes1_prtcl) {
case 0x07:
@@ -603,7 +603,7 @@ void ls2080a_handle_phy_interface_sgmii(int dpmac_id)
>> 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];
@@ -849,7 +849,7 @@ int board_eth_init(bd_t *bis)
unsigned int i;
char *env_hwconfig;

- env_hwconfig = getenv("hwconfig");
+ env_hwconfig = env_get("hwconfig");

initialize_dpmac_to_slot();

diff --git a/board/freescale/ls2080aqds/ls2080aqds.c b/board/freescale/ls2080aqds/ls2080aqds.c
index f36fb9810b..83773d0af5 100644
--- a/board/freescale/ls2080aqds/ls2080aqds.c
+++ b/board/freescale/ls2080aqds/ls2080aqds.c
@@ -204,7 +204,7 @@ int board_init(void)

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)))
diff --git a/board/freescale/ls2080ardb/ls2080ardb.c b/board/freescale/ls2080ardb/ls2080ardb.c
index df2d768718..ed1fbb23fe 100644
--- a/board/freescale/ls2080ardb/ls2080ardb.c
+++ b/board/freescale/ls2080ardb/ls2080ardb.c
@@ -215,7 +215,7 @@ int board_init(void)

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)))
diff --git a/board/freescale/mpc837xemds/pci.c b/board/freescale/mpc837xemds/pci.c
index 39c40e5cc9..e5d3dfd454 100644
--- a/board/freescale/mpc837xemds/pci.c
+++ b/board/freescale/mpc837xemds/pci.c
@@ -67,7 +67,7 @@ static struct pci_region pcie_regions_1[] = {

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;
diff --git a/board/freescale/mpc837xerdb/mpc837xerdb.c b/board/freescale/mpc837xerdb/mpc837xerdb.c
index 319f0479e2..9a0ab7f2ad 100644
--- a/board/freescale/mpc837xerdb/mpc837xerdb.c
+++ b/board/freescale/mpc837xerdb/mpc837xerdb.c
@@ -173,7 +173,7 @@ int board_mmc_init(bd_t *bd)
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)
diff --git a/board/freescale/mpc8572ds/mpc8572ds.c b/board/freescale/mpc8572ds/mpc8572ds.c
index ed6836a930..93d54f5c4a 100644
--- a/board/freescale/mpc8572ds/mpc8572ds.c
+++ b/board/freescale/mpc8572ds/mpc8572ds.c
@@ -239,8 +239,8 @@ int ft_board_setup(void *blob, bd_t *bd)

ft_cpu_setup(blob, bd);

- base = getenv_bootm_low();
- size = getenv_bootm_size();
+ base = env_get_bootm_low();
+ size = env_get_bootm_size();

fdt_fixup_memory(blob, (u64)base, (u64)size);

diff --git a/board/freescale/mx51evk/mx51evk_video.c b/board/freescale/mx51evk/mx51evk_video.c
index 86ec7508db..cc2c855b88 100644
--- a/board/freescale/mx51evk/mx51evk_video.c
+++ b/board/freescale/mx51evk/mx51evk_video.c
@@ -76,7 +76,7 @@ void setup_iomux_lcd(void)
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) {
diff --git a/board/freescale/mx53loco/mx53loco_video.c b/board/freescale/mx53loco/mx53loco_video.c
index bc5e8a9d3e..5fb0f04387 100644
--- a/board/freescale/mx53loco/mx53loco_video.c
+++ b/board/freescale/mx53loco/mx53loco_video.c
@@ -92,7 +92,7 @@ void setup_iomux_lcd(void)
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/p1010rdb/p1010rdb.c b/board/freescale/p1010rdb/p1010rdb.c
index 65bb575a96..aa04e993c4 100644
--- a/board/freescale/p1010rdb/p1010rdb.c
+++ b/board/freescale/p1010rdb/p1010rdb.c
@@ -453,8 +453,8 @@ int ft_board_setup(void *blob, bd_t *bd)

ft_cpu_setup(blob, bd);

- base = getenv_bootm_low();
- size = getenv_bootm_size();
+ base = env_get_bootm_low();
+ size = env_get_bootm_size();

#if defined(CONFIG_PCI)
FT_FSL_PCI_SETUP;
diff --git a/board/freescale/p1022ds/p1022ds.c b/board/freescale/p1022ds/p1022ds.c
index 345feac0b2..bf493262d0 100644
--- a/board/freescale/p1022ds/p1022ds.c
+++ b/board/freescale/p1022ds/p1022ds.c
@@ -339,8 +339,8 @@ int ft_board_setup(void *blob, bd_t *bd)

ft_cpu_setup(blob, bd);

- base = getenv_bootm_low();
- size = getenv_bootm_size();
+ base = env_get_bootm_low();
+ size = env_get_bootm_size();

fdt_fixup_memory(blob, (u64)base, (u64)size);

diff --git a/board/freescale/p1023rdb/p1023rdb.c b/board/freescale/p1023rdb/p1023rdb.c
index 0451722603..ccda824125 100644
--- a/board/freescale/p1023rdb/p1023rdb.c
+++ b/board/freescale/p1023rdb/p1023rdb.c
@@ -137,8 +137,8 @@ int ft_board_setup(void *blob, bd_t *bd)

ft_cpu_setup(blob, bd);

- base = getenv_bootm_low();
- size = getenv_bootm_size();
+ base = env_get_bootm_low();
+ size = env_get_bootm_size();

fdt_fixup_memory(blob, (u64)base, (u64)size);

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 51217c58e5..31c8ed9ae1 100644
--- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
+++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
@@ -350,7 +350,8 @@ int board_eth_init(bd_t *bis)

#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,
@@ -438,8 +439,8 @@ int ft_board_setup(void *blob, bd_t *bd)

ft_cpu_setup(blob, bd);

- base = getenv_bootm_low();
- size = getenv_bootm_size();
+ base = env_get_bootm_low();
+ size = env_get_bootm_size();

fdt_fixup_memory(blob, (u64)base, (u64)size);

diff --git a/board/freescale/p1_twr/p1_twr.c b/board/freescale/p1_twr/p1_twr.c
index f54a6ff8dc..02c89998cb 100644
--- a/board/freescale/p1_twr/p1_twr.c
+++ b/board/freescale/p1_twr/p1_twr.c
@@ -268,8 +268,8 @@ int ft_board_setup(void *blob, bd_t *bd)

ft_cpu_setup(blob, bd);

- base = getenv_bootm_low();
- size = getenv_bootm_size();
+ base = env_get_bootm_low();
+ size = env_get_bootm_size();

fdt_fixup_memory(blob, (u64)base, (u64)size);

diff --git a/board/freescale/p2041rdb/p2041rdb.c b/board/freescale/p2041rdb/p2041rdb.c
index 21fb66f184..78ee74770c 100644
--- a/board/freescale/p2041rdb/p2041rdb.c
+++ b/board/freescale/p2041rdb/p2041rdb.c
@@ -219,8 +219,8 @@ int ft_board_setup(void *blob, bd_t *bd)

ft_cpu_setup(blob, bd);

- base = getenv_bootm_low();
- size = getenv_bootm_size();
+ base = env_get_bootm_low();
+ size = env_get_bootm_size();

fdt_fixup_memory(blob, (u64)base, (u64)size);

diff --git a/board/freescale/t102xqds/t102xqds.c b/board/freescale/t102xqds/t102xqds.c
index 1b2f6b2487..20374baf48 100644
--- a/board/freescale/t102xqds/t102xqds.c
+++ b/board/freescale/t102xqds/t102xqds.c
@@ -363,8 +363,8 @@ int ft_board_setup(void *blob, bd_t *bd)

ft_cpu_setup(blob, bd);

- base = getenv_bootm_low();
- size = getenv_bootm_size();
+ base = env_get_bootm_low();
+ size = env_get_bootm_size();

fdt_fixup_memory(blob, (u64)base, (u64)size);

diff --git a/board/freescale/t102xrdb/t102xrdb.c b/board/freescale/t102xrdb/t102xrdb.c
index f370f72baa..8885a546fa 100644
--- a/board/freescale/t102xrdb/t102xrdb.c
+++ b/board/freescale/t102xrdb/t102xrdb.c
@@ -186,8 +186,8 @@ int ft_board_setup(void *blob, bd_t *bd)

ft_cpu_setup(blob, bd);

- base = getenv_bootm_low();
- size = getenv_bootm_size();
+ base = env_get_bootm_low();
+ size = env_get_bootm_size();

fdt_fixup_memory(blob, (u64)base, (u64)size);

diff --git a/board/freescale/t1040qds/t1040qds.c b/board/freescale/t1040qds/t1040qds.c
index 5466fbf5f6..a36997b48c 100644
--- a/board/freescale/t1040qds/t1040qds.c
+++ b/board/freescale/t1040qds/t1040qds.c
@@ -245,8 +245,8 @@ int ft_board_setup(void *blob, bd_t *bd)

ft_cpu_setup(blob, bd);

- base = getenv_bootm_low();
- size = getenv_bootm_size();
+ base = env_get_bootm_low();
+ size = env_get_bootm_size();

fdt_fixup_memory(blob, (u64)base, (u64)size);

diff --git a/board/freescale/t104xrdb/t104xrdb.c b/board/freescale/t104xrdb/t104xrdb.c
index d4c3d4dcb4..2818cdf274 100644
--- a/board/freescale/t104xrdb/t104xrdb.c
+++ b/board/freescale/t104xrdb/t104xrdb.c
@@ -132,8 +132,8 @@ int ft_board_setup(void *blob, bd_t *bd)

ft_cpu_setup(blob, bd);

- base = getenv_bootm_low();
- size = getenv_bootm_size();
+ base = env_get_bootm_low();
+ size = env_get_bootm_size();

fdt_fixup_memory(blob, (u64)base, (u64)size);

diff --git a/board/freescale/t208xqds/t208xqds.c b/board/freescale/t208xqds/t208xqds.c
index 26093ea9d2..ed3d3f4b71 100644
--- a/board/freescale/t208xqds/t208xqds.c
+++ b/board/freescale/t208xqds/t208xqds.c
@@ -451,8 +451,8 @@ int ft_board_setup(void *blob, bd_t *bd)

ft_cpu_setup(blob, bd);

- base = getenv_bootm_low();
- size = getenv_bootm_size();
+ base = env_get_bootm_low();
+ size = env_get_bootm_size();

fdt_fixup_memory(blob, (u64)base, (u64)size);

diff --git a/board/freescale/t208xrdb/t208xrdb.c b/board/freescale/t208xrdb/t208xrdb.c
index 1ab05ec9fd..619495e6ab 100644
--- a/board/freescale/t208xrdb/t208xrdb.c
+++ b/board/freescale/t208xrdb/t208xrdb.c
@@ -118,8 +118,8 @@ int ft_board_setup(void *blob, bd_t *bd)

ft_cpu_setup(blob, bd);

- base = getenv_bootm_low();
- size = getenv_bootm_size();
+ base = env_get_bootm_low();
+ size = env_get_bootm_size();

fdt_fixup_memory(blob, (u64)base, (u64)size);

diff --git a/board/freescale/t4qds/t4240emu.c b/board/freescale/t4qds/t4240emu.c
index 35ad19e045..7136acafea 100644
--- a/board/freescale/t4qds/t4240emu.c
+++ b/board/freescale/t4qds/t4240emu.c
@@ -70,8 +70,8 @@ int ft_board_setup(void *blob, bd_t *bd)

ft_cpu_setup(blob, bd);

- base = getenv_bootm_low();
- size = getenv_bootm_size();
+ base = env_get_bootm_low();
+ size = env_get_bootm_size();

fdt_fixup_memory(blob, (u64)base, (u64)size);

diff --git a/board/freescale/t4qds/t4240qds.c b/board/freescale/t4qds/t4240qds.c
index 8f9e7e8255..7b71b541fd 100644
--- a/board/freescale/t4qds/t4240qds.c
+++ b/board/freescale/t4qds/t4240qds.c
@@ -265,7 +265,7 @@ static int adjust_vdd(ulong vdd_override)
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;
@@ -684,8 +684,8 @@ int ft_board_setup(void *blob, bd_t *bd)

ft_cpu_setup(blob, bd);

- base = getenv_bootm_low();
- size = getenv_bootm_size();
+ base = env_get_bootm_low();
+ size = env_get_bootm_size();

fdt_fixup_memory(blob, (u64)base, (u64)size);

diff --git a/board/freescale/t4rdb/t4240rdb.c b/board/freescale/t4rdb/t4240rdb.c
index bdd6f4ef49..f511706b9f 100644
--- a/board/freescale/t4rdb/t4240rdb.c
+++ b/board/freescale/t4rdb/t4240rdb.c
@@ -97,8 +97,8 @@ int ft_board_setup(void *blob, bd_t *bd)

ft_cpu_setup(blob, bd);

- base = getenv_bootm_low();
- size = getenv_bootm_size();
+ base = env_get_bootm_low();
+ size = env_get_bootm_size();

fdt_fixup_memory(blob, (u64)base, (u64)size);

diff --git a/board/gateworks/gw_ventana/common.c b/board/gateworks/gw_ventana/common.c
index 46404b4d59..e9865b4adb 100644
--- a/board/gateworks/gw_ventana/common.c
+++ b/board/gateworks/gw_ventana/common.c
@@ -1160,7 +1160,7 @@ void setup_board_gpio(int board, struct ventana_board_info *info)
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;
diff --git a/board/gateworks/gw_ventana/gw_ventana.c b/board/gateworks/gw_ventana/gw_ventana.c
index 61298ab2fd..4ddc7e1fa2 100644
--- a/board/gateworks/gw_ventana/gw_ventana.c
+++ b/board/gateworks/gw_ventana/gw_ventana.c
@@ -298,11 +298,11 @@ int board_eth_init(bd_t *bis)
#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"));
}
}

@@ -579,7 +579,7 @@ void board_pci_fixup_dev(struct pci_controller *hose, pci_dev_t dev,
*/
void get_board_serial(struct tag_serialnr *serialnr)
{
- char *serial = getenv("serial#");
+ char *serial = env_get("serial#");

if (serial) {
serialnr->high = 0;
@@ -658,7 +658,7 @@ int checkboard(void)
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
@@ -746,7 +746,7 @@ int misc_init_r(void)
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);
}
@@ -770,11 +770,11 @@ int misc_init_r(void)

/* 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);
}

@@ -788,7 +788,7 @@ int misc_init_r(void)
}

/* 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;");
@@ -1035,7 +1035,7 @@ int fdt_fixup_sky2(void *blob, int np, struct pci_dev *dev)
int j;

sprintf(mac, "eth1addr");
- tmp = getenv(mac);
+ tmp = env_get(mac);
if (tmp) {
for (j = 0; j < 6; j++) {
mac_addr[j] = tmp ?
@@ -1118,8 +1118,8 @@ int ft_board_setup(void *blob, bd_t *bd)
{ "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;

@@ -1131,7 +1131,7 @@ int ft_board_setup(void *blob, bd_t *bd)
}
}

- if (getenv("fdt_noauto")) {
+ if (env_get("fdt_noauto")) {
puts(" Skiping ft_board_setup (fdt_noauto defined)\n");
return 0;
}
@@ -1152,15 +1152,15 @@ int ft_board_setup(void *blob, bd_t *bd)
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
@@ -1315,7 +1315,7 @@ int ft_board_setup(void *blob, bd_t *bd)
}

#if defined(CONFIG_CMD_PCI)
- if (!getenv("nopcifixup"))
+ if (!env_get("nopcifixup"))
ft_board_pci_fixup(blob, bd);
#endif

@@ -1324,7 +1324,7 @@ int ft_board_setup(void *blob, bd_t *bd)
* 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 baa8480b6c..9524da7daf 100644
--- a/board/gateworks/gw_ventana/gw_ventana_spl.c
+++ b/board/gateworks/gw_ventana/gw_ventana_spl.c
@@ -691,8 +691,8 @@ int spl_start_uboot(void)
#ifdef CONFIG_SPL_ENV_SUPPORT
env_init();
env_load();
- debug("boot_os=%s\n", getenv("boot_os"));
- if (getenv_yesno("boot_os") == 1)
+ debug("boot_os=%s\n", env_get("boot_os"));
+ if (env_get_yesno("boot_os") == 1)
ret = 0;
#else
/* use i2c-0:0x50:0x00 for falcon boot mode (0=linux, else uboot) */
diff --git a/board/gdsys/a38x/keyprogram.c b/board/gdsys/a38x/keyprogram.c
index a4a6f1cca5..d75e08b39f 100644
--- a/board/gdsys/a38x/keyprogram.c
+++ b/board/gdsys/a38x/keyprogram.c
@@ -129,12 +129,12 @@ int load_and_run_keyprog(void)
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;
diff --git a/board/gdsys/mpc8308/hrcon.c b/board/gdsys/mpc8308/hrcon.c
index c6566e9196..7e485074ce 100644
--- a/board/gdsys/mpc8308/hrcon.c
+++ b/board/gdsys/mpc8308/hrcon.c
@@ -103,7 +103,7 @@ int fpga_get_reg(u32 fpga, u16 *reg, off_t regoff, u16 *data)

int checkboard(void)
{
- char *s = getenv("serial#");
+ char *s = env_get("serial#");
bool hw_type_cat = pca9698_get_value(0x20, 20);

puts("Board: ");
diff --git a/board/gdsys/mpc8308/strider.c b/board/gdsys/mpc8308/strider.c
index 34e9d1956e..fec691515d 100644
--- a/board/gdsys/mpc8308/strider.c
+++ b/board/gdsys/mpc8308/strider.c
@@ -106,7 +106,7 @@ int fpga_get_reg(u32 fpga, u16 *reg, off_t regoff, u16 *data)

int checkboard(void)
{
- char *s = getenv("serial#");
+ char *s = env_get("serial#");
bool hw_type_cat = pca9698_get_value(0x20, 18);

puts("Board: ");
diff --git a/board/gdsys/p1022/controlcenterd-id.c b/board/gdsys/p1022/controlcenterd-id.c
index 95f11fb69f..1813a58e60 100644
--- a/board/gdsys/p1022/controlcenterd-id.c
+++ b/board/gdsys/p1022/controlcenterd-id.c
@@ -217,7 +217,7 @@ static u8 *get_2nd_stage_bl_location(ulong target_addr)
{
ulong addr;
#ifdef CCDM_SECOND_STAGE
- addr = getenv_ulong("loadaddr", 16, CONFIG_LOADADDR);
+ addr = env_get_ulong("loadaddr", 16, CONFIG_LOADADDR);
#else
addr = target_addr;
#endif
@@ -235,7 +235,7 @@ static u8 *get_image_location(void)
{
ulong addr;
/* TODO use other area? */
- addr = getenv_ulong("loadaddr", 16, CONFIG_LOADADDR);
+ addr = env_get_ulong("loadaddr", 16, CONFIG_LOADADDR);
return (u8 *)(addr);
}
#endif
@@ -1043,13 +1043,13 @@ static int second_stage_init(void)
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;

diff --git a/board/gdsys/p1022/controlcenterd.c b/board/gdsys/p1022/controlcenterd.c
index 01064dcfde..9fb814d8c7 100644
--- a/board/gdsys/p1022/controlcenterd.c
+++ b/board/gdsys/p1022/controlcenterd.c
@@ -223,7 +223,7 @@ void hw_watchdog_reset(void)
#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)
@@ -335,8 +335,8 @@ int ft_board_setup(void *blob, bd_t *bd)

ft_cpu_setup(blob, bd);

- base = getenv_bootm_low();
- size = getenv_bootm_size();
+ base = env_get_bootm_low();
+ size = env_get_bootm_size();

fdt_fixup_memory(blob, (u64)base, (u64)size);

diff --git a/board/grinn/chiliboard/board.c b/board/grinn/chiliboard/board.c
index 2900109bbd..2f5974a246 100644
--- a/board/grinn/chiliboard/board.c
+++ b/board/grinn/chiliboard/board.c
@@ -126,7 +126,7 @@ int board_late_init(void)
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))
@@ -142,7 +142,7 @@ int board_late_init(void)
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);
}
diff --git a/board/grinn/liteboard/board.c b/board/grinn/liteboard/board.c
index 24956927ac..941e7ea2c8 100644
--- a/board/grinn/liteboard/board.c
+++ b/board/grinn/liteboard/board.c
@@ -149,7 +149,7 @@ int board_mmc_init(bd_t *bis)

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)) {
diff --git a/board/gumstix/pepper/board.c b/board/gumstix/pepper/board.c
index 7e8b014e3d..bfc5fd1c46 100644
--- a/board/gumstix/pepper/board.c
+++ b/board/gumstix/pepper/board.c
@@ -239,7 +239,7 @@ int board_eth_init(bd_t *bis)
uint32_t mac_hi, mac_lo;
const char *devname;

- if (!eth_getenv_enetaddr("ethaddr", mac_addr)) {
+ if (!eth_env_get_enetaddr("ethaddr", mac_addr)) {
/* try reading mac address from efuse */
mac_lo = readl(&cdev->macid0l);
mac_hi = readl(&cdev->macid0h);
diff --git a/board/highbank/highbank.c b/board/highbank/highbank.c
index e51043aa91..f7c05ab08f 100644
--- a/board/highbank/highbank.c
+++ b/board/highbank/highbank.c
@@ -80,7 +80,7 @@ int misc_init_r(void)

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
diff --git a/board/isee/igep003x/board.c b/board/isee/igep003x/board.c
index 1aa2f52069..d33dc960a5 100644
--- a/board/isee/igep003x/board.c
+++ b/board/isee/igep003x/board.c
@@ -264,7 +264,7 @@ int board_eth_init(bd_t *bis)
uint8_t mac_addr[6];
uint32_t mac_hi, mac_lo;

- if (!eth_getenv_enetaddr("ethaddr", mac_addr)) {
+ if (!eth_env_get_enetaddr("ethaddr", mac_addr)) {
/* try reading mac address from efuse */
mac_lo = readl(&cdev->macid0l);
mac_hi = readl(&cdev->macid0h);
diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c
index 56d3044241..6cd281218e 100644
--- a/board/keymile/common/common.c
+++ b/board/keymile/common/common.c
@@ -54,7 +54,7 @@ int set_km_env(void)
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 +
@@ -236,10 +236,10 @@ static int do_checkboardidhwk(cmd_tbl_t *cmdtp, int flag, int argc,
}

/* 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);

@@ -253,7 +253,7 @@ static int do_checkboardidhwk(cmd_tbl_t *cmdtp, int flag, int argc,
* 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;
@@ -355,7 +355,7 @@ static int do_checktestboot(cmd_tbl_t *cmdtp, int flag, int argc,
#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) {
diff --git a/board/keymile/common/ivm.c b/board/keymile/common/ivm.c
index cfb3494053..3c8de10c1d 100644
--- a/board/keymile/common/ivm.c
+++ b/board/keymile/common/ivm.c
@@ -254,7 +254,7 @@ int ivm_analyze_eeprom(unsigned char *buf, int len)

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;
@@ -302,11 +302,11 @@ static int ivm_populate_env(unsigned char *buf, int len)

/* if an offset is defined, add it */
process_mac(valbuf, page2, CONFIG_PIGGY_MAC_ADRESS_OFFSET);
- if (getenv("ethaddr") == NULL)
+ if (env_get("ethaddr") == NULL)
env_set((char *)"ethaddr", (char *)valbuf);
#ifdef CONFIG_KMVECT1
/* KMVECT1 has two ethernet interfaces */
- if (getenv("eth1addr") == NULL) {
+ if (env_get("eth1addr") == NULL) {
process_mac(valbuf, page2, 1);
env_set((char *)"eth1addr", (char *)valbuf);
}
diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
index 08ae9ae346..af1ebc4101 100644
--- a/board/keymile/km_arm/km_arm.c
+++ b/board/keymile/km_arm/km_arm.c
@@ -201,7 +201,7 @@ int misc_init_r(void)
#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) {
diff --git a/board/keymile/kmp204x/kmp204x.c b/board/keymile/kmp204x/kmp204x.c
index 095e467ac0..8c9d6b167d 100644
--- a/board/keymile/kmp204x/kmp204x.c
+++ b/board/keymile/kmp204x/kmp204x.c
@@ -239,7 +239,7 @@ void fdt_fixup_fman_mac_addresses(void *blob)
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;
@@ -271,8 +271,8 @@ int ft_board_setup(void *blob, bd_t *bd)

ft_cpu_setup(blob, bd);

- base = getenv_bootm_low();
- size = getenv_bootm_size();
+ base = env_get_bootm_low();
+ size = env_get_bootm_size();

fdt_fixup_memory(blob, (u64)base, (u64)size);

diff --git a/board/kosagi/novena/novena.c b/board/kosagi/novena/novena.c
index baca7223fa..f0ace03009 100644
--- a/board/kosagi/novena/novena.c
+++ b/board/kosagi/novena/novena.c
@@ -240,7 +240,7 @@ int misc_init_r(void)
int ret;

/* If 'ethaddr' is already set, do nothing. */
- if (getenv("ethaddr"))
+ if (env_get("ethaddr"))
return 0;

/* EEPROM is at bus 2. */
diff --git a/board/lg/sniper/sniper.c b/board/lg/sniper/sniper.c
index 4906e4f9d2..a299f761f9 100644
--- a/board/lg/sniper/sniper.c
+++ b/board/lg/sniper/sniper.c
@@ -133,7 +133,7 @@ int misc_init_r(void)
}

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);
}

diff --git a/board/liebherr/mccmon6/mccmon6.c b/board/liebherr/mccmon6/mccmon6.c
index 8d0a66621d..4f7e018dea 100644
--- a/board/liebherr/mccmon6/mccmon6.c
+++ b/board/liebherr/mccmon6/mccmon6.c
@@ -467,7 +467,7 @@ int spl_start_uboot(void)
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;

@@ -481,7 +481,7 @@ int spl_start_uboot(void)
* 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;

diff --git a/board/logicpd/omap3som/omap3logic.c b/board/logicpd/omap3som/omap3logic.c
index 8885d1e6a9..faf04df99f 100644
--- a/board/logicpd/omap3som/omap3logic.c
+++ b/board/logicpd/omap3som/omap3logic.c
@@ -219,7 +219,7 @@ int board_late_init(void)
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);
}

diff --git a/board/logicpd/zoom1/zoom1.c b/board/logicpd/zoom1/zoom1.c
index f76223cacd..e6c2526ea1 100644
--- a/board/logicpd/zoom1/zoom1.c
+++ b/board/logicpd/zoom1/zoom1.c
@@ -130,7 +130,7 @@ int board_eth_init(bd_t *bis)
uchar eth_addr[6];

rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
- if (!eth_getenv_enetaddr(STR_ENV_ETHADDR, eth_addr)) {
+ if (!eth_env_get_enetaddr(STR_ENV_ETHADDR, eth_addr)) {
dev = eth_get_dev_by_index(0);
if (dev) {
eth_env_set_enetaddr(STR_ENV_ETHADDR, dev->enetaddr);
diff --git a/board/micronas/vct/vct.c b/board/micronas/vct/vct.c
index 8bf8d5f4e8..510746d35c 100644
--- a/board/micronas/vct/vct.c
+++ b/board/micronas/vct/vct.c
@@ -72,7 +72,7 @@ int dram_init(void)
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
diff --git a/board/nokia/rx51/rx51.c b/board/nokia/rx51/rx51.c
index 889e748f98..7764288811 100644
--- a/board/nokia/rx51/rx51.c
+++ b/board/nokia/rx51/rx51.c
@@ -234,18 +234,18 @@ void setup_board_tags(struct tag **in_params)
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 *)&params->u;
diff --git a/board/phytec/pcm051/board.c b/board/phytec/pcm051/board.c
index 0da96e7413..52ad5b64de 100644
--- a/board/phytec/pcm051/board.c
+++ b/board/phytec/pcm051/board.c
@@ -216,7 +216,7 @@ int board_eth_init(bd_t *bis)
uint8_t mac_addr[6];
uint32_t mac_hi, mac_lo;

- if (!eth_getenv_enetaddr("ethaddr", mac_addr)) {
+ if (!eth_env_get_enetaddr("ethaddr", mac_addr)) {
printf("<ethaddr> not set. Reading from E-fuse\n");
/* try reading mac address from efuse */
mac_lo = readl(&cdev->macid0l);
diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
index 7ff7b269f9..530f149617 100644
--- a/board/raspberrypi/rpi/rpi.c
+++ b/board/raspberrypi/rpi/rpi.c
@@ -247,7 +247,7 @@ static void set_fdtfile(void)
{
const char *fdtfile;

- if (getenv("fdtfile"))
+ if (env_get("fdtfile"))
return;

fdtfile = model->fdtfile;
@@ -260,7 +260,7 @@ static void set_fdtfile(void)
*/
static void set_fdt_addr(void)
{
- if (getenv("fdt_addr"))
+ if (env_get("fdt_addr"))
return;

if (fdt_magic(fw_dtb_pointer) != FDT_MAGIC)
@@ -287,7 +287,7 @@ static void set_usbethaddr(void)
if (!model->has_onboard_eth)
return;

- if (getenv("usbethaddr"))
+ if (env_get("usbethaddr"))
return;

BCM2835_MBOX_INIT_HDR(msg);
@@ -302,8 +302,8 @@ static void set_usbethaddr(void)

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;
}
@@ -330,7 +330,7 @@ static void set_serial_number(void)
int ret;
char serial_string[17] = { 0 };

- if (getenv("serial#"))
+ if (env_get("serial#"))
return;

BCM2835_MBOX_INIT_HDR(msg);
diff --git a/board/renesas/alt/alt.c b/board/renesas/alt/alt.c
index b35b6a3ad1..0bf8160f1f 100644
--- a/board/renesas/alt/alt.c
+++ b/board/renesas/alt/alt.c
@@ -143,7 +143,7 @@ int board_eth_init(bd_t *bis)
unsigned char enetaddr[6];

ret = sh_eth_initialize(bis);
- if (!eth_getenv_enetaddr("ethaddr", enetaddr))
+ if (!eth_env_get_enetaddr("ethaddr", enetaddr))
return ret;

/* Set Mac address */
diff --git a/board/renesas/blanche/blanche.c b/board/renesas/blanche/blanche.c
index e3262f779a..574dcda01b 100644
--- a/board/renesas/blanche/blanche.c
+++ b/board/renesas/blanche/blanche.c
@@ -418,7 +418,7 @@ int board_eth_init(bd_t *bis)

rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);

- if (!eth_getenv_enetaddr(STR_ENV_ETHADDR, eth_addr)) {
+ if (!eth_env_get_enetaddr(STR_ENV_ETHADDR, eth_addr)) {
dev = eth_get_dev_by_index(0);
if (dev) {
eth_env_set_enetaddr(STR_ENV_ETHADDR, dev->enetaddr);
diff --git a/board/renesas/gose/gose.c b/board/renesas/gose/gose.c
index 359f95e264..54e126985b 100644
--- a/board/renesas/gose/gose.c
+++ b/board/renesas/gose/gose.c
@@ -126,7 +126,7 @@ int board_eth_init(bd_t *bis)

#ifdef CONFIG_SH_ETHER
ret = sh_eth_initialize(bis);
- if (!eth_getenv_enetaddr("ethaddr", enetaddr))
+ if (!eth_env_get_enetaddr("ethaddr", enetaddr))
return ret;

/* Set Mac address */
diff --git a/board/renesas/koelsch/koelsch.c b/board/renesas/koelsch/koelsch.c
index dd62145ac9..8fa648e40a 100644
--- a/board/renesas/koelsch/koelsch.c
+++ b/board/renesas/koelsch/koelsch.c
@@ -131,7 +131,7 @@ int board_eth_init(bd_t *bis)
unsigned char enetaddr[6];

ret = sh_eth_initialize(bis);
- if (!eth_getenv_enetaddr("ethaddr", enetaddr))
+ if (!eth_env_get_enetaddr("ethaddr", enetaddr))
return ret;

/* Set Mac address */
diff --git a/board/renesas/lager/lager.c b/board/renesas/lager/lager.c
index 2ada816006..562be04760 100644
--- a/board/renesas/lager/lager.c
+++ b/board/renesas/lager/lager.c
@@ -136,7 +136,7 @@ int board_eth_init(bd_t *bis)
unsigned char enetaddr[6];

ret = sh_eth_initialize(bis);
- if (!eth_getenv_enetaddr("ethaddr", enetaddr))
+ if (!eth_env_get_enetaddr("ethaddr", enetaddr))
return ret;

/* Set Mac address */
diff --git a/board/renesas/porter/porter.c b/board/renesas/porter/porter.c
index 926a657511..5b1a167906 100644
--- a/board/renesas/porter/porter.c
+++ b/board/renesas/porter/porter.c
@@ -126,7 +126,7 @@ int board_eth_init(bd_t *bis)
unsigned char enetaddr[6];

ret = sh_eth_initialize(bis);
- if (!eth_getenv_enetaddr("ethaddr", enetaddr))
+ if (!eth_env_get_enetaddr("ethaddr", enetaddr))
return ret;

/* Set Mac address */
diff --git a/board/renesas/silk/silk.c b/board/renesas/silk/silk.c
index e13a38f5ea..a8de402d20 100644
--- a/board/renesas/silk/silk.c
+++ b/board/renesas/silk/silk.c
@@ -135,7 +135,7 @@ int board_eth_init(bd_t *bis)
unsigned char enetaddr[6];

ret = sh_eth_initialize(bis);
- if (!eth_getenv_enetaddr("ethaddr", enetaddr))
+ if (!eth_env_get_enetaddr("ethaddr", enetaddr))
return ret;

/* Set Mac address */
diff --git a/board/renesas/stout/stout.c b/board/renesas/stout/stout.c
index fe8dd3d952..d681148273 100644
--- a/board/renesas/stout/stout.c
+++ b/board/renesas/stout/stout.c
@@ -137,7 +137,7 @@ int board_eth_init(bd_t *bis)
unsigned char enetaddr[6];

ret = sh_eth_initialize(bis);
- if (!eth_getenv_enetaddr("ethaddr", enetaddr))
+ if (!eth_env_get_enetaddr("ethaddr", enetaddr))
return ret;

/* Set Mac address */
diff --git a/board/samsung/common/exynos5-dt.c b/board/samsung/common/exynos5-dt.c
index 44f412db5d..ae2a6e6bfa 100644
--- a/board/samsung/common/exynos5-dt.c
+++ b/board/samsung/common/exynos5-dt.c
@@ -179,7 +179,7 @@ char *get_dfu_alt_system(char *interface, char *devstr)
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)
diff --git a/board/samsung/odroid/odroid.c b/board/samsung/odroid/odroid.c
index b4cb33240e..e40a2f6e3a 100644
--- a/board/samsung/odroid/odroid.c
+++ b/board/samsung/odroid/odroid.c
@@ -66,7 +66,7 @@ const char *get_board_type(void)
#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)
diff --git a/board/samtec/vining_2000/vining_2000.c b/board/samtec/vining_2000/vining_2000.c
index 125f6e7070..af1a3e75cb 100644
--- a/board/samtec/vining_2000/vining_2000.c
+++ b/board/samtec/vining_2000/vining_2000.c
@@ -131,7 +131,7 @@ int board_eth_init(bd_t *bis)

/* 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));
diff --git a/board/samtec/vining_fpga/socfpga.c b/board/samtec/vining_fpga/socfpga.c
index 760fc71217..229b12f308 100644
--- a/board/samtec/vining_fpga/socfpga.c
+++ b/board/samtec/vining_fpga/socfpga.c
@@ -76,7 +76,7 @@ int misc_init_r(void)
}

/* 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);
@@ -85,14 +85,14 @@ int misc_init_r(void)
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;
diff --git a/board/siemens/common/board.c b/board/siemens/common/board.c
index b967227411..65fa6af2d4 100644
--- a/board/siemens/common/board.c
+++ b/board/siemens/common/board.c
@@ -121,7 +121,7 @@ unsigned char get_button_state(char * const envname, unsigned char def)
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 {
@@ -199,7 +199,7 @@ void set_env_gpios(unsigned char state)
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;

diff --git a/board/siemens/taurus/taurus.c b/board/siemens/taurus/taurus.c
index d877a9c771..8390bdd5f8 100644
--- a/board/siemens/taurus/taurus.c
+++ b/board/siemens/taurus/taurus.c
@@ -377,7 +377,7 @@ static int upgrade_failure_fallback(void)
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");
@@ -388,18 +388,18 @@ static int upgrade_failure_fallback(void)
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);

@@ -418,10 +418,10 @@ static int do_upgrade_available(cmd_tbl_t *cmdtp, int flag, int argc,
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);
diff --git a/board/silica/pengwyn/board.c b/board/silica/pengwyn/board.c
index 057691b045..0429e6f0c7 100644
--- a/board/silica/pengwyn/board.c
+++ b/board/silica/pengwyn/board.c
@@ -171,7 +171,7 @@ int board_eth_init(bd_t *bis)
uint8_t mac_addr[6];
uint32_t mac_hi, mac_lo;

- if (!eth_getenv_enetaddr("ethaddr", mac_addr)) {
+ if (!eth_env_get_enetaddr("ethaddr", mac_addr)) {
printf("<ethaddr> not set. Reading from E-fuse\n");
/* try reading mac address from efuse */
mac_lo = readl(&cdev->macid0l);
diff --git a/board/socrates/socrates.c b/board/socrates/socrates.c
index fb691c22d9..004f37009a 100644
--- a/board/socrates/socrates.c
+++ b/board/socrates/socrates.c
@@ -38,7 +38,7 @@ int checkboard (void)
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
@@ -409,7 +409,7 @@ void board_backlight_switch (int flag)
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/spear/common/spr_misc.c b/board/spear/common/spr_misc.c
index 67de28e7ea..a02304f49e 100644
--- a/board/spear/common/spr_misc.c
+++ b/board/spear/common/spr_misc.c
@@ -53,7 +53,7 @@ int misc_init_r(void)
#if defined(CONFIG_CMD_NET)
uchar mac_id[6];

- if (!eth_getenv_enetaddr("ethaddr", mac_id) && !i2c_read_mac(mac_id))
+ if (!eth_env_get_enetaddr("ethaddr", mac_id) && !i2c_read_mac(mac_id))
eth_env_set_enetaddr("ethaddr", mac_id);
#endif
env_set("verify", "n");
diff --git a/board/st/stm32f429-discovery/stm32f429-discovery.c b/board/st/stm32f429-discovery/stm32f429-discovery.c
index 673e7728f1..d6763c306f 100644
--- a/board/st/stm32f429-discovery/stm32f429-discovery.c
+++ b/board/st/stm32f429-discovery/stm32f429-discovery.c
@@ -314,7 +314,7 @@ int misc_init_r(void)
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 26732dc40f..70e01437c4 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -602,7 +602,7 @@ void get_board_serial(struct tag_serialnr *serialnr)
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);
@@ -694,7 +694,7 @@ static void setup_environment(const void *fdt)
else
sprintf(ethaddr, "eth%daddr", i);

- if (getenv(ethaddr))
+ if (env_get(ethaddr))
continue;

/* Non OUI / registered MAC address */
@@ -708,7 +708,7 @@ static void setup_environment(const void *fdt)
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]);

diff --git a/board/syteco/zmx25/zmx25.c b/board/syteco/zmx25/zmx25.c
index e02dcf2995..85fda13188 100644
--- a/board/syteco/zmx25/zmx25.c
+++ b/board/syteco/zmx25/zmx25.c
@@ -146,7 +146,7 @@ int board_late_init(void)
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 cc65c7b84b..f79bb9dcdd 100644
--- a/board/tcl/sl50/board.c
+++ b/board/tcl/sl50/board.c
@@ -77,7 +77,7 @@ int spl_start_uboot(void)
#ifdef CONFIG_SPL_ENV_SUPPORT
env_init();
env_load();
- if (getenv_yesno("boot_os") != 1)
+ if (env_get_yesno("boot_os") != 1)
return 1;
#endif

@@ -322,7 +322,7 @@ int board_eth_init(bd_t *bis)

#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))
@@ -340,7 +340,7 @@ int board_eth_init(bd_t *bis)
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);
}
diff --git a/board/technexion/twister/twister.c b/board/technexion/twister/twister.c
index 25aeebc8d0..8c38f14cde 100644
--- a/board/technexion/twister/twister.c
+++ b/board/technexion/twister/twister.c
@@ -94,7 +94,7 @@ int misc_init_r(void)

omap_die_id_display();

- eth_addr = getenv("ethaddr");
+ eth_addr = env_get("ethaddr");
if (eth_addr)
return 0;

diff --git a/board/teejet/mt_ventoux/mt_ventoux.c b/board/teejet/mt_ventoux/mt_ventoux.c
index 6e73ae114a..9eaae50f27 100644
--- a/board/teejet/mt_ventoux/mt_ventoux.c
+++ b/board/teejet/mt_ventoux/mt_ventoux.c
@@ -261,7 +261,7 @@ int misc_init_r(void)

if (ret)
return 0;
- eth_addr = getenv("ethaddr");
+ eth_addr = env_get("ethaddr");
if (!eth_addr)
TAM3517_READ_MAC_FROM_EEPROM(&info);

@@ -311,7 +311,7 @@ int board_video_init(void)

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 d8c8083e16..de782b9f45 100644
--- a/board/theobroma-systems/puma_rk3399/puma-rk3399.c
+++ b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
@@ -72,13 +72,13 @@ static void setup_macaddr(void)
{
#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) {
@@ -171,7 +171,7 @@ void get_board_serial(struct tag_serialnr *serialnr)
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);
diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
index 7bdbc89d5e..1a52bffc00 100644
--- a/board/ti/am335x/board.c
+++ b/board/ti/am335x/board.c
@@ -250,7 +250,7 @@ int spl_start_uboot(void)
#ifdef CONFIG_SPL_ENV_SUPPORT
env_init();
env_load();
- if (getenv_yesno("boot_os") != 1)
+ if (env_get_yesno("boot_os") != 1)
return 1;
#endif

@@ -745,7 +745,7 @@ int board_late_init(void)
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))
@@ -761,7 +761,7 @@ int board_late_init(void)
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);
}
diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c
index db9aff3739..1d1b6b9845 100644
--- a/board/ti/am43xx/board.c
+++ b/board/ti/am43xx/board.c
@@ -791,7 +791,7 @@ int board_eth_init(bd_t *bis)
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);
@@ -806,7 +806,7 @@ int board_eth_init(bd_t *bis)
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);
}
diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c
index b656f88163..1b00cec460 100644
--- a/board/ti/am57xx/board.c
+++ b/board/ti/am57xx/board.c
@@ -738,7 +738,7 @@ int spl_start_uboot(void)
#ifdef CONFIG_SPL_ENV_SUPPORT
env_init();
env_load();
- if (getenv_yesno("boot_os") != 1)
+ if (env_get_yesno("boot_os") != 1)
return 1;
#endif

@@ -928,7 +928,7 @@ int board_eth_init(bd_t *bis)
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))
@@ -944,7 +944,7 @@ int board_eth_init(bd_t *bis)
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 4252074e74..93d3d0b54e 100644
--- a/board/ti/dra7xx/evm.c
+++ b/board/ti/dra7xx/evm.c
@@ -826,7 +826,7 @@ int spl_start_uboot(void)
#ifdef CONFIG_SPL_ENV_SUPPORT
env_init();
env_load();
- if (getenv_yesno("boot_os") != 1)
+ if (env_get_yesno("boot_os") != 1)
return 1;
#endif

@@ -893,7 +893,7 @@ int board_eth_init(bd_t *bis)
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))
@@ -909,7 +909,7 @@ int board_eth_init(bd_t *bis)
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/evm/evm.c b/board/ti/evm/evm.c
index ac8e093e5a..61f69e1296 100644
--- a/board/ti/evm/evm.c
+++ b/board/ti/evm/evm.c
@@ -245,7 +245,7 @@ int board_eth_init(bd_t *bis)

rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);

- if (!eth_getenv_enetaddr(STR_ENV_ETHADDR, eth_addr)) {
+ if (!eth_env_get_enetaddr(STR_ENV_ETHADDR, eth_addr)) {
dev = eth_get_dev_by_index(0);
if (dev) {
eth_env_set_enetaddr(STR_ENV_ETHADDR, dev->enetaddr);
diff --git a/board/ti/ks2_evm/board.c b/board/ti/ks2_evm/board.c
index c61baeeb8c..ae86dfbe0a 100644
--- a/board/ti/ks2_evm/board.c
+++ b/board/ti/ks2_evm/board.c
@@ -74,7 +74,7 @@ int get_eth_env_param(char *env_name)
char *env;
int res = -1;

- env = getenv(env_name);
+ env = env_get(env_name);
if (env)
res = simple_strtol(env, NULL, 0);

@@ -151,9 +151,9 @@ int ft_board_setup(void *blob, bd_t *bd)
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;
@@ -180,13 +180,13 @@ int ft_board_setup(void *blob, bd_t *bd)
}

/* 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);

@@ -251,7 +251,7 @@ void ft_board_setup_ex(void *blob, bd_t *bd)
char *env;
u64 *reserve_start;

- env = getenv("mem_lpae");
+ env = env_get("mem_lpae");
lpae = env && simple_strtol(env, NULL, 0);

if (lpae) {
diff --git a/board/ti/ti814x/evm.c b/board/ti/ti814x/evm.c
index 38f9c57606..cdde6a8ca3 100644
--- a/board/ti/ti814x/evm.c
+++ b/board/ti/ti814x/evm.c
@@ -166,7 +166,7 @@ int board_eth_init(bd_t *bis)
uint8_t mac_addr[6];
uint32_t mac_hi, mac_lo;

- if (!eth_getenv_enetaddr("ethaddr", mac_addr)) {
+ if (!eth_env_get_enetaddr("ethaddr", mac_addr)) {
printf("<ethaddr> not set. Reading from E-fuse\n");
/* try reading mac address from efuse */
mac_lo = readl(&cdev->macid0l);
diff --git a/board/ti/ti816x/evm.c b/board/ti/ti816x/evm.c
index 1a8fe27c9f..cb40cc5f47 100644
--- a/board/ti/ti816x/evm.c
+++ b/board/ti/ti816x/evm.c
@@ -38,7 +38,7 @@ int board_eth_init(bd_t *bis)
uint32_t mac_hi, mac_lo;
struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;

- if (!eth_getenv_enetaddr("ethaddr", mac_addr)) {
+ if (!eth_env_get_enetaddr("ethaddr", mac_addr)) {
printf("<ethaddr> not set. Reading from E-fuse\n");
/* try reading mac address from efuse */
mac_lo = readl(&cdev->macid0l);
diff --git a/board/timll/devkit8000/devkit8000.c b/board/timll/devkit8000/devkit8000.c
index 2f80d15666..741b3acce2 100644
--- a/board/timll/devkit8000/devkit8000.c
+++ b/board/timll/devkit8000/devkit8000.c
@@ -102,7 +102,7 @@ int misc_init_r(void)
CONFIG_DM9000_BASE, GPMC_SIZE_16M);

/* Use OMAP DIE_ID as MAC address */
- if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
+ if (!eth_env_get_enetaddr("ethaddr", enetaddr)) {
printf("ethaddr not set, using Die ID\n");
die_id_0 = readl(&id_base->die_id_0);
enetaddr[0] = 0x02; /* locally administered */
diff --git a/board/toradex/apalis_imx6/apalis_imx6.c b/board/toradex/apalis_imx6/apalis_imx6.c
index 86a7a159e8..7a3e493faf 100644
--- a/board/toradex/apalis_imx6/apalis_imx6.c
+++ b/board/toradex/apalis_imx6/apalis_imx6.c
@@ -814,7 +814,7 @@ int board_late_init(void)
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");
diff --git a/board/toradex/common/tdx-cfg-block.c b/board/toradex/common/tdx-cfg-block.c
index 1bf8ca8f76..328c4c0200 100644
--- a/board/toradex/common/tdx-cfg-block.c
+++ b/board/toradex/common/tdx-cfg-block.c
@@ -278,7 +278,7 @@ static int get_cfgblock_interactive(void)
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')
diff --git a/board/toradex/common/tdx-common.c b/board/toradex/common/tdx-common.c
index 78b2bc0c2b..b4e4727e63 100644
--- a/board/toradex/common/tdx-common.c
+++ b/board/toradex/common/tdx-common.c
@@ -86,11 +86,11 @@ int show_board_info(void)
* Check if environment contains a valid MAC address,
* set the one from config block if not
*/
- if (!eth_getenv_enetaddr("ethaddr", ethaddr))
+ if (!eth_env_get_enetaddr("ethaddr", ethaddr))
eth_env_set_enetaddr("ethaddr", (u8 *)&tdx_eth_addr);

#ifdef CONFIG_TDX_CFG_BLOCK_2ND_ETHADDR
- if (!eth_getenv_enetaddr("eth1addr", ethaddr)) {
+ if (!eth_env_get_enetaddr("eth1addr", ethaddr)) {
/*
* Secondary MAC address is allocated from block
* 0x100000 higher then the first MAC address
diff --git a/board/varisys/common/sys_eeprom.c b/board/varisys/common/sys_eeprom.c
index d235897311..69f596a4cc 100644
--- a/board/varisys/common/sys_eeprom.c
+++ b/board/varisys/common/sys_eeprom.c
@@ -486,7 +486,7 @@ int mac_read_from_eeprom_common(void)
/* 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);
}
}
diff --git a/board/varisys/cyrus/cyrus.c b/board/varisys/cyrus/cyrus.c
index 74f4473877..30f518abe8 100644
--- a/board/varisys/cyrus/cyrus.c
+++ b/board/varisys/cyrus/cyrus.c
@@ -87,8 +87,8 @@ int ft_board_setup(void *blob, bd_t *bd)

ft_cpu_setup(blob, bd);

- base = getenv_bootm_low();
- size = getenv_bootm_size();
+ base = env_get_bootm_low();
+ size = env_get_bootm_size();

fdt_fixup_memory(blob, (u64)base, (u64)size);

diff --git a/board/vscom/baltos/board.c b/board/vscom/baltos/board.c
index 2e3baeb118..cb39190c28 100644
--- a/board/vscom/baltos/board.c
+++ b/board/vscom/baltos/board.c
@@ -453,7 +453,7 @@ int board_eth_init(bd_t *bis)

#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 37a736351c..c997cea6f0 100644
--- a/board/work-microwave/work_92105/work_92105_display.c
+++ b/board/work-microwave/work_92105/work_92105_display.c
@@ -228,7 +228,7 @@ void work_92105_display_init(void)
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);
diff --git a/board/xes/common/board.c b/board/xes/common/board.c
index 4ed6f50e5c..b76eb948d5 100644
--- a/board/xes/common/board.c
+++ b/board/xes/common/board.c
@@ -51,13 +51,13 @@ int checkboard(void)

/* 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");
diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index 89ab24417d..ddbb5ce8fd 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -282,9 +282,9 @@ int board_late_init(void)
* 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 8971697e60..e97fa1cdb4 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -28,7 +28,7 @@ static void print_eth(int idx)
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);
@@ -51,7 +51,7 @@ static void print_eths(void)
} 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

@@ -141,7 +141,7 @@ static inline void print_eth_ip_addr(void)
#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 daf15d9e80..df0bbe19ca 100644
--- a/cmd/bootm.c
+++ b/cmd/bootm.c
@@ -138,7 +138,7 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])

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];
@@ -202,7 +202,7 @@ U_BOOT_CMD(
#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 5879065c2e..870db7c1de 100644
--- a/cmd/bootmenu.c
+++ b/cmd/bootmenu.c
@@ -53,7 +53,7 @@ static char *bootmenu_getoption(unsigned short int n)
return NULL;

sprintf(name, "bootmenu_%d", n);
- return getenv(name);
+ return env_get(name);
}

static void bootmenu_print_entry(void *data)
@@ -483,7 +483,7 @@ int do_bootmenu(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
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 7b23c5b3dd..86f1bac272 100644
--- a/cmd/cramfs.c
+++ b/cmd/cramfs.c
@@ -104,7 +104,7 @@ int do_cramfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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 */
@@ -117,9 +117,9 @@ int do_cramfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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];
@@ -169,7 +169,7 @@ int do_cramfs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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 ed9625b221..5745a389da 100644
--- a/cmd/elf.c
+++ b/cmd/elf.c
@@ -148,7 +148,7 @@ int do_bootelf(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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' */
@@ -242,11 +242,11 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
*/
#if defined(CONFIG_WALNUT)
tmp = (char *)CONFIG_SYS_NVRAM_BASE_ADDR + 0x500;
- eth_getenv_enetaddr("ethaddr", (uchar *)build_buf);
+ eth_env_get_enetaddr("ethaddr", (uchar *)build_buf);
memcpy(tmp, &build_buf[3], 3);
#elif defined(CONFIG_SYS_VXWORKS_MAC_PTR)
tmp = (char *)CONFIG_SYS_VXWORKS_MAC_PTR;
- eth_getenv_enetaddr("ethaddr", (uchar *)build_buf);
+ eth_env_get_enetaddr("ethaddr", (uchar *)build_buf);
memcpy(tmp, build_buf, 6);
#else
puts("## Ethernet MAC address not copied to NV RAM\n");
@@ -258,7 +258,7 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
* (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 {
@@ -269,21 +269,21 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
* 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);
@@ -295,12 +295,12 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
* 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;
+ u32 mask = env_get_ip("netmask").s_addr;
ptr += sprintf(build_buf + ptr,
":%08x ", ntohl(mask));
} else {
@@ -308,19 +308,19 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
}

- 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);
@@ -341,12 +341,12 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
* 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/fdt.c b/cmd/fdt.c
index eb01a889ad..118613f405 100644
--- a/cmd/fdt.c
+++ b/cmd/fdt.c
@@ -111,7 +111,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 1;
printf("The address of the fdt is %#08lx\n",
control ? (ulong)map_to_sysmem(blob) :
- getenv_hex("fdtaddr", 0));
+ env_get_hex("fdtaddr", 0));
return 0;
}

diff --git a/cmd/fpga.c b/cmd/fpga.c
index 016349f560..ac6f504140 100644
--- a/cmd/fpga.c
+++ b/cmd/fpga.c
@@ -43,8 +43,8 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
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 cb76d5e540..e0ff9b9291 100644
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -50,14 +50,14 @@ static int extract_env(const char *str, char **env)
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 449f6e9f51..8656299447 100644
--- a/cmd/ini.c
+++ b/cmd/ini.c
@@ -238,9 +238,9 @@ static int do_ini(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])

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 e1896d9f97..70db04a04f 100644
--- a/cmd/itest.c
+++ b/cmd/itest.c
@@ -101,7 +101,7 @@ static char * evalstr(char *s)
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 add89dee6a..aee2f4513d 100644
--- a/cmd/jffs2.c
+++ b/cmd/jffs2.c
@@ -479,9 +479,9 @@ int do_jffs2_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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 ec3730e0f6..519c309a61 100644
--- a/cmd/load.c
+++ b/cmd/load.c
@@ -50,11 +50,11 @@ static int do_load_serial(cmd_tbl_t *cmdtp, int flag, int argc,
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) {
@@ -427,9 +427,9 @@ static int do_load_serial_bin(cmd_tbl_t *cmdtp, int flag, int argc,
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 873ee40371..7a3bd5cd69 100644
--- a/cmd/log.c
+++ b/cmd/log.c
@@ -71,7 +71,8 @@ void logbuff_init_ptrs(void)
#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)
@@ -94,7 +95,8 @@ void logbuff_init_ptrs(void)
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 1b2352ea55..c737cb23b5 100644
--- a/cmd/md5sum.c
+++ b/cmd/md5sum.c
@@ -54,7 +54,7 @@ static int parse_verify_sum(char *verify_str, u8 *vsum)
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 d3fde77ef0..615aa7459a 100644
--- a/cmd/mtdparts.c
+++ b/cmd/mtdparts.c
@@ -1533,11 +1533,11 @@ static int spread_partitions(void)
* @param buf temporary buffer pointer MTDPARTS_MAXLEN long
* @return mtdparts variable string, NULL if not found
*/
-static const char *getenv_mtdparts(char *buf)
+static const char *env_get_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;
}
@@ -1565,7 +1565,7 @@ static int parse_mtdparts(const char *const mtdparts)
}

/* re-read 'mtdparts' variable, mtd_devices_init may be updating env */
- p = getenv_mtdparts(tmp_parts);
+ p = env_get_mtdparts(tmp_parts);
if (!p)
p = mtdparts;

@@ -1741,9 +1741,9 @@ int mtdparts_init(void)
}

/* get variables */
- ids = getenv("mtdids");
- parts = getenv_mtdparts(tmp_parts);
- current_partition = getenv("partition");
+ ids = env_get("mtdids");
+ parts = env_get_mtdparts(tmp_parts);
+ current_partition = env_get("partition");

/* save it for later parsing, cannot rely on current partition pointer
* as 'partition' variable may be updated during init */
@@ -1850,7 +1850,7 @@ int mtdparts_init(void)
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 ea46e7b108..a1997ac0d3 100644
--- a/cmd/mvebu/bubt.c
+++ b/cmd/mvebu/bubt.c
@@ -98,7 +98,7 @@ static ulong get_load_addr(void)
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 0f5d431e5c..a22945d144 100644
--- a/cmd/nand.c
+++ b/cmd/nand.c
@@ -383,7 +383,7 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#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;

@@ -966,11 +966,11 @@ static int do_nandboot(cmd_tbl_t *cmdtp, int flag, int argc,
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 fa6d02f90d..d090f7cade 100644
--- a/cmd/net.c
+++ b/cmd/net.c
@@ -181,7 +181,7 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
ulong addr;

/* pre-set load_addr */
- s = getenv("loadaddr");
+ s = env_get("loadaddr");
if (s != NULL)
load_addr = simple_strtoul(s, NULL, 16);

@@ -331,7 +331,7 @@ int do_sntp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
char *toff;

if (argc < 2) {
- net_ntp_server = getenv_ip("ntpserverip");
+ net_ntp_server = env_get_ip("ntpserverip");
if (net_ntp_server.s_addr == 0) {
printf("ntpserverip not set\n");
return CMD_RET_FAILURE;
@@ -344,7 +344,7 @@ int do_sntp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
}

- 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 a649004850..4033d90c8e 100644
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -327,13 +327,13 @@ int env_set_hex(const char *varname, ulong value)
return env_set(varname, str);
}

-ulong getenv_hex(const char *varname, ulong default_val)
+ulong env_get_hex(const char *varname, ulong default_val)
{
const char *s;
ulong value;
char *endp;

- s = getenv(varname);
+ s = env_get(varname);
if (s)
value = simple_strtoul(s, &endp, 16);
if (!s || endp == s)
@@ -594,7 +594,7 @@ static int do_env_edit(cmd_tbl_t *cmdtp, int flag, int argc,
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
@@ -622,7 +622,7 @@ static int do_env_edit(cmd_tbl_t *cmdtp, int flag, int argc,
* 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;
@@ -637,7 +637,7 @@ char *getenv(const char *name)
}

/* 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;
@@ -646,7 +646,7 @@ char *getenv(const char *name)
/*
* 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;

@@ -690,13 +690,13 @@ int getenv_f(const char *name, char *buf, unsigned len)
* found
* @return the decoded value, or default_val if not found
*/
-ulong getenv_ulong(const char *name, int base, ulong default_val)
+ulong env_get_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 357b96940c..94faf59ad0 100644
--- a/cmd/pxe.c
+++ b/cmd/pxe.c
@@ -41,7 +41,7 @@ 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);
@@ -70,8 +70,7 @@ static int format_mac_pxe(char *outbuf, size_t outbuf_len)
return -EINVAL;
}

- if (!eth_getenv_enetaddr_by_index("eth", eth_get_dev_index(),
- ethaddr))
+ if (!eth_env_get_enetaddr_by_index("eth", eth_get_dev_index(), ethaddr))
return -ENOENT;

sprintf(outbuf, "01-%02x-%02x-%02x-%02x-%02x-%02x",
@@ -649,9 +648,9 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
}

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) {
@@ -662,8 +661,8 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)

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
@@ -699,7 +698,7 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
printf("append: %s\n", finalbootargs);
}

- bootm_argv[1] = getenv("kernel_addr_r");
+ bootm_argv[1] = env_get("kernel_addr_r");

/*
* fdt usage is optional:
@@ -714,7 +713,7 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
*
* 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]) {
@@ -726,7 +725,7 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
} else if (label->fdtdir) {
char *f1, *f2, *f3, *f4, *slash;

- f1 = getenv("fdtfile");
+ f1 = env_get("fdtfile");
if (f1) {
f2 = "";
f3 = "";
@@ -739,9 +738,9 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
* 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";
}

@@ -781,7 +780,7 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
}

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 +1670,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 9b12ab40ca..b38026ba81 100644
--- a/cmd/qfw.c
+++ b/cmd/qfw.c
@@ -123,7 +123,7 @@ static int qemu_fwcfg_do_load(cmd_tbl_t *cmdtp, int flag,
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
@@ -132,7 +132,7 @@ static int qemu_fwcfg_do_load(cmd_tbl_t *cmdtp, int flag,
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 4df9c5f5db..e10c7b9eba 100644
--- a/cmd/reiser.c
+++ b/cmd/reiser.c
@@ -88,18 +88,18 @@ int do_reiserload (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])

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 91a5a9a770..af210225f1 100644
--- a/cmd/setexpr.c
+++ b/cmd/setexpr.c
@@ -145,7 +145,7 @@ static int regex_sub(const char *name,
}

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/source.c b/cmd/source.c
index 177f86bb54..a9831b6608 100644
--- a/cmd/source.c
+++ b/cmd/source.c
@@ -40,7 +40,7 @@ source (ulong addr, const char *fit_uname)
size_t fit_len;
#endif

- verify = getenv_yesno ("verify");
+ verify = env_get_yesno("verify");

buf = map_sysmem(addr, 0);
switch (genimg_get_format(buf)) {
diff --git a/cmd/trace.c b/cmd/trace.c
index e6c08e4ba5..a0a7dd1995 100644
--- a/cmd/trace.c
+++ b/cmd/trace.c
@@ -16,10 +16,10 @@ static int get_args(int argc, char * const argv[], char **buff,
if (argc < 2)
return -1;
if (argc < 4) {
- *buff_size = getenv_ulong("profsize", 16, 0);
- *buff = map_sysmem(getenv_ulong("profbase", 16, 0),
+ *buff_size = env_get_ulong("profsize", 16, 0);
+ *buff = map_sysmem(env_get_ulong("profbase", 16, 0),
*buff_size);
- *buff_ptr = getenv_ulong("profoffset", 16, 0);
+ *buff_ptr = env_get_ulong("profoffset", 16, 0);
} else {
*buff_size = simple_strtoul(argv[3], NULL, 16);
*buff = map_sysmem(simple_strtoul(argv[2], NULL, 16),
diff --git a/cmd/ximg.c b/cmd/ximg.c
index 50dc00e4f8..21b5c37721 100644
--- a/cmd/ximg.c
+++ b/cmd/ximg.c
@@ -52,7 +52,7 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
#endif
uint8_t comp;

- verify = getenv_yesno("verify");
+ verify = env_get_yesno("verify");

if (argc > 1) {
addr = simple_strtoul(argv[1], NULL, 16);
diff --git a/cmd/zfs.c b/cmd/zfs.c
index 08b0062c10..6913043d7f 100644
--- 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 41f18208c3..a011865028 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -50,7 +50,7 @@ static int slow_equals(u8 *a, u8 *b, int len)

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];
@@ -109,8 +109,8 @@ static int passwd_abort(uint64_t etime)
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];
@@ -301,10 +301,10 @@ const char *bootdelay_process(void)
bootcount++;
bootcount_store(bootcount);
env_set_ulong("bootcount", bootcount);
- bootlimit = getenv_ulong("bootlimit", 10, 0);
+ bootlimit = env_get_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
@@ -321,17 +321,17 @@ const char *bootdelay_process(void)

#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;
@@ -357,7 +357,7 @@ void autoboot_command(const char *s)

#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/board_f.c b/common/board_f.c
index ffa84e3566..e281bee592 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -118,7 +118,7 @@ __weak void board_add_ram_info(int use_default)

static int init_baud_rate(void)
{
- gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE);
+ gd->baudrate = env_get_ulong("baudrate", 10, CONFIG_BAUDRATE);
return 0;
}

@@ -324,7 +324,7 @@ static int reserve_pram(void)
{
ulong reg;

- reg = getenv_ulong("pram", 10, CONFIG_PRAM);
+ reg = env_get_ulong("pram", 10, CONFIG_PRAM);
gd->relocaddr -= (reg << 10); /* size is in kB */
debug("Reserving %ldk for protected RAM@%08lx\n", reg,
gd->relocaddr);
diff --git a/common/board_r.c b/common/board_r.c
index 3b7bc6bbd0..aab3253079 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -372,7 +372,7 @@ static int initr_flash(void)
*
* NOTE: Maybe we should add some WATCHDOG_RESET()? XXX
*/
- if (getenv_yesno("flashchecksum") == 1) {
+ if (env_get_yesno("flashchecksum") == 1) {
printf(" CRC: %08X", crc32(0,
(const unsigned char *) CONFIG_SYS_FLASH_BASE,
flash_size));
@@ -490,7 +490,7 @@ static int initr_env(void)
#endif

/* Initialize from environment */
- load_addr = getenv_ulong("loadaddr", 16, load_addr);
+ load_addr = env_get_ulong("loadaddr", 16, load_addr);

return 0;
}
@@ -537,21 +537,21 @@ static int initr_ethaddr(void)
bd_t *bd = gd->bd;

/* kept around for legacy kernels only ... ignore the next section */
- eth_getenv_enetaddr("ethaddr", bd->bi_enetaddr);
+ eth_env_get_enetaddr("ethaddr", bd->bi_enetaddr);
#ifdef CONFIG_HAS_ETH1
- eth_getenv_enetaddr("eth1addr", bd->bi_enet1addr);
+ eth_env_get_enetaddr("eth1addr", bd->bi_enet1addr);
#endif
#ifdef CONFIG_HAS_ETH2
- eth_getenv_enetaddr("eth2addr", bd->bi_enet2addr);
+ eth_env_get_enetaddr("eth2addr", bd->bi_enet2addr);
#endif
#ifdef CONFIG_HAS_ETH3
- eth_getenv_enetaddr("eth3addr", bd->bi_enet3addr);
+ eth_env_get_enetaddr("eth3addr", bd->bi_enet3addr);
#endif
#ifdef CONFIG_HAS_ETH4
- eth_getenv_enetaddr("eth4addr", bd->bi_enet4addr);
+ eth_env_get_enetaddr("eth4addr", bd->bi_enet4addr);
#endif
#ifdef CONFIG_HAS_ETH5
- eth_getenv_enetaddr("eth5addr", bd->bi_enet5addr);
+ eth_env_get_enetaddr("eth5addr", bd->bi_enet5addr);
#endif
return 0;
}
@@ -651,7 +651,7 @@ int initr_mem(void)
char memsz[32];

# ifdef CONFIG_PRAM
- pram = getenv_ulong("pram", 10, CONFIG_PRAM);
+ pram = env_get_ulong("pram", 10, CONFIG_PRAM);
# endif
# if defined(CONFIG_LOGBUFFER) && !defined(CONFIG_ALT_LB_ADDR)
/* Also take the logbuffer into account (pram is in kB) */
diff --git a/common/bootm.c b/common/bootm.c
index e34617a145..32b3ea8e2d 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -55,8 +55,8 @@ static void boot_start_lmb(bootm_headers_t *images)

lmb_init(&images->lmb);

- mem_start = getenv_bootm_low();
- mem_size = getenv_bootm_size();
+ mem_start = env_get_bootm_low();
+ mem_size = env_get_bootm_size();

lmb_add(&images->lmb, (phys_addr_t)mem_start, mem_size);

@@ -72,7 +72,7 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
{
memset((void *)&images, 0, sizeof(images));
- images.verify = getenv_yesno("verify");
+ images.verify = env_get_yesno("verify");

boot_start_lmb(&images);

@@ -524,7 +524,7 @@ static void fixup_silent_linux(void)
{
char *buf;
const char *env_val;
- char *cmdline = getenv("bootargs");
+ char *cmdline = env_get("bootargs");
int want_silent;

/*
@@ -534,7 +534,7 @@ static void fixup_silent_linux(void)
* yes - we always fixup
* unset - we rely on the console silent flag
*/
- want_silent = getenv_yesno("silent_linux");
+ want_silent = env_get_yesno("silent_linux");
if (want_silent == 0)
return;
else if (want_silent == -1 && !(gd->flags & GD_FLG_SILENT))
@@ -691,7 +691,7 @@ int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
#ifdef CONFIG_TRACE
/* Pretend to run the OS, then run a user command */
if (!ret && (states & BOOTM_STATE_OS_FAKE_GO)) {
- char *cmd_list = 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 86a37cb925..1feea8af17 100644
--- a/common/bootm_os.c
+++ b/common/bootm_os.c
@@ -21,7 +21,7 @@ static int do_bootm_standalone(int flag, int argc, char * const argv[],
int (*appl)(int, char *const[]);

/* Don't start if "autostart" is set to "no" */
- s = getenv("autostart");
+ s = env_get("autostart");
if ((s != NULL) && !strcmp(s, "no")) {
env_set_hex("filesize", images->os.image_len);
return 0;
@@ -96,7 +96,7 @@ static int do_bootm_netbsd(int flag, int argc, char * const argv[],
cmdline = malloc(len);
copy_args(cmdline, argc, argv, ' ');
} else {
- cmdline = getenv("bootargs");
+ cmdline = env_get("bootargs");
if (cmdline == NULL)
cmdline = "";
}
@@ -227,14 +227,14 @@ static int do_bootm_plan9(int flag, int argc, char * const argv[],
#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);
}
@@ -278,7 +278,7 @@ void do_bootvx_fdt(bootm_headers_t *images)

ret = fdt_add_subnode(*of_flat_tree, 0, "chosen");
if ((ret >= 0 || ret == -FDT_ERR_EXISTS)) {
- bootline = 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 2d82798cd0..b3b8271a92 100644
--- a/common/bootretry.c
+++ b/common/bootretry.c
@@ -23,7 +23,7 @@ static int retry_time = -1; /* -1 so can call readline before main_loop */
*/
void bootretry_init_cmd_timeout(void)
{
- char *s = 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 a433ef2166..57874d8797 100644
--- a/common/cli.c
+++ b/common/cli.c
@@ -129,7 +129,7 @@ int do_run(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
for (i = 1; i < argc; ++i) {
char *arg;

- arg = 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 280289639c..07c048ec6a 100644
--- a/common/cli_hush.c
+++ b/common/cli_hush.c
@@ -560,7 +560,7 @@ static int builtin_cd(struct child_prog *child)
{
char *newdir;
if (child->argv[1] == NULL)
- newdir = getenv("HOME");
+ newdir = env_get("HOME");
else
newdir = child->argv[1];
if (chdir(newdir)) {
@@ -948,7 +948,7 @@ static inline void cmdedit_set_initial_prompt(void)
#ifndef CONFIG_FEATURE_SH_FANCY_PROMPT
PS1 = NULL;
#else
- PS1 = getenv("PS1");
+ PS1 = env_get("PS1");
if(PS1==0)
PS1 = "\\w \\$ ";
#endif
@@ -987,9 +987,9 @@ static int uboot_cli_readline(struct in_str *i)

#ifdef CONFIG_CMDLINE_PS_SUPPORT
if (i->promptmode == 1)
- ps_prompt = getenv("PS1");
+ ps_prompt = env_get("PS1");
else
- ps_prompt = getenv("PS2");
+ ps_prompt = env_get("PS2");
if (ps_prompt)
prompt = ps_prompt;
#endif
@@ -2172,7 +2172,7 @@ int set_local_var(const char *s, int flg_export)
name=strdup(s);

#ifdef __U_BOOT__
- if (getenv(name) != NULL) {
+ if (env_get(name) != NULL) {
printf ("ERROR: "
"There is a global environment variable with the same name.\n");
free(name);
@@ -2793,7 +2793,7 @@ static char *lookup_param(char *src)
}
}

- p = getenv(src);
+ p = env_get(src);
if (!p)
p = get_local_var(src);

@@ -3157,7 +3157,7 @@ static void mapset(const unsigned char *set, int code)
static void update_ifs_map(void)
{
/* char *ifs and char map[256] are both globals. */
- ifs = (uchar *)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 bb96aaead6..cb642d2ff3 100644
--- a/common/cli_simple.c
+++ b/common/cli_simple.c
@@ -131,7 +131,7 @@ void cli_simple_process_macros(const char *input, char *output)
envname[i] = 0;

/* Get its value */
- envval = getenv(envname);
+ envval = env_get(envname);

/* Copy into the line if it exists */
if (envval != NULL)
@@ -168,7 +168,7 @@ void cli_simple_process_macros(const char *input, char *output)
* 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 2f3fa28f74..683f4c3073 100644
--- a/common/console.c
+++ b/common/console.c
@@ -682,7 +682,7 @@ int console_assign(int file, const char *devname)
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;
@@ -761,9 +761,9 @@ int console_init_r(void)

/* 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);
@@ -852,7 +852,7 @@ int console_init_r(void)
* 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 2113b6c372..5065ad5f73 100644
--- a/common/fb_mmc.c
+++ b/common/fb_mmc.c
@@ -49,7 +49,7 @@ static int part_get_info_by_name_or_alias(struct blk_desc *dev_desc,
/* 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 5aa8e3422e..b0d7f82894 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -197,7 +197,7 @@ int fdt_root(void *fdt)
return err;
}

- serial = getenv("serial#");
+ serial = env_get("serial#");
if (serial) {
err = fdt_setprop(fdt, 0, "serial-number", serial,
strlen(serial) + 1);
@@ -289,7 +289,7 @@ int fdt_chosen(void *fdt)
if (nodeoffset < 0)
return nodeoffset;

- str = getenv("bootargs");
+ str = env_get("bootargs");
if (str) {
err = fdt_setprop(fdt, nodeoffset, "bootargs", str,
strlen(str) + 1);
@@ -509,7 +509,7 @@ void fdt_fixup_ethernet(void *fdt)
} else {
continue;
}
- tmp = getenv(mac);
+ tmp = env_get(mac);
if (!tmp)
continue;

diff --git a/common/hash.c b/common/hash.c
index fda636d34a..dcf016d8a7 100644
--- a/common/hash.c
+++ b/common/hash.c
@@ -362,7 +362,7 @@ static int parse_verify_sum(struct hash_algo *algo, char *verify_str,
if (strlen(verify_str) == digits)
vsum_str = verify_str;
else {
- vsum_str = 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 85aaabbb85..e5186d7796 100644
--- a/common/hwconfig.c
+++ b/common/hwconfig.c
@@ -81,7 +81,7 @@ static const char *__hwconfig(const char *opt, size_t *arglen,
"and before environment is ready\n");
return NULL;
}
- env_hwconfig = getenv("hwconfig");
+ env_hwconfig = env_get("hwconfig");
}

if (env_hwconfig) {
diff --git a/common/image-android.c b/common/image-android.c
index 018c7594fe..e74d0aafca 100644
--- a/common/image-android.c
+++ b/common/image-android.c
@@ -72,7 +72,7 @@ int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify,
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 c6e8832d66..da4d007081 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -132,7 +132,7 @@ int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size)
of_len = *of_size + CONFIG_SYS_FDT_PAD;

/* If fdt_high is set use it to select the relocation address */
- fdt_high = getenv("fdt_high");
+ fdt_high = env_get("fdt_high");
if (fdt_high) {
void *desired_addr = (void *)simple_strtoul(fdt_high, NULL, 16);

@@ -156,8 +156,8 @@ int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size)
} else {
of_start =
(void *)(ulong) lmb_alloc_base(lmb, of_len, 0x1000,
- getenv_bootm_mapsize()
- + getenv_bootm_low());
+ env_get_bootm_mapsize()
+ + env_get_bootm_low());
}

if (of_start == NULL) {
diff --git a/common/image.c b/common/image.c
index 0f88984f2d..a058eb85e1 100644
--- a/common/image.c
+++ b/common/image.c
@@ -465,9 +465,9 @@ static int on_loadaddr(const char *name, const char *value, enum env_op op,
}
U_BOOT_ENV_CALLBACK(loadaddr, on_loadaddr);

-ulong getenv_bootm_low(void)
+ulong env_get_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;
@@ -482,11 +482,11 @@ ulong getenv_bootm_low(void)
#endif
}

-phys_size_t getenv_bootm_size(void)
+phys_size_t env_get_bootm_size(void)
{
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;
@@ -500,7 +500,7 @@ phys_size_t getenv_bootm_size(void)
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
@@ -509,10 +509,10 @@ phys_size_t getenv_bootm_size(void)
return size - (tmp - start);
}

-phys_size_t getenv_bootm_mapsize(void)
+phys_size_t env_get_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;
@@ -521,7 +521,7 @@ phys_size_t getenv_bootm_mapsize(void)
#if defined(CONFIG_SYS_BOOTMAPSZ)
return CONFIG_SYS_BOOTMAPSZ;
#else
- return getenv_bootm_size();
+ return env_get_bootm_size();
#endif
}

@@ -1224,7 +1224,8 @@ int boot_ramdisk_high(struct lmb *lmb, ulong rd_data, ulong rd_len,
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.
*/
@@ -1232,7 +1233,7 @@ int boot_ramdisk_high(struct lmb *lmb, ulong rd_data, ulong rd_len,
if (initrd_high == ~0)
initrd_copy_to_ram = 0;
} else {
- initrd_high = getenv_bootm_mapsize() + getenv_bootm_low();
+ initrd_high = env_get_bootm_mapsize() + env_get_bootm_low();
}

@@ -1505,7 +1506,7 @@ int boot_get_loadable(int argc, char * const argv[], bootm_headers_t *images,
* @cmd_end: pointer to a ulong variable, will hold cmdline end
*
* boot_get_cmdline() allocates space for kernel command line below
- * BOOTMAPSZ + getenv_bootm_low() address. If "bootargs" U-Boot environemnt
+ * BOOTMAPSZ + env_get_bootm_low() address. If "bootargs" U-Boot environemnt
* variable is present its contents is copied to allocated kernel
* command line.
*
@@ -1519,12 +1520,13 @@ int boot_get_cmdline(struct lmb *lmb, ulong *cmd_start, ulong *cmd_end)
char *s;

cmdline = (char *)(ulong)lmb_alloc_base(lmb, CONFIG_SYS_BARGSIZE, 0xf,
- getenv_bootm_mapsize() + getenv_bootm_low());
+ env_get_bootm_mapsize() + env_get_bootm_low());

if (cmdline == NULL)
return -1;

- if ((s = getenv("bootargs")) == NULL)
+ s = env_get("bootargs");
+ if (!s)
s = "";

strcpy(cmdline, s);
@@ -1545,7 +1547,7 @@ int boot_get_cmdline(struct lmb *lmb, ulong *cmd_start, ulong *cmd_end)
* @kbd: double pointer to board info data
*
* boot_get_kbd() allocates space for kernel copy of board info data below
- * BOOTMAPSZ + getenv_bootm_low() address and kernel board info is initialized
+ * BOOTMAPSZ + env_get_bootm_low() address and kernel board info is initialized
* with the current u-boot board info data.
*
* returns:
@@ -1555,7 +1557,7 @@ int boot_get_cmdline(struct lmb *lmb, ulong *cmd_start, ulong *cmd_end)
int boot_get_kbd(struct lmb *lmb, bd_t **kbd)
{
*kbd = (bd_t *)(ulong)lmb_alloc_base(lmb, sizeof(bd_t), 0xf,
- getenv_bootm_mapsize() + getenv_bootm_low());
+ env_get_bootm_mapsize() + env_get_bootm_low());
if (*kbd == NULL)
return -1;

diff --git a/common/lcd.c b/common/lcd.c
index 7e399cee2d..c3ff9599ed 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -223,7 +223,7 @@ void lcd_clear(void)
/* 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 07fc31b716..6a1159879e 100644
--- a/common/main.c
+++ b/common/main.c
@@ -25,7 +25,7 @@ static void run_preboot_environment_command(void)
#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 60a73311d9..c96e7bfceb 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -248,7 +248,7 @@ config SPL_ENV_SUPPORT
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 f5ec0fb396..2c974735b1 100644
--- a/common/spl/spl_dfu.c
+++ b/common/spl/spl_dfu.c
@@ -40,7 +40,7 @@ int spl_dfu_cmd(int usbctrl, char *dfu_alt_info, char *interface, char *devstr)

/* 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 f17c6b9494..559ba0b797 100644
--- a/common/spl/spl_ext.c
+++ b/common/spl/spl_ext.c
@@ -89,7 +89,7 @@ int spl_load_image_ext_os(struct spl_image_info *spl_image,
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) {
@@ -102,7 +102,7 @@ int spl_load_image_ext_os(struct spl_image_info *spl_image,
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 5e312160d9..60b85f082d 100644
--- a/common/spl/spl_fat.c
+++ b/common/spl/spl_fat.c
@@ -113,7 +113,7 @@ int spl_load_image_fat_os(struct spl_image_info *spl_image,
return err;

#if defined(CONFIG_SPL_ENV_SUPPORT) && defined(CONFIG_SPL_OS_BOOT)
- file = 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) {
@@ -121,7 +121,7 @@ int spl_load_image_fat_os(struct spl_image_info *spl_image,
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 89af437f2c..d251b3b654 100644
--- a/common/splash.c
+++ b/common/splash.c
@@ -60,7 +60,7 @@ __weak int splash_screen_prepare(void)
#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 867a798487..8c0ac581f7 100644
--- a/common/splash_source.c
+++ b/common/splash_source.c
@@ -220,7 +220,7 @@ static int splash_load_fs(struct splash_location *location, u32 bmp_load_addr)
loff_t actread;
char *splash_file;

- splash_file = getenv("splashfile");
+ splash_file = env_get("splashfile");
if (!splash_file)
splash_file = SPLASH_SOURCE_DEFAULT_FILE_NAME;

@@ -286,7 +286,7 @@ static struct splash_location *select_splash_location(
if (!locations || size == 0)
return NULL;

- env_splashsource = getenv("splashsource");
+ env_splashsource = env_get("splashsource");
if (env_splashsource == NULL)
return &locations[0];

@@ -383,7 +383,7 @@ int splash_source_load(struct splash_location *locations, uint size)
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 061a5541b1..974f4655e7 100644
--- a/common/update.c
+++ b/common/update.c
@@ -59,7 +59,7 @@ static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr)
/* save used globals and env variable */
saved_timeout_msecs = tftp_timeout_ms;
saved_timeout_count = tftp_timeout_count_max;
- saved_netretry = strdup(getenv("netretry"));
+ saved_netretry = strdup(env_get("netretry"));
saved_bootfile = strdup(net_boot_file_name);

/* set timeouts for auto-update */
@@ -254,7 +254,7 @@ int update_tftp(ulong addr, char *interface, char *devstring)
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);
@@ -264,7 +264,8 @@ int update_tftp(ulong addr, char *interface, char *devstring)
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 d135526e4f..b51e2c5a7d 100644
--- a/common/usb_hub.c
+++ b/common/usb_hub.c
@@ -131,7 +131,7 @@ static void usb_hub_power_on(struct usb_hub_device *hub)
* but allow this time to be increased via env variable as some
* devices break the spec and require longer warm-up times
*/
- env = 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 d2d29cc98f..8cbdba6ac2 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -515,7 +515,7 @@ static int probe_usb_keyboard(struct usb_device *dev)
if (error)
return error;

- stdinname = getenv("stdin");
+ stdinname = env_get("stdin");
#if CONFIG_IS_ENABLED(CONSOLE_MUX)
error = iomux_doenv(stdin, stdinname);
if (error)
@@ -582,7 +582,7 @@ int usb_kbd_deregister(int force)
if (stdio_deregister_dev(dev, force) != 0)
return 1;
#if CONFIG_IS_ENABLED(CONSOLE_MUX)
- if (iomux_doenv(stdin, getenv("stdin")) != 0)
+ if (iomux_doenv(stdin, env_get("stdin")) != 0)
return 1;
#endif
#ifdef CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE
@@ -627,7 +627,7 @@ static int usb_kbd_remove(struct udevice *dev)
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 491b02dc9c..05d07d850b 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -452,7 +452,7 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str,
/* 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 25fe56ce42..f8dae008d7 100644
--- a/disk/part_amiga.c
+++ b/disk/part_amiga.c
@@ -132,7 +132,7 @@ struct rigid_disk_block *get_rdisk(struct blk_desc *dev_desc)
int limit;
char *s;

- s = getenv("amiga_scanlimit");
+ s = env_get("amiga_scanlimit");
if (s)
limit = simple_strtoul(s, NULL, 10);
else
@@ -172,7 +172,7 @@ struct bootcode_block *get_bootcode(struct blk_desc *dev_desc)
int limit;
char *s;

- s = getenv("amiga_scanlimit");
+ s = env_get("amiga_scanlimit");
if (s)
limit = simple_strtoul(s, NULL, 10);
else
diff --git a/doc/README.enetaddr b/doc/README.enetaddr
index 241d528ff7..f926485986 100644
--- a/doc/README.enetaddr
+++ b/doc/README.enetaddr
@@ -84,7 +84,7 @@ uchar enetaddr[6];
eth_parse_enetaddr(addr, enetaddr);
/* enetaddr now equals { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 } */

- * int eth_getenv_enetaddr(char *name, uchar *enetaddr);
+ * int eth_env_get_enetaddr(char *name, uchar *enetaddr);

Look up an environment variable and convert the stored address. If the address
is valid, then the function returns 1. Otherwise, the function returns 0. In
@@ -92,7 +92,7 @@ all cases, the enetaddr memory is initialized. If the env var is not found,
then it is set to all zeros. The common function is_valid_ethaddr() is used
to determine address validity.
uchar enetaddr[6];
-if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
+if (!eth_env_get_enetaddr("ethaddr", enetaddr)) {
/* "ethaddr" is not set in the environment */
... try and setup "ethaddr" in the env ...
}
diff --git a/drivers/bootcount/bootcount_env.c b/drivers/bootcount/bootcount_env.c
index ec5f942676..c3618d3a59 100644
--- a/drivers/bootcount/bootcount_env.c
+++ b/drivers/bootcount/bootcount_env.c
@@ -10,7 +10,7 @@

void bootcount_store(ulong a)
{
- int upgrade_available = getenv_ulong("upgrade_available", 10, 0);
+ int upgrade_available = env_get_ulong("upgrade_available", 10, 0);

if (upgrade_available) {
env_set_ulong("bootcount", a);
@@ -20,11 +20,11 @@ void bootcount_store(ulong a)

ulong bootcount_load(void)
{
- int upgrade_available = getenv_ulong("upgrade_available", 10, 0);
+ int upgrade_available = env_get_ulong("upgrade_available", 10, 0);
ulong val = 0;

if (upgrade_available)
- val = getenv_ulong("bootcount", 10, 0);
+ val = env_get_ulong("bootcount", 10, 0);

return val;
}
diff --git a/drivers/ddr/fsl/fsl_ddr_gen4.c b/drivers/ddr/fsl/fsl_ddr_gen4.c
index 3349fc5c3b..058c9b9da8 100644
--- a/drivers/ddr/fsl/fsl_ddr_gen4.c
+++ b/drivers/ddr/fsl/fsl_ddr_gen4.c
@@ -469,7 +469,7 @@ step2:
#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);
diff --git a/drivers/ddr/fsl/interactive.c b/drivers/ddr/fsl/interactive.c
index 653bbabc95..c99bd2fb6d 100644
--- a/drivers/ddr/fsl/interactive.c
+++ b/drivers/ddr/fsl/interactive.c
@@ -1861,7 +1861,7 @@ int fsl_ddr_interactive_env_var_exists(void)
{
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;
- }
}

/*
diff --git a/drivers/ddr/fsl/options.c b/drivers/ddr/fsl/options.c
index 20edd2dc28..7ef342f625 100644
--- a/drivers/ddr/fsl/options.c
+++ b/drivers/ddr/fsl/options.c
@@ -18,7 +18,7 @@
* 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 later.
*/

/* Board-specific functions defined in each board's ddr.c */
@@ -755,7 +755,7 @@ unsigned int populate_memctl_options(const common_timing_params_t *common_dimm,
* 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) || \
@@ -1399,7 +1399,7 @@ int fsl_use_spd(void)
* 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 ceb33e35ee..856a793c17 100644
--- a/drivers/dfu/dfu.c
+++ b/drivers/dfu/dfu.c
@@ -62,7 +62,7 @@ int dfu_init_env_entities(char *interface, char *devstr)
#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;
@@ -101,7 +101,7 @@ unsigned char *dfu_get_buf(struct dfu_entity *dfu)
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);

@@ -123,7 +123,7 @@ static char *dfu_get_hash_algo(void)
{
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 926ccbd2ef..79135563ae 100644
--- a/drivers/dfu/dfu_mmc.c
+++ b/drivers/dfu/dfu_mmc.c
@@ -161,7 +161,7 @@ static int mmc_file_op(enum dfu_op op, struct dfu_entity *dfu,
}

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 0fd25b17ec..18476e97d1 100644
--- a/drivers/input/i8042.c
+++ b/drivers/input/i8042.c
@@ -274,7 +274,7 @@ static int i8042_start(struct udevice *dev)

/* 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 011667fedd..26da3a95ff 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -652,7 +652,7 @@ int input_stdio_register(struct stdio_dev *dev)
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))
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 048a51785e..42bc2efd90 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -2353,7 +2353,7 @@ unsigned long flash_init (void)
#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/dc2114x.c b/drivers/net/dc2114x.c
index 8245cf51cc..f38f36beb1 100644
--- a/drivers/net/dc2114x.c
+++ b/drivers/net/dc2114x.c
@@ -750,7 +750,7 @@ static void update_srom(struct eth_device *dev, bd_t *bis)
uchar enetaddr[6];

/* Ethernet Addr... */
- if (!eth_getenv_enetaddr("ethaddr", enetaddr))
+ if (!eth_env_get_enetaddr("ethaddr", enetaddr))
return;
eeprom[0x0a] = (enetaddr[1] << 8) | enetaddr[0];
eeprom[0x0b] = (enetaddr[3] << 8) | enetaddr[2];
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 424c347e0e..797e34f7cc 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -1096,7 +1096,7 @@ static int fec_probe(bd_t *bd, int dev_id, uint32_t base_addr,
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 5aeeb87282..3245bee473 100644
--- a/drivers/net/fm/b4860.c
+++ b/drivers/net/fm/b4860.c
@@ -97,7 +97,7 @@ phy_interface_t fman_port_enet_if(enum fm_port port)
* 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 9918d8089a..5920fecea1 100644
--- a/drivers/net/fm/fdt.c
+++ b/drivers/net/fm/fdt.c
@@ -36,7 +36,7 @@ void fdt_fixup_fman_firmware(void *blob)
return;

/* If the environment variable is not set, then exit silently */
- p = getenv("fman_ucode");
+ p = env_get("fman_ucode");
if (!p)
return;

diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c
index 8bf25c7040..142aeecfe9 100644
--- a/drivers/net/fsl-mc/mc.c
+++ b/drivers/net/fsl-mc/mc.c
@@ -190,8 +190,8 @@ static int mc_fixup_mac_addr(void *blob, int nodeoffset,
/* MAC address property present */
if (fdt_get_property(blob, nodeoffset, propname, NULL)) {
/* u-boot MAC addr randomly assigned - leave the present one */
- if (!eth_getenv_enetaddr_by_index("eth", eth_dev->index,
- env_enetaddr))
+ if (!eth_env_get_enetaddr_by_index("eth", eth_dev->index,
+ env_enetaddr))
return err;
} else {
size = MC_DT_INCREASE_SIZE + strlen(propname) + len;
@@ -530,7 +530,7 @@ static unsigned long get_mc_boot_timeout_ms(void)
{
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);
@@ -815,7 +815,7 @@ unsigned long mc_get_dram_block_size(void)
{
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,
@@ -1511,7 +1511,7 @@ void mc_env_boot(void)
* 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 */
diff --git a/drivers/net/fsl_mcdmafec.c b/drivers/net/fsl_mcdmafec.c
index 628b420add..26c714cc04 100644
--- a/drivers/net/fsl_mcdmafec.c
+++ b/drivers/net/fsl_mcdmafec.c
@@ -383,9 +383,9 @@ static int fec_init(struct eth_device *dev, bd_t * bd)

/* Set station address */
if ((u32) fecp == CONFIG_SYS_FEC0_IOBASE)
- eth_getenv_enetaddr("ethaddr", enetaddr);
+ eth_env_get_enetaddr("ethaddr", enetaddr);
else
- eth_getenv_enetaddr("eth1addr", enetaddr);
+ eth_env_get_enetaddr("eth1addr", enetaddr);
fec_set_hwaddr(fecp, enetaddr);

/* Set Opcode/Pause Duration Register */
diff --git a/drivers/net/ftgmac100.c b/drivers/net/ftgmac100.c
index 5ccc4beda8..d0939e93dc 100644
--- a/drivers/net/ftgmac100.c
+++ b/drivers/net/ftgmac100.c
@@ -346,7 +346,7 @@ static void ftgmac100_set_mac(struct eth_device *dev,

static void ftgmac100_set_mac_from_env(struct eth_device *dev)
{
- eth_getenv_enetaddr("ethaddr", dev->enetaddr);
+ eth_env_get_enetaddr("ethaddr", dev->enetaddr);

ftgmac100_set_mac(dev, dev->enetaddr);
}
diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c
index cd24a21f04..f231e6b33b 100644
--- a/drivers/net/ftmac100.c
+++ b/drivers/net/ftmac100.c
@@ -355,7 +355,7 @@ static int ftmac100_free_pkt(struct udevice *dev, uchar *packet, int length)
int ftmac100_read_rom_hwaddr(struct udevice *dev)
{
struct eth_pdata *pdata = dev_get_platdata(dev);
- eth_getenv_enetaddr("ethaddr", pdata->enetaddr);
+ eth_env_get_enetaddr("ethaddr", pdata->enetaddr);
return 0;
}

diff --git a/drivers/net/lan91c96.c b/drivers/net/lan91c96.c
index 255c7010cc..a9fc74bdee 100644
--- a/drivers/net/lan91c96.c
+++ b/drivers/net/lan91c96.c
@@ -704,7 +704,7 @@ static int smc_get_ethaddr(bd_t *bd, struct eth_device *dev)
{
uchar v_mac[6];

- if (!eth_getenv_enetaddr("ethaddr", v_mac)) {
+ if (!eth_env_get_enetaddr("ethaddr", v_mac)) {
/* get ROM mac value if any */
if (!get_rom_mac(dev, v_mac)) {
printf("\n*** ERROR: ethaddr is NOT set !!\n");
diff --git a/drivers/net/mcffec.c b/drivers/net/mcffec.c
index e1b06b25d7..39a6747320 100644
--- a/drivers/net/mcffec.c
+++ b/drivers/net/mcffec.c
@@ -428,25 +428,25 @@ int fec_init(struct eth_device *dev, bd_t * bd)
if ((u32) fecp == CONFIG_SYS_FEC0_IOBASE) {
#ifdef CONFIG_SYS_FEC1_IOBASE
volatile fec_t *fecp1 = (fec_t *) (CONFIG_SYS_FEC1_IOBASE);
- eth_getenv_enetaddr("eth1addr", ea);
+ eth_env_get_enetaddr("eth1addr", ea);
fecp1->palr =
(ea[0] << 24) | (ea[1] << 16) | (ea[2] << 8) | (ea[3]);
fecp1->paur = (ea[4] << 24) | (ea[5] << 16);
#endif
- eth_getenv_enetaddr("ethaddr", ea);
+ eth_env_get_enetaddr("ethaddr", ea);
fecp->palr =
(ea[0] << 24) | (ea[1] << 16) | (ea[2] << 8) | (ea[3]);
fecp->paur = (ea[4] << 24) | (ea[5] << 16);
} else {
#ifdef CONFIG_SYS_FEC0_IOBASE
volatile fec_t *fecp0 = (fec_t *) (CONFIG_SYS_FEC0_IOBASE);
- eth_getenv_enetaddr("ethaddr", ea);
+ eth_env_get_enetaddr("ethaddr", ea);
fecp0->palr =
(ea[0] << 24) | (ea[1] << 16) | (ea[2] << 8) | (ea[3]);
fecp0->paur = (ea[4] << 24) | (ea[5] << 16);
#endif
#ifdef CONFIG_SYS_FEC1_IOBASE
- eth_getenv_enetaddr("eth1addr", ea);
+ eth_env_get_enetaddr("eth1addr", ea);
fecp->palr =
(ea[0] << 24) | (ea[1] << 16) | (ea[2] << 8) | (ea[3]);
fecp->paur = (ea[4] << 24) | (ea[5] << 16);
diff --git a/drivers/net/ne2000_base.c b/drivers/net/ne2000_base.c
index f6e5eafba5..fb088e06a4 100644
--- a/drivers/net/ne2000_base.c
+++ b/drivers/net/ne2000_base.c
@@ -715,12 +715,12 @@ static int ne2k_setup_driver(struct eth_device *dev)
* to the MAC address value in the environment, so we do not read
* it from the prom or eeprom if it is specified in the environment.
*/
- if (!eth_getenv_enetaddr("ethaddr", dev->enetaddr)) {
+ if (!eth_env_get_enetaddr("ethaddr", dev->enetaddr)) {
/* If the MAC address is not in the environment, get it: */
if (!get_prom(dev->enetaddr, nic.base)) /* get MAC from prom */
dp83902a_init(dev->enetaddr); /* fallback: seeprom */
/* And write it into the environment otherwise eth_write_hwaddr
- * returns -1 due to eth_getenv_enetaddr_by_index() failing,
+ * returns -1 due to eth_env_get_enetaddr_by_index() failing,
* and this causes "Warning: failed to set MAC address", and
* cmd_bdinfo has no ethaddr value which it can show: */
eth_env_set_enetaddr("ethaddr", dev->enetaddr);
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 3500047577..e9dbedf326 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -62,8 +62,8 @@ static int is_broadcast(struct in_addr ip)

/* update only when the environment has changed */
if (env_changed_id != env_id) {
- netmask = getenv_ip("netmask");
- our_ip = getenv_ip("ipaddr");
+ netmask = env_get_ip("netmask");
+ our_ip = env_get_ip("ipaddr");

env_changed_id = env_id;
}
@@ -82,11 +82,11 @@ static int refresh_settings_from_env(void)

/* update only when the environment has changed */
if (env_changed_id != env_id) {
- if (getenv("ncip")) {
- nc_ip = getenv_ip("ncip");
+ if (env_get("ncip")) {
+ nc_ip = env_get_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;
@@ -95,10 +95,10 @@ static int refresh_settings_from_env(void)
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);

diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 0e4a4ebcc6..15cae957e7 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -357,7 +357,7 @@ static int ksz9021_config(struct phy_device *phydev)
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 */
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index a7c265b980..970d730e56 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -578,7 +578,7 @@ int sh_eth_initialize(bd_t *bd)
if (retval < 0)
return retval;

- if (!eth_getenv_enetaddr("ethaddr", dev->enetaddr))
+ if (!eth_env_get_enetaddr("ethaddr", dev->enetaddr))
puts("Please set MAC address\n");

return ret;
diff --git a/drivers/pci/fsl_pci_init.c b/drivers/pci/fsl_pci_init.c
index af20cf0f3e..df76a94144 100644
--- a/drivers/pci/fsl_pci_init.c
+++ b/drivers/pci/fsl_pci_init.c
@@ -390,7 +390,7 @@ void fsl_pci_init(struct pci_controller *hose, struct fsl_pci_info *pci_info)

#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);

@@ -673,7 +673,7 @@ int fsl_pci_init_port(struct fsl_pci_info *pci_info,
#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 6b36c187b5..bbc7dab366 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -427,7 +427,7 @@ int pci_hose_scan(struct pci_controller *hose)

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++)
@@ -459,7 +459,7 @@ void pci_init(void)
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()... */
diff --git a/drivers/pci/pci_common.c b/drivers/pci/pci_common.c
index 6526de80db..faf25d96cb 100644
--- a/drivers/pci/pci_common.c
+++ b/drivers/pci/pci_common.c
@@ -89,7 +89,7 @@ __weak int pci_skip_dev(struct pci_controller *hose, pci_dev_t dev)
/*
* 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 95083f0d72..2ddfd4ea5c 100644
--- a/drivers/rtc/m41t60.c
+++ b/drivers/rtc/m41t60.c
@@ -200,7 +200,7 @@ int rtc_set(struct rtc_time *tmp)
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;
diff --git a/drivers/serial/usbtty.c b/drivers/serial/usbtty.c
index 29799dce93..353109c070 100644
--- a/drivers/serial/usbtty.c
+++ b/drivers/serial/usbtty.c
@@ -526,9 +526,9 @@ int drv_usbtty_init (void)
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",
@@ -540,10 +540,9 @@ int drv_usbtty_init (void)

/* 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... */
diff --git a/drivers/usb/gadget/designware_udc.c b/drivers/usb/gadget/designware_udc.c
index 0db7a3b6c1..a25f5019e8 100644
--- a/drivers/usb/gadget/designware_udc.c
+++ b/drivers/usb/gadget/designware_udc.c
@@ -601,7 +601,7 @@ void udc_setup_ep(struct usb_device_instance *device,
if ((ep != 0) && (udc_device->device_state < STATE_ADDRESSED))
return;

- tt = getenv("usbtty");
+ tt = env_get("usbtty");
if (!tt)
tt = "generic";

diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index d0105372cf..2cf5c8d31e 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -2384,12 +2384,12 @@ static int _usb_eth_init(struct ether_priv *priv)
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)) {
@@ -2420,8 +2420,8 @@ static int _usb_eth_init(struct ether_priv *priv)
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) {
diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
index dfa4359577..bc4be712da 100644
--- a/drivers/usb/gadget/f_dfu.c
+++ b/drivers/usb/gadget/f_dfu.c
@@ -725,7 +725,7 @@ static int dfu_bind(struct usb_configuration *c, struct usb_function *f)

cdev->req->context = f_dfu;

- s = getenv("serial#");
+ s = env_get("serial#");
if (s)
g_dnl_set_serialnumber((char *)s);

diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 7cd6d24bf5..d05b74b2d2 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -212,7 +212,7 @@ static int fastboot_bind(struct usb_configuration *c, struct usb_function *f)
f->hs_descriptors = fb_hs_function;
}

- s = getenv("serial#");
+ s = env_get("serial#");
if (s)
g_dnl_set_serialnumber((char *)s);

@@ -426,7 +426,7 @@ static void cb_getvar(struct usb_ep *ep, struct usb_request *req)
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
@@ -441,7 +441,7 @@ static void cb_getvar(struct usb_ep *ep, struct usb_request *req)
}

sprintf(envstr, "fastboot.%s", cmd);
- s = getenv(envstr);
+ s = env_get(envstr);
if (s) {
strncat(response, s, chars_left);
} else {
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index b57c6cd35a..62c431b99f 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -225,7 +225,7 @@ static int ehci_fsl_init(int index, struct usb_ehci *ehci,
"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
diff --git a/drivers/video/ati_radeon_fb.c b/drivers/video/ati_radeon_fb.c
index 07a29eaba1..5b6c42291c 100644
--- a/drivers/video/ati_radeon_fb.c
+++ b/drivers/video/ati_radeon_fb.c
@@ -637,7 +637,8 @@ void *video_hw_init(void)

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);
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
index f54802052e..75d4388943 100644
--- a/drivers/video/cfb_console.c
+++ b/drivers/video/cfb_console.c
@@ -1866,7 +1866,7 @@ static void *video_logo(void)
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)
diff --git a/drivers/video/ct69000.c b/drivers/video/ct69000.c
index a74e4e6868..5148413773 100644
--- a/drivers/video/ct69000.c
+++ b/drivers/video/ct69000.c
@@ -918,7 +918,8 @@ video_hw_init (void)
tmp = 0;
videomode = 0x301;
/* 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);
diff --git a/drivers/video/mb862xx.c b/drivers/video/mb862xx.c
index 1c74e97c5e..e0565e1d2e 100644
--- a/drivers/video/mb862xx.c
+++ b/drivers/video/mb862xx.c
@@ -246,7 +246,8 @@ unsigned int card_init (void)
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 51d06d6677..78e595ea4a 100644
--- a/drivers/video/mx3fb.c
+++ b/drivers/video/mx3fb.c
@@ -816,7 +816,7 @@ void *video_hw_init(void)

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 0ddce3db58..9d810bab31 100644
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
@@ -161,7 +161,7 @@ void *video_hw_init(void)
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;
diff --git a/drivers/video/videomodes.c b/drivers/video/videomodes.c
index cf71ad120e..6d96b33f20 100644
--- a/drivers/video/videomodes.c
+++ b/drivers/video/videomodes.c
@@ -165,7 +165,8 @@ int video_get_params (struct ctfb_res_modes *pPar, char *penv)
/* 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;

/*
@@ -234,7 +235,7 @@ int video_get_params (struct ctfb_res_modes *pPar, char *penv)
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 1957cc1996..be70980f04 100644
--- a/env/callback.c
+++ b/env/callback.c
@@ -51,7 +51,7 @@ void env_callback_init(ENTRY *var_entry)
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 b63b5fc12f..a30c04cf2c 100644
--- a/env/common.c
+++ b/env/common.c
@@ -31,9 +31,9 @@ struct hsearch_data env_htab = {
* Read an environment variable as a boolean
* Return -1 if variable does not exist (default to true)
*/
-int getenv_yesno(const char *var)
+int env_get_yesno(const char *var)
{
- char *s = getenv(var);
+ char *s = env_get(var);

if (s == NULL)
return -1;
@@ -44,7 +44,7 @@ int getenv_yesno(const char *var)
/*
* Look up the variable from the default environment
*/
-char *getenv_default(const char *name)
+char *env_get_default(const char *name)
{
char *ret_val;
unsigned long really_valid = gd->env_valid;
@@ -53,7 +53,7 @@ char *getenv_default(const char *name)
/* 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 3c50620cb3..4b0ddb6bb8 100644
--- a/env/flags.c
+++ b/env/flags.c
@@ -15,7 +15,7 @@
#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>
@@ -308,7 +308,7 @@ static inline int env_flags_lookup(const char *flags_list, const char *name,
*/
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))
@@ -325,7 +325,7 @@ enum env_flags_vartype env_flags_get_type(const char *name)
*/
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))
@@ -426,7 +426,7 @@ void env_flags_init(ENTRY *var_entry)
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 */
@@ -541,7 +541,7 @@ int env_flags_validate(const ENTRY *item, const char *newval, enum env_op op,
return 1;
} else if (item->flags &
ENV_FLAGS_VARACCESS_PREVENT_NONDEF_OVERWR) {
- const char *defval = getenv_default(name);
+ const char *defval = env_get_default(name);

if (defval == NULL)
defval = "";
diff --git a/fs/fs.c b/fs/fs.c
index 055dffdafd..13cd3626c6 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -379,7 +379,7 @@ int do_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
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
@@ -388,7 +388,7 @@ int do_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
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 9deed77378..5416041243 100644
--- a/include/_exports.h
+++ b/include/_exports.h
@@ -31,7 +31,7 @@
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)
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index d8d1b444f2..9238c7988b 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -76,7 +76,7 @@ typedef struct global_data {
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 57f53f54ed..ea24db68ed 100644
--- a/include/common.h
+++ b/include/common.h
@@ -310,16 +310,45 @@ int env_init (void);
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);
-ulong getenv_ulong(const char *name, int base, ulong default_val);
+/**
+ * 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);
+
+/**
+ * env_get_ulong() - Return an environment variable as an integer value
+ *
+ * Most U-Boot environment variables store hex values. For those which store
+ * (e.g.) base-10 integers, this function can be used to read the value.
+ *
+ * @name: Variable to look up
+ * @base: Base to use (e.g. 10 for base 10, 2 for binary)
+ * @default_val: Default value to return if no value is found
+ * @return the value found, or @default_val if none
+ */
+ulong env_get_ulong(const char *name, int base, ulong default_val);

/**
- * getenv_hex() - Return an environment variable as a hex value
+ * env_get_hex() - Return an environment variable as a hex value
*
* Decode an environment as a hex number (it may or may not have a 0x
* prefix). If the environment variable cannot be found, or does not start
@@ -328,13 +357,13 @@ ulong getenv_ulong(const char *name, int base, ulong default_val);
* @varname: Variable to decode
* @default_val: Value to return on error
*/
-ulong getenv_hex(const char *varname, ulong default_val);
+ulong env_get_hex(const char *varname, ulong default_val);

/*
* Read an environment variable as a boolean
* Return -1 if variable does not exist (default to true)
*/
-int getenv_yesno(const char *var);
+int env_get_yesno(const char *var);

/**
* env_set() - set an environment variable
@@ -718,9 +747,9 @@ int zzip(void *dst, unsigned long *lenp, unsigned char *src,

/* lib/net_utils.c */
#include <net.h>
-static inline struct in_addr getenv_ip(char *var)
+static inline struct in_addr env_get_ip(char *var)
{
- return string_to_ip(getenv(var));
+ return string_to_ip(env_get(var));
}

int pcmcia_init (void);
diff --git a/include/environment.h b/include/environment.h
index faf4d6adbb..dc1293dfb2 100644
--- a/include/environment.h
+++ b/include/environment.h
@@ -282,7 +282,7 @@ extern struct hsearch_data env_htab;
void env_crc_update(void);

/* Look up the variable from the default environment */
-char *getenv_default(const char *name);
+char *env_get_default(const char *name);

/* [re]set to the default environment */
void set_default_env(const char *s);
diff --git a/include/exports.h b/include/exports.h
index 6522d78fac..ebe81d914c 100644
--- a/include/exports.h
+++ b/include/exports.h
@@ -27,7 +27,7 @@ unsigned long get_timer(unsigned long);
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 c6f1513220..1f4bfda2f3 100644
--- a/include/image.h
+++ b/include/image.h
@@ -373,7 +373,7 @@ typedef struct bootm_headers {
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)
@@ -769,9 +769,9 @@ static inline void image_set_name(image_header_t *hdr, const char *name)
int image_check_hcrc(const image_header_t *hdr);
int image_check_dcrc(const image_header_t *hdr);
#ifndef USE_HOSTCC
-ulong getenv_bootm_low(void);
-phys_size_t getenv_bootm_size(void);
-phys_size_t getenv_bootm_mapsize(void);
+ulong env_get_bootm_low(void);
+phys_size_t env_get_bootm_size(void);
+phys_size_t env_get_bootm_mapsize(void);
#endif
void memmove_wd(void *to, void *from, size_t len, ulong chunksz);

diff --git a/include/net.h b/include/net.h
index 65ab7b2c79..2647769cb6 100644
--- a/include/net.h
+++ b/include/net.h
@@ -239,7 +239,7 @@ void eth_set_current(void); /* set nterface to ethcur var */

int eth_get_dev_index(void); /* get the device index */
void eth_parse_enetaddr(const char *addr, uchar *enetaddr);
-int eth_getenv_enetaddr(const char *name, uchar *enetaddr);
+int eth_env_get_enetaddr(const char *name, uchar *enetaddr);
int eth_env_set_enetaddr(const char *name, const uchar *enetaddr);

/**
@@ -275,7 +275,7 @@ int usb_ether_init(void);
* Returns:
* Return true if the address is valid.
*/
-int eth_getenv_enetaddr_by_index(const char *base_name, int index,
+int eth_env_get_enetaddr_by_index(const char *base_name, int index,
uchar *enetaddr);

int eth_init(void); /* Initialize the device */
@@ -834,7 +834,7 @@ void vlan_to_string(ushort x, char *s);
ushort string_to_vlan(const char *s);

/* read a VLAN id from an environment variable */
-ushort getenv_vlan(char *);
+ushort env_get_vlan(char *);

/* copy a filename (allow for "..." notation, limit length) */
void copy_filename(char *dst, const char *src, int size);
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index fbb48bf74d..31b29b1016 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -1246,7 +1246,7 @@ int fdtdec_setup(void)
# endif
# ifndef CONFIG_SPL_BUILD
/* Allow the early environment to override the fdt address */
- gd->fdt_blob = (void *)getenv_ulong("fdtcontroladdr", 16,
+ gd->fdt_blob = (void *)env_get_ulong("fdtcontroladdr", 16,
(uintptr_t)gd->fdt_blob);
# endif
#endif
diff --git a/lib/smbios.c b/lib/smbios.c
index 22ca247fec..8f19ad89c1 100644
--- a/lib/smbios.c
+++ b/lib/smbios.c
@@ -112,7 +112,7 @@ static int smbios_write_type1(ulong *current, int handle)
{
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 579515687b..73370a13fe 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -414,7 +414,7 @@ static void bootp_timeout_handler(void)
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;
@@ -488,7 +488,7 @@ static int dhcp_extended(u8 *e, int message_type, struct in_addr server_ip,
*e++ = tmp & 0xff;
}
#if defined(CONFIG_BOOTP_SEND_HOSTNAME)
- hostname = getenv("hostname");
+ hostname = env_get("hostname");
if (hostname) {
int hostnamelen = strlen(hostname);

@@ -503,8 +503,8 @@ static int dhcp_extended(u8 *e, int message_type, struct in_addr server_ip,
clientarch = CONFIG_BOOTP_PXE_CLIENTARCH;
#endif

- if (getenv("bootp_arch"))
- clientarch = getenv_ulong("bootp_arch", 16, clientarch);
+ if (env_get("bootp_arch"))
+ clientarch = env_get_ulong("bootp_arch", 16, clientarch);

if (clientarch > 0) {
*e++ = 93; /* Client System Architecture */
@@ -520,7 +520,7 @@ static int dhcp_extended(u8 *e, int message_type, struct in_addr server_ip,
*e++ = 0; /* minor revision */

#ifdef CONFIG_LIB_UUID
- uuid = getenv("pxeuuid");
+ uuid = env_get("pxeuuid");

if (uuid) {
if (uuid_str_valid(uuid)) {
@@ -713,7 +713,7 @@ void bootp_request(void)
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 d356576210..d30b04ba86 100644
--- a/net/eth-uclass.c
+++ b/net/eth-uclass.c
@@ -241,8 +241,8 @@ U_BOOT_ENV_CALLBACK(ethaddr, on_ethaddr);

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;
@@ -401,7 +401,7 @@ int eth_initialize(void)
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)
@@ -495,7 +495,7 @@ static int eth_post_probe(struct udevice *dev)
if (eth_get_ops(dev)->read_rom_hwaddr)
eth_get_ops(dev)->read_rom_hwaddr(dev);

- eth_getenv_enetaddr_by_index("eth", dev->seq, env_enetaddr);
+ eth_env_get_enetaddr_by_index("eth", dev->seq, env_enetaddr);
if (!is_zero_ethaddr(env_enetaddr)) {
if (!is_zero_ethaddr(pdata->enetaddr) &&
memcmp(pdata->enetaddr, env_enetaddr, ARP_HLEN)) {
diff --git a/net/eth_common.c b/net/eth_common.c
index 7b36532ee1..66d0d22966 100644
--- a/net/eth_common.c
+++ b/net/eth_common.c
@@ -24,9 +24,9 @@ void eth_parse_enetaddr(const char *addr, uchar *enetaddr)
}
}

-int eth_getenv_enetaddr(const char *name, uchar *enetaddr)
+int eth_env_get_enetaddr(const char *name, uchar *enetaddr)
{
- eth_parse_enetaddr(getenv(name), enetaddr);
+ eth_parse_enetaddr(env_get(name), enetaddr);
return is_valid_ethaddr(enetaddr);
}

@@ -34,7 +34,7 @@ int eth_env_set_enetaddr(const char *name, const uchar *enetaddr)
{
char buf[ARP_HLEN_ASCII + 1];

- if (eth_getenv_enetaddr(name, (uchar *)buf))
+ if (eth_env_get_enetaddr(name, (uchar *)buf))
return -EEXIST;

sprintf(buf, "%pM", enetaddr);
@@ -42,12 +42,12 @@ int eth_env_set_enetaddr(const char *name, const uchar *enetaddr)
return env_set(name, buf);
}

-int eth_getenv_enetaddr_by_index(const char *base_name, int index,
+int eth_env_get_enetaddr_by_index(const char *base_name, int index,
uchar *enetaddr)
{
char enetvar[32];
sprintf(enetvar, index ? "%s%daddr" : "%saddr", base_name, index);
- return eth_getenv_enetaddr(enetvar, enetaddr);
+ return eth_env_get_enetaddr(enetvar, enetaddr);
}

int eth_env_set_enetaddr_by_index(const char *base_name, int index,
@@ -76,13 +76,13 @@ int eth_mac_skip(int index)
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;

/*
@@ -90,7 +90,7 @@ void eth_current_changed(void)
* 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;

@@ -116,7 +116,7 @@ void eth_try_another(int first_restart)
* 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;

@@ -142,12 +142,12 @@ void eth_set_current(void)

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 2608302648..be0cf64a3d 100644
--- a/net/eth_legacy.c
+++ b/net/eth_legacy.c
@@ -137,7 +137,7 @@ int eth_write_hwaddr(struct eth_device *dev, const char *base_name,
unsigned char env_enetaddr[ARP_HLEN];
int ret = 0;

- eth_getenv_enetaddr_by_index(base_name, eth_number, env_enetaddr);
+ eth_env_get_enetaddr_by_index(base_name, eth_number, env_enetaddr);

if (!is_zero_ethaddr(env_enetaddr)) {
if (!is_zero_ethaddr(dev->enetaddr) &&
@@ -261,7 +261,7 @@ int eth_initialize(void)
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/link_local.c b/net/link_local.c
index dfd240dfbc..31cdef4083 100644
--- a/net/link_local.c
+++ b/net/link_local.c
@@ -104,7 +104,7 @@ static void configure_wait(void)

void link_local_start(void)
{
- ip = getenv_ip("llipaddr");
+ ip = env_get_ip("llipaddr");
if (ip.s_addr != 0 &&
(ntohl(ip.s_addr) & IN_CLASSB_NET) != LINKLOCAL_ADDR) {
puts("invalid link address");
diff --git a/net/net.c b/net/net.c
index 2fed28092d..ebadd679c8 100644
--- a/net/net.c
+++ b/net/net.c
@@ -319,7 +319,7 @@ U_BOOT_ENV_CALLBACK(dnsip, on_dnsip);
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) {
/*
@@ -329,7 +329,7 @@ void net_auto_load(void)
return;
}
#endif
- if (getenv_yesno("autoload") == 0) {
+ if (env_get_yesno("autoload") == 0) {
/*
* Just use BOOTP/RARP to configure system;
* Do not use TFTP to load the bootfile.
@@ -668,7 +668,7 @@ int net_start_again(void)
unsigned long retrycnt = 0;
int ret;

- nretry = getenv("netretry");
+ nretry = env_get("netretry");
if (nretry) {
if (!strcmp(nretry, "yes"))
retry_forever = 1;
@@ -1536,7 +1536,7 @@ ushort string_to_vlan(const char *s)
return htons(id);
}

-ushort getenv_vlan(char *var)
+ushort env_get_vlan(char *var)
{
- return string_to_vlan(getenv(var));
+ return string_to_vlan(env_get(var));
}
diff --git a/net/net_rand.h b/net/net_rand.h
index ba9d0642cf..4b31227cee 100644
--- a/net/net_rand.h
+++ b/net/net_rand.h
@@ -20,7 +20,7 @@ static inline unsigned int seed_mac(void)
unsigned int seed;

/* get our mac */
- eth_getenv_enetaddr("ethaddr", enetaddr);
+ eth_env_get_enetaddr("ethaddr", enetaddr);

seed = enetaddr[5];
seed ^= enetaddr[4] << 8;
diff --git a/net/tftp.c b/net/tftp.c
index ced45ec1f1..f498263376 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -706,11 +706,11 @@ void tftp_start(enum proto_t protocol)
* 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);

@@ -720,7 +720,7 @@ void tftp_start(enum proto_t protocol)
timeout_ms = 1000;
}

- ep = getenv("tftptimeoutcountmax");
+ ep = env_get("tftptimeoutcountmax");
if (ep != NULL)
tftp_timeout_count_max = simple_strtol(ep, NULL, 10);

@@ -822,10 +822,10 @@ void tftp_start(enum proto_t protocol)
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 8c2c822acb..8fef0c3412 100644
--- a/post/post.c
+++ b/post/post.c
@@ -180,7 +180,7 @@ static void post_get_env_flags(int *test_flags)
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 21283eb357..f76d52569d 100644
--- a/test/command_ut.c
+++ b/test/command_ut.c
@@ -19,16 +19,16 @@ static int do_ut_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])

/* 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
@@ -36,7 +36,7 @@ static int do_ut_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
*/
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);
@@ -46,10 +46,10 @@ static int do_ut_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#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 f824d704c6..122fab924d 100644
--- a/test/dm/eth.c
+++ b/test/dm/eth.c
@@ -28,15 +28,15 @@ static int dm_test_eth(struct unit_test_state *uts)

env_set("ethact", "eth at 10002000");
ut_assertok(net_loop(PING));
- ut_asserteq_str("eth at 10002000", getenv("ethact"));
+ ut_asserteq_str("eth at 10002000", env_get("ethact"));

env_set("ethact", "eth at 10003000");
ut_assertok(net_loop(PING));
- ut_asserteq_str("eth at 10003000", getenv("ethact"));
+ ut_asserteq_str("eth at 10003000", env_get("ethact"));

env_set("ethact", "eth at 10004000");
ut_assertok(net_loop(PING));
- ut_asserteq_str("eth at 10004000", getenv("ethact"));
+ ut_asserteq_str("eth at 10004000", env_get("ethact"));

return 0;
}
@@ -47,20 +47,20 @@ static int dm_test_eth_alias(struct unit_test_state *uts)
net_ping_ip = string_to_ip("1.1.2.2");
env_set("ethact", "eth0");
ut_assertok(net_loop(PING));
- ut_asserteq_str("eth at 10002000", getenv("ethact"));
+ ut_asserteq_str("eth at 10002000", env_get("ethact"));

env_set("ethact", "eth1");
ut_assertok(net_loop(PING));
- ut_asserteq_str("eth at 10004000", getenv("ethact"));
+ ut_asserteq_str("eth at 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 at 10002000", getenv("ethact"));
+ ut_asserteq_str("eth at 10002000", env_get("ethact"));

env_set("ethact", "eth5");
ut_assertok(net_loop(PING));
- ut_asserteq_str("eth at 10003000", getenv("ethact"));
+ ut_asserteq_str("eth at 10003000", env_get("ethact"));

return 0;
}
@@ -74,13 +74,13 @@ static int dm_test_eth_prime(struct unit_test_state *uts)
env_set("ethact", NULL);
env_set("ethprime", "eth5");
ut_assertok(net_loop(PING));
- ut_asserteq_str("eth at 10003000", getenv("ethact"));
+ ut_asserteq_str("eth at 10003000", env_get("ethact"));

/* Expected to be "eth at 10002000" because it is first */
env_set("ethact", NULL);
env_set("ethprime", NULL);
ut_assertok(net_loop(PING));
- ut_asserteq_str("eth at 10002000", getenv("ethact"));
+ ut_asserteq_str("eth at 10002000", env_get("ethact"));

return 0;
}
@@ -119,7 +119,7 @@ static int dm_test_eth_act(struct unit_test_state *uts)
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);
@@ -152,13 +152,13 @@ static int _dm_test_eth_rotate1(struct unit_test_state *uts)
/* Make sure that the default is to rotate to the next interface */
env_set("ethact", "eth at 10004000");
ut_assertok(net_loop(PING));
- ut_asserteq_str("eth at 10002000", getenv("ethact"));
+ ut_asserteq_str("eth at 10002000", env_get("ethact"));

/* If ethrotate is no, then we should fail on a bad MAC */
env_set("ethact", "eth at 10004000");
env_set("ethrotate", "no");
ut_asserteq(-EINVAL, net_loop(PING));
- ut_asserteq_str("eth at 10004000", getenv("ethact"));
+ ut_asserteq_str("eth at 10004000", env_get("ethact"));

return 0;
}
@@ -168,12 +168,12 @@ static int _dm_test_eth_rotate2(struct unit_test_state *uts)
/* Make sure we can skip invalid devices */
env_set("ethact", "eth at 10004000");
ut_assertok(net_loop(PING));
- ut_asserteq_str("eth at 10004000", getenv("ethact"));
+ ut_asserteq_str("eth at 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;
}
@@ -187,7 +187,7 @@ static int dm_test_eth_rotate(struct unit_test_state *uts)
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);
@@ -200,7 +200,7 @@ static int dm_test_eth_rotate(struct unit_test_state *uts)

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);
@@ -229,7 +229,7 @@ static int _dm_test_net_retry(struct unit_test_state *uts)
env_set("netretry", "yes");
sandbox_eth_skip_timeout();
ut_assertok(net_loop(PING));
- ut_asserteq_str("eth at 10002000", getenv("ethact"));
+ ut_asserteq_str("eth at 10002000", env_get("ethact"));

/*
* eth1 is disabled and netretry is no, so the ping should fail and the
@@ -239,7 +239,7 @@ static int _dm_test_net_retry(struct unit_test_state *uts)
env_set("netretry", "no");
sandbox_eth_skip_timeout();
ut_asserteq(-ETIMEDOUT, net_loop(PING));
- ut_asserteq_str("eth at 10004000", getenv("ethact"));
+ ut_asserteq_str("eth@10004000", env_get("ethact"));

return 0;
}
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index 2861656183..3e20481921 100644
--- a/tools/env/fw_env.c
+++ b/tools/env/fw_env.c
@@ -286,7 +286,7 @@ int fw_printenv(int argc, char *argv[], int value_only, struct env_opts *opts)
char *name = argv[i];
char *val = NULL;

- val = fw_getenv(name);
+ val = fw_env_get(name);
if (!val) {
fprintf (stderr, "## Error: \"%s\" not defined\n", name);
rc = -1;
diff --git a/tools/env/fw_env.h b/tools/env/fw_env.h
index 04bb64602b..8ee7d546e3 100644
--- a/tools/env/fw_env.h
+++ b/tools/env/fw_env.h
@@ -112,13 +112,13 @@ int fw_parse_script(char *fname, struct env_opts *opts);
int fw_env_open(struct env_opts *opts);

/**
- * fw_getenv() - lookup variable in the RAM cache
+ * fw_env_get() - lookup variable in the RAM cache
*
* @name: variable to be searched
* Return:
* pointer to start of value, NULL if not found
*/
-char *fw_getenv(char *name);
+char *fw_env_get(char *name);

/**
* fw_env_write() - modify a variable held in the RAM cache
--
2.14.0.rc0.284.gd933b75aa4-goog