All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH V2] SPL: Add FIT data-position property support
@ 2017-12-05  5:20 Peng Fan
  2017-12-05  5:26 ` Lokesh Vutla
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Peng Fan @ 2017-12-05  5:20 UTC (permalink / raw)
  To: u-boot

For external data, FIT has a optional property "data-position" which
can set the external data to a fixed offset to FIT beginning.
Add the support for this property in SPL FIT.

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tomas Melin <tomas.melin@vaisala.com>
Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Cc: "Andrew F. Davis" <afd@ti.com>
Cc: Igor Grinberg <grinberg@compulab.co.il>
Cc: "tomas.melin at vaisala.com" <tomas.melin@vaisala.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Andre Przywara <andre.przywara@arm.com>
Cc: York Sun <york.sun@nxp.com>
Cc: Lokesh Vutla <lokeshvutla@ti.com>
Cc: "Cooper Jr., Franklin" <fcooper@ti.com>
Cc: George McCollister <george.mccollister@gmail.com>
Cc: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Cc: Jean-Jacques Hiblot <jjhiblot@ti.com>
Cc: Rick Altherr <raltherr@google.com>
Cc: Tom Rini <trini@konsulko.com>
---

V2:
 Add review tags
 Per York's comments, add a piece text in source_file_format.txt.

 common/image-fit.c                    | 25 +++++++++++++++++++++++++
 common/spl/spl_fit.c                  | 11 +++++++++--
 doc/uImage.FIT/source_file_format.txt |  3 ++-
 include/image.h                       |  3 +++
 4 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/common/image-fit.c b/common/image-fit.c
index 7f17fd1410..b785d8a36e 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -806,6 +806,31 @@ int fit_image_get_data_offset(const void *fit, int noffset, int *data_offset)
 	return 0;
 }
 
+/**
+ * Get 'data-position' property from a given image node.
+ *
+ * @fit: pointer to the FIT image header
+ * @noffset: component image node offset
+ * @data_position: holds the data-position property
+ *
+ * returns:
+ *     0, on success
+ *     -ENOENT if the property could not be found
+ */
+int fit_image_get_data_position(const void *fit, int noffset,
+				int *data_position)
+{
+	const fdt32_t *val;
+
+	val = fdt_getprop(fit, noffset, FIT_DATA_POSITION_PROP, NULL);
+	if (!val)
+		return -ENOENT;
+
+	*data_position = fdt32_to_cpu(*val);
+
+	return 0;
+}
+
 /**
  * Get 'data-size' property from a given image node.
  *
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index 72ae8f4c50..cc07fbc8a0 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -173,6 +173,7 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector,
 	int align_len = ARCH_DMA_MINALIGN - 1;
 	uint8_t image_comp = -1, type = -1;
 	const void *data;
+	bool external_data = false;
 
 	if (IS_ENABLED(CONFIG_SPL_OS_BOOT) && IS_ENABLED(CONFIG_SPL_GZIP)) {
 		if (fit_image_get_comp(fit, node, &image_comp))
@@ -189,9 +190,15 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector,
 	if (fit_image_get_load(fit, node, &load_addr))
 		load_addr = image_info->load_addr;
 
-	if (!fit_image_get_data_offset(fit, node, &offset)) {
-		/* External data */
+	if (!fit_image_get_data_position(fit, node, &offset)) {
+		external_data = true;
+	} else if (!fit_image_get_data_offset(fit, node, &offset)) {
 		offset += base_offset;
+		external_data = true;
+	}
+
+	if (external_data) {
+		/* External data */
 		if (fit_image_get_data_size(fit, node, &len))
 			return -ENOENT;
 
diff --git a/doc/uImage.FIT/source_file_format.txt b/doc/uImage.FIT/source_file_format.txt
index 6f727a1e8a..88663a161d 100644
--- a/doc/uImage.FIT/source_file_format.txt
+++ b/doc/uImage.FIT/source_file_format.txt
@@ -288,7 +288,8 @@ In this case the 'data' property is omitted. Instead you can use:
 
 The 'data-offset' property can be substituted with 'data-position', which
 defines an absolute position or address as the offset. This is helpful when
-booting U-Boot proper before performing relocation.
+booting U-Boot proper before performing relocation. Pass '-p [offset]' to
+mkimage to enable 'data-position'.
 
 Normal kernel FIT image has data embedded within FIT structure. U-Boot image
 for SPL boot has external data. Existence of 'data-offset' can be used to
diff --git a/include/image.h b/include/image.h
index e9c18ce403..a128a623e5 100644
--- a/include/image.h
+++ b/include/image.h
@@ -887,6 +887,7 @@ int bootz_setup(ulong image, ulong *start, ulong *end);
 
 /* image node */
 #define FIT_DATA_PROP		"data"
+#define FIT_DATA_POSITION_PROP	"data-position"
 #define FIT_DATA_OFFSET_PROP	"data-offset"
 #define FIT_DATA_SIZE_PROP	"data-size"
 #define FIT_TIMESTAMP_PROP	"timestamp"
@@ -968,6 +969,8 @@ int fit_image_get_entry(const void *fit, int noffset, ulong *entry);
 int fit_image_get_data(const void *fit, int noffset,
 				const void **data, size_t *size);
 int fit_image_get_data_offset(const void *fit, int noffset, int *data_offset);
+int fit_image_get_data_position(const void *fit, int noffset,
+				int *data_position);
 int fit_image_get_data_size(const void *fit, int noffset, int *data_size);
 
 int fit_image_hash_get_algo(const void *fit, int noffset, char **algo);
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH V2] SPL: Add FIT data-position property support
  2017-12-05  5:20 [U-Boot] [PATCH V2] SPL: Add FIT data-position property support Peng Fan
@ 2017-12-05  5:26 ` Lokesh Vutla
  2017-12-05 16:26 ` York Sun
  2017-12-13 22:56 ` [U-Boot] [U-Boot, " Tom Rini
  2 siblings, 0 replies; 4+ messages in thread
From: Lokesh Vutla @ 2017-12-05  5:26 UTC (permalink / raw)
  To: u-boot



On Tuesday 05 December 2017 10:50 AM, Peng Fan wrote:
> For external data, FIT has a optional property "data-position" which
> can set the external data to a fixed offset to FIT beginning.
> Add the support for this property in SPL FIT.
> 
> Signed-off-by: Ye Li <ye.li@nxp.com>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Tomas Melin <tomas.melin@vaisala.com>
> Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
> Cc: "Andrew F. Davis" <afd@ti.com>
> Cc: Igor Grinberg <grinberg@compulab.co.il>
> Cc: "tomas.melin at vaisala.com" <tomas.melin@vaisala.com>
> Cc: Kever Yang <kever.yang@rock-chips.com>
> Cc: Andre Przywara <andre.przywara@arm.com>
> Cc: York Sun <york.sun@nxp.com>
> Cc: Lokesh Vutla <lokeshvutla@ti.com>
> Cc: "Cooper Jr., Franklin" <fcooper@ti.com>
> Cc: George McCollister <george.mccollister@gmail.com>
> Cc: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
> Cc: Jean-Jacques Hiblot <jjhiblot@ti.com>
> Cc: Rick Altherr <raltherr@google.com>
> Cc: Tom Rini <trini@konsulko.com>
> ---

Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>

Thanks and regards,
Lokesh

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH V2] SPL: Add FIT data-position property support
  2017-12-05  5:20 [U-Boot] [PATCH V2] SPL: Add FIT data-position property support Peng Fan
  2017-12-05  5:26 ` Lokesh Vutla
@ 2017-12-05 16:26 ` York Sun
  2017-12-13 22:56 ` [U-Boot] [U-Boot, " Tom Rini
  2 siblings, 0 replies; 4+ messages in thread
From: York Sun @ 2017-12-05 16:26 UTC (permalink / raw)
  To: u-boot

On 12/04/2017 09:21 PM, Peng Fan wrote:
> For external data, FIT has a optional property "data-position" which
> can set the external data to a fixed offset to FIT beginning.
> Add the support for this property in SPL FIT.
> 
> Signed-off-by: Ye Li <ye.li@nxp.com>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Tomas Melin <tomas.melin@vaisala.com>
> Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
> Cc: "Andrew F. Davis" <afd@ti.com>
> Cc: Igor Grinberg <grinberg@compulab.co.il>
> Cc: "tomas.melin at vaisala.com" <tomas.melin@vaisala.com>
> Cc: Kever Yang <kever.yang@rock-chips.com>
> Cc: Andre Przywara <andre.przywara@arm.com>
> Cc: York Sun <york.sun@nxp.com>
> Cc: Lokesh Vutla <lokeshvutla@ti.com>
> Cc: "Cooper Jr., Franklin" <fcooper@ti.com>
> Cc: George McCollister <george.mccollister@gmail.com>
> Cc: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
> Cc: Jean-Jacques Hiblot <jjhiblot@ti.com>
> Cc: Rick Altherr <raltherr@google.com>
> Cc: Tom Rini <trini@konsulko.com>
> ---
> 
> V2:
>  Add review tags
>  Per York's comments, add a piece text in source_file_format.txt.
> 
>  common/image-fit.c                    | 25 +++++++++++++++++++++++++
>  common/spl/spl_fit.c                  | 11 +++++++++--
>  doc/uImage.FIT/source_file_format.txt |  3 ++-
>  include/image.h                       |  3 +++
>  4 files changed, 39 insertions(+), 3 deletions(-)
> 

Reviewed-by: York Sun <york.sun@nxp.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [U-Boot, V2] SPL: Add FIT data-position property support
  2017-12-05  5:20 [U-Boot] [PATCH V2] SPL: Add FIT data-position property support Peng Fan
  2017-12-05  5:26 ` Lokesh Vutla
  2017-12-05 16:26 ` York Sun
@ 2017-12-13 22:56 ` Tom Rini
  2 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2017-12-13 22:56 UTC (permalink / raw)
  To: u-boot

