Merge with git://www.denx.de/git/u-boot.git

This commit is contained in:
Stefan Roese 2007-08-15 21:11:45 +02:00
commit a44e7a97c8
10 changed files with 176 additions and 178 deletions

View File

@ -1900,7 +1900,7 @@ TQM8560_config: unconfig
######################################################################### #########################################################################
MPC8641HPCN_config: unconfig MPC8641HPCN_config: unconfig
@$(MKCONFIG) $(@:_config=) ppc mpc86xx mpc8641hpcn @$(MKCONFIG) $(@:_config=) ppc mpc86xx mpc8641hpcn freescale
sbc8641d_config: unconfig sbc8641d_config: unconfig
@./mkconfig $(@:_config=) ppc mpc86xx sbc8641d @./mkconfig $(@:_config=) ppc mpc86xx sbc8641d

View File

@ -24,13 +24,14 @@
include $(TOPDIR)/config.mk include $(TOPDIR)/config.mk
ifneq ($(OBJTREE),$(SRCTREE)) ifneq ($(OBJTREE),$(SRCTREE))
$(shell mkdir -p $(obj)../freescale/common) $(shell mkdir -p $(obj)../common)
endif endif
LIB = $(obj)lib$(BOARD).a LIB = $(obj)lib$(BOARD).a
COBJS := $(BOARD).o sys_eeprom.o \ COBJS := $(BOARD).o \
../freescale/common/pixis.o ../common/sys_eeprom.o \
../common/pixis.o
SOBJS := init.o SOBJS := init.o

View File

@ -33,7 +33,7 @@
extern void ft_cpu_setup(void *blob, bd_t *bd); extern void ft_cpu_setup(void *blob, bd_t *bd);
#endif #endif
#include "../freescale/common/pixis.h" #include "../common/pixis.h"
#if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER) #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
extern void ddr_enable_ecc(unsigned int dram_size); extern void ddr_enable_ecc(unsigned int dram_size);

View File

