diff options
author | Patrick Georgi <patrick.georgi@coresystems.de> | 2009-12-31 12:56:53 +0000 |
---|---|---|
committer | Patrick Georgi <patrick.georgi@coresystems.de> | 2009-12-31 12:56:53 +0000 |
commit | 1bb68289001f95b49499ac8eb483a7a10e64cc52 (patch) | |
tree | c1d60ba92227bc29ef48c0afb273db4825524dd2 /src/arch | |
parent | 9db833bec394b886ca990965970cdb100b65d9ac (diff) | |
download | coreboot-staging-1bb68289001f95b49499ac8eb483a7a10e64cc52.zip coreboot-staging-1bb68289001f95b49499ac8eb483a7a10e64cc52.tar.gz |
romcc:
- Set __PRE_RAM__ define per default
- Properly handle ignored (#ifdef'd out) #include lines
amd/serengeti_cheetah_fam10:
- write ACPI files to $(obj) instead of the top dir (alias $(CURDIR))
tinybootblock:
- provide a way to define code that should be added to the bootblock,
to map the entire ROM for use by CBFS
amd/model_fxx, amd/model_10xxx:
- add CONFIG_SSE
walkcbfs.S:
- eliminate the use of two registers, to make space for romcc to wiggle
amd/serengeti_cheetah_fam10:
- use the enable_rom framework. not entirely functional yet
Boot-tested on emulation/qemu-x86
Build-tested on amd/serengeti_cheetah_fam10
amd/serengeti_cheetah_fam10 fails in amdht/ somewhere, but builds
Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de>
Acked-by: Ronald G. Minnich <rminnich@gmail.com>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4994 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/arch')
-rw-r--r-- | src/arch/i386/Kconfig | 6 | ||||
-rw-r--r-- | src/arch/i386/Makefile.tinybootblock.inc | 10 | ||||
-rw-r--r-- | src/arch/i386/init/bootblock.c | 32 | ||||
-rw-r--r-- | src/arch/i386/lib/walkcbfs.S | 42 |
4 files changed, 65 insertions, 25 deletions
diff --git a/src/arch/i386/Kconfig b/src/arch/i386/Kconfig index 19bd63a..1d01d09 100644 --- a/src/arch/i386/Kconfig +++ b/src/arch/i386/Kconfig @@ -43,3 +43,9 @@ config MAX_REBOOT_CNT config TINY_BOOTBLOCK bool default n + +config BOOTBLOCK_NORTHBRIDGE_INIT + string + +config BOOTBLOCK_SOUTHBRIDGE_INIT + string diff --git a/src/arch/i386/Makefile.tinybootblock.inc b/src/arch/i386/Makefile.tinybootblock.inc index 86a71a8..a3f38ce 100644 --- a/src/arch/i386/Makefile.tinybootblock.inc +++ b/src/arch/i386/Makefile.tinybootblock.inc @@ -30,9 +30,17 @@ bootblock_inc += $(src)/cpu/x86/16bit/entry16.inc bootblock_inc += $(src)/cpu/x86/16bit/reset16.inc bootblock_inc += $(src)/cpu/x86/32bit/entry32.inc bootblock_inc += $(src)/arch/i386/lib/id.inc +ifeq ($(CONFIG_SSE),y) +bootblock_inc += $(src)/cpu/x86/sse_enable.inc +endif bootblock_inc += $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.inc bootblock_inc += $(src)/arch/i386/lib/walkcbfs.S +bootblock_romccflags := -mcpu=i386 +ifeq ($(CONFIG_SSE),y) +bootblock_romccflags := -mcpu=k7 -msse +endif + $(obj)/bootblock/ldscript.ld: $(bootblock_ldscripts) $(obj)/ldoptions mkdir -p $(obj)/bootblock printf '$(foreach ldscript,ldoptions $(bootblock_lds),INCLUDE "$(ldscript)"\n)' > $@ @@ -48,7 +56,7 @@ $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.s: $(obj)/bootblock/bootblock.c $(CC) -x assembler-with-cpp -DASSEMBLY -E -I$(src)/include -I$(src)/arch/i386/include -I$(obj) -I$(obj)/bootblock -include $(obj)/config.h -I. -I$(src) $< > $@.new && mv $@.new $@ $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.inc: $(obj)/romcc $(src)/arch/i386/init/bootblock.c - $(obj)/romcc $(ROMCCFLAGS) $(INCLUDES) $(src)/arch/i386/init/bootblock.c -o $@ + $(obj)/romcc $(bootblock_romccflags) -O2 $(ROMCCFLAGS) $(INCLUDES) $(src)/arch/i386/init/bootblock.c -o $@ $(obj)/bootblock.elf: $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.o $(obj)/bootblock/ldscript.ld @printf " LINK $(subst $(obj)/,,$(@))\n" diff --git a/src/arch/i386/init/bootblock.c b/src/arch/i386/init/bootblock.c index eea0198..3cafef5 100644 --- a/src/arch/i386/init/bootblock.c +++ b/src/arch/i386/init/bootblock.c @@ -1,24 +1,46 @@ +#if CONFIG_LOGICAL_CPUS && \ + (defined(CONFIG_BOOTBLOCK_NORTHBRIDGE_INIT) || defined(CONFIG_BOOTBLOCK_SOUTHBRIDGE_INIT)) +#include <cpu/x86/lapic/boot_cpu.c> +#else +#define boot_cpu(x) 1 +#endif + +#ifdef CONFIG_BOOTBLOCK_NORTHBRIDGE_INIT +#include CONFIG_BOOTBLOCK_NORTHBRIDGE_INIT +#else +static void bootblock_northbridge_init(void) { } +#endif +#ifdef CONFIG_BOOTBLOCK_SOUTHBRIDGE_INIT +#include CONFIG_BOOTBLOCK_SOUTHBRIDGE_INIT +#else +static void bootblock_southbridge_init(void) { } +#endif + static unsigned long findstage(char* target) { unsigned long entry; asm volatile ( "mov $1f, %%esp\n\t" "jmp walkcbfs\n\t" - "1:\n\t" : "=a" (entry) : "S" (target) : "ebx", "ecx", "edx", "edi", "ebp", "esp"); + "1:\n\t" : "=a" (entry) : "S" (target) : "ebx", "ecx", "edi", "esp"); return entry; } -static void call(unsigned long addr) +static void call(unsigned long addr, unsigned long bist) { - asm volatile ("jmp %0\n\t" : : "r" (addr)); + asm volatile ("jmp %0\n\t" : : "r" (addr), "a" (bist)); } -static void main(void) +static void main(unsigned long bist) { + if (boot_cpu()) { + bootblock_northbridge_init(); + bootblock_southbridge_init(); + } const char* target1 = "fallback/romstage"; unsigned long entry; entry = findstage(target1); - if (entry) call(entry); + if (entry) call(entry, bist); asm volatile ("1:\n\thlt\n\tjmp 1b\n\t"); } diff --git a/src/arch/i386/lib/walkcbfs.S b/src/arch/i386/lib/walkcbfs.S index aba0453..d043af5 100644 --- a/src/arch/i386/lib/walkcbfs.S +++ b/src/arch/i386/lib/walkcbfs.S @@ -25,18 +25,9 @@ input %esi: filename input %esp: return address (not pointer to return address!) output %eax: entry point - clobbers %ebx, %ecx, %edx, %edi, %ebp + clobbers %ebx, %ecx, %edi */ walkcbfs: - mov %esi, %ebp /* stash away filename pointer */ - mov $0, %edx -1: - cmpb $0, (%edx,%esi) - jz 2f - add $1, %edx - jmp 1b -2: - add $1, %edx mov CBFS_HEADER_PTR, %eax mov CBFS_HEADER_ROMSIZE(%eax), %ecx bswap %ecx @@ -45,15 +36,20 @@ walkcbfs: mov CBFS_HEADER_OFFSET(%eax), %ecx bswap %ecx add %ecx, %ebx - mov CBFS_HEADER_ALIGN(%eax), %eax - bswap %eax - sub $1, %eax + /* determine filename length */ + mov $0, %eax +1: + cmpb $0, (%eax,%esi) + jz 2f + add $1, %eax + jmp 1b +2: + add $1, %eax walker: - mov %ebp, %esi mov %ebx, %edi add $CBFS_FILE_STRUCTSIZE, %edi /* edi = address of first byte after struct cbfs_file */ - mov %edx, %ecx + mov %eax, %ecx repe cmpsb # zero flag set if strings are equal jnz tryharder @@ -67,21 +63,29 @@ walker: jmp *%esp tryharder: + sub %ebx, %edi /* edi = # of walked bytes */ + sub %edi, %esi /* esi = start of filename */ + + /* ebx = ecx = (current+offset+len+ALIGN-1) & ~(ALIGN-1) */ mov CBFS_FILE_OFFSET(%ebx), %ecx bswap %ecx add %ebx, %ecx mov CBFS_FILE_LEN(%ebx), %edi bswap %edi add %edi, %ecx - add %eax, %ecx - mov %eax, %edi + mov CBFS_HEADER_PTR, %ebx + mov CBFS_HEADER_ALIGN(%ebx), %ebx + bswap %ebx + sub $1, %ebx + add %ebx, %ecx + mov %ebx, %edi not %edi and %edi, %ecx mov %ecx, %ebx /* look if we should exit */ - mov CBFS_HEADER_PTR, %esi - mov CBFS_HEADER_ROMSIZE(%esi), %ecx + mov CBFS_HEADER_PTR, %ecx + mov CBFS_HEADER_ROMSIZE(%ecx), %ecx bswap %ecx not %ecx add $1, %ecx |