Skip to contentSkip to conversation

cmd: fdt: Fix fdt address information after the movement

RFC PATCH New Marek Vasut 2 participants 4 messages Feb 24, 2018 – Apr 17, 2018

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 cmd: fdt: Fix fdt address information after the movement

From: Hiroyuki Yokoyama <[email protected]>

This patch fixes the address information of fdt.

wrong case:
=> fdt addr 0x48000000
=> fdt move 0x48000000 0x41000000 0xa000
=> fdt addr
The address of the fdt is 48000000

Active address in this case is 0x41000000.

Cc Hiroyuki Yokoyama <[email protected]>
Cc Nobuhiro Iwamatsu <[email protected]>
Cc Pantelis Antoniou <[email protected]>
---
 cmd/fdt.c | 2 ++
 1 file changed, 2 insertions(+)
cmd/fdt.c +2 -0
index b783b0df42..1245bc24eb 100644
@@ -204,6 +204,8 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			return 1;
 		}
 		working_fdt = newaddr;
+		env_set_hex("fdtaddr", (ulong)working_fdt);
+
 #ifdef CONFIG_OF_SYSTEM_SETUP
 	/* Call the board-specific fixup routine */
 	} else if (strncmp(argv[1], "sys", 3) == 0) {
Signature · 1 line
2.16.1
#1 lore raw

RFC PATCH 1/1 cmd: fdt: Fix fdt address information after the movement

Hi Marek,

Quoted 26 lines · Marek Vasut

From: Hiroyuki Yokoyama <[email protected]>

This patch fixes the address information of fdt.

wrong case:
=> fdt addr 0x48000000
=> fdt move 0x48000000 0x41000000 0xa000
=> fdt addr
The address of the fdt is 48000000

Active address in this case is 0x41000000.

Cc Hiroyuki Yokoyama <[email protected]>
Cc Nobuhiro Iwamatsu <[email protected]>
Cc Pantelis Antoniou <[email protected]>
---
 cmd/fdt.c | 2 ++
 1 file changed, 2 insertions(+)
cmd/fdt.c +0 -0
index b783b0df42..1245bc24eb 100644

cmd/fdt.c static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) · line 207

Quoted 4 lines
cmd/fdt.c +1 -0
@@ -204,6 +204,8 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                        return 1;
                }
                working_fdt = newaddr;
+               env_set_hex("fdtaddr", (ulong)working_fdt);

Shouldn't this be map_to_sysmem(working_fdt)?

Quoted 6 lines
cmd/fdt.c +1 -1
+
 #ifdef CONFIG_OF_SYSTEM_SETUP
        /* Call the board-specific fixup routine */
        } else if (strncmp(argv[1], "sys", 3) == 0) {
--

2.16.1

Regards,
Simon

#2 lore raw

RFC PATCH 1/1 cmd: fdt: Fix fdt address information after the movement

Quoted 1 line · Simon Glass

Hi Marek,

Hi,

Quoted 22 lines · Marek Vasut
Quoted 21 lines

From: Hiroyuki Yokoyama <[email protected]>

This patch fixes the address information of fdt.

wrong case:
=> fdt addr 0x48000000
=> fdt move 0x48000000 0x41000000 0xa000
=> fdt addr
The address of the fdt is 48000000

Active address in this case is 0x41000000.

Cc Hiroyuki Yokoyama <[email protected]>
Cc Nobuhiro Iwamatsu <[email protected]>
Cc Pantelis Antoniou <[email protected]>
---
 cmd/fdt.c | 2 ++
 1 file changed, 2 insertions(+)
Quoted 11 lines

cmd/fdt.c static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) · line 207

Quoted 9 lines
cmd/fdt.c +1 -0
index b783b0df42..1245bc24eb 100644
@@ -204,6 +204,8 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                        return 1;
                }
                working_fdt = newaddr;
+               env_set_hex("fdtaddr", (ulong)working_fdt);

Shouldn't this be map_to_sysmem(working_fdt)?

Should it ?

The other question I have is, is this possibly changing the U-Boot API and is that a problem ?

btw sorry, must've missed this mail.

Signature · 2 lines
Best regards,
Marek Vasut
#3 lore raw

RFC PATCH 1/1 cmd: fdt: Fix fdt address information after the movement

Hi Marek,

Quoted 39 lines · Marek Vasut
Quoted 1 line · Simon Glass

Hi Marek,

Hi,

Quoted 22 lines · Marek Vasut
Quoted 21 lines

From: Hiroyuki Yokoyama <[email protected]>

This patch fixes the address information of fdt.

wrong case:
=> fdt addr 0x48000000
=> fdt move 0x48000000 0x41000000 0xa000
=> fdt addr
The address of the fdt is 48000000

Active address in this case is 0x41000000.

Cc Hiroyuki Yokoyama <[email protected]>
Cc Nobuhiro Iwamatsu <[email protected]>
Cc Pantelis Antoniou <[email protected]>
---
 cmd/fdt.c | 2 ++
 1 file changed, 2 insertions(+)
Quoted 11 lines

cmd/fdt.c static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) · line 207

Quoted 9 lines
cmd/fdt.c +1 -0
index b783b0df42..1245bc24eb 100644
@@ -204,6 +204,8 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                        return 1;
                }
                working_fdt = newaddr;
+               env_set_hex("fdtaddr", (ulong)working_fdt);

Shouldn't this be map_to_sysmem(working_fdt)?

Quoted 1 line

Should it ?

Yes, because you are converting a pointer to a ulong address. That's what that function is for. If you use it, you will allow this code to work on sandbox.

Quoted 3 lines

The other question I have is, is this possibly changing the U-Boot API and is that a problem ?

Probably this code should use set_working_fdt_addr() instead. Then we have all the env_sets in one place.

But no I don't think it is a problem to make this change. After all, working_fdt should match the 'fdtaddr' environment variable, right?

Quoted 2 lines

btw sorry, must've missed this mail.

That's OK, I do that a lot I suspect...

Regards,
Simon