[coreboot-gerrit] Patch set updated for coreboot: cpu/qemu-x86: Run a C environment in the bootblock

Alexandru Gagniuc (mr.nuke.me@gmail.com) gerrit at coreboot.org
Fri Jan 8 06:08:45 CET 2016


Alexandru Gagniuc (mr.nuke.me at gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/11858

-gerrit

commit 87d6a3cd0f79223d1bb4385c84a92ddfba4985ef
Author: Alexandru Gagniuc <mr.nuke.me at gmail.com>
Date:   Sat Oct 10 16:35:58 2015 -0700

    cpu/qemu-x86: Run a C environment in the bootblock
    
    Make use of the ROMCC-less bootblock introduced earlier. The "qemu"
    cpu is particularly easy because it does not require CAR setup.
    
    Change-Id: Idf161d363d2daf3c55454d376ca42d492463971a
    Signed-off-by: Alexandru Gagniuc <mr.nuke.me at gmail.com>
---
 src/cpu/qemu-x86/Kconfig      |  2 +-
 src/cpu/qemu-x86/Makefile.inc |  1 +
 src/cpu/qemu-x86/bootblock.S  | 48 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/src/cpu/qemu-x86/Kconfig b/src/cpu/qemu-x86/Kconfig
index ea2bc46..f956de5 100644
--- a/src/cpu/qemu-x86/Kconfig
+++ b/src/cpu/qemu-x86/Kconfig
@@ -19,4 +19,4 @@ config CPU_QEMU_X86
 	select ARCH_VERSTAGE_X86_32
 	select ARCH_ROMSTAGE_X86_32
 	select ARCH_RAMSTAGE_X86_32
-	select SMP
+	select C_ENVIRONMENT_BOOTBLOCK
diff --git a/src/cpu/qemu-x86/Makefile.inc b/src/cpu/qemu-x86/Makefile.inc
index b5f8369..ef94a52 100644
--- a/src/cpu/qemu-x86/Makefile.inc
+++ b/src/cpu/qemu-x86/Makefile.inc
@@ -12,6 +12,7 @@
 ## GNU General Public License for more details.
 ##
 
+bootblock-y += bootblock.S
 ramstage-y += qemu.c
 subdirs-y += ../x86/mtrr
 subdirs-y += ../x86/lapic
diff --git a/src/cpu/qemu-x86/bootblock.S b/src/cpu/qemu-x86/bootblock.S
new file mode 100644
index 0000000..6e1cd2e
--- /dev/null
+++ b/src/cpu/qemu-x86/bootblock.S
@@ -0,0 +1,48 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015  Alexandru Gagniuc <mr.nuke.me at gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <console/post_codes.h>
+
+#define STACK_SIZE 0x10000
+#define STACK_BASE 0xd0000
+
+.intel_syntax noprefix
+
+#define post_code(code) \
+	mov	eax, code; \
+	out	0x80, eax
+
+.global bootblock_pre_c_entry
+
+.section .text
+bootblock_pre_c_entry:
+
+	/* Set up a stack */
+	mov	esp, (STACK_BASE + STACK_SIZE - 4)
+
+	/*
+	 * We have the following values saved from earlier:
+	 * mm0: BIST result
+	 * mm1: TSC timestamp low 32 bits
+	 * mm2: TSC timestamp high 32 bits
+	 */
+	movd	eax, mm2
+	push	eax
+	movd	eax, mm1
+	push	eax
+	movd	eax, mm0
+	push	eax
+	call	bootblock_main
+
+.halt_forever:
+	post_code(POST_DEAD_CODE)
+	hlt
+	jmp	.halt_forever



More information about the coreboot-gerrit mailing list