summaryrefslogtreecommitdiff
path: root/arch/x86
Commit message (Collapse)AuthorAgeLines
* x86: Wrap small helper functions from libgcc to avoid an ABI mismatchGabe Black2011-11-29-0/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* x86: Import the glibc memset implementationGabe Black2011-11-29-1/+89
| | | | | | | 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>
* x86: Fix a few recently added bugsGabe Black2011-11-29-1/+6
| | | | | Signed-off-by: Gabe Black <gabeblack@chromium.org> Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
* x86: Don't relocate symbols which point to things that aren't relocatedGabe Black2011-11-29-11/+8
| | | | | | | | 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>
* x86: Fix how the location of the realmode and bios blobs are calculatedGabe Black2011-11-29-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* x86: Misc cleanupsGraeme Russ2011-11-29-2/+3
| | | | Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
* x86: Misc PCI touchupsGraeme Russ2011-11-29-7/+9
| | | | Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
* x86: Ensure IDT and GDT remain 16-byte aligned post relocationGraeme Russ2011-11-29-6/+13
| | | | | | Some CPUs have strict alignment requirements for these tables Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
* x86: Provide more configuration granularityGraeme Russ2011-11-29-51/+56
| | | | | | Planned future ports requires more granularity for some options Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
* x86: Add multiboot headerGraeme Russ2011-11-29-0/+20
| | | | | | | | | 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>
* sc520: Create arch asm-offsetsGraeme Russ2011-11-29-47/+49
| | | | Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
* x86: Punt cold- and warm-boot flagsGraeme Russ2011-11-29-7/+0
| | | | | | | Nobody uses them anyway Signed-off-by: Graeme Russ <graeme.russ@gmail.com> Acked-by: Mike Frysinger <vapier@gentoo.org>
* cosmetic: checkpatch cleanup of arch/x86/lib/*.cGraeme Russ2011-11-29-432/+516
| | | | Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
* cosmetic: checkpatch cleanup of arch/x86/cpu/sc520/*.cGraeme Russ2011-11-29-87/+39
| | | | Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
* cosmetic: checkpatch cleanup of arch/x86/cpu/*.cGraeme Russ2011-11-29-23/+30
| | | | Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
* x86: Call hang() on unrecoverable exceptionGraeme Russ2011-11-29-10/+10
| | | | Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
* Reduce build timesWolfgang Denk2011-11-03-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* x86: Fix a compiler warning in arch/x86/lib/realmode.cGabe Black2011-11-02-1/+1
| | | | | | | Ensure that the value being passed to a %d format specifier is of type int. Signed-off-by: Gabe Black <gabeblack@chromium.org>
* x86: Remove the prototype for the unused function board_initGabe Black2011-11-02-1/+0
| | | | Signed-off-by: Gabe Black <gabeblack@chromium.org>
* x86: Rename include/asm/ic to include/asm/arch-sc520Graeme Russ2011-11-02-10/+9
| | | Also include some trivial related cleanups
* x86: turn off cache: set control register properlyOndrej Kupka2011-11-02-1/+1
| | | | | | Bits should be ORed when they are supposed to be added together Signed-off-by: Ondrej Kupka <ondra.cap@gmail.com>
* x86: Use getenv_ulong() in place of getenv(), strtoulSimon Glass2011-10-23-11/+3
| | | | | | This changes the board code to use the new getenv_ulong() function. Signed-off-by: Simon Glass <sjg@chromium.org>
* x86: cache: define ARCH_DMA_MINALIGN for DMA buffer alignmentAnton Staaf2011-10-23-0/+35
| | | | | | | Signed-off-by: Anton Staaf <robotboy@chromium.org> Cc: Mike Frysinger <vapier@gentoo.org> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Graeme Russ <graeme.russ@gmail.com>
* net: drop !NET_MULTI codeMike Frysinger2011-10-05-2/+0
| | | | | | | | | | | This is long over due. All but two net drivers have been converted, but those have now been dropped. The only thing left to do is actually delete all references to NET_MULTI and code that is compiled when that is not defined. So here we scrub the core code. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* image: push default arch values to arch headersMike Frysinger2011-10-05-0/+3
| | | | | | | | | This pushes the ugly duplicated arch ifdef lists we maintain in various image related files out to the arch headers themselves. Acked-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> Tested-by: Thomas Chou <thomas@wytron.com.tw> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* console: Implement pre-console bufferGraeme Russ2011-10-05-0/+3
| | | | | | | | | | | | | Allow redirection of console output prior to console initialisation to a temporary buffer. To enable this functionality, the board (or arch) must define: - CONFIG_PRE_CONSOLE_BUFFER - Enable pre-console buffer - CONFIG_PRE_CON_BUF_ADDR - Base address of pre-console buffer - CONFIG_PRE_CON_BUF_SZ - Size of pre-console buffer (in bytes) The pre-console buffer will buffer the last CONFIG_PRE_CON_BUF_SZ bytes Any earlier characters are silently dropped.
* Convert ISO-8859 files to UTF-8Albert ARIBAUD2011-08-04-43/+43
| | | | | | | | There was a mix of UTF-8 and ISO-8859 files in the U-Boot source tree, which could cause issues with the patchwork review system. This commit converts all ISO-8859 files to UTF-8. Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
* Unify timer_init() and cpu_init() prototypesWolfgang Denk2011-08-01-1/+0
| | | | | | | | | | Clean up some duplicated prototype declarations. Get rid of now useless AVR32 initcalls.h file. Signed-off-by: Wolfgang Denk <wd@denx.de> Cc: Albert Aribaud <albert.aribaud@free.fr> Cc: Haavard Skinnemoen <haavard.skinnemoen@atmel.com> Cc: Graeme Russ <graeme.russ@gmail.com>
* cleanup: Fix typos and misspellings in various files.Mike Williams2011-07-28-2/+2
| | | | | | | | | | | Recieve/Receive recieve/receive Interupt/Interrupt interupt/interrupt Addres/Address addres/address Signed-off-by: Mike Williams <mike@mikebwilliams.com>
* unify version_stringAndreas Bießmann2011-07-28-4/+0
| | | | | | | | | | | | This patch removes the architecture specific implementation of version_string where possible. Some architectures use a special place and therefore we provide U_BOOT_VERSION_STRING definition and a common weak symbol version_string. Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com> CC: Mike Frysinger <vapier@gentoo.org> CC: Peter Pan <pppeterpppan@gmail.com> Acked-by: Mike Frysinger <vapier@gentoo.org>
* Timer: Remove reset_timer() for non-Nios2 archesGraeme Russ2011-07-26-5/+0
|
* Timer: Remove set_timer completelyGraeme Russ2011-07-26-7/+0
|
* Minor coding style cleanup.Wolfgang Denk2011-05-19-1/+0
| | | | Signed-off-by: Wolfgang Denk <wd@denx.de>
* Handle most LDSCRIPT setting centrallyScott Wood2011-04-30-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, some linker scripts are found by common code in config.mk. Some are found using CONFIG_SYS_LDSCRIPT, but the code for that is sometimes in arch config.mk and sometimes in board config.mk. Some are found using an arch-specific rule for looking in CPUDIR, etc. Further, the powerpc config.mk rule relied on CONFIG_NAND_SPL when it really wanted CONFIG_NAND_U_BOOT -- which covered up the fact that not all NAND_U_BOOT builds actually wanted CPUDIR/u-boot-nand.lds. Replace all of this -- except for a handful of boards that are actually selecting a linker script in a unique way -- with centralized ldscript finding. If board code specifies LDSCRIPT, that will be used. Otherwise, if CONFIG_SYS_LDSCRIPT is specified, that will be used. If neither of these are specified, then the central config.mk will check for the existence of the following, in order: $(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds (only if CONFIG_NAND_U_BOOT) $(TOPDIR)/$(CPUDIR)/u-boot-nand.lds (only if CONFIG_NAND_U_BOOT) $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds $(TOPDIR)/$(CPUDIR)/u-boot.lds Some boards (sc3, cm5200, munices) provided their own u-boot.lds that were dead code, because they were overridden by a CPUDIR u-boot.lds under the old powerpc rules. These boards' own u-boot.lds have bitrotted and no longer work -- these lds files have been removed. Signed-off-by: Scott Wood <scottwood@freescale.com> Tested-by: Graeme Russ <graeme.russ@gmail.com>
* sc520: Move reset to stand-alone fileGraeme Russ2011-04-13-10/+41
| | | | | | | | Partial linking allows weak functions to be overridden in files containing only one function. Moving the sc520 override of reset_cpu gets rid of an ugly #ifdef Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
* x86: Rename i386 to x86Graeme Russ2011-04-13-0/+8631
Signed-off-by: Graeme Russ <graeme.russ@gmail.com>