diff options
Diffstat (limited to 'drivers/remoteproc/remoteproc_internal.h')
-rw-r--r-- | drivers/remoteproc/remoteproc_internal.h | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/drivers/remoteproc/remoteproc_internal.h b/drivers/remoteproc/remoteproc_internal.h index 9f336d6bdef3..a690ebe7aa51 100644 --- a/drivers/remoteproc/remoteproc_internal.h +++ b/drivers/remoteproc/remoteproc_internal.h @@ -21,9 +21,27 @@ #define REMOTEPROC_INTERNAL_H #include <linux/irqreturn.h> +#include <linux/firmware.h> struct rproc; +/** + * struct rproc_fw_ops - firmware format specific operations. + * @find_rsc_table: finds the resource table inside the firmware image + * @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); + 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); @@ -41,4 +59,48 @@ void rproc_create_debug_dir(struct rproc *rproc); void rproc_init_debugfs(void); void rproc_exit_debugfs(void); +void rproc_free_vring(struct rproc_vring *rvring); +int rproc_alloc_vring(struct rproc_vdev *rvdev, int i); + +void *rproc_da_to_va(struct rproc *rproc, u64 da, int len); + +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); + + return 0; +} + +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); + + return 0; +} + +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); + + return -EINVAL; +} + +static inline +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); + + return NULL; +} + +extern const struct rproc_fw_ops rproc_elf_fw_ops; + #endif /* REMOTEPROC_INTERNAL_H */ |