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