summaryrefslogtreecommitdiff
path: root/drivers/remoteproc
diff options
context:
space:
mode:
authorSjur Brændeland <sjur.brandeland@stericsson.com>2012-06-19 10:56:44 +0400
committerOhad Ben-Cohen <ohad@wizery.com>2012-07-15 12:14:45 +0400
commit3e5f9eb5d91e430ca908a61615f9a89c189a0d4e (patch)
treedf36c0a8c3193ddf7c7ea1f10025a93ace8a4f8e /drivers/remoteproc
parentbd48498487735a01abc68edb76e3d86393e096e1 (diff)
downloadlinux-3e5f9eb5d91e430ca908a61615f9a89c189a0d4e.tar.xz
remoteproc: Add function rproc_get_boot_addr
Prepare for introduction of custom firmware loaders by moving the function operating on ELF data-structures into separate functions. Move lookup of the boot_addr in the ELF binary to the function rproc_get_boot_addr(). Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com> [rproc_get_boot_addr's kerneldoc: add missing @rproc line] [rproc_get_boot_addr's kerneldoc: minor style changes] Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Diffstat (limited to 'drivers/remoteproc')
-rw-r--r--drivers/remoteproc/remoteproc_core.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index e75424b6314c..3173e213940b 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -998,6 +998,24 @@ static int rproc_fw_sanity_check(struct rproc *rproc, const struct firmware *fw)
return 0;
}
+/**
+ * rproc_get_boot_addr() - Get rproc's boot address.
+ * @rproc: the remote processor handle
+ * @fw: the ELF firmware image
+ *
+ * This function returns the entry point address of the ELF
+ * image.
+ *
+ * Note that the boot address is not a configurable property of all remote
+ * processors. Some will always boot at a specific hard-coded address.
+ */
+u32 rproc_get_boot_addr(struct rproc *rproc, const struct firmware *fw)
+{
+ struct elf32_hdr *ehdr = (struct elf32_hdr *)fw->data;
+
+ return ehdr->e_entry;
+}
+
/*
* take a firmware and boot a remote processor with it.
*/
@@ -1005,7 +1023,6 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw)
{
struct device *dev = &rproc->dev;
const char *name = rproc->firmware;
- struct elf32_hdr *ehdr;
struct resource_table *table;
int ret, tablesz;
@@ -1013,8 +1030,6 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw)
if (ret)
return ret;
- ehdr = (struct elf32_hdr *)fw->data;
-
dev_info(dev, "Booting fw image %s, size %d\n", name, fw->size);
/*
@@ -1027,12 +1042,7 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw)
return ret;
}
- /*
- * The ELF entry point is the rproc's boot addr (though this is not
- * a configurable property of all remote processors: some will always
- * boot at a specific hardcoded address).
- */
- rproc->bootaddr = ehdr->e_entry;
+ rproc->bootaddr = rproc_get_boot_addr(rproc, fw);
/* look for the resource table */
table = rproc_find_rsc_table(rproc, fw, &tablesz);