diff options
author | Patrick Georgi <patrick@georgi-clan.de> | 2012-11-20 18:20:56 +0100 |
---|---|---|
committer | Patrick Georgi <patrick@georgi-clan.de> | 2012-11-28 07:45:05 +0100 |
commit | bbc880eee702fc175d4a3c3e87b682c26c38f940 (patch) | |
tree | a5a55d36dc52758723f0426e3189e0084bedb348 /src/northbridge | |
parent | 721265b87ac1e70dea72c5b1ae7f5878214557cf (diff) | |
download | coreboot-bbc880eee702fc175d4a3c3e87b682c26c38f940.tar.xz |
amdk8/amdfam10: Use CAR_GLOBAL for sysinfo
This gets rid of the somewhat unstructured placement of AMD's
sysinfo structure in CAR.
We used to carve out some CAR space using a Kconfig variable,
and then put sysinfo there manually (by "virtue" of pointer magic).
Now it's a variable with the CAR_GLOBAL qualifier, and build
system magic.
For this, the following steps were done (but must happen together
since the intermediates won't build):
- Add new CAR_GLOBAL sysinfo_car
- point all sysinfo pointers to sysinfo_car instead of GLOBAL_VAR
- remove DCACHE_RAM_GLOBAL_VAR_SIZE
- from CAR setup (no need to reserve the space)
- commented out code (that was commented out for years)
- only copy sizeof(sysinfo) into RAM after ram init, where
before it copied the whole GLOBAL_VAR area.
- from Kconfig
Change-Id: I3cbcccd883ca6751326c8e32afde2eb0c91229ed
Signed-off-by: Patrick Georgi <patrick@georgi-clan.de>
Reviewed-on: http://review.coreboot.org/1887
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-by: Marc Jones <marcj303@gmail.com>
Diffstat (limited to 'src/northbridge')
-rw-r--r-- | src/northbridge/amd/amdfam10/acpi.c | 2 | ||||
-rw-r--r-- | src/northbridge/amd/amdfam10/amdfam10.h | 4 | ||||
-rw-r--r-- | src/northbridge/amd/amdfam10/northbridge.c | 4 | ||||
-rw-r--r-- | src/northbridge/amd/amdfam10/raminit_amdmct.c | 7 | ||||
-rw-r--r-- | src/northbridge/amd/amdk8/f.h | 4 | ||||
-rw-r--r-- | src/northbridge/amd/amdk8/pre_f.h | 4 | ||||
-rw-r--r-- | src/northbridge/amd/amdk8/raminit.c | 3 | ||||
-rw-r--r-- | src/northbridge/amd/amdk8/raminit_f.c | 3 | ||||
-rw-r--r-- | src/northbridge/amd/amdk8/raminit_f_dqs.c | 4 |
9 files changed, 28 insertions, 7 deletions
diff --git a/src/northbridge/amd/amdfam10/acpi.c b/src/northbridge/amd/amdfam10/acpi.c index 87c2d8c0e9..14efa9792e 100644 --- a/src/northbridge/amd/amdfam10/acpi.c +++ b/src/northbridge/amd/amdfam10/acpi.c @@ -134,7 +134,7 @@ unsigned long acpi_fill_slit(unsigned long current) /* fill the first 8 byte with that num */ /* fill the next num*num byte with distance, local is 10, 1 hop mean 20, and 2 hop with 30.... */ - struct sys_info *sysinfox = (struct sys_info *)((CONFIG_RAMTOP) - CONFIG_DCACHE_RAM_GLOBAL_VAR_SIZE); + struct sys_info *sysinfox = (struct sys_info *)((CONFIG_RAMTOP) - sizeof(*sysinfox)); u8 *ln = sysinfox->ln; diff --git a/src/northbridge/amd/amdfam10/amdfam10.h b/src/northbridge/amd/amdfam10/amdfam10.h index 712c98638e..4c06463ab9 100644 --- a/src/northbridge/amd/amdfam10/amdfam10.h +++ b/src/northbridge/amd/amdfam10/amdfam10.h @@ -1098,6 +1098,10 @@ struct sys_info { } __attribute__((packed)); +#ifdef __PRE_RAM__ +extern struct sys_info sysinfo_car; +#endif + #ifndef __PRE_RAM__ device_t get_node_pci(u32 nodeid, u32 fn); #endif diff --git a/src/northbridge/amd/amdfam10/northbridge.c b/src/northbridge/amd/amdfam10/northbridge.c index 7f05b46aa5..971051f76a 100644 --- a/src/northbridge/amd/amdfam10/northbridge.c +++ b/src/northbridge/amd/amdfam10/northbridge.c @@ -773,7 +773,7 @@ static void disable_hoist_memory(unsigned long hole_startk, int node_id) u32 hole_sizek; u32 one_DCT; - struct sys_info *sysinfox = (struct sys_info *)((CONFIG_RAMTOP) - CONFIG_DCACHE_RAM_GLOBAL_VAR_SIZE); // in RAM + struct sys_info *sysinfox = (struct sys_info *)((CONFIG_RAMTOP) - sizeof(*sysinfox)); // in RAM struct mem_info *meminfo; meminfo = &sysinfox->meminfo[node_id]; @@ -1056,7 +1056,7 @@ static void amdfam10_domain_set_resources(device_t dev) #if !CONFIG_AMDMCT #if CONFIG_HW_MEM_HOLE_SIZEK != 0 if(reset_memhole) { - struct sys_info *sysinfox = (struct sys_info *)((CONFIG_RAMTOP) - CONFIG_DCACHE_RAM_GLOBAL_VAR_SIZE); // in RAM + struct sys_info *sysinfox = (struct sys_info *)((CONFIG_RAMTOP) - sizeof(*sysinfox)); // in RAM struct mem_info *meminfo; meminfo = &sysinfox->meminfo[i]; sizek += hoist_memory(mmio_basek,i, get_one_DCT(meminfo), sysconf.nodes); diff --git a/src/northbridge/amd/amdfam10/raminit_amdmct.c b/src/northbridge/amd/amdfam10/raminit_amdmct.c index 973384bb78..2bafde617b 100644 --- a/src/northbridge/amd/amdfam10/raminit_amdmct.c +++ b/src/northbridge/amd/amdfam10/raminit_amdmct.c @@ -120,6 +120,9 @@ static void print_t(const char *strval) #endif /* DDR2 */ +#include <cpu/x86/car.h> +struct sys_info sysinfo_car CAR_GLOBAL; + int mctRead_SPD(u32 smaddr, u32 reg) { return spd_read_byte(smaddr, reg); @@ -128,7 +131,7 @@ int mctRead_SPD(u32 smaddr, u32 reg) void mctSMBhub_Init(u32 node) { - struct sys_info *sysinfo = (struct sys_info *)(CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE - CONFIG_DCACHE_RAM_GLOBAL_VAR_SIZE); + struct sys_info *sysinfo = &sysinfo_car; struct mem_controller *ctrl = &( sysinfo->ctrl[node] ); activate_spd_rom(ctrl); } @@ -137,7 +140,7 @@ void mctSMBhub_Init(u32 node) void mctGet_DIMMAddr(struct DCTStatStruc *pDCTstat, u32 node) { int j; - struct sys_info *sysinfo = (struct sys_info *)(CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE - CONFIG_DCACHE_RAM_GLOBAL_VAR_SIZE); + struct sys_info *sysinfo = &sysinfo_car; struct mem_controller *ctrl = &( sysinfo->ctrl[node] ); for(j=0;j<DIMM_SOCKETS;j++) { diff --git a/src/northbridge/amd/amdk8/f.h b/src/northbridge/amd/amdk8/f.h index 769f5980ba..bfeee0ecc5 100644 --- a/src/northbridge/amd/amdk8/f.h +++ b/src/northbridge/amd/amdk8/f.h @@ -518,6 +518,10 @@ struct sys_info { uint32_t sbbusn; } __attribute__((packed)); +#ifdef __PRE_RAM__ +extern struct sys_info sysinfo_car; +#endif + #include <reset.h> #if ((CONFIG_MEM_TRAIN_SEQ != 1) && defined(__PRE_RAM__)) || \ diff --git a/src/northbridge/amd/amdk8/pre_f.h b/src/northbridge/amd/amdk8/pre_f.h index dae2d97cd3..0e0f9f4e32 100644 --- a/src/northbridge/amd/amdk8/pre_f.h +++ b/src/northbridge/amd/amdk8/pre_f.h @@ -262,4 +262,8 @@ struct sys_info { uint32_t sbbusn; } __attribute__((packed)); +#ifdef __PRE_RAM__ +extern struct sys_info sysinfo_car; +#endif + #endif /* AMDK8_PRE_F_H */ diff --git a/src/northbridge/amd/amdk8/raminit.c b/src/northbridge/amd/amdk8/raminit.c index 7db338b42a..33a3245644 100644 --- a/src/northbridge/amd/amdk8/raminit.c +++ b/src/northbridge/amd/amdk8/raminit.c @@ -14,6 +14,9 @@ #include "option_table.h" #endif +#include <cpu/x86/car.h> +struct sys_info sysinfo_car CAR_GLOBAL; + #if (CONFIG_RAMTOP & (CONFIG_RAMTOP -1)) != 0 # error "CONFIG_RAMTOP must be a power of 2" #endif diff --git a/src/northbridge/amd/amdk8/raminit_f.c b/src/northbridge/amd/amdk8/raminit_f.c index 86c409f949..7114e95cbe 100644 --- a/src/northbridge/amd/amdk8/raminit_f.c +++ b/src/northbridge/amd/amdk8/raminit_f.c @@ -39,6 +39,9 @@ #endif +#include <cpu/x86/car.h> +struct sys_info sysinfo_car CAR_GLOBAL; + #if (CONFIG_RAMTOP & (CONFIG_RAMTOP -1)) != 0 # error "CONFIG_RAMTOP must be a power of 2" #endif diff --git a/src/northbridge/amd/amdk8/raminit_f_dqs.c b/src/northbridge/amd/amdk8/raminit_f_dqs.c index fdec120b50..870c7c9692 100644 --- a/src/northbridge/amd/amdk8/raminit_f_dqs.c +++ b/src/northbridge/amd/amdk8/raminit_f_dqs.c @@ -2089,7 +2089,7 @@ 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) - CONFIG_DCACHE_RAM_GLOBAL_VAR_SIZE); + struct sys_info *sysinfox = (void *)((CONFIG_RAMTOP) - sizeof(*sysinfox)); wait_till_sysinfo_in_ram(); // use pci to get it if(sysinfox->mem_trained[nodeid] == 0x80) { @@ -2100,7 +2100,7 @@ static inline void train_ram_on_node(unsigned nodeid, unsigned coreid, struct sy sysinfo->mem_trained[nodeid] = sysinfox->mem_trained[nodeid]; memcpy(&sysinfo->ctrl[nodeid], &sysinfox->ctrl[nodeid], sizeof(struct mem_controller)); #else - memcpy(sysinfo, sysinfox, CONFIG_DCACHE_RAM_GLOBAL_VAR_SIZE); + memcpy(sysinfo, sysinfox, sizeof(*sysinfo)); #endif set_top_mem_ap(sysinfo->tom_k, sysinfo->tom2_k); // keep the ap's tom consistent with bsp's #if !CONFIG_AP_CODE_IN_CAR |