All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Anderson <sean.anderson@seco.com>
To: Simon Glass <sjg@chromium.org>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Tom Rini <trini@konsulko.com>,
	u-boot@lists.denx.de, Sean Anderson <sean.anderson@seco.com>
Subject: [PATCH 12/17] cmd: fdt: Use start/size for chosen instead of start/end
Date: Thu,  3 Mar 2022 15:43:55 -0500	[thread overview]
Message-ID: <20220303204400.2787389-13-sean.anderson@seco.com> (raw)
In-Reply-To: <20220303204400.2787389-1-sean.anderson@seco.com>

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 <sean.anderson@seco.com>
---

 arch/arm/lib/semihosting.c | 16 ++++++++--------
 cmd/fdt.c                  |  6 +++---
 2 files changed, 11 insertions(+), 11 deletions(-)

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 <addr> <size>        - Add a mem reserve\n"
 	"fdt rsvmem delete <index>           - Delete a mem reserves\n"
-	"fdt chosen [<start> <end>]          - Add/update the /chosen branch in the tree\n"
-	"                                        <start>/<end> - initrd start/end addr\n"
+	"fdt chosen [<start> <size>]         - Add/update the /chosen branch in the tree\n"
+	"                                        <start>/<size> - initrd start addr/size\n"
 #if defined(CONFIG_FIT_SIGNATURE)
 	"fdt checksign [<addr>]              - check FIT signature\n"
 	"                                        <start> - addr of key blob\n"
-- 
2.25.1


  parent reply	other threads:[~2022-03-03 20:47 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-03 20:43 [PATCH 00/17] arm: semihosting: Cleanups and new features Sean Anderson
2022-03-03 20:43 ` [PATCH 01/17] doc: Convert semihosting readme to rST Sean Anderson
2022-03-03 20:43 ` [PATCH 02/17] nxp: ls1046ardb: Convert README " Sean Anderson
2022-03-03 20:43 ` [PATCH 03/17] doc: ls1046ardb: Expand boot mode section Sean Anderson
2022-03-03 20:43 ` [PATCH 04/17] arm: smh: Add semihosting entry to MAINTAINERS Sean Anderson
2022-03-03 20:43 ` [PATCH 05/17] arm: smh: Export semihosting functions Sean Anderson
2022-03-03 20:43 ` [PATCH 06/17] arm: smh: Use numeric modes for smh_open Sean Anderson
2022-03-03 20:43 ` [PATCH 07/17] arm: smh: Return errno on error Sean Anderson
2022-03-03 20:43 ` [PATCH 08/17] arm: smh: Document functions in header Sean Anderson
2022-03-03 20:43 ` [PATCH 09/17] arm: smh: Add some file manipulation commands Sean Anderson
2022-03-03 20:43 ` [PATCH 10/17] spl: Add semihosting boot method Sean Anderson
2022-03-03 20:43 ` [PATCH 11/17] fs: Add semihosting filesystem Sean Anderson
2022-03-03 20:43 ` Sean Anderson [this message]
2022-03-03 20:43 ` [PATCH 13/17] arm: smh: Remove smhload command Sean Anderson
2022-03-03 20:43 ` [PATCH 14/17] arm: smh: Add some functions for working with the host console Sean Anderson
2022-03-03 20:43 ` [PATCH 15/17] serial: Add semihosting driver Sean Anderson
2022-03-03 20:43 ` [PATCH 16/17] doc: smh: Update semihosting documentation Sean Anderson
2022-03-03 20:44 ` [PATCH 17/17] ls1046ardb: Add support for JTAG boot Sean Anderson
2022-03-04  1:06 ` [PATCH 00/17] arm: semihosting: Cleanups and new features Linus Walleij
2022-03-04 11:47   ` Andre Przywara
2022-03-04 17:19     ` Sean Anderson
2022-03-04 18:46       ` Tom Rini
2022-03-10 16:48         ` Sean Anderson
2022-03-10 17:01           ` Andre Przywara
2022-03-10 17:06             ` Sean Anderson
2022-03-10 17:16               ` Tom Rini
2022-03-11 13:10                 ` Andre Przywara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220303204400.2787389-13-sean.anderson@seco.com \
    --to=sean.anderson@seco.com \
    --cc=linus.walleij@linaro.org \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.