Skip to contentSkip to conversation

SPL: Add FIT data-position property support

PATCH Superseded Peng Fan 5 participants 6 messages Nov 28, 2017 – Dec 5, 2017

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Peng Fan

author
#0 lore raw

PATCH 1/1 SPL: Add FIT data-position property support

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.

Cc Simon Glass <[email protected]>
Cc Pantelis Antoniou <[email protected]>
Cc "Andrew F. Davis" <[email protected]>
Cc Igor Grinberg <[email protected]>
Cc "tomas.melin at vaisala.com" <[email protected]>
Cc Kever Yang <[email protected]>
Cc Andre Przywara <[email protected]>
Cc York Sun <[email protected]>
Cc Lokesh Vutla <[email protected]>
Cc "Cooper Jr., Franklin" <[email protected]>
Cc George McCollister <[email protected]>
Cc Tuomas Tynkkynen <[email protected]>
Cc Jean-Jacques Hiblot <[email protected]>
Cc Rick Altherr <[email protected]>
Cc Tom Rini <[email protected]>
---
 common/image-fit.c   | 25 +++++++++++++++++++++++++
 common/spl/spl_fit.c | 11 +++++++++--
 include/image.h      |  3 +++
 3 files changed, 37 insertions(+), 2 deletions(-)
common/image-fit.c +25 -0
index 7f17fd1410..b785d8a36e 100644
@@ -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.
  *
common/spl/spl_fit.c +9 -2
index 32d9ee5901..c915b4b149 100644
@@ -143,6 +143,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))
@@ -159,9 +160,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;
 
include/image.h +3 -0
index 127cfc5148..15e171d037 100644
@@ -886,6 +886,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"
@@ -967,6 +968,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);
Signature · 1 line
2.14.1
#1 lore raw

PATCH 1/1 SPL: Add FIT data-position property support

Quoted 21 lines · Peng Fan

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.

Cc Simon Glass <[email protected]>
Cc Pantelis Antoniou <[email protected]>
Cc "Andrew F. Davis" <[email protected]>
Cc Igor Grinberg <[email protected]>
Cc "tomas.melin at vaisala.com" <[email protected]>
Cc Kever Yang <[email protected]>
Cc Andre Przywara <[email protected]>
Cc York Sun <[email protected]>
Cc Lokesh Vutla <[email protected]>
Cc "Cooper Jr., Franklin" <[email protected]>
Cc George McCollister <[email protected]>
Cc Tuomas Tynkkynen <[email protected]>
Cc Jean-Jacques Hiblot <[email protected]>
Cc Rick Altherr <[email protected]>
Cc Tom Rini <[email protected]>
Quoted 5 lines
---
 common/image-fit.c   | 25 +++++++++++++++++++++++++
 common/spl/spl_fit.c | 11 +++++++++--
 include/image.h      |  3 +++
 3 files changed, 37 insertions(+), 2 deletions(-)
#2 lore raw

PATCH 1/1 SPL: Add FIT data-position property support

In reply to Peng Fan
Quoted 21 lines · Peng Fan

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.

Cc Simon Glass <[email protected]>
Cc Pantelis Antoniou <[email protected]>
Cc "Andrew F. Davis" <[email protected]>
Cc Igor Grinberg <[email protected]>
Cc "tomas.melin at vaisala.com" <[email protected]>
Cc Kever Yang <[email protected]>
Cc Andre Przywara <[email protected]>
Cc York Sun <[email protected]>
Cc Lokesh Vutla <[email protected]>
Cc "Cooper Jr., Franklin" <[email protected]>
Cc George McCollister <[email protected]>
Cc Tuomas Tynkkynen <[email protected]>
Cc Jean-Jacques Hiblot <[email protected]>
Cc Rick Altherr <[email protected]>
Cc Tom Rini <[email protected]>
Quoted 5 lines
---
 common/image-fit.c   | 25 +++++++++++++++++++++++++
 common/spl/spl_fit.c | 11 +++++++++--
 include/image.h      |  3 +++
 3 files changed, 37 insertions(+), 2 deletions(-)

Looks good. Would it be appropriate to update doc/uImage.FIT/source_file_format.txt to include this property?

York

#5 lore raw

PATCH 1/1 SPL: Add FIT data-position property support

In reply to Peng Fan
Quoted 21 lines · Peng Fan

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.

