public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Albert ARIBAUD <albert.u.boot@aribaud.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 04/13] arm: Add start_call_board_init_r() to each start.S
Date: Tue, 21 Feb 2012 20:32:45 +0100	[thread overview]
Message-ID: <4F43F15D.40602@aribaud.net> (raw)
In-Reply-To: <1329787975-6695-5-git-send-email-sjg@chromium.org>

Hi Simon,

Le 21/02/2012 02:32, Simon Glass a ?crit :
> We don't want this in a common file, or at least not yet, so add
> this function to every start.S individually. The existing code tacked
> on the end of a long relocation function and does not suit our needs
> since it doesn't allow the address of board_init_r() to be passed in
> and cannot be called from C since it expects values in registers r4
> and above.

It is not really an addition, as every start.S file involved already has 
this sequence at the end of its relocate_code routine.

> Signed-off-by: Simon Glass<sjg@chromium.org>
> ---
> Changes in v4:
> - Put start_call_board_init_r() into each start.S, sadly
> - Split out start_call_board_init_r() addition into new patch
>
>   arch/arm/cpu/arm1136/start.S   |   19 +++++++++++++++++++
>   arch/arm/cpu/arm1176/start.S   |   19 +++++++++++++++++++
>   arch/arm/cpu/arm720t/start.S   |   19 +++++++++++++++++++
>   arch/arm/cpu/arm920t/start.S   |   19 +++++++++++++++++++
>   arch/arm/cpu/arm925t/start.S   |   19 +++++++++++++++++++
>   arch/arm/cpu/arm926ejs/start.S |   19 +++++++++++++++++++
>   arch/arm/cpu/arm946es/start.S  |   19 +++++++++++++++++++
>   arch/arm/cpu/arm_intcm/start.S |   19 +++++++++++++++++++
>   arch/arm/cpu/armv7/start.S     |   19 +++++++++++++++++++
>   arch/arm/cpu/ixp/start.S       |   19 +++++++++++++++++++
>   arch/arm/cpu/lh7a40x/start.S   |   19 +++++++++++++++++++
>   arch/arm/cpu/pxa/start.S       |   20 ++++++++++++++++++++
>   arch/arm/cpu/s3c44b0/start.S   |   19 +++++++++++++++++++
>   arch/arm/cpu/sa1100/start.S    |   19 +++++++++++++++++++
>   14 files changed, 267 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/cpu/arm1136/start.S b/arch/arm/cpu/arm1136/start.S
> index 28e059e..e74d5f9 100644
> --- a/arch/arm/cpu/arm1136/start.S
> +++ b/arch/arm/cpu/arm1136/start.S
> @@ -295,6 +295,25 @@ _board_init_r_ofs:
>   	.word board_init_r - _start
>   #endif
>
> +/**

Do we agree to Doxygen annotations in U-Boot?

> + * Jump to board_init_r with a new stack pointer
> + *
> + * @param gd	Pointer to global data
> + * @param dest_addr	Destination address from global data
> + * @param func	Address of board_init_r function (relocated)
> + * @param sp	New stack pointer
> + */
> +.globl start_call_board_init_r
> +start_call_board_init_r:

Why "start_call_board_init_r"? "start_" may mislead readers into 
thinking we're starting something there and finishing it elsewhere, and 
"call_board_init_r" doesn't tell we're switching stacks etc.

I suggest "pivot_to_board_init_r", in analogy with Linux 'pivot_root'. 
Other suggestions are welcome.

Better yet, we could avoid this new function altogether and make start.S 
much cleaner by rewriting the startup sequence as:

1. start.S sets up the initial stack
2. start.S calls C function board_init_f
3. board_init_f allocates initial GD and stores final stack, final GD,
    and final base address within initial GD, then returns normally
4. start.S sets up the final stack and final GD
4. start.S calls C function relocate_code using relevant GD fields
    as its arguments
5. relocate_code returns normally
6. start.S calls either nand_boot or board_init_r()

This way all the logic would be in start.S and board_init_f(), 
relocate_code() and board_init_r() would be simple and independent 
functions.

