return table;
}
+struct resource_table *rproc_elf_get_rsctab_addr(struct rproc *rproc,
+ const struct firmware *fw)
+{
+ struct elf32_shdr *shdr;
+
+ shdr = find_rsc_shdr(&rproc->dev, (struct elf32_hdr *)fw->data,
+ fw->size);
+ if (!shdr)
+ return NULL;
+
+ /* Find resource table in loaded segments */
+ return rproc_da_to_va(rproc, shdr->sh_addr, shdr->sh_size);
+}
+
const struct rproc_fw_ops rproc_elf_fw_ops = {
.load = rproc_elf_load_segments,
.find_rsc_table = rproc_elf_find_rsc_table,
.sanity_check = rproc_elf_sanity_check,
- .get_boot_addr = rproc_elf_get_boot_addr
+ .get_boot_addr = rproc_elf_get_boot_addr,
+ .get_rsctab_addr = rproc_elf_get_rsctab_addr
};
* expects to find it
* @sanity_check: sanity check the fw image
* @get_boot_addr: get boot address to entry point specified in firmware
+ * @get_rsctab_addr: get resouce table address as specified in firmware
*/
struct rproc_fw_ops {
struct resource_table *(*find_rsc_table) (struct rproc *rproc,
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);
+ struct resource_table *(*get_rsctab_addr)(struct rproc *rproc,
+ const struct firmware *fw);
};
/* from remoteproc_core.c */
return NULL;
}
+static inline
+struct resource_table *rproc_get_rsctab_addr(struct rproc *rproc,
+ const struct firmware *fw)
+{
+ if (rproc->fw_ops->get_rsctab_addr)
+ return rproc->fw_ops->get_rsctab_addr(rproc, fw);
+
+ return NULL;
+}
+
extern const struct rproc_fw_ops rproc_elf_fw_ops;
#endif /* REMOTEPROC_INTERNAL_H */