From a92851939cffcfa11d3abf80cc910a43bb48e6b0 Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Thu, 18 May 2017 14:44:08 -0700 Subject: arch/x86: Add function to determine if we're currently running from CAR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds a simple function that can be used to check if CAR_GLOBALs are currently being read from CAR or from DRAM. Change-Id: Ib7ad0896a691ef6e89e622b985417fedc43579c1 Signed-off-by: Julius Werner Reviewed-on: https://review.coreboot.org/19787 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin Reviewed-by: Philippe Mathieu-Daudé --- src/arch/x86/include/arch/early_variables.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/arch') diff --git a/src/arch/x86/include/arch/early_variables.h b/src/arch/x86/include/arch/early_variables.h index d0cfda75aa..2c6c539654 100644 --- a/src/arch/x86/include/arch/early_variables.h +++ b/src/arch/x86/include/arch/early_variables.h @@ -44,12 +44,20 @@ 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); /* Get and update a CAR_GLOBAL pointing elsewhere in car.global_data*/ 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_VERSTAGE */ /* Get and set a primitive type global variable. */ @@ -73,6 +81,7 @@ static inline size_t car_object_offset(void *ptr) #else #define CAR_GLOBAL static inline void *car_get_var_ptr(void *var) { return var; } +static inline int car_active(void) { return 0; } #define car_get_var(var) (var) #define car_sync_var(var) (var) #define car_set_var(var, val) (var) = (val) -- cgit v1.2.3