summaryrefslogtreecommitdiffstats
path: root/drivers/remoteproc/remoteproc_internal.h
diff options
context:
space:
mode:
authorBjorn Andersson <bjorn.andersson@linaro.org>2018-01-06 00:58:01 +0100
committerBjorn Andersson <bjorn.andersson@linaro.org>2018-01-15 18:29:40 +0100
commit0f21f9cc9d868784c7564edc0cfeddd25ca9621a (patch)
tree4529534ba2c028abd340bf7f47ba9646eb838091 /drivers/remoteproc/remoteproc_internal.h
parentremoteproc: Clone rproc_ops in rproc_alloc() (diff)
downloadlinux-0f21f9cc9d868784c7564edc0cfeddd25ca9621a.tar.xz
linux-0f21f9cc9d868784c7564edc0cfeddd25ca9621a.zip
remoteproc: Merge rproc_ops and rproc_fw_ops
There are currently a few different schemes used for overriding fw_ops or parts of fw_ops. Merge fw_ops into rproc_ops and expose the default ELF-loader symbols so that they can be assigned by the drivers. To keep backwards compatibility with the "default" case, a driver not specifying the "load" operation is assumed to want the full ELF-loader suit of functions. Reviewed-By: Loic Pallardy <loic.pallardy@st.com> Tested-By: Loic Pallardy <loic.pallardy@st.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Diffstat (limited to 'drivers/remoteproc/remoteproc_internal.h')
-rw-r--r--drivers/remoteproc/remoteproc_internal.h51
1 files changed, 19 insertions, 32 deletions
diff --git a/drivers/remoteproc/remoteproc_internal.h b/drivers/remoteproc/remoteproc_internal.h
index c1077bec5d0b..a42690c514e2 100644
--- a/drivers/remoteproc/remoteproc_internal.h
+++ b/drivers/remoteproc/remoteproc_internal.h
@@ -25,26 +25,6 @@
struct rproc;
-/**
- * struct rproc_fw_ops - firmware format specific operations.
- * @find_rsc_table: find the resource table inside the firmware image
- * @find_loaded_rsc_table: find the loaded resouce table
- * @load: load firmeware to memory, where the remote processor
- * expects to find it
- * @sanity_check: sanity check the fw image
- * @get_boot_addr: get boot address to entry point specified in firmware
- */
-struct rproc_fw_ops {
- struct resource_table *(*find_rsc_table)(struct rproc *rproc,
- const struct firmware *fw,
- int *tablesz);
- struct resource_table *(*find_loaded_rsc_table)(
- struct rproc *rproc, const struct firmware *fw);
- int (*load)(struct rproc *rproc, const struct firmware *fw);
- int (*sanity_check)(struct rproc *rproc, const struct firmware *fw);
- u32 (*get_boot_addr)(struct rproc *rproc, const struct firmware *fw);
-};
-
/* from remoteproc_core.c */
void rproc_release(struct kref *kref);
irqreturn_t rproc_vq_interrupt(struct rproc *rproc, int vq_id);
@@ -74,11 +54,20 @@ int rproc_alloc_vring(struct rproc_vdev *rvdev, int i);
void *rproc_da_to_va(struct rproc *rproc, u64 da, int len);
int rproc_trigger_recovery(struct rproc *rproc);
+int rproc_elf_sanity_check(struct rproc *rproc, const struct firmware *fw);
+u32 rproc_elf_get_boot_addr(struct rproc *rproc, const struct firmware *fw);
+int rproc_elf_load_segments(struct rproc *rproc, const struct firmware *fw);
+struct resource_table *rproc_elf_find_rsc_table(struct rproc *rproc,
+ const struct firmware *fw,
+ int *tablesz);
+struct resource_table *rproc_elf_find_loaded_rsc_table(struct rproc *rproc,
+ const struct firmware *fw);
+
static inline
int rproc_fw_sanity_check(struct rproc *rproc, const struct firmware *fw)
{
- if (rproc->fw_ops->sanity_check)
- return rproc->fw_ops->sanity_check(rproc, fw);
+ if (rproc->ops->sanity_check)
+ return rproc->ops->sanity_check(rproc, fw);
return 0;
}
@@ -86,8 +75,8 @@ int rproc_fw_sanity_check(struct rproc *rproc, const struct firmware *fw)
static inline
u32 rproc_get_boot_addr(struct rproc *rproc, const struct firmware *fw)
{
- if (rproc->fw_ops->get_boot_addr)
- return rproc->fw_ops->get_boot_addr(rproc, fw);
+ if (rproc->ops->get_boot_addr)
+ return rproc->ops->get_boot_addr(rproc, fw);
return 0;
}
@@ -95,8 +84,8 @@ u32 rproc_get_boot_addr(struct rproc *rproc, const struct firmware *fw)
static inline
int rproc_load_segments(struct rproc *rproc, const struct firmware *fw)
{
- if (rproc->fw_ops->load)
- return rproc->fw_ops->load(rproc, fw);
+ if (rproc->ops->load)
+ return rproc->ops->load(rproc, fw);
return -EINVAL;
}
@@ -106,8 +95,8 @@ struct resource_table *rproc_find_rsc_table(struct rproc *rproc,
const struct firmware *fw,
int *tablesz)
{
- if (rproc->fw_ops->find_rsc_table)
- return rproc->fw_ops->find_rsc_table(rproc, fw, tablesz);
+ if (rproc->ops->find_rsc_table)
+ return rproc->ops->find_rsc_table(rproc, fw, tablesz);
return NULL;
}
@@ -116,12 +105,10 @@ static inline
struct resource_table *rproc_find_loaded_rsc_table(struct rproc *rproc,
const struct firmware *fw)
{
- if (rproc->fw_ops->find_loaded_rsc_table)
- return rproc->fw_ops->find_loaded_rsc_table(rproc, fw);
+ if (rproc->ops->find_loaded_rsc_table)
+ return rproc->ops->find_loaded_rsc_table(rproc, fw);
return NULL;
}
-extern const struct rproc_fw_ops rproc_elf_fw_ops;
-
#endif /* REMOTEPROC_INTERNAL_H */