Skip to contentSkip to conversation

cmd_fdt: Actually fix fdt command in sandbox

PATCH Superseded Joe Hershberger 3 participants 14 messages Feb 3, 2015 – Feb 6, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 cmd_fdt: Actually fix fdt command in sandbox

Commit 90bac29a76bc8d649b41a55f2786c0abef9bb2c1 claims to fix this bug that was introduced in commit a92fd6577ea17751ead9b50243e3c562125cf581 but doesn't actually make the change that the commit message describes.

Actually fix the bug this time.

---

 common/cmd_fdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/cmd_fdt.c +1 -1
index dc59fab..51c585b 100644
@@ -123,7 +123,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		if (control)
 			gd->fdt_blob = blob;
 		else
-			set_working_fdt_addr((void *)blob);
+			set_working_fdt_addr((void *)addr);
 
 		if (argc >= 2) {
 			int  len;
Signature · 1 line
1.7.11.5
#1 lore raw

PATCH 2/2 cmd_fdt: Print the control fdt in terms of virtual memory

If you want to inspect the control device tree using the fdt command, the "fdt address -c" command previously unhelpfully printed the phys memory address of the device tree. That address could not then be used to set the fdt address for inspection.

---

 common/cmd_fdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/cmd_fdt.c +1 -1
index 51c585b..868558d 100644
@@ -111,7 +111,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			if (!blob || !fdt_valid(&blob))
 				return 1;
 			printf("The address of the fdt is %#08lx\n",
-			       control ? (ulong)blob :
+			       control ? (ulong)map_to_sysmem(blob) :
 					getenv_hex("fdtaddr", 0));
 			return 0;
 		}
Signature · 1 line
1.7.11.5
#2 lore raw

PATCH 2/2 cmd_fdt: Print the control fdt in terms of virtual memory

Hello Joe,

Quoted 4 lines · Joe Hershberger

If you want to inspect the control device tree using the fdt command, the "fdt address -c" command previously unhelpfully printed the phys memory address of the device tree. That address could not then be used to set the fdt address for inspection.

Nitpick: your commit message says what the problem is, but does not say what solution is chosen. Granted, here understanding that from the code is trivial, but I'd still like it if the message made it clear.

Quoted 27 lines

---

 common/cmd_fdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/cmd_fdt.c +1 -1
index 51c585b..868558d 100644
@@ -111,7 +111,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			if (!blob || !fdt_valid(&blob))
 				return 1;
 			printf("The address of the fdt is %#08lx\n",
-			       control ? (ulong)blob :
+			       control ? (ulong)map_to_sysmem(blob) :
 					getenv_hex("fdtaddr", 0));
 			return 0;
 		}
Signature · 6 lines
1.7.11.5

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Amicalement,

Signature · 1 line
Albert.
#3 lore raw

PATCH 1/2 cmd_fdt: Actually fix fdt command in sandbox

In reply to Joe Hershberger

Hi Joe,

Quoted 11 lines · Joe Hershberger

Commit 90bac29a76bc8d649b41a55f2786c0abef9bb2c1 claims to fix this bug that was introduced in commit a92fd6577ea17751ead9b50243e3c562125cf581 but doesn't actually make the change that the commit message describes.

Actually fix the bug this time.

---

 common/cmd_fdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

set_working_fdt_addr() is very confusing. It should take a ulong as a parameter, not a void *.

Quoted 15 lines
common/cmd_fdt.c +1 -2
index dc59fab..51c585b 100644
@@ -123,7 +123,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                if (control)
                        gd->fdt_blob = blob;
                else
-                       set_working_fdt_addr((void *)blob);
+                       set_working_fdt_addr((void *)addr);
 
                if (argc >= 2) {
                        int  len;
--
Quoted 2 lines

1.7.11.5

Regards,
Simon

#4 lore raw

PATCH v2 1/2 cmd_fdt: Actually fix fdt command in sandbox

In reply to Joe Hershberger

Commit 90bac29a76bc8d649b41a55f2786c0abef9bb2c1 claims to fix this bug that was introduced in commit a92fd6577ea17751ead9b50243e3c562125cf581 but doesn't actually make the change that the commit message describes.

Actually fix the bug this time.

---

Changes in v2:
-Changed the prototype of set_working_fdt_addr() to ulong instead of void *

 common/bootm.c        | 2 +-
 common/cmd_fdt.c      | 8 ++++----
 common/image-fdt.c    | 2 +-
 include/fdt_support.h | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)
common/bootm.c +1 -1
index e2dc164..34f60bb 100644
@@ -233,7 +233,7 @@ static int bootm_find_fdt(int flag, int argc, char * const argv[])
 		return 1;
 	}
 
-	set_working_fdt_addr(images.ft_addr);
+	set_working_fdt_addr((ulong)images.ft_addr);
 
 	return 0;
 }
common/cmd_fdt.c +4 -4
index dc59fab..4e9bc6b 100644
@@ -38,13 +38,13 @@ static int is_printable_string(const void *data, int len);
  */
 struct fdt_header *working_fdt;
 