Cc Simon Glass <[email protected]>
Cc Pantelis Antoniou <[email protected]>
Cc "Andrew F. Davis" <[email protected]>
Cc Igor Grinberg <[email protected]>
Cc "tomas.melin at vaisala.com" <[email protected]>
Cc Kever Yang <[email protected]>
Cc Andre Przywara <[email protected]>
Cc York Sun <[email protected]>
Cc Lokesh Vutla <[email protected]>
Cc "Cooper Jr., Franklin" <[email protected]>
Cc George McCollister <[email protected]>
Cc Tuomas Tynkkynen <[email protected]>
Cc Jean-Jacques Hiblot <[email protected]>
Cc Rick Altherr <[email protected]>
Cc Tom Rini <[email protected]>
Quoted 6 lines
---
 common/image-fit.c   | 25 +++++++++++++++++++++++++
 common/spl/spl_fit.c | 11 +++++++++--
 include/image.h      |  3 +++
 3 files changed, 37 insertions(+), 2 deletions(-)
#3 lore raw

PATCH 1/1 SPL: Add FIT data-position property support

In reply to York Sun
Quoted 29 lines · York Sun
Quoted 21 lines · Peng Fan

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.

Cc Simon Glass <[email protected]>
Cc Pantelis Antoniou <[email protected]>
Cc "Andrew F. Davis" <[email protected]>
Cc Igor Grinberg <[email protected]>
Cc "tomas.melin at vaisala.com" <[email protected]>
Cc Kever Yang <[email protected]>
Cc Andre Przywara <[email protected]>
Cc York Sun <[email protected]>
Cc Lokesh Vutla <[email protected]>
Cc "Cooper Jr., Franklin" <[email protected]>
Cc George McCollister <[email protected]>
Cc Tuomas Tynkkynen <[email protected]>
Cc Jean-Jacques Hiblot <[email protected]>
Cc Rick Altherr <[email protected]>
Cc Tom Rini <[email protected]>
Quoted 5 lines
---
 common/image-fit.c   | 25 +++++++++++++++++++++++++
 common/spl/spl_fit.c | 11 +++++++++--
 include/image.h      |  3 +++
 3 files changed, 37 insertions(+), 2 deletions(-)
Quoted 2 lines

Looks good. Would it be appropriate to update doc/uImage.FIT/source_file_format.txt to include this property?

All,

Is the following explaination ok?

doc/uImage.FIT/source_file_format.txt +2 -1
index 6f727a1e8a..0db23db6c7 100644
@@ -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`.
 

If it is ok, I'll add it into V2.

Thanks,
Peng.

Quoted 7 lines

York

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#4 lore raw

PATCH 1/1 SPL: Add FIT data-position property support

Quoted 52 lines · Peng Fan
Quoted 31 lines · York Sun
Quoted 22 lines · Peng Fan

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.

Cc Simon Glass <[email protected]>
Cc Pantelis Antoniou <[email protected]>
Cc "Andrew F. Davis" <[email protected]>
Cc Igor Grinberg <[email protected]>
Cc "tomas.melin at vaisala.com" <[email protected]>
Cc Kever Yang <[email protected]>
Cc Andre Przywara <[email protected]>
Cc York Sun <[email protected]>
Cc Lokesh Vutla <[email protected]>
Cc "Cooper Jr., Franklin" <[email protected]>
Cc George McCollister <[email protected]>
Cc Tuomas Tynkkynen <[email protected]>
Cc Jean-Jacques Hiblot <[email protected]>
Cc Rick Altherr <[email protected]>
Cc Tom Rini <[email protected]>
Quoted 5 lines

---

common/image-fit.c   | 25 +++++++++++++++++++++++++
common/spl/spl_fit.c | 11 +++++++++--
include/image.h      |  3 +++
3 files changed, 37 insertions(+), 2 deletions(-)
Quoted 2 lines

Looks good. Would it be appropriate to update doc/uImage.FIT/source_file_format.txt to include this property?

All,

Is the following explaination ok?

doc/uImage.FIT/source_file_format.txt +0 -0
index 6f727a1e8a..0db23db6c7 100644
@@ -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

doc/uImage.FIT/source_file_format.txt +2 -1
-booting U-Boot proper before performing relocation.
+booting U-Boot proper before performing relocation. Pass `-p [offset]` to
+mkimage to enable `data-position`.
Quoted 2 lines

If it is ok, I'll add it into V2.

It's something. I am OK.

York