diff options
author | Sjur Brændeland <sjur.brandeland@stericsson.com> | 2012-06-19 02:56:44 -0400 |
---|---|---|
committer | Ohad Ben-Cohen <ohad@wizery.com> | 2012-07-15 04:14:45 -0400 |
commit | 3e5f9eb5d91e430ca908a61615f9a89c189a0d4e (patch) | |
tree | df36c0a8c3193ddf7c7ea1f10025a93ace8a4f8e /drivers/remoteproc | |
parent | bd48498487735a01abc68edb76e3d86393e096e1 (diff) |
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.c | 28 |
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) | |||
998 | return 0; | 998 | return 0; |
999 | } | 999 | } |
1000 | 1000 | ||
1001 | /** | ||
1002 | * rproc_get_boot_addr() - Get rproc's boot address. | ||
1003 | * @rproc: the remote processor handle | ||
1004 | * @fw: the ELF firmware image | ||
1005 | * | ||
1006 | * This function returns the entry point address of the ELF | ||
1007 | * image. | ||
1008 | * | ||
1009 | * Note that the boot address is not a configurable property of all remote | ||
1010 | * processors. Some will always boot at a specific hard-coded address. | ||
1011 | */ | ||
1012 | u32 rproc_get_boot_addr(struct rproc *rproc, const struct firmware *fw) | ||
1013 | { | ||
1014 | struct elf32_hdr *ehdr = (struct elf32_hdr *)fw->data; | ||
1015 | |||
1016 | return ehdr->e_entry; | ||
1017 | } | ||
1018 | |||
1001 | /* | 1019 | /* |
1002 | * take a firmware and boot a remote processor with it. | 1020 | * take a firmware and boot a remote processor with it. |
1003 | */ | 1021 | */ |
@@ -1005,7 +1023,6 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw) | |||
1005 | { | 1023 | { |
1006 | struct device *dev = &rproc->dev; | 1024 | struct device *dev = &rproc->dev; |
1007 | const char *name = rproc->firmware; | 1025 | const char *name = rproc->firmware; |
1008 | struct elf32_hdr *ehdr; | ||
1009 | struct resource_table *table; | 1026 | struct resource_table *table; |
1010 | int ret, tablesz; | 1027 | int ret, tablesz; |
1011 | 1028 | ||
@@ -1013,8 +1030,6 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw) | |||
1013 | if (ret) | 1030 | if (ret) |
1014 | return ret; | 1031 | return ret; |
1015 | 1032 | ||
1016 | ehdr = (struct elf32_hdr *)fw->data; | ||
1017 | |||
1018 | dev_info(dev, "Booting fw image %s, size %d\n", name, fw->size); | 1033 | dev_info(dev, "Booting fw image %s, size %d\n", name, fw->size); |
1019 | 1034 | ||
1020 | /* | 1035 | /* |
@@ -1027,12 +1042,7 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw) | |||
1027 | return ret; | 1042 | return ret; |
1028 | } | 1043 | } |
1029 | 1044 | ||
1030 | /* | 1045 | rproc->bootaddr = rproc_get_boot_addr(rproc, fw); |
1031 | * The ELF entry point is the rproc's boot addr (though this is not | ||
1032 | * a configurable property of all remote processors: some will always | ||
1033 | * boot at a specific hardcoded address). | ||
1034 | */ | ||
1035 | rproc->bootaddr = ehdr->e_entry; | ||
1036 | 1046 | ||
1037 | /* look for the resource table */ | 1047 | /* look for the resource table */ |
1038 | table = rproc_find_rsc_table(rproc, fw, &tablesz); | 1048 | table = rproc_find_rsc_table(rproc, fw, &tablesz); |