diff options
Diffstat (limited to 'src/arch/x86/include/arch/early_variables.h')
-rw-r--r-- | src/arch/x86/include/arch/early_variables.h | 54 |
1 files changed, 16 insertions, 38 deletions
diff --git a/src/arch/x86/include/arch/early_variables.h b/src/arch/x86/include/arch/early_variables.h index 4860e49b11..3910a820da 100644 --- a/src/arch/x86/include/arch/early_variables.h +++ b/src/arch/x86/include/arch/early_variables.h @@ -20,7 +20,8 @@ #include <commonlib/helpers.h> #include <stdlib.h> -#if ENV_CACHE_AS_RAM && CONFIG(CAR_GLOBAL_MIGRATION) +#if ENV_ROMSTAGE && CONFIG(CAR_GLOBAL_MIGRATION) + asm(".section .car.global_data,\"w\",@nobits"); asm(".previous"); #ifdef __clang__ @@ -29,27 +30,6 @@ asm(".previous"); #define CAR_GLOBAL __attribute__((used, section(".car.global_data#"))) #endif /* __clang__ */ -/* - * In stages that use CAR (verstage, C bootblock) all CAR_GLOBAL variables are - * accessed unconditionally because cbmem is never initialized until romstage - * when dram comes up. - */ -#if !ENV_ROMSTAGE -static inline void *car_get_var_ptr(void *var) -{ - return var; -} - -static inline void *car_sync_var_ptr(void *var) -{ - return var; -} - -static inline int car_active(void) -{ - return 1; -} -#else /* Get the correct pointer for the CAR global variable. */ void *car_get_var_ptr(void *var); @@ -58,7 +38,6 @@ void *car_sync_var_ptr(void *var); /* Return 1 when currently running with globals in Cache-as-RAM, 0 otherwise. */ int car_active(void); -#endif /* !ENV_ROMSTAGE */ /* Get and set a primitive type global variable. */ #define car_get_var(var) \ @@ -81,26 +60,25 @@ static inline size_t car_object_offset(void *ptr) #else /* - * We might end up here if: - * 1. ENV_CACHE_AS_RAM is not set for the stage or - * 2. ENV_CACHE_AS_RAM is set for the stage but CONFIG_CAR_GLOBAL_MIGRATION - * is not set. In this case, there is no need to migrate CAR global - * variables. But, since we might still be running out of CAR, car_active needs - * to return 1 if ENV_CACHE_AS_RAM is set. + * For all stages other than romstage, all CAR_GLOBAL variables are accessed + * unconditionally as there is no migration of symbols. */ #define CAR_GLOBAL -static inline void *car_get_var_ptr(void *var) { return var; } - -#if ENV_CACHE_AS_RAM -static inline int car_active(void) { return 1; } -#else -static inline int car_active(void) { return 0; } -#endif /* ENV_CACHE_AS_RAM */ - #define car_get_var(var) (var) #define car_sync_var(var) (var) #define car_set_var(var, val) (var) = (val) -#endif /* ENV_CACHE_AS_RAM && CONFIG(CAR_GLOBAL_MIGRATION) */ + +static inline void *car_get_var_ptr(void *var) +{ + return var; +} + +static inline int car_active(void) +{ + return ENV_CACHE_AS_RAM; +} + +#endif #endif /* ARCH_EARLY_VARIABLES_H */ |