global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2021-07-24 09:03:29 -06:00 committed by Tom Rini
parent 031725f8cd
commit 7e5f460ec4
183 changed files with 692 additions and 659 deletions

View file

@ -565,28 +565,28 @@ void fdt_fixup_pfe_firmware(void *blob)
if (!p)
return;
pclassfw = (void *)simple_strtoul(p, NULL, 16);
pclassfw = (void *)hextoul(p, NULL);
if (!pclassfw)
return;
p = env_get("class_elf_size");
if (!p)
return;
len_class = simple_strtoul(p, NULL, 16);
len_class = hextoul(p, NULL);
/* If the environment variable is not set, then exit silently */
p = env_get("tmu_elf_firmware");
if (!p)
return;
ptmufw = (void *)simple_strtoul(p, NULL, 16);
ptmufw = (void *)hextoul(p, NULL);
if (!ptmufw)
return;
p = env_get("tmu_elf_size");
if (!p)
return;
len_tmu = simple_strtoul(p, NULL, 16);
len_tmu = hextoul(p, NULL);
if (len_class == 0 || len_tmu == 0) {
printf("PFE FW corrupted. CLASS FW size %d, TMU FW size %d\n",
@ -605,14 +605,14 @@ void fdt_fixup_pfe_firmware(void *blob)
if (!p)
return;
putilfw = (void *)simple_strtoul(p, NULL, 16);
putilfw = (void *)hextoul(p, NULL);
if (!putilfw)
return;
p = env_get("util_elf_size");
if (!p)
return;
len_util = simple_strtoul(p, NULL, 16);
len_util = hextoul(p, NULL);
if (len_util) {
printf("PFE Util PE firmware is not added to FDT.\n");

View file

@ -191,7 +191,7 @@ static int do_smhload(struct cmd_tbl *cmdtp, int flag, int argc,
int ret;
char end_str[64];
load_addr = simple_strtoul(argv[2], NULL, 16);
load_addr = hextoul(argv[2], NULL);
if (!load_addr)
return -1;

View file

@ -300,8 +300,8 @@ static int do_dek_blob(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != 4)
return CMD_RET_USAGE;
src_addr = simple_strtoul(argv[1], NULL, 16);
dst_addr = simple_strtoul(argv[2], NULL, 16);
src_addr = hextoul(argv[1], NULL);
dst_addr = hextoul(argv[2], NULL);
len = simple_strtoul(argv[3], NULL, 10);
return blob_encap_dek(src_addr, dst_addr, len);

View file

@ -71,7 +71,7 @@ static int do_mfgprot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
if (argc != 4)
return CMD_RET_USAGE;
m_addr = simple_strtoul(argv[2], NULL, 16);
m_addr = hextoul(argv[2], NULL);
m_size = simple_strtoul(argv[3], NULL, 10);
m_ptr = map_physmem(m_addr, m_size, MAP_NOCACHE);
if (!m_ptr)

View file

@ -1083,13 +1083,13 @@ static int do_nandbcb_bcbonly(int argc, char *const argv[])
mtd = cfg.mtd;
cfg.boot_stream1_address = simple_strtoul(argv[2], NULL, 16);
cfg.boot_stream1_size = simple_strtoul(argv[3], NULL, 16);
cfg.boot_stream1_address = hextoul(argv[2], NULL);
cfg.boot_stream1_size = hextoul(argv[3], NULL);
cfg.boot_stream1_size = ALIGN(cfg.boot_stream1_size, mtd->writesize);
if (argc > 5) {
cfg.boot_stream2_address = simple_strtoul(argv[4], NULL, 16);
cfg.boot_stream2_size = simple_strtoul(argv[5], NULL, 16);
cfg.boot_stream2_address = hextoul(argv[4], NULL);
cfg.boot_stream2_size = hextoul(argv[5], NULL);
cfg.boot_stream2_size = ALIGN(cfg.boot_stream2_size,
mtd->writesize);
}
@ -1450,7 +1450,7 @@ static int do_nandbcb_init(int argc, char * const argv[])
if (nandbcb_set_boot_config(argc, argv, &cfg))
return CMD_RET_FAILURE;
addr = simple_strtoul(argv[1], &endp, 16);
addr = hextoul(argv[1], &endp);
if (*argv[1] == 0 || *endp != 0)
return CMD_RET_FAILURE;

View file

@ -609,12 +609,12 @@ static int do_authenticate_image(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 3)
return CMD_RET_USAGE;
addr = simple_strtoul(argv[1], NULL, 16);
length = simple_strtoul(argv[2], NULL, 16);
addr = hextoul(argv[1], NULL);
length = hextoul(argv[2], NULL);
if (argc == 3)
ivt_offset = get_image_ivt_offset(addr);
else
ivt_offset = simple_strtoul(argv[3], NULL, 16);
ivt_offset = hextoul(argv[3], NULL);
rcode = imx_hab_authenticate_image(addr, length, ivt_offset);
if (rcode == 0)

View file

@ -161,7 +161,7 @@ static int do_authenticate(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 2)
return CMD_RET_USAGE;
addr = simple_strtoul(argv[1], NULL, 16);
addr = hextoul(argv[1], NULL);
printf("Authenticate OS container at 0x%lx\n", addr);

View file

@ -638,24 +638,24 @@ static int do_snvs_cfg(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != (NB_REGISTERS + 1))
return CMD_RET_USAGE;
conf.hp.lock = simple_strtoul(argv[++idx], NULL, 16);
conf.hp.secvio_ctl = simple_strtoul(argv[++idx], NULL, 16);
conf.lp.lock = simple_strtoul(argv[++idx], NULL, 16);
conf.lp.secvio_ctl = simple_strtoul(argv[++idx], NULL, 16);
conf.lp.tamper_filt_cfg = simple_strtoul(argv[++idx], NULL, 16);
conf.lp.tamper_det_cfg = simple_strtoul(argv[++idx], NULL, 16);
conf.lp.tamper_det_cfg2 = simple_strtoul(argv[++idx], NULL, 16);
conf.lp.tamper_filt1_cfg = simple_strtoul(argv[++idx], NULL, 16);
conf.lp.tamper_filt2_cfg = simple_strtoul(argv[++idx], NULL, 16);
conf.lp.act_tamper1_cfg = simple_strtoul(argv[++idx], NULL, 16);
conf.lp.act_tamper2_cfg = simple_strtoul(argv[++idx], NULL, 16);
conf.lp.act_tamper3_cfg = simple_strtoul(argv[++idx], NULL, 16);
conf.lp.act_tamper4_cfg = simple_strtoul(argv[++idx], NULL, 16);
conf.lp.act_tamper5_cfg = simple_strtoul(argv[++idx], NULL, 16);
conf.lp.act_tamper_ctl = simple_strtoul(argv[++idx], NULL, 16);
conf.lp.act_tamper_clk_ctl = simple_strtoul(argv[++idx], NULL, 16);
conf.lp.act_tamper_routing_ctl1 = simple_strtoul(argv[++idx], NULL, 16);
conf.lp.act_tamper_routing_ctl2 = simple_strtoul(argv[++idx], NULL, 16);
conf.hp.lock = hextoul(argv[++idx], NULL);
conf.hp.secvio_ctl = hextoul(argv[++idx], NULL);
conf.lp.lock = hextoul(argv[++idx], NULL);
conf.lp.secvio_ctl = hextoul(argv[++idx], NULL);
conf.lp.tamper_filt_cfg = hextoul(argv[++idx], NULL);
conf.lp.tamper_det_cfg = hextoul(argv[++idx], NULL);
conf.lp.tamper_det_cfg2 = hextoul(argv[++idx], NULL);
conf.lp.tamper_filt1_cfg = hextoul(argv[++idx], NULL);
conf.lp.tamper_filt2_cfg = hextoul(argv[++idx], NULL);
conf.lp.act_tamper1_cfg = hextoul(argv[++idx], NULL);
conf.lp.act_tamper2_cfg = hextoul(argv[++idx], NULL);
conf.lp.act_tamper3_cfg = hextoul(argv[++idx], NULL);
conf.lp.act_tamper4_cfg = hextoul(argv[++idx], NULL);
conf.lp.act_tamper5_cfg = hextoul(argv[++idx], NULL);
conf.lp.act_tamper_ctl = hextoul(argv[++idx], NULL);
conf.lp.act_tamper_clk_ctl = hextoul(argv[++idx], NULL);
conf.lp.act_tamper_routing_ctl1 = hextoul(argv[++idx], NULL);
conf.lp.act_tamper_routing_ctl2 = hextoul(argv[++idx], NULL);
err = apply_snvs_config(&conf);
@ -690,12 +690,12 @@ static int do_snvs_dgo_cfg(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != (6 + 1))
return CMD_RET_USAGE;
conf.tamper_offset_ctl = simple_strtoul(argv[++idx], NULL, 16);
conf.tamper_pull_ctl = simple_strtoul(argv[++idx], NULL, 16);
conf.tamper_ana_test_ctl = simple_strtoul(argv[++idx], NULL, 16);
conf.tamper_sensor_trim_ctl = simple_strtoul(argv[++idx], NULL, 16);
conf.tamper_misc_ctl = simple_strtoul(argv[++idx], NULL, 16);
conf.tamper_core_volt_mon_ctl = simple_strtoul(argv[++idx], NULL, 16);
conf.tamper_offset_ctl = hextoul(argv[++idx], NULL);
conf.tamper_pull_ctl = hextoul(argv[++idx], NULL);
conf.tamper_ana_test_ctl = hextoul(argv[++idx], NULL);
conf.tamper_sensor_trim_ctl = hextoul(argv[++idx], NULL);
conf.tamper_misc_ctl = hextoul(argv[++idx], NULL);
conf.tamper_core_volt_mon_ctl = hextoul(argv[++idx], NULL);
err = apply_snvs_dgo_config(&conf);
@ -727,7 +727,7 @@ static int do_tamper_pin_cfg(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
conf.pad = simple_strtoul(argv[++idx], NULL, 10);
conf.mux_conf = simple_strtoul(argv[++idx], NULL, 16);
conf.mux_conf = hextoul(argv[++idx], NULL);
err = apply_tamper_pin_list_config(&conf, 1);
@ -761,8 +761,8 @@ static int do_snvs_clear_status(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != (2 + 1))
return CMD_RET_USAGE;
conf.lp.status = simple_strtoul(argv[++idx], NULL, 16);
conf.lp.tamper_det_status = simple_strtoul(argv[++idx], NULL, 16);
conf.lp.status = hextoul(argv[++idx], NULL);
conf.lp.tamper_det_status = hextoul(argv[++idx], NULL);
scierr = check_write_secvio_config(SC_CONF_OFFSET_OF(lp.status),
&conf.lp.status, NULL, NULL, NULL,

View file

@ -180,7 +180,7 @@ static int do_bootaux(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_SUCCESS;
}
addr = simple_strtoul(argv[1], NULL, 16);
addr = hextoul(argv[1], NULL);
if (!addr)
return CMD_RET_FAILURE;

View file

@ -47,7 +47,7 @@ int cpu_release(u32 nr, int argc, char *const argv[])
{
uint32_t boot_addr;
boot_addr = simple_strtoul(argv[0], NULL, 16);
boot_addr = hextoul(argv[0], NULL);
switch (nr) {
case 1:

View file

@ -25,7 +25,7 @@ static int do_mon_install(struct cmd_tbl *cmdtp, int flag, int argc,
freq = CONFIG_SYS_HZ_CLOCK;
addr = simple_strtoul(argv[1], NULL, 16);
addr = hextoul(argv[1], NULL);
header = (struct image_header *)addr;
@ -40,7 +40,7 @@ static int do_mon_install(struct cmd_tbl *cmdtp, int flag, int argc,
size);
if (argc >= 3)
ecrypt_bm_addr = simple_strtoul(argv[2], NULL, 16);
ecrypt_bm_addr = hextoul(argv[2], NULL);
rcode = mon_install(load_addr, dpsc_base, freq, ecrypt_bm_addr);
printf("## installed monitor @ 0x%x, freq [%d], status %d\n",
@ -76,8 +76,8 @@ int do_mon_power(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 3)
return CMD_RET_USAGE;
core_id = simple_strtoul(argv[1], NULL, 16);
on = simple_strtoul(argv[2], NULL, 16);
core_id = hextoul(argv[1], NULL);
on = hextoul(argv[2], NULL);
if (on)
rcode = mon_power_on(core_id, fn);

View file

@ -47,7 +47,7 @@ void msm_generate_mac_addr(u8 *mac)
mac[0] = 0x02;
mac[1] = 00;
for (i = 3; i >= 0; i--) {
mac[i + 2] = simple_strtoul(&sn[2 * i], NULL, 16);
mac[i + 2] = hextoul(&sn[2 * i], NULL);
sn[2 * i] = 0;
}
}

View file

@ -191,7 +191,7 @@ static int do_bridge(struct cmd_tbl *cmdtp, int flag, int argc,
argv++;
if (argc == 3)
mask = simple_strtoul(argv[1], NULL, 16);
mask = hextoul(argv[1], NULL);
switch (*argv[0]) {
case 'e': /* Enable */

View file

@ -17,8 +17,8 @@ static int do_vab(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 3)
return CMD_RET_USAGE;
addr = simple_strtoul(argv[1], NULL, 16);
len = simple_strtoul(argv[2], NULL, 16);
addr = hextoul(argv[1], NULL);
len = hextoul(argv[2], NULL);
if (socfpga_vendor_authentication((void *)&addr, (size_t *)&len) != 0)
return CMD_RET_FAILURE;

View file

@ -162,7 +162,7 @@ static int do_stm32key_read(struct cmd_tbl *cmdtp, int flag, int argc, char *con
return CMD_RET_SUCCESS;
}
addr = simple_strtoul(argv[1], NULL, 16);
addr = hextoul(argv[1], NULL);
if (!addr)
return CMD_RET_USAGE;
@ -185,7 +185,7 @@ static int do_stm32key_fuse(struct cmd_tbl *cmdtp, int flag, int argc, char *con
yes = true;
}
addr = simple_strtoul(argv[argc - 1], NULL, 16);
addr = hextoul(argv[argc - 1], NULL);
if (!addr)
return CMD_RET_USAGE;

View file

@ -64,12 +64,12 @@ static int do_stm32prog(struct cmd_tbl *cmdtp, int flag, int argc,
addr = STM32_DDR_BASE;
size = 0;
if (argc > 3) {
addr = simple_strtoul(argv[3], NULL, 16);
addr = hextoul(argv[3], NULL);
if (!addr)
return CMD_RET_FAILURE;
}
if (argc > 4)
size = simple_strtoul(argv[4], NULL, 16);
size = hextoul(argv[4], NULL);
/* check STM32IMAGE presence */
if (size == 0) {

View file

@ -66,7 +66,7 @@ static void uniphier_set_env_addr(const char *env, const char *offset_env)
if (!str)
goto fail;
offset = simple_strtoul(str, &end, 16);
offset = hextoul(str, &end);
if (*end)
goto fail;
}

View file

@ -252,7 +252,7 @@ int cpu_release(u32 nr, int argc, char *const argv[])
return 1;
}
u32 boot_addr = simple_strtoul(argv[0], NULL, 16);
u32 boot_addr = hextoul(argv[0], NULL);
u32 boot_addr_uniq = 0;
if (!(boot_addr == ZYNQMP_R5_LOVEC_ADDR ||
boot_addr == ZYNQMP_R5_HIVEC_ADDR)) {

View file

@ -281,8 +281,7 @@ int octeon_parse_bootopts(int argc, char *const argv[],
} else if (!strncmp(argv[arg], "forceboot", 9)) {
boot_args->forceboot = true;
} else if (!strncmp(argv[arg], "nodemask=", 9)) {
boot_args->node_mask = simple_strtoul(argv[arg] + 9,
NULL, 16);
boot_args->node_mask = hextoul(argv[arg] + 9, NULL);
} else if (!strncmp(argv[arg], "numcores=", 9)) {
memset(node_values, 0, sizeof(node_values));
num_values = octeon_parse_nodes(node_values,
@ -383,7 +382,7 @@ int do_bootoctlinux(struct cmd_tbl *cmdtp, int flag, int argc,
argv[1][1] == 'x' ||
argv[1][1] == 'X' ||
argv[1][1] == '\0'))) {
addr = simple_strtoul(argv[1], NULL, 16);
addr = hextoul(argv[1], NULL);
if (!addr)
addr = CONFIG_SYS_LOAD_ADDR;
arg_start++;

View file

@ -64,7 +64,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
s = env_get("machid");
if (s) {
machid = simple_strtoul(s, NULL, 16);
machid = hextoul(s, NULL);
printf("Using machid 0x%x from environment\n", machid);
}

View file

@ -27,7 +27,7 @@ int do_bootm_linux(int flag, int argc, char *const argv[],
of_flat_tree = images->ft_addr;
#endif
if (!of_flat_tree && argc > 1)
of_flat_tree = (char *)simple_strtoul(argv[1], NULL, 16);
of_flat_tree = (char *)hextoul(argv[1], NULL);
if (of_flat_tree)
initrd_end = (ulong)of_flat_tree;

View file

@ -219,17 +219,17 @@ int do_ecc(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
ddr->err_detect = val;
return 0;
} else if (strcmp(argv[1], "injectdatahi") == 0) {
val = simple_strtoul(argv[2], NULL, 16);
val = hextoul(argv[2], NULL);
ddr->data_err_inject_hi = val;
return 0;
} else if (strcmp(argv[1], "injectdatalo") == 0) {
val = simple_strtoul(argv[2], NULL, 16);
val = hextoul(argv[2], NULL);
ddr->data_err_inject_lo = val;
return 0;
} else if (strcmp(argv[1], "injectecc") == 0) {
val = simple_strtoul(argv[2], NULL, 16);
val = hextoul(argv[2], NULL);
if (val > 0xff) {
printf("Incorrect ECC inject mask, "
"should be 0x00..0xff\n");
@ -269,8 +269,8 @@ int do_ecc(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
}
if (argc == 4) {
if (strcmp(argv[1], "testdw") == 0) {
addr = (u64 *) simple_strtoul(argv[2], NULL, 16);
count = simple_strtoul(argv[3], NULL, 16);
addr = (u64 *)hextoul(argv[2], NULL);
count = hextoul(argv[3], NULL);
if ((u32) addr % 8) {
printf("Address not aligned on "
@ -308,8 +308,8 @@ int do_ecc(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return 0;
}
if (strcmp(argv[1], "testword") == 0) {
addr = (u64 *) simple_strtoul(argv[2], NULL, 16);
count = simple_strtoul(argv[3], NULL, 16);
addr = (u64 *)hextoul(argv[2], NULL);
count = hextoul(argv[3], NULL);
if ((u32) addr % 8) {
printf("Address not aligned on "

View file

@ -167,7 +167,7 @@ int cpu_release(u32 nr, int argc, char *const argv[])
for (i = 1; i < 3; i++) {
if (argv[i][0] != '-') {
u8 entry = boot_entry_map[i];
val = simple_strtoul(argv[i], NULL, 16);
val = hextoul(argv[i], NULL);
table[entry] = val;
}
}

View file

@ -37,11 +37,12 @@ int do_sh_zimageboot(struct cmd_tbl *cmdtp, int flag, int argc,
}
if (s0)
zboot_entry = (ulong (*)(int, char * const []))simple_strtoul(s0, NULL, 16);
zboot_entry = (ulong (*)(int, char * const []))hextoul(s0,
NULL);
/* empty_zero_page */
if (s1)
param = (unsigned char*)simple_strtoul(s1, NULL, 16);
param = (unsigned char *)hextoul(s1, NULL);
/* Linux kernel command line */
cmdline = (char *)param + COMMAND_LINE;

View file

@ -405,17 +405,17 @@ static int do_zboot_start(struct cmd_tbl *cmdtp, int flag, int argc,
}
if (s)
state.bzimage_addr = simple_strtoul(s, NULL, 16);
state.bzimage_addr = hextoul(s, NULL);
if (argc >= 3) {
/* argv[2] holds the size of the bzImage */
state.bzimage_size = simple_strtoul(argv[2], NULL, 16);
state.bzimage_size = hextoul(argv[2], NULL);
}
if (argc >= 4)
state.initrd_addr = simple_strtoul(argv[3], NULL, 16);
state.initrd_addr = hextoul(argv[3], NULL);
if (argc >= 5)
state.initrd_size = simple_strtoul(argv[4], NULL, 16);
state.initrd_size = hextoul(argv[4], NULL);
if (argc >= 6) {
/*
* When the base_ptr is passed in, we assume that the image is
@ -428,7 +428,7 @@ static int do_zboot_start(struct cmd_tbl *cmdtp, int flag, int argc,
* load address and set bzimage_addr to 0 so we know that it
* cannot be proceesed (or processed again).
*/
state.base_ptr = (void *)simple_strtoul(argv[5], NULL, 16);
state.base_ptr = (void *)hextoul(argv[5], NULL);
state.load_address = state.bzimage_addr;
state.bzimage_addr = 0;
}
@ -702,7 +702,7 @@ static int do_zboot_dump(struct cmd_tbl *cmdtp, int flag, int argc,
struct boot_params *base_ptr = state.base_ptr;
if (argc > 1)
base_ptr = (void *)simple_strtoul(argv[1], NULL, 16);
base_ptr = (void *)hextoul(argv[1], NULL);
if (!base_ptr) {
printf("No zboot setup_base\n");
return CMD_RET_FAILURE;
@ -749,7 +749,7 @@ int do_zboot_parent(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc > 1) {
char *endp;
simple_strtoul(argv[1], &endp, 16);
hextoul(argv[1], &endp);
/*
* endp pointing to nul means that argv[1] was just a valid
* number, so pass it along to the normal processing

View file

@ -214,7 +214,7 @@ int drv_video_init(void)
#ifdef CONFIG_SPLASH_SCREEN
s = env_get("splashimage");
if (s != NULL) {
splash = simple_strtoul(s, NULL, 16);
splash = hextoul(s, NULL);
vcxk_acknowledge_wait();
video_display_bitmap(splash, 0, 0);
}

View file

@ -230,7 +230,7 @@ static int do_go_uboot(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 2)
return CMD_RET_USAGE;
addr = simple_strtoul(argv[1], NULL, 16);
addr = hextoul(argv[1], NULL);
fdt = board_fdt_blob_setup();
entry = (uboot_entry_t)addr;
flush_cache((ulong)addr, 1 << 20); /* 1MiB should be enough */

View file

@ -39,7 +39,7 @@ int misc_init_r(void)
tmp[0] = efuse_mac_addr[i * 2];
tmp[1] = efuse_mac_addr[i * 2 + 1];
tmp[2] = '\0';
mac_addr[i] = simple_strtoul(tmp, NULL, 16);
mac_addr[i] = hextoul(tmp, NULL);
}
if (is_valid_ethaddr(mac_addr))

View file

@ -126,7 +126,7 @@ int misc_init_r(void)
tmp[0] = efuse_mac_addr[i * 2];
tmp[1] = efuse_mac_addr[i * 2 + 1];
tmp[2] = '\0';
mac_addr[i] = simple_strtoul(tmp, NULL, 16);
mac_addr[i] = hextoul(tmp, NULL);
}
if (is_valid_ethaddr(mac_addr))

View file

@ -166,7 +166,7 @@ int misc_init_r(void)
tmp[0] = efuse_mac_addr[i * 2];
tmp[1] = efuse_mac_addr[i * 2 + 1];
tmp[2] = '\0';
mac_addr[i] = simple_strtoul(tmp, NULL, 16);
mac_addr[i] = hextoul(tmp, NULL);
}
if (is_valid_ethaddr(mac_addr))

View file

@ -376,7 +376,7 @@ int board_late_init(void)
/* Parse MAC address */
for (i = 0; i < 6; i++) {
env_enetaddr[i] = env_str ?
simple_strtoul(env_str, &end, 16) : 0;
hextoul(env_str, &end) : 0;
if (env_str)
env_str = (*end) ? end+1 : end;
}

View file

@ -235,25 +235,25 @@ int do_atf(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
char str[4 * sizeof(uint64_t)];
if ((argc == 5) && !strcmp(argv[1], "readmmc")) {
buffer = (void *)simple_strtoul(argv[2], NULL, 16);
buffer = (void *)hextoul(argv[2], NULL);
offset = simple_strtoul(argv[3], NULL, 10);
size = simple_strtoul(argv[4], NULL, 10);
ret = atf_read_mmc(offset, buffer, size);
} else if ((argc == 5) && !strcmp(argv[1], "readnor")) {
buffer = (void *)simple_strtoul(argv[2], NULL, 16);
buffer = (void *)hextoul(argv[2], NULL);
offset = simple_strtoul(argv[3], NULL, 10);
size = simple_strtoul(argv[4], NULL, 10);
ret = atf_read_nor(offset, buffer, size);
} else if ((argc == 5) && !strcmp(argv[1], "writemmc")) {
buffer = (void *)simple_strtoul(argv[2], NULL, 16);
buffer = (void *)hextoul(argv[2], NULL);
offset = simple_strtoul(argv[3], NULL, 10);
size = simple_strtoul(argv[4], NULL, 10);
ret = atf_write_mmc(offset, buffer, size);
} else if ((argc == 5) && !strcmp(argv[1], "writenor")) {
buffer = (void *)simple_strtoul(argv[2], NULL, 16);
buffer = (void *)hextoul(argv[2], NULL);
offset = simple_strtoul(argv[3], NULL, 10);
size = simple_strtoul(argv[4], NULL, 10);

View file

@ -208,7 +208,7 @@ void get_board_serial(struct tag_serialnr *serialnr)
str = strchr(serial, '_');
if (str && (strlen(str) >= 4)) {
serialnr->high = (*(str + 1) << 8) | *(str + 2);
serialnr->low = simple_strtoul(str + 3, NULL, 16);
serialnr->low = hextoul(str + 3, NULL);
}
} else {
serialnr->high = 0;

View file

@ -40,7 +40,7 @@ static int do_esbc_validate(struct cmd_tbl *cmdtp, int flag, int argc,
hash_str = argv[2];
/* First argument - header address -32/64bit */
haddr = (uintptr_t)simple_strtoul(argv[1], NULL, 16);
haddr = (uintptr_t)hextoul(argv[1], NULL);
/* With esbc_validate command, Image address must be
* part of header. So, the function is called

View file

@ -767,7 +767,7 @@ static inline int str2longbe(const char *p, ulong *num)
if (!p) {
return 0;
} else {
tmp = simple_strtoul(p, &endptr, 16);
tmp = hextoul(p, &endptr);
if (sizeof(ulong) == 4)
*num = cpu_to_be32(tmp);
else

View file

@ -378,7 +378,7 @@ static void set_mac_address(unsigned int index, const char *string)
}
for (i = 0; *p && (i < 6); i++) {
e.mac[index][i] = simple_strtoul(p, &p, 16);
e.mac[index][i] = hextoul(p, &p);
if (*p == ':')
p++;
}
@ -452,7 +452,7 @@ int do_mac(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
set_date(argv[2]);
break;
case 'p': /* MAC table size */
e.mac_count = simple_strtoul(argv[2], NULL, 16);
e.mac_count = hextoul(argv[2], NULL);
update_crc();
break;
case '0' ... '9': /* "mac 0" through "mac 22" */

View file

@ -416,7 +416,7 @@ static inline void do_dpmac_config(int dpmac, const char *arg_dpmacid,
env_dpmac, phy_num + 1, arg_dpmacid);
else
wriop_set_phy_address(dpmac, phy_num,
simple_strtoul(ret, NULL, 16));
hextoul(ret, NULL));
}
/*search mdio in dpmac arg*/

View file

@ -437,7 +437,7 @@ static inline void do_dpmac_config(int dpmac, const char *arg_dpmacid,
env_dpmac, phy_num + 1, arg_dpmacid);
else
wriop_set_phy_address(dpmac, phy_num,
simple_strtoul(ret, NULL, 16));
hextoul(ret, NULL));
}
/*search mdio in dpmac arg*/

View file

@ -281,7 +281,7 @@ int board_early_init_r(void)
/* If a VSC7385 microcode image is present, then upload it. */
tmp = env_get("vscfw_addr");
if (tmp) {
vscfw_addr = simple_strtoul(tmp, NULL, 16);
vscfw_addr = hextoul(tmp, NULL);
printf("uploading VSC7385 microcode from %x\n", vscfw_addr);
if (vsc7385_upload_firmware((void *)vscfw_addr,
CONFIG_VSC7385_IMAGE_SIZE))

View file

@ -100,8 +100,8 @@ int cpld_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
else
cpld_set_defbank();
} else if (strcmp(argv[1], "lane_mux") == 0) {
u32 lane = simple_strtoul(argv[2], NULL, 16);
u8 val = (u8)simple_strtoul(argv[3], NULL, 16);
u32 lane = hextoul(argv[2], NULL);
u8 val = (u8)hextoul(argv[3], NULL);
u8 reg = CPLD_READ(serdes_mux);
switch (lane) {

View file

@ -1502,7 +1502,7 @@ void setup_board_gpio(int board, struct ventana_board_info *info)
continue;
s = hwconfig_subarg(arg, "padctrl", &len);
if (s) {
ctrl = MUX_PAD_CTRL(simple_strtoul(s, NULL, 16)
ctrl = MUX_PAD_CTRL(hextoul(s, NULL)
& 0x1ffff) | MUX_MODE_SION;
}
if (hwconfig_subarg_cmp(arg, "mode", "gpio")) {

View file

@ -915,7 +915,7 @@ int fdt_fixup_sky2(void *blob, int np, struct pci_dev *dev)
if (tmp) {
for (j = 0; j < 6; j++) {
mac_addr[j] = tmp ?
simple_strtoul(tmp, &end,16) : 0;
hextoul(tmp, &end) : 0;
if (tmp)
tmp = (*end) ? end+1 : end;
}

View file

@ -284,9 +284,9 @@ static int osd_print(struct cmd_tbl *cmdtp, int flag, int argc,
if (!(osd_screen_mask & (1 << screen)))
continue;
x = simple_strtoul(argv[1], NULL, 16);
y = simple_strtoul(argv[2], NULL, 16);
color = simple_strtoul(argv[3], NULL, 16);
x = hextoul(argv[1], NULL);
y = hextoul(argv[2], NULL);
color = hextoul(argv[3], NULL);
text = argv[4];
charcount = strlen(text);
len = (charcount > bufsize) ? bufsize : charcount;
@ -416,13 +416,13 @@ int osd_write(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
char *rp;
u16 *wp = buffer;
unsigned count = (argc > 4) ?
simple_strtoul(argv[4], NULL, 16) : 1;
hextoul(argv[4], NULL) : 1;
if (!(osd_screen_mask & (1 << screen)))
continue;
x = simple_strtoul(argv[1], NULL, 16);
y = simple_strtoul(argv[2], NULL, 16);
x = hextoul(argv[1], NULL);
y = hextoul(argv[2], NULL);
rp = argv[3];
@ -431,7 +431,7 @@ int osd_write(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
memcpy(substr, rp, 4);
substr[4] = 0;
*wp = simple_strtoul(substr, NULL, 16);
*wp = hextoul(substr, NULL);
rp += 4;
wp++;
@ -463,8 +463,8 @@ int osd_size(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return 1;
}
x = simple_strtoul(argv[1], NULL, 16);
y = simple_strtoul(argv[2], NULL, 16);
x = hextoul(argv[1], NULL);
y = hextoul(argv[2], NULL);
if (!x || (x > 64) || (x > MAX_X_CHARS) ||
!y || (y > 32) || (y > MAX_Y_CHARS)) {

View file

@ -30,10 +30,10 @@ static int do_osd_write(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 4 || (strlen(argv[3])) % 2)
return CMD_RET_USAGE;
x = simple_strtoul(argv[1], NULL, 16);
y = simple_strtoul(argv[2], NULL, 16);
x = hextoul(argv[1], NULL);
y = hextoul(argv[2], NULL);
hexstr = argv[3];
count = (argc > 4) ? simple_strtoul(argv[4], NULL, 16) : 1;
count = (argc > 4) ? hextoul(argv[4], NULL) : 1;
buflen = strlen(hexstr) / 2;
@ -80,9 +80,9 @@ static int do_osd_print(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 5)
return CMD_RET_USAGE;
x = simple_strtoul(argv[1], NULL, 16);
y = simple_strtoul(argv[2], NULL, 16);
color = simple_strtoul(argv[3], NULL, 16);
x = hextoul(argv[1], NULL);
y = hextoul(argv[2], NULL);
color = hextoul(argv[3], NULL);
text = argv[4];
for (uclass_first_device(UCLASS_VIDEO_OSD, &dev);
@ -109,8 +109,8 @@ static int do_osd_size(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 3)
return CMD_RET_USAGE;
x = simple_strtoul(argv[1], NULL, 16);
y = simple_strtoul(argv[2], NULL, 16);
x = hextoul(argv[1], NULL);
y = hextoul(argv[2], NULL);
for (uclass_first_device(UCLASS_VIDEO_OSD, &dev);
dev;

View file

@ -278,7 +278,7 @@ static int do_checkboardidhwk(struct cmd_tbl *cmdtp, int flag, int argc,
* use simple_strtoul because we need &end and
* we know we got non numeric char at the end
*/
bid = simple_strtoul(rest, &endp, 16);
bid = hextoul(rest, &endp);
/* BoardId and HWkey are separated with a "_" */
if (*endp == '_') {
rest = endp + 1;
@ -286,7 +286,7 @@ static int do_checkboardidhwk(struct cmd_tbl *cmdtp, int flag, int argc,
* use simple_strtoul because we need
* &end
*/
hwkey = simple_strtoul(rest, &endp, 16);
hwkey = hextoul(rest, &endp);
rest = endp;
while (*rest && !isxdigit(*rest))
rest++;

View file

@ -138,7 +138,7 @@ static int do_sl28_nvm(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_FAILURE;
if (argc > 1) {
nvm = simple_strtoul(argv[1], &endp, 16);
nvm = hextoul(argv[1], &endp);
if (*endp != '\0') {
printf("ERROR: argument is not a valid number\n");
ret = -EINVAL;

View file

@ -347,7 +347,7 @@ int board_late_init(void)
if (!s)
return 0;
addr = simple_strtoul(s, NULL, 16);
addr = hextoul(s, NULL);
dst = malloc(CONFIG_SYS_VIDEO_LOGO_MAX_SIZE);
if (!dst)
return -ENOMEM;

View file

@ -133,7 +133,7 @@ static int do_cpld(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 3)
return CMD_RET_USAGE;
addr = simple_strtoul(argv[2], NULL, 16);
addr = hextoul(argv[2], NULL);
if (!(addr == CPLD_ADDR_VERSION || addr == CPLD_ADDR_MODE ||
addr == CPLD_ADDR_MUX || addr == CPLD_ADDR_HDMI ||
addr == CPLD_ADDR_DIPSW || addr == CPLD_ADDR_RESET)) {
@ -144,7 +144,7 @@ static int do_cpld(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc == 3 && strcmp(argv[1], "read") == 0) {
printf("0x%x\n", cpld_read(addr));
} else if (argc == 4 && strcmp(argv[1], "write") == 0) {
val = simple_strtoul(argv[3], NULL, 16);
val = hextoul(argv[3], NULL);
if (addr == CPLD_ADDR_MUX) {
/* never mask SCIFA0 console */
val &= ~MUX_MSK_SCIFA0_USB;

View file

@ -111,7 +111,7 @@ static int do_cpld(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 3)
return CMD_RET_USAGE;
addr = simple_strtoul(argv[2], NULL, 16);
addr = hextoul(argv[2], NULL);
if (!(addr == CPLD_ADDR_VERSION || addr == CPLD_ADDR_MODE ||
addr == CPLD_ADDR_MUX || addr == CPLD_ADDR_DIPSW6 ||
addr == CPLD_ADDR_RESET)) {
@ -122,7 +122,7 @@ static int do_cpld(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc == 3 && strcmp(argv[1], "read") == 0) {
printf("0x%x\n", cpld_read(dev, addr));
} else if (argc == 4 && strcmp(argv[1], "write") == 0) {
val = simple_strtoul(argv[3], NULL, 16);
val = hextoul(argv[3], NULL);
cpld_write(dev, addr, val);
}

View file

@ -243,7 +243,7 @@ int factoryset_read_eeprom(int i2c_addr)
buf, MAX_STRING_LENGTH);
cp1 = buf;
for (i = 0; i < 6; i++) {
factory_dat.mac[i] = simple_strtoul((char *)cp1, NULL, 16);
factory_dat.mac[i] = hextoul((char *)cp1, NULL);
cp1 += 3;
}
@ -254,8 +254,7 @@ int factoryset_read_eeprom(int i2c_addr)
if (ret > 0) {
cp1 = buf;
for (i = 0; i < 6; i++) {
factory_dat.mac_wlan[i] = simple_strtoul((char *)cp1,
NULL, 16);
factory_dat.mac_wlan[i] = hextoul((char *)cp1, NULL);
cp1 += 3;
}
}
@ -266,15 +265,13 @@ int factoryset_read_eeprom(int i2c_addr)
if (0 <= get_factory_record_val(cp, size, (uchar *)"USBD1",
(uchar *)"vid", buf,
MAX_STRING_LENGTH)) {
factory_dat.usb_vendor_id = simple_strtoul((char *)buf,
NULL, 16);
factory_dat.usb_vendor_id = hextoul((char *)buf, NULL);
}
if (0 <= get_factory_record_val(cp, size, (uchar *)"USBD1",
(uchar *)"pid", buf,
MAX_STRING_LENGTH)) {
factory_dat.usb_product_id = simple_strtoul((char *)buf,
NULL, 16);
factory_dat.usb_product_id = hextoul((char *)buf, NULL);
}
printf("DFU USB: VID = 0x%4x, PID = 0x%4x\n", factory_dat.usb_vendor_id,
factory_dat.usb_product_id);
@ -294,8 +291,7 @@ int factoryset_read_eeprom(int i2c_addr)
if (0 <= get_factory_record_val(cp, size, (uchar *)"DEV",
(uchar *)"ver", buf,
MAX_STRING_LENGTH)) {
factory_dat.version = simple_strtoul((char *)buf,
NULL, 16);
factory_dat.version = hextoul((char *)buf, NULL);
debug("version number: %d\n", factory_dat.version);
}
/* Get ASN from factory set if available */

View file

@ -281,7 +281,7 @@ static void set_mac_address(char *string)
}
for (i = 0; *string && (i < MAC_ADDR_BYTES); i++) {
e.mac_addr[i] = simple_strtoul(string, &string, 16);
e.mac_addr[i] = hextoul(string, &string);
if (*string == ':')
string++;
}

View file

@ -252,7 +252,7 @@ static int arg_read_set(const struct env_map_common *map, u32 i, int argc,
char *endp = argv[1];
if (map[i].type == ENV_HEX)
map[i].val->val = simple_strtoul(argv[1], &endp, 16);
map[i].val->val = hextoul(argv[1], &endp);
else
map[i].val->val = simple_strtoul(argv[1], &endp, 10);

View file

@ -120,7 +120,7 @@ static void setup_serial(void)
if (env_get("serial#"))
return;
board_serial = simple_strtoul(ep->serial, &endp, 16);
board_serial = hextoul(ep->serial, &endp);
if (*endp != '\0') {
pr_err("Error: Can't set serial# to %s\n", ep->serial);
return;

View file

@ -201,7 +201,7 @@ static void setup_serial(void)
if (env_get("serial#"))
return;
board_serial = simple_strtoul(ep->serial, &endp, 16);
board_serial = hextoul(ep->serial, &endp);
if (*endp != '\0') {
pr_err("Error: Can't set serial# to %s\n", ep->serial);
return;

View file

@ -299,7 +299,7 @@ static void set_mac_address(unsigned int index, const char *string)
}
for (i = 0; *p && (i < 6); i++) {
e.mac[index][i] = simple_strtoul(p, &p, 16);
e.mac[index][i] = hextoul(p, &p);
if (*p == ':')
p++;
}
@ -364,7 +364,7 @@ int do_mac(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
set_date(argv[2]);
break;
case 'p': /* MAC table size */
e.mac_count = simple_strtoul(argv[2], NULL, 16);
e.mac_count = hextoul(argv[2], NULL);
update_crc();
break;
case '0' ... '9': /* "mac 0" through "mac 22" */

View file

@ -19,7 +19,7 @@ static int do_fru_capture(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < cmdtp->maxargs)
return CMD_RET_USAGE;
addr = simple_strtoul(argv[2], &endp, 16);
addr = hextoul(argv[2], &endp);
if (*argv[1] == 0 || *endp != 0)
return -1;
@ -41,7 +41,7 @@ static int do_fru_generate(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < cmdtp->maxargs)
return CMD_RET_USAGE;
addr = simple_strtoul(argv[2], NULL, 16);
addr = hextoul(argv[2], NULL);
return fru_generate(addr, argv[3], argv[4], argv[5], argv[6], argv[7]);
}

View file

@ -32,7 +32,7 @@ static int do_versal_load_pdi(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
}
len = simple_strtoul(argv[3], NULL, 16);
len = hextoul(argv[3], NULL);
if (!len) {
debug("pdi_load: zero size\n");
return CMD_RET_USAGE;

View file

@ -422,7 +422,7 @@ static int do_zynq_rsa(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != cmdtp->maxargs)
return CMD_RET_FAILURE;
src_ptr = simple_strtoul(argv[2], &endp, 16);
src_ptr = hextoul(argv[2], &endp);
if (*argv[2] == 0 || *endp != 0)
return CMD_RET_USAGE;
@ -453,26 +453,26 @@ static int zynq_decrypt_image(struct cmd_tbl *cmdtp, int flag, int argc,
else
return CMD_RET_USAGE;
srcaddr = simple_strtoul(argv[3], &endp, 16);
srcaddr = hextoul(argv[3], &endp);
if (*argv[3] == 0 || *endp != 0)
return CMD_RET_USAGE;
srclen = simple_strtoul(argv[4], &endp, 16);
srclen = hextoul(argv[4], &endp);
if (*argv[4] == 0 || *endp != 0)
return CMD_RET_USAGE;
dstaddr = 0xFFFFFFFF;
dstlen = srclen;
} else {
srcaddr = simple_strtoul(argv[2], &endp, 16);
srcaddr = hextoul(argv[2], &endp);
if (*argv[2] == 0 || *endp != 0)
return CMD_RET_USAGE;
srclen = simple_strtoul(argv[3], &endp, 16);
srclen = hextoul(argv[3], &endp);
if (*argv[3] == 0 || *endp != 0)
return CMD_RET_USAGE;
dstaddr = simple_strtoul(argv[4], &endp, 16);
dstaddr = hextoul(argv[4], &endp);
if (*argv[4] == 0 || *endp != 0)
return CMD_RET_USAGE;
dstlen = simple_strtoul(argv[5], &endp, 16);
dstlen = hextoul(argv[5], &endp);
if (*argv[5] == 0 || *endp != 0)
return CMD_RET_USAGE;
}

View file

@ -40,7 +40,7 @@ static int do_zynqmp_verify_secure(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
src_addr = simple_strtoull(argv[2], NULL, 16);
len = simple_strtoul(argv[3], NULL, 16);
len = hextoul(argv[3], NULL);
if (argc == 5)
key_ptr = (uint8_t *)(uintptr_t)simple_strtoull(argv[4],
@ -86,7 +86,7 @@ static int do_zynqmp_mmio_read(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != cmdtp->maxargs)
return CMD_RET_USAGE;
addr = simple_strtoul(argv[2], NULL, 16);
addr = hextoul(argv[2], NULL);
ret = zynqmp_mmio_read(addr, &read_val);
if (!ret)
@ -107,9 +107,9 @@ static int do_zynqmp_mmio_write(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != cmdtp->maxargs)
return CMD_RET_USAGE;
addr = simple_strtoul(argv[2], NULL, 16);
mask = simple_strtoul(argv[3], NULL, 16);
val = simple_strtoul(argv[4], NULL, 16);
addr = hextoul(argv[2], NULL);
mask = hextoul(argv[3], NULL);
val = hextoul(argv[4], NULL);
ret = zynqmp_mmio_write(addr, mask, val);
if (ret != 0)
@ -135,12 +135,12 @@ static int do_zynqmp_aes(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < cmdtp->maxargs - 1)
return CMD_RET_USAGE;
aes->srcaddr = simple_strtoul(argv[2], NULL, 16);
aes->ivaddr = simple_strtoul(argv[3], NULL, 16);
aes->len = simple_strtoul(argv[4], NULL, 16);
aes->op = simple_strtoul(argv[5], NULL, 16);
aes->keysrc = simple_strtoul(argv[6], NULL, 16);
aes->dstaddr = simple_strtoul(argv[7], NULL, 16);
aes->srcaddr = hextoul(argv[2], NULL);
aes->ivaddr = hextoul(argv[3], NULL);
aes->len = hextoul(argv[4], NULL);
aes->op = hextoul(argv[5], NULL);
aes->keysrc = hextoul(argv[6], NULL);
aes->dstaddr = hextoul(argv[7], NULL);
flush_dcache_range((ulong)aes, (ulong)(aes) +
roundup(sizeof(struct aes), ARCH_DMA_MINALIGN));
@ -161,7 +161,7 @@ static int do_zynqmp_aes(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < cmdtp->maxargs)
return CMD_RET_USAGE;
aes->keyaddr = simple_strtoul(argv[8], NULL, 16);
aes->keyaddr = hextoul(argv[8], NULL);
if (aes->keyaddr)
flush_dcache_range(aes->keyaddr,
(aes->keyaddr +
@ -187,7 +187,7 @@ static int do_zynqmp_tcm_init(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != cmdtp->maxargs)
return CMD_RET_USAGE;
mode = simple_strtoul(argv[2], NULL, 16);
mode = hextoul(argv[2], NULL);
if (mode != TCM_LOCK && mode != TCM_SPLIT) {
printf("Mode should be either 0(lock)/1(split)\n");
return CMD_RET_FAILURE;
@ -209,8 +209,8 @@ static int do_zynqmp_pmufw(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != cmdtp->maxargs)
return CMD_RET_USAGE;
addr = simple_strtoul(argv[2], NULL, 16);
size = simple_strtoul(argv[3], NULL, 16);
addr = hextoul(argv[2], NULL);
size = hextoul(argv[3], NULL);
flush_dcache_range((ulong)addr, (ulong)(addr + size));
zynqmp_pmufw_load_config_object((const void *)(uintptr_t)addr,
@ -236,16 +236,16 @@ static int do_zynqmp_rsa(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_FAILURE;
}
srcaddr = simple_strtoul(argv[2], NULL, 16);
srclen = simple_strtoul(argv[3], NULL, 16);
srcaddr = hextoul(argv[2], NULL);
srclen = hextoul(argv[3], NULL);
if (srclen != RSA_KEY_SIZE) {
puts("ERR: srclen should be equal to 0x200(512 bytes)\n");
return CMD_RET_USAGE;
}
mod = simple_strtoul(argv[4], NULL, 16);
exp = simple_strtoul(argv[5], NULL, 16);
rsaop = simple_strtoul(argv[6], NULL, 16);
mod = hextoul(argv[4], NULL);
exp = hextoul(argv[5], NULL);
rsaop = hextoul(argv[6], NULL);
if (!(rsaop == 0 || rsaop == 1)) {
puts("ERR: rsaop should be either 0 or 1\n");
return CMD_RET_USAGE;
@ -299,11 +299,11 @@ static int do_zynqmp_sha3(struct cmd_tbl *cmdtp, int flag,
return CMD_RET_FAILURE;
}
srcaddr = simple_strtoul(argv[2], NULL, 16);
srclen = simple_strtoul(argv[3], NULL, 16);
srcaddr = hextoul(argv[2], NULL);
srclen = hextoul(argv[3], NULL);
if (argc == 5) {
hashaddr = simple_strtoul(argv[4], NULL, 16);
hashaddr = hextoul(argv[4], NULL);
flush_dcache_range(hashaddr,
hashaddr + roundup(ZYNQMP_SHA3_SIZE,
ARCH_DMA_MINALIGN));

View file

@ -161,7 +161,7 @@ static int do_abootimg_addr(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != 2)
return CMD_RET_USAGE;
img_addr = simple_strtoul(argv[1], &endp, 16);
img_addr = hextoul(argv[1], &endp);
if (*endp != '\0') {
printf("Error: Wrong image address\n");
return CMD_RET_FAILURE;

View file

@ -27,7 +27,7 @@ static int do_adtimg_addr(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != 2)
return CMD_RET_USAGE;
hdr_addr = simple_strtoul(argv[1], &endp, 16);
hdr_addr = hextoul(argv[1], &endp);
if (*endp != '\0') {
printf("Error: Wrong image address '%s'\n", argv[1]);
return CMD_RET_FAILURE;

View file

@ -55,11 +55,11 @@ static int do_aes(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
else
return CMD_RET_USAGE;
key_addr = simple_strtoul(argv[2], NULL, 16);
iv_addr = simple_strtoul(argv[3], NULL, 16);
src_addr = simple_strtoul(argv[4], NULL, 16);
dst_addr = simple_strtoul(argv[5], NULL, 16);
len = simple_strtoul(argv[6], NULL, 16);
key_addr = hextoul(argv[2], NULL);
iv_addr = hextoul(argv[3], NULL);
src_addr = hextoul(argv[4], NULL);
dst_addr = hextoul(argv[5], NULL);
len = hextoul(argv[6], NULL);
key_ptr = (uint8_t *)map_sysmem(key_addr, key_len);
iv_ptr = (uint8_t *)map_sysmem(iv_addr, 128 / 8);

View file

@ -280,7 +280,7 @@ static int do_afs(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
} else if (argc == 4 && !strcmp(argv[1], "load")) {
ulong load_addr;
load_addr = simple_strtoul(argv[3], NULL, 16);
load_addr = hextoul(argv[3], NULL);
ret = load_image(argv[2], load_addr);
} else {
return CMD_RET_USAGE;

View file

@ -22,7 +22,7 @@ int do_avb_init(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc != 2)
return CMD_RET_USAGE;
mmc_dev = simple_strtoul(argv[1], NULL, 16);
mmc_dev = hextoul(argv[1], NULL);
if (avb_ops)
avb_ops_free(avb_ops);
@ -53,9 +53,9 @@ int do_avb_read_part(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
part = argv[1];
offset = simple_strtoul(argv[2], NULL, 16);
bytes = simple_strtoul(argv[3], NULL, 16);
buffer = (void *)simple_strtoul(argv[4], NULL, 16);
offset = hextoul(argv[2], NULL);
bytes = hextoul(argv[3], NULL);
buffer = (void *)hextoul(argv[4], NULL);
if (avb_ops->read_from_partition(avb_ops, part, offset, bytes,
buffer, &bytes_read) ==
@ -86,8 +86,8 @@ int do_avb_read_part_hex(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
part = argv[1];
offset = simple_strtoul(argv[2], NULL, 16);
bytes = simple_strtoul(argv[3], NULL, 16);
offset = hextoul(argv[2], NULL);
bytes = hextoul(argv[3], NULL);
buffer = malloc(bytes);
if (!buffer) {
@ -132,9 +132,9 @@ int do_avb_write_part(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
part = argv[1];
offset = simple_strtoul(argv[2], NULL, 16);
bytes = simple_strtoul(argv[3], NULL, 16);
buffer = (void *)simple_strtoul(argv[4], NULL, 16);
offset = hextoul(argv[2], NULL);
bytes = hextoul(argv[3], NULL);
buffer = (void *)hextoul(argv[4], NULL);
if (avb_ops->write_to_partition(avb_ops, part, offset, bytes, buffer) ==
AVB_IO_RESULT_OK) {
@ -161,7 +161,7 @@ int do_avb_read_rb(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != 2)
return CMD_RET_USAGE;
index = (size_t)simple_strtoul(argv[1], NULL, 16);
index = (size_t)hextoul(argv[1], NULL);
if (avb_ops->read_rollback_index(avb_ops, index, &rb_idx) ==
AVB_IO_RESULT_OK) {
@ -188,8 +188,8 @@ int do_avb_write_rb(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != 3)
return CMD_RET_USAGE;
index = (size_t)simple_strtoul(argv[1], NULL, 16);
rb_idx = simple_strtoul(argv[2], NULL, 16);
index = (size_t)hextoul(argv[1], NULL);
rb_idx = hextoul(argv[2], NULL);
if (avb_ops->write_rollback_index(avb_ops, index, rb_idx) ==
AVB_IO_RESULT_OK)

View file

@ -198,14 +198,14 @@ static int do_axi_md(struct cmd_tbl *cmdtp, int flag, int argc,
/*
* Address is specified since argc >= 3
*/
addr = simple_strtoul(argv[2], NULL, 16);
addr = hextoul(argv[2], NULL);
/*
* If there's another parameter, it is the length to display;
* length is the number of objects, not number of bytes
*/
if (argc > 3)
length = simple_strtoul(argv[3], NULL, 16);
length = hextoul(argv[3], NULL);
}
switch (size) {
@ -291,14 +291,14 @@ static int do_axi_mw(struct cmd_tbl *cmdtp, int flag, int argc,
};
/* Address is specified since argc > 4 */
addr = simple_strtoul(argv[2], NULL, 16);
addr = hextoul(argv[2], NULL);
/* Get the value to write */
writeval = simple_strtoul(argv[3], NULL, 16);
writeval = hextoul(argv[3], NULL);
/* Count ? */
if (argc == 5)
count = simple_strtoul(argv[4], NULL, 16);
count = hextoul(argv[4], NULL);
else
count = 1;

View file

@ -75,11 +75,11 @@ int do_bedbug_dis(struct cmd_tbl *cmdtp, int flag, int argc,
if ((flag & CMD_FLAG_REPEAT) == 0) {
/* New command */
addr = simple_strtoul (argv[1], NULL, 16);
addr = hextoul(argv[1], NULL);
/* If an extra param is given then it is the length */
if (argc > 2)
len = simple_strtoul (argv[2], NULL, 16);
len = hextoul(argv[2], NULL);
}
/* Run the disassembler */
@ -114,7 +114,7 @@ int do_bedbug_asm(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
printf ("\nEnter '.' when done\n");
mem_addr = simple_strtoul (argv[1], NULL, 16);
mem_addr = hextoul(argv[1], NULL);
while (1) {
putc ('\n');

View file

@ -58,7 +58,7 @@ void write_to_mem(char *varname, u8 *result, ulong len)
ulong addr;
u8 *buf;
addr = simple_strtoul(varname, NULL, 16);
addr = hextoul(varname, NULL);
buf = map_sysmem(addr, len);
memcpy(buf, result, len);
unmap_sysmem(buf);
@ -95,12 +95,12 @@ static int do_binop(struct cmd_tbl *cmdtp, int flag, int argc,
src2 = malloc(len);
if (*src1arg == '*')
read_from_mem(simple_strtoul(src1arg + 1, NULL, 16), src1, len);
read_from_mem(hextoul(src1arg + 1, NULL), src1, len);
else
read_from_env_var(src1arg, src1);
if (*src2arg == '*')
read_from_mem(simple_strtoul(src2arg + 1, NULL, 16), src2, len);
read_from_mem(hextoul(src2arg + 1, NULL), src2, len);
else
read_from_env_var(src2arg, src2);

View file

@ -63,9 +63,9 @@ int blk_common_cmd(int argc, char *const argv[], enum if_type if_type,
default: /* at least 4 args */
if (strcmp(argv[1], "read") == 0) {
ulong addr = simple_strtoul(argv[2], NULL, 16);
lbaint_t blk = simple_strtoul(argv[3], NULL, 16);
ulong cnt = simple_strtoul(argv[4], NULL, 16);
ulong addr = hextoul(argv[2], NULL);
lbaint_t blk = hextoul(argv[3], NULL);
ulong cnt = hextoul(argv[4], NULL);
ulong n;
printf("\n%s read: device %d block # "LBAFU", count %lu ... ",
@ -78,9 +78,9 @@ int blk_common_cmd(int argc, char *const argv[], enum if_type if_type,
n == cnt ? "OK" : "ERROR");
return n == cnt ? 0 : 1;
} else if (strcmp(argv[1], "write") == 0) {
ulong addr = simple_strtoul(argv[2], NULL, 16);
lbaint_t blk = simple_strtoul(argv[3], NULL, 16);
ulong cnt = simple_strtoul(argv[4], NULL, 16);
ulong addr = hextoul(argv[2], NULL);
lbaint_t blk = hextoul(argv[3], NULL);
ulong cnt = hextoul(argv[4], NULL);
ulong n;
printf("\n%s write: device %d block # "LBAFU", count %lu ... ",

View file

@ -70,10 +70,10 @@ static int do_blob(struct cmd_tbl *cmdtp, int flag, int argc,
else
return CMD_RET_USAGE;
src_addr = simple_strtoul(argv[2], NULL, 16);
dst_addr = simple_strtoul(argv[3], NULL, 16);
len = simple_strtoul(argv[4], NULL, 16);
key_addr = simple_strtoul(argv[5], NULL, 16);
src_addr = hextoul(argv[2], NULL);
dst_addr = hextoul(argv[3], NULL);
len = hextoul(argv[4], NULL);
key_addr = hextoul(argv[5], NULL);
km_ptr = (uint8_t *)(uintptr_t)key_addr;
src_ptr = (uint8_t *)(uintptr_t)src_addr;

View file

@ -102,7 +102,7 @@ static int do_bmp_info(struct cmd_tbl *cmdtp, int flag, int argc,
addr = image_load_addr;
break;
case 2: /* use argument */
addr = simple_strtoul(argv[1], NULL, 16);
addr = hextoul(argv[1], NULL);
break;
default:
return CMD_RET_USAGE;
@ -124,10 +124,10 @@ static int do_bmp_display(struct cmd_tbl *cmdtp, int flag, int argc,
addr = image_load_addr;
break;
case 2: /* use argument */
addr = simple_strtoul(argv[1], NULL, 16);
addr = hextoul(argv[1], NULL);
break;
case 4:
addr = simple_strtoul(argv[1], NULL, 16);
addr = hextoul(argv[1], NULL);
if (!strcmp(argv[2], "m"))
x = BMP_ALIGN_CENTER;
else

View file

@ -29,7 +29,7 @@ static int do_go(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc < 2)
return CMD_RET_USAGE;
addr = simple_strtoul(argv[1], NULL, 16);
addr = hextoul(argv[1], NULL);
printf ("## Starting application at 0x%08lX ...\n", addr);

View file

@ -281,7 +281,7 @@ efi_status_t efi_install_fdt(void *fdt)
return EFI_NOT_FOUND;
}
}
fdt_addr = simple_strtoul(fdt_opt, NULL, 16);
fdt_addr = hextoul(fdt_opt, NULL);
if (!fdt_addr) {
log_err("ERROR: invalid $fdt_addr or $fdtcontroladdr\n");
return EFI_LOAD_ERROR;
@ -628,7 +628,7 @@ static int do_bootefi(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc > 2) {
uintptr_t fdt_addr;
fdt_addr = simple_strtoul(argv[2], NULL, 16);
fdt_addr = hextoul(argv[2], NULL);
fdt = map_sysmem(fdt_addr, 0);
} else {
fdt = EFI_FDT_USE_INTERNAL;

View file

@ -43,7 +43,7 @@ static int booti_start(struct cmd_tbl *cmdtp, int flag, int argc,
debug("* kernel: default image load address = 0x%08lx\n",
image_load_addr);
} else {
ld = simple_strtoul(argv[0], NULL, 16);
ld = hextoul(argv[0], NULL);
debug("* kernel: cmdline image address = 0x%08lx\n", ld);
}

View file

@ -112,7 +112,7 @@ int do_bootm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc > 0) {
char *endp;
simple_strtoul(argv[0], &endp, 16);
hextoul(argv[0], &endp);
/* endp pointing to NULL means that argv[0] was just a
* valid number, pass it along to the normal bootm processing
*
@ -240,7 +240,7 @@ static int do_iminfo(struct cmd_tbl *cmdtp, int flag, int argc,
}
for (arg = 1; arg < argc; ++arg) {
addr = simple_strtoul(argv[arg], NULL, 16);
addr = hextoul(argv[arg], NULL);
if (image_info(addr) != 0)
rcode = 1;
}

View file

@ -24,12 +24,12 @@ static int get_base_size(int argc, char *const argv[], ulong *basep,
*sizep = CONFIG_BOOTSTAGE_STASH_SIZE;
if (argc < 2)
return 0;
*basep = simple_strtoul(argv[1], &endp, 16);
*basep = hextoul(argv[1], &endp);
if (*argv[1] == 0 || *endp != 0)
return -1;
if (argc == 2)
return 0;
*sizep = simple_strtoul(argv[2], &endp, 16);
*sizep = hextoul(argv[2], &endp);
if (*argv[2] == 0 || *endp != 0)
return -1;

View file

@ -39,7 +39,7 @@ static int bootz_start(struct cmd_tbl *cmdtp, int flag, int argc,
debug("* kernel: default image load address = 0x%08lx\n",
image_load_addr);
} else {
images->ep = simple_strtoul(argv[0], NULL, 16);
images->ep = hextoul(argv[0], NULL);
debug("* kernel: cmdline image address = 0x%08lx\n",
images->ep);
}

View file

@ -53,13 +53,13 @@ static int do_spi_images_addr(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
/* convert command parameter to fastboot address (base 16), i.e. hex */
images_load_addr = simple_strtoul(argv[1], NULL, 16);
images_load_addr = hextoul(argv[1], NULL);
if (!images_load_addr) {
pr_err("Invalid load address\n");
return CMD_RET_USAGE;
}
spi_load_addr = simple_strtoul(argv[2], NULL, 16);
spi_load_addr = hextoul(argv[2], NULL);
if (!spi_load_addr) {
pr_err("Invalid spi load address\n");
return CMD_RET_USAGE;

View file

@ -22,7 +22,7 @@ static int do_cbfs_init(struct cmd_tbl *cmdtp, int flag, int argc,
return 0;
}
if (argc == 2) {
end_of_rom = simple_strtoul(argv[1], &ep, 16);
end_of_rom = hextoul(argv[1], &ep);
if (*ep) {
puts("\n** Invalid end of ROM **\n");
return 1;
@ -58,9 +58,9 @@ static int do_cbfs_fsload(struct cmd_tbl *cmdtp, int flag, int argc,
}
/* parse offset and count */
offset = simple_strtoul(argv[1], NULL, 16);
offset = hextoul(argv[1], NULL);
if (argc == 4)
count = simple_strtoul(argv[3], NULL, 16);
count = hextoul(argv[3], NULL);
else
count = 0;

View file

@ -107,7 +107,7 @@ int do_cramfs_load(struct cmd_tbl *cmdtp, int flag, int argc,
struct mtdids id;
ulong addr;
addr = simple_strtoul(env_get("cramfsaddr"), NULL, 16);
addr = hextoul(env_get("cramfsaddr"), NULL);
/* hack! */
/* cramfs_* only supports NOR flash chips */
@ -172,7 +172,7 @@ int do_cramfs_ls(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
struct mtdids id;
ulong addr;
addr = simple_strtoul(env_get("cramfsaddr"), NULL, 16);
addr = hextoul(env_get("cramfsaddr"), NULL);
/* hack! */
/* cramfs_* only supports NOR flash chips */

View file

@ -65,11 +65,11 @@ static int do_read_write(struct udevice *dev, int is_write, int argc,
return 1;
if (argc < 4)
return 1;
addr = simple_strtoul(argv[3], &endp, 16);
addr = hextoul(argv[3], &endp);
if (*argv[3] == 0 || *endp != 0)
return 1;
if (argc > 4) {
size = simple_strtoul(argv[4], &endp, 16);
size = hextoul(argv[4], &endp);
if (*argv[4] == 0 || *endp != 0)
return 1;
}

View file

@ -48,7 +48,7 @@ static int do_demo_light(struct cmd_tbl *cmdtp, int flag, int argc,
int ret;
if (argc) {
light = simple_strtoul(argv[0], NULL, 16);
light = hextoul(argv[0], NULL);
ret = demo_set_light(demo_dev, light);
} else {
ret = demo_get_light(demo_dev);

View file

@ -36,7 +36,7 @@ int common_diskboot(struct cmd_tbl *cmdtp, const char *intf, int argc,
bootstage_mark(BOOTSTAGE_ID_IDE_ADDR);
if (argc > 1)
addr = simple_strtoul(argv[1], NULL, 16);
addr = hextoul(argv[1], NULL);
bootstage_mark(BOOTSTAGE_ID_IDE_BOOT_DEVICE);

View file

@ -61,7 +61,7 @@ static int do_efi_capsule_update(struct cmd_tbl *cmdtp, int flag,
argv++;
}
capsule = (typeof(capsule))simple_strtoul(argv[1], &endp, 16);
capsule = (typeof(capsule))hextoul(argv[1], &endp);
if (endp == argv[1]) {
printf("Invalid address: %s", argv[1]);
return CMD_RET_FAILURE;
@ -117,7 +117,7 @@ static int do_efi_capsule_show(struct cmd_tbl *cmdtp, int flag,
if (argc != 2)
return CMD_RET_USAGE;
capsule = (typeof(capsule))simple_strtoul(argv[1], &endp, 16);
capsule = (typeof(capsule))hextoul(argv[1], &endp);
if (endp == argv[1]) {
printf("Invalid address: %s", argv[1]);
return CMD_RET_FAILURE;
@ -256,7 +256,7 @@ static int do_efi_capsule_res(struct cmd_tbl *cmdtp, int flag,
argc--;
argv++;
capsule_id = simple_strtoul(argv[0], &endp, 16);
capsule_id = hextoul(argv[0], &endp);
if (capsule_id < 0 || capsule_id > 0xffff)
return CMD_RET_USAGE;
@ -983,7 +983,7 @@ static int do_efi_boot_add(struct cmd_tbl *cmdtp, int flag,
r = CMD_RET_USAGE;
goto out;
}
id = (int)simple_strtoul(argv[1], &endp, 16);
id = (int)hextoul(argv[1], &endp);
if (*endp != '\0' || id > 0xffff)
return CMD_RET_USAGE;
@ -1113,7 +1113,7 @@ static int do_efi_boot_rm(struct cmd_tbl *cmdtp, int flag,
guid = efi_global_variable_guid;
for (i = 1; i < argc; i++, argv++) {
id = (int)simple_strtoul(argv[1], &endp, 16);
id = (int)hextoul(argv[1], &endp);
if (*endp != '\0' || id > 0xffff)
return CMD_RET_FAILURE;
@ -1410,7 +1410,7 @@ static int do_efi_boot_next(struct cmd_tbl *cmdtp, int flag,
if (argc != 2)
return CMD_RET_USAGE;
bootnext = (u16)simple_strtoul(argv[1], &endp, 16);
bootnext = (u16)hextoul(argv[1], &endp);
if (*endp) {
printf("invalid value: %s\n", argv[1]);
r = CMD_RET_FAILURE;
@ -1469,7 +1469,7 @@ static int do_efi_boot_order(struct cmd_tbl *cmdtp, int flag,
return CMD_RET_FAILURE;
for (i = 0; i < argc; i++) {
id = (int)simple_strtoul(argv[i], &endp, 16);
id = (int)hextoul(argv[i], &endp);
if (*endp != '\0' || id > 0xffff) {
printf("invalid value: %s\n", argv[i]);
r = CMD_RET_FAILURE;

View file

@ -115,7 +115,7 @@ int do_bootvx(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc < 2)
addr = image_load_addr;
else
addr = simple_strtoul(argv[1], NULL, 16);
addr = hextoul(argv[1], NULL);
#if defined(CONFIG_CMD_NET)
/*
@ -200,7 +200,7 @@ int do_bootvx(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
}
if (!bootaddr)
bootaddr = simple_strtoul(tmp, NULL, 16);
bootaddr = hextoul(tmp, NULL);
/*
* Check to see if the bootline is defined in the 'bootargs' parameter.

View file

@ -112,13 +112,13 @@ static int do_fastboot(struct cmd_tbl *cmdtp, int flag, int argc,
case 'l':
if (--argc <= 0)
return CMD_RET_USAGE;
buf_addr = simple_strtoul(*++argv, NULL, 16);
buf_addr = hextoul(*++argv, NULL);
goto NXTARG;
case 's':
if (--argc <= 0)
return CMD_RET_USAGE;
buf_size = simple_strtoul(*++argv, NULL, 16);
buf_size = hextoul(*++argv, NULL);
goto NXTARG;
default:

View file

@ -143,7 +143,7 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return 0;
}
addr = simple_strtoul(argv[0], NULL, 16);
addr = hextoul(argv[0], NULL);
blob = map_sysmem(addr, 0);
if (!fdt_valid(&blob))
return 1;
@ -157,7 +157,7 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
int err;
/* Optional new length */
len = simple_strtoul(argv[1], NULL, 16);
len = hextoul(argv[1], NULL);
if (len < fdt_totalsize(blob)) {
printf("New length %d < existing length %d, ignoring\n",
len, fdt_totalsize(blob));
@ -195,11 +195,11 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
/*
* Set the address and length of the fdt.
*/
working_fdt = (struct fdt_header *)simple_strtoul(argv[2], NULL, 16);
working_fdt = (struct fdt_header *)hextoul(argv[2], NULL);
if (!fdt_valid(&working_fdt))
return 1;
newaddr = (struct fdt_header *)simple_strtoul(argv[3],NULL,16);
newaddr = (struct fdt_header *)hextoul(argv[3], NULL);
/*
* If the user specifies a length, use that. Otherwise use the
@ -208,7 +208,7 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc <= 4) {
len = fdt_totalsize(working_fdt);
} else {
len = simple_strtoul(argv[4], NULL, 16);
len = hextoul(argv[4], NULL);
if (len < fdt_totalsize(working_fdt)) {
printf ("New length 0x%X < existing length "
"0x%X, aborting.\n",
@ -364,21 +364,22 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
}
if (subcmd[0] == 'n' || (subcmd[0] == 's' && argc == 5)) {
int reqIndex = -1;
int req_index = -1;
int startDepth = fdt_node_depth(
working_fdt, nodeoffset);
int curDepth = startDepth;
int curIndex = -1;
int cur_index = -1;
int nextNodeOffset = fdt_next_node(
working_fdt, nodeoffset, &curDepth);
if (subcmd[0] == 'n')
reqIndex = simple_strtoul(argv[5], NULL, 16);
req_index = hextoul(argv[5], NULL);
while (curDepth > startDepth) {
if (curDepth == startDepth + 1)
curIndex++;
if (subcmd[0] == 'n' && curIndex == reqIndex) {
cur_index++;
if (subcmd[0] == 'n' &&
cur_index == req_index) {
const char *node_name;
node_name = fdt_get_name(working_fdt,
@ -394,7 +395,7 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
}
if (subcmd[0] == 's') {
/* get the num nodes at this level */
env_set_ulong(var, curIndex + 1);
env_set_ulong(var, cur_index + 1);
} else {
/* node index not found */
printf("libfdt node not found\n");
@ -548,7 +549,7 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
* Set boot cpu id
*/
} else if (strncmp(argv[1], "boo", 3) == 0) {
unsigned long tmp = simple_strtoul(argv[2], NULL, 16);
unsigned long tmp = hextoul(argv[2], NULL);
fdt_set_boot_cpuid_phys(working_fdt, tmp);
/*
@ -600,7 +601,7 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return err;
}
} else if (argv[2][0] == 'd') {
unsigned long idx = simple_strtoul(argv[3], NULL, 16);
unsigned long idx = hextoul(argv[3], NULL);
int err = fdt_del_mem_rsv(working_fdt, idx);
if (err < 0) {
@ -636,8 +637,8 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return CMD_RET_USAGE;
if (argc == 4) {
initrd_start = simple_strtoul(argv[2], NULL, 16);
initrd_end = simple_strtoul(argv[3], NULL, 16);
initrd_start = hextoul(argv[2], NULL);
initrd_end = hextoul(argv[3], NULL);
}
fdt_chosen(working_fdt);
@ -654,7 +655,7 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return CMD_RET_FAILURE;
if (argc > 2) {
addr = simple_strtoul(argv[2], NULL, 16);
addr = hextoul(argv[2], NULL);
blob = map_sysmem(addr, 0);
} else {
blob = (struct fdt_header *)gd->fdt_blob;
@ -691,7 +692,7 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (!working_fdt)
return CMD_RET_FAILURE;
addr = simple_strtoul(argv[2], NULL, 16);
addr = hextoul(argv[2], NULL);
blob = map_sysmem(addr, 0);
if (!fdt_valid(&blob))
return CMD_RET_FAILURE;
@ -706,7 +707,7 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
else if (strncmp(argv[1], "re", 2) == 0) {
uint extrasize;
if (argc > 2)
extrasize = simple_strtoul(argv[2], NULL, 16);
extrasize = hextoul(argv[2], NULL);
else
extrasize = 0;
fdt_shrink_to_minimum(working_fdt, extrasize);
@ -797,7 +798,7 @@ static int fdt_parse_prop(char * const *newval, int count, char *data, int *len)
}
if (!isxdigit(*newp))
break;
tmp = simple_strtoul(newp, &newp, 16);
tmp = hextoul(newp, &newp);
*data++ = tmp & 0xFF;
*len = *len + 1;
}
@ -883,7 +884,7 @@ static void print_data(const void *data, int len)
env_max_dump = env_get("fdt_max_dump");
if (env_max_dump)
max_dump = simple_strtoul(env_max_dump, NULL, 16);
max_dump = hextoul(env_max_dump, NULL);
/*
* It is a string, but it may have multiple strings (embedded '\0's).

View file

@ -151,7 +151,7 @@ addr_spec(char *arg1, char *arg2, ulong *addr_first, ulong *addr_last)
char *ep;
char len_used; /* indicates if the "start +length" form used */
*addr_first = simple_strtoul(arg1, &ep, 16);
*addr_first = hextoul(arg1, &ep);
if (ep == arg1 || *ep != '\0')
return -1;
@ -161,7 +161,7 @@ addr_spec(char *arg1, char *arg2, ulong *addr_first, ulong *addr_last)
++arg2;
}
*addr_last = simple_strtoul(arg2, &ep, 16);
*addr_last = hextoul(arg2, &ep);
if (ep == arg2 || *ep != '\0')
return -1;
@ -287,7 +287,7 @@ static int do_flinfo(struct cmd_tbl *cmdtp, int flag, int argc,
return 0;
}
bank = simple_strtoul(argv[1], NULL, 16);
bank = hextoul(argv[1], NULL);
if ((bank < 1) || (bank > CONFIG_SYS_MAX_FLASH_BANKS)) {
printf ("Only FLASH Banks # 1 ... # %d supported\n",
CONFIG_SYS_MAX_FLASH_BANKS);
@ -366,7 +366,7 @@ static int do_flerase(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
if (strcmp(argv[1], "bank") == 0) {
bank = simple_strtoul(argv[2], NULL, 16);
bank = hextoul(argv[2], NULL);
if ((bank < 1) || (bank > CONFIG_SYS_MAX_FLASH_BANKS)) {
printf ("Only FLASH Banks # 1 ... # %d supported\n",
CONFIG_SYS_MAX_FLASH_BANKS);
@ -547,7 +547,7 @@ static int do_protect(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
if (strcmp(argv[2], "bank") == 0) {
bank = simple_strtoul(argv[3], NULL, 16);
bank = hextoul(argv[3], NULL);
if ((bank < 1) || (bank > CONFIG_SYS_MAX_FLASH_BANKS)) {
printf ("Only FLASH Banks # 1 ... # %d supported\n",
CONFIG_SYS_MAX_FLASH_BANKS);

View file

@ -57,7 +57,7 @@ static int do_fpga_check_params(long *dev, long *fpga_data, size_t *data_size,
}
*fpga_data = local_fpga_data;
local_data_size = simple_strtoul(argv[2], NULL, 16);
local_data_size = hextoul(argv[2], NULL);
if (!local_data_size) {
debug("fpga: zero size\n");
return CMD_RET_USAGE;
@ -95,8 +95,8 @@ int do_fpga_loads(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
*/
argc++;
fpga_sec_info.encflag = (u8)simple_strtoul(argv[4], NULL, 16);
fpga_sec_info.authflag = (u8)simple_strtoul(argv[3], NULL, 16);
fpga_sec_info.encflag = (u8)hextoul(argv[4], NULL);
fpga_sec_info.authflag = (u8)hextoul(argv[3], NULL);
if (fpga_sec_info.authflag >= FPGA_NO_ENC_OR_NO_AUTH &&
fpga_sec_info.encflag >= FPGA_NO_ENC_OR_NO_AUTH) {
@ -134,7 +134,7 @@ static int do_fpga_loadfs(struct cmd_tbl *cmdtp, int flag, int argc,
return ret;
fpga_fsinfo.fstype = FS_TYPE_ANY;
fpga_fsinfo.blocksize = (unsigned int)simple_strtoul(argv[3], NULL, 16);
fpga_fsinfo.blocksize = (unsigned int)hextoul(argv[3], NULL);
fpga_fsinfo.interface = argv[4];
fpga_fsinfo.dev_part = argv[5];
fpga_fsinfo.filename = argv[6];
@ -274,7 +274,7 @@ static int do_fpga_loadmk(struct cmd_tbl *cmdtp, int flag, int argc,
} else
#endif
{
fpga_data = (void *)simple_strtoul(datastr, NULL, 16);
fpga_data = (void *)hextoul(datastr, NULL);
debug("* fpga: cmdline image address = 0x%08lx\n",
(ulong)fpga_data);
}

View file

@ -49,19 +49,19 @@ int do_fpga_md(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
/*
* FPGA is specified since argc > 2
*/
fpga = simple_strtoul(argv[1], NULL, 16);
fpga = hextoul(argv[1], NULL);
/*
* Address is specified since argc > 2
*/
addr = simple_strtoul(argv[2], NULL, 16);
addr = hextoul(argv[2], NULL);
/*
* If another parameter, it is the length to display.
* Length is the number of objects, not number of bytes.
*/
if (argc > 3)
length = simple_strtoul(argv[3], NULL, 16);
length = hextoul(argv[3], NULL);
}
nbytes = length * sizeof(u16);

View file

@ -62,7 +62,7 @@ static int do_host_bind(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc > 2)
return CMD_RET_USAGE;
dev_str = argv[0];
dev = simple_strtoul(dev_str, &ep, 16);
dev = hextoul(dev_str, &ep);
if (*ep) {
printf("** Bad device specification %s **\n", dev_str);
return CMD_RET_USAGE;
@ -82,7 +82,7 @@ static int do_host_info(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc >= 2) {
char *ep;
char *dev_str = argv[1];
int dev = simple_strtoul(dev_str, &ep, 16);
int dev = hextoul(dev_str, &ep);
if (*ep) {
printf("** Bad device specification %s **\n", dev_str);
return CMD_RET_USAGE;
@ -139,7 +139,7 @@ static int do_host_dev(struct cmd_tbl *cmdtp, int flag, int argc,
return 0;
}
dev = simple_strtoul(argv[1], &ep, 16);
dev = hextoul(argv[1], &ep);
if (*ep) {
printf("** Bad device specification %s **\n", argv[2]);
return CMD_RET_USAGE;

View file

@ -308,13 +308,13 @@ static int do_i2c_read(struct cmd_tbl *cmdtp, int flag, int argc,
/*
* I2C chip address
*/
chip = simple_strtoul(argv[1], NULL, 16);
chip = hextoul(argv[1], NULL);
/*
* I2C data address within the chip. This can be 1 or
* 2 bytes long. Some day it might be 3 bytes long :-).
*/
devaddr = simple_strtoul(argv[2], NULL, 16);
devaddr = hextoul(argv[2], NULL);
alen = get_alen(argv[2], DEFAULT_ADDR_LEN);
if (alen > 3)
return CMD_RET_USAGE;
@ -322,12 +322,12 @@ static int do_i2c_read(struct cmd_tbl *cmdtp, int flag, int argc,
/*
* Length is the number of objects, not number of bytes.
*/
length = simple_strtoul(argv[3], NULL, 16);
length = hextoul(argv[3], NULL);
/*
* memaddr is the address where to store things in memory
*/
memaddr = (u_char *)simple_strtoul(argv[4], NULL, 16);
memaddr = (u_char *)hextoul(argv[4], NULL);
#if CONFIG_IS_ENABLED(DM_I2C)
ret = i2c_get_cur_bus_chip(chip, &dev);
@ -363,18 +363,18 @@ static int do_i2c_write(struct cmd_tbl *cmdtp, int flag, int argc,
/*
* memaddr is the address where to store things in memory
*/
memaddr = (u_char *)simple_strtoul(argv[1], NULL, 16);
memaddr = (u_char *)hextoul(argv[1], NULL);
/*
* I2C chip address
*/
chip = simple_strtoul(argv[2], NULL, 16);
chip = hextoul(argv[2], NULL);
/*
* I2C data address within the chip. This can be 1 or
* 2 bytes long. Some day it might be 3 bytes long :-).
*/
devaddr = simple_strtoul(argv[3], NULL, 16);
devaddr = hextoul(argv[3], NULL);
alen = get_alen(argv[3], DEFAULT_ADDR_LEN);
if (alen > 3)
return cmd_usage(cmdtp);
@ -382,7 +382,7 @@ static int do_i2c_write(struct cmd_tbl *cmdtp, int flag, int argc,
/*
* Length is the number of bytes.
*/
length = simple_strtoul(argv[4], NULL, 16);
length = hextoul(argv[4], NULL);
#if CONFIG_IS_ENABLED(DM_I2C)
ret = i2c_get_cur_bus_chip(chip, &dev);
@ -447,13 +447,13 @@ static int do_i2c_flags(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 2)
return CMD_RET_USAGE;
chip = simple_strtoul(argv[1], NULL, 16);
chip = hextoul(argv[1], NULL);
ret = i2c_get_cur_bus_chip(chip, &dev);
if (ret)
return i2c_report_err(ret, I2C_ERR_READ);
if (argc > 2) {
flags = simple_strtoul(argv[2], NULL, 16);
flags = hextoul(argv[2], NULL);
ret = i2c_set_chip_flags(dev, flags);
} else {
ret = i2c_get_chip_flags(dev, &flags);
@ -477,13 +477,13 @@ static int do_i2c_olen(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 2)
return CMD_RET_USAGE;
chip = simple_strtoul(argv[1], NULL, 16);
chip = hextoul(argv[1], NULL);
ret = i2c_get_cur_bus_chip(chip, &dev);
if (ret)
return i2c_report_err(ret, I2C_ERR_READ);
if (argc > 2) {
olen = simple_strtoul(argv[2], NULL, 16);
olen = hextoul(argv[2], NULL);
ret = i2c_set_chip_offset_len(dev, olen);
} else {
ret = i2c_get_chip_offset_len(dev);
@ -543,13 +543,13 @@ static int do_i2c_md(struct cmd_tbl *cmdtp, int flag, int argc,
/*
* I2C chip address
*/
chip = simple_strtoul(argv[1], NULL, 16);
chip = hextoul(argv[1], NULL);
/*
* I2C data address within the chip. This can be 1 or
* 2 bytes long. Some day it might be 3 bytes long :-).
*/
addr = simple_strtoul(argv[2], NULL, 16);
addr = hextoul(argv[2], NULL);
alen = get_alen(argv[2], DEFAULT_ADDR_LEN);
if (alen > 3)
return CMD_RET_USAGE;
@ -559,7 +559,7 @@ static int do_i2c_md(struct cmd_tbl *cmdtp, int flag, int argc,
* Length is the number of objects, not number of bytes.
*/
if (argc > 3)
length = simple_strtoul(argv[3], NULL, 16);
length = hextoul(argv[3], NULL);
}
#if CONFIG_IS_ENABLED(DM_I2C)
@ -651,12 +651,12 @@ static int do_i2c_mw(struct cmd_tbl *cmdtp, int flag, int argc,
/*
* Chip is always specified.
*/
chip = simple_strtoul(argv[1], NULL, 16);
chip = hextoul(argv[1], NULL);
/*
* Address is always specified.
*/
addr = simple_strtoul(argv[2], NULL, 16);
addr = hextoul(argv[2], NULL);
alen = get_alen(argv[2], DEFAULT_ADDR_LEN);
if (alen > 3)
return CMD_RET_USAGE;
@ -671,13 +671,13 @@ static int do_i2c_mw(struct cmd_tbl *cmdtp, int flag, int argc,
/*
* Value to write is always specified.
*/
byte = simple_strtoul(argv[3], NULL, 16);
byte = hextoul(argv[3], NULL);
/*
* Optional count
*/
if (argc == 5)
count = simple_strtoul(argv[4], NULL, 16);
count = hextoul(argv[4], NULL);
else
count = 1;
@ -740,12 +740,12 @@ static int do_i2c_crc(struct cmd_tbl *cmdtp, int flag, int argc,
/*
* Chip is always specified.
*/
chip = simple_strtoul(argv[1], NULL, 16);
chip = hextoul(argv[1], NULL);
/*
* Address is always specified.
*/
addr = simple_strtoul(argv[2], NULL, 16);
addr = hextoul(argv[2], NULL);
alen = get_alen(argv[2], DEFAULT_ADDR_LEN);
if (alen > 3)
return CMD_RET_USAGE;
@ -760,7 +760,7 @@ static int do_i2c_crc(struct cmd_tbl *cmdtp, int flag, int argc,
/*
* Count is always specified
*/
count = simple_strtoul(argv[3], NULL, 16);
count = hextoul(argv[3], NULL);
printf ("CRC32 for %08lx ... %08lx ==> ", addr, addr + count - 1);
/*
@ -840,12 +840,12 @@ static int mod_i2c_mem(struct cmd_tbl *cmdtp, int incrflag, int flag, int argc,
/*
* Chip is always specified.
*/
chip = simple_strtoul(argv[1], NULL, 16);
chip = hextoul(argv[1], NULL);
/*
* Address is always specified.
*/
addr = simple_strtoul(argv[2], NULL, 16);
addr = hextoul(argv[2], NULL);
alen = get_alen(argv[2], DEFAULT_ADDR_LEN);
if (alen > 3)
return CMD_RET_USAGE;
@ -900,7 +900,7 @@ static int mod_i2c_mem(struct cmd_tbl *cmdtp, int incrflag, int flag, int argc,
else {
char *endp;
data = simple_strtoul(console_buffer, &endp, 16);
data = hextoul(console_buffer, &endp);
if (size == 1)
data = data << 24;
else if (size == 2)
@ -1049,12 +1049,12 @@ static int do_i2c_loop(struct cmd_tbl *cmdtp, int flag, int argc,
/*
* Chip is always specified.
*/
chip = simple_strtoul(argv[1], NULL, 16);
chip = hextoul(argv[1], NULL);
/*
* Address is always specified.
*/
addr = simple_strtoul(argv[2], NULL, 16);
addr = hextoul(argv[2], NULL);
alen = get_alen(argv[2], DEFAULT_ADDR_LEN);
if (alen > 3)
return CMD_RET_USAGE;
@ -1070,7 +1070,7 @@ static int do_i2c_loop(struct cmd_tbl *cmdtp, int flag, int argc,
* Length is the number of objects, not number of bytes.
*/
length = 1;
length = simple_strtoul(argv[3], NULL, 16);
length = hextoul(argv[3], NULL);
if (length > sizeof(bytes))
length = sizeof(bytes);
@ -1219,7 +1219,7 @@ static int do_sdram(struct cmd_tbl *cmdtp, int flag, int argc,
/*
* Chip is always specified.
*/
chip = simple_strtoul (argv[1], NULL, 16);
chip = hextoul(argv[1], NULL);
#if CONFIG_IS_ENABLED(DM_I2C)
ret = i2c_get_cur_bus_chip(chip, &dev);
@ -1673,7 +1673,7 @@ int do_edid(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return 1;
}
chip = simple_strtoul(argv[1], NULL, 16);
chip = hextoul(argv[1], NULL);
#if CONFIG_IS_ENABLED(DM_I2C)
ret = i2c_get_cur_bus_chip(chip, &dev);
if (!ret)

View file

@ -236,10 +236,10 @@ static int do_ini(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return CMD_RET_USAGE;
section = argv[1];
file_address = (char *)simple_strtoul(
argc < 3 ? env_get("loadaddr") : argv[2], NULL, 16);
file_size = (size_t)simple_strtoul(
argc < 4 ? env_get("filesize") : argv[3], NULL, 16);
file_address = (char *)hextoul(argc < 3 ? env_get("loadaddr") : argv[2],
NULL);
file_size = (size_t)hextoul(argc < 4 ? env_get("filesize") : argv[3],
NULL);
return ini_parse(file_address, file_size, ini_handler, (void *)section);
}

View file

@ -51,7 +51,7 @@ int do_io_iod(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return 1;
/* Address is specified since argc > 1 */
addr = simple_strtoul(argv[1], NULL, 16);
addr = hextoul(argv[1], NULL);
addr += base_address;
/*
@ -59,7 +59,7 @@ int do_io_iod(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
* Length is the number of objects, not number of bytes.
*/
if (argc > 2)
length = simple_strtoul(argv[2], NULL, 16);
length = hextoul(argv[2], NULL);
}
bytes = size * length;
@ -102,8 +102,8 @@ int do_io_iow(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (size < 0)
return 1;
addr = simple_strtoul(argv[1], NULL, 16);
val = simple_strtoul(argv[2], NULL, 16);
addr = hextoul(argv[1], NULL);
val = hextoul(argv[2], NULL);
if (size == 4)
outl((u32) val, addr);

View file

@ -60,8 +60,8 @@ static int do_set_buffer(int argc, char *const argv[])
ulong addr = 0, size = 0;
if (argc == 2) {
addr = simple_strtoul(*argv++, NULL, 16);
size = simple_strtoul(*argv++, NULL, 16);
addr = hextoul(*argv++, NULL);
size = hextoul(*argv++, NULL);
} else if (argc != 0) {
return CMD_RET_USAGE;
}
@ -76,8 +76,8 @@ static int do_set_region(int argc, char *const argv[])
ulong addr = 0, size = 0;
if (argc == 2) {
addr = simple_strtoul(*argv++, NULL, 16);
size = simple_strtoul(*argv++, NULL, 16);
addr = hextoul(*argv++, NULL);
size = hextoul(*argv++, NULL);
} else if (argc != 0) {
return CMD_RET_USAGE;
}

View file

@ -57,7 +57,7 @@ static long evalexp(char *s, int w)
/* if the parameter starts with a * then assume is a pointer to the value we want */
if (s[0] == '*') {
addr = simple_strtoul(&s[1], NULL, 16);
addr = hextoul(&s[1], NULL);
buf = map_physmem(addr, w, MAP_WRBACK);
if (!buf && addr) {
puts("Failed to map physical memory\n");
@ -82,7 +82,7 @@ static long evalexp(char *s, int w)
unmap_physmem(buf, w);
return l;
} else {
l = simple_strtoul(s, NULL, 16);
l = hextoul(s, NULL);
}
/* avoid overflow on mask calculus */
@ -93,7 +93,7 @@ static char * evalstr(char *s)
{
/* if the parameter starts with a * then assume a string pointer else its a literal */
if (s[0] == '*') {
return (char *)simple_strtoul(&s[1], NULL, 16);
return (char *)hextoul(&s[1], NULL);
} else if (s[0] == '$') {
int i = 2;

View file

@ -491,7 +491,7 @@ int do_jffs2_fsload(struct cmd_tbl *cmdtp, int flag, int argc,
filename = argv[1];
}
if (argc == 3) {
offset = simple_strtoul(argv[1], NULL, 16);
offset = hextoul(argv[1], NULL);
image_load_addr = offset;
filename = argv[2];
}

View file

@ -257,11 +257,11 @@ int do_save_serial(struct cmd_tbl *cmdtp, int flag, int argc,
#endif
if (argc >= 2) {
offset = simple_strtoul(argv[1], NULL, 16);
offset = hextoul(argv[1], NULL);
}
#ifdef CONFIG_SYS_LOADS_BAUD_CHANGE
if (argc >= 3) {
size = simple_strtoul(argv[2], NULL, 16);
size = hextoul(argv[2], NULL);
}
if (argc == 4) {
save_baudrate = (int)simple_strtoul(argv[3], NULL, 10);
@ -284,7 +284,7 @@ int do_save_serial(struct cmd_tbl *cmdtp, int flag, int argc,
}
#else /* ! CONFIG_SYS_LOADS_BAUD_CHANGE */
if (argc == 3) {
size = simple_strtoul(argv[2], NULL, 16);
size = hextoul(argv[2], NULL);
}
#endif /* CONFIG_SYS_LOADS_BAUD_CHANGE */
@ -438,12 +438,12 @@ static int do_load_serial_bin(struct cmd_tbl *cmdtp, int flag, int argc,
/* pre-set offset from $loadaddr */
s = env_get("loadaddr");
if (s)
offset = simple_strtoul(s, NULL, 16);
offset = hextoul(s, NULL);
load_baudrate = current_baudrate = gd->baudrate;
if (argc >= 2) {
offset = simple_strtoul(argv[1], NULL, 16);
offset = hextoul(argv[1], NULL);
}
if (argc == 3) {
load_baudrate = (int)simple_strtoul(argv[2], NULL, 10);

View file

@ -26,11 +26,11 @@ static int do_lzmadec(struct cmd_tbl *cmdtp, int flag, int argc,
switch (argc) {
case 4:
dst_len = simple_strtoul(argv[3], NULL, 16);
dst_len = hextoul(argv[3], NULL);
/* fall through */
case 3:
src = simple_strtoul(argv[1], NULL, 16);
dst = simple_strtoul(argv[2], NULL, 16);
src = hextoul(argv[1], NULL);
dst = hextoul(argv[2], NULL);
break;
default:
return CMD_RET_USAGE;

View file

@ -25,7 +25,7 @@ static void store_result(const u8 *sum, const char *dest)
if (*dest == '*') {
u8 *ptr;
ptr = (u8 *)simple_strtoul(dest + 1, NULL, 16);
ptr = (u8 *)hextoul(dest + 1, NULL);
for (i = 0; i < 16; i++)
*ptr++ = sum[i];
} else {
@ -46,7 +46,7 @@ static int parse_verify_sum(char *verify_str, u8 *vsum)
if (*verify_str == '*') {
u8 *ptr;
ptr = (u8 *)simple_strtoul(verify_str + 1, NULL, 16);
ptr = (u8 *)hextoul(verify_str + 1, NULL);
memcpy(vsum, ptr, 16);
} else {
unsigned int i;
@ -66,7 +66,7 @@ static int parse_verify_sum(char *verify_str, u8 *vsum)
*nullp = '\0';
*(u8 *)(vsum + i) =
simple_strtoul(vsum_str + (i * 2), NULL, 16);
hextoul(vsum_str + (i * 2), NULL);
*nullp = end;
}
}
@ -97,8 +97,8 @@ int do_md5sum(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return CMD_RET_USAGE;
}
addr = simple_strtoul(*av++, NULL, 16);
len = simple_strtoul(*av++, NULL, 16);
addr = hextoul(*av++, NULL);
len = hextoul(*av++, NULL);
buf = map_sysmem(addr, len);
md5_wd(buf, len, output, CHUNKSZ_MD5);
@ -147,8 +147,8 @@ static int do_md5sum(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 3)
return CMD_RET_USAGE;
addr = simple_strtoul(argv[1], NULL, 16);
len = simple_strtoul(argv[2], NULL, 16);
addr = hextoul(argv[1], NULL);
len = hextoul(argv[2], NULL);
buf = map_sysmem(addr, len);
md5_wd(buf, len, output, CHUNKSZ_MD5);

View file

@ -254,7 +254,7 @@ static int do_mdio(struct cmd_tbl *cmdtp, int flag, int argc,
switch (op[0]) {
case 'w':
if (pos > 1)
data = simple_strtoul(argv[pos--], NULL, 16);
data = hextoul(argv[pos--], NULL);
/* Intentional fall-through - Get reg for read and write */
case 'r':
if (pos > 1)

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