* MA 02111-1307 USA
*/
-#define DEBUG
#include <common.h>
#include <watchdog.h>
ulong initrd_start, initrd_end;
ulong rd_data_start, rd_data_end, rd_len;
ulong size;
+ phys_size_t bootm_size;
ulong cmd_start, cmd_end, bootmap_base;
bd_t *kbd;
#endif
bootmap_base = getenv_bootm_low();
- size = getenv_bootm_size();
+ bootm_size = getenv_bootm_size();
#ifdef DEBUG
- if (((u64)bootmap_base + size) > (CFG_SDRAM_BASE + (u64)gd->ram_size))
+ if (((u64)bootmap_base + bootm_size) >
+ (CFG_SDRAM_BASE + (u64)gd->ram_size))
puts("WARNING: bootm_low + bootm_size exceed total memory\n");
- if ((bootmap_base + size) > get_effective_memsize())
+ if ((bootmap_base + bootm_size) > get_effective_memsize())
puts("WARNING: bootm_low + bootm_size exceed eff. memory\n");
#endif
- size = min(size, get_effective_memsize());
+ size = min(bootm_size, get_effective_memsize());
size = min(size, CFG_LINUX_LOWMEM_MAX_SIZE);
- if (size < getenv_bootm_size()) {
+ if (size < bootm_size) {
ulong base = bootmap_base + size;
printf("WARNING: adjusting available memory to %x\n", size);
- lmb_reserve(lmb, base, getenv_bootm_size() - size);
+ lmb_reserve(lmb, base, bootm_size - size);
}
/*
/* find kernel entry point */
if (images->legacy_hdr_valid) {
- ep = image_get_ep (images->legacy_hdr_os);
+ ep = image_get_ep (&images->legacy_hdr_os_copy);
#if defined(CONFIG_FIT)
} else if (images->fit_uname_os) {
- fit_unsupported_reset ("PPC linux bootm");
- goto error;
+ ret = fit_image_get_entry (images->fit_hdr_os,
+ images->fit_noffset_os, &ep);
+ if (ret) {
+ puts ("Can't get entry point property!\n");
+ goto error;
+ }
#endif
} else {
puts ("Could not find kernel entry point!\n");
fdt_error ("/chosen node create failed");
goto error;
}
-#ifdef CONFIG_OF_HAS_UBOOT_ENV
- if (fdt_env(of_flat_tree) < 0) {
- fdt_error ("/u-boot-env node create failed");
- goto error;
- }
-#endif
-#ifdef CONFIG_OF_HAS_BD_T
- if (fdt_bd_t(of_flat_tree) < 0) {
- fdt_error ("/bd_t node create failed");
- goto error;
- }
-#endif
#ifdef CONFIG_OF_BOARD_SETUP
/* Call the board-specific fixup routine */
ft_board_setup(of_flat_tree, gd->bd);
kbd->bi_cpmfreq /= 1000000L;
kbd->bi_brgfreq /= 1000000L;
kbd->bi_sccfreq /= 1000000L;
- kbd->bi_vco /= 1000000L;
+ kbd->bi_vco /= 1000000L;
#endif
#if defined(CONFIG_MPC5xxx)
kbd->bi_ipbfreq /= 1000000L;
ulong image_start, image_end;
ulong load_start, load_end;
#if defined(CONFIG_FIT)
- void *fit_hdr;
- const char *fit_uname_config = NULL;
- const char *fit_uname_fdt = NULL;
+ void *fit_hdr;
+ const char *fit_uname_config = NULL;
+ const char *fit_uname_fdt = NULL;
ulong default_addr;
- int conf_noffset;
+ int cfg_noffset;
int fdt_noffset;
const void *data;
size_t size;
*of_flat_tree = NULL;
*of_size = 0;
- if (argc > 3) {
+ if (argc > 3 || genimg_has_config (images)) {
#if defined(CONFIG_FIT)
- /*
- * If the FDT blob comes from the FIT image and the FIT image
- * address is omitted in the command line argument, try to use
- * ramdisk or os FIT image address or default load address.
- */
- if (images->fit_uname_rd)
- default_addr = (ulong)images->fit_hdr_rd;
- else if (images->fit_uname_os)
- default_addr = (ulong)images->fit_hdr_os;
- else
- default_addr = load_addr;
-
- if (fit_parse_conf (argv[3], default_addr,
- &fdt_addr, &fit_uname_config)) {
- debug ("* fdt: config '%s' from image at 0x%08lx\n",
- fit_uname_config, fdt_addr);
- } else if (fit_parse_subimage (argv[3], default_addr,
- &fdt_addr, &fit_uname_fdt)) {
- debug ("* fdt: subimage '%s' from image at 0x%08lx\n",
- fit_uname_fdt, fdt_addr);
- } else
+ if (argc > 3) {
+ /*
+ * If the FDT blob comes from the FIT image and the
+ * FIT image address is omitted in the command line
+ * argument, try to use ramdisk or os FIT image
+ * address or default load address.
+ */
+ if (images->fit_uname_rd)
+ default_addr = (ulong)images->fit_hdr_rd;
+ else if (images->fit_uname_os)
+ default_addr = (ulong)images->fit_hdr_os;
+ else
+ default_addr = load_addr;
+
+ if (fit_parse_conf (argv[3], default_addr,
+ &fdt_addr, &fit_uname_config)) {
+ debug ("* fdt: config '%s' from image at 0x%08lx\n",
+ fit_uname_config, fdt_addr);
+ } else if (fit_parse_subimage (argv[3], default_addr,
+ &fdt_addr, &fit_uname_fdt)) {
+ debug ("* fdt: subimage '%s' from image at 0x%08lx\n",
+ fit_uname_fdt, fdt_addr);
+ } else
#endif
- {
- fdt_addr = simple_strtoul(argv[3], NULL, 16);
- debug ("* fdt: cmdline image address = 0x%08lx\n",
- fdt_addr);
+ {
+ fdt_addr = simple_strtoul(argv[3], NULL, 16);
+ debug ("* fdt: cmdline image address = 0x%08lx\n",
+ fdt_addr);
+ }
+#if defined(CONFIG_FIT)
+ } else {
+ /* use FIT configuration provided in first bootm
+ * command argument
+ */
+ fdt_addr = (ulong)images->fit_hdr_os;
+ fit_uname_config = images->fit_uname_cfg;
+ debug ("* fdt: using config '%s' from image at 0x%08lx\n",
+ fit_uname_config, fdt_addr);
+
+ /*
+ * Check whether configuration has FDT blob defined,
+ * if not quit silently.
+ */
+ fit_hdr = (void *)fdt_addr;
+ cfg_noffset = fit_conf_get_node (fit_hdr,
+ fit_uname_config);
+ if (cfg_noffset < 0) {
+ debug ("* fdt: no such config\n");
+ return 0;
+ }
+
+ fdt_noffset = fit_conf_get_fdt_node (fit_hdr,
+ cfg_noffset);
+ if (fdt_noffset < 0) {
+ debug ("* fdt: no fdt in config\n");
+ return 0;
+ }
}
+#endif
debug ("## Checking for 'FDT'/'FDT Image' at %08lx\n",
fdt_addr);
* fit_conf_get_node() will try to
* find default config node
*/
- conf_noffset = fit_conf_get_node (fit_hdr,
+ cfg_noffset = fit_conf_get_node (fit_hdr,
fit_uname_config);
- if (conf_noffset < 0)
+
+ if (cfg_noffset < 0) {
+ fdt_error ("Could not find configuration node\n");
goto error;
+ }
+
+ fit_uname_config = fdt_get_name (fit_hdr,
+ cfg_noffset, NULL);
+ printf (" Using '%s' configuration\n",
+ fit_uname_config);
fdt_noffset = fit_conf_get_fdt_node (fit_hdr,
- conf_noffset);
+ cfg_noffset);
fit_uname_fdt = fit_get_name (fit_hdr,
fdt_noffset, NULL);
} else {
fdt_noffset = fit_image_get_node (fit_hdr,
fit_uname_fdt);
}
- if (fdt_noffset < 0)
+ if (fdt_noffset < 0) {
+ fdt_error ("Could not find subimage node\n");
goto error;
+ }
printf (" Trying '%s' FDT blob subimage\n",
fit_uname_fdt);
/*
* FDT blob
*/
+ fdt_blob = (char *)fdt_addr;
debug ("* fdt: raw FDT blob\n");
printf ("## Flattened Device Tree blob at %08lx\n", fdt_blob);
- fdt_blob = (char *)fdt_addr;
}
break;
default:
printf (" Booting using the fdt blob at 0x%x\n", fdt_blob);
} else if (images->legacy_hdr_valid &&
- image_check_type (images->legacy_hdr_os, IH_TYPE_MULTI)) {
+ image_check_type (&images->legacy_hdr_os_copy, IH_TYPE_MULTI)) {
ulong fdt_data, fdt_len;
goto error;
}
} else {
- fdt_error ("Did not find a Flattened Device Tree "
- "in a legacy multi-component image");
- goto error;
+ debug ("## No Flattened Device Tree\n");
+ return 0;
}
} else {
debug ("## No Flattened Device Tree\n");
ulong of_start;
/* position on a 4K boundary before the alloc_current */
- of_start = lmb_alloc_base(lmb, of_len, 0x1000,
+ of_start = (unsigned long)lmb_alloc_base(lmb, of_len, 0x1000,
(CFG_BOOTMAPSZ + bootmap_base));
if (of_start == 0) {
*of_flat_tree = (char *)of_start;
} else {
*of_flat_tree = fdt_blob;
- lmb_reserve(lmb, (ulong)fdt, of_len);
+ lmb_reserve(lmb, (ulong)working_fdt, of_len);
}
return 0;