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>
This commit is contained in:
parent
946d3f9309
commit
76ab2b7a8a
|
@ -71,7 +71,17 @@
|
||||||
* cbmem console. This is useful for clearing this area on a per-stage
|
* 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. */
|
* basis when more than one stage uses cache-as-ram for CAR_GLOBALs. */
|
||||||
_car_global_start = .;
|
_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);
|
*(.car.global_data);
|
||||||
|
#endif
|
||||||
. = ALIGN(ARCH_POINTER_ALIGN_SIZE);
|
. = ALIGN(ARCH_POINTER_ALIGN_SIZE);
|
||||||
_car_global_end = .;
|
_car_global_end = .;
|
||||||
_car_relocatable_data_end = .;
|
_car_relocatable_data_end = .;
|
||||||
|
@ -88,10 +98,15 @@
|
||||||
.illegal_globals . : {
|
.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)
|
||||||
*(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)
|
||||||
*(.bss.*)
|
*(.bss.*)
|
||||||
*(.sbss)
|
*(.sbss)
|
||||||
*(.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");
|
_bogus = ASSERT((CONFIG_DCACHE_RAM_SIZE == 0) || (SIZEOF(.car.data) <= CONFIG_DCACHE_RAM_SIZE), "Cache as RAM area is too full");
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <rules.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(".section .car.global_data,\"w\",@nobits");
|
||||||
asm(".previous");
|
asm(".previous");
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
|
@ -34,7 +34,7 @@ asm(".previous");
|
||||||
* accessed unconditionally because cbmem is never initialized until romstage
|
* accessed unconditionally because cbmem is never initialized until romstage
|
||||||
* when dram comes up.
|
* 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)
|
static inline void *car_get_var_ptr(void *var)
|
||||||
{
|
{
|
||||||
return var;
|
return var;
|
||||||
|
|
Loading…
Reference in New Issue