]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - common/image-fit.c
mkimage: Report information about fpga
[karo-tx-uboot.git] / common / image-fit.c
index fbd9e0d770571148ad4f79483bace326e9b9dc6b..8a0ca2a8038db5f3aba06cf1cc5244988b6d056f 100644 (file)
@@ -433,7 +433,7 @@ void fit_image_print(const void *fit, int image_noffset, const char *p)
 
        if ((type == IH_TYPE_KERNEL) || (type == IH_TYPE_STANDALONE) ||
            (type == IH_TYPE_RAMDISK)) {
-               fit_image_get_entry(fit, image_noffset, &entry);
+               ret = fit_image_get_entry(fit, image_noffset, &entry);
                printf("%s  Entry Point:  ", p);
                if (ret)
                        printf("unavailable\n");
@@ -675,6 +675,34 @@ int fit_image_get_comp(const void *fit, int noffset, uint8_t *comp)
        return 0;
 }
 
+static int fit_image_get_address(const void *fit, int noffset, char *name,
+                         ulong *load)
+{
+       int len, cell_len;
+       const fdt32_t *cell;
+       uint64_t load64 = 0;
+
+       cell = fdt_getprop(fit, noffset, name, &len);
+       if (cell == NULL) {
+               fit_get_debug(fit, noffset, name, len);
+               return -1;
+       }
+
+       if (len > sizeof(ulong)) {
+               printf("Unsupported %s address size\n", name);
+               return -1;
+       }
+
+       cell_len = len >> 2;
+       /* Use load64 to avoid compiling warning for 32-bit target */
+       while (cell_len--) {
+               load64 = (load64 << 32) | uimage_to_cpu(*cell);
+               cell++;
+       }
+       *load = (ulong)load64;
+
+       return 0;
+}
 /**
  * fit_image_get_load() - get load addr property for given component image node
  * @fit: pointer to the FIT format image header
@@ -690,17 +718,7 @@ int fit_image_get_comp(const void *fit, int noffset, uint8_t *comp)
  */
 int fit_image_get_load(const void *fit, int noffset, ulong *load)
 {
-       int len;
-       const uint32_t *data;
-
-       data = fdt_getprop(fit, noffset, FIT_LOAD_PROP, &len);
-       if (data == NULL) {
-               fit_get_debug(fit, noffset, FIT_LOAD_PROP, len);
-               return -1;
-       }
-
-       *load = uimage_to_cpu(*data);
-       return 0;
+       return fit_image_get_address(fit, noffset, FIT_LOAD_PROP, load);
 }
 
 /**
@@ -722,17 +740,7 @@ int fit_image_get_load(const void *fit, int noffset, ulong *load)
  */
 int fit_image_get_entry(const void *fit, int noffset, ulong *entry)
 {
-       int len;
-       const uint32_t *data;
-
-       data = fdt_getprop(fit, noffset, FIT_ENTRY_PROP, &len);
-       if (data == NULL) {
-               fit_get_debug(fit, noffset, FIT_ENTRY_PROP, len);
-               return -1;
-       }
-
-       *entry = uimage_to_cpu(*data);
-       return 0;
+       return fit_image_get_address(fit, noffset, FIT_ENTRY_PROP, entry);
 }
 
 /**
@@ -878,9 +886,9 @@ int fit_set_timestamp(void *fit, int noffset, time_t timestamp)
        ret = fdt_setprop(fit, noffset, FIT_TIMESTAMP_PROP, &t,
                                sizeof(uint32_t));
        if (ret) {
-               printf("Can't set '%s' property for '%s' node (%s)\n",
-                      FIT_TIMESTAMP_PROP, fit_get_name(fit, noffset, NULL),
-                      fdt_strerror(ret));
+               debug("Can't set '%s' property for '%s' node (%s)\n",
+                     FIT_TIMESTAMP_PROP, fit_get_name(fit, noffset, NULL),
+                     fdt_strerror(ret));
                return ret == -FDT_ERR_NOSPACE ? -ENOSPC : -1;
        }
 
@@ -1101,8 +1109,9 @@ int fit_all_image_verify(const void *fit)
                         * Direct child node of the images parent node,
                         * i.e. component image node.
                         */
-                       printf("   Hash(es) for Image %u (%s): ", count++,
+                       printf("   Hash(es) for Image %u (%s): ", count,
                               fit_get_name(fit, noffset, NULL));
+                       count++;
 
                        if (!fit_image_verify(fit, noffset))
                                return 0;
@@ -1474,6 +1483,10 @@ void fit_conf_print(const void *fit, int noffset, const char *p)
        if (uname)
                printf("%s  FDT:          %s\n", p, uname);
 
+       uname = (char *)fdt_getprop(fit, noffset, FIT_FPGA_PROP, NULL);
+       if (uname)
+               printf("%s  FPGA:         %s\n", p, uname);
+
        /* Print out all of the specified loadables */
        for (loadables_index = 0;
             fdt_get_string_index(fit, noffset,