summaryrefslogtreecommitdiff
path: root/board/xilinx
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-07-24 18:03:29 +0300
committerTom Rini <trini@konsulko.com>2021-08-02 20:32:14 +0300
commit7e5f460ec457fe310156e399198a41eb0ce1e98c (patch)
tree7e89e4d15fcea2d2263c4b4af1be69905537ef42 /board/xilinx
parent031725f8cdf33e836d19f35d3fe82c5baa5a2976 (diff)
downloadu-boot-7e5f460ec457fe310156e399198a41eb0ce1e98c.tar.xz
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 'board/xilinx')
-rw-r--r--board/xilinx/common/fru.c4
-rw-r--r--board/xilinx/versal/cmds.c2
-rw-r--r--board/xilinx/zynq/cmds.c14
-rw-r--r--board/xilinx/zynqmp/cmds.c46
4 files changed, 33 insertions, 33 deletions
diff --git a/board/xilinx/common/fru.c b/board/xilinx/common/fru.c
index ccf48723ff..f6ca46c3ce 100644
--- a/board/xilinx/common/fru.c
+++ b/board/xilinx/common/fru.c
@@ -19,7 +19,7 @@ static int do_fru_capture(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < cmdtp->maxargs)
return CMD_RET_USAGE;
- addr = simple_strtoul(argv[2], &endp, 16);
+ addr = hextoul(argv[2], &endp);
if (*argv[1] == 0 || *endp != 0)
return -1;
@@ -41,7 +41,7 @@ static int do_fru_generate(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < cmdtp->maxargs)
return CMD_RET_USAGE;
- addr = simple_strtoul(argv[2], NULL, 16);
+ addr = hextoul(argv[2], NULL);
return fru_generate(addr, argv[3], argv[4], argv[5], argv[6], argv[7]);
}
diff --git a/board/xilinx/versal/cmds.c b/board/xilinx/versal/cmds.c
index f5735d0c62..04d4cdb141 100644
--- a/board/xilinx/versal/cmds.c
+++ b/board/xilinx/versal/cmds.c
@@ -32,7 +32,7 @@ static int do_versal_load_pdi(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
}
- len = simple_strtoul(argv[3], NULL, 16);
+ len = hextoul(argv[3], NULL);
if (!len) {
debug("pdi_load: zero size\n");
return CMD_RET_USAGE;
diff --git a/board/xilinx/zynq/cmds.c b/board/xilinx/zynq/cmds.c
index 6c697caa62..024fac65f3 100644
--- a/board/xilinx/zynq/cmds.c
+++ b/board/xilinx/zynq/cmds.c
@@ -422,7 +422,7 @@ static int do_zynq_rsa(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != cmdtp->maxargs)
return CMD_RET_FAILURE;
- src_ptr = simple_strtoul(argv[2], &endp, 16);
+ src_ptr = hextoul(argv[2], &endp);
if (*argv[2] == 0 || *endp != 0)
return CMD_RET_USAGE;
@@ -453,26 +453,26 @@ static int zynq_decrypt_image(struct cmd_tbl *cmdtp, int flag, int argc,
else
return CMD_RET_USAGE;
- srcaddr = simple_strtoul(argv[3], &endp, 16);
+ srcaddr = hextoul(argv[3], &endp);
if (*argv[3] == 0 || *endp != 0)
return CMD_RET_USAGE;
- srclen = simple_strtoul(argv[4], &endp, 16);
+ srclen = hextoul(argv[4], &endp);
if (*argv[4] == 0 || *endp != 0)
return CMD_RET_USAGE;
dstaddr = 0xFFFFFFFF;
dstlen = srclen;
} else {
- srcaddr = simple_strtoul(argv[2], &endp, 16);
+ srcaddr = hextoul(argv[2], &endp);
if (*argv[2] == 0 || *endp != 0)
return CMD_RET_USAGE;
- srclen = simple_strtoul(argv[3], &endp, 16);
+ srclen = hextoul(argv[3], &endp);
if (*argv[3] == 0 || *endp != 0)
return CMD_RET_USAGE;
- dstaddr = simple_strtoul(argv[4], &endp, 16);
+ dstaddr = hextoul(argv[4], &endp);
if (*argv[4] == 0 || *endp != 0)
return CMD_RET_USAGE;
- dstlen = simple_strtoul(argv[5], &endp, 16);
+ dstlen = hextoul(argv[5], &endp);
if (*argv[5] == 0 || *endp != 0)
return CMD_RET_USAGE;
}
diff --git a/board/xilinx/zynqmp/cmds.c b/board/xilinx/zynqmp/cmds.c
index cf63ad97fa..b15c0f599b 100644
--- a/board/xilinx/zynqmp/cmds.c
+++ b/board/xilinx/zynqmp/cmds.c
@@ -40,7 +40,7 @@ static int do_zynqmp_verify_secure(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_USAGE;
src_addr = simple_strtoull(argv[2], NULL, 16);
- len = simple_strtoul(argv[3], NULL, 16);
+ len = hextoul(argv[3], NULL);
if (argc == 5)
key_ptr = (uint8_t *)(uintptr_t)simple_strtoull(argv[4],
@@ -86,7 +86,7 @@ static int do_zynqmp_mmio_read(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != cmdtp->maxargs)
return CMD_RET_USAGE;
- addr = simple_strtoul(argv[2], NULL, 16);
+ addr = hextoul(argv[2], NULL);
ret = zynqmp_mmio_read(addr, &read_val);
if (!ret)
@@ -107,9 +107,9 @@ static int do_zynqmp_mmio_write(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != cmdtp->maxargs)
return CMD_RET_USAGE;
- addr = simple_strtoul(argv[2], NULL, 16);
- mask = simple_strtoul(argv[3], NULL, 16);
- val = simple_strtoul(argv[4], NULL, 16);
+ addr = hextoul(argv[2], NULL);
+ mask = hextoul(argv[3], NULL);
+ val = hextoul(argv[4], NULL);
ret = zynqmp_mmio_write(addr, mask, val);
if (ret != 0)
@@ -135,12 +135,12 @@ static int do_zynqmp_aes(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < cmdtp->maxargs - 1)
return CMD_RET_USAGE;
- aes->srcaddr = simple_strtoul(argv[2], NULL, 16);
- aes->ivaddr = simple_strtoul(argv[3], NULL, 16);
- aes->len = simple_strtoul(argv[4], NULL, 16);
- aes->op = simple_strtoul(argv[5], NULL, 16);
- aes->keysrc = simple_strtoul(argv[6], NULL, 16);
- aes->dstaddr = simple_strtoul(argv[7], NULL, 16);
+ aes->srcaddr = hextoul(argv[2], NULL);
+ aes->ivaddr = hextoul(argv[3], NULL);
+ aes->len = hextoul(argv[4], NULL);
+ aes->op = hextoul(argv[5], NULL);
+ aes->keysrc = hextoul(argv[6], NULL);
+ aes->dstaddr = hextoul(argv[7], NULL);
flush_dcache_range((ulong)aes, (ulong)(aes) +
roundup(sizeof(struct aes), ARCH_DMA_MINALIGN));
@@ -161,7 +161,7 @@ static int do_zynqmp_aes(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < cmdtp->maxargs)
return CMD_RET_USAGE;
- aes->keyaddr = simple_strtoul(argv[8], NULL, 16);
+ aes->keyaddr = hextoul(argv[8], NULL);
if (aes->keyaddr)
flush_dcache_range(aes->keyaddr,
(aes->keyaddr +
@@ -187,7 +187,7 @@ static int do_zynqmp_tcm_init(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != cmdtp->maxargs)
return CMD_RET_USAGE;
- mode = simple_strtoul(argv[2], NULL, 16);
+ mode = hextoul(argv[2], NULL);
if (mode != TCM_LOCK && mode != TCM_SPLIT) {
printf("Mode should be either 0(lock)/1(split)\n");
return CMD_RET_FAILURE;
@@ -209,8 +209,8 @@ static int do_zynqmp_pmufw(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc != cmdtp->maxargs)
return CMD_RET_USAGE;
- addr = simple_strtoul(argv[2], NULL, 16);
- size = simple_strtoul(argv[3], NULL, 16);
+ addr = hextoul(argv[2], NULL);
+ size = hextoul(argv[3], NULL);
flush_dcache_range((ulong)addr, (ulong)(addr + size));
zynqmp_pmufw_load_config_object((const void *)(uintptr_t)addr,
@@ -236,16 +236,16 @@ static int do_zynqmp_rsa(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_FAILURE;
}
- srcaddr = simple_strtoul(argv[2], NULL, 16);
- srclen = simple_strtoul(argv[3], NULL, 16);
+ srcaddr = hextoul(argv[2], NULL);
+ srclen = hextoul(argv[3], NULL);
if (srclen != RSA_KEY_SIZE) {
puts("ERR: srclen should be equal to 0x200(512 bytes)\n");
return CMD_RET_USAGE;
}
- mod = simple_strtoul(argv[4], NULL, 16);
- exp = simple_strtoul(argv[5], NULL, 16);
- rsaop = simple_strtoul(argv[6], NULL, 16);
+ mod = hextoul(argv[4], NULL);
+ exp = hextoul(argv[5], NULL);
+ rsaop = hextoul(argv[6], NULL);
if (!(rsaop == 0 || rsaop == 1)) {
puts("ERR: rsaop should be either 0 or 1\n");
return CMD_RET_USAGE;
@@ -299,11 +299,11 @@ static int do_zynqmp_sha3(struct cmd_tbl *cmdtp, int flag,
return CMD_RET_FAILURE;
}
- srcaddr = simple_strtoul(argv[2], NULL, 16);
- srclen = simple_strtoul(argv[3], NULL, 16);
+ srcaddr = hextoul(argv[2], NULL);
+ srclen = hextoul(argv[3], NULL);
if (argc == 5) {
- hashaddr = simple_strtoul(argv[4], NULL, 16);
+ hashaddr = hextoul(argv[4], NULL);
flush_dcache_range(hashaddr,
hashaddr + roundup(ZYNQMP_SHA3_SIZE,
ARCH_DMA_MINALIGN));