summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/i386/Config.lb42
-rw-r--r--src/arch/i386/init/crt0.S.lb12
-rw-r--r--src/arch/i386/init/ldscript_cbfs.lb59
-rw-r--r--src/arch/i386/init/ldscript_fallback_cbfs.lb64
-rw-r--r--src/arch/i386/lib/Config.lb7
-rw-r--r--src/arch/i386/lib/cbfs_and_run.c23
6 files changed, 196 insertions, 11 deletions
diff --git a/src/arch/i386/Config.lb b/src/arch/i386/Config.lb
index 5f09066695..68b4310248 100644
--- a/src/arch/i386/Config.lb
+++ b/src/arch/i386/Config.lb
@@ -1,3 +1,4 @@
+uses CONFIG_CBFS
uses CONFIG_SMP
uses CONFIG_PRECOMPRESSED_PAYLOAD
uses CONFIG_USE_INIT
@@ -7,18 +8,39 @@ uses USE_FALLBACK_IMAGE
init init/crt0.S.lb
+if CONFIG_CBFS
+ if USE_FAILOVER_IMAGE
+ else
+ initobject /src/lib/cbfs.o
+ initobject /src/console/vsprintf.o
+ initobject /src/lib/lzma.o
+ end
+end
+
if HAVE_FAILOVER_BOOT
- if USE_FAILOVER_IMAGE
- ldscript init/ldscript_failover.lb
- else
- ldscript init/ldscript.lb
- end
+ if USE_FAILOVER_IMAGE
+ ldscript init/ldscript_failover.lb
+ else
+ if CONFIG_CBFS
+ ldscript init/ldscript_cbfs.lb
+ else
+ ldscript init/ldscript.lb
+ end
+ end
else
- if USE_FALLBACK_IMAGE
- ldscript init/ldscript_fallback.lb
- else
- ldscript init/ldscript.lb
- end
+ if CONFIG_CBFS
+ if USE_FALLBACK_IMAGE
+ ldscript init/ldscript_fallback_cbfs.lb
+ else
+ ldscript init/ldscript_cbfs.lb
+ end
+ else
+ if USE_FALLBACK_IMAGE
+ ldscript init/ldscript_fallback.lb
+ else
+ ldscript init/ldscript.lb
+ end
+ end
end
makerule all
diff --git a/src/arch/i386/init/crt0.S.lb b/src/arch/i386/init/crt0.S.lb
index c54e7053d0..dd51899441 100644
--- a/src/arch/i386/init/crt0.S.lb
+++ b/src/arch/i386/init/crt0.S.lb
@@ -73,6 +73,10 @@ __main:
movl $0x4000000, %esp
movl %esp, %ebp
pushl %esi
+#ifdef CONFIG_CBFS
+ pushl $str_coreboot_ram_name
+ call cbfs_and_run_core
+#else
movl $_liseg, %esi
movl $_iseg, %edi
movl $_eiseg, %ecx
@@ -81,6 +85,7 @@ __main:
pushl %edi
pushl %esi
call copy_and_run_core
+#endif
.Lhlt:
intel_chip_post_macro(0xee) /* post fe */
@@ -137,6 +142,13 @@ str_copying_to_ram: .string "Uncompressing coreboot to RAM.\r\n"
#else
str_copying_to_ram: .string "Copying coreboot to RAM.\r\n"
#endif
+#if CONFIG_CBFS
+# if USE_FALLBACK_IMAGE == 1
+str_coreboot_ram_name: .string "fallback/coreboot_ram"
+# else
+str_coreboot_ram_name: .string "normal/coreboot_ram"
+# endif
+#endif
str_pre_main: .string "Jumping to coreboot.\r\n"
.previous
diff --git a/src/arch/i386/init/ldscript_cbfs.lb b/src/arch/i386/init/ldscript_cbfs.lb
new file mode 100644
index 0000000000..e86befb1ca
--- /dev/null
+++ b/src/arch/i386/init/ldscript_cbfs.lb
@@ -0,0 +1,59 @@
+/*
+ * Memory map:
+ *
+ * _RAMBASE
+ * : data segment
+ * : bss segment
+ * : heap
+ * : stack
+ * _ROMBASE
+ * : coreboot text
+ * : readonly text
+ */
+/*
+ * Bootstrap code for the STPC Consumer
+ * Copyright (c) 1999 by Net Insight AB. All Rights Reserved.
+ *
+ */
+
+/*
+ * Written by Johan Rydberg, based on work by Daniel Kahlin.
+ * Rewritten by Eric Biederman
+ */
+/*
+ * We use ELF as output format. So that we can
+ * debug the code in some form.
+ */
+OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
+OUTPUT_ARCH(i386)
+
+/*
+ENTRY(_start)
+*/
+
+TARGET(binary)
+SECTIONS
+{
+ . = _ROMBASE;
+
+ /* This section might be better named .setup */
+ .rom . : {
+ _rom = .;
+ *(.rom.text);
+ *(.rom.data);
+ *(.rodata.*);
+ *(.rom.data.*);
+ . = ALIGN(16);
+ _erom = .;
+ }
+
+ _lrom = LOADADDR(.rom);
+ _elrom = LOADADDR(.rom) + SIZEOF(.rom);
+
+ /DISCARD/ : {
+ *(.comment)
+ *(.comment.*)
+ *(.note)
+ *(.note.*)
+ }
+}
diff --git a/src/arch/i386/init/ldscript_fallback_cbfs.lb b/src/arch/i386/init/ldscript_fallback_cbfs.lb
new file mode 100644
index 0000000000..d1b56ce3b2
--- /dev/null
+++ b/src/arch/i386/init/ldscript_fallback_cbfs.lb
@@ -0,0 +1,64 @@
+/*
+ * Memory map:
+ *
+ * _RAMBASE
+ * : data segment
+ * : bss segment
+ * : heap
+ * : stack
+ * _ROMBASE
+ * : coreboot text
+ * : readonly text
+ */
+/*
+ * Bootstrap code for the STPC Consumer
+ * Copyright (c) 1999 by Net Insight AB. All Rights Reserved.
+ *
+ */
+
+/*
+ * Written by Johan Rydberg, based on work by Daniel Kahlin.
+ * Rewritten by Eric Biederman
+ */
+/*
+ * We use ELF as output format. So that we can
+ * debug the code in some form.
+ */
+OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
+OUTPUT_ARCH(i386)
+
+/*
+ENTRY(_start)
+*/
+
+TARGET(binary)
+SECTIONS
+{
+ . = _ROMBASE;
+
+ /* cut _start into last 64k*/
+ _x = .;
+ . = (_x < (_ROMBASE - 0x10000 + ROM_IMAGE_SIZE)) ? (_ROMBASE - 0x10000 + ROM_IMAGE_SIZE) : _x;
+
+ /* This section might be better named .setup */
+ .rom . : {
+ _rom = .;
+ *(.rom.text);
+ *(.rom.data);
+ *(.init.rodata.*);
+ *(.rodata.*);
+ *(.rom.data.*);
+ . = ALIGN(16);
+ _erom = .;
+ }
+
+ _lrom = LOADADDR(.rom);
+ _elrom = LOADADDR(.rom) + SIZEOF(.rom);
+
+ /DISCARD/ : {
+ *(.comment)
+ *(.note)
+ *(.comment.*)
+ *(.note.*)
+ }
+}
diff --git a/src/arch/i386/lib/Config.lb b/src/arch/i386/lib/Config.lb
index 3356b8f4f5..52da9d5e59 100644
--- a/src/arch/i386/lib/Config.lb
+++ b/src/arch/i386/lib/Config.lb
@@ -1,6 +1,7 @@
uses CONFIG_USE_INIT
uses CONFIG_USE_PRINTK_IN_CAR
uses USE_FAILOVER_IMAGE
+uses CONFIG_CBFS
object c_start.S
object cpu.c
@@ -14,5 +15,9 @@ initobject printk_init.o
if USE_FAILOVER_IMAGE
else
- initobject copy_and_run.o
+ if CONFIG_CBFS
+ initobject cbfs_and_run.o
+ else
+ initobject copy_and_run.o
+ end
end
diff --git a/src/arch/i386/lib/cbfs_and_run.c b/src/arch/i386/lib/cbfs_and_run.c
new file mode 100644
index 0000000000..eaded11223
--- /dev/null
+++ b/src/arch/i386/lib/cbfs_and_run.c
@@ -0,0 +1,23 @@
+/* by yhlu 6.2005
+ moved from nrv2v.c and some lines from crt0.S
+ 2006/05/02 - stepan: move nrv2b to an extra file.
+*/
+
+#include <console/console.h>
+#include <cbfs.h>
+
+void cbfs_and_run_core(char *filename, unsigned ebp)
+{
+ u8 *dst;
+ print_debug("Jumping to image.\r\n");
+ dst = cbfs_load_stage(filename);
+ print_debug("Jumping to image.\r\n");
+
+ __asm__ volatile (
+ "movl %%eax, %%ebp\n\t"
+ "cli\n\t"
+ "jmp *%%edi\n\t"
+ :: "a"(ebp), "D"(dst)
+ );
+
+}