-void set_working_fdt_addr(void *addr)
+void set_working_fdt_addr(ulong addr)
 {
 	void *buf;
 
-	buf = map_sysmem((ulong)addr, 0);
+	buf = map_sysmem(addr, 0);
 	working_fdt = buf;
-	setenv_addr("fdtaddr", addr);
+	setenv_addr("fdtaddr", (void *)addr);
 }
 
 /*
@@ -123,7 +123,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		if (control)
 			gd->fdt_blob = blob;
 		else
-			set_working_fdt_addr((void *)blob);
+			set_working_fdt_addr(addr);
 
 		if (argc >= 2) {
 			int  len;
common/image-fdt.c +1 -1
index e3f06cd..d9e4728 100644
@@ -190,7 +190,7 @@ int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size)
 	*of_flat_tree = of_start;
 	*of_size = of_len;
 
-	set_working_fdt_addr(*of_flat_tree);
+	set_working_fdt_addr((ulong)*of_flat_tree);
 	return 0;
 
 error:
include/fdt_support.h +1 -1
index 1f19fe4..ae5e8a3 100644
@@ -100,7 +100,7 @@ void ft_pci_setup(void *blob, bd_t *bd);
  */
 int ft_system_setup(void *blob, bd_t *bd);
 
-void set_working_fdt_addr(void *addr);
+void set_working_fdt_addr(ulong addr);
 int fdt_shrink_to_minimum(void *blob);
 int fdt_increase_size(void *fdt, int add_len);
 
Signature · 1 line
1.7.11.5
#5 lore raw

PATCH v2 2/2 cmd_fdt: Print the control fdt in terms of virtual memory

If you want to inspect the control device tree using the fdt command, the "fdt address -c" command previously unhelpfully printed the phys memory address of the device tree. That address could not then be used to set the fdt address for inspection. Changed the resulting print to one that can be copied directly to the 'fdt address <addr>' command.

---

Changes in v2:
-Reworded commit message

 common/cmd_fdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/cmd_fdt.c +1 -1
index 4e9bc6b..b213105 100644
@@ -111,7 +111,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			if (!blob || !fdt_valid(&blob))
 				return 1;
 			printf("The address of the fdt is %#08lx\n",
-			       control ? (ulong)blob :
+			       control ? (ulong)map_to_sysmem(blob) :
 					getenv_hex("fdtaddr", 0));
 			return 0;
 		}
Signature · 1 line
1.7.11.5
#6 lore raw

PATCH v2 2/2 cmd_fdt: Print the control fdt in terms of virtual memory

Quoted 8 lines · Joe Hershberger

If you want to inspect the control device tree using the fdt command, the "fdt address -c" command previously unhelpfully printed the phys memory address of the device tree. That address could not then be used to set the fdt address for inspection. Changed the resulting print to one that can be copied directly to the 'fdt address <addr>' command.

Quoted 7 lines

---

Changes in v2:
-Reworded commit message

 common/cmd_fdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#7 lore raw

PATCH v2 1/2 cmd_fdt: Actually fix fdt command in sandbox

In reply to Joe Hershberger
Quoted 10 lines · Joe Hershberger

Commit 90bac29a76bc8d649b41a55f2786c0abef9bb2c1 claims to fix this bug that was introduced in commit a92fd6577ea17751ead9b50243e3c562125cf581 but doesn't actually make the change that the commit message describes.

Actually fix the bug this time.

---

Quoted 8 lines

Changes in v2:
-Changed the prototype of set_working_fdt_addr() to ulong instead of void *

 common/bootm.c        | 2 +-
 common/cmd_fdt.c      | 8 ++++----
 common/image-fdt.c    | 2 +-
 include/fdt_support.h | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)
#8 lore raw

PATCH v3 1/2 cmd_fdt: Actually fix fdt command in sandbox

In reply to Joe Hershberger

Commit 90bac29a76bc8d649b41a55f2786c0abef9bb2c1 claims to fix this bug that was introduced in commit a92fd6577ea17751ead9b50243e3c562125cf581 but doesn't actually make the change that the commit message describes.

Actually fix the bug this time.

---

Changes in v3:
-Change the setenv call to the ulong version

Changes in v2:
-Changed the prototype of set_working_fdt_addr() to ulong instead of void *

 common/bootm.c        | 2 +-
 common/cmd_fdt.c      | 8 ++++----
 common/image-fdt.c    | 2 +-
 include/fdt_support.h | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)
common/bootm.c +1 -1
index e2dc164..34f60bb 100644
@@ -233,7 +233,7 @@ static int bootm_find_fdt(int flag, int argc, char * const argv[])
 		return 1;
 	}
 
-	set_working_fdt_addr(images.ft_addr);
+	set_working_fdt_addr((ulong)images.ft_addr);
 
 	return 0;
 }
common/cmd_fdt.c +4 -4
index dc59fab..5878496 100644
@@ -38,13 +38,13 @@ static int is_printable_string(const void *data, int len);
  */
 struct fdt_header *working_fdt;
 
