summaryrefslogtreecommitdiff
path: root/src/cpu
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2015-07-16 16:07:02 -0500
committerAaron Durbin <adurbin@chromium.org>2015-08-13 16:10:17 +0200
commit0dc7354760e889074472ef17652c7f270f3aa529 (patch)
treee909b28b3789b569b8cbe62ec10dbf167474e070 /src/cpu
parentdb01ddfd49ee6177c738f410496574105e7e5e44 (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/cpu')
-rw-r--r--src/cpu/amd/car/post_cache_as_ram.c12
-rw-r--r--src/cpu/x86/car.c9
2 files changed, 5 insertions, 16 deletions
diff --git a/src/cpu/amd/car/post_cache_as_ram.c b/src/cpu/amd/car/post_cache_as_ram.c
index 6c320906ae..96df3e7ff8 100644
--- a/src/cpu/amd/car/post_cache_as_ram.c
+++ b/src/cpu/amd/car/post_cache_as_ram.c
@@ -3,6 +3,7 @@
*/
#include <string.h>
#include <arch/stages.h>
+#include <arch/early_variables.h>
#include <cpu/x86/mtrr.h>
#include <cpu/amd/mtrr.h>
#include <cpu/amd/car.h>
@@ -22,18 +23,9 @@
#define print_car_debug(x)
#endif
-extern char _car_data_start[];
-extern char _car_data_end[];
-
-static size_t car_data_size(void)
-{
- size_t car_size = &_car_data_end[0] - &_car_data_start[0];
- return ALIGN(car_size, 64);
-}
-
static size_t backup_size(void)
{
- size_t car_size = &_car_data_end[0] - &_car_data_start[0];
+ size_t car_size = car_data_size();
return ALIGN(car_size + 1024, 1024);
}
diff --git a/src/cpu/x86/car.c b/src/cpu/x86/car.c
index b4345eae60..cdf7cfcb37 100644
--- a/src/cpu/x86/car.c
+++ b/src/cpu/x86/car.c
@@ -30,9 +30,6 @@ typedef void (* const car_migration_func_t)(void);
extern car_migration_func_t _car_migrate_start;
-extern char _car_data_start[];
-extern char _car_data_end[];
-
/*
* The car_migrated global variable determines if the cache-as-ram space has
* been migrated to real RAM. It does this by assuming the following things:
@@ -117,20 +114,20 @@ void *car_sync_var_ptr(void *var)
static void do_car_migrate_variables(void)
{
void *migrated_base;
- size_t car_data_size = &_car_data_end[0] - &_car_data_start[0];
+ size_t car_size = car_data_size();
/* Check if already migrated. */
if (car_migrated)
return;
- migrated_base = cbmem_add(CBMEM_ID_CAR_GLOBALS, car_data_size);
+ migrated_base = cbmem_add(CBMEM_ID_CAR_GLOBALS, car_size);
if (migrated_base == NULL) {
printk(BIOS_ERR, "Could not migrate CAR data!\n");
return;
}
- memcpy(migrated_base, &_car_data_start[0], car_data_size);
+ memcpy(migrated_base, &_car_data_start[0], car_size);
/* Mark that the data has been moved. */
car_migrated = ~0;