[coreboot-gerrit] Patch set updated for coreboot: 24e8ff3 CBMEM: Always select CAR_MIGRATION

Kyösti Mälkki (kyosti.malkki@gmail.com) gerrit at coreboot.org
Tue Sep 10 13:37:31 CEST 2013


Kyösti Mälkki (kyosti.malkki at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3916

-gerrit

commit 24e8ff3e46870425e22108a7bb802e98574f776e
Author: Kyösti Mälkki <kyosti.malkki at gmail.com>
Date:   Mon Sep 9 19:52:51 2013 +0300

    CBMEM: Always select CAR_MIGRATION
    
    If romstage does not make cbmem_initialize() call, linker should
    optimize the code for CAR migration away.
    
    This simplifies design of CBMEM console by a considerable amount.
    As console buffer is now migrated within cbmem_initialize() call there
    is no longer need for cbmemc_reinit() call made at end of romstage.
    
    Change-Id: I8675ecaafb641fa02675e9ba3f374caa8e240f1d
    Signed-off-by: Kyösti Mälkki <kyosti.malkki at gmail.com>
---
 src/arch/x86/boot/cbmem.c                      |  2 +-
 src/cpu/intel/haswell/Kconfig                  |  1 -
 src/cpu/x86/Kconfig                            |  9 ------
 src/cpu/x86/Makefile.inc                       |  2 +-
 src/include/cpu/x86/car.h                      |  2 +-
 src/lib/cbmem_console.c                        | 42 ++------------------------
 src/lib/usbdebug.c                             |  4 +--
 src/mainboard/emulation/qemu-i440fx/romstage.c |  4 ---
 src/mainboard/emulation/qemu-q35/romstage.c    |  4 ---
 src/mainboard/google/butterfly/romstage.c      |  4 ---
 src/mainboard/google/link/romstage.c           |  4 ---
 src/mainboard/google/parrot/romstage.c         |  4 ---
 src/mainboard/google/stout/romstage.c          |  4 ---
 src/mainboard/intel/emeraldlake2/romstage.c    |  4 ---
 src/mainboard/kontron/ktqm77/romstage.c        |  4 ---
 src/mainboard/lenovo/t60/romstage.c            |  4 ---
 src/mainboard/lenovo/x60/romstage.c            |  4 ---
 src/mainboard/samsung/lumpy/romstage.c         |  4 ---
 src/mainboard/samsung/stumpy/romstage.c        |  4 ---
 19 files changed, 7 insertions(+), 103 deletions(-)

diff --git a/src/arch/x86/boot/cbmem.c b/src/arch/x86/boot/cbmem.c
index 991a3e6..58ccbca 100644
--- a/src/arch/x86/boot/cbmem.c
+++ b/src/arch/x86/boot/cbmem.c
@@ -47,7 +47,7 @@ void __attribute__((weak)) backup_top_of_ram(uint64_t ramtop)
 
 /* This is for compatibility with old boards only. Any new chipset and board
  * must implement get_top_of_ram() for both romstage and ramstage to support
- * features like CAR_MIGRATION and CBMEM_CONSOLE.
+ * early features like COLLECT_TIMESTAMPS and CBMEM_CONSOLE.
  */
 void set_top_of_ram(uint64_t ramtop)
 {
diff --git a/src/cpu/intel/haswell/Kconfig b/src/cpu/intel/haswell/Kconfig
index c352e36..7b6fc43 100644
--- a/src/cpu/intel/haswell/Kconfig
+++ b/src/cpu/intel/haswell/Kconfig
@@ -18,7 +18,6 @@ config CPU_SPECIFIC_OPTIONS
 	#select AP_IN_SIPI_WAIT
 	select TSC_SYNC_MFENCE
 	select CPU_INTEL_FIRMWARE_INTERFACE_TABLE
-	select CAR_MIGRATION
 
 config BOOTBLOCK_CPU_INIT
 	string
diff --git a/src/cpu/x86/Kconfig b/src/cpu/x86/Kconfig
index c10dd15..c64a8e4 100644
--- a/src/cpu/x86/Kconfig
+++ b/src/cpu/x86/Kconfig
@@ -115,12 +115,3 @@ config X86_AMD_FIXED_MTRRS
 	help
 	  This option informs the MTRR code to use the RdMem and WrMem fields
 	  in the fixed MTRR MSRs.
-
-config CAR_MIGRATION
-	def_bool n
-	depends on DYNAMIC_CBMEM || EARLY_CBMEM_INIT
-	help
-	  Migrate the cache-as-ram variables to CBMEM once CBMEM is set up
-	  in romstage. This option is only needed if one will be doing more
-	  work in romstage after the cache-as-ram is torn down aside from
-	  loading ramstage.
diff --git a/src/cpu/x86/Makefile.inc b/src/cpu/x86/Makefile.inc
index fe8648c..311dcc1 100644
--- a/src/cpu/x86/Makefile.inc
+++ b/src/cpu/x86/Makefile.inc
@@ -1 +1 @@
-romstage-$(CONFIG_CAR_MIGRATION) += car.c
+romstage-$(CONFIG_CACHE_AS_RAM) += car.c
diff --git a/src/include/cpu/x86/car.h b/src/include/cpu/x86/car.h
index 7b5cedf..5fc11f9 100644
--- a/src/include/cpu/x86/car.h
+++ b/src/include/cpu/x86/car.h
@@ -28,7 +28,7 @@
 #define CAR_CBMEM
 #endif
 
-#if CONFIG_CAR_MIGRATION && defined(__PRE_RAM__)
+#if defined(__PRE_RAM__)
 #define CAR_MIGRATE_ATTR __attribute__ ((used,section (".car.migrate")))
 
 /* Call migrate_fn_() when CAR globals are migrated. */
diff --git a/src/lib/cbmem_console.c b/src/lib/cbmem_console.c
index 1b58402..c9e9d70 100644
--- a/src/lib/cbmem_console.c
+++ b/src/lib/cbmem_console.c
@@ -45,17 +45,6 @@ static struct cbmem_console *cbmem_console_p CAR_GLOBAL;
 
 static struct cbmem_console car_cbmem_console CAR_CBMEM;
 
-/*
- * Once DRAM is initialized and the cache as ram mode is disabled, while still
- * running from ROM, the console buffer in the cache as RAM area becomes
- * unavailable.
- *
- * By this time the console log buffer is already available in
- * CBMEM. The location at 0x600 is used as the redirect pointer allowing to
- * find out where the actual console log buffer is.
- */
-#define CBMEM_CONSOLE_REDIRECT (*((struct cbmem_console **)0x600))
-
 #else
 
 /*
@@ -69,30 +58,12 @@ static u8 static_console[40000];
 
 static inline struct cbmem_console *current_console(void)
 {
-#if CONFIG_CAR_MIGRATION || !defined(__PRE_RAM__)
-	return car_get_var(cbmem_console_p);
-#else
-	/*
-	 * This check allows to tell if the cache as RAM mode has been exited
-	 * or not. If it has been exited, the real memory is being used
-	 * (resulting in the variable on the stack located below
-	 * DCACHE_RAM_BASE), use the redirect pointer to find out where the
-	 * actual console buffer is.
-	 */
-	if ((uintptr_t)__builtin_frame_address(0) <
-	    (uintptr_t)CONFIG_DCACHE_RAM_BASE)
-		return CBMEM_CONSOLE_REDIRECT;
 	return car_get_var(cbmem_console_p);
-#endif /* CONFIG_CAR_MIGRATION */
 }
 
 static inline void current_console_set(struct cbmem_console *new_console_p)
 {
-#if CONFIG_CAR_MIGRATION || !defined(__PRE_RAM__)
 	car_set_var(cbmem_console_p, new_console_p);
-#else
-	CBMEM_CONSOLE_REDIRECT = new_console_p;
-#endif
 }
 
 static inline void init_console_ptr(void *storage, u32 total_space)
@@ -193,7 +164,7 @@ static void copy_console_buffer(struct cbmem_console *new_cons_p)
 	new_cons_p->buffer_cursor = cursor;
 }
 