@ -51,7 +51,7 @@ SECTIONS
.text : .text :
{ {
cpu/mpc86xx/start.o (.text) cpu/mpc86xx/start.o (.text)
board/mpc8641hpcn/init.o (.bootpg) board/freescale/mpc8641hpcn/init.o (.bootpg)
cpu/mpc86xx/traps.o (.text) cpu/mpc86xx/traps.o (.text)
cpu/mpc86xx/interrupts.o (.text) cpu/mpc86xx/interrupts.o (.text)
cpu/mpc86xx/cpu_init.o (.text) cpu/mpc86xx/cpu_init.o (.text)

View File

@ -45,10 +45,10 @@
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;
/*cmd_boot.c*/ /*cmd_boot.c*/
extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
#if (CONFIG_COMMANDS & CFG_CMD_DATE) || defined(CONFIG_TIMESTAMP) #if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE)
#include <rtc.h> #include <rtc.h>
#endif #endif
@ -56,13 +56,6 @@ DECLARE_GLOBAL_DATA_PTR;
#include <hush.h> #include <hush.h>
#endif #endif
#ifdef CONFIG_SHOW_BOOT_PROGRESS
# include <status_led.h>
# define SHOW_BOOT_PROGRESS(arg) show_boot_progress(arg)
#else
# define SHOW_BOOT_PROGRESS(arg)
#endif
#ifdef CFG_INIT_RAM_LOCK #ifdef CFG_INIT_RAM_LOCK
#include <asm/cache.h> #include <asm/cache.h>
#endif #endif
@ -89,11 +82,11 @@ int gunzip (void *, int, unsigned char *, unsigned long *);
static void *zalloc(void *, unsigned, unsigned); static void *zalloc(void *, unsigned, unsigned);
static void zfree(void *, void *, unsigned); static void zfree(void *, void *, unsigned);
#if (CONFIG_COMMANDS & CFG_CMD_IMI) #if defined(CONFIG_CMD_IMI)
static int image_info (unsigned long addr); static int image_info (unsigned long addr);
#endif #endif
#if (CONFIG_COMMANDS & CFG_CMD_IMLS) #if defined(CONFIG_CMD_IMLS)
#include <flash.h> #include <flash.h>
extern flash_info_t flash_info[]; /* info for FLASH chips */ extern flash_info_t flash_info[]; /* info for FLASH chips */
static int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); static int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
@ -133,12 +126,12 @@ static void fixup_silent_linux (void);
#endif #endif
static boot_os_Fcn do_bootm_netbsd; static boot_os_Fcn do_bootm_netbsd;
static boot_os_Fcn do_bootm_rtems; static boot_os_Fcn do_bootm_rtems;
#if (CONFIG_COMMANDS & CFG_CMD_ELF) #if defined(CONFIG_CMD_ELF)
static boot_os_Fcn do_bootm_vxworks; static boot_os_Fcn do_bootm_vxworks;
static boot_os_Fcn do_bootm_qnxelf; static boot_os_Fcn do_bootm_qnxelf;
int do_bootvx ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[] ); int do_bootvx ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[] );
int do_bootelf (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[] ); int do_bootelf (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[] );
#endif /* CFG_CMD_ELF */ #endif
#if defined(CONFIG_ARTOS) && defined(CONFIG_PPC) #if defined(CONFIG_ARTOS) && defined(CONFIG_PPC)
static boot_os_Fcn do_bootm_artos; static boot_os_Fcn do_bootm_artos;
#endif #endif
@ -176,7 +169,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
addr = simple_strtoul(argv[1], NULL, 16); addr = simple_strtoul(argv[1], NULL, 16);
} }
SHOW_BOOT_PROGRESS (1); show_boot_progress (1);
printf ("## Booting image at %08lx ...\n", addr); printf ("## Booting image at %08lx ...\n", addr);
/* Copy header so we can blank CRC field for re-calculation */ /* Copy header so we can blank CRC field for re-calculation */
@ -200,11 +193,11 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
#endif /* __I386__ */ #endif /* __I386__ */
{ {
puts ("Bad Magic Number\n"); puts ("Bad Magic Number\n");
SHOW_BOOT_PROGRESS (-1); show_boot_progress (-1);
return 1; return 1;
} }
} }
SHOW_BOOT_PROGRESS (2); show_boot_progress (2);
data = (ulong)&header; data = (ulong)&header;
len = sizeof(image_header_t); len = sizeof(image_header_t);
@ -214,10 +207,10 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
if (crc32 (0, (uchar *)data, len) != checksum) { if (crc32 (0, (uchar *)data, len) != checksum) {
puts ("Bad Header Checksum\n"); puts ("Bad Header Checksum\n");
SHOW_BOOT_PROGRESS (-2); show_boot_progress (-2);
return 1; return 1;
} }
SHOW_BOOT_PROGRESS (3); show_boot_progress (3);
#ifdef CONFIG_HAS_DATAFLASH #ifdef CONFIG_HAS_DATAFLASH
if (addr_dataflash(addr)){ if (addr_dataflash(addr)){
@ -238,12 +231,12 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
puts (" Verifying Checksum ... "); puts (" Verifying Checksum ... ");
if (crc32 (0, (uchar *)data, len) != ntohl(hdr->ih_dcrc)) { if (crc32 (0, (uchar *)data, len) != ntohl(hdr->ih_dcrc)) {
printf ("Bad Data CRC\n"); printf ("Bad Data CRC\n");
SHOW_BOOT_PROGRESS (-3); show_boot_progress (-3);
return 1; return 1;
} }
puts ("OK\n"); puts ("OK\n");
} }
SHOW_BOOT_PROGRESS (4); show_boot_progress (4);
len_ptr = (ulong *)data; len_ptr = (ulong *)data;
@ -272,10 +265,10 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
#endif #endif
{ {
printf ("Unsupported Architecture 0x%x\n", hdr->ih_arch); printf ("Unsupported Architecture 0x%x\n", hdr->ih_arch);
SHOW_BOOT_PROGRESS (-4); show_boot_progress (-4);
return 1; return 1;
} }
SHOW_BOOT_PROGRESS (5); show_boot_progress (5);
switch (hdr->ih_type) { switch (hdr->ih_type) {
case IH_TYPE_STANDALONE: case IH_TYPE_STANDALONE:
@ -297,10 +290,10 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
data += 4; data += 4;
break; break;
default: printf ("Wrong Image Type for %s command\n", cmdtp->name); default: printf ("Wrong Image Type for %s command\n", cmdtp->name);
SHOW_BOOT_PROGRESS (-5); show_boot_progress (-5);
return 1; return 1;
} }
SHOW_BOOT_PROGRESS (6); show_boot_progress (6);
/* /*
* We have reached the point of no return: we are going to * We have reached the point of no return: we are going to
@ -351,7 +344,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
if (gunzip ((void *)ntohl(hdr->ih_load), unc_len, if (gunzip ((void *)ntohl(hdr->ih_load), unc_len,
(uchar *)data, &len) != 0) { (uchar *)data, &len) != 0) {
puts ("GUNZIP ERROR - must RESET board to recover\n"); puts ("GUNZIP ERROR - must RESET board to recover\n");
SHOW_BOOT_PROGRESS (-6); show_boot_progress (-6);
do_reset (cmdtp, flag, argc, argv); do_reset (cmdtp, flag, argc, argv);
} }
break; break;
@ -368,8 +361,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
CFG_MALLOC_LEN < (4096 * 1024), 0); CFG_MALLOC_LEN < (4096 * 1024), 0);
if (i != BZ_OK) { if (i != BZ_OK) {
printf ("BUNZIP2 ERROR %d - must RESET board to recover\n", i); printf ("BUNZIP2 ERROR %d - must RESET board to recover\n", i);
SHOW_BOOT_PROGRESS (-6); show_boot_progress (-6);
udelay(100000);
do_reset (cmdtp, flag, argc, argv); do_reset (cmdtp, flag, argc, argv);
} }
break; break;
@ -378,11 +370,11 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
if (iflag) if (iflag)
enable_interrupts(); enable_interrupts();
printf ("Unimplemented compression type %d\n", hdr->ih_comp); printf ("Unimplemented compression type %d\n", hdr->ih_comp);
SHOW_BOOT_PROGRESS (-7); show_boot_progress (-7);
return 1; return 1;
} }
puts ("OK\n"); puts ("OK\n");
SHOW_BOOT_PROGRESS (7); show_boot_progress (7);
switch (hdr->ih_type) { switch (hdr->ih_type) {
case IH_TYPE_STANDALONE: case IH_TYPE_STANDALONE:
@ -409,10 +401,10 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
if (iflag) if (iflag)
enable_interrupts(); enable_interrupts();
printf ("Can't boot image type %d\n", hdr->ih_type); printf ("Can't boot image type %d\n", hdr->ih_type);
SHOW_BOOT_PROGRESS (-8); show_boot_progress (-8);
return 1; return 1;
} }
SHOW_BOOT_PROGRESS (8); show_boot_progress (8);
switch (hdr->ih_os) { switch (hdr->ih_os) {
default: /* handled by (original) Linux case */ default: /* handled by (original) Linux case */
@ -440,7 +432,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
addr, len_ptr, verify); addr, len_ptr, verify);
break; break;
#if (CONFIG_COMMANDS & CFG_CMD_ELF) #if defined(CONFIG_CMD_ELF)
case IH_OS_VXWORKS: case IH_OS_VXWORKS:
do_bootm_vxworks (cmdtp, flag, argc, argv, do_bootm_vxworks (cmdtp, flag, argc, argv,
addr, len_ptr, verify); addr, len_ptr, verify);
@ -449,7 +441,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
do_bootm_qnxelf (cmdtp, flag, argc, argv, do_bootm_qnxelf (cmdtp, flag, argc, argv,
addr, len_ptr, verify); addr, len_ptr, verify);
break; break;
#endif /* CFG_CMD_ELF */ #endif
#ifdef CONFIG_ARTOS #ifdef CONFIG_ARTOS
case IH_OS_ARTOS: case IH_OS_ARTOS:
do_bootm_artos (cmdtp, flag, argc, argv, do_bootm_artos (cmdtp, flag, argc, argv,
@ -458,7 +450,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
#endif #endif
} }
SHOW_BOOT_PROGRESS (-9); show_boot_progress (-9);
#ifdef DEBUG #ifdef DEBUG
puts ("\n## Control returned to monitor - resetting...\n"); puts ("\n## Control returned to monitor - resetting...\n");
do_reset (cmdtp, flag, argc, argv); do_reset (cmdtp, flag, argc, argv);
@ -637,7 +629,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
#endif #endif
if (argc >= 3) { if (argc >= 3) {
debug ("Not skipping initrd\n"); debug ("Not skipping initrd\n");
SHOW_BOOT_PROGRESS (9); show_boot_progress (9);
addr = simple_strtoul(argv[2], NULL, 16); addr = simple_strtoul(argv[2], NULL, 16);
@ -648,7 +640,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
if (ntohl(hdr->ih_magic) != IH_MAGIC) { if (ntohl(hdr->ih_magic) != IH_MAGIC) {
puts ("Bad Magic Number\n"); puts ("Bad Magic Number\n");
SHOW_BOOT_PROGRESS (-10); show_boot_progress (-10);
do_reset (cmdtp, flag, argc, argv); do_reset (cmdtp, flag, argc, argv);
} }
@ -660,11 +652,11 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
if (crc32 (0, (uchar *)data, len) != checksum) { if (crc32 (0, (uchar *)data, len) != checksum) {
puts ("Bad Header Checksum\n"); puts ("Bad Header Checksum\n");
SHOW_BOOT_PROGRESS (-11); show_boot_progress (-11);
do_reset (cmdtp, flag, argc, argv); do_reset (cmdtp, flag, argc, argv);
} }
SHOW_BOOT_PROGRESS (10); show_boot_progress (10);
print_image_hdr (hdr); print_image_hdr (hdr);
@ -697,19 +689,19 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
if (csum != ntohl(hdr->ih_dcrc)) { if (csum != ntohl(hdr->ih_dcrc)) {
puts ("Bad Data CRC\n"); puts ("Bad Data CRC\n");
SHOW_BOOT_PROGRESS (-12); show_boot_progress (-12);
do_reset (cmdtp, flag, argc, argv); do_reset (cmdtp, flag, argc, argv);
} }
puts ("OK\n"); puts ("OK\n");
} }
SHOW_BOOT_PROGRESS (11); show_boot_progress (11);
if ((hdr->ih_os != IH_OS_LINUX) || if ((hdr->ih_os != IH_OS_LINUX) ||
(hdr->ih_arch != IH_CPU_PPC) || (hdr->ih_arch != IH_CPU_PPC) ||
(hdr->ih_type != IH_TYPE_RAMDISK) ) { (hdr->ih_type != IH_TYPE_RAMDISK) ) {
puts ("No Linux PPC Ramdisk Image\n"); puts ("No Linux PPC Ramdisk Image\n");
SHOW_BOOT_PROGRESS (-13); show_boot_progress (-13);
do_reset (cmdtp, flag, argc, argv); do_reset (cmdtp, flag, argc, argv);
} }
@ -720,7 +712,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
u_long tail = ntohl(len_ptr[0]) % 4; u_long tail = ntohl(len_ptr[0]) % 4;
int i; int i;
SHOW_BOOT_PROGRESS (13); show_boot_progress (13);
/* skip kernel length and terminator */ /* skip kernel length and terminator */
data = (ulong)(&len_ptr[2]); data = (ulong)(&len_ptr[2]);
@ -739,7 +731,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
/* /*
* no initrd image * no initrd image
*/ */
SHOW_BOOT_PROGRESS (14); show_boot_progress (14);
len = data = 0; len = data = 0;
} }
@ -748,59 +740,65 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
if(argc > 3) { if(argc > 3) {
of_flat_tree = (char *) simple_strtoul(argv[3], NULL, 16); of_flat_tree = (char *) simple_strtoul(argv[3], NULL, 16);
hdr = (image_header_t *)of_flat_tree; hdr = (image_header_t *)of_flat_tree;
#if defined(CONFIG_OF_LIBFDT) #if defined(CONFIG_OF_FLAT_TREE)
if (fdt_check_header(of_flat_tree) == 0) { if (*((ulong *)(of_flat_tree + sizeof(image_header_t))) != OF_DT_HEADER) {
#else #else
if (*(ulong *)of_flat_tree == OF_DT_HEADER) { if (fdt_check_header(of_flat_tree + sizeof(image_header_t)) != 0) {
#endif #endif
#ifndef CFG_NO_FLASH #ifndef CFG_NO_FLASH
if (addr2info((ulong)of_flat_tree) != NULL) if (addr2info((ulong)of_flat_tree) != NULL)
of_data = (ulong)of_flat_tree; of_data = (ulong)of_flat_tree;
#endif #endif
} else if (ntohl(hdr->ih_magic) == IH_MAGIC) { } else if (ntohl(hdr->ih_magic) == IH_MAGIC) {
printf("## Flat Device Tree Image at %08lX\n", hdr); printf("## Flat Device Tree at %08lX\n", hdr);
print_image_hdr(hdr); print_image_hdr(hdr);
if ((ntohl(hdr->ih_load) < ((unsigned long)hdr + ntohl(hdr->ih_size) + sizeof(hdr))) && if ((ntohl(hdr->ih_load) < ((unsigned long)hdr + ntohl(hdr->ih_size) + sizeof(hdr))) &&
((ntohl(hdr->ih_load) + ntohl(hdr->ih_size)) > (unsigned long)hdr)) { ((ntohl(hdr->ih_load) + ntohl(hdr->ih_size)) > (unsigned long)hdr)) {
printf ("ERROR: Load address overwrites Flat Device Tree uImage\n"); puts ("ERROR: fdt overwritten - "
return; "must RESET the board to recover.\n");
do_reset (cmdtp, flag, argc, argv);
} }
printf(" Verifying Checksum ... "); puts (" Verifying Checksum ... ");
memmove (&header, (char *)hdr, sizeof(image_header_t)); memmove (&header, (char *)hdr, sizeof(image_header_t));
checksum = ntohl(header.ih_hcrc); checksum = ntohl(header.ih_hcrc);
header.ih_hcrc = 0; header.ih_hcrc = 0;
if(checksum != crc32(0, (uchar *)&header, sizeof(image_header_t))) { if(checksum != crc32(0, (uchar *)&header, sizeof(image_header_t))) {
printf("ERROR: Flat Device Tree header checksum is invalid\n"); puts ("ERROR: fdt header checksum invalid - "
return; "must RESET the board to recover.\n");
do_reset (cmdtp, flag, argc, argv);
} }
checksum = ntohl(hdr->ih_dcrc); checksum = ntohl(hdr->ih_dcrc);
addr = (ulong)((uchar *)(hdr) + sizeof(image_header_t)); addr = (ulong)((uchar *)(hdr) + sizeof(image_header_t));
if(checksum != crc32(0, (uchar *)addr, ntohl(hdr->ih_size))) { if(checksum != crc32(0, (uchar *)addr, ntohl(hdr->ih_size))) {
printf("ERROR: Flat Device Tree checksum is invalid\n"); puts ("ERROR: fdt checksum invalid - "
return; "must RESET the board to recover.\n");
do_reset (cmdtp, flag, argc, argv);
} }
printf("OK\n"); puts ("OK\n");
if (ntohl(hdr->ih_type) != IH_TYPE_FLATDT) { if (ntohl(hdr->ih_type) != IH_TYPE_FLATDT) {
printf ("ERROR: uImage not Flat Device Tree type\n"); puts ("ERROR: uImage is not a fdt - "
return; "must RESET the board to recover.\n");
do_reset (cmdtp, flag, argc, argv);
} }
if (ntohl(hdr->ih_comp) != IH_COMP_NONE) { if (ntohl(hdr->ih_comp) != IH_COMP_NONE) {
printf("ERROR: uImage is not uncompressed\n"); puts ("ERROR: uImage is compressed - "
return; "must RESET the board to recover.\n");
do_reset (cmdtp, flag, argc, argv);
} }
#if defined(CONFIG_OF_LIBFDT) #if defined(CONFIG_OF_FLAT_TREE)
if (fdt_check_header(of_flat_tree + sizeof(image_header_t)) == 0) {
#else
if (*((ulong *)(of_flat_tree + sizeof(image_header_t))) != OF_DT_HEADER) { if (*((ulong *)(of_flat_tree + sizeof(image_header_t))) != OF_DT_HEADER) {
#else
if (fdt_check_header(of_flat_tree + sizeof(image_header_t)) != 0) {
#endif #endif
printf ("ERROR: uImage data is not a flat device tree\n"); puts ("ERROR: uImage data is not a fdt - "
return; "must RESET the board to recover.\n");
do_reset (cmdtp, flag, argc, argv);
} }
memmove((void *)ntohl(hdr->ih_load), memmove((void *)ntohl(hdr->ih_load),
@ -808,10 +806,11 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
ntohl(hdr->ih_size)); ntohl(hdr->ih_size));
of_flat_tree = (char *)ntohl(hdr->ih_load); of_flat_tree = (char *)ntohl(hdr->ih_load);
} else { } else {
printf ("Did not find a flat flat device tree at address %08lX\n", of_flat_tree); puts ("Did not find a flat Flat Device Tree.\n"
return; "Must RESET the board to recover.\n");
do_reset (cmdtp, flag, argc, argv);
} }
printf (" Booting using flat device tree at 0x%x\n", printf (" Booting using the fdt at 0x%x\n",
of_flat_tree); of_flat_tree);
} else if ((hdr->ih_type==IH_TYPE_MULTI) && (len_ptr[1]) && (len_ptr[2])) { } else if ((hdr->ih_type==IH_TYPE_MULTI) && (len_ptr[1]) && (len_ptr[2])) {
u_long tail = ntohl(len_ptr[0]) % 4; u_long tail = ntohl(len_ptr[0]) % 4;
@ -835,22 +834,24 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
of_data += 4 - tail; of_data += 4 - tail;
} }
#if defined(CONFIG_OF_LIBFDT) #if defined(CONFIG_OF_FLAT_TREE)
if (fdt_check_header((void *)of_data) != 0) { if (*((ulong *)(of_flat_tree + sizeof(image_header_t))) != OF_DT_HEADER) {
#else #else
if (((struct boot_param_header *)of_data)->magic != OF_DT_HEADER) { if (fdt_check_header(of_flat_tree + sizeof(image_header_t)) != 0) {
#endif #endif
printf ("ERROR: image is not a flat device tree\n"); puts ("ERROR: image is not a fdt - "
return; "must RESET the board to recover.\n");
do_reset (cmdtp, flag, argc, argv);
} }
#if defined(CONFIG_OF_LIBFDT) #if defined(CONFIG_OF_FLAT_TREE)
if (be32_to_cpu(fdt_totalsize(of_data)) != ntohl(len_ptr[2])) {
#else
if (((struct boot_param_header *)of_data)->totalsize != ntohl(len_ptr[2])) { if (((struct boot_param_header *)of_data)->totalsize != ntohl(len_ptr[2])) {
#else
if (be32_to_cpu(fdt_totalsize(of_data)) != ntohl(len_ptr[2])) {
#endif #endif
printf ("ERROR: flat device tree size does not agree with image\n"); puts ("ERROR: fdt size != image size - "
return; "must RESET the board to recover.\n");
do_reset (cmdtp, flag, argc, argv);
} }
} }
#endif #endif
@ -890,7 +891,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
initrd_start = nsp; initrd_start = nsp;
} }
SHOW_BOOT_PROGRESS (12); show_boot_progress (12);
debug ("## initrd at 0x%08lX ... 0x%08lX (len=%ld=0x%lX)\n", debug ("## initrd at 0x%08lX ... 0x%08lX (len=%ld=0x%lX)\n",
data, data + len - 1, len, len); data, data + len - 1, len, len);
@ -923,27 +924,26 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
initrd_end = 0; initrd_end = 0;
} }
debug ("## Transferring control to Linux (at address %08lx) ...\n", #if defined(CONFIG_OF_LIBFDT)
(ulong)kernel);
SHOW_BOOT_PROGRESS (15); #ifdef CFG_BOOTMAPSZ
/*
#if defined(CFG_INIT_RAM_LOCK) && !defined(CONFIG_E500) * The blob must be within CFG_BOOTMAPSZ,
unlock_ram_in_cache(); * so we flag it to be copied if it is not.
*/
if (of_flat_tree >= (char *)CFG_BOOTMAPSZ)
of_data = of_flat_tree;
#endif #endif
#if defined(CONFIG_OF_LIBFDT)
/* move of_flat_tree if needed */ /* move of_flat_tree if needed */
if (of_data) { if (of_data) {
int err; int err;
ulong of_start, of_len; ulong of_start, of_len;
of_len = be32_to_cpu(fdt_totalsize(of_data)); of_len = be32_to_cpu(fdt_totalsize(of_data));
/* position on a 4K boundary before the initrd/kbd */
if (initrd_start) /* position on a 4K boundary before the kbd */
of_start = initrd_start - of_len; of_start = (ulong)kbd - of_len;
else
of_start = (ulong)kbd - of_len;
of_start &= ~(4096 - 1); /* align on page */ of_start &= ~(4096 - 1); /* align on page */
debug ("## device tree at 0x%08lX ... 0x%08lX (len=%ld=0x%lX)\n", debug ("## device tree at 0x%08lX ... 0x%08lX (len=%ld=0x%lX)\n",
of_data, of_data + of_len - 1, of_len, of_len); of_data, of_data + of_len - 1, of_len, of_len);
@ -951,42 +951,49 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
of_flat_tree = (char *)of_start; of_flat_tree = (char *)of_start;
printf (" Loading Device Tree to %08lx, end %08lx ... ", printf (" Loading Device Tree to %08lx, end %08lx ... ",
of_start, of_start + of_len - 1); of_start, of_start + of_len - 1);
err = fdt_open_into((void *)of_start, (void *)of_data, of_len); err = fdt_open_into((void *)of_data, (void *)of_start, of_len);
if (err != 0) { if (err != 0) {
printf ("libfdt: %s " __FILE__ " %d\n", fdt_strerror(err), __LINE__); puts ("ERROR: fdt move failed - "
} "must RESET the board to recover.\n");
/* do_reset (cmdtp, flag, argc, argv);
* Add the chosen node if it doesn't exist, add the env and bd_t
* if the user wants it (the logic is in the subroutines).
*/
if (fdt_chosen(of_flat_tree, initrd_start, initrd_end, 0) < 0) {
printf("Failed creating the /chosen node (0x%08X), aborting.\n", of_flat_tree);
return;
} }
}
/*
* Add the chosen node if it doesn't exist, add the env and bd_t
* if the user wants it (the logic is in the subroutines).
*/
if (fdt_chosen(of_flat_tree, initrd_start, initrd_end, 0) < 0) {
puts ("ERROR: /chosen node create failed - "
"must RESET the board to recover.\n");
do_reset (cmdtp, flag, argc, argv);
}
#ifdef CONFIG_OF_HAS_UBOOT_ENV #ifdef CONFIG_OF_HAS_UBOOT_ENV
if (fdt_env(of_flat_tree) < 0) { if (fdt_env(of_flat_tree) < 0) {
printf("Failed creating the /u-boot-env node, aborting.\n"); puts ("ERROR: /u-boot-env node create failed - "
return; "must RESET the board to recover.\n");
} do_reset (cmdtp, flag, argc, argv);
#endif
#ifdef CONFIG_OF_HAS_BD_T
if (fdt_bd_t(of_flat_tree) < 0) {
printf("Failed creating the /bd_t node, aborting.\n");
return;
}
#endif
} }
#endif #endif
#ifdef CONFIG_OF_HAS_BD_T
if (fdt_bd_t(of_flat_tree) < 0) {
puts ("ERROR: /bd_t node create failed - "
"must RESET the board to recover.\n");
do_reset (cmdtp, flag, argc, argv);
}
#endif
#ifdef CONFIG_OF_BOARD_SETUP
/* Call the board-specific fixup routine */
ft_board_setup(of_flat_tree, gd->bd);
#endif
#endif /* CONFIG_OF_LIBFDT */
#if defined(CONFIG_OF_FLAT_TREE) #if defined(CONFIG_OF_FLAT_TREE)
/* move of_flat_tree if needed */ /* move of_flat_tree if needed */
if (of_data) { if (of_data) {
ulong of_start, of_len; ulong of_start, of_len;
of_len = ((struct boot_param_header *)of_data)->totalsize; of_len = ((struct boot_param_header *)of_data)->totalsize;
/* provide extra 8k pad */ /* provide extra 8k pad */
if (initrd_start) of_start = (ulong)kbd - of_len - 8192;
of_start = initrd_start - of_len - 8192;
else
of_start = (ulong)kbd - of_len - 8192;
of_start &= ~(4096 - 1); /* align on page */ of_start &= ~(4096 - 1); /* align on page */
debug ("## device tree at 0x%08lX ... 0x%08lX (len=%ld=0x%lX)\n", debug ("## device tree at 0x%08lX ... 0x%08lX (len=%ld=0x%lX)\n",
of_data, of_data + of_len - 1, of_len, of_len); of_data, of_data + of_len - 1, of_len, of_len);
@ -996,8 +1003,36 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
of_start, of_start + of_len - 1); of_start, of_start + of_len - 1);
memmove ((void *)of_start, (void *)of_data, of_len); memmove ((void *)of_start, (void *)of_data, of_len);
} }
/*
* Create the /chosen node and modify the blob with board specific
* values as needed.
*/
ft_setup(of_flat_tree, kbd, initrd_start, initrd_end);
/* ft_dump_blob(of_flat_tree); */
#endif
debug ("## Transferring control to Linux (at address %08lx) ...\n",
(ulong)kernel);
show_boot_progress (15);
#if defined(CFG_INIT_RAM_LOCK) && !defined(CONFIG_E500)
unlock_ram_in_cache();
#endif #endif
#if defined(CONFIG_OF_FLAT_TREE) || defined(CONFIG_OF_LIBFDT)
if (of_flat_tree) { /* device tree; boot new style */
/*
* Linux Kernel Parameters (passing device tree):
* r3: pointer to the fdt, followed by the board info data
* r4: physical pointer to the kernel itself
* r5: NULL
* r6: NULL
* r7: NULL
*/
(*kernel) ((bd_t *)of_flat_tree, (ulong)kernel, 0, 0, 0);
/* does not return */
}
#endif
/* /*
* Linux Kernel Parameters (passing board info data): * Linux Kernel Parameters (passing board info data):
* r3: ptr to board info data * r3: ptr to board info data
@ -1006,46 +1041,8 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
* r6: Start of command line string * r6: Start of command line string
* r7: End of command line string * r7: End of command line string
*/ */
#if defined(CONFIG_OF_FLAT_TREE) || defined(CONFIG_OF_LIBFDT) (*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end);
if (!of_flat_tree) /* no device tree; boot old style */ /* does not return */
#endif
(*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end);
/* does not return */
#if defined(CONFIG_OF_FLAT_TREE) || defined(CONFIG_OF_LIBFDT)
/*
* Linux Kernel Parameters (passing device tree):
* r3: ptr to OF flat tree, followed by the board info data
* r4: physical pointer to the kernel itself
* r5: NULL
* r6: NULL
* r7: NULL
*/
#if defined(CONFIG_OF_FLAT_TREE)
ft_setup(of_flat_tree, kbd, initrd_start, initrd_end);
/* ft_dump_blob(of_flat_tree); */
#endif
#if defined(CONFIG_OF_LIBFDT)
if (fdt_chosen(of_flat_tree, initrd_start, initrd_end, 0) < 0) {
printf("Failed creating the /chosen node (0x%08X), aborting.\n", of_flat_tree);
return;
}
#ifdef CONFIG_OF_HAS_UBOOT_ENV
if (fdt_env(of_flat_tree) < 0) {
printf("Failed creating the /u-boot-env node, aborting.\n");
return;
}
#endif
#ifdef CONFIG_OF_HAS_BD_T
if (fdt_bd_t(of_flat_tree) < 0) {
printf("Failed creating the /bd_t node, aborting.\n");
return;
}
#endif
#endif /* if defined(CONFIG_OF_LIBFDT) */
(*kernel) ((bd_t *)of_flat_tree, (ulong)kernel, 0, 0, 0);
#endif
} }
#endif /* CONFIG_PPC */ #endif /* CONFIG_PPC */
@ -1115,7 +1112,7 @@ do_bootm_netbsd (cmd_tbl_t *cmdtp, int flag,
printf ("## Transferring control to NetBSD stage-2 loader (at address %08lx) ...\n", printf ("## Transferring control to NetBSD stage-2 loader (at address %08lx) ...\n",
(ulong)loader); (ulong)loader);
SHOW_BOOT_PROGRESS (15); show_boot_progress (15);
/* /*
* NetBSD Stage-2 Loader Parameters: * NetBSD Stage-2 Loader Parameters:
@ -1219,7 +1216,7 @@ do_bootm_artos (cmd_tbl_t *cmdtp, int flag,
#endif #endif
#if (CONFIG_COMMANDS & CFG_CMD_BOOTD) #if defined(CONFIG_CMD_BOOTD)
int do_bootd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) int do_bootd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{ {
int rcode = 0; int rcode = 0;
@ -1247,7 +1244,7 @@ U_BOOT_CMD(
#endif #endif
#if (CONFIG_COMMANDS & CFG_CMD_IMI) #if defined(CONFIG_CMD_IMI)
int do_iminfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) int do_iminfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{ {
int arg; int arg;
@ -1315,9 +1312,9 @@ U_BOOT_CMD(
" image contents (magic number, header and payload checksums)\n" " image contents (magic number, header and payload checksums)\n"
); );
#endif /* CFG_CMD_IMI */ #endif
#if (CONFIG_COMMANDS & CFG_CMD_IMLS) #if defined(CONFIG_CMD_IMLS)
/*----------------------------------------------------------------------- /*-----------------------------------------------------------------------
* List all images found in flash. * List all images found in flash.
*/ */
@ -1373,23 +1370,23 @@ U_BOOT_CMD(
" - Prints information about all images found at sector\n" " - Prints information about all images found at sector\n"
" boundaries in flash.\n" " boundaries in flash.\n"
); );
#endif /* CFG_CMD_IMLS */ #endif
void void
print_image_hdr (image_header_t *hdr) print_image_hdr (image_header_t *hdr)
{ {
#if (CONFIG_COMMANDS & CFG_CMD_DATE) || defined(CONFIG_TIMESTAMP) #if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE)
time_t timestamp = (time_t)ntohl(hdr->ih_time); time_t timestamp = (time_t)ntohl(hdr->ih_time);
struct rtc_time tm; struct rtc_time tm;
#endif #endif
printf (" Image Name: %.*s\n", IH_NMLEN, hdr->ih_name); printf (" Image Name: %.*s\n", IH_NMLEN, hdr->ih_name);
#if (CONFIG_COMMANDS & CFG_CMD_DATE) || defined(CONFIG_TIMESTAMP) #if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE)
to_tm (timestamp, &tm); to_tm (timestamp, &tm);
printf (" Created: %4d-%02d-%02d %2d:%02d:%02d UTC\n", printf (" Created: %4d-%02d-%02d %2d:%02d:%02d UTC\n",
tm.tm_year, tm.tm_mon, tm.tm_mday, tm.tm_year, tm.tm_mon, tm.tm_mday,
tm.tm_hour, tm.tm_min, tm.tm_sec); tm.tm_hour, tm.tm_min, tm.tm_sec);
#endif /* CFG_CMD_DATE, CONFIG_TIMESTAMP */ #endif
puts (" Image Type: "); print_type(hdr); puts (" Image Type: "); print_type(hdr);
printf ("\n Data Size: %d Bytes = ", ntohl(hdr->ih_size)); printf ("\n Data Size: %d Bytes = ", ntohl(hdr->ih_size));
print_size (ntohl(hdr->ih_size), "\n"); print_size (ntohl(hdr->ih_size), "\n");
@ -1578,7 +1575,7 @@ do_bootm_rtems (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
printf ("## Transferring control to RTEMS (at address %08lx) ...\n", printf ("## Transferring control to RTEMS (at address %08lx) ...\n",
(ulong)entry_point); (ulong)entry_point);
SHOW_BOOT_PROGRESS (15); show_boot_progress (15);
/* /*
* RTEMS Parameters: * RTEMS Parameters:
@ -1588,7 +1585,7 @@ do_bootm_rtems (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
(*entry_point ) ( gd->bd ); (*entry_point ) ( gd->bd );
} }
#if (CONFIG_COMMANDS & CFG_CMD_ELF) #if defined(CONFIG_CMD_ELF)
static void static void
do_bootm_vxworks (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], do_bootm_vxworks (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
ulong addr, ulong *len_ptr, int verify) ulong addr, ulong *len_ptr, int verify)
@ -1614,7 +1611,7 @@ do_bootm_qnxelf (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
local_args[1] = str; /* and provide it via the arguments */ local_args[1] = str; /* and provide it via the arguments */
do_bootelf(cmdtp, 0, 2, local_args); do_bootelf(cmdtp, 0, 2, local_args);
} }
#endif /* CFG_CMD_ELF */ #endif
#ifdef CONFIG_LYNXKDI #ifdef CONFIG_LYNXKDI
static void static void

View File

@ -492,7 +492,7 @@
#define CFG_LOAD_ADDR 0x2000000 /* default load address */ #define CFG_LOAD_ADDR 0x2000000 /* default load address */
#define CFG_PROMPT "=> " /* Monitor Command Prompt */ #define CFG_PROMPT "=> " /* Monitor Command Prompt */
#if (CONFIG_COMMANDS & CFG_CMD_KGDB) #if defined(CONFIG_CMD_KGDB)
#define CFG_CBSIZE 1024 /* Console I/O Buffer Size */ #define CFG_CBSIZE 1024 /* Console I/O Buffer Size */
#else #else
#define CFG_CBSIZE 256 /* Console I/O Buffer Size */ #define CFG_CBSIZE 256 /* Console I/O Buffer Size */
@ -513,7 +513,7 @@
/* Cache Configuration */ /* Cache Configuration */
#define CFG_DCACHE_SIZE 32768 #define CFG_DCACHE_SIZE 32768
#define CFG_CACHELINE_SIZE 32 #define CFG_CACHELINE_SIZE 32
#if (CONFIG_COMMANDS & CFG_CMD_KGDB) #if defined(CONFIG_CMD_KGDB)
#define CFG_CACHELINE_SHIFT 5 /*log base 2 of the above value*/ #define CFG_CACHELINE_SHIFT 5 /*log base 2 of the above value*/
#endif #endif
@ -525,7 +525,7 @@
#define BOOTFLAG_COLD 0x01 /* Normal Power-On: Boot from FLASH */ #define BOOTFLAG_COLD 0x01 /* Normal Power-On: Boot from FLASH */
#define BOOTFLAG_WARM 0x02 /* Software reboot */ #define BOOTFLAG_WARM 0x02 /* Software reboot */
#if (CONFIG_COMMANDS & CFG_CMD_KGDB) #if defined(CONFIG_CMD_KGDB)
#define CONFIG_KGDB_BAUDRATE 230400 /* speed to run kgdb serial port */ #define CONFIG_KGDB_BAUDRATE 230400 /* speed to run kgdb serial port */
#define CONFIG_KGDB_SER_INDEX 2 /* which serial port to use */ #define CONFIG_KGDB_SER_INDEX 2 /* which serial port to use */
#endif #endif

View File

@ -614,4 +614,4 @@ static void parse_multicast_oack(char *pkt, int len)
#endif /* Multicast TFTP */ #endif /* Multicast TFTP */
#endif /* CFG_CMD_NET */ #endif