Merge branch '2021-08-02-numeric-input-cleanups'

- Merge in a series that cleans up and makes more consistent how we deal
  with numeric input on the CLI.  This saves a few bytes in a lot of
  places.
This commit is contained in:
Tom Rini 2021-08-02 13:32:20 -04:00
commit 51aef40555
254 changed files with 1169 additions and 948 deletions

41
README
View File

@ -3510,47 +3510,6 @@ The signature of the callback functions is:
The return value is 0 if the variable change is accepted and 1 otherwise.
Command Line Parsing:
=====================
There are two different command line parsers available with U-Boot:
the old "simple" one, and the much more powerful "hush" shell:
Old, simple command line parser:
--------------------------------
- supports environment variables (through setenv / saveenv commands)
- several commands on one line, separated by ';'
- variable substitution using "... ${name} ..." syntax
- special characters ('$', ';') can be escaped by prefixing with '\',
for example:
setenv bootcmd bootm \${address}
- You can also escape text by enclosing in single apostrophes, for example:
setenv addip 'setenv bootargs $bootargs ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname::off'
Hush shell:
-----------
- similar to Bourne shell, with control structures like
if...then...else...fi, for...do...done; while...do...done,
until...do...done, ...
- supports environment ("global") variables (through setenv / saveenv
commands) and local shell variables (through standard shell syntax
"name=value"); only environment variables can be used with "run"
command
General rules:
--------------
(1) If a command line (or an environment variable executed by a "run"
command) contains several commands separated by semicolon, and
one of these commands fails, then the remaining commands will be
executed anyway.
(2) If you execute several variables with one call to run (i. e.
calling run with a list of variables as arguments), any failing
command will cause "run" to terminate, i. e. the remaining
variables are not executed.
Note for Redundant Ethernet Interfaces:
=======================================

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

@ -277,7 +277,7 @@ static unsigned long get_internval_val_mhz(void)
ulong interval_mhz = get_bus_freq(0) / (1000 * 1000);
if (interval)
interval_mhz = simple_strtoul(interval, NULL, 10);
interval_mhz = dectoul(interval, NULL);
return interval_mhz;
}

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,9 +300,9 @@ 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);
len = simple_strtoul(argv[3], NULL, 10);
src_addr = hextoul(argv[1], NULL);
dst_addr = hextoul(argv[2], NULL);
len = dectoul(argv[3], NULL);
return blob_encap_dek(src_addr, dst_addr, len);
}

View File

@ -71,8 +71,8 @@ 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_size = simple_strtoul(argv[3], NULL, 10);
m_addr = hextoul(argv[2], NULL);
m_size = dectoul(argv[3], NULL);
m_ptr = map_physmem(m_addr, m_size, MAP_NOCACHE);
if (!m_ptr)
return -ENOMEM;

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);
@ -726,8 +726,8 @@ static int do_tamper_pin_cfg(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != (2 + 1))
return CMD_RET_USAGE;
conf.pad = simple_strtoul(argv[++idx], NULL, 10);
conf.mux_conf = simple_strtoul(argv[++idx], NULL, 16);
conf.pad = dectoul(argv[++idx], NULL);
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