-static void cbmemc_reinit_(void)
+void cbmemc_reinit(void)
 {
 	struct cbmem_console *cbm_cons_p;
 
@@ -221,12 +192,5 @@ static void cbmemc_reinit_(void)
 	current_console_set(cbm_cons_p);
 }
 
-void cbmemc_reinit(void)
-{
-#if !CONFIG_CAR_MIGRATION || !defined(__PRE_RAM__)
-	cbmemc_reinit_();
-#endif
-}
-
-/* Call cbmemc_reinit_() at CAR migration time. */
-CAR_MIGRATE(cbmemc_reinit_)
+/* Call cbmemc_reinit() at CAR migration time. */
+CAR_MIGRATE(cbmemc_reinit)
diff --git a/src/lib/usbdebug.c b/src/lib/usbdebug.c
index 7a8402d..f44a7d4 100644
--- a/src/lib/usbdebug.c
+++ b/src/lib/usbdebug.c
@@ -869,7 +869,6 @@ void pci_ehci_read_resources(struct device *dev)
 }
 #endif
 
-#if CONFIG_CAR_MIGRATION
 #if !defined(__PRE_RAM__) && !defined(__SMM__)
 static int get_usbdebug_from_cbmem(struct ehci_debug_info *info)
 {
@@ -899,7 +898,6 @@ static void migrate_ehci_debug(void)
 }
 CAR_MIGRATE(migrate_ehci_debug);
 #endif
-#endif /* CONFIG_CAR_MIGRATION */
 
 unsigned long pci_ehci_base_regs(pci_devfn_t sdev)
 {
@@ -931,7 +929,7 @@ int usbdebug_init(void)
 {
 	struct ehci_debug_info *dbg_info = dbgp_ehci_info();
 
-#if CONFIG_CAR_MIGRATION && !defined(__PRE_RAM__) && !defined(__SMM__)
+#if !defined(__PRE_RAM__) && !defined(__SMM__)
 	if (!get_usbdebug_from_cbmem(dbg_info))
 		return 0;
 #endif
diff --git a/src/mainboard/emulation/qemu-i440fx/romstage.c b/src/mainboard/emulation/qemu-i440fx/romstage.c
index 413f745..5d7f309 100644
--- a/src/mainboard/emulation/qemu-i440fx/romstage.c
+++ b/src/mainboard/emulation/qemu-i440fx/romstage.c
@@ -53,9 +53,5 @@ void main(unsigned long bist)
 	timestamp_init(rdtsc());
 	timestamp_add_now(TS_START_ROMSTAGE);
 #endif
-#if CONFIG_CONSOLE_CBMEM
-	/* Keep this the last thing this function does. */
-	cbmemc_reinit();
-#endif
 
 }
diff --git a/src/mainboard/emulation/qemu-q35/romstage.c b/src/mainboard/emulation/qemu-q35/romstage.c
index e9cd801..7584a58 100644
--- a/src/mainboard/emulation/qemu-q35/romstage.c
+++ b/src/mainboard/emulation/qemu-q35/romstage.c
@@ -55,9 +55,5 @@ void main(unsigned long bist)
 	timestamp_init(rdtsc());
 	timestamp_add_now(TS_START_ROMSTAGE);
 #endif
-#if CONFIG_CONSOLE_CBMEM
-	/* Keep this the last thing this function does. */
-	cbmemc_reinit();
-#endif
 
 }
diff --git a/src/mainboard/google/butterfly/romstage.c b/src/mainboard/google/butterfly/romstage.c
index 5e2b713..a43eda3 100644
--- a/src/mainboard/google/butterfly/romstage.c
+++ b/src/mainboard/google/butterfly/romstage.c
@@ -294,8 +294,4 @@ void main(unsigned long bist)
 	timestamp_add(TS_AFTER_INITRAM, after_dram_time );
 	timestamp_add_now(TS_END_ROMSTAGE);
 #endif
-#if CONFIG_CONSOLE_CBMEM
-	/* Keep this the last thing this function does. */
-	cbmemc_reinit();
-#endif
 }
diff --git a/src/mainboard/google/link/romstage.c b/src/mainboard/google/link/romstage.c
index f20a722..59787cc0 100644
--- a/src/mainboard/google/link/romstage.c
+++ b/src/mainboard/google/link/romstage.c
@@ -337,8 +337,4 @@ void main(unsigned long bist)
 	timestamp_add(TS_AFTER_INITRAM, after_dram_time );
 	timestamp_add_now(TS_END_ROMSTAGE);
 #endif
-#if CONFIG_CONSOLE_CBMEM
-	/* Keep this the last thing this function does. */
-	cbmemc_reinit();
-#endif
 }
diff --git a/src/mainboard/google/parrot/romstage.c b/src/mainboard/google/parrot/romstage.c
index 9968226..9688358 100644
--- a/src/mainboard/google/parrot/romstage.c
+++ b/src/mainboard/google/parrot/romstage.c
@@ -295,8 +295,4 @@ void main(unsigned long bist)
 	timestamp_add(TS_AFTER_INITRAM, after_dram_time );
 	timestamp_add_now(TS_END_ROMSTAGE);
 #endif
-#if CONFIG_CONSOLE_CBMEM
-	/* Keep this the last thing this function does. */
-	cbmemc_reinit();
-#endif
 }
