of/flattree: print memory scan node results in CPU endian
PATCH 1/1 of/flattree: print memory scan node results in CPU endian
Commit 51975db0b7333 ("of/flattree: merge early_init_dt_scan_memory() common code") consolidated some code from PowerPC (typically big-endian), and ended-up adding a pr_debug() printing reg properties in big-endian (DT native) format, not CPU endian. Unsurprisingly, when these messages are turned on a little-endian systems, this is confusing, so do the conversion while printing the values.
--- drivers/of/fdt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/of/fdt.c +2 -1
@@ -880,7 +880,8 @@ int __init early_init_dt_scan_memory(unsigned long node, const char *uname, endp = reg + (l /sizeof (__be32));pr_debug ("memory scan node %s, reg size %d, data: %x %x %x %x,\n" , - uname, l, reg[0 ], reg[1 ], reg[2 ], reg[3 ]); + uname, l,be32_to_cpu (reg[0 ]),be32_to_cpu (reg[1 ]), +be32_to_cpu (reg[2 ]),be32_to_cpu (reg[3 ]));while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) {u64 base, size;
Signature · 1 line
2.1.0
Quoted 17 lines · Florian Fainelli
Commit
51975db0b7333("of/flattree: mergeearly_init_dt_scan_memory()common code") consolidated some code from PowerPC (typically big-endian), and ended-up adding apr_debug()printing reg properties in big-endian (DT native) format, not CPU endian. Unsurprisingly, when these messages are turned on a little-endian systems, this is confusing, so do the conversion while printing the values.Signed-off-by Florian Fainelli <[email protected]>--- drivers/of/fdt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/of/fdt.c +0
-0
drivers/of/fdt.c int __init early_init_dt_scan_memory(unsigned long node, const char *uname, · line 884
Quoted 6 lines
drivers/of/fdt.c +2
-1@@ -880,7 +880,8 @@ int __init early_init_dt_scan_memory(unsigned long node, const char *uname, endp = reg + (l /sizeof (__be32));pr_debug ("memory scan node %s, reg size %d, data: %x %x %x %x,\n" , - uname, l, reg[0 ], reg[1 ], reg[2 ], reg[3 ]); + uname, l,be32_to_cpu (reg[0 ]),be32_to_cpu (reg[1 ]), +be32_to_cpu (reg[2 ]),be32_to_cpu (reg[3 ]));
The pr_debug() assumes that the length of reg[] is >= 4 elements, which might not be true. Since the following while loop checks the length of reg[] and then uses pr_debug() to print each (base, size) tuple with the correct endian, maybe it would be better to just remove reg[0] through reg[3] from the above pr_debug() instead of fixing the endian issue.
drivers/of/fdt.c int __init early_init_dt_scan_memory(unsigned long node, const char *uname,
Quoted 4 lines
drivers/of/fdt.c +0
-0while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) {u64 base, size;
-Frank
Quoted 20 lines · Frank Rowand
Quoted 19 lines · Florian Fainelli
Commit
51975db0b7333("of/flattree: mergeearly_init_dt_scan_memory()common code") consolidated some code from PowerPC (typically big-endian), and ended-up adding apr_debug()printing reg properties in big-endian (DT native) format, not CPU endian. Unsurprisingly, when these messages are turned on a little-endian systems, this is confusing, so do the conversion while printing the values.Signed-off-by Florian Fainelli <[email protected]>--- drivers/of/fdt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/of/fdt.c +0
-0@@ -880,7 +880,8 @@ int __init early_init_dt_scan_memory(unsigned long node, const char *uname, endp = reg + (l /sizeof (__be32));
Quoted 10 lines
drivers/of/fdt.c int __init early_init_dt_scan_memory(unsigned long node, const char *uname, · line 884
Quoted 4 lines
drivers/of/fdt.c +2
-1pr_debug ("memory scan node %s, reg size %d, data: %x %x %x %x,\n" , - uname, l, reg[0 ], reg[1 ], reg[2 ], reg[3 ]); + uname, l,be32_to_cpu (reg[0 ]),be32_to_cpu (reg[1 ]), +be32_to_cpu (reg[2 ]),be32_to_cpu (reg[3 ]));The
pr_debug()assumes that the length of reg[] is >= 4 elements, which might not be true. Since the following while loop checks the length of reg[] and then usespr_debug()to print each (base, size) tuple with the correct endian, maybe it would be better to just remove reg[0] through reg[3] from the abovepr_debug()instead of fixing the endian issue.
Right, that works too, will follow-up with a patch removing the reg[0..3] prints.
Thanks!
--
Florian
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 1/1 of/fdt: Remove "reg" data prints from early_init_dt_scan_memory
In reply to Frank RowandCommit 51975db0b7333 ("of/flattree: merge early_init_dt_scan_memory() common code") consolidated some code from PowerPC (typically big-endian), and ended-up adding a pr_debug() printing reg properties in big-endian (DT native) format, not CPU endian.
This debug print suffers from two problems:
- we only print 4 "reg" values, while there could be more on typical systems having multiple memory ranges
- we print these 4 "reg" values in FDT endianess, that is big-endian, and these values could be confusing for little-endian configurations
Since we are already printing the base address and size of the memory regions parsed by early_init_dt_scan_memory() later in a way that is both endian correct, and takes into account arbitrary number of memory banks, just remove that part of the debug print.
---
Patch against devicetree/next
drivers/of/fdt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/of/fdt.c +1 -2
@@ -879,8 +879,7 @@ int __init early_init_dt_scan_memory(unsigned long node, const char *uname, endp = reg + (l /sizeof (__be32)); -pr_debug ("memory scan node %s, reg size %d, data: %x %x %x %x,\n" , - uname, l, reg[0 ], reg[1 ], reg[2 ], reg[3 ]); +pr_debug ("memory scan node %s, reg size %d,\n" , uname, l);while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) {u64 base, size;
Signature · 6 lines
2.1.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Rob Herring
AppliedRe: [PATCH] of/fdt: Remove "reg" data prints from early_init_dt_scan_memory
Quoted 16 lines · Florian Fainelli
Commit
51975db0b7333("of/flattree: mergeearly_init_dt_scan_memory()common code") consolidated some code from PowerPC (typically big-endian), and ended-up adding apr_debug()printing reg properties in big-endian (DT native) format, not CPU endian.This debug print suffers from two problems:
- we only print 4 "reg" values, while there could be more on typical systems having multiple memory ranges
- we print these 4 "reg" values in FDT endianess, that is big-endian, and these values could be confusing for little-endian configurationsSince we are already printing the base address and size of the memory regions parsed by
early_init_dt_scan_memory()later in a way that is both endian correct, and takes into account arbitrary number of memory banks, just remove that part of the debug print.
Quoted 4 lines
Suggested-by Frank Rowand <[email protected]>Signed-off-by Florian Fainelli <[email protected]>---
Patch against devicetree/next
Applied. Thanks.
Rob
Quoted 19 lines
drivers/of/fdt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/of/fdt.c +1
-3@@ -879,8 +879,7 @@ int __init early_init_dt_scan_memory(unsigned long node, const char *uname, endp = reg + (l /sizeof (__be32)); -pr_debug ("memory scan node %s, reg size %d, data: %x %x %x %x,\n" , - uname, l, reg[0 ], reg[1 ], reg[2 ], reg[3 ]); +pr_debug ("memory scan node %s, reg size %d,\n" , uname, l);while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) {u64 base, size; --
Quoted 2 lines
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html