[U-Boot] [RFC 00/14] x86 touch-ups (Includes new init sequence!)
Graeme Russ
graeme.russ at gmail.com
Fri Dec 23 13:25:37 CET 2011
Merry Christmas everyone
After some positive feedback on my new x86 init sequence, I've reworked
it onto the tail end of some patches that have been sitting around in my
staging branch for the last few weeks.
Patches 1-8 should not be that interesting to most of you (although patch
3 is a precursor for what happens from patches 9 onward)
A note of warning, patches 1-8 have been run-tested on a new board I've
been working on - I have not tested them for regression on the sc520 eNET
board or coreboot yet
Patches 9-14 have been compile tested but not run (and these have not been
run through checkpatch yet - sorry, but it's late and this is the last
chance for me to get anything out before the new year)
This series is against u-boot-x86/next and _should_ apply to u-boot/next
Patches 9-14 transition x86 away from the very ad-hoc init sequence into
a clearly defined series of init loops - It should be capable of being
the back-bone of a new unified init sequence. From there, we should be
able to tackle the 'ifdef hell' (misc_init_r? what-the!)
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
Graeme Russ (14):
x86: Import glibc memcpy implementation
x86: Speed up copy-to-RAM and clear BSS operations
x86: Allow cache before copy to RAM
x86: Import MSR/MTRR code from Linux
x86: Create weak init_cache() function
x86: cache tidy-ups
CHECKPATCH: arch/x86/cpu/*
CHECKPATCH: arch/x86/lib/*
x86: Move do_go_exec() out of board.c
x86: Move setup_pcat_compatibility() out of board.c
x86: remove gd->start_addr_sp
x86: Move relocation code out of board.c
x86: Simplify board.c
x86: Tweak initialisation procedure
arch/x86/cpu/cpu.c | 28 ++-
arch/x86/cpu/interrupts.c | 2 +-
arch/x86/cpu/start.S | 52 ++--
arch/x86/cpu/start16.S | 54 +++-
arch/x86/include/asm/global_data.h | 1 -
arch/x86/include/asm/init_helpers.h | 42 +++
arch/x86/include/asm/init_wrappers.h | 42 +++
arch/x86/include/asm/msr-index.h | 447 +++++++++++++++++++++++++++++++
arch/x86/include/asm/msr.h | 216 +++++++++++++++
arch/x86/include/asm/mtrr.h | 203 ++++++++++++++
arch/x86/include/asm/string.h | 2 +-
arch/x86/include/asm/u-boot-x86.h | 3 +-
arch/x86/lib/Makefile | 4 +
arch/x86/lib/bios.S | 134 ++++++----
arch/x86/lib/board.c | 483 ++++++++++------------------------
arch/x86/lib/cmd_boot.c | 64 +++++
arch/x86/lib/init_helpers.c | 154 +++++++++++
arch/x86/lib/init_wrappers.c | 137 ++++++++++
arch/x86/lib/realmode_switch.S | 61 +++--
arch/x86/lib/relocate.c | 117 ++++++++
arch/x86/lib/string.c | 61 +++++
arch/x86/lib/zimage.c | 7 +
include/common.h | 11 +-
23 files changed, 1854 insertions(+), 471 deletions(-)
create mode 100644 arch/x86/include/asm/init_helpers.h
create mode 100644 arch/x86/include/asm/init_wrappers.h
create mode 100644 arch/x86/include/asm/msr-index.h
create mode 100644 arch/x86/include/asm/msr.h
create mode 100644 arch/x86/include/asm/mtrr.h
create mode 100644 arch/x86/lib/cmd_boot.c
create mode 100644 arch/x86/lib/init_helpers.c
create mode 100644 arch/x86/lib/init_wrappers.c
create mode 100644 arch/x86/lib/relocate.c
--
1.7.5.2.317.g391b14
More information about the U-Boot
mailing list