Re: [RFCv2 09/11] remoteproc: Add operation to find resource table in memory

Ido Yariv
2012-12-21T02:27:33Z

Hi Sjur,

On Fri, Dec 14, 2012 at 05:06:58PM +0100, Sjur Brændeland wrote:
> Add function find_rsc_table_va 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>
> ---
> drivers/remoteproc/remoteproc_elf_loader.c | 16 ++++++++++-
> drivers/remoteproc/remoteproc_internal.h | 13 ++++++++
> drivers/remoteproc/ste_modem_rproc.c | 43 +++++++++++++++++++---------
> 3 files changed, 57 insertions(+), 15 deletions(-)

Perhaps split this patch into two - one that adds the new firmware op
and another that modifies the ste driver?

>
> diff --git a/drivers/remoteproc/remoteproc_elf_loader.c b/drivers/remoteproc/remoteproc_elf_loader.c
> index 69832d9..3f6e315 100644
> --- a/drivers/remoteproc/remoteproc_elf_loader.c
> +++ b/drivers/remoteproc/remoteproc_elf_loader.c
> @@ -306,9 +306,23 @@ rproc_elf_find_rsc_table(struct rproc *rproc, const struct firmware *fw,
> 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);
> + if (!shdr)
> + return NULL;

Instead of traversing the headers twice, perhaps we could save the
address and size in advance and use it here?

Thanks,
Ido.