blob: d19ebdadb39117419b642f2fbb0c043f35c7cfce [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
Marc Jones2ce8bfd2007-12-19 01:49:44 +000018#include <stdint.h>
Patrick Georgi12aba822009-04-30 07:07:22 +000019#include <string.h>
Marc Jones2ce8bfd2007-12-19 01:49:44 +000020#include <device/pci_def.h>
Marc Jones2ce8bfd2007-12-19 01:49:44 +000021#include <arch/io.h>
Elyes HAOUASd2b9ec12018-10-27 09:41:02 +020022#include <arch/cpu.h>
Marc Jones2ce8bfd2007-12-19 01:49:44 +000023#include <cpu/x86/lapic.h>
Patrick Georgi12584e22010-05-08 09:14:51 +000024#include <console/console.h>
Timothy Pearson91e9f672015-03-19 16:44:46 -050025#include <timestamp.h>
Marc Jones2ce8bfd2007-12-19 01:49:44 +000026#include <cpu/amd/model_10xxx_rev.h>
Uwe Hermann26535d62010-11-20 20:36:40 +000027#include <spd.h>
Aaron Durbindc9f5cd2015-09-08 13:34:43 -050028#include <commonlib/loglevel.h>
Edward O'Callaghan77757c22015-01-04 21:33:39 +110029#include <cpu/x86/bist.h>
Damien Zammit75a3d1f2016-11-28 00:29:10 +110030#include <cpu/amd/car.h>
Elyes HAOUAS400ce552018-10-12 10:54:30 +020031#include <cpu/amd/msr.h>
Edward O'Callaghan81998092014-04-28 18:07:33 +100032#include <superio/winbond/common/winbond.h>
33#include <superio/winbond/w83627hf/w83627hf.h>
Damien Zammit75a3d1f2016-11-28 00:29:10 +110034#include <northbridge/amd/amdfam10/raminit.h>
35#include <northbridge/amd/amdht/ht_wrapper.h>
36#include <cpu/amd/family_10h-family_15h/init_cpus.h>
37#include <arch/early_variables.h>
38#include <cbmem.h>
39#include "southbridge/amd/amd8111/early_smbus.c"
stepan836ae292010-12-08 05:42:47 +000040#include "southbridge/amd/amd8111/early_ctrl.c"
Marc Jones2ce8bfd2007-12-19 01:49:44 +000041
Damien Zammit75a3d1f2016-11-28 00:29:10 +110042#include "cpu/amd/quadcore/quadcore.c"
43
Marc Jones2ce8bfd2007-12-19 01:49:44 +000044#define SERIAL_DEV PNP_DEV(0x2e, W83627HF_SP1)
Marc Jones2ce8bfd2007-12-19 01:49:44 +000045
Damien Zammit75a3d1f2016-11-28 00:29:10 +110046void activate_spd_rom(const struct mem_controller *ctrl);
Elyes HAOUASdd35e2c2018-09-20 17:33:50 +020047int spd_read_byte(unsigned int device, unsigned int address);
Damien Zammit75a3d1f2016-11-28 00:29:10 +110048extern struct sys_info sysinfo_car;
49
Marc Jones2ce8bfd2007-12-19 01:49:44 +000050static void memreset_setup(void)
51{
Elyes HAOUAScaccd972016-10-10 21:25:17 +020052 /* GPIO on amd8111 to enable MEMRST ???? */
53 outb((1 << 2)|(1 << 0), SMBUS_IO_BASE + 0xc0 + 16); /* REVC_MEMRST_EN = 1 */
Elyes HAOUAS6350a2e2016-09-16 20:49:38 +020054 outb((1 << 2)|(0 << 0), SMBUS_IO_BASE + 0xc0 + 17);
Marc Jones2ce8bfd2007-12-19 01:49:44 +000055}
56
Damien Zammit75a3d1f2016-11-28 00:29:10 +110057void activate_spd_rom(const struct mem_controller *ctrl)
Marc Jones2ce8bfd2007-12-19 01:49:44 +000058{
59#define SMBUS_HUB 0x18
60 int ret,i;
61 u8 device = ctrl->spd_switch_addr;
62
Elyes HAOUASaedcc102014-07-21 08:07:19 +020063 printk(BIOS_DEBUG, "switch i2c to : %02x for node %02x\n", device, ctrl->node_id);
Marc Jones2ce8bfd2007-12-19 01:49:44 +000064
Elyes HAOUAS6350a2e2016-09-16 20:49:38 +020065 /* the very first write always get COL_STS = 1 and ABRT_STS = 1, so try another time*/
66 i = 2;
Marc Jones2ce8bfd2007-12-19 01:49:44 +000067 do {
68 ret = smbus_write_byte(SMBUS_HUB, 0x01, (1<<(device & 0x7)));
Elyes HAOUAS6350a2e2016-09-16 20:49:38 +020069 } while ((ret != 0) && (i-->0));
Marc Jones2ce8bfd2007-12-19 01:49:44 +000070 smbus_write_byte(SMBUS_HUB, 0x03, 0);
71}
72
Damien Zammit75a3d1f2016-11-28 00:29:10 +110073int spd_read_byte(u32 device, u32 address)
Marc Jones2ce8bfd2007-12-19 01:49:44 +000074{
Uwe Hermann7b997052010-11-21 22:47:22 +000075 return smbus_read_byte(device, address);
Marc Jones2ce8bfd2007-12-19 01:49:44 +000076}
77
Uwe Hermann26535d62010-11-20 20:36:40 +000078static const u8 spd_addr[] = {
Elyes HAOUAScaccd972016-10-10 21:25:17 +020079 /* first node */
Uwe Hermann26535d62010-11-20 20:36:40 +000080 RC00, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
81#if CONFIG_MAX_PHYSICAL_CPUS > 1
Elyes HAOUAScaccd972016-10-10 21:25:17 +020082 /* second node */
Uwe Hermann26535d62010-11-20 20:36:40 +000083 RC01, DIMM0, DIMM2, DIMM4, DIMM6, DIMM1, DIMM3, DIMM5, DIMM7,
84#endif
85#if CONFIG_MAX_PHYSICAL_CPUS > 2
Elyes HAOUAScaccd972016-10-10 21:25:17 +020086 /* third node */
Uwe Hermann26535d62010-11-20 20:36:40 +000087 RC02, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
Elyes HAOUAScaccd972016-10-10 21:25:17 +020088 /* forth node */
Uwe Hermann26535d62010-11-20 20:36:40 +000089 RC03, DIMM0, DIMM2, DIMM4, DIMM6, DIMM1, DIMM3, DIMM5, DIMM7,
90#endif
91#if CONFIG_MAX_PHYSICAL_CPUS > 4
92 RC04, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
93 RC05, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
94#endif
95#if CONFIG_MAX_PHYSICAL_CPUS > 6
96 RC06, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
97 RC07, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
98#endif
99#if CONFIG_MAX_PHYSICAL_CPUS > 8
100 RC08, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
101 RC09, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
102 RC10, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
103 RC11, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
104#endif
105#if CONFIG_MAX_PHYSICAL_CPUS > 12
106 RC12, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
107 RC13, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
108 RC14, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
109 RC15, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
110#endif
111#if CONFIG_MAX_PHYSICAL_CPUS > 16
112 RC16, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
113 RC17, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
114 RC18, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
115 RC19, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
116#endif
117#if CONFIG_MAX_PHYSICAL_CPUS > 20
118 RC20, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
119 RC21, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
120 RC22, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
121 RC23, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
122#endif
123#if CONFIG_MAX_PHYSICAL_CPUS > 24
124 RC24, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
125 RC25, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
126 RC26, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
127 RC27, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
128 RC28, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
129 RC29, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
130 RC30, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
131 RC31, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
132#endif
133#if CONFIG_MAX_PHYSICAL_CPUS > 32
134 RC32, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
135 RC33, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
136 RC34, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
137 RC35, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
138 RC36, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
139 RC37, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
140 RC38, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
141 RC39, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
142 RC40, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
143 RC41, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
144 RC42, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
145 RC43, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
146 RC44, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
147 RC45, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
148 RC46, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
149 RC47, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
150#endif
151#if CONFIG_MAX_PHYSICAL_CPUS > 48
152 RC48, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
153 RC49, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
154 RC50, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
155 RC51, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
156 RC52, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
157 RC53, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
158 RC54, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
159 RC55, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
160 RC56, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
161 RC57, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
162 RC58, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
163 RC59, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
164 RC60, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
165 RC61, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
166 RC62, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
167 RC63, DIMM0, DIMM2, 0, 0, DIMM1, DIMM3, 0, 0,
168#endif
169};
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000170
Patrick Georgice6fb1e2010-03-17 22:44:39 +0000171void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000172{
Patrick Georgibbc880e2012-11-20 18:20:56 +0100173 struct sys_info *sysinfo = &sysinfo_car;
Uwe Hermann7b997052010-11-21 22:47:22 +0000174 u32 bsp_apicid = 0, val;
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000175 msr_t msr;
176
Timothy Pearson91e9f672015-03-19 16:44:46 -0500177 timestamp_init(timestamp_get());
178 timestamp_add_now(TS_START_ROMSTAGE);
179
Patrick Georgi2bd91002010-03-18 16:46:50 +0000180 if (!cpu_init_detectedx && boot_cpu()) {
Patrick Georgice6fb1e2010-03-17 22:44:39 +0000181 /* Nothing special needs to be done to find bus 0 */
182 /* Allow the HT devices to be found */
183 /* mov bsp to bus 0xff when > 8 nodes */
184 set_bsp_node_CHtExtNodeCfgEn();
185 enumerate_ht_chain();
Patrick Georgice6fb1e2010-03-17 22:44:39 +0000186 }
187
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000188 post_code(0x30);
189
190 if (bist == 0) {
Marc Jonesf0174b52008-04-22 23:27:53 +0000191 bsp_apicid = init_cpus(cpu_init_detectedx, sysinfo); /* mmconf is inited in init_cpus */
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000192 /* All cores run this but the BSP(node0,core0) is the only core that returns. */
193 }
194
195 post_code(0x32);
196
Edward O'Callaghan81998092014-04-28 18:07:33 +1000197 winbond_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE);
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000198 console_init();
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000199
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000200 /* Halt if there was a built in self test failure */
201 report_bist_failure(bist);
202
Elyes HAOUAScaccd972016-10-10 21:25:17 +0200203 /* Load MPB */
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000204 val = cpuid_eax(1);
Elyes HAOUASaedcc102014-07-21 08:07:19 +0200205 printk(BIOS_DEBUG, "BSP Family_Model: %08x\n", val);
Myles Watson08e0fb82010-03-22 16:33:25 +0000206 printk(BIOS_DEBUG, "*sysinfo range: [%p,%p]\n",sysinfo,sysinfo+1);
Elyes HAOUASaedcc102014-07-21 08:07:19 +0200207 printk(BIOS_DEBUG, "bsp_apicid = %02x\n", bsp_apicid);
208 printk(BIOS_DEBUG, "cpu_init_detectedx = %08lx\n", cpu_init_detectedx);
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000209
210 /* Setup sysinfo defaults */
211 set_sysinfo_in_ram(0);
212
Marc Jonesda4ce6b2008-04-22 22:11:31 +0000213 update_microcode(val);
Kyösti Mälkkif0a13ce2013-12-08 07:20:48 +0200214
Marc Jonesda4ce6b2008-04-22 22:11:31 +0000215 post_code(0x33);
216
Timothy Pearson730a0432015-10-16 13:51:51 -0500217 cpuSetAMDMSR(0);
Marc Jonesda4ce6b2008-04-22 22:11:31 +0000218 post_code(0x34);
219
220 amd_ht_init(sysinfo);
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000221 post_code(0x35);
222
Marc Jonesda4ce6b2008-04-22 22:11:31 +0000223 /* Setup nodes PCI space and start core 0 AP init. */
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000224 finalize_node_setup(sysinfo);
225
Marc Jonesda4ce6b2008-04-22 22:11:31 +0000226 /* Setup any mainboard PCI settings etc. */
227 setup_mb_resource_map();
228 post_code(0x36);
229
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000230 /* wait for all the APs core0 started by finalize_node_setup. */
231 /* FIXME: A bunch of cores are going to start output to serial at once.
232 It would be nice to fixup prink spinlocks for ROM XIP mode.
233 I think it could be done by putting the spinlock flag in the cache
234 of the BSP located right after sysinfo.
235 */
236 wait_all_core0_started();
237
Martin Rothf95911a2017-06-24 21:45:13 -0600238 #if IS_ENABLED(CONFIG_LOGICAL_CPUS)
Marc Jonesf0174b52008-04-22 23:27:53 +0000239 /* Core0 on each node is configured. Now setup any additional cores. */
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +0000240 printk(BIOS_DEBUG, "start_other_cores()\n");
Timothy Pearson0122afb2015-07-30 14:07:15 -0500241 start_other_cores(bsp_apicid);
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000242 post_code(0x37);
243 wait_all_other_cores_started(bsp_apicid);
244 #endif
245
246 post_code(0x38);
247
Martin Rothf95911a2017-06-24 21:45:13 -0600248 #if IS_ENABLED(CONFIG_SET_FIDVID)
Elyes HAOUAS400ce552018-10-12 10:54:30 +0200249 msr = rdmsr(MSR_COFVID_STS);
Elyes HAOUASaedcc102014-07-21 08:07:19 +0200250 printk(BIOS_DEBUG, "\nBegin FIDVID MSR 0xc0010071 0x%08x 0x%08x\n", msr.hi, msr.lo);
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000251
252 /* FIXME: The sb fid change may survive the warm reset and only
253 need to be done once.*/
254 enable_fid_change_on_sb(sysinfo->sbbusn, sysinfo->sbdn);
255
256 post_code(0x39);
257
Elyes HAOUAScaccd972016-10-10 21:25:17 +0200258 if (!warm_reset_detect(0)) { /* BSP is node 0 */
Marc Jonesf0174b52008-04-22 23:27:53 +0000259 init_fidvid_bsp(bsp_apicid, sysinfo->nodes);
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000260 } else {
Elyes HAOUAScaccd972016-10-10 21:25:17 +0200261 init_fidvid_stage2(bsp_apicid, 0); /* BSP is node 0 */
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000262 }
263
264 post_code(0x3A);
265
Marc Jonesf0174b52008-04-22 23:27:53 +0000266 /* show final fid and vid */
Elyes HAOUAS400ce552018-10-12 10:54:30 +0200267 msr = rdmsr(MSR_COFVID_STS);
Elyes HAOUASaedcc102014-07-21 08:07:19 +0200268 printk(BIOS_DEBUG, "End FIDVIDMSR 0xc0010071 0x%08x 0x%08x\n", msr.hi, msr.lo);
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000269 #endif
270
Marc Jonesf0174b52008-04-22 23:27:53 +0000271 /* Reset for HT, FIDVID, PLL and errata changes to take affect. */
272 if (!warm_reset_detect(0)) {
Stefan Reinauer069f4762015-01-05 13:02:32 -0800273 printk(BIOS_INFO, "...WARM RESET...\n\n\n");
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000274 soft_reset_x(sysinfo->sbbusn, sysinfo->sbdn);
275 die("After soft_reset_x - shouldn't see this message!!!\n");
276 }
277
278 post_code(0x3B);
279
Marc Jonesf0174b52008-04-22 23:27:53 +0000280 /* FIXME: Move this to chipset init.
281 enable cf9 for hard reset */
Stefan Reinauer069f4762015-01-05 13:02:32 -0800282 printk(BIOS_DEBUG, "enable_cf9_x()\n");
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000283 enable_cf9_x(sysinfo->sbbusn, sysinfo->sbdn);
284 post_code(0x3C);
285
Marc Jonesf0174b52008-04-22 23:27:53 +0000286 /* It's the time to set ctrl in sysinfo now; */
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +0000287 printk(BIOS_DEBUG, "fill_mem_ctrl()\n");
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000288 fill_mem_ctrl(sysinfo->nodes, sysinfo->ctrl, spd_addr);
289 post_code(0x3D);
290
Stefan Reinauerc02b4fc2010-03-22 11:42:32 +0000291 printk(BIOS_DEBUG, "enable_smbus()\n");
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000292 enable_smbus();
293 post_code(0x3E);
294
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000295 memreset_setup();
Marc Jonesda4ce6b2008-04-22 22:11:31 +0000296 post_code(0x40);
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000297
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000298 raminit_amdmct(sysinfo);
Timothy Pearson91e9f672015-03-19 16:44:46 -0500299
Timothy Pearson86f4ca52015-03-13 13:27:58 -0500300 cbmem_initialize_empty();
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000301 post_code(0x41);
302
Timothy Pearson22564082015-03-27 22:49:18 -0500303 amdmct_cbmem_store_info(sysinfo);
304
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000305 post_code(0x42);
Marc Jones2ce8bfd2007-12-19 01:49:44 +0000306}
Scott Duplichan314dd0b2011-03-08 23:01:46 +0000307
308/**
309 * BOOL AMD_CB_ManualBUIDSwapList(u8 Node, u8 Link, u8 **List)
310 * Description:
311 * This routine is called every time a non-coherent chain is processed.
312 * BUID assignment may be controlled explicitly on a non-coherent chain. Provide a
313 * swap list. The first part of the list controls the BUID assignment and the
314 * second part of the list provides the device to device linking. Device orientation
315 * can be detected automatically, or explicitly. See documentation for more details.
316 *
317 * Automatic non-coherent init assigns BUIDs starting at 1 and incrementing sequentially
318 * based on each device's unit count.
319 *
320 * Parameters:
Martin Rothc3fde7e2014-12-29 22:13:37 -0700321 * @param[in] node = The node on which this chain is located
322 * @param[in] link = The link on the host for this chain
323 * @param[out] List = supply a pointer to a list
Scott Duplichan314dd0b2011-03-08 23:01:46 +0000324 */
325BOOL AMD_CB_ManualBUIDSwapList (u8 node, u8 link, const u8 **List)
326{
327 static const u8 swaplist[] = { 0xFF, CONFIG_HT_CHAIN_UNITID_BASE, CONFIG_HT_CHAIN_END_UNITID_BASE, 0xFF };
328 /* If the BUID was adjusted in early_ht we need to do the manual override */
329 if ((CONFIG_HT_CHAIN_UNITID_BASE != 0) && (CONFIG_HT_CHAIN_END_UNITID_BASE != 0)) {
330 printk(BIOS_DEBUG, "AMD_CB_ManualBUIDSwapList()\n");
331 if ((node == 0) && (link == 0)) { /* BSP SB link */
332 *List = swaplist;
333 return 1;
334 }
335 }
336
337 return 0;
338}