Amicalement,
-- 
Albert.

  reply	other threads:[~2012-02-21 19:32 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-21  1:32 [U-Boot] [PATCH v4 0/13] Introduce generic relocation feature Simon Glass
2012-02-21  1:32 ` [U-Boot] [PATCH v4 01/13] Define CONFIG_SYS_SKIP_RELOC for all archs Simon Glass
2012-03-06  5:04   ` Mike Frysinger
2012-03-06  6:27     ` Simon Glass
2012-02-21  1:32 ` [U-Boot] [PATCH v4 02/13] Add generic relocation feature Simon Glass
2012-02-21 19:36   ` Albert ARIBAUD
2012-02-21 20:03     ` Simon Glass
2012-02-21  1:32 ` [U-Boot] [PATCH v4 03/13] arm: Export and promote relocation symbols Simon Glass
2012-02-21  1:32 ` [U-Boot] [PATCH v4 04/13] arm: Add start_call_board_init_r() to each start.S Simon Glass
2012-02-21 19:32   ` Albert ARIBAUD [this message]
2012-02-21 20:02     ` Simon Glass
2012-02-23 13:07       ` Simon Glass
2012-02-21  1:32 ` [U-Boot] [PATCH v4 05/13] Move memcpy(), memset() into new lib/membasic.c Simon Glass
2012-03-06  5:05   ` Mike Frysinger
2012-03-06  6:34     ` Simon Glass
2012-03-06 16:20       ` Mike Frysinger
2012-03-07  5:43         ` Simon Glass
2012-03-07  5:50         ` Graeme Russ
2012-03-07 17:48           ` Simon Glass
2012-03-11  7:35           ` Mike Frysinger
2012-02-21  1:32 ` [U-Boot] [PATCH v4 06/13] arm: Add explicit __image_copy_end symbol for ARM926EJ-S Simon Glass
2012-02-21  1:32 ` [U-Boot] [PATCH v4 07/13] davinci: Use correct #ifdef around gdata/bdata Simon Glass
2012-02-21 15:24   ` Tom Rini
2012-02-23 17:25   ` Sughosh Ganu
2012-02-26 17:56     ` Simon Glass
2012-02-27 10:16       ` Sughosh Ganu
2012-02-27 10:39         ` Christian Riesch
2012-02-27 10:56           ` Sughosh Ganu
2012-02-27 11:37             ` Christian Riesch
2012-02-27 12:02               ` Sughosh Ganu
2012-02-28 21:55                 ` Albert ARIBAUD
2012-02-28 22:03                   ` Scott Wood
2012-03-03 20:22                 ` Simon Glass
2012-03-03 20:29                   ` Simon Glass
2012-02-21  1:32 ` [U-Boot] [PATCH v4 08/13] tx25: Modify to work with generic relocation Simon Glass
2012-02-21  1:32 ` [U-Boot] [PATCH v4 09/13] hawkboard: " Simon Glass
2012-02-21 15:25   ` Tom Rini
2012-02-23  8:43   ` Sughosh Ganu
2012-02-23 15:11     ` Sughosh Ganu
2012-02-26 18:09       ` Simon Glass
2012-02-21  1:32 ` [U-Boot] [PATCH v4 10/13] mx31pdk: " Simon Glass
2012-02-21  1:32 ` [U-Boot] [PATCH v4 11/13] smdk6400: " Simon Glass
2012-02-21  1:32 ` [U-Boot] [PATCH v4 12/13] arm: Move over to " Simon Glass
2012-02-21  1:32 ` [U-Boot] [PATCH v4 13/13] arm: Remove unused code in start.S Simon Glass
2012-02-21 19:40 ` [U-Boot] [PATCH v4 0/13] Introduce generic relocation feature Albert ARIBAUD
2012-02-21 20:07   ` Simon Glass
2012-02-21 20:10     ` Graeme Russ
2012-02-21 20:16       ` Simon Glass
     [not found]         ` <4F4D4511.6020708@aribaud.net>
2012-03-03 16:01           ` Simon Glass

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=4F43F15D.40602@aribaud.net \
    --to=albert.u.boot@aribaud.net \
    --cc=u-boot@lists.denx.de \
    /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