mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-04 20:19:47 +08:00
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>
This commit is contained in:
parent
bd48498487
commit
3e5f9eb5d9
@ -998,6 +998,24 @@ static int rproc_fw_sanity_check(struct rproc *rproc, const struct firmware *fw)
|
|||||||
return 0;
|
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.
|
* 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;
|
struct device *dev = &rproc->dev;
|
||||||
const char *name = rproc->firmware;
|
const char *name = rproc->firmware;
|
||||||
struct elf32_hdr *ehdr;
|
|
||||||
struct resource_table *table;
|
struct resource_table *table;
|
||||||
int ret, tablesz;
|
int ret, tablesz;
|
||||||
|
|
||||||
@ -1013,8 +1030,6 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw)
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ehdr = (struct elf32_hdr *)fw->data;
|
|
||||||
|
|
||||||
dev_info(dev, "Booting fw image %s, size %d\n", name, fw->size);
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
rproc->bootaddr = rproc_get_boot_addr(rproc, fw);
|
||||||
* 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;
|
|
||||||
|
|
||||||
/* look for the resource table */
|
/* look for the resource table */
|
||||||
table = rproc_find_rsc_table(rproc, fw, &tablesz);
|
table = rproc_find_rsc_table(rproc, fw, &tablesz);
|
||||||
|
Loading…
Reference in New Issue
Block a user