@ -42,9 +42,9 @@ int do_pll_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
else
goto pll_cmd_usage;
cmd_pll_data.pll_m = simple_strtoul(argv[2], NULL, 10);
cmd_pll_data.pll_d = simple_strtoul(argv[3], NULL, 10);
cmd_pll_data.pll_od = simple_strtoul(argv[4], NULL, 10);
cmd_pll_data.pll_m = dectoul(argv[2], NULL);
cmd_pll_data.pll_d = dectoul(argv[3], NULL);
cmd_pll_data.pll_od = dectoul(argv[4], NULL);
printf("Trying to set pll %d; mult %d; div %d; OD %d\n",
cmd_pll_data.pll, cmd_pll_data.pll_m,
@ -72,7 +72,7 @@ int do_getclk_cmd(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != 2)
goto getclk_cmd_usage;
clk = simple_strtoul(argv[1], NULL, 10);
clk = dectoul(argv[1], NULL);
freq = ks_clk_get_rate(clk);
if (freq)
@ -101,7 +101,7 @@ int do_psc_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc != 3)
goto psc_cmd_usage;
psc_module = simple_strtoul(argv[1], NULL, 10);
psc_module = dectoul(argv[1], NULL);
if (strcmp(argv[2], "en") == 0) {
res = psc_enable_module(psc_module);
printf("psc_enable_module(%d) - %s\n", psc_module,

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

@ -125,7 +125,7 @@ static void kw_sysrst_check(void)
return;
/* read sysrstdelay value */
sysrst_dly = (u32) simple_strtoul(s, NULL, 10);
sysrst_dly = (u32)dectoul(s, NULL);
/* read SysRst Length counter register (bits 28:0) */
sysrst_cnt = (0x1fffffff & readl(KW_REG_SYSRST_CNT));

View File

@ -592,7 +592,7 @@ struct clk *clk_get(const char *id)
c = strrchr((const char *)str, (int)'.');
if (!c || !cdev->peri)
break;
devid = simple_strtoul(++c, NULL, 10);
devid = dectoul(++c, NULL);
if (cdev->peri->dev_id == devid)
break;
}

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

@ -59,17 +59,17 @@ static int do_stm32prog(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
}
dev = (int)simple_strtoul(argv[2], NULL, 10);
dev = (int)dectoul(argv[2], NULL);
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

@ -253,7 +253,7 @@ static int parse_type(struct stm32prog_data *data,
result = -EINVAL;
else
part->bin_nb =
simple_strtoul(&p[7], NULL, 10);
dectoul(&p[7], NULL);
}
} else if (!strcmp(p, "System")) {
part->part_type = PART_SYSTEM;

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

@ -138,7 +138,7 @@ int do_ecc(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
}
if (argc == 3) {
if (strcmp(argv[1], "sbecnt") == 0) {
val = simple_strtoul(argv[2], NULL, 10);
val = dectoul(argv[2], NULL);
if (val > 255) {
printf("Incorrect Counter value, "
"should be 0..255\n");
@ -151,7 +151,7 @@ int do_ecc(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
ddr->err_sbe = val;
return 0;
} else if (strcmp(argv[1], "sbethr") == 0) {
val = simple_strtoul(argv[2], NULL, 10);
val = dectoul(argv[2], NULL);
if (val > 255) {
printf("Incorrect Counter value, "
"should be 0..255\n");
@ -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

@ -52,7 +52,7 @@ void spi_set_speed(struct spi_slave *slave, uint hz)
*/
int name_to_gpio(const char *name)
{
int gpio = 31 - simple_strtoul(name, NULL, 10);
int gpio = 31 - dectoul(name, NULL);
if (gpio < 16)
gpio = -1;

View File

@ -194,13 +194,13 @@ int drv_video_init(void)
printf("Init Video as ");
s = env_get("displaywidth");
if (s != NULL)
display_width = simple_strtoul(s, NULL, 10);
display_width = dectoul(s, NULL);
else
display_width = 256;
s = env_get("displayheight");
if (s != NULL)
display_height = simple_strtoul(s, NULL, 10);
display_height = dectoul(s, NULL);
else
display_height = 256;
@ -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);
}
@ -234,8 +234,8 @@ int do_brightness(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
switch (argc) {
case 3:
side = simple_strtoul(argv[1], NULL, 10);
bright = simple_strtoul(argv[2], NULL, 10);
side = dectoul(argv[1], NULL);
bright = dectoul(argv[2], NULL);
if ((side >= 0) && (side <= 3) &&
(bright >= 0) && (bright <= 1000)) {
vcxk_setbrightness(side, bright);

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

@ -47,7 +47,7 @@ void at91_pda_detect(void)
break;
}
}
pda = simple_strtoul((const char *)buf, NULL, 10);
pda = dectoul((const char *)buf, NULL);
switch (pda) {
case 7000:

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,48 +235,48 @@ 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);
offset = simple_strtoul(argv[3], NULL, 10);
size = simple_strtoul(argv[4], NULL, 10);
buffer = (void *)hextoul(argv[2], NULL);
offset = dectoul(argv[3], NULL);
size = dectoul(argv[4], NULL);
ret = atf_read_mmc(offset, buffer, size);
} else if ((argc == 5) && !strcmp(argv[1], "readnor")) {
buffer = (void *)simple_strtoul(argv[2], NULL, 16);
offset = simple_strtoul(argv[3], NULL, 10);
size = simple_strtoul(argv[4], NULL, 10);
buffer = (void *)hextoul(argv[2], NULL);
offset = dectoul(argv[3], NULL);
size = dectoul(argv[4], NULL);
ret = atf_read_nor(offset, buffer, size);
} else if ((argc == 5) && !strcmp(argv[1], "writemmc")) {
buffer = (void *)simple_strtoul(argv[2], NULL, 16);
offset = simple_strtoul(argv[3], NULL, 10);
size = simple_strtoul(argv[4], NULL, 10);
buffer = (void *)hextoul(argv[2], NULL);
offset = dectoul(argv[3], NULL);
size = dectoul(argv[4], NULL);
ret = atf_write_mmc(offset, buffer, size);
} else if ((argc == 5) && !strcmp(argv[1], "writenor")) {
buffer = (void *)simple_strtoul(argv[2], NULL, 16);
offset = simple_strtoul(argv[3], NULL, 10);
size = simple_strtoul(argv[4], NULL, 10);
buffer = (void *)hextoul(argv[2], NULL);
offset = dectoul(argv[3], NULL);
size = dectoul(argv[4], NULL);
ret = atf_write_nor(offset, buffer, size);
} else if ((argc == 2) && !strcmp(argv[1], "part")) {
atf_print_part_table();
} else if ((argc == 4) && !strcmp(argv[1], "erasenor")) {
offset = simple_strtoul(argv[2], NULL, 10);
size = simple_strtoul(argv[3], NULL, 10);
offset = dectoul(argv[2], NULL);
size = dectoul(argv[3], NULL);
ret = atf_erase_nor(offset, size);
} else if ((argc == 2) && !strcmp(argv[1], "envcount")) {
ret = atf_env_count();
printf("Number of environment strings: %zd\n", ret);
} else if ((argc == 3) && !strcmp(argv[1], "envstring")) {
index = simple_strtoul(argv[2], NULL, 10);
index = dectoul(argv[2], NULL);
ret = atf_env_string(index, str);
if (ret > 0)
printf("Environment string %d: %s\n", index, str);
else
printf("Return code: %zd\n", ret);
} else if ((argc == 3) && !strcmp(argv[1], "dramsize")) {
node = simple_strtoul(argv[2], NULL, 10);
node = dectoul(argv[2], NULL);
ret = atf_dram_size(node);
printf("DRAM size: %zd Mbytes\n", ret >> 20);
} else if ((argc == 2) && !strcmp(argv[1], "nodes")) {

View File

@ -153,7 +153,7 @@ u32 cl_eeprom_get_board_rev(uint eeprom_bus)
*/
if (cl_eeprom_layout == LAYOUT_LEGACY) {
sprintf(str, "%x", board_rev);
board_rev = simple_strtoul(str, NULL, 10);
board_rev = dectoul(str, NULL);
}
return board_rev;

View File

@ -244,7 +244,7 @@ static int parse_pixclock(char *pixclock)
int divisor, pixclock_val;
char *pixclk_start = pixclock;
pixclock_val = simple_strtoul(pixclock, &pixclock, 10);
pixclock_val = dectoul(pixclock, &pixclock);
divisor = DIV_ROUND_UP(PIXEL_CLK_NUMERATOR, pixclock_val);
/* 0 and 1 are illegal values for PCD */
if (divisor <= 1)

View File

@ -284,7 +284,7 @@ u32 get_board_rev(void)
s = env_get("maxcpuclk");
if (s)
maxcpuclk = simple_strtoul(s, NULL, 10);
maxcpuclk = dectoul(s, NULL);
if (maxcpuclk >= 456000000)
rev = 3;

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

@ -403,10 +403,10 @@ static unsigned long strfractoint(char *strptr)
mulconst = 1;
for (i = 0; i < j; i++)
mulconst *= 10;
decval = simple_strtoul(decarr, NULL, 10);
decval = dectoul(decarr, NULL);
}
intval = simple_strtoul(intarr, NULL, 10);
intval = dectoul(intarr, NULL);
intval = intval * mulconst;
return intval + decval;
@ -489,9 +489,9 @@ static int pixis_reset_cmd(struct cmd_tbl *cmdtp, int flag, int argc,
unsigned long corepll;
unsigned long mpxpll;
sysclk = simple_strtoul(p_cf_sysclk, NULL, 10);
sysclk = dectoul(p_cf_sysclk, NULL);
corepll = strfractoint(p_cf_corepll);
mpxpll = simple_strtoul(p_cf_mpxpll, NULL, 10);
mpxpll = dectoul(p_cf_mpxpll, NULL);
if (!(set_px_sysclk(sysclk)
&& set_px_corepll(corepll)

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,11 +452,11 @@ 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" */
set_mac_address(simple_strtoul(argv[1], NULL, 10), argv[2]);
set_mac_address(dectoul(argv[1], NULL), argv[2]);
break;
case 'h': /* help */
default:

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

@ -277,7 +277,7 @@ static int do_gsc_sleep(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 2)
return CMD_RET_USAGE;
secs = simple_strtoul(argv[1], NULL, 10);
secs = dectoul(argv[1], NULL);
printf("GSC Sleeping for %ld seconds\n", secs);
i2c_set_bus_num(0);
@ -322,7 +322,7 @@ static int do_gsc_wd(struct cmd_tbl *cmdtp, int flag, int argc,
int timeout = 0;
if (argc > 2)
timeout = simple_strtoul(argv[2], NULL, 10);
timeout = dectoul(argv[2], NULL);
i2c_set_bus_num(0);
if (gsc_i2c_read(GSC_SC_ADDR, GSC_SC_CTRL1, 1, &reg, 1))
return CMD_RET_FAILURE;

View File

@ -471,7 +471,7 @@ void get_board_serial(struct tag_serialnr *serialnr)
if (serial) {
serialnr->high = 0;
serialnr->low = simple_strtoul(serial, NULL, 10);
serialnr->low = dectoul(serial, NULL);
} else if (ventana_info.model[0]) {
serialnr->high = 0;
serialnr->low = ventana_info.serial;
@ -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

@ -660,7 +660,7 @@ static int do_gsc(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]
if (strcasecmp(argv[1], "sleep") == 0) {
if (argc < 3)
return CMD_RET_USAGE;
if (!gsc_sleep(simple_strtoul(argv[2], NULL, 10)))
if (!gsc_sleep(dectoul(argv[2], NULL)))
return CMD_RET_SUCCESS;
} else if (strcasecmp(argv[1], "hwmon") == 0) {
if (!gsc_hwmon())

View File

@ -275,13 +275,13 @@ int do_ioreflect(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (argc < 2)
return CMD_RET_USAGE;
fpga = simple_strtoul(argv[1], NULL, 10);
fpga = dectoul(argv[1], NULL);
/*
* If another parameter, it is the report rate in packets.
*/
if (argc > 2)
rate = simple_strtoul(argv[2], NULL, 10);
rate = dectoul(argv[2], NULL);
/* Enable receive path */
FPGA_SET_REG(fpga, ep.rx_tx_control, CTRL_PROC_RECEIVE_ENABLE);
@ -388,18 +388,18 @@ int do_ioloop(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
/*
* FPGA is specified since argc > 2
*/
fpga = simple_strtoul(argv[1], NULL, 10);
fpga = dectoul(argv[1], NULL);
/*
* packet size is specified since argc > 2
*/
size = simple_strtoul(argv[2], NULL, 10);
size = dectoul(argv[2], NULL);
/*
* If another parameter, it is the test rate in packets per second.
*/
if (argc > 3)
rate = simple_strtoul(argv[3], NULL, 10);
rate = dectoul(argv[3], NULL);
/* enable receive path */
FPGA_SET_REG(fpga, ep.rx_tx_control, CTRL_PROC_RECEIVE_ENABLE);
@ -463,13 +463,13 @@ int do_ioloop(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
/*
* packet size is specified since argc > 1
*/
size = simple_strtoul(argv[2], NULL, 10);
size = dectoul(argv[2], NULL);
/*
* If another parameter, it is the test rate in packets per second.
*/
if (argc > 2)
rate = simple_strtoul(argv[3], NULL, 10);
rate = dectoul(argv[3], NULL);
/* Enable receive path */
misc_set_enabled(dev, true);
@ -514,7 +514,7 @@ int do_iodev(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return CMD_RET_FAILURE;
if (argc > 1) {
int i = simple_strtoul(argv[1], NULL, 10);
int i = dectoul(argv[1], NULL);
snprintf(name, sizeof(name), "ioep%d", i);

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

@ -169,7 +169,7 @@ char *get_dfu_alt_boot(char *interface, char *devstr)
if (board_is_odroidxu4() || board_is_odroidhc1() || board_is_odroidhc2())
return info;
dev_num = simple_strtoul(devstr, NULL, 10);
dev_num = dectoul(devstr, NULL);
mmc = find_mmc_device(dev_num);
if (!mmc)

View File

@ -85,7 +85,7 @@ char *get_dfu_alt_boot(char *interface, char *devstr)
char *alt_boot;
int dev_num;
dev_num = simple_strtoul(devstr, NULL, 10);
dev_num = dectoul(devstr, NULL);
mmc = find_mmc_device(dev_num);
if (!mmc)

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

@ -394,10 +394,9 @@ static int do_upgrade_available(struct cmd_tbl *cmdtp, int flag, int argc,
unsigned long boot_retry = 0;
char boot_buf[10];
upgrade_available = simple_strtoul(env_get("upgrade_available"), NULL,
10);
upgrade_available = dectoul(env_get("upgrade_available"), NULL);
if (upgrade_available) {
boot_retry = simple_strtoul(env_get("boot_retries"), NULL, 10);
boot_retry = dectoul(env_get("boot_retries"), NULL);
boot_retry++;
sprintf(boot_buf, "%lx", boot_retry);
env_set("boot_retries", boot_buf);

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++;
}
@ -324,7 +324,7 @@ static void set_pcb_revision(char *string)
{
unsigned long p;
p = simple_strtoul(string, &string, 10);
p = dectoul(string, &string);
if (p > U8_MAX) {
printf("%s must not be greater than %d\n", "PCB revision",
U8_MAX);
@ -366,7 +366,7 @@ static void set_bom_variant(char *string)
{
unsigned long p;
p = simple_strtoul(string, &string, 10);
p = dectoul(string, &string);
if (p > U8_MAX) {
printf("%s must not be greater than %d\n", "BOM variant",
U8_MAX);
@ -389,7 +389,7 @@ static void set_product_id(char *string)
{
unsigned long p;
p = simple_strtoul(string, &string, 10);
p = dectoul(string, &string);
if (p > U16_MAX) {
printf("%s must not be greater than %d\n", "Product ID",
U16_MAX);

View File

@ -252,9 +252,9 @@ 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);
map[i].val->val = dectoul(argv[1], &endp);
map[i].val->set = true;

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

@ -548,7 +548,7 @@ static int get_cfgblock_interactive(void)
len = cli_readline(message);
}
tdx_serial = simple_strtoul(console_buffer, NULL, 10);
tdx_serial = dectoul(console_buffer, NULL);
return 0;
}
@ -566,14 +566,14 @@ static int get_cfgblock_barcode(char *barcode, struct toradex_hw *tag,
/* Get hardware information from the first 8 digits */
tag->ver_major = barcode[4] - '0';
tag->ver_minor = barcode[5] - '0';
tag->ver_assembly = simple_strtoul(revision, NULL, 10);
tag->ver_assembly = dectoul(revision, NULL);
barcode[4] = '\0';
tag->prodid = simple_strtoul(barcode, NULL, 10);
tag->prodid = dectoul(barcode, NULL);
/* Parse second part of the barcode (serial number */
barcode += 8;
*serial = simple_strtoul(barcode, NULL, 10);
*serial = dectoul(barcode, NULL);
return 0;
}
@ -710,7 +710,7 @@ int try_migrate_tdx_cfg_block_carrier(void)
tdx_car_hw_tag.ver_assembly = pid8[7] - '0';
pid8[4] = '\0';
tdx_car_hw_tag.prodid = simple_strtoul(pid8, NULL, 10);
tdx_car_hw_tag.prodid = dectoul(pid8, NULL);
/* Valid Tag */
write_tag(config_block, &offset, TAG_VALID, NULL, 0);
@ -754,7 +754,7 @@ static int get_cfgblock_carrier_interactive(void)
sprintf(message, "Choose your carrier board (provide ID): ");
len = cli_readline(message);
tdx_car_hw_tag.prodid = simple_strtoul(console_buffer, NULL, 10);
tdx_car_hw_tag.prodid = dectoul(console_buffer, NULL);
do {
sprintf(message, "Enter carrier board version (e.g. V1.1B): V");
@ -770,7 +770,7 @@ static int get_cfgblock_carrier_interactive(void)
len = cli_readline(message);
}
tdx_car_serial = simple_strtoul(console_buffer, NULL, 10);
tdx_car_serial = dectoul(console_buffer, NULL);
return 0;
}

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,11 +364,11 @@ 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" */
set_mac_address(simple_strtoul(argv[1], NULL, 10), argv[2]);
set_mac_address(dectoul(argv[1], NULL), argv[2]);
break;
case 'h': /* help */
default:

View File

@ -233,8 +233,7 @@ void work_92105_display_init(void)
/* set display contrast */
display_contrast_str = env_get("fwopt_dispcontrast");
if (display_contrast_str)
display_contrast = simple_strtoul(display_contrast_str,
NULL, 10);
display_contrast = dectoul(display_contrast_str, NULL);
i2c_write(0x2c, 0x00, 1, &display_contrast, 1);
/* request GPO_15 as an output initially set to 1 */

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)
@ -366,7 +366,7 @@ int do_avb_read_pvalue(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
name = argv[1];
bytes = simple_strtoul(argv[2], &endp, 10);
bytes = dectoul(argv[2], &endp);
if (*endp && *endp != '\n')
return CMD_RET_USAGE;

View File

@ -120,7 +120,7 @@ static int do_axi_show_bus(struct cmd_tbl *cmdtp, int flag, int argc,
int i;
/* show specific bus */
i = simple_strtoul(argv[1], NULL, 10);
i = dectoul(argv[1], NULL);
struct udevice *bus;
int ret;
@ -153,7 +153,7 @@ static int do_axi_bus_num(struct cmd_tbl *cmdtp, int flag, int argc,
printf("Current bus is %d\n", bus_no);
} else {
bus_no = simple_strtoul(argv[1], NULL, 10);
bus_no = dectoul(argv[1], NULL);
printf("Setting bus to %d\n", bus_no);
ret = axi_set_cur_bus(bus_no);
@ -193,19 +193,19 @@ static int do_axi_md(struct cmd_tbl *cmdtp, int flag, int argc,
}
if ((flag & CMD_FLAG_REPEAT) == 0) {
size = simple_strtoul(argv[1], NULL, 10);
size = dectoul(argv[1], NULL);
/*
* 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) {
@ -273,7 +273,7 @@ static int do_axi_mw(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc <= 3 || argc >= 6)
return CMD_RET_USAGE;
size = simple_strtoul(argv[1], NULL, 10);
size = dectoul(argv[1], NULL);
switch (size) {
case 8:
@ -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

@ -218,13 +218,13 @@ static int do_bind_unbind(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
ret = unbind_by_node_path(argv[1]);
} else if (!by_node && bind) {
int index = (argc > 2) ? simple_strtoul(argv[2], NULL, 10) : 0;
int index = (argc > 2) ? dectoul(argv[2], NULL) : 0;
if (argc != 4)
return CMD_RET_USAGE;
ret = bind_by_class_index(argv[1], index, argv[3]);
} else if (!by_node && !bind) {
int index = (argc > 2) ? simple_strtoul(argv[2], NULL, 10) : 0;
int index = (argc > 2) ? dectoul(argv[2], NULL) : 0;
if (argc == 3)
ret = unbind_by_class_index(argv[1], index);

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);
@ -89,18 +89,18 @@ static int do_binop(struct cmd_tbl *cmdtp, int flag, int argc,
else
return CMD_RET_USAGE;
len = simple_strtoul(lenarg, NULL, 10);
len = dectoul(lenarg, NULL);
src1 = malloc(len);
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

@ -40,7 +40,7 @@ int blk_common_cmd(int argc, char *const argv[], enum if_type if_type,
return CMD_RET_USAGE;
case 3:
if (strncmp(argv[1], "dev", 3) == 0) {
int dev = (int)simple_strtoul(argv[2], NULL, 10);
int dev = (int)dectoul(argv[2], NULL);
if (!blk_show_device(if_type, dev)) {
*cur_devnump = dev;
@ -50,7 +50,7 @@ int blk_common_cmd(int argc, char *const argv[], enum if_type if_type,
}
return 0;
} else if (strncmp(argv[1], "part", 4) == 0) {
int dev = (int)simple_strtoul(argv[2], NULL, 10);
int dev = (int)dectoul(argv[2], NULL);
if (blk_print_part_devnum(if_type, dev)) {
printf("\n%s device %d not available\n",
@ -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,18 +124,18 @@ 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
x = simple_strtoul(argv[2], NULL, 10);
x = dectoul(argv[2], NULL);
if (!strcmp(argv[3], "m"))
y = BMP_ALIGN_CENTER;
else
y = simple_strtoul(argv[3], NULL, 10);
y = dectoul(argv[3], NULL);
break;
default:
return CMD_RET_USAGE;

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

@ -120,7 +120,7 @@ static int do_clk_setfreq(struct cmd_tbl *cmdtp, int flag, int argc,
s32 freq;
struct udevice *dev;
freq = simple_strtoul(argv[2], NULL, 10);
freq = dectoul(argv[2], NULL);
dev = clk_lookup(argv[1]);

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