FDT: only call boot_get_fdt from generic code
All arches except nios2 and microblaze call boot_get_fdt from bootm_start in common/cmd_bootm.c. Having nios2 and microblaze do so as well removes code from their respective do_bootm_linux routines and allows removal of a nasty ifdef from bootm_start. In the case where boot_get_fdt returns an error bootm_start returns and the platform specific do_bootm_linux routines will never get called. Also only check argv[3] for an fdt addr if argc > 3 first. This is already the case for nios2. Signed-off-by: John Rigby <john.rigby@linaro.org> CC: Scott McNutt <smcnutt@psyent.com> CC: Michal Simek <monstr@monstr.eu> CC: Thomas Chou <thomas@wytron.com.tw> Acked-by: Wolfgang Denk <wd@denx.de> Acked-by: Michal Simek <monstr@monstr.eu> Tested-by: Thomas Chou <thomas@wytron.com.tw>
This commit is contained in:
		
							parent
							
								
									a6bd9e83ab
								
							
						
					
					
						commit
						5a75e12107
					
				|  | @ -46,12 +46,9 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima | ||||||
| 
 | 
 | ||||||
| 	char	*of_flat_tree = NULL; | 	char	*of_flat_tree = NULL; | ||||||
| #if defined(CONFIG_OF_LIBFDT) | #if defined(CONFIG_OF_LIBFDT) | ||||||
| 	ulong	of_size = 0; | 	/* did generic code already find a device tree? */ | ||||||
| 
 | 	if (images->ft_len) | ||||||
| 	/* find flattened device tree */ | 		of_flat_tree = images->ft_addr; | ||||||
| 	ret = boot_get_fdt (flag, argc, argv, images, &of_flat_tree, &of_size); |  | ||||||
| 	if (ret) |  | ||||||
| 		return 1; |  | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 	theKernel = (void (*)(char *, ulong, ulong))images->ep; | 	theKernel = (void (*)(char *, ulong, ulong))images->ep; | ||||||
|  | @ -64,9 +61,8 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima | ||||||
| 
 | 
 | ||||||
| 	show_boot_progress (15); | 	show_boot_progress (15); | ||||||
| 
 | 
 | ||||||
| 	if (!(ulong) of_flat_tree) | 	if (!of_flat_tree && argc > 3) | ||||||
| 		of_flat_tree = (char *)simple_strtoul(argv[3], NULL, 16); | 		of_flat_tree = (char *)simple_strtoul(argv[3], NULL, 16); | ||||||
| 
 |  | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
| 	printf ("## Transferring control to Linux (at address 0x%08lx) " \ | 	printf ("## Transferring control to Linux (at address 0x%08lx) " \ | ||||||
| 				"ramdisk 0x%08lx, FDT 0x%08lx...\n", | 				"ramdisk 0x%08lx, FDT 0x%08lx...\n", | ||||||
|  |  | ||||||
|  | @ -36,11 +36,9 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima | ||||||
| 	ulong initrd_end = images->rd_end; | 	ulong initrd_end = images->rd_end; | ||||||
| 	char *of_flat_tree = NULL; | 	char *of_flat_tree = NULL; | ||||||
| #if defined(CONFIG_OF_LIBFDT) | #if defined(CONFIG_OF_LIBFDT) | ||||||
| 	ulong of_size = 0; | 	/* did generic code already find a device tree? */ | ||||||
| 
 | 	if (images->ft_len) | ||||||
| 	/* find flattened device tree */ | 		of_flat_tree = images->ft_addr; | ||||||
| 	if (boot_get_fdt(flag, argc, argv, images, &of_flat_tree, &of_size)) |  | ||||||
| 		return 1; |  | ||||||
| #endif | #endif | ||||||
| 	if (!of_flat_tree && argc > 3) | 	if (!of_flat_tree && argc > 3) | ||||||
| 		of_flat_tree = (char *)simple_strtoul(argv[3], NULL, 16); | 		of_flat_tree = (char *)simple_strtoul(argv[3], NULL, 16); | ||||||
|  |  | ||||||
|  | @ -308,7 +308,6 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[] | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| #if defined(CONFIG_OF_LIBFDT) | #if defined(CONFIG_OF_LIBFDT) | ||||||
| #if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_SPARC) |  | ||||||
| 		/* find flattened device tree */ | 		/* find flattened device tree */ | ||||||
| 		ret = boot_get_fdt (flag, argc, argv, &images, | 		ret = boot_get_fdt (flag, argc, argv, &images, | ||||||
| 				    &images.ft_addr, &images.ft_len); | 				    &images.ft_addr, &images.ft_len); | ||||||
|  | @ -318,7 +317,6 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[] | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		set_working_fdt_addr(images.ft_addr); | 		set_working_fdt_addr(images.ft_addr); | ||||||
| #endif |  | ||||||
| #endif | #endif | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue