summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2018-10-30 12:15:10 -0600
committerAaron Durbin <adurbin@chromium.org>2018-11-01 21:33:03 +0000
commit76ab2b7a8a62e80b0ccdad60f15113fa6d73187f (patch)
treec797159b96b0dc2bef96a365bae8d0b5089e4749
parent946d3f9309c1d6d3d5fa057420ceab00b1ed89d1 (diff)
arch/x86: allow global .bss objects without CAR_GLOBAL
For platforms utilizing CONFIG_NO_CAR_GLOBAL_MIGRATION there's no need to automatically migrate globals. Because of this it's possible to automatically allow for uninitialized global variables which reside in the .bss section without needing to decorate those objects with CAR_GLOBAL. Change-Id: Icae806fecd936ed2ebf0c13d30ffa07c77a95150 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/29359 Reviewed-by: Furquan Shaikh <furquan@google.com> Reviewed-by: Nico Huber <nico.h@gmx.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r--src/arch/x86/car.ld15
-rw-r--r--src/arch/x86/include/arch/early_variables.h4
2 files changed, 17 insertions, 2 deletions
diff --git a/src/arch/x86/car.ld b/src/arch/x86/car.ld
index 7122776068..33fb5c926c 100644
--- a/src/arch/x86/car.ld
+++ b/src/arch/x86/car.ld
@@ -71,7 +71,17 @@
* cbmem console. This is useful for clearing this area on a per-stage
* basis when more than one stage uses cache-as-ram for CAR_GLOBALs. */
_car_global_start = .;
+#if IS_ENABLED(CONFIG_NO_CAR_GLOBAL_MIGRATION)
+ /* Allow global unitialized variables when CAR_GLOBALs are not used. */
+ *(.bss)
+ *(.bss.*)
+ *(.sbss)
+ *(.sbss.*)
+#else
+ /* .car.global_data objects only around when
+ * !CONFIG_NO_CAR_GLOBAL_MIGRATION is employed. */
*(.car.global_data);
+#endif
. = ALIGN(ARCH_POINTER_ALIGN_SIZE);
_car_global_end = .;
_car_relocatable_data_end = .;
@@ -88,10 +98,15 @@
.illegal_globals . : {
*(EXCLUDE_FILE ("*/libagesa.*.a:" "*/romstage*/buildOpts.o" "*/romstage*/agesawrapper.o" "*/vendorcode/amd/agesa/*" "*/vendorcode/amd/cimx/*") .data)
*(EXCLUDE_FILE ("*/libagesa.*.a:" "*/romstage*/buildOpts.o" "*/romstage*/agesawrapper.o" "*/vendorcode/amd/agesa/*" "*/vendorcode/amd/cimx/*") .data.*)
+#if !IS_ENABLED(CONFIG_NO_CAR_GLOBAL_MIGRATION)
*(.bss)
*(.bss.*)
*(.sbss)
*(.sbss.*)
+#else
+ /* In case something sneaks through when it shouldn't. */
+ *(.car.global_data);
+#endif
}
_bogus = ASSERT((CONFIG_DCACHE_RAM_SIZE == 0) || (SIZEOF(.car.data) <= CONFIG_DCACHE_RAM_SIZE), "Cache as RAM area is too full");
diff --git a/src/arch/x86/include/arch/early_variables.h b/src/arch/x86/include/arch/early_variables.h
index 1b6810de86..d215e47bc0 100644
--- a/src/arch/x86/include/arch/early_variables.h
+++ b/src/arch/x86/include/arch/early_variables.h
@@ -20,7 +20,7 @@
#include <stdlib.h>
#include <rules.h>
-#if ENV_CACHE_AS_RAM
+#if ENV_CACHE_AS_RAM && !IS_ENABLED(CONFIG_NO_CAR_GLOBAL_MIGRATION)
asm(".section .car.global_data,\"w\",@nobits");
asm(".previous");
#ifdef __clang__
@@ -34,7 +34,7 @@ asm(".previous");
* accessed unconditionally because cbmem is never initialized until romstage
* when dram comes up.
*/
-#if ENV_VERSTAGE || ENV_BOOTBLOCK || IS_ENABLED(CONFIG_NO_CAR_GLOBAL_MIGRATION)
+#if ENV_VERSTAGE || ENV_BOOTBLOCK
static inline void *car_get_var_ptr(void *var)
{
return var;