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",
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");
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;
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);
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)
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);
}
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;
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)
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);
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);
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);
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);
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,
return CMD_RET_SUCCESS;
}
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
if (!addr)
return CMD_RET_FAILURE;
{
uint32_t boot_addr;
- boot_addr = simple_strtoul(argv[0], NULL, 16);
+ boot_addr = hextoul(argv[0], NULL);
switch (nr) {
case 1:
freq = CONFIG_SYS_HZ_CLOCK;
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
header = (struct image_header *)addr;
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",
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);
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;
}
}
argv++;
if (argc == 3)
- mask = simple_strtoul(argv[1], NULL, 16);
+ mask = hextoul(argv[1], NULL);
switch (*argv[0]) {
case 'e': /* Enable */
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;
return CMD_RET_SUCCESS;
}
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
if (!addr)
return CMD_RET_USAGE;
yes = true;
}
- addr = simple_strtoul(argv[argc - 1], NULL, 16);
+ addr = hextoul(argv[argc - 1], NULL);
if (!addr)
return CMD_RET_USAGE;
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) {
if (!str)
goto fail;
- offset = simple_strtoul(str, &end, 16);
+ offset = hextoul(str, &end);
if (*end)
goto fail;
}
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)) {
} 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,
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++;
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);
}
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;
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");
}
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 "
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 "
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;
}
}
}
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;
}
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
* 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;
}
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;
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
#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);
}
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 */
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))
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))
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))
/* 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;
}
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);
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;
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
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
}
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++;
}
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" */
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*/
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*/
/* 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))
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) {
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")) {
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;
}
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;
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];
memcpy(substr, rp, 4);
substr[4] = 0;
- *wp = simple_strtoul(substr, NULL, 16);
+ *wp = hextoul(substr, NULL);
rp += 4;
wp++;
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)) {
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;
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);
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;
* 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;
* use simple_strtoul because we need
* &end
*/
- hwkey = simple_strtoul(rest, &endp, 16);
+ hwkey = hextoul(rest, &endp);
rest = endp;
while (*rest && !isxdigit(*rest))
rest++;
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;
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;
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)) {
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;
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)) {
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);
}
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;
}
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;
}
}
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);
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 */
}
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++;
}
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);
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;
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;
}
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++;
}
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" */
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;
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]);
}
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;
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;
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;
}
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],
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)
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)
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));
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 +
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;
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,
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;
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));
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;
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;
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);
} 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;
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);
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) ==
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) {
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) {
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) {
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)
/*
* 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) {
};
/* 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;
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 */
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');
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);
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);
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 ... ",
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 ... ",
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;
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;
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
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);
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;
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;
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);
}
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
*
}
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;
}
*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;
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);
}
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;
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;
}
/* 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;
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 */
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 */
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;
}
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);
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);
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;
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;
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;
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;
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;
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;
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;
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)
/*
}
if (!bootaddr)
- bootaddr = simple_strtoul(tmp, NULL, 16);
+ bootaddr = hextoul(tmp, NULL);
/*
* Check to see if the bootline is defined in the 'bootargs' parameter.
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:
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;
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));
/*
* 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
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",
}
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,
}
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");
* 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);
/*
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) {
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);
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;
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;
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);
}
if (!isxdigit(*newp))
break;
- tmp = simple_strtoul(newp, &newp, 16);
+ tmp = hextoul(newp, &newp);
*data++ = tmp & 0xFF;
*len = *len + 1;
}
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).
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;
++arg2;
}
- *addr_last = simple_strtoul(arg2, &ep, 16);
+ *addr_last = hextoul(arg2, &ep);
if (ep == arg2 || *ep != '\0')
return -1;
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);
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);
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);
}
*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;
*/
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) {
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];
} 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);
}
/*
* 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);
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;
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;
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;
/*
* 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;
/*
* 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);
/*
* 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);
/*
* 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);
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);
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);
/*
* 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;
* 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)
/*
* 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;
/*
* 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;
/*
* 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;
/*
* 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);
/*
/*
* 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;
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)
/*
* 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;
* 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);
/*
* 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);
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)
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);
}
return 1;
/* Address is specified since argc > 1 */
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
addr += base_address;
/*
* 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;
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);
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;
}
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;
}
/* 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");
unmap_physmem(buf, w);
return l;
} else {
- l = simple_strtoul(s, NULL, 16);
+ l = hextoul(s, NULL);
}
/* avoid overflow on mask calculus */
{
/* 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;
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];
}
#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);
}
#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 */
/* 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);
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;
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 {
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;
*nullp = '\0';
*(u8 *)(vsum + i) =
- simple_strtoul(vsum_str + (i * 2), NULL, 16);
+ hextoul(vsum_str + (i * 2), NULL);
*nullp = end;
}
}
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);
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);
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)
/* Address is specified since argc > 1
*/
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
addr += base_address;
/* If another parameter, it is the length to display.
* 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;
/* Address is specified since argc > 1
*/
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
addr += base_address;
/* Get the value to write.
if (SUPPORT_64BIT_DATA)
writeval = simple_strtoull(argv[2], NULL, 16);
else
- writeval = simple_strtoul(argv[2], NULL, 16);
+ writeval = hextoul(argv[2], NULL);
/* Count ? */
if (argc == 4) {
- count = simple_strtoul(argv[3], NULL, 16);
+ count = hextoul(argv[3], NULL);
} else {
count = 1;
}
size == 4 ? "word" :
size == 2 ? "halfword" : "byte";
- addr1 = simple_strtoul(argv[1], NULL, 16);
+ addr1 = hextoul(argv[1], NULL);
addr1 += base_address;
- addr2 = simple_strtoul(argv[2], NULL, 16);
+ addr2 = hextoul(argv[2], NULL);
addr2 += base_address;
- count = simple_strtoul(argv[3], NULL, 16);
+ count = hextoul(argv[3], NULL);
bytes = size * count;
base = buf1 = map_sysmem(addr1, bytes);
if ((size = cmd_get_data_size(argv[0], 4)) < 0)
return 1;
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
addr += base_address;
- dest = simple_strtoul(argv[2], NULL, 16);
+ dest = hextoul(argv[2], NULL);
dest += base_address;
- count = simple_strtoul(argv[3], NULL, 16);
+ count = hextoul(argv[3], NULL);
if (count == 0) {
puts ("Zero length ???\n");
if (ch == 'q')
quiet = true;
else if (ch == 'l' && isxdigit(argv[0][2]))
- limit = simple_strtoul(argv[0] + 2, NULL, 16);
+ limit = hextoul(argv[0] + 2, NULL);
else
return CMD_RET_USAGE;
argc--;
}
/* Address is specified since argc > 1 */
- addr = simple_strtoul(argv[0], NULL, 16);
+ addr = hextoul(argv[0], NULL);
addr += base_address;
/* Length is the number of objects, not number of bytes */
- length = simple_strtoul(argv[1], NULL, 16);
+ length = hextoul(argv[1], NULL);
/* Read the bytes to search for */
end = search_buf + sizeof(search_buf);
ptr += len;
continue;
} else {
- u32 val = simple_strtoul(argv[i], NULL, 16);
+ u32 val = hextoul(argv[i], NULL);
switch (size) {
case 1:
if (argc > 1) {
/* Set new base address.
*/
- base_address = simple_strtoul(argv[1], NULL, 16);
+ base_address = hextoul(argv[1], NULL);
}
/* Print the current base address.
*/
/* Address is always specified.
*/
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
/* Length is the number of objects, not number of bytes.
*/
- length = simple_strtoul(argv[2], NULL, 16);
+ length = hextoul(argv[2], NULL);
bytes = size * length;
buf = map_sysmem(addr, bytes);
/* Address is always specified.
*/
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
/* Length is the number of objects, not number of bytes.
*/
- length = simple_strtoul(argv[2], NULL, 16);
+ length = hextoul(argv[2], NULL);
/* data to write */
if (SUPPORT_64BIT_DATA)
data = simple_strtoull(argv[3], NULL, 16);
else
- data = simple_strtoul(argv[3], NULL, 16);
+ data = hextoul(argv[3], NULL);
bytes = size * length;
buf = map_sysmem(addr, bytes);
/* Address is specified since argc > 1
*/
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
addr += base_address;
}
if (SUPPORT_64BIT_DATA)
i = simple_strtoull(console_buffer, &endp, 16);
else
- i = simple_strtoul(console_buffer, &endp, 16);
+ i = hextoul(console_buffer, &endp);
nbytes = endp - console_buffer;
if (nbytes) {
/* good enough to not time out
if (argc < 3 || argc > 4)
return CMD_RET_USAGE;
- len = simple_strtoul(argv[2], NULL, 16);
- addr = simple_strtoul(argv[1], NULL, 16);
+ len = hextoul(argv[2], NULL);
+ addr = hextoul(argv[1], NULL);
if (argc == 4) {
- seed = simple_strtoul(argv[3], NULL, 16);
+ seed = hextoul(argv[3], NULL);
if (seed == 0) {
printf("The seed cannot be 0. Using 0xDEADBEEF.\n");
seed = 0xDEADBEEF;
if (argc < 2)
return CMD_RET_USAGE;
- fslnum = (unsigned int)simple_strtoul (argv[1], NULL, 16);
- blocking = (unsigned int)simple_strtoul (argv[2], NULL, 16);
+ fslnum = (unsigned int)hextoul(argv[1], NULL);
+ blocking = (unsigned int)hextoul(argv[2], NULL);
if (fslnum < 0 || fslnum >= XILINX_FSL_NUMBER) {
puts ("Bad number of FSL\n");
return CMD_RET_USAGE;
if (argc < 3)
return CMD_RET_USAGE;
- fslnum = (unsigned int)simple_strtoul (argv[1], NULL, 16);
- num = (unsigned int)simple_strtoul (argv[2], NULL, 16);
- blocking = (unsigned int)simple_strtoul (argv[3], NULL, 16);
+ fslnum = (unsigned int)hextoul(argv[1], NULL);
+ num = (unsigned int)hextoul(argv[2], NULL);
+ blocking = (unsigned int)hextoul(argv[3], NULL);
if (fslnum < 0 || fslnum >= XILINX_FSL_NUMBER)
return CMD_RET_USAGE;
if (argc < 2)
return CMD_RET_USAGE;
- reg = (unsigned int)simple_strtoul (argv[1], NULL, 16);
- val = (unsigned int)simple_strtoul (argv[2], NULL, 16);
+ reg = (unsigned int)hextoul(argv[1], NULL);
+ val = (unsigned int)hextoul(argv[2], NULL);
switch (reg) {
case 0x1:
if (argc > 2) {
unsigned char * phi)
{
char * end;
- *plo = simple_strtoul(input, &end, 16);
+ *plo = hextoul(input, &end);
if (*end == '-') {
end++;
- *phi = simple_strtoul(end, NULL, 16);
+ *phi = hextoul(end, NULL);
}
else {
*phi = *plo;
if (argc >= 4)
extract_range(argv[3], ®lo, ®hi);
if (argc >= 5)
- data = simple_strtoul(argv[4], NULL, 16);
+ data = hextoul(argv[4], NULL);
if (argc >= 6)
- mask = simple_strtoul(argv[5], NULL, 16);
+ mask = hextoul(argv[5], NULL);
}
if (addrhi > 31 && strncmp(op, "de", 2)) {
return ret;
}
- offset = simple_strtoul(argv[1], NULL, 16);
- buf = (void *)simple_strtoul(argv[2], NULL, 16);
- size = simple_strtoul(argv[3], NULL, 16);
+ offset = hextoul(argv[1], NULL);
+ buf = (void *)hextoul(argv[2], NULL);
+ size = hextoul(argv[3], NULL);
if (op == MISC_OP_READ)
misc_op = misc_read;
if (argc != 2)
return CMD_RET_USAGE;
- key_addr = (void *)simple_strtoul(argv[1], NULL, 16);
+ key_addr = (void *)hextoul(argv[1], NULL);
if (!confirm_key_prog())
return CMD_RET_FAILURE;
if (mmc_rpmb_set_key(mmc, key_addr)) {
if (argc < 4)
return CMD_RET_USAGE;
- addr = (void *)simple_strtoul(argv[1], NULL, 16);
- blk = simple_strtoul(argv[2], NULL, 16);
- cnt = simple_strtoul(argv[3], NULL, 16);
+ addr = (void *)hextoul(argv[1], NULL);
+ blk = hextoul(argv[2], NULL);
+ cnt = hextoul(argv[3], NULL);
if (argc == 5)
- key_addr = (void *)simple_strtoul(argv[4], NULL, 16);
+ key_addr = (void *)hextoul(argv[4], NULL);
printf("\nMMC RPMB read: dev # %d, block # %d, count %d ... ",
curr_device, blk, cnt);
if (argc != 5)
return CMD_RET_USAGE;
- addr = (void *)simple_strtoul(argv[1], NULL, 16);
- blk = simple_strtoul(argv[2], NULL, 16);
- cnt = simple_strtoul(argv[3], NULL, 16);
- key_addr = (void *)simple_strtoul(argv[4], NULL, 16);
+ addr = (void *)hextoul(argv[1], NULL);
+ blk = hextoul(argv[2], NULL);
+ cnt = hextoul(argv[3], NULL);
+ key_addr = (void *)hextoul(argv[4], NULL);
printf("\nMMC RPMB write: dev # %d, block # %d, count %d ... ",
curr_device, blk, cnt);
if (argc != 4)
return CMD_RET_USAGE;
- addr = (void *)simple_strtoul(argv[1], NULL, 16);
- blk = simple_strtoul(argv[2], NULL, 16);
- cnt = simple_strtoul(argv[3], NULL, 16);
+ addr = (void *)hextoul(argv[1], NULL);
+ blk = hextoul(argv[2], NULL);
+ cnt = hextoul(argv[3], NULL);
mmc = init_mmc_device(curr_device, false);
if (!mmc)
if (argc != 3)
return CMD_RET_USAGE;
- addr = (void *)simple_strtoul(argv[1], NULL, 16);
- blk = simple_strtoul(argv[2], NULL, 16);
+ addr = (void *)hextoul(argv[1], NULL);
+ blk = hextoul(argv[2], NULL);
if (!is_sparse_image(addr)) {
printf("Not a sparse image\n");
if (argc != 4)
return CMD_RET_USAGE;
- addr = (void *)simple_strtoul(argv[1], NULL, 16);
- blk = simple_strtoul(argv[2], NULL, 16);
- cnt = simple_strtoul(argv[3], NULL, 16);
+ addr = (void *)hextoul(argv[1], NULL);
+ blk = hextoul(argv[2], NULL);
+ cnt = hextoul(argv[3], NULL);
mmc = init_mmc_device(curr_device, false);
if (!mmc)
if (argc != 3)
return CMD_RET_USAGE;
- blk = simple_strtoul(argv[1], NULL, 16);
- cnt = simple_strtoul(argv[2], NULL, 16);
+ blk = hextoul(argv[1], NULL);
+ cnt = hextoul(argv[2], NULL);
mmc = init_mmc_device(curr_device, false);
if (!mmc)
if (argc != 2)
return CMD_RET_USAGE;
- val = simple_strtoul(argv[1], NULL, 16);
+ val = hextoul(argv[1], NULL);
mmc = find_mmc_device(curr_device);
if (!mmc) {
goto out_put_mtd;
}
- user_addr = simple_strtoul(argv[0], NULL, 16);
+ user_addr = hextoul(argv[0], NULL);
argc--;
argv++;
}
- start_off = argc > 0 ? simple_strtoul(argv[0], NULL, 16) : 0;
+ start_off = argc > 0 ? hextoul(argv[0], NULL) : 0;
if (!mtd_is_aligned_with_min_io_size(mtd, start_off)) {
printf("Offset not aligned with a page (0x%x)\n",
mtd->writesize);
}
default_len = dump ? mtd->writesize : mtd->size;
- len = argc > 1 ? simple_strtoul(argv[1], NULL, 16) : default_len;
+ len = argc > 1 ? hextoul(argv[1], NULL) : default_len;
if (!mtd_is_aligned_with_min_io_size(mtd, len)) {
len = round_up(len, mtd->writesize);
printf("Size not on a page boundary (0x%x), rounding to 0x%llx\n",
argc -= 2;
argv += 2;
- off = argc > 0 ? simple_strtoul(argv[0], NULL, 16) : 0;
- len = argc > 1 ? simple_strtoul(argv[1], NULL, 16) : mtd->size;
+ off = argc > 0 ? hextoul(argv[0], NULL) : 0;
+ len = argc > 1 ? hextoul(argv[1], NULL) : mtd->size;
if (!mtd_is_aligned_with_block_size(mtd, off)) {
printf("Offset not aligned with a block (0x%x)\n",
addr_str = env_get("loadaddr");
if (addr_str)
- addr = simple_strtoul(addr_str, NULL, 16);
+ addr = hextoul(addr_str, NULL);
else
addr = CONFIG_SYS_LOAD_ADDR;
return -1;
}
- cp_index = simple_strtoul(argv[1], NULL, 16);
- comphy_index = simple_strtoul(argv[2], NULL, 16);
+ cp_index = hextoul(argv[1], NULL);
+ comphy_index = hextoul(argv[2], NULL);
ret = uclass_get(UCLASS_MISC, &uc);
if (ret) {
if (argc < 3)
goto usage;
- off = (int)simple_strtoul(argv[2], NULL, 16);
+ off = (int)hextoul(argv[2], NULL);
ret = nand_dump(mtd, off, !strcmp(&cmd[4], ".oob"), repeat);
return ret == 0 ? 1 : 0;
if (argc < 4)
goto usage;
- addr = (ulong)simple_strtoul(argv[2], NULL, 16);
+ addr = (ulong)hextoul(argv[2], NULL);
read = strncmp(cmd, "read", 4) == 0; /* 1 = read, 0 = write */
printf("\nNAND %s: ", read ? "read" : "write");
goto usage;
while (argc > 0) {
- addr = simple_strtoul(*argv, NULL, 16);
+ addr = hextoul(*argv, NULL);
if (mtd_block_markbad(mtd, addr)) {
printf("block 0x%08lx NOT marked "
if (argc > 3)
goto usage;
if (argc == 3)
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
else
addr = CONFIG_SYS_LOAD_ADDR;
boot_device = env_get("bootdevice");
break;
case 2:
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
boot_device = env_get("bootdevice");
break;
case 3:
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
boot_device = argv[2];
break;
case 4:
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
boot_device = argv[2];
- offset = simple_strtoul(argv[3], NULL, 16);
+ offset = hextoul(argv[3], NULL);
break;
default:
#if defined(CONFIG_CMD_MTDPARTS)
}
bootstage_mark(BOOTSTAGE_ID_NAND_BOOT_DEVICE);
- idx = simple_strtoul(boot_device, NULL, 16);
+ idx = hextoul(boot_device, NULL);
mtd = get_nand_dev_by_index(idx);
if (!mtd) {
/* pre-set image_load_addr */
s = env_get("loadaddr");
if (s != NULL)
- image_load_addr = simple_strtoul(s, NULL, 16);
+ image_load_addr = hextoul(s, NULL);
switch (argc) {
case 1:
* form must be written in a format which can not be
* mis-interpreted as a valid number.
*/
- addr = simple_strtoul(argv[1], &end, 16);
+ addr = hextoul(argv[1], &end);
if (end == (argv[1] + strlen(argv[1]))) {
image_load_addr = addr;
/* refresh bootfile name from env */
break;
case 3:
- image_load_addr = simple_strtoul(argv[1], NULL, 16);
+ image_load_addr = hextoul(argv[1], NULL);
net_boot_file_name_explicit = true;
copy_filename(net_boot_file_name, argv[2],
sizeof(net_boot_file_name));
s = env_get(varname);
if (s)
- value = simple_strtoul(s, &endp, 16);
+ value = hextoul(s, &endp);
if (!s || endp == s)
return default_val;
case 's': /* size given */
if (--argc <= 0)
return cmd_usage(cmdtp);
- size = simple_strtoul(*++argv, NULL, 16);
+ size = hextoul(*++argv, NULL);
goto NXTARG;
case 't': /* text format */
if (fmt++)
if (argc < 1)
return CMD_RET_USAGE;
- addr = simple_strtoul(argv[0], NULL, 16);
+ addr = hextoul(argv[0], NULL);
ptr = map_sysmem(addr, size);
if (size)
if (sep != '\n' && crlf_is_lf )
crlf_is_lf = 0;
- addr = simple_strtoul(argv[0], NULL, 16);
+ addr = hextoul(argv[0], NULL);
ptr = map_sysmem(addr, 0);
if (argc >= 2 && strcmp(argv[1], "-")) {
- size = simple_strtoul(argv[1], NULL, 16);
+ size = hextoul(argv[1], NULL);
} else if (chk) {
puts("## Error: external checksum format must pass size\n");
return CMD_RET_FAILURE;
argc--;
argv++;
- addr = simple_strtoul(argv[0], &ep, 16);
+ addr = hextoul(argv[0], &ep);
if (*ep != ':')
return CMD_RET_USAGE;
/* 0 should be allowed for delete */
- size = simple_strtoul(++ep, NULL, 16);
+ size = hextoul(++ep, NULL);
value_on_memory = true;
} else if (!strcmp(argv[0], "-v")) {
if ((s != NULL) && (!strcmp(s, ".oob")))
oob = 1;
- addr = (ulong)simple_strtoul(argv[1], NULL, 16);
+ addr = (ulong)hextoul(argv[1], NULL);
printf("\nOneNAND read: ");
if (arg_off_size_onenand(argc - 2, argv + 2, &ofs, &len) != 0)
if (strncmp(argv[0] + 6, "yaffs", 5) == 0)
withoob = 1;
- addr = (ulong)simple_strtoul(argv[1], NULL, 16);
+ addr = (ulong)hextoul(argv[1], NULL);
printf("\nOneNAND write: ");
if (arg_off_size_onenand(argc - 2, argv + 2, &ofs, &len) != 0)
return CMD_RET_USAGE;
s = strchr(argv[0], '.');
- ofs = (int)simple_strtoul(argv[1], NULL, 16);
+ ofs = (int)hextoul(argv[1], NULL);
if (s != NULL && strcmp(s, ".oob") == 0)
ret = onenand_dump(mtd, ofs, 1);
return CMD_RET_USAGE;
while (argc > 0) {
- addr = simple_strtoul(*argv, NULL, 16);
+ addr = hextoul(*argv, NULL);
if (mtd_block_markbad(mtd, addr)) {
printf("block 0x%08lx NOT marked "
return CMD_RET_FAILURE;
}
- 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;
return CMD_RET_FAILURE;
}
- 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];
res = video_osd_print(osd_cur, x, y, color, text);
return CMD_RET_FAILURE;
}
- x = simple_strtoul(argv[1], NULL, 16);
- y = simple_strtoul(argv[2], NULL, 16);
+ x = hextoul(argv[1], NULL);
+ y = hextoul(argv[2], NULL);
res = video_osd_set_size(osd_cur, x, y);
if (res) {
if (argc != 3)
return CMD_RET_USAGE;
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
size = simple_strtoul(argv[2], NULL, 10);
return pcap_init(addr, size) ? CMD_RET_FAILURE : CMD_RET_SUCCESS;
if (name[i] == '.') {
memcpy(cnum, &name[iold], i - iold);
cnum[i - iold] = '\0';
- bdfs[n++] = simple_strtoul(cnum, NULL, 16);
+ bdfs[n++] = hextoul(cnum, NULL);
iold = i + 1;
}
}
strcpy(cnum, &name[iold]);
if (n == 0)
n = 1;
- bdfs[n] = simple_strtoul(cnum, NULL, 16);
+ bdfs[n] = hextoul(cnum, NULL);
return PCI_BDF(bdfs[0], bdfs[1], bdfs[2]);
}
#endif
else {
char *endp;
- i = simple_strtoul(console_buffer, &endp, 16);
+ i = hextoul(console_buffer, &endp);
nbytes = endp - console_buffer;
if (nbytes) {
/* good enough to not time out
cmd_size = cmd_get_data_size(argv[1], 4);
size = (cmd_size == 4) ? PCI_SIZE_32 : cmd_size - 1;
if (argc > 3)
- addr = simple_strtoul(argv[3], NULL, 16);
+ addr = hextoul(argv[3], NULL);
if (argc > 4)
- value = simple_strtoul(argv[4], NULL, 16);
+ value = hextoul(argv[4], NULL);
case 'h': /* header */
#ifdef CONFIG_DM_PCI
case 'b': /* bars */
argc--;
}
if (argc > 1)
- busnum = simple_strtoul(argv[1], NULL, 16);
+ busnum = hextoul(argv[1], NULL);
}
#ifdef CONFIG_DM_PCI
ret = uclass_get_device_by_seq(UCLASS_PCI, busnum, &bus);
/* Address is specified since argc > 2
*/
- pstore_addr = simple_strtoul(argv[1], NULL, 16);
+ pstore_addr = hextoul(argv[1], NULL);
/* Length is specified since argc > 2
*/
- pstore_length = simple_strtoul(argv[2], NULL, 16);
+ pstore_length = hextoul(argv[2], NULL);
if (argc > 3)
- pstore_record_size = simple_strtoul(argv[3], NULL, 16);
+ pstore_record_size = hextoul(argv[3], NULL);
if (argc > 4)
- pstore_console_size = simple_strtoul(argv[4], NULL, 16);
+ pstore_console_size = hextoul(argv[4], NULL);
if (argc > 5)
- pstore_ftrace_size = simple_strtoul(argv[5], NULL, 16);
+ pstore_ftrace_size = hextoul(argv[5], NULL);
if (argc > 6)
- pstore_pmsg_size = simple_strtoul(argv[6], NULL, 16);
+ pstore_pmsg_size = hextoul(argv[6], NULL);
if (argc > 7)
- pstore_ecc_size = simple_strtoul(argv[7], NULL, 16);
+ pstore_ecc_size = hextoul(argv[7], NULL);
if (pstore_length < (pstore_record_size + pstore_console_size
+ pstore_ftrace_size + pstore_pmsg_size)) {
int err;
/* Get the main fdt and map it */
- fdt_addr = simple_strtoul(env_get("fdt_addr_r"), NULL, 16);
+ fdt_addr = hextoul(env_get("fdt_addr_r"), NULL);
working_fdt = map_sysmem(fdt_addr, 0);
err = fdt_check_header(working_fdt);
if (err)
return;
}
- fdtoverlay_addr = simple_strtoul(fdtoverlay_addr_env, NULL, 16);
+ fdtoverlay_addr = hextoul(fdtoverlay_addr_env, NULL);
/* Cycle over the overlay files and apply them in order */
do {
env = env_get("loadaddr");
load_addr = env ?
- (void *)simple_strtoul(env, NULL, 16) :
+ (void *)hextoul(env, NULL) :
#ifdef CONFIG_LOADADDR
(void *)CONFIG_LOADADDR;
#else
env = env_get("ramdiskaddr");
initrd_addr = env ?
- (void *)simple_strtoul(env, NULL, 16) :
+ (void *)hextoul(env, NULL) :
#ifdef CONFIG_RAMDISK_ADDR
(void *)CONFIG_RAMDISK_ADDR;
#else
#endif
if (argc == 2) {
- load_addr = (void *)simple_strtoul(argv[0], NULL, 16);
- initrd_addr = (void *)simple_strtoul(argv[1], NULL, 16);
+ load_addr = (void *)hextoul(argv[0], NULL);
+ initrd_addr = (void *)hextoul(argv[1], NULL);
} else if (argc == 1) {
- load_addr = (void *)simple_strtoul(argv[0], NULL, 16);
+ load_addr = (void *)hextoul(argv[0], NULL);
}
if (!load_addr || !initrd_addr) {
return 1;
}
- dev = (int)simple_strtoul(argv[2], &ep, 16);
+ dev = (int)hextoul(argv[2], &ep);
if (*ep) {
if (*ep != ':') {
printf("Invalid block device %s\n", argv[2]);
return 1;
}
- part = (int)simple_strtoul(++ep, NULL, 16);
+ part = (int)hextoul(++ep, NULL);
}
dev_desc = blk_get_dev(argv[1], dev);
return 1;
}
- addr = (void *)simple_strtoul(argv[3], NULL, 16);
- blk = simple_strtoul(argv[4], NULL, 16);
- cnt = simple_strtoul(argv[5], NULL, 16);
+ addr = (void *)hextoul(argv[3], NULL);
+ blk = hextoul(argv[4], NULL);
+ cnt = hextoul(argv[5], NULL);
if (part != 0) {
if (part_get_info(dev_desc, part, &part_info)) {
case 3:
addr_str = env_get("loadaddr");
if (addr_str != NULL) {
- addr = simple_strtoul (addr_str, NULL, 16);
+ addr = hextoul(addr_str, NULL);
} else {
addr = CONFIG_SYS_LOAD_ADDR;
}
count = 0;
break;
case 4:
- addr = simple_strtoul (argv[3], NULL, 16);
+ addr = hextoul(argv[3], NULL);
filename = env_get("bootfile");
count = 0;
break;
case 5:
- addr = simple_strtoul (argv[3], NULL, 16);
+ addr = hextoul(argv[3], NULL);
filename = argv[4];
count = 0;
break;
case 6:
- addr = simple_strtoul (argv[3], NULL, 16);
+ addr = hextoul(argv[3], NULL);
filename = argv[4];
- count = simple_strtoul (argv[5], NULL, 16);
+ count = hextoul(argv[5], NULL);
break;
default:
return CMD_RET_USAGE;
id = (int)simple_strtoul(argv[1], NULL, 10);
- addr = simple_strtoul(argv[2], NULL, 16);
+ addr = hextoul(argv[2], NULL);
- size = simple_strtoul(argv[3], NULL, 16);
+ size = hextoul(argv[3], NULL);
if (!size) {
printf("\t Expect some size??\n");
}
if (argc >= 2)
- n = simple_strtoul(argv[1], NULL, 16);
+ n = hextoul(argv[1], NULL);
buf = malloc(n);
if (!buf) {
if (argc < 2 || argc > 3)
return CMD_RET_USAGE;
- reg = simple_strtoul(argv[0], NULL, 16);
- len = simple_strtoul(argv[1], NULL, 16);
+ reg = hextoul(argv[0], NULL);
+ len = hextoul(argv[1], NULL);
if (argc == 3) {
u8 *addr;
- addr = map_sysmem(simple_strtoul(argv[2], NULL, 16), len);
+ addr = map_sysmem(hextoul(argv[2], NULL), len);
ret = dm_rtc_read(dev, reg, addr, len);
unmap_sysmem(addr);
if (ret) {
if (argc < 2 || argc > 3)
return CMD_RET_USAGE;
- reg = simple_strtoul(argv[0], NULL, 16);
+ reg = hextoul(argv[0], NULL);
if (argc == 3) {
u8 *addr;
- len = simple_strtoul(argv[1], NULL, 16);
- addr = map_sysmem(simple_strtoul(argv[2], NULL, 16), len);
+ len = hextoul(argv[1], NULL);
+ addr = map_sysmem(hextoul(argv[2], NULL), len);
ret = dm_rtc_write(dev, reg, addr, len);
unmap_sysmem(addr);
if (ret) {
int len;
char *str;
- addr = simple_strtoul(&s[1], NULL, 16);
+ addr = hextoul(&s[1], NULL);
switch (w) {
case 1:
p = map_sysmem(addr, sizeof(uchar));
} else {
if (w == CMD_DATA_SIZE_STR)
return -EINVAL;
- arg.ival = simple_strtoul(s, NULL, 16);
+ arg.ival = hextoul(s, NULL);
}
*argp = arg;
++arg;
}
- len_arg = simple_strtoul(arg, &ep, 16);
+ len_arg = hextoul(arg, &ep);
if (ep == arg || *ep != '\0')
return -1;
return -1;
}
if (argc >= 4) {
- mode = simple_strtoul(argv[3], &endp, 16);
+ mode = hextoul(argv[3], &endp);
if (*argv[3] == 0 || *endp != 0)
return -1;
}
if (argc < 3)
return -1;
- addr = simple_strtoul(argv[1], &endp, 16);
+ addr = hextoul(argv[1], &endp);
if (*argv[1] == 0 || *endp != 0)
return -1;
if (argc < 3)
return -1;
- offset = simple_strtoul(argv[1], &endp, 16);
+ offset = hextoul(argv[1], &endp);
if (*argv[1] == 0 || *endp != 0)
return -1;
- len = simple_strtoul(argv[2], &endp, 16);
+ len = hextoul(argv[2], &endp);
if (*argv[2] == 0 || *endp != 0)
return -1;
if (argc < 2)
return CMD_RET_USAGE;
- fid = simple_strtoul(argv[1], NULL, 16);
+ fid = hextoul(argv[1], NULL);
- a1 = argc > 2 ? simple_strtoul(argv[2], NULL, 16) : 0;
- a2 = argc > 3 ? simple_strtoul(argv[3], NULL, 16) : 0;
- a3 = argc > 4 ? simple_strtoul(argv[4], NULL, 16) : 0;
- a4 = argc > 5 ? simple_strtoul(argv[5], NULL, 16) : 0;
- a5 = argc > 6 ? simple_strtoul(argv[6], NULL, 16) : 0;
- a6 = argc > 7 ? simple_strtoul(argv[7], NULL, 16) : 0;
- a7 = argc > 8 ? simple_strtoul(argv[8], NULL, 16) : 0;
+ a1 = argc > 2 ? hextoul(argv[2], NULL) : 0;
+ a2 = argc > 3 ? hextoul(argv[3], NULL) : 0;
+ a3 = argc > 4 ? hextoul(argv[4], NULL) : 0;
+ a4 = argc > 5 ? hextoul(argv[5], NULL) : 0;
+ a5 = argc > 6 ? hextoul(argv[6], NULL) : 0;
+ a6 = argc > 7 ? hextoul(argv[7], NULL) : 0;
+ a7 = argc > 8 ? hextoul(argv[8], NULL) : 0;
if (!strcmp(argv[0], "smc"))
arm_smccc_smc(fid, a1, a2, a3, a4, a5, a6, a7, &res);
fit_uname, addr);
#endif
} else {
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
debug("* source: cmdline image address = 0x%08lx\n", addr);
}
return CMD_RET_USAGE;
if ((flag & CMD_FLAG_REPEAT) == 0) {
- start_addr = (char *)simple_strtoul(argv[1], NULL, 16);
+ start_addr = (char *)hextoul(argv[1], NULL);
if (argc > 2)
- last_addr = (char *)simple_strtoul(argv[2], NULL, 16);
+ last_addr = (char *)hextoul(argv[2], NULL);
else
last_addr = (char *)-1;
}
return CMD_RET_FAILURE;
}
- start_addr = simple_strtoul(argv[2], NULL, 16);
- ecc_err = simple_strtoul(argv[3], NULL, 16);
+ start_addr = hextoul(argv[2], NULL);
+ ecc_err = hextoul(argv[3], NULL);
if (!is_addr_valid(start_addr)) {
puts("Invalid address. Please enter ECC supported address!\n");
((argc == 5) && (strncmp(argv[1], "compare", 8) == 0))))
return cmd_usage(cmdtp);
- start_addr = simple_strtoul(argv[2], NULL, 16);
- end_addr = simple_strtoul(argv[3], NULL, 16);
+ start_addr = hextoul(argv[2], NULL);
+ end_addr = hextoul(argv[3], NULL);
if ((start_addr < CONFIG_SYS_SDRAM_BASE) ||
(start_addr > (CONFIG_SYS_SDRAM_BASE +
puts("Please wait ...\n");
if (argc == 5) {
- size = simple_strtoul(argv[4], NULL, 16);
+ size = hextoul(argv[4], NULL);
ddr_memory_compare(start_addr, end_addr, size);
} else {
ddr_memory_test(start_addr, end_addr, 0);
/* Convert string to binary */
for (i = 0, p = (char *)string; i < 6; i++) {
- buf[i] = p ? simple_strtoul(p, &end, 16) : 0;
+ buf[i] = p ? hextoul(p, &end) : 0;
if (p)
p = (*end) ? end + 1 : end;
}
for (i = 0; i < length; i += 2) {
byte[0] = bytes[i];
byte[1] = bytes[i + 1];
- data[i / 2] = (u8)simple_strtoul(byte, NULL, 16);
+ data[i / 2] = (u8)hextoul(byte, NULL);
}
if (count_ptr)
*buff_size);
*buff_ptr = env_get_ulong("profoffset", 16, 0);
} else {
- *buff_size = simple_strtoul(argv[3], NULL, 16);
- *buff = map_sysmem(simple_strtoul(argv[2], NULL, 16),
+ *buff_size = hextoul(argv[3], NULL);
+ *buff = map_sysmem(hextoul(argv[2], NULL),
*buff_size);
*buff_ptr = 0;
};
if (argc > 1)
cmd = argv[1][0];
if (argc > 2)
- addr1 = simple_strtoul(argv[2], NULL, 16);
+ addr1 = hextoul(argv[2], NULL);
if (argc > 3)
- addr2 = simple_strtoul(argv[3], NULL, 16);
+ addr2 = hextoul(argv[3], NULL);
if (argc > 4)
- size = simple_strtoul(argv[4], NULL, 16);
+ size = hextoul(argv[4], NULL);
if (argc > 5)
- vam = simple_strtoul(argv[5], NULL, 16);
+ vam = hextoul(argv[5], NULL);
if (argc > 6)
- vdw = simple_strtoul(argv[6], NULL, 16);
+ vdw = hextoul(argv[6], NULL);
switch (cmd) {
case 'c':
return 1;
}
- addr = simple_strtoul(argv[2], NULL, 16);
- size = simple_strtoul(argv[4], NULL, 16);
+ addr = hextoul(argv[2], NULL);
+ size = hextoul(argv[4], NULL);
if (strlen(argv[1]) == 10 &&
strncmp(argv[1] + 5, ".part", 5) == 0) {
(void *)addr, size);
} else {
size_t full_size;
- full_size = simple_strtoul(argv[5], NULL, 16);
+ full_size = hextoul(argv[5], NULL);
ret = ubi_volume_begin_write(argv[3],
(void *)addr, size, full_size);
}
/* E.g., read volume size */
if (argc == 5) {
- size = simple_strtoul(argv[4], NULL, 16);
+ size = hextoul(argv[4], NULL);
argc--;
}
/* E.g., read volume */
if (argc == 4) {
- addr = simple_strtoul(argv[2], NULL, 16);
+ addr = hextoul(argv[2], NULL);
argc--;
}
if (argc < 3)
return CMD_RET_USAGE;
- addr = simple_strtoul(argv[1], &endp, 16);
+ addr = hextoul(argv[1], &endp);
if (endp == argv[1])
return CMD_RET_USAGE;
filename = argv[2];
if (argc == 4) {
- size = simple_strtoul(argv[3], &endp, 16);
+ size = hextoul(argv[3], &endp);
if (endp == argv[3])
return CMD_RET_USAGE;
}
if (argc > 1)
cmd = argv[1][0];
if (argc > 2)
- addr1 = simple_strtoul(argv[2], NULL, 16);
+ addr1 = hextoul(argv[2], NULL);
if (argc > 3)
- addr2 = simple_strtoul(argv[3], NULL, 16);
+ addr2 = hextoul(argv[3], NULL);
if (argc > 4)
- size = simple_strtoul(argv[4], NULL, 16);
+ size = hextoul(argv[4], NULL);
if (argc > 5)
- vam = simple_strtoul(argv[5], NULL, 16);
+ vam = hextoul(argv[5], NULL);
if (argc > 6)
- pms = simple_strtoul(argv[6], NULL, 16);
+ pms = hextoul(argv[6], NULL);
if (argc > 7)
- vdw = simple_strtoul(argv[7], NULL, 16);
+ vdw = hextoul(argv[7], NULL);
switch (cmd) {
case 'i': /* init */
switch (argc) {
case 4:
- src = simple_strtoul(argv[1], NULL, 16);
- dst = simple_strtoul(argv[2], NULL, 16);
- dst_len = simple_strtoul(argv[3], NULL, 16);
+ src = hextoul(argv[1], NULL);
+ dst = hextoul(argv[2], NULL);
+ dst_len = hextoul(argv[3], NULL);
break;
default:
return CMD_RET_USAGE;
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;
if (ret < 0)
return CMD_RET_FAILURE;
- addr = (unsigned char *)simple_strtoul(argv[3], NULL, 16);
- length = simple_strtoul(argv[4], NULL, 16);
+ addr = (unsigned char *)hextoul(argv[3], NULL);
+ length = hextoul(argv[4], NULL);
if (5 < argc) {
- writebuf = simple_strtoul(argv[5], NULL, 16);
+ writebuf = hextoul(argv[5], NULL);
if (6 < argc) {
startoffs = simple_strtoull(argv[6], NULL, 16);
if (7 < argc)
printf("Invalid type name %s\n", typename);
return CMD_RET_USAGE;
}
- start = simple_strtoul(argv[1], NULL, 16);
- size = simple_strtoul(argv[2], NULL, 16);
+ start = hextoul(argv[1], NULL);
+ size = hextoul(argv[2], NULL);
base = start | type;
valid = native_read_msr(MTRR_PHYS_MASK_MSR(reg)) & MTRR_PHYS_MASK_VALID;
if (cmd != 'l') {
if (argc < 2)
return CMD_RET_USAGE;
- reg = simple_strtoul(argv[1], NULL, 16);
+ reg = hextoul(argv[1], NULL);
if (reg >= reg_count) {
printf("Invalid register number\n");
return CMD_RET_USAGE;
verify = env_get_yesno("verify");
if (argc > 1) {
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
}
if (argc > 2) {
- part = simple_strtoul(argv[2], NULL, 16);
+ part = hextoul(argv[2], NULL);
#if defined(CONFIG_FIT)
uname = argv[2];
#endif
}
if (argc > 3) {
- dest = simple_strtoul(argv[3], NULL, 16);
+ dest = hextoul(argv[3], NULL);
}
switch (genimg_get_format((void *)addr)) {
}
filename = argv[1];
- value = simple_strtoul(argv[2], NULL, 16);
- numValues = simple_strtoul(argv[3], NULL, 16);
+ value = hextoul(argv[2], NULL);
+ numValues = hextoul(argv[3], NULL);
printf("Writing value (%lx) %lx times to %s... ", value, numValues,
filename);
}
filename = argv[1];
- addr = simple_strtoul(argv[2], NULL, 16);
+ addr = hextoul(argv[2], NULL);
cmd_yaffs_mread_file(filename, (char *)addr);
}
filename = argv[1];
- addr = simple_strtoul(argv[2], NULL, 16);
- size = simple_strtoul(argv[3], NULL, 16);
+ addr = hextoul(argv[2], NULL);
+ size = hextoul(argv[3], NULL);
cmd_yaffs_mwrite_file(filename, (char *)addr, size);
return CMD_RET_USAGE;
count = 0;
- addr = simple_strtoul(argv[3], NULL, 16);
+ addr = hextoul(argv[3], NULL);
filename = env_get("bootfile");
switch (argc) {
case 3:
addr_str = env_get("loadaddr");
if (addr_str != NULL)
- addr = simple_strtoul(addr_str, NULL, 16);
+ addr = hextoul(addr_str, NULL);
else
addr = CONFIG_SYS_LOAD_ADDR;
break;
case 6:
filename = argv[4];
- count = simple_strtoul(argv[5], NULL, 16);
+ count = hextoul(argv[5], NULL);
break;
default:
switch (argc) {
case 5:
- dst_len = simple_strtoul(argv[4], NULL, 16);
+ dst_len = hextoul(argv[4], NULL);
/* fall through */
case 4:
- src = simple_strtoul(argv[1], NULL, 16);
- src_len = simple_strtoul(argv[2], NULL, 16);
- dst = simple_strtoul(argv[3], NULL, 16);
+ src = hextoul(argv[1], NULL);
+ src_len = hextoul(argv[2], NULL);
+ dst = hextoul(argv[3], NULL);
break;
default:
return cmd_usage(cmdtp);
}
if (txt[0] == '0' && (txt[1] == 'x' || txt[1] == 'X')) /* hex */
- val = simple_strtoul (&txt[2], NULL, 16);
+ val = hextoul(&txt[2], NULL);
else /* decimal */
val = simple_strtoul (txt, NULL, 10);
/* See README.plan9 */
s = env_get("confaddr");
if (s != NULL) {
- char *confaddr = (char *)simple_strtoul(s, NULL, 16);
+ char *confaddr = (char *)hextoul(s, NULL);
if (argc > 0) {
copy_args(confaddr, argc, argv, '\n');
/* find f=0xnumber flag */
if ((bootargs[pos] == '=') && (pos >= 1) &&
(bootargs[pos - 1] == 'f')) {
- vxflags = simple_strtoul(&bootargs[pos + 1],
- NULL, 16);
+ vxflags = hextoul(&bootargs[pos + 1], NULL);
if (vxflags & VXWORKS_SYSFLG_STD_DTB)
std_dtb = true;
}
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;
}
char chr[3];
strlcpy(chr, &str[i * 2], 3);
- result[i] = simple_strtoul(chr, NULL, 16);
+ result[i] = hextoul(chr, NULL);
}
return 0;
ulong addr;
void *buf;
- addr = simple_strtoul(dest, NULL, 16);
+ addr = hextoul(dest, NULL);
buf = map_sysmem(addr, algo->digest_size);
memcpy(buf, sum, algo->digest_size);
unmap_sysmem(buf);
ulong addr;
void *buf;
- addr = simple_strtoul(verify_str, NULL, 16);
+ addr = hextoul(verify_str, NULL);
buf = map_sysmem(addr, algo->digest_size);
memcpy(vsum, buf, algo->digest_size);
} else {
if ((argc < 2) || ((flags & HASH_FLAG_VERIFY) && (argc < 3)))
return CMD_RET_USAGE;
- addr = simple_strtoul(*argv++, NULL, 16);
- len = simple_strtoul(*argv++, NULL, 16);
+ addr = hextoul(*argv++, NULL);
+ len = hextoul(*argv++, NULL);
if (multi_hash()) {
struct hash_algo *algo;
addr, addr + len - 1, crc);
if (argc >= 3) {
- ptr = (ulong *)simple_strtoul(argv[0], NULL, 16);
+ ptr = (ulong *)hextoul(argv[0], NULL);
*ptr = crc;
}
}
/* If fdt_high is set use it to select the relocation address */
fdt_high = env_get("fdt_high");
if (fdt_high) {
- void *desired_addr = (void *)simple_strtoul(fdt_high, NULL, 16);
+ void *desired_addr = (void *)hextoul(fdt_high, NULL);
if (((ulong) desired_addr) == ~0UL) {
/* All ones means use fdt in place */
*of_size = 0;
img_addr = (argc == 0) ? image_load_addr :
- simple_strtoul(argv[0], NULL, 16);
+ hextoul(argv[0], NULL);
buf = map_sysmem(img_addr, 0);
if (argc > 2)
} else
#endif
{
- fdt_addr = simple_strtoul(select, NULL, 16);
+ fdt_addr = hextoul(select, NULL);
debug("* fdt: cmdline image address = 0x%08lx\n",
fdt_addr);
}
sep = strchr(spec, sepc);
if (sep) {
if (sep - spec > 0)
- *addr = simple_strtoul(spec, NULL, 16);
+ *addr = hextoul(spec, NULL);
*name = sep + 1;
return 1;
switch (op) {
case env_op_create:
case env_op_overwrite:
- image_load_addr = simple_strtoul(value, NULL, 16);
+ image_load_addr = hextoul(value, NULL);
break;
default:
break;
{
char *s = env_get("bootm_low");
if (s) {
- ulong tmp = simple_strtoul(s, NULL, 16);
+ ulong tmp = hextoul(s, NULL);
return tmp;
}
*fit_uname_kernel, kernel_addr);
#endif
} else {
- kernel_addr = simple_strtoul(img_addr, NULL, 16);
+ kernel_addr = hextoul(img_addr, NULL);
debug("* kernel: cmdline image address = 0x%08lx\n",
kernel_addr);
}
} else
#endif
{
- rd_addr = simple_strtoul(select, NULL, 16);
+ rd_addr = hextoul(select, NULL);
debug("* ramdisk: cmdline image address = "
"0x%08lx\n",
rd_addr);
if (select)
end = strchr(select, ':');
if (end) {
- rd_len = simple_strtoul(++end, NULL, 16);
+ rd_len = hextoul(++end, NULL);
rd_data = rd_addr;
} else
#endif
/* a value of "no" or a similar string will act like 0,
* turning the "load high" feature off. This is intentional.
*/
- initrd_high = simple_strtoul(s, NULL, 16);
+ initrd_high = hextoul(s, NULL);
if (initrd_high == ~0)
initrd_copy_to_ram = 0;
} else {
*caddr = 0;
while (*sym) {
- sym_addr = simple_strtoul(sym, &esym, 16);
+ sym_addr = hextoul(sym, &esym);
sym = esym;
if (sym_addr > addr)
break;
if (op == env_op_delete)
return 0;
- addr = simple_strtoul(value, NULL, 16);
+ addr = hextoul(value, NULL);
/* See README.displaying-bmps */
aligned = (addr % 4 == 2);
if (!aligned) {
if (!splashimage)
return -ENOENT;
- bmp_load_addr = simple_strtoul(splashimage, 0, 16);
+ bmp_load_addr = hextoul(splashimage, 0);
if (!bmp_load_addr) {
printf("Error: bad 'splashimage' address\n");
return -EFAULT;
if (!s)
return -EINVAL;
- addr = simple_strtoul(s, NULL, 16);
+ addr = hextoul(s, NULL);
ret = splash_screen_prepare();
if (ret)
return ret;
if (env_splashimage_value == NULL)
return -ENOENT;
- bmp_load_addr = simple_strtoul(env_splashimage_value, 0, 16);
+ bmp_load_addr = hextoul(env_splashimage_value, 0);
if (bmp_load_addr == 0) {
printf("Error: bad splashimage address specified\n");
return -EFAULT;
/* get load address of downloaded update file */
env_addr = env_get("loadaddr");
if (env_addr)
- addr = simple_strtoul(env_addr, NULL, 16);
+ addr = hextoul(env_addr, NULL);
else
addr = CONFIG_UPDATE_LOAD_ADDR;
hwpart = 0;
}
- dev = simple_strtoul(dev_str, &ep, 16);
+ dev = hextoul(dev_str, &ep);
if (*ep) {
printf("** Bad device specification %s %s **\n",
ifname, dev_str);
}
if (hwpart_str) {
- hwpart = simple_strtoul(hwpart_str, &ep, 16);
+ hwpart = hextoul(hwpart_str, &ep);
if (*ep) {
printf("** Bad HW partition specification %s %s **\n",
ifname, hwpart_str);
part = PART_AUTO;
} else {
/* Something specified -> use exactly that */
- part = (int)simple_strtoul(part_str, &ep, 16);
+ part = (int)hextoul(part_str, &ep);
/*
* Less than whole string converted,
* or request for whole device, but caller requires partition.
st = strsep(&s, " ");
if (!strcmp(st, "raw")) {
dfu->layout = DFU_RAW_ADDR;
- dfu->data.mtd.start = simple_strtoul(s, &s, 16);
+ dfu->data.mtd.start = hextoul(s, &s);
s++;
- dfu->data.mtd.size = simple_strtoul(s, &s, 16);
+ dfu->data.mtd.size = hextoul(s, &s);
} else if ((!strcmp(st, "part")) || (!strcmp(st, "partubi"))) {
char mtd_id[32];
struct mtd_device *mtd_dev;
st = strsep(&s, " ");
if (!strcmp(st, "raw")) {
dfu->layout = DFU_RAW_ADDR;
- dfu->data.nand.start = simple_strtoul(s, &s, 16);
+ dfu->data.nand.start = hextoul(s, &s);
s++;
- dfu->data.nand.size = simple_strtoul(s, &s, 16);
+ dfu->data.nand.size = hextoul(s, &s);
} else if ((!strcmp(st, "part")) || (!strcmp(st, "partubi"))) {
char mtd_id[32];
struct mtd_device *mtd_dev;
}
dfu->layout = DFU_RAM_ADDR;
- dfu->data.ram.start = simple_strtoul(argv[1], NULL, 16);
- dfu->data.ram.size = simple_strtoul(argv[2], NULL, 16);
+ dfu->data.ram.start = hextoul(argv[1], NULL);
+ dfu->data.ram.size = hextoul(argv[2], NULL);
dfu->write_medium = dfu_write_medium_ram;
dfu->get_medium_size = dfu_get_medium_size_ram;
st = strsep(&s, " ");
if (!strcmp(st, "raw")) {
dfu->layout = DFU_RAW_ADDR;
- dfu->data.sf.start = simple_strtoul(s, &s, 16);
+ dfu->data.sf.start = hextoul(s, &s);
s++;
- dfu->data.sf.size = simple_strtoul(s, &s, 16);
+ dfu->data.sf.size = hextoul(s, &s);
} else if (CONFIG_IS_ENABLED(DFU_SF_PART) &&
(!strcmp(st, "part") || !strcmp(st, "partubi"))) {
char mtd_id[32];
return;
}
fastboot_bytes_received = 0;
- fastboot_bytes_expected = simple_strtoul(cmd_parameter, &tmp, 16);
+ fastboot_bytes_expected = hextoul(cmd_parameter, &tmp);
if (fastboot_bytes_expected == 0) {
fastboot_fail("Expected nonzero image size", response);
return;
/* arg2 used as chip number or pin number */
if (argc > 2)
- ul_arg2 = simple_strtoul(argv[2], NULL, 16);
+ ul_arg2 = hextoul(argv[2], NULL);
/* arg3 used as pin or invert value */
if (argc > 3)
- ul_arg3 = simple_strtoul(argv[3], NULL, 16) & 0x1;
+ ul_arg3 = hextoul(argv[3], NULL) & 0x1;
switch ((long)c->cmd) {
case PCA953X_CMD_INFO:
/* arg2 used as chip addr and pin number */
if (argc > 2)
- ul_arg2 = simple_strtoul(argv[2], NULL, 16);
+ ul_arg2 = hextoul(argv[2], NULL);
/* arg3 used as output/pullup value */
if (argc > 3)
- ul_arg3 = simple_strtoul(argv[3], NULL, 16);
+ ul_arg3 = hextoul(argv[3], NULL);
switch ((int)c->cmd) {
case DS4510_CMD_DEVICE:
else
return cmd_usage(cmdtp);
- addr = simple_strtoul(argv[3], NULL, 16);
- off += simple_strtoul(argv[4], NULL, 16);
- cnt = simple_strtoul(argv[5], NULL, 16);
+ addr = hextoul(argv[3], NULL);
+ off += hextoul(argv[4], NULL);
+ cnt = hextoul(argv[5], NULL);
if ((off + cnt) > end) {
printf("ERROR: invalid len\n");
}
/* Parse the arguments */
- dest = (void *)simple_strtoul(argv[0], NULL, 16);
+ dest = (void *)hextoul(argv[0], NULL);
offset = simple_strtoul(argv[1], NULL, 0);
length = simple_strtoul(argv[2], NULL, 0);
}
/* Parse the arguments */
- source = (const void *)simple_strtoul(argv[0], NULL, 16);
+ source = (const void *)hextoul(argv[0], NULL);
offset = simple_strtoul(argv[1], NULL, 0);
length = simple_strtoul(argv[2], NULL, 0);
if (!p)
return;
- fmanfw = (struct qe_firmware *)simple_strtoul(p, NULL, 16);
+ fmanfw = (struct qe_firmware *)hextoul(p, NULL);
if (!fmanfw)
return;
char *dram_block_size_env_var = env_get(MC_MEM_SIZE_ENV_VAR);
if (dram_block_size_env_var) {
- dram_block_size = simple_strtoul(dram_block_size_env_var, NULL,
- 16);
+ dram_block_size = hextoul(dram_block_size_env_var, NULL);
if (dram_block_size < CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE) {
printf("fsl-mc: WARNING: Invalid value for \'"
}
id = simple_strtoul(argv[4], NULL, 0);
- addr = simple_strtoul(argv[5], NULL, 16);
+ addr = hextoul(argv[5], NULL);
size = 4;
for (i = 0; i < num; i++, addr += 4) {
}
id = simple_strtoul(argv[4], NULL, 0);
- addr = simple_strtoul(argv[5], NULL, 16);
+ addr = hextoul(argv[5], NULL);
size = 4;
for (i = 0; i < num; i++, addr += 4) {
}
id = simple_strtoul(argv[4], NULL, 0);
- val = simple_strtoul(argv[5], NULL, 16);
+ val = hextoul(argv[5], NULL);
val = cpu_to_be32(val);
- addr = simple_strtoul(argv[6], NULL, 16);
+ addr = hextoul(argv[6], NULL);
size = 4;
pe_dmem_write(id, val, addr, size);
} else {
return;
}
- offset = simple_strtoul(argv[4], NULL, 16);
+ offset = hextoul(argv[4], NULL);
for (i = 0; i < num; i++, offset += 4) {
pe_lmem_read(&val, 4, offset);
return;
}
- val = simple_strtoul(argv[4], NULL, 16);
+ val = hextoul(argv[4], NULL);
val = cpu_to_be32(val);
- offset = simple_strtoul(argv[5], NULL, 16);
+ offset = hextoul(argv[5], NULL);
pe_lmem_write(&val, 4, offset);
} else {
printf("Usage: pfe pe lmem [read | write] <parameters>\n");
return ret;
}
- page = simple_strtoul(argv[1], NULL, 16);
- offset = simple_strtoul(argv[2], NULL, 16);
+ page = hextoul(argv[1], NULL);
+ offset = hextoul(argv[2], NULL);
width = simple_strtoul(argv[3], NULL, 10);
switch (width) {
return ret;
}
- page = simple_strtoul(argv[1], NULL, 16);
- offset = simple_strtoul(argv[2], NULL, 16);
+ page = hextoul(argv[1], NULL);
+ offset = hextoul(argv[2], NULL);
width = simple_strtoul(argv[3], NULL, 10);
if (width == 48 || width == 64)
value64 = simple_strtoull(argv[4], NULL, 16);
else
- value = simple_strtoul(argv[4], NULL, 16);
+ value = hextoul(argv[4], NULL);
switch (width) {
case 8:
phyaddr = simple_strtoul(argv[1], NULL, 10);
port = simple_strtoul(argv[2], NULL, 10);
reg = simple_strtoul(argv[3], NULL, 10);
- value = simple_strtoul(argv[4], NULL, 16);
+ value = hextoul(argv[4], NULL);
ret = sw_reg_write(name, phyaddr, port, reg, value);
if (argc < 4)
return CMD_RET_USAGE;
- reg = simple_strtoul(argv[3], NULL, 16);
+ reg = hextoul(argv[3], NULL);
ret = pmic_reg_read(p, reg, &val);
if (ret)
if (argc < 5)
return CMD_RET_USAGE;
- reg = simple_strtoul(argv[3], NULL, 16);
- val = simple_strtoul(argv[4], NULL, 16);
+ reg = hextoul(argv[3], NULL);
+ val = hextoul(argv[4], NULL);
pmic_reg_write(p, reg, val);
return CMD_RET_SUCCESS;
return cmd_usage(cmdtp);
if (strcmp(argv[1], "fw") == 0) {
- addr = simple_strtoul(argv[2], NULL, 16);
+ addr = hextoul(argv[2], NULL);
if (!addr) {
printf("Invalid address\n");
*/
if (argc > 3) {
- ulong length = simple_strtoul(argv[3], NULL, 16);
+ ulong length = hextoul(argv[3], NULL);
struct qe_firmware *firmware = (void *)addr;
if (length != be32_to_cpu(firmware->header.length)) {
* the M41T60 documentation for further details.
*/
if (s) {
- unsigned long const l = simple_strtoul(s, 0, 16);
+ unsigned long const l = hextoul(s, 0);
if (l <= 0x3F) {
if ((data[RTC_CTRL] & 0x3F) != l) {
if (penv) {
/* deceide if it is a string */
if (penv[0] <= '9') {
- videomode = (int) simple_strtoul (penv, NULL, 16);
+ videomode = (int)hextoul(penv, NULL);
tmp = 1;
}
} else {
ret = splash_screen_prepare();
if (ret < 0)
return video_fb_address;
- addr = simple_strtoul(s, NULL, 16);
+ addr = hextoul(s, NULL);
if (video_display_bitmap(addr,
video_logo_xpos,
if (penv) {
/* decide if it is a string */
if (penv[0] <= '9') {
- videomode = (int) simple_strtoul(penv, NULL, 16);
+ videomode = (int)hextoul(penv, NULL);
tmp = 1;
}
} else {
}
if (argc >= 4) {
- addr = simple_strtoul(argv[3], &ep, 16);
+ addr = hextoul(argv[3], &ep);
if (ep == argv[3] || *ep != '\0')
return CMD_RET_USAGE;
} else {
addr_str = env_get("loadaddr");
if (addr_str != NULL)
- addr = simple_strtoul(addr_str, NULL, 16);
+ addr = hextoul(addr_str, NULL);
else
addr = CONFIG_SYS_LOAD_ADDR;
}
}
}
if (argc >= 6)
- bytes = simple_strtoul(argv[5], NULL, 16);
+ bytes = hextoul(argv[5], NULL);
else
bytes = 0;
if (argc >= 7)
- pos = simple_strtoul(argv[6], NULL, 16);
+ pos = hextoul(argv[6], NULL);
else
pos = 0;
if (fs_set_blk_dev(argv[1], argv[2], fstype))
return 1;
- addr = simple_strtoul(argv[3], NULL, 16);
+ addr = hextoul(argv[3], NULL);
filename = argv[4];
- bytes = simple_strtoul(argv[5], NULL, 16);
+ bytes = hextoul(argv[5], NULL);
if (argc >= 7)
- pos = simple_strtoul(argv[6], NULL, 16);
+ pos = hextoul(argv[6], NULL);
else
pos = 0;
#include <stdarg.h>
#include <linux/types.h>
+/**
+ * simple_strtoul - convert a string to an unsigned long
+ *
+ * @param cp The string to be converted
+ * @param endp Updated to point to the first character not converted
+ * @param base The number base to use
+ * @return value decoded from string (0 if invalid)
+ *
+ * Converts a string to an unsigned long. If there are invalid characters at
+ * the end these are ignored. In the worst case, if all characters are invalid,
+ * 0 is returned
+ */
ulong simple_strtoul(const char *cp, char **endp, unsigned int base);
+/**
+ * hex_strtoul - convert a string in hex to an unsigned long
+ *
+ * @param cp The string to be converted
+ * @param endp Updated to point to the first character not converted
+ * @return value decoded from string (0 if invalid)
+ *
+ * Converts a hex string to an unsigned long. If there are invalid characters at
+ * the end these are ignored. In the worst case, if all characters are invalid,
+ * 0 is returned
+ */
+unsigned long hextoul(const char *cp, char **endp);
+
/**
* strict_strtoul - convert a string to an unsigned long strictly
* @param cp The string to be converted
*
* echo will append a newline to the tail.
*
- * simple_strtoul just ignores the successive invalid characters and
- * return the converted value of prefix part of the string.
- *
* Copied this function from Linux 2.6.38 commit ID:
* 521cb40b0c44418a4fd36dc633f575813d59a43d
*
return;
for (i = 0; i < 6; ++i) {
- enetaddr[i] = addr ? simple_strtoul(addr, &end, 16) : 0;
+ enetaddr[i] = addr ? hextoul(addr, &end) : 0;
if (addr)
addr = (*end) ? end + 1 : end;
}
return s;
}
-unsigned long simple_strtoul(const char *cp, char **endp,
- unsigned int base)
+ulong simple_strtoul(const char *cp, char **endp, uint base)
{
- unsigned long result = 0;
- unsigned long value;
+ ulong result = 0;
+ ulong value;
cp = _parse_integer_fixup_radix(cp, &base);
return result;
}
+ulong hextoul(const char *cp, char **endp)
+{
+ return simple_strtoul(cp, endp, 16);
+}
+
int strict_strtoul(const char *cp, unsigned int base, unsigned long *res)
{
char *tail;
}
if (str_format == UUID_STR_FORMAT_STD) {
- tmp32 = cpu_to_be32(simple_strtoul(uuid_str, NULL, 16));
+ tmp32 = cpu_to_be32(hextoul(uuid_str, NULL));
memcpy(uuid_bin, &tmp32, 4);
- tmp16 = cpu_to_be16(simple_strtoul(uuid_str + 9, NULL, 16));
+ tmp16 = cpu_to_be16(hextoul(uuid_str + 9, NULL));
memcpy(uuid_bin + 4, &tmp16, 2);
- tmp16 = cpu_to_be16(simple_strtoul(uuid_str + 14, NULL, 16));
+ tmp16 = cpu_to_be16(hextoul(uuid_str + 14, NULL));
memcpy(uuid_bin + 6, &tmp16, 2);
} else {
- tmp32 = cpu_to_le32(simple_strtoul(uuid_str, NULL, 16));
+ tmp32 = cpu_to_le32(hextoul(uuid_str, NULL));
memcpy(uuid_bin, &tmp32, 4);
- tmp16 = cpu_to_le16(simple_strtoul(uuid_str + 9, NULL, 16));
+ tmp16 = cpu_to_le16(hextoul(uuid_str + 9, NULL));
memcpy(uuid_bin + 4, &tmp16, 2);
- tmp16 = cpu_to_le16(simple_strtoul(uuid_str + 14, NULL, 16));
+ tmp16 = cpu_to_le16(hextoul(uuid_str + 14, NULL));
memcpy(uuid_bin + 6, &tmp16, 2);
}
- tmp16 = cpu_to_be16(simple_strtoul(uuid_str + 19, NULL, 16));
+ tmp16 = cpu_to_be16(hextoul(uuid_str + 19, NULL));
memcpy(uuid_bin + 8, &tmp16, 2);
tmp64 = cpu_to_be64(simple_strtoull(uuid_str + 24, NULL, 16));
{
char *endptr;
- *num = simple_strtoul(p, &endptr, 16);
+ *num = hextoul(p, &endptr);
return *p != '\0' && *endptr == '\0';
}
}
STR_TEST(str_simple_strtoul, 0);
+static int str_hextoul(struct unit_test_state *uts)
+{
+ char *endp;
+
+ /* Just a simple test, since we know this uses simple_strtoul() */
+ ut_asserteq(0x1099ab, hextoul(str2, &endp));
+ ut_asserteq(6, endp - str2);
+
+ return 0;
+}
+STR_TEST(str_hextoul, 0);
+
int do_ut_str(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
struct unit_test *tests = UNIT_TEST_SUITE_START(str_test);