env: Add a loadaddr env handler
Remove the hard-coded loadaddr handler and use a callback instead Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
This commit is contained in:
parent
32057717e0
commit
1cf0a8b2fb
|
@ -73,10 +73,6 @@ SPI_FLASH|NVRAM|MMC|FAT|REMOTE} or CONFIG_ENV_IS_NOWHERE
|
||||||
*/
|
*/
|
||||||
#define MAX_ENV_SIZE (1 << 20) /* 1 MiB */
|
#define MAX_ENV_SIZE (1 << 20) /* 1 MiB */
|
||||||
|
|
||||||
ulong load_addr = CONFIG_SYS_LOAD_ADDR; /* Default Load Address */
|
|
||||||
ulong save_addr; /* Default Save Address */
|
|
||||||
ulong save_size; /* Default Save Size (in bytes) */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This variable is incremented on each do_env_set(), so it can
|
* This variable is incremented on each do_env_set(), so it can
|
||||||
* be used via get_env_id() as an indication, if the environment
|
* be used via get_env_id() as an indication, if the environment
|
||||||
|
@ -270,14 +266,6 @@ int env_change_ok(const ENTRY *item, const char *newval, enum env_op op,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* Some variables should be updated when the corresponding
|
|
||||||
* entry in the environment is changed
|
|
||||||
*/
|
|
||||||
if (strcmp(name, "loadaddr") == 0) {
|
|
||||||
load_addr = simple_strtoul(newval, NULL, 16);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
#include <rtc.h>
|
#include <rtc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <environment.h>
|
||||||
#include <image.h>
|
#include <image.h>
|
||||||
|
|
||||||
#if defined(CONFIG_FIT) || defined(CONFIG_OF_LIBFDT)
|
#if defined(CONFIG_FIT) || defined(CONFIG_OF_LIBFDT)
|
||||||
|
@ -416,6 +417,26 @@ static const image_header_t *image_get_ramdisk(ulong rd_addr, uint8_t arch,
|
||||||
/* Shared dual-format routines */
|
/* Shared dual-format routines */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
#ifndef USE_HOSTCC
|
#ifndef USE_HOSTCC
|
||||||
|
ulong load_addr = CONFIG_SYS_LOAD_ADDR; /* Default Load Address */
|
||||||
|
ulong save_addr; /* Default Save Address */
|
||||||
|
ulong save_size; /* Default Save Size (in bytes) */
|
||||||
|
|
||||||
|
static int on_loadaddr(const char *name, const char *value, enum env_op op,
|
||||||
|
int flags)
|
||||||
|
{
|
||||||
|
switch (op) {
|
||||||
|
case env_op_create:
|
||||||
|
case env_op_overwrite:
|
||||||
|
load_addr = simple_strtoul(value, NULL, 16);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
U_BOOT_ENV_CALLBACK(loadaddr, on_loadaddr);
|
||||||
|
|
||||||
ulong getenv_bootm_low(void)
|
ulong getenv_bootm_low(void)
|
||||||
{
|
{
|
||||||
char *s = getenv("bootm_low");
|
char *s = getenv("bootm_low");
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#define ENV_CALLBACK_LIST_STATIC ENV_CALLBACK_VAR ":callbacks," \
|
#define ENV_CALLBACK_LIST_STATIC ENV_CALLBACK_VAR ":callbacks," \
|
||||||
"baudrate:baudrate," \
|
"baudrate:baudrate," \
|
||||||
"bootfile:bootfile," \
|
"bootfile:bootfile," \
|
||||||
|
"loadaddr:loadaddr," \
|
||||||
CONFIG_ENV_CALLBACK_LIST_STATIC
|
CONFIG_ENV_CALLBACK_LIST_STATIC
|
||||||
|
|
||||||
struct env_clbk_tbl {
|
struct env_clbk_tbl {
|
||||||
|
|
Loading…
Reference in New Issue