diff options
| author | Joe Hershberger <joe.hershberger@ni.com> | 2012-08-17 10:34:36 +0000 | 
|---|---|---|
| committer | Gerald Van Baren <gvb@unssw.com> | 2012-10-15 19:20:16 -0400 | 
| commit | f0a29d43313c9d0d9091aeae175bd7e8e7ac6124 (patch) | |
| tree | 72e7da4c7c2d25397bbd9280d80c43a2beb676fb | |
| parent | 367e12597617b2581eb72b3676c6cb86822268b5 (diff) | |
| download | olio-uboot-2014.01-f0a29d43313c9d0d9091aeae175bd7e8e7ac6124.tar.xz olio-uboot-2014.01-f0a29d43313c9d0d9091aeae175bd7e8e7ac6124.zip | |
fdt: Limit printed hex in fdt print and list commands
Prevent printing the entire image in a itb. It is most likely unhelpful
to have the hex of the entire image scroll for minutes on your slow
serial console.
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
| -rw-r--r-- | common/cmd_fdt.c | 32 | 
1 files changed, 22 insertions, 10 deletions
| diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c index e2225c4d5..699441b51 100644 --- a/common/cmd_fdt.c +++ b/common/cmd_fdt.c @@ -35,6 +35,9 @@  #define MAX_LEVEL	32		/* how deeply nested we will go */  #define SCRATCHPAD	1024		/* bytes of scratchpad memory */ +#ifndef CONFIG_CMD_FDT_MAX_DUMP +#define CONFIG_CMD_FDT_MAX_DUMP 64 +#endif  /*   * Global data (for the gd->bd) @@ -672,19 +675,28 @@ static void print_data(const void *data, int len)  	}  	if ((len %4) == 0) { -		const u32 *p; +		if (len > CONFIG_CMD_FDT_MAX_DUMP) +			printf("* 0x%08x [0x%08x]", (unsigned int)data, len); +		else { +			const u32 *p; -		printf("<"); -		for (j = 0, p = data; j < len/4; j ++) -			printf("0x%x%s", fdt32_to_cpu(p[j]), j < (len/4 - 1) ? " " : ""); -		printf(">"); +			printf("<"); +			for (j = 0, p = data; j < len/4; j++) +				printf("0x%08x%s", fdt32_to_cpu(p[j]), +					j < (len/4 - 1) ? " " : ""); +			printf(">"); +		}  	} else { /* anything else... hexdump */ -		const u8 *s; +		if (len > CONFIG_CMD_FDT_MAX_DUMP) +			printf("* 0x%08x [0x%08x]", (unsigned int)data, len); +		else { +			const u8 *s; -		printf("["); -		for (j = 0, s = data; j < len; j++) -			printf("%02x%s", s[j], j < len - 1 ? " " : ""); -		printf("]"); +			printf("["); +			for (j = 0, s = data; j < len; j++) +				printf("%02x%s", s[j], j < len - 1 ? " " : ""); +			printf("]"); +		}  	}  } |