mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-24 21:54:01 +00:00
bootm: Simplify arguments for bootm_pre_load()
Move the argument decoding to the caller, to avoid needing to pass the command-line arguments. Add a function comment while we are here. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
parent
a50e886a7f
commit
921070bcdc
1 changed files with 16 additions and 7 deletions
23
boot/bootm.c
23
boot/bootm.c
|
@ -82,22 +82,31 @@ static int bootm_start(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static ulong bootm_data_addr(int argc, char *const argv[])
|
||||
static ulong bootm_data_addr(const char *addr_str)
|
||||
{
|
||||
ulong addr;
|
||||
|
||||
if (argc > 0)
|
||||
addr = simple_strtoul(argv[0], NULL, 16);
|
||||
if (addr_str)
|
||||
addr = hextoul(addr_str, NULL);
|
||||
else
|
||||
addr = image_load_addr;
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
||||
static int bootm_pre_load(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
char *const argv[])
|
||||
/**
|
||||
* bootm_pre_load() - Handle the pre-load processing
|
||||
*
|
||||
* This can be used to do a full signature check of the image, for example.
|
||||
* It calls image_pre_load() with the data address of the image to check.
|
||||
*
|
||||
* @addr_str: String containing load address in hex, or NULL to use
|
||||
* image_load_addr
|
||||
* Return: 0 if OK, CMD_RET_FAILURE on failure
|
||||
*/
|
||||
static int bootm_pre_load(const char *addr_str)
|
||||
{
|
||||
ulong data_addr = bootm_data_addr(argc, argv);
|
||||
ulong data_addr = bootm_data_addr(addr_str);
|
||||
int ret = 0;
|
||||
|
||||
if (IS_ENABLED(CONFIG_CMD_BOOTM_PRE_LOAD))
|
||||
|
@ -785,7 +794,7 @@ int do_bootm_states(struct cmd_tbl *cmdtp, int flag, int argc,
|
|||
ret = bootm_start();
|
||||
|
||||
if (!ret && (states & BOOTM_STATE_PRE_LOAD))
|
||||
ret = bootm_pre_load(cmdtp, flag, argc, argv);
|
||||
ret = bootm_pre_load(argv[0]);
|
||||
|
||||
if (!ret && (states & BOOTM_STATE_FINDOS))
|
||||
ret = bootm_find_os(cmdtp, flag, argc, argv);
|
||||
|
|
Loading…
Reference in a new issue