public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ido Yariv <ido@wizery.com>
To: sjur.brandeland@stericsson.com
Cc: Ohad Ben-Cohen <ohad@wizery.com>,
	linux-kernel@vger.kernel.org,
	Dmitry Tarnyagin <dmitry.tarnyagin@stericsson.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Erwan Yvin <erwan.yvin@stericsson.com>,
	sjur@brendeland.net
Subject: Re: [PATCH 3/9] remoteproc: Parse ELF file to find resource table address
Date: Wed, 20 Feb 2013 12:44:46 +0200	[thread overview]
Message-ID: <20130220104446.GC16388@WorkStation.localnet> (raw)
In-Reply-To: <1360496352-29482-4-git-send-email-sjur.brandeland@stericsson.com>

Hi Sjur,

On Sun, Feb 10, 2013 at 12:39:06PM +0100, sjur.brandeland@stericsson.com wrote:
> From: Sjur Brændeland <sjur.brandeland@stericsson.com>
> 
> 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 |   17 ++++++++++++++++-
>  drivers/remoteproc/remoteproc_internal.h   |   13 +++++++++++++
>  2 files changed, 29 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/remoteproc/remoteproc_elf_loader.c b/drivers/remoteproc/remoteproc_elf_loader.c
> index a958950..3137fba 100644
> --- a/drivers/remoteproc/remoteproc_elf_loader.c
> +++ b/drivers/remoteproc/remoteproc_elf_loader.c
> @@ -312,9 +312,24 @@ 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,
> +				fw->size);
> +	if (!shdr)
> +		return NULL;
> +
> +	/* Find resource table in loaded segments */
> +	return rproc_da_to_va(rproc, shdr->sh_addr, shdr->sh_size);
> +}
> +
>  const struct rproc_fw_ops rproc_elf_fw_ops = {
>  	.load = rproc_elf_load_segments,
>  	.find_rsc_table = rproc_elf_find_rsc_table,
>  	.sanity_check = rproc_elf_sanity_check,
> -	.get_boot_addr = rproc_elf_get_boot_addr
> +	.get_boot_addr = rproc_elf_get_boot_addr,
> +	.get_rsctab_addr = rproc_elf_get_rsctab_addr

Since this new op returns a VA (unlike get_boot_addr), it would probably be
better to use an indicative name like get_rsctab_va.

>  };
> diff --git a/drivers/remoteproc/remoteproc_internal.h b/drivers/remoteproc/remoteproc_internal.h
> index 7bb6648..3a5cb7d 100644
> --- a/drivers/remoteproc/remoteproc_internal.h
> +++ b/drivers/remoteproc/remoteproc_internal.h
> @@ -32,6 +32,7 @@ struct rproc;
>   *			expects to find it
>   * @sanity_check:	sanity check the fw image
>   * @get_boot_addr:	get boot address to entry point specified in firmware
> + * @get_rsctab_addr:	get resouce table address as specified in firmware
>   */
>  struct rproc_fw_ops {
>  	struct resource_table *(*find_rsc_table) (struct rproc *rproc,
> @@ -40,6 +41,8 @@ struct rproc_fw_ops {
>  	int (*load)(struct rproc *rproc, const struct firmware *fw);
>  	int (*sanity_check)(struct rproc *rproc, const struct firmware *fw);
>  	u32 (*get_boot_addr)(struct rproc *rproc, const struct firmware *fw);
> +	struct resource_table *(*get_rsctab_addr)(struct rproc *rproc,
> +						const struct firmware *fw);
>  };
>  
>  /* from remoteproc_core.c */
> @@ -102,6 +105,16 @@ struct resource_table *rproc_find_rsc_table(struct rproc *rproc,
>  	return NULL;
>  }
>  
> +static inline
> +struct resource_table *rproc_get_rsctab_addr(struct rproc *rproc,
> +				const struct firmware *fw)
> +{
> +	if (rproc->fw_ops->get_rsctab_addr)
> +		return rproc->fw_ops->get_rsctab_addr(rproc, fw);
> +
> +	return NULL;
> +}
> +
>  extern const struct rproc_fw_ops rproc_elf_fw_ops;
>  
>  #endif /* REMOTEPROC_INTERNAL_H */
> -- 
> 1.7.5.4
> 

Thanks,
Ido.

  reply	other threads:[~2013-02-20 10:44 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-10 11:39 [PATCH 0/9] remoteproc: Support bi-directional vdev config space sjur.brandeland
2013-02-10 11:39 ` [PATCH 1/9] remoteproc: Bugfix: Deallocate firmware image on shutdown sjur.brandeland
2013-03-19 12:37   ` Ohad Ben-Cohen
2013-03-19 12:40     ` Sjur BRENDELAND
2013-03-19 13:15       ` Ohad Ben-Cohen
2013-02-10 11:39 ` [PATCH 2/9] remoteproc: Refactor function rproc_elf_find_rsc_table sjur.brandeland
2013-02-20 10:44   ` Ido Yariv
2013-02-10 11:39 ` [PATCH 3/9] remoteproc: Parse ELF file to find resource table address sjur.brandeland
2013-02-20 10:44   ` Ido Yariv [this message]
2013-02-10 11:39 ` [PATCH 4/9] remoteproc: Parse STE-firmware and " sjur.brandeland
2013-02-10 11:39 ` [PATCH 5/9] remoteproc: Set vring addresses in resource table sjur.brandeland
2013-02-10 11:39 ` [PATCH 6/9] remoteproc: Support virtio config space sjur.brandeland
2013-02-20 10:45   ` Ido Yariv
2013-02-10 11:39 ` [PATCH 7/9] remoteproc: Code cleanup of resource parsing sjur.brandeland
2013-02-10 11:39 ` [PATCH 8/9] remoteproc: Calculate max_notifyid by counting vrings sjur.brandeland
2013-02-20 10:45   ` Ido Yariv
2013-02-10 11:39 ` [PATCH 9/9] remoteproc: Always perserve resource table data sjur.brandeland
2013-02-20 10:46   ` Ido Yariv
2013-02-21 15:56     ` Sjur Brændeland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130220104446.GC16388@WorkStation.localnet \
    --to=ido@wizery.com \
    --cc=dmitry.tarnyagin@stericsson.com \
    --cc=erwan.yvin@stericsson.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ohad@wizery.com \
    --cc=sjur.brandeland@stericsson.com \
    --cc=sjur@brendeland.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox