summaryrefslogtreecommitdiff
path: root/include/remoteproc.h
diff options
context:
space:
mode:
authorFabien Dessenne <fabien.dessenne@st.com>2019-10-30 14:38:28 +0100
committerTom Rini <trini@konsulko.com>2020-01-07 11:13:25 -0500
commitffcb880de81c7a8fb4328b415bf95cae57bc6b2b (patch)
tree6e4b28fe66c8faa4b40be12327b0ac87c97ece75 /include/remoteproc.h
parent152781d4641e0e4c37b3a32f699cf99aeec877c8 (diff)
downloadu-boot-ffcb880de81c7a8fb4328b415bf95cae57bc6b2b.tar.gz
remoteproc: elf_loader: Add elf resource table load support
Add rproc_elf_load_rsc_table(), which searches for a resource table in an elf64/elf32 image, and if found, copies it to device memory. Add also the elf32 and elf64 variants of this API. Add a test for this. Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com> Acked-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
Diffstat (limited to 'include/remoteproc.h')
-rw-r--r--include/remoteproc.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/include/remoteproc.h b/include/remoteproc.h
index 046cd9e54e..a903acb9b2 100644
--- a/include/remoteproc.h
+++ b/include/remoteproc.h
@@ -277,6 +277,64 @@ int rproc_elf_load_image(struct udevice *dev, unsigned long addr, ulong size);
* image.
*/
ulong rproc_elf_get_boot_addr(struct udevice *dev, ulong addr);
+
+/**
+ * rproc_elf32_load_rsc_table() - load the resource table from an ELF32 image
+ *
+ * Search for the resource table in an ELF32 image, and if found, copy it to
+ * device memory.
+ *
+ * @dev: device loading the resource table
+ * @fw_addr: ELF image address
+ * @fw_size: size of the ELF image
+ * @rsc_addr: pointer to the found resource table address. Updated on
+ * operation success
+ * @rsc_size: pointer to the found resource table size. Updated on operation
+ * success
+ *
+ * @return 0 if a valid resource table is successfully loaded, -ENODATA if there
+ * is no resource table (which is optional), or another appropriate error value.
+ */
+int rproc_elf32_load_rsc_table(struct udevice *dev, ulong fw_addr,
+ ulong fw_size, ulong *rsc_addr, ulong *rsc_size);
+/**
+ * rproc_elf64_load_rsc_table() - load the resource table from an ELF64 image
+ *
+ * Search for the resource table in an ELF64 image, and if found, copy it to
+ * device memory.
+ *
+ * @dev: device loading the resource table
+ * @fw_addr: ELF image address
+ * @fw_size: size of the ELF image
+ * @rsc_addr: pointer to the found resource table address. Updated on
+ * operation success
+ * @rsc_size: pointer to the found resource table size. Updated on operation
+ * success
+ *
+ * @return 0 if a valid resource table is successfully loaded, -ENODATA if there
+ * is no resource table (which is optional), or another appropriate error value.
+ */
+int rproc_elf64_load_rsc_table(struct udevice *dev, ulong fw_addr,
+ ulong fw_size, ulong *rsc_addr, ulong *rsc_size);
+/**
+ * rproc_elf_load_rsc_table() - load the resource table from an ELF image
+ *
+ * Auto detects if the image is ELF32 or ELF64 image and search accordingly for
+ * the resource table, and if found, copy it to device memory.
+ *
+ * @dev: device loading the resource table
+ * @fw_addr: ELF image address
+ * @fw_size: size of the ELF image
+ * @rsc_addr: pointer to the found resource table address. Updated on
+ * operation success
+ * @rsc_size: pointer to the found resource table size. Updated on operation
+ * success
+ *
+ * @return 0 if a valid resource table is successfully loaded, -ENODATA if there
+ * is no resource table (which is optional), or another appropriate error value.
+ */
+int rproc_elf_load_rsc_table(struct udevice *dev, ulong fw_addr,
+ ulong fw_size, ulong *rsc_addr, ulong *rsc_size);
#else
static inline int rproc_init(void) { return -ENOSYS; }
static inline int rproc_dev_init(int id) { return -ENOSYS; }
@@ -304,6 +362,18 @@ static inline int rproc_elf_load_image(struct udevice *dev, ulong addr,
{ return -ENOSYS; }
static inline ulong rproc_elf_get_boot_addr(struct udevice *dev, ulong addr)
{ return 0; }
+static inline int rproc_elf32_load_rsc_table(struct udevice *dev, ulong fw_addr,
+ ulong fw_size, ulong *rsc_addr,
+ ulong *rsc_size)
+{ return -ENOSYS; }
+static inline int rproc_elf64_load_rsc_table(struct udevice *dev, ulong fw_addr,
+ ulong fw_size, ulong *rsc_addr,
+ ulong *rsc_size)
+{ return -ENOSYS; }
+static inline int rproc_elf_load_rsc_table(struct udevice *dev, ulong fw_addr,
+ ulong fw_size, ulong *rsc_addr,
+ ulong *rsc_size)
+{ return -ENOSYS; }
#endif
#endif /* _RPROC_H_ */