-void set_working_fdt_addr(void *addr)
+void set_working_fdt_addr(ulong addr)
 {
 	void *buf;
 
-	buf = map_sysmem((ulong)addr, 0);
+	buf = map_sysmem(addr, 0);
 	working_fdt = buf;
-	setenv_addr("fdtaddr", addr);
+	setenv_ulong("fdtaddr", addr);
 }
 
 /*
@@ -123,7 +123,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		if (control)
 			gd->fdt_blob = blob;
 		else
-			set_working_fdt_addr((void *)blob);
+			set_working_fdt_addr(addr);
 
 		if (argc >= 2) {
 			int  len;
common/image-fdt.c +1 -1
index e3f06cd..d9e4728 100644
@@ -190,7 +190,7 @@ int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size)
 	*of_flat_tree = of_start;
 	*of_size = of_len;
 
-	set_working_fdt_addr(*of_flat_tree);
+	set_working_fdt_addr((ulong)*of_flat_tree);
 	return 0;
 
 error:
include/fdt_support.h +1 -1
index 1f19fe4..ae5e8a3 100644
@@ -100,7 +100,7 @@ void ft_pci_setup(void *blob, bd_t *bd);
  */
 int ft_system_setup(void *blob, bd_t *bd);
 
-void set_working_fdt_addr(void *addr);
+void set_working_fdt_addr(ulong addr);
 int fdt_shrink_to_minimum(void *blob);
 int fdt_increase_size(void *fdt, int add_len);
 
Signature · 1 line
1.7.11.5
#9 lore raw

PATCH v3 2/2 cmd_fdt: Print the control fdt in terms of virtual memory

If you want to inspect the control device tree using the fdt command, the "fdt address -c" command previously unhelpfully printed the phys memory address of the device tree. That address could not then be used to set the fdt address for inspection. Changed the resulting print to one that can be copied directly to the 'fdt address <addr>' command.

---

Changes in v3: None
Changes in v2:
-Reworded commit message

 common/cmd_fdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/cmd_fdt.c +1 -1
index 5878496..48b3e70 100644
@@ -111,7 +111,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			if (!blob || !fdt_valid(&blob))
 				return 1;
 			printf("The address of the fdt is %#08lx\n",
-			       control ? (ulong)blob :
+			       control ? (ulong)map_to_sysmem(blob) :
 					getenv_hex("fdtaddr", 0));
 			return 0;
 		}
Signature · 1 line
1.7.11.5
#10 lore raw

PATCH v3 2/2 cmd_fdt: Print the control fdt in terms of virtual memory

Quoted 11 lines · Joe Hershberger

If you want to inspect the control device tree using the fdt command, the "fdt address -c" command previously unhelpfully printed the phys memory address of the device tree. That address could not then be used to set the fdt address for inspection. Changed the resulting print to one that can be copied directly to the 'fdt address <addr>' command.

---

Changes in v3: None

Quoted 22 lines

Changes in v2:

(quoted diff) +0 -1
-Reworded commit message
 
 common/cmd_fdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/cmd_fdt.c +1 -2
index 5878496..48b3e70 100644
@@ -111,7 +111,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                        if (!blob || !fdt_valid(&blob))
                                return 1;
                        printf("The address of the fdt is %#08lx\n",
-                              control ? (ulong)blob :
+                              control ? (ulong)map_to_sysmem(blob) :
                                        getenv_hex("fdtaddr", 0));
                        return 0;
                }
--

1.7.11.5

#11 lore raw

PATCH v3 2/2 cmd_fdt: Print the control fdt in terms of virtual memory

Quoted 7 lines · Simon Glass
Quoted 6 lines · Joe Hershberger

If you want to inspect the control device tree using the fdt command, the "fdt address -c" command previously unhelpfully printed the phys memory address of the device tree. That address could not then be used to set the fdt address for inspection. Changed the resulting print to one that can be copied directly to the 'fdt address <addr>' command.

Quoted 7 lines
Quoted 5 lines

---

Changes in v3: None

Applied to u-boot-fdt, thanks!

Quoted 3 lines
Quoted 3 lines

Changes in v2:
-Reworded commit message

#12 lore raw

PATCH v3 1/2 cmd_fdt: Actually fix fdt command in sandbox

In reply to Joe Hershberger
Quoted 4 lines · Joe Hershberger

Commit 90bac29a76bc8d649b41a55f2786c0abef9bb2c1 claims to fix this bug that was introduced in commit a92fd6577ea17751ead9b50243e3c562125cf581 but doesn't actually make the change that the commit message describes.

Quoted 8 lines

Actually fix the bug this time.

---

Changes in v3:
-Change the setenv call to the ulong version

#13 lore raw

PATCH v3 1/2 cmd_fdt: Actually fix fdt command in sandbox

Quoted 7 lines · Simon Glass
Quoted 6 lines · Joe Hershberger

Commit 90bac29a76bc8d649b41a55f2786c0abef9bb2c1 claims to fix this bug that was introduced in commit a92fd6577ea17751ead9b50243e3c562125cf581 but doesn't actually make the change that the commit message describes.

Actually fix the bug this time.

Quoted 8 lines
Quoted 6 lines

---

Changes in v3:
-Change the setenv call to the ulong version

Applied to u-boot-fdt, thanks!