From: wdenk Date: Sun, 8 Sep 2002 22:44:00 +0000 (+0000) Subject: ARMBoot merge X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=de86c8f0cc741fedce6bd2db311c363695263a3a;p=users%2Frw%2Fppcboot.git ARMBoot merge --- diff --git a/MAKEALL b/MAKEALL index 290a7ef..3a49185 100755 --- a/MAKEALL +++ b/MAKEALL @@ -96,7 +96,7 @@ LIST_ARM7="impa7 ep7312" ## ARM9 Systems ######################################################################### -LIST_ARM9="cmdk2400 smdk2410" +LIST_ARM9="smdk2400 smdk2410" LIST_arm="${LIST_SA} ${LIST_ARM7} ${LIST_ARM9}" @@ -121,7 +121,7 @@ build_target() { for arg in $@ do case "$arg" in - 8xx|824x|8260|4xx|7xx|74xx) + 8xx|824x|8260|4xx|7xx|74xx|SA|ARM7|ARM9) for target in `eval echo '$LIST_'${arg}` do build_target ${target} diff --git a/Makefile b/Makefile index 0fc0303..c8956f9 100644 --- a/Makefile +++ b/Makefile @@ -109,12 +109,12 @@ endif LIBS = board/$(BOARDDIR)/lib$(BOARD).a LIBS += cpu/$(CPU)/lib$(CPU).a LIBS += lib_$(ARCH)/lib$(ARCH).a -LIBS += drivers/libdrivers.a LIBS += fs/jffs2/libjffs2.a LIBS += net/libnet.a LIBS += disk/libdisk.a LIBS += rtc/librtc.a LIBS += dtt/libdtt.a +LIBS += drivers/libdrivers.a LIBS += common/libcommon.a LIBS += lib_generic/libgeneric.a diff --git a/board/cpu86/flash.c b/board/cpu86/flash.c index 5fac05e..f4fbc2d 100644 --- a/board/cpu86/flash.c +++ b/board/cpu86/flash.c @@ -193,15 +193,15 @@ unsigned long flash_init (void) printf("("); - if (size_b0 > 0) - printf("Bank#1 - %ld MB", size_b0 >> 20); - - if (size_b1 > 0) - printf("%sBank#2 - %ld kB", - (size_b0 > 0) ? ", " : "", - size_b1 >> 10); + if (size_b0 > 0) { + puts ("Bank#1 - "); + print_size (size_b0, (size_b1 > 0) ? ", " : ") "); + } - printf(") "); + if (size_b1 > 0) { + puts ("Bank#2 - "); + print_size (size_b1, ") "); + } } else { printf ("## No FLASH found.\n"); diff --git a/board/dnp1110/dnp1110.c b/board/dnp1110/dnp1110.c index 6e93a39..80e707e 100644 --- a/board/dnp1110/dnp1110.c +++ b/board/dnp1110/dnp1110.c @@ -33,22 +33,26 @@ int board_init (void) { + DECLARE_GLOBAL_DATA_PTR; + /* memory and cpu-speed are setup before relocation */ /* so we do _nothing_ here */ /* arch number of DNP1110-Board */ - bd->bi_arch_number = 255; + gd->bd->bi_arch_number = 255; /* adress of boot parameters */ - bd->bi_boot_params = 0xc0000100; + gd->bd->bi_boot_params = 0xc0000100; return 0; } int dram_init (void) { - bd->bi_dram[0].start = PHYS_SDRAM_1; - bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; + DECLARE_GLOBAL_DATA_PTR; + + gd->bd->bi_dram[0].start = PHYS_SDRAM_1; + gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; return PHYS_SDRAM_1_SIZE; } diff --git a/board/dnp1110/env.c b/board/dnp1110/env.c index ff11dc0..9eef7f2 100644 --- a/board/dnp1110/env.c +++ b/board/dnp1110/env.c @@ -23,6 +23,7 @@ */ #include +#include static int check_crc(bd_t *bd) { diff --git a/board/dnp1110/armboot.lds b/board/dnp1110/ppcboot.lds similarity index 100% rename from board/dnp1110/armboot.lds rename to board/dnp1110/ppcboot.lds diff --git a/board/eltec/bab750/flash.c b/board/eltec/bab750/flash.c index 69522fa..3264d6a 100644 --- a/board/eltec/bab750/flash.c +++ b/board/eltec/bab750/flash.c @@ -129,11 +129,9 @@ void flash_print_info (flash_info_t *info) break; } - if (info->size >= (1 << 20)) { - printf (" Size: %ld MB in %d Sectors\n", info->size >> 20, info->sector_count); - } else { - printf (" Size: %ld kB in %d Sectors\n", info->size >> 10, info->sector_count); - } + puts (" Size: "); + print_size (info->size, ""); + printf (" in %d Sectors\n", info->sector_count); printf (" Sector Start Addresses:"); for (i=0; isector_count; ++i) { diff --git a/board/ep7312/env.c b/board/ep7312/env.c index ff11dc0..9eef7f2 100644 --- a/board/ep7312/env.c +++ b/board/ep7312/env.c @@ -23,6 +23,7 @@ */ #include +#include static int check_crc(bd_t *bd) { diff --git a/board/ep7312/ep7312.c b/board/ep7312/ep7312.c index ddad657..8191b12 100644 --- a/board/ep7312/ep7312.c +++ b/board/ep7312/ep7312.c @@ -34,22 +34,26 @@ int board_init (void) { + DECLARE_GLOBAL_DATA_PTR; + /* Activate LED flasher */ IO_LEDFLSH = 0x40; /* arch number MACH_TYPE_EDB7312 */ - bd->bi_arch_number = 131; + gd->bd->bi_arch_number = 131; /* location of boot parameters */ - bd->bi_boot_params = 0xc0020100; + gd->bd->bi_boot_params = 0xc0020100; return 0; } int dram_init (void) { - bd->bi_dram[0].start = PHYS_SDRAM_1; - bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; + DECLARE_GLOBAL_DATA_PTR; + + gd->bd->bi_dram[0].start = PHYS_SDRAM_1; + gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; return PHYS_SDRAM_1_SIZE; } diff --git a/board/ep7312/flash.c b/board/ep7312/flash.c index 1e69c26..aec1637 100644 --- a/board/ep7312/flash.c +++ b/board/ep7312/flash.c @@ -33,316 +33,309 @@ flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /*----------------------------------------------------------------------- */ -ulong flash_init(void) +ulong flash_init (void) { - int i, j; - ulong size = 0; - - for (i = 0; i < CFG_MAX_FLASH_BANKS; i++) - { - ulong flashbase = 0; - flash_info[i].flash_id = - (INTEL_MANUFACT & FLASH_VENDMASK) | - (INTEL_ID_28F128J3 & FLASH_TYPEMASK); - flash_info[i].size = FLASH_BANK_SIZE; - flash_info[i].sector_count = CFG_MAX_FLASH_SECT; - memset(flash_info[i].protect, 0, CFG_MAX_FLASH_SECT); - if (i == 0) - flashbase = PHYS_FLASH_1; - else - panic("configured to many flash banks!\n"); - for (j = 0; j < flash_info[i].sector_count; j++) - { - flash_info[i].start[j] = flashbase + j*MAIN_SECT_SIZE; + int i, j; + ulong size = 0; + + for (i = 0; i < CFG_MAX_FLASH_BANKS; i++) { + ulong flashbase = 0; + + flash_info[i].flash_id = + (INTEL_MANUFACT & FLASH_VENDMASK) | + (INTEL_ID_28F128J3 & FLASH_TYPEMASK); + flash_info[i].size = FLASH_BANK_SIZE; + flash_info[i].sector_count = CFG_MAX_FLASH_SECT; + memset (flash_info[i].protect, 0, CFG_MAX_FLASH_SECT); + if (i == 0) + flashbase = PHYS_FLASH_1; + else + panic ("configured to many flash banks!\n"); + for (j = 0; j < flash_info[i].sector_count; j++) { + flash_info[i].start[j] = flashbase + j * MAIN_SECT_SIZE; + } + size += flash_info[i].size; } - size += flash_info[i].size; - } - - /* Protect monitor and environment sectors - */ - flash_protect(FLAG_PROTECT_SET, - CFG_FLASH_BASE, - CFG_FLASH_BASE + _armboot_end - _armboot_start, - &flash_info[0]); - - flash_protect(FLAG_PROTECT_SET, - CFG_ENV_ADDR, - CFG_ENV_ADDR + CFG_ENV_SIZE - 1, - &flash_info[0]); - - return size; + + /* Protect monitor and environment sectors + */ + flash_protect (FLAG_PROTECT_SET, + CFG_FLASH_BASE, + CFG_FLASH_BASE + _armboot_end - _armboot_start, + &flash_info[0]); + + flash_protect (FLAG_PROTECT_SET, + CFG_ENV_ADDR, + CFG_ENV_ADDR + CFG_ENV_SIZE - 1, &flash_info[0]); + + return size; } /*----------------------------------------------------------------------- */ -void flash_print_info (flash_info_t *info) +void flash_print_info (flash_info_t * info) { - int i; - - switch (info->flash_id & FLASH_VENDMASK) - { - case (INTEL_MANUFACT & FLASH_VENDMASK): - printf("Intel: "); - break; - default: - printf("Unknown Vendor "); - break; - } - - switch (info->flash_id & FLASH_TYPEMASK) - { - case (INTEL_ID_28F128J3 & FLASH_TYPEMASK): - printf("28F128J3 (128Mbit)\n"); - break; - default: - printf("Unknown Chip Type\n"); - goto Done; - break; - } - - printf(" Size: %ld MB in %d Sectors\n", - info->size >> 20, info->sector_count); - - printf(" Sector Start Addresses:"); - for (i = 0; i < info->sector_count; i++) - { - if ((i % 5) == 0) - { - printf ("\n "); + int i; + + switch (info->flash_id & FLASH_VENDMASK) { + case (INTEL_MANUFACT & FLASH_VENDMASK): + printf ("Intel: "); + break; + default: + printf ("Unknown Vendor "); + break; } - printf (" %08lX%s", info->start[i], - info->protect[i] ? " (RO)" : " "); - } - printf ("\n"); - -Done: + + switch (info->flash_id & FLASH_TYPEMASK) { + case (INTEL_ID_28F128J3 & FLASH_TYPEMASK): + printf ("28F128J3 (128Mbit)\n"); + break; + default: + printf ("Unknown Chip Type\n"); + goto Done; + break; + } + + printf (" Size: %ld MB in %d Sectors\n", + info->size >> 20, info->sector_count); + + printf (" Sector Start Addresses:"); + for (i = 0; i < info->sector_count; i++) { + if ((i % 5) == 0) { + printf ("\n "); + } + printf (" %08lX%s", info->start[i], + info->protect[i] ? " (RO)" : " "); + } + printf ("\n"); + + Done: } /*----------------------------------------------------------------------- */ -int flash_erase (flash_info_t *info, int s_first, int s_last) +int flash_erase (flash_info_t * info, int s_first, int s_last) { - int flag, prot, sect; - int rc = ERR_OK; - - if (info->flash_id == FLASH_UNKNOWN) - return ERR_UNKNOWN_FLASH_TYPE; - - if ((s_first < 0) || (s_first > s_last)) { - return ERR_INVAL; - } - - if ((info->flash_id & FLASH_VENDMASK) != - (INTEL_MANUFACT & FLASH_VENDMASK)) { - return ERR_UNKNOWN_FLASH_VENDOR; - } - - prot = 0; - for (sect=s_first; sect<=s_last; ++sect) { - if (info->protect[sect]) { - prot++; - } - } - if (prot) - return ERR_PROTECTED; + int flag, prot, sect; + int rc = ERR_OK; - /* - * Disable interrupts which might cause a timeout - * here. Remember that our exception vectors are - * at address 0 in the flash, and we don't want a - * (ticker) exception to happen while the flash - * chip is in programming mode. - */ - flag = disable_interrupts(); + if (info->flash_id == FLASH_UNKNOWN) + return ERR_UNKNOWN_FLASH_TYPE; - /* Start erase on unprotected sectors */ - for (sect = s_first; sect<=s_last && !ctrlc(); sect++) { + if ((s_first < 0) || (s_first > s_last)) { + return ERR_INVAL; + } - printf("Erasing sector %2d ... ", sect); + if ((info->flash_id & FLASH_VENDMASK) != + (INTEL_MANUFACT & FLASH_VENDMASK)) { + return ERR_UNKNOWN_FLASH_VENDOR; + } - /* arm simple, non interrupt dependent timer */ - reset_timer_masked(); - - if (info->protect[sect] == 0) { /* not protected */ - vushort *addr = (vushort *)(info->start[sect]); - - *addr = 0x20; /* erase setup */ - *addr = 0xD0; /* erase confirm */ - - while ((*addr & 0x80) != 0x80) { - if (get_timer_masked() > CFG_FLASH_ERASE_TOUT) { - *addr = 0xB0; /* suspend erase */ - *addr = 0xFF; /* reset to read mode */ - rc = ERR_TIMOUT; - goto outahere; + prot = 0; + for (sect = s_first; sect <= s_last; ++sect) { + if (info->protect[sect]) { + prot++; + } + } + if (prot) + return ERR_PROTECTED; + + /* + * Disable interrupts which might cause a timeout + * here. Remember that our exception vectors are + * at address 0 in the flash, and we don't want a + * (ticker) exception to happen while the flash + * chip is in programming mode. + */ + flag = disable_interrupts (); + + /* Start erase on unprotected sectors */ + for (sect = s_first; sect <= s_last && !ctrlc (); sect++) { + + printf ("Erasing sector %2d ... ", sect); + + /* arm simple, non interrupt dependent timer */ + reset_timer_masked (); + + if (info->protect[sect] == 0) { /* not protected */ + vu_short *addr = (vu_short *) (info->start[sect]); + + *addr = 0x20; /* erase setup */ + *addr = 0xD0; /* erase confirm */ + + while ((*addr & 0x80) != 0x80) { + if (get_timer_masked () > CFG_FLASH_ERASE_TOUT) { + *addr = 0xB0; /* suspend erase */ + *addr = 0xFF; /* reset to read mode */ + rc = ERR_TIMOUT; + goto outahere; + } + } + + /* clear status register command */ + *addr = 0x50; + /* reset to read mode */ + *addr = 0xFF; } - } - - /* clear status register command */ - *addr = 0x50; - /* reset to read mode */ - *addr = 0xFF; + printf ("ok.\n"); } - printf("ok.\n"); - } - if (ctrlc()) - printf("User Interrupt!\n"); - -outahere: - - /* allow flash to settle - wait 10 ms */ - udelay_masked(10000); - - if (flag) - enable_interrupts(); - - return rc; + if (ctrlc ()) + printf ("User Interrupt!\n"); + + outahere: + + /* allow flash to settle - wait 10 ms */ + udelay_masked (10000); + + if (flag) + enable_interrupts (); + + return rc; } /*----------------------------------------------------------------------- * Copy memory to flash */ -static int write_word (flash_info_t *info, ulong dest, ushort data) +static int write_word (flash_info_t * info, ulong dest, ushort data) { - vushort *addr = (vushort *)dest, val; - int rc = ERR_OK; - int flag; - - /* Check if Flash is (sufficiently) erased - */ - if ((*addr & data) != data) - return ERR_NOT_ERASED; - - /* - * Disable interrupts which might cause a timeout - * here. Remember that our exception vectors are - * at address 0 in the flash, and we don't want a - * (ticker) exception to happen while the flash - * chip is in programming mode. - */ - flag = disable_interrupts(); - - /* clear status register command */ - *addr = 0x50; - - /* program set-up command */ - *addr = 0x40; - - /* latch address/data */ - *addr = data; - - /* arm simple, non interrupt dependent timer */ - reset_timer_masked(); - - /* wait while polling the status register */ - while(((val = *addr) & 0x80) != 0x80) - { - if (get_timer_masked() > CFG_FLASH_WRITE_TOUT) { - rc = ERR_TIMOUT; - /* suspend program command */ - *addr = 0xB0; - goto outahere; + vu_short *addr = (vu_short *) dest, val; + int rc = ERR_OK; + int flag; + + /* Check if Flash is (sufficiently) erased + */ + if ((*addr & data) != data) + return ERR_NOT_ERASED; + + /* + * Disable interrupts which might cause a timeout + * here. Remember that our exception vectors are + * at address 0 in the flash, and we don't want a + * (ticker) exception to happen while the flash + * chip is in programming mode. + */ + flag = disable_interrupts (); + + /* clear status register command */ + *addr = 0x50; + + /* program set-up command */ + *addr = 0x40; + + /* latch address/data */ + *addr = data; + + /* arm simple, non interrupt dependent timer */ + reset_timer_masked (); + + /* wait while polling the status register */ + while (((val = *addr) & 0x80) != 0x80) { + if (get_timer_masked () > CFG_FLASH_WRITE_TOUT) { + rc = ERR_TIMOUT; + /* suspend program command */ + *addr = 0xB0; + goto outahere; + } + } + + if (val & 0x1A) { /* check for error */ + printf ("\nFlash write error %02x at address %08lx\n", + (int) val, (unsigned long) dest); + if (val & (1 << 3)) { + printf ("Voltage range error.\n"); + rc = ERR_PROG_ERROR; + goto outahere; + } + if (val & (1 << 1)) { + printf ("Device protect error.\n"); + rc = ERR_PROTECTED; + goto outahere; + } + if (val & (1 << 4)) { + printf ("Programming error.\n"); + rc = ERR_PROG_ERROR; + goto outahere; + } + rc = ERR_PROG_ERROR; + goto outahere; } - } - - if(val & 0x1A) { /* check for error */ - printf("\nFlash write error %02x at address %08lx\n", - (int)val, (unsigned long)dest); - if(val & (1<<3)) { - printf("Voltage range error.\n"); - rc = ERR_PROG_ERROR; - goto outahere; - } - if(val & (1<<1)) { - printf("Device protect error.\n"); - rc = ERR_PROTECTED; - goto outahere; - } - if(val & (1<<4)) { - printf("Programming error.\n"); - rc = ERR_PROG_ERROR; - goto outahere; - } - rc = ERR_PROG_ERROR; - goto outahere; - } - -outahere: - /* read array command */ - *addr = 0xFF; - - if (flag) - enable_interrupts(); - - return rc; + + outahere: + /* read array command */ + *addr = 0xFF; + + if (flag) + enable_interrupts (); + + return rc; } /*----------------------------------------------------------------------- * Copy memory to flash. */ -int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt) +int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt) { - ulong cp, wp; - ushort data; - int l; - int i, rc; - - wp = (addr & ~1); /* get lower word aligned address */ + ulong cp, wp; + ushort data; + int l; + int i, rc; + + wp = (addr & ~1); /* get lower word aligned address */ + + /* + * handle unaligned start bytes + */ + if ((l = addr - wp) != 0) { + data = 0; + for (i = 0, cp = wp; i < l; ++i, ++cp) { + data = (data >> 8) | (*(uchar *) cp << 8); + } + for (; i < 2 && cnt > 0; ++i) { + data = (data >> 8) | (*src++ << 8); + --cnt; + ++cp; + } + for (; cnt == 0 && i < 2; ++i, ++cp) { + data = (data >> 8) | (*(uchar *) cp << 8); + } - /* - * handle unaligned start bytes - */ - if ((l = addr - wp) != 0) { - data = 0; - for (i=0, cp=wp; i> 8) | (*(uchar *)cp << 8); + if ((rc = write_word (info, wp, data)) != 0) { + return (rc); + } + wp += 2; } - for (; i<2 && cnt>0; ++i) { - data = (data >> 8) | (*src++ << 8); - --cnt; - ++cp; + + /* + * handle word aligned part + */ + while (cnt >= 2) { + data = *((vu_short *) src); + if ((rc = write_word (info, wp, data)) != 0) { + return (rc); + } + src += 2; + wp += 2; + cnt -= 2; } - for (; cnt==0 && i<2; ++i, ++cp) { - data = (data >> 8) | (*(uchar *)cp << 8); + + if (cnt == 0) { + return ERR_OK; } - - if ((rc = write_word(info, wp, data)) != 0) { - return (rc); + + /* + * handle unaligned tail bytes + */ + data = 0; + for (i = 0, cp = wp; i < 2 && cnt > 0; ++i, ++cp) { + data = (data >> 8) | (*src++ << 8); + --cnt; } - wp += 2; - } - - /* - * handle word aligned part - */ - while (cnt >= 2) { - data = *((vushort*)src); - if ((rc = write_word(info, wp, data)) != 0) { - return (rc); + for (; i < 2; ++i, ++cp) { + data = (data >> 8) | (*(uchar *) cp << 8); } - src += 2; - wp += 2; - cnt -= 2; - } - - if (cnt == 0) { - return ERR_OK; - } - - /* - * handle unaligned tail bytes - */ - data = 0; - for (i=0, cp=wp; i<2 && cnt>0; ++i, ++cp) { - data = (data >> 8) | (*src++ << 8); - --cnt; - } - for (; i<2; ++i, ++cp) { - data = (data >> 8) | (*(uchar *)cp << 8); - } - - return write_word(info, wp, data); + + return write_word (info, wp, data); } diff --git a/board/ep7312/armboot.lds b/board/ep7312/ppcboot.lds similarity index 100% rename from board/ep7312/armboot.lds rename to board/ep7312/ppcboot.lds diff --git a/board/evb64260/flash.c b/board/evb64260/flash.c index 936b2ed..1b41474 100644 --- a/board/evb64260/flash.c +++ b/board/evb64260/flash.c @@ -210,13 +210,9 @@ flash_print_info (flash_info_t *info) break; } - if((info->size >> 20) > 0 ) { - printf (" Size: %ld MB in %d Sectors\n", - info->size >> 20, info->sector_count); - } else { - printf (" Size: %ld kB in %d Sectors\n", - info->size >> 10, info->sector_count); - } + puts (" Size: "); + print_size (info->size, ""); + printf (" in %d Sectors\n", info->sector_count); printf (" Sector Start Addresses:"); for (i=0; isector_count; ++i) { diff --git a/board/impa7/env.c b/board/impa7/env.c index ff11dc0..9eef7f2 100644 --- a/board/impa7/env.c +++ b/board/impa7/env.c @@ -23,6 +23,7 @@ */ #include +#include static int check_crc(bd_t *bd) { diff --git a/board/impa7/impa7.c b/board/impa7/impa7.c index b2a6273..b95e910 100644 --- a/board/impa7/impa7.c +++ b/board/impa7/impa7.c @@ -34,24 +34,28 @@ int board_init (void) { + DECLARE_GLOBAL_DATA_PTR; + /* Activate LED flasher */ IO_LEDFLSH = 0x40; /* arch number of EP7111 */ - bd->bi_arch_number = 50; + gd->bd->bi_arch_number = 50; /* location of boot parameters for EP7111 */ - bd->bi_boot_params = 0xc0020100; + gd->bd->bi_boot_params = 0xc0020100; return 0; } int dram_init (void) { - bd->bi_dram[0].start = PHYS_SDRAM_1; - bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; - bd->bi_dram[1].start = PHYS_SDRAM_2; - bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE; + DECLARE_GLOBAL_DATA_PTR; + + gd->bd->bi_dram[0].start = PHYS_SDRAM_1; + gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; + gd->bd->bi_dram[1].start = PHYS_SDRAM_2; + gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE; return PHYS_SDRAM_1_SIZE + PHYS_SDRAM_2_SIZE; } diff --git a/board/impa7/armboot.lds b/board/impa7/ppcboot.lds similarity index 100% rename from board/impa7/armboot.lds rename to board/impa7/ppcboot.lds diff --git a/board/lart/env.c b/board/lart/env.c index ff11dc0..9eef7f2 100644 --- a/board/lart/env.c +++ b/board/lart/env.c @@ -23,6 +23,7 @@ */ #include +#include static int check_crc(bd_t *bd) { diff --git a/board/lart/lart.c b/board/lart/lart.c index 93f8b76..a50aa70 100644 --- a/board/lart/lart.c +++ b/board/lart/lart.c @@ -33,20 +33,25 @@ int board_init (void) { + DECLARE_GLOBAL_DATA_PTR; + /* memory and cpu-speed are setup before relocation */ /* so we do _nothing_ here */ /* arch number of LART-Board */ - bd->bi_arch_number = 27; + gd->bd->bi_arch_number = 27; /* adress of boot parameters */ - bd->bi_boot_params = 0xc0000100; + gd->bd->bi_boot_params = 0xc0000100; return 0; } int dram_init (void) { + DECLARE_GLOBAL_DATA_PTR; + bd_t *bd = gd->bd; + bd->bi_dram[0].start = PHYS_SDRAM_1; bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; bd->bi_dram[1].start = PHYS_SDRAM_2; diff --git a/board/lart/armboot.lds b/board/lart/ppcboot.lds similarity index 100% rename from board/lart/armboot.lds rename to board/lart/ppcboot.lds diff --git a/board/shannon/env.c b/board/shannon/env.c index b219fc8..046b4d5 100644 --- a/board/shannon/env.c +++ b/board/shannon/env.c @@ -23,6 +23,7 @@ */ #include +#include static int check_crc(bd_t *bd) { diff --git a/board/shannon/armboot.lds b/board/shannon/ppcboot.lds similarity index 100% rename from board/shannon/armboot.lds rename to board/shannon/ppcboot.lds diff --git a/board/shannon/shannon.c b/board/shannon/shannon.c index 7ffc4b3..2dd708f 100644 --- a/board/shannon/shannon.c +++ b/board/shannon/shannon.c @@ -33,6 +33,8 @@ int board_init (void) { + DECLARE_GLOBAL_DATA_PTR; + /* memory and cpu-speed are setup before relocation */ /* but if we use InfernoLoader, we must do some inits here */ @@ -61,16 +63,22 @@ int board_init (void) #endif /* CONFIG_INIT_CRITICAL */ /* arch number for shannon */ - bd->bi_arch_number = 97; + gd->bd->bi_arch_number = 97; /* adress of boot parameters */ - bd->bi_boot_params = 0xc0000100; + gd->bd->bi_boot_params = 0xc0000100; return 0; } int dram_init (void) { +#if defined(PHYS_SDRAM_1) || defined(PHYS_SDRAM_2) || \ + defined(PHYS_SDRAM_3) || defined(PHYS_SDRAM_4) + DECLARE_GLOBAL_DATA_PTR; + bd_t *bd = gd->bd; +#endif + #ifdef PHYS_SDRAM_1 bd->bi_dram[0].start = PHYS_SDRAM_1; bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; @@ -91,10 +99,17 @@ int dram_init (void) bd->bi_dram[3].size = PHYS_SDRAM_4_SIZE; #endif - return ( PHYS_SDRAM_1_SIZE + return ( 0 +#ifdef PHYS_SDRAM_1 + + PHYS_SDRAM_1_SIZE +#endif +#ifdef PHYS_SDRAM_2 + PHYS_SDRAM_2_SIZE -#ifdef PHYS_SDRAM_4 +#endif +#ifdef PHYS_SDRAM_3 + PHYS_SDRAM_3_SIZE +#endif +#ifdef PHYS_SDRAM_4 + PHYS_SDRAM_4_SIZE #endif ); diff --git a/board/smdk2400/armboot.lds b/board/smdk2400/ppcboot.lds similarity index 100% rename from board/smdk2400/armboot.lds rename to board/smdk2400/ppcboot.lds diff --git a/board/smdk2410/env.c b/board/smdk2410/env.c index d22c529..5e8d95a 100644 --- a/board/smdk2410/env.c +++ b/board/smdk2410/env.c @@ -26,6 +26,7 @@ */ #include +#include static int check_crc(bd_t *bd) { diff --git a/board/smdk2410/flash.c b/board/smdk2410/flash.c index 53339fb..fb25902 100644 --- a/board/smdk2410/flash.c +++ b/board/smdk2410/flash.c @@ -220,7 +220,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last) if (info->protect[sect] == 0) { /* not protected */ - vushort *addr = (vushort *)(info->start[sect]); + vu_short *addr = (vu_short *)(info->start[sect]); MEM_FLASH_ADDR1 = CMD_UNLOCK1; MEM_FLASH_ADDR2 = CMD_UNLOCK2; @@ -296,7 +296,7 @@ outahere: volatile static int write_hword (flash_info_t *info, ulong dest, ushort data) { - vushort *addr = (vushort *)dest; + vu_short *addr = (vu_short *)dest; ushort result; int rc = ERR_OK; int cflag, iflag; @@ -411,7 +411,7 @@ int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt) * handle word aligned part */ while (cnt >= 2) { - data = *((vushort*)src); + data = *((vu_short*)src); if ((rc = write_hword(info, wp, data)) != 0) { return (rc); } diff --git a/board/smdk2410/armboot.lds b/board/smdk2410/ppcboot.lds similarity index 100% rename from board/smdk2410/armboot.lds rename to board/smdk2410/ppcboot.lds diff --git a/board/smdk2410/smdk2410.c b/board/smdk2410/smdk2410.c index 56cc4b2..9fecce5 100644 --- a/board/smdk2410/smdk2410.c +++ b/board/smdk2410/smdk2410.c @@ -67,6 +67,8 @@ static inline void delay (unsigned long loops) int board_init (void) { + DECLARE_GLOBAL_DATA_PTR; + /* to reduce PLL lock time, adjust the LOCKTIME register */ rLOCKTIME = 0xFFFFFF; @@ -100,17 +102,19 @@ int board_init (void) rGPHUP = 0x000007FF; /* arch number of SMDK2410-Board */ - bd->bi_arch_number = 193; + gd->bd->bi_arch_number = 193; /* adress of boot parameters */ - bd->bi_boot_params = 0x30000100; + gd->bd->bi_boot_params = 0x30000100; return 0; } int dram_init (void) { - bd->bi_dram[0].start = PHYS_SDRAM_1; - bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; + DECLARE_GLOBAL_DATA_PTR; + + gd->bd->bi_dram[0].start = PHYS_SDRAM_1; + gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; return PHYS_SDRAM_1_SIZE; } diff --git a/common/cmd_boot.c b/common/cmd_boot.c index 421c905..a1d7179 100644 --- a/common/cmd_boot.c +++ b/common/cmd_boot.c @@ -46,6 +46,10 @@ static void print_num(const char *, ulong); static void print_str(const char *, const char *); int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { +#ifdef CONFIG_ARM /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ +#warning ARM version not implemented yet /* XXXXXXXXXXXXXXXXXXXXXXXXXXXX */ + return 0; +#else /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ DECLARE_GLOBAL_DATA_PTR; int i; @@ -100,6 +104,7 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) printf ("\nIP addr = "); print_IPaddr (bd->bi_ip_addr); printf ("\nbaudrate = %6ld bps\n", bd->bi_baudrate ); return 0; +#endif /* CONFIG_ARM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ } static void print_num(const char *name, ulong value) diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 9524e1d..b3a5f78 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -271,6 +271,10 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag, ulong *len_ptr, int verify) { +#ifdef CONFIG_ARM /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ +#warning ARM version not implemented yet /* XXXXXXXXXXXXXXXXXXXXXXXXXXXX */ + return; +#else /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ DECLARE_GLOBAL_DATA_PTR; ulong sp; @@ -529,6 +533,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag, * r7: End of command line string */ (*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end); +#endif /* CONFIG_ARM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ } static void @@ -701,8 +706,8 @@ print_image_hdr (image_header_t *hdr) tm.tm_hour, tm.tm_min, tm.tm_sec); #endif /* CFG_CMD_DATE */ printf (" Image Type: "); print_type(hdr); printf ("\n"); - printf (" Data Size: %d Bytes = %d kB = %d MB\n", - hdr->ih_size, hdr->ih_size>>10, hdr->ih_size>>20); + printf (" Data Size: %d Bytes = ", hdr->ih_size); + print_size (hdr->ih_size, "\n"); printf (" Load Address: %08x\n", hdr->ih_load); printf (" Entry Point: %08x\n", hdr->ih_ep); @@ -712,8 +717,8 @@ print_image_hdr (image_header_t *hdr) printf (" Contents:\n"); for (i=0; *len_ptr; ++i, ++len_ptr) { - printf (" Image %d: %8ld Bytes = %ld kB = %ld MB\n", - i, *len_ptr, *len_ptr>>10, *len_ptr>>20); + printf (" Image %d: %8ld Bytes = ", i, *len_ptr); + print_size (*len_ptr, "\n"); } } } diff --git a/common/cmd_ide.c b/common/cmd_ide.c index 5f8fe82..46f4c35 100644 --- a/common/cmd_ide.c +++ b/common/cmd_ide.c @@ -1,5 +1,5 @@ /* - * (C) Copyright 2000, 2001 + * (C) Copyright 2000-2002 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. * * See file CREDITS for list of people who contributed to this @@ -30,7 +30,8 @@ #include #include #include -#ifdef CONFIG_IDE_8xx_DIRECT +#include +#if defined(CONFIG_IDE_8xx_DIRECT) || defined(CONFIG_IDE_PCMCIA) # include #endif #ifdef CONFIG_8xx @@ -402,11 +403,11 @@ int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) hdr = (image_header_t *)addr; - if (hdr->ih_magic == IH_MAGIC) { + if (ntohl(hdr->ih_magic) == IH_MAGIC) { print_image_hdr (hdr); - cnt = (hdr->ih_size + sizeof(image_header_t)); + cnt = (ntohl(hdr->ih_size) + sizeof(image_header_t)); cnt += info.blksz - 1; cnt /= info.blksz; cnt -= 1; diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index 72e99d2..d1fa3f7 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -136,7 +136,12 @@ static uchar *flash_addr = (uchar *)CFG_ENV_ADDR; static env_t *env_ptr = NULL; #else +#ifdef CONFIG_ARM /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ +#warning ARM version not implemented yet /* XXXXXXXXXXXXXXXXXXXXXXXXXXXX */ + /* nothing XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ +#else /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ # error Define one of CFG_ENV_IS_IN_NVRAM, CFG_ENV_IS_IN_EEPROM, CFG_ENV_IS_IN_FLASH, CFG_ENV_IS_NOWHERE +#endif /* CONFIG_ARM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ #endif /* CFG_ENV_IS_IN_FLASH */ /*----------------------------------------------------------------------*/ @@ -253,6 +258,10 @@ static uchar *(*get_env_addr)(int) = get_env_addr_memory; void env_relocate (void) { +#ifdef CONFIG_ARM /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ +#warning ARM version not implemented yet /* XXXXXXXXXXXXXXXXXXXXXXXXXXXX */ + return; +#else /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ DECLARE_GLOBAL_DATA_PTR; DEBUGF ("%s[%d] offset = 0x%lx\n", __FUNCTION__,__LINE__, @@ -321,6 +330,7 @@ void env_relocate (void) } #endif gd->env_addr = (ulong)&(env_ptr->data); +#endif /* CONFIG_ARM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ } /************************************************************************ ************************************************************************/ @@ -330,6 +340,10 @@ void env_relocate (void) */ static uchar get_env_char_memory (int index) { +#ifdef CONFIG_ARM /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ +#warning ARM version not implemented yet /* XXXXXXXXXXXXXXXXXXXXXXXXXXXX */ + return 0; +#else /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ DECLARE_GLOBAL_DATA_PTR; if (gd->env_valid) { @@ -337,11 +351,16 @@ static uchar get_env_char_memory (int index) } else { return ( default_environment[index] ); } +#endif /* CONFIG_ARM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ } static uchar *get_env_addr_memory(int index) { +#ifdef CONFIG_ARM /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ +#warning ARM version not implemented yet /* XXXXXXXXXXXXXXXXXXXXXXXXXXXX */ + return 0; +#else /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ DECLARE_GLOBAL_DATA_PTR; if (gd->env_valid) { @@ -349,11 +368,16 @@ static uchar *get_env_addr_memory(int index) } else { return (&default_environment[index]); } +#endif /* CONFIG_ARM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ } #if defined(CFG_ENV_IS_IN_NVRAM) && defined(CFG_NVRAM_ACCESS_ROUTINE) static uchar get_env_char_nvram(int index) { +#ifdef CONFIG_ARM /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ +#warning ARM version not implemented yet /* XXXXXXXXXXXXXXXXXXXXXXXXXXXX */ + return 0; +#else /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ DECLARE_GLOBAL_DATA_PTR; uchar c; @@ -364,6 +388,7 @@ static uchar get_env_char_nvram(int index) c = default_environment[index]; return c; +#endif /* CONFIG_ARM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ } #endif @@ -373,6 +398,10 @@ static uchar get_env_char_nvram(int index) */ static uchar get_env_char_eeprom (int index) { +#ifdef CONFIG_ARM /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ +#warning ARM version not implemented yet /* XXXXXXXXXXXXXXXXXXXXXXXXXXXX */ + return 0; +#else /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ DECLARE_GLOBAL_DATA_PTR; uchar c; @@ -387,6 +416,7 @@ static uchar get_env_char_eeprom (int index) } return (c); +#endif /* CONFIG_ARM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ } #endif /* CFG_ENV_IS_IN_EEPROM */ @@ -455,6 +485,10 @@ int do_printenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) int _do_setenv (int flag, int argc, char *argv[]) { +#ifdef CONFIG_ARM /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ +#warning ARM version not implemented yet /* XXXXXXXXXXXXXXXXXXXXXXXXXXXX */ + return 0; +#else /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ DECLARE_GLOBAL_DATA_PTR; int i, len, oldval; @@ -662,6 +696,7 @@ int _do_setenv (int flag, int argc, char *argv[]) } #endif /* CFG_CMD_NET */ return 0; +#endif /* CONFIG_ARM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ } void setenv (char *varname, char *varvalue) @@ -867,6 +902,10 @@ int saveenv(void) int saveenv(void) { +#ifdef CONFIG_ARM /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ +#warning ARM version not implemented yet /* XXXXXXXXXXXXXXXXXXXXXXXXXXXX */ + return 0; +#else /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ int len, rc; ulong end_addr; uchar *flash_sect_addr; @@ -918,6 +957,7 @@ int saveenv(void) /* try to re-protect */ (void) flash_sect_protect (1, (ulong)flash_sect_addr, end_addr); return rcode; +#endif /* CONFIG_ARM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ } #endif /* CFG_CMD_ENV + CFG_CMD_FLASH */ @@ -966,6 +1006,10 @@ int env_init(void) #else int env_init(void) { +#ifdef CONFIG_ARM /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ +#warning ARM version not implemented yet /* XXXXXXXXXXXXXXXXXXXXXXXXXXXX */ + return 0; +#else /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ DECLARE_GLOBAL_DATA_PTR; if (crc32(0, env_ptr->data, ENV_SIZE) == env_ptr->crc) { @@ -977,6 +1021,7 @@ int env_init(void) } return (0); +#endif /* CONFIG_ARM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ } #endif /* defined(CFG_ENV_IS_IN_NVRAM) && defined(CFG_NVRAM_ACCESS_ROUTINE) */ diff --git a/common/console.c b/common/console.c index dbcd368..b231662 100644 --- a/common/console.c +++ b/common/console.c @@ -27,6 +27,8 @@ #include #include +void **syscall_tbl; + #ifdef CFG_CONSOLE_IS_IN_ENV /* * if overwrite_console returns 1, the stdin, stderr and stdout diff --git a/cpu/arm720t/cpu.c b/cpu/arm720t/cpu.c index 3d19e24..7521fba 100644 --- a/cpu/arm720t/cpu.c +++ b/cpu/arm720t/cpu.c @@ -131,7 +131,9 @@ int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) disable_interrupts (); reset_cpu (0); - /*NOTREACHED*/} + /*NOTREACHED*/ + return (0); +} void icache_enable (void) { diff --git a/cpu/arm720t/interrupts.c b/cpu/arm720t/interrupts.c index 050bcae..8831186 100644 --- a/cpu/arm720t/interrupts.c +++ b/cpu/arm720t/interrupts.c @@ -28,7 +28,8 @@ #include #include -#include + +#include extern void reset_cpu(ulong addr); diff --git a/cpu/arm720t/serial.c b/cpu/arm720t/serial.c index 708b9e9..d38ac39 100644 --- a/cpu/arm720t/serial.c +++ b/cpu/arm720t/serial.c @@ -116,3 +116,11 @@ int serial_getc (void) return IO_UARTDR1 & 0xff; } + +void +serial_puts (const char *s) +{ + while (*s) { + serial_putc (*s++); + } +} diff --git a/cpu/arm920t/serial.c b/cpu/arm920t/serial.c index 2567c97..b37d23a 100644 --- a/cpu/arm920t/serial.c +++ b/cpu/arm920t/serial.c @@ -170,3 +170,11 @@ int serial_tstc (void) return rUTRSTAT1 & 0x1; #endif } + +void +serial_puts (const char *s) +{ + while (*s) { + serial_putc (*s++); + } +} diff --git a/cpu/sa1100/interrupts.c b/cpu/sa1100/interrupts.c index b57be49..be52849 100644 --- a/cpu/sa1100/interrupts.c +++ b/cpu/sa1100/interrupts.c @@ -28,7 +28,8 @@ #include #include -#include + +#include extern void reset_cpu (ulong addr); diff --git a/cpu/sa1100/serial.c b/cpu/sa1100/serial.c index 5a0acbe..cbb894c 100644 --- a/cpu/sa1100/serial.c +++ b/cpu/sa1100/serial.c @@ -148,3 +148,11 @@ int serial_getc (void) return (char) Ser3UTDR & 0xff; #endif } + +void +serial_puts (const char *s) +{ + while (*s) { + serial_putc (*s++); + } +} diff --git a/cpu/xscale/serial.c b/cpu/xscale/serial.c index 643d77b..6a396b5 100644 --- a/cpu/xscale/serial.c +++ b/cpu/xscale/serial.c @@ -133,3 +133,11 @@ int serial_getc (void) #elif CONFIG_STUART #endif } + +void +serial_puts (const char *s) +{ + while (*s) { + serial_putc (*s++); + } +} diff --git a/drivers/3c589.c b/drivers/3c589.c index 2fd2125..808a10b 100644 --- a/drivers/3c589.c +++ b/drivers/3c589.c @@ -64,7 +64,7 @@ #ifdef CONFIG_DRIVER_3C589 -#include <3c589.h> +#include "3c589.h" // Use power-down feature of the chip diff --git a/drivers/Makefile b/drivers/Makefile index fff3b19..28846ee 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -27,9 +27,14 @@ include $(TOPDIR)/config.mk LIB = libdrivers.a -OBJS = ns87308.o ns16550.o serial.o pci_auto.o pci.o pci_indirect.o \ - eepro100.o dc2114x.o w83c553f.o sym53c8xx.o pcnet.o \ - tigon3.o bcm570x.o bcm570x_autoneg.o 5701rls.o +OBJS = 3c589.o 5701rls.o bcm570x.o bcm570x_autoneg.o \ + cs8900.o dc2114x.o eepro100.o \ + ns16550.o ns87308.o \ + pci.o pci_auto.o pci_indirect.o \ + pcnet.o serial.o \ + smc91111.o sym53c8xx.o \ + tigon3.o w83c553f.o + all: $(LIB) $(LIB): $(OBJS) diff --git a/drivers/cs8900.c b/drivers/cs8900.c index 64748f1..a4664a7 100644 --- a/drivers/cs8900.c +++ b/drivers/cs8900.c @@ -34,7 +34,7 @@ #include #include -#include +#include "cs8900.h" #include #ifdef CONFIG_DRIVER_CS8900 diff --git a/drivers/cs8900.h b/drivers/cs8900.h index dbd329e..ac26df2 100644 --- a/drivers/cs8900.h +++ b/drivers/cs8900.h @@ -32,7 +32,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include +#include #include #ifdef CONFIG_DRIVER_CS8900 diff --git a/drivers/smc91111.c b/drivers/smc91111.c index b8dfc5d..a2c3be7 100644 --- a/drivers/smc91111.c +++ b/drivers/smc91111.c @@ -60,7 +60,7 @@ #include #include -#include +#include "smc91111.h" #include #ifdef CONFIG_DRIVER_SMC91111 @@ -278,7 +278,7 @@ static int poll4int( byte mask, int timeout ) { PRINTK2("Polling...\n"); SMC_SELECT_BANK(2); - while((SMC_inw(INT_REG) & mask) == 0) + while((SMC_inw(SMC91111_INT_REG) & mask) == 0) { if (get_timer(0) >= tmo) { is_timeout = 1; @@ -475,10 +475,10 @@ again: try++; time_out = MEMORY_WAIT_TIME; do { - status = SMC_inb( INT_REG ); + status = SMC_inb( SMC91111_INT_REG ); if ( status & IM_ALLOC_INT ) { /* acknowledge the interrupt */ - SMC_outb( IM_ALLOC_INT, INT_REG ); + SMC_outb( IM_ALLOC_INT, SMC91111_INT_REG ); break; } } while ( -- time_out ); @@ -528,11 +528,11 @@ again: /* send the packet length ( +6 for status, length and ctl byte ) and the status word ( set to zeros ) */ #ifdef USE_32_BIT - SMC_outl( (length +6 ) << 16 , DATA_REG ); + SMC_outl( (length +6 ) << 16 , SMC91111_DATA_REG ); #else - SMC_outw( 0, DATA_REG ); + SMC_outw( 0, SMC91111_DATA_REG ); /* send the packet length ( +6 for status words, length, and ctl*/ - SMC_outw( (length+6), DATA_REG ); + SMC_outw( (length+6), SMC91111_DATA_REG ); #endif /* send the actual data @@ -543,18 +543,18 @@ again: . almost as much time as is saved? */ #ifdef USE_32_BIT - SMC_outsl(DATA_REG, buf, length >> 2 ); + SMC_outsl(SMC91111_DATA_REG, buf, length >> 2 ); if ( length & 0x2 ) - SMC_outw(*((word *)(buf + (length & 0xFFFFFFFC))), DATA_REG); + SMC_outw(*((word *)(buf + (length & 0xFFFFFFFC))), SMC91111_DATA_REG); #else - SMC_outsw(DATA_REG , buf, (length ) >> 1); + SMC_outsw(SMC91111_DATA_REG , buf, (length ) >> 1); #endif // USE_32_BIT /* Send the last byte, if there is one. */ if ( (length & 1) == 0 ) { - SMC_outw( 0, DATA_REG ); + SMC_outw( 0, SMC91111_DATA_REG ); } else { - SMC_outw( buf[length -1 ] | 0x2000, DATA_REG ); + SMC_outw( buf[length -1 ] | 0x2000, SMC91111_DATA_REG ); } /* and let the chipset deal with it */ @@ -581,7 +581,7 @@ again: return 0; } else { /* ack. int */ - SMC_outw(IM_TX_INT, INT_REG); + SMC_outw(IM_TX_INT, SMC91111_INT_REG); PRINTK2("%s: Sent packet of length %d \n", SMC_DEV_NAME, length); /* release packet */ @@ -719,12 +719,12 @@ static int smc_rcv() /* First two words are status and packet_length */ #ifdef USE_32_BIT - stat_len = SMC_inl(DATA_REG); + stat_len = SMC_inl(SMC91111_DATA_REG); status = stat_len & 0xffff; packet_length = stat_len >> 16; #else - status = SMC_inw( DATA_REG ); - packet_length = SMC_inw( DATA_REG ); + status = SMC_inw( SMC91111_DATA_REG ); + packet_length = SMC_inw( SMC91111_DATA_REG ); #endif packet_length &= 0x07ff; /* mask off top bits */ @@ -749,20 +749,20 @@ static int smc_rcv() to send the DWORDs or the bytes first, or some mixture. A mixture might improve already slow PIO performance */ - SMC_insl( DATA_REG , NetRxPackets[0], packet_length >> 2 ); + SMC_insl( SMC91111_DATA_REG , NetRxPackets[0], packet_length >> 2 ); /* read the left over bytes */ if (packet_length & 3) { int i; byte *tail = NetRxPackets[0] + (packet_length & ~3); - dword leftover = SMC_inl(DATA_REG); + dword leftover = SMC_inl(SMC91111_DATA_REG); for (i=0; i<(packet_length & 3); i++) *tail++ = (byte) (leftover >> (8*i)) & 0xff; } #else PRINTK3(" Reading %d words and %d byte(s) \n", (packet_length >> 1 ), packet_length & 1 ); - SMC_insw(DATA_REG , NetRxPackets[0], packet_length >> 1); + SMC_insw(SMC91111_DATA_REG , NetRxPackets[0], packet_length >> 1); #endif // USE_32_BIT diff --git a/drivers/smc91111.h b/drivers/smc91111.h index 4d2ed74..e517957 100644 --- a/drivers/smc91111.h +++ b/drivers/smc91111.h @@ -41,7 +41,7 @@ #ifndef _SMC91111_H_ #define _SMC91111_H_ -#include +#include #include @@ -372,12 +372,12 @@ typedef unsigned long int dword; // Data Register /* BANK 2 */ -#define DATA_REG 0x0008 +#define SMC91111_DATA_REG 0x0008 // Interrupt Status/Acknowledge Register /* BANK 2 */ -#define INT_REG 0x000C +#define SMC91111_INT_REG 0x000C // Interrupt Mask Register diff --git a/examples/syscall.S b/examples/syscall.S index 01dd110..9e8725e 100644 --- a/examples/syscall.S +++ b/examples/syscall.S @@ -2,6 +2,42 @@ #include #include +#ifdef CONFIG_ARM /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ +#warning ARM version not implemented yet /* XXXXXXXXXXXXXXXXXXXXXXXXXXXX */ + .global mon_getc + .type mon_getc,function +mon_getc: + .global mon_tstc + .type mon_tstc,function +mon_tstc: + .global mon_putc + .type mon_putc,function +mon_putc: + .global mon_puts + .type mon_puts,function +mon_puts: + .global mon_printf + .type mon_printf,function +mon_printf: + .global mon_install_hdlr + .type mon_install_hdlr,function +mon_install_hdlr: + .global mon_free_hdlr + .type mon_free_hdlr,function +mon_free_hdlr: + .global mon_malloc + .type mon_malloc,function +mon_malloc: + .global mon_free + .type mon_free,function +mon_free: + @ args = 0, pretend = 0, frame = 0 + @ frame_needed = 1, current_function_anonymous_args = 0 + mov ip, sp + stmfd sp!, {fp, ip, lr, pc} + sub fp, ip, #4 + ldmea fp, {fp, sp, pc} +#else /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ #define SYSCALL(name,n) \ .globl name ; \ name: ; \ @@ -25,3 +61,4 @@ name: ; \ SYSCALL(mon_free_hdlr,SYSCALL_FREE_HDLR) SYSCALL(mon_malloc,SYSCALL_MALLOC) SYSCALL(mon_free,SYSCALL_FREE) +#endif /* CONFIG_ARM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ diff --git a/include/asm-arm/global_data.h b/include/asm-arm/global_data.h index 5ac8cf4..5191286 100644 --- a/include/asm-arm/global_data.h +++ b/include/asm-arm/global_data.h @@ -37,15 +37,15 @@ typedef struct global_data { bd_t *bd; unsigned long flags; unsigned long baudrate; + unsigned long have_console; /* serial_init() was called */ + unsigned long reloc_off; /* Relocation Offset */ #if 0 unsigned long cpu_clk; /* CPU clock in Hz! */ unsigned long bus_clk; unsigned long ram_size; /* RAM size */ - unsigned long reloc_off; /* Relocation Offset */ unsigned long reset_status; /* reset status register at boot */ unsigned long env_addr; /* Address of Environment struct */ unsigned long env_valid; /* Checksum of Environment valid? */ - unsigned long have_console; /* serial_init() was called */ #endif } gd_t; diff --git a/include/asm-arm/io.h b/include/asm-arm/io.h index cff09e5..0d55ca2 100644 --- a/include/asm-arm/io.h +++ b/include/asm-arm/io.h @@ -20,9 +20,8 @@ #ifndef __ASM_ARM_IO_H #define __ASM_ARM_IO_H -#ifdef __KERNEL__ - #include +#include #include #include @@ -281,5 +280,5 @@ out: #define isa_check_signature(io,sig,len) (0) #endif /* __mem_isa */ -#endif /* __KERNEL__ */ + #endif /* __ASM_ARM_IO_H */ diff --git a/include/asm-arm/ppcboot-arm.h b/include/asm-arm/ppcboot-arm.h index 0866863..b0adb50 100644 --- a/include/asm-arm/ppcboot-arm.h +++ b/include/asm-arm/ppcboot-arm.h @@ -44,11 +44,6 @@ int cleanup_before_linux(void); int board_init(void); int dram_init (void); -/* arm/display_options.c */ -int display_banner(void); -int display_dram_config(void); -void display_flash_config(ulong); - /* ------------------------------------------------------------ */ /* Here is a list of some prototypes which are incompatible to */ /* the PPCBoot implementation */ diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h index 426f926..652b12b 100644 --- a/include/asm-ppc/io.h +++ b/include/asm-ppc/io.h @@ -1,5 +1,5 @@ /* originally from linux source. - * removed the dependacies on CONFIG_ values + * removed the dependencies on CONFIG_ values * removed virt_to_phys stuff (and in fact everything surrounded by #if __KERNEL__) * Modified By Rob Taylor, Flying Pig Systems, 2000 */ diff --git a/include/common.h b/include/common.h index 5a802ae..630e74e 100644 --- a/include/common.h +++ b/include/common.h @@ -49,6 +49,9 @@ typedef volatile unsigned char vu_char; #ifdef CONFIG_HYMOD #include #endif +#ifdef CONFIG_ARM +#define asmlinkage /* nothing */ +#endif #include #include @@ -91,6 +94,7 @@ void hang (void); /* */ long int initdram (int); int display_options (void); +void print_size (ulong, const char *); /* common/main.c */ void main_loop (void); @@ -359,7 +363,7 @@ ulong crc32 (ulong, const unsigned char *, uint); ulong crc32_no_comp (ulong, const unsigned char *, uint); /* common/console.c */ -void **syscall_tbl; +extern void **syscall_tbl; int console_init_f(void); /* Before relocation; uses the serial stuff */ int console_init_r(void); /* After relocation; uses the console stuff */ diff --git a/include/configs/dnp1110.h b/include/configs/dnp1110.h index 5ecc5a8..7fc6776 100644 --- a/include/configs/dnp1110.h +++ b/include/configs/dnp1110.h @@ -52,7 +52,7 @@ * Hardware drivers */ #define CONFIG_DRIVER_SMC91111 -#define SMC91111_BASE 0x20000300 +#define CONFIG_SMC91111_BASE 0x20000300 /* diff --git a/include/configs/ep7312.h b/include/configs/ep7312.h index 4b8e9cc..30eb49c 100644 --- a/include/configs/ep7312.h +++ b/include/configs/ep7312.h @@ -77,10 +77,10 @@ #define CONFIG_BOOTDELAY 3 #define CONFIG_BOOTARGS "devfs=mount root=ramfs console=ttyS0,9600" #define CONFIG_ETHADDR 08:00:3e:21:c7:f7 -//#define CONFIG_NETMASK 255.255.0.0 -//#define CONFIG_IPADDR 172.22.2.128 -//#define CONFIG_SERVERIP 172.22.2.126 -//#define CONFIG_BOOTFILE "impa7" +/*#define CONFIG_NETMASK 255.255.0.0 */ +/*#define CONFIG_IPADDR 172.22.2.128 */ +/*#define CONFIG_SERVERIP 172.22.2.126 */ +/*#define CONFIG_BOOTFILE "impa7" */ #define CONFIG_BOOTCOMMAND "bootp;bootm" #if (CONFIG_COMMANDS & CFG_CMD_KGDB) diff --git a/include/configs/impa7.h b/include/configs/impa7.h index 2a02c43..eef1e4b 100644 --- a/include/configs/impa7.h +++ b/include/configs/impa7.h @@ -75,11 +75,11 @@ #define CONFIG_BOOTDELAY 3 #define CONFIG_BOOTARGS "devfs=mount root=ramfs console=ttyS0,9600" -//#define CONFIG_ETHADDR 08:00:3e:26:0a:5a -//#define CONFIG_NETMASK 255.255.0.0 -//#define CONFIG_IPADDR 172.22.2.128 -//#define CONFIG_SERVERIP 172.22.2.126 -//#define CONFIG_BOOTFILE "impa7" +/*#define CONFIG_ETHADDR 08:00:3e:26:0a:5a */ +/*#define CONFIG_NETMASK 255.255.0.0 */ +/*#define CONFIG_IPADDR 172.22.2.128 */ +/*#define CONFIG_SERVERIP 172.22.2.126 */ +/*#define CONFIG_BOOTFILE "impa7" */ #define CONFIG_BOOTCOMMAND "bootp;bootm" #if (CONFIG_COMMANDS & CFG_CMD_KGDB) diff --git a/include/configs/shannon.h b/include/configs/shannon.h index 41a4c57..db2724d 100644 --- a/include/configs/shannon.h +++ b/include/configs/shannon.h @@ -68,9 +68,11 @@ #define CONFIG_BAUDRATE 115200 +#if 0 /* XXX - cannot test IDE anyway, so disabled for now - wd */ #define CONFIG_COMMANDS (CONFIG_CMD_DFL | \ CFG_CMD_PCMCIA | \ CFG_CMD_IDE) +#endif /* 0 */ /* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */ #include diff --git a/include/configs/smdk2410.h b/include/configs/smdk2410.h index 61c75dd..070e54b 100644 --- a/include/configs/smdk2410.h +++ b/include/configs/smdk2410.h @@ -78,13 +78,13 @@ #include #define CONFIG_BOOTDELAY 3 -//#define CONFIG_BOOTARGS "root=ramfs devfs=mount console=ttySA0,9600" -//#define CONFIG_ETHADDR 08:00:3e:26:0a:5b +/*#define CONFIG_BOOTARGS "root=ramfs devfs=mount console=ttySA0,9600" */ +/*#define CONFIG_ETHADDR 08:00:3e:26:0a:5b */ #define CONFIG_NETMASK 255.255.255.0 #define CONFIG_IPADDR 10.0.0.110 #define CONFIG_SERVERIP 10.0.0.1 -//#define CONFIG_BOOTFILE "elinos-lart" -//#define CONFIG_BOOTCOMMAND "tftp; bootm" +/*#define CONFIG_BOOTFILE "elinos-lart" */ +/*#define CONFIG_BOOTCOMMAND "tftp; bootm" */ #if (CONFIG_COMMANDS & CFG_CMD_KGDB) #define CONFIG_KGDB_BAUDRATE 115200 /* speed to run kgdb serial port */ diff --git a/include/flash.h b/include/flash.h index fe6e955..3045149 100644 --- a/include/flash.h +++ b/include/flash.h @@ -184,6 +184,7 @@ extern int flash_real_protect(flash_info_t *info, long sector, int prot); #define INTEL_ID_28F640C3T 0x88CC88CC /* 64M = 4M x 16 top boot sector */ #define INTEL_ID_28F640C3B 0x88CD88CD /* 64M = 4M x 16 bottom boot sector */ +#define INTEL_ID_28F128J3 0x89189818 /* 16M = 8M x 16 x 128 */ #define INTEL_ID_28F640J5 0x00150015 /* 64M = 128K x 64 */ #define INTEL_ID_28F320J3A 0x00160016 /* 32M = 128K x 32 */ #define INTEL_ID_28F640J3A 0x00170017 /* 64M = 128K x 64 */ diff --git a/include/net.h b/include/net.h index af63c40..e8adb83 100644 --- a/include/net.h +++ b/include/net.h @@ -18,6 +18,7 @@ #define CONFIG_NET_MULTI #endif #endif +#include /* for nton* / ntoh* stuff */ /* diff --git a/lib_arm/Makefile b/lib_arm/Makefile index 8ebc797..de5e5dd 100644 --- a/lib_arm/Makefile +++ b/lib_arm/Makefile @@ -25,9 +25,10 @@ include $(TOPDIR)/config.mk LIB = lib$(ARCH).a -AOBJS = +AOBJS = _udivsi3.o _umodsi3.o -COBJS = armlinux.o board.o +COBJS = armlinux.o board.o \ + cache.o div0.o OBJS = $(AOBJS) $(COBJS) diff --git a/lib_arm/_udivsi3.S b/lib_arm/_udivsi3.S new file mode 100644 index 0000000..d1543e9 --- /dev/null +++ b/lib_arm/_udivsi3.S @@ -0,0 +1,77 @@ +/* # 1 "libgcc1.S" */ +@ libgcc1 routines for ARM cpu. +@ Division routines, written by Richard Earnshaw, (rearnsha@armltd.co.uk) +dividend .req r0 +divisor .req r1 +result .req r2 +curbit .req r3 +ip .req r12 +sp .req r13 +lr .req r14 +pc .req r15 + .text + .globl __udivsi3 + .type __udivsi3 ,function + .align 0 + __udivsi3 : + cmp divisor, #0 + beq Ldiv0 + mov curbit, #1 + mov result, #0 + cmp dividend, divisor + bcc Lgot_result +Loop1: + @ Unless the divisor is very big, shift it up in multiples of + @ four bits, since this is the amount of unwinding in the main + @ division loop. Continue shifting until the divisor is + @ larger than the dividend. + cmp divisor, #0x10000000 + cmpcc divisor, dividend + movcc divisor, divisor, lsl #4 + movcc curbit, curbit, lsl #4 + bcc Loop1 +Lbignum: + @ For very big divisors, we must shift it a bit at a time, or + @ we will be in danger of overflowing. + cmp divisor, #0x80000000 + cmpcc divisor, dividend + movcc divisor, divisor, lsl #1 + movcc curbit, curbit, lsl #1 + bcc Lbignum +Loop3: + @ Test for possible subtractions, and note which bits + @ are done in the result. On the final pass, this may subtract + @ too much from the dividend, but the result will be ok, since the + @ "bit" will have been shifted out at the bottom. + cmp dividend, divisor + subcs dividend, dividend, divisor + orrcs result, result, curbit + cmp dividend, divisor, lsr #1 + subcs dividend, dividend, divisor, lsr #1 + orrcs result, result, curbit, lsr #1 + cmp dividend, divisor, lsr #2 + subcs dividend, dividend, divisor, lsr #2 + orrcs result, result, curbit, lsr #2 + cmp dividend, divisor, lsr #3 + subcs dividend, dividend, divisor, lsr #3 + orrcs result, result, curbit, lsr #3 + cmp dividend, #0 @ Early termination? + movnes curbit, curbit, lsr #4 @ No, any more bits to do? + movne divisor, divisor, lsr #4 + bne Loop3 +Lgot_result: + mov r0, result + mov pc, lr +Ldiv0: + str lr, [sp, #-4]! + bl __div0 (PLT) + mov r0, #0 @ about as wrong as it could be + ldmia sp!, {pc} + .size __udivsi3 , . - __udivsi3 +/* # 235 "libgcc1.S" */ +/* # 320 "libgcc1.S" */ +/* # 421 "libgcc1.S" */ +/* # 433 "libgcc1.S" */ +/* # 456 "libgcc1.S" */ +/* # 500 "libgcc1.S" */ +/* # 580 "libgcc1.S" */ diff --git a/lib_arm/_umodsi3.S b/lib_arm/_umodsi3.S new file mode 100644 index 0000000..89aee5a --- /dev/null +++ b/lib_arm/_umodsi3.S @@ -0,0 +1,88 @@ +/* # 1 "libgcc1.S" */ +@ libgcc1 routines for ARM cpu. +@ Division routines, written by Richard Earnshaw, (rearnsha@armltd.co.uk) +/* # 145 "libgcc1.S" */ +dividend .req r0 +divisor .req r1 +overdone .req r2 +curbit .req r3 +ip .req r12 +sp .req r13 +lr .req r14 +pc .req r15 + .text + .globl __umodsi3 + .type __umodsi3 ,function + .align 0 + __umodsi3 : + cmp divisor, #0 + beq Ldiv0 + mov curbit, #1 + cmp dividend, divisor + movcc pc, lr +Loop1: + @ Unless the divisor is very big, shift it up in multiples of + @ four bits, since this is the amount of unwinding in the main + @ division loop. Continue shifting until the divisor is + @ larger than the dividend. + cmp divisor, #0x10000000 + cmpcc divisor, dividend + movcc divisor, divisor, lsl #4 + movcc curbit, curbit, lsl #4 + bcc Loop1 +Lbignum: + @ For very big divisors, we must shift it a bit at a time, or + @ we will be in danger of overflowing. + cmp divisor, #0x80000000 + cmpcc divisor, dividend + movcc divisor, divisor, lsl #1 + movcc curbit, curbit, lsl #1 + bcc Lbignum +Loop3: + @ Test for possible subtractions. On the final pass, this may + @ subtract too much from the dividend, so keep track of which + @ subtractions are done, we can fix them up afterwards... + mov overdone, #0 + cmp dividend, divisor + subcs dividend, dividend, divisor + cmp dividend, divisor, lsr #1 + subcs dividend, dividend, divisor, lsr #1 + orrcs overdone, overdone, curbit, ror #1 + cmp dividend, divisor, lsr #2 + subcs dividend, dividend, divisor, lsr #2 + orrcs overdone, overdone, curbit, ror #2 + cmp dividend, divisor, lsr #3 + subcs dividend, dividend, divisor, lsr #3 + orrcs overdone, overdone, curbit, ror #3 + mov ip, curbit + cmp dividend, #0 @ Early termination? + movnes curbit, curbit, lsr #4 @ No, any more bits to do? + movne divisor, divisor, lsr #4 + bne Loop3 + @ Any subtractions that we should not have done will be recorded in + @ the top three bits of "overdone". Exactly which were not needed + @ are governed by the position of the bit, stored in ip. + @ If we terminated early, because dividend became zero, + @ then none of the below will match, since the bit in ip will not be + @ in the bottom nibble. + ands overdone, overdone, #0xe0000000 + moveq pc, lr @ No fixups needed + tst overdone, ip, ror #3 + addne dividend, dividend, divisor, lsr #3 + tst overdone, ip, ror #2 + addne dividend, dividend, divisor, lsr #2 + tst overdone, ip, ror #1 + addne dividend, dividend, divisor, lsr #1 + mov pc, lr +Ldiv0: + str lr, [sp, #-4]! + bl __div0 (PLT) + mov r0, #0 @ about as wrong as it could be + ldmia sp!, {pc} + .size __umodsi3 , . - __umodsi3 +/* # 320 "libgcc1.S" */ +/* # 421 "libgcc1.S" */ +/* # 433 "libgcc1.S" */ +/* # 456 "libgcc1.S" */ +/* # 500 "libgcc1.S" */ +/* # 580 "libgcc1.S" */ diff --git a/lib_arm/board.c b/lib_arm/board.c index 5f192c2..e9d3335 100644 --- a/lib_arm/board.c +++ b/lib_arm/board.c @@ -30,6 +30,9 @@ #include #include +const char version_string[] = + PPCBOOT_VERSION" (" __DATE__ " - " __TIME__ ")"; + #ifdef CONFIG_DRIVER_CS8900 extern void cs8900_get_enetaddr (uchar * addr); #endif @@ -68,6 +71,7 @@ void *sbrk (ptrdiff_t increment) * Init Utilities * ************************************************************************ * Some of this code should be moved into the core functions, + * or dropped completely, * but let's get it working (again) first... */ @@ -85,6 +89,49 @@ static int init_baudrate (void) return (0); } +static int display_banner (void) +{ + + printf ("\n\n%s\n\n", version_string); + printf ("ARMBoot code: %08lx -> %08lx\n", + _armboot_start, _armboot_end); +#ifdef CONFIG_USE_IRQ + printf ("IRQ Stack: %08lx\n", IRQ_STACK_START); + printf ("FIQ Stack: %08lx\n", FIQ_STACK_START); +#endif + return (0); +} + +/* + * WARNING: this code looks "cleaner" than the PowerPC version, but + * has the disadvantage that you either get nothing, or everything. + * On PowerPC, you might see "DRAM: " before the system hangs - which + * gives a simple yet clear indication which part of the + * initialization if failing. + */ +static int display_dram_config (void) +{ + DECLARE_GLOBAL_DATA_PTR; + int i; + + puts ("DRAM Configuration:\n"); + + for(i=0; ibd->bi_dram[i].start); + print_size (gd->bd->bi_dram[i].size, "\n"); + } + + return (0); +} + +static void display_flash_config (ulong size) +{ + puts ("Flash: "); + print_size (size, "\n"); +} + + + /* * Breath some life into the board... * @@ -117,7 +164,7 @@ init_fnc_t *init_sequence[] = { init_baudrate, /* initialze baudrate settings */ serial_init, /* serial communications setup */ display_banner, - interrupt_init, /* set up execptions */ + interrupt_init, /* set up exceptions */ dram_init, /* configure available RAM banks */ display_dram_config, diff --git a/lib_arm/cache.c b/lib_arm/cache.c new file mode 100644 index 0000000..4f3cbc2 --- /dev/null +++ b/lib_arm/cache.c @@ -0,0 +1,29 @@ +/* + * (C) Copyright 2002 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +/* for now: just dummy functions to satisfy the linker */ + +void flush_cache (unsigned long dummy1, unsigned long dummy2) +{ + return; +} diff --git a/lib_arm/div0.c b/lib_arm/div0.c new file mode 100644 index 0000000..6267bf1 --- /dev/null +++ b/lib_arm/div0.c @@ -0,0 +1,30 @@ +/* + * (C) Copyright 2002 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +/* Replacement (=dummy) for GNU/Linux division-by zero handler */ +void __div0 (void) +{ + extern void hang (void); + + hang(); +} diff --git a/lib_generic/display_options.c b/lib_generic/display_options.c index 6693763..ac04bff 100644 --- a/lib_generic/display_options.c +++ b/lib_generic/display_options.c @@ -1,5 +1,5 @@ /* - * (C) Copyright 2000 + * (C) Copyright 2000-2002 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. * * See file CREDITS for list of people who contributed to this @@ -34,3 +34,29 @@ int display_options (void) #endif return 0; } + +/* + * print sizes as "xxx kB", "xxx.y kB", "xxx MB" or "xxx.y MB" as needed; + * allow for optional trailing string (like "\n") + */ +void print_size (ulong size, const char *s) +{ + ulong m, n; + ulong d = 1 << 20; /* 1 MB */ + char c = 'M'; + + if (size < d) { /* print in kB */ + c = 'k'; + d = 1 << 10; + } + + n = size / d; + + m = (10 * (size - (n * d)) + (d / 2) ) / d; + + printf ("%2ld", n); + if (m) { + printf (".%ld", m); + } + printf (" %cB%s", c, s); +} diff --git a/lib_generic/string.c b/lib_generic/string.c index d3bd319..d6b84b7 100644 --- a/lib_generic/string.c +++ b/lib_generic/string.c @@ -20,16 +20,30 @@ #include #include -#define __HAVE_ARCH_BCOPY +#ifdef CONFIG_ARM +#undef __HAVE_ARCH_MEMCMP +#undef __HAVE_ARCH_MEMCPY +#undef __HAVE_ARCH_MEMMOVE +#undef __HAVE_ARCH_MEMSET +#undef __HAVE_ARCH_BCOPY +#undef __HAVE_ARCH_STRCAT +#undef __HAVE_ARCH_STRCHR +#undef __HAVE_ARCH_STRCMP +#undef __HAVE_ARCH_STRCPY +#undef __HAVE_ARCH_STRLEN +#undef __HAVE_ARCH_STRNCPY +#else #define __HAVE_ARCH_MEMCMP #define __HAVE_ARCH_MEMCPY #define __HAVE_ARCH_MEMMOVE #define __HAVE_ARCH_MEMSET +#define __HAVE_ARCH_BCOPY #define __HAVE_ARCH_STRCAT #define __HAVE_ARCH_STRCMP #define __HAVE_ARCH_STRCPY #define __HAVE_ARCH_STRLEN #define __HAVE_ARCH_STRNCPY +#endif #ifndef __HAVE_ARCH_STRNICMP /** diff --git a/lib_ppc/board.c b/lib_ppc/board.c index 4856362..afe74cd 100644 --- a/lib_ppc/board.c +++ b/lib_ppc/board.c @@ -204,7 +204,7 @@ static int init_func_ram (void) puts ("DRAM: "); if ((gd->ram_size = initdram (board_type)) > 0) { - printf ("%2ld MB\n", gd->ram_size >> 20); + print_size (gd->ram_size, "\n"); return (0); } puts (failed); @@ -650,11 +650,7 @@ void board_init_r (gd_t *id, ulong dest_addr) if ((flash_size = flash_init ()) > 0) { #ifdef CFG_FLASH_CHECKSUM - if (flash_size >= (1 << 20)) { - printf ("%2ld MB", flash_size >> 20); - } else { - printf ("%2ld kB", flash_size >> 10); - } + print_size (flash_size, ""); /* * Compute and print flash CRC if flashchecksum is set to 'y' * @@ -670,11 +666,7 @@ void board_init_r (gd_t *id, ulong dest_addr) } putc ('\n'); #else - if (flash_size >= (1 << 20)) { - printf ("%2ld MB\n", flash_size >> 20); - } else { - printf ("%2ld kB\n", flash_size >> 10); - } + print_size (flash_size, ""); #endif /* CFG_FLASH_CHECKSUM */ } else { puts (failed); diff --git a/net/tftp.c b/net/tftp.c index d7d90bd..3aa745b 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -296,10 +296,8 @@ TftpStart (void) printf ("Filename '%s'.", tftp_filename); if (NetBootFileSize) { - printf (" Size is %d%s kB => %x Bytes", - NetBootFileSize/2, - (NetBootFileSize%2) ? ".5" : "", - NetBootFileSize<<9); + printf (" Size is 0x%x Bytes = ", NetBootFileSize<<9); + print_size (NetBootFileSize<<9, ""); } putc ('\n');