summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2010-08-10 22:20:27 +0200
committerWolfgang Denk <wd@denx.de>2010-08-10 22:20:27 +0200
commit201532a69cf7e7a84bff354fdab45947425d22b4 (patch)
tree4a09ca44e9fb720ec5b6ef29cca2de627e29f29a /common
parent560639806da5172147a3b1ebd99839feac38b718 (diff)
parentb417260d871d4d8d336c160d95ed40cc8c0fb0fa (diff)
downloadu-boot-imx-201532a69cf7e7a84bff354fdab45947425d22b4.zip
u-boot-imx-201532a69cf7e7a84bff354fdab45947425d22b4.tar.gz
u-boot-imx-201532a69cf7e7a84bff354fdab45947425d22b4.tar.bz2
Merge branch 'master' of ../master
Diffstat (limited to 'common')
-rw-r--r--common/cmd_ambapp.c3
-rw-r--r--common/cmd_bootldr.c3
-rw-r--r--common/cmd_bootm.c7
-rw-r--r--common/cmd_cplbinfo.c3
-rw-r--r--common/cmd_cramfs.c4
-rw-r--r--common/cmd_dataflash_mmc_mux.c5
-rw-r--r--common/cmd_license.c3
-rw-r--r--common/cmd_mgdisk.c5
-rw-r--r--common/cmd_mmc.c7
-rw-r--r--common/cmd_nand.c3
-rw-r--r--common/cmd_nvedit.c18
-rw-r--r--common/cmd_otp.c3
-rw-r--r--common/cmd_spibootldr.c3
-rw-r--r--common/cmd_strings.c3
-rw-r--r--common/cmd_ubi.c3
-rw-r--r--common/cmd_ubifs.c6
-rw-r--r--common/cmd_ximg.c3
-rw-r--r--common/fdt_support.c7
-rw-r--r--common/flash.c9
-rw-r--r--common/image.c2
-rw-r--r--common/main.c8
21 files changed, 67 insertions, 41 deletions
diff --git a/common/cmd_ambapp.c b/common/cmd_ambapp.c
index 283c433..fa7d7e2 100644
--- a/common/cmd_ambapp.c
+++ b/common/cmd_ambapp.c
@@ -272,7 +272,8 @@ int ambapp_init_reloc(void)
return 0;
}
-U_BOOT_CMD(ambapp, 1, 1, do_ambapp_print,
+U_BOOT_CMD(
+ ambapp, 1, 1, do_ambapp_print,
"list AMBA Plug&Play information",
"ambapp\n"
" - lists AMBA (AHB & APB) Plug&Play devices present on the system"
diff --git a/common/cmd_bootldr.c b/common/cmd_bootldr.c
index c7f14d9..535b931 100644
--- a/common/cmd_bootldr.c
+++ b/common/cmd_bootldr.c
@@ -167,7 +167,8 @@ int do_bootldr(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 0;
}
-U_BOOT_CMD(bootldr, 2, 0, do_bootldr,
+U_BOOT_CMD(
+ bootldr, 2, 0, do_bootldr,
"boot ldr image from memory",
"[addr]\n"
""
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 594bccb..4c6ed48 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -333,6 +333,9 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
ulong image_start = os.image_start;
ulong image_len = os.image_len;
uint unc_len = CONFIG_SYS_BOOTM_LEN;
+#if defined(CONFIG_LZMA) || defined(CONFIG_LZO)
+ int ret;
+#endif /* defined(CONFIG_LZMA) || defined(CONFIG_LZO) */
const char *type_name = genimg_get_type_name (os.type);
@@ -390,7 +393,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
SizeT lzma_len = unc_len;
printf (" Uncompressing %s ... ", type_name);
- int ret = lzmaBuffToBuffDecompress(
+ ret = lzmaBuffToBuffDecompress(
(unsigned char *)load, &lzma_len,
(unsigned char *)image_start, image_len);
unc_len = lzma_len;
@@ -408,7 +411,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
case IH_COMP_LZO:
printf (" Uncompressing %s ... ", type_name);
- int ret = lzop_decompress((const unsigned char *)image_start,
+ ret = lzop_decompress((const unsigned char *)image_start,
image_len, (unsigned char *)load,
&unc_len);
if (ret != LZO_E_OK) {
diff --git a/common/cmd_cplbinfo.c b/common/cmd_cplbinfo.c
index fc6abff..ab5b3b5 100644
--- a/common/cmd_cplbinfo.c
+++ b/common/cmd_cplbinfo.c
@@ -53,7 +53,8 @@ int do_cplbinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 0;
}
-U_BOOT_CMD(cplbinfo, 1, 0, do_cplbinfo,
+U_BOOT_CMD(
+ cplbinfo, 1, 0, do_cplbinfo,
"display current CPLB tables",
""
);
diff --git a/common/cmd_cramfs.c b/common/cmd_cramfs.c
index ab10450..8c86dc5 100644
--- a/common/cmd_cramfs.c
+++ b/common/cmd_cramfs.c
@@ -199,14 +199,14 @@ int do_cramfs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
/***************************************************/
U_BOOT_CMD(
cramfsload, 3, 0, do_cramfs_load,
- "cramfsload\t- load binary file from a filesystem image",
+ "load binary file from a filesystem image",
"[ off ] [ filename ]\n"
" - load binary file from address 'cramfsaddr'\n"
" with offset 'off'\n"
);
U_BOOT_CMD(
cramfsls, 2, 1, do_cramfs_ls,
- "cramfsls\t- list files in a directory (default /)",
+ "list files in a directory (default /)",
"[ directory ]\n"
" - list files in a directory.\n"
);
diff --git a/common/cmd_dataflash_mmc_mux.c b/common/cmd_dataflash_mmc_mux.c
index de4e676..1678d6e 100644
--- a/common/cmd_dataflash_mmc_mux.c
+++ b/common/cmd_dataflash_mmc_mux.c
@@ -41,8 +41,7 @@ int do_dataflash_mmc_mux (cmd_tbl_t *cmdtp, int flag, int argc, char * const arg
AT91F_GetMuxStatus () ? "MMC" : "SPI");
return 0;
default:
- printf ("Usage:\n%s\n", cmdtp->usage);
- return 1;
+ return cmd_usage(cmdtp);
}
return 0;
}
@@ -59,7 +58,7 @@ static int mmc_nspi (const char *s)
U_BOOT_CMD(
dataflash_mmc_mux, 2, 1, do_dataflash_mmc_mux,
- "dataflash_mmc_mux\t- enable or disable MMC or SPI\n",
+ "enable or disable MMC or SPI\n",
"[mmc, spi]\n"
" - enable or disable MMC or SPI"
);
diff --git a/common/cmd_license.c b/common/cmd_license.c
index 90fd57e..70645d5 100644
--- a/common/cmd_license.c
+++ b/common/cmd_license.c
@@ -49,7 +49,8 @@ int do_license(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 0;
}
-U_BOOT_CMD(license, 1, 1, do_license,
+U_BOOT_CMD(
+ license, 1, 1, do_license,
"print GPL license text",
""
);
diff --git a/common/cmd_mgdisk.c b/common/cmd_mgdisk.c
index c2d5217..d99af2d 100644
--- a/common/cmd_mgdisk.c
+++ b/common/cmd_mgdisk.c
@@ -54,15 +54,14 @@ int do_mg_disk_cmd (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 1;
break;
default:
- printf("Usage:\n%s\n", cmdtp->usage);
- return 1;
+ return cmd_usage(cmdtp);
}
return 0;
}
U_BOOT_CMD(
mgd, 5, 0, do_mg_disk_cmd,
- "mgd - mgine m[g]flash command\n",
+ "mgine m[g]flash command\n",
": mgine mflash IO mode (disk) command\n"
" - initialize : mgd init\n"
" - random read : mgd read [from] [to] [size]\n"
diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
index e5f5e94..a6ed6a8 100644
--- a/common/cmd_mmc.c
+++ b/common/cmd_mmc.c
@@ -130,8 +130,11 @@ int do_mmcinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 0;
}
-U_BOOT_CMD(mmcinfo, 2, 0, do_mmcinfo,
- "mmcinfo <dev num>-- display MMC info",
+U_BOOT_CMD(
+ mmcinfo, 2, 0, do_mmcinfo,
+ "display MMC info",
+ "<dev num>\n
+ " - device number of the device to dislay info of\n"
""
);
diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 0f47a25..3f1d077 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -579,7 +579,8 @@ usage:
return cmd_usage(cmdtp);
}
-U_BOOT_CMD(nand, CONFIG_SYS_MAXARGS, 1, do_nand,
+U_BOOT_CMD(
+ nand, CONFIG_SYS_MAXARGS, 1, do_nand,
"NAND sub-system",
"info - show available NAND devices\n"
"nand device [dev] - show or set current device\n"
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 16d5ff7..fd5320d 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -557,13 +557,19 @@ int getenv_f(char *name, char *buf, unsigned len)
}
if ((val=envmatch((uchar *)name, i)) < 0)
continue;
+
/* found; copy out */
- n = 0;
- while ((len > n++) && (*buf++ = env_get_char(val++)) != '\0')
- ;
- if (len == n)
- *buf = '\0';
- return (n);
+ for (n=0; n<len; ++n, ++buf) {
+ if ((*buf = env_get_char(val++)) == '\0')
+ return n;
+ }
+
+ if (n)
+ *--buf = '\0';
+
+ printf("env_buf too small [%d]\n", len);
+
+ return n;
}
return (-1);
}
diff --git a/common/cmd_otp.c b/common/cmd_otp.c
index 43f7c69..56f08e0 100644
--- a/common/cmd_otp.c
+++ b/common/cmd_otp.c
@@ -223,7 +223,8 @@ int do_otp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return ret;
}
-U_BOOT_CMD(otp, 7, 0, do_otp,
+U_BOOT_CMD(
+ otp, 7, 0, do_otp,
"One-Time-Programmable sub-system",
"read <addr> <page> [count] [half]\n"
" - read 'count' half-pages starting at 'page' (offset 'half') to 'addr'\n"
diff --git a/common/cmd_spibootldr.c b/common/cmd_spibootldr.c
index 68aa618..ca76dde 100644
--- a/common/cmd_spibootldr.c
+++ b/common/cmd_spibootldr.c
@@ -30,7 +30,8 @@ int do_spibootldr(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return bfrom_SpiBoot(addr, BFLAG_PERIPHERAL | 4, 0, NULL);
}
-U_BOOT_CMD(spibootldr, 2, 0, do_spibootldr,
+U_BOOT_CMD(
+ spibootldr, 2, 0, do_spibootldr,
"boot ldr image from spi",
"[offset]\n"
" - boot ldr image stored at offset into spi\n");
diff --git a/common/cmd_strings.c b/common/cmd_strings.c
index 144a6c1..2986324 100644
--- a/common/cmd_strings.c
+++ b/common/cmd_strings.c
@@ -38,7 +38,8 @@ int do_strings(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 0;
}
-U_BOOT_CMD(strings, 3, 1, do_strings,
+U_BOOT_CMD(
+ strings, 3, 1, do_strings,
"display strings",
"<addr> [byte count]\n"
" - display strings at <addr> for at least [byte count] or first double NUL"
diff --git a/common/cmd_ubi.c b/common/cmd_ubi.c
index 77ca0a5..7692ac7 100644
--- a/common/cmd_ubi.c
+++ b/common/cmd_ubi.c
@@ -598,7 +598,8 @@ static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
return -1;
}
-U_BOOT_CMD(ubi, 6, 1, do_ubi,
+U_BOOT_CMD(
+ ubi, 6, 1, do_ubi,
"ubi commands",
"part [part] [offset]\n"
" - Show or set current partition (with optional VID"
diff --git a/common/cmd_ubifs.c b/common/cmd_ubifs.c
index 2cab793..a0ec184 100644
--- a/common/cmd_ubifs.c
+++ b/common/cmd_ubifs.c
@@ -131,13 +131,15 @@ U_BOOT_CMD(
" - mount 'volume-name' volume"
);
-U_BOOT_CMD(ubifsls, 2, 0, do_ubifs_ls,
+U_BOOT_CMD(
+ ubifsls, 2, 0, do_ubifs_ls,
"list files in a directory",
"[directory]\n"
" - list files in a 'directory' (default '/')"
);
-U_BOOT_CMD(ubifsload, 4, 0, do_ubifs_load,
+U_BOOT_CMD(
+ ubifsload, 4, 0, do_ubifs_load,
"load file from an UBIFS filesystem",
"<addr> <filename> [bytes]\n"
" - load file 'filename' to address 'addr'"
diff --git a/common/cmd_ximg.c b/common/cmd_ximg.c
index 8a2cf83..dceb975 100644
--- a/common/cmd_ximg.c
+++ b/common/cmd_ximg.c
@@ -262,7 +262,8 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
return 0;
}
-U_BOOT_CMD(imxtract, 4, 1, do_imgextract,
+U_BOOT_CMD(
+ imxtract, 4, 1, do_imgextract,
"extract a part of a multi-image",
"addr part [dest]\n"
" - extract <part> from legacy image at <addr> and copy to <dest>"
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 166f5e1..33336be 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -498,11 +498,12 @@ int fdt_resize(void *blob)
/*
* Calculate the actual size of the fdt
- * plus the size needed for two fdt_add_mem_rsv, one
- * for the fdt itself and one for a possible initrd
+ * plus the size needed for 5 fdt_add_mem_rsv, one
+ * for the fdt itself and 4 for a possible initrd
+ * ((initrd-start + initrd-end) * 2 (name & value))
*/
actualsize = fdt_off_dt_strings(blob) +
- fdt_size_dt_strings(blob) + 2*sizeof(struct fdt_reserve_entry);
+ fdt_size_dt_strings(blob) + 5 * sizeof(struct fdt_reserve_entry);
/* Make it so the fdt ends on a page boundary */
actualsize = ALIGN(actualsize + ((uint)blob & 0xfff), 0x1000);
diff --git a/common/flash.c b/common/flash.c
index eb4b2f5..683978e 100644
--- a/common/flash.c
+++ b/common/flash.c
@@ -43,15 +43,18 @@ extern flash_info_t flash_info[]; /* info for FLASH chips */
void
flash_protect (int flag, ulong from, ulong to, flash_info_t *info)
{
- ulong b_end = info->start[0] + info->size - 1; /* bank end address */
- short s_end = info->sector_count - 1; /* index of last sector */
+ ulong b_end;
+ short s_end;
int i;
/* Do nothing if input data is bad. */
- if (info->sector_count == 0 || info->size == 0 || to < from) {
+ if (!info || info->sector_count == 0 || info->size == 0 || to < from) {
return;
}
+ s_end = info->sector_count - 1; /* index of last sector */
+ b_end = info->start[0] + info->size - 1; /* bank end address */
+
debug ("flash_protect %s: from 0x%08lX to 0x%08lX\n",
(flag & FLAG_PROTECT_SET) ? "ON" :
(flag & FLAG_PROTECT_CLEAR) ? "OFF" : "???",
diff --git a/common/image.c b/common/image.c
index ea59730..fcb938b 100644
--- a/common/image.c
+++ b/common/image.c
@@ -1184,6 +1184,7 @@ static int fit_check_fdt (const void *fit, int fdt_noffset, int verify)
* 0 - success
* 1 - failure
*/
+#if defined(CONFIG_SYS_BOOTMAPSZ)
int boot_relocate_fdt (struct lmb *lmb, ulong bootmap_base,
char **of_flat_tree, ulong *of_size)
{
@@ -1263,6 +1264,7 @@ int boot_relocate_fdt (struct lmb *lmb, ulong bootmap_base,
error:
return 1;
}
+#endif /* CONFIG_SYS_BOOTMAPSZ */
/**
* boot_get_fdt - main fdt handling routine
diff --git a/common/main.c b/common/main.c
index 54ef79e..8d548db 100644
--- a/common/main.c
+++ b/common/main.c
@@ -643,12 +643,10 @@ static void cread_print_hist_list(void)
#define ERASE_TO_EOL() { \
if (num < eol_num) { \
- int tmp; \
- for (tmp = num; tmp < eol_num; tmp++) \
- getcmd_putch(' '); \
- while (tmp-- > num) \
+ printf("%*s", (int)(eol_num - num), ""); \
+ do { \
getcmd_putch(CTL_BACKSPACE); \
- eol_num = num; \
+ } while (--eol_num > num); \
} \
}