diff options
Diffstat (limited to 'common')
37 files changed, 467 insertions, 275 deletions
diff --git a/common/Makefile b/common/Makefile index 224b7cc..d662468 100644 --- a/common/Makefile +++ b/common/Makefile @@ -26,17 +26,15 @@ include $(TOPDIR)/config.mk LIB = $(obj)libcommon.o # core +ifndef CONFIG_SPL_BUILD COBJS-y += main.o -COBJS-y += console.o COBJS-y += command.o COBJS-y += dlmalloc.o COBJS-y += exports.o COBJS-$(CONFIG_SYS_HUSH_PARSER) += hush.o COBJS-y += image.o -COBJS-y += memsize.o COBJS-y += s_record.o COBJS-$(CONFIG_SERIAL_MULTI) += serial.o -COBJS-y += stdio.o COBJS-y += xyzModem.o # core command @@ -94,6 +92,7 @@ COBJS-$(CONFIG_CMD_FAT) += cmd_fat.o COBJS-$(CONFIG_CMD_FDC)$(CONFIG_CMD_FDOS) += cmd_fdc.o COBJS-$(CONFIG_OF_LIBFDT) += cmd_fdt.o fdt_support.o COBJS-$(CONFIG_CMD_FDOS) += cmd_fdos.o +COBJS-$(CONFIG_CMD_FITUPD) += cmd_fitupd.o COBJS-$(CONFIG_CMD_FLASH) += cmd_flash.o ifdef CONFIG_FPGA COBJS-$(CONFIG_CMD_FPGA) += cmd_fpga.o @@ -173,6 +172,11 @@ COBJS-$(CONFIG_LYNXKDI) += lynxkdi.o COBJS-$(CONFIG_MODEM_SUPPORT) += modem.o COBJS-$(CONFIG_UPDATE_TFTP) += update.o COBJS-$(CONFIG_USB_KEYBOARD) += usb_kbd.o +endif + +COBJS-y += console.o +COBJS-y += memsize.o +COBJS-y += stdio.o COBJS := $(sort $(COBJS-y)) diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 1966da4..272d879 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -708,6 +708,21 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return 1; } +int bootm_maybe_autostart(cmd_tbl_t *cmdtp, const char *cmd) +{ + const char *ep = getenv("autostart"); + + if (ep && !strcmp(ep, "yes")) { + char *local_args[2]; + local_args[0] = (char *)cmd; + local_args[1] = NULL; + printf("Automatic boot of image at addr 0x%08lX ...\n", load_addr); + return do_bootm(cmdtp, 0, 1, local_args); + } + + return 0; +} + /** * image_get_kernel - verify legacy format kernel image * @img_addr: in RAM address of the legacy format image to be verified diff --git a/common/cmd_cache.c b/common/cmd_cache.c index 5cdd834..9778d3b 100644 --- a/common/cmd_cache.c +++ b/common/cmd_cache.c @@ -26,18 +26,27 @@ */ #include <common.h> #include <command.h> +#include <linux/compiler.h> -static int on_off (const char *); +static int parse_argv(const char *); + +void __weak flush_icache(void) +{ + /* please define arch specific flush_icache */ + puts("No arch specific flush_icache available!\n"); +} int do_icache ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { switch (argc) { case 2: /* on / off */ - switch (on_off(argv[1])) { + switch (parse_argv(argv[1])) { case 0: icache_disable(); break; case 1: icache_enable (); break; + case 2: flush_icache(); + break; } /* FALL TROUGH */ case 1: /* get status */ @@ -50,15 +59,23 @@ int do_icache ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return 0; } +void __weak flush_dcache(void) +{ + puts("No arch specific flush_dcache available!\n"); + /* please define arch specific flush_dcache */ +} + int do_dcache ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { switch (argc) { case 2: /* on / off */ - switch (on_off(argv[1])) { + switch (parse_argv(argv[1])) { case 0: dcache_disable(); break; case 1: dcache_enable (); break; + case 2: flush_dcache(); + break; } /* FALL TROUGH */ case 1: /* get status */ @@ -72,9 +89,11 @@ int do_dcache ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } -static int on_off (const char *s) +static int parse_argv(const char *s) { - if (strcmp(s, "on") == 0) { + if (strcmp(s, "flush") == 0) { + return (2); + } else if (strcmp(s, "on") == 0) { return (1); } else if (strcmp(s, "off") == 0) { return (0); @@ -86,13 +105,13 @@ static int on_off (const char *s) U_BOOT_CMD( icache, 2, 1, do_icache, "enable or disable instruction cache", - "[on, off]\n" - " - enable or disable instruction cache" + "[on, off, flush]\n" + " - enable, disable, or flush instruction cache" ); U_BOOT_CMD( dcache, 2, 1, do_dcache, "enable or disable data cache", - "[on, off]\n" - " - enable or disable data (writethrough) cache" + "[on, off, flush]\n" + " - enable, disable, or flush data (writethrough) cache" ); diff --git a/common/cmd_eeprom.c b/common/cmd_eeprom.c index 9f4b22c..e911377 100644 --- a/common/cmd_eeprom.c +++ b/common/cmd_eeprom.c @@ -250,7 +250,7 @@ int eeprom_write (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cn /* * For a FRAM device there is no limit on the number of the - * bytes that can be ccessed with the single read or write + * bytes that can be accessed with the single read or write * operation. */ #if !defined(CONFIG_SYS_I2C_FRAM) diff --git a/common/cmd_fdc.c b/common/cmd_fdc.c index cdb050c..40d12f6 100644 --- a/common/cmd_fdc.c +++ b/common/cmd_fdc.c @@ -721,8 +721,6 @@ int do_fdcboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) image_header_t *hdr; /* used for fdc boot */ unsigned char boot_drive; int i,nrofblk; - char *ep; - int rcode = 0; #if defined(CONFIG_FIT) const void *fit_hdr = NULL; #endif @@ -823,19 +821,7 @@ int do_fdcboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) /* Loading ok, update default load address */ load_addr = addr; - /* Check if we should attempt an auto-start */ - if (((ep = getenv("autostart")) != NULL) && (strcmp(ep,"yes") == 0)) { - char *local_args[2]; - - local_args[0] = argv[0]; - local_args[1] = NULL; - - printf ("Automatic boot of image at addr 0x%08lX ...\n", addr); - - do_bootm (cmdtp, 0, 1, local_args); - rcode ++; - } - return rcode; + return bootm_maybe_autostart(cmdtp, argv[0]); } U_BOOT_CMD( diff --git a/common/cmd_fdos.c b/common/cmd_fdos.c index 2af4ca0..d714af8 100644 --- a/common/cmd_fdos.c +++ b/common/cmd_fdos.c @@ -40,7 +40,6 @@ int do_fdosboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) char *name; char *ep; int size; - int rcode = 0; char buf [12]; int drive = CONFIG_SYS_FDC_DRIVE_NUMBER; @@ -98,15 +97,7 @@ int do_fdosboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) printf("Floppy DOS load complete: %d bytes loaded to 0x%lx\n", size, load_addr); - /* Check if we should attempt an auto-start */ - if (((ep = getenv("autostart")) != NULL) && (strcmp(ep,"yes") == 0)) { - char *local_args[2]; - local_args[0] = argv[0]; - local_args[1] = NULL; - printf ("Automatic boot of image at addr 0x%08lX ...\n", load_addr); - rcode = do_bootm (cmdtp, 0, 1, local_args); - } - return rcode; + return bootm_maybe_autostart(cmdtp, argv[0]); } /*----------------------------------------------------------------------------- diff --git a/common/cmd_fitupd.c b/common/cmd_fitupd.c new file mode 100644 index 0000000..4d1192b --- /dev/null +++ b/common/cmd_fitupd.c @@ -0,0 +1,36 @@ +/* + * (C) Copyright 2011 + * Andreas Pretzsch, carpe noctem engineering, apr@cn-eng.de + * + * This file is released under the terms of GPL v2 and any later version. + * See the file COPYING in the root directory of the source tree for details. + */ + +#include <common.h> +#include <command.h> + +#if !defined(CONFIG_UPDATE_TFTP) +#error "CONFIG_UPDATE_TFTP required" +#endif + +extern int update_tftp(ulong addr); + +static int do_fitupd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{ + ulong addr = 0UL; + + if (argc > 2) + return cmd_usage(cmdtp); + + if (argc == 2) + addr = simple_strtoul(argv[1], NULL, 16); + + return update_tftp(addr); +} + +U_BOOT_CMD(fitupd, 2, 0, do_fitupd, + "update from FIT image", + "[addr]\n" + "\t- run update from FIT image at addr\n" + "\t or from tftp 'updatefile'" +); diff --git a/common/cmd_flash.c b/common/cmd_flash.c index bd49b79..5508d73 100644 --- a/common/cmd_flash.c +++ b/common/cmd_flash.c @@ -139,7 +139,7 @@ int flash_sect_roundb (ulong *addr) } /* bank */ } if (!found) { - /* error, addres not in flash */ + /* error, address not in flash */ printf("Error: end address (0x%08lx) not in flash!\n", *addr); return 1; } diff --git a/common/cmd_fpga.c b/common/cmd_fpga.c index 0ad310f..8946345 100644 --- a/common/cmd_fpga.c +++ b/common/cmd_fpga.c @@ -289,7 +289,7 @@ int do_fpga (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { const void *fit_hdr = (const void *)fpga_data; int noffset; - void *fit_data; + const void *fit_data; if (fit_uname == NULL) { puts ("No FIT subimage unit name\n"); diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c index d913e13..3ea75f7 100644 --- a/common/cmd_i2c.c +++ b/common/cmd_i2c.c @@ -1397,8 +1397,8 @@ static int i2c_mux_get_busid (void) return tmp; } -/* Analyses a Muxstring and sends immediately the - Commands to the Muxes. Runs from Flash. +/* Analyses a Muxstring and immediately sends the + commands to the muxes. Runs from flash. */ int i2c_mux_ident_muxstring_f (uchar *buf) { diff --git a/common/cmd_ide.c b/common/cmd_ide.c index 21fe1ea..2e8c6e0 100644 --- a/common/cmd_ide.c +++ b/common/cmd_ide.c @@ -356,7 +356,6 @@ int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) ulong addr, cnt; disk_partition_t info; image_header_t *hdr; - int rcode = 0; #if defined(CONFIG_FIT) const void *fit_hdr = NULL; #endif @@ -495,19 +494,7 @@ int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) load_addr = addr; - /* Check if we should attempt an auto-start */ - if (((ep = getenv("autostart")) != NULL) && (strcmp(ep,"yes") == 0)) { - char *local_args[2]; - - local_args[0] = argv[0]; - local_args[1] = NULL; - - printf ("Automatic boot of image at addr 0x%08lX ...\n", addr); - - do_bootm (cmdtp, 0, 1, local_args); - rcode = 1; - } - return rcode; + return bootm_maybe_autostart(cmdtp, argv[0]); } /* ------------------------------------------------------------------------- */ @@ -732,10 +719,12 @@ void ide_init (void) /* ------------------------------------------------------------------------- */ +#ifdef CONFIG_PARTITIONS block_dev_desc_t * ide_get_dev(int dev) { return (dev < CONFIG_SYS_IDE_MAXDEVICE) ? &ide_dev_desc[dev] : NULL; } +#endif #ifdef CONFIG_IDE_8xx_DIRECT diff --git a/common/cmd_mac.c b/common/cmd_mac.c index 1884c2a..fcc2867 100644 --- a/common/cmd_mac.c +++ b/common/cmd_mac.c @@ -30,8 +30,8 @@ U_BOOT_CMD( mac, 3, 1, do_mac, "display and program the system ID and MAC addresses in EEPROM", "[read|save|id|num|errata|date|ports|0|1|2|3|4|5|6|7]\n" - "read\n" - " - show content of EEPROM\n" + "mac read\n" + " - read EEPROM content into memory\n" "mac save\n" " - save to the EEPROM\n" "mac id\n" diff --git a/common/cmd_md5sum.c b/common/cmd_md5sum.c index d6ebb80..629a74d 100644 --- a/common/cmd_md5sum.c +++ b/common/cmd_md5sum.c @@ -37,7 +37,7 @@ static int do_md5sum(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) addr = simple_strtoul(argv[1], NULL, 16); len = simple_strtoul(argv[2], NULL, 16); - md5((unsigned char *) addr, len, output); + md5_wd((unsigned char *) addr, len, output, CHUNKSZ_MD5); printf("md5 for %08lx ... %08lx ==> ", addr, addr + len - 1); for (i = 0; i < 16; i++) printf("%02x", output[i]); diff --git a/common/cmd_mem.c b/common/cmd_mem.c index a5576aa..4daa1b3 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -1092,7 +1092,7 @@ int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) length = simple_strtoul (argv[2], NULL, 16); - crc = crc32 (0, (const uchar *) addr, length); + crc = crc32_wd (0, (const uchar *) addr, length, CHUNKSZ_CRC32); printf ("CRC32 for %08lx ... %08lx ==> %08lx\n", addr, addr + length - 1, crc); @@ -1137,7 +1137,7 @@ usage: addr += base_address; length = simple_strtoul(*av++, NULL, 16); - crc = crc32(0, (const uchar *) addr, length); + crc = crc32_wd (0, (const uchar *) addr, length, CHUNKSZ_CRC32); if (!verify) { printf ("CRC32 for %08lx ... %08lx ==> %08lx\n", diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c index 176646d..8f13c22 100644 --- a/common/cmd_mmc.c +++ b/common/cmd_mmc.c @@ -87,6 +87,12 @@ U_BOOT_CMD( ); #else /* !CONFIG_GENERIC_MMC */ +enum mmc_state { + MMC_INVALID, + MMC_READ, + MMC_WRITE, + MMC_ERASE, +}; static void print_mmcinfo(struct mmc *mmc) { printf("Device: %s\n", mmc->name); @@ -144,6 +150,8 @@ U_BOOT_CMD( int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { + enum mmc_state state; + if (argc < 2) return cmd_usage(cmdtp); @@ -165,9 +173,11 @@ int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } mmc->has_init = 0; - mmc_init(mmc); - return 0; + if (mmc_init(mmc)) + return 1; + else + return 0; } else if (strncmp(argv[1], "part", 4) == 0) { block_dev_desc_t *mmc_dev; struct mmc *mmc = find_mmc_device(curr_device); @@ -239,53 +249,61 @@ int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) curr_device, mmc->part_num); return 0; - } else if (strcmp(argv[1], "read") == 0) { - void *addr = (void *)simple_strtoul(argv[2], NULL, 16); - u32 cnt = simple_strtoul(argv[4], NULL, 16); - u32 n; - u32 blk = simple_strtoul(argv[3], NULL, 16); - struct mmc *mmc = find_mmc_device(curr_device); - - if (!mmc) { - printf("no mmc device at slot %x\n", curr_device); - return 1; - } - - printf("\nMMC read: dev # %d, block # %d, count %d ... ", - curr_device, blk, cnt); - - mmc_init(mmc); - - n = mmc->block_dev.block_read(curr_device, blk, cnt, addr); + } - /* flush cache after read */ - flush_cache((ulong)addr, cnt * 512); /* FIXME */ + if (strcmp(argv[1], "read") == 0) + state = MMC_READ; + else if (strcmp(argv[1], "write") == 0) + state = MMC_WRITE; + else if (strcmp(argv[1], "erase") == 0) + state = MMC_ERASE; + else + state = MMC_INVALID; - printf("%d blocks read: %s\n", - n, (n==cnt) ? "OK" : "ERROR"); - return (n == cnt) ? 0 : 1; - } else if (strcmp(argv[1], "write") == 0) { - void *addr = (void *)simple_strtoul(argv[2], NULL, 16); - u32 cnt = simple_strtoul(argv[4], NULL, 16); - u32 n; + if (state != MMC_INVALID) { struct mmc *mmc = find_mmc_device(curr_device); + int idx = 2; + u32 blk, cnt, n; + void *addr; - int blk = simple_strtoul(argv[3], NULL, 16); + if (state != MMC_ERASE) { + addr = (void *)simple_strtoul(argv[idx], NULL, 16); + ++idx; + } else + addr = 0; + blk = simple_strtoul(argv[idx], NULL, 16); + cnt = simple_strtoul(argv[idx + 1], NULL, 16); if (!mmc) { printf("no mmc device at slot %x\n", curr_device); return 1; } - printf("\nMMC write: dev # %d, block # %d, count %d ... ", - curr_device, blk, cnt); + printf("\nMMC %s: dev # %d, block # %d, count %d ... ", + argv[1], curr_device, blk, cnt); mmc_init(mmc); - n = mmc->block_dev.block_write(curr_device, blk, cnt, addr); + switch (state) { + case MMC_READ: + n = mmc->block_dev.block_read(curr_device, blk, + cnt, addr); + /* flush cache after read */ + flush_cache((ulong)addr, cnt * 512); /* FIXME */ + break; + case MMC_WRITE: + n = mmc->block_dev.block_write(curr_device, blk, + cnt, addr); + break; + case MMC_ERASE: + n = mmc->block_dev.block_erase(curr_device, blk, cnt); + break; + default: + BUG(); + } - printf("%d blocks written: %s\n", - n, (n == cnt) ? "OK" : "ERROR"); + printf("%d blocks %s: %s\n", + n, argv[1], (n == cnt) ? "OK" : "ERROR"); return (n == cnt) ? 0 : 1; } @@ -297,6 +315,7 @@ U_BOOT_CMD( "MMC sub system", "read addr blk# cnt\n" "mmc write addr blk# cnt\n" + "mmc erase blk# cnt\n" "mmc rescan\n" "mmc part - lists available partition on current mmc device\n" "mmc dev [dev] [part] - show or set current mmc device [partition]\n" diff --git a/common/cmd_nand.c b/common/cmd_nand.c index b767cd2..66e06a5 100644 --- a/common/cmd_nand.c +++ b/common/cmd_nand.c @@ -741,7 +741,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand, ulong offset, ulong addr, char *cmd) { int r; - char *ep, *s; + char *s; size_t cnt; image_header_t *hdr; #if defined(CONFIG_FIT) @@ -816,19 +816,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand, load_addr = addr; - /* Check if we should attempt an auto-start */ - if (((ep = getenv("autostart")) != NULL) && (strcmp(ep, "yes") == 0)) { - char *local_args[2]; - - local_args[0] = cmd; - local_args[1] = NULL; - - printf("Automatic boot of image at addr 0x%08lx ...\n", addr); - - do_bootm(cmdtp, 0, 1, local_args); - return 1; - } - return 0; + return bootm_maybe_autostart(cmdtp, cmd); } int do_nandboot(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) diff --git a/common/cmd_net.c b/common/cmd_net.c index 75ba1c3..872f4a6 100644 --- a/common/cmd_net.c +++ b/common/cmd_net.c @@ -227,17 +227,8 @@ netboot_common (proto_t proto, cmd_tbl_t *cmdtp, int argc, char * const argv[]) /* flush cache */ flush_cache(load_addr, size); - /* Loading ok, check if we should attempt an auto-start */ - if (((s = getenv("autostart")) != NULL) && (strcmp(s,"yes") == 0)) { - char *local_args[2]; - local_args[0] = argv[0]; - local_args[1] = NULL; - - printf ("Automatic boot of image at addr 0x%08lX ...\n", - load_addr); - show_boot_progress (82); - rcode = do_bootm (cmdtp, 0, 1, local_args); - } + show_boot_progress(82); + rcode = bootm_maybe_autostart(cmdtp, argv[0]); if (rcode < 0) show_boot_progress (-83); diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index b2c88ba..e8b116d 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -367,13 +367,14 @@ int _do_env_set (int flag, int argc, char * const argv[]) return 0; } -int setenv(char *varname, char *varvalue) +int setenv(const char *varname, const char *varvalue) { - char * const argv[4] = { "setenv", varname, varvalue, NULL }; + const char * const argv[4] = { "setenv", varname, varvalue, NULL }; + if ((varvalue == NULL) || (varvalue[0] == '\0')) - return _do_env_set(0, 2, argv); + return _do_env_set(0, 2, (char * const *)argv); else - return _do_env_set(0, 3, argv); + return _do_env_set(0, 3, (char * const *)argv); } int do_env_set(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) @@ -482,7 +483,7 @@ int do_env_edit(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) * return address of storage for that variable, * or NULL if not found */ -char *getenv(char *name) +char *getenv(const char *name) { if (gd->flags & GD_FLG_ENV_READY) { /* after import into hashtable */ ENTRY e, *ep; @@ -507,7 +508,7 @@ char *getenv(char *name) /* * Look up variable from environment for restricted C runtime env. */ -int getenv_f(char *name, char *buf, unsigned len) +int getenv_f(const char *name, char *buf, unsigned len) { int i, nxt; diff --git a/common/cmd_sata.c b/common/cmd_sata.c index 7efa859..f62c0cb 100644 --- a/common/cmd_sata.c +++ b/common/cmd_sata.c @@ -57,10 +57,12 @@ int __sata_initialize(void) } int sata_initialize(void) __attribute__((weak,alias("__sata_initialize"))); +#ifdef CONFIG_PARTITIONS block_dev_desc_t *sata_get_dev(int dev) { return (dev < CONFIG_SYS_SATA_MAX_DEVICE) ? &sata_dev_desc[dev] : NULL; } +#endif int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c index be4fe74..fa10751 100644 --- a/common/cmd_scsi.c +++ b/common/cmd_scsi.c @@ -46,7 +46,7 @@ #define SCSI_VEND_ID 0x10b9 #define SCSI_DEV_ID 0x5288 -#else +#elif !defined(CONFIG_SCSI_AHCI_PLAT) #error no scsi device defined #endif @@ -174,7 +174,7 @@ removable: scsi_curr_dev = -1; } - +#ifdef CONFIG_PCI void scsi_init(void) { int busdevfunc; @@ -192,12 +192,14 @@ void scsi_init(void) scsi_low_level_init(busdevfunc); scsi_scan(1); } +#endif +#ifdef CONFIG_PARTITIONS block_dev_desc_t * scsi_get_dev(int dev) { return (dev < CONFIG_SYS_SCSI_MAX_DEVICE) ? &scsi_dev_desc[dev] : NULL; } - +#endif /****************************************************************************** * scsi boot command intepreter. Derived from diskboot @@ -210,7 +212,6 @@ int do_scsiboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) ulong addr, cnt; disk_partition_t info; image_header_t *hdr; - int rcode = 0; #if defined(CONFIG_FIT) const void *fit_hdr = NULL; #endif @@ -326,15 +327,7 @@ int do_scsiboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) flush_cache (addr, (cnt+1)*info.blksz); - /* Check if we should attempt an auto-start */ - if (((ep = getenv("autostart")) != NULL) && (strcmp(ep,"yes") == 0)) { - char *local_args[2]; - local_args[0] = argv[0]; - local_args[1] = NULL; - printf ("Automatic boot of image at addr 0x%08lX ...\n", addr); - rcode = do_bootm (cmdtp, 0, 1, local_args); - } - return rcode; + return bootm_maybe_autostart(cmdtp, argv[0]); } /********************************************************************************* diff --git a/common/cmd_sha1sum.c b/common/cmd_sha1sum.c index bb3cff0..2b2dd8b 100644 --- a/common/cmd_sha1sum.c +++ b/common/cmd_sha1sum.c @@ -37,7 +37,7 @@ static int do_sha1sum(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) addr = simple_strtoul(argv[1], NULL, 16); len = simple_strtoul(argv[2], NULL, 16); - sha1_csum((unsigned char *) addr, len, output); + sha1_csum_wd((unsigned char *) addr, len, output, CHUNKSZ_SHA1); printf("SHA1 for %08lx ... %08lx ==> ", addr, addr + len - 1); for (i = 0; i < 20; i++) printf("%02x", output[i]); diff --git a/common/cmd_usb.c b/common/cmd_usb.c index 3ba6fff..cd4d417 100644 --- a/common/cmd_usb.c +++ b/common/cmd_usb.c @@ -356,7 +356,7 @@ int do_usbboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *boot_device = NULL; char *ep; - int dev, part = 1, rcode; + int dev, part = 1; ulong addr, cnt; disk_partition_t info; image_header_t *hdr; @@ -490,16 +490,7 @@ int do_usbboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) flush_cache(addr, (cnt+1)*info.blksz); - /* Check if we should attempt an auto-start */ - if (((ep = getenv("autostart")) != NULL) && (strcmp(ep, "yes") == 0)) { - char *local_args[2]; - local_args[0] = argv[0]; - local_args[1] = NULL; - printf("Automatic boot of image at addr 0x%08lX ...\n", addr); - rcode = do_bootm(cmdtp, 0, 1, local_args); - return rcode; - } - return 0; + return bootm_maybe_autostart(cmdtp, argv[0]); } #endif /* CONFIG_USB_STORAGE */ diff --git a/common/cmd_version.c b/common/cmd_version.c index 83cb11c..e4b2ac1 100644 --- a/common/cmd_version.c +++ b/common/cmd_version.c @@ -24,8 +24,9 @@ #include <common.h> #include <command.h> #include <version.h> +#include <linux/compiler.h> -extern char version_string[]; +const char __weak version_string[] = U_BOOT_VERSION_STRING; int do_version(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { diff --git a/common/cmd_ximg.c b/common/cmd_ximg.c index dceb975..850188e 100644 --- a/common/cmd_ximg.c +++ b/common/cmd_ximg.c @@ -215,6 +215,7 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) memmove ((char *) dest, (char *)data, len); #endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */ break; +#ifdef CONFIG_GZIP case IH_COMP_GZIP: printf (" Uncompressing part %d ... ", part); if (gunzip ((void *) dest, unc_len, @@ -223,6 +224,7 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) return 1; } break; +#endif #if defined(CONFIG_BZIP2) case IH_COMP_BZIP2: { diff --git a/common/command.c b/common/command.c index b3ec510..ddaed68 100644 --- a/common/command.c +++ b/common/command.c @@ -140,7 +140,7 @@ cmd_tbl_t *find_cmd (const char *cmd) return find_cmd_tbl(cmd, &__u_boot_cmd_start, len); } -int cmd_usage(cmd_tbl_t *cmdtp) +int cmd_usage(const cmd_tbl_t *cmdtp) { printf("%s - %s\n\n", cmdtp->name, cmdtp->usage); diff --git a/common/env_common.c b/common/env_common.c index c3e6388..19149b5 100644 --- a/common/env_common.c +++ b/common/env_common.c @@ -47,7 +47,7 @@ static uchar env_get_char_init (int index); #define XMK_STR(x) #x #define MK_STR(x) XMK_STR(x) -uchar default_environment[] = { +const uchar default_environment[] = { #ifdef CONFIG_BOOTARGS "bootargs=" CONFIG_BOOTARGS "\0" #endif @@ -162,7 +162,7 @@ uchar env_get_char (int index) return (c); } -uchar *env_get_addr (int index) +const uchar *env_get_addr (int index) { if (gd->env_valid) return (uchar *)(gd->env_addr + index); diff --git a/common/env_embedded.c b/common/env_embedded.c index ae6cac4..e438575 100644 --- a/common/env_embedded.c +++ b/common/env_embedded.c @@ -44,7 +44,7 @@ * Generate embedded environment table * inside U-Boot image, if needed. */ -#if defined(ENV_IS_EMBEDDED) +#if defined(ENV_IS_EMBEDDED) || defined(CONFIG_BUILD_ENVCRC) /* * Only put the environment in it's own section when we are building * U-Boot proper. The host based program "tools/envcrc" does not need diff --git a/common/env_flash.c b/common/env_flash.c index 456f2e8..50ca4ffa 100644 --- a/common/env_flash.c +++ b/common/env_flash.c @@ -74,7 +74,7 @@ static env_t *flash_addr_new = (env_t *)CONFIG_ENV_ADDR_REDUND; static ulong end_addr_new = CONFIG_ENV_ADDR_REDUND + CONFIG_ENV_SECT_SIZE - 1; #endif /* CONFIG_ENV_ADDR_REDUND */ -extern uchar default_environment[]; +extern const uchar default_environment[]; uchar env_get_char_spec(int index) diff --git a/common/fdt_support.c b/common/fdt_support.c index 496040b..19b2ef6 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -1195,6 +1195,46 @@ int fdt_alloc_phandle(void *blob) return phandle + 1; } +/* + * fdt_create_phandle: Create a phandle property for the given node + * + * @fdt: ptr to device tree + * @nodeoffset: node to update + * @phandle: phandle value to set (must be unique) +*/ +int fdt_create_phandle(void *fdt, int nodeoffset, uint32_t phandle) +{ + int ret; + +#ifdef DEBUG + int off = fdt_node_offset_by_phandle(fdt, phandle); + + if ((off >= 0) && (off != nodeoffset)) { + char buf[64]; + + fdt_get_path(fdt, nodeoffset, buf, sizeof(buf)); + printf("Trying to update node %s with phandle %u ", + buf, phandle); + + fdt_get_path(fdt, off, buf, sizeof(buf)); + printf("that already exists in node %s.\n", buf); + return -FDT_ERR_BADPHANDLE; + } +#endif + + ret = fdt_setprop_cell(fdt, nodeoffset, "phandle", phandle); + if (ret < 0) + return ret; + + /* + * For now, also set the deprecated "linux,phandle" property, so that we + * don't break older kernels. + */ + ret = fdt_setprop_cell(fdt, nodeoffset, "linux,phandle", phandle); + + return ret; +} + #if defined(CONFIG_VIDEO) int fdt_add_edid(void *blob, const char *compat, unsigned char *edid_buf) { @@ -1223,3 +1263,70 @@ err_size: return ret; } #endif + +/* + * Verify the physical address of device tree node for a given alias + * + * This function locates the device tree node of a given alias, and then + * verifies that the physical address of that device matches the given + * parameter. It displays a message if there is a mismatch. + * + * Returns 1 on success, 0 on failure + */ +int fdt_verify_alias_address(void *fdt, int anode, const char *alias, u64 addr) +{ + const char *path; + const u32 *reg; + int node, len; + u64 dt_addr; + + path = fdt_getprop(fdt, anode, alias, NULL); + if (!path) { + /* If there's no such alias, then it's not a failure */ + return 1; + } + + node = fdt_path_offset(fdt, path); + if (node < 0) { + printf("Warning: device tree alias '%s' points to invalid " + "node %s.\n", alias, path); + return 0; + } + + reg = fdt_getprop(fdt, node, "reg", &len); + if (!reg) { + printf("Warning: device tree node '%s' has no address.\n", + path); + return 0; + } + + dt_addr = fdt_translate_address(fdt, node, reg); + if (addr != dt_addr) { + printf("Warning: U-Boot configured device %s at address %llx,\n" + " but the device tree has it address %llx.\n", + alias, addr, dt_addr); + return 0; + } + + return 1; +} + +/* + * Returns the base address of an SOC or PCI node + */ +u64 fdt_get_base_address(void *fdt, int node) +{ + int size; + u32 naddr; + const u32 *prop; + + prop = fdt_getprop(fdt, node, "#address-cells", &size); + if (prop && size == 4) + naddr = *prop; + else + naddr = 2; + + prop = fdt_getprop(fdt, node, "ranges", &size); + + return prop ? fdt_translate_address(fdt, node, prop + naddr) : 0; +} diff --git a/common/image.c b/common/image.c index e542a57..f175541 100644 --- a/common/image.c +++ b/common/image.c @@ -141,6 +141,7 @@ static const table_entry_t uimage_type[] = { { IH_TYPE_FLATDT, "flat_dt", "Flat Device Tree", }, { IH_TYPE_KWBIMAGE, "kwbimage", "Kirkwood Boot Image",}, { IH_TYPE_IMXIMAGE, "imximage", "Freescale i.MX Boot Image",}, + { IH_TYPE_UBLIMAGE, "ublimage", "Davinci UBL image",}, { -1, "", "", }, }; @@ -1234,8 +1235,10 @@ int boot_relocate_fdt (struct lmb *lmb, char **of_flat_tree, ulong *of_size) { void *fdt_blob = *of_flat_tree; void *of_start = 0; + char *fdt_high; ulong of_len = 0; int err; + int disable_relocation = 0; /* nothing to do */ if (*of_size == 0) @@ -1249,26 +1252,62 @@ int boot_relocate_fdt (struct lmb *lmb, char **of_flat_tree, ulong *of_size) /* position on a 4K boundary before the alloc_current */ /* Pad the FDT by a specified amount */ of_len = *of_size + CONFIG_SYS_FDT_PAD; - of_start = (void *)(unsigned long)lmb_alloc_base(lmb, of_len, 0x1000, - getenv_bootm_mapsize() + getenv_bootm_low()); + + /* If fdt_high is set use it to select the relocation address */ + fdt_high = getenv("fdt_high"); + if (fdt_high) { + void *desired_addr = (void *)simple_strtoul(fdt_high, NULL, 16); + + if (((ulong) desired_addr) == ~0UL) { + /* All ones means use fdt in place */ + desired_addr = fdt_blob; + disable_relocation = 1; + } + if (desired_addr) { + of_start = + (void *)(ulong) lmb_alloc_base(lmb, of_len, 0x1000, + ((ulong) + desired_addr) + + of_len); + if (desired_addr && of_start != desired_addr) { + puts("Failed using fdt_high value for Device Tree"); + goto error; + } + } else { + of_start = + (void *)(ulong) lmb_alloc(lmb, of_len, 0x1000); + } + } else { + of_start = + (void *)(ulong) lmb_alloc_base(lmb, of_len, 0x1000, + getenv_bootm_mapsize() + + getenv_bootm_low()); + } if (of_start == 0) { puts("device tree - allocation error\n"); goto error; } - debug ("## device tree at %p ... %p (len=%ld [0x%lX])\n", - fdt_blob, fdt_blob + *of_size - 1, of_len, of_len); + if (disable_relocation) { + /* We assume there is space after the existing fdt to use for padding */ + fdt_set_totalsize(of_start, of_len); + printf(" Using Device Tree in place at %p, end %p\n", + of_start, of_start + of_len - 1); + } else { + debug ("## device tree at %p ... %p (len=%ld [0x%lX])\n", + fdt_blob, fdt_blob + *of_size - 1, of_len, of_len); - printf (" Loading Device Tree to %p, end %p ... ", - of_start, of_start + of_len - 1); + printf (" Loading Device Tree to %p, end %p ... ", + of_start, of_start + of_len - 1); - err = fdt_open_into (fdt_blob, of_start, of_len); - if (err != 0) { - fdt_error ("fdt move failed"); - goto error; + err = fdt_open_into (fdt_blob, of_start, of_len); + if (err != 0) { + fdt_error ("fdt move failed"); + goto error; + } + puts ("OK\n"); } - puts ("OK\n"); *of_flat_tree = of_start; *of_size = of_len; diff --git a/common/main.c b/common/main.c index 2730c6f..3324d9d 100644 --- a/common/main.c +++ b/common/main.c @@ -30,6 +30,7 @@ #include <common.h> #include <watchdog.h> #include <command.h> +#include <version.h> #ifdef CONFIG_MODEM_SUPPORT #include <malloc.h> /* for free() prototype */ #endif @@ -51,15 +52,11 @@ void inline __show_boot_progress (int val) {} void show_boot_progress (int val) __attribute__((weak, alias("__show_boot_progress"))); #if defined(CONFIG_UPDATE_TFTP) -void update_tftp (void); +int update_tftp (ulong addr); #endif /* CONFIG_UPDATE_TFTP */ #define MAX_DELAY_STOP_STR 32 -#if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) -static int abortboot(int); -#endif - #undef DEBUG_PARSER char console_buffer[CONFIG_SYS_CBSIZE + 1]; /* console I/O buffer */ @@ -91,7 +88,7 @@ extern void mdm_init(void); /* defined in board.c */ */ #if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) # if defined(CONFIG_AUTOBOOT_KEYED) -static __inline__ int abortboot(int bootdelay) +static inline int abortboot(int bootdelay) { int abort = 0; uint64_t etime = endtick(bootdelay); @@ -205,7 +202,7 @@ static __inline__ int abortboot(int bootdelay) static int menukey = 0; #endif -static __inline__ int abortboot(int bootdelay) +static inline int abortboot(int bootdelay) { int abort = 0; @@ -311,8 +308,6 @@ void main_loop (void) #ifdef CONFIG_VERSION_VARIABLE { - extern char version_string[]; - setenv ("ver", version_string); /* set version variable */ } #endif /* CONFIG_VERSION_VARIABLE */ @@ -345,7 +340,7 @@ void main_loop (void) #endif /* CONFIG_PREBOOT */ #if defined(CONFIG_UPDATE_TFTP) - update_tftp (); + update_tftp (0UL); #endif /* CONFIG_UPDATE_TFTP */ #if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) @@ -395,15 +390,15 @@ void main_loop (void) # ifdef CONFIG_MENUKEY if (menukey == CONFIG_MENUKEY) { - s = getenv("menucmd"); - if (s) { + s = getenv("menucmd"); + if (s) { # ifndef CONFIG_SYS_HUSH_PARSER - run_command (s, 0); + run_command(s, 0); # else - parse_string_outer(s, FLAG_PARSE_SEMICOLON | - FLAG_EXIT_FROM_LOOP); + parse_string_outer(s, FLAG_PARSE_SEMICOLON | + FLAG_EXIT_FROM_LOOP); # endif - } + } } #endif /* CONFIG_MENUKEY */ #endif /* CONFIG_BOOTDELAY */ diff --git a/common/memsize.c b/common/memsize.c index 6c275c9..963e4f3 100644 --- a/common/memsize.c +++ b/common/memsize.c @@ -37,7 +37,7 @@ * the actually available RAM size between addresses `base' and * `base + maxsize'. */ -long get_ram_size(volatile long *base, long maxsize) +long get_ram_size(long *base, long maxsize) { volatile long *addr; long save[32]; diff --git a/common/miiphyutil.c b/common/miiphyutil.c index bcab74e..35ad357 100644 --- a/common/miiphyutil.c +++ b/common/miiphyutil.c @@ -111,7 +111,8 @@ void miiphy_register(const char *name, { struct mii_dev *new_dev; struct legacy_mii_dev *ldev; - unsigned int name_len; + + BUG_ON(strlen(name) >= MDIO_NAME_LEN); /* check if we have unique name */ new_dev = miiphy_get_dev_by_name(name); @@ -121,14 +122,6 @@ void miiphy_register(const char *name, } /* allocate memory */ - name_len = strlen(name); - if (name_len > MDIO_NAME_LEN - 1) { - /* Hopefully this won't happen, but if it does, we'll know */ - printf("miiphy_register: MDIO name was longer than %d\n", - MDIO_NAME_LEN); - return; - } - new_dev = mdio_alloc(); ldev = malloc(sizeof(*ldev)); @@ -141,7 +134,8 @@ void miiphy_register(const char *name, /* initalize mii_dev struct fields */ new_dev->read = legacy_miiphy_read; new_dev->write = legacy_miiphy_write; - sprintf(new_dev->name, name); + strncpy(new_dev->name, name, MDIO_NAME_LEN); + new_dev->name[MDIO_NAME_LEN - 1] = 0; ldev->read = read; ldev->write = write; new_dev->priv = ldev; diff --git a/common/serial.c b/common/serial.c index 7a69fc1..995d268 100644 --- a/common/serial.c +++ b/common/serial.c @@ -24,81 +24,15 @@ #include <common.h> #include <serial.h> #include <stdio_dev.h> +#include <post.h> +#include <linux/compiler.h> DECLARE_GLOBAL_DATA_PTR; static struct serial_device *serial_devices = NULL; static struct serial_device *serial_current = NULL; -#if !defined(CONFIG_LWMON) && !defined(CONFIG_PXA250) && !defined(CONFIG_PXA27X) -struct serial_device *__default_serial_console (void) -{ -#if defined(CONFIG_8xx_CONS_SMC1) || defined(CONFIG_8xx_CONS_SMC2) - return &serial_smc_device; -#elif defined(CONFIG_8xx_CONS_SCC1) || defined(CONFIG_8xx_CONS_SCC2) \ - || defined(CONFIG_8xx_CONS_SCC3) || defined(CONFIG_8xx_CONS_SCC4) - return &serial_scc_device; -#elif defined(CONFIG_4xx) \ - || defined(CONFIG_MB86R0x) || defined(CONFIG_MPC5xxx) \ - || defined(CONFIG_MPC83xx) || defined(CONFIG_MPC85xx) \ - || defined(CONFIG_MPC86xx) || defined(CONFIG_SYS_SC520) \ - || defined(CONFIG_TEGRA2) -#if defined(CONFIG_CONS_INDEX) && defined(CONFIG_SYS_NS16550_SERIAL) -#if (CONFIG_CONS_INDEX==1) - return &eserial1_device; -#elif (CONFIG_CONS_INDEX==2) - return &eserial2_device; -#elif (CONFIG_CONS_INDEX==3) - return &eserial3_device; -#elif (CONFIG_CONS_INDEX==4) - return &eserial4_device; -#else -#error "Bad CONFIG_CONS_INDEX." -#endif -#else - return &serial0_device; -#endif -#elif defined(CONFIG_MPC512X) -#if (CONFIG_PSC_CONSOLE == 3) - return &serial3_device; -#elif (CONFIG_PSC_CONSOLE == 6) - return &serial6_device; -#else -#error "Bad CONFIG_PSC_CONSOLE." -#endif -#elif defined(CONFIG_S3C2410) -#if defined(CONFIG_SERIAL1) - return &s3c24xx_serial0_device; -#elif defined(CONFIG_SERIAL2) - return &s3c24xx_serial1_device; -#elif defined(CONFIG_SERIAL3) - return &s3c24xx_serial2_device; -#else -#error "CONFIG_SERIAL? missing." -#endif -#elif defined(CONFIG_S5P) -#if defined(CONFIG_SERIAL0) - return &s5p_serial0_device; -#elif defined(CONFIG_SERIAL1) - return &s5p_serial1_device; -#elif defined(CONFIG_SERIAL2) - return &s5p_serial2_device; -#elif defined(CONFIG_SERIAL3) - return &s5p_serial3_device; -#else -#error "CONFIG_SERIAL? missing." -#endif -#elif defined(CONFIG_OMAP3_ZOOM2) - return ZOOM2_DEFAULT_SERIAL_DEVICE; -#else -#error No default console -#endif -} - -struct serial_device *default_serial_console(void) __attribute__((weak, alias("__default_serial_console"))); -#endif - -int serial_register (struct serial_device *dev) +void serial_register(struct serial_device *dev) { #ifdef CONFIG_NEEDS_MANUAL_RELOC dev->init += gd->reloc_off; @@ -111,8 +45,6 @@ int serial_register (struct serial_device *dev) dev->next = serial_devices; serial_devices = dev; - - return 0; } void serial_initialize (void) @@ -294,3 +226,91 @@ void serial_puts (const char *s) serial_current->puts (s); } + +#if CONFIG_POST & CONFIG_SYS_POST_UART +static const int bauds[] = CONFIG_SYS_BAUDRATE_TABLE; + +/* Mark weak until post/cpu/.../uart.c migrate over */ +__weak +int uart_post_test(int flags) +{ + unsigned char c; + int ret, saved_baud, b; + struct serial_device *saved_dev, *s; + bd_t *bd = gd->bd; + + /* Save current serial state */ + ret = 0; + saved_dev = serial_current; + saved_baud = bd->bi_baudrate; + + for (s = serial_devices; s; s = s->next) { + /* If this driver doesn't support loop back, skip it */ + if (!s->loop) + continue; + + /* Test the next device */ + serial_current = s; + + ret = serial_init(); + if (ret) + goto done; + + /* Consume anything that happens to be queued */ + while (serial_tstc()) + serial_getc(); + + /* Enable loop back */ + s->loop(1); + + /* Test every available baud rate */ + for (b = 0; b < ARRAY_SIZE(bauds); ++b) { + bd->bi_baudrate = bauds[b]; + serial_setbrg(); + + /* + * Stick to printable chars to avoid issues: + * - terminal corruption + * - serial program reacting to sequences and sending + * back random extra data + * - most serial drivers add in extra chars (like \r\n) + */ + for (c = 0x20; c < 0x7f; ++c) { + /* Send it out */ + serial_putc(c); + + /* Make sure it's the same one */ + ret = (c != serial_getc()); + if (ret) { + s->loop(0); + goto done; + } + + /* Clean up the output in case it was sent */ + serial_putc('\b'); + ret = ('\b' != serial_getc()); + if (ret) { + s->loop(0); + goto done; + } + } + } + + /* Disable loop back */ + s->loop(0); + + /* XXX: There is no serial_uninit() !? */ + if (s->uninit) + s->uninit(); + } + + done: + /* Restore previous serial state */ + serial_current = saved_dev; + bd->bi_baudrate = saved_baud; + serial_reinit_all(); + serial_setbrg(); + + return ret; +} +#endif diff --git a/common/update.c b/common/update.c index 7528474..a19f136 100644 --- a/common/update.c +++ b/common/update.c @@ -238,13 +238,17 @@ static int update_fit_getparams(const void *fit, int noffset, ulong *addr, return 0; } -void update_tftp(void) +int update_tftp(ulong addr) { char *filename, *env_addr; int images_noffset, ndepth, noffset; ulong update_addr, update_fladdr, update_size; - ulong addr; void *fit; + int ret = 0; + + /* use already present image */ + if (addr) + goto got_update_file; printf("Auto-update from TFTP: "); @@ -253,7 +257,7 @@ void update_tftp(void) if (filename == NULL) { printf("failed, env. variable '%s' not found\n", UPDATE_FILE_ENV); - return; + return 1; } printf("trying update file '%s'\n", filename); @@ -268,15 +272,16 @@ void update_tftp(void) if (update_load(filename, CONFIG_UPDATE_TFTP_MSEC_MAX, CONFIG_UPDATE_TFTP_CNT_MAX, addr)) { printf("Can't load update file, aborting auto-update\n"); - return; + return 1; } +got_update_file: fit = (void *)addr; if (!fit_check_format((void *)fit)) { printf("Bad FIT format of the update file, aborting " "auto-update\n"); - return; + return 1; } /* process updates */ @@ -293,6 +298,7 @@ void update_tftp(void) if (!fit_image_check_hashes(fit, noffset)) { printf("Error: invalid update hash, aborting\n"); + ret = 1; goto next_node; } @@ -301,15 +307,17 @@ void update_tftp(void) &update_fladdr, &update_size)) { printf("Error: can't get update parameteres, " "aborting\n"); + ret = 1; goto next_node; } if (update_flash(update_addr, update_fladdr, update_size)) { printf("Error: can't flash update, aborting\n"); + ret = 1; goto next_node; } next_node: noffset = fdt_next_node(fit, noffset, &ndepth); } - return; + return ret; } diff --git a/common/usb_storage.c b/common/usb_storage.c index 9ecf165..16667f3 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -173,11 +173,12 @@ unsigned long usb_stor_write(int device, unsigned long blknr, struct usb_device * usb_get_dev_index(int index); void uhci_show_temp_int_td(void); +#ifdef CONFIG_PARTITIONS block_dev_desc_t *usb_stor_get_dev(int index) { return (index < usb_max_devs) ? &usb_dev_desc[index] : NULL; } - +#endif void usb_show_progress(void) { diff --git a/common/xyzModem.c b/common/xyzModem.c index 7a46805..a1f955b 100644 --- a/common/xyzModem.c +++ b/common/xyzModem.c @@ -786,7 +786,7 @@ xyzModem_stream_terminate (bool abort, int (*getc) (void)) ZM_DEBUG (zm_dprintf ("Engaging cleanup mode...\n")); /* * Consume any trailing crap left in the inbuffer from - * previous recieved blocks. Since very few files are an exact multiple + * previous received blocks. Since very few files are an exact multiple * of the transfer block size, there will almost always be some gunk here. * If we don't eat it now, RedBoot will think the user typed it. */ |