summaryrefslogtreecommitdiff
path: root/common/image-fit.c
diff options
context:
space:
mode:
authortomas.melin@vaisala.com <tomas.melin@vaisala.com>2017-01-13 11:20:14 (GMT)
committerAnatolij Gustschin <agust@denx.de>2017-01-13 16:40:38 (GMT)
commitdb1b79b886f085b5af09db9378f5c53417c3ecde (patch)
tree5844db57fca174b2ae55ce0b611aaea047d2216b /common/image-fit.c
parent7583f1f577db45c37e0c76dc67616347585aeda3 (diff)
downloadu-boot-fsl-qoriq-db1b79b886f085b5af09db9378f5c53417c3ecde.tar.xz
splash: add support for loading splash from a FIT image
Enable support for loading a splash image from within a FIT image. The image is assumed to be generated with mkimage -E flag to hold the data external to the FIT. Signed-off-by: Tomas Melin <tomas.melin@vaisala.com> Acked-by: Igor Grinberg <grinberg@compulab.co.il>
Diffstat (limited to 'common/image-fit.c')
-rw-r--r--common/image-fit.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/common/image-fit.c b/common/image-fit.c
index 95d8bf4..109ecfa 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -778,6 +778,54 @@ int fit_image_get_data(const void *fit, int noffset,
}
/**
+ * Get 'data-offset' property from a given image node.
+ *
+ * @fit: pointer to the FIT image header
+ * @noffset: component image node offset
+ * @data_offset: holds the data-offset property
+ *
+ * returns:
+ * 0, on success
+ * -ENOENT if the property could not be found
+ */
+int fit_image_get_data_offset(const void *fit, int noffset, int *data_offset)
+{
+ const fdt32_t *val;
+
+ val = fdt_getprop(fit, noffset, FIT_DATA_OFFSET_PROP, NULL);
+ if (!val)
+ return -ENOENT;
+
+ *data_offset = fdt32_to_cpu(*val);
+
+ return 0;
+}
+
+/**
+ * Get 'data-size' property from a given image node.
+ *
+ * @fit: pointer to the FIT image header
+ * @noffset: component image node offset
+ * @data_size: holds the data-size property
+ *
+ * returns:
+ * 0, on success
+ * -ENOENT if the property could not be found
+ */
+int fit_image_get_data_size(const void *fit, int noffset, int *data_size)
+{
+ const fdt32_t *val;
+
+ val = fdt_getprop(fit, noffset, FIT_DATA_SIZE_PROP, NULL);
+ if (!val)
+ return -ENOENT;
+
+ *data_size = fdt32_to_cpu(*val);
+
+ return 0;
+}
+
+/**
* fit_image_hash_get_algo - get hash algorithm name
* @fit: pointer to the FIT format image header
* @noffset: hash node offset