From: Graeme Russ <graeme.russ@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC 00/14] x86 touch-ups (Includes new init sequence!)
Date: Mon, 26 Dec 2011 16:18:39 +1100 [thread overview]
Message-ID: <4EF803AF.2010304@gmail.com> (raw)
In-Reply-To: <1324643151-23642-1-git-send-email-graeme.russ@gmail.com>
On 23/12/11 23:25, Graeme Russ wrote:
[snip]
> So a quick overview of the new sequence and it's associated elegance (IMHO)
> (keep in mind this is x86 centric)
> - CPU boots and runs the reset vector code
> - early_board_init performs any insanely-low-level init that is needed
> - car_init sets up Cache-As-RAM (and clears it so gd is zero'd)
> - set up a stack in CAR
> - call board_init_f() passing the address of gd in CAR[1][2]
> - board_init_f() runs the 'init_sequence_f' functions which should
> initialise console and SDRAM
> - board_init_f() calls back into the assembler routine
> board_init_f_r_trampoline - This routine is very simple - It creates a
> new stack in SDRAM and calls back into board_init_f_r
> - board_init_f_r is running in Flash, but with SDRAM initialised. It
> runs an init loop which copies gd from CAR to SDRAM, initialises the
> CPU cache (which destroys all data in CAR, but that is all safely in
> RAM by now), copies U-Boot to RAM, clears BSS and jumps to the in-RAM
> version of board_init_r which finishes the initialisation and enters
> the main loop
>
> The memory layout for x86 is pretty simple right now - gd is at top-of-RAM
> and the stack sits just below it. U-Boot .text, .data, .bss etc are below
> the stack and the heap is below U-Boot. I understand that other arch's are
> more complex (LCD frame buffers in top-of-RAM for example) - I think this
> can all be dealt with elegantly with this code as well, but I have not
> attempted to do so
>
> [1] The board_init_f() has different meanings for different arch's already
> [2] This parameter is not used, but could be in future to remove the 'gd
> pointer in a fixed register' hack
This will not work as printf() and friends require a functional Global Data
pointer
Passing a Global Data pointer to board_init_f_r() like I do is also
problematic - I move Global Data to RAM and trash the in-cache copy, but
the gd still points to the (now trashed) cache copy until we jump to RAM
(quite frankly, I don't know how it worked in the first place...)
The only way this can work is if I either:
1) Reserve a register, or
2) Reserve a writeable location in some memory location which is available
prior to SDRAM init
x86 is the only arch that does not use a reserved register for the global
data pointer, but I have proved previously that x86 is capable of this
construct:
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/88462
So I'll adjust this patch set accordingly
Regards,
Graeme
next prev parent reply other threads:[~2011-12-26 5:18 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-23 12:25 [U-Boot] [RFC 00/14] x86 touch-ups (Includes new init sequence!) Graeme Russ
2011-12-23 12:25 ` [U-Boot] [RFC 01/14] x86: Import glibc memcpy implementation Graeme Russ
2011-12-23 12:25 ` [U-Boot] [RFC 02/14] x86: Speed up copy-to-RAM and clear BSS operations Graeme Russ
2011-12-23 12:25 ` [U-Boot] [RFC 03/14] x86: Allow cache before copy to RAM Graeme Russ
2011-12-23 12:25 ` [U-Boot] [RFC 04/14] x86: Import MSR/MTRR code from Linux Graeme Russ
2011-12-23 12:25 ` [U-Boot] [RFC 05/14] x86: Create weak init_cache() function Graeme Russ
2011-12-29 5:39 ` Simon Glass
2011-12-23 12:25 ` [U-Boot] [RFC 06/14] x86: cache tidy-ups Graeme Russ
2011-12-23 12:25 ` [U-Boot] [RFC 07/14] CHECKPATCH: arch/x86/cpu/* Graeme Russ
2011-12-23 12:25 ` [U-Boot] [RFC 08/14] CHECKPATCH: arch/x86/lib/* Graeme Russ
2011-12-23 12:25 ` [U-Boot] [RFC 09/14] x86: Move do_go_exec() out of board.c Graeme Russ
2011-12-23 12:25 ` [U-Boot] [RFC 10/14] x86: Move setup_pcat_compatibility() " Graeme Russ
2011-12-23 12:25 ` [U-Boot] [RFC 11/14] x86: remove gd->start_addr_sp Graeme Russ
2011-12-23 12:25 ` [U-Boot] [RFC 12/14] x86: Move relocation code out of board.c Graeme Russ
2011-12-23 12:25 ` [U-Boot] [RFC 13/14] x86: Simplify board.c Graeme Russ
2011-12-23 12:25 ` [U-Boot] [RFC 14/14] x86: Tweak initialisation procedure Graeme Russ
2011-12-26 5:18 ` Graeme Russ [this message]
2011-12-26 6:59 ` [U-Boot] [RFC 00/14] x86 touch-ups (Includes new init sequence!) 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=4EF803AF.2010304@gmail.com \
--to=graeme.russ@gmail.com \
--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