aboutsummaryrefslogtreecommitdiff
path: root/include/remoteproc.h
diff options
context:
space:
mode:
authorLokesh Vutla <lokeshvutla@ti.com>2019-09-04 16:01:30 +0530
committerTom Rini <trini@konsulko.com>2019-10-11 10:07:34 -0400
commit856c0ad413f52d20963ef6b0fe982a0ca91086f2 (patch)
treee9c1c8729acb11ab54a367e2fcae8e8c3ec1450e /include/remoteproc.h
parente3c4d6f01fb5c86ee8a67d28cc3a0eb708954e40 (diff)
downloadu-boot-856c0ad413f52d20963ef6b0fe982a0ca91086f2.zip
u-boot-856c0ad413f52d20963ef6b0fe982a0ca91086f2.tar.gz
u-boot-856c0ad413f52d20963ef6b0fe982a0ca91086f2.tar.bz2
remoteproc: elf_loader: Introduce a common elf loader and checker functions
Introduce a common remoteproc elf loader and checker functions that automatically detects the 64 bit elf file or 32 bit elf file and loads/checks the sections accordingly. Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com> Reviewed-by: Fabien Dessenne <fabien.dessenne@st.com>
Diffstat (limited to 'include/remoteproc.h')
-rw-r--r--include/remoteproc.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/include/remoteproc.h b/include/remoteproc.h
index 56a11db..812e0f4 100644
--- a/include/remoteproc.h
+++ b/include/remoteproc.h
@@ -227,6 +227,19 @@ int rproc_elf32_sanity_check(ulong addr, ulong size);
int rproc_elf64_sanity_check(ulong addr, ulong size);
/**
+ * rproc_elf_sanity_check() - Verify if an image is a valid ELF one
+ *
+ * Check if a valid ELF image exists at the given memory location. Auto
+ * detects ELF32/ELF64 and verifies basic ELF64/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_elf_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
@@ -243,6 +256,17 @@ int rproc_elf32_load_image(struct udevice *dev, unsigned long addr, ulong size);
* @return 0 if the image is successfully loaded, else appropriate error value.
*/
int rproc_elf64_load_image(struct udevice *dev, ulong addr, ulong size);
+
+/**
+ * rproc_elf_load_image() - load an ELF image
+ * @dev: device loading the ELF image
+ * @addr: valid ELF image address
+ * @size: size of the image
+ *
+ * Auto detects if the image is ELF32 or ELF64 image and load accordingly.
+ * @return 0 if the image is successfully loaded, else appropriate error value.
+ */
+int rproc_elf_load_image(struct udevice *dev, unsigned long addr, ulong size);
#else
static inline int rproc_init(void) { return -ENOSYS; }
static inline int rproc_dev_init(int id) { return -ENOSYS; }
@@ -257,12 +281,17 @@ static inline int rproc_elf32_sanity_check(ulong addr,
ulong size) { return -ENOSYS; }
static inline int rproc_elf64_sanity_check(ulong addr,
ulong size) { return -ENOSYS; }
+static inline int rproc_elf_sanity_check(ulong addr,
+ ulong size) { return -ENOSYS; }
static inline int rproc_elf32_load_image(struct udevice *dev,
unsigned long addr, ulong size)
{ return -ENOSYS; }
static inline int rproc_elf64_load_image(struct udevice *dev, ulong addr,
ulong size)
{ return -ENOSYS; }
+static inline int rproc_elf_load_image(struct udevice *dev, ulong addr,
+ ulong size)
+{ return -ENOSYS; }
#endif
#endif /* _RPROC_H_ */