]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
image: Remove the fit_load_image() property parameter
authorSimon Glass <sjg@chromium.org>
Thu, 12 Jun 2014 13:24:47 +0000 (07:24 -0600)
committerTom Rini <trini@ti.com>
Thu, 19 Jun 2014 15:18:59 +0000 (11:18 -0400)
This can be obtained by looking up the image type, so is redundant. It is
better to centralise this lookup to avoid errors.

Signed-off-by: Simon Glass <sjg@chromium.org>
common/bootm.c
common/image-fdt.c
common/image-fit.c
common/image.c
include/image.h

index 27a7f028a6f9ab5cd20d073614927d252d439139..338f647e419b9500ca20950ff4d6ea3cf5fe0064 100644 (file)
@@ -776,8 +776,7 @@ static const void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
 #endif
 #if defined(CONFIG_FIT)
        case IMAGE_FORMAT_FIT:
-               os_noffset = fit_image_load(images, FIT_KERNEL_PROP,
-                               img_addr,
+               os_noffset = fit_image_load(images, img_addr,
                                &fit_uname_kernel, &fit_uname_config,
                                IH_ARCH_DEFAULT, IH_TYPE_KERNEL,
                                BOOTSTAGE_ID_FIT_KERNEL_START,
index 27a8a44eaad80d21247274f9e13a6d26fe3c49ab..9fc7481fd80d190a015814b626091dd8a65bdcce 100644 (file)
@@ -355,7 +355,6 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
                                ulong load, len;
 
                                fdt_noffset = fit_image_load(images,
-                                       FIT_FDT_PROP,
                                        fdt_addr, &fit_uname_fdt,
                                        &fit_uname_config,
                                        arch, IH_TYPE_FLATDT,
index 40c7e27c6e6da81495165601f5d7d0a57266e5aa..c0d7b8ca9156568dc9799a4a93b95adb7b8f53f4 100644 (file)
@@ -1477,7 +1477,32 @@ int fit_get_node_from_config(bootm_headers_t *images, const char *prop_name,
        return noffset;
 }
 
-int fit_image_load(bootm_headers_t *images, const char *prop_name, ulong addr,
+/**
+ * fit_get_image_type_property() - get property name for IH_TYPE_...
+ *
+ * @return the properly name where we expect to find the image in the
+ * config node
+ */
+static const char *fit_get_image_type_property(int type)
+{
+       /*
+        * This is sort-of available in the uimage_type[] table in image.c
+        * but we don't have access to the sohrt name, and "fdt" is different
+        * anyway. So let's just keep it here.
+        */
+       switch (type) {
+       case IH_TYPE_FLATDT:
+               return FIT_FDT_PROP;
+       case IH_TYPE_KERNEL:
+               return FIT_KERNEL_PROP;
+       case IH_TYPE_RAMDISK:
+               return FIT_RAMDISK_PROP;
+       }
+
+       return "unknown";
+}
+
+int fit_image_load(bootm_headers_t *images, ulong addr,
                   const char **fit_unamep, const char **fit_uname_configp,
                   int arch, int image_type, int bootstage_id,
                   enum fit_load_op load_op, ulong *datap, ulong *lenp)
@@ -1490,11 +1515,13 @@ int fit_image_load(bootm_headers_t *images, const char *prop_name, ulong addr,
        size_t size;
        int type_ok, os_ok;
        ulong load, data, len;
+       const char *prop_name;
        int ret;
 
        fit = map_sysmem(addr, 0);
        fit_uname = fit_unamep ? *fit_unamep : NULL;
        fit_uname_config = fit_uname_configp ? *fit_uname_configp : NULL;
+       prop_name = fit_get_image_type_property(image_type);
        printf("## Loading %s from FIT Image at %08lx ...\n", prop_name, addr);
 
        bootstage_mark(bootstage_id + BOOTSTAGE_SUB_FORMAT);
index f33b17522a89e2cc47628685c5cb401e3f0f5cc1..828b0af6d2235e40541bdf56e69d1dfc65003766 100644 (file)
@@ -903,7 +903,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 #endif
 #if defined(CONFIG_FIT)
                case IMAGE_FORMAT_FIT:
-                       rd_noffset = fit_image_load(images, FIT_RAMDISK_PROP,
+                       rd_noffset = fit_image_load(images,
                                        rd_addr, &fit_uname_ramdisk,
                                        &fit_uname_config, arch,
                                        IH_TYPE_RAMDISK,
index b71e4ba35f633555b435448ba3ce119a19837b89..ae767f0c8315c3b6a99a511e25f8e85fe665f8c9 100644 (file)
@@ -434,8 +434,9 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
  * out progress messages, checking the type/arch/os and optionally copying it
  * to the right load address.
  *
+ * The property to look up is defined by image_type.
+ *
  * @param images       Boot images structure
- * @param prop_name    Property name to look up (FIT_..._PROP)
  * @param addr         Address of FIT in memory
  * @param fit_unamep   On entry this is the requested image name
  *                     (e.g. "kernel@1") or NULL to use the default. On exit
@@ -454,7 +455,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
  * @param datap                Returns address of loaded image
  * @param lenp         Returns length of loaded image
  */
-int fit_image_load(bootm_headers_t *images, const char *prop_name, ulong addr,
+int fit_image_load(bootm_headers_t *images, ulong addr,
                   const char **fit_unamep, const char **fit_uname_configp,
                   int arch, int image_type, int bootstage_id,
                   enum fit_load_op load_op, ulong *datap, ulong *lenp);