On Tue, Dec 05, 2017 at 01:20:59PM +0800, Peng Fan wrote:

> For external data, FIT has a optional property "data-position" which
> can set the external data to a fixed offset to FIT beginning.
> Add the support for this property in SPL FIT.
> 
> Signed-off-by: Ye Li <ye.li@nxp.com>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Tomas Melin <tomas.melin@vaisala.com>
> Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
> Cc: "Andrew F. Davis" <afd@ti.com>
> Cc: Igor Grinberg <grinberg@compulab.co.il>
> Cc: "tomas.melin at vaisala.com" <tomas.melin@vaisala.com>
> Cc: Kever Yang <kever.yang@rock-chips.com>
> Cc: Andre Przywara <andre.przywara@arm.com>
> Cc: York Sun <york.sun@nxp.com>
> Cc: Lokesh Vutla <lokeshvutla@ti.com>
> Cc: "Cooper Jr., Franklin" <fcooper@ti.com>
> Cc: George McCollister <george.mccollister@gmail.com>
> Cc: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
> Cc: Jean-Jacques Hiblot <jjhiblot@ti.com>
> Cc: Rick Altherr <raltherr@google.com>
> Cc: Tom Rini <trini@konsulko.com>
> Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
> Reviewed-by: York Sun <york.sun@nxp.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171213/12b2d2fc/attachment.sig>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-12-13 22:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-05  5:20 [U-Boot] [PATCH V2] SPL: Add FIT data-position property support Peng Fan
2017-12-05  5:26 ` Lokesh Vutla
2017-12-05 16:26 ` York Sun
2017-12-13 22:56 ` [U-Boot] [U-Boot, " Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.