zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 1 | /* |
| 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. |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | #include <console/console.h> |
| 17 | #include <arch/io.h> |
Kyösti Mälkki | 8ae16a4 | 2014-06-19 20:44:34 +0300 | [diff] [blame] | 18 | #include <arch/acpi.h> |
Vladimir Serbinenko | 56f46d8 | 2014-10-08 22:06:27 +0200 | [diff] [blame] | 19 | #include <arch/acpigen.h> |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 20 | #include <stdint.h> |
| 21 | #include <device/device.h> |
| 22 | #include <device/pci.h> |
| 23 | #include <device/pci_ids.h> |
| 24 | #include <device/hypertransport.h> |
| 25 | #include <stdlib.h> |
| 26 | #include <string.h> |
Ronald G. Minnich | 5079a0d | 2012-11-27 11:32:38 -0800 | [diff] [blame] | 27 | #include <lib.h> |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 28 | #include <cpu/cpu.h> |
| 29 | #include <cbmem.h> |
Martin Roth | 73e86a8 | 2013-01-17 16:28:30 -0700 | [diff] [blame] | 30 | #include <AGESA.h> |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 31 | |
| 32 | #include <cpu/x86/lapic.h> |
Kyösti Mälkki | dbc4739 | 2012-08-05 12:11:40 +0300 | [diff] [blame] | 33 | #include <cpu/amd/mtrr.h> |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 34 | |
| 35 | #include <Porting.h> |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 36 | #include <Options.h> |
| 37 | #include <Topology.h> |
| 38 | #include <cpu/amd/amdfam15.h> |
| 39 | #include <cpuRegisters.h> |
Kyösti Mälkki | f21c2ac | 2014-10-19 09:35:18 +0300 | [diff] [blame] | 40 | #include <northbridge/amd/agesa/agesawrapper.h> |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 41 | |
| 42 | #define MAX_NODE_NUMS (MAX_NODES * MAX_DIES) |
| 43 | |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 44 | typedef struct dram_base_mask { |
| 45 | u32 base; //[47:27] at [28:8] |
| 46 | u32 mask; //[47:27] at [28:8] and enable at bit 0 |
| 47 | } dram_base_mask_t; |
| 48 | |
| 49 | static unsigned node_nums; |
| 50 | static unsigned sblink; |
| 51 | static device_t __f0_dev[MAX_NODE_NUMS]; |
| 52 | static device_t __f1_dev[MAX_NODE_NUMS]; |
| 53 | static device_t __f2_dev[MAX_NODE_NUMS]; |
| 54 | static device_t __f4_dev[MAX_NODE_NUMS]; |
| 55 | static unsigned fx_devs = 0; |
| 56 | |
| 57 | static dram_base_mask_t get_dram_base_mask(u32 nodeid) |
| 58 | { |
| 59 | device_t dev; |
| 60 | dram_base_mask_t d; |
| 61 | dev = __f1_dev[0]; |
| 62 | u32 temp; |
| 63 | temp = pci_read_config32(dev, 0x44 + (nodeid << 3)); //[39:24] at [31:16] |
| 64 | d.mask = ((temp & 0xfff80000)>>(8+3)); // mask out DramMask [26:24] too |
| 65 | temp = pci_read_config32(dev, 0x144 + (nodeid <<3)) & 0xff; //[47:40] at [7:0] |
| 66 | d.mask |= temp<<21; |
| 67 | temp = pci_read_config32(dev, 0x40 + (nodeid << 3)); //[39:24] at [31:16] |
| 68 | d.mask |= (temp & 1); // enable bit |
| 69 | d.base = ((temp & 0xfff80000)>>(8+3)); // mask out DramBase [26:24) too |
| 70 | temp = pci_read_config32(dev, 0x140 + (nodeid <<3)) & 0xff; //[47:40] at [7:0] |
| 71 | d.base |= temp<<21; |
| 72 | return d; |
| 73 | } |
| 74 | |
| 75 | static void set_io_addr_reg(device_t dev, u32 nodeid, u32 linkn, u32 reg, |
| 76 | u32 io_min, u32 io_max) |
| 77 | { |
| 78 | u32 i; |
| 79 | u32 tempreg; |
| 80 | /* io range allocation */ |
| 81 | tempreg = (nodeid&0xf) | ((nodeid & 0x30)<<(8-4)) | (linkn<<4) | ((io_max&0xf0)<<(12-4)); //limit |
| 82 | for (i=0; i<node_nums; i++) |
| 83 | pci_write_config32(__f1_dev[i], reg+4, tempreg); |
| 84 | tempreg = 3 /*| ( 3<<4)*/ | ((io_min&0xf0)<<(12-4)); //base :ISA and VGA ? |
| 85 | #if 0 |
| 86 | // FIXME: can we use VGA reg instead? |
| 87 | if (dev->link[link].bridge_ctrl & PCI_BRIDGE_CTL_VGA) { |
| 88 | printk(BIOS_SPEW, "%s, enabling legacy VGA IO forwarding for %s link %s\n", |
| 89 | __func__, dev_path(dev), link); |
| 90 | tempreg |= PCI_IO_BASE_VGA_EN; |
| 91 | } |
| 92 | if (dev->link[link].bridge_ctrl & PCI_BRIDGE_CTL_NO_ISA) { |
| 93 | tempreg |= PCI_IO_BASE_NO_ISA; |
| 94 | } |
| 95 | #endif |
| 96 | for (i=0; i<node_nums; i++) |
| 97 | pci_write_config32(__f1_dev[i], reg, tempreg); |
| 98 | } |
| 99 | |
| 100 | static void set_mmio_addr_reg(u32 nodeid, u32 linkn, u32 reg, u32 index, u32 mmio_min, u32 mmio_max, u32 nodes) |
| 101 | { |
| 102 | u32 i; |
| 103 | u32 tempreg; |
| 104 | /* io range allocation */ |
| 105 | tempreg = (nodeid&0xf) | (linkn<<4) | (mmio_max&0xffffff00); //limit |
| 106 | for (i=0; i<nodes; i++) |
| 107 | pci_write_config32(__f1_dev[i], reg+4, tempreg); |
| 108 | tempreg = 3 | (nodeid & 0x30) | (mmio_min&0xffffff00); |
| 109 | for (i=0; i<node_nums; i++) |
| 110 | pci_write_config32(__f1_dev[i], reg, tempreg); |
| 111 | } |
| 112 | |
| 113 | static device_t get_node_pci(u32 nodeid, u32 fn) |
| 114 | { |
zbao | d462736 | 2012-07-23 19:49:40 +0800 | [diff] [blame] | 115 | #if MAX_NODE_NUMS + CONFIG_CDB >= 32 |
| 116 | if ((CONFIG_CDB + nodeid) < 32) { |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 117 | return dev_find_slot(CONFIG_CBB, PCI_DEVFN(CONFIG_CDB + nodeid, fn)); |
| 118 | } else { |
| 119 | return dev_find_slot(CONFIG_CBB-1, PCI_DEVFN(CONFIG_CDB + nodeid - 32, fn)); |
| 120 | } |
| 121 | #else |
| 122 | return dev_find_slot(CONFIG_CBB, PCI_DEVFN(CONFIG_CDB + nodeid, fn)); |
| 123 | #endif |
| 124 | } |
| 125 | |
| 126 | static void get_fx_devs(void) |
| 127 | { |
| 128 | int i; |
| 129 | for (i = 0; i < MAX_NODE_NUMS; i++) { |
| 130 | __f0_dev[i] = get_node_pci(i, 0); |
| 131 | __f1_dev[i] = get_node_pci(i, 1); |
| 132 | __f2_dev[i] = get_node_pci(i, 2); |
| 133 | __f4_dev[i] = get_node_pci(i, 4); |
| 134 | if (__f0_dev[i] != NULL && __f1_dev[i] != NULL) |
| 135 | fx_devs = i+1; |
| 136 | } |
| 137 | if (__f1_dev[0] == NULL || __f0_dev[0] == NULL || fx_devs == 0) { |
| 138 | die("Cannot find 0:0x18.[0|1]\n"); |
| 139 | } |
| 140 | printk(BIOS_DEBUG, "fx_devs=0x%x\n", fx_devs); |
| 141 | } |
| 142 | |
| 143 | static u32 f1_read_config32(unsigned reg) |
| 144 | { |
| 145 | if (fx_devs == 0) |
| 146 | get_fx_devs(); |
| 147 | return pci_read_config32(__f1_dev[0], reg); |
| 148 | } |
| 149 | |
| 150 | static void f1_write_config32(unsigned reg, u32 value) |
| 151 | { |
| 152 | int i; |
| 153 | if (fx_devs == 0) |
| 154 | get_fx_devs(); |
| 155 | for(i = 0; i < fx_devs; i++) { |
| 156 | device_t dev; |
| 157 | dev = __f1_dev[i]; |
| 158 | if (dev && dev->enabled) { |
| 159 | pci_write_config32(dev, reg, value); |
| 160 | } |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | static u32 amdfam15_nodeid(device_t dev) |
| 165 | { |
| 166 | #if MAX_NODE_NUMS == 64 |
| 167 | unsigned busn; |
| 168 | busn = dev->bus->secondary; |
| 169 | if (busn != CONFIG_CBB) { |
| 170 | return (dev->path.pci.devfn >> 3) - CONFIG_CDB + 32; |
| 171 | } else { |
| 172 | return (dev->path.pci.devfn >> 3) - CONFIG_CDB; |
| 173 | } |
| 174 | |
| 175 | #else |
| 176 | return (dev->path.pci.devfn >> 3) - CONFIG_CDB; |
| 177 | #endif |
| 178 | } |
| 179 | |
| 180 | static void set_vga_enable_reg(u32 nodeid, u32 linkn) |
| 181 | { |
| 182 | u32 val; |
| 183 | |
| 184 | val = 1 | (nodeid<<4) | (linkn<<12); |
| 185 | /* it will routing |
| 186 | * (1)mmio 0xa0000:0xbffff |
| 187 | * (2)io 0x3b0:0x3bb, 0x3c0:0x3df |
| 188 | */ |
| 189 | f1_write_config32(0xf4, val); |
| 190 | |
| 191 | } |
| 192 | |
| 193 | /** |
| 194 | * @return |
Edward O'Callaghan | ae5fd34 | 2014-11-20 19:58:09 +1100 | [diff] [blame] | 195 | * @retval 2 resoure does not exist, usable |
| 196 | * @retval 0 resource exists, not usable |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 197 | * @retval 1 resource exist, resource has been allocated before |
| 198 | */ |
| 199 | static int reg_useable(unsigned reg, device_t goal_dev, unsigned goal_nodeid, |
| 200 | unsigned goal_link) |
| 201 | { |
| 202 | struct resource *res; |
| 203 | unsigned nodeid, link = 0; |
| 204 | int result; |
| 205 | res = 0; |
| 206 | for (nodeid = 0; !res && (nodeid < fx_devs); nodeid++) { |
| 207 | device_t dev; |
| 208 | dev = __f0_dev[nodeid]; |
| 209 | if (!dev) |
| 210 | continue; |
| 211 | for (link = 0; !res && (link < 8); link++) { |
| 212 | res = probe_resource(dev, IOINDEX(0x1000 + reg, link)); |
| 213 | } |
| 214 | } |
| 215 | result = 2; |
| 216 | if (res) { |
| 217 | result = 0; |
| 218 | if ((goal_link == (link - 1)) && |
| 219 | (goal_nodeid == (nodeid - 1)) && |
| 220 | (res->flags <= 1)) { |
| 221 | result = 1; |
| 222 | } |
| 223 | } |
| 224 | return result; |
| 225 | } |
| 226 | |
| 227 | static struct resource *amdfam15_find_iopair(device_t dev, unsigned nodeid, unsigned link) |
| 228 | { |
| 229 | struct resource *resource; |
| 230 | u32 free_reg, reg; |
| 231 | resource = 0; |
| 232 | free_reg = 0; |
| 233 | for (reg = 0xc0; reg <= 0xd8; reg += 0x8) { |
| 234 | int result; |
| 235 | result = reg_useable(reg, dev, nodeid, link); |
| 236 | if (result == 1) { |
| 237 | /* I have been allocated this one */ |
| 238 | break; |
| 239 | } |
| 240 | else if (result > 1) { |
| 241 | /* I have a free register pair */ |
| 242 | free_reg = reg; |
| 243 | } |
| 244 | } |
| 245 | if (reg > 0xd8) { |
| 246 | reg = free_reg; // if no free, the free_reg still be 0 |
| 247 | } |
| 248 | |
| 249 | resource = new_resource(dev, IOINDEX(0x1000 + reg, link)); |
| 250 | |
| 251 | return resource; |
| 252 | } |
| 253 | |
| 254 | static struct resource *amdfam15_find_mempair(device_t dev, u32 nodeid, u32 link) |
| 255 | { |
| 256 | struct resource *resource; |
| 257 | u32 free_reg, reg; |
| 258 | resource = 0; |
| 259 | free_reg = 0; |
| 260 | for (reg = 0x80; reg <= 0xb8; reg += 0x8) { |
| 261 | int result; |
| 262 | result = reg_useable(reg, dev, nodeid, link); |
| 263 | if (result == 1) { |
| 264 | /* I have been allocated this one */ |
| 265 | break; |
| 266 | } |
| 267 | else if (result > 1) { |
| 268 | /* I have a free register pair */ |
| 269 | free_reg = reg; |
| 270 | } |
| 271 | } |
| 272 | if (reg > 0xb8) { |
| 273 | reg = free_reg; |
| 274 | } |
| 275 | |
| 276 | resource = new_resource(dev, IOINDEX(0x1000 + reg, link)); |
| 277 | return resource; |
| 278 | } |
| 279 | |
| 280 | static void amdfam15_link_read_bases(device_t dev, u32 nodeid, u32 link) |
| 281 | { |
| 282 | struct resource *resource; |
| 283 | |
| 284 | /* Initialize the io space constraints on the current bus */ |
| 285 | resource = amdfam15_find_iopair(dev, nodeid, link); |
| 286 | if (resource) { |
| 287 | u32 align; |
| 288 | align = log2(HT_IO_HOST_ALIGN); |
| 289 | resource->base = 0; |
| 290 | resource->size = 0; |
| 291 | resource->align = align; |
| 292 | resource->gran = align; |
| 293 | resource->limit = 0xffffUL; |
| 294 | resource->flags = IORESOURCE_IO | IORESOURCE_BRIDGE; |
| 295 | } |
| 296 | |
| 297 | /* Initialize the prefetchable memory constraints on the current bus */ |
| 298 | resource = amdfam15_find_mempair(dev, nodeid, link); |
| 299 | if (resource) { |
| 300 | resource->base = 0; |
| 301 | resource->size = 0; |
| 302 | resource->align = log2(HT_MEM_HOST_ALIGN); |
| 303 | resource->gran = log2(HT_MEM_HOST_ALIGN); |
| 304 | resource->limit = 0xffffffffffULL; |
| 305 | resource->flags = IORESOURCE_MEM | IORESOURCE_PREFETCH; |
| 306 | resource->flags |= IORESOURCE_BRIDGE; |
| 307 | } |
| 308 | |
| 309 | /* Initialize the memory constraints on the current bus */ |
| 310 | resource = amdfam15_find_mempair(dev, nodeid, link); |
| 311 | if (resource) { |
| 312 | resource->base = 0; |
| 313 | resource->size = 0; |
| 314 | resource->align = log2(HT_MEM_HOST_ALIGN); |
| 315 | resource->gran = log2(HT_MEM_HOST_ALIGN); |
| 316 | resource->limit = 0xffffffffffULL; |
| 317 | resource->flags = IORESOURCE_MEM | IORESOURCE_BRIDGE; |
| 318 | } |
| 319 | |
| 320 | } |
| 321 | |
Steven Sherk | f434058 | 2013-01-29 16:13:35 -0700 | [diff] [blame] | 322 | static void nb_read_resources(device_t dev) |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 323 | { |
| 324 | u32 nodeid; |
| 325 | struct bus *link; |
| 326 | |
| 327 | nodeid = amdfam15_nodeid(dev); |
| 328 | for (link = dev->link_list; link; link = link->next) { |
| 329 | if (link->children) { |
| 330 | amdfam15_link_read_bases(dev, nodeid, link->link_num); |
| 331 | } |
| 332 | } |
Steven Sherk | 1cbabb0 | 2013-02-01 09:22:35 -0700 | [diff] [blame] | 333 | |
| 334 | /* |
Stefan Reinauer | 4aff445 | 2013-02-12 14:17:15 -0800 | [diff] [blame] | 335 | * This MMCONF resource must be reserved in the PCI domain. |
Steven Sherk | 1cbabb0 | 2013-02-01 09:22:35 -0700 | [diff] [blame] | 336 | * It is not honored by the coreboot resource allocator if it is in |
Stefan Reinauer | 0aa37c4 | 2013-02-12 15:20:54 -0800 | [diff] [blame] | 337 | * the CPU_CLUSTER. |
Steven Sherk | 1cbabb0 | 2013-02-01 09:22:35 -0700 | [diff] [blame] | 338 | */ |
| 339 | #if CONFIG_MMCONF_SUPPORT |
| 340 | struct resource *resource = new_resource(dev, 0xc0010058); |
| 341 | resource->base = CONFIG_MMCONF_BASE_ADDRESS; |
| 342 | resource->size = CONFIG_MMCONF_BUS_NUMBER * 4096 * 256; |
| 343 | resource->flags = IORESOURCE_MEM | IORESOURCE_RESERVE | |
| 344 | IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED; |
| 345 | #endif |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 346 | } |
| 347 | |
| 348 | static void set_resource(device_t dev, struct resource *resource, u32 nodeid) |
| 349 | { |
| 350 | resource_t rbase, rend; |
| 351 | unsigned reg, link_num; |
| 352 | char buf[50]; |
| 353 | |
| 354 | /* Make certain the resource has actually been set */ |
| 355 | if (!(resource->flags & IORESOURCE_ASSIGNED)) { |
| 356 | return; |
| 357 | } |
| 358 | |
| 359 | /* If I have already stored this resource don't worry about it */ |
| 360 | if (resource->flags & IORESOURCE_STORED) { |
| 361 | return; |
| 362 | } |
| 363 | |
| 364 | /* Only handle PCI memory and IO resources */ |
| 365 | if (!(resource->flags & (IORESOURCE_MEM | IORESOURCE_IO))) |
| 366 | return; |
| 367 | |
| 368 | /* Ensure I am actually looking at a resource of function 1 */ |
| 369 | if ((resource->index & 0xffff) < 0x1000) { |
| 370 | return; |
| 371 | } |
| 372 | /* Get the base address */ |
| 373 | rbase = resource->base; |
| 374 | |
| 375 | /* Get the limit (rounded up) */ |
| 376 | rend = resource_end(resource); |
| 377 | |
| 378 | /* Get the register and link */ |
| 379 | reg = resource->index & 0xfff; // 4k |
| 380 | link_num = IOINDEX_LINK(resource->index); |
| 381 | |
| 382 | if (resource->flags & IORESOURCE_IO) { |
| 383 | set_io_addr_reg(dev, nodeid, link_num, reg, rbase>>8, rend>>8); |
| 384 | } |
| 385 | else if (resource->flags & IORESOURCE_MEM) { |
Edward O'Callaghan | ae5fd34 | 2014-11-20 19:58:09 +1100 | [diff] [blame] | 386 | set_mmio_addr_reg(nodeid, link_num, reg, (resource->index >>24), rbase>>8, rend>>8, node_nums);// [39:8] |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 387 | } |
| 388 | resource->flags |= IORESOURCE_STORED; |
Vladimir Serbinenko | a37383d | 2013-11-26 02:41:26 +0100 | [diff] [blame] | 389 | snprintf(buf, sizeof (buf), " <node %x link %x>", |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 390 | nodeid, link_num); |
| 391 | report_resource_stored(dev, resource, buf); |
| 392 | } |
| 393 | |
| 394 | /** |
| 395 | * I tried to reuse the resource allocation code in set_resource() |
| 396 | * but it is too difficult to deal with the resource allocation magic. |
| 397 | */ |
| 398 | |
| 399 | static void create_vga_resource(device_t dev, unsigned nodeid) |
| 400 | { |
| 401 | struct bus *link; |
| 402 | |
| 403 | /* find out which link the VGA card is connected, |
| 404 | * we only deal with the 'first' vga card */ |
| 405 | for (link = dev->link_list; link; link = link->next) { |
| 406 | if (link->bridge_ctrl & PCI_BRIDGE_CTL_VGA) { |
zbao | d59d624 | 2012-07-23 19:41:03 +0800 | [diff] [blame] | 407 | #if CONFIG_MULTIPLE_VGA_ADAPTERS |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 408 | extern device_t vga_pri; // the primary vga device, defined in device.c |
| 409 | printk(BIOS_DEBUG, "VGA: vga_pri bus num = %d bus range [%d,%d]\n", vga_pri->bus->secondary, |
| 410 | link->secondary,link->subordinate); |
| 411 | /* We need to make sure the vga_pri is under the link */ |
| 412 | if((vga_pri->bus->secondary >= link->secondary ) && |
| 413 | (vga_pri->bus->secondary <= link->subordinate ) |
| 414 | ) |
| 415 | #endif |
| 416 | break; |
| 417 | } |
| 418 | } |
| 419 | |
| 420 | /* no VGA card installed */ |
| 421 | if (link == NULL) |
| 422 | return; |
| 423 | |
| 424 | printk(BIOS_DEBUG, "VGA: %s (aka node %d) link %d has VGA device\n", dev_path(dev), nodeid, sblink); |
| 425 | set_vga_enable_reg(nodeid, sblink); |
| 426 | } |
| 427 | |
Steven Sherk | f434058 | 2013-01-29 16:13:35 -0700 | [diff] [blame] | 428 | static void nb_set_resources(device_t dev) |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 429 | { |
| 430 | unsigned nodeid; |
| 431 | struct bus *bus; |
| 432 | struct resource *res; |
| 433 | |
| 434 | /* Find the nodeid */ |
| 435 | nodeid = amdfam15_nodeid(dev); |
| 436 | |
| 437 | create_vga_resource(dev, nodeid); //TODO: do we need this? |
| 438 | |
| 439 | /* Set each resource we have found */ |
| 440 | for (res = dev->resource_list; res; res = res->next) { |
| 441 | set_resource(dev, res, nodeid); |
| 442 | } |
| 443 | |
| 444 | for (bus = dev->link_list; bus; bus = bus->next) { |
| 445 | if (bus->children) { |
| 446 | assign_resources(bus); |
| 447 | } |
| 448 | } |
Steven Sherk | 1cbabb0 | 2013-02-01 09:22:35 -0700 | [diff] [blame] | 449 | |
| 450 | /* Print the MMCONF region if it has been reserved. */ |
| 451 | res = find_resource(dev, 0xc0010058); |
| 452 | if (res) { |
| 453 | report_resource_stored(dev, res, " <mmconfig>"); |
| 454 | } |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 455 | } |
| 456 | |
Vladimir Serbinenko | 807127f | 2014-11-09 13:36:18 +0100 | [diff] [blame] | 457 | |
| 458 | static unsigned long acpi_fill_hest(acpi_hest_t *hest) |
Vladimir Serbinenko | 56f46d8 | 2014-10-08 22:06:27 +0200 | [diff] [blame] | 459 | { |
| 460 | void *addr, *current; |
| 461 | |
| 462 | /* Skip the HEST header. */ |
| 463 | current = (void *)(hest + 1); |
| 464 | |
| 465 | addr = agesawrapper_getlateinitptr(PICK_WHEA_MCE); |
| 466 | if (addr != NULL) |
Stefan Reinauer | 77a1d1a | 2015-07-21 12:48:17 -0700 | [diff] [blame] | 467 | current += acpi_create_hest_error_source(hest, current, 0, |
| 468 | addr + 2, *(UINT16 *)addr - 2); |
Vladimir Serbinenko | 56f46d8 | 2014-10-08 22:06:27 +0200 | [diff] [blame] | 469 | |
| 470 | addr = agesawrapper_getlateinitptr(PICK_WHEA_CMC); |
| 471 | if (addr != NULL) |
Stefan Reinauer | 77a1d1a | 2015-07-21 12:48:17 -0700 | [diff] [blame] | 472 | current += acpi_create_hest_error_source(hest, current, 1, |
| 473 | addr + 2, *(UINT16 *)addr - 2); |
Vladimir Serbinenko | 56f46d8 | 2014-10-08 22:06:27 +0200 | [diff] [blame] | 474 | |
| 475 | return (unsigned long)current; |
| 476 | } |
| 477 | |
Alexander Couzens | 5eea458 | 2015-04-12 22:18:55 +0200 | [diff] [blame] | 478 | static void northbridge_fill_ssdt_generator(device_t device) |
Vladimir Serbinenko | 56f46d8 | 2014-10-08 22:06:27 +0200 | [diff] [blame] | 479 | { |
| 480 | msr_t msr; |
| 481 | char pscope[] = "\\_SB.PCI0"; |
| 482 | |
| 483 | acpigen_write_scope(pscope); |
| 484 | msr = rdmsr(TOP_MEM); |
| 485 | acpigen_write_name_dword("TOM1", msr.lo); |
| 486 | msr = rdmsr(TOP_MEM2); |
| 487 | /* |
| 488 | * Since XP only implements parts of ACPI 2.0, we can't use a qword |
| 489 | * here. |
| 490 | * See http://www.acpi.info/presentations/S01USMOBS169_OS%2520new.ppt |
| 491 | * slide 22ff. |
| 492 | * Shift value right by 20 bit to make it fit into 32bit, |
| 493 | * giving us 1MB granularity and a limit of almost 4Exabyte of memory. |
| 494 | */ |
| 495 | acpigen_write_name_dword("TOM2", (msr.hi << 12) | msr.lo >> 20); |
| 496 | acpigen_pop_len(); |
| 497 | } |
| 498 | |
Alexander Couzens | 83fc32f | 2015-04-12 22:28:37 +0200 | [diff] [blame] | 499 | static unsigned long agesa_write_acpi_tables(device_t device, |
| 500 | unsigned long current, |
Vladimir Serbinenko | 56f46d8 | 2014-10-08 22:06:27 +0200 | [diff] [blame] | 501 | acpi_rsdp_t *rsdp) |
| 502 | { |
| 503 | acpi_srat_t *srat; |
| 504 | acpi_slit_t *slit; |
| 505 | acpi_header_t *ssdt; |
| 506 | acpi_header_t *alib; |
| 507 | acpi_header_t *ivrs; |
| 508 | acpi_hest_t *hest; |
| 509 | |
| 510 | /* HEST */ |
| 511 | current = ALIGN(current, 8); |
| 512 | hest = (acpi_hest_t *)current; |
Vladimir Serbinenko | 807127f | 2014-11-09 13:36:18 +0100 | [diff] [blame] | 513 | acpi_write_hest((void *)current, acpi_fill_hest); |
Vladimir Serbinenko | 56f46d8 | 2014-10-08 22:06:27 +0200 | [diff] [blame] | 514 | acpi_add_table(rsdp, (void *)current); |
| 515 | current += ((acpi_header_t *)current)->length; |
| 516 | |
| 517 | current = ALIGN(current, 8); |
| 518 | printk(BIOS_DEBUG, "ACPI: * IVRS at %lx\n", current); |
| 519 | ivrs = agesawrapper_getlateinitptr(PICK_IVRS); |
| 520 | if (ivrs != NULL) { |
| 521 | memcpy((void *)current, ivrs, ivrs->length); |
| 522 | ivrs = (acpi_header_t *) current; |
| 523 | current += ivrs->length; |
| 524 | acpi_add_table(rsdp, ivrs); |
| 525 | } else { |
| 526 | printk(BIOS_DEBUG, " AGESA IVRS table NULL. Skipping.\n"); |
| 527 | } |
| 528 | |
| 529 | /* SRAT */ |
| 530 | current = ALIGN(current, 8); |
| 531 | printk(BIOS_DEBUG, "ACPI: * SRAT at %lx\n", current); |
| 532 | srat = (acpi_srat_t *) agesawrapper_getlateinitptr (PICK_SRAT); |
| 533 | if (srat != NULL) { |
| 534 | memcpy((void *)current, srat, srat->header.length); |
| 535 | srat = (acpi_srat_t *) current; |
| 536 | current += srat->header.length; |
| 537 | acpi_add_table(rsdp, srat); |
| 538 | } else { |
| 539 | printk(BIOS_DEBUG, " AGESA SRAT table NULL. Skipping.\n"); |
| 540 | } |
| 541 | |
| 542 | /* SLIT */ |
| 543 | current = ALIGN(current, 8); |
| 544 | printk(BIOS_DEBUG, "ACPI: * SLIT at %lx\n", current); |
| 545 | slit = (acpi_slit_t *) agesawrapper_getlateinitptr (PICK_SLIT); |
| 546 | if (slit != NULL) { |
| 547 | memcpy((void *)current, slit, slit->header.length); |
| 548 | slit = (acpi_slit_t *) current; |
| 549 | current += slit->header.length; |
| 550 | acpi_add_table(rsdp, slit); |
| 551 | } else { |
| 552 | printk(BIOS_DEBUG, " AGESA SLIT table NULL. Skipping.\n"); |
| 553 | } |
| 554 | |
| 555 | /* ALIB */ |
| 556 | current = ALIGN(current, 16); |
| 557 | printk(BIOS_DEBUG, "ACPI: * AGESA ALIB SSDT at %lx\n", current); |
| 558 | alib = (acpi_header_t *)agesawrapper_getlateinitptr (PICK_ALIB); |
| 559 | if (alib != NULL) { |
| 560 | memcpy((void *)current, alib, alib->length); |
| 561 | alib = (acpi_header_t *) current; |
| 562 | current += alib->length; |
| 563 | acpi_add_table(rsdp, (void *)alib); |
| 564 | } |
| 565 | else { |
| 566 | printk(BIOS_DEBUG, " AGESA ALIB SSDT table NULL. Skipping.\n"); |
| 567 | } |
| 568 | |
| 569 | /* this pstate ssdt may cause Blue Screen: Fixed: Keep this comment for a while. */ |
| 570 | /* SSDT */ |
| 571 | current = ALIGN(current, 16); |
| 572 | printk(BIOS_DEBUG, "ACPI: * SSDT at %lx\n", current); |
| 573 | ssdt = (acpi_header_t *)agesawrapper_getlateinitptr (PICK_PSTATE); |
| 574 | if (ssdt != NULL) { |
| 575 | memcpy((void *)current, ssdt, ssdt->length); |
| 576 | ssdt = (acpi_header_t *) current; |
| 577 | current += ssdt->length; |
| 578 | } |
| 579 | else { |
| 580 | printk(BIOS_DEBUG, " AGESA PState table NULL. Skipping.\n"); |
| 581 | } |
| 582 | acpi_add_table(rsdp,ssdt); |
| 583 | |
| 584 | printk(BIOS_DEBUG, "ACPI: * SSDT for PState at %lx\n", current); |
| 585 | |
| 586 | return current; |
| 587 | } |
| 588 | |
| 589 | |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 590 | static struct device_operations northbridge_operations = { |
Steven Sherk | f434058 | 2013-01-29 16:13:35 -0700 | [diff] [blame] | 591 | .read_resources = nb_read_resources, |
| 592 | .set_resources = nb_set_resources, |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 593 | .enable_resources = pci_dev_enable_resources, |
Edward O'Callaghan | d994ef1 | 2014-11-21 02:22:33 +1100 | [diff] [blame] | 594 | .init = DEVICE_NOOP, |
Vladimir Serbinenko | 56f46d8 | 2014-10-08 22:06:27 +0200 | [diff] [blame] | 595 | .acpi_fill_ssdt_generator = northbridge_fill_ssdt_generator, |
| 596 | .write_acpi_tables = agesa_write_acpi_tables, |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 597 | .enable = 0, |
| 598 | .ops_pci = 0, |
| 599 | }; |
| 600 | |
| 601 | static const struct pci_driver family15_northbridge __pci_driver = { |
| 602 | .ops = &northbridge_operations, |
| 603 | .vendor = PCI_VENDOR_ID_AMD, |
| 604 | .device = PCI_DEVICE_ID_AMD_15H_MODEL_001F_NB_HT, |
| 605 | }; |
| 606 | |
| 607 | static const struct pci_driver family10_northbridge __pci_driver = { |
| 608 | .ops = &northbridge_operations, |
| 609 | .vendor = PCI_VENDOR_ID_AMD, |
| 610 | .device = PCI_DEVICE_ID_AMD_10H_NB_HT, |
| 611 | }; |
| 612 | |
| 613 | struct chip_operations northbridge_amd_agesa_family15tn_ops = { |
| 614 | CHIP_NAME("AMD FAM15 Northbridge") |
| 615 | .enable_dev = 0, |
| 616 | }; |
| 617 | |
| 618 | static void domain_read_resources(device_t dev) |
| 619 | { |
| 620 | unsigned reg; |
| 621 | |
| 622 | /* Find the already assigned resource pairs */ |
| 623 | get_fx_devs(); |
| 624 | for (reg = 0x80; reg <= 0xd8; reg+= 0x08) { |
| 625 | u32 base, limit; |
| 626 | base = f1_read_config32(reg); |
| 627 | limit = f1_read_config32(reg + 0x04); |
| 628 | /* Is this register allocated? */ |
| 629 | if ((base & 3) != 0) { |
| 630 | unsigned nodeid, reg_link; |
| 631 | device_t reg_dev; |
| 632 | if (reg<0xc0) { // mmio |
| 633 | nodeid = (limit & 0xf) + (base&0x30); |
| 634 | } else { // io |
| 635 | nodeid = (limit & 0xf) + ((base>>4)&0x30); |
| 636 | } |
| 637 | reg_link = (limit >> 4) & 7; |
| 638 | reg_dev = __f0_dev[nodeid]; |
| 639 | if (reg_dev) { |
| 640 | /* Reserve the resource */ |
| 641 | struct resource *res; |
| 642 | res = new_resource(reg_dev, IOINDEX(0x1000 + reg, reg_link)); |
| 643 | if (res) { |
| 644 | res->flags = 1; |
| 645 | } |
| 646 | } |
| 647 | } |
| 648 | } |
| 649 | /* FIXME: do we need to check extend conf space? |
| 650 | I don't believe that much preset value */ |
| 651 | |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 652 | pci_domain_read_resources(dev); |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 653 | } |
| 654 | |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 655 | static void domain_enable_resources(device_t dev) |
| 656 | { |
Kyösti Mälkki | 8ae16a4 | 2014-06-19 20:44:34 +0300 | [diff] [blame] | 657 | if (acpi_is_wakeup_s3()) |
Kyösti Mälkki | 1aa35c6 | 2014-10-21 14:19:04 +0300 | [diff] [blame] | 658 | agesawrapper_fchs3laterestore(); |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 659 | |
| 660 | /* Must be called after PCI enumeration and resource allocation */ |
Kyösti Mälkki | b139b5e | 2014-10-20 07:41:20 +0300 | [diff] [blame] | 661 | if (!acpi_is_wakeup_s3()) { |
| 662 | /* Enable MMIO on AMD CPU Address Map Controller */ |
Kyösti Mälkki | 48518f0 | 2014-11-25 14:20:57 +0200 | [diff] [blame] | 663 | amd_initcpuio(); |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 664 | |
Kyösti Mälkki | 1aa35c6 | 2014-10-21 14:19:04 +0300 | [diff] [blame] | 665 | agesawrapper_amdinitmid(); |
Kyösti Mälkki | b139b5e | 2014-10-20 07:41:20 +0300 | [diff] [blame] | 666 | } |
Mike Loptien | e133aab | 2013-01-30 16:00:43 -0700 | [diff] [blame] | 667 | printk(BIOS_DEBUG, " ader - leaving %s.\n", __func__); |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 668 | } |
| 669 | |
| 670 | #if CONFIG_HW_MEM_HOLE_SIZEK != 0 |
| 671 | struct hw_mem_hole_info { |
| 672 | unsigned hole_startk; |
| 673 | int node_id; |
| 674 | }; |
| 675 | static struct hw_mem_hole_info get_hw_mem_hole_info(void) |
| 676 | { |
| 677 | struct hw_mem_hole_info mem_hole; |
| 678 | int i; |
| 679 | mem_hole.hole_startk = CONFIG_HW_MEM_HOLE_SIZEK; |
| 680 | mem_hole.node_id = -1; |
| 681 | for (i = 0; i < node_nums; i++) { |
| 682 | dram_base_mask_t d; |
| 683 | u32 hole; |
| 684 | d = get_dram_base_mask(i); |
| 685 | if (!(d.mask & 1)) continue; // no memory on this node |
| 686 | hole = pci_read_config32(__f1_dev[i], 0xf0); |
| 687 | if (hole & 1) { // we find the hole |
| 688 | mem_hole.hole_startk = (hole & (0xff<<24)) >> 10; |
| 689 | mem_hole.node_id = i; // record the node No with hole |
| 690 | break; // only one hole |
| 691 | } |
| 692 | } |
Kyösti Mälkki | 2f9b3af | 2014-06-26 05:30:54 +0300 | [diff] [blame] | 693 | |
| 694 | /* We need to double check if there is special set on base reg and limit reg |
| 695 | * are not continuous instead of hole, it will find out its hole_startk. |
| 696 | */ |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 697 | if (mem_hole.node_id == -1) { |
| 698 | resource_t limitk_pri = 0; |
| 699 | for (i=0; i<node_nums; i++) { |
| 700 | dram_base_mask_t d; |
| 701 | resource_t base_k, limit_k; |
| 702 | d = get_dram_base_mask(i); |
| 703 | if (!(d.base & 1)) continue; |
| 704 | base_k = ((resource_t)(d.base & 0x1fffff00)) <<9; |
| 705 | if (base_k > 4 *1024 * 1024) break; // don't need to go to check |
| 706 | if (limitk_pri != base_k) { // we find the hole |
| 707 | mem_hole.hole_startk = (unsigned)limitk_pri; // must beblow 4G |
| 708 | mem_hole.node_id = i; |
| 709 | break; //only one hole |
| 710 | } |
zbao | 15dc3cc | 2012-08-03 15:56:21 +0800 | [diff] [blame] | 711 | limit_k = ((resource_t)(((d.mask & ~1) + 0x000FF) & 0x1fffff00)) << 9; |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 712 | limitk_pri = limit_k; |
| 713 | } |
| 714 | } |
| 715 | return mem_hole; |
| 716 | } |
| 717 | #endif |
| 718 | |
zbao | 405cfe2 | 2012-07-23 19:44:29 +0800 | [diff] [blame] | 719 | #define ONE_MB_SHIFT 20 |
zbao | 6db7f34 | 2012-07-19 16:38:12 +0800 | [diff] [blame] | 720 | |
Kyösti Mälkki | 6b5eb1c | 2012-07-19 19:26:43 +0300 | [diff] [blame] | 721 | static void setup_uma_memory(void) |
zbao | 6db7f34 | 2012-07-19 16:38:12 +0800 | [diff] [blame] | 722 | { |
| 723 | #if CONFIG_GFXUMA |
Kyösti Mälkki | dbc4739 | 2012-08-05 12:11:40 +0300 | [diff] [blame] | 724 | uint32_t topmem = (uint32_t) bsp_topmem(); |
zbao | 6db7f34 | 2012-07-19 16:38:12 +0800 | [diff] [blame] | 725 | uint32_t sys_mem; |
| 726 | |
zbao | 6db7f34 | 2012-07-19 16:38:12 +0800 | [diff] [blame] | 727 | /* refer to UMA Size Consideration in Family15h BKDG. */ |
| 728 | /* Please reference MemNGetUmaSizeOR () */ |
| 729 | /* |
| 730 | * Total system memory UMASize |
| 731 | * >= 2G 512M |
| 732 | * >=1G 256M |
| 733 | * <1G 64M |
| 734 | */ |
Kyösti Mälkki | dbc4739 | 2012-08-05 12:11:40 +0300 | [diff] [blame] | 735 | sys_mem = topmem + (16 << ONE_MB_SHIFT); // Ignore 16MB allocated for C6 when finding UMA size |
| 736 | if ((bsp_topmem2()>>32) || (sys_mem >= 2048 << ONE_MB_SHIFT)) { |
zbao | 405cfe2 | 2012-07-23 19:44:29 +0800 | [diff] [blame] | 737 | uma_memory_size = 512 << ONE_MB_SHIFT; |
| 738 | } else if (sys_mem >= 1024 << ONE_MB_SHIFT) { |
| 739 | uma_memory_size = 256 << ONE_MB_SHIFT; |
zbao | 6db7f34 | 2012-07-19 16:38:12 +0800 | [diff] [blame] | 740 | } else { |
zbao | 405cfe2 | 2012-07-23 19:44:29 +0800 | [diff] [blame] | 741 | uma_memory_size = 64 << ONE_MB_SHIFT; |
zbao | 6db7f34 | 2012-07-19 16:38:12 +0800 | [diff] [blame] | 742 | } |
Kyösti Mälkki | dbc4739 | 2012-08-05 12:11:40 +0300 | [diff] [blame] | 743 | uma_memory_base = topmem - uma_memory_size; /* TOP_MEM1 */ |
zbao | 6db7f34 | 2012-07-19 16:38:12 +0800 | [diff] [blame] | 744 | |
| 745 | printk(BIOS_INFO, "%s: uma size 0x%08llx, memory start 0x%08llx\n", |
| 746 | __func__, uma_memory_size, uma_memory_base); |
zbao | 6db7f34 | 2012-07-19 16:38:12 +0800 | [diff] [blame] | 747 | #endif |
| 748 | } |
| 749 | |
| 750 | |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 751 | static void domain_set_resources(device_t dev) |
| 752 | { |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 753 | unsigned long mmio_basek; |
| 754 | u32 pci_tolm; |
Kyösti Mälkki | 2b790f6 | 2013-09-03 05:25:57 +0300 | [diff] [blame] | 755 | u64 ramtop = 0; |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 756 | int i, idx; |
| 757 | struct bus *link; |
| 758 | #if CONFIG_HW_MEM_HOLE_SIZEK != 0 |
| 759 | struct hw_mem_hole_info mem_hole; |
| 760 | u32 reset_memhole = 1; |
| 761 | #endif |
| 762 | |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 763 | pci_tolm = 0xffffffffUL; |
| 764 | for (link = dev->link_list; link; link = link->next) { |
| 765 | pci_tolm = find_pci_tolm(link); |
| 766 | } |
| 767 | |
| 768 | // FIXME handle interleaved nodes. If you fix this here, please fix |
| 769 | // amdk8, too. |
| 770 | mmio_basek = pci_tolm >> 10; |
| 771 | /* Round mmio_basek to something the processor can support */ |
| 772 | mmio_basek &= ~((1 << 6) -1); |
| 773 | |
| 774 | // FIXME improve mtrr.c so we don't use up all of the mtrrs with a 64M |
| 775 | // MMIO hole. If you fix this here, please fix amdk8, too. |
| 776 | /* Round the mmio hole to 64M */ |
| 777 | mmio_basek &= ~((64*1024) - 1); |
| 778 | |
| 779 | #if CONFIG_HW_MEM_HOLE_SIZEK != 0 |
| 780 | /* if the hw mem hole is already set in raminit stage, here we will compare |
| 781 | * mmio_basek and hole_basek. if mmio_basek is bigger that hole_basek and will |
| 782 | * use hole_basek as mmio_basek and we don't need to reset hole. |
| 783 | * otherwise We reset the hole to the mmio_basek |
| 784 | */ |
| 785 | |
| 786 | mem_hole = get_hw_mem_hole_info(); |
| 787 | |
| 788 | // Use hole_basek as mmio_basek, and we don't need to reset hole anymore |
| 789 | if ((mem_hole.node_id != -1) && (mmio_basek > mem_hole.hole_startk)) { |
| 790 | mmio_basek = mem_hole.hole_startk; |
| 791 | reset_memhole = 0; |
| 792 | } |
| 793 | #endif |
| 794 | |
| 795 | idx = 0x10; |
| 796 | for (i = 0; i < node_nums; i++) { |
| 797 | dram_base_mask_t d; |
| 798 | resource_t basek, limitk, sizek; // 4 1T |
| 799 | |
| 800 | d = get_dram_base_mask(i); |
| 801 | |
| 802 | if (!(d.mask & 1)) continue; |
| 803 | basek = ((resource_t)(d.base & 0x1fffff00)) << 9; // could overflow, we may lost 6 bit here |
Edward O'Callaghan | ae5fd34 | 2014-11-20 19:58:09 +1100 | [diff] [blame] | 804 | limitk = ((resource_t)(((d.mask & ~1) + 0x000FF) & 0x1fffff00)) << 9; |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 805 | |
| 806 | sizek = limitk - basek; |
| 807 | |
| 808 | /* see if we need a hole from 0xa0000 to 0xbffff */ |
| 809 | if ((basek < ((8*64)+(8*16))) && (sizek > ((8*64)+(16*16)))) { |
| 810 | ram_resource(dev, (idx | i), basek, ((8*64)+(8*16)) - basek); |
| 811 | idx += 0x10; |
| 812 | basek = (8*64)+(16*16); |
| 813 | sizek = limitk - ((8*64)+(16*16)); |
| 814 | |
| 815 | } |
| 816 | |
| 817 | //printk(BIOS_DEBUG, "node %d : mmio_basek=%08lx, basek=%08llx, limitk=%08llx\n", i, mmio_basek, basek, limitk); |
| 818 | |
Kyösti Mälkki | 26c6543 | 2014-06-26 05:30:54 +0300 | [diff] [blame] | 819 | /* split the region to accommodate pci memory space */ |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 820 | if ((basek < 4*1024*1024 ) && (limitk > mmio_basek)) { |
| 821 | if (basek <= mmio_basek) { |
| 822 | unsigned pre_sizek; |
| 823 | pre_sizek = mmio_basek - basek; |
| 824 | if (pre_sizek>0) { |
| 825 | ram_resource(dev, (idx | i), basek, pre_sizek); |
| 826 | idx += 0x10; |
| 827 | sizek -= pre_sizek; |
Kyösti Mälkki | 2b790f6 | 2013-09-03 05:25:57 +0300 | [diff] [blame] | 828 | if (!ramtop) |
| 829 | ramtop = mmio_basek * 1024; |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 830 | } |
| 831 | basek = mmio_basek; |
| 832 | } |
| 833 | if ((basek + sizek) <= 4*1024*1024) { |
| 834 | sizek = 0; |
| 835 | } |
| 836 | else { |
Siyuan Wang | 29840e2 | 2013-06-04 19:56:22 +0800 | [diff] [blame] | 837 | uint64_t topmem2 = bsp_topmem2(); |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 838 | basek = 4*1024*1024; |
Siyuan Wang | 29840e2 | 2013-06-04 19:56:22 +0800 | [diff] [blame] | 839 | sizek = topmem2/1024 - basek; |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 840 | } |
| 841 | } |
| 842 | |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 843 | ram_resource(dev, (idx | i), basek, sizek); |
| 844 | idx += 0x10; |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 845 | printk(BIOS_DEBUG, "node %d: mmio_basek=%08lx, basek=%08llx, limitk=%08llx\n", |
| 846 | i, mmio_basek, basek, limitk); |
Kyösti Mälkki | 2b790f6 | 2013-09-03 05:25:57 +0300 | [diff] [blame] | 847 | if (!ramtop) |
| 848 | ramtop = limitk * 1024; |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 849 | } |
| 850 | |
Kyösti Mälkki | 63f8c08 | 2012-07-10 13:27:26 +0300 | [diff] [blame] | 851 | #if CONFIG_GFXUMA |
Kyösti Mälkki | 2b790f6 | 2013-09-03 05:25:57 +0300 | [diff] [blame] | 852 | set_top_of_ram(uma_memory_base); |
Kyösti Mälkki | 63f8c08 | 2012-07-10 13:27:26 +0300 | [diff] [blame] | 853 | uma_resource(dev, 7, uma_memory_base >> 10, uma_memory_size >> 10); |
Kyösti Mälkki | 2b790f6 | 2013-09-03 05:25:57 +0300 | [diff] [blame] | 854 | #else |
| 855 | set_top_of_ram(ramtop); |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 856 | #endif |
| 857 | |
| 858 | for(link = dev->link_list; link; link = link->next) { |
| 859 | if (link->children) { |
| 860 | assign_resources(link); |
| 861 | } |
| 862 | } |
| 863 | } |
| 864 | |
| 865 | static struct device_operations pci_domain_ops = { |
| 866 | .read_resources = domain_read_resources, |
| 867 | .set_resources = domain_set_resources, |
| 868 | .enable_resources = domain_enable_resources, |
Edward O'Callaghan | e9e1d7a | 2015-01-02 15:11:49 +1100 | [diff] [blame] | 869 | .init = DEVICE_NOOP, |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 870 | .scan_bus = pci_domain_scan_bus, |
Kyösti Mälkki | 872c922 | 2013-07-03 09:44:28 +0300 | [diff] [blame] | 871 | .ops_pci_bus = pci_bus_default_ops, |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 872 | }; |
| 873 | |
| 874 | static void sysconf_init(device_t dev) // first node |
| 875 | { |
| 876 | sblink = (pci_read_config32(dev, 0x64)>>8) & 7; // don't forget sublink1 |
| 877 | node_nums = ((pci_read_config32(dev, 0x60)>>4) & 7) + 1; //NodeCnt[2:0] |
| 878 | } |
| 879 | |
| 880 | static void add_more_links(device_t dev, unsigned total_links) |
| 881 | { |
| 882 | struct bus *link, *last = NULL; |
| 883 | int link_num; |
| 884 | |
| 885 | for (link = dev->link_list; link; link = link->next) |
| 886 | last = link; |
| 887 | |
| 888 | if (last) { |
| 889 | int links = total_links - last->link_num; |
| 890 | link_num = last->link_num; |
| 891 | if (links > 0) { |
| 892 | link = malloc(links*sizeof(*link)); |
| 893 | if (!link) |
| 894 | die("Couldn't allocate more links!\n"); |
| 895 | memset(link, 0, links*sizeof(*link)); |
| 896 | last->next = link; |
| 897 | } |
| 898 | } |
| 899 | else { |
| 900 | link_num = -1; |
| 901 | link = malloc(total_links*sizeof(*link)); |
| 902 | memset(link, 0, total_links*sizeof(*link)); |
| 903 | dev->link_list = link; |
| 904 | } |
| 905 | |
| 906 | for (link_num = link_num + 1; link_num < total_links; link_num++) { |
| 907 | link->link_num = link_num; |
| 908 | link->dev = dev; |
| 909 | link->next = link + 1; |
| 910 | last = link; |
| 911 | link = link->next; |
| 912 | } |
| 913 | last->next = NULL; |
| 914 | } |
| 915 | |
Kyösti Mälkki | 580e722 | 2015-03-19 21:04:23 +0200 | [diff] [blame] | 916 | static void cpu_bus_scan(device_t dev) |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 917 | { |
| 918 | struct bus *cpu_bus; |
| 919 | device_t dev_mc; |
| 920 | #if CONFIG_CBB |
| 921 | device_t pci_domain; |
| 922 | #endif |
| 923 | int i,j; |
| 924 | int coreid_bits; |
| 925 | int core_max = 0; |
| 926 | unsigned ApicIdCoreIdSize; |
| 927 | unsigned core_nums; |
| 928 | int siblings = 0; |
| 929 | unsigned int family; |
| 930 | |
| 931 | #if CONFIG_CBB |
| 932 | dev_mc = dev_find_slot(0, PCI_DEVFN(CONFIG_CDB, 0)); //0x00 |
| 933 | if (dev_mc && dev_mc->bus) { |
| 934 | printk(BIOS_DEBUG, "%s found", dev_path(dev_mc)); |
| 935 | pci_domain = dev_mc->bus->dev; |
Stefan Reinauer | 4aff445 | 2013-02-12 14:17:15 -0800 | [diff] [blame] | 936 | if (pci_domain && (pci_domain->path.type == DEVICE_PATH_DOMAIN)) { |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 937 | printk(BIOS_DEBUG, "\n%s move to ",dev_path(dev_mc)); |
| 938 | dev_mc->bus->secondary = CONFIG_CBB; // move to 0xff |
| 939 | printk(BIOS_DEBUG, "%s",dev_path(dev_mc)); |
| 940 | } else { |
| 941 | printk(BIOS_DEBUG, " but it is not under pci_domain directly "); |
| 942 | } |
| 943 | printk(BIOS_DEBUG, "\n"); |
| 944 | } |
| 945 | dev_mc = dev_find_slot(CONFIG_CBB, PCI_DEVFN(CONFIG_CDB, 0)); |
| 946 | if (!dev_mc) { |
| 947 | dev_mc = dev_find_slot(0, PCI_DEVFN(0x18, 0)); |
| 948 | if (dev_mc && dev_mc->bus) { |
| 949 | printk(BIOS_DEBUG, "%s found\n", dev_path(dev_mc)); |
| 950 | pci_domain = dev_mc->bus->dev; |
Stefan Reinauer | 4aff445 | 2013-02-12 14:17:15 -0800 | [diff] [blame] | 951 | if (pci_domain && (pci_domain->path.type == DEVICE_PATH_DOMAIN)) { |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 952 | if ((pci_domain->link_list) && (pci_domain->link_list->children == dev_mc)) { |
| 953 | printk(BIOS_DEBUG, "%s move to ",dev_path(dev_mc)); |
| 954 | dev_mc->bus->secondary = CONFIG_CBB; // move to 0xff |
| 955 | printk(BIOS_DEBUG, "%s\n",dev_path(dev_mc)); |
| 956 | while (dev_mc) { |
| 957 | printk(BIOS_DEBUG, "%s move to ",dev_path(dev_mc)); |
| 958 | dev_mc->path.pci.devfn -= PCI_DEVFN(0x18,0); |
| 959 | printk(BIOS_DEBUG, "%s\n",dev_path(dev_mc)); |
| 960 | dev_mc = dev_mc->sibling; |
| 961 | } |
| 962 | } |
| 963 | } |
| 964 | } |
| 965 | } |
| 966 | #endif |
| 967 | dev_mc = dev_find_slot(CONFIG_CBB, PCI_DEVFN(CONFIG_CDB, 0)); |
| 968 | if (!dev_mc) { |
| 969 | printk(BIOS_ERR, "%02x:%02x.0 not found", CONFIG_CBB, CONFIG_CDB); |
| 970 | die(""); |
| 971 | } |
| 972 | sysconf_init(dev_mc); |
| 973 | #if CONFIG_CBB && (MAX_NODE_NUMS > 32) |
| 974 | if (node_nums>32) { // need to put node 32 to node 63 to bus 0xfe |
| 975 | if (pci_domain->link_list && !pci_domain->link_list->next) { |
| 976 | struct bus *new_link = new_link(pci_domain); |
| 977 | pci_domain->link_list->next = new_link; |
| 978 | new_link->link_num = 1; |
| 979 | new_link->dev = pci_domain; |
| 980 | new_link->children = 0; |
| 981 | printk(BIOS_DEBUG, "%s links now 2\n", dev_path(pci_domain)); |
| 982 | } |
| 983 | pci_domain->link_list->next->secondary = CONFIG_CBB - 1; |
| 984 | } |
| 985 | #endif |
| 986 | |
| 987 | /* Get Max Number of cores(MNC) */ |
| 988 | coreid_bits = (cpuid_ecx(AMD_CPUID_ASIZE_PCCOUNT) & 0x0000F000) >> 12; |
| 989 | core_max = 1 << (coreid_bits & 0x000F); //mnc |
| 990 | |
| 991 | ApicIdCoreIdSize = ((cpuid_ecx(0x80000008)>>12) & 0xF); |
| 992 | if (ApicIdCoreIdSize) { |
| 993 | core_nums = (1 << ApicIdCoreIdSize) - 1; |
| 994 | } else { |
| 995 | core_nums = 3; //quad core |
| 996 | } |
| 997 | |
| 998 | /* Find which cpus are present */ |
| 999 | cpu_bus = dev->link_list; |
| 1000 | for (i = 0; i < node_nums; i++) { |
Kyösti Mälkki | cd9fc1a | 2012-07-06 19:02:56 +0300 | [diff] [blame] | 1001 | device_t cdb_dev; |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 1002 | unsigned busn, devn; |
| 1003 | struct bus *pbus; |
| 1004 | |
| 1005 | busn = CONFIG_CBB; |
| 1006 | devn = CONFIG_CDB + i; |
| 1007 | pbus = dev_mc->bus; |
| 1008 | #if CONFIG_CBB && (MAX_NODE_NUMS > 32) |
| 1009 | if (i >= 32) { |
| 1010 | busn--; |
| 1011 | devn -= 32; |
| 1012 | pbus = pci_domain->link_list->next; |
| 1013 | } |
| 1014 | #endif |
| 1015 | |
| 1016 | /* Find the cpu's pci device */ |
| 1017 | cdb_dev = dev_find_slot(busn, PCI_DEVFN(devn, 0)); |
| 1018 | if (!cdb_dev) { |
| 1019 | /* If I am probing things in a weird order |
| 1020 | * ensure all of the cpu's pci devices are found. |
| 1021 | */ |
| 1022 | int fn; |
| 1023 | for(fn = 0; fn <= 5; fn++) { //FBDIMM? |
| 1024 | cdb_dev = pci_probe_dev(NULL, pbus, |
| 1025 | PCI_DEVFN(devn, fn)); |
| 1026 | } |
| 1027 | cdb_dev = dev_find_slot(busn, PCI_DEVFN(devn, 0)); |
| 1028 | } else { |
| 1029 | /* Ok, We need to set the links for that device. |
| 1030 | * otherwise the device under it will not be scanned |
| 1031 | */ |
Kyösti Mälkki | 2a2d613 | 2015-02-04 13:25:37 +0200 | [diff] [blame] | 1032 | add_more_links(cdb_dev, 4); |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 1033 | } |
| 1034 | |
| 1035 | family = cpuid_eax(1); |
| 1036 | family = (family >> 20) & 0xFF; |
| 1037 | if (family == 1) { //f10 |
| 1038 | u32 dword; |
| 1039 | cdb_dev = dev_find_slot(busn, PCI_DEVFN(devn, 3)); |
| 1040 | dword = pci_read_config32(cdb_dev, 0xe8); |
| 1041 | siblings = ((dword & BIT15) >> 13) | ((dword & (BIT13 | BIT12)) >> 12); |
| 1042 | } else if (family == 6) {//f15 |
| 1043 | cdb_dev = dev_find_slot(busn, PCI_DEVFN(devn, 5)); |
| 1044 | if (cdb_dev && cdb_dev->enabled) { |
| 1045 | siblings = pci_read_config32(cdb_dev, 0x84); |
| 1046 | siblings &= 0xFF; |
| 1047 | } |
| 1048 | } else { |
| 1049 | siblings = 0; //default one core |
| 1050 | } |
Kyösti Mälkki | cd9fc1a | 2012-07-06 19:02:56 +0300 | [diff] [blame] | 1051 | int enable_node = cdb_dev && cdb_dev->enabled; |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 1052 | printk(BIOS_SPEW, "%s family%xh, core_max=0x%x, core_nums=0x%x, siblings=0x%x\n", |
| 1053 | dev_path(cdb_dev), 0x0f + family, core_max, core_nums, siblings); |
| 1054 | |
| 1055 | for (j = 0; j <= siblings; j++ ) { |
| 1056 | extern CONST OPTIONS_CONFIG_TOPOLOGY ROMDATA TopologyConfiguration; |
| 1057 | u32 modules = TopologyConfiguration.PlatformNumberOfModules; |
| 1058 | u32 lapicid_start = 0; |
| 1059 | |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 1060 | /* |
| 1061 | * APIC ID calucation is tightly coupled with AGESA v5 code. |
| 1062 | * This calculation MUST match the assignment calculation done |
| 1063 | * in LocalApicInitializationAtEarly() function. |
| 1064 | * And reference GetLocalApicIdForCore() |
| 1065 | * |
| 1066 | * Apply apic enumeration rules |
| 1067 | * For systems with >= 16 APICs, put the IO-APICs at 0..n and |
| 1068 | * put the local-APICs at m..z |
| 1069 | * |
| 1070 | * This is needed because many IO-APIC devices only have 4 bits |
| 1071 | * for their APIC id and therefore must reside at 0..15 |
| 1072 | */ |
| 1073 | #ifndef CFG_PLAT_NUM_IO_APICS /* defined in mainboard buildOpts.c */ |
| 1074 | #define CFG_PLAT_NUM_IO_APICS 3 |
| 1075 | #endif |
| 1076 | if ((node_nums * core_max) + CFG_PLAT_NUM_IO_APICS >= 0x10) { |
| 1077 | lapicid_start = (CFG_PLAT_NUM_IO_APICS - 1) / core_max; |
| 1078 | lapicid_start = (lapicid_start + 1) * core_max; |
| 1079 | printk(BIOS_SPEW, "lpaicid_start=0x%x ", lapicid_start); |
| 1080 | } |
Kyösti Mälkki | c33f1e9 | 2012-08-07 17:12:11 +0300 | [diff] [blame] | 1081 | u32 apic_id = (lapicid_start * (i/modules + 1)) + ((i % modules) ? (j + (siblings + 1)) : j); |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 1082 | printk(BIOS_SPEW, "node 0x%x core 0x%x apicid=0x%x\n", |
Kyösti Mälkki | c33f1e9 | 2012-08-07 17:12:11 +0300 | [diff] [blame] | 1083 | i, j, apic_id); |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 1084 | |
Kyösti Mälkki | c33f1e9 | 2012-08-07 17:12:11 +0300 | [diff] [blame] | 1085 | device_t cpu = add_cpu_device(cpu_bus, apic_id, enable_node); |
| 1086 | if (cpu) |
| 1087 | amd_cpu_topology(cpu, i, j); |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 1088 | } //j |
| 1089 | } |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 1090 | } |
| 1091 | |
| 1092 | static void cpu_bus_init(device_t dev) |
| 1093 | { |
| 1094 | initialize_cpus(dev->link_list); |
| 1095 | } |
| 1096 | |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 1097 | static struct device_operations cpu_bus_ops = { |
Edward O'Callaghan | 2837ab2 | 2014-11-06 08:57:40 +1100 | [diff] [blame] | 1098 | .read_resources = DEVICE_NOOP, |
| 1099 | .set_resources = DEVICE_NOOP, |
Edward O'Callaghan | 812d2a4 | 2014-10-31 08:17:23 +1100 | [diff] [blame] | 1100 | .enable_resources = DEVICE_NOOP, |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 1101 | .init = cpu_bus_init, |
| 1102 | .scan_bus = cpu_bus_scan, |
| 1103 | }; |
| 1104 | |
| 1105 | static void root_complex_enable_dev(struct device *dev) |
| 1106 | { |
Kyösti Mälkki | 87213b6 | 2012-08-27 20:00:33 +0300 | [diff] [blame] | 1107 | static int done = 0; |
| 1108 | |
| 1109 | /* Do not delay UMA setup, as a device on the PCI bus may evaluate |
| 1110 | the global uma_memory variables already in its enable function. */ |
| 1111 | if (!done) { |
| 1112 | setup_bsp_ramtop(); |
| 1113 | setup_uma_memory(); |
| 1114 | done = 1; |
| 1115 | } |
| 1116 | |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 1117 | /* Set the operations if it is a special bus type */ |
Stefan Reinauer | 4aff445 | 2013-02-12 14:17:15 -0800 | [diff] [blame] | 1118 | if (dev->path.type == DEVICE_PATH_DOMAIN) { |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 1119 | dev->ops = &pci_domain_ops; |
Stefan Reinauer | 0aa37c4 | 2013-02-12 15:20:54 -0800 | [diff] [blame] | 1120 | } else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER) { |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 1121 | dev->ops = &cpu_bus_ops; |
| 1122 | } |
| 1123 | } |
| 1124 | |
| 1125 | struct chip_operations northbridge_amd_agesa_family15tn_root_complex_ops = { |
Edward O'Callaghan | ae5fd34 | 2014-11-20 19:58:09 +1100 | [diff] [blame] | 1126 | CHIP_NAME("AMD FAM15tn Root Complex") |
zbao | 2c08f6a | 2012-07-02 15:32:58 +0800 | [diff] [blame] | 1127 | .enable_dev = root_complex_enable_dev, |
| 1128 | }; |
Dave Frodin | cbf3d40 | 2012-12-05 08:20:12 -0700 | [diff] [blame] | 1129 | |
Edward O'Callaghan | ae5fd34 | 2014-11-20 19:58:09 +1100 | [diff] [blame] | 1130 | /********************************************************************* |
| 1131 | * Change the vendor / device IDs to match the generic VBIOS header. * |
| 1132 | *********************************************************************/ |
Dave Frodin | cbf3d40 | 2012-12-05 08:20:12 -0700 | [diff] [blame] | 1133 | u32 map_oprom_vendev(u32 vendev) |
| 1134 | { |
Edward O'Callaghan | ae5fd34 | 2014-11-20 19:58:09 +1100 | [diff] [blame] | 1135 | u32 new_vendev = vendev; |
Dave Frodin | cbf3d40 | 2012-12-05 08:20:12 -0700 | [diff] [blame] | 1136 | |
| 1137 | switch(vendev) { |
Bruce Griffith | 42e11f5 | 2013-07-08 18:19:08 -0600 | [diff] [blame] | 1138 | case 0x10029900: /* AMD Radeon HD 7660G (Trinity) */ |
| 1139 | case 0x10029901: /* AMD Radeon HD 7660D (Trinity) */ |
| 1140 | case 0x10029903: /* AMD Radeon HD 7640G (Trinity) */ |
| 1141 | case 0x10029904: /* AMD Radeon HD 7560D (Trinity) */ |
| 1142 | case 0x10029907: /* AMD Radeon HD 7620G (Trinity) */ |
| 1143 | case 0x10029908: /* AMD Radeon HD 7600G (Trinity) */ |
| 1144 | case 0x1002990A: /* AMD Radeon HD 7500G (Trinity) */ |
| 1145 | case 0x1002990B: /* AMD Radeon HD 8650G (Richland) */ |
| 1146 | case 0x1002990C: /* AMD Radeon HD 8670D (Richland) */ |
| 1147 | case 0x1002990D: /* AMD Radeon HD 8550G (Richland) */ |
| 1148 | case 0x1002990E: /* AMD Radeon HD 8570D (Richland) */ |
| 1149 | case 0x1002990F: /* AMD Radeon HD 8610G (Richland) */ |
| 1150 | case 0x10029910: /* AMD Radeon HD 7660G (Trinity) */ |
| 1151 | case 0x10029913: /* AMD Radeon HD 7640G (Trinity) */ |
| 1152 | case 0x10029917: /* AMD Radeon HD 7620G (Trinity) */ |
| 1153 | case 0x10029918: /* AMD Radeon HD 7600G (Trinity) */ |
| 1154 | case 0x10029919: /* AMD Radeon HD 7500G (Trinity) */ |
| 1155 | case 0x10029990: /* AMD Radeon HD 7520G (Trinity) */ |
| 1156 | case 0x10029991: /* AMD Radeon HD 7540D (Trinity) */ |
| 1157 | case 0x10029992: /* AMD Radeon HD 7420G (Trinity) */ |
| 1158 | case 0x10029993: /* AMD Radeon HD 7480D (Trinity) */ |
| 1159 | case 0x10029994: /* AMD Radeon HD 7400G (Trinity) */ |
| 1160 | case 0x10029995: /* AMD Radeon HD 8450G (Richland) */ |
| 1161 | case 0x10029996: /* AMD Radeon HD 8470D (Richland) */ |
| 1162 | case 0x10029997: /* AMD Radeon HD 8350G (Richland) */ |
| 1163 | case 0x10029998: /* AMD Radeon HD 8370D (Richland) */ |
| 1164 | case 0x10029999: /* AMD Radeon HD 8510G (Richland) */ |
| 1165 | case 0x1002999A: /* AMD Radeon HD 8410G (Richland) */ |
| 1166 | case 0x1002999B: /* AMD Radeon HD 8310G (Richland) */ |
| 1167 | case 0x1002999C: /* AMD Radeon HD 8650D (Richland) */ |
| 1168 | case 0x1002999D: /* AMD Radeon HD 8550D (Richland) */ |
| 1169 | case 0x100299A0: /* AMD Radeon HD 7520G (Trinity) */ |
| 1170 | case 0x100299A2: /* AMD Radeon HD 7420G (Trinity) */ |
| 1171 | case 0x100299A4: /* AMD Radeon HD 7400G (Trinity) */ |
Edward O'Callaghan | ae5fd34 | 2014-11-20 19:58:09 +1100 | [diff] [blame] | 1172 | new_vendev = 0x10029901; |
Dave Frodin | cbf3d40 | 2012-12-05 08:20:12 -0700 | [diff] [blame] | 1173 | break; |
| 1174 | } |
| 1175 | |
| 1176 | return new_vendev; |
| 1177 | } |