diff --git a/arch/ppc/lib/board.c b/arch/ppc/lib/board.c index d306d8e..7a4a580 100644 --- a/arch/ppc/lib/board.c +++ b/arch/ppc/lib/board.c @@ -50,15 +50,15 @@ /***********************************************************************/ static void init_bd(bd_t *bd, ulong bootflag) { -// bd->bi_memstart = CFG_SDRAM_BASE; /* start of DRAM memory */ -// bd->bi_memsize = gd->ram_size; /* size of DRAM memory in bytes */ + bd->bi_memstart = CFG_SDRAM_BASE; /* start of DRAM memory */ +// bd->bi_memsize = gd->ram_size; /* size of DRAM memory in bytes */ /* FIXME */ #ifdef CONFIG_IP860 -// bd->bi_sramstart = SRAM_BASE; /* start of SRAM memory */ -// bd->bi_sramsize = SRAM_SIZE; /* size of SRAM memory */ + bd->bi_sramstart = SRAM_BASE; /* start of SRAM memory */ + bd->bi_sramsize = SRAM_SIZE; /* size of SRAM memory */ #else -// bd->bi_sramstart = 0; /* FIXME */ /* start of SRAM memory */ -// bd->bi_sramsize = 0; /* FIXME */ /* size of SRAM memory */ + bd->bi_sramstart = 0; /* FIXME */ /* start of SRAM memory */ + bd->bi_sramsize = 0; /* FIXME */ /* size of SRAM memory */ #endif #if defined(CONFIG_8xx) || defined(CONFIG_8260) || defined(CONFIG_5xx) || \ @@ -103,23 +103,22 @@ * ************************************************************************ */ + +bd_t *bd; + void board_init_r (ulong end_of_ram) { - bd_t *bd; - char *x; extern void malloc_bin_reloc (void); - asm ("sync ; isync"); + asm ("sync ; isync"); - mem_malloc_init((void *)(end_of_ram - 4096 - CFG_MALLOC_LEN), (void *)(end_of_ram - 4096)); + mem_malloc_init((void *)(end_of_ram - 4096 - CFG_MALLOC_LEN), (void *)(end_of_ram - 4096)); - /* get gd and bd */ - gd = malloc(sizeof(gd_t)); - memset(gd, 0x0, sizeof(gd_t)); - bd = malloc(sizeof(bd_t)); - memset(bd, 0x0, sizeof(bd_t)); + /* get gd and bd */ + bd = malloc(sizeof(bd_t)); + memset(bd, 0x0, sizeof(bd_t)); - gd->bd = bd; + init_bd(bd, 0); /* * Setup trap handlers diff --git a/arch/ppc/lib/ppclinux.c b/arch/ppc/lib/ppclinux.c index 6562860..8ef91a4 100644 --- a/arch/ppc/lib/ppclinux.c +++ b/arch/ppc/lib/ppclinux.c @@ -10,6 +10,8 @@ #ifdef CONFIG_OF_FLAT_TREE #include #endif +extern bd_t *bd; +#define SHOW_BOOT_PROGRESS(x) void __attribute__((noinline)) do_bootm_linux (cmd_tbl_t *cmdtp, int flag, @@ -18,7 +20,6 @@ ulong *len_ptr, int verify) { -#if 0 ulong sp; ulong len, checksum; ulong initrd_start, initrd_end; @@ -76,7 +77,7 @@ debug ("=> set upper limit to 0x%08lX\n", sp); - cmdline = (char *)((sp - CFG_BARGSIZE) & ~0xF); + cmdline = (char *)((sp - CONFIG_CBSIZE) & ~0xF); kbd = (bd_t *)(((ulong)cmdline - sizeof(bd_t)) & ~0xF); if ((s = getenv("bootargs")) == NULL) @@ -87,7 +88,7 @@ cmd_start = (ulong)&cmdline[0]; cmd_end = cmd_start + strlen(cmdline); - *kbd = *(gd->bd); + *kbd = *(bd); #ifdef DEBUG printf ("## cmdline at 0x%08lX ... 0x%08lX\n", cmd_start, cmd_end); @@ -146,7 +147,7 @@ if (ntohl(hdr->ih_magic) != IH_MAGIC) { puts ("Bad Magic Number\n"); SHOW_BOOT_PROGRESS (-10); - do_reset (cmdtp, flag, argc, argv); + do_reset (); } data = (ulong)&header; @@ -158,7 +159,7 @@ if (crc32 (0, (uchar *)data, len) != checksum) { puts ("Bad Header Checksum\n"); SHOW_BOOT_PROGRESS (-11); - do_reset (cmdtp, flag, argc, argv); + do_reset(); } SHOW_BOOT_PROGRESS (10); @@ -195,7 +196,7 @@ if (csum != ntohl(hdr->ih_dcrc)) { puts ("Bad Data CRC\n"); SHOW_BOOT_PROGRESS (-12); - do_reset (cmdtp, flag, argc, argv); + do_reset (); } puts ("OK\n"); } @@ -207,7 +208,7 @@ (hdr->ih_type != IH_TYPE_RAMDISK) ) { puts ("No Linux PPC Ramdisk Image\n"); SHOW_BOOT_PROGRESS (-13); - do_reset (cmdtp, flag, argc, argv); + do_reset (); } /* @@ -247,7 +248,7 @@ hdr = (image_header_t *)of_flat_tree; if (*(ulong *)of_flat_tree == OF_DT_HEADER) { -#ifndef CFG_NO_FLASH +#ifdef CONFIG_OF_FLAT_TREE_FLASH /* FIXME */ if (addr2info((ulong)of_flat_tree) != NULL) of_data = (ulong)of_flat_tree; #endif @@ -464,6 +465,5 @@ (*kernel) ((bd_t *)of_flat_tree, (ulong)kernel, 0, 0, 0); #endif -#endif } diff --git a/common/Kconfig b/common/Kconfig index 9370c23..9ecc869 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -107,6 +107,11 @@ help Enabling this options activates all consoles on startup, so you will get output and a prompt on all consoles simultaneously. + +config OF_FLAT_TREE + bool + prompt "Open Firmware flat device tree support" + endmenu menu "Commands" diff --git a/common/Makefile b/common/Makefile index 01d4542..5aabb80 100644 --- a/common/Makefile +++ b/common/Makefile @@ -20,6 +20,7 @@ obj-$(CONFIG_SIMPLE_READLINE) += readline_simple.o obj-$(CONFIG_GREGORIAN_CALENDER) += date.o obj-y += cmd_fs.o +obj-$(CONFIG_OF_FLAT_TREE) += ft_build.o obj-y += exports.o obj-y += main.o @@ -55,7 +56,6 @@ #obj-y += cmd_fat.o #obj-y += cmd_pci.o #obj-y += cmd_ximg.o -#obj-y += ft_build.o #obj-y += miiphybb.o #obj-y += usb_storage.o #obj-y += circbuf.o diff --git a/common/cmd_boot.c b/common/cmd_boot.c index af549c9..246d3e0 100644 --- a/common/cmd_boot.c +++ b/common/cmd_boot.c @@ -82,7 +82,11 @@ " passing 'arg' as arguments\n") U_BOOT_CMD_END -extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +static int cmd_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +{ + do_reset(); + return 1; +} U_BOOT_CMD_START(reset) .maxargs = CONFIG_MAXARGS, diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 0edaf87..be0f973 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -38,7 +38,6 @@ DECLARE_GLOBAL_DATA_PTR; /*cmd_boot.c*/ - extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); #if (CONFIG_COMMANDS & CFG_CMD_DATE) || defined(CONFIG_TIMESTAMP) #include @@ -332,7 +331,7 @@ (uchar *)data, &len) != 0) { puts ("GUNZIP ERROR - must RESET board to recover\n"); SHOW_BOOT_PROGRESS (-6); - do_reset (cmdtp, flag, argc, argv); + do_reset(); } break; #endif diff --git a/common/console.c b/common/console.c index 270c927..8f8e433 100644 --- a/common/console.c +++ b/common/console.c @@ -175,6 +175,24 @@ return 0; } +void fprintf (int file, const char *fmt, ...) +{ + va_list args; + uint i; + char printbuffer[CFG_PBSIZE]; + + va_start (args, fmt); + + /* For this to work, printbuffer must be larger than + * anything we ever want to print. + */ + i = vsprintf (printbuffer, fmt, args); + va_end (args); + + /* Print the string */ + fputs (file, printbuffer); +} + void printf (const char *fmt, ...) { va_list args; @@ -193,6 +211,7 @@ puts (printbuffer); } + void vprintf (const char *fmt, va_list args) { uint i; diff --git a/common/ft_build.c b/common/ft_build.c index 980e40f..c85082f 100644 --- a/common/ft_build.c +++ b/common/ft_build.c @@ -22,10 +22,10 @@ #include #include #include +#include +#include -#ifdef CONFIG_OF_FLAT_TREE - -#include +#include #include #include @@ -588,4 +588,4 @@ ft_dump_blob(blob); #endif } -#endif + diff --git a/cpu/mpc5xxx/cpu.c b/cpu/mpc5xxx/cpu.c index 6d5ea03..c835269 100644 --- a/cpu/mpc5xxx/cpu.c +++ b/cpu/mpc5xxx/cpu.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -73,8 +74,7 @@ /* ------------------------------------------------------------------------- */ -int -do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +void do_reset (void) { ulong msr; /* Interrupts and MMU off */ @@ -87,9 +87,6 @@ *(vu_long *)(MPC5XXX_GPT0_COUNTER) = 0x0001000f; *(vu_long *)(MPC5XXX_GPT0_ENABLE) = 0x9004; /* wden|ce|timer_ms */ while(1); - - return 1; - } /* ------------------------------------------------------------------------- */ diff --git a/include/asm-ppc/u-boot.h b/include/asm-ppc/u-boot.h index e13361e..30b44e3 100644 --- a/include/asm-ppc/u-boot.h +++ b/include/asm-ppc/u-boot.h @@ -37,19 +37,19 @@ #ifndef __ASSEMBLY__ typedef struct bd_info { -// unsigned long bi_memstart; /* start of DRAM memory */ -// unsigned long bi_memsize; /* size of DRAM memory in bytes */ -// unsigned long bi_flashstart; /* start of FLASH memory */ -// unsigned long bi_flashsize; /* size of FLASH memory */ -// unsigned long bi_flashoffset; /* reserved area for startup monitor */ -// unsigned long bi_sramstart; /* start of SRAM memory */ -// unsigned long bi_sramsize; /* size of SRAM memory */ + unsigned long bi_memstart; /* start of DRAM memory */ + unsigned long bi_memsize; /* size of DRAM memory in bytes */ + unsigned long bi_flashstart; /* start of FLASH memory */ + unsigned long bi_flashsize; /* size of FLASH memory */ + unsigned long bi_flashoffset; /* reserved area for startup monitor */ + unsigned long bi_sramstart; /* start of SRAM memory */ + unsigned long bi_sramsize; /* size of SRAM memory */ #if defined(CONFIG_5xx) || defined(CONFIG_8xx) || defined(CONFIG_8260) \ || defined(CONFIG_E500) || defined(CONFIG_MPC86xx) unsigned long bi_immr_base; /* base of IMMR register */ #endif #if defined(CONFIG_MPC5xxx) -// unsigned long bi_mbar_base; /* base of internal registers */ + unsigned long bi_mbar_base; /* base of internal registers */ #endif #if defined(CONFIG_MPC83XX) unsigned long bi_immrbar; diff --git a/include/common.h b/include/common.h index e6f7d66..68644e0 100644 --- a/include/common.h +++ b/include/common.h @@ -73,6 +73,7 @@ /* * Function Prototypes */ +void do_reset(void); #ifdef CONFIG_SERIAL_SOFTWARE_FIFO void serial_buffered_init (void); diff --git a/lib_generic/vsprintf.c b/lib_generic/vsprintf.c index 2740f2e..5e320f5 100644 --- a/lib_generic/vsprintf.c +++ b/lib_generic/vsprintf.c @@ -15,11 +15,6 @@ #include #include -#if !defined (CONFIG_PANIC_HANG) -#include -/*cmd_boot.c*/ -extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); -#endif unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base) { @@ -379,7 +374,7 @@ #if defined (CONFIG_PANIC_HANG) hang(); #else - udelay (100000); /* allow messages to go out */ - do_reset (NULL, 0, 0, NULL); + udelay(100000); /* allow messages to go out */ + do_reset(); #endif }