]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - common/cmd_bootm.c
do_reset: unify duplicate prototypes
[karo-tx-uboot.git] / common / cmd_bootm.c
index bf77fb463d3421a6cc20e9b72b5715ac24d60176..9873ee7de8822cba4838e732df3f3680c9c28cf3 100644 (file)
@@ -77,6 +77,7 @@ static int image_info (unsigned long addr);
 
 #if defined(CONFIG_CMD_IMLS)
 #include <flash.h>
+#include <mtd/cfi_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 * const argv[]);
 #endif
@@ -92,7 +93,6 @@ static int fit_check_kernel (const void *fit, int os_noffset, int verify);
 
 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 * const argv[]);
 
 /*
  *  Continue booting an OS image; caller already has:
@@ -118,6 +118,9 @@ extern void lynxkdi_boot (image_header_t *);
 #ifdef CONFIG_BOOTM_RTEMS
 static boot_os_fn do_bootm_rtems;
 #endif
+#if defined(CONFIG_BOOTM_OSE)
+static boot_os_fn do_bootm_ose;
+#endif
 #if defined(CONFIG_CMD_ELF)
 static boot_os_fn do_bootm_vxworks;
 static boot_os_fn do_bootm_qnxelf;
@@ -141,6 +144,9 @@ static boot_os_fn *boot_os[] = {
 #ifdef CONFIG_BOOTM_RTEMS
        [IH_OS_RTEMS] = do_bootm_rtems,
 #endif
+#if defined(CONFIG_BOOTM_OSE)
+       [IH_OS_OSE] = do_bootm_ose,
+#endif
 #if defined(CONFIG_CMD_ELF)
        [IH_OS_VXWORKS] = do_bootm_vxworks,
        [IH_OS_QNX] = do_bootm_qnxelf,
@@ -301,7 +307,6 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
                }
 
 #if defined(CONFIG_OF_LIBFDT)
-#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_SPARC)
                /* find flattened device tree */
                ret = boot_get_fdt (flag, argc, argv, &images,
                                    &images.ft_addr, &images.ft_len);
@@ -311,7 +316,6 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
                }
 
                set_working_fdt_addr(images.ft_addr);
-#endif
 #endif
        }
 
@@ -333,6 +337,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);
 
@@ -386,12 +393,14 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
                break;
 #endif /* CONFIG_BZIP2 */
 #ifdef CONFIG_LZMA
-       case IH_COMP_LZMA:
+       case IH_COMP_LZMA: {
+               SizeT lzma_len = unc_len;
                printf ("   Uncompressing %s ... ", type_name);
 
-               int ret = lzmaBuffToBuffDecompress(
-                       (unsigned char *)load, &unc_len,
+               ret = lzmaBuffToBuffDecompress(
+                       (unsigned char *)load, &lzma_len,
                        (unsigned char *)image_start, image_len);
+               unc_len = lzma_len;
                if (ret != SZ_OK) {
                        printf ("LZMA: uncompress or overwrite error %d "
                                "- must RESET board to recover\n", ret);
@@ -400,12 +409,13 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
                }
                *load_end = load + unc_len;
                break;
+       }
 #endif /* CONFIG_LZMA */
 #ifdef CONFIG_LZO
        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) {
@@ -461,7 +471,7 @@ static int bootm_start_standalone(ulong iflag, int argc, char * const argv[])
 static cmd_tbl_t cmd_bootm_sub[] = {
        U_BOOT_CMD_MKENT(start, 0, 1, (void *)BOOTM_STATE_START, "", ""),
        U_BOOT_CMD_MKENT(loados, 0, 1, (void *)BOOTM_STATE_LOADOS, "", ""),
-#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_SPARC)
+#ifdef CONFIG_SYS_BOOT_RAMDISK_HIGH
        U_BOOT_CMD_MKENT(ramdisk, 0, 1, (void *)BOOTM_STATE_RAMDISK, "", ""),
 #endif
 #ifdef CONFIG_OF_LIBFDT
@@ -491,17 +501,14 @@ int do_bootm_subcommand (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv
                        argv++;
                        return bootm_start(cmdtp, flag, argc, argv);
                }
-       }
-       /* Unrecognized command */
-       else {
-               cmd_usage(cmdtp);
-               return 1;
+       } else {
+               /* Unrecognized command */
+               return cmd_usage(cmdtp);
        }
 
        if (images.state >= state) {
                printf ("Trying to execute a command out of order\n");
-               cmd_usage(cmdtp);
-               return 1;
+               return cmd_usage(cmdtp);
        }
 
        images.state |= state;
@@ -520,7 +527,7 @@ int do_bootm_subcommand (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv
                        lmb_reserve(&images.lmb, images.os.load,
                                        (load_end - images.os.load));
                        break;
-#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_SPARC)
+#ifdef CONFIG_SYS_BOOT_RAMDISK_HIGH
                case BOOTM_STATE_RAMDISK:
                {
                        ulong rd_len = images.rd_end - images.rd_start;
@@ -582,7 +589,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        ulong           load_end = 0;
        int             ret;
        boot_os_fn      *boot_fn;
-#ifndef CONFIG_RELOC_FIXUP_WORKS
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
        static int relocated = 0;
 
        /* relocate boot function table */
@@ -1379,6 +1386,39 @@ static int do_bootm_rtems (int flag, int argc, char * const argv[],
 }
 #endif /* CONFIG_BOOTM_RTEMS */
 
+#if defined(CONFIG_BOOTM_OSE)
+static int do_bootm_ose (int flag, int argc, char * const argv[],
+                          bootm_headers_t *images)
+{
+       void (*entry_point)(void);
+
+       if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
+               return 1;
+
+#if defined(CONFIG_FIT)
+       if (!images->legacy_hdr_valid) {
+               fit_unsupported_reset ("OSE");
+               return 1;
+       }
+#endif
+
+       entry_point = (void (*)(void))images->ep;
+
+       printf ("## Transferring control to OSE (at address %08lx) ...\n",
+               (ulong)entry_point);
+
+       show_boot_progress (15);
+
+       /*
+        * OSE Parameters:
+        *   None
+        */
+       (*entry_point)();
+
+       return 1;
+}
+#endif /* CONFIG_BOOTM_OSE */
+
 #if defined(CONFIG_CMD_ELF)
 static int do_bootm_vxworks (int flag, int argc, char * const argv[],
                             bootm_headers_t *images)