summaryrefslogtreecommitdiff
path: root/drivers/remoteproc/remoteproc_internal.h
diff options
context:
space:
mode:
authorClement Leger <cleger@kalray.eu>2020-03-02 10:39:00 +0100
committerBjorn Andersson <bjorn.andersson@linaro.org>2020-03-25 22:29:40 -0700
commitf31e339f1b9b765c8c727d635c1b74424c102c1e (patch)
tree3b2b3a819cd1adb9efc51b93119edcf19c948bac /drivers/remoteproc/remoteproc_internal.h
parent826c339099295312eb9bc207197f3beb6ff19051 (diff)
remoteproc: Add elf64 support in elf loader
In order to support elf64, use macros from remoteproc_elf_helpers.h to access elf headers depending on elf class. To allow new drivers to support elf64, add rproc_elf_sanity_check function which make more sense than adding a elf64 named one since it will support both elf versions. Driver which need to support both elf32/elf64 should use this new function for elf sanity check instead of the elf32 one. Signed-off-by: Clement Leger <cleger@kalray.eu> Tested-by: Arnaud POULIQUEN <arnaud.pouliquen@st.com> Link: https://lore.kernel.org/r/20200302093902.27849-7-cleger@kalray.eu Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Diffstat (limited to 'drivers/remoteproc/remoteproc_internal.h')
-rw-r--r--drivers/remoteproc/remoteproc_internal.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/remoteproc/remoteproc_internal.h b/drivers/remoteproc/remoteproc_internal.h
index 85903f5fea5b..b389dc79da81 100644
--- a/drivers/remoteproc/remoteproc_internal.h
+++ b/drivers/remoteproc/remoteproc_internal.h
@@ -55,6 +55,7 @@ phys_addr_t rproc_va_to_pa(void *cpu_addr);
int rproc_trigger_recovery(struct rproc *rproc);
int rproc_elf32_sanity_check(struct rproc *rproc, const struct firmware *fw);
+int rproc_elf_sanity_check(struct rproc *rproc, const struct firmware *fw);
u64 rproc_elf_get_boot_addr(struct rproc *rproc, const struct firmware *fw);
int rproc_elf_load_segments(struct rproc *rproc, const struct firmware *fw);
int rproc_elf_load_rsc_table(struct rproc *rproc, const struct firmware *fw);
@@ -119,4 +120,13 @@ struct resource_table *rproc_find_loaded_rsc_table(struct rproc *rproc,
return NULL;
}
+static inline
+bool rproc_u64_fit_in_size_t(u64 val)
+{
+ if (sizeof(size_t) == sizeof(u64))
+ return true;
+
+ return (val <= (size_t) -1);
+}
+
#endif /* REMOTEPROC_INTERNAL_H */