Commit 382bee57 authored by Simon Glass's avatar Simon Glass Committed by Tom Rini
Browse files

env: Rename setenv() to env_set()



We are now using an env_ prefix for environment functions. Rename setenv()
for consistency. Also add function comments in common.h.
Suggested-by: default avatarWolfgang Denk <wd@denx.de>
Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
parent 01510091
......@@ -481,7 +481,7 @@ static int API_env_set(va_list ap)
if ((value = (char *)va_arg(ap, uintptr_t)) == NULL)
return API_EINVAL;
setenv(name, value);
env_set(name, value);
return 0;
}
......
......@@ -329,7 +329,7 @@ int arch_misc_init(void)
strcpy(soc, "vf");
strcat(soc, soc_type);
setenv("soc", soc);
env_set("soc", soc);
return 0;
}
......
......@@ -200,7 +200,7 @@ static int do_smhload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
/* Optionally save returned end to the environment */
if (argc == 4) {
sprintf(end_str, "0x%08lx", end_addr);
setenv(argv[3], end_str);
env_set(argv[3], end_str);
}
} else {
return CMD_RET_USAGE;
......
......@@ -132,7 +132,7 @@ int board_late_init(void)
/* In bootstrap don't use the env vars */
if (((reg & 0x3000000) >> 24) == 0x1) {
set_default_env(NULL);
setenv("preboot", "");
env_set("preboot", "");
}
return opos6ul_board_late_init();
......
......@@ -256,9 +256,9 @@ int arch_misc_init(void)
{
#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
if (is_mx7d())
setenv("soc", "imx7d");
env_set("soc", "imx7d");
else
setenv("soc", "imx7s");
env_set("soc", "imx7s");
#endif
return 0;
......
......@@ -241,7 +241,7 @@ void arch_preboot_os(void)
int fb_set_reboot_flag(void)
{
printf("Setting reboot to fastboot flag ...\n");
setenv("dofastboot", "1");
env_set("dofastboot", "1");
env_save();
return 0;
}
......
......@@ -40,7 +40,7 @@ static void omap_set_fastboot_cpu(void)
printf("Warning: fastboot.cpu: unknown CPU rev: %u\n", cpu_rev);
}
setenv("fastboot.cpu", cpu);
env_set("fastboot.cpu", cpu);
}
static void omap_set_fastboot_secure(void)
......@@ -63,7 +63,7 @@ static void omap_set_fastboot_secure(void)
printf("Warning: fastboot.secure: unknown CPU sec: %u\n", dev);
}
setenv("fastboot.secure", secure);
env_set("fastboot.secure", secure);
}
static void omap_set_fastboot_board_rev(void)
......@@ -74,7 +74,7 @@ static void omap_set_fastboot_board_rev(void)
if (board_rev == NULL)
printf("Warning: fastboot.board_rev: unknown board revision\n");
setenv("fastboot.board_rev", board_rev);
env_set("fastboot.board_rev", board_rev);
}
#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
......@@ -118,7 +118,7 @@ static void omap_set_fastboot_userdata_size(void)
sprintf(buf, "%u", sz_kb);
}
setenv("fastboot.userdata_size", buf);
env_set("fastboot.userdata_size", buf);
}
#else
static inline void omap_set_fastboot_userdata_size(void)
......@@ -173,7 +173,7 @@ void omap_die_id_serial(void)
snprintf(serial_string, sizeof(serial_string),
"%08x%08x", die_id[0], die_id[3]);
setenv("serial#", serial_string);
env_set("serial#", serial_string);
}
}
......
......@@ -34,11 +34,11 @@ static void setup_boot_mode(void)
switch (boot_mode) {
case BOOT_FASTBOOT:
printf("enter fastboot!\n");
setenv("preboot", "setenv preboot; fastboot usb0");
env_set("preboot", "setenv preboot; fastboot usb0");
break;
case BOOT_UMS:
printf("enter UMS!\n");
setenv("preboot", "setenv preboot; ums mmc 0");
env_set("preboot", "setenv preboot; ums mmc 0");
break;
}
}
......
......@@ -30,11 +30,11 @@ static void setup_boot_mode(void)
switch (boot_mode) {
case BOOT_FASTBOOT:
printf("enter fastboot!\n");
setenv("preboot", "setenv preboot; fastboot usb0");
env_set("preboot", "setenv preboot; fastboot usb0");
break;
case BOOT_UMS:
printf("enter UMS!\n");
setenv("preboot", "setenv preboot; ums mmc 0");
env_set("preboot", "setenv preboot; ums mmc 0");
break;
}
}
......
......@@ -37,11 +37,11 @@ static void setup_boot_mode(void)
switch (boot_mode) {
case BOOT_FASTBOOT:
printf("enter fastboot!\n");
setenv("preboot", "setenv preboot; fastboot usb0");
env_set("preboot", "setenv preboot; fastboot usb0");
break;
case BOOT_UMS:
printf("enter UMS!\n");
setenv("preboot", "setenv preboot; if mmc dev 0;"
env_set("preboot", "setenv preboot; if mmc dev 0;"
"then ums mmc 0; else ums mmc 1;fi");
break;
}
......
......@@ -219,9 +219,9 @@ int arch_misc_init(void)
{
const u32 bsel = readl(&sysmgr_regs->bootinfo) & 0x7;
const int fpga_id = socfpga_fpga_id(0);
setenv("bootmode", bsel_str[bsel].mode);
env_set("bootmode", bsel_str[bsel].mode);
if (fpga_id >= 0)
setenv("fpgatype", socfpga_fpga_model[fpga_id].var);
env_set("fpgatype", socfpga_fpga_model[fpga_id].var);
return socfpga_eth_reset();
}
#endif
......
......@@ -214,9 +214,9 @@ int board_late_init(void)
#if defined(CONFIG_TEGRA_SUPPORT_NON_SECURE)
if (tegra_cpu_is_non_secure()) {
printf("CPU is in NS mode\n");
setenv("cpu_ns_mode", "1");
env_set("cpu_ns_mode", "1");
} else {
setenv("cpu_ns_mode", "");
env_set("cpu_ns_mode", "");
}
#endif
start_cpu_fan();
......
......@@ -49,7 +49,7 @@ static int set_ethaddr_from_nvtboot(void)
return -ENOENT;
}
ret = setenv("ethaddr", (void *)prop);
ret = env_set("ethaddr", (void *)prop);
if (ret) {
printf("Failed to set ethaddr from nvtboot DTB: %d\n", ret);
return ret;
......
......@@ -55,7 +55,7 @@ static int uniphier_set_fdt_file(void)
strncat(dtb_name, ".dtb", buf_len);
return setenv("fdt_file", dtb_name);
return env_set("fdt_file", dtb_name);
}
int board_late_init(void)
......@@ -65,20 +65,20 @@ int board_late_init(void)
switch (uniphier_boot_device_raw()) {
case BOOT_DEVICE_MMC1:
printf("eMMC Boot");
setenv("bootmode", "emmcboot");
env_set("bootmode", "emmcboot");
break;
case BOOT_DEVICE_NAND:
printf("NAND Boot");
setenv("bootmode", "nandboot");
env_set("bootmode", "nandboot");
nand_denali_wp_disable();
break;
case BOOT_DEVICE_NOR:
printf("NOR Boot");
setenv("bootmode", "norboot");
env_set("bootmode", "norboot");
break;
case BOOT_DEVICE_USB:
printf("USB Boot");
setenv("bootmode", "usbboot");
env_set("bootmode", "usbboot");
break;
default:
printf("Unknown");
......
......@@ -138,7 +138,7 @@ int get_arc_info(void)
printf("\t<not found>\n");
} else {
printf("\t%s\n", smac[3]);
setenv("SERIAL", smac[3]);
env_set("SERIAL", smac[3]);
}
}
......@@ -152,7 +152,7 @@ int get_arc_info(void)
char *ret = getenv("ethaddr");
if (strcmp(ret, __stringify(CONFIG_ETHADDR)) == 0) {
setenv("ethaddr", smac[2]);
env_set("ethaddr", smac[2]);
printf("\t%s (factory)\n", smac[2]);
} else {
printf("\t%s\n", ret);
......@@ -160,8 +160,8 @@ int get_arc_info(void)
}
if (strcmp(smac[1], "00:00:00:00:00:00") == 0) {
setenv("eth1addr", smac[2]);
setenv("eth2addr", smac[2]);
env_set("eth1addr", smac[2]);
env_set("eth2addr", smac[2]);
return 0;
}
......@@ -172,7 +172,7 @@ int get_arc_info(void)
char *ret = getenv("eth1addr");
if (strcmp(ret, __stringify(CONFIG_ETH1ADDR)) == 0) {
setenv("eth1addr", smac[1]);
env_set("eth1addr", smac[1]);
printf("\t%s (factory)\n", smac[1]);
} else {
printf("\t%s\n", ret);
......@@ -180,7 +180,7 @@ int get_arc_info(void)
}
if (strcmp(smac[0], "00:00:00:00:00:00") == 0) {
setenv("eth2addr", smac[1]);
env_set("eth2addr", smac[1]);
return 0;
}
......@@ -191,7 +191,7 @@ int get_arc_info(void)
char *ret = getenv("eth2addr");
if (strcmp(ret, __stringify(CONFIG_ETH2ADDR)) == 0) {
setenv("eth2addr", smac[0]);
env_set("eth2addr", smac[0]);
printf("\t%s (factory)\n", smac[0]);
} else {
printf("\t%s\n", ret);
......
......@@ -230,9 +230,9 @@ int last_stage_init(void)
strcat(newkernelargs, mmckargs);
strcat(newkernelargs, " ");
strcat(newkernelargs, &tmp[n]);
setenv("kernelargs", newkernelargs);
env_set("kernelargs", newkernelargs);
} else {
setenv("kernelargs", mmckargs);
env_set("kernelargs", mmckargs);
}
}
get_arc_info();
......@@ -244,7 +244,7 @@ int last_stage_init(void)
strcat(newkernelargs, sval);
strcat(newkernelargs, " ");
strcat(newkernelargs, kval);
setenv("kernelargs", newkernelargs);
env_set("kernelargs", newkernelargs);
}
} else {
printf("Error reading kernelargs env variable!\n");
......
......@@ -167,7 +167,7 @@ int board_late_init(void)
lcd_position_cursor(1, 8);
lcd_puts(
"switching to network-console ... ");
setenv("bootcmd", "run netconsole");
env_set("bootcmd", "run netconsole");
}
return 0;
}
......
......@@ -203,7 +203,7 @@ int board_late_init(void)
lcd_position_cursor(1, 8);
lcd_puts(
"switching to network-console ... ");
setenv("bootcmd", "run netconsole");
env_set("bootcmd", "run netconsole");
cnt = 4;
break;
} else if (!gpio_get_value(ESC_KEY) &&
......@@ -211,7 +211,7 @@ int board_late_init(void)
lcd_position_cursor(1, 8);
lcd_puts(
"starting u-boot script from USB ... ");
setenv("bootcmd", "run usbscript");
env_set("bootcmd", "run usbscript");
cnt = 4;
break;
} else if ((!gpio_get_value(ESC_KEY) &&
......@@ -221,7 +221,7 @@ int board_late_init(void)
lcd_position_cursor(1, 8);
lcd_puts(
"starting script from network ... ");
setenv("bootcmd", "run netscript");
env_set("bootcmd", "run netscript");
cnt = 4;
break;
} else if (!gpio_get_value(ESC_KEY)) {
......@@ -232,19 +232,19 @@ int board_late_init(void)
lcd_position_cursor(1, 8);
lcd_puts(
"starting vxworks from network ... ");
setenv("bootcmd", "run netboot");
env_set("bootcmd", "run netboot");
cnt = 4;
} else if (scratchreg == 0xCD) {
lcd_position_cursor(1, 8);
lcd_puts(
"starting script from network ... ");
setenv("bootcmd", "run netscript");
env_set("bootcmd", "run netscript");
cnt = 4;
} else if (scratchreg == 0xCE) {
lcd_position_cursor(1, 8);
lcd_puts(
"starting AR from eMMC ... ");
setenv("bootcmd", "run mmcboot");
env_set("bootcmd", "run mmcboot");
cnt = 4;
}
......@@ -252,7 +252,7 @@ int board_late_init(void)
switch (cnt) {
case 0:
lcd_puts("entering BOOT-mode. ");
setenv("bootcmd", "run defaultAR");
env_set("bootcmd", "run defaultAR");
buf = 0x0000;
break;
case 1:
......@@ -285,7 +285,7 @@ int board_late_init(void)
(u32)getenv_ulong("vx_memtop", 16, gd->fb_base-0x20),
(u32)getenv_ulong("vx_romfsbase", 16, 0),
(u32)getenv_ulong("vx_romfssize", 16, 0));
setenv("othbootargs", othbootargs);
env_set("othbootargs", othbootargs);
/*
* reset VBAR registers to its reset location, VxWorks 6.9.3.2 does
* expect that vectors are there, original u-boot moves them to _start
......
......@@ -184,7 +184,7 @@ int load_lcdtiming(struct am335x_lcdpanel *panel)
puts("no 'factory-settings / rotation' in dtb!\n");
}
snprintf(buf, sizeof(buf), "fbcon=rotate:%d", panel_info.vl_rot);
setenv("optargs_rot", buf);
env_set("optargs_rot", buf);
#else
pnltmp.hactive = getenv_ulong("ds1_hactive", 10, ~0UL);
pnltmp.vactive = getenv_ulong("ds1_vactive", 10, ~0UL);
......
......@@ -285,7 +285,7 @@ static int set_regdomain(void)
puts("EEPROM regdomain read failed.\n");
printf("Regdomain set to %s\n", rd);
return setenv("regdomain", rd);
return env_set("regdomain", rd);
}
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment