summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/i386/Kconfig18
-rw-r--r--src/arch/i386/Makefile.bootblock.inc (renamed from src/arch/i386/Makefile.tinybootblock.inc)2
-rw-r--r--src/arch/i386/Makefile.inc2
-rw-r--r--src/arch/i386/include/bootblock_common.h (renamed from src/arch/i386/init/bootblock.c)14
-rw-r--r--src/arch/i386/init/bootblock_normal.c29
-rw-r--r--src/arch/i386/init/bootblock_simple.c15
6 files changed, 64 insertions, 16 deletions
diff --git a/src/arch/i386/Kconfig b/src/arch/i386/Kconfig
index bf60039f8f..50a8057371 100644
--- a/src/arch/i386/Kconfig
+++ b/src/arch/i386/Kconfig
@@ -49,6 +49,24 @@ config BIG_BOOTBLOCK
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
diff --git a/src/arch/i386/Makefile.tinybootblock.inc b/src/arch/i386/Makefile.bootblock.inc
index 8911844d9e..a7cbc6c9cf 100644
--- a/src/arch/i386/Makefile.tinybootblock.inc
+++ b/src/arch/i386/Makefile.bootblock.inc
@@ -63,7 +63,7 @@ $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.o: $(obj)/mainboard/$(MAINBOARDDIR)/b
$(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
diff --git a/src/arch/i386/Makefile.inc b/src/arch/i386/Makefile.inc
index 831c8cf90a..950381aedf 100644
--- a/src/arch/i386/Makefile.inc
+++ b/src/arch/i386/Makefile.inc
@@ -95,7 +95,7 @@ endif
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
diff --git a/src/arch/i386/init/bootblock.c b/src/arch/i386/include/bootblock_common.h
index 86a5c5b136..895a185c6f 100644
--- a/src/arch/i386/init/bootblock.c
+++ b/src/arch/i386/include/bootblock_common.h
@@ -31,17 +31,3 @@ static void call(unsigned long addr, unsigned long bist)
{
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");
-}
-
diff --git a/src/arch/i386/init/bootblock_normal.c b/src/arch/i386/init/bootblock_normal.c
new file mode 100644
index 0000000000..0e5bd25556
--- /dev/null
+++ b/src/arch/i386/init/bootblock_normal.c
@@ -0,0 +1,29 @@
+#include <bootblock_common.h>
+
+#include <arch/io.h>
+#include "arch/romcc_io.h"
+#include "pc80/mc146818rtc_early.c"
+
+static void main(unsigned long bist)
+{
+ if (boot_cpu()) {
+ bootblock_northbridge_init();
+ bootblock_southbridge_init();
+ }
+
+ unsigned long entry;
+ 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");
+}
+
diff --git a/src/arch/i386/init/bootblock_simple.c b/src/arch/i386/init/bootblock_simple.c
new file mode 100644
index 0000000000..e8994ee092
--- /dev/null
+++ b/src/arch/i386/init/bootblock_simple.c
@@ -0,0 +1,15 @@
+#include <bootblock_common.h>
+
+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");
+}
+