diff options
author | Simon Glass <sjg@chromium.org> | 2021-07-24 09:03:29 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-08-02 13:32:14 -0400 |
commit | 7e5f460ec457fe310156e399198a41eb0ce1e98c (patch) | |
tree | 7e89e4d15fcea2d2263c4b4af1be69905537ef42 /arch/arm/mach-imx | |
parent | 031725f8cdf33e836d19f35d3fe82c5baa5a2976 (diff) | |
download | u-boot-7e5f460ec457fe310156e399198a41eb0ce1e98c.zip u-boot-7e5f460ec457fe310156e399198a41eb0ce1e98c.tar.gz u-boot-7e5f460ec457fe310156e399198a41eb0ce1e98c.tar.bz2 |
global: Convert simple_strtoul() with hex to hextoul()
It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.
Add a proper comment to simple_strtoul() while we are here.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch/arm/mach-imx')
-rw-r--r-- | arch/arm/mach-imx/cmd_dek.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-imx/cmd_mfgprot.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-imx/cmd_nandbcb.c | 10 | ||||
-rw-r--r-- | arch/arm/mach-imx/hab.c | 6 | ||||
-rw-r--r-- | arch/arm/mach-imx/imx8/ahab.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-imx/imx8/snvs_security_sc.c | 54 | ||||
-rw-r--r-- | arch/arm/mach-imx/imx_bootaux.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-imx/mx6/mp.c | 2 |
8 files changed, 41 insertions, 41 deletions
diff --git a/arch/arm/mach-imx/cmd_dek.c b/arch/arm/mach-imx/cmd_dek.c index b10ead1..40df10d 100644 --- a/arch/arm/mach-imx/cmd_dek.c +++ b/arch/arm/mach-imx/cmd_dek.c @@ -300,8 +300,8 @@ static int do_dek_blob(struct cmd_tbl *cmdtp, int flag, int argc, if (argc != 4) return CMD_RET_USAGE; - src_addr = simple_strtoul(argv[1], NULL, 16); - dst_addr = simple_strtoul(argv[2], NULL, 16); + src_addr = hextoul(argv[1], NULL); + dst_addr = hextoul(argv[2], NULL); len = simple_strtoul(argv[3], NULL, 10); return blob_encap_dek(src_addr, dst_addr, len); diff --git a/arch/arm/mach-imx/cmd_mfgprot.c b/arch/arm/mach-imx/cmd_mfgprot.c index 1430f61..29074fc 100644 --- a/arch/arm/mach-imx/cmd_mfgprot.c +++ b/arch/arm/mach-imx/cmd_mfgprot.c @@ -71,7 +71,7 @@ static int do_mfgprot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) if (argc != 4) return CMD_RET_USAGE; - m_addr = simple_strtoul(argv[2], NULL, 16); + m_addr = hextoul(argv[2], NULL); m_size = simple_strtoul(argv[3], NULL, 10); m_ptr = map_physmem(m_addr, m_size, MAP_NOCACHE); if (!m_ptr) diff --git a/arch/arm/mach-imx/cmd_nandbcb.c b/arch/arm/mach-imx/cmd_nandbcb.c index 7157c9e..cd51344 100644 --- a/arch/arm/mach-imx/cmd_nandbcb.c +++ b/arch/arm/mach-imx/cmd_nandbcb.c @@ -1083,13 +1083,13 @@ static int do_nandbcb_bcbonly(int argc, char *const argv[]) mtd = cfg.mtd; - cfg.boot_stream1_address = simple_strtoul(argv[2], NULL, 16); - cfg.boot_stream1_size = simple_strtoul(argv[3], NULL, 16); + cfg.boot_stream1_address = hextoul(argv[2], NULL); + cfg.boot_stream1_size = hextoul(argv[3], NULL); cfg.boot_stream1_size = ALIGN(cfg.boot_stream1_size, mtd->writesize); if (argc > 5) { - cfg.boot_stream2_address = simple_strtoul(argv[4], NULL, 16); - cfg.boot_stream2_size = simple_strtoul(argv[5], NULL, 16); + cfg.boot_stream2_address = hextoul(argv[4], NULL); + cfg.boot_stream2_size = hextoul(argv[5], NULL); cfg.boot_stream2_size = ALIGN(cfg.boot_stream2_size, mtd->writesize); } @@ -1450,7 +1450,7 @@ static int do_nandbcb_init(int argc, char * const argv[]) if (nandbcb_set_boot_config(argc, argv, &cfg)) return CMD_RET_FAILURE; - addr = simple_strtoul(argv[1], &endp, 16); + addr = hextoul(argv[1], &endp); if (*argv[1] == 0 || *endp != 0) return CMD_RET_FAILURE; diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index 00bd157..cc39e6b 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -609,12 +609,12 @@ static int do_authenticate_image(struct cmd_tbl *cmdtp, int flag, int argc, if (argc < 3) return CMD_RET_USAGE; - addr = simple_strtoul(argv[1], NULL, 16); - length = simple_strtoul(argv[2], NULL, 16); + addr = hextoul(argv[1], NULL); + length = hextoul(argv[2], NULL); if (argc == 3) ivt_offset = get_image_ivt_offset(addr); else - ivt_offset = simple_strtoul(argv[3], NULL, 16); + ivt_offset = hextoul(argv[3], NULL); rcode = imx_hab_authenticate_image(addr, length, ivt_offset); if (rcode == 0) diff --git a/arch/arm/mach-imx/imx8/ahab.c b/arch/arm/mach-imx/imx8/ahab.c index 6392fe2..015267c 100644 --- a/arch/arm/mach-imx/imx8/ahab.c +++ b/arch/arm/mach-imx/imx8/ahab.c @@ -161,7 +161,7 @@ static int do_authenticate(struct cmd_tbl *cmdtp, int flag, int argc, if (argc < 2) return CMD_RET_USAGE; - addr = simple_strtoul(argv[1], NULL, 16); + addr = hextoul(argv[1], NULL); printf("Authenticate OS container at 0x%lx\n", addr); diff --git a/arch/arm/mach-imx/imx8/snvs_security_sc.c b/arch/arm/mach-imx/imx8/snvs_security_sc.c index 6f9b1c9..7c34ce6 100644 --- a/arch/arm/mach-imx/imx8/snvs_security_sc.c +++ b/arch/arm/mach-imx/imx8/snvs_security_sc.c @@ -638,24 +638,24 @@ static int do_snvs_cfg(struct cmd_tbl *cmdtp, int flag, int argc, if (argc != (NB_REGISTERS + 1)) return CMD_RET_USAGE; - conf.hp.lock = simple_strtoul(argv[++idx], NULL, 16); - conf.hp.secvio_ctl = simple_strtoul(argv[++idx], NULL, 16); - conf.lp.lock = simple_strtoul(argv[++idx], NULL, 16); - conf.lp.secvio_ctl = simple_strtoul(argv[++idx], NULL, 16); - conf.lp.tamper_filt_cfg = simple_strtoul(argv[++idx], NULL, 16); - conf.lp.tamper_det_cfg = simple_strtoul(argv[++idx], NULL, 16); - conf.lp.tamper_det_cfg2 = simple_strtoul(argv[++idx], NULL, 16); - conf.lp.tamper_filt1_cfg = simple_strtoul(argv[++idx], NULL, 16); - conf.lp.tamper_filt2_cfg = simple_strtoul(argv[++idx], NULL, 16); - conf.lp.act_tamper1_cfg = simple_strtoul(argv[++idx], NULL, 16); - conf.lp.act_tamper2_cfg = simple_strtoul(argv[++idx], NULL, 16); - conf.lp.act_tamper3_cfg = simple_strtoul(argv[++idx], NULL, 16); - conf.lp.act_tamper4_cfg = simple_strtoul(argv[++idx], NULL, 16); - conf.lp.act_tamper5_cfg = simple_strtoul(argv[++idx], NULL, 16); - conf.lp.act_tamper_ctl = simple_strtoul(argv[++idx], NULL, 16); - conf.lp.act_tamper_clk_ctl = simple_strtoul(argv[++idx], NULL, 16); - conf.lp.act_tamper_routing_ctl1 = simple_strtoul(argv[++idx], NULL, 16); - conf.lp.act_tamper_routing_ctl2 = simple_strtoul(argv[++idx], NULL, 16); + conf.hp.lock = hextoul(argv[++idx], NULL); + conf.hp.secvio_ctl = hextoul(argv[++idx], NULL); + conf.lp.lock = hextoul(argv[++idx], NULL); + conf.lp.secvio_ctl = hextoul(argv[++idx], NULL); + conf.lp.tamper_filt_cfg = hextoul(argv[++idx], NULL); + conf.lp.tamper_det_cfg = hextoul(argv[++idx], NULL); + conf.lp.tamper_det_cfg2 = hextoul(argv[++idx], NULL); + conf.lp.tamper_filt1_cfg = hextoul(argv[++idx], NULL); + conf.lp.tamper_filt2_cfg = hextoul(argv[++idx], NULL); + conf.lp.act_tamper1_cfg = hextoul(argv[++idx], NULL); + conf.lp.act_tamper2_cfg = hextoul(argv[++idx], NULL); + conf.lp.act_tamper3_cfg = hextoul(argv[++idx], NULL); + conf.lp.act_tamper4_cfg = hextoul(argv[++idx], NULL); + conf.lp.act_tamper5_cfg = hextoul(argv[++idx], NULL); + conf.lp.act_tamper_ctl = hextoul(argv[++idx], NULL); + conf.lp.act_tamper_clk_ctl = hextoul(argv[++idx], NULL); + conf.lp.act_tamper_routing_ctl1 = hextoul(argv[++idx], NULL); + conf.lp.act_tamper_routing_ctl2 = hextoul(argv[++idx], NULL); err = apply_snvs_config(&conf); @@ -690,12 +690,12 @@ static int do_snvs_dgo_cfg(struct cmd_tbl *cmdtp, int flag, int argc, if (argc != (6 + 1)) return CMD_RET_USAGE; - conf.tamper_offset_ctl = simple_strtoul(argv[++idx], NULL, 16); - conf.tamper_pull_ctl = simple_strtoul(argv[++idx], NULL, 16); - conf.tamper_ana_test_ctl = simple_strtoul(argv[++idx], NULL, 16); - conf.tamper_sensor_trim_ctl = simple_strtoul(argv[++idx], NULL, 16); - conf.tamper_misc_ctl = simple_strtoul(argv[++idx], NULL, 16); - conf.tamper_core_volt_mon_ctl = simple_strtoul(argv[++idx], NULL, 16); + conf.tamper_offset_ctl = hextoul(argv[++idx], NULL); + conf.tamper_pull_ctl = hextoul(argv[++idx], NULL); + conf.tamper_ana_test_ctl = hextoul(argv[++idx], NULL); + conf.tamper_sensor_trim_ctl = hextoul(argv[++idx], NULL); + conf.tamper_misc_ctl = hextoul(argv[++idx], NULL); + conf.tamper_core_volt_mon_ctl = hextoul(argv[++idx], NULL); err = apply_snvs_dgo_config(&conf); @@ -727,7 +727,7 @@ static int do_tamper_pin_cfg(struct cmd_tbl *cmdtp, int flag, int argc, return CMD_RET_USAGE; conf.pad = simple_strtoul(argv[++idx], NULL, 10); - conf.mux_conf = simple_strtoul(argv[++idx], NULL, 16); + conf.mux_conf = hextoul(argv[++idx], NULL); err = apply_tamper_pin_list_config(&conf, 1); @@ -761,8 +761,8 @@ static int do_snvs_clear_status(struct cmd_tbl *cmdtp, int flag, int argc, if (argc != (2 + 1)) return CMD_RET_USAGE; - conf.lp.status = simple_strtoul(argv[++idx], NULL, 16); - conf.lp.tamper_det_status = simple_strtoul(argv[++idx], NULL, 16); + conf.lp.status = hextoul(argv[++idx], NULL); + conf.lp.tamper_det_status = hextoul(argv[++idx], NULL); scierr = check_write_secvio_config(SC_CONF_OFFSET_OF(lp.status), &conf.lp.status, NULL, NULL, NULL, diff --git a/arch/arm/mach-imx/imx_bootaux.c b/arch/arm/mach-imx/imx_bootaux.c index 30fb45d..9ffe5ac 100644 --- a/arch/arm/mach-imx/imx_bootaux.c +++ b/arch/arm/mach-imx/imx_bootaux.c @@ -180,7 +180,7 @@ static int do_bootaux(struct cmd_tbl *cmdtp, int flag, int argc, return CMD_RET_SUCCESS; } - addr = simple_strtoul(argv[1], NULL, 16); + addr = hextoul(argv[1], NULL); if (!addr) return CMD_RET_FAILURE; diff --git a/arch/arm/mach-imx/mx6/mp.c b/arch/arm/mach-imx/mx6/mp.c index 2fdf070..de9ace0 100644 --- a/arch/arm/mach-imx/mx6/mp.c +++ b/arch/arm/mach-imx/mx6/mp.c @@ -47,7 +47,7 @@ int cpu_release(u32 nr, int argc, char *const argv[]) { uint32_t boot_addr; - boot_addr = simple_strtoul(argv[0], NULL, 16); + boot_addr = hextoul(argv[0], NULL); switch (nr) { case 1: |