blob: ad3157fbf6cb5ce0e5aafa47a71274a5fbf4758f [file] [log] [blame]
Marc Jones2ce8bfd2007-12-19 01:49:44 +00001/*
Stefan Reinauer7e61e452008-01-18 10:35:56 +00002 * This file is part of the coreboot project.
Marc Jones2ce8bfd2007-12-19 01:49:44 +00003 *
Marc Jonesda4ce6b2008-04-22 22:11:31 +00004 * Copyright (C) 2007-2008 Advanced Micro Devices, Inc.
Marc Jones2ce8bfd2007-12-19 01:49:44 +00005 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
Marc Jones2ce8bfd2007-12-19 01:49:44 +000014 */
15
Marc Jones2ce8bfd2007-12-19 01:49:44 +000016#define SYSTEM_TYPE 0 /* SERVER */
Marc Jones2ce8bfd2007-12-19 01:49:44 +000017
Elyes HAOUAScaccd972016-10-10 21:25:17 +020018/* used by incoherent_ht */
Marc Jones2ce8bfd2007-12-19 01:49:44 +000019#define FAM10_SCAN_PCI_BUS 0
20#define FAM10_ALLOCATE_IO_RANGE 0
21
Marc Jones2ce8bfd2007-12-19 01:49:44 +000022#include <stdint.h>
Patrick Georgi12aba822009-04-30 07:07:22 +000023#include <string.h>
Marc Jones2ce8bfd2007-12-19 01:49:44 +000024#include <device/pci_def.h>
25#include <device/pci_ids.h>
26#include <arch/io.h>
27#include <device/pnp_def.h>
Marc Jones2ce8bfd2007-12-19 01:49:44 +000028#include <cpu/x86/lapic.h>
Patrick Georgi12584e22010-05-08 09:14:51 +000029#include <console/console.h>
Timothy Pearson91e9f672015-03-19 16:44:46 -050030#include <timestamp.h>
Marc Jones2ce8bfd2007-12-19 01:49:44 +000031#include <cpu/amd/model_10xxx_rev.h>
Patrick Georgid0835952010-10-05 09:07:10 +000032#include <lib.h>
Uwe Hermann26535d62010-11-20 20:36:40 +000033#include <spd.h>
Edward O'Callaghan77757c22015-01-04 21:33:39 +110034#include <cpu/x86/lapic.h>
Aaron Durbindc9f5cd2015-09-08 13:34:43 -050035#include <commonlib/loglevel.h>
Edward O'Callaghan77757c22015-01-04 21:33:39 +110036#include <cpu/x86/bist.h>
Damien Zammit75a3d1f2016-11-28 00:29:10 +110037#include <cpu/amd/car.h>
Edward O'Callaghan81998092014-04-28 18:07:33 +100038#include <superio/winbond/common/winbond.h>
39#include <superio/winbond/w83627hf/w83627hf.h>
Damien Zammit75a3d1f2016-11-28 00:29:10 +110040#include <northbridge/amd/amdfam10/raminit.h>
41#include <northbridge/amd/amdht/ht_wrapper.h>
42#include <cpu/amd/family_10h-family_15h/init_cpus.h>
43#include <arch/early_variables.h>
44#include <cbmem.h>
45#include "southbridge/amd/amd8111/early_smbus.c"
stepan836ae292010-12-08 05:42:47 +000046#include "southbridge/amd/amd8111/early_ctrl.c"
Marc Jones2ce8bfd2007-12-19 01:49:44 +000047
Damien Zammit75a3d1f2016-11-28 00:29:10 +110048#include "resourcemap.c"
49#include "cpu/amd/quadcore/quadcore.c"
50
Marc Jones2ce8bfd2007-12-19 01:49:44 +000051#define SERIAL_DEV PNP_DEV(0x2e, W83627HF_SP1)
Marc Jones2ce8bfd2007-12-19 01:49:44 +000052
Damien Zammit75a3d1f2016-11-28 00:29:10 +110053void activate_spd_rom(const struct mem_controller *ctrl);
Elyes HAOUASdd35e2c2018-09-20 17:33:50 +020054int spd_read_byte(unsigned int device, unsigned int address);
Damien Zammit75a3d1f2016-11-28 00:29:10 +110055extern struct sys_info sysinfo_car;
56
Marc Jones2ce8bfd2007-12-19 01:49:44 +000057static void memreset_setup(void)
58{
Elyes HAOUAScaccd972016-10-10 21:25:17 +020059 /* GPIO on amd8111 to enable MEMRST ???? */
60 outb((1 << 2)|(1 << 0), SMBUS_IO_BASE + 0xc0 + 16); /* REVC_MEMRST_EN = 1 */
Elyes HAOUAS6350a2e2016-09-16 20:49:38 +020061 outb((1 << 2)|(0 << 0), SMBUS_IO_BASE + 0xc0 + 17);
Marc Jones2ce8bfd2007-12-19 01:49:44 +000062}
63
Damien Zammit75a3d1f2016-11-28 00:29:10 +110064void activate_spd_rom(const struct mem_controller *ctrl)
Marc Jones2ce8bfd2007-12-19 01:49:44 +000065{
66#define SMBUS_HUB 0x18
67 int ret,i;
68 u8 device = ctrl->spd_switch_addr;
69
Elyes HAOUASaedcc102014-07-21 08:07:19 +020070 printk(BIOS_DEBUG, "switch i2c to : %02x for node %02x\n", device, ctrl->node_id);
Marc Jones2ce8bfd2007-12-19 01:49:44 +000071
Elyes HAOUAS6350a2e2016-09-16 20:49:38 +020072 /* the very first write always get COL_STS = 1 and ABRT_STS = 1, so try another time*/
73 i = 2;
Marc Jones2ce8bfd2007-12-19 01:49:44 +000074 do {
75 ret = smbus_write_byte(SMBUS_HUB, 0x01, (1<<(device & 0x7)));
Elyes HAOUAS6350a2e2016-09-16 20:49:38 +020076 } while ((ret != 0) && (i-->0));
Marc Jones2ce8bfd2007-12-19 01:49:44 +000077 smbus_write_byte(SMBUS_HUB, 0x03, 0);
78}
79
Damien Zammit75a3d1f2016-11-28 00:29:10 +110080int spd_read_byte(u32 device, u32 address)
Marc Jones2ce8bfd2007-12-19 01:49:44 +000081{
Uwe Hermann7b997052010-11-21 22:47:22 +000082 return smbus_read_byte(device, address);
Marc Jones2ce8bfd2007-12-19 01:49:44 +000083}
84
Uwe Hermann26535d62010-11-20 20:36:40 +000085static const u8 spd_addr[] = {
Elyes HAOUAScaccd972016-10-10 21:25:17 +020086 /* first node */
Uwe Hermann26535d62010-11-20 20:36:40 +000087 RC00, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
88#if CONFIG_MAX_PHYSICAL_CPUS > 1
Elyes HAOUAScaccd972016-10-10 21:25:17 +020089 /* second node */
Uwe Hermann26535d62010-11-20 20:36:40 +000090 RC01, DIMM0, DIMM2, DIMM4, DIMM6, DIMM1, DIMM3, DIMM5, DIMM7,
91#endif
92#if CONFIG_MAX_PHYSICAL_CPUS > 2
Elyes HAOUAScaccd972016-10-10 21:25:17 +020093 /* third node */
Uwe Hermann26535d62010-11-20 20:36:40 +000094 RC02, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
Elyes HAOUAScaccd972016-10-10 21:25:17 +020095 /* forth node */
Uwe Hermann26535d62010-11-20 20:36:40 +000096 RC03, DIMM0, DIMM2, DIMM4, DIMM6, DIMM1, DIMM3, DIMM5, DIMM7,
97#endif
98#if CONFIG_MAX_PHYSICAL_CPUS > 4
99 RC04, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
100 RC05, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
101#endif
102#if CONFIG_MAX_PHYSICAL_CPUS > 6
103 RC06, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
104 RC07, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
105#endif
106#if CONFIG_MAX_PHYSICAL_CPUS > 8
107 RC08, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
108 RC09, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
109 RC10, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
110 RC11, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
111#endif
112#if CONFIG_MAX_PHYSICAL_CPUS > 12
113 RC12, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
114 RC13, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
115 RC14, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
116 RC15, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
117#endif
118#if CONFIG_MAX_PHYSICAL_CPUS > 16
119 RC16, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
120 RC17, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
121 RC18, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
122 RC19, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
123#endif
124#if CONFIG_MAX_PHYSICAL_CPUS > 20
125 RC20, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
126 RC21, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
127 RC22, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
128 RC23, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
129#endif
130#if CONFIG_MAX_PHYSICAL_CPUS > 24
131 RC24, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
132 RC25, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
133 RC26, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
134 RC27, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
135 RC28, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
136 RC29, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
137 RC30, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
138 RC31, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
139#endif
140#if CONFIG_MAX_PHYSICAL_CPUS > 32
141 RC32, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
142 RC33, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
143 RC34, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
144 RC35, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
145 RC36, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
146 RC37, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
147 RC38, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
148 RC39, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
149 RC40, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
150 RC41, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
151 RC42, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
152 RC43, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
153 RC44, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
154 RC45, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
155 RC46, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
156 RC47, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
157#endif
158#if CONFIG_MAX_PHYSICAL_CPUS > 48
159 RC48, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
160 RC49, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
161 RC50, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
162 RC51, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
163 RC52, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
164 RC53, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
165 RC54, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
166 RC55, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
167 RC56, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
168 RC57, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
169 RC58, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
170 RC59, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
171 RC60, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
172 RC61, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
173 RC62, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
174 RC63, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
175#endif
176};
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000177
Patrick Georgice6fb1e2010-03-17 22:44:39 +0000178void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000179{
Patrick Georgibbc880e2012-11-20 18:20:56 +0100180 struct sys_info *sysinfo = &sysinfo_car;
Uwe Hermann7b997052010-11-21 22:47:22 +0000181 u32 bsp_apicid = 0, val;
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000182 msr_t msr;
183
Timothy Pearson91e9f672015-03-19 16:44:46 -0500184 timestamp_init(timestamp_get());
185 timestamp_add_now(TS_START_ROMSTAGE);
186
Patrick Georgi2bd91002010-03-18 16:46:50 +0000187 if (!cpu_init_detectedx && boot_cpu()) {
Patrick Georgice6fb1e2010-03-17 22:44:39 +0000188 /* Nothing special needs to be done to find bus 0 */
189 /* Allow the HT devices to be found */
190 /* mov bsp to bus 0xff when > 8 nodes */
191 set_bsp_node_CHtExtNodeCfgEn();
192 enumerate_ht_chain();
Patrick Georgice6fb1e2010-03-17 22:44:39 +0000193 }
194
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000195 post_code(0x30);
196
197 if (bist == 0) {
Marc Jonesf0174b52008-04-22 23:27:53 +0000198 bsp_apicid = init_cpus(cpu_init_detectedx, sysinfo); /* mmconf is inited in init_cpus */
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000199 /* All cores run this but the BSP(node0,core0) is the only core that returns. */
200 }
201
202 post_code(0x32);
203
Edward O'Callaghan81998092014-04-28 18:07:33 +1000204 winbond_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE);
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000205 console_init();
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000206
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000207 /* Halt if there was a built in self test failure */
208 report_bist_failure(bist);
209
Elyes HAOUAScaccd972016-10-10 21:25:17 +0200210 /* Load MPB */
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000211 val = cpuid_eax(1);
Elyes HAOUASaedcc102014-07-21 08:07:19 +0200212 printk(BIOS_DEBUG, "BSP Family_Model: %08x\n", val);
Myles Watson08e0fb82010-03-22 16:33:25 +0000213 printk(BIOS_DEBUG, "*sysinfo range: [%p,%p]\n",sysinfo,sysinfo+1);
Elyes HAOUASaedcc102014-07-21 08:07:19 +0200214 printk(BIOS_DEBUG, "bsp_apicid = %02x\n", bsp_apicid);
215 printk(BIOS_DEBUG, "cpu_init_detectedx = %08lx\n", cpu_init_detectedx);
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000216
217 /* Setup sysinfo defaults */
218 set_sysinfo_in_ram(0);
219
Marc Jonesda4ce6b2008-04-22 22:11:31 +0000220 update_microcode(val);
Kyösti Mälkkif0a13ce2013-12-08 07:20:48 +0200221
Marc Jonesda4ce6b2008-04-22 22:11:31 +0000222 post_code(0x33);
223
Timothy Pearson730a0432015-10-16 13:51:51 -0500224 cpuSetAMDMSR(0);
Marc Jonesda4ce6b2008-04-22 22:11:31 +0000225 post_code(0x34);
226
227 amd_ht_init(sysinfo);
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000228 post_code(0x35);
229
Marc Jonesda4ce6b2008-04-22 22:11:31 +0000230 /* Setup nodes PCI space and start core 0 AP init. */
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000231 finalize_node_setup(sysinfo);
232
Marc Jonesda4ce6b2008-04-22 22:11:31 +0000233 /* Setup any mainboard PCI settings etc. */
234 setup_mb_resource_map();
235 post_code(0x36);
236
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000237 /* wait for all the APs core0 started by finalize_node_setup. */
238 /* FIXME: A bunch of cores are going to start output to serial at once.
239 It would be nice to fixup prink spinlocks for ROM XIP mode.
240 I think it could be done by putting the spinlock flag in the cache
241 of the BSP located right after sysinfo.
242 */
243 wait_all_core0_started();
244
Martin Rothf95911a2017-06-24 21:45:13 -0600245 #if IS_ENABLED(CONFIG_LOGICAL_CPUS)
Marc Jonesf0174b52008-04-22 23:27:53 +0000246 /* Core0 on each node is configured. Now setup any additional cores. */
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +0000247 printk(BIOS_DEBUG, "start_other_cores()\n");
Timothy Pearson0122afb2015-07-30 14:07:15 -0500248 start_other_cores(bsp_apicid);
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000249 post_code(0x37);
250 wait_all_other_cores_started(bsp_apicid);
251 #endif
252
253 post_code(0x38);
254
Martin Rothf95911a2017-06-24 21:45:13 -0600255 #if IS_ENABLED(CONFIG_SET_FIDVID)
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000256 msr = rdmsr(0xc0010071);
Elyes HAOUASaedcc102014-07-21 08:07:19 +0200257 printk(BIOS_DEBUG, "\nBegin FIDVID MSR 0xc0010071 0x%08x 0x%08x\n", msr.hi, msr.lo);
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000258
259 /* FIXME: The sb fid change may survive the warm reset and only
260 need to be done once.*/
261 enable_fid_change_on_sb(sysinfo->sbbusn, sysinfo->sbdn);
262
263 post_code(0x39);
264
Elyes HAOUAScaccd972016-10-10 21:25:17 +0200265 if (!warm_reset_detect(0)) { /* BSP is node 0 */
Marc Jonesf0174b52008-04-22 23:27:53 +0000266 init_fidvid_bsp(bsp_apicid, sysinfo->nodes);
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000267 } else {
Elyes HAOUAScaccd972016-10-10 21:25:17 +0200268 init_fidvid_stage2(bsp_apicid, 0); /* BSP is node 0 */
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000269 }
270
271 post_code(0x3A);
272
Marc Jonesf0174b52008-04-22 23:27:53 +0000273 /* show final fid and vid */
Elyes HAOUAS6350a2e2016-09-16 20:49:38 +0200274 msr = rdmsr(0xc0010071);
Elyes HAOUASaedcc102014-07-21 08:07:19 +0200275 printk(BIOS_DEBUG, "End FIDVIDMSR 0xc0010071 0x%08x 0x%08x\n", msr.hi, msr.lo);
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000276 #endif
277
Marc Jonesf0174b52008-04-22 23:27:53 +0000278 /* Reset for HT, FIDVID, PLL and errata changes to take affect. */
279 if (!warm_reset_detect(0)) {
Stefan Reinauer069f4762015-01-05 13:02:32 -0800280 printk(BIOS_INFO, "...WARM RESET...\n\n\n");
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000281 soft_reset_x(sysinfo->sbbusn, sysinfo->sbdn);
282 die("After soft_reset_x - shouldn't see this message!!!\n");
283 }
284
285 post_code(0x3B);
286
Marc Jonesf0174b52008-04-22 23:27:53 +0000287 /* FIXME: Move this to chipset init.
288 enable cf9 for hard reset */
Stefan Reinauer069f4762015-01-05 13:02:32 -0800289 printk(BIOS_DEBUG, "enable_cf9_x()\n");
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000290 enable_cf9_x(sysinfo->sbbusn, sysinfo->sbdn);
291 post_code(0x3C);
292
Marc Jonesf0174b52008-04-22 23:27:53 +0000293 /* It's the time to set ctrl in sysinfo now; */
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +0000294 printk(BIOS_DEBUG, "fill_mem_ctrl()\n");
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000295 fill_mem_ctrl(sysinfo->nodes, sysinfo->ctrl, spd_addr);
296 post_code(0x3D);
297
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +0000298 printk(BIOS_DEBUG, "enable_smbus()\n");
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000299 enable_smbus();
300 post_code(0x3E);
301
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000302 memreset_setup();
Marc Jonesda4ce6b2008-04-22 22:11:31 +0000303 post_code(0x40);
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000304
Timothy Pearson91e9f672015-03-19 16:44:46 -0500305 timestamp_add_now(TS_BEFORE_INITRAM);
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +0000306 printk(BIOS_DEBUG, "raminit_amdmct()\n");
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000307 raminit_amdmct(sysinfo);
Timothy Pearson91e9f672015-03-19 16:44:46 -0500308 timestamp_add_now(TS_AFTER_INITRAM);
309
Timothy Pearson86f4ca52015-03-13 13:27:58 -0500310 cbmem_initialize_empty();
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000311 post_code(0x41);
312
Timothy Pearson22564082015-03-27 22:49:18 -0500313 amdmct_cbmem_store_info(sysinfo);
314
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000315 post_code(0x42);
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000316}
Scott Duplichan314dd0b2011-03-08 23:01:46 +0000317
318/**
319 * BOOL AMD_CB_ManualBUIDSwapList(u8 Node, u8 Link, u8 **List)
320 * Description:
321 * This routine is called every time a non-coherent chain is processed.
322 * BUID assignment may be controlled explicitly on a non-coherent chain. Provide a
323 * swap list. The first part of the list controls the BUID assignment and the
324 * second part of the list provides the device to device linking. Device orientation
325 * can be detected automatically, or explicitly. See documentation for more details.
326 *
327 * Automatic non-coherent init assigns BUIDs starting at 1 and incrementing sequentially
328 * based on each device's unit count.
329 *
330 * Parameters:
Martin Rothc3fde7e2014-12-29 22:13:37 -0700331 * @param[in] node = The node on which this chain is located
332 * @param[in] link = The link on the host for this chain
333 * @param[out] List = supply a pointer to a list
Scott Duplichan314dd0b2011-03-08 23:01:46 +0000334 */
335BOOL AMD_CB_ManualBUIDSwapList (u8 node, u8 link, const u8 **List)
336{
337 static const u8 swaplist[] = { 0xFF, CONFIG_HT_CHAIN_UNITID_BASE, CONFIG_HT_CHAIN_END_UNITID_BASE, 0xFF };
338 /* If the BUID was adjusted in early_ht we need to do the manual override */
339 if ((CONFIG_HT_CHAIN_UNITID_BASE != 0) && (CONFIG_HT_CHAIN_END_UNITID_BASE != 0)) {
340 printk(BIOS_DEBUG, "AMD_CB_ManualBUIDSwapList()\n");
341 if ((node == 0) && (link == 0)) { /* BSP SB link */
342 *List = swaplist;
343 return 1;
344 }
345 }
346
347 return 0;
348}