[coreboot] [commit] r5157 - in trunk/src/arch/i386: . include init
repository service
svn at coreboot.org
Wed Feb 24 14:58:24 CET 2010
Author: oxygene
Date: Wed Feb 24 14:58:23 2010
New Revision: 5157
URL: http://tracker.coreboot.org/trac/coreboot/changeset/5157
Log:
Enable user selectable bootblocks, and provide a bootblock that
selects between "fallback" and "normal", in addition to the
already present "fallback"-only bootblock.
Signed-off-by: Patrick Georgi <patrick.georgi at coresystems.de>
Acked-by: Stefan Reinauer <stepan at coresystems.de>
Added:
trunk/src/arch/i386/Makefile.bootblock.inc
- copied, changed from r5156, trunk/src/arch/i386/Makefile.tinybootblock.inc
trunk/src/arch/i386/include/bootblock_common.h
- copied, changed from r5156, trunk/src/arch/i386/init/bootblock.c
trunk/src/arch/i386/init/bootblock_normal.c
- copied, changed from r5156, trunk/src/arch/i386/init/bootblock.c
trunk/src/arch/i386/init/bootblock_simple.c
- copied, changed from r5156, trunk/src/arch/i386/init/bootblock.c
Deleted:
trunk/src/arch/i386/Makefile.tinybootblock.inc
trunk/src/arch/i386/init/bootblock.c
Modified:
trunk/src/arch/i386/Kconfig
trunk/src/arch/i386/Makefile.inc
Modified: trunk/src/arch/i386/Kconfig
==============================================================================
--- trunk/src/arch/i386/Kconfig Wed Feb 24 14:18:01 2010 (r5156)
+++ trunk/src/arch/i386/Kconfig Wed Feb 24 14:58:23 2010 (r5157)
@@ -49,6 +49,24 @@
default n if TINY_BOOTBLOCK
default y
+choice
+ prompt "Bootblock behaviour"
+ default BOOTBLOCK_SIMPLE
+ depends on TINY_BOOTBLOCK
+
+config BOOTBLOCK_SIMPLE
+ bool "Always load fallback"
+
+config BOOTBLOCK_NORMAL
+ bool "Switch to normal if CMOS says so"
+
+endchoice
+
+config BOOTBLOCK_SOURCE
+ string
+ default "bootblock_simple.c" if BOOTBLOCK_SIMPLE
+ default "bootblock_normal.c" if BOOTBLOCK_NORMAL
+
config UPDATE_IMAGE
bool "Update existing coreboot.rom image"
default n
Copied and modified: trunk/src/arch/i386/Makefile.bootblock.inc (from r5156, trunk/src/arch/i386/Makefile.tinybootblock.inc)
==============================================================================
--- trunk/src/arch/i386/Makefile.tinybootblock.inc Wed Feb 24 14:18:01 2010 (r5156, copy source)
+++ trunk/src/arch/i386/Makefile.bootblock.inc Wed Feb 24 14:58:23 2010 (r5157)
@@ -63,7 +63,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: $(src)/arch/i386/init/bootblock.c $(obj)/romcc
+$(obj)/mainboard/$(MAINBOARDDIR)/bootblock.inc: $(src)/arch/i386/init/$(subst ",,$(CONFIG_BOOTBLOCK_SOURCE)) $(obj)/romcc
$(obj)/romcc $(bootblock_romccflags) -O2 $(ROMCCFLAGS) $(INCLUDES) $< -o $@
$(obj)/bootblock.elf: $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.o $(obj)/bootblock/ldscript.ld
Modified: trunk/src/arch/i386/Makefile.inc
==============================================================================
--- trunk/src/arch/i386/Makefile.inc Wed Feb 24 14:18:01 2010 (r5156)
+++ trunk/src/arch/i386/Makefile.inc Wed Feb 24 14:58:23 2010 (r5157)
@@ -95,7 +95,7 @@
endif
ifeq ($(CONFIG_TINY_BOOTBLOCK),y)
-include $(src)/arch/i386/Makefile.tinybootblock.inc
+include $(src)/arch/i386/Makefile.bootblock.inc
else
include $(src)/arch/i386/Makefile.bigbootblock.inc
endif
Copied and modified: trunk/src/arch/i386/include/bootblock_common.h (from r5156, trunk/src/arch/i386/init/bootblock.c)
==============================================================================
--- trunk/src/arch/i386/init/bootblock.c Wed Feb 24 14:18:01 2010 (r5156, copy source)
+++ trunk/src/arch/i386/include/bootblock_common.h Wed Feb 24 14:58:23 2010 (r5157)
@@ -31,17 +31,3 @@
{
asm volatile ("jmp *%0\n\t" : : "r" (addr), "a" (bist));
}
-
-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, bist);
- asm volatile ("1:\n\thlt\n\tjmp 1b\n\t");
-}
-
Copied and modified: trunk/src/arch/i386/init/bootblock_normal.c (from r5156, trunk/src/arch/i386/init/bootblock.c)
==============================================================================
--- trunk/src/arch/i386/init/bootblock.c Wed Feb 24 14:18:01 2010 (r5156, copy source)
+++ trunk/src/arch/i386/init/bootblock_normal.c Wed Feb 24 14:58:23 2010 (r5157)
@@ -1,36 +1,8 @@
-#define __PRE_RAM__
-#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
+#include <bootblock_common.h>
-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", "edi", "esp");
- return entry;
-}
-
-static void call(unsigned long addr, unsigned long bist)
-{
- asm volatile ("jmp *%0\n\t" : : "r" (addr), "a" (bist));
-}
+#include <arch/io.h>
+#include "arch/romcc_io.h"
+#include "pc80/mc146818rtc_early.c"
static void main(unsigned long bist)
{
@@ -38,10 +10,20 @@
bootblock_northbridge_init();
bootblock_southbridge_init();
}
- const char* target1 = "fallback/romstage";
+
unsigned long entry;
- entry = findstage(target1);
+ if (do_normal_boot())
+ entry = findstage("normal/romstage");
+ else
+ entry = findstage("fallback/romstage");
+
if (entry) call(entry, bist);
+
+ /* run fallback if normal can't be found */
+ entry = findstage("fallback/romstage");
+ if (entry) call(entry, bist);
+
+ /* duh. we're stuck */
asm volatile ("1:\n\thlt\n\tjmp 1b\n\t");
}
Copied and modified: trunk/src/arch/i386/init/bootblock_simple.c (from r5156, trunk/src/arch/i386/init/bootblock.c)
==============================================================================
--- trunk/src/arch/i386/init/bootblock.c Wed Feb 24 14:18:01 2010 (r5156, copy source)
+++ trunk/src/arch/i386/init/bootblock_simple.c Wed Feb 24 14:58:23 2010 (r5157)
@@ -1,36 +1,4 @@
-#define __PRE_RAM__
-#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", "edi", "esp");
- return entry;
-}
-
-static void call(unsigned long addr, unsigned long bist)
-{
- asm volatile ("jmp *%0\n\t" : : "r" (addr), "a" (bist));
-}
+#include <bootblock_common.h>
static void main(unsigned long bist)
{
More information about the coreboot
mailing list