[coreboot-gerrit] Change in ...coreboot[master]: mb/qemu-{i440fx, q35}: Use POSTCAR stage to load the ramstage

Arthur Heymans (Code Review) gerrit at coreboot.org
Thu Dec 20 11:27:08 CET 2018


Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/30332


Change subject: mb/qemu-{i440fx,q35}: Use POSTCAR stage to load the ramstage
......................................................................

mb/qemu-{i440fx,q35}: Use POSTCAR stage to load the ramstage

qemu does not have a real CAR but postcar stage is still useful
to avoid unneeded romstage globals migration.

Change-Id: Id73632afbef1c7f0845153bc01c6c21e87386710
Signed-off-by: Arthur Heymans <arthur at aheymans.xyz>
---
M src/mainboard/emulation/qemu-i440fx/Kconfig
M src/mainboard/emulation/qemu-i440fx/Makefile.inc
A src/mainboard/emulation/qemu-i440fx/exit_car.S
M src/mainboard/emulation/qemu-i440fx/romstage.c
M src/mainboard/emulation/qemu-q35/Kconfig
M src/mainboard/emulation/qemu-q35/Makefile.inc
M src/mainboard/emulation/qemu-q35/romstage.c
7 files changed, 50 insertions(+), 2 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/32/30332/1

diff --git a/src/mainboard/emulation/qemu-i440fx/Kconfig b/src/mainboard/emulation/qemu-i440fx/Kconfig
index 7e991b6..668b0ef 100644
--- a/src/mainboard/emulation/qemu-i440fx/Kconfig
+++ b/src/mainboard/emulation/qemu-i440fx/Kconfig
@@ -13,6 +13,8 @@
 	select MAINBOARD_HAS_NATIVE_VGA_INIT
 	select MAINBOARD_FORCE_NATIVE_VGA_INIT
 	select BOOTBLOCK_CONSOLE
+	select POSTCAR_STAGE
+	select POSTCAR_CONSOLE
 
 config MAINBOARD_DIR
 	string
diff --git a/src/mainboard/emulation/qemu-i440fx/Makefile.inc b/src/mainboard/emulation/qemu-i440fx/Makefile.inc
index 9e2880a..de790e6 100644
--- a/src/mainboard/emulation/qemu-i440fx/Makefile.inc
+++ b/src/mainboard/emulation/qemu-i440fx/Makefile.inc
@@ -2,3 +2,5 @@
 ramstage-y += fw_cfg.c
 romstage-y += memory.c
 ramstage-y += memory.c
+postcar-y += memory.c
+postcar-y += exit_car.S
diff --git a/src/mainboard/emulation/qemu-i440fx/exit_car.S b/src/mainboard/emulation/qemu-i440fx/exit_car.S
new file mode 100644
index 0000000..59a8c5c
--- /dev/null
+++ b/src/mainboard/emulation/qemu-i440fx/exit_car.S
@@ -0,0 +1,33 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2018 Intel Corp.
+ *
+ * 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; version 2 of
+ * the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+#include <cpu/x86/mtrr.h>
+#include <cpu/x86/cr.h>
+/*
+ * This path for CAR teardown is taken when CONFIG_FSP_CAR is employed.
+ * This version of chipset_teardown_car sets up the stack, then bypasses
+ * the rest of arch/x86/exit_car.S and calls main() itself instead of
+ * returning to _start. In main(), the TempRamExit FSP API is called
+ * to tear down the CAR and set up caching which can be overwritten
+ * after the API call.  More info can be found in the FSP Integration
+ * Guide included with the FSP binary.
+ */
+.text
+.global chipset_teardown_car
+chipset_teardown_car:
+	/* Set up new stack. */
+	mov	post_car_stack_top, %esp
+	/* Call C code */
+	call	main
diff --git a/src/mainboard/emulation/qemu-i440fx/romstage.c b/src/mainboard/emulation/qemu-i440fx/romstage.c
index e31394c..98929f7 100644
--- a/src/mainboard/emulation/qemu-i440fx/romstage.c
+++ b/src/mainboard/emulation/qemu-i440fx/romstage.c
@@ -23,11 +23,15 @@
 
 asmlinkage void car_stage_entry(void)
 {
+ 	struct postcar_frame pcf;
+
 	console_init();
 
 	cbmem_recovery(0);
 
 	timestamp_add_now(TS_START_ROMSTAGE);
 
-	run_ramstage();
+	if (postcar_frame_init(&pcf, 1 * KiB))
+		die("Unable to initialize postcar frame.\n");
+	run_postcar_phase(&pcf);
 }
diff --git a/src/mainboard/emulation/qemu-q35/Kconfig b/src/mainboard/emulation/qemu-q35/Kconfig
index fdd8890..16d5cd2 100644
--- a/src/mainboard/emulation/qemu-q35/Kconfig
+++ b/src/mainboard/emulation/qemu-q35/Kconfig
@@ -12,6 +12,8 @@
 	select MAINBOARD_HAS_NATIVE_VGA_INIT
 	select MAINBOARD_FORCE_NATIVE_VGA_INIT
 	select BOOTBLOCK_CONSOLE
+	select POSTCAR_STAGE
+	select POSTCAR_CONSOLE
 
 config MAINBOARD_DIR
 	string
diff --git a/src/mainboard/emulation/qemu-q35/Makefile.inc b/src/mainboard/emulation/qemu-q35/Makefile.inc
index 1503220..1ff7c99 100644
--- a/src/mainboard/emulation/qemu-q35/Makefile.inc
+++ b/src/mainboard/emulation/qemu-q35/Makefile.inc
@@ -2,4 +2,6 @@
 ramstage-y += ../qemu-i440fx/memory.c
 ramstage-y += ../qemu-i440fx/fw_cfg.c
 romstage-y += ../qemu-i440fx/memory.c
+postcar-y += ../qemu-i440fx/memory.c
+postcar-y += ../qemu-i440fx/exit_car.S
 bootblock-y += bootblock.c
diff --git a/src/mainboard/emulation/qemu-q35/romstage.c b/src/mainboard/emulation/qemu-q35/romstage.c
index 2b8d935..72ac403 100644
--- a/src/mainboard/emulation/qemu-q35/romstage.c
+++ b/src/mainboard/emulation/qemu-q35/romstage.c
@@ -24,6 +24,7 @@
 
 asmlinkage void car_stage_entry(void)
 {
+	struct postcar_frame pcf;
 	i82801ix_early_init();
 	console_init();
 
@@ -31,5 +32,7 @@
 
 	timestamp_add_now(TS_START_ROMSTAGE);
 
-	run_ramstage();
+	if (postcar_frame_init(&pcf, 1 * KiB))
+		die("Unable to initialize postcar frame.\n");
+	run_postcar_phase(&pcf);
 }

-- 
To view, visit https://review.coreboot.org/c/coreboot/+/30332
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Id73632afbef1c7f0845153bc01c6c21e87386710
Gerrit-Change-Number: 30332
Gerrit-PatchSet: 1
Gerrit-Owner: Arthur Heymans <arthur at aheymans.xyz>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20181220/ed713bec/attachment.html>


More information about the coreboot-gerrit mailing list