env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()
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>
This commit is contained in:
parent
00caae6d47
commit
bfebc8c965
@ -31,7 +31,7 @@ u32 get_my_id()
|
|||||||
int hold_cores_in_reset(int verbose)
|
int hold_cores_in_reset(int verbose)
|
||||||
{
|
{
|
||||||
/* Default to no, overridden by 'y', 'yes', 'Y', 'Yes', or '1' */
|
/* 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) {
|
if (verbose) {
|
||||||
puts("Secondary cores are being held in reset.\n");
|
puts("Secondary cores are being held in reset.\n");
|
||||||
puts("See 'mp_holdoff' environment variable\n");
|
puts("See 'mp_holdoff' environment variable\n");
|
||||||
|
@ -282,9 +282,9 @@ int board_late_init(void)
|
|||||||
snprintf(othbootargs, sizeof(othbootargs),
|
snprintf(othbootargs, sizeof(othbootargs),
|
||||||
"u=vxWorksFTP pw=vxWorks o=0x%08x;0x%08x;0x%08x;0x%08x",
|
"u=vxWorksFTP pw=vxWorks o=0x%08x;0x%08x;0x%08x;0x%08x",
|
||||||
(unsigned int) gd->fb_base-0x20,
|
(unsigned int) gd->fb_base-0x20,
|
||||||
(u32)getenv_ulong("vx_memtop", 16, gd->fb_base-0x20),
|
(u32)env_get_ulong("vx_memtop", 16, gd->fb_base-0x20),
|
||||||
(u32)getenv_ulong("vx_romfsbase", 16, 0),
|
(u32)env_get_ulong("vx_romfsbase", 16, 0),
|
||||||
(u32)getenv_ulong("vx_romfssize", 16, 0));
|
(u32)env_get_ulong("vx_romfssize", 16, 0));
|
||||||
env_set("othbootargs", othbootargs);
|
env_set("othbootargs", othbootargs);
|
||||||
/*
|
/*
|
||||||
* reset VBAR registers to its reset location, VxWorks 6.9.3.2 does
|
* reset VBAR registers to its reset location, VxWorks 6.9.3.2 does
|
||||||
|
@ -58,9 +58,9 @@ void lcdbacklight(int on)
|
|||||||
unsigned int bright = FDTPROP(PATHINF, "brightdef");
|
unsigned int bright = FDTPROP(PATHINF, "brightdef");
|
||||||
unsigned int pwmfrq = FDTPROP(PATHINF, "brightfdim");
|
unsigned int pwmfrq = FDTPROP(PATHINF, "brightfdim");
|
||||||
#else
|
#else
|
||||||
unsigned int driver = getenv_ulong("ds1_bright_drv", 16, 0UL);
|
unsigned int driver = env_get_ulong("ds1_bright_drv", 16, 0UL);
|
||||||
unsigned int bright = getenv_ulong("ds1_bright_def", 10, 50);
|
unsigned int bright = env_get_ulong("ds1_bright_def", 10, 50);
|
||||||
unsigned int pwmfrq = getenv_ulong("ds1_pwmfreq", 10, ~0UL);
|
unsigned int pwmfrq = env_get_ulong("ds1_pwmfreq", 10, ~0UL);
|
||||||
#endif
|
#endif
|
||||||
unsigned int tmp;
|
unsigned int tmp;
|
||||||
struct gptimer *timerhw;
|
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);
|
snprintf(buf, sizeof(buf), "fbcon=rotate:%d", panel_info.vl_rot);
|
||||||
env_set("optargs_rot", buf);
|
env_set("optargs_rot", buf);
|
||||||
#else
|
#else
|
||||||
pnltmp.hactive = getenv_ulong("ds1_hactive", 10, ~0UL);
|
pnltmp.hactive = env_get_ulong("ds1_hactive", 10, ~0UL);
|
||||||
pnltmp.vactive = getenv_ulong("ds1_vactive", 10, ~0UL);
|
pnltmp.vactive = env_get_ulong("ds1_vactive", 10, ~0UL);
|
||||||
pnltmp.bpp = getenv_ulong("ds1_bpp", 10, ~0UL);
|
pnltmp.bpp = env_get_ulong("ds1_bpp", 10, ~0UL);
|
||||||
pnltmp.hfp = getenv_ulong("ds1_hfp", 10, ~0UL);
|
pnltmp.hfp = env_get_ulong("ds1_hfp", 10, ~0UL);
|
||||||
pnltmp.hbp = getenv_ulong("ds1_hbp", 10, ~0UL);
|
pnltmp.hbp = env_get_ulong("ds1_hbp", 10, ~0UL);
|
||||||
pnltmp.hsw = getenv_ulong("ds1_hsw", 10, ~0UL);
|
pnltmp.hsw = env_get_ulong("ds1_hsw", 10, ~0UL);
|
||||||
pnltmp.vfp = getenv_ulong("ds1_vfp", 10, ~0UL);
|
pnltmp.vfp = env_get_ulong("ds1_vfp", 10, ~0UL);
|
||||||
pnltmp.vbp = getenv_ulong("ds1_vbp", 10, ~0UL);
|
pnltmp.vbp = env_get_ulong("ds1_vbp", 10, ~0UL);
|
||||||
pnltmp.vsw = getenv_ulong("ds1_vsw", 10, ~0UL);
|
pnltmp.vsw = env_get_ulong("ds1_vsw", 10, ~0UL);
|
||||||
pnltmp.pxl_clk_div = getenv_ulong("ds1_pxlclkdiv", 10, ~0UL);
|
pnltmp.pxl_clk_div = env_get_ulong("ds1_pxlclkdiv", 10, ~0UL);
|
||||||
pnltmp.pol = getenv_ulong("ds1_pol", 16, ~0UL);
|
pnltmp.pol = env_get_ulong("ds1_pol", 16, ~0UL);
|
||||||
pnltmp.pup_delay = getenv_ulong("ds1_pupdelay", 10, ~0UL);
|
pnltmp.pup_delay = env_get_ulong("ds1_pupdelay", 10, ~0UL);
|
||||||
pnltmp.pon_delay = getenv_ulong("ds1_tondelay", 10, ~0UL);
|
pnltmp.pon_delay = env_get_ulong("ds1_tondelay", 10, ~0UL);
|
||||||
panel_info.vl_rot = getenv_ulong("ds1_rotation", 10, 0);
|
panel_info.vl_rot = env_get_ulong("ds1_rotation", 10, 0);
|
||||||
#endif
|
#endif
|
||||||
if (
|
if (
|
||||||
~0UL == (pnltmp.hactive) ||
|
~0UL == (pnltmp.hactive) ||
|
||||||
@ -251,7 +251,7 @@ static int load_devicetree(void)
|
|||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
loff_t dtbsize;
|
loff_t dtbsize;
|
||||||
u32 dtbaddr = getenv_ulong("dtbaddr", 16, 0UL);
|
u32 dtbaddr = env_get_ulong("dtbaddr", 16, 0UL);
|
||||||
|
|
||||||
if (dtbaddr == 0) {
|
if (dtbaddr == 0) {
|
||||||
printf("%s: don't have a valid <dtbaddr> in env!\n", __func__);
|
printf("%s: don't have a valid <dtbaddr> in env!\n", __func__);
|
||||||
@ -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
|
* if no simplefb is requested through environment, we don't set up
|
||||||
* one, instead we turn off backlight.
|
* one, instead we turn off backlight.
|
||||||
*/
|
*/
|
||||||
if (getenv_ulong("simplefb", 10, 0) == 0) {
|
if (env_get_ulong("simplefb", 10, 0) == 0) {
|
||||||
lcdbacklight(0);
|
lcdbacklight(0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -447,7 +447,7 @@ void lcdpower(int on)
|
|||||||
}
|
}
|
||||||
pin = FDTPROP(PATHINF, "pwrpin");
|
pin = FDTPROP(PATHINF, "pwrpin");
|
||||||
#else
|
#else
|
||||||
pin = getenv_ulong("ds1_pwr", 16, ~0UL);
|
pin = env_get_ulong("ds1_pwr", 16, ~0UL);
|
||||||
#endif
|
#endif
|
||||||
if (pin == ~0UL) {
|
if (pin == ~0UL) {
|
||||||
puts("no pwrpin in dtb/env, cannot powerup display!\n");
|
puts("no pwrpin in dtb/env, cannot powerup display!\n");
|
||||||
|
@ -163,7 +163,7 @@ int spl_start_uboot(void)
|
|||||||
#ifdef CONFIG_SPL_ENV_SUPPORT
|
#ifdef CONFIG_SPL_ENV_SUPPORT
|
||||||
env_init();
|
env_init();
|
||||||
env_load();
|
env_load();
|
||||||
if (getenv_yesno("boot_os") != 1)
|
if (env_get_yesno("boot_os") != 1)
|
||||||
return 1;
|
return 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -692,7 +692,7 @@ int spl_start_uboot(void)
|
|||||||
env_init();
|
env_init();
|
||||||
env_load();
|
env_load();
|
||||||
debug("boot_os=%s\n", env_get("boot_os"));
|
debug("boot_os=%s\n", env_get("boot_os"));
|
||||||
if (getenv_yesno("boot_os") == 1)
|
if (env_get_yesno("boot_os") == 1)
|
||||||
ret = 0;
|
ret = 0;
|
||||||
#else
|
#else
|
||||||
/* use i2c-0:0x50:0x00 for falcon boot mode (0=linux, else uboot) */
|
/* use i2c-0:0x50:0x00 for falcon boot mode (0=linux, else uboot) */
|
||||||
|
@ -217,7 +217,7 @@ static u8 *get_2nd_stage_bl_location(ulong target_addr)
|
|||||||
{
|
{
|
||||||
ulong addr;
|
ulong addr;
|
||||||
#ifdef CCDM_SECOND_STAGE
|
#ifdef CCDM_SECOND_STAGE
|
||||||
addr = getenv_ulong("loadaddr", 16, CONFIG_LOADADDR);
|
addr = env_get_ulong("loadaddr", 16, CONFIG_LOADADDR);
|
||||||
#else
|
#else
|
||||||
addr = target_addr;
|
addr = target_addr;
|
||||||
#endif
|
#endif
|
||||||
@ -235,7 +235,7 @@ static u8 *get_image_location(void)
|
|||||||
{
|
{
|
||||||
ulong addr;
|
ulong addr;
|
||||||
/* TODO use other area? */
|
/* TODO use other area? */
|
||||||
addr = getenv_ulong("loadaddr", 16, CONFIG_LOADADDR);
|
addr = env_get_ulong("loadaddr", 16, CONFIG_LOADADDR);
|
||||||
return (u8 *)(addr);
|
return (u8 *)(addr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -77,7 +77,7 @@ int spl_start_uboot(void)
|
|||||||
#ifdef CONFIG_SPL_ENV_SUPPORT
|
#ifdef CONFIG_SPL_ENV_SUPPORT
|
||||||
env_init();
|
env_init();
|
||||||
env_load();
|
env_load();
|
||||||
if (getenv_yesno("boot_os") != 1)
|
if (env_get_yesno("boot_os") != 1)
|
||||||
return 1;
|
return 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -250,7 +250,7 @@ int spl_start_uboot(void)
|
|||||||
#ifdef CONFIG_SPL_ENV_SUPPORT
|
#ifdef CONFIG_SPL_ENV_SUPPORT
|
||||||
env_init();
|
env_init();
|
||||||
env_load();
|
env_load();
|
||||||
if (getenv_yesno("boot_os") != 1)
|
if (env_get_yesno("boot_os") != 1)
|
||||||
return 1;
|
return 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -743,7 +743,7 @@ int spl_start_uboot(void)
|
|||||||
#ifdef CONFIG_SPL_ENV_SUPPORT
|
#ifdef CONFIG_SPL_ENV_SUPPORT
|
||||||
env_init();
|
env_init();
|
||||||
env_load();
|
env_load();
|
||||||
if (getenv_yesno("boot_os") != 1)
|
if (env_get_yesno("boot_os") != 1)
|
||||||
return 1;
|
return 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -826,7 +826,7 @@ int spl_start_uboot(void)
|
|||||||
#ifdef CONFIG_SPL_ENV_SUPPORT
|
#ifdef CONFIG_SPL_ENV_SUPPORT
|
||||||
env_init();
|
env_init();
|
||||||
env_load();
|
env_load();
|
||||||
if (getenv_yesno("boot_os") != 1)
|
if (env_get_yesno("boot_os") != 1)
|
||||||
return 1;
|
return 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
printf("The address of the fdt is %#08lx\n",
|
printf("The address of the fdt is %#08lx\n",
|
||||||
control ? (ulong)map_to_sysmem(blob) :
|
control ? (ulong)map_to_sysmem(blob) :
|
||||||
getenv_hex("fdtaddr", 0));
|
env_get_hex("fdtaddr", 0));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,7 +327,7 @@ int env_set_hex(const char *varname, ulong value)
|
|||||||
return env_set(varname, str);
|
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;
|
const char *s;
|
||||||
ulong value;
|
ulong value;
|
||||||
@ -690,7 +690,7 @@ int env_get_f(const char *name, char *buf, unsigned len)
|
|||||||
* found
|
* found
|
||||||
* @return the decoded value, or default_val if not 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 env_get() here, even before relocation, since the
|
* We can use env_get() here, even before relocation, since the
|
||||||
|
@ -40,7 +40,7 @@ source (ulong addr, const char *fit_uname)
|
|||||||
size_t fit_len;
|
size_t fit_len;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
verify = getenv_yesno ("verify");
|
verify = env_get_yesno("verify");
|
||||||
|
|
||||||
buf = map_sysmem(addr, 0);
|
buf = map_sysmem(addr, 0);
|
||||||
switch (genimg_get_format(buf)) {
|
switch (genimg_get_format(buf)) {
|
||||||
|
@ -16,10 +16,10 @@ static int get_args(int argc, char * const argv[], char **buff,
|
|||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
return -1;
|
return -1;
|
||||||
if (argc < 4) {
|
if (argc < 4) {
|
||||||
*buff_size = getenv_ulong("profsize", 16, 0);
|
*buff_size = env_get_ulong("profsize", 16, 0);
|
||||||
*buff = map_sysmem(getenv_ulong("profbase", 16, 0),
|
*buff = map_sysmem(env_get_ulong("profbase", 16, 0),
|
||||||
*buff_size);
|
*buff_size);
|
||||||
*buff_ptr = getenv_ulong("profoffset", 16, 0);
|
*buff_ptr = env_get_ulong("profoffset", 16, 0);
|
||||||
} else {
|
} else {
|
||||||
*buff_size = simple_strtoul(argv[3], NULL, 16);
|
*buff_size = simple_strtoul(argv[3], NULL, 16);
|
||||||
*buff = map_sysmem(simple_strtoul(argv[2], NULL, 16),
|
*buff = map_sysmem(simple_strtoul(argv[2], NULL, 16),
|
||||||
|
@ -52,7 +52,7 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
|
|||||||
#endif
|
#endif
|
||||||
uint8_t comp;
|
uint8_t comp;
|
||||||
|
|
||||||
verify = getenv_yesno("verify");
|
verify = env_get_yesno("verify");
|
||||||
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
addr = simple_strtoul(argv[1], NULL, 16);
|
addr = simple_strtoul(argv[1], NULL, 16);
|
||||||
|
@ -301,7 +301,7 @@ const char *bootdelay_process(void)
|
|||||||
bootcount++;
|
bootcount++;
|
||||||
bootcount_store(bootcount);
|
bootcount_store(bootcount);
|
||||||
env_set_ulong("bootcount", bootcount);
|
env_set_ulong("bootcount", bootcount);
|
||||||
bootlimit = getenv_ulong("bootlimit", 10, 0);
|
bootlimit = env_get_ulong("bootlimit", 10, 0);
|
||||||
#endif /* CONFIG_BOOTCOUNT_LIMIT */
|
#endif /* CONFIG_BOOTCOUNT_LIMIT */
|
||||||
|
|
||||||
s = env_get("bootdelay");
|
s = env_get("bootdelay");
|
||||||
|
@ -118,7 +118,7 @@ __weak void board_add_ram_info(int use_default)
|
|||||||
|
|
||||||
static int init_baud_rate(void)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,7 +324,7 @@ static int reserve_pram(void)
|
|||||||
{
|
{
|
||||||
ulong reg;
|
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 */
|
gd->relocaddr -= (reg << 10); /* size is in kB */
|
||||||
debug("Reserving %ldk for protected RAM at %08lx\n", reg,
|
debug("Reserving %ldk for protected RAM at %08lx\n", reg,
|
||||||
gd->relocaddr);
|
gd->relocaddr);
|
||||||
|
@ -372,7 +372,7 @@ static int initr_flash(void)
|
|||||||
*
|
*
|
||||||
* NOTE: Maybe we should add some WATCHDOG_RESET()? XXX
|
* 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,
|
printf(" CRC: %08X", crc32(0,
|
||||||
(const unsigned char *) CONFIG_SYS_FLASH_BASE,
|
(const unsigned char *) CONFIG_SYS_FLASH_BASE,
|
||||||
flash_size));
|
flash_size));
|
||||||
@ -490,7 +490,7 @@ static int initr_env(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Initialize from environment */
|
/* Initialize from environment */
|
||||||
load_addr = getenv_ulong("loadaddr", 16, load_addr);
|
load_addr = env_get_ulong("loadaddr", 16, load_addr);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -651,7 +651,7 @@ int initr_mem(void)
|
|||||||
char memsz[32];
|
char memsz[32];
|
||||||
|
|
||||||
# ifdef CONFIG_PRAM
|
# ifdef CONFIG_PRAM
|
||||||
pram = getenv_ulong("pram", 10, CONFIG_PRAM);
|
pram = env_get_ulong("pram", 10, CONFIG_PRAM);
|
||||||
# endif
|
# endif
|
||||||
# if defined(CONFIG_LOGBUFFER) && !defined(CONFIG_ALT_LB_ADDR)
|
# if defined(CONFIG_LOGBUFFER) && !defined(CONFIG_ALT_LB_ADDR)
|
||||||
/* Also take the logbuffer into account (pram is in kB) */
|
/* Also take the logbuffer into account (pram is in kB) */
|
||||||
|
@ -72,7 +72,7 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc,
|
|||||||
char * const argv[])
|
char * const argv[])
|
||||||
{
|
{
|
||||||
memset((void *)&images, 0, sizeof(images));
|
memset((void *)&images, 0, sizeof(images));
|
||||||
images.verify = getenv_yesno("verify");
|
images.verify = env_get_yesno("verify");
|
||||||
|
|
||||||
boot_start_lmb(&images);
|
boot_start_lmb(&images);
|
||||||
|
|
||||||
@ -534,7 +534,7 @@ static void fixup_silent_linux(void)
|
|||||||
* yes - we always fixup
|
* yes - we always fixup
|
||||||
* unset - we rely on the console silent flag
|
* 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)
|
if (want_silent == 0)
|
||||||
return;
|
return;
|
||||||
else if (want_silent == -1 && !(gd->flags & GD_FLG_SILENT))
|
else if (want_silent == -1 && !(gd->flags & GD_FLG_SILENT))
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
void bootcount_store(ulong a)
|
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) {
|
if (upgrade_available) {
|
||||||
env_set_ulong("bootcount", a);
|
env_set_ulong("bootcount", a);
|
||||||
@ -20,11 +20,11 @@ void bootcount_store(ulong a)
|
|||||||
|
|
||||||
ulong bootcount_load(void)
|
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;
|
ulong val = 0;
|
||||||
|
|
||||||
if (upgrade_available)
|
if (upgrade_available)
|
||||||
val = getenv_ulong("bootcount", 10, 0);
|
val = env_get_ulong("bootcount", 10, 0);
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
2
env/common.c
vendored
2
env/common.c
vendored
@ -31,7 +31,7 @@ struct hsearch_data env_htab = {
|
|||||||
* Read an environment variable as a boolean
|
* Read an environment variable as a boolean
|
||||||
* Return -1 if variable does not exist (default to true)
|
* 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 = env_get(var);
|
char *s = env_get(var);
|
||||||
|
|
||||||
|
@ -335,10 +335,21 @@ char *env_get(const char *varname);
|
|||||||
*/
|
*/
|
||||||
int env_get_f(const char *name, char *buf, unsigned len);
|
int env_get_f(const char *name, char *buf, unsigned len);
|
||||||
|
|
||||||
ulong getenv_ulong(const char *name, int base, ulong default_val);
|
/**
|
||||||
|
* 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
|
* 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
|
* prefix). If the environment variable cannot be found, or does not start
|
||||||
@ -347,13 +358,13 @@ ulong getenv_ulong(const char *name, int base, ulong default_val);
|
|||||||
* @varname: Variable to decode
|
* @varname: Variable to decode
|
||||||
* @default_val: Value to return on error
|
* @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
|
* Read an environment variable as a boolean
|
||||||
* Return -1 if variable does not exist (default to true)
|
* 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
|
* env_set() - set an environment variable
|
||||||
|
@ -1240,7 +1240,7 @@ int fdtdec_setup(void)
|
|||||||
# endif
|
# endif
|
||||||
# ifndef CONFIG_SPL_BUILD
|
# ifndef CONFIG_SPL_BUILD
|
||||||
/* Allow the early environment to override the fdt address */
|
/* 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);
|
(uintptr_t)gd->fdt_blob);
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -504,7 +504,7 @@ static int dhcp_extended(u8 *e, int message_type, struct in_addr server_ip,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (env_get("bootp_arch"))
|
if (env_get("bootp_arch"))
|
||||||
clientarch = getenv_ulong("bootp_arch", 16, clientarch);
|
clientarch = env_get_ulong("bootp_arch", 16, clientarch);
|
||||||
|
|
||||||
if (clientarch > 0) {
|
if (clientarch > 0) {
|
||||||
*e++ = 93; /* Client System Architecture */
|
*e++ = 93; /* Client System Architecture */
|
||||||
|
@ -329,7 +329,7 @@ void net_auto_load(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (getenv_yesno("autoload") == 0) {
|
if (env_get_yesno("autoload") == 0) {
|
||||||
/*
|
/*
|
||||||
* Just use BOOTP/RARP to configure system;
|
* Just use BOOTP/RARP to configure system;
|
||||||
* Do not use TFTP to load the bootfile.
|
* Do not use TFTP to load the bootfile.
|
||||||
|
Loading…
Reference in New Issue
Block a user