diff options
author | Aaron Durbin <adurbin@chromium.org> | 2015-07-16 16:07:02 -0500 |
---|---|---|
committer | Aaron Durbin <adurbin@chromium.org> | 2015-08-13 16:10:17 +0200 |
commit | 0dc7354760e889074472ef17652c7f270f3aa529 (patch) | |
tree | e909b28b3789b569b8cbe62ec10dbf167474e070 /src/arch/x86/include | |
parent | db01ddfd49ee6177c738f410496574105e7e5e44 (diff) |
amd: raminit sysinfo offset fix
The sysinfo object within the k8 ram init is used
to communicate progess/status from all the nodes in the
system. However, the code was assuming where the sysinfo
object lived in cache-as-ram. The layout of cache-as-ram
is dynamic so one needs to do the lookup of the correct
address at runtime. The way the amd code is compiled
by #include'ing .c files makes the solution a little
more complex in that some cache-as-ram support code
needed to be refactored.
Change-Id: I6500fa7b005dc082c4c0b3382ee2c3a138d9ac31
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/10961
Tested-by: build bot (Jenkins)
Tested-by: Raptor Engineering Automated Test Stand <noreply@raptorengineeringinc.com>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'src/arch/x86/include')
-rw-r--r-- | src/arch/x86/include/arch/early_variables.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/arch/x86/include/arch/early_variables.h b/src/arch/x86/include/arch/early_variables.h index d9f1cd76e6..7ccb340cf4 100644 --- a/src/arch/x86/include/arch/early_variables.h +++ b/src/arch/x86/include/arch/early_variables.h @@ -20,6 +20,8 @@ #ifndef ARCH_EARLY_VARIABLES_H #define ARCH_EARLY_VARIABLES_H +#include <stdlib.h> + #if defined(__PRE_RAM__) && IS_ENABLED(CONFIG_CACHE_AS_RAM) asm(".section .car.global_data,\"w\",@nobits"); asm(".previous"); @@ -43,6 +45,20 @@ void *car_sync_var_ptr(void *var); #define car_set_var(var, val) \ do { car_get_var(var) = (val); } while(0) +extern char _car_data_start[]; +extern char _car_data_end[]; + +static inline size_t car_data_size(void) +{ + size_t car_size = &_car_data_end[0] - &_car_data_start[0]; + return ALIGN(car_size, 64); +} + +static inline size_t car_object_offset(void *ptr) +{ + return (char *)ptr - &_car_data_start[0]; +} + #else #define CAR_GLOBAL static inline void *car_get_var_ptr(void *var) { return var; } |