diff options
Diffstat (limited to 'common')
93 files changed, 619 insertions, 592 deletions
diff --git a/common/cmd_ambapp.c b/common/cmd_ambapp.c index bb20ab5..283c433 100644 --- a/common/cmd_ambapp.c +++ b/common/cmd_ambapp.c @@ -223,7 +223,7 @@ void ambapp_print_ahb(ahbctrl_pp_dev * ahb, int index) printf(" irq: %-2d (ver: %d)\n", irq, ver); } -int do_ambapp_print(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +int do_ambapp_print(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { /* Print AHB Masters */ diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c index d22eb66..fbe73f1 100644 --- a/common/cmd_bdinfo.c +++ b/common/cmd_bdinfo.c @@ -37,11 +37,12 @@ static void print_eth(int idx); #ifndef CONFIG_ARM /* PowerPC and other */ static void print_lnum(const char *, u64); +#endif -#ifdef CONFIG_PPC +#if defined(CONFIG_PPC) static void print_str(const char *, const char *); -int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { bd_t *bd = gd->bd; char buf[32]; @@ -119,28 +120,9 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 0; } -#elif defined(CONFIG_NIOS) /* NIOS*/ +#elif defined(CONFIG_NIOS2) -int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) -{ - bd_t *bd = gd->bd; - - print_num ("memstart", (ulong)bd->bi_memstart); - print_lnum ("memsize", (u64)bd->bi_memsize); - print_num ("flashstart", (ulong)bd->bi_flashstart); - print_num ("flashsize", (ulong)bd->bi_flashsize); - print_num ("flashoffset", (ulong)bd->bi_flashoffset); - - print_eth(0); - printf ("ip_addr = %pI4\n", &bd->bi_ip_addr); - printf ("baudrate = %ld bps\n", bd->bi_baudrate); - - return 0; -} - -#elif defined(CONFIG_NIOS2) /* Nios-II */ - -int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { bd_t *bd = gd->bd; @@ -164,9 +146,10 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 0; } -#elif defined(CONFIG_MICROBLAZE) /* ! PPC, which leaves Microblaze */ -int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +#elif defined(CONFIG_MICROBLAZE) + +int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { bd_t *bd = gd->bd; print_num ("mem start ", (ulong)bd->bi_memstart); @@ -186,8 +169,9 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 0; } -#elif defined(CONFIG_SPARC) /* SPARC */ -int do_bdinfo(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +#elif defined(CONFIG_SPARC) + +int do_bdinfo(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { bd_t *bd = gd->bd; @@ -218,10 +202,11 @@ int do_bdinfo(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) return 0; } -#elif defined(CONFIG_M68K) /* M68K */ +#elif defined(CONFIG_M68K) + static void print_str(const char *, const char *); -int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { bd_t *bd = gd->bd; char buf[32]; @@ -268,9 +253,10 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } #elif defined(CONFIG_BLACKFIN) + static void print_str(const char *, const char *); -int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { bd_t *bd = gd->bd; char buf[32]; @@ -296,9 +282,9 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 0; } -#else /* ! PPC, which leaves MIPS */ +#elif defined(CONFIG_MIPS) -int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { bd_t *bd = gd->bd; @@ -315,12 +301,31 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 0; } -#endif /* MIPS */ -#else /* ARM */ +#elif defined(CONFIG_AVR32) int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { + bd_t *bd = gd->bd; + + print_num ("boot_params", (ulong)bd->bi_boot_params); + print_num ("memstart", (ulong)bd->bi_memstart); + print_lnum ("memsize", (u64)bd->bi_memsize); + print_num ("flashstart", (ulong)bd->bi_flashstart); + print_num ("flashsize", (ulong)bd->bi_flashsize); + print_num ("flashoffset", (ulong)bd->bi_flashoffset); + + print_eth(0); + printf ("ip_addr = %pI4\n", &bd->bi_ip_addr); + printf ("baudrate = %lu bps\n", bd->bi_baudrate); + + return 0; +} + +#elif defined(CONFIG_ARM) + +int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{ int i; bd_t *bd = gd->bd; @@ -343,7 +348,9 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 0; } -#endif /* CONFIG_ARM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ +#else + #error "a case for this architecture does not exist!" +#endif static void print_num(const char *name, ulong value) { diff --git a/common/cmd_bedbug.c b/common/cmd_bedbug.c index 8be1c25..d01ee19 100644 --- a/common/cmd_bedbug.c +++ b/common/cmd_bedbug.c @@ -73,7 +73,7 @@ void bedbug_init (void) * Entry point from the interpreter to the disassembler. Repeated calls * will resume from the last disassembled address. * ====================================================================== */ -int do_bedbug_dis (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +int do_bedbug_dis (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { ulong addr; /* Address to start disassembly from */ ulong len; /* # of instructions to disassemble */ @@ -115,7 +115,7 @@ U_BOOT_CMD (ds, 3, 1, do_bedbug_dis, * instructions in consecutive memory locations until a '.' (period) is * entered on a line by itself. * ====================================================================== */ -int do_bedbug_asm (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +int do_bedbug_asm (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { long mem_addr; /* Address to assemble into */ unsigned long instr; /* Machine code for text */ @@ -167,7 +167,7 @@ U_BOOT_CMD (as, 2, 0, do_bedbug_asm, * CPU-specific break point set routine. * ====================================================================== */ -int do_bedbug_break (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +int do_bedbug_break (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { /* -------------------------------------------------- */ if (bug_ctx.do_break) @@ -263,7 +263,7 @@ void bedbug_main_loop (unsigned long addr, struct pt_regs *regs) * stopped flag in the context so that the breakpoint routine will * return. * ====================================================================== */ -int do_bedbug_continue (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +int do_bedbug_continue (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { /* -------------------------------------------------- */ @@ -286,7 +286,7 @@ U_BOOT_CMD (continue, 1, 0, do_bedbug_continue, * the address passes control to the CPU-specific set breakpoint routine * for the current breakpoint number. * ====================================================================== */ -int do_bedbug_step (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +int do_bedbug_step (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { unsigned long addr; /* Address to stop at */ @@ -317,7 +317,7 @@ U_BOOT_CMD (step, 1, 1, do_bedbug_step, * the address passes control to the CPU-specific set breakpoint routine * for the current breakpoint number. * ====================================================================== */ -int do_bedbug_next (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +int do_bedbug_next (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { unsigned long addr; /* Address to stop at */ @@ -346,7 +346,7 @@ U_BOOT_CMD (next, 1, 1, do_bedbug_next, * Interpreter command to print the current stack. This assumes an EABI * architecture, so it starts with GPR R1 and works back up the stack. * ====================================================================== */ -int do_bedbug_stack (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +int do_bedbug_stack (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { unsigned long sp; /* Stack pointer */ unsigned long func; /* LR from stack */ @@ -391,7 +391,7 @@ U_BOOT_CMD (where, 1, 1, do_bedbug_stack, * Interpreter command to dump the registers. Calls the CPU-specific * show registers routine. * ====================================================================== */ -int do_bedbug_rdump (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +int do_bedbug_rdump (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { /* -------------------------------------------------- */ diff --git a/common/cmd_bmp.c b/common/cmd_bmp.c index 583b009..5ec798c 100644 --- a/common/cmd_bmp.c +++ b/common/cmd_bmp.c @@ -90,7 +90,7 @@ bmp_image_t *gunzip_bmp(unsigned long addr, unsigned long *lenp) } #endif -static int do_bmp_info(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +static int do_bmp_info(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { ulong addr; @@ -109,7 +109,7 @@ static int do_bmp_info(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) return (bmp_info(addr)); } -static int do_bmp_display(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +static int do_bmp_display(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { ulong addr; int x = 0, y = 0; @@ -149,7 +149,7 @@ static cmd_tbl_t cmd_bmp_sub[] = { * Return: None * */ -static int do_bmp(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +static int do_bmp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { cmd_tbl_t *c; diff --git a/common/cmd_boot.c b/common/cmd_boot.c index bfc1db2..9ccc8c7 100644 --- a/common/cmd_boot.c +++ b/common/cmd_boot.c @@ -30,12 +30,12 @@ /* Allow ports to override the default behavior */ __attribute__((weak)) -unsigned long do_go_exec (ulong (*entry)(int, char *[]), int argc, char *argv[]) +unsigned long do_go_exec (ulong (*entry)(int, char * const []), int argc, char * const argv[]) { return entry (argc, argv); } -int do_go (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_go (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { ulong addr, rc; int rcode = 0; @@ -69,7 +69,7 @@ U_BOOT_CMD( " passing 'arg' as arguments" ); -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 * const argv[]); U_BOOT_CMD( reset, 1, 0, do_reset, diff --git a/common/cmd_bootldr.c b/common/cmd_bootldr.c index b2a8b0e..c7f14d9 100644 --- a/common/cmd_bootldr.c +++ b/common/cmd_bootldr.c @@ -142,7 +142,7 @@ static void ldr_exec(void *addr) * to also add booting from SPI, or TWI, but this function does * not currently support that. */ -int do_bootldr(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_bootldr(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { void *addr; diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index da06009..bf77fb4 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -78,7 +78,7 @@ static int image_info (unsigned long addr); #if defined(CONFIG_CMD_IMLS) #include <flash.h> 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 * const argv[]); #endif #ifdef CONFIG_SILENT_CONSOLE @@ -90,9 +90,9 @@ static image_header_t *image_get_kernel (ulong img_addr, int verify); static int fit_check_kernel (const void *fit, int os_noffset, int verify); #endif -static void *boot_get_kernel (cmd_tbl_t *cmdtp, int flag,int argc, char *argv[], +static void *boot_get_kernel (cmd_tbl_t *cmdtp, int flag,int argc, char * const argv[], bootm_headers_t *images, ulong *os_data, ulong *os_len); -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 * const argv[]); /* * Continue booting an OS image; caller already has: @@ -102,7 +102,7 @@ extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); * - loaded (first part of) image to header load address, * - disabled interrupts. */ -typedef int boot_os_fn (int flag, int argc, char *argv[], +typedef int boot_os_fn (int flag, int argc, char * const argv[], bootm_headers_t *images); /* pointers to os/initrd/fdt */ #ifdef CONFIG_BOOTM_LINUX @@ -121,8 +121,8 @@ static boot_os_fn do_bootm_rtems; #if defined(CONFIG_CMD_ELF) static boot_os_fn do_bootm_vxworks; static boot_os_fn do_bootm_qnxelf; -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_bootvx (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]); +int do_bootelf (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]); #endif #if defined(CONFIG_INTEGRITY) static boot_os_fn do_bootm_integrity; @@ -174,8 +174,6 @@ void arch_preboot_os(void) __attribute__((weak, alias("__arch_preboot_os"))); #define IH_INITRD_ARCH IH_ARCH_MICROBLAZE #elif defined(__mips__) #define IH_INITRD_ARCH IH_ARCH_MIPS -#elif defined(__nios__) - #define IH_INITRD_ARCH IH_ARCH_NIOS #elif defined(__nios2__) #define IH_INITRD_ARCH IH_ARCH_NIOS2 #elif defined(__PPC__) @@ -208,7 +206,7 @@ static void bootm_start_lmb(void) #endif } -static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { void *os_hdr; int ret; @@ -440,10 +438,10 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress) return 0; } -static int bootm_start_standalone(ulong iflag, int argc, char *argv[]) +static int bootm_start_standalone(ulong iflag, int argc, char * const argv[]) { char *s; - int (*appl)(int, char *[]); + int (*appl)(int, char * const []); /* Don't start if "autostart" is set to "no" */ if (((s = getenv("autostart")) != NULL) && (strcmp(s, "no") == 0)) { @@ -452,7 +450,7 @@ static int bootm_start_standalone(ulong iflag, int argc, char *argv[]) setenv("filesize", buf); return 0; } - appl = (int (*)(int, char *[]))ntohl(images.ep); + appl = (int (*)(int, char * const []))ntohl(images.ep); (*appl)(argc-1, &argv[1]); return 0; @@ -475,7 +473,7 @@ static cmd_tbl_t cmd_bootm_sub[] = { U_BOOT_CMD_MKENT(go, 0, 1, (void *)BOOTM_STATE_OS_GO, "", ""), }; -int do_bootm_subcommand (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_bootm_subcommand (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { int ret = 0; int state; @@ -578,7 +576,7 @@ int do_bootm_subcommand (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) /* bootm - boot application image from image in memory */ /*******************************************************************/ -int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { ulong iflag; ulong load_end = 0; @@ -637,15 +635,6 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) usb_stop(); #endif -#ifdef CONFIG_AMIGAONEG3SE - /* - * We've possible left the caches enabled during - * bios emulation, so turn them off again - */ - icache_disable(); - dcache_disable(); -#endif - ret = bootm_load_os(images.os, &load_end, 1); if (ret < 0) { @@ -822,7 +811,7 @@ static int fit_check_kernel (const void *fit, int os_noffset, int verify) * pointer to image header if valid image was found, plus kernel start * address and length, otherwise NULL */ -static void *boot_get_kernel (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], +static void *boot_get_kernel (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[], bootm_headers_t *images, ulong *os_data, ulong *os_len) { image_header_t *hdr; @@ -1023,7 +1012,7 @@ U_BOOT_CMD( /* bootd - boot default image */ /*******************************************************************/ #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 * const argv[]) { int rcode = 0; @@ -1058,7 +1047,7 @@ U_BOOT_CMD( /* iminfo - print header info for a requested image */ /*******************************************************************/ #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 * const argv[]) { int arg; ulong addr; @@ -1145,7 +1134,7 @@ U_BOOT_CMD( /* imls - list all images found in flash */ /*******************************************************************/ #if defined(CONFIG_CMD_IMLS) -int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { flash_info_t *info; int i, j; @@ -1248,7 +1237,7 @@ static void fixup_silent_linux () /*******************************************************************/ #ifdef CONFIG_BOOTM_NETBSD -static int do_bootm_netbsd (int flag, int argc, char *argv[], +static int do_bootm_netbsd (int flag, int argc, char * const argv[], bootm_headers_t *images) { void (*loader)(bd_t *, image_header_t *, char *, char *); @@ -1336,7 +1325,7 @@ static int do_bootm_netbsd (int flag, int argc, char *argv[], #endif /* CONFIG_BOOTM_NETBSD*/ #ifdef CONFIG_LYNXKDI -static int do_bootm_lynxkdi (int flag, int argc, char *argv[], +static int do_bootm_lynxkdi (int flag, int argc, char * const argv[], bootm_headers_t *images) { image_header_t *hdr = &images->legacy_hdr_os_copy; @@ -1358,7 +1347,7 @@ static int do_bootm_lynxkdi (int flag, int argc, char *argv[], #endif /* CONFIG_LYNXKDI */ #ifdef CONFIG_BOOTM_RTEMS -static int do_bootm_rtems (int flag, int argc, char *argv[], +static int do_bootm_rtems (int flag, int argc, char * const argv[], bootm_headers_t *images) { void (*entry_point)(bd_t *); @@ -1391,7 +1380,7 @@ static int do_bootm_rtems (int flag, int argc, char *argv[], #endif /* CONFIG_BOOTM_RTEMS */ #if defined(CONFIG_CMD_ELF) -static int do_bootm_vxworks (int flag, int argc, char *argv[], +static int do_bootm_vxworks (int flag, int argc, char * const argv[], bootm_headers_t *images) { char str[80]; @@ -1413,7 +1402,7 @@ static int do_bootm_vxworks (int flag, int argc, char *argv[], return 1; } -static int do_bootm_qnxelf(int flag, int argc, char *argv[], +static int do_bootm_qnxelf(int flag, int argc, char * const argv[], bootm_headers_t *images) { char *local_args[2]; @@ -1439,7 +1428,7 @@ static int do_bootm_qnxelf(int flag, int argc, char *argv[], #endif #ifdef CONFIG_INTEGRITY -static int do_bootm_integrity (int flag, int argc, char *argv[], +static int do_bootm_integrity (int flag, int argc, char * const argv[], bootm_headers_t *images) { void (*entry_point)(void); diff --git a/common/cmd_cache.c b/common/cmd_cache.c index 1202258..be87b5c 100644 --- a/common/cmd_cache.c +++ b/common/cmd_cache.c @@ -29,7 +29,7 @@ static int on_off (const char *); -int do_icache ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_icache ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { switch (argc) { case 2: /* on / off */ @@ -55,7 +55,7 @@ int do_icache ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 0; } -int do_dcache ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_dcache ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { switch (argc) { case 2: /* on / off */ diff --git a/common/cmd_console.c b/common/cmd_console.c index 178fbfe..d8cad6b 100644 --- a/common/cmd_console.c +++ b/common/cmd_console.c @@ -29,7 +29,7 @@ #include <stdio_dev.h> extern void _do_coninfo (void); -int do_coninfo (cmd_tbl_t * cmd, int flag, int argc, char *argv[]) +int do_coninfo (cmd_tbl_t * cmd, int flag, int argc, char * const argv[]) { int l; struct list_head *list = stdio_get_list(); diff --git a/common/cmd_cplbinfo.c b/common/cmd_cplbinfo.c index 1a044d2..fc6abff 100644 --- a/common/cmd_cplbinfo.c +++ b/common/cmd_cplbinfo.c @@ -42,7 +42,7 @@ static void show_cplb_table(uint32_t *addr, uint32_t *data) /* * display current instruction and data cplb tables */ -int do_cplbinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_cplbinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { printf("%s CPLB table [%08x]:\n", "Instruction", *(uint32_t *)DMEM_CONTROL); show_cplb_table((uint32_t *)ICPLB_ADDR0, (uint32_t *)ICPLB_DATA0); diff --git a/common/cmd_cramfs.c b/common/cmd_cramfs.c index 55e2d36..ab10450 100644 --- a/common/cmd_cramfs.c +++ b/common/cmd_cramfs.c @@ -98,7 +98,7 @@ extern int cramfs_info (struct part_info *info); * @param argv arguments list * @return 0 on success, 1 otherwise */ -int do_cramfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_cramfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *filename; int size; @@ -163,7 +163,7 @@ int do_cramfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) * @param argv arguments list * @return 0 on success, 1 otherwise */ -int do_cramfs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_cramfs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *filename = "/"; int ret; diff --git a/common/cmd_dataflash_mmc_mux.c b/common/cmd_dataflash_mmc_mux.c index 97e303e..de4e676 100644 --- a/common/cmd_dataflash_mmc_mux.c +++ b/common/cmd_dataflash_mmc_mux.c @@ -26,7 +26,7 @@ static int mmc_nspi (const char *); -int do_dataflash_mmc_mux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_dataflash_mmc_mux (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { switch (argc) { case 2: /* on / off */ diff --git a/common/cmd_date.c b/common/cmd_date.c index 3141a39..50b4240 100644 --- a/common/cmd_date.c +++ b/common/cmd_date.c @@ -43,7 +43,7 @@ const char *weekdays[] = { int mk_date (char *, struct rtc_time *); -int do_date (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_date (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { struct rtc_time tm; int rcode = 0; diff --git a/common/cmd_dcr.c b/common/cmd_dcr.c index 4f23b8d..45de8cd 100644 --- a/common/cmd_dcr.c +++ b/common/cmd_dcr.c @@ -36,7 +36,7 @@ unsigned long set_dcr (unsigned short, unsigned long); * Interpreter command to retrieve an AMCC PPC 4xx Device Control Register * ======================================================================= */ -int do_getdcr ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[] ) +int do_getdcr ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[] ) { unsigned short dcrn; /* Device Control Register Num */ unsigned long value; /* DCR's value */ @@ -63,7 +63,7 @@ int do_getdcr ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[] ) * Interpreter command to set an AMCC PPC 4xx Device Control Register * ====================================================================== */ -int do_setdcr (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +int do_setdcr (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { unsigned short dcrn; /* Device Control Register Num */ unsigned long value; @@ -110,7 +110,7 @@ int do_setdcr (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) * Device Control Register inderect addressing. * ======================================================================= */ -int do_getidcr (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_getidcr (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { unsigned short adr_dcrn; /* Device Control Register Num for Address */ unsigned short dat_dcrn; /* Device Control Register Num for Data */ @@ -166,7 +166,7 @@ int do_getidcr (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) * Device Control Register inderect addressing. * ======================================================================= */ -int do_setidcr (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +int do_setidcr (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { unsigned short adr_dcrn; /* Device Control Register Num for Address */ unsigned short dat_dcrn; /* Device Control Register Num for Data */ diff --git a/common/cmd_df.c b/common/cmd_df.c index 7f957fe..6a08666 100644 --- a/common/cmd_df.c +++ b/common/cmd_df.c @@ -6,7 +6,7 @@ #include <common.h> #include <df.h> -static int do_df(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +static int do_df(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { const char *cmd; diff --git a/common/cmd_diag.c b/common/cmd_diag.c index 0436c49..317ea66 100644 --- a/common/cmd_diag.c +++ b/common/cmd_diag.c @@ -28,7 +28,7 @@ #include <command.h> #include <post.h> -int do_diag (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +int do_diag (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { unsigned int i; diff --git a/common/cmd_display.c b/common/cmd_display.c index 3422395..6c11aa6 100644 --- a/common/cmd_display.c +++ b/common/cmd_display.c @@ -30,7 +30,7 @@ #define CWORD_CLEAR 0x80 #define CLEAR_DELAY (110 * 2) -int do_display (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_display (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { int i; int pos; diff --git a/common/cmd_dtt.c b/common/cmd_dtt.c index 3cfd36e..3388e43 100644 --- a/common/cmd_dtt.c +++ b/common/cmd_dtt.c @@ -28,7 +28,7 @@ #include <dtt.h> #include <i2c.h> -int do_dtt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +int do_dtt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { int i; unsigned char sensors[] = CONFIG_DTT_SENSORS; diff --git a/common/cmd_echo.c b/common/cmd_echo.c index 3ec4d48..43a6da5 100644 --- a/common/cmd_echo.c +++ b/common/cmd_echo.c @@ -24,7 +24,7 @@ #include <common.h> #include <command.h> -int do_echo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_echo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { int i; int putnl = 1; diff --git a/common/cmd_eeprom.c b/common/cmd_eeprom.c index 519b510..129162c 100644 --- a/common/cmd_eeprom.c +++ b/common/cmd_eeprom.c @@ -60,7 +60,7 @@ extern int eeprom_write_enable (unsigned dev_addr, int state); /* ------------------------------------------------------------------------- */ #if defined(CONFIG_CMD_EEPROM) -int do_eeprom ( cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +int do_eeprom ( cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { const char *const fmt = "\nEEPROM @0x%lX %s: addr %08lx off %04lx count %ld ... "; diff --git a/common/cmd_elf.c b/common/cmd_elf.c index 63f6fe7..104d6e6 100644 --- a/common/cmd_elf.c +++ b/common/cmd_elf.c @@ -29,7 +29,8 @@ unsigned long load_elf_image (unsigned long addr); /* Allow ports to override the default behavior */ __attribute__((weak)) -unsigned long do_bootelf_exec (ulong (*entry)(int, char *[]), int argc, char *argv[]) +unsigned long do_bootelf_exec (ulong (*entry)(int, char * const[]), + int argc, char * const argv[]) { unsigned long ret; @@ -56,7 +57,7 @@ unsigned long do_bootelf_exec (ulong (*entry)(int, char *[]), int argc, char *ar /* ====================================================================== * Interpreter command to boot an arbitrary ELF image from memory. * ====================================================================== */ -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 * const argv[]) { unsigned long addr; /* Address of the ELF image */ unsigned long rc; /* Return value from user code */ @@ -93,7 +94,7 @@ int do_bootelf (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) * be either an ELF image or a raw binary. Will attempt to setup the * bootline and other parameters correctly. * ====================================================================== */ -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 * const argv[]) { unsigned long addr; /* Address of image */ unsigned long bootaddr; /* Address to put the bootline */ diff --git a/common/cmd_exit.c b/common/cmd_exit.c index ed876d8..f3fc8f5 100644 --- a/common/cmd_exit.c +++ b/common/cmd_exit.c @@ -24,7 +24,7 @@ #include <common.h> #include <command.h> -int do_exit(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_exit(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { int r; diff --git a/common/cmd_ext2.c b/common/cmd_ext2.c index b7e4048..49021cd 100644 --- a/common/cmd_ext2.c +++ b/common/cmd_ext2.c @@ -56,7 +56,7 @@ #define PRINTF(fmt,args...) #endif -int do_ext2ls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_ext2ls (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *filename = "/"; int dev=0; @@ -123,7 +123,7 @@ U_BOOT_CMD( /****************************************************************************** * Ext2fs boot command intepreter. Derived from diskboot */ -int do_ext2load (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_ext2load (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *filename = NULL; char *ep; diff --git a/common/cmd_fat.c b/common/cmd_fat.c index f3089a2..ede7308 100644 --- a/common/cmd_fat.c +++ b/common/cmd_fat.c @@ -33,7 +33,7 @@ #include <fat.h> -int do_fat_fsload (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_fat_fsload (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { long size; unsigned long offset; @@ -94,7 +94,7 @@ U_BOOT_CMD( " to address 'addr' from dos filesystem" ); -int do_fat_ls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_fat_ls (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *filename = "/"; int ret; @@ -141,7 +141,7 @@ U_BOOT_CMD( " - list files from 'dev' on 'interface' in a 'directory'" ); -int do_fat_fsinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_fat_fsinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { int dev=0; int part=1; @@ -227,7 +227,7 @@ int find_fat_partition (void) } int -do_fat_dump (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) +do_fat_dump (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char * const argv[]) { __u8 block[1024]; int ret; diff --git a/common/cmd_fdc.c b/common/cmd_fdc.c index 8e18c71..486d5d4 100644 --- a/common/cmd_fdc.c +++ b/common/cmd_fdc.c @@ -183,31 +183,6 @@ static FDC_COMMAND_STRUCT cmd; /* global command struct */ #define CONFIG_SYS_ISA_IO_OFFSET 0 #endif - -#ifdef CONFIG_AMIGAONEG3SE -unsigned char INT6_Status; - -void fdc_interrupt(void) -{ - INT6_Status = 0x80; -} - -/* waits for an interrupt (polling) */ -int wait_for_fdc_int(void) -{ - unsigned long timeout; - timeout = FDC_TIME_OUT; - while(((volatile)INT6_Status & 0x80) == 0) { - timeout--; - udelay(10); - if(timeout == 0) /* timeout occured */ - return FALSE; - } - INT6_Status = 0; - return TRUE; -} -#endif - /* Supporting Functions */ /* reads a Register of the FDC */ unsigned char read_fdc_reg(unsigned int addr) @@ -230,7 +205,6 @@ void write_fdc_reg(unsigned int addr, unsigned char val) tmp[0]=val; } -#ifndef CONFIG_AMIGAONEG3SE /* waits for an interrupt (polling) */ int wait_for_fdc_int(void) { @@ -245,8 +219,6 @@ int wait_for_fdc_int(void) return TRUE; } -#endif - /* reads a byte from the FIFO of the FDC and checks direction and RQM bit of the MSR. returns -1 if timeout, or byte if ok */ int read_fdc_byte(void) @@ -438,7 +410,6 @@ int fdc_seek(FDC_COMMAND_STRUCT *pCMD,FD_GEO_STRUCT *pFG) return(fdc_issue_cmd(pCMD,pFG)); } -#ifndef CONFIG_AMIGAONEG3SE /* terminates current command, by not servicing the FIFO * waits for interrupt and fills in the result bytes */ int fdc_terminate(FDC_COMMAND_STRUCT *pCMD) @@ -452,27 +423,6 @@ int fdc_terminate(FDC_COMMAND_STRUCT *pCMD) } return TRUE; } -#endif -#ifdef CONFIG_AMIGAONEG3SE -int fdc_terminate(FDC_COMMAND_STRUCT *pCMD) -{ - int i; - for(i=0;i<100;i++) - udelay(500); /* wait 500usec for fifo overrun */ - while((INT6_Status&0x80)==0x00); /* wait as long as no int has occured */ - for(i=0;i<7;i++) { - pCMD->result[i]=(unsigned char)read_fdc_byte(); - } - INT6_Status = 0; - return TRUE; -} - -#endif - -#ifdef CONFIG_AMIGAONEG3SE -#define disable_interrupts() 0 -#define enable_interrupts() (void)0 -#endif /* reads data from FDC, seek commands are issued automatic */ int fdc_read_data(unsigned char *buffer, unsigned long blocks,FDC_COMMAND_STRUCT *pCMD, FD_GEO_STRUCT *pFG) @@ -593,11 +543,6 @@ retrycal: return TRUE; } -#ifdef CONFIG_AMIGAONEG3SE -#undef disable_interrupts() -#undef enable_interrupts() -#endif - /* Scan all drives and check if drive is present and disk is inserted */ int fdc_check_drive(FDC_COMMAND_STRUCT *pCMD, FD_GEO_STRUCT *pFG) { @@ -647,11 +592,6 @@ int fdc_setup(int drive, FDC_COMMAND_STRUCT *pCMD, FD_GEO_STRUCT *pFG) { int i; -#ifdef CONFIG_AMIGAONEG3SE - irq_install_handler(6, (interrupt_handler_t *)fdc_interrupt, NULL); - i8259_unmask_irq(6); -#endif - #ifdef CONFIG_SYS_FDC_HW_INIT fdc_hw_init (); #endif @@ -773,7 +713,7 @@ int fdc_fdos_read (void *buffer, int len) /**************************************************************************** * main routine do_fdcboot */ -int do_fdcboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_fdcboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { FD_GEO_STRUCT *pFG = (FD_GEO_STRUCT *)floppy_type; FDC_COMMAND_STRUCT *pCMD = &cmd; diff --git a/common/cmd_fdos.c b/common/cmd_fdos.c index 3cc6586..00f7e88 100644 --- a/common/cmd_fdos.c +++ b/common/cmd_fdos.c @@ -35,7 +35,7 @@ * do_fdosboot -- *----------------------------------------------------------------------------- */ -int do_fdosboot(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_fdosboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *name; char *ep; @@ -115,7 +115,7 @@ int do_fdosboot(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) * do_fdosls -- *----------------------------------------------------------------------------- */ -int do_fdosls(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_fdosls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *path = ""; int drive = CONFIG_SYS_FDC_DRIVE_NUMBER; diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c index 5df79ae..cd4c6de 100644 --- a/common/cmd_fdt.c +++ b/common/cmd_fdt.c @@ -42,7 +42,7 @@ DECLARE_GLOBAL_DATA_PTR; static int fdt_valid(void); -static int fdt_parse_prop(char **newval, int count, char *data, int *len); +static int fdt_parse_prop(char *const*newval, int count, char *data, int *len); static int fdt_print(const char *pathp, char *prop, int depth); /* @@ -63,7 +63,7 @@ void set_working_fdt_addr(void *addr) /* * Flattened Device Tree command, see the help for parameter definitions. */ -int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { if (argc < 2) { cmd_usage(cmdtp); @@ -515,7 +515,7 @@ static int fdt_valid(void) * data: A bytestream to be placed in the property * len: The length of the resulting bytestream */ -static int fdt_parse_prop(char **newval, int count, char *data, int *len) +static int fdt_parse_prop(char * const *newval, int count, char *data, int *len) { char *cp; /* temporary char pointer */ char *newp; /* temporary newval char pointer */ diff --git a/common/cmd_flash.c b/common/cmd_flash.c index 6361c4e..5d8fb7a 100644 --- a/common/cmd_flash.c +++ b/common/cmd_flash.c @@ -287,7 +287,7 @@ flash_fill_sect_ranges (ulong addr_first, ulong addr_last, } #endif /* CONFIG_SYS_NO_FLASH */ -int do_flinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_flinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { #ifndef CONFIG_SYS_NO_FLASH ulong bank; @@ -319,7 +319,7 @@ int do_flinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 0; } -int do_flerase (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_flerase (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { #ifndef CONFIG_SYS_NO_FLASH flash_info_t *info; @@ -461,7 +461,7 @@ int flash_sect_erase (ulong addr_first, ulong addr_last) } #endif /* CONFIG_SYS_NO_FLASH */ -int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { #ifndef CONFIG_SYS_NO_FLASH flash_info_t *info; diff --git a/common/cmd_fpga.c b/common/cmd_fpga.c index 2e017b8..ddc7a05 100644 --- a/common/cmd_fpga.c +++ b/common/cmd_fpga.c @@ -156,7 +156,7 @@ int fpga_loadbitstream(unsigned long dev, char* fpgadata, size_t size) * If there is no data addr field, the fpgadata environment variable is used. * The info command requires no data address field. */ -int do_fpga (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +int do_fpga (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { int op, dev = FPGA_INVALID_DEVICE; size_t data_size = 0; diff --git a/common/cmd_help.c b/common/cmd_help.c index e860dfb..8c8178e 100644 --- a/common/cmd_help.c +++ b/common/cmd_help.c @@ -24,7 +24,7 @@ #include <common.h> #include <command.h> -int do_help(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +int do_help(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { return _do_help(&__u_boot_cmd_start, &__u_boot_cmd_end - &__u_boot_cmd_start, diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c index 8b9c2c9..fb9d3b0 100644 --- a/common/cmd_i2c.c +++ b/common/cmd_i2c.c @@ -178,7 +178,7 @@ static uint get_alen(char *arg) * i2c read {i2c_chip} {devaddr}{.0, .1, .2} {len} {memaddr} */ -static int do_i2c_read ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +static int do_i2c_read ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { u_char chip; uint devaddr, alen, length; @@ -226,7 +226,7 @@ static int do_i2c_read ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) * Syntax: * i2c md {i2c_chip} {addr}{.0, .1, .2} {len} */ -static int do_i2c_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +static int do_i2c_md ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { u_char chip; uint addr, alen, length; @@ -324,7 +324,7 @@ static int do_i2c_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) * Syntax: * i2c mw {i2c_chip} {addr}{.0, .1, .2} {data} [{count}] */ -static int do_i2c_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +static int do_i2c_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { uchar chip; ulong addr; @@ -388,7 +388,7 @@ static int do_i2c_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) * Syntax: * i2c crc32 {i2c_chip} {addr}{.0, .1, .2} {count} */ -static int do_i2c_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +static int do_i2c_crc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { uchar chip; ulong addr; @@ -452,7 +452,7 @@ static int do_i2c_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) */ static int -mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[]) +mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[]) { uchar chip; ulong addr; @@ -575,7 +575,7 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[]) * Syntax: * i2c probe {addr}{.0, .1, .2} */ -static int do_i2c_probe (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +static int do_i2c_probe (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { int j; #if defined(CONFIG_SYS_I2C_NOPROBES) @@ -619,7 +619,7 @@ static int do_i2c_probe (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) * {length} - Number of bytes to read * {delay} - A DECIMAL number and defaults to 1000 uSec */ -static int do_i2c_loop(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +static int do_i2c_loop(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { u_char chip; ulong alen; @@ -731,7 +731,7 @@ static void decode_bits (u_char const b, char const *str[], int const do_once) * Syntax: * i2c sdram {i2c_chip} */ -static int do_sdram (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +static int do_sdram (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { enum { unknown, EDO, SDRAM, DDR2 } type; @@ -1208,7 +1208,7 @@ static int do_sdram (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) #endif #if defined(CONFIG_I2C_MUX) -static int do_i2c_add_bus(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +static int do_i2c_add_bus(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { int ret=0; @@ -1239,7 +1239,7 @@ static int do_i2c_add_bus(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) #endif /* CONFIG_I2C_MUX */ #if defined(CONFIG_I2C_MULTI_BUS) -static int do_i2c_bus_num(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +static int do_i2c_bus_num(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { int bus_idx, ret=0; @@ -1257,7 +1257,7 @@ static int do_i2c_bus_num(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) } #endif /* CONFIG_I2C_MULTI_BUS */ -static int do_i2c_bus_speed(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +static int do_i2c_bus_speed(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { int speed, ret=0; @@ -1274,17 +1274,17 @@ static int do_i2c_bus_speed(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) return ret; } -static int do_i2c_mm(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +static int do_i2c_mm(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { return mod_i2c_mem (cmdtp, 1, flag, argc, argv); } -static int do_i2c_nm(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +static int do_i2c_nm(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { return mod_i2c_mem (cmdtp, 0, flag, argc, argv); } -static int do_i2c_reset(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +static int do_i2c_reset(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); return 0; @@ -1312,7 +1312,7 @@ static cmd_tbl_t cmd_i2c_sub[] = { U_BOOT_CMD_MKENT(speed, 1, 1, do_i2c_bus_speed, "", ""), }; -static int do_i2c(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +static int do_i2c(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { cmd_tbl_t *c; diff --git a/common/cmd_ide.c b/common/cmd_ide.c index 093ca9f..d486697 100644 --- a/common/cmd_ide.c +++ b/common/cmd_ide.c @@ -119,31 +119,22 @@ ulong ide_bus_offset[CONFIG_SYS_IDE_MAXBUS] = { }; -#ifndef CONFIG_AMIGAONEG3SE static int ide_bus_ok[CONFIG_SYS_IDE_MAXBUS]; -#else -static int ide_bus_ok[CONFIG_SYS_IDE_MAXBUS] = {0,}; -#endif block_dev_desc_t ide_dev_desc[CONFIG_SYS_IDE_MAXDEVICE]; /* ------------------------------------------------------------------------- */ #ifdef CONFIG_IDE_LED -#if !defined(CONFIG_KUP4K) && !defined(CONFIG_KUP4X) &&!defined(CONFIG_BMS2003) &&!defined(CONFIG_CPC45) +# if !defined(CONFIG_BMS2003) && \ + !defined(CONFIG_CPC45) && \ + !defined(CONFIG_KUP4K) && \ + !defined(CONFIG_KUP4X) static void ide_led (uchar led, uchar status); #else extern void ide_led (uchar led, uchar status); #endif #else -#ifndef CONFIG_AMIGAONEG3SE #define ide_led(a,b) /* dummy */ -#else -extern void ide_led(uchar led, uchar status); -#define LED_IDE1 1 -#define LED_IDE2 2 -#define CONFIG_IDE_LED 1 -#define DEVICE_LED(x) 1 -#endif #endif #ifdef CONFIG_IDE_RESET @@ -181,7 +172,7 @@ static void set_pcmcia_timing (int pmode); /* ------------------------------------------------------------------------- */ -int do_ide (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_ide (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { int rcode = 0; @@ -355,7 +346,7 @@ int do_ide (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } } -int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *boot_device = NULL; char *ep; @@ -562,12 +553,8 @@ void ide_init (void) #endif unsigned char c; int i, bus; -#if defined(CONFIG_AMIGAONEG3SE) || defined(CONFIG_SC3) +#if defined(CONFIG_SC3) unsigned int ata_reset_time = ATA_RESET_TIME; - char *s; -#endif -#ifdef CONFIG_AMIGAONEG3SE - unsigned int max_bus_scan; #endif #ifdef CONFIG_IDE_8xx_PCCARD extern int pcmcia_on (void); @@ -638,19 +625,8 @@ void ide_init (void) * Wait for IDE to get ready. * According to spec, this can take up to 31 seconds! */ -#ifndef CONFIG_AMIGAONEG3SE for (bus=0; bus<CONFIG_SYS_IDE_MAXBUS; ++bus) { int dev = bus * (CONFIG_SYS_IDE_MAXDEVICE / CONFIG_SYS_IDE_MAXBUS); -#else - s = getenv("ide_maxbus"); - if (s) - max_bus_scan = simple_strtol(s, NULL, 10); - else - max_bus_scan = CONFIG_SYS_IDE_MAXBUS; - - for (bus=0; bus<max_bus_scan; ++bus) { - int dev = bus * (CONFIG_SYS_IDE_MAXDEVICE / max_bus_scan); -#endif #ifdef CONFIG_IDE_8xx_PCCARD /* Skip non-ide devices from probing */ @@ -668,30 +644,19 @@ void ide_init (void) udelay (100000); /* 100 ms */ ide_outb (dev, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(dev)); udelay (100000); /* 100 ms */ -#if defined(CONFIG_AMIGAONEG3SE) || defined(CONFIG_SC3) - if ((s = getenv("ide_reset_timeout")) != NULL) - ata_reset_time = simple_strtol(s, NULL, 10); -#endif i = 0; do { udelay (10000); /* 10 ms */ c = ide_inb (dev, ATA_STATUS); i++; -#if defined(CONFIG_AMIGAONEG3SE) || defined(CONFIG_SC3) +#if defined(CONFIG_SC3) if (i > (ata_reset_time * 100)) { #else if (i > (ATA_RESET_TIME * 100)) { #endif puts ("** Timeout **\n"); ide_led ((LED_IDE1 | LED_IDE2), 0); /* LED's off */ -#ifdef CONFIG_AMIGAONEG3SE - /* If this is the second bus, the first one was OK */ - if (bus != 0) { - ide_bus_ok[bus] = 0; - goto skip_bus; - } -#endif return; } if ((i >= 100) && ((i%100)==0)) { @@ -714,9 +679,6 @@ void ide_init (void) WATCHDOG_RESET(); } -#ifdef CONFIG_AMIGAONEG3SE - skip_bus: -#endif putc ('\n'); ide_led ((LED_IDE1 | LED_IDE2), 0); /* LED's off */ @@ -1010,10 +972,6 @@ static void ide_ident (block_dev_desc_t *dev_desc) unsigned char c; hd_driveid_t *iop = (hd_driveid_t *)iobuf; -#ifdef CONFIG_AMIGAONEG3SE - int max_bus_scan; - char *s; -#endif #ifdef CONFIG_ATAPI int retries = 0; int do_retry = 0; @@ -1030,19 +988,6 @@ static void ide_ident (block_dev_desc_t *dev_desc) device=dev_desc->dev; printf (" Device %d: ", device); -#ifdef CONFIG_AMIGAONEG3SE - s = getenv("ide_maxbus"); - if (s) { - max_bus_scan = simple_strtol(s, NULL, 10); - } else { - max_bus_scan = CONFIG_SYS_IDE_MAXBUS; - } - if (device >= max_bus_scan*2) { - dev_desc->type=DEV_TYPE_UNKNOWN; - return; - } -#endif - ide_led (DEVICE_LED(device), 1); /* LED on */ /* Select device */ @@ -1086,10 +1031,6 @@ static void ide_ident (block_dev_desc_t *dev_desc) if (((c & ATA_STAT_DRQ) == 0) || ((c & (ATA_STAT_FAULT|ATA_STAT_ERR)) != 0) ) { #ifdef CONFIG_ATAPI -#ifdef CONFIG_AMIGAONEG3SE - s = getenv("ide_doreset"); - if (s && strcmp(s, "on") == 0) -#endif { /* Need to soft reset the device in case it's an ATAPI... */ debug ("Retrying...\n"); @@ -1601,7 +1542,6 @@ static void ide_reset (void) /* ------------------------------------------------------------------------- */ #if defined(CONFIG_IDE_LED) && \ - !defined(CONFIG_AMIGAONEG3SE)&& \ !defined(CONFIG_CPC45) && \ !defined(CONFIG_HMI10) && \ !defined(CONFIG_KUP4K) && \ @@ -1758,9 +1698,6 @@ unsigned char atapi_issue(int device,unsigned char* ccb,int ccblen, unsigned cha */ mask = ATA_STAT_BUSY|ATA_STAT_DRQ; res = 0; -#ifdef CONFIG_AMIGAONEG3SE -# warning THF: Removed LBA mode ??? -#endif ide_outb (device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device)); c = atapi_wait_mask(device,ATAPI_TIME_OUT,mask,res); if ((c & mask) != res) { @@ -1774,9 +1711,6 @@ unsigned char atapi_issue(int device,unsigned char* ccb,int ccblen, unsigned cha ide_outb (device, ATA_SECT_NUM, 0); ide_outb (device, ATA_CYL_LOW, (unsigned char)(buflen & 0xFF)); ide_outb (device, ATA_CYL_HIGH, (unsigned char)((buflen>>8) & 0xFF)); -#ifdef CONFIG_AMIGAONEG3SE -# warning THF: Removed LBA mode ??? -#endif ide_outb (device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device)); ide_outb (device, ATA_COMMAND, ATAPI_CMD_PACKET); @@ -1875,16 +1809,6 @@ unsigned char atapi_issue_autoreq (int device, unsigned char res,key,asc,ascq; int notready,unitattn; -#ifdef CONFIG_AMIGAONEG3SE - char *s; - unsigned int timeout, retrycnt; - - s = getenv("ide_cd_timeout"); - timeout = s ? (simple_strtol(s, NULL, 10)*1000000)/5 : 0; - - retrycnt = 0; -#endif - unitattn=ATAPI_UNIT_ATTN; notready=ATAPI_DRIVE_NOT_READY; @@ -1939,25 +1863,6 @@ retry: goto error; } -#ifdef CONFIG_AMIGAONEG3SE - if ((sense_data[2]&0xF)==0x0B) { - debug ("ABORTED COMMAND...retry\n"); - if (retrycnt++ < 4) - goto retry; - return (0xFF); - } - - if ((sense_data[2]&0xf) == 0x02 && - sense_data[12] == 0x04 && - sense_data[13] == 0x01 ) { - debug ("Waiting for unit to become active\n"); - udelay(timeout); - if (retrycnt++ < 4) - goto retry; - return 0xFF; - } -#endif /* CONFIG_AMIGAONEG3SE */ - printf ("ERROR: Unknown Sense key %02X ASC %02X ASCQ %02X\n",key,asc,ascq); error: debug ("ERROR Sense key %02X ASC %02X ASCQ %02X\n",key,asc,ascq); diff --git a/common/cmd_immap.c b/common/cmd_immap.c index 37e6058..1f59c1e 100644 --- a/common/cmd_immap.c +++ b/common/cmd_immap.c @@ -43,14 +43,14 @@ DECLARE_GLOBAL_DATA_PTR; static void -unimplemented ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +unimplemented ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { printf ("Sorry, but the '%s' command has not been implemented\n", cmdtp->name); } int -do_siuinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +do_siuinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR; @@ -81,7 +81,7 @@ do_siuinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } int -do_memcinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +do_memcinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR; @@ -133,7 +133,7 @@ do_memcinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } int -do_sitinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +do_sitinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { unimplemented (cmdtp, flag, argc, argv); return 0; @@ -141,7 +141,7 @@ do_sitinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) #ifdef CONFIG_8260 int -do_icinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +do_icinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { unimplemented (cmdtp, flag, argc, argv); return 0; @@ -149,7 +149,7 @@ do_icinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) #endif int -do_carinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +do_carinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR; @@ -233,7 +233,7 @@ static void binary (char *label, uint value, int nbits) #endif int -do_iopinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +do_iopinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR; @@ -316,7 +316,7 @@ do_iopinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) * use *uint and set the address based on cmd + port */ int -do_iopset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +do_iopset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { uint rcode = 0; iopin_t iopin; @@ -431,14 +431,14 @@ do_iopset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } int -do_dmainfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +do_dmainfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { unimplemented (cmdtp, flag, argc, argv); return 0; } int -do_fccinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +do_fccinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { unimplemented (cmdtp, flag, argc, argv); return 0; @@ -498,7 +498,7 @@ static void prbrg (int n, uint val) } int -do_brginfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +do_brginfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR; @@ -522,7 +522,7 @@ do_brginfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } int -do_i2cinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +do_i2cinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR; @@ -569,42 +569,42 @@ do_i2cinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } int -do_sccinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +do_sccinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { unimplemented (cmdtp, flag, argc, argv); return 0; } int -do_smcinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +do_smcinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { unimplemented (cmdtp, flag, argc, argv); return 0; } int -do_spiinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +do_spiinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { unimplemented (cmdtp, flag, argc, argv); return 0; } int -do_muxinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +do_muxinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { unimplemented (cmdtp, flag, argc, argv); return 0; } int -do_siinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +do_siinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { unimplemented (cmdtp, flag, argc, argv); return 0; } int -do_mccinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +do_mccinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { unimplemented (cmdtp, flag, argc, argv); return 0; diff --git a/common/cmd_irq.c b/common/cmd_irq.c index 2c7e6bb..4888328 100644 --- a/common/cmd_irq.c +++ b/common/cmd_irq.c @@ -24,7 +24,7 @@ #include <config.h> #include <command.h> -int do_interrupts(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_interrupts(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { if (argc != 2) { @@ -49,7 +49,7 @@ U_BOOT_CMD( ); /* Implemented in $(CPU)/interrupts.c */ -int do_irqinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_irqinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]); U_BOOT_CMD( irqinfo, 1, 1, do_irqinfo, diff --git a/common/cmd_itest.c b/common/cmd_itest.c index 58c5e7b..e88d6e0 100644 --- a/common/cmd_itest.c +++ b/common/cmd_itest.c @@ -160,7 +160,7 @@ int binary_test (char *op, char *arg1, char *arg2, int w) } /* command line interface to the shell test */ -int do_itest ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[] ) +int do_itest ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[] ) { int value, w; diff --git a/common/cmd_jffs2.c b/common/cmd_jffs2.c index 6799cca..0e7a6b0 100644 --- a/common/cmd_jffs2.c +++ b/common/cmd_jffs2.c @@ -485,7 +485,7 @@ static struct part_info* jffs2_part_info(struct mtd_device *dev, unsigned int pa * @param argv arguments list * @return 0 on success, 1 otherwise */ -int do_jffs2_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_jffs2_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *fsname; char *filename; @@ -549,7 +549,7 @@ int do_jffs2_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) * @param argv arguments list * @return 0 on success, 1 otherwise */ -int do_jffs2_ls(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_jffs2_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *filename = "/"; int ret; @@ -587,7 +587,7 @@ int do_jffs2_ls(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) * @param argv arguments list * @return 0 on success, 1 otherwise */ -int do_jffs2_fsinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_jffs2_fsinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { struct part_info *part; char *fsname; diff --git a/common/cmd_license.c b/common/cmd_license.c index 85a4871..90fd57e 100644 --- a/common/cmd_license.c +++ b/common/cmd_license.c @@ -30,7 +30,7 @@ #include <malloc.h> #include <license.h> -int do_license(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_license(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *tok, *dst = malloc(LICENSE_MAX); unsigned long len = LICENSE_MAX; diff --git a/common/cmd_load.c b/common/cmd_load.c index d6bbb78..52ed1fa 100644 --- a/common/cmd_load.c +++ b/common/cmd_load.c @@ -51,7 +51,7 @@ static int do_echo = 1; /* -------------------------------------------------------------------- */ #if defined(CONFIG_CMD_LOADS) -int do_load_serial (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_load_serial (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { long offset = 0; ulong addr; @@ -255,7 +255,7 @@ read_record (char *buf, ulong len) #if defined(CONFIG_CMD_SAVES) -int do_save_serial (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_save_serial (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { ulong offset = 0; ulong size = 0; @@ -433,7 +433,7 @@ int his_pad_count; /* number of pad chars he needs */ char his_pad_char; /* pad chars he needs */ char his_quote; /* quote chars he'll use */ -int do_load_serial_bin (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_load_serial_bin (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { ulong offset = 0; ulong addr; @@ -1091,7 +1091,7 @@ U_BOOT_CMD( /* -------------------------------------------------------------------- */ #if defined(CONFIG_CMD_HWFLOW) -int do_hwflow (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_hwflow (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { extern int hwflow_onoff(int); diff --git a/common/cmd_log.c b/common/cmd_log.c index 3653fe1..49deddd 100644 --- a/common/cmd_log.c +++ b/common/cmd_log.c @@ -193,7 +193,7 @@ void logbuff_log(char *msg) * Return: None * */ -int do_log (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_log (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *s; unsigned long i, start, size; diff --git a/common/cmd_mac.c b/common/cmd_mac.c index 20403da..1884c2a 100644 --- a/common/cmd_mac.c +++ b/common/cmd_mac.c @@ -24,7 +24,7 @@ #include <common.h> #include <command.h> -extern int do_mac(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +extern int do_mac(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]); U_BOOT_CMD( mac, 3, 1, do_mac, diff --git a/common/cmd_mem.c b/common/cmd_mem.c index 1839330..bcea399 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -43,7 +43,7 @@ #define PRINTF(fmt,args...) #endif -static int mod_mem(cmd_tbl_t *, int, int, int, char *[]); +static int mod_mem(cmd_tbl_t *, int, int, int, char * const []); /* Display values from last command. * Memory modify remembered values are different from display memory. @@ -60,7 +60,7 @@ static ulong base_address = 0; * md{.b, .w, .l} {addr} {len} */ #define DISP_LINE_LEN 16 -int do_mem_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_mem_md ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { ulong addr, length; #if defined(CONFIG_HAS_DATAFLASH) @@ -158,16 +158,16 @@ int do_mem_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return (rc); } -int do_mem_mm ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_mem_mm ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { return mod_mem (cmdtp, 1, flag, argc, argv); } -int do_mem_nm ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_mem_nm ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { return mod_mem (cmdtp, 0, flag, argc, argv); } -int do_mem_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_mem_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { ulong addr, writeval, count; int size; @@ -211,7 +211,7 @@ int do_mem_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } #ifdef CONFIG_MX_CYCLIC -int do_mem_mdc ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_mem_mdc ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { int i; ulong count; @@ -240,7 +240,7 @@ int do_mem_mdc ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 0; } -int do_mem_mwc ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_mem_mwc ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { int i; ulong count; @@ -270,7 +270,7 @@ int do_mem_mwc ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } #endif /* CONFIG_MX_CYCLIC */ -int do_mem_cmp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_mem_cmp (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { ulong addr1, addr2, count, ngood; int size; @@ -355,7 +355,7 @@ int do_mem_cmp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return rcode; } -int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { ulong addr, dest, count; int size; @@ -463,7 +463,7 @@ int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 0; } -int do_mem_base (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_mem_base (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { if (argc > 1) { /* Set new base address. @@ -476,7 +476,7 @@ int do_mem_base (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 0; } -int do_mem_loop (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_mem_loop (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { ulong addr, length, i, junk; int size; @@ -547,7 +547,7 @@ int do_mem_loop (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } #ifdef CONFIG_LOOPW -int do_mem_loopw (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_mem_loopw (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { ulong addr, length, i, data; int size; @@ -626,7 +626,7 @@ int do_mem_loopw (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) * configured using CONFIG_SYS_ALT_MEMTEST. The complete test loops until * interrupted by ctrl-c or by a failure of one of the sub-tests. */ -int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { vu_long *addr, *start, *end; ulong val; @@ -984,7 +984,7 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) * nm{.b, .w, .l} {addr} */ static int -mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[]) +mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[]) { ulong addr, i; int nbytes, size; @@ -1089,7 +1089,7 @@ mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[]) #ifndef CONFIG_CRC32_VERIFY -int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { ulong addr, length; ulong crc; @@ -1120,7 +1120,7 @@ int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) #else /* CONFIG_CRC32_VERIFY */ -int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { ulong addr, length; ulong crc; @@ -1128,7 +1128,7 @@ int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) ulong vcrc; int verify; int ac; - char **av; + char * const *av; if (argc < 3) { usage: @@ -1175,7 +1175,7 @@ int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) #endif /* CONFIG_CRC32_VERIFY */ #ifdef CONFIG_CMD_MD5SUM -int do_md5sum(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_md5sum(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { unsigned long addr, len; unsigned int i; @@ -1200,7 +1200,7 @@ int do_md5sum(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) #endif #ifdef CONFIG_CMD_SHA1 -int do_sha1sum(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_sha1sum(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { unsigned long addr, len; unsigned int i; @@ -1225,7 +1225,7 @@ int do_sha1sum(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) #endif #ifdef CONFIG_CMD_UNZIP -int do_unzip ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_unzip ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { unsigned long src, dst; unsigned long src_len = ~0UL, dst_len = ~0UL; diff --git a/common/cmd_mfsl.c b/common/cmd_mfsl.c index b19ad0e..eeef2cd 100644 --- a/common/cmd_mfsl.c +++ b/common/cmd_mfsl.c @@ -31,7 +31,7 @@ #include <command.h> #include <asm/asm.h> -int do_frd (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +int do_frd (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { unsigned int fslnum; unsigned int num; @@ -189,7 +189,7 @@ int do_frd (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) return 0; } -int do_fwr (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +int do_fwr (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { unsigned int fslnum; unsigned int num; @@ -348,7 +348,7 @@ int do_fwr (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) } -int do_rspr (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +int do_rspr (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { unsigned int reg = 0; unsigned int val = 0; diff --git a/common/cmd_mgdisk.c b/common/cmd_mgdisk.c index 3ba62f6..c2d5217 100644 --- a/common/cmd_mgdisk.c +++ b/common/cmd_mgdisk.c @@ -26,7 +26,7 @@ #include <mg_disk.h> -int do_mg_disk_cmd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_mg_disk_cmd (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { u32 from, to, size; diff --git a/common/cmd_mii.c b/common/cmd_mii.c index 65e13c3..1619a25 100644 --- a/common/cmd_mii.c +++ b/common/cmd_mii.c @@ -292,7 +292,7 @@ static void extract_range( } /* ---------------------------------------------------------------- */ -int do_mii (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +int do_mii (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { char op[2]; unsigned char addrlo, addrhi, reglo, reghi; diff --git a/common/cmd_misc.c b/common/cmd_misc.c index b0ced2f..8439da2 100644 --- a/common/cmd_misc.c +++ b/common/cmd_misc.c @@ -27,7 +27,7 @@ #include <common.h> #include <command.h> -int do_sleep (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_sleep (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { ulong start = get_timer(0); ulong delay; diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c index c67c9cf..698157f 100644 --- a/common/cmd_mmc.c +++ b/common/cmd_mmc.c @@ -28,7 +28,7 @@ #ifndef CONFIG_GENERIC_MMC static int curr_device = -1; -int do_mmc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_mmc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { int dev; @@ -114,7 +114,7 @@ static void print_mmcinfo(struct mmc *mmc) printf("Bus Width: %d-bit\n", mmc->bus_width); } -int do_mmcinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_mmcinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { struct mmc *mmc; int dev_num; @@ -140,7 +140,7 @@ U_BOOT_CMD(mmcinfo, 2, 0, do_mmcinfo, "" ); -int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { int rc = 0; diff --git a/common/cmd_mp.c b/common/cmd_mp.c index d78c209..4d7b871 100644 --- a/common/cmd_mp.c +++ b/common/cmd_mp.c @@ -24,7 +24,7 @@ #include <command.h> int -cpu_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +cpu_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { unsigned long cpuid; diff --git a/common/cmd_mtdparts.c b/common/cmd_mtdparts.c index 116e637..447486b 100644 --- a/common/cmd_mtdparts.c +++ b/common/cmd_mtdparts.c @@ -1713,7 +1713,7 @@ static struct part_info* mtd_part_info(struct mtd_device *dev, unsigned int part * @param argv arguments list * @return 0 on success, 1 otherwise */ -int do_chpart(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_chpart(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { /* command line only */ struct mtd_device *dev; @@ -1751,7 +1751,7 @@ int do_chpart(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) * @param argv arguments list * @return 0 on success, 1 otherwise */ -int do_mtdparts(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_mtdparts(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { if (argc == 2) { if (strcmp(argv[1], "default") == 0) { diff --git a/common/cmd_nand.c b/common/cmd_nand.c index f611fd7..ea80555 100644 --- a/common/cmd_nand.c +++ b/common/cmd_nand.c @@ -90,7 +90,7 @@ static inline int str2long(char *p, ulong *num) } static int -arg_off_size(int argc, char *argv[], nand_info_t *nand, ulong *off, size_t *size) +arg_off_size(int argc, char * const argv[], nand_info_t *nand, ulong *off, size_t *size) { int idx = nand_curr_device; #if defined(CONFIG_CMD_MTDPARTS) @@ -204,7 +204,7 @@ static void nand_print_info(int idx) nand->name, nand->erasesize >> 10); } -int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { int i, dev, ret = 0; ulong addr, off; @@ -599,7 +599,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand, return 0; } -int do_nandboot(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +int do_nandboot(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { char *boot_device = NULL; int idx; diff --git a/common/cmd_net.c b/common/cmd_net.c index b80a7ad..3cdb07f 100644 --- a/common/cmd_net.c +++ b/common/cmd_net.c @@ -28,11 +28,11 @@ #include <command.h> #include <net.h> -extern int do_bootm (cmd_tbl_t *, int, int, char *[]); +extern int do_bootm (cmd_tbl_t *, int, int, char * const []); -static int netboot_common (proto_t, cmd_tbl_t *, int , char *[]); +static int netboot_common (proto_t, cmd_tbl_t *, int , char * const []); -int do_bootp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_bootp (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { return netboot_common (BOOTP, cmdtp, argc, argv); } @@ -43,7 +43,7 @@ U_BOOT_CMD( "[loadAddress] [[hostIPaddr:]bootfilename]" ); -int do_tftpb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_tftpb (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { return netboot_common (TFTP, cmdtp, argc, argv); } @@ -54,7 +54,7 @@ U_BOOT_CMD( "[loadAddress] [[hostIPaddr:]bootfilename]" ); -int do_rarpb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_rarpb (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { return netboot_common (RARP, cmdtp, argc, argv); } @@ -66,7 +66,7 @@ U_BOOT_CMD( ); #if defined(CONFIG_CMD_DHCP) -int do_dhcp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_dhcp (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { return netboot_common(DHCP, cmdtp, argc, argv); } @@ -79,7 +79,7 @@ U_BOOT_CMD( #endif #if defined(CONFIG_CMD_NFS) -int do_nfs (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_nfs (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { return netboot_common(NFS, cmdtp, argc, argv); } @@ -151,7 +151,7 @@ static void netboot_update_env (void) } static int -netboot_common (proto_t proto, cmd_tbl_t *cmdtp, int argc, char *argv[]) +netboot_common (proto_t proto, cmd_tbl_t *cmdtp, int argc, char * const argv[]) { char *s; char *end; @@ -230,7 +230,7 @@ netboot_common (proto_t proto, cmd_tbl_t *cmdtp, int argc, char *argv[]) } #if defined(CONFIG_CMD_PING) -int do_ping (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_ping (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { if (argc < 2) return -1; @@ -280,7 +280,7 @@ static void cdp_update_env(void) } -int do_cdp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_cdp (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { int r; @@ -302,7 +302,7 @@ U_BOOT_CMD( #endif #if defined(CONFIG_CMD_SNTP) -int do_sntp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_sntp (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *toff; @@ -340,7 +340,7 @@ U_BOOT_CMD( #endif #if defined(CONFIG_CMD_DNS) -int do_dns(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_dns(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { if (argc == 1) { cmd_usage(cmdtp); diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index eb89e9e..13325bc 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -139,7 +139,7 @@ static int printenv(char *name, int state) return i; } -int do_printenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_printenv (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { int i; int rcode = 0; @@ -173,7 +173,7 @@ int do_printenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) * This function will ONLY work with a in-RAM copy of the environment */ -int _do_setenv (int flag, int argc, char *argv[]) +int _do_setenv (int flag, int argc, char * const argv[]) { int i, len, oldval; int console = -1; @@ -385,24 +385,12 @@ int _do_setenv (int flag, int argc, char *argv[]) return 0; } #endif - -#ifdef CONFIG_AMIGAONEG3SE - if (strcmp(argv[1], "vga_fg_color") == 0 || - strcmp(argv[1], "vga_bg_color") == 0 ) { - extern void video_set_color(unsigned char attr); - extern unsigned char video_get_attr(void); - - video_set_color(video_get_attr()); - return 0; - } -#endif /* CONFIG_AMIGAONEG3SE */ - return 0; } int setenv (char *varname, char *varvalue) { - char *argv[4] = { "setenv", varname, varvalue, NULL }; + char * const argv[4] = { "setenv", varname, varvalue, NULL }; if ((varvalue == NULL) || (varvalue[0] == '\0')) return _do_setenv (0, 2, argv); else @@ -412,12 +400,12 @@ int setenv (char *varname, char *varvalue) #ifdef CONFIG_HAS_UID void forceenv (char *varname, char *varvalue) { - char *argv[4] = { "forceenv", varname, varvalue, NULL }; + char * const argv[4] = { "forceenv", varname, varvalue, NULL }; _do_setenv (0xdeaf4add, 3, argv); } #endif -int do_setenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_setenv (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { if (argc < 2) { cmd_usage(cmdtp); @@ -432,7 +420,7 @@ int do_setenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) */ #if defined(CONFIG_CMD_ASKENV) -int do_askenv ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_askenv ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { extern char console_buffer[CONFIG_SYS_CBSIZE]; char message[CONFIG_SYS_CBSIZE]; @@ -509,7 +497,7 @@ int do_askenv ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) * Interactively edit an environment variable */ #if defined(CONFIG_CMD_EDITENV) -int do_editenv(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_editenv(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char buffer[CONFIG_SYS_CBSIZE]; char *init_val; @@ -588,7 +576,7 @@ int getenv_r (char *name, char *buf, unsigned len) #if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE) -int do_saveenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_saveenv (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { extern char * env_name_spec; @@ -672,7 +660,7 @@ U_BOOT_CMD( #endif #if defined(CONFIG_CMD_RUN) -int do_run (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +int do_run (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]); U_BOOT_CMD( run, CONFIG_SYS_MAXARGS, 1, do_run, "run commands in an environment variable", diff --git a/common/cmd_onenand.c b/common/cmd_onenand.c index 2646ae9..a3e46a3 100644 --- a/common/cmd_onenand.c +++ b/common/cmd_onenand.c @@ -32,7 +32,7 @@ static inline int str2long(char *p, ulong *num) return (*p != '\0' && *endptr == '\0') ? 1 : 0; } -static int arg_off_size(int argc, char *argv[], ulong *off, size_t *size) +static int arg_off_size(int argc, char * const argv[], ulong *off, size_t *size) { if (argc >= 1) { if (!(str2long(argv[0], off))) { @@ -330,13 +330,13 @@ static int onenand_dump(struct mtd_info *mtd, ulong off, int only_oob) return 0; } -static int do_onenand_info(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +static int do_onenand_info(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { printf("%s\n", mtd->name); return 0; } -static int do_onenand_bad(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +static int do_onenand_bad(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { ulong ofs; @@ -351,7 +351,7 @@ static int do_onenand_bad(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) return 0; } -static int do_onenand_read(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +static int do_onenand_read(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { char *s; int oob = 0; @@ -383,7 +383,7 @@ static int do_onenand_read(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) return ret == 0 ? 0 : 1; } -static int do_onenand_write(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +static int do_onenand_write(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { ulong addr, ofs; size_t len; @@ -409,7 +409,7 @@ static int do_onenand_write(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) return ret == 0 ? 0 : 1; } -static int do_onenand_erase(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +static int do_onenand_erase(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { ulong ofs; int ret = 0; @@ -445,7 +445,7 @@ static int do_onenand_erase(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) return ret == 0 ? 0 : 1; } -static int do_onenand_test(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +static int do_onenand_test(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { ulong ofs; int ret = 0; @@ -470,7 +470,7 @@ static int do_onenand_test(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) return ret == 0 ? 0 : 1; } -static int do_onenand_dump(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +static int do_onenand_dump(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { ulong ofs; int ret = 0; @@ -493,7 +493,7 @@ static int do_onenand_dump(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) return ret == 0 ? 1 : 0; } -static int do_onenand_markbad(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +static int do_onenand_markbad(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { int ret = 0; ulong addr; @@ -537,7 +537,7 @@ static cmd_tbl_t cmd_onenand_sub[] = { U_BOOT_CMD_MKENT(markbad, CONFIG_SYS_MAXARGS, 0, do_onenand_markbad, "", ""), }; -static int do_onenand(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +static int do_onenand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { cmd_tbl_t *c; diff --git a/common/cmd_otp.c b/common/cmd_otp.c index 30af5a3..a8c73b5 100644 --- a/common/cmd_otp.c +++ b/common/cmd_otp.c @@ -80,7 +80,7 @@ static void set_otp_timing(bool write) bfrom_OtpCommand(OTP_INIT, write ? timing : timing & ~(-1 << 15)); } -int do_otp(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_otp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { uint32_t ret, base_flags; bool prompt_user, force_read; diff --git a/common/cmd_pci.c b/common/cmd_pci.c index 8a260df..358ca60 100644 --- a/common/cmd_pci.c +++ b/common/cmd_pci.c @@ -471,7 +471,7 @@ pci_cfg_modify (pci_dev_t bdf, ulong addr, ulong size, ulong value, int incrflag * pci modify[.b, .w, .l] bus.device.function [addr] * pci write[.b, .w, .l] bus.device.function addr value */ -int do_pci (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_pci (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { ulong addr = 0, value = 0, size = 0; pci_dev_t bdf = 0; diff --git a/common/cmd_pcmcia.c b/common/cmd_pcmcia.c index e576b0c..70e5210 100644 --- a/common/cmd_pcmcia.c +++ b/common/cmd_pcmcia.c @@ -66,7 +66,7 @@ extern int pcmcia_on (void); extern int pcmcia_off (void); -int do_pinit (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_pinit (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { int rcode = 0; diff --git a/common/cmd_portio.c b/common/cmd_portio.c index f8befee..92d61d2 100644 --- a/common/cmd_portio.c +++ b/common/cmd_portio.c @@ -37,7 +37,7 @@ static uint in_last_addr, in_last_size; static uint out_last_addr, out_last_size, out_last_value; -int do_portio_out (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +int do_portio_out (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { uint addr = out_last_addr; uint size = out_last_size; @@ -97,7 +97,7 @@ U_BOOT_CMD( "[.b, .w, .l] port value\n - output to IO port" ); -int do_portio_in (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +int do_portio_in (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { uint addr = in_last_addr; uint size = in_last_size; diff --git a/common/cmd_reginfo.c b/common/cmd_reginfo.c index 89fd9ec..94b8d58 100644 --- a/common/cmd_reginfo.c +++ b/common/cmd_reginfo.c @@ -35,7 +35,7 @@ extern void ppc4xx_reginfo(void); extern void mpc86xx_reginfo(void); #endif -int do_reginfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_reginfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { #if defined(CONFIG_8xx) volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR; diff --git a/common/cmd_reiser.c b/common/cmd_reiser.c index 8ede782..2133a1f 100644 --- a/common/cmd_reiser.c +++ b/common/cmd_reiser.c @@ -47,7 +47,7 @@ #define PRINTF(fmt,args...) #endif -int do_reiserls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_reiserls (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *filename = "/"; int dev=0; @@ -110,7 +110,7 @@ U_BOOT_CMD( /****************************************************************************** * Reiserfs boot command intepreter. Derived from diskboot */ -int do_reiserload (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_reiserload (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *filename = NULL; char *ep; diff --git a/common/cmd_sata.c b/common/cmd_sata.c index 1693a7e..7be58e5 100644 --- a/common/cmd_sata.c +++ b/common/cmd_sata.c @@ -62,7 +62,7 @@ block_dev_desc_t *sata_get_dev(int dev) return (dev < CONFIG_SYS_SATA_MAX_DEVICE) ? &sata_dev_desc[dev] : NULL; } -int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { int rc = 0; diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c index f89492f..5b2df28 100644 --- a/common/cmd_scsi.c +++ b/common/cmd_scsi.c @@ -202,7 +202,7 @@ block_dev_desc_t * scsi_get_dev(int dev) /****************************************************************************** * scsi boot command intepreter. Derived from diskboot */ -int do_scsiboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_scsiboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *boot_device = NULL; char *ep; @@ -342,7 +342,7 @@ int do_scsiboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) /********************************************************************************* * scsi command intepreter */ -int do_scsi (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_scsi (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { switch (argc) { case 0: diff --git a/common/cmd_setexpr.c b/common/cmd_setexpr.c index 2d37197..b3e489f 100644 --- a/common/cmd_setexpr.c +++ b/common/cmd_setexpr.c @@ -32,7 +32,7 @@ static ulong get_arg(char *s, int w) { ulong *p; - /* + /* * if the parameter starts with a '*' then assume * it is a pointer to the value we want */ @@ -50,7 +50,7 @@ static ulong get_arg(char *s, int w) } } -int do_setexpr(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_setexpr(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { ulong a, b; char buf[16]; diff --git a/common/cmd_sf.c b/common/cmd_sf.c index d69ae6a..4826e9f 100644 --- a/common/cmd_sf.c +++ b/common/cmd_sf.c @@ -19,7 +19,7 @@ static struct spi_flash *flash; -static int do_spi_flash_probe(int argc, char *argv[]) +static int do_spi_flash_probe(int argc, char * const argv[]) { unsigned int bus = 0; unsigned int cs; @@ -75,7 +75,7 @@ usage: return 1; } -static int do_spi_flash_read_write(int argc, char *argv[]) +static int do_spi_flash_read_write(int argc, char * const argv[]) { unsigned long addr; unsigned long offset; @@ -122,7 +122,7 @@ usage: return 1; } -static int do_spi_flash_erase(int argc, char *argv[]) +static int do_spi_flash_erase(int argc, char * const argv[]) { unsigned long offset; unsigned long len; @@ -152,7 +152,7 @@ usage: return 1; } -static int do_spi_flash(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +static int do_spi_flash(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { const char *cmd; diff --git a/common/cmd_source.c b/common/cmd_source.c index 1424d30..16a627a 100644 --- a/common/cmd_source.c +++ b/common/cmd_source.c @@ -199,7 +199,7 @@ source (ulong addr, const char *fit_uname) /**************************************************/ #if defined(CONFIG_CMD_SOURCE) int -do_source (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +do_source (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { ulong addr; int rcode; diff --git a/common/cmd_spi.c b/common/cmd_spi.c index ab7aac7..bafa217 100644 --- a/common/cmd_spi.c +++ b/common/cmd_spi.c @@ -63,7 +63,7 @@ static uchar din[MAX_SPI_BYTES]; * The command prints out the hexadecimal string received via SPI. */ -int do_spi (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_spi (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { struct spi_slave *slave; char *cp = 0; diff --git a/common/cmd_spibootldr.c b/common/cmd_spibootldr.c index d29ed2b..68aa618 100644 --- a/common/cmd_spibootldr.c +++ b/common/cmd_spibootldr.c @@ -15,7 +15,7 @@ #include <asm/blackfin.h> #include <asm/mach-common/bits/bootrom.h> -int do_spibootldr(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_spibootldr(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { s32 addr; diff --git a/common/cmd_strings.c b/common/cmd_strings.c index 3a0d8ff..bbbb6b4 100644 --- a/common/cmd_strings.c +++ b/common/cmd_strings.c @@ -12,7 +12,7 @@ static char *start_addr, *last_addr; -int do_strings(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_strings(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { if (argc == 1) { cmd_usage(cmdtp); diff --git a/common/cmd_terminal.c b/common/cmd_terminal.c index 60ec378..7cc1a6c 100644 --- a/common/cmd_terminal.c +++ b/common/cmd_terminal.c @@ -29,7 +29,7 @@ #include <stdio_dev.h> #include <serial.h> -int do_terminal(cmd_tbl_t * cmd, int flag, int argc, char *argv[]) +int do_terminal(cmd_tbl_t * cmd, int flag, int argc, char * const argv[]) { int last_tilde = 0; struct stdio_dev *dev = NULL; diff --git a/common/cmd_test.c b/common/cmd_test.c index d886f89..fcb5ef2 100644 --- a/common/cmd_test.c +++ b/common/cmd_test.c @@ -24,9 +24,9 @@ #include <common.h> #include <command.h> -int do_test(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_test(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { - char **ap; + char * const *ap; int left, adv, expr, last_expr, neg, last_cmp; /* args? */ @@ -150,7 +150,7 @@ U_BOOT_CMD( "[args..]" ); -int do_false(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_false(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { return 1; } @@ -161,7 +161,7 @@ U_BOOT_CMD( NULL ); -int do_true(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_true(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { return 0; } diff --git a/common/cmd_tsi148.c b/common/cmd_tsi148.c index f2097fd..1e83c88 100644 --- a/common/cmd_tsi148.c +++ b/common/cmd_tsi148.c @@ -402,7 +402,7 @@ int tsi148_vme_crg_window(unsigned int vmeAddr, int vam) /* * Tundra Tsi148 configuration */ -int do_tsi148(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_tsi148(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { ulong addr1 = 0, addr2 = 0, size = 0, vam = 0, vdw = 0; char cmd = 'x'; diff --git a/common/cmd_ubi.c b/common/cmd_ubi.c index 2484b40..2faf8d8 100644 --- a/common/cmd_ubi.c +++ b/common/cmd_ubi.c @@ -436,7 +436,7 @@ static int ubi_dev_scan(struct mtd_info *info, char *ubidev, return 0; } -static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { size_t size = 0; ulong addr = 0; diff --git a/common/cmd_ubifs.c b/common/cmd_ubifs.c index ed0e9db..9017041 100644 --- a/common/cmd_ubifs.c +++ b/common/cmd_ubifs.c @@ -42,7 +42,7 @@ int ubifs_mount(char *vol_name); int ubifs_ls(char *dir_name); int ubifs_load(char *filename, u32 addr, u32 size); -int do_ubifs_mount(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_ubifs_mount(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *vol_name; int ret; @@ -68,7 +68,7 @@ int do_ubifs_mount(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 0; } -int do_ubifs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_ubifs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *filename = "/"; int ret; @@ -89,7 +89,7 @@ int do_ubifs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return ret; } -int do_ubifs_load(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_ubifs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *filename; char *endp; diff --git a/common/cmd_universe.c b/common/cmd_universe.c index 0a6d722..a86a574 100644 --- a/common/cmd_universe.c +++ b/common/cmd_universe.c @@ -317,7 +317,7 @@ int universe_vme_slave_window(unsigned int vmeAddr, unsigned int pciAddr, int si /* * Tundra Universe configuration */ -int do_universe(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_universe(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { ulong addr1 = 0, addr2 = 0, size = 0, vam = 0, pms = 0, vdw = 0; char cmd = 'x'; diff --git a/common/cmd_usb.c b/common/cmd_usb.c index fcb5f76..73d74ac 100644 --- a/common/cmd_usb.c +++ b/common/cmd_usb.c @@ -349,7 +349,7 @@ void usb_show_tree(struct usb_device *dev) * usb boot command intepreter. Derived from diskboot */ #ifdef CONFIG_USB_STORAGE -int do_usbboot(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_usbboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *boot_device = NULL; char *ep; @@ -506,7 +506,7 @@ int do_usbboot(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) /****************************************************************************** * usb command intepreter */ -int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { int i; diff --git a/common/cmd_version.c b/common/cmd_version.c index 7f165c7..7d1b495 100644 --- a/common/cmd_version.c +++ b/common/cmd_version.c @@ -26,7 +26,7 @@ extern char version_string[]; -int do_version(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_version(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { printf("\n%s\n", version_string); diff --git a/common/cmd_vfd.c b/common/cmd_vfd.c index 9c5b038..1429d31 100644 --- a/common/cmd_vfd.c +++ b/common/cmd_vfd.c @@ -45,7 +45,7 @@ extern int transfer_pic(unsigned char, unsigned char *, int, int); int trab_vfd (ulong bitmap); -int do_vfd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_vfd (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { ulong bitmap; diff --git a/common/cmd_ximg.c b/common/cmd_ximg.c index 75499b4..8a2cf83 100644 --- a/common/cmd_ximg.c +++ b/common/cmd_ximg.c @@ -43,7 +43,7 @@ #endif int -do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { ulong addr = load_addr; ulong dest = 0; diff --git a/common/cmd_yaffs2.c b/common/cmd_yaffs2.c index d448d04..7c01ea2 100644 --- a/common/cmd_yaffs2.c +++ b/common/cmd_yaffs2.c @@ -24,7 +24,7 @@ extern void cmd_yaffs_mv(const char *oldPath, const char *newPath); extern int yaffs_DumpDevStruct(const char *path); -int do_ymount (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_ymount (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *mtpoint = argv[1]; cmd_yaffs_mount(mtpoint); @@ -32,7 +32,7 @@ int do_ymount (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return(0); } -int do_yumount (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_yumount (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *mtpoint = argv[1]; cmd_yaffs_umount(mtpoint); @@ -40,7 +40,7 @@ int do_yumount (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return(0); } -int do_yls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_yls (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *dirname = argv[argc-1]; @@ -49,7 +49,7 @@ int do_yls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return(0); } -int do_yrd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_yrd (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *filename = argv[1]; printf ("Reading file %s ", filename); @@ -60,7 +60,7 @@ int do_yrd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return(0); } -int do_ywr (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_ywr (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *filename = argv[1]; ulong value = simple_strtoul(argv[2], NULL, 16); @@ -74,7 +74,7 @@ int do_ywr (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return(0); } -int do_yrdm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_yrdm (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *filename = argv[1]; ulong addr = simple_strtoul(argv[2], NULL, 16); @@ -84,7 +84,7 @@ int do_yrdm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return(0); } -int do_ywrm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_ywrm (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *filename = argv[1]; ulong addr = simple_strtoul(argv[2], NULL, 16); @@ -95,7 +95,7 @@ int do_ywrm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return(0); } -int do_ymkdir (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_ymkdir (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *dirname = argv[1]; @@ -104,7 +104,7 @@ int do_ymkdir (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return(0); } -int do_yrmdir (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_yrmdir (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *dirname = argv[1]; @@ -113,7 +113,7 @@ int do_yrmdir (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return(0); } -int do_yrm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_yrm (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *path = argv[1]; @@ -122,7 +122,7 @@ int do_yrm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return(0); } -int do_ymv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_ymv (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *oldPath = argv[1]; char *newPath = argv[2]; @@ -132,7 +132,7 @@ int do_ymv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return(0); } -int do_ydump (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_ydump (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *dirname = argv[1]; if (yaffs_DumpDevStruct(dirname) != 0) diff --git a/common/command.c b/common/command.c index 67ad692..a1fc592 100644 --- a/common/command.c +++ b/common/command.c @@ -34,7 +34,7 @@ */ int _do_help (cmd_tbl_t *cmd_start, int cmd_items, cmd_tbl_t * cmdtp, int - flag, int argc, char *argv[]) + flag, int argc, char * const argv[]) { int i; int rcode = 0; @@ -158,7 +158,7 @@ int cmd_usage(cmd_tbl_t *cmdtp) #ifdef CONFIG_AUTO_COMPLETE -int var_complete(int argc, char *argv[], char last_char, int maxv, char *cmdv[]) +int var_complete(int argc, char * const argv[], char last_char, int maxv, char *cmdv[]) { static char tmp_buf[512]; int space; @@ -175,7 +175,7 @@ int var_complete(int argc, char *argv[], char last_char, int maxv, char *cmdv[]) } static void install_auto_complete_handler(const char *cmd, - int (*complete)(int argc, char *argv[], char last_char, int maxv, char *cmdv[])) + int (*complete)(int argc, char * const argv[], char last_char, int maxv, char *cmdv[])) { cmd_tbl_t *cmdtp; @@ -200,7 +200,7 @@ void install_auto_complete(void) /*************************************************************************************/ -static int complete_cmdv(int argc, char *argv[], char last_char, int maxv, char *cmdv[]) +static int complete_cmdv(int argc, char * const argv[], char last_char, int maxv, char *cmdv[]) { cmd_tbl_t *cmdtp; const char *p; @@ -301,7 +301,7 @@ static int make_argv(char *s, int argvsz, char *argv[]) return argc; } -static void print_argv(const char *banner, const char *leader, const char *sep, int linemax, char *argv[]) +static void print_argv(const char *banner, const char *leader, const char *sep, int linemax, char * const argv[]) { int ll = leader != NULL ? strlen(leader) : 0; int sl = sep != NULL ? strlen(sep) : 0; @@ -328,7 +328,7 @@ static void print_argv(const char *banner, const char *leader, const char *sep, printf("\n"); } -static int find_common_prefix(char *argv[]) +static int find_common_prefix(char * const argv[]) { int i, len; char *anchor, *s, *t; diff --git a/common/console.c b/common/console.c index 51c6fb6..7e01886 100644 --- a/common/console.c +++ b/common/console.c @@ -29,10 +29,6 @@ DECLARE_GLOBAL_DATA_PTR; -#ifdef CONFIG_AMIGAONEG3SE -int console_changed = 0; -#endif - #ifdef CONFIG_SYS_CONSOLE_IS_IN_ENV /* * if overwrite_console returns 1, the stdin, stderr and stdout @@ -205,7 +201,7 @@ static inline void console_doenv(int file, struct stdio_dev *dev) /** U-Boot INITIAL CONSOLE-NOT COMPATIBLE FUNCTIONS *************************/ -void serial_printf(const char *fmt, ...) +int serial_printf(const char *fmt, ...) { va_list args; uint i; @@ -220,6 +216,7 @@ void serial_printf(const char *fmt, ...) va_end(args); serial_puts(printbuffer); + return i; } int fgetc(int file) @@ -273,7 +270,7 @@ void fputs(int file, const char *s) console_puts(file, s); } -void fprintf(int file, const char *fmt, ...) +int fprintf(int file, const char *fmt, ...) { va_list args; uint i; @@ -289,6 +286,7 @@ void fprintf(int file, const char *fmt, ...) /* Send to desired file */ fputs(file, printbuffer); + return i; } /** U-Boot INITIAL CONSOLE-COMPATIBLE FUNCTION *****************************/ @@ -367,7 +365,7 @@ void puts(const char *s) } } -void printf(const char *fmt, ...) +int printf(const char *fmt, ...) { va_list args; uint i; @@ -383,9 +381,10 @@ void printf(const char *fmt, ...) /* Print the string */ puts(printbuffer); + return i; } -void vprintf(const char *fmt, va_list args) +int vprintf(const char *fmt, va_list args) { uint i; char printbuffer[CONFIG_SYS_PBSIZE]; @@ -397,6 +396,7 @@ void vprintf(const char *fmt, va_list args) /* Print the string */ puts(printbuffer); + return i; } /* test if ctrl-c was pressed */ diff --git a/common/env_common.c b/common/env_common.c index 439a4a9..82e4936 100644 --- a/common/env_common.c +++ b/common/env_common.c @@ -32,11 +32,6 @@ DECLARE_GLOBAL_DATA_PTR; -#ifdef CONFIG_AMIGAONEG3SE - extern void enable_nvram(void); - extern void disable_nvram(void); -#endif - #undef DEBUG_ENV #ifdef DEBUG_ENV #define DEBUGF(fmt,args...) printf(fmt ,##args) @@ -159,20 +154,6 @@ static uchar env_get_char_init (int index) return (c); } -#ifdef CONFIG_AMIGAONEG3SE -uchar env_get_char_memory (int index) -{ - uchar retval; - enable_nvram(); - if (gd->env_valid) { - retval = ( *((uchar *)(gd->env_addr + index)) ); - } else { - retval = ( default_environment[index] ); - } - disable_nvram(); - return retval; -} -#else uchar env_get_char_memory (int index) { if (gd->env_valid) { @@ -181,7 +162,6 @@ uchar env_get_char_memory (int index) return ( default_environment[index] ); } } -#endif uchar env_get_char (int index) { @@ -229,10 +209,6 @@ void env_relocate (void) gd->reloc_off); #endif -#ifdef CONFIG_AMIGAONEG3SE - enable_nvram(); -#endif - #ifdef ENV_IS_EMBEDDED /* * The environment buffer is embedded with the text segment, @@ -263,10 +239,6 @@ void env_relocate (void) env_relocate_spec (); } gd->env_addr = (ulong)&(env_ptr->data); - -#ifdef CONFIG_AMIGAONEG3SE - disable_nvram(); -#endif } #ifdef CONFIG_AUTO_COMPLETE diff --git a/common/env_eeprom.c b/common/env_eeprom.c index 4f7f0db..8fe59f8 100644 --- a/common/env_eeprom.c +++ b/common/env_eeprom.c @@ -32,11 +32,6 @@ #include <i2c.h> #endif -#ifdef CONFIG_ENV_OFFSET_REDUND -#define ACTIVE_FLAG 1 -#define OBSOLETE_FLAG 0 -#endif - DECLARE_GLOBAL_DATA_PTR; env_t *env_ptr = NULL; diff --git a/common/env_flash.c b/common/env_flash.c index b860c48..925c5a0 100644 --- a/common/env_flash.c +++ b/common/env_flash.c @@ -44,12 +44,6 @@ DECLARE_GLOBAL_DATA_PTR; #error CONFIG_ENV_SIZE_REDUND should not be less then CONFIG_ENV_SIZE #endif -#ifdef CONFIG_INFERNO -# ifdef CONFIG_ENV_ADDR_REDUND -#error CONFIG_ENV_ADDR_REDUND is not implemented for CONFIG_INFERNO -# endif -#endif - char * env_name_spec = "Flash"; #ifdef ENV_IS_EMBEDDED @@ -77,9 +71,6 @@ static env_t *flash_addr_new = (env_t *)CONFIG_ENV_ADDR_REDUND; /* CONFIG_ENV_ADDR is supposed to be on sector boundary */ static ulong end_addr = CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE - 1; static ulong end_addr_new = CONFIG_ENV_ADDR_REDUND + CONFIG_ENV_SECT_SIZE - 1; - -#define ACTIVE_FLAG 1 -#define OBSOLETE_FLAG 0 #endif /* CONFIG_ENV_ADDR_REDUND */ extern uchar default_environment[]; @@ -294,13 +285,7 @@ int saveenv(void) len = CONFIG_ENV_SIZE; #endif /* CONFIG_ENV_SECT_SIZE */ -#ifndef CONFIG_INFERNO end_addr = flash_sect_addr + len - 1; -#else - /* this is the last sector, and the size is hardcoded here */ - /* otherwise we will get stack problems on loading 128 KB environment */ - end_addr = flash_sect_addr + 0x20000 - 1; -#endif debug ("Protect off %08lX ... %08lX\n", (ulong)flash_sect_addr, end_addr); diff --git a/common/env_nand.c b/common/env_nand.c index a15a950..50bc111 100644 --- a/common/env_nand.c +++ b/common/env_nand.c @@ -49,10 +49,6 @@ #error CONFIG_ENV_SIZE_REDUND should be the same as CONFIG_ENV_SIZE #endif -#ifdef CONFIG_INFERNO -#error CONFIG_INFERNO not supported yet -#endif - #ifndef CONFIG_ENV_RANGE #define CONFIG_ENV_RANGE CONFIG_ENV_SIZE #endif diff --git a/common/env_nvram.c b/common/env_nvram.c index 2628fe4..7c7cf98 100644 --- a/common/env_nvram.c +++ b/common/env_nvram.c @@ -59,24 +59,6 @@ char * env_name_spec = "NVRAM"; extern uchar default_environment[]; -#ifdef CONFIG_AMIGAONEG3SE -uchar env_get_char_spec (int index) -{ -#ifdef CONFIG_SYS_NVRAM_ACCESS_ROUTINE - uchar c; - - nvram_read(&c, CONFIG_ENV_ADDR+index, 1); - - return c; -#else - uchar retval; - enable_nvram(); - retval = *((uchar *)(gd->env_addr + index)); - disable_nvram(); - return retval; -#endif -} -#else uchar env_get_char_spec (int index) { #ifdef CONFIG_SYS_NVRAM_ACCESS_ROUTINE @@ -89,7 +71,6 @@ uchar env_get_char_spec (int index) return *((uchar *)(gd->env_addr + index)); #endif } -#endif void env_relocate_spec (void) { @@ -103,19 +84,12 @@ void env_relocate_spec (void) int saveenv (void) { int rcode = 0; -#ifdef CONFIG_AMIGAONEG3SE - enable_nvram(); -#endif #ifdef CONFIG_SYS_NVRAM_ACCESS_ROUTINE nvram_write(CONFIG_ENV_ADDR, env_ptr, CONFIG_ENV_SIZE); #else if (memcpy ((char *)CONFIG_ENV_ADDR, env_ptr, CONFIG_ENV_SIZE) == NULL) rcode = 1 ; #endif -#ifdef CONFIG_AMIGAONEG3SE - udelay(10000); - disable_nvram(); -#endif return rcode; } @@ -127,9 +101,6 @@ int saveenv (void) */ int env_init (void) { -#ifdef CONFIG_AMIGAONEG3SE - enable_nvram(); -#endif #if defined(CONFIG_SYS_NVRAM_ACCESS_ROUTINE) ulong crc; uchar data[ENV_SIZE]; @@ -147,8 +118,5 @@ int env_init (void) gd->env_addr = (ulong)&default_environment[0]; gd->env_valid = 0; } -#ifdef CONFIG_AMIGAONEG3SE - disable_nvram(); -#endif return (0); } diff --git a/common/env_sf.c b/common/env_sf.c index 6575b6d..4391d61 100644 --- a/common/env_sf.c +++ b/common/env_sf.c @@ -43,6 +43,14 @@ # define CONFIG_ENV_SPI_MODE SPI_MODE_3 #endif +#ifdef CONFIG_ENV_OFFSET_REDUND +static ulong env_offset = CONFIG_ENV_OFFSET; +static ulong env_new_offset = CONFIG_ENV_OFFSET_REDUND; + +#define ACTIVE_FLAG 1 +#define OBSOLETE_FLAG 0 +#endif /* CONFIG_ENV_ADDR_REDUND */ + DECLARE_GLOBAL_DATA_PTR; /* references to names in env_common.c */ @@ -58,6 +66,229 @@ uchar env_get_char_spec(int index) return *((uchar *)(gd->env_addr + index)); } +#if defined(CONFIG_ENV_OFFSET_REDUND) +void swap_env(void) +{ + ulong tmp_offset = env_offset; + + env_offset = env_new_offset; + env_new_offset = tmp_offset; +} + +int saveenv(void) +{ + u32 saved_size, saved_offset; + char *saved_buffer = NULL; + u32 sector = 1; + int ret; + char flag = OBSOLETE_FLAG, new_flag = ACTIVE_FLAG; + + if (!env_flash) { + puts("Environment SPI flash not initialized\n"); + return 1; + } + + /* Is the sector larger than the env (i.e. embedded) */ + if (CONFIG_ENV_SECT_SIZE > CONFIG_ENV_SIZE) { + saved_size = CONFIG_ENV_SECT_SIZE - CONFIG_ENV_SIZE; + saved_offset = env_new_offset + CONFIG_ENV_SIZE; + saved_buffer = malloc(saved_size); + if (!saved_buffer) { + ret = 1; + goto done; + } + ret = spi_flash_read(env_flash, saved_offset, + saved_size, saved_buffer); + if (ret) + goto done; + } + + if (CONFIG_ENV_SIZE > CONFIG_ENV_SECT_SIZE) { + sector = CONFIG_ENV_SIZE / CONFIG_ENV_SECT_SIZE; + if (CONFIG_ENV_SIZE % CONFIG_ENV_SECT_SIZE) + sector++; + } + + puts("Erasing SPI flash..."); + ret = spi_flash_erase(env_flash, env_new_offset, + sector * CONFIG_ENV_SECT_SIZE); + if (ret) + goto done; + + puts("Writing to SPI flash..."); + ret = spi_flash_write(env_flash, + env_new_offset + offsetof(env_t, data), + sizeof(env_ptr->data), env_ptr->data); + if (ret) + goto done; + + ret = spi_flash_write(env_flash, + env_new_offset + offsetof(env_t, crc), + sizeof(env_ptr->crc), &env_ptr->crc); + if (ret) + goto done; + + ret = spi_flash_write(env_flash, + env_offset + offsetof(env_t, flags), + sizeof(env_ptr->flags), &flag); + if (ret) + goto done; + + ret = spi_flash_write(env_flash, + env_new_offset + offsetof(env_t, flags), + sizeof(env_ptr->flags), &new_flag); + if (ret) + goto done; + + if (CONFIG_ENV_SECT_SIZE > CONFIG_ENV_SIZE) { + ret = spi_flash_write(env_flash, saved_offset, + saved_size, saved_buffer); + if (ret) + goto done; + } + + swap_env(); + + ret = 0; + puts("done\n"); + + done: + if (saved_buffer) + free(saved_buffer); + return ret; +} + +void env_relocate_spec(void) +{ + int ret; + int crc1_ok = 0, crc2_ok = 0; + env_t *tmp_env1 = NULL; + env_t *tmp_env2 = NULL; + uchar flag1, flag2; + /* current_env is set only in case both areas are valid! */ + int current_env = 0; + + tmp_env1 = (env_t *)malloc(CONFIG_ENV_SIZE); + if (!tmp_env1) { + puts("*** Warning: could not init environment," + " using defaults\n\n"); + goto out; + } + + tmp_env2 = (env_t *)malloc(CONFIG_ENV_SIZE); + if (!tmp_env2) { + puts("*** Warning: could not init environment," + " using defaults\n\n"); + goto out; + } + + env_flash = spi_flash_probe(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS, + CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE); + if (!env_flash) + goto err_probe; + + ret = spi_flash_read(env_flash, CONFIG_ENV_OFFSET, + CONFIG_ENV_SIZE, tmp_env1); + if (ret) + goto err_read; + + if (crc32(0, tmp_env1->data, ENV_SIZE) == tmp_env1->crc) + crc1_ok = 1; + flag1 = tmp_env1->flags; + + ret = spi_flash_read(env_flash, CONFIG_ENV_OFFSET_REDUND, + CONFIG_ENV_SIZE, tmp_env2); + if (!ret) { + if (crc32(0, tmp_env2->data, ENV_SIZE) == tmp_env2->crc) + crc2_ok = 1; + flag2 = tmp_env2->flags; + } + + if (!crc1_ok && !crc2_ok) + goto err_crc; + else if (crc1_ok && !crc2_ok) { + gd->env_valid = 1; + memcpy(env_ptr, tmp_env1, CONFIG_ENV_SIZE); + } else if (!crc1_ok && crc2_ok) { + gd->env_valid = 1; + memcpy(env_ptr, tmp_env2, CONFIG_ENV_SIZE); + swap_env(); + } else if (flag1 == ACTIVE_FLAG && flag2 == OBSOLETE_FLAG) { + gd->env_valid = 1; + memcpy(env_ptr, tmp_env1, CONFIG_ENV_SIZE); + } else if (flag1 == OBSOLETE_FLAG && flag2 == ACTIVE_FLAG) { + gd->env_valid = 1; + memcpy(env_ptr, tmp_env2, CONFIG_ENV_SIZE); + swap_env(); + } else if (flag1 == flag2) { + gd->env_valid = 2; + memcpy(env_ptr, tmp_env1, CONFIG_ENV_SIZE); + current_env = 1; + } else if (flag1 == 0xFF) { + gd->env_valid = 2; + memcpy(env_ptr, tmp_env1, CONFIG_ENV_SIZE); + current_env = 1; + } else { + /* + * this differs from code in env_flash.c, but I think a sane + * default path is desirable. + */ + gd->env_valid = 2; + memcpy(env_ptr, tmp_env2, CONFIG_ENV_SIZE); + swap_env(); + current_env = 2; + } + if (current_env == 1) { + if (flag2 != OBSOLETE_FLAG) { + flag2 = OBSOLETE_FLAG; + spi_flash_write(env_flash, + env_new_offset + offsetof(env_t, flags), + sizeof(env_ptr->flags), &flag2); + } + if (flag1 != ACTIVE_FLAG) { + flag1 = ACTIVE_FLAG; + spi_flash_write(env_flash, + env_offset + offsetof(env_t, flags), + sizeof(env_ptr->flags), &flag1); + } + } else if (current_env == 2) { + if (flag1 != OBSOLETE_FLAG) { + flag1 = OBSOLETE_FLAG; + spi_flash_write(env_flash, + env_new_offset + offsetof(env_t, flags), + sizeof(env_ptr->flags), &flag1); + } + if (flag2 != ACTIVE_FLAG) { + flag2 = ACTIVE_FLAG; + spi_flash_write(env_flash, + env_offset + offsetof(env_t, flags), + sizeof(env_ptr->flags), &flag2); + } + } + if (gd->env_valid == 2) { + puts("*** Warning - some problems detected " + "reading environment; recovered successfully\n\n"); + } + if (tmp_env1) + free(tmp_env1); + if (tmp_env2) + free(tmp_env2); + return; + +err_read: + spi_flash_free(env_flash); + env_flash = NULL; +err_probe: +err_crc: + puts("*** Warning - bad CRC, using default environment\n\n"); +out: + if (tmp_env1) + free(tmp_env1); + if (tmp_env2) + free(tmp_env2); + set_default_env(); +} +#else int saveenv(void) { u32 saved_size, saved_offset; @@ -144,6 +375,7 @@ err_crc: set_default_env(); } +#endif int env_init(void) { diff --git a/common/exports.c b/common/exports.c index 60bba75..ceee73a 100644 --- a/common/exports.c +++ b/common/exports.c @@ -3,7 +3,7 @@ DECLARE_GLOBAL_DATA_PTR; -static void dummy(void) +__attribute__((unused)) static void dummy(void) { } diff --git a/common/fdt_support.c b/common/fdt_support.c index b6f252a..a8ac617 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -534,7 +534,8 @@ void fdt_fixup_crypto_node(void *blob, int sec_rev) { 0x0202, 1, 24, 0x04c, 0x0122003f }, /* SEC 2.2 */ { 0x0204, 4, 24, 0x07e, 0x012b0ebf }, /* SEC 2.4 */ { 0x0300, 4, 24, 0x9fe, 0x03ab0ebf }, /* SEC 3.0 */ - { 0x0303, 4, 24, 0x97c, 0x03ab0abf }, /* SEC 3.3 */ + { 0x0301, 4, 24, 0xbfe, 0x03ab0ebf }, /* SEC 3.1 */ + { 0x0303, 4, 24, 0x97c, 0x03a30abf }, /* SEC 3.3 */ }; char compat_strlist[ARRAY_SIZE(sec_rev_prop_list) * sizeof("fsl,secX.Y")]; diff --git a/common/hush.c b/common/hush.c index 06c5ff8..8a74d22 100644 --- a/common/hush.c +++ b/common/hush.c @@ -94,7 +94,7 @@ #include <hush.h> #include <command.h> /* find_cmd */ /*cmd_boot.c*/ -extern int do_bootd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); /* do_bootd */ +extern int do_bootd (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]); /* do_bootd */ #endif #ifndef __U_BOOT__ #include <ctype.h> /* isalpha, isdigit */ @@ -1018,13 +1018,13 @@ static void get_user_input(struct in_str *i) fflush(stdout); i->p = the_command; #else - extern char console_buffer[CONFIG_SYS_CBSIZE]; + extern char console_buffer[]; int n; static char the_command[CONFIG_SYS_CBSIZE]; #ifdef CONFIG_BOOT_RETRY_TIME # ifdef CONFIG_RESET_TO_RETRY - 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 * const argv[]); # else # error "This currently only works with CONFIG_RESET_TO_RETRY enabled" # endif @@ -1681,7 +1681,7 @@ static int run_pipe_real(struct pipe *pi) } else { int rcode; #if defined(CONFIG_CMD_BOOTD) - extern int do_bootd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); + extern int do_bootd (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]); /* avoid "bootd" recursion */ if (cmdtp->cmd == do_bootd) { @@ -3351,7 +3351,7 @@ static void setup_job_control(void) tcsetpgrp(shell_terminal, shell_pgrp); } -int hush_main(int argc, char **argv) +int hush_main(int argc, char * const *argv) { int opt; FILE *input; @@ -3588,7 +3588,7 @@ static char * make_string(char ** inp) } #ifdef __U_BOOT__ -int do_showvar (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +int do_showvar (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { int i, k; int rcode = 0; diff --git a/common/hwconfig.c b/common/hwconfig.c index e5c60ba..1f9f4a0 100644 --- a/common/hwconfig.c +++ b/common/hwconfig.c @@ -11,15 +11,23 @@ * the License, or (at your option) any later version. */ +#ifndef HWCONFIG_TEST #include <config.h> #include <common.h> #include <exports.h> #include <hwconfig.h> #include <linux/types.h> #include <linux/string.h> +#else +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#define min(a, b) (((a) < (b)) ? (a) : (b)) +#endif /* HWCONFIG_TEST */ static const char *hwconfig_parse(const char *opts, size_t maxlen, - const char *opt, char stopch, char eqch, + const char *opt, char *stopchs, char eqch, size_t *arglen) { size_t optlen = strlen(opt); @@ -33,8 +41,9 @@ next: if (end - start > maxlen) return NULL; - if (str && (str == opts || str[-1] == stopch) && - (*end == stopch || *end == eqch || *end == '\0')) { + if (str && (str == opts || strpbrk(str - 1, stopchs) == str - 1) && + (strpbrk(end, stopchs) == end || *end == eqch || + *end == '\0')) { const char *arg_end; if (!arglen) @@ -43,7 +52,7 @@ next: if (*end != eqch) return NULL; - arg_end = strchr(str, stopch); + arg_end = strpbrk(str, stopchs); if (!arg_end) *arglen = min(maxlen, strlen(str)) - optlen - 1; else @@ -66,15 +75,15 @@ static const char *__hwconfig(const char *opt, size_t *arglen) if (env_hwconfig) return hwconfig_parse(env_hwconfig, strlen(env_hwconfig), - opt, ';', ':', arglen); + opt, ";", ':', arglen); if (board_hwconfig) return hwconfig_parse(board_hwconfig, strlen(board_hwconfig), - opt, ';', ':', arglen); + opt, ";", ':', arglen); if (cpu_hwconfig) return hwconfig_parse(cpu_hwconfig, strlen(cpu_hwconfig), - opt, ';', ':', arglen); + opt, ";", ':', arglen); return NULL; } @@ -164,7 +173,7 @@ int hwconfig_sub(const char *opt, const char *subopt) arg = __hwconfig(opt, &arglen); if (!arg) return 0; - return !!hwconfig_parse(arg, arglen, subopt, ',', '=', NULL); + return !!hwconfig_parse(arg, arglen, subopt, ",;", '=', NULL); } /* @@ -185,7 +194,7 @@ const char *hwconfig_subarg(const char *opt, const char *subopt, arg = __hwconfig(opt, &arglen); if (!arg) return NULL; - return hwconfig_parse(arg, arglen, subopt, ',', '=', subarglen); + return hwconfig_parse(arg, arglen, subopt, ",;", '=', subarglen); } /* @@ -208,3 +217,50 @@ int hwconfig_subarg_cmp(const char *opt, const char *subopt, const char *subarg) return !strncmp(argstr, subarg, arglen); } + +#ifdef HWCONFIG_TEST +int main() +{ + const char *ret; + size_t len; + + setenv("hwconfig", "key1:subkey1=value1,subkey2=value2;key2:value3;;;;" + "key3;:,:=;key4", 1); + + ret = hwconfig_arg("key1", &len); + printf("%zd %.*s\n", len, (int)len, ret); + assert(len == 29); + assert(hwconfig_arg_cmp("key1", "subkey1=value1,subkey2=value2")); + assert(!strncmp(ret, "subkey1=value1,subkey2=value2", len)); + + ret = hwconfig_subarg("key1", "subkey1", &len); + printf("%zd %.*s\n", len, (int)len, ret); + assert(len == 6); + assert(hwconfig_subarg_cmp("key1", "subkey1", "value1")); + assert(!strncmp(ret, "value1", len)); + + ret = hwconfig_subarg("key1", "subkey2", &len); + printf("%zd %.*s\n", len, (int)len, ret); + assert(len == 6); + assert(hwconfig_subarg_cmp("key1", "subkey2", "value2")); + assert(!strncmp(ret, "value2", len)); + + ret = hwconfig_arg("key2", &len); + printf("%zd %.*s\n", len, (int)len, ret); + assert(len == 6); + assert(hwconfig_arg_cmp("key2", "value3")); + assert(!strncmp(ret, "value3", len)); + + assert(hwconfig("key3")); + assert(hwconfig_arg("key4", &len) == NULL); + assert(hwconfig_arg("bogus", &len) == NULL); + + unsetenv("hwconfig"); + + assert(hwconfig(NULL) == 0); + assert(hwconfig("") == 0); + assert(hwconfig("key3") == 0); + + return 0; +} +#endif /* HWCONFIG_TEST */ diff --git a/common/image.c b/common/image.c index 8d4be14..6d8833e 100644 --- a/common/image.c +++ b/common/image.c @@ -60,7 +60,7 @@ static int fit_check_ramdisk (const void *fit, int os_noffset, #endif #ifdef CONFIG_CMD_BDI -extern int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +extern int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]); #endif DECLARE_GLOBAL_DATA_PTR; @@ -84,7 +84,6 @@ static table_entry_t uimage_arch[] = { { IH_ARCH_MICROBLAZE, "microblaze", "MicroBlaze", }, { IH_ARCH_MIPS, "mips", "MIPS", }, { IH_ARCH_MIPS64, "mips64", "MIPS 64 Bit", }, - { IH_ARCH_NIOS, "nios", "NIOS", }, { IH_ARCH_NIOS2, "nios2", "NIOS II", }, { IH_ARCH_PPC, "powerpc", "PowerPC", }, { IH_ARCH_PPC, "ppc", "PowerPC", }, @@ -757,7 +756,7 @@ int genimg_has_config (bootm_headers_t *images) * 1, if ramdisk image is found but corrupted, or invalid * rd_start and rd_end are set to 0 if no ramdisk exists */ -int boot_get_ramdisk (int argc, char *argv[], bootm_headers_t *images, +int boot_get_ramdisk (int argc, char * const argv[], bootm_headers_t *images, uint8_t arch, ulong *rd_start, ulong *rd_end) { ulong rd_addr, rd_load; @@ -1280,7 +1279,7 @@ error: * 1, if fdt image is found but corrupted * of_flat_tree and of_size are set to 0 if no fdt exists */ -int boot_get_fdt (int flag, int argc, char *argv[], bootm_headers_t *images, +int boot_get_fdt (int flag, int argc, char * const argv[], bootm_headers_t *images, char **of_flat_tree, ulong *of_size) { const image_header_t *fdt_hdr; diff --git a/common/kgdb.c b/common/kgdb.c index 9e3b64c..8a621ad 100644 --- a/common/kgdb.c +++ b/common/kgdb.c @@ -584,7 +584,7 @@ breakpoint(void) } int -do_kgdb(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +do_kgdb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { printf("Entering KGDB mode via exception handler...\n\n"); kgdb_breakpoint(argc - 1, argv + 1); diff --git a/common/lcd.c b/common/lcd.c index 64fb1c6..93ddedf 100644 --- a/common/lcd.c +++ b/common/lcd.c @@ -78,7 +78,7 @@ static inline void lcd_putc_xy (ushort x, ushort y, uchar c); static int lcd_init (void *lcdbase); -static int lcd_clear (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]); +static int lcd_clear (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]); static void *lcd_logo (void); static int lcd_getbgcolor (void); @@ -350,7 +350,7 @@ int drv_lcd_init (void) } /*----------------------------------------------------------------------*/ -static int lcd_clear (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +static int lcd_clear (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { #if LCD_BPP == LCD_MONOCHROME /* Setting the palette */ diff --git a/common/main.c b/common/main.c index f7e7c1c..20090ee 100644 --- a/common/main.c +++ b/common/main.c @@ -51,10 +51,10 @@ void inline __show_boot_progress (int val) {} void show_boot_progress (int val) __attribute__((weak, alias("__show_boot_progress"))); #if defined(CONFIG_BOOT_RETRY_TIME) && defined(CONFIG_RESET_TO_RETRY) -extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); /* for do_reset() prototype */ +extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]); /* for do_reset() prototype */ #endif -extern int do_bootd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); +extern int do_bootd (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]); #if defined(CONFIG_UPDATE_TFTP) void update_tftp (void); @@ -427,14 +427,7 @@ void main_loop (void) } } #endif /* CONFIG_MENUKEY */ -#endif /* CONFIG_BOOTDELAY */ - -#ifdef CONFIG_AMIGAONEG3SE - { - extern void video_banner(void); - video_banner(); - } -#endif +#endif /* CONFIG_BOOTDELAY */ /* * Main Loop for Monitor Command Processing @@ -1421,7 +1414,7 @@ int run_command (const char *cmd, int flag) /****************************************************************************/ #if defined(CONFIG_CMD_RUN) -int do_run (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +int do_run (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { int i; |