diff options
author | wdenk <wdenk> | 2003-07-24 23:38:38 +0000 |
---|---|---|
committer | wdenk <wdenk> | 2003-07-24 23:38:38 +0000 |
commit | 27b207fd0a0941b03f27e2a82c0468b1a090c745 (patch) | |
tree | 4d339d7a2a00889f09a876425ce430be57de56e9 /tools/updater | |
parent | 2535d60277cc295adf75cd5721dcecd840c69a63 (diff) | |
download | u-boot-midas-27b207fd0a0941b03f27e2a82c0468b1a090c745.tar.gz u-boot-midas-27b207fd0a0941b03f27e2a82c0468b1a090c745.tar.bz2 u-boot-midas-27b207fd0a0941b03f27e2a82c0468b1a090c745.zip |
* Implement new mechanism to export U-Boot's functions to standalone
applications: instead of using (PPC-specific) system calls we now
use a jump table; please see doc/README.standalone for details
* Patch by Dave Westwood, 24 Jul 2003:
added support for Unity OS (a proprietary OS)
Diffstat (limited to 'tools/updater')
-rw-r--r-- | tools/updater/Makefile | 6 | ||||
-rw-r--r-- | tools/updater/cmd_flash.c | 52 | ||||
-rw-r--r-- | tools/updater/flash.c | 6 | ||||
-rw-r--r-- | tools/updater/flash_hw.c | 82 | ||||
-rw-r--r-- | tools/updater/string.c | 2 | ||||
-rw-r--r-- | tools/updater/update.c | 30 |
6 files changed, 89 insertions, 89 deletions
diff --git a/tools/updater/Makefile b/tools/updater/Makefile index 21b11ca409..3fa1912416 100644 --- a/tools/updater/Makefile +++ b/tools/updater/Makefile @@ -31,9 +31,9 @@ SRC = update.c flash.c flash_hw.c utils.c cmd_flash.c string.c ctype.c dummy ASRC = ppcstring.S OBJS = $(SRC:.c=.o) $(ASRC:.S=.o) -LIB = $(TOPDIR)/examples/libsyscall.a -LIBAOBJS= $(TOPDIR)/examples/syscall.o -LIBCOBJS= +LIB = $(TOPDIR)/examples/libstubs.a +LIBAOBJS= +LIBCOBJS= $(TOPDIR)/examples/stubs.o LIBOBJS = $(LIBAOBJS) $(LIBCOBJS) CPPFLAGS += -I$(TOPDIR) -I$(TOPDIR)/board/MAI/AmigaOneG3SE diff --git a/tools/updater/cmd_flash.c b/tools/updater/cmd_flash.c index 573546dbe9..c0e57729f7 100644 --- a/tools/updater/cmd_flash.c +++ b/tools/updater/cmd_flash.c @@ -97,7 +97,7 @@ int do_flinfo (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) if (argc == 1) { /* print info for all FLASH banks */ for (bank=0; bank <CFG_MAX_FLASH_BANKS; ++bank) { - mon_printf ("\nBank # %ld: ", bank+1); + printf ("\nBank # %ld: ", bank+1); flash_print_info (&flash_info[bank]); } @@ -106,11 +106,11 @@ int do_flinfo (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) bank = simple_strtoul(argv[1], NULL, 16); if ((bank < 1) || (bank > CFG_MAX_FLASH_BANKS)) { - mon_printf ("Only FLASH Banks # 1 ... # %d supported\n", + printf ("Only FLASH Banks # 1 ... # %d supported\n", CFG_MAX_FLASH_BANKS); return 1; } - mon_printf ("\nBank # %ld: ", bank); + printf ("\nBank # %ld: ", bank); flash_print_info (&flash_info[bank-1]); return 0; } @@ -122,13 +122,13 @@ int do_flerase(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) int rcode = 0; if (argc < 2) { - mon_printf ("Usage:\n%s\n", cmdtp->usage); + printf ("Usage:\n%s\n", cmdtp->usage); return 1; } if (strcmp(argv[1], "all") == 0) { for (bank=1; bank<=CFG_MAX_FLASH_BANKS; ++bank) { - mon_printf ("Erase Flash Bank # %ld ", bank); + printf ("Erase Flash Bank # %ld ", bank); info = &flash_info[bank-1]; rcode = flash_erase (info, 0, info->sector_count-1); } @@ -137,28 +137,28 @@ int do_flerase(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) if ((n = abbrev_spec(argv[1], &info, §_first, §_last)) != 0) { if (n < 0) { - mon_printf("Bad sector specification\n"); + printf("Bad sector specification\n"); return 1; } - mon_printf ("Erase Flash Sectors %d-%d in Bank # %d ", + printf ("Erase Flash Sectors %d-%d in Bank # %d ", sect_first, sect_last, (info-flash_info)+1); rcode = flash_erase(info, sect_first, sect_last); return rcode; } if (argc != 3) { - mon_printf ("Usage:\n%s\n", cmdtp->usage); + printf ("Usage:\n%s\n", cmdtp->usage); return 1; } if (strcmp(argv[1], "bank") == 0) { bank = simple_strtoul(argv[2], NULL, 16); if ((bank < 1) || (bank > CFG_MAX_FLASH_BANKS)) { - mon_printf ("Only FLASH Banks # 1 ... # %d supported\n", + printf ("Only FLASH Banks # 1 ... # %d supported\n", CFG_MAX_FLASH_BANKS); return 1; } - mon_printf ("Erase Flash Bank # %ld ", bank); + printf ("Erase Flash Bank # %ld ", bank); info = &flash_info[bank-1]; rcode = flash_erase (info, 0, info->sector_count-1); return rcode; @@ -168,11 +168,11 @@ int do_flerase(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) addr_last = simple_strtoul(argv[2], NULL, 16); if (addr_first >= addr_last) { - mon_printf ("Usage:\n%s\n", cmdtp->usage); + printf ("Usage:\n%s\n", cmdtp->usage); return 1; } - mon_printf ("Erase Flash from 0x%08lx to 0x%08lx ", addr_first, addr_last); + printf ("Erase Flash from 0x%08lx to 0x%08lx ", addr_first, addr_last); rcode = flash_sect_erase(addr_first, addr_last); return rcode; } @@ -226,9 +226,9 @@ int flash_sect_erase (ulong addr_first, ulong addr_last) } } if (erased) { - /* mon_printf ("Erased %d sectors\n", erased); */ + /* printf ("Erased %d sectors\n", erased); */ } else { - mon_printf ("Error: start and/or end address" + printf ("Error: start and/or end address" " not on sector boundary\n"); rcode = 1; } @@ -244,7 +244,7 @@ int do_protect(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) int rcode = 0; if (argc < 3) { - mon_printf ("Usage:\n%s\n", cmdtp->usage); + printf ("Usage:\n%s\n", cmdtp->usage); return 1; } @@ -253,7 +253,7 @@ int do_protect(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) else if (strcmp(argv[1], "on") == 0) p = 1; else { - mon_printf ("Usage:\n%s\n", cmdtp->usage); + printf ("Usage:\n%s\n", cmdtp->usage); return 1; } @@ -263,7 +263,7 @@ int do_protect(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) if (info->flash_id == FLASH_UNKNOWN) { continue; } - /*mon_printf ("%sProtect Flash Bank # %ld\n", */ + /*printf ("%sProtect Flash Bank # %ld\n", */ /* p ? "" : "Un-", bank); */ for (i=0; i<info->sector_count; ++i) { @@ -286,10 +286,10 @@ int do_protect(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) if ((n = abbrev_spec(argv[2], &info, §_first, §_last)) != 0) { if (n < 0) { - mon_printf("Bad sector specification\n"); + printf("Bad sector specification\n"); return 1; } - /*mon_printf("%sProtect Flash Sectors %d-%d in Bank # %d\n", */ + /*printf("%sProtect Flash Sectors %d-%d in Bank # %d\n", */ /* p ? "" : "Un-", sect_first, sect_last, */ /* (info-flash_info)+1); */ for (i = sect_first; i <= sect_last; i++) { @@ -310,23 +310,23 @@ int do_protect(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) } if (argc != 4) { - mon_printf ("Usage:\n%s\n", cmdtp->usage); + printf ("Usage:\n%s\n", cmdtp->usage); return 1; } if (strcmp(argv[2], "bank") == 0) { bank = simple_strtoul(argv[3], NULL, 16); if ((bank < 1) || (bank > CFG_MAX_FLASH_BANKS)) { - mon_printf ("Only FLASH Banks # 1 ... # %d supported\n", + printf ("Only FLASH Banks # 1 ... # %d supported\n", CFG_MAX_FLASH_BANKS); return 1; } - mon_printf ("%sProtect Flash Bank # %ld\n", + printf ("%sProtect Flash Bank # %ld\n", p ? "" : "Un-", bank); info = &flash_info[bank-1]; if (info->flash_id == FLASH_UNKNOWN) { - mon_printf ("missing or unknown FLASH type\n"); + printf ("missing or unknown FLASH type\n"); return 1; } for (i=0; i<info->sector_count; ++i) { @@ -350,7 +350,7 @@ int do_protect(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) addr_last = simple_strtoul(argv[3], NULL, 16); if (addr_first >= addr_last) { - mon_printf ("Usage:\n%s\n", cmdtp->usage); + printf ("Usage:\n%s\n", cmdtp->usage); return 1; } rcode = flash_sect_protect (p, addr_first, addr_last); @@ -417,10 +417,10 @@ int flash_sect_protect (int p, ulong addr_first, ulong addr_last) } if (protected) { - /* mon_printf ("%sProtected %d sectors\n", */ + /* printf ("%sProtected %d sectors\n", */ /* p ? "" : "Un-", protected); */ } else { - mon_printf ("Error: start and/or end address" + printf ("Error: start and/or end address" " not on sector boundary\n"); rcode = 1; } diff --git a/tools/updater/flash.c b/tools/updater/flash.c index d2e11d2124..99b17195e5 100644 --- a/tools/updater/flash.c +++ b/tools/updater/flash.c @@ -157,9 +157,9 @@ flash_write (uchar *src, ulong addr, ulong cnt) } } - mon_printf("\rWriting "); - for (j=0; j<20; j++) mon_putc(177); - mon_printf("\rWriting "); + printf("\rWriting "); + for (j=0; j<20; j++) putc(177); + printf("\rWriting "); /* finally write data to flash */ for (info = info_first; info <= info_last && cnt>0; ++info) { diff --git a/tools/updater/flash_hw.c b/tools/updater/flash_hw.c index 1d782c61e0..62d1083c46 100644 --- a/tools/updater/flash_hw.c +++ b/tools/updater/flash_hw.c @@ -33,7 +33,7 @@ #undef DEBUG_FLASH #ifdef DEBUG_FLASH -#define DEBUGF(fmt,args...) mon_printf(fmt ,##args) +#define DEBUGF(fmt,args...) printf(fmt ,##args) #else #define DEBUGF(fmt,args...) #endif @@ -132,7 +132,7 @@ unsigned long flash_init (void) #endif } else { - mon_printf ("Warning: the BOOT Flash is not initialised !"); + printf ("Warning: the BOOT Flash is not initialised !"); } flash_to_mem(); @@ -287,7 +287,7 @@ static ulong flash_get_size (ulong addr, flash_info_t *info) } if (info->sector_count > CFG_MAX_FLASH_SECT) { - mon_printf ("** ERROR: sector count %d > max (%d) **\n", + printf ("** ERROR: sector count %d > max (%d) **\n", info->sector_count, CFG_MAX_FLASH_SECT); info->sector_count = CFG_MAX_FLASH_SECT; } @@ -346,16 +346,16 @@ int flash_erase (flash_info_t *info, int s_first, int s_last) if (s_first < 0 || s_first > s_last) { if (info->flash_id == FLASH_UNKNOWN) { - mon_printf ("- missing\n"); + printf ("- missing\n"); } else { - mon_printf ("- no sectors to erase\n"); + printf ("- no sectors to erase\n"); } flash_to_mem(); return 1; } if (info->flash_id == FLASH_UNKNOWN) { - mon_printf ("Can't erase unknown flash type %08lx - aborted\n", + printf ("Can't erase unknown flash type %08lx - aborted\n", info->flash_id); flash_to_mem(); return 1; @@ -369,10 +369,10 @@ int flash_erase (flash_info_t *info, int s_first, int s_last) } if (prot) { - mon_printf ("- Warning: %d protected sectors will not be erased!\n", + printf ("- Warning: %d protected sectors will not be erased!\n", prot); } else { - mon_printf (""); + printf (""); } l_sect = -1; @@ -406,7 +406,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last) enable_interrupts(); /* wait at least 80us - let's wait 1 ms */ - mon_udelay (1000); + udelay (1000); /* * We wait for the last triggered sector @@ -414,22 +414,22 @@ int flash_erase (flash_info_t *info, int s_first, int s_last) if (l_sect < 0) goto DONE; - start = mon_get_timer (0); + start = get_timer (0); last = start; addr = info->start[l_sect]; DEBUGF ("Start erase timeout: %d\n", CFG_FLASH_ERASE_TOUT); while ((in8(addr) & 0x80) != 0x80) { - if ((now = mon_get_timer(start)) > CFG_FLASH_ERASE_TOUT) { - mon_printf ("Timeout\n"); + if ((now = get_timer(start)) > CFG_FLASH_ERASE_TOUT) { + printf ("Timeout\n"); flash_reset (info->start[0]); flash_to_mem(); return 1; } /* show that we're waiting */ if ((now - last) > 1000) { /* every second */ - mon_putc ('.'); + putc ('.'); last = now; } iobarrier_rw(); @@ -440,7 +440,7 @@ DONE: flash_reset (info->start[0]); flash_to_mem(); - mon_printf (" done\n"); + printf (" done\n"); return 0; } @@ -484,7 +484,7 @@ int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt) wp += 4; } - mon_putc(219); + putc(219); /* * handle word aligned part @@ -492,7 +492,7 @@ int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt) while (cnt >= 4) { if (out_cnt>26214) { - mon_putc(219); + putc(219); out_cnt = 0; } data = 0; @@ -568,9 +568,9 @@ static int write_word (flash_info_t *info, ulong dest, ulong data) enable_interrupts(); /* data polling for D7 */ - start = mon_get_timer (0); + start = get_timer (0); while ((in8(dest+i) & 0x80) != (data_ch[i] & 0x80)) { - if (mon_get_timer(start) > CFG_FLASH_WRITE_TOUT) { + if (get_timer(start) > CFG_FLASH_WRITE_TOUT) { flash_reset (addr); flash_to_mem(); return (1); @@ -600,60 +600,60 @@ void flash_print_info (flash_info_t *info) int i; if (info->flash_id == FLASH_UNKNOWN) { - mon_printf ("missing or unknown FLASH type\n"); + printf ("missing or unknown FLASH type\n"); return; } switch (info->flash_id & FLASH_VENDMASK) { - case FLASH_MAN_AMD: mon_printf ("AMD "); break; - case FLASH_MAN_FUJ: mon_printf ("FUJITSU "); break; - case FLASH_MAN_BM: mon_printf ("BRIGHT MICRO "); break; - case FLASH_MAN_STM: mon_printf ("SGS THOMSON "); break; - default: mon_printf ("Unknown Vendor "); break; + case FLASH_MAN_AMD: printf ("AMD "); break; + case FLASH_MAN_FUJ: printf ("FUJITSU "); break; + case FLASH_MAN_BM: printf ("BRIGHT MICRO "); break; + case FLASH_MAN_STM: printf ("SGS THOMSON "); break; + default: printf ("Unknown Vendor "); break; } switch (info->flash_id & FLASH_TYPEMASK) { - case FLASH_AM040: mon_printf ("29F040 or 29LV040 (4 Mbit, uniform sectors)\n"); + case FLASH_AM040: printf ("29F040 or 29LV040 (4 Mbit, uniform sectors)\n"); break; - case FLASH_AM400B: mon_printf ("AM29LV400B (4 Mbit, bottom boot sect)\n"); + case FLASH_AM400B: printf ("AM29LV400B (4 Mbit, bottom boot sect)\n"); break; - case FLASH_AM400T: mon_printf ("AM29LV400T (4 Mbit, top boot sector)\n"); + case FLASH_AM400T: printf ("AM29LV400T (4 Mbit, top boot sector)\n"); break; - case FLASH_AM800B: mon_printf ("AM29LV800B (8 Mbit, bottom boot sect)\n"); + case FLASH_AM800B: printf ("AM29LV800B (8 Mbit, bottom boot sect)\n"); break; - case FLASH_AM800T: mon_printf ("AM29LV800T (8 Mbit, top boot sector)\n"); + case FLASH_AM800T: printf ("AM29LV800T (8 Mbit, top boot sector)\n"); break; - case FLASH_AM160B: mon_printf ("AM29LV160B (16 Mbit, bottom boot sect)\n"); + case FLASH_AM160B: printf ("AM29LV160B (16 Mbit, bottom boot sect)\n"); break; - case FLASH_AM160T: mon_printf ("AM29LV160T (16 Mbit, top boot sector)\n"); + case FLASH_AM160T: printf ("AM29LV160T (16 Mbit, top boot sector)\n"); break; - case FLASH_AM320B: mon_printf ("AM29LV320B (32 Mbit, bottom boot sect)\n"); + case FLASH_AM320B: printf ("AM29LV320B (32 Mbit, bottom boot sect)\n"); break; - case FLASH_AM320T: mon_printf ("AM29LV320T (32 Mbit, top boot sector)\n"); + case FLASH_AM320T: printf ("AM29LV320T (32 Mbit, top boot sector)\n"); break; - default: mon_printf ("Unknown Chip Type\n"); + default: printf ("Unknown Chip Type\n"); break; } if (info->size % 0x100000 == 0) { - mon_printf (" Size: %ld MB in %d Sectors\n", + printf (" Size: %ld MB in %d Sectors\n", info->size / 0x100000, info->sector_count); } else if (info->size % 0x400 == 0) { - mon_printf (" Size: %ld KB in %d Sectors\n", + printf (" Size: %ld KB in %d Sectors\n", info->size / 0x400, info->sector_count); } else { - mon_printf (" Size: %ld B in %d Sectors\n", + printf (" Size: %ld B in %d Sectors\n", info->size, info->sector_count); } - mon_printf (" Sector Start Addresses:"); + printf (" Sector Start Addresses:"); for (i=0; i<info->sector_count; ++i) { if ((i % 5) == 0) - mon_printf ("\n "); - mon_printf (" %08lX%s", + printf ("\n "); + printf (" %08lX%s", info->start[i], info->protect[i] ? " (RO)" : " " ); } - mon_printf ("\n"); + printf ("\n"); } diff --git a/tools/updater/string.c b/tools/updater/string.c index 8a8edec5cf..954fb01e20 100644 --- a/tools/updater/string.c +++ b/tools/updater/string.c @@ -164,7 +164,7 @@ char * strdup(const char *s) char *new; if ((s == NULL) || - ((new = mon_malloc (strlen(s) + 1)) == NULL) ) { + ((new = malloc (strlen(s) + 1)) == NULL) ) { return NULL; } diff --git a/tools/updater/update.c b/tools/updater/update.c index 26204fb632..b6d50d5be0 100644 --- a/tools/updater/update.c +++ b/tools/updater/update.c @@ -1,5 +1,5 @@ #include <common.h> -#include <syscall.h> +#include <exports.h> extern unsigned long __dummy; void do_reset (void); @@ -8,14 +8,14 @@ void do_updater(void); void _main(void) { int i; - mon_printf("U-Boot Firmware Updater\n\n\n"); - mon_printf("****************************************************\n" + printf("U-Boot Firmware Updater\n\n\n"); + printf("****************************************************\n" "* ATTENTION!! PLEASE READ THIS NOTICE CAREFULLY! *\n" "****************************************************\n\n" "This program will update your computer's firmware.\n" "Do NOT remove the disk, reset the machine, or do\n" "anything that might disrupt functionality. If this\n"); - mon_printf("Program fails, your computer might be unusable, and\n" + printf("Program fails, your computer might be unusable, and\n" "you will need to return your board for reflashing.\n" "If you find this too risky, remove the diskette and\n" "switch off your machine now. Otherwise press the \n" @@ -23,8 +23,8 @@ void _main(void) do { char x; - while (!mon_tstc()); - x = mon_getc(); + while (!tstc()); + x = getc(); if (x == ' ') break; } while (1); @@ -32,14 +32,14 @@ void _main(void) i = 5; - mon_printf("\nUpdate done. Please remove diskette.\n"); - mon_printf("The machine will automatically reset in %d seconds\n", i); - mon_printf("You can switch off/reset now when the floppy is removed\n\n"); + printf("\nUpdate done. Please remove diskette.\n"); + printf("The machine will automatically reset in %d seconds\n", i); + printf("You can switch off/reset now when the floppy is removed\n\n"); while (i) { - mon_printf("Resetting in %d\r", i); - mon_udelay(1000000); + printf("Resetting in %d\r", i); + udelay(1000000); i--; } do_reset(); @@ -57,11 +57,11 @@ void do_updater(void) int rc; flash_sect_protect(0, 0xFFF00000, 0xFFF7FFFF); - mon_printf("Erasing "); + printf("Erasing "); flash_sect_erase(0xFFF00000, 0xFFF7FFFF); - mon_printf("Writing "); + printf("Writing "); rc = flash_write((uchar *)addr, 0xFFF00000, 0x7FFFF); - if (rc != 0) mon_printf("\nFlashing failed due to error %d\n", rc); - else mon_printf("\ndone\n"); + if (rc != 0) printf("\nFlashing failed due to error %d\n", rc); + else printf("\ndone\n"); flash_sect_protect(1, 0xFFF00000, 0xFFF7FFFF); } |