diff options
author | Patrick Georgi <patrick.georgi@coresystems.de> | 2010-02-24 13:58:23 +0000 |
---|---|---|
committer | Patrick Georgi <patrick.georgi@coresystems.de> | 2010-02-24 13:58:23 +0000 |
commit | c9fa96d04c85430c7397473b2995f8f4913beb9c (patch) | |
tree | ae5557338f4144ec069ae1c28869f22d3805121b /src/arch/i386/init | |
parent | d3428b071e256f0b09f40ef3d18837749401b6f8 (diff) | |
download | coreboot-c9fa96d04c85430c7397473b2995f8f4913beb9c.tar.xz |
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@coresystems.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5157 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/arch/i386/init')
-rw-r--r-- | src/arch/i386/init/bootblock.c | 47 | ||||
-rw-r--r-- | src/arch/i386/init/bootblock_normal.c | 29 | ||||
-rw-r--r-- | src/arch/i386/init/bootblock_simple.c | 15 |
3 files changed, 44 insertions, 47 deletions
diff --git a/src/arch/i386/init/bootblock.c b/src/arch/i386/init/bootblock.c deleted file mode 100644 index 86a5c5b136..0000000000 --- a/src/arch/i386/init/bootblock.c +++ /dev/null @@ -1,47 +0,0 @@ -#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)); -} - -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"); +} + |