summaryrefslogtreecommitdiff
path: root/include/remoteproc.h
diff options
context:
space:
mode:
authorFabien Dessenne <fabien.dessenne@st.com>2019-05-31 15:11:33 +0200
committerPatrick Delaunay <patrick.delaunay@st.com>2019-07-22 09:21:28 +0200
commit7a7c4cb0f0440ce7384e233583b32c75ef534ddc (patch)
tree03c2fa96ca5995ab1658133a4822d9d933dda0bd /include/remoteproc.h
parent163b7d7706d842517c5c77e649290be557ad578b (diff)
remoteproc: add elf file load support
The current implementation supports only binary file load. Add helpers to support ELF32 format (sanity check, and load). Note that since an ELF32 image is built for the remote processor, the load function uses the device_to_virt ops to translate the addresses. Implement a basic translation for sandbox_testproc. Add related tests. Test result: => ut dm remoteproc_elf Test: dm_test_remoteproc_elf: remoteproc.c Test: dm_test_remoteproc_elf: remoteproc.c (flat tree) Failures: 0 Signed-off-by: Loic Pallardy <loic.pallardy@st.com> Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com> Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
Diffstat (limited to 'include/remoteproc.h')
-rw-r--r--include/remoteproc.h30
1 files changed, 27 insertions, 3 deletions
diff --git a/include/remoteproc.h b/include/remoteproc.h
index aef6ff2e49..c29c0867bc 100644
--- a/include/remoteproc.h
+++ b/include/remoteproc.h
@@ -151,10 +151,10 @@ int rproc_dev_init(int id);
bool rproc_is_initialized(void);
/**
- * rproc_load() - load binary to a remote processor
+ * rproc_load() - load binary or elf to a remote processor
* @id: id of the remote processor
- * @addr: address in memory where the binary image is located
- * @size: size of the binary image
+ * @addr: address in memory where the image is located
+ * @size: size of the image
* @return 0 if all ok, else appropriate error value.
*/
int rproc_load(int id, ulong addr, ulong size);
@@ -200,6 +200,26 @@ int rproc_ping(int id);
* processor, but just ensures that it is out of reset and executing code.
*/
int rproc_is_running(int id);
+
+/**
+ * rproc_elf32_sanity_check() - Verify if an image is a valid ELF32 one
+ *
+ * Check if a valid ELF32 image exists at the given memory location. Verify
+ * basic ELF32 format requirements like magic number and sections size.
+ *
+ * @addr: address of the image to verify
+ * @size: size of the image
+ * @return 0 if the image looks good, else appropriate error value.
+ */
+int rproc_elf32_sanity_check(ulong addr, ulong size);
+
+/**
+ * rproc_elf32_load_image() - load an ELF32 image
+ * @dev: device loading the ELF32 image
+ * @addr: valid ELF32 image address
+ * @return 0 if the image is successfully loaded, else appropriate error value.
+ */
+int rproc_elf32_load_image(struct udevice *dev, unsigned long addr);
#else
static inline int rproc_init(void) { return -ENOSYS; }
static inline int rproc_dev_init(int id) { return -ENOSYS; }
@@ -210,6 +230,10 @@ static inline int rproc_stop(int id) { return -ENOSYS; }
static inline int rproc_reset(int id) { return -ENOSYS; }
static inline int rproc_ping(int id) { return -ENOSYS; }
static inline int rproc_is_running(int id) { return -ENOSYS; }
+static inline int rproc_elf32_sanity_check(ulong addr,
+ ulong size) { return -ENOSYS; }
+static inline int rproc_elf32_load_image(struct udevice *dev,
+ unsigned long addr) { return -ENOSYS; }
#endif
#endif /* _RPROC_H_ */