mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 06/11] ARM: i.MX: xload-esdhc: Allow patching first word of the image
Date: Mon, 2 Jul 2018 08:20:38 +0200	[thread overview]
Message-ID: <20180702062038.23se52uzy2ttrubm@pengutronix.de> (raw)
In-Reply-To: <20180630034900.3324-7-andrew.smirnov@gmail.com>

On Fri, Jun 29, 2018 at 08:48:55PM -0700, Andrey Smirnov wrote:
> Depending on how SD card/eMMC was programmed first byte of the image
> ther may or may not have appropriate branch instruction. Extend
> esdhc_start_image() to allow passing a custom callback that would
> patch the first instruction in memory to correctly redirect the CPU to
> the resto of the code.
> 
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
>  arch/arm/mach-imx/xload-esdhc.c | 18 +++++++++++++++---
>  1 file changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/mach-imx/xload-esdhc.c b/arch/arm/mach-imx/xload-esdhc.c
> index 98ebdfcf7..c017a8b10 100644
> --- a/arch/arm/mach-imx/xload-esdhc.c
> +++ b/arch/arm/mach-imx/xload-esdhc.c
> @@ -219,7 +219,8 @@ static int esdhc_read_blocks(struct esdhc *esdhc, void *dst, size_t len)
>  }
>  
>  static int
> -esdhc_start_image(struct esdhc *esdhc, ptrdiff_t address, u32 offset)
> +esdhc_start_image(struct esdhc *esdhc, ptrdiff_t address, u32 offset,
> +		  u32 (*opcode_b)(u32))
>  {
>  	void *buf = (void *)address;
>  	u32 *ivt = buf + offset + SZ_1K;
> @@ -254,6 +255,9 @@ esdhc_start_image(struct esdhc *esdhc, ptrdiff_t address, u32 offset)
>  
>  	bb = buf + ofs;
>  
> +	if (opcode_b)
> +		*(u32 *)buf = opcode_b(ofs);
> +

If I understand correctly this is to make sure that the bl31 binary
which jumps to MX8MQ_ATF_BL33_BASE_ADDR jumps over the imx header
to the barebox image, right?

Maybe we should memmove the barebox image to MX8MQ_ATF_BL33_BASE_ADDR
instead of inserting handweaved assembly into the binary.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2018-07-02  6:20 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-30  3:48 [PATCH 00/11] ARM: i.MX8MQ and EVK support, part II Andrey Smirnov
2018-06-30  3:48 ` [PATCH 01/11] ARM: nxp-imx8mq-evk: Update DDR initialization code Andrey Smirnov
2018-06-30  3:48 ` [PATCH 02/11] ARM: Add code to support SMCCC on AArch64 Andrey Smirnov
2018-07-02  6:26   ` Sascha Hauer
2018-07-03 17:44     ` Andrey Smirnov
2018-06-30  3:48 ` [PATCH 03/11] ARM: i.MX8MQ: Configure cntfrq only in EL3 Andrey Smirnov
2018-06-30  3:48 ` [PATCH 04/11] ARM: i.MX8MQ: Add a macro to load BL31 ATF blob Andrey Smirnov
2018-07-02  6:25   ` Sascha Hauer
2018-07-03 17:58     ` Andrey Smirnov
2018-07-19 23:01       ` Andrey Smirnov
2018-06-30  3:48 ` [PATCH 05/11] ARM: i.MX: xload-esdhc: Move image base to MX8MQ_ATF_BL33_BASE_ADDR Andrey Smirnov
2018-06-30  3:48 ` [PATCH 06/11] ARM: i.MX: xload-esdhc: Allow patching first word of the image Andrey Smirnov
2018-07-02  6:20   ` Sascha Hauer [this message]
2018-07-03 18:12     ` Andrey Smirnov
2018-06-30  3:48 ` [PATCH 07/11] ARM: i.MX: fimware: Add pre-built BL31 ATF blob Andrey Smirnov
2018-07-02  5:23   ` Sascha Hauer
2018-07-03 17:59     ` Andrey Smirnov
2018-06-30  3:48 ` [PATCH 08/11] ARM: nxp-imx8mq-evk: Add code to load ATF BL31 blob Andrey Smirnov
2018-06-30  3:48 ` [PATCH 09/11] ARM: i.MX8MQ: Query and display ATF fimware hash if availible Andrey Smirnov
2018-06-30  3:48 ` [PATCH 10/11] ARM: nxp-imx8mq-evk: Add bootflow comments Andrey Smirnov
2018-07-02  5:48   ` Sascha Hauer
2018-07-03 18:00     ` Andrey Smirnov
2018-06-30  3:49 ` [PATCH 11/11] firmware: Fix copy-paste comment mistake Andrey Smirnov

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=20180702062038.23se52uzy2ttrubm@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=andrew.smirnov@gmail.com \
    --cc=barebox@lists.infradead.org \
    /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