From: Sean Anderson Date: Tue, 22 Mar 2022 20:59:21 +0000 (-0400) Subject: cmd: fdt: Use start/size for chosen instead of start/end X-Git-Url: http://git.dujemihanovic.xyz/img/static/git-favicon.png?a=commitdiff_plain;h=dbf6f7c95240bd5fc7f5bbc2b36e275248279f53;p=u-boot.git cmd: fdt: Use start/size for chosen instead of start/end Most U-Boot command deal with start/size instead of start/end. Convert the "fdt chosen" command to use these semantics as well. The only user of this subcommand is vexpress, so convert the smhload command to use this as well. We don't bother renaming the variable in vexpress64's bootcommand, since it will be rewritten in the next commit. Signed-off-by: Sean Anderson --- diff --git a/arch/arm/lib/semihosting.c b/arch/arm/lib/semihosting.c index d08003cef1..45cd566cfc 100644 --- a/arch/arm/lib/semihosting.c +++ b/arch/arm/lib/semihosting.c @@ -171,7 +171,7 @@ long smh_seek(long fd, long pos) } static int smh_load_file(const char * const name, ulong load_addr, - ulong *end_addr) + ulong *size) { long fd; long len; @@ -191,11 +191,11 @@ static int smh_load_file(const char * const name, ulong load_addr, smh_close(fd); if (ret == len) { - *end_addr = load_addr + len - 1; + *size = len; printf("loaded file %s from %08lX to %08lX, %08lX bytes\n", name, load_addr, - *end_addr, + load_addr + len - 1, len); } else if (ret >= 0) { ret = -EAGAIN; @@ -214,22 +214,22 @@ static int do_smhload(struct cmd_tbl *cmdtp, int flag, int argc, { if (argc == 3 || argc == 4) { ulong load_addr; - ulong end_addr = 0; + ulong size = 0; int ret; - char end_str[64]; + char size_str[64]; load_addr = hextoul(argv[2], NULL); if (!load_addr) return -1; - ret = smh_load_file(argv[1], load_addr, &end_addr); + ret = smh_load_file(argv[1], load_addr, &size); if (ret < 0) return CMD_RET_FAILURE; /* Optionally save returned end to the environment */ if (argc == 4) { - sprintf(end_str, "0x%08lx", end_addr); - env_set(argv[3], end_str); + sprintf(size_str, "0x%08lx", size); + env_set(argv[3], size_str); } } else { return CMD_RET_USAGE; diff --git a/cmd/fdt.c b/cmd/fdt.c index 2a207bf2b5..7d7cae88a2 100644 --- a/cmd/fdt.c +++ b/cmd/fdt.c @@ -638,7 +638,7 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) if (argc == 4) { initrd_start = hextoul(argv[2], NULL); - initrd_end = hextoul(argv[3], NULL); + initrd_end = initrd_start + hextoul(argv[3], NULL) - 1; } fdt_chosen(working_fdt); @@ -1083,8 +1083,8 @@ static char fdt_help_text[] = "fdt rsvmem print - Show current mem reserves\n" "fdt rsvmem add - Add a mem reserve\n" "fdt rsvmem delete - Delete a mem reserves\n" - "fdt chosen [ ] - Add/update the /chosen branch in the tree\n" - " / - initrd start/end addr\n" + "fdt chosen [ ] - Add/update the /chosen branch in the tree\n" + " / - initrd start addr/size\n" #if defined(CONFIG_FIT_SIGNATURE) "fdt checksign [] - check FIT signature\n" " - addr of key blob\n"