summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorMarian Balakowicz <m8@semihalf.com>2008-02-29 14:58:34 +0100
committerMarian Balakowicz <m8@semihalf.com>2008-02-29 14:58:34 +0100
commit9a4daad0a35eb5143037eea9f786a3e9d672bdd6 (patch)
tree69650696145431c6b48d0792b4d6bdf8b714d37a /common
parente18489e8c27e843e337258fb00f2652ff0f43b92 (diff)
downloadtalos-obmc-uboot-9a4daad0a35eb5143037eea9f786a3e9d672bdd6.tar.gz
talos-obmc-uboot-9a4daad0a35eb5143037eea9f786a3e9d672bdd6.zip
[new uImage] Update naming convention for bootm/uImage related code
This patch introduces the following prefix convention for the image format handling and bootm related code: genimg_ - dual format shared code image_ - legacy uImage format specific code fit_ - new uImage format specific code boot_ - booting process related code Related routines are renamed and a few pieces of code are moved around and re-grouped. Signed-off-by: Marian Balakowicz <m8@semihalf.com>
Diffstat (limited to 'common')
-rw-r--r--common/cmd_autoscript.c4
-rw-r--r--common/cmd_bootm.c36
-rw-r--r--common/cmd_doc.c2
-rw-r--r--common/cmd_fdc.c2
-rw-r--r--common/cmd_fpga.c2
-rw-r--r--common/cmd_ide.c2
-rw-r--r--common/cmd_nand.c4
-rw-r--r--common/cmd_scsi.c2
-rw-r--r--common/cmd_usb.c2
-rw-r--r--common/cmd_ximg.c6
-rw-r--r--common/image.c429
11 files changed, 249 insertions, 242 deletions
diff --git a/common/cmd_autoscript.c b/common/cmd_autoscript.c
index f9ab1d9a13..60ffc7dbce 100644
--- a/common/cmd_autoscript.c
+++ b/common/cmd_autoscript.c
@@ -61,7 +61,7 @@ autoscript (ulong addr)
verify = getenv_verify ();
- switch (gen_image_get_format ((void *)addr)) {
+ switch (genimg_get_format ((void *)addr)) {
case IMAGE_FORMAT_LEGACY:
hdr = (image_header_t *)addr;
@@ -90,7 +90,7 @@ autoscript (ulong addr)
/* get length of script */
data = (ulong *)image_get_data (hdr);
- if ((len = image_to_cpu (*data)) == 0) {
+ if ((len = uimage_to_cpu (*data)) == 0) {
puts ("Empty Script\n");
return 1;
}
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 8595ef6889..10403aa0fa 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -66,7 +66,7 @@ static int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
static void fixup_silent_linux (void);
#endif
-static void *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 *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[]);
@@ -143,7 +143,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
board_lmb_reserve(&lmb);
/* get kernel image header, start address and length */
- os_hdr = get_kernel (cmdtp, flag, argc, argv,
+ os_hdr = boot_get_kernel (cmdtp, flag, argc, argv,
&images, &os_data, &os_len);
if (os_len == 0)
return 1;
@@ -151,7 +151,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
show_boot_progress (6);
/* get image parameters */
- switch (gen_image_get_format (os_hdr)) {
+ switch (genimg_get_format (os_hdr)) {
case IMAGE_FORMAT_LEGACY:
type = image_get_type (os_hdr);
comp = image_get_comp (os_hdr);
@@ -172,7 +172,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
image_start = (ulong)os_hdr;
load_end = 0;
- type_name = image_get_type_name (type);
+ type_name = genimg_get_type_name (type);
/*
* We have reached the point of no return: we are going to
@@ -309,16 +309,16 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
}
/**
- * get_kernel - find kernel image
- * @os_data: pointer to a ulong variable, will hold os data start address
- * @os_len: pointer to a ulong variable, will hold os data length
+ * image_get_kernel - verify legacy format kernel image
+ * @img_addr: in RAM address of the legacy format image to be verified
+ * @verify: data CRC verification flag
*
- * get_kernel() tries to find a kernel image, verifies its integrity
- * and locates kernel data.
+ * image_get_kernel() verifies legacy image integrity and returns pointer to
+ * legacy image header if image verification was completed successfully.
*
* returns:
- * pointer to image header if valid image was found, plus kernel start
- * address and length, otherwise NULL
+ * pointer to a legacy image header if valid image was found
+ * otherwise return NULL
*/
static image_header_t *image_get_kernel (ulong img_addr, int verify)
{
@@ -360,18 +360,18 @@ static image_header_t *image_get_kernel (ulong img_addr, int verify)
}
/**
- * get_kernel - find kernel image
+ * boot_get_kernel - find kernel image
* @os_data: pointer to a ulong variable, will hold os data start address
* @os_len: pointer to a ulong variable, will hold os data length
*
- * get_kernel() tries to find a kernel image, verifies its integrity
+ * boot_get_kernel() tries to find a kernel image, verifies its integrity
* and locates kernel data.
*
* returns:
* pointer to image header if valid image was found, plus kernel start
* address and length, otherwise NULL
*/
-static void *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 *argv[],
bootm_headers_t *images, ulong *os_data, ulong *os_len)
{
image_header_t *hdr;
@@ -406,10 +406,10 @@ static void *get_kernel (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
printf ("## Booting kernel image at %08lx ...\n", img_addr);
/* copy from dataflash if needed */
- img_addr = gen_get_image (img_addr);
+ img_addr = genimg_get_image (img_addr);
/* check image type, for FIT images get FIT kernel node */
- switch (gen_image_get_format ((void *)img_addr)) {
+ switch (genimg_get_format ((void *)img_addr)) {
case IMAGE_FORMAT_LEGACY:
debug ("* kernel: legacy format image\n");
@@ -531,7 +531,7 @@ static int image_info (ulong addr)
printf ("\n## Checking Image at %08lx ...\n", addr);
- switch (gen_image_get_format (hdr)) {
+ switch (genimg_get_format (hdr)) {
case IMAGE_FORMAT_LEGACY:
puts (" Legacy image found\n");
if (!image_check_magic (hdr)) {
@@ -599,7 +599,7 @@ int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
if (!hdr)
goto next_sector;
- switch (gen_image_get_format (hdr)) {
+ switch (genimg_get_format (hdr)) {
case IMAGE_FORMAT_LEGACY:
if (!image_check_magic (hdr))
goto next_sector;
diff --git a/common/cmd_doc.c b/common/cmd_doc.c
index 3358b04622..293b1aa674 100644
--- a/common/cmd_doc.c
+++ b/common/cmd_doc.c
@@ -261,7 +261,7 @@ int do_docboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
}
show_boot_progress (38);
- switch (gen_image_get_format ((void *)addr)) {
+ switch (genimg_get_format ((void *)addr)) {
case IMAGE_FORMAT_LEGACY:
hdr = (image_header_t *)addr;
diff --git a/common/cmd_fdc.c b/common/cmd_fdc.c
index b6e023a5da..80301b9d52 100644
--- a/common/cmd_fdc.c
+++ b/common/cmd_fdc.c
@@ -836,7 +836,7 @@ int do_fdcboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
return 1;
}
- switch (gen_image_get_format ((void *)addr)) {
+ switch (genimg_get_format ((void *)addr)) {
case IMAGE_FORMAT_LEGACY:
hdr = (image_header_t *)addr;
if (!image_check_magic (hdr)) {
diff --git a/common/cmd_fpga.c b/common/cmd_fpga.c
index 10199f59d4..0bb82f68a8 100644
--- a/common/cmd_fpga.c
+++ b/common/cmd_fpga.c
@@ -216,7 +216,7 @@ int do_fpga (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
break;
case FPGA_LOADMK:
- switch (gen_image_get_format (fpga_data)) {
+ switch (genimg_get_format (fpga_data)) {
case IMAGE_FORMAT_LEGACY:
{
image_header_t *hdr = (image_header_t *)fpga_data;
diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index bef04db4f6..79b7dfb7fc 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -446,7 +446,7 @@ int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
}
show_boot_progress (48);
- switch (gen_image_get_format ((void *)addr)) {
+ switch (genimg_get_format ((void *)addr)) {
case IMAGE_FORMAT_LEGACY:
hdr = (image_header_t *)addr;
diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index b099afeca0..86959dc2c0 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -512,7 +512,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
}
show_boot_progress (56);
- switch (gen_image_get_format ((void *)addr)) {
+ switch (genimg_get_format ((void *)addr)) {
case IMAGE_FORMAT_LEGACY:
hdr = (image_header_t *)addr;
@@ -994,7 +994,7 @@ int do_nandboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
}
show_boot_progress (56);
- switch (gen_image_get_format ((void *)addr)) {
+ switch (genimg_get_format ((void *)addr)) {
case IMAGE_FORMAT_LEGACY:
hdr = (image_header_t *)addr;
diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c
index 42b3072984..786880521b 100644
--- a/common/cmd_scsi.c
+++ b/common/cmd_scsi.c
@@ -273,7 +273,7 @@ int do_scsiboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
return 1;
}
- switch (gen_image_get_format ((void *)addr)) {
+ switch (genimg_get_format ((void *)addr)) {
case IMAGE_FORMAT_LEGACY:
hdr = (image_header_t *)addr;
diff --git a/common/cmd_usb.c b/common/cmd_usb.c
index ad3873c2cb..8ee7d27675 100644
--- a/common/cmd_usb.c
+++ b/common/cmd_usb.c
@@ -386,7 +386,7 @@ int do_usbboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
return 1;
}
- switch (gen_image_get_format ((void *)addr)) {
+ switch (genimg_get_format ((void *)addr)) {
case IMAGE_FORMAT_LEGACY:
hdr = (image_header_t *)addr;
diff --git a/common/cmd_ximg.c b/common/cmd_ximg.c
index 4dadc3709d..360b05e1b3 100644
--- a/common/cmd_ximg.c
+++ b/common/cmd_ximg.c
@@ -57,7 +57,7 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
}
- switch (gen_image_get_format ((void *)addr)) {
+ switch (genimg_get_format ((void *)addr)) {
case IMAGE_FORMAT_LEGACY:
printf("## Copying from legacy image at %08lx ...\n", addr);
@@ -104,7 +104,7 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
data += 4;
if (argc > 2 && part > i) {
u_long tail;
- len = image_to_cpu (len_ptr[i]);
+ len = uimage_to_cpu (len_ptr[i]);
tail = len % 4;
data += len;
if (tail) {
@@ -116,7 +116,7 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
printf("Bad Image Part\n");
return 1;
}
- len = image_to_cpu (len_ptr[part]);
+ len = uimage_to_cpu (len_ptr[part]);
#if defined(CONFIG_FIT)
case IMAGE_FORMAT_FIT:
fit_unsupported ("imxtract");
diff --git a/common/image.c b/common/image.c
index 9e446faa73..99ed3b8aa8 100644
--- a/common/image.c
+++ b/common/image.c
@@ -68,6 +68,9 @@ static image_header_t* image_get_ramdisk (cmd_tbl_t *cmdtp, int flag,
unsigned long crc32 (unsigned long, const unsigned char *, unsigned int);
+/*****************************************************************************/
+/* Legacy format routines */
+/*****************************************************************************/
int image_check_hcrc (image_header_t *hdr)
{
ulong hcrc;
@@ -120,61 +123,6 @@ int image_check_dcrc_wd (image_header_t *hdr, ulong chunksz)
return (dcrc == image_get_dcrc (hdr));
}
-int getenv_verify (void)
-{
- char *s = getenv ("verify");
- return (s && (*s == 'n')) ? 0 : 1;
-}
-
-int getenv_autostart (void)
-{
- char *s = getenv ("autostart");
- return (s && (*s == 'n')) ? 0 : 1;
-}
-
-ulong getenv_bootm_low(void)
-{
- char *s = getenv ("bootm_low");
- if (s) {
- ulong tmp = simple_strtoul (s, NULL, 16);
- return tmp;
- }
-
-#ifdef CFG_SDRAM_BASE
- return CFG_SDRAM_BASE;
-#else
- return 0;
-#endif
-}
-
-ulong getenv_bootm_size(void)
-{
- char *s = getenv ("bootm_size");
- if (s) {
- ulong tmp = simple_strtoul (s, NULL, 16);
- return tmp;
- }
-
- return gd->bd->bi_memsize;
-}
-
-void memmove_wd (void *to, void *from, size_t len, ulong chunksz)
-{
-#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
- while (len > 0) {
- size_t tail = (len > chunksz) ? chunksz : len;
- WATCHDOG_RESET ();
- memmove (to, from, tail);
- to += tail;
- from += tail;
- len -= tail;
- }
-#else /* !(CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG) */
- memmove (to, from, len);
-#endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */
-}
-#endif /* USE_HOSTCC */
-
/**
* image_multi_count - get component (sub-image) count
* @hdr: pointer to the header of the multi component image
@@ -262,7 +210,185 @@ void image_multi_getimg (image_header_t *hdr, ulong idx,
}
#ifndef USE_HOSTCC
-const char* image_get_os_name (uint8_t os)
+static void image_print_type (image_header_t *hdr)
+{
+ const char *os, *arch, *type, *comp;
+
+ os = genimg_get_os_name (image_get_os (hdr));
+ arch = genimg_get_arch_name (image_get_arch (hdr));
+ type = genimg_get_type_name (image_get_type (hdr));
+ comp = genimg_get_comp_name (image_get_comp (hdr));
+
+ printf ("%s %s %s (%s)", arch, os, type, comp);
+}
+
+void image_print_contents (image_header_t *hdr)
+{
+#if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE)
+ time_t timestamp = (time_t)image_get_time (hdr);
+ struct rtc_time tm;
+#endif
+
+ printf (" Image Name: %.*s\n", IH_NMLEN, image_get_name (hdr));
+
+#if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE)
+ to_tm (timestamp, &tm);
+ printf (" Created: %4d-%02d-%02d %2d:%02d:%02d UTC\n",
+ tm.tm_year, tm.tm_mon, tm.tm_mday,
+ tm.tm_hour, tm.tm_min, tm.tm_sec);
+#endif
+ puts (" Image Type: ");
+ image_print_type (hdr);
+
+ printf ("\n Data Size: %d Bytes = ", image_get_data_size (hdr));
+ print_size (image_get_data_size (hdr), "\n");
+ printf (" Load Address: %08x\n"
+ " Entry Point: %08x\n",
+ image_get_load (hdr), image_get_ep (hdr));
+
+ if (image_check_type (hdr, IH_TYPE_MULTI)) {
+ int i;
+ ulong data, len;
+ ulong count = image_multi_count (hdr);
+
+ puts (" Contents:\n");
+ for (i = 0; i < count; i++) {
+ image_multi_getimg (hdr, i, &data, &len);
+ printf (" Image %d: %8ld Bytes = ", i, len);
+ print_size (len, "\n");
+ }
+ }
+}
+
+/**
+ * image_get_ramdisk - get and verify ramdisk image
+ * @cmdtp: command table pointer
+ * @flag: command flag
+ * @argc: command argument count
+ * @argv: command argument list
+ * @rd_addr: ramdisk image start address
+ * @arch: expected ramdisk architecture
+ * @verify: checksum verification flag
+ *
+ * image_get_ramdisk() returns a pointer to the verified ramdisk image
+ * header. Routine receives image start address and expected architecture
+ * flag. Verification done covers data and header integrity and os/type/arch
+ * fields checking.
+ *
+ * If dataflash support is enabled routine checks for dataflash addresses
+ * and handles required dataflash reads.
+ *
+ * returns:
+ * pointer to a ramdisk image header, if image was found and valid
+ * otherwise, return NULL
+ */
+static image_header_t* image_get_ramdisk (cmd_tbl_t *cmdtp, int flag,
+ int argc, char *argv[],
+ ulong rd_addr, uint8_t arch, int verify)
+{
+ image_header_t *rd_hdr;
+
+ show_boot_progress (9);
+ rd_hdr = (image_header_t *)rd_addr;
+
+ if (!image_check_magic (rd_hdr)) {
+ puts ("Bad Magic Number\n");
+ show_boot_progress (-10);
+ return NULL;
+ }
+
+ if (!image_check_hcrc (rd_hdr)) {
+ puts ("Bad Header Checksum\n");
+ show_boot_progress (-11);
+ return NULL;
+ }
+
+ show_boot_progress (10);
+ image_print_contents (rd_hdr);
+
+ if (verify) {
+ puts(" Verifying Checksum ... ");
+ if (!image_check_dcrc_wd (rd_hdr, CHUNKSZ)) {
+ puts ("Bad Data CRC\n");
+ show_boot_progress (-12);
+ return NULL;
+ }
+ puts("OK\n");
+ }
+
+ show_boot_progress (11);
+
+ if (!image_check_os (rd_hdr, IH_OS_LINUX) ||
+ !image_check_arch (rd_hdr, arch) ||
+ !image_check_type (rd_hdr, IH_TYPE_RAMDISK)) {
+ printf ("No Linux %s Ramdisk Image\n",
+ genimg_get_arch_name(arch));
+ show_boot_progress (-13);
+ return NULL;
+ }
+
+ return rd_hdr;
+}
+
+/*****************************************************************************/
+/* Shared dual-format routines */
+/*****************************************************************************/
+int getenv_verify (void)
+{
+ char *s = getenv ("verify");
+ return (s && (*s == 'n')) ? 0 : 1;
+}
+
+int getenv_autostart (void)
+{
+ char *s = getenv ("autostart");
+ return (s && (*s == 'n')) ? 0 : 1;
+}
+
+ulong getenv_bootm_low(void)
+{
+ char *s = getenv ("bootm_low");
+ if (s) {
+ ulong tmp = simple_strtoul (s, NULL, 16);
+ return tmp;
+ }
+
+#ifdef CFG_SDRAM_BASE
+ return CFG_SDRAM_BASE;
+#else
+ return 0;
+#endif
+}
+
+ulong getenv_bootm_size(void)
+{
+ char *s = getenv ("bootm_size");
+ if (s) {
+ ulong tmp = simple_strtoul (s, NULL, 16);
+ return tmp;
+ }
+
+ return gd->bd->bi_memsize;
+}
+
+void memmove_wd (void *to, void *from, size_t len, ulong chunksz)
+{
+#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+ while (len > 0) {
+ size_t tail = (len > chunksz) ? chunksz : len;
+ WATCHDOG_RESET ();
+ memmove (to, from, tail);
+ to += tail;
+ from += tail;
+ len -= tail;
+ }
+#else /* !(CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG) */
+ memmove (to, from, len);
+#endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */
+}
+#endif /* USE_HOSTCC */
+
+const char* genimg_get_os_name (uint8_t os)
{
const char *name;
@@ -286,7 +412,7 @@ const char* image_get_os_name (uint8_t os)
return name;
}
-const char* image_get_arch_name (uint8_t arch)
+const char* genimg_get_arch_name (uint8_t arch)
{
const char *name;
@@ -315,7 +441,7 @@ const char* image_get_arch_name (uint8_t arch)
return name;
}
-const char* image_get_type_name (uint8_t type)
+const char* genimg_get_type_name (uint8_t type)
{
const char *name;
@@ -334,7 +460,7 @@ const char* image_get_type_name (uint8_t type)
return name;
}
-const char* image_get_comp_name (uint8_t comp)
+const char* genimg_get_comp_name (uint8_t comp)
{
const char *name;
@@ -348,71 +474,21 @@ const char* image_get_comp_name (uint8_t comp)
return name;
}
-static void image_print_type (image_header_t *hdr)
-{
- const char *os, *arch, *type, *comp;
-
- os = image_get_os_name (image_get_os (hdr));
- arch = image_get_arch_name (image_get_arch (hdr));
- type = image_get_type_name (image_get_type (hdr));
- comp = image_get_comp_name (image_get_comp (hdr));
-
- printf ("%s %s %s (%s)", arch, os, type, comp);
-}
-
-void image_print_contents (image_header_t *hdr)
-{
-#if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE)
- time_t timestamp = (time_t)image_get_time (hdr);
- struct rtc_time tm;
-#endif
-
- printf (" Image Name: %.*s\n", IH_NMLEN, image_get_name (hdr));
-
-#if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE)
- to_tm (timestamp, &tm);
- printf (" Created: %4d-%02d-%02d %2d:%02d:%02d UTC\n",
- tm.tm_year, tm.tm_mon, tm.tm_mday,
- tm.tm_hour, tm.tm_min, tm.tm_sec);
-#endif
- puts (" Image Type: ");
- image_print_type (hdr);
-
- printf ("\n Data Size: %d Bytes = ", image_get_data_size (hdr));
- print_size (image_get_data_size (hdr), "\n");
- printf (" Load Address: %08x\n"
- " Entry Point: %08x\n",
- image_get_load (hdr), image_get_ep (hdr));
-
- if (image_check_type (hdr, IH_TYPE_MULTI)) {
- int i;
- ulong data, len;
- ulong count = image_multi_count (hdr);
-
- puts (" Contents:\n");
- for (i = 0; i < count; i++) {
- image_multi_getimg (hdr, i, &data, &len);
- printf (" Image %d: %8ld Bytes = ", i, len);
- print_size (len, "\n");
- }
- }
-}
-
/**
- * gen_image_get_format - get image format type
+ * genimg_get_format - get image format type
* @img_addr: image start address
*
- * gen_image_get_format() checks whether provided address points to a valid
+ * genimg_get_format() checks whether provided address points to a valid
* legacy or FIT image.
*
* New uImage format and FDT blob are based on a libfdt. FDT blob
* may be passed directly or embedded in a FIT image. In both situations
- * gen_image_get_format() must be able to dectect libfdt header.
+ * genimg_get_format() must be able to dectect libfdt header.
*
* returns:
* image format type or IMAGE_FORMAT_INVALID if no image is present
*/
-int gen_image_get_format (void *img_addr)
+int genimg_get_format (void *img_addr)
{
ulong format = IMAGE_FORMAT_INVALID;
image_header_t *hdr;
@@ -435,16 +511,16 @@ int gen_image_get_format (void *img_addr)
}
/**
- * gen_get_image - get image from special storage (if necessary)
+ * genimg_get_image - get image from special storage (if necessary)
* @img_addr: image start address
*
- * gen_get_image() checks if provided image start adddress is located
+ * genimg_get_image() checks if provided image start adddress is located
* in a dataflash storage. If so, image is moved to a system RAM memory.
*
* returns:
* image start address after possible relocation from special storage
*/
-ulong gen_get_image (ulong img_addr)
+ulong genimg_get_image (ulong img_addr)
{
ulong ram_addr = img_addr;
@@ -469,7 +545,7 @@ ulong gen_get_image (ulong img_addr)
read_dataflash (img_addr, h_size, (char *)ram_addr);
/* get data size */
- switch (gen_image_get_format ((void *)ram_addr)) {
+ switch (genimg_get_format ((void *)ram_addr)) {
case IMAGE_FORMAT_LEGACY:
d_size = image_get_data_size ((image_header_t *)ram_addr);
debug (" Legacy format image found at 0x%08lx, size 0x%08lx\n",
@@ -502,77 +578,7 @@ ulong gen_get_image (ulong img_addr)
}
/**
- * image_get_ramdisk - get and verify ramdisk image
- * @cmdtp: command table pointer
- * @flag: command flag
- * @argc: command argument count
- * @argv: command argument list
- * @rd_addr: ramdisk image start address
- * @arch: expected ramdisk architecture
- * @verify: checksum verification flag
- *
- * image_get_ramdisk() returns a pointer to the verified ramdisk image
- * header. Routine receives image start address and expected architecture
- * flag. Verification done covers data and header integrity and os/type/arch
- * fields checking.
- *
- * If dataflash support is enabled routine checks for dataflash addresses
- * and handles required dataflash reads.
- *
- * returns:
- * pointer to a ramdisk image header, if image was found and valid
- * otherwise, return NULL
- */
-static image_header_t* image_get_ramdisk (cmd_tbl_t *cmdtp, int flag,
- int argc, char *argv[],
- ulong rd_addr, uint8_t arch, int verify)
-{
- image_header_t *rd_hdr;
-
- show_boot_progress (9);
- rd_hdr = (image_header_t *)rd_addr;
-
- if (!image_check_magic (rd_hdr)) {
- puts ("Bad Magic Number\n");
- show_boot_progress (-10);
- return NULL;
- }
-
- if (!image_check_hcrc (rd_hdr)) {
- puts ("Bad Header Checksum\n");
- show_boot_progress (-11);
- return NULL;
- }
-
- show_boot_progress (10);
- image_print_contents (rd_hdr);
-
- if (verify) {
- puts(" Verifying Checksum ... ");
- if (!image_check_dcrc_wd (rd_hdr, CHUNKSZ)) {
- puts ("Bad Data CRC\n");
- show_boot_progress (-12);
- return NULL;
- }
- puts("OK\n");
- }
-
- show_boot_progress (11);
-
- if (!image_check_os (rd_hdr, IH_OS_LINUX) ||
- !image_check_arch (rd_hdr, arch) ||
- !image_check_type (rd_hdr, IH_TYPE_RAMDISK)) {
- printf ("No Linux %s Ramdisk Image\n",
- image_get_arch_name(arch));
- show_boot_progress (-13);
- return NULL;
- }
-
- return rd_hdr;
-}
-
-/**
- * get_ramdisk - main ramdisk handling routine
+ * boot_get_ramdisk - main ramdisk handling routine
* @cmdtp: command table pointer
* @flag: command flag
* @argc: command argument count
@@ -582,7 +588,7 @@ static image_header_t* image_get_ramdisk (cmd_tbl_t *cmdtp, int flag,
* @rd_start: pointer to a ulong variable, will hold ramdisk start address
* @rd_end: pointer to a ulong variable, will hold ramdisk end
*
- * get_ramdisk() is responsible for finding a valid ramdisk image.
+ * boot_get_ramdisk() is responsible for finding a valid ramdisk image.
* Curently supported are the following ramdisk sources:
* - multicomponent kernel/ramdisk image,
* - commandline provided address of decicated ramdisk image.
@@ -593,7 +599,7 @@ static image_header_t* image_get_ramdisk (cmd_tbl_t *cmdtp, int flag,
* rd_start and rd_end are set to 0 if no ramdisk exists
* return 1 if ramdisk image is found but corrupted
*/
-int get_ramdisk (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
+int boot_get_ramdisk (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
bootm_headers_t *images, uint8_t arch,
ulong *rd_start, ulong *rd_end)
{
@@ -645,14 +651,14 @@ int get_ramdisk (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
/* copy from dataflash if needed */
printf ("## Loading init Ramdisk Image at %08lx ...\n",
rd_addr);
- rd_addr = gen_get_image (rd_addr);
+ rd_addr = genimg_get_image (rd_addr);
/*
* Check if there is an initrd image at the
* address provided in the second bootm argument
* check image type, for FIT images get FIT node.
*/
- switch (gen_image_get_format ((void *)rd_addr)) {
+ switch (genimg_get_format ((void *)rd_addr)) {
case IMAGE_FORMAT_LEGACY:
debug ("* ramdisk: legacy format image\n");
@@ -729,7 +735,7 @@ int get_ramdisk (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
#if defined(CONFIG_PPC) || defined(CONFIG_M68K)
/**
- * ramdisk_high - relocate init ramdisk
+ * boot_ramdisk_high - relocate init ramdisk
* @lmb: pointer to lmb handle, will be used for memory mgmt
* @rd_data: ramdisk data start address
* @rd_len: ramdisk data length
@@ -738,18 +744,18 @@ int get_ramdisk (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
* @initrd_end: pointer to a ulong variable, will hold final init ramdisk
* end address (after possible relocation)
*
- * ramdisk_high() takes a relocation hint from "initrd_high" environement
+ * boot_ramdisk_high() takes a relocation hint from "initrd_high" environement
* variable and if requested ramdisk data is moved to a specified location.
*
+ * Initrd_start and initrd_end are set to final (after relocation) ramdisk
+ * start/end addresses if ramdisk image start and len were provided,
+ * otherwise set initrd_start and initrd_end set to zeros.
+ *
* returns:
- * - initrd_start and initrd_end are set to final (after relocation) ramdisk
- * start/end addresses if ramdisk image start and len were provided
- * otherwise set initrd_start and initrd_end set to zeros
- * - returns:
- * 0 - success
- * -1 - failure
+ * 0 - success
+ * -1 - failure
*/
-int ramdisk_high (struct lmb *lmb, ulong rd_data, ulong rd_len,
+int boot_ramdisk_high (struct lmb *lmb, ulong rd_data, ulong rd_len,
ulong *initrd_start, ulong *initrd_end)
{
char *s;
@@ -779,12 +785,12 @@ int ramdisk_high (struct lmb *lmb, ulong rd_data, ulong rd_len,
lmb_reserve(lmb, rd_data, rd_len);
} else {
if (initrd_high)
- *initrd_start = lmb_alloc_base(lmb, rd_len, 0x1000, initrd_high);
+ *initrd_start = lmb_alloc_base (lmb, rd_len, 0x1000, initrd_high);
else
- *initrd_start = lmb_alloc(lmb, rd_len, 0x1000);
+ *initrd_start = lmb_alloc (lmb, rd_len, 0x1000);
if (*initrd_start == 0) {
- puts("ramdisk - allocation error\n");
+ puts ("ramdisk - allocation error\n");
goto error;
}
show_boot_progress (12);
@@ -793,7 +799,7 @@ int ramdisk_high (struct lmb *lmb, ulong rd_data, ulong rd_len,
printf (" Loading Ramdisk to %08lx, end %08lx ... ",
*initrd_start, *initrd_end);
- memmove_wd((void *)*initrd_start,
+ memmove_wd ((void *)*initrd_start,
(void *)rd_data, rd_len, CHUNKSZ);
puts ("OK\n");
@@ -804,6 +810,7 @@ int ramdisk_high (struct lmb *lmb, ulong rd_data, ulong rd_len,
}
debug (" ramdisk load start = 0x%08lx, ramdisk load end = 0x%08lx\n",
*initrd_start, *initrd_end);
+
return 0;
error:
@@ -811,14 +818,14 @@ error:
}
/**
- * get_boot_cmdline - allocate and initialize kernel cmdline
+ * boot_get_cmdline - allocate and initialize kernel cmdline
* @lmb: pointer to lmb handle, will be used for memory mgmt
* @cmd_start: pointer to a ulong variable, will hold cmdline start
* @cmd_end: pointer to a ulong variable, will hold cmdline end
* @bootmap_base: ulong variable, holds offset in physical memory to
* base of bootmap
*
- * get_boot_cmdline() allocates space for kernel command line below
+ * boot_get_cmdline() allocates space for kernel command line below
* BOOTMAPSZ + bootmap_base address. If "bootargs" U-boot environemnt
* variable is present its contents is copied to allocated kernel
* command line.
@@ -827,7 +834,7 @@ error:
* 0 - success
* -1 - failure
*/
-int get_boot_cmdline (struct lmb *lmb, ulong *cmd_start, ulong *cmd_end,
+int boot_get_cmdline (struct lmb *lmb, ulong *cmd_start, ulong *cmd_end,
ulong bootmap_base)
{
char *cmdline;
@@ -853,13 +860,13 @@ int get_boot_cmdline (struct lmb *lmb, ulong *cmd_start, ulong *cmd_end,
}
/**
- * get_boot_kbd - allocate and initialize kernel copy of board info
+ * boot_get_kbd - allocate and initialize kernel copy of board info
* @lmb: pointer to lmb handle, will be used for memory mgmt
* @kbd: double pointer to board info data
* @bootmap_base: ulong variable, holds offset in physical memory to
* base of bootmap
*
- * get_boot_kbd() allocates space for kernel copy of board info data below
+ * boot_get_kbd() allocates space for kernel copy of board info data below
* BOOTMAPSZ + bootmap_base address and kernel board info is initialized with
* the current u-boot board info data.
*
@@ -867,7 +874,7 @@ int get_boot_cmdline (struct lmb *lmb, ulong *cmd_start, ulong *cmd_end,
* 0 - success
* -1 - failure
*/
-int get_boot_kbd (struct lmb *lmb, bd_t **kbd, ulong bootmap_base)
+int boot_get_kbd (struct lmb *lmb, bd_t **kbd, ulong bootmap_base)
{
*kbd = (bd_t *)lmb_alloc_base(lmb, sizeof(bd_t), 0xf,
CFG_BOOTMAPSZ + bootmap_base);
OpenPOWER on IntegriCloud