env: Rename getenv/_f() to env_get()

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

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2017-08-03 12:22:12 -06:00 committed by Tom Rini
parent fd1e959e91
commit 00caae6d47
213 changed files with 531 additions and 502 deletions

2
README
View file

@ -3286,7 +3286,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 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 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. until then to read environment variables.
The environment is protected by a CRC32 checksum. Before the monitor The environment is protected by a CRC32 checksum. Before the monitor

View file

@ -458,7 +458,7 @@ static int API_env_get(va_list ap)
if ((value = (char **)va_arg(ap, uintptr_t)) == NULL) if ((value = (char **)va_arg(ap, uintptr_t)) == NULL)
return API_EINVAL; return API_EINVAL;
*value = getenv(name); *value = env_get(name);
return 0; return 0;
} }

View file

@ -85,7 +85,7 @@ static void boot_jump_linux(bootm_headers_t *images, int flag)
r2 = (unsigned int)images->ft_addr; r2 = (unsigned int)images->ft_addr;
} else { } else {
r0 = 1; r0 = 1;
r2 = (unsigned int)getenv("bootargs"); r2 = (unsigned int)env_get("bootargs");
} }
smp_set_core_boot_addr((unsigned long)kernel_entry, -1); smp_set_core_boot_addr((unsigned long)kernel_entry, -1);

View file

