[coreboot] proposed cpu startup change

ron minnich rminnich at gmail.com
Fri Mar 6 21:05:24 CET 2009

This is a proposal for cpu startup on v3. It is motivated by the needs
of SMP. The idea is that we introduce cpu phases to parallel the
device phases. Because, on modern CPUs, we can dynamically probe
pretty much everything, we don't use the device tree for CPUs; that
was always a point of confusion on v2 anyway. Rather, in this example,
we define cpu_phase1 and cpu_phase 6 (for example) and define weak
symbols for them. These functions can be over-ridden by platform or
cpu functions.

Here's the patch. Comments welcome.

Index: lib/stage2.c
--- lib/stage2.c	(revision 1143)
+++ lib/stage2.c	(working copy)
@@ -28,6 +28,18 @@
 #include <device/device.h>
 #include <tables.h>

+void __attribute__((weak)) unsigned int cpu_phase1(unsigned int coldboot,
+			struct sys_info *sysinfo)
+	printk(BIOS_SPEW, "cpu_phase1: nothing to do\n");
+void __attribute__((weak)) unsigned int cpu_phase6(unsigned int coldboot,
+			struct sys_info *sysinfo)
+	printk(BIOS_SPEW, "cpu_phase6: nothing to do\n");
  * Main function of the DRAM part of coreboot.
@@ -44,8 +56,10 @@
 void *stage2(void)
 	void *mbi;
+	struct sys_info *sysinfo = &(global_vars()->sys_info);

+	cpu_phase1(is_coldboot(), sysinfo);

 	/* Phase 1 was console init and making printk work. Both functions are
@@ -85,6 +99,11 @@
 	show_all_devs(BIOS_DEBUG, "After phase 6.");

+	/* final cleanup: do any remaining CPU setup. This can include memory
+	 * init, or not, depending on the CPU; it may have been done in phase 1.
+ 	 */
+	cpu_phase6(is_coldboot(), sysinfo);
 	/* Write tables to pass information to the payloads. */
 	mbi = write_tables();

More information about the coreboot mailing list