aboutsummaryrefslogtreecommitdiff
path: root/src/northbridge/amd/amdk8
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/northbridge/amd/amdk8
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/northbridge/amd/amdk8')
-rw-r--r--src/northbridge/amd/amdk8/f.h3
-rw-r--r--src/northbridge/amd/amdk8/pre_f.h3
-rw-r--r--src/northbridge/amd/amdk8/raminit.c3
-rw-r--r--src/northbridge/amd/amdk8/raminit_f.c3
-rw-r--r--src/northbridge/amd/amdk8/raminit_f_dqs.c6
5 files changed, 9 insertions, 9 deletions
diff --git a/src/northbridge/amd/amdk8/f.h b/src/northbridge/amd/amdk8/f.h
index 4f958c54c2..af4658dd8e 100644
--- a/src/northbridge/amd/amdk8/f.h
+++ b/src/northbridge/amd/amdk8/f.h
@@ -519,7 +519,8 @@ struct sys_info {
} __attribute__((packed));
#ifdef __PRE_RAM__
-extern struct sys_info sysinfo_car;
+#include <arch/early_variables.h>
+struct sys_info sysinfo_car CAR_GLOBAL;
#endif
#include <reset.h>
diff --git a/src/northbridge/amd/amdk8/pre_f.h b/src/northbridge/amd/amdk8/pre_f.h
index 0e0f9f4e32..c413b5b003 100644
--- a/src/northbridge/amd/amdk8/pre_f.h
+++ b/src/northbridge/amd/amdk8/pre_f.h
@@ -263,7 +263,8 @@ struct sys_info {
} __attribute__((packed));
#ifdef __PRE_RAM__
-extern struct sys_info sysinfo_car;
+#include <arch/early_variables.h>
+struct sys_info sysinfo_car CAR_GLOBAL;
#endif
#endif /* AMDK8_PRE_F_H */
diff --git a/src/northbridge/amd/amdk8/raminit.c b/src/northbridge/amd/amdk8/raminit.c
index c58abb15ae..fbcb8879f8 100644
--- a/src/northbridge/amd/amdk8/raminit.c
+++ b/src/northbridge/amd/amdk8/raminit.c
@@ -17,9 +17,6 @@
#include "option_table.h"
#endif
-#include <arch/early_variables.h>
-struct sys_info sysinfo_car CAR_GLOBAL;
-
void setup_resource_map(const unsigned int *register_values, int max)
{
int i;
diff --git a/src/northbridge/amd/amdk8/raminit_f.c b/src/northbridge/amd/amdk8/raminit_f.c
index 1c1a6ea142..a116d7683b 100644
--- a/src/northbridge/amd/amdk8/raminit_f.c
+++ b/src/northbridge/amd/amdk8/raminit_f.c
@@ -42,9 +42,6 @@
#endif
-#include <arch/early_variables.h>
-struct sys_info sysinfo_car CAR_GLOBAL;
-
#include "f_pci.c"
diff --git a/src/northbridge/amd/amdk8/raminit_f_dqs.c b/src/northbridge/amd/amdk8/raminit_f_dqs.c
index ee3b609956..609cddf913 100644
--- a/src/northbridge/amd/amdk8/raminit_f_dqs.c
+++ b/src/northbridge/amd/amdk8/raminit_f_dqs.c
@@ -2074,7 +2074,11 @@ static void train_ram(unsigned nodeid, struct sys_info *sysinfo, struct sys_info
static inline void train_ram_on_node(unsigned nodeid, unsigned coreid, struct sys_info *sysinfo, unsigned retcall)
{
if(coreid) return; // only do it on core0
- struct sys_info *sysinfox = (void *)((CONFIG_RAMTOP) - sizeof(*sysinfox));
+ struct sys_info *sysinfox;
+ uintptr_t migrated_base = CONFIG_RAMTOP - car_data_size();
+
+ sysinfox = (void *)(migrated_base + car_object_offset(&sysinfo_car));
+
wait_till_sysinfo_in_ram(); // use pci to get it
if(sysinfox->mem_trained[nodeid] == 0x80) {