blob: 08a0c9d7094497cb5d5f3d15c2f7201af1ffeb76 [file] [log] [blame]
Stefan Reinauer00636b02012-04-04 00:08:51 +02001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2007-2009 coresystems GmbH
5 * Copyright (C) 2011 The ChromiumOS Authors. All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
Stefan Reinauer00636b02012-04-04 00:08:51 +020015 */
16
17#include <console/console.h>
18#include <arch/acpi.h>
19#include <arch/io.h>
20#include <stdint.h>
21#include <delay.h>
22#include <cpu/intel/model_206ax/model_206ax.h>
Duncan Laurie77dbbac2012-06-25 09:51:59 -070023#include <cpu/x86/msr.h>
Aaron Durbinc6f27222013-04-03 09:56:57 -050024#include <cpu/x86/mtrr.h>
Stefan Reinauer00636b02012-04-04 00:08:51 +020025#include <device/device.h>
26#include <device/pci.h>
27#include <device/pci_ids.h>
28#include <device/hypertransport.h>
29#include <stdlib.h>
30#include <string.h>
Stefan Reinauer00636b02012-04-04 00:08:51 +020031#include <cpu/cpu.h>
Stefan Reinauerbb11e602012-05-10 12:15:18 -070032#include <cbmem.h>
Stefan Reinauer00636b02012-04-04 00:08:51 +020033#include "chip.h"
34#include "sandybridge.h"
Vladimir Serbinenkoc16e9dfa2015-05-29 16:18:01 +020035#include <cpu/intel/smm/gen1/smi.h>
Stefan Reinauer00636b02012-04-04 00:08:51 +020036
37static int bridge_revision_id = -1;
38
Kyösti Mälkkif7bfc342013-10-18 11:02:46 +030039/* IGD UMA memory */
40static uint64_t uma_memory_base = 0;
41static uint64_t uma_memory_size = 0;
42
Stefan Reinauer00636b02012-04-04 00:08:51 +020043int bridge_silicon_revision(void)
44{
45 if (bridge_revision_id < 0) {
46 uint8_t stepping = cpuid_eax(1) & 0xf;
47 uint8_t bridge_id = pci_read_config16(
48 dev_find_slot(0, PCI_DEVFN(0, 0)),
49 PCI_DEVICE_ID) & 0xf0;
50 bridge_revision_id = bridge_id | stepping;
51 }
52 return bridge_revision_id;
53}
54
55/* Reserve everything between A segment and 1MB:
56 *
57 * 0xa0000 - 0xbffff: legacy VGA
58 * 0xc0000 - 0xcffff: VGA OPROM (needed by kernel)
59 * 0xe0000 - 0xfffff: SeaBIOS, if used, otherwise DMI
60 */
61static const int legacy_hole_base_k = 0xa0000 / 1024;
62static const int legacy_hole_size_k = 384;
63
Stefan Reinauer00636b02012-04-04 00:08:51 +020064static int get_pcie_bar(u32 *base, u32 *len)
65{
66 device_t dev;
67 u32 pciexbar_reg;
68
69 *base = 0;
70 *len = 0;
71
72 dev = dev_find_slot(0, PCI_DEVFN(0, 0));
73 if (!dev)
74 return 0;
75
76 pciexbar_reg = pci_read_config32(dev, PCIEXBAR);
77
78 if (!(pciexbar_reg & (1 << 0)))
79 return 0;
80
81 switch ((pciexbar_reg >> 1) & 3) {
82 case 0: // 256MB
83 *base = pciexbar_reg & ((1 << 31)|(1 << 30)|(1 << 29)|(1 << 28));
84 *len = 256 * 1024 * 1024;
85 return 1;
86 case 1: // 128M
87 *base = pciexbar_reg & ((1 << 31)|(1 << 30)|(1 << 29)|(1 << 28)|(1 << 27));
88 *len = 128 * 1024 * 1024;
89 return 1;
90 case 2: // 64M
91 *base = pciexbar_reg & ((1 << 31)|(1 << 30)|(1 << 29)|(1 << 28)|(1 << 27)|(1 << 26));
92 *len = 64 * 1024 * 1024;
93 return 1;
94 }
95
96 return 0;
97}
98
Stefan Reinauer00636b02012-04-04 00:08:51 +020099static void add_fixed_resources(struct device *dev, int index)
100{
101 struct resource *resource;
102 u32 pcie_config_base, pcie_config_size;
103
Kyösti Mälkki7f189cc2012-07-27 13:12:03 +0300104 mmio_resource(dev, index++, uma_memory_base >> 10, uma_memory_size >> 10);
Stefan Reinauer00636b02012-04-04 00:08:51 +0200105
106 if (get_pcie_bar(&pcie_config_base, &pcie_config_size)) {
107 printk(BIOS_DEBUG, "Adding PCIe config bar base=0x%08x "
108 "size=0x%x\n", pcie_config_base, pcie_config_size);
Kyösti Mälkki1ec5e742012-07-26 23:51:20 +0300109 resource = new_resource(dev, index++);
Stefan Reinauer00636b02012-04-04 00:08:51 +0200110 resource->base = (resource_t) pcie_config_base;
111 resource->size = (resource_t) pcie_config_size;
112 resource->flags = IORESOURCE_MEM | IORESOURCE_RESERVE |
113 IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED;
114 }
Kyösti Mälkki1ec5e742012-07-26 23:51:20 +0300115
Aaron Durbinc9650762013-03-22 22:03:09 -0500116 mmio_resource(dev, index++, legacy_hole_base_k,
117 (0xc0000 >> 10) - legacy_hole_base_k);
118 reserved_ram_resource(dev, index++, 0xc0000 >> 10,
119 (0x100000 - 0xc0000) >> 10);
Kyösti Mälkki1ec5e742012-07-26 23:51:20 +0300120
121#if CONFIG_CHROMEOS_RAMOOPS
Aaron Durbinc9650762013-03-22 22:03:09 -0500122 reserved_ram_resource(dev, index++,
123 CONFIG_CHROMEOS_RAMOOPS_RAM_START >> 10,
Kyösti Mälkki1ec5e742012-07-26 23:51:20 +0300124 CONFIG_CHROMEOS_RAMOOPS_RAM_SIZE >> 10);
125#endif
126
127 /* Required for SandyBridge sighting 3715511 */
128 bad_ram_resource(dev, index++, 0x20000000 >> 10, 0x00200000 >> 10);
129 bad_ram_resource(dev, index++, 0x40000000 >> 10, 0x00200000 >> 10);
Nico Huberbb9469c2015-10-21 11:49:23 +0200130
131 /* Reserve IOMMU BARs */
132 const u32 capid0_a = pci_read_config32(dev, 0xe4);
133 if (!(capid0_a & (1 << 23))) {
134 mmio_resource(dev, index++, IOMMU_BASE1 >> 10, 4);
135 mmio_resource(dev, index++, IOMMU_BASE2 >> 10, 4);
136 }
Stefan Reinauer00636b02012-04-04 00:08:51 +0200137}
138
Stefan Reinauer00636b02012-04-04 00:08:51 +0200139static void pci_domain_set_resources(device_t dev)
140{
141 uint64_t tom, me_base, touud;
142 uint32_t tseg_base, uma_size, tolud;
143 uint16_t ggc;
144 unsigned long long tomk;
145
146 /* Total Memory 2GB example:
147 *
148 * 00000000 0000MB-1992MB 1992MB RAM (writeback)
149 * 7c800000 1992MB-2000MB 8MB TSEG (SMRR)
150 * 7d000000 2000MB-2002MB 2MB GFX GTT (uncached)
151 * 7d200000 2002MB-2034MB 32MB GFX UMA (uncached)
152 * 7f200000 2034MB TOLUD
153 * 7f800000 2040MB MEBASE
154 * 7f800000 2040MB-2048MB 8MB ME UMA (uncached)
155 * 80000000 2048MB TOM
156 * 100000000 4096MB-4102MB 6MB RAM (writeback)
157 *
158 * Total Memory 4GB example:
159 *
160 * 00000000 0000MB-2768MB 2768MB RAM (writeback)
161 * ad000000 2768MB-2776MB 8MB TSEG (SMRR)
162 * ad800000 2776MB-2778MB 2MB GFX GTT (uncached)
163 * ada00000 2778MB-2810MB 32MB GFX UMA (uncached)
164 * afa00000 2810MB TOLUD
165 * ff800000 4088MB MEBASE
166 * ff800000 4088MB-4096MB 8MB ME UMA (uncached)
167 * 100000000 4096MB TOM
168 * 100000000 4096MB-5374MB 1278MB RAM (writeback)
169 * 14fe00000 5368MB TOUUD
170 */
171
172 /* Top of Upper Usable DRAM, including remap */
173 touud = pci_read_config32(dev, TOUUD+4);
174 touud <<= 32;
175 touud |= pci_read_config32(dev, TOUUD);
176
177 /* Top of Lower Usable DRAM */
178 tolud = pci_read_config32(dev, TOLUD);
179
180 /* Top of Memory - does not account for any UMA */
181 tom = pci_read_config32(dev, 0xa4);
182 tom <<= 32;
183 tom |= pci_read_config32(dev, 0xa0);
184
185 printk(BIOS_DEBUG, "TOUUD 0x%llx TOLUD 0x%08x TOM 0x%llx\n",
186 touud, tolud, tom);
187
188 /* ME UMA needs excluding if total memory <4GB */
189 me_base = pci_read_config32(dev, 0x74);
190 me_base <<= 32;
191 me_base |= pci_read_config32(dev, 0x70);
192
193 printk(BIOS_DEBUG, "MEBASE 0x%llx\n", me_base);
194
195 tomk = tolud >> 10;
196 if (me_base == tolud) {
197 /* ME is from MEBASE-TOM */
198 uma_size = (tom - me_base) >> 10;
199 /* Increment TOLUD to account for ME as RAM */
200 tolud += uma_size << 10;
201 /* UMA starts at old TOLUD */
202 uma_memory_base = tomk * 1024ULL;
203 uma_memory_size = uma_size * 1024ULL;
204 printk(BIOS_DEBUG, "ME UMA base 0x%llx size %uM\n",
205 me_base, uma_size >> 10);
206 }
207
208 /* Graphics memory comes next */
209 ggc = pci_read_config16(dev, GGC);
210 if (!(ggc & 2)) {
211 printk(BIOS_DEBUG, "IGD decoded, subtracting ");
212
213 /* Graphics memory */
214 uma_size = ((ggc >> 3) & 0x1f) * 32 * 1024ULL;
215 printk(BIOS_DEBUG, "%uM UMA", uma_size >> 10);
216 tomk -= uma_size;
217 uma_memory_base = tomk * 1024ULL;
218 uma_memory_size += uma_size * 1024ULL;
219
220 /* GTT Graphics Stolen Memory Size (GGMS) */
221 uma_size = ((ggc >> 8) & 0x3) * 1024ULL;
222 tomk -= uma_size;
223 uma_memory_base = tomk * 1024ULL;
224 uma_memory_size += uma_size * 1024ULL;
225 printk(BIOS_DEBUG, " and %uM GTT\n", uma_size >> 10);
226 }
227
228 /* Calculate TSEG size from its base which must be below GTT */
229 tseg_base = pci_read_config32(dev, 0xb8);
230 uma_size = (uma_memory_base - tseg_base) >> 10;
231 tomk -= uma_size;
232 uma_memory_base = tomk * 1024ULL;
233 uma_memory_size += uma_size * 1024ULL;
234 printk(BIOS_DEBUG, "TSEG base 0x%08x size %uM\n",
235 tseg_base, uma_size >> 10);
236
237 printk(BIOS_INFO, "Available memory below 4GB: %lluM\n", tomk >> 10);
238
239 /* Report the memory regions */
240 ram_resource(dev, 3, 0, legacy_hole_base_k);
241 ram_resource(dev, 4, legacy_hole_base_k + legacy_hole_size_k,
242 (tomk - (legacy_hole_base_k + legacy_hole_size_k)));
243
244 /*
245 * If >= 4GB installed then memory from TOLUD to 4GB
246 * is remapped above TOM, TOUUD will account for both
247 */
248 touud >>= 10; /* Convert to KB */
249 if (touud > 4096 * 1024) {
250 ram_resource(dev, 5, 4096 * 1024, touud - (4096 * 1024));
251 printk(BIOS_INFO, "Available memory above 4GB: %lluM\n",
252 (touud >> 10) - 4096);
253 }
254
255 add_fixed_resources(dev, 6);
256
257 assign_resources(dev->link_list);
Stefan Reinauer00636b02012-04-04 00:08:51 +0200258}
259
260 /* TODO We could determine how many PCIe busses we need in
261 * the bar. For now that number is hardcoded to a max of 64.
262 * See e7525/northbridge.c for an example.
263 */
264static struct device_operations pci_domain_ops = {
265 .read_resources = pci_domain_read_resources,
266 .set_resources = pci_domain_set_resources,
267 .enable_resources = NULL,
268 .init = NULL,
269 .scan_bus = pci_domain_scan_bus,
Kyösti Mälkki872c9222013-07-03 09:44:28 +0300270 .ops_pci_bus = pci_bus_default_ops,
Nico Huber9d9ce0d2015-10-26 12:59:49 +0100271 .write_acpi_tables = northbridge_write_acpi_tables,
Stefan Reinauer00636b02012-04-04 00:08:51 +0200272};
273
274static void mc_read_resources(device_t dev)
275{
276 struct resource *resource;
277
278 pci_dev_read_resources(dev);
279
280 /* So, this is one of the big mysteries in the coreboot resource
281 * allocator. This resource should make sure that the address space
282 * of the PCIe memory mapped config space bar. But it does not.
283 */
284
285 /* We use 0xcf as an unused index for our PCIe bar so that we find it again */
286 resource = new_resource(dev, 0xcf);
287 resource->base = DEFAULT_PCIEXBAR;
288 resource->size = 64 * 1024 * 1024; /* 64MB hard coded PCIe config space */
289 resource->flags =
290 IORESOURCE_MEM | IORESOURCE_FIXED | IORESOURCE_STORED |
291 IORESOURCE_ASSIGNED;
292 printk(BIOS_DEBUG, "Adding PCIe enhanced config space BAR 0x%08lx-0x%08lx.\n",
293 (unsigned long)(resource->base), (unsigned long)(resource->base + resource->size));
294}
295
296static void mc_set_resources(device_t dev)
297{
298 struct resource *resource;
299
300 /* Report the PCIe BAR */
301 resource = find_resource(dev, 0xcf);
302 if (resource) {
303 report_resource_stored(dev, resource, "<mmconfig>");
304 }
305
306 /* And call the normal set_resources */
307 pci_dev_set_resources(dev);
308}
309
310static void intel_set_subsystem(device_t dev, unsigned vendor, unsigned device)
311{
312 if (!vendor || !device) {
313 pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
314 pci_read_config32(dev, PCI_VENDOR_ID));
315 } else {
316 pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
317 ((device & 0xffff) << 16) | (vendor & 0xffff));
318 }
319}
320
321static void northbridge_dmi_init(struct device *dev)
322{
323 u32 reg32;
324
325 /* Clear error status bits */
326 DMIBAR32(0x1c4) = 0xffffffff;
327 DMIBAR32(0x1d0) = 0xffffffff;
328
329 /* Steps prior to DMI ASPM */
Vincent Palatin0ff99b72012-03-28 16:10:29 -0700330 if ((bridge_silicon_revision() & BASE_REV_MASK) == BASE_REV_SNB) {
331 reg32 = DMIBAR32(0x250);
332 reg32 &= ~((1 << 22)|(1 << 20));
333 reg32 |= (1 << 21);
334 DMIBAR32(0x250) = reg32;
335 }
Stefan Reinauer00636b02012-04-04 00:08:51 +0200336
337 reg32 = DMIBAR32(0x238);
338 reg32 |= (1 << 29);
339 DMIBAR32(0x238) = reg32;
340
341 if (bridge_silicon_revision() >= SNB_STEP_D0) {
342 reg32 = DMIBAR32(0x1f8);
343 reg32 |= (1 << 16);
344 DMIBAR32(0x1f8) = reg32;
345 } else if (bridge_silicon_revision() >= SNB_STEP_D1) {
346 reg32 = DMIBAR32(0x1f8);
347 reg32 &= ~(1 << 26);
348 reg32 |= (1 << 16);
349 DMIBAR32(0x1f8) = reg32;
350
351 reg32 = DMIBAR32(0x1fc);
352 reg32 |= (1 << 12) | (1 << 23);
353 DMIBAR32(0x1fc) = reg32;
354 }
355
356 /* Enable ASPM on SNB link, should happen before PCH link */
Vincent Palatin0ff99b72012-03-28 16:10:29 -0700357 if ((bridge_silicon_revision() & BASE_REV_MASK) == BASE_REV_SNB) {
358 reg32 = DMIBAR32(0xd04);
359 reg32 |= (1 << 4);
360 DMIBAR32(0xd04) = reg32;
361 }
Stefan Reinauer00636b02012-04-04 00:08:51 +0200362
363 reg32 = DMIBAR32(0x88);
364 reg32 |= (1 << 1) | (1 << 0);
365 DMIBAR32(0x88) = reg32;
366}
367
Patrick Rudolph3660c0f2015-07-28 08:01:02 +0200368/* Disable unused PEG devices based on devicetree */
369static void disable_peg(void)
370{
371 struct device *dev;
372 u32 reg;
373
374 dev = dev_find_slot(0, PCI_DEVFN(0, 0));
375 reg = pci_read_config32(dev, DEVEN);
376
377 dev = dev_find_slot(0, PCI_DEVFN(1, 2));
378 if (!dev || !dev->enabled) {
379 printk(BIOS_DEBUG, "Disabling PEG12.\n");
380 reg &= ~DEVEN_PEG12;
381 }
382 dev = dev_find_slot(0, PCI_DEVFN(1, 1));
383 if (!dev || !dev->enabled) {
384 printk(BIOS_DEBUG, "Disabling PEG11.\n");
385 reg &= ~DEVEN_PEG11;
386 }
387 dev = dev_find_slot(0, PCI_DEVFN(1, 0));
388 if (!dev || !dev->enabled) {
389 printk(BIOS_DEBUG, "Disabling PEG10.\n");
390 reg &= ~DEVEN_PEG10;
391 }
392 dev = dev_find_slot(0, PCI_DEVFN(2, 0));
393 if (!dev || !dev->enabled) {
394 printk(BIOS_DEBUG, "Disabling IGD.\n");
395 reg &= ~DEVEN_IGD;
396 }
397 dev = dev_find_slot(0, PCI_DEVFN(6, 0));
398 if (!dev || !dev->enabled) {
399 printk(BIOS_DEBUG, "Disabling PEG60.\n");
400 reg &= ~DEVEN_PEG60;
401 }
402
403 dev = dev_find_slot(0, PCI_DEVFN(0, 0));
404 pci_write_config32(dev, DEVEN, reg);
405 if (!(reg & (DEVEN_PEG60 | DEVEN_PEG10 | DEVEN_PEG11 | DEVEN_PEG12))) {
406 /* Set the PEG clock gating bit.
407 * Disables the IO clock on all PEG devices. */
408 MCHBAR32(0x7010) = MCHBAR32(0x7010) | 0x01;
409 printk(BIOS_DEBUG, "Disabling PEG IO clock.\n");
410 }
411}
412
Stefan Reinauer00636b02012-04-04 00:08:51 +0200413static void northbridge_init(struct device *dev)
414{
415 u8 bios_reset_cpl;
Duncan Lauriefe7b5d22012-06-23 20:14:07 -0700416 u32 bridge_type;
Stefan Reinauer00636b02012-04-04 00:08:51 +0200417
418 northbridge_dmi_init(dev);
419
Duncan Lauriefe7b5d22012-06-23 20:14:07 -0700420 bridge_type = MCHBAR32(0x5f10);
421 bridge_type &= ~0xff;
422
423 if ((bridge_silicon_revision() & BASE_REV_MASK) == BASE_REV_IVB) {
424 /* Enable Power Aware Interrupt Routing */
425 u8 pair = MCHBAR8(0x5418);
426 pair &= ~0xf; /* Clear 3:0 */
427 pair |= 0x4; /* Fixed Priority */
428 MCHBAR8(0x5418) = pair;
429
430 /* 30h for IvyBridge */
431 bridge_type |= 0x30;
432 } else {
433 /* 20h for Sandybridge */
434 bridge_type |= 0x20;
435 }
436 MCHBAR32(0x5f10) = bridge_type;
437
Stefan Reinauer00636b02012-04-04 00:08:51 +0200438 /*
439 * Set bit 0 of BIOS_RESET_CPL to indicate to the CPU
440 * that BIOS has initialized memory and power management
441 */
442 bios_reset_cpl = MCHBAR8(BIOS_RESET_CPL);
443 bios_reset_cpl |= 1;
444 MCHBAR8(BIOS_RESET_CPL) = bios_reset_cpl;
445 printk(BIOS_DEBUG, "Set BIOS_RESET_CPL\n");
446
447 /* Configure turbo power limits 1ms after reset complete bit */
448 mdelay(1);
449 set_power_limits(28);
450
Duncan Laurie77dbbac2012-06-25 09:51:59 -0700451 /*
452 * CPUs with configurable TDP also need power limits set
453 * in MCHBAR. Use same values from MSR_PKG_POWER_LIMIT.
454 */
455 if (cpu_config_tdp_levels()) {
456 msr_t msr = rdmsr(MSR_PKG_POWER_LIMIT);
457 MCHBAR32(0x59A0) = msr.lo;
458 MCHBAR32(0x59A4) = msr.hi;
459 }
460
Stefan Reinauer00636b02012-04-04 00:08:51 +0200461 /* Set here before graphics PM init */
462 MCHBAR32(0x5500) = 0x00100001;
Patrick Rudolph3660c0f2015-07-28 08:01:02 +0200463
464 /* Turn off unused devices */
465 disable_peg();
Stefan Reinauer00636b02012-04-04 00:08:51 +0200466}
467
468static void northbridge_enable(device_t dev)
469{
470#if CONFIG_HAVE_ACPI_RESUME
471 switch (pci_read_config32(dev, SKPAD)) {
472 case 0xcafebabe:
473 printk(BIOS_DEBUG, "Normal boot.\n");
474 acpi_slp_type=0;
475 break;
476 case 0xcafed00d:
477 printk(BIOS_DEBUG, "S3 Resume.\n");
478 acpi_slp_type=3;
479 break;
480 default:
481 printk(BIOS_DEBUG, "Unknown boot method, assuming normal.\n");
482 acpi_slp_type=0;
483 break;
484 }
485#endif
486}
487
Vladimir Serbinenkoc16e9dfa2015-05-29 16:18:01 +0200488static u32 northbridge_get_base_reg(device_t dev, int reg)
489{
490 u32 value;
491
492 value = pci_read_config32(dev, reg);
493 /* Base registers are at 1MiB granularity. */
494 value &= ~((1 << 20) - 1);
495 return value;
496}
497
498void
499northbridge_get_tseg_base_and_size(u32 *tsegmb, u32 *tseg_size)
500{
501 device_t dev;
502 u32 bgsm;
503 dev = dev_find_slot(0, PCI_DEVFN(0, 0));
504
505 *tsegmb = northbridge_get_base_reg(dev, TSEG);
506 bgsm = northbridge_get_base_reg(dev, BGSM);
507 *tseg_size = bgsm - *tsegmb;
508}
509
510void northbridge_write_smram(u8 smram)
511{
512 pci_write_config8(dev_find_slot(0, PCI_DEVFN(0, 0)), SMRAM, smram);
513}
514
Stefan Reinauer00636b02012-04-04 00:08:51 +0200515static struct pci_operations intel_pci_ops = {
516 .set_subsystem = intel_set_subsystem,
517};
518
519static struct device_operations mc_ops = {
520 .read_resources = mc_read_resources,
521 .set_resources = mc_set_resources,
522 .enable_resources = pci_dev_enable_resources,
523 .init = northbridge_init,
524 .enable = northbridge_enable,
525 .scan_bus = 0,
526 .ops_pci = &intel_pci_ops,
Vladimir Serbinenko0a669912014-10-05 14:34:17 +0200527 .acpi_fill_ssdt_generator = generate_cpu_entries,
Stefan Reinauer00636b02012-04-04 00:08:51 +0200528};
529
Walter Murphy496f4a02012-04-23 11:08:03 -0700530static const struct pci_driver mc_driver_0100 __pci_driver = {
531 .ops = &mc_ops,
532 .vendor = PCI_VENDOR_ID_INTEL,
533 .device = 0x0100,
534};
535
Stefan Reinauer00636b02012-04-04 00:08:51 +0200536static const struct pci_driver mc_driver __pci_driver = {
537 .ops = &mc_ops,
538 .vendor = PCI_VENDOR_ID_INTEL,
539 .device = 0x0104, /* Sandy bridge */
540};
541
Damien Zammit35170382014-10-29 00:11:53 +1100542static const struct pci_driver mc_driver_150 __pci_driver = {
543 .ops = &mc_ops,
544 .vendor = PCI_VENDOR_ID_INTEL,
545 .device = 0x0150, /* Ivy bridge */
546};
547
Stefan Reinauer00636b02012-04-04 00:08:51 +0200548static const struct pci_driver mc_driver_1 __pci_driver = {
549 .ops = &mc_ops,
550 .vendor = PCI_VENDOR_ID_INTEL,
551 .device = 0x0154, /* Ivy bridge */
552};
553
554static void cpu_bus_init(device_t dev)
555{
556 initialize_cpus(dev->link_list);
557}
558
Stefan Reinauer00636b02012-04-04 00:08:51 +0200559static struct device_operations cpu_bus_ops = {
Edward O'Callaghan9f744622014-10-31 08:12:34 +1100560 .read_resources = DEVICE_NOOP,
561 .set_resources = DEVICE_NOOP,
562 .enable_resources = DEVICE_NOOP,
Stefan Reinauer00636b02012-04-04 00:08:51 +0200563 .init = cpu_bus_init,
564 .scan_bus = 0,
565};
566
567static void enable_dev(device_t dev)
568{
569 /* Set the operations if it is a special bus type */
Stefan Reinauer4aff4452013-02-12 14:17:15 -0800570 if (dev->path.type == DEVICE_PATH_DOMAIN) {
Stefan Reinauer00636b02012-04-04 00:08:51 +0200571 dev->ops = &pci_domain_ops;
Stefan Reinauer0aa37c42013-02-12 15:20:54 -0800572 } else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER) {
Stefan Reinauer00636b02012-04-04 00:08:51 +0200573 dev->ops = &cpu_bus_ops;
574 }
575}
576
577struct chip_operations northbridge_intel_sandybridge_ops = {
Damien Zammit35170382014-10-29 00:11:53 +1100578 CHIP_NAME("Intel SandyBridge/IvyBridge integrated Northbridge")
Stefan Reinauer00636b02012-04-04 00:08:51 +0200579 .enable_dev = enable_dev,
580};