@ -95,7 +95,7 @@ static void erratum_a008514(void)
static unsigned long get_internval_val_mhz(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 * interval is the number of platform cycles(MHz) between
* wake up events generated by EPU. * wake up events generated by EPU.

View file

@ -216,7 +216,7 @@ static void do_nonsec_virt_switch(void)
/* Subcommand: PREP */ /* Subcommand: PREP */
static void boot_prep_linux(bootm_headers_t *images) 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) { if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len) {
#ifdef CONFIG_OF_LIBFDT #ifdef CONFIG_OF_LIBFDT
@ -273,7 +273,7 @@ __weak bool armv7_boot_nonsec_default(void)
#ifdef CONFIG_ARMV7_NONSEC #ifdef CONFIG_ARMV7_NONSEC
bool armv7_boot_nonsec(void) bool armv7_boot_nonsec(void)
{ {
char *s = getenv("bootm_boot_mode"); char *s = env_get("bootm_boot_mode");
bool nonsec = armv7_boot_nonsec_default(); bool nonsec = armv7_boot_nonsec_default();
if (s && !strcmp(s, "sec")) 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; ulong addr = (ulong)kernel_entry | 1;
kernel_entry = (void *)addr; kernel_entry = (void *)addr;
#endif #endif
s = getenv("machid"); s = env_get("machid");
if (s) { if (s) {
if (strict_strtoul(s, 16, &machid) < 0) { if (strict_strtoul(s, 16, &machid) < 0) {
debug("strict_strtoul failed!\n"); debug("strict_strtoul failed!\n");

View file

@ -10,7 +10,7 @@ int board_video_skip(void)
{ {
int i; int i;
int ret; int ret;
char const *panel = getenv("panel"); char const *panel = env_get("panel");
if (!panel) { if (!panel) {
for (i = 0; i < display_count; i++) { for (i = 0; i < display_count; i++) {

View file

@ -331,7 +331,7 @@ void ddr3_check_ecc_int(u32 base)
int ecc_test = 0; int ecc_test = 0;
u32 value = __raw_readl(base + KS2_DDR3_ECC_INT_STATUS_OFFSET); u32 value = __raw_readl(base + KS2_DDR3_ECC_INT_STATUS_OFFSET);
env = getenv("ecc_test"); env = env_get("ecc_test");
if (env) if (env)
ecc_test = simple_strtol(env, NULL, 0); ecc_test = simple_strtol(env, NULL, 0);

View file

@ -46,7 +46,7 @@ int misc_init_r(void)
char *env; char *env;
long ks2_debug = 0; long ks2_debug = 0;
env = getenv("ks2_debug"); env = env_get("ks2_debug");
if (env) if (env)
ks2_debug = simple_strtol(env, NULL, 0); ks2_debug = simple_strtol(env, NULL, 0);

View file

@ -129,7 +129,7 @@ int kw_config_adr_windows(void)
static void kw_sysrst_action(void) static void kw_sysrst_action(void)
{ {
int ret; int ret;
char *s = getenv("sysrstcmd"); char *s = env_get("sysrstcmd");
if (!s) { if (!s) {
debug("Error.. %s failed, check sysrstcmd\n", 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 * no action if sysrstdelay environment variable is not defined
*/ */
s = getenv("sysrstdelay"); s = env_get("sysrstdelay");
if (s == NULL) if (s == NULL)
return; return;

View file

@ -70,7 +70,7 @@ static void omap_set_fastboot_board_rev(void)
{ {
const char *board_rev; const char *board_rev;
board_rev = getenv("board_rev"); board_rev = env_get("board_rev");
if (board_rev == NULL) if (board_rev == NULL)
printf("Warning: fastboot.board_rev: unknown board revision\n"); 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); omap_die_id((unsigned int *)&die_id);
if (!getenv("serial#")) { if (!env_get("serial#")) {
snprintf(serial_string, sizeof(serial_string), snprintf(serial_string, sizeof(serial_string),
"%08x%08x", die_id[0], die_id[3]); "%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; char *serial_string;
unsigned long long serial; unsigned long long serial;
serial_string = getenv("serial#"); serial_string = env_get("serial#");
if (serial_string) { if (serial_string) {
serial = simple_strtoull(serial_string, NULL, 16); serial = simple_strtoull(serial_string, NULL, 16);
@ -202,7 +202,7 @@ void omap_die_id_usbethaddr(void)
omap_die_id((unsigned int *)&die_id); omap_die_id((unsigned int *)&die_id);
if (!getenv("usbethaddr")) { if (!env_get("usbethaddr")) {
/* /*
* Create a fake MAC address from the processor ID code. * Create a fake MAC address from the processor ID code.
* First byte is 0x02 to signify locally administered. * First byte is 0x02 to signify locally administered.

View file

@ -35,7 +35,7 @@ static int set_ethaddr_from_nvtboot(void)
const u32 *prop; const u32 *prop;
/* Already a valid address in the environment? If so, keep it */ /* Already a valid address in the environment? If so, keep it */
if (getenv("ethaddr")) if (env_get("ethaddr"))
return 0; return 0;
node = fdt_path_offset(nvtboot_blob, "/chosen"); node = fdt_path_offset(nvtboot_blob, "/chosen");

View file

@ -37,7 +37,7 @@ static int uniphier_set_fdt_file(void)
char dtb_name[256]; char dtb_name[256];
int buf_len = sizeof(dtb_name); int buf_len = sizeof(dtb_name);
if (getenv("fdt_file")) if (env_get("fdt_file"))
return 0; /* do nothing if it is already set */ return 0; /* do nothing if it is already set */
compat = fdt_stringlist_get(gd->fdt_blob, 0, "compatible", 0, NULL); compat = fdt_stringlist_get(gd->fdt_blob, 0, "compatible", 0, NULL);

View file

@ -113,7 +113,8 @@ static void set_clocks_in_mhz (bd_t *kbd)
{ {
char *s; char *s;
if ((s = getenv("clocks_in_mhz")) != NULL) { s = env_get("clocks_in_mhz");
if (s) {
/* convert all clock information to MHz */ /* convert all clock information to MHz */
kbd->bi_intfreq /= 1000000L; kbd->bi_intfreq /= 1000000L;
kbd->bi_busfreq /= 1000000L; kbd->bi_busfreq /= 1000000L;

View file

@ -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 */ /* First parameter is mapped to $r5 for kernel boot args */
void (*thekernel) (char *, ulong, ulong); void (*thekernel) (char *, ulong, ulong);
char *commandline = getenv("bootargs"); char *commandline = env_get("bootargs");
ulong rd_data_start, rd_data_end; ulong rd_data_start, rd_data_end;
/* /*

View file

@ -80,7 +80,7 @@ static void linux_cmdline_legacy(bootm_headers_t *images)
linux_cmdline_init(); linux_cmdline_init();
bootargs = getenv("bootargs"); bootargs = env_get("bootargs");
if (!bootargs) if (!bootargs)
return; return;
@ -202,11 +202,11 @@ static void linux_env_legacy(bootm_headers_t *images)
sprintf(env_buf, "0x%X", (uint) (gd->bd->bi_flashsize)); sprintf(env_buf, "0x%X", (uint) (gd->bd->bi_flashsize));
linux_env_set("flash_size", env_buf); linux_env_set("flash_size", env_buf);
cp = getenv("ethaddr"); cp = env_get("ethaddr");
if (cp) if (cp)
linux_env_set("ethaddr", cp); linux_env_set("ethaddr", cp);
cp = getenv("eth1addr"); cp = env_get("eth1addr");
if (cp) if (cp)
linux_env_set("eth1addr", cp); linux_env_set("eth1addr", cp);

View file

@ -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); void (*theKernel)(int zero, int arch, uint params);
#ifdef CONFIG_CMDLINE_TAG #ifdef CONFIG_CMDLINE_TAG
char *commandline = getenv("bootargs"); char *commandline = env_get("bootargs");
#endif #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; theKernel = (void (*)(int, int, uint))images->ep;
s = getenv("machid"); s = env_get("machid");
if (s) { if (s) {
machid = simple_strtoul(s, NULL, 16); machid = simple_strtoul(s, NULL, 16);
printf("Using machid 0x%x from environment\n", machid); printf("Using machid 0x%x from environment\n", machid);

View file

@ -12,7 +12,7 @@
int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *images) int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *images)
{ {
void (*kernel)(int, int, int, char *) = (void *)images->ep; 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_start = images->rd_start;
ulong initrd_end = images->rd_end; ulong initrd_end = images->rd_end;
char *of_flat_tree = NULL; char *of_flat_tree = NULL;

View file

@ -256,7 +256,7 @@ static void enable_tdm_law(void)
* is not setup properly yet. Search for tdm entry in * is not setup properly yet. Search for tdm entry in
* hwconfig. * hwconfig.
*/ */
ret = getenv_f("hwconfig", buffer, sizeof(buffer)); ret = env_get_f("hwconfig", buffer, sizeof(buffer));
if (ret > 0) { if (ret > 0) {
tdm_hwconfig_enabled = hwconfig_f("tdm", buffer); tdm_hwconfig_enabled = hwconfig_f("tdm", buffer);
/* If tdm is defined in hwconfig, set law for tdm workaround */ /* 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; cpc_corenet_t *cpc = (cpc_corenet_t *)CONFIG_SYS_FSL_CPC_ADDR;
/* Extract hwconfig from environment */ /* Extract hwconfig from environment */
ret = getenv_f("hwconfig", buffer, sizeof(buffer)); ret = env_get_f("hwconfig", buffer, sizeof(buffer));
if (ret > 0) { if (ret > 0) {
/* /*
* If "en_cpc" is not defined in hwconfig then by default all * If "en_cpc" is not defined in hwconfig then by default all
@ -754,7 +754,7 @@ int cpu_init_r(void)
char *buf = NULL; char *buf = NULL;
int n, res; int n, res;
n = getenv_f("hwconfig", buffer, sizeof(buffer)); n = env_get_f("hwconfig", buffer, sizeof(buffer));
if (n > 0) if (n > 0)
buf = buffer; buf = buffer;
@ -794,7 +794,7 @@ int cpu_init_r(void)
#endif #endif
#if defined(CONFIG_PPC_SPINTABLE_COMPATIBLE) && defined(CONFIG_MP) #if defined(CONFIG_PPC_SPINTABLE_COMPATIBLE) && defined(CONFIG_MP)
spin = getenv("spin_table_compat"); spin = env_get("spin_table_compat");
if (spin && (*spin == 'n')) if (spin && (*spin == 'n'))
spin_table_compat = 0; spin_table_compat = 0;
else else
@ -845,7 +845,7 @@ int cpu_init_r(void)
#ifdef CONFIG_SYS_SRIO #ifdef CONFIG_SYS_SRIO
srio_init(); srio_init();
#ifdef CONFIG_SRIO_PCIE_BOOT_MASTER #ifdef CONFIG_SRIO_PCIE_BOOT_MASTER
char *s = getenv("bootmaster"); char *s = env_get("bootmaster");
if (s) { if (s) {
if (!strcmp(s, "SRIO1")) { if (!strcmp(s, "SRIO1")) {
srio_boot_master(1); srio_boot_master(1);

View file

@ -92,7 +92,7 @@ void ft_fixup_cpu(void *blob, u64 memory_limit)
* Extract hwconfig from environment. * Extract hwconfig from environment.
* Search for tdm entry in hwconfig. * Search for tdm entry in hwconfig.
*/ */
ret = getenv_f("hwconfig", buffer, sizeof(buffer)); ret = env_get_f("hwconfig", buffer, sizeof(buffer));
if (ret > 0) if (ret > 0)
tdm_hwconfig_enabled = hwconfig_f("tdm", buffer); tdm_hwconfig_enabled = hwconfig_f("tdm", buffer);

View file

@ -514,7 +514,7 @@ void fsl_serdes_init(void)
* Extract hwconfig from environment since we have not properly setup * Extract hwconfig from environment since we have not properly setup
* the environment but need it for ddr config params * 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; buf = buffer;
#endif #endif
if (serdes_prtcl_map & (1 << NONE)) if (serdes_prtcl_map & (1 << NONE))

View file

@ -275,7 +275,8 @@ static void set_clocks_in_mhz (bd_t *kbd)
{ {
char *s; char *s;
if ((s = getenv ("clocks_in_mhz")) != NULL) { s = env_get("clocks_in_mhz");
if (s) {
/* convert all clock information to MHz */ /* convert all clock information to MHz */
kbd->bi_intfreq /= 1000000L; kbd->bi_intfreq /= 1000000L;
kbd->bi_busfreq /= 1000000L; kbd->bi_busfreq /= 1000000L;

View file

@ -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; char *cmdline = (char *)param + COMMAND_LINE;
/* PAGE_SIZE */ /* PAGE_SIZE */
unsigned long size = images->ep - (unsigned long)param; 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 * allow the PREP bootm subcommand, it is required for bootm to work

View file

@ -42,7 +42,7 @@ int do_sh_zimageboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
/* Linux kernel command line */ /* Linux kernel command line */
cmdline = (char *)param + COMMAND_LINE; cmdline = (char *)param + COMMAND_LINE;
bootargs = getenv("bootargs"); bootargs = env_get("bootargs");
/* Clear zero page */ /* Clear zero page */
/* cppcheck-suppress nullPointer */ /* cppcheck-suppress nullPointer */

View file

@ -48,15 +48,15 @@ static void build_command_line(char *command_line, int auto_boot)
command_line[0] = '\0'; command_line[0] = '\0';
env_command_line = getenv("bootargs"); env_command_line = env_get("bootargs");
/* set console= argument if we use a serial console */ /* set console= argument if we use a serial console */
if (!strstr(env_command_line, "console=")) { if (!strstr(env_command_line, "console=")) {
if (!strcmp(getenv("stdout"), "serial")) { if (!strcmp(env_get("stdout"), "serial")) {
/* We seem to use serial console */ /* We seem to use serial console */
sprintf(command_line, "console=ttyS0,%s ", 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 */ /* argv[1] holds the address of the bzImage */
s = argv[1]; s = argv[1];
} else { } else {
s = getenv("fileaddr"); s = env_get("fileaddr");
} }
if (s) if (s)

View file

@ -136,7 +136,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
{ {
struct bp_tag *params, *params_start; struct bp_tag *params, *params_start;
ulong initrd_start, initrd_end; 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))) if (!(flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)))
return 0; return 0;

View file

@ -149,7 +149,7 @@ int get_arc_info(void)
if (smac[2][0] == 0xFF) { if (smac[2][0] == 0xFF) {
printf("\t<not found>\n"); printf("\t<not found>\n");
} else { } else {
char *ret = getenv("ethaddr"); char *ret = env_get("ethaddr");
if (strcmp(ret, __stringify(CONFIG_ETHADDR)) == 0) { if (strcmp(ret, __stringify(CONFIG_ETHADDR)) == 0) {
env_set("ethaddr", smac[2]); env_set("ethaddr", smac[2]);
@ -169,7 +169,7 @@ int get_arc_info(void)
if (smac[1][0] == 0xFF) { if (smac[1][0] == 0xFF) {
printf("\t<not found>\n"); printf("\t<not found>\n");
} else { } else {
char *ret = getenv("eth1addr"); char *ret = env_get("eth1addr");
if (strcmp(ret, __stringify(CONFIG_ETH1ADDR)) == 0) { if (strcmp(ret, __stringify(CONFIG_ETH1ADDR)) == 0) {
env_set("eth1addr", smac[1]); env_set("eth1addr", smac[1]);
@ -188,7 +188,7 @@ int get_arc_info(void)
if (smac[0][0] == 0xFF) { if (smac[0][0] == 0xFF) {
printf("\t<not found>\n"); printf("\t<not found>\n");
} else { } else {
char *ret = getenv("eth2addr"); char *ret = env_get("eth2addr");
if (strcmp(ret, __stringify(CONFIG_ETH2ADDR)) == 0) { if (strcmp(ret, __stringify(CONFIG_ETH2ADDR)) == 0) {
env_set("eth2addr", smac[0]); env_set("eth2addr", smac[0]);

View file

@ -64,7 +64,7 @@ void board_gpio_init(void)
for (i = 0; i < GPIO_MAX_NUM; i++) { for (i = 0; i < GPIO_MAX_NUM; i++) {
sprintf(envname, "GPIO%d", i); sprintf(envname, "GPIO%d", i);
val = getenv(envname); val = env_get(envname);
if (val) { if (val) {
char direction = toupper(val[0]); char direction = toupper(val[0]);
char level = toupper(val[1]); 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) { if (val) {
gpio_direction_input(GPIO_PCIE1_EN); gpio_direction_input(GPIO_PCIE1_EN);
gpio_direction_input(GPIO_PCIE2_EN); gpio_direction_input(GPIO_PCIE2_EN);
@ -91,7 +91,7 @@ void board_gpio_init(void)
gpio_direction_output(GPIO_PCIE2_EN, 1); gpio_direction_output(GPIO_PCIE2_EN, 1);
} }
val = getenv("SDHC_CDWP_OFF"); val = env_get("SDHC_CDWP_OFF");
if (!val) { if (!val) {
ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
@ -214,7 +214,7 @@ int last_stage_init(void)
else else
printf("NCT72(0x%x): ready\n", id2); printf("NCT72(0x%x): ready\n", id2);
kval = getenv("kernelargs"); kval = env_get("kernelargs");
mmc = find_mmc_device(0); mmc = find_mmc_device(0);
if (mmc) if (mmc)
@ -238,7 +238,7 @@ int last_stage_init(void)
get_arc_info(); get_arc_info();
if (kval) { if (kval) {
sval = getenv("SERIAL"); sval = env_get("SERIAL");
if (sval) { if (sval) {
strcpy(newkernelargs, "SN="); strcpy(newkernelargs, "SN=");
strcat(newkernelargs, sval); strcat(newkernelargs, sval);

View file

@ -157,7 +157,7 @@ u32 get_board_rev(void)
u32 maxcpuclk = CONFIG_DA850_EVM_MAX_CPU_CLK; u32 maxcpuclk = CONFIG_DA850_EVM_MAX_CPU_CLK;
u32 rev = 0; u32 rev = 0;
s = getenv("maxcpuclk"); s = env_get("maxcpuclk");
if (s) if (s)
maxcpuclk = simple_strtoul(s, NULL, 10); maxcpuclk = simple_strtoul(s, NULL, 10);

View file

@ -263,9 +263,9 @@ static int load_devicetree(void)
(size_t *)&dtbsize, (size_t *)&dtbsize,
NULL, 0x20000, (u_char *)dtbaddr); NULL, 0x20000, (u_char *)dtbaddr);
#else #else
char *dtbname = getenv("dtb"); char *dtbname = env_get("dtb");
char *dtbdev = getenv("dtbdev"); char *dtbdev = env_get("dtbdev");
char *dtbpart = getenv("dtbpart"); char *dtbpart = env_get("dtbpart");
if (!dtbdev || !dtbpart || !dtbname) { if (!dtbdev || !dtbpart || !dtbname) {
printf("%s: <dtbdev>/<dtbpart>/<dtb> missing.\n", __func__); printf("%s: <dtbdev>/<dtbpart>/<dtb> missing.\n", __func__);
return -1; return -1;
@ -405,11 +405,11 @@ static void br_summaryscreen_printenv(char *prefix,
char *name, char *altname, char *name, char *altname,
char *suffix) char *suffix)
{ {
char *envval = getenv(name); char *envval = env_get(name);
if (0 != envval) { if (0 != envval) {
lcd_printf("%s %s %s", prefix, envval, suffix); lcd_printf("%s %s %s", prefix, envval, suffix);
} else if (0 != altname) { } else if (0 != altname) {
envval = getenv(altname); envval = env_get(altname);
if (0 != envval) if (0 != envval)
lcd_printf("%s %s %s", prefix, envval, suffix); lcd_printf("%s %s %s", prefix, envval, suffix);
} else { } else {
@ -657,7 +657,7 @@ int board_eth_init(bd_t *bis)
mac_addr[4] = mac_lo & 0xFF; mac_addr[4] = mac_lo & 0xFF;
mac_addr[5] = (mac_lo & 0xFF00) >> 8; mac_addr[5] = (mac_lo & 0xFF00) >> 8;
if (!getenv("ethaddr")) { if (!env_get("ethaddr")) {
#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_USE_FDT) #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_USE_FDT)
printf("<ethaddr> not set. trying DTB ... "); printf("<ethaddr> not set. trying DTB ... ");
mac = dtbmacaddr(0); mac = dtbmacaddr(0);

View file

@ -139,7 +139,7 @@ void hw_watchdog_init(void)
int enable; int enable;
enable = 1; enable = 1;
s = getenv("watchdog"); s = env_get("watchdog");
if (s != NULL) if (s != NULL)
if ((strncmp(s, "off", 3) == 0) || (strncmp(s, "0", 1) == 0)) if ((strncmp(s, "off", 3) == 0) || (strncmp(s, "0", 1) == 0))
enable = 0; enable = 0;
@ -191,13 +191,13 @@ int drv_video_init(void)
unsigned long splash; unsigned long splash;
#endif #endif
printf("Init Video as "); printf("Init Video as ");
s = getenv("displaywidth"); s = env_get("displaywidth");
if (s != NULL) if (s != NULL)
display_width = simple_strtoul(s, NULL, 10); display_width = simple_strtoul(s, NULL, 10);
else else
display_width = 256; display_width = 256;
s = getenv("displayheight"); s = env_get("displayheight");
if (s != NULL) if (s != NULL)
display_height = simple_strtoul(s, NULL, 10); display_height = simple_strtoul(s, NULL, 10);
else else
@ -211,7 +211,7 @@ int drv_video_init(void)
vcxk_init(display_width, display_height); vcxk_init(display_width, display_height);
#ifdef CONFIG_SPLASH_SCREEN #ifdef CONFIG_SPLASH_SCREEN
s = getenv("splashimage"); s = env_get("splashimage");
if (s != NULL) { if (s != NULL) {
splash = simple_strtoul(s, NULL, 16); splash = simple_strtoul(s, NULL, 16);
vcxk_acknowledge_wait(); vcxk_acknowledge_wait();

View file

@ -211,7 +211,7 @@ int ft_board_setup(void *blob, bd_t *bd)
{ "mxc_nand", MTD_DEV_TYPE_NAND, }, /* NAND flash */ { "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"); puts(" Skiping ft_board_setup (fdt_noauto defined)\n");
return 0; return 0;
} }

View file

@ -221,7 +221,7 @@ int misc_init_r(void)
{ {
init_fan(); init_fan();
#if defined(CONFIG_CMD_I2C) && defined(CONFIG_SYS_I2C_EEPROM_ADDR) #if defined(CONFIG_CMD_I2C) && defined(CONFIG_SYS_I2C_EEPROM_ADDR)
if (!getenv("ethaddr")) { if (!env_get("ethaddr")) {
uchar mac[6]; uchar mac[6];
if (lacie_read_mac_address(mac) == 0) if (lacie_read_mac_address(mac) == 0)
eth_env_set_enetaddr("ethaddr", mac); eth_env_set_enetaddr("ethaddr", mac);

View file

@ -83,7 +83,7 @@ int board_init(void)
int misc_init_r(void) int misc_init_r(void)
{ {
#if defined(CONFIG_CMD_I2C) && defined(CONFIG_SYS_I2C_EEPROM_ADDR) #if defined(CONFIG_CMD_I2C) && defined(CONFIG_SYS_I2C_EEPROM_ADDR)
if (!getenv("ethaddr")) { if (!env_get("ethaddr")) {
uchar mac[6]; uchar mac[6];
if (lacie_read_mac_address(mac) == 0) if (lacie_read_mac_address(mac) == 0)
eth_env_set_enetaddr("ethaddr", mac); eth_env_set_enetaddr("ethaddr", mac);

View file

@ -118,7 +118,7 @@ int misc_init_r(void)
} }
if (reboot_mode[0] > 0 && isascii(reboot_mode[0])) { 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); env_set("reboot-mode", (char *)reboot_mode);
} }

View file

@ -51,7 +51,7 @@ int misc_init_r(void)
eth_env_set_enetaddr("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, len = meson_sm_read_efuse(EFUSE_SN_OFFSET, serial,
EFUSE_SN_SIZE); EFUSE_SN_SIZE);
if (len == EFUSE_SN_SIZE) if (len == EFUSE_SN_SIZE)

View file

@ -651,7 +651,7 @@ int board_late_init(void)
{ {
char *my_bootdelay; char *my_bootdelay;
char bootmode = 0; char bootmode = 0;
char const *panel = getenv("panel"); char const *panel = env_get("panel");
/* /*
* Check the boot-source. If booting from NOR Flash, * 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; bootmode |= (gpio_get_value(IMX_GPIO_NR(7, 1)) ? 1 : 0) << 2;
if (bootmode == 7) { if (bootmode == 7) {
my_bootdelay = getenv("nor_bootdelay"); my_bootdelay = env_get("nor_bootdelay");
if (my_bootdelay != NULL) if (my_bootdelay != NULL)
env_set("bootdelay", my_bootdelay); env_set("bootdelay", my_bootdelay);
else else

View file

@ -169,7 +169,7 @@ static int set_ethaddr_from_eeprom(void)
const char *ETHADDR_NAME = "ethaddr"; const char *ETHADDR_NAME = "ethaddr";
struct udevice *bus, *dev; struct udevice *bus, *dev;
if (getenv(ETHADDR_NAME)) if (env_get(ETHADDR_NAME))
return 0; return 0;
if (uclass_get_device_by_seq(UCLASS_I2C, 1, &bus)) { if (uclass_get_device_by_seq(UCLASS_I2C, 1, &bus)) {

View file

@ -392,7 +392,7 @@ int board_eth_init(bd_t *bis)
#if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \ #if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \
(defined(CONFIG_SPL_ETH_SUPPORT) && 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"); printf("<ethaddr> not set. Validating first E-fuse MAC\n");
if (is_valid_ethaddr(mac_addr)) if (is_valid_ethaddr(mac_addr))

View file

@ -133,8 +133,8 @@ void get_board_serial(struct tag_serialnr *serialnr)
#ifdef CONFIG_REVISION_TAG #ifdef CONFIG_REVISION_TAG
u32 get_board_rev(void) u32 get_board_rev(void)
{ {
if (getenv("revision#") != NULL) if (env_get("revision#") != NULL)
return simple_strtoul(getenv("revision#"), NULL, 10); return simple_strtoul(env_get("revision#"), NULL, 10);
return 0; return 0;
} }
#endif #endif

View file

@ -341,7 +341,7 @@ int board_init(void)
at91_set_A_periph(AT91_PIN_PE6, 1); /* power up */ at91_set_A_periph(AT91_PIN_PE6, 1); /* power up */
/* Select the second timing index for board rev 2 */ /* 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)) { if (rev_str && !strncmp(rev_str, "2", 1)) {
struct udevice *dev; 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 * Set MAC address so we do not need to init Ethernet before Linux
* boot * boot
*/ */
env_str = getenv("ethaddr"); env_str = env_get("ethaddr");
if (env_str) { if (env_str) {
struct at91_emac *emac = (struct at91_emac *)ATMEL_BASE_EMAC; struct at91_emac *emac = (struct at91_emac *)ATMEL_BASE_EMAC;
/* Parse MAC address */ /* Parse MAC address */
@ -385,7 +385,7 @@ int board_late_init(void)
&emac->sa2l); &emac->sa2l);
writel((env_enetaddr[4] | env_enetaddr[5] << 8), &emac->sa2h); writel((env_enetaddr[4] | env_enetaddr[5] << 8), &emac->sa2h);
printf("MAC: %s\n", getenv("ethaddr")); printf("MAC: %s\n", env_get("ethaddr"));
} else { } else {
/* Not set in environment */ /* Not set in environment */
printf("MAC: not set\n"); printf("MAC: not set\n");

View file

@ -545,7 +545,7 @@ int board_eth_init(bd_t *bis)
#if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \ #if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \
(defined(CONFIG_SPL_ETH_SUPPORT) && 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"); printf("<ethaddr> not set. Validating first E-fuse MAC\n");
if (is_valid_ethaddr(mac_addr)) if (is_valid_ethaddr(mac_addr))

View file

@ -749,7 +749,7 @@ size_t display_count = ARRAY_SIZE(displays);
int board_cfb_skip(void) int board_cfb_skip(void)
{ {
return NULL != getenv("novideo"); return NULL != env_get("novideo");
} }
static void setup_display(void) static void setup_display(void)
@ -974,7 +974,7 @@ static void preboot_keys(void)
char keypress[ARRAY_SIZE(buttons)+1]; char keypress[ARRAY_SIZE(buttons)+1];
numpressed = read_keys(keypress); numpressed = read_keys(keypress);
if (numpressed) { if (numpressed) {
char *kbd_magic_keys = getenv("magic_keys"); char *kbd_magic_keys = env_get("magic_keys");
char *suffix; char *suffix;
/* /*
* loop over all magic keys * loop over all magic keys
@ -983,7 +983,7 @@ static void preboot_keys(void)
char *keys; char *keys;
char magic[sizeof(kbd_magic_prefix) + 1]; char magic[sizeof(kbd_magic_prefix) + 1];
sprintf(magic, "%s%c", kbd_magic_prefix, *suffix); sprintf(magic, "%s%c", kbd_magic_prefix, *suffix);
keys = getenv(magic); keys = env_get(magic);
if (keys) { if (keys) {
if (!strcmp(keys, keypress)) if (!strcmp(keys, keypress))
break; break;
@ -993,7 +993,7 @@ static void preboot_keys(void)
char cmd_name[sizeof(kbd_command_prefix) + 1]; char cmd_name[sizeof(kbd_command_prefix) + 1];
char *cmd; char *cmd;
sprintf(cmd_name, "%s%c", kbd_command_prefix, *suffix); sprintf(cmd_name, "%s%c", kbd_command_prefix, *suffix);
cmd = getenv(cmd_name); cmd = env_get(cmd_name);
if (cmd) { if (cmd) {
env_set("preboot", cmd); env_set("preboot", cmd);
return; return;

View file

@ -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) int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
{ {
debug("%s\n", __func__); debug("%s\n", __func__);
if (!getenv("serial#")) if (!env_get("serial#"))
g_dnl_set_serialnumber(CONFIG_USB_SERIALNO); g_dnl_set_serialnumber(CONFIG_USB_SERIALNO);
return 0; return 0;
} }

View file

@ -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) int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
{ {
debug("%s\n", __func__); debug("%s\n", __func__);
if (!getenv("serial#")) if (!env_get("serial#"))
g_dnl_set_serialnumber(CONFIG_USB_SERIALNO); g_dnl_set_serialnumber(CONFIG_USB_SERIALNO);
return 0; return 0;
} }

View file

@ -86,7 +86,7 @@ int misc_init_r(void)
* Default MAC address comes from CONFIG_ETHADDR + DIP switches 1-6. * Default MAC address comes from CONFIG_ETHADDR + DIP switches 1-6.
*/ */
char *s = getenv("ethaddr"); char *s = env_get("ethaddr");
if (s == 0) { if (s == 0) {
unsigned int x; unsigned int x;
char s[] = __stringify(CONFIG_ETHBASE); char s[] = __stringify(CONFIG_ETHBASE);

View file

@ -181,7 +181,7 @@ int board_eth_init(bd_t *bis)
gpio_set_value(CL_SOM_AM57X_GPIO_PHY1_RST, 1); gpio_set_value(CL_SOM_AM57X_GPIO_PHY1_RST, 1);
mdelay(20); mdelay(20);
cpsw_phy_envval = getenv("cpsw_phy"); cpsw_phy_envval = env_get("cpsw_phy");
if (cpsw_phy_envval != NULL) if (cpsw_phy_envval != NULL)
cpsw_act_phy = simple_strtoul(cpsw_phy_envval, NULL, 0); cpsw_act_phy = simple_strtoul(cpsw_phy_envval, NULL, 0);

View file

@ -114,10 +114,10 @@ int board_video_skip(void)
{ {
int ret; int ret;
struct display_info_t *preset; struct display_info_t *preset;
char const *panel = getenv("displaytype"); char const *panel = env_get("displaytype");
if (!panel) /* Also accept panel for backward compatibility */ if (!panel) /* Also accept panel for backward compatibility */
panel = getenv("panel"); panel = env_get("panel");
if (!panel) if (!panel)
return -ENOENT; return -ENOENT;

View file

@ -400,7 +400,7 @@ void lcd_ctrl_init(void *lcdbase)
{ {
struct prcm *prcm = (struct prcm *)PRCM_BASE; struct prcm *prcm = (struct prcm *)PRCM_BASE;
char *custom_lcd; char *custom_lcd;
char *displaytype = getenv("displaytype"); char *displaytype = env_get("displaytype");
if (displaytype == NULL) if (displaytype == NULL)
return; return;
@ -408,7 +408,7 @@ void lcd_ctrl_init(void *lcdbase)
lcd_def = env_parse_displaytype(displaytype); lcd_def = env_parse_displaytype(displaytype);
/* If we did not recognize the preset, check if it's an env variable */ /* If we did not recognize the preset, check if it's an env variable */
if (lcd_def == NONE) { if (lcd_def == NONE) {
custom_lcd = getenv(displaytype); custom_lcd = env_get(displaytype);
if (custom_lcd == NULL || parse_customlcd(custom_lcd) < 0) if (custom_lcd == NULL || parse_customlcd(custom_lcd) < 0)
return; return;
} }

View file

@ -235,7 +235,7 @@ int power_init_board(void)
return 0; return 0;
/* set level of MIPI if specified */ /* set level of MIPI if specified */
lv_mipi = getenv("lv_mipi"); lv_mipi = env_get("lv_mipi");
if (lv_mipi) if (lv_mipi)
return 0; return 0;
@ -583,7 +583,7 @@ int board_video_skip(void)
{ {
int i; int i;
int ret; int ret;
char const *panel = getenv("panel"); char const *panel = env_get("panel");
if (!panel) { if (!panel) {
for (i = 0; i < ARRAY_SIZE(displays); i++) { for (i = 0; i < ARRAY_SIZE(displays); i++) {
struct display_info_t const *dev = displays + i; struct display_info_t const *dev = displays + i;

View file

@ -292,7 +292,7 @@ u32 get_board_rev(void)
u32 maxcpuclk = CONFIG_DA850_EVM_MAX_CPU_CLK; u32 maxcpuclk = CONFIG_DA850_EVM_MAX_CPU_CLK;
u32 rev = 0; u32 rev = 0;
s = getenv("maxcpuclk"); s = env_get("maxcpuclk");
if (s) if (s)
maxcpuclk = simple_strtoul(s, NULL, 10); maxcpuclk = simple_strtoul(s, NULL, 10);

View file

@ -293,7 +293,7 @@ static void dspwake(void)
if ((REG(CHIP_REV_ID_REG) & 0x3f) == 0x10) if ((REG(CHIP_REV_ID_REG) & 0x3f) == 0x10)
return; return;
if (!strcmp(getenv("dspwake"), "no")) if (!strcmp(env_get("dspwake"), "no"))
return; return;
*resetvect++ = 0x1E000; /* DSP Idle */ *resetvect++ = 0x1E000; /* DSP Idle */
@ -323,7 +323,7 @@ int misc_init_r(void)
uint8_t tmp[20], addr[10]; uint8_t tmp[20], addr[10];
if (getenv("ethaddr") == NULL) { if (env_get("ethaddr") == NULL) {
/* Read Ethernet MAC address from EEPROM */ /* Read Ethernet MAC address from EEPROM */
if (dvevm_read_mac_address(addr)) { if (dvevm_read_mac_address(addr)) {
/* Set Ethernet MAC address from EEPROM */ /* Set Ethernet MAC address from EEPROM */

View file

@ -181,7 +181,7 @@ int checkboard(void)
puts("Board: EtherCAN/2 Gateway"); puts("Board: EtherCAN/2 Gateway");
break; break;
} }
if (getenv_f("serial#", str, sizeof(str)) > 0) { if (env_get_f("serial#", str, sizeof(str)) > 0) {
puts(", serial# "); puts(", serial# ");
puts(str); puts(str);
} }
@ -198,7 +198,7 @@ void get_board_serial(struct tag_serialnr *serialnr)
{ {
char *str; char *str;
char *serial = getenv("serial#"); char *serial = env_get("serial#");
if (serial) { if (serial) {
str = strchr(serial, '_'); str = strchr(serial, '_');
if (str && (strlen(str) >= 4)) { 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. * In some cases this this needs to be set to 4.
* Check the user has set environment mdiv to 4 to change the divisor. * 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) | writel((readl(&pmc->mckr) & ~AT91_PMC_MDIV) |
AT91SAM9_PMC_MDIV_4, &pmc->mckr); AT91SAM9_PMC_MDIV_4, &pmc->mckr);
at91_clock_init(CONFIG_SYS_AT91_MAIN_CLOCK); at91_clock_init(CONFIG_SYS_AT91_MAIN_CLOCK);

View file

@ -195,7 +195,7 @@ static int adjust_vdd(ulong vdd_override)
vid, vdd_target/10); vid, vdd_target/10);
/* check override variable for overriding VDD */ /* 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 && if (vdd_override == 0 && vdd_string &&
!strict_strtoul(vdd_string, 10, &vdd_string_override)) !strict_strtoul(vdd_string, 10, &vdd_string_override))
vdd_override = vdd_string_override; vdd_override = vdd_string_override;
@ -542,7 +542,7 @@ int configure_vsc3316_3308(void)
* Extract hwconfig from environment since environment * Extract hwconfig from environment since environment
* is not setup properly yet * is not setup properly yet
*/ */
getenv_f("hwconfig", buffer, sizeof(buffer)); env_get_f("hwconfig", buffer, sizeof(buffer));
buf = buffer; buf = buffer;
if (hwconfig_subarg_cmp_f("fsl_b4860_serdes2", if (hwconfig_subarg_cmp_f("fsl_b4860_serdes2",

View file

@ -478,7 +478,7 @@ int mac_read_from_eeprom(void)
/* Only initialize environment variables that are blank /* Only initialize environment variables that are blank
* (i.e. have not yet been set) * (i.e. have not yet been set)
*/ */
if (!getenv(enetvar)) if (!env_get(enetvar))
env_set(enetvar, ethaddr); env_set(enetvar, ethaddr);
} }
} }

View file

@ -376,7 +376,7 @@ int adjust_vdd(ulong vdd_override)
vdd_target = vdd[vid]; vdd_target = vdd[vid];
/* check override variable for overriding VDD */ /* 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 && if (vdd_override == 0 && vdd_string &&
!strict_strtoul(vdd_string, 10, &vdd_string_override)) !strict_strtoul(vdd_string, 10, &vdd_string_override))
vdd_override = vdd_string_override; vdd_override = vdd_string_override;
@ -560,7 +560,7 @@ int adjust_vdd(ulong vdd_override)
vdd_target = vdd[vid]; vdd_target = vdd[vid];
/* check override variable for overriding VDD */ /* 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 && if (vdd_override == 0 && vdd_string &&
!strict_strtoul(vdd_string, 10, &vdd_string_override)) !strict_strtoul(vdd_string, 10, &vdd_string_override))
vdd_override = vdd_string_override; vdd_override = vdd_string_override;

View file

@ -449,7 +449,7 @@ static void initialize_dpmac_to_slot(void)
>> FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_SHIFT; >> FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_SHIFT;
char *env_hwconfig; char *env_hwconfig;
env_hwconfig = getenv("hwconfig"); env_hwconfig = env_get("hwconfig");
switch (serdes1_prtcl) { switch (serdes1_prtcl) {
case 0x07: case 0x07:
@ -603,7 +603,7 @@ void ls2080a_handle_phy_interface_sgmii(int dpmac_id)
>> FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_SHIFT; >> FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_SHIFT;
int *riser_phy_addr; int *riser_phy_addr;
char *env_hwconfig = getenv("hwconfig"); char *env_hwconfig = env_get("hwconfig");
if (hwconfig_f("xqsgmii", env_hwconfig)) if (hwconfig_f("xqsgmii", env_hwconfig))
riser_phy_addr = &xqsgii_riser_phy_addr[0]; riser_phy_addr = &xqsgii_riser_phy_addr[0];
@ -849,7 +849,7 @@ int board_eth_init(bd_t *bis)
unsigned int i; unsigned int i;
char *env_hwconfig; char *env_hwconfig;
env_hwconfig = getenv("hwconfig"); env_hwconfig = env_get("hwconfig");
initialize_dpmac_to_slot(); initialize_dpmac_to_slot();

View file

@ -204,7 +204,7 @@ int board_init(void)
val = in_le32(dcfg_ccsr + DCFG_RCWSR13 / 4); val = in_le32(dcfg_ccsr + DCFG_RCWSR13 / 4);
env_hwconfig = getenv("hwconfig"); env_hwconfig = env_get("hwconfig");
if (hwconfig_f("dspi", env_hwconfig) && if (hwconfig_f("dspi", env_hwconfig) &&
DCFG_RCWSR13_DSPI == (val & (u32)(0xf << 8))) DCFG_RCWSR13_DSPI == (val & (u32)(0xf << 8)))

View file

@ -250,7 +250,7 @@ int misc_init_r(void)
val = in_le32(dcfg_ccsr + DCFG_RCWSR13 / 4); val = in_le32(dcfg_ccsr + DCFG_RCWSR13 / 4);
env_hwconfig = getenv("hwconfig"); env_hwconfig = env_get("hwconfig");
if (hwconfig_f("dspi", env_hwconfig) && if (hwconfig_f("dspi", env_hwconfig) &&
DCFG_RCWSR13_DSPI == (val & (u32)(0xf << 8))) DCFG_RCWSR13_DSPI == (val & (u32)(0xf << 8)))

View file

@ -67,7 +67,7 @@ static struct pci_region pcie_regions_1[] = {
static int is_pex_x2(void) 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")) if (pex_x2 && !strcmp(pex_x2, "yes"))
return 1; return 1;

View file

@ -173,7 +173,7 @@ int board_mmc_init(bd_t *bd)
char buffer[HWCONFIG_BUFFER_SIZE] = {0}; char buffer[HWCONFIG_BUFFER_SIZE] = {0};
int esdhc_hwconfig_enabled = 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); esdhc_hwconfig_enabled = hwconfig_f("esdhc", buffer);
if (esdhc_hwconfig_enabled == 0) if (esdhc_hwconfig_enabled == 0)

View file

@ -76,7 +76,7 @@ void setup_iomux_lcd(void)
int board_video_skip(void) int board_video_skip(void)
{ {
int ret; int ret;
char const *e = getenv("panel"); char const *e = env_get("panel");
if (e) { if (e) {
if (strcmp(e, "claa") == 0) { if (strcmp(e, "claa") == 0) {

View file

@ -92,7 +92,7 @@ void setup_iomux_lcd(void)
int board_video_skip(void) int board_video_skip(void)
{ {
int ret; int ret;
char const *e = getenv("panel"); char const *e = env_get("panel");
if (e) { if (e) {
if (strcmp(e, "seiko") == 0) { if (strcmp(e, "seiko") == 0) {

View file

@ -350,7 +350,8 @@ int board_eth_init(bd_t *bis)
#ifdef CONFIG_VSC7385_ENET #ifdef CONFIG_VSC7385_ENET
/* If a VSC7385 microcode image is present, then upload it. */ /* 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); vscfw_addr = simple_strtoul(tmp, NULL, 16);
printf("uploading VSC7385 microcode from %x\n", vscfw_addr); printf("uploading VSC7385 microcode from %x\n", vscfw_addr);
if (vsc7385_upload_firmware((void *) vscfw_addr, if (vsc7385_upload_firmware((void *) vscfw_addr,

View file

@ -265,7 +265,7 @@ static int adjust_vdd(ulong vdd_override)
vdd_target = vdd[vid]; vdd_target = vdd[vid];
/* check override variable for overriding VDD */ /* 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 && if (vdd_override == 0 && vdd_string &&
!strict_strtoul(vdd_string, 10, &vdd_string_override)) !strict_strtoul(vdd_string, 10, &vdd_string_override))
vdd_override = vdd_string_override; vdd_override = vdd_string_override;

View file

@ -1160,7 +1160,7 @@ void setup_board_gpio(int board, struct ventana_board_info *info)
char arg[10]; char arg[10];
size_t len; size_t len;
int i; int i;
int quiet = simple_strtol(getenv("quiet"), NULL, 10); int quiet = simple_strtol(env_get("quiet"), NULL, 10);
if (board >= GW_UNKNOWN) if (board >= GW_UNKNOWN)
return; return;

View file

@ -298,11 +298,11 @@ int board_eth_init(bd_t *bis)
#endif #endif
/* default to the first detected enet dev */ /* default to the first detected enet dev */
if (!getenv("ethprime")) { if (!env_get("ethprime")) {
struct eth_device *dev = eth_get_dev_by_index(0); struct eth_device *dev = eth_get_dev_by_index(0);
if (dev) { if (dev) {
env_set("ethprime", dev->name); 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) void get_board_serial(struct tag_serialnr *serialnr)
{ {
char *serial = getenv("serial#"); char *serial = env_get("serial#");
if (serial) { if (serial) {
serialnr->high = 0; serialnr->high = 0;
@ -658,7 +658,7 @@ int checkboard(void)
int quiet; /* Quiet or minimal output mode */ int quiet; /* Quiet or minimal output mode */
quiet = 0; quiet = 0;
p = getenv("quiet"); p = env_get("quiet");
if (p) if (p)
quiet = simple_strtol(p, NULL, 10); quiet = simple_strtol(p, NULL, 10);
else else
@ -746,7 +746,7 @@ int misc_init_r(void)
for (i = 0; i < (sizeof(str)-1) && info->model[i]; i++) for (i = 0; i < (sizeof(str)-1) && info->model[i]; i++)
str[i] = tolower(info->model[i]); str[i] = tolower(info->model[i]);
env_set("model", str); env_set("model", str);
if (!getenv("fdt_file")) { if (!env_get("fdt_file")) {
sprintf(fdt, "%s-%s.dtb", cputype, str); sprintf(fdt, "%s-%s.dtb", cputype, str);
env_set("fdt_file", fdt); env_set("fdt_file", fdt);
} }
@ -770,11 +770,11 @@ int misc_init_r(void)
/* initialize env from EEPROM */ /* initialize env from EEPROM */
if (test_bit(EECONFIG_ETH0, info->config) && if (test_bit(EECONFIG_ETH0, info->config) &&
!getenv("ethaddr")) { !env_get("ethaddr")) {
eth_env_set_enetaddr("ethaddr", info->mac0); eth_env_set_enetaddr("ethaddr", info->mac0);
} }
if (test_bit(EECONFIG_ETH1, info->config) && if (test_bit(EECONFIG_ETH1, info->config) &&
!getenv("eth1addr")) { !env_get("eth1addr")) {
eth_env_set_enetaddr("eth1addr", info->mac1); 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 */ /* Set a non-initialized hwconfig based on board configuration */
if (!strcmp(getenv("hwconfig"), "_UNKNOWN_")) { if (!strcmp(env_get("hwconfig"), "_UNKNOWN_")) {
buf[0] = 0; buf[0] = 0;
if (gpio_cfg[board_type].rs232_en) if (gpio_cfg[board_type].rs232_en)
strcat(buf, "rs232;"); strcat(buf, "rs232;");
@ -1035,7 +1035,7 @@ int fdt_fixup_sky2(void *blob, int np, struct pci_dev *dev)
int j; int j;
sprintf(mac, "eth1addr"); sprintf(mac, "eth1addr");
tmp = getenv(mac); tmp = env_get(mac);
if (tmp) { if (tmp) {
for (j = 0; j < 6; j++) { for (j = 0; j < 6; j++) {
mac_addr[j] = tmp ? 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 */ { "sst,w25q256", MTD_DEV_TYPE_NOR, }, /* SPI flash */
{ "fsl,imx6q-gpmi-nand", MTD_DEV_TYPE_NAND, }, /* NAND flash */ { "fsl,imx6q-gpmi-nand", MTD_DEV_TYPE_NAND, }, /* NAND flash */
}; };
const char *model = getenv("model"); const char *model = env_get("model");
const char *display = getenv("display"); const char *display = env_get("display");
int i; int i;
char rev = 0; 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"); puts(" Skiping ft_board_setup (fdt_noauto defined)\n");
return 0; return 0;
} }
@ -1152,15 +1152,15 @@ int ft_board_setup(void *blob, bd_t *bd)
printf(" Adjusting FDT per EEPROM for %s...\n", model); printf(" Adjusting FDT per EEPROM for %s...\n", model);
/* board serial number */ /* board serial number */
fdt_setprop(blob, 0, "system-serial", getenv("serial#"), fdt_setprop(blob, 0, "system-serial", env_get("serial#"),
strlen(getenv("serial#")) + 1); strlen(env_get("serial#")) + 1);
/* board (model contains model from device-tree) */ /* board (model contains model from device-tree) */
fdt_setprop(blob, 0, "board", info->model, fdt_setprop(blob, 0, "board", info->model,
strlen((const char *)info->model) + 1); strlen((const char *)info->model) + 1);
/* set desired digital video capture format */ /* set desired digital video capture format */
ft_sethdmiinfmt(blob, getenv("hdmiinfmt")); ft_sethdmiinfmt(blob, env_get("hdmiinfmt"));
/* /*
* Board model specific fixups * Board model specific fixups
@ -1315,7 +1315,7 @@ int ft_board_setup(void *blob, bd_t *bd)
} }
#if defined(CONFIG_CMD_PCI) #if defined(CONFIG_CMD_PCI)
if (!getenv("nopcifixup")) if (!env_get("nopcifixup"))
ft_board_pci_fixup(blob, bd); ft_board_pci_fixup(blob, bd);
#endif #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 * remove nodes by alias path if EEPROM config tells us the
* peripheral is not loaded on the board. * peripheral is not loaded on the board.
*/ */
if (getenv("fdt_noconfig")) { if (env_get("fdt_noconfig")) {
puts(" Skiping periperhal config (fdt_noconfig defined)\n"); puts(" Skiping periperhal config (fdt_noconfig defined)\n");
return 0; return 0;
} }

View file

@ -691,7 +691,7 @@ int spl_start_uboot(void)
#ifdef CONFIG_SPL_ENV_SUPPORT #ifdef CONFIG_SPL_ENV_SUPPORT
env_init(); env_init();
env_load(); env_load();
debug("boot_os=%s\n", getenv("boot_os")); debug("boot_os=%s\n", env_get("boot_os"));
if (getenv_yesno("boot_os") == 1) if (getenv_yesno("boot_os") == 1)
ret = 0; ret = 0;
#else #else

View file

@ -129,12 +129,12 @@ int load_and_run_keyprog(void)
char *hexprog; char *hexprog;
struct key_program *prog; struct key_program *prog;
cmd = getenv("loadkeyprogram"); cmd = env_get("loadkeyprogram");
if (!cmd || run_command(cmd, 0)) if (!cmd || run_command(cmd, 0))
return 1; return 1;
hexprog = getenv("keyprogram"); hexprog = env_get("keyprogram");
if (decode_hexstr(hexprog, &binprog)) if (decode_hexstr(hexprog, &binprog))
return 1; return 1;

View file

@ -103,7 +103,7 @@ int fpga_get_reg(u32 fpga, u16 *reg, off_t regoff, u16 *data)
int checkboard(void) int checkboard(void)
{ {
char *s = getenv("serial#"); char *s = env_get("serial#");
bool hw_type_cat = pca9698_get_value(0x20, 20); bool hw_type_cat = pca9698_get_value(0x20, 20);
puts("Board: "); puts("Board: ");

View file

@ -106,7 +106,7 @@ int fpga_get_reg(u32 fpga, u16 *reg, off_t regoff, u16 *data)
int checkboard(void) int checkboard(void)
{ {
char *s = getenv("serial#"); char *s = env_get("serial#");
bool hw_type_cat = pca9698_get_value(0x20, 18); bool hw_type_cat = pca9698_get_value(0x20, 18);
puts("Board: "); puts("Board: ");

View file

@ -1043,13 +1043,13 @@ static int second_stage_init(void)
goto failure; goto failure;
/* run "prepboot" from env to get "mmcdev" set */ /* run "prepboot" from env to get "mmcdev" set */
cptr = getenv("prepboot"); cptr = env_get("prepboot");
if (cptr && !run_command(cptr, 0)) if (cptr && !run_command(cptr, 0))
mmcdev = getenv("mmcdev"); mmcdev = env_get("mmcdev");
if (!mmcdev) if (!mmcdev)
goto failure; goto failure;
cptr = getenv("ramdiskimage"); cptr = env_get("ramdiskimage");
if (cptr) if (cptr)
image_path = cptr; image_path = cptr;

View file

@ -223,7 +223,7 @@ void hw_watchdog_reset(void)
#ifdef CONFIG_TRAILBLAZER #ifdef CONFIG_TRAILBLAZER
int do_bootd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) 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) int board_early_init_r(void)

View file

@ -126,7 +126,7 @@ int board_late_init(void)
mac_addr[4] = mac_lo & 0xFF; mac_addr[4] = mac_lo & 0xFF;
mac_addr[5] = (mac_lo & 0xFF00) >> 8; mac_addr[5] = (mac_lo & 0xFF00) >> 8;
if (!getenv("ethaddr")) { if (!env_get("ethaddr")) {
printf("<ethaddr> not set. Validating first E-fuse MAC\n"); printf("<ethaddr> not set. Validating first E-fuse MAC\n");
if (is_valid_ethaddr(mac_addr)) if (is_valid_ethaddr(mac_addr))
@ -142,7 +142,7 @@ int board_late_init(void)
mac_addr[4] = mac_lo & 0xFF; mac_addr[4] = mac_lo & 0xFF;
mac_addr[5] = (mac_lo & 0xFF00) >> 8; mac_addr[5] = (mac_lo & 0xFF00) >> 8;
if (!getenv("eth1addr")) { if (!env_get("eth1addr")) {
if (is_valid_ethaddr(mac_addr)) if (is_valid_ethaddr(mac_addr))
eth_env_set_enetaddr("eth1addr", mac_addr); eth_env_set_enetaddr("eth1addr", mac_addr);
} }

View file

@ -149,7 +149,7 @@ int board_mmc_init(bd_t *bis)
static int check_mmc_autodetect(void) static int check_mmc_autodetect(void)
{ {
char *autodetect_str = getenv("mmcautodetect"); char *autodetect_str = env_get("mmcautodetect");
if ((autodetect_str != NULL) && if ((autodetect_str != NULL) &&
(strcmp(autodetect_str, "yes") == 0)) { (strcmp(autodetect_str, "yes") == 0)) {

View file

@ -80,7 +80,7 @@ int misc_init_r(void)
boot_choice = readl(HB_SREG_A9_BOOT_SRC_STAT) & 0xff; boot_choice = readl(HB_SREG_A9_BOOT_SRC_STAT) & 0xff;
sprintf(envbuffer, "bootcmd%d", boot_choice); sprintf(envbuffer, "bootcmd%d", boot_choice);
if (getenv(envbuffer)) { if (env_get(envbuffer)) {
sprintf(envbuffer, "run bootcmd%d", boot_choice); sprintf(envbuffer, "run bootcmd%d", boot_choice);
env_set("bootcmd", envbuffer); env_set("bootcmd", envbuffer);
} else } else

View file

@ -95,10 +95,10 @@ static void assign_hardware_id(void)
int board_late_init(void) int board_late_init(void)
{ {
if (!getenv("serial#")) if (!env_get("serial#"))
assign_serial(); assign_serial();
if (!getenv("hardware_id")) if (!env_get("hardware_id"))
assign_hardware_id(); assign_hardware_id();
return 0; return 0;

View file

@ -54,7 +54,7 @@ int set_km_env(void)
env_set("pnvramaddr", (char *)buf); env_set("pnvramaddr", (char *)buf);
/* try to read rootfssize (ram image) from environment */ /* try to read rootfssize (ram image) from environment */
p = getenv("rootfssize"); p = env_get("rootfssize");
if (p != NULL) if (p != NULL)
strict_strtoul(p, 16, &rootfssize); strict_strtoul(p, 16, &rootfssize);
pram = (rootfssize + CONFIG_KM_RESERVED_PRAM + CONFIG_KM_PHRAM + 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 */ /* now try to read values from environment if available */
p = getenv("boardid"); p = env_get("boardid");
if (p != NULL) if (p != NULL)
rc = strict_strtoul(p, 16, &envbid); rc = strict_strtoul(p, 16, &envbid);
p = getenv("hwkey"); p = env_get("hwkey");
if (p != NULL) if (p != NULL)
rc = strict_strtoul(p, 16, &envhwkey); 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 * BoardId/HWkey not available in the environment, so try the
* environment variable for BoardId/HWkey list * environment variable for BoardId/HWkey list
*/ */
char *bidhwklist = getenv("boardIdListHex"); char *bidhwklist = env_get("boardIdListHex");
if (bidhwklist) { if (bidhwklist) {
int found = 0; int found = 0;
@ -355,7 +355,7 @@ static int do_checktestboot(cmd_tbl_t *cmdtp, int flag, int argc,
#if defined(CONFIG_POST) #if defined(CONFIG_POST)
testpin = post_hotkeys_pressed(); testpin = post_hotkeys_pressed();
#endif #endif
s = getenv("test_bank"); s = env_get("test_bank");
/* when test_bank is not set, act as if testpin is not asserted */ /* when test_bank is not set, act as if testpin is not asserted */
testboot = (testpin != 0) && (s); testboot = (testpin != 0) && (s);
if (verbose) { if (verbose) {

View file

@ -261,7 +261,7 @@ int ivm_analyze_eeprom(unsigned char *buf, int len)
GET_STRING("IVM_Symbol", IVM_POS_SYMBOL_ONLY, 8) GET_STRING("IVM_Symbol", IVM_POS_SYMBOL_ONLY, 8)
GET_STRING("IVM_DeviceName", IVM_POS_SHORT_TEXT, 64) GET_STRING("IVM_DeviceName", IVM_POS_SHORT_TEXT, 64)
tmp = (unsigned char *) getenv("IVM_DeviceName"); tmp = (unsigned char *)env_get("IVM_DeviceName");
if (tmp) { if (tmp) {
int len = strlen((char *)tmp); int len = strlen((char *)tmp);
int i = 0; int i = 0;

View file

@ -201,7 +201,7 @@ int misc_init_r(void)
#if defined(CONFIG_KM_MGCOGE3UN) #if defined(CONFIG_KM_MGCOGE3UN)
char *wait_for_ne; char *wait_for_ne;
u8 dip_switch = kw_gpio_get_value(KM_FLASH_ERASE_ENABLE); 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 ((wait_for_ne != NULL) && (dip_switch == 0)) {
if (strcmp(wait_for_ne, "true") == 0) { if (strcmp(wait_for_ne, "true") == 0) {

View file

@ -239,7 +239,7 @@ void fdt_fixup_fman_mac_addresses(void *blob)
unsigned char mac_addr[6]; unsigned char mac_addr[6];
/* get the mac addr from env */ /* get the mac addr from env */
tmp = getenv("ethaddr"); tmp = env_get("ethaddr");
if (!tmp) { if (!tmp) {
printf("ethaddr env variable not defined\n"); printf("ethaddr env variable not defined\n");
return; return;

View file

@ -240,7 +240,7 @@ int misc_init_r(void)
int ret; int ret;
/* If 'ethaddr' is already set, do nothing. */ /* If 'ethaddr' is already set, do nothing. */
if (getenv("ethaddr")) if (env_get("ethaddr"))
return 0; return 0;
/* EEPROM is at bus 2. */ /* EEPROM is at bus 2. */

View file

@ -133,7 +133,7 @@ int misc_init_r(void)
} }
if (reboot_mode[0] > 0 && isascii(reboot_mode[0])) { 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); env_set("reboot-mode", (char *)reboot_mode);
} }

View file

@ -467,7 +467,7 @@ int spl_start_uboot(void)
return 1; return 1;
env_init(); 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)) if ((ret != -1) && (strcmp(s, "no") == 0))
return 1; return 1;
@ -481,7 +481,7 @@ int spl_start_uboot(void)
* recovery_status = <any value> -> start SWUpdate * 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) if (ret != -1)
return 1; return 1;

View file

@ -219,7 +219,7 @@ int board_late_init(void)
gd->bd->bi_arch_number = board->machine_id; gd->bd->bi_arch_number = board->machine_id;
/* If the user has not set fdtimage, set the default */ /* If the user has not set fdtimage, set the default */
if (!getenv("fdtimage")) if (!env_get("fdtimage"))
env_set("fdtimage", board->fdtfile); env_set("fdtimage", board->fdtfile);
} }

View file

@ -72,7 +72,7 @@ int dram_init(void)
int checkboard(void) int checkboard(void)
{ {
char buf[64]; 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(); u32 config0 = read_c0_prid();
if ((config0 & 0xff0000) == PRID_COMP_LEGACY if ((config0 & 0xff0000) == PRID_COMP_LEGACY

View file

@ -234,18 +234,18 @@ void setup_board_tags(struct tag **in_params)
params->u.core.rootdev = 0x0; params->u.core.rootdev = 0x0;
/* append omap atag only if env setup_omap_atag is set to 1 */ /* 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') if (!str || str[0] != '1')
return; return;
str = getenv("setup_console_atag"); str = env_get("setup_console_atag");
if (str && str[0] == '1') if (str && str[0] == '1')
setup_console_atag = 1; setup_console_atag = 1;
else else
setup_console_atag = 0; setup_console_atag = 0;
setup_boot_reason_atag = getenv("setup_boot_reason_atag"); setup_boot_reason_atag = env_get("setup_boot_reason_atag");
setup_boot_mode_atag = getenv("setup_boot_mode_atag"); setup_boot_mode_atag = env_get("setup_boot_mode_atag");
params = *in_params; params = *in_params;
t = (struct tag_omap *)&params->u; t = (struct tag_omap *)&params->u;

View file

@ -247,7 +247,7 @@ static void set_fdtfile(void)
{ {
const char *fdtfile; const char *fdtfile;
if (getenv("fdtfile")) if (env_get("fdtfile"))
return; return;
fdtfile = model->fdtfile; fdtfile = model->fdtfile;
@ -260,7 +260,7 @@ static void set_fdtfile(void)
*/ */
static void set_fdt_addr(void) static void set_fdt_addr(void)
{ {
if (getenv("fdt_addr")) if (env_get("fdt_addr"))
return; return;
if (fdt_magic(fw_dtb_pointer) != FDT_MAGIC) if (fdt_magic(fw_dtb_pointer) != FDT_MAGIC)
@ -287,7 +287,7 @@ static void set_usbethaddr(void)
if (!model->has_onboard_eth) if (!model->has_onboard_eth)
return; return;
if (getenv("usbethaddr")) if (env_get("usbethaddr"))
return; return;
BCM2835_MBOX_INIT_HDR(msg); 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); eth_env_set_enetaddr("usbethaddr", msg->get_mac_address.body.resp.mac);
if (!getenv("ethaddr")) if (!env_get("ethaddr"))
env_set("ethaddr", getenv("usbethaddr")); env_set("ethaddr", env_get("usbethaddr"));
return; return;
} }
@ -330,7 +330,7 @@ static void set_serial_number(void)
int ret; int ret;
char serial_string[17] = { 0 }; char serial_string[17] = { 0 };
if (getenv("serial#")) if (env_get("serial#"))
return; return;
BCM2835_MBOX_INIT_HDR(msg); BCM2835_MBOX_INIT_HDR(msg);

View file

@ -179,7 +179,7 @@ char *get_dfu_alt_system(char *interface, char *devstr)
if (board_is_odroidxu4()) if (board_is_odroidxu4())
return info; return info;
return getenv("dfu_alt_system"); return env_get("dfu_alt_system");
} }
char *get_dfu_alt_boot(char *interface, char *devstr) char *get_dfu_alt_boot(char *interface, char *devstr)

View file

@ -66,7 +66,7 @@ const char *get_board_type(void)
#ifdef CONFIG_SET_DFU_ALT_INFO #ifdef CONFIG_SET_DFU_ALT_INFO
char *get_dfu_alt_system(char *interface, char *devstr) 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) char *get_dfu_alt_boot(char *interface, char *devstr)

View file

@ -131,7 +131,7 @@ int board_eth_init(bd_t *bis)
/* just to get secound mac address */ /* just to get secound mac address */
imx_get_mac_from_fuse(1, eth1addr); 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); eth_env_set_enetaddr("eth1addr", eth1addr);
imx_iomux_v3_setup_multiple_pads(fec1_pads, ARRAY_SIZE(fec1_pads)); imx_iomux_v3_setup_multiple_pads(fec1_pads, ARRAY_SIZE(fec1_pads));

View file

@ -76,7 +76,7 @@ int misc_init_r(void)
} }
/* If 'unit_serial' is already set, do nothing. */ /* If 'unit_serial' is already set, do nothing. */
if (!getenv("unit_serial")) { if (!env_get("unit_serial")) {
/* This field is Big Endian ! */ /* This field is Big Endian ! */
serial = (data[0x54] << 24) | (data[0x55] << 16) | serial = (data[0x54] << 24) | (data[0x55] << 16) |
(data[0x56] << 8) | (data[0x57] << 0); (data[0x56] << 8) | (data[0x57] << 0);
@ -85,14 +85,14 @@ int misc_init_r(void)
env_set("unit_serial", str); env_set("unit_serial", str);
} }
if (!getenv("unit_ident")) { if (!env_get("unit_ident")) {
memset(str, 0, sizeof(str)); memset(str, 0, sizeof(str));
memcpy(str, &data[0x2e], 18); memcpy(str, &data[0x2e], 18);
env_set("unit_ident", str); env_set("unit_ident", str);
} }
/* Set ethernet address from EEPROM. */ /* 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]); eth_env_set_enetaddr("ethaddr", &data[0x62]);
return 0; return 0;

View file

@ -121,7 +121,7 @@ unsigned char get_button_state(char * const envname, unsigned char def)
char *ptr_env; char *ptr_env;
/* If button is not found we take default */ /* If button is not found we take default */
ptr_env = getenv(envname); ptr_env = env_get(envname);
if (NULL == ptr_env) { if (NULL == ptr_env) {
gpio = def; gpio = def;
} else { } else {
@ -199,7 +199,7 @@ void set_env_gpios(unsigned char state)
strcat(str_tmp, num); strcat(str_tmp, num);
/* If env var is not found we stop */ /* If env var is not found we stop */
ptr_env = getenv(str_tmp); ptr_env = env_get(str_tmp);
if (NULL == ptr_env) if (NULL == ptr_env)
break; break;

View file

@ -377,7 +377,7 @@ static int upgrade_failure_fallback(void)
char *kern_size; char *kern_size;
char *kern_size_fb; char *kern_size_fb;
partitionset_active = getenv("partitionset_active"); partitionset_active = env_get("partitionset_active");
if (partitionset_active) { if (partitionset_active) {
if (partitionset_active[0] == 'A') if (partitionset_active[0] == 'A')
env_set("partitionset_active", "B"); env_set("partitionset_active", "B");
@ -388,18 +388,18 @@ static int upgrade_failure_fallback(void)
return -ENOENT; return -ENOENT;
} }
rootfs = getenv("rootfs"); rootfs = env_get("rootfs");
rootfs_fallback = getenv("rootfs_fallback"); rootfs_fallback = env_get("rootfs_fallback");
env_set("rootfs", rootfs_fallback); env_set("rootfs", rootfs_fallback);
env_set("rootfs_fallback", rootfs); env_set("rootfs_fallback", rootfs);
kern_size = getenv("kernel_size"); kern_size = env_get("kernel_size");
kern_size_fb = getenv("kernel_size_fallback"); kern_size_fb = env_get("kernel_size_fallback");
env_set("kernel_size", kern_size_fb); env_set("kernel_size", kern_size_fb);
env_set("kernel_size_fallback", kern_size); env_set("kernel_size_fallback", kern_size);
kern_off = getenv("kernel_Off"); kern_off = env_get("kernel_Off");
kern_off_fb = getenv("kernel_Off_fallback"); kern_off_fb = env_get("kernel_Off_fallback");
env_set("kernel_Off", kern_off_fb); env_set("kernel_Off", kern_off_fb);
env_set("kernel_Off_fallback", kern_off); 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; unsigned long boot_retry = 0;
char boot_buf[10]; char boot_buf[10];
upgrade_available = simple_strtoul(getenv("upgrade_available"), NULL, upgrade_available = simple_strtoul(env_get("upgrade_available"), NULL,
10); 10);
if (upgrade_available) { if (upgrade_available) {
boot_retry = simple_strtoul(getenv("boot_retries"), NULL, 10); boot_retry = simple_strtoul(env_get("boot_retries"), NULL, 10);
boot_retry++; boot_retry++;
sprintf(boot_buf, "%lx", boot_retry); sprintf(boot_buf, "%lx", boot_retry);
env_set("boot_retries", boot_buf); env_set("boot_retries", boot_buf);

View file

@ -38,7 +38,7 @@ int checkboard (void)
volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
char buf[64]; char buf[64];
int f; int f;
int i = getenv_f("serial#", buf, sizeof(buf)); int i = env_get_f("serial#", buf, sizeof(buf));
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
char *src; char *src;
#endif #endif
@ -409,7 +409,7 @@ void board_backlight_switch (int flag)
printf ("hwmon IC init failed\n"); printf ("hwmon IC init failed\n");
if (flag) { if (flag) {
param = getenv("brightness"); param = env_get("brightness");
rc = param ? simple_strtol(param, NULL, 10) : -1; rc = param ? simple_strtol(param, NULL, 10) : -1;
if (rc < 0) if (rc < 0)
rc = DEFAULT_BRIGHTNESS; rc = DEFAULT_BRIGHTNESS;

View file

@ -314,7 +314,7 @@ int misc_init_r(void)
char serialno[25]; char serialno[25];
uint32_t u_id_low, u_id_mid, u_id_high; 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_low = readl(&STM32_U_ID->u_id_low);
u_id_mid = readl(&STM32_U_ID->u_id_mid); u_id_mid = readl(&STM32_U_ID->u_id_mid);
u_id_high = readl(&STM32_U_ID->u_id_high); u_id_high = readl(&STM32_U_ID->u_id_high);

View file

@ -602,7 +602,7 @@ void get_board_serial(struct tag_serialnr *serialnr)
char *serial_string; char *serial_string;
unsigned long long serial; unsigned long long serial;
serial_string = getenv("serial#"); serial_string = env_get("serial#");
if (serial_string) { if (serial_string) {
serial = simple_strtoull(serial_string, NULL, 16); serial = simple_strtoull(serial_string, NULL, 16);
@ -694,7 +694,7 @@ static void setup_environment(const void *fdt)
else else
sprintf(ethaddr, "eth%daddr", i); sprintf(ethaddr, "eth%daddr", i);
if (getenv(ethaddr)) if (env_get(ethaddr))
continue; continue;
/* Non OUI / registered MAC address */ /* Non OUI / registered MAC address */
@ -708,7 +708,7 @@ static void setup_environment(const void *fdt)
eth_env_set_enetaddr(ethaddr, mac_addr); eth_env_set_enetaddr(ethaddr, mac_addr);
} }
if (!getenv("serial#")) { if (!env_get("serial#")) {
snprintf(serial_string, sizeof(serial_string), snprintf(serial_string, sizeof(serial_string),
"%08x%08x", sid[0], sid[3]); "%08x%08x", sid[0], sid[3]);

View file

@ -146,7 +146,7 @@ int board_late_init(void)
udelay(5000); udelay(5000);
#endif #endif
e = getenv("gs_base_board"); e = env_get("gs_base_board");
if (e != NULL) { if (e != NULL) {
if (strcmp(e, "G283") == 0) { if (strcmp(e, "G283") == 0) {
int key = gpio_get_value(IMX_GPIO_NR(2, 29)); int key = gpio_get_value(IMX_GPIO_NR(2, 29));

View file

@ -322,7 +322,7 @@ int board_eth_init(bd_t *bis)
#if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \ #if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \
(defined(CONFIG_SPL_ETH_SUPPORT) && 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"); printf("<ethaddr> not set. Validating first E-fuse MAC\n");
if (is_valid_ethaddr(mac_addr)) 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[4] = mac_lo & 0xFF;
mac_addr[5] = (mac_lo & 0xFF00) >> 8; mac_addr[5] = (mac_lo & 0xFF00) >> 8;
if (!getenv("eth1addr")) { if (!env_get("eth1addr")) {
if (is_valid_ethaddr(mac_addr)) if (is_valid_ethaddr(mac_addr))
eth_env_set_enetaddr("eth1addr", mac_addr); eth_env_set_enetaddr("eth1addr", mac_addr);
} }

View file

@ -94,7 +94,7 @@ int misc_init_r(void)
omap_die_id_display(); omap_die_id_display();
eth_addr = getenv("ethaddr"); eth_addr = env_get("ethaddr");
if (eth_addr) if (eth_addr)
return 0; return 0;

View file

@ -261,7 +261,7 @@ int misc_init_r(void)
if (ret) if (ret)
return 0; return 0;
eth_addr = getenv("ethaddr"); eth_addr = env_get("ethaddr");
if (!eth_addr) if (!eth_addr)
TAM3517_READ_MAC_FROM_EEPROM(&info); TAM3517_READ_MAC_FROM_EEPROM(&info);
@ -311,7 +311,7 @@ int board_video_init(void)
fb = (void *)0x88000000; fb = (void *)0x88000000;
s = getenv("panel"); s = env_get("panel");
if (s) { if (s) {
index = simple_strtoul(s, NULL, 10); index = simple_strtoul(s, NULL, 10);
if (index < ARRAY_SIZE(lcd_cfg)) if (index < ARRAY_SIZE(lcd_cfg))

Some files were not shown because too many files have changed in this diff Show more