diff --git a/src/mainboard/google/stout/romstage.c b/src/mainboard/google/stout/romstage.c
index 48113f3..f9374c9 100644
--- a/src/mainboard/google/stout/romstage.c
+++ b/src/mainboard/google/stout/romstage.c
@@ -347,8 +347,4 @@ void main(unsigned long bist)
 	timestamp_add(TS_AFTER_INITRAM, after_dram_time );
 	timestamp_add_now(TS_END_ROMSTAGE);
 #endif
-#if CONFIG_CONSOLE_CBMEM
-	/* Keep this the last thing this function does. */
-	cbmemc_reinit();
-#endif
 }
diff --git a/src/mainboard/intel/emeraldlake2/romstage.c b/src/mainboard/intel/emeraldlake2/romstage.c
index 88bcced..ef43606 100644
--- a/src/mainboard/intel/emeraldlake2/romstage.c
+++ b/src/mainboard/intel/emeraldlake2/romstage.c
@@ -349,8 +349,4 @@ void main(unsigned long bist)
 	timestamp_add(TS_AFTER_INITRAM, after_dram_time );
 	timestamp_add_now(TS_END_ROMSTAGE);
 #endif
-#if CONFIG_CONSOLE_CBMEM
-	/* Keep this the last thing this function does. */
-	cbmemc_reinit();
-#endif
 }
diff --git a/src/mainboard/kontron/ktqm77/romstage.c b/src/mainboard/kontron/ktqm77/romstage.c
index 79fafe0..5fa824b 100644
--- a/src/mainboard/kontron/ktqm77/romstage.c
+++ b/src/mainboard/kontron/ktqm77/romstage.c
@@ -343,8 +343,4 @@ void main(unsigned long bist)
 	timestamp_add(TS_AFTER_INITRAM, after_dram_time );
 	timestamp_add_now(TS_END_ROMSTAGE);
 #endif
-#if CONFIG_CONSOLE_CBMEM
-	/* Keep this the last thing this function does. */
-	cbmemc_reinit();
-#endif
 }
diff --git a/src/mainboard/lenovo/t60/romstage.c b/src/mainboard/lenovo/t60/romstage.c
index 5bb7ac1..8740faf 100644
--- a/src/mainboard/lenovo/t60/romstage.c
+++ b/src/mainboard/lenovo/t60/romstage.c
@@ -365,8 +365,4 @@ void main(unsigned long bist)
 	timestamp_add_now(TS_END_ROMSTAGE);
 #endif
 
-#if CONFIG_CONSOLE_CBMEM
-	/* Keep this the last thing this function does. */
-	cbmemc_reinit();
-#endif
 }
diff --git a/src/mainboard/lenovo/x60/romstage.c b/src/mainboard/lenovo/x60/romstage.c
index 4d0eac7..2510c20 100644
--- a/src/mainboard/lenovo/x60/romstage.c
+++ b/src/mainboard/lenovo/x60/romstage.c
@@ -369,8 +369,4 @@ void main(unsigned long bist)
 	timestamp_add_now(TS_END_ROMSTAGE);
 #endif
 
-#if CONFIG_CONSOLE_CBMEM
-	/* Keep this the last thing this function does. */
-	cbmemc_reinit();
-#endif
 }
diff --git a/src/mainboard/samsung/lumpy/romstage.c b/src/mainboard/samsung/lumpy/romstage.c
index 449a81c..f52a174 100644
--- a/src/mainboard/samsung/lumpy/romstage.c
+++ b/src/mainboard/samsung/lumpy/romstage.c
@@ -368,8 +368,4 @@ void main(unsigned long bist)
 	timestamp_add(TS_AFTER_INITRAM, after_dram_time );
 	timestamp_add_now(TS_END_ROMSTAGE);
 #endif
-#if CONFIG_CONSOLE_CBMEM
-	/* Keep this the last thing this function does. */
-	cbmemc_reinit();
-#endif
 }
diff --git a/src/mainboard/samsung/stumpy/romstage.c b/src/mainboard/samsung/stumpy/romstage.c
index daa8d55..98edc8c 100644
--- a/src/mainboard/samsung/stumpy/romstage.c
+++ b/src/mainboard/samsung/stumpy/romstage.c
@@ -375,8 +375,4 @@ void main(unsigned long bist)
 	timestamp_add(TS_AFTER_INITRAM, after_dram_time );
 	timestamp_add_now(TS_END_ROMSTAGE);
 #endif
-#if CONFIG_CONSOLE_CBMEM
-	/* Keep this the last thing this function does. */
-	cbmemc_reinit();
-#endif
 }



More information about the coreboot-gerrit mailing list