aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/remoteproc/remoteproc_elf_loader.c
diff options
context:
space:
mode:
authorSjur Brændeland <sjur.brandeland@stericsson.com>2013-02-21 12:15:34 -0500
committerOhad Ben-Cohen <ohad@wizery.com>2013-04-05 01:49:52 -0400
commit95f9578163bc25bcbf391420373cf797d5321830 (patch)
tree92dab559c6244e5d39354598eb65911b014c5ebe /drivers/remoteproc/remoteproc_elf_loader.c
parentf665b2cd3f569a353c0a62b03a95827dd8743e9b (diff)
remoteproc: add find_loaded_rsc_table firmware ops
Add function find_loaded_rsc_table to firmware ops. This function returns the location of the resource table in shared memory after loading. Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com> Acked-by: Ido Yariv <ido@wizery.com> [align function name with existing terminology, update commit log] [document new function, rebase patch, small cleanups] Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Diffstat (limited to 'drivers/remoteproc/remoteproc_elf_loader.c')
-rw-r--r--drivers/remoteproc/remoteproc_elf_loader.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/remoteproc/remoteproc_elf_loader.c b/drivers/remoteproc/remoteproc_elf_loader.c
index 774e5f768bf3..ce283a5b42a1 100644
--- a/drivers/remoteproc/remoteproc_elf_loader.c
+++ b/drivers/remoteproc/remoteproc_elf_loader.c
@@ -304,9 +304,34 @@ rproc_elf_find_rsc_table(struct rproc *rproc, const struct firmware *fw,
304 return table; 304 return table;
305} 305}
306 306
307/**
308 * rproc_elf_find_loaded_rsc_table() - find the loaded resource table
309 * @rproc: the rproc handle
310 * @fw: the ELF firmware image
311 *
312 * This function finds the location of the loaded resource table. Don't
313 * call this function if the table wasn't loaded yet - it's a bug if you do.
314 *
315 * Returns the pointer to the resource table if it is found or NULL otherwise.
316 * If the table wasn't loaded yet the result is unspecified.
317 */
318static struct resource_table *
319rproc_elf_find_loaded_rsc_table(struct rproc *rproc, const struct firmware *fw)
320{
321 struct elf32_hdr *ehdr = (struct elf32_hdr *)fw->data;
322 struct elf32_shdr *shdr;
323
324 shdr = find_table(&rproc->dev, ehdr, fw->size);
325 if (!shdr)
326 return NULL;
327
328 return rproc_da_to_va(rproc, shdr->sh_addr, shdr->sh_size);
329}
330
307const struct rproc_fw_ops rproc_elf_fw_ops = { 331const struct rproc_fw_ops rproc_elf_fw_ops = {
308 .load = rproc_elf_load_segments, 332 .load = rproc_elf_load_segments,
309 .find_rsc_table = rproc_elf_find_rsc_table, 333 .find_rsc_table = rproc_elf_find_rsc_table,
334 .find_loaded_rsc_table = rproc_elf_find_loaded_rsc_table,
310 .sanity_check = rproc_elf_sanity_check, 335 .sanity_check = rproc_elf_sanity_check,
311 .get_boot_addr = rproc_elf_get_boot_addr 336 .get_boot_addr = rproc_elf_get_boot_addr
312}; 337};