x86: simplify early_variables.h header

The CAR macros and the associated functions are only employed
under the following conditions:
- chipsets which have CAR
- compilation during romstage
Therefore clean up the build-time conditionals to use those 2
constructs.

Change-Id: I2b923feeb68f2b964c5ac57e11391313d9c8ffc5
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/8634
Tested-by: build bot (Jenkins)
Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
This commit is contained in:
Aaron Durbin 2015-03-09 15:41:16 -05:00 committed by Aaron Durbin
parent db9d169ddb
commit 1a7da5c3ee
1 changed files with 5 additions and 11 deletions

View File

@ -20,7 +20,7 @@
#ifndef ARCH_EARLY_VARIABLES_H
#define ARCH_EARLY_VARIABLES_H
#ifdef __PRE_RAM__
#if defined(__PRE_RAM__) && IS_ENABLED(CONFIG_CACHE_AS_RAM)
asm(".section .car.global_data,\"w\",@nobits");
asm(".previous");
#ifdef __clang__
@ -28,11 +28,7 @@ asm(".previous");
#else
#define CAR_GLOBAL __attribute__((used,section(".car.global_data#")))
#endif /* __clang__ */
#else
#define CAR_GLOBAL
#endif
#if defined(__PRE_RAM__)
#define CAR_MIGRATE_ATTR __attribute__ ((used,section (".car.migrate")))
/* Call migrate_fn_() when CAR globals are migrated. */
@ -54,18 +50,16 @@ void *car_sync_var_ptr(void *var);
#define car_set_var(var, val) \
do { car_get_var(var) = (val); } while(0)
/* Migrate the CAR variables to memory. */
void car_migrate_variables(void);
#else
#define CAR_GLOBAL
#define CAR_MIGRATE(migrate_fn_)
static inline void *car_get_var_ptr(void *var) { return var; }
#define car_get_var(var) (var)
#define car_sync_var(var) (var)
#define car_set_var(var, val) do { (var) = (val); } while (0)
#endif
#if defined(__PRE_RAM__) && IS_ENABLED(CONFIG_CACHE_AS_RAM)
/* Migrate the CAR variables to memory. */
void car_migrate_variables(void);
#else
static inline void car_migrate_variables(void) { }
#endif