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>
This commit is contained in:
		
							parent
							
								
									367e125976
								
							
						
					
					
						commit
						f0a29d4331
					
				|  | @ -35,6 +35,9 @@ | ||||||
| 
 | 
 | ||||||
| #define MAX_LEVEL	32		/* how deeply nested we will go */ | #define MAX_LEVEL	32		/* how deeply nested we will go */ | ||||||
| #define SCRATCHPAD	1024		/* bytes of scratchpad memory */ | #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) |  * Global data (for the gd->bd) | ||||||
|  | @ -672,13 +675,21 @@ static void print_data(const void *data, int len) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if ((len %4) == 0) { | 	if ((len %4) == 0) { | ||||||
|  | 		if (len > CONFIG_CMD_FDT_MAX_DUMP) | ||||||
|  | 			printf("* 0x%08x [0x%08x]", (unsigned int)data, len); | ||||||
|  | 		else { | ||||||
| 			const u32 *p; | 			const u32 *p; | ||||||
| 
 | 
 | ||||||
| 			printf("<"); | 			printf("<"); | ||||||
| 		for (j = 0, p = data; j < len/4; j ++) | 			for (j = 0, p = data; j < len/4; j++) | ||||||
| 			printf("0x%x%s", fdt32_to_cpu(p[j]), j < (len/4 - 1) ? " " : ""); | 				printf("0x%08x%s", fdt32_to_cpu(p[j]), | ||||||
|  | 					j < (len/4 - 1) ? " " : ""); | ||||||
| 			printf(">"); | 			printf(">"); | ||||||
|  | 		} | ||||||
| 	} else { /* anything else... hexdump */ | 	} else { /* anything else... hexdump */ | ||||||
|  | 		if (len > CONFIG_CMD_FDT_MAX_DUMP) | ||||||
|  | 			printf("* 0x%08x [0x%08x]", (unsigned int)data, len); | ||||||
|  | 		else { | ||||||
| 			const u8 *s; | 			const u8 *s; | ||||||
| 
 | 
 | ||||||
| 			printf("["); | 			printf("["); | ||||||
|  | @ -686,6 +697,7 @@ static void print_data(const void *data, int len) | ||||||
| 				printf("%02x%s", s[j], j < len - 1 ? " " : ""); | 				printf("%02x%s", s[j], j < len - 1 ? " " : ""); | ||||||
| 			printf("]"); | 			printf("]"); | ||||||
| 		} | 		} | ||||||
|  | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /****************************************************************************/ | /****************************************************************************/ | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue