blob: 960078e69bd9d7eb35dcbf9c2fbdeb57c34179ef [file] [log] [blame]
Bruce Griffith27ed80b2014-08-15 11:46:25 -06001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2012 Advanced Micro Devices, Inc.
5 *
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.
Bruce Griffith27ed80b2014-08-15 11:46:25 -060014 */
15
16#include <console/console.h>
17#include <arch/io.h>
18#include <arch/acpi.h>
19#include <stdint.h>
20#include <device/device.h>
21#include <device/pci.h>
22#include <device/pci_ids.h>
23#include <device/hypertransport.h>
24#include <stdlib.h>
25#include <string.h>
26#include <lib.h>
27#include <cpu/cpu.h>
28#include <cbmem.h>
29
30#include <Porting.h>
31#include <AGESA.h>
32#include <FieldAccessors.h>
33#include <Options.h>
34#include <Topology.h>
35#include <cpu/amd/amdfam16.h>
36#include <cpuRegisters.h>
Kyösti Mälkki023ed1f2014-10-22 08:05:36 +030037#include <northbridge/amd/pi/agesawrapper.h>
Kyösti Mälkkie4c17ce2014-10-21 18:22:32 +030038#include <northbridge/amd/pi/agesawrapper_call.h>
Bruce Griffith27ed80b2014-08-15 11:46:25 -060039#include "northbridge.h"
40
41#include <cpu/x86/lapic.h>
42#include <cpu/amd/mtrr.h>
Kyösti Mälkki0b5b5412014-11-26 08:11:07 +020043#include <arch/acpi.h>
44#include <arch/acpigen.h>
Bruce Griffith27ed80b2014-08-15 11:46:25 -060045
46#define MAX_NODE_NUMS (MAX_NODES * MAX_DIES)
47
Bruce Griffith27ed80b2014-08-15 11:46:25 -060048typedef struct dram_base_mask {
49 u32 base; //[47:27] at [28:8]
50 u32 mask; //[47:27] at [28:8] and enable at bit 0
51} dram_base_mask_t;
52
53static unsigned node_nums;
54static unsigned sblink;
55static device_t __f0_dev[MAX_NODE_NUMS];
56static device_t __f1_dev[MAX_NODE_NUMS];
57static device_t __f2_dev[MAX_NODE_NUMS];
58static device_t __f4_dev[MAX_NODE_NUMS];
59static unsigned fx_devs = 0;
60
61static dram_base_mask_t get_dram_base_mask(u32 nodeid)
62{
63 device_t dev;
64 dram_base_mask_t d;
65 dev = __f1_dev[0];
66 u32 temp;
67 temp = pci_read_config32(dev, 0x44 + (nodeid << 3)); //[39:24] at [31:16]
68 d.mask = ((temp & 0xfff80000)>>(8+3)); // mask out DramMask [26:24] too
69 temp = pci_read_config32(dev, 0x144 + (nodeid <<3)) & 0xff; //[47:40] at [7:0]
70 d.mask |= temp<<21;
71 temp = pci_read_config32(dev, 0x40 + (nodeid << 3)); //[39:24] at [31:16]
72 d.mask |= (temp & 1); // enable bit
73 d.base = ((temp & 0xfff80000)>>(8+3)); // mask out DramBase [26:24) too
74 temp = pci_read_config32(dev, 0x140 + (nodeid <<3)) & 0xff; //[47:40] at [7:0]
75 d.base |= temp<<21;
76 return d;
77}
78
79static void set_io_addr_reg(device_t dev, u32 nodeid, u32 linkn, u32 reg,
80 u32 io_min, u32 io_max)
81{
82 u32 i;
83 u32 tempreg;
84 /* io range allocation */
85 tempreg = (nodeid&0xf) | ((nodeid & 0x30)<<(8-4)) | (linkn<<4) | ((io_max&0xf0)<<(12-4)); //limit
Elyes HAOUASa8131602016-09-19 10:27:57 -060086 for (i = 0; i < node_nums; i++)
Bruce Griffith27ed80b2014-08-15 11:46:25 -060087 pci_write_config32(__f1_dev[i], reg+4, tempreg);
Elyes HAOUASa8131602016-09-19 10:27:57 -060088 tempreg = 3 /*| (3<<4)*/ | ((io_min&0xf0)<<(12-4)); //base :ISA and VGA ?
Elyes HAOUASa8131602016-09-19 10:27:57 -060089 for (i = 0; i < node_nums; i++)
Bruce Griffith27ed80b2014-08-15 11:46:25 -060090 pci_write_config32(__f1_dev[i], reg, tempreg);
91}
92
93static void set_mmio_addr_reg(u32 nodeid, u32 linkn, u32 reg, u32 index, u32 mmio_min, u32 mmio_max, u32 nodes)
94{
95 u32 i;
96 u32 tempreg;
97 /* io range allocation */
98 tempreg = (nodeid&0xf) | (linkn<<4) | (mmio_max&0xffffff00); //limit
Elyes HAOUASa8131602016-09-19 10:27:57 -060099 for (i = 0; i < nodes; i++)
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600100 pci_write_config32(__f1_dev[i], reg+4, tempreg);
101 tempreg = 3 | (nodeid & 0x30) | (mmio_min&0xffffff00);
Elyes HAOUASa8131602016-09-19 10:27:57 -0600102 for (i = 0; i < node_nums; i++)
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600103 pci_write_config32(__f1_dev[i], reg, tempreg);
104}
105
106static device_t get_node_pci(u32 nodeid, u32 fn)
107{
108#if MAX_NODE_NUMS + CONFIG_CDB >= 32
109 if ((CONFIG_CDB + nodeid) < 32) {
110 return dev_find_slot(CONFIG_CBB, PCI_DEVFN(CONFIG_CDB + nodeid, fn));
111 } else {
112 return dev_find_slot(CONFIG_CBB-1, PCI_DEVFN(CONFIG_CDB + nodeid - 32, fn));
113 }
114#else
115 return dev_find_slot(CONFIG_CBB, PCI_DEVFN(CONFIG_CDB + nodeid, fn));
116#endif
117}
118
119static void get_fx_devs(void)
120{
121 int i;
122 for (i = 0; i < MAX_NODE_NUMS; i++) {
123 __f0_dev[i] = get_node_pci(i, 0);
124 __f1_dev[i] = get_node_pci(i, 1);
125 __f2_dev[i] = get_node_pci(i, 2);
126 __f4_dev[i] = get_node_pci(i, 4);
127 if (__f0_dev[i] != NULL && __f1_dev[i] != NULL)
128 fx_devs = i+1;
129 }
130 if (__f1_dev[0] == NULL || __f0_dev[0] == NULL || fx_devs == 0) {
131 die("Cannot find 0:0x18.[0|1]\n");
132 }
Elyes HAOUASa8131602016-09-19 10:27:57 -0600133 printk(BIOS_DEBUG, "fx_devs = 0x%x\n", fx_devs);
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600134}
135
136static u32 f1_read_config32(unsigned reg)
137{
138 if (fx_devs == 0)
139 get_fx_devs();
140 return pci_read_config32(__f1_dev[0], reg);
141}
142
143static void f1_write_config32(unsigned reg, u32 value)
144{
145 int i;
146 if (fx_devs == 0)
147 get_fx_devs();
Elyes HAOUAS5a7e72f2016-08-23 21:36:02 +0200148 for (i = 0; i < fx_devs; i++) {
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600149 device_t dev;
150 dev = __f1_dev[i];
151 if (dev && dev->enabled) {
152 pci_write_config32(dev, reg, value);
153 }
154 }
155}
156
157static u32 amdfam16_nodeid(device_t dev)
158{
159#if MAX_NODE_NUMS == 64
160 unsigned busn;
161 busn = dev->bus->secondary;
162 if (busn != CONFIG_CBB) {
163 return (dev->path.pci.devfn >> 3) - CONFIG_CDB + 32;
164 } else {
165 return (dev->path.pci.devfn >> 3) - CONFIG_CDB;
166 }
167
168#else
169 return (dev->path.pci.devfn >> 3) - CONFIG_CDB;
170#endif
171}
172
173static void set_vga_enable_reg(u32 nodeid, u32 linkn)
174{
175 u32 val;
176
177 val = 1 | (nodeid<<4) | (linkn<<12);
178 /* it will routing
179 * (1)mmio 0xa0000:0xbffff
180 * (2)io 0x3b0:0x3bb, 0x3c0:0x3df
181 */
182 f1_write_config32(0xf4, val);
183
184}
185
186/**
187 * @return
188 * @retval 2 resoure does not exist, usable
189 * @retval 0 resource exists, not usable
190 * @retval 1 resource exist, resource has been allocated before
191 */
192static int reg_useable(unsigned reg, device_t goal_dev, unsigned goal_nodeid,
193 unsigned goal_link)
194{
195 struct resource *res;
196 unsigned nodeid, link = 0;
197 int result;
198 res = 0;
199 for (nodeid = 0; !res && (nodeid < fx_devs); nodeid++) {
200 device_t dev;
201 dev = __f0_dev[nodeid];
202 if (!dev)
203 continue;
204 for (link = 0; !res && (link < 8); link++) {
205 res = probe_resource(dev, IOINDEX(0x1000 + reg, link));
206 }
207 }
208 result = 2;
209 if (res) {
210 result = 0;
211 if ((goal_link == (link - 1)) &&
212 (goal_nodeid == (nodeid - 1)) &&
213 (res->flags <= 1)) {
214 result = 1;
215 }
216 }
217 return result;
218}
219
220static struct resource *amdfam16_find_iopair(device_t dev, unsigned nodeid, unsigned link)
221{
222 struct resource *resource;
223 u32 free_reg, reg;
224 resource = 0;
225 free_reg = 0;
226 for (reg = 0xc0; reg <= 0xd8; reg += 0x8) {
227 int result;
228 result = reg_useable(reg, dev, nodeid, link);
229 if (result == 1) {
230 /* I have been allocated this one */
231 break;
232 }
233 else if (result > 1) {
234 /* I have a free register pair */
235 free_reg = reg;
236 }
237 }
238 if (reg > 0xd8) {
239 reg = free_reg; // if no free, the free_reg still be 0
240 }
241
242 resource = new_resource(dev, IOINDEX(0x1000 + reg, link));
243
244 return resource;
245}
246
247static struct resource *amdfam16_find_mempair(device_t dev, u32 nodeid, u32 link)
248{
249 struct resource *resource;
250 u32 free_reg, reg;
251 resource = 0;
252 free_reg = 0;
253 for (reg = 0x80; reg <= 0xb8; reg += 0x8) {
254 int result;
255 result = reg_useable(reg, dev, nodeid, link);
256 if (result == 1) {
257 /* I have been allocated this one */
258 break;
259 }
260 else if (result > 1) {
261 /* I have a free register pair */
262 free_reg = reg;
263 }
264 }
265 if (reg > 0xb8) {
266 reg = free_reg;
267 }
268
269 resource = new_resource(dev, IOINDEX(0x1000 + reg, link));
270 return resource;
271}
272
273static void amdfam16_link_read_bases(device_t dev, u32 nodeid, u32 link)
274{
275 struct resource *resource;
276
277 /* Initialize the io space constraints on the current bus */
278 resource = amdfam16_find_iopair(dev, nodeid, link);
279 if (resource) {
280 u32 align;
281 align = log2(HT_IO_HOST_ALIGN);
282 resource->base = 0;
283 resource->size = 0;
284 resource->align = align;
285 resource->gran = align;
286 resource->limit = 0xffffUL;
287 resource->flags = IORESOURCE_IO | IORESOURCE_BRIDGE;
288 }
289
290 /* Initialize the prefetchable memory constraints on the current bus */
291 resource = amdfam16_find_mempair(dev, nodeid, link);
292 if (resource) {
293 resource->base = 0;
294 resource->size = 0;
295 resource->align = log2(HT_MEM_HOST_ALIGN);
296 resource->gran = log2(HT_MEM_HOST_ALIGN);
297 resource->limit = 0xffffffffffULL;
298 resource->flags = IORESOURCE_MEM | IORESOURCE_PREFETCH;
299 resource->flags |= IORESOURCE_BRIDGE;
300 }
301
302 /* Initialize the memory constraints on the current bus */
303 resource = amdfam16_find_mempair(dev, nodeid, link);
304 if (resource) {
305 resource->base = 0;
306 resource->size = 0;
307 resource->align = log2(HT_MEM_HOST_ALIGN);
308 resource->gran = log2(HT_MEM_HOST_ALIGN);
309 resource->limit = 0xffffffffffULL;
310 resource->flags = IORESOURCE_MEM | IORESOURCE_BRIDGE;
311 }
312
313}
314
315static void read_resources(device_t dev)
316{
317 u32 nodeid;
318 struct bus *link;
319
320 nodeid = amdfam16_nodeid(dev);
321 for (link = dev->link_list; link; link = link->next) {
322 if (link->children) {
323 amdfam16_link_read_bases(dev, nodeid, link->link_num);
324 }
325 }
Kyösti Mälkki5d490382015-05-27 07:58:22 +0300326
327 /*
328 * This MMCONF resource must be reserved in the PCI domain.
329 * It is not honored by the coreboot resource allocator if it is in
330 * the CPU_CLUSTER.
331 */
Kyösti Mälkkie25b5ef2016-12-02 08:56:05 +0200332 mmconf_resource(dev, 0xc0010058);
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600333}
334
335static void set_resource(device_t dev, struct resource *resource, u32 nodeid)
336{
337 resource_t rbase, rend;
338 unsigned reg, link_num;
339 char buf[50];
340
341 /* Make certain the resource has actually been set */
342 if (!(resource->flags & IORESOURCE_ASSIGNED)) {
343 return;
344 }
345
346 /* If I have already stored this resource don't worry about it */
347 if (resource->flags & IORESOURCE_STORED) {
348 return;
349 }
350
351 /* Only handle PCI memory and IO resources */
352 if (!(resource->flags & (IORESOURCE_MEM | IORESOURCE_IO)))
353 return;
354
355 /* Ensure I am actually looking at a resource of function 1 */
356 if ((resource->index & 0xffff) < 0x1000) {
357 return;
358 }
359 /* Get the base address */
360 rbase = resource->base;
361
362 /* Get the limit (rounded up) */
363 rend = resource_end(resource);
364
365 /* Get the register and link */
366 reg = resource->index & 0xfff; // 4k
367 link_num = IOINDEX_LINK(resource->index);
368
369 if (resource->flags & IORESOURCE_IO) {
370 set_io_addr_reg(dev, nodeid, link_num, reg, rbase>>8, rend>>8);
371 }
372 else if (resource->flags & IORESOURCE_MEM) {
Elyes HAOUAS7db506c2016-10-02 11:56:39 +0200373 set_mmio_addr_reg(nodeid, link_num, reg, (resource->index >>24), rbase>>8, rend>>8, node_nums); // [39:8]
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600374 }
375 resource->flags |= IORESOURCE_STORED;
Elyes HAOUAS0d4b11a2016-10-03 21:57:21 +0200376 snprintf(buf, sizeof(buf), " <node %x link %x>",
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600377 nodeid, link_num);
378 report_resource_stored(dev, resource, buf);
379}
380
381/**
382 * I tried to reuse the resource allocation code in set_resource()
383 * but it is too difficult to deal with the resource allocation magic.
384 */
385
386static void create_vga_resource(device_t dev, unsigned nodeid)
387{
388 struct bus *link;
389
390 /* find out which link the VGA card is connected,
391 * we only deal with the 'first' vga card */
392 for (link = dev->link_list; link; link = link->next) {
393 if (link->bridge_ctrl & PCI_BRIDGE_CTL_VGA) {
394#if CONFIG_MULTIPLE_VGA_ADAPTERS
395 extern device_t vga_pri; // the primary vga device, defined in device.c
396 printk(BIOS_DEBUG, "VGA: vga_pri bus num = %d bus range [%d,%d]\n", vga_pri->bus->secondary,
397 link->secondary,link->subordinate);
398 /* We need to make sure the vga_pri is under the link */
Elyes HAOUASa8131602016-09-19 10:27:57 -0600399 if ((vga_pri->bus->secondary >= link->secondary) &&
400 (vga_pri->bus->secondary <= link->subordinate))
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600401#endif
402 break;
403 }
404 }
405
406 /* no VGA card installed */
407 if (link == NULL)
408 return;
409
410 printk(BIOS_DEBUG, "VGA: %s (aka node %d) link %d has VGA device\n", dev_path(dev), nodeid, sblink);
411 set_vga_enable_reg(nodeid, sblink);
412}
413
414static void set_resources(device_t dev)
415{
416 unsigned nodeid;
417 struct bus *bus;
418 struct resource *res;
419
420 /* Find the nodeid */
421 nodeid = amdfam16_nodeid(dev);
422
423 create_vga_resource(dev, nodeid); //TODO: do we need this?
424
425 /* Set each resource we have found */
426 for (res = dev->resource_list; res; res = res->next) {
427 set_resource(dev, res, nodeid);
428 }
429
430 for (bus = dev->link_list; bus; bus = bus->next) {
431 if (bus->children) {
432 assign_resources(bus);
433 }
434 }
435}
436
437static void northbridge_init(struct device *dev)
438{
439}
Kyösti Mälkki0b5b5412014-11-26 08:11:07 +0200440
Vladimir Serbinenko807127f2014-11-09 13:36:18 +0100441static unsigned long acpi_fill_hest(acpi_hest_t *hest)
Kyösti Mälkki0b5b5412014-11-26 08:11:07 +0200442{
443 void *addr, *current;
444
445 /* Skip the HEST header. */
446 current = (void *)(hest + 1);
447
448 addr = agesawrapper_getlateinitptr(PICK_WHEA_MCE);
449 if (addr != NULL)
450 current += acpi_create_hest_error_source(hest, current, 0, (void *)((u32)addr + 2), *(UINT16 *)addr - 2);
451
452 addr = agesawrapper_getlateinitptr(PICK_WHEA_CMC);
453 if (addr != NULL)
454 current += acpi_create_hest_error_source(hest, current, 1, (void *)((u32)addr + 2), *(UINT16 *)addr - 2);
455
456 return (unsigned long)current;
457}
458
Alexander Couzens5eea4582015-04-12 22:18:55 +0200459static void northbridge_fill_ssdt_generator(device_t device)
Kyösti Mälkki0b5b5412014-11-26 08:11:07 +0200460{
461 msr_t msr;
462 char pscope[] = "\\_SB.PCI0";
463
464 acpigen_write_scope(pscope);
465 msr = rdmsr(TOP_MEM);
466 acpigen_write_name_dword("TOM1", msr.lo);
467 msr = rdmsr(TOP_MEM2);
468 /*
469 * Since XP only implements parts of ACPI 2.0, we can't use a qword
470 * here.
471 * See http://www.acpi.info/presentations/S01USMOBS169_OS%2520new.ppt
472 * slide 22ff.
473 * Shift value right by 20 bit to make it fit into 32bit,
474 * giving us 1MB granularity and a limit of almost 4Exabyte of memory.
475 */
476 acpigen_write_name_dword("TOM2", (msr.hi << 12) | msr.lo >> 20);
477 acpigen_pop_len();
478}
479
Alexander Couzens83fc32f2015-04-12 22:28:37 +0200480static unsigned long agesa_write_acpi_tables(device_t device,
481 unsigned long current,
Kyösti Mälkki0b5b5412014-11-26 08:11:07 +0200482 acpi_rsdp_t *rsdp)
483{
484 acpi_srat_t *srat;
485 acpi_slit_t *slit;
486 acpi_header_t *ssdt;
487 acpi_header_t *alib;
488 acpi_header_t *ivrs;
489 acpi_hest_t *hest;
490
491 /* HEST */
492 current = ALIGN(current, 8);
493 hest = (acpi_hest_t *)current;
Vladimir Serbinenko807127f2014-11-09 13:36:18 +0100494 acpi_write_hest((void *)current, acpi_fill_hest);
Kyösti Mälkki0b5b5412014-11-26 08:11:07 +0200495 acpi_add_table(rsdp, (void *)current);
496 current += ((acpi_header_t *)current)->length;
497
498 current = ALIGN(current, 8);
499 printk(BIOS_DEBUG, "ACPI: * IVRS at %lx\n", current);
500 ivrs = agesawrapper_getlateinitptr(PICK_IVRS);
501 if (ivrs != NULL) {
502 memcpy((void *)current, ivrs, ivrs->length);
503 ivrs = (acpi_header_t *) current;
504 current += ivrs->length;
505 acpi_add_table(rsdp, ivrs);
506 } else {
507 printk(BIOS_DEBUG, " AGESA IVRS table NULL. Skipping.\n");
508 }
509
510 /* SRAT */
511 current = ALIGN(current, 8);
512 printk(BIOS_DEBUG, "ACPI: * SRAT at %lx\n", current);
513 srat = (acpi_srat_t *) agesawrapper_getlateinitptr (PICK_SRAT);
514 if (srat != NULL) {
515 memcpy((void *)current, srat, srat->header.length);
516 srat = (acpi_srat_t *) current;
517 current += srat->header.length;
518 acpi_add_table(rsdp, srat);
519 } else {
520 printk(BIOS_DEBUG, " AGESA SRAT table NULL. Skipping.\n");
521 }
522
523 /* SLIT */
524 current = ALIGN(current, 8);
525 printk(BIOS_DEBUG, "ACPI: * SLIT at %lx\n", current);
526 slit = (acpi_slit_t *) agesawrapper_getlateinitptr (PICK_SLIT);
527 if (slit != NULL) {
528 memcpy((void *)current, slit, slit->header.length);
529 slit = (acpi_slit_t *) current;
530 current += slit->header.length;
531 acpi_add_table(rsdp, slit);
532 } else {
533 printk(BIOS_DEBUG, " AGESA SLIT table NULL. Skipping.\n");
534 }
535
536 /* ALIB */
537 current = ALIGN(current, 16);
538 printk(BIOS_DEBUG, "ACPI: * AGESA ALIB SSDT at %lx\n", current);
539 alib = (acpi_header_t *)agesawrapper_getlateinitptr (PICK_ALIB);
540 if (alib != NULL) {
541 memcpy((void *)current, alib, alib->length);
542 alib = (acpi_header_t *) current;
543 current += alib->length;
544 acpi_add_table(rsdp, (void *)alib);
545 }
546 else {
547 printk(BIOS_DEBUG, " AGESA ALIB SSDT table NULL. Skipping.\n");
548 }
549
550 /* this pstate ssdt may cause Blue Screen: Fixed: Keep this comment for a while. */
551 /* SSDT */
552 current = ALIGN(current, 16);
553 printk(BIOS_DEBUG, "ACPI: * SSDT at %lx\n", current);
554 ssdt = (acpi_header_t *)agesawrapper_getlateinitptr (PICK_PSTATE);
555 if (ssdt != NULL) {
556 memcpy((void *)current, ssdt, ssdt->length);
557 ssdt = (acpi_header_t *) current;
558 current += ssdt->length;
559 }
560 else {
561 printk(BIOS_DEBUG, " AGESA PState table NULL. Skipping.\n");
562 }
563 acpi_add_table(rsdp,ssdt);
564
565 printk(BIOS_DEBUG, "ACPI: * SSDT for PState at %lx\n", current);
566 return current;
567}
568
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600569static struct device_operations northbridge_operations = {
570 .read_resources = read_resources,
571 .set_resources = set_resources,
572 .enable_resources = pci_dev_enable_resources,
573 .init = northbridge_init,
Kyösti Mälkki0b5b5412014-11-26 08:11:07 +0200574 .acpi_fill_ssdt_generator = northbridge_fill_ssdt_generator,
575 .write_acpi_tables = agesa_write_acpi_tables,
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600576 .enable = 0,
577 .ops_pci = 0,
578};
579
580static const struct pci_driver family16_northbridge __pci_driver = {
581 .ops = &northbridge_operations,
582 .vendor = PCI_VENDOR_ID_AMD,
Marshall Dawson463f46e2016-10-14 20:46:08 -0600583 .device = PCI_DEVICE_ID_AMD_16H_MODEL_303F_NB_HT,
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600584};
585
586static const struct pci_driver family10_northbridge __pci_driver = {
587 .ops = &northbridge_operations,
588 .vendor = PCI_VENDOR_ID_AMD,
589 .device = PCI_DEVICE_ID_AMD_10H_NB_HT,
590};
591
Dave Frodin891f71a2015-01-19 15:58:24 -0700592static void fam16_finalize(void *chip_info)
593{
594 device_t dev;
595 u32 value;
596 dev = dev_find_slot(0, PCI_DEVFN(0, 0)); /* clear IoapicSbFeatureEn */
597 pci_write_config32(dev, 0xF8, 0);
598 pci_write_config32(dev, 0xFC, 5); /* TODO: move it to dsdt.asl */
599
600 /* disable No Snoop */
601 dev = dev_find_slot(0, PCI_DEVFN(1, 1));
602 value = pci_read_config32(dev, 0x60);
603 value &= ~(1 << 11);
604 pci_write_config32(dev, 0x60, value);
605}
606
Kyösti Mälkkie4c17ce2014-10-21 18:22:32 +0300607struct chip_operations northbridge_amd_pi_00730F01_ops = {
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600608 CHIP_NAME("AMD FAM16 Northbridge")
609 .enable_dev = 0,
Dave Frodin891f71a2015-01-19 15:58:24 -0700610 .final = fam16_finalize,
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600611};
612
613static void domain_read_resources(device_t dev)
614{
615 unsigned reg;
616
617 /* Find the already assigned resource pairs */
618 get_fx_devs();
619 for (reg = 0x80; reg <= 0xd8; reg+= 0x08) {
620 u32 base, limit;
621 base = f1_read_config32(reg);
622 limit = f1_read_config32(reg + 0x04);
623 /* Is this register allocated? */
624 if ((base & 3) != 0) {
625 unsigned nodeid, reg_link;
626 device_t reg_dev;
Elyes HAOUASa8131602016-09-19 10:27:57 -0600627 if (reg < 0xc0) { // mmio
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600628 nodeid = (limit & 0xf) + (base&0x30);
629 } else { // io
630 nodeid = (limit & 0xf) + ((base>>4)&0x30);
631 }
632 reg_link = (limit >> 4) & 7;
633 reg_dev = __f0_dev[nodeid];
634 if (reg_dev) {
635 /* Reserve the resource */
636 struct resource *res;
637 res = new_resource(reg_dev, IOINDEX(0x1000 + reg, reg_link));
638 if (res) {
639 res->flags = 1;
640 }
641 }
642 }
643 }
644 /* FIXME: do we need to check extend conf space?
645 I don't believe that much preset value */
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600646 pci_domain_read_resources(dev);
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600647}
648
649static void domain_enable_resources(device_t dev)
650{
651 if (acpi_is_wakeup_s3())
652 AGESAWRAPPER(fchs3laterestore);
653
654 /* Must be called after PCI enumeration and resource allocation */
655 if (!acpi_is_wakeup_s3())
656 AGESAWRAPPER(amdinitmid);
657
658 printk(BIOS_DEBUG, " ader - leaving domain_enable_resources.\n");
659}
660
661#if CONFIG_HW_MEM_HOLE_SIZEK != 0
662struct hw_mem_hole_info {
663 unsigned hole_startk;
664 int node_id;
665};
666static struct hw_mem_hole_info get_hw_mem_hole_info(void)
667{
668 struct hw_mem_hole_info mem_hole;
669 int i;
670 mem_hole.hole_startk = CONFIG_HW_MEM_HOLE_SIZEK;
671 mem_hole.node_id = -1;
672 for (i = 0; i < node_nums; i++) {
673 dram_base_mask_t d;
674 u32 hole;
675 d = get_dram_base_mask(i);
676 if (!(d.mask & 1)) continue; // no memory on this node
677 hole = pci_read_config32(__f1_dev[i], 0xf0);
678 if (hole & 2) { // we find the hole
679 mem_hole.hole_startk = (hole & (0xff<<24)) >> 10;
680 mem_hole.node_id = i; // record the node No with hole
681 break; // only one hole
682 }
683 }
684
685 /* We need to double check if there is special set on base reg and limit reg
686 * are not continuous instead of hole, it will find out its hole_startk.
687 */
688 if (mem_hole.node_id == -1) {
689 resource_t limitk_pri = 0;
Elyes HAOUASa8131602016-09-19 10:27:57 -0600690 for (i = 0; i < node_nums; i++) {
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600691 dram_base_mask_t d;
692 resource_t base_k, limit_k;
693 d = get_dram_base_mask(i);
694 if (!(d.base & 1)) continue;
695 base_k = ((resource_t)(d.base & 0x1fffff00)) <<9;
696 if (base_k > 4 *1024 * 1024) break; // don't need to go to check
697 if (limitk_pri != base_k) { // we find the hole
698 mem_hole.hole_startk = (unsigned)limitk_pri; // must beblow 4G
699 mem_hole.node_id = i;
700 break; //only one hole
701 }
702 limit_k = ((resource_t)(((d.mask & ~1) + 0x000FF) & 0x1fffff00)) << 9;
703 limitk_pri = limit_k;
704 }
705 }
706 return mem_hole;
707}
708#endif
709
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600710static void domain_set_resources(device_t dev)
711{
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600712 unsigned long mmio_basek;
713 u32 pci_tolm;
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600714 int i, idx;
715 struct bus *link;
716#if CONFIG_HW_MEM_HOLE_SIZEK != 0
717 struct hw_mem_hole_info mem_hole;
718 u32 reset_memhole = 1;
719#endif
720
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600721 pci_tolm = 0xffffffffUL;
722 for (link = dev->link_list; link; link = link->next) {
723 pci_tolm = find_pci_tolm(link);
724 }
725
726 // FIXME handle interleaved nodes. If you fix this here, please fix
727 // amdk8, too.
728 mmio_basek = pci_tolm >> 10;
729 /* Round mmio_basek to something the processor can support */
730 mmio_basek &= ~((1 << 6) -1);
731
732 // FIXME improve mtrr.c so we don't use up all of the mtrrs with a 64M
733 // MMIO hole. If you fix this here, please fix amdk8, too.
734 /* Round the mmio hole to 64M */
735 mmio_basek &= ~((64*1024) - 1);
736
737#if CONFIG_HW_MEM_HOLE_SIZEK != 0
738 /* if the hw mem hole is already set in raminit stage, here we will compare
739 * mmio_basek and hole_basek. if mmio_basek is bigger that hole_basek and will
740 * use hole_basek as mmio_basek and we don't need to reset hole.
741 * otherwise We reset the hole to the mmio_basek
742 */
743
744 mem_hole = get_hw_mem_hole_info();
745
746 // Use hole_basek as mmio_basek, and we don't need to reset hole anymore
747 if ((mem_hole.node_id != -1) && (mmio_basek > mem_hole.hole_startk)) {
748 mmio_basek = mem_hole.hole_startk;
749 reset_memhole = 0;
750 }
751#endif
752
753 idx = 0x10;
754 for (i = 0; i < node_nums; i++) {
755 dram_base_mask_t d;
756 resource_t basek, limitk, sizek; // 4 1T
757
758 d = get_dram_base_mask(i);
759
760 if (!(d.mask & 1)) continue;
761 basek = ((resource_t)(d.base & 0x1fffff00)) << 9; // could overflow, we may lost 6 bit here
Elyes HAOUAS7db506c2016-10-02 11:56:39 +0200762 limitk = ((resource_t)(((d.mask & ~1) + 0x000FF) & 0x1fffff00)) << 9;
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600763
764 sizek = limitk - basek;
765
766 /* see if we need a hole from 0xa0000 to 0xbffff */
767 if ((basek < ((8*64)+(8*16))) && (sizek > ((8*64)+(16*16)))) {
768 ram_resource(dev, (idx | i), basek, ((8*64)+(8*16)) - basek);
769 idx += 0x10;
770 basek = (8*64)+(16*16);
771 sizek = limitk - ((8*64)+(16*16));
772
773 }
774
775 //printk(BIOS_DEBUG, "node %d : mmio_basek=%08lx, basek=%08llx, limitk=%08llx\n", i, mmio_basek, basek, limitk);
776
777 /* split the region to accommodate pci memory space */
Elyes HAOUASa8131602016-09-19 10:27:57 -0600778 if ((basek < 4*1024*1024) && (limitk > mmio_basek)) {
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600779 if (basek <= mmio_basek) {
780 unsigned pre_sizek;
781 pre_sizek = mmio_basek - basek;
Elyes HAOUASa8131602016-09-19 10:27:57 -0600782 if (pre_sizek > 0) {
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600783 ram_resource(dev, (idx | i), basek, pre_sizek);
784 idx += 0x10;
785 sizek -= pre_sizek;
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600786 }
787 basek = mmio_basek;
788 }
789 if ((basek + sizek) <= 4*1024*1024) {
790 sizek = 0;
791 }
792 else {
793 uint64_t topmem2 = bsp_topmem2();
794 basek = 4*1024*1024;
795 sizek = topmem2/1024 - basek;
796 }
797 }
798
799 ram_resource(dev, (idx | i), basek, sizek);
800 idx += 0x10;
801 printk(BIOS_DEBUG, "node %d: mmio_basek=%08lx, basek=%08llx, limitk=%08llx\n",
802 i, mmio_basek, basek, limitk);
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600803 }
804
Kyösti Mälkkie87564f2017-04-15 20:07:53 +0300805 add_uma_resource_below_tolm(dev, 7);
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600806
Elyes HAOUAS5a7e72f2016-08-23 21:36:02 +0200807 for (link = dev->link_list; link; link = link->next) {
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600808 if (link->children) {
809 assign_resources(link);
810 }
811 }
812}
813
Philipp Deppenwiese30670122017-03-01 02:24:33 +0100814static const char *domain_acpi_name(struct device *dev)
815{
816 if (dev->path.type == DEVICE_PATH_DOMAIN)
817 return "PCI0";
818
819 return NULL;
820}
821
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600822static struct device_operations pci_domain_ops = {
823 .read_resources = domain_read_resources,
824 .set_resources = domain_set_resources,
825 .enable_resources = domain_enable_resources,
826 .init = NULL,
827 .scan_bus = pci_domain_scan_bus,
828 .ops_pci_bus = pci_bus_default_ops,
Philipp Deppenwiese30670122017-03-01 02:24:33 +0100829 .acpi_name = domain_acpi_name,
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600830};
831
832static void sysconf_init(device_t dev) // first node
833{
834 sblink = (pci_read_config32(dev, 0x64)>>8) & 7; // don't forget sublink1
835 node_nums = ((pci_read_config32(dev, 0x60)>>4) & 7) + 1; //NodeCnt[2:0]
836}
837
838static void add_more_links(device_t dev, unsigned total_links)
839{
840 struct bus *link, *last = NULL;
841 int link_num;
842
843 for (link = dev->link_list; link; link = link->next)
844 last = link;
845
846 if (last) {
847 int links = total_links - last->link_num;
848 link_num = last->link_num;
849 if (links > 0) {
850 link = malloc(links*sizeof(*link));
851 if (!link)
852 die("Couldn't allocate more links!\n");
853 memset(link, 0, links*sizeof(*link));
854 last->next = link;
855 }
856 }
857 else {
858 link_num = -1;
859 link = malloc(total_links*sizeof(*link));
860 memset(link, 0, total_links*sizeof(*link));
861 dev->link_list = link;
862 }
863
864 for (link_num = link_num + 1; link_num < total_links; link_num++) {
865 link->link_num = link_num;
866 link->dev = dev;
867 link->next = link + 1;
868 last = link;
869 link = link->next;
870 }
871 last->next = NULL;
872}
873
Kyösti Mälkki580e7222015-03-19 21:04:23 +0200874static void cpu_bus_scan(device_t dev)
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600875{
876 struct bus *cpu_bus;
877 device_t dev_mc;
878#if CONFIG_CBB
879 device_t pci_domain;
880#endif
881 int i,j;
882 int coreid_bits;
883 int core_max = 0;
884 unsigned ApicIdCoreIdSize;
885 unsigned core_nums;
886 int siblings = 0;
887 unsigned int family;
888 u32 modules = 0;
889 VOID* modules_ptr = &modules;
890 BUILD_OPT_CFG* options = NULL;
891 int ioapic_count = 0;
892
893 // TODO Remove the printk's.
894 printk(BIOS_SPEW, "MullinsPI Debug: Grabbing the AMD Topology Information.\n");
895 AmdGetValue(AMD_GLOBAL_USER_OPTIONS, (VOID**)&options, sizeof(options));
896 AmdGetValue(AMD_GLOBAL_NUM_MODULES, &modules_ptr, sizeof(modules));
Alexandru Gagniuc2e0cf142014-12-28 20:38:32 -0600897 modules = *(u32*)modules_ptr;
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600898 ASSERT(modules > 0);
899 ASSERT(options);
900 ioapic_count = (int)options->CfgPlatNumIoApics;
901 ASSERT(ioapic_count > 0);
902 printk(BIOS_SPEW, "MullinsPI Debug: AMD Topology Number of Modules (@0x%p) is %d\n", modules_ptr, modules);
903 printk(BIOS_SPEW, "MullinsPI Debug: AMD Topology Number of IOAPICs (@0x%p) is %d\n", options, (int)options->CfgPlatNumIoApics);
904
905#if CONFIG_CBB
906 dev_mc = dev_find_slot(0, PCI_DEVFN(CONFIG_CDB, 0)); //0x00
907 if (dev_mc && dev_mc->bus) {
908 printk(BIOS_DEBUG, "%s found", dev_path(dev_mc));
909 pci_domain = dev_mc->bus->dev;
910 if (pci_domain && (pci_domain->path.type == DEVICE_PATH_DOMAIN)) {
911 printk(BIOS_DEBUG, "\n%s move to ",dev_path(dev_mc));
912 dev_mc->bus->secondary = CONFIG_CBB; // move to 0xff
913 printk(BIOS_DEBUG, "%s",dev_path(dev_mc));
914 } else {
915 printk(BIOS_DEBUG, " but it is not under pci_domain directly ");
916 }
917 printk(BIOS_DEBUG, "\n");
918 }
919 dev_mc = dev_find_slot(CONFIG_CBB, PCI_DEVFN(CONFIG_CDB, 0));
920 if (!dev_mc) {
921 dev_mc = dev_find_slot(0, PCI_DEVFN(0x18, 0));
922 if (dev_mc && dev_mc->bus) {
923 printk(BIOS_DEBUG, "%s found\n", dev_path(dev_mc));
924 pci_domain = dev_mc->bus->dev;
925 if (pci_domain && (pci_domain->path.type == DEVICE_PATH_DOMAIN)) {
926 if ((pci_domain->link_list) && (pci_domain->link_list->children == dev_mc)) {
927 printk(BIOS_DEBUG, "%s move to ",dev_path(dev_mc));
928 dev_mc->bus->secondary = CONFIG_CBB; // move to 0xff
929 printk(BIOS_DEBUG, "%s\n",dev_path(dev_mc));
930 while (dev_mc) {
931 printk(BIOS_DEBUG, "%s move to ",dev_path(dev_mc));
932 dev_mc->path.pci.devfn -= PCI_DEVFN(0x18,0);
933 printk(BIOS_DEBUG, "%s\n",dev_path(dev_mc));
934 dev_mc = dev_mc->sibling;
935 }
936 }
937 }
938 }
939 }
940#endif
941 dev_mc = dev_find_slot(CONFIG_CBB, PCI_DEVFN(CONFIG_CDB, 0));
942 if (!dev_mc) {
943 printk(BIOS_ERR, "%02x:%02x.0 not found", CONFIG_CBB, CONFIG_CDB);
944 die("");
945 }
946 sysconf_init(dev_mc);
947#if CONFIG_CBB && (MAX_NODE_NUMS > 32)
Elyes HAOUASa8131602016-09-19 10:27:57 -0600948 if (node_nums > 32) { // need to put node 32 to node 63 to bus 0xfe
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600949 if (pci_domain->link_list && !pci_domain->link_list->next) {
950 struct bus *new_link = new_link(pci_domain);
951 pci_domain->link_list->next = new_link;
952 new_link->link_num = 1;
953 new_link->dev = pci_domain;
954 new_link->children = 0;
955 printk(BIOS_DEBUG, "%s links now 2\n", dev_path(pci_domain));
956 }
957 pci_domain->link_list->next->secondary = CONFIG_CBB - 1;
958 }
959#endif
960
961 /* Get Max Number of cores(MNC) */
962 coreid_bits = (cpuid_ecx(AMD_CPUID_ASIZE_PCCOUNT) & 0x0000F000) >> 12;
963 core_max = 1 << (coreid_bits & 0x000F); //mnc
964
965 ApicIdCoreIdSize = ((cpuid_ecx(0x80000008)>>12) & 0xF);
966 if (ApicIdCoreIdSize) {
967 core_nums = (1 << ApicIdCoreIdSize) - 1;
968 } else {
969 core_nums = 3; //quad core
970 }
971
972 /* Find which cpus are present */
973 cpu_bus = dev->link_list;
974 for (i = 0; i < node_nums; i++) {
975 device_t cdb_dev;
976 unsigned busn, devn;
977 struct bus *pbus;
978
979 busn = CONFIG_CBB;
980 devn = CONFIG_CDB + i;
981 pbus = dev_mc->bus;
982#if CONFIG_CBB && (MAX_NODE_NUMS > 32)
983 if (i >= 32) {
984 busn--;
985 devn -= 32;
986 pbus = pci_domain->link_list->next;
987 }
988#endif
989
990 /* Find the cpu's pci device */
991 cdb_dev = dev_find_slot(busn, PCI_DEVFN(devn, 0));
992 if (!cdb_dev) {
993 /* If I am probing things in a weird order
994 * ensure all of the cpu's pci devices are found.
995 */
996 int fn;
Elyes HAOUAS5a7e72f2016-08-23 21:36:02 +0200997 for (fn = 0; fn <= 5; fn++) { //FBDIMM?
Bruce Griffith27ed80b2014-08-15 11:46:25 -0600998 cdb_dev = pci_probe_dev(NULL, pbus,
999 PCI_DEVFN(devn, fn));
1000 }
1001 cdb_dev = dev_find_slot(busn, PCI_DEVFN(devn, 0));
1002 } else {
1003 /* Ok, We need to set the links for that device.
1004 * otherwise the device under it will not be scanned
1005 */
Kyösti Mälkkic5163ed82015-02-04 13:25:37 +02001006
1007 add_more_links(cdb_dev, 4);
Bruce Griffith27ed80b2014-08-15 11:46:25 -06001008 }
1009
1010 family = cpuid_eax(1);
1011 family = (family >> 20) & 0xFF;
1012 if (family == 1) { //f10
1013 u32 dword;
1014 cdb_dev = dev_find_slot(busn, PCI_DEVFN(devn, 3));
1015 dword = pci_read_config32(cdb_dev, 0xe8);
1016 siblings = ((dword & BIT15) >> 13) | ((dword & (BIT13 | BIT12)) >> 12);
1017 } else if (family == 7) {//f16
1018 cdb_dev = dev_find_slot(busn, PCI_DEVFN(devn, 5));
1019 if (cdb_dev && cdb_dev->enabled) {
1020 siblings = pci_read_config32(cdb_dev, 0x84);
1021 siblings &= 0xFF;
1022 }
1023 } else {
1024 siblings = 0; //default one core
1025 }
1026 int enable_node = cdb_dev && cdb_dev->enabled;
Elyes HAOUASa8131602016-09-19 10:27:57 -06001027 printk(BIOS_SPEW, "%s family%xh, core_max = 0x%x, core_nums = 0x%x, siblings = 0x%x\n",
Bruce Griffith27ed80b2014-08-15 11:46:25 -06001028 dev_path(cdb_dev), 0x0f + family, core_max, core_nums, siblings);
1029
Elyes HAOUASa8131602016-09-19 10:27:57 -06001030 for (j = 0; j <= siblings; j++) {
Bruce Griffith27ed80b2014-08-15 11:46:25 -06001031 u32 lapicid_start = 0;
1032
1033 /*
1034 * APIC ID calucation is tightly coupled with AGESA v5 code.
1035 * This calculation MUST match the assignment calculation done
1036 * in LocalApicInitializationAtEarly() function.
1037 * And reference GetLocalApicIdForCore()
1038 *
1039 * Apply apic enumeration rules
1040 * For systems with >= 16 APICs, put the IO-APICs at 0..n and
1041 * put the local-APICs at m..z
1042 *
1043 * This is needed because many IO-APIC devices only have 4 bits
1044 * for their APIC id and therefore must reside at 0..15
Elyes HAOUAS6e8b3c12016-09-02 19:22:00 +02001045 */
Bruce Griffith27ed80b2014-08-15 11:46:25 -06001046 if ((node_nums * core_max) + ioapic_count >= 0x10) {
1047 lapicid_start = (ioapic_count - 1) / core_max;
1048 lapicid_start = (lapicid_start + 1) * core_max;
Elyes HAOUASa8131602016-09-19 10:27:57 -06001049 printk(BIOS_SPEW, "lpaicid_start = 0x%x ", lapicid_start);
Bruce Griffith27ed80b2014-08-15 11:46:25 -06001050 }
1051 u32 apic_id = (lapicid_start * (i/modules + 1)) + ((i % modules) ? (j + (siblings + 1)) : j);
Elyes HAOUASa8131602016-09-19 10:27:57 -06001052 printk(BIOS_SPEW, "node 0x%x core 0x%x apicid = 0x%x\n",
Bruce Griffith27ed80b2014-08-15 11:46:25 -06001053 i, j, apic_id);
1054
1055 device_t cpu = add_cpu_device(cpu_bus, apic_id, enable_node);
1056 if (cpu)
1057 amd_cpu_topology(cpu, i, j);
1058 } //j
1059 }
Bruce Griffith27ed80b2014-08-15 11:46:25 -06001060}
1061
1062static void cpu_bus_init(device_t dev)
1063{
1064 initialize_cpus(dev->link_list);
1065}
1066
Bruce Griffith27ed80b2014-08-15 11:46:25 -06001067static struct device_operations cpu_bus_ops = {
Kyösti Mälkki48f82a92016-12-02 16:02:30 +02001068 .read_resources = DEVICE_NOOP,
1069 .set_resources = DEVICE_NOOP,
Edward O'Callaghan812d2a42014-10-31 08:17:23 +11001070 .enable_resources = DEVICE_NOOP,
Bruce Griffith27ed80b2014-08-15 11:46:25 -06001071 .init = cpu_bus_init,
1072 .scan_bus = cpu_bus_scan,
1073};
1074
1075static void root_complex_enable_dev(struct device *dev)
1076{
1077 static int done = 0;
1078
Bruce Griffith27ed80b2014-08-15 11:46:25 -06001079 if (!done) {
1080 setup_bsp_ramtop();
Bruce Griffith27ed80b2014-08-15 11:46:25 -06001081 done = 1;
1082 }
1083
1084 /* Set the operations if it is a special bus type */
1085 if (dev->path.type == DEVICE_PATH_DOMAIN) {
1086 dev->ops = &pci_domain_ops;
1087 } else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER) {
1088 dev->ops = &cpu_bus_ops;
1089 }
1090}
1091
Kyösti Mälkkie4c17ce2014-10-21 18:22:32 +03001092struct chip_operations northbridge_amd_pi_00730F01_root_complex_ops = {
Bruce Griffith27ed80b2014-08-15 11:46:25 -06001093 CHIP_NAME("AMD FAM16 Root Complex")
1094 .enable_dev = root_complex_enable_dev,
1095};
1096
1097/*********************************************************************
1098 * Change the vendor / device IDs to match the generic VBIOS header. *
1099 *********************************************************************/
1100u32 map_oprom_vendev(u32 vendev)
1101{
1102 u32 new_vendev;
1103 new_vendev =
1104 ((0x10029850 <= vendev) && (vendev <= 0x1002986F)) ? 0x10029850 : vendev;
1105
1106 if (vendev != new_vendev)
1107 printk(BIOS_NOTICE, "Mapping PCI device %8x to %8x\n", vendev, new_vendev);
1108
1109 return new_vendev;
1110}