Commit Graph

66 Commits

Author SHA1 Message Date
Simon Glass 55f97c1bfb x86: Change global data baudrate to int
This doesn't need to be a long, so change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@ti.com>
2012-10-19 15:25:46 -07:00
Marek Vasut 036036d79c serial: Remove CONFIG_SERIAL_MULTI from remaining sources
Remove the parts depending either on disabled CONFIG_SERIAL_MULTI
or ifdefs around CONFIG_SERIAL_MULTI parts since CONFIG_SERIAL_MULTI
is now enabled by default.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
2012-10-15 11:53:59 -07:00
Mike Frysinger 47fde91f0c global_data: unify global flag defines
All the global flag defines are the same across all arches.  So unify them
in one place, and add a simple way for arches to extend for their needs.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-08-09 21:46:32 +02:00
Mike Frysinger de30122bb5 net: move bootfile init into eth_initialize
All arches init this the same way, so move the logic into the core
net code to avoid duplicating it everywhere else.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-15 17:32:33 -05:00
Mike Frysinger 50a47d0523 net: punt bd->bi_ip_addr
This field gets read in one place (by "bdinfo"), and we can replace
that with getenv("ipaddr").  After all, the bi_ip_addr field is kept
up-to-date implicitly with the value of the ipaddr env var.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2012-05-15 17:32:05 -05:00
Mike Frysinger ae806cc6ab sc520: fix build warning about unused temp var
Building the eNET_SRAM board fails for me:
	sc520_timer.c: In function 'sc520_udelay':
	sc520_timer.c:81:7: error: variable 'temp' set but not used
		[-Werror=unused-but-set-variable]
	cc1: all warnings being treated as errors
	make[1]: *** [sc520_timer.o] Error 1

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-03-06 21:05:18 +11:00
Graeme Russ a1d57b7aba x86: Convert board_init_f_r to a processing loop
Create an init function array for board_init_f_r - This finalises the
migration to a purely array based initialisation mechanism

Also tweak a few comments while we are at it so everything is 'correct'

--
Changes for v2:
 - Renamed to a more apt name
 - Fix bug in set_reloc_flag_r
 - Re-instate gd->flags = boot_flags; in board_init_f
 - Added commit message
2012-01-04 22:53:14 +11:00
Graeme Russ d47ab0ecde x86: Split init functions out of board.c
This patch moves towards reducing board.c to simply a set of init cores for
the three initialisation phases (Flash, Flash/RAM, and RAM), a set of three
init function arrays and a init function array processing function
2012-01-04 22:41:32 +11:00
Graeme Russ b156ff09aa x86: Move relocation code out of board.c 2012-01-04 22:39:06 +11:00
Graeme Russ 8e18e6e173 x86: Move setup_pcat_compatibility() out of board.c
This function simply does not belong in board.c

--
Changes for v2:
 - Added commit message
2012-01-04 22:37:20 +11:00
Graeme Russ d13640b7c4 x86: Move do_go_exec() out of board.c
--
Changes for v2:
 - None
2012-01-04 22:35:20 +11:00
Graeme Russ b843f31193 CHECKPATCH: arch/x86/lib/* 2012-01-04 22:33:59 +11:00
Graeme Russ 58c7a6751d x86: Tweak IDT and GDT for alignment and readability
--
Changes for v2:
 - Renamed to better reflect nature of changes
2012-01-04 22:29:40 +11:00
Graeme Russ 98f1fa9fd4 x86: Allow cache before copy to RAM
--
Changes for v2:
 - None
2012-01-04 22:25:53 +11:00
Graeme Russ d653244b12 x86: Create weak init_cache() and default enable_caches() functions
--
Changes for v2:
 - Tweaked commit title
2012-01-04 22:19:01 +11:00
Graeme Russ 3766bb33a5 x86: Set GD_FLG_RELOC after entering in-RAM copy of U-Boot
--
Changes for v2:
 - None
2012-01-04 22:18:36 +11:00
Graeme Russ 9e6c572ff0 x86: Use fs for global data
Use the base address of the 'F' segment as a pointer to the global data
structure. By adding the linear address (i.e. the 'D' segment address) as
the first word of the global data structure, the address of the global data
relative to the 'D' segment can be found simply, for example, by:

	fs movl 0, %eax

This makes the gd 'pointer' writable prior to relocation (by reloading the
Global Desctriptor Table) which brings x86 into line with all other arches

NOTE: Writing to the gd 'pointer' is expensive (but we only do it
twice) but using it to access global data members (read and write) is
still fairly cheap

--
Changes for v2:
 - Rebased against changes made to patch #3
 - Removed extra indent
 - Tweaked commit message
2012-01-04 22:17:24 +11:00
Graeme Russ 240ab5aa21 x86: Rework relocation calculations
This commit introduces no functional changes - It simply re-arranges the
calculations so that adding to them in future commits will be cleaner

--
Changes for v2:
 - Fixed typo in title
 - Added commit message
2012-01-04 22:17:22 +11:00
Graeme Russ f48dd6fc6c x86: Simplify Flash-to-RAM code execution transition
Move the relocation offset calculation out of assembler and into C. This
also paves the way for the upcoming init sequence simplification by adding
the board_init_f_r flash to RAM transitional function

--
Changes for v2:
 - Added commit message
 - Minor adjustment to new stack address comment
2012-01-04 22:17:20 +11:00
Graeme Russ 74bfbe1ba5 x86: Rework Global Descriptor Table loading
The inline assembler is ugly and uses hard coded magic numbers. Make it more
elegant to allow cleaner implementation of future GDT related patches. The
compiler seems smart enough to generate the same code anyway

--
Changes for v2:
 - Rebased against revised patch #3
 - Use GDT size define instead of magic number
 - Added commit message
2012-01-04 22:17:19 +11:00
Graeme Russ 109ad143f8 x86: Remove GDR related magic numbers
--
Changes for v2:
 - Use an enum
 - Add defined for GDT size (previously added in patch 7)
 - Use X86_ namespace (as per Linux headers)
2012-01-04 21:05:09 +11:00
Graeme Russ 1176a7067a x86: Speed up copy-to-RAM and clear BSS operations
The implementations of memcpy and memset are now the optimised versions
from glibc, so use them instead of simple copy loops

--
Changes for v2:
 - Removed unneeded brackets
2012-01-04 21:05:00 +11:00
Graeme Russ b2c2a03842 x86: Import glibc memcpy implementation
Taken from glibc version 2.14.90

--
Changes for v2:
 - None
2012-01-02 03:58:46 +11:00
Gabe Black 6f9d9986d5 x86: Add support for specifying an initrd with the zboot command
This change finishes plumbing the initrd support built into the zboot
mechanism out to the command interface.

It also fixes a bug in the command declaration where the kernel size could
be passed as an optional second parameter but not enough arguments were
allowed.

Signed-off-by: Gabe Black <gabeblack@chromium.org>
2011-12-19 13:26:17 +11:00
Gabe Black 69370d144a x86: Refactor the zboot innards so they can be reused with a vboot image
If vboot successfully verifies a kernel, it will leave it in place and
basically ready to boot. The zeropage table which is part of the x86 boot
protocol is at the end of the kernel, though, instead of the beginning, and
because the image is already in place there's no need to copy it around.
This change refactors the code which implements the zboot command so that
the configuration of the zeropage table and loading the pieces of the
kernel into memory are done separately. Also, because the command line goes
before the zeropage table in vboot which is somewhat incompatible with the
normal protocol, where to put the command line is a now a parameter instead
of being hard coded.

Signed-off-by: Gabe Black <gabeblack@chromium.org>
2011-12-19 13:26:16 +11:00
Gabe Black f08fa7a201 x86: Add infrastructure to extract an e820 table from the coreboot tables
Also approximate the size of RAM using the largest RAM address available
in the tables. There may be areas which are marked as reserved which are
actually at the end of RAM.

Signed-off-by: Gabe Black <gabeblack@chromium.org>
2011-12-19 13:26:16 +11:00
Gabe Black 233dbc1194 x86: Add support for booting Linux using the 32 bit boot protocol
This change conditionally modifies the zboot command so that it can use the
32 bit boot protocol. This is necessary because the 16 bit realmode entry
point assumes that it can call BIOS services which neither coreboot nor
u-boot provide.

Signed-off-by: Gabe Black <gabeblack@chromium.org>
2011-12-19 13:26:16 +11:00
Gabe Black d3a2bc3fd1 x86: Clean up the x86 zimage code in preparation to extend it
This change cleans up some formatting issues in the zimage handling code, and
converts it from using offsets added to a base pointer to using the available
structure definitions which were already being included.

Signed-off-by: Gabe Black <gabeblack@chromium.org>
2011-12-19 13:26:16 +11:00
Gabe Black 63f559cd12 x86: Import code from coreboot's libpayload to parse the coreboot table
This change also forces the lib_sysinfo structure to be in the .data
section. Otherwise it ends up in the .bss section. U-boot assumes that it
doesn't need to copy it over during relocation, and instead fills that
whole section with zeroes. If we really were booting from ROM that would be
appropriate, but we need some information from the coreboot tables (memory
size) before then and have to fill that structure before relocation. We
skirt u-boot's assumption by putting this in .data where it assumes there
is still read only but non-zero data.

Signed-off-by: Gabe Black <gabeblack@chromium.org>
2011-12-19 13:26:15 +11:00
Gabe Black ef5a5b0049 x86: Initial commit for running as a coreboot payload
Add a target for running u-boot as a coreboot payload in boards.cfg, a
board, CPU and a config. This is a skeleton implementation which always
reports the size of memory as 64 MB.

Signed-off-by: Gabe Black <gabeblack@chromium.org>
2011-12-19 13:26:15 +11:00
Gabe Black 36b2409a3d x86: Wrap small helper functions from libgcc to avoid an ABI mismatch
When gcc compiles some 64 bit operations on a 32 bit machine, it generates
calls to small functions instead of instructions which do the job directly.
Those functions are defined in libgcc and transparently provide whatever
functionality was necessary. Unfortunately, u-boot can be built with a
non-standard ABI when libgcc isn't. More specifically, u-boot uses
-mregparm. When the u-boot and libgcc are linked together, very confusing
bugs can crop up, for instance seemingly normal integer division or modulus
getting the wrong answer or even raising a spurious divide by zero
exception.

This change borrows (steals) a technique and some code from coreboot which
solves this problem by creating wrappers which translate the calling
convention when calling the functions in libgcc. Unfortunately that means
that these instructions which had already been turned into functions have
even more overhead, but more importantly it makes them work properly.

To find all of the functions that needed wrapping, u-boot was compiled
without linking in libgcc. All the symbols the linker complained were
undefined were presumed to be the symbols that are needed from libgcc.
These were a subset of the symbols covered by the coreboot code, so it was
used unmodified.

To prevent symbols which are provided by libgcc but not currently wrapped
(or even known about) from being silently linked against by code generated
by libgcc, a new copy of libgcc is created where all the symbols are
prefixed with __normal_. Without being purposefully wrapped, these symbols
will cause linker errors instead of silently introducing very subtle,
confusing bugs.

Another approach would be to whitelist symbols from libgcc and strip out
all the others. The problem with this approach is that it requires the
white listed symbols to be specified three times, once for objcopy, once so
the linker inserts the wrapped, and once to generate the wrapper itself,
while this implementation needs it to be listed only twice. There isn't
much tangible difference in what each approach produces, so this one was
preferred.

Signed-off-by: Gabe Black <gabeblack@chromium.org>
2011-11-29 21:31:24 +11:00
Gabe Black dbaef6ef33 x86: Import the glibc memset implementation
The new implementation is about twice as fast as the old. This is from
glibc-2.14, sysdeps/i386/memset.c.

Signed-off-by: Gabe Black <gabeblack@chromium.org>
2011-11-29 21:31:17 +11:00
Gabe Black 60a9b6bfdd x86: Fix a few recently added bugs
Signed-off-by: Gabe Black <gabeblack@chromium.org>
Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
2011-11-29 21:30:51 +11:00
Gabe Black 769db03a4a x86: Don't relocate symbols which point to things that aren't relocated
This change adds an upper bound for symbols which are fixed up after u-boot
is relocated into RAM. This way portions that are left at their original
location can be referred to without having to manually fix up any pointers.

Signed-off-by: Gabe Black <gabeblack@chromium.org>
2011-11-29 21:30:44 +11:00
Gabe Black 03228b26d5 x86: Fix how the location of the realmode and bios blobs are calculated
There are two blobs embedded into the u-boot image which are linked to run
at an address which is different from where they actually end up in the
ROM, one called "realmode" and one called "bios". There are realmode_setup
and bios_setup functions which prepare those blobs by copying them into the
location they're supposed to run from, among other things.

During u-boot relocation from ROM to RAM, the text and a few data segments
are copied over. The realmode and bios sections are not copied, and so the
only place they can be read from is their original location in the ROM.
Looking specifically at the bios blob, there are symbols defined in the
linker script called __bios_start and __bios_size which are defined to be
the start and size of the blob in the ROM.

In the bios_setup function, there seem to be two mistakes happening. First,
the offset from ROM to RAM is being added to __bios_start which implies that
this code expects to use the copy moved to RAM. No such copy is made, so
that's wrong. More subtly, when u-boot relocates itself, it goes through
all of the relocations stored in .rel.dyn and fixes them up. This has the
effect of transforming the __bios_start reference in bios_setup so that it
refers to the version in RAM (if one existed) instead of the one in ROM. To
correct for that, the offset actually needs to be subtracted out again to
translate the address back into the ROM.

The net effect is that for both blobs, a + needs to be changed to a -.

Signed-off-by: Gabe Black <gabeblack@chromium.org>
2011-11-29 21:30:38 +11:00
Graeme Russ 2f0e0cd246 x86: Misc cleanups
Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
2011-11-29 21:10:12 +11:00
Graeme Russ 1cfcf03701 x86: Misc PCI touchups
Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
2011-11-29 21:10:08 +11:00
Graeme Russ 303418cc97 x86: Ensure IDT and GDT remain 16-byte aligned post relocation
Some CPUs have strict alignment requirements for these tables

Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
2011-11-29 21:10:01 +11:00
Graeme Russ a76fc70ee1 x86: Provide more configuration granularity
Planned future ports requires more granularity for some options

Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
2011-11-29 21:09:52 +11:00
Graeme Russ a206cc2343 x86: Add multiboot header
By adding a multiboot header, U-Boot can be loaded by GRUB2. Using GRUB2 to
bootstrap U-Boot is useful for using an existing BIOS to get an initial
U-Boot port up and running before implementing the low-level reset vector
code, SDRAM init, etc. and overwriting the BIOS

Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
2011-11-29 21:08:02 +11:00
Graeme Russ 311b1a2b38 sc520: Create arch asm-offsets
Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
2011-11-29 21:07:42 +11:00
Graeme Russ facc9e7bf4 x86: Punt cold- and warm-boot flags
Nobody uses them anyway

Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
2011-11-29 21:04:06 +11:00
Graeme Russ 83088afbba cosmetic: checkpatch cleanup of arch/x86/lib/*.c
Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
2011-11-29 21:03:43 +11:00
Graeme Russ 01a0f5a1eb cosmetic: checkpatch cleanup of arch/x86/cpu/sc520/*.c
Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
2011-11-29 21:01:26 +11:00
Graeme Russ 717979fdd7 cosmetic: checkpatch cleanup of arch/x86/cpu/*.c
Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
2011-11-29 21:01:21 +11:00
Graeme Russ 6d7404c4c1 x86: Call hang() on unrecoverable exception
Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
2011-11-29 21:01:13 +11:00
Wolfgang Denk cca4e4aec1 Reduce build times
U-Boot Makefiles contain a number of tests for compiler features etc.
which so far are executed again and again.  On some architectures
(especially ARM) this results in a large number of calls to gcc.

This patch makes sure to run such tests only once, thus largely
reducing the number of "execve" system calls.

Example: number of "execve" system calls for building the "P2020DS"
(Power Architecture) and "qong" (ARM) boards, measured as:
	-> strace -f -e trace=execve -o /tmp/foo ./MAKEALL <board>
	-> grep execve /tmp/foo | wc -l

	Before: After:	Reduction:
==================================
P2020DS 20555	15205	-26%
qong	31692	14490	-54%

As a result, built times are significantly reduced, typically by
30...50%.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Albert Aribaud <albert.aribaud@free.fr>
cc: Graeme Russ <graeme.russ@gmail.com>
cc: Mike Frysinger <vapier@gentoo.org>
Tested-by: Graeme Russ <graeme.russ@gmail.com>
Tested-by: Matthias Weisser <weisserm@arcor.de>
Tested-by: Sanjeev Premi <premi@ti.com>
Tested-by: Simon Glass <sjg@chromium.org>
Tested-by: Macpaul Lin <macpaul@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
2011-11-03 20:44:58 +01:00
Gabe Black 4c1c355a68 x86: Fix a compiler warning in arch/x86/lib/realmode.c
Ensure that the value being passed to a %d format specifier is of type
int.

Signed-off-by: Gabe Black <gabeblack@chromium.org>
2011-11-02 21:45:38 +11:00
Gabe Black fdb711528c x86: Remove the prototype for the unused function board_init
Signed-off-by: Gabe Black <gabeblack@chromium.org>
2011-11-02 21:08:16 +11:00
Graeme Russ 3c7db1beac x86: Rename include/asm/ic to include/asm/arch-sc520
Also include some trivial related cleanups
2011-11-02 20:49:17 +11:00