blob: 7f7c842324a33c30a4123a89af398979a2d13ae6 [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
Kyösti Mälkkie25b5ef2016-12-02 08:56:05 +020064static int get_pcie_bar(u32 *base)
Stefan Reinauer00636b02012-04-04 00:08:51 +020065{
66 device_t dev;
67 u32 pciexbar_reg;
68
69 *base = 0;
Stefan Reinauer00636b02012-04-04 00:08:51 +020070
71 dev = dev_find_slot(0, PCI_DEVFN(0, 0));
72 if (!dev)
73 return 0;
74
75 pciexbar_reg = pci_read_config32(dev, PCIEXBAR);
76
77 if (!(pciexbar_reg & (1 << 0)))
78 return 0;
79
80 switch ((pciexbar_reg >> 1) & 3) {
81 case 0: // 256MB
82 *base = pciexbar_reg & ((1 << 31)|(1 << 30)|(1 << 29)|(1 << 28));
Kyösti Mälkkie25b5ef2016-12-02 08:56:05 +020083 return 256;
Stefan Reinauer00636b02012-04-04 00:08:51 +020084 case 1: // 128M
85 *base = pciexbar_reg & ((1 << 31)|(1 << 30)|(1 << 29)|(1 << 28)|(1 << 27));
Kyösti Mälkkie25b5ef2016-12-02 08:56:05 +020086 return 128;
Stefan Reinauer00636b02012-04-04 00:08:51 +020087 case 2: // 64M
88 *base = pciexbar_reg & ((1 << 31)|(1 << 30)|(1 << 29)|(1 << 28)|(1 << 27)|(1 << 26));
Kyösti Mälkkie25b5ef2016-12-02 08:56:05 +020089 return 64;
Stefan Reinauer00636b02012-04-04 00:08:51 +020090 }
91
92 return 0;
93}
94
Stefan Reinauer00636b02012-04-04 00:08:51 +020095static void add_fixed_resources(struct device *dev, int index)
96{
Kyösti Mälkki7f189cc2012-07-27 13:12:03 +030097 mmio_resource(dev, index++, uma_memory_base >> 10, uma_memory_size >> 10);
Stefan Reinauer00636b02012-04-04 00:08:51 +020098
Aaron Durbinc9650762013-03-22 22:03:09 -050099 mmio_resource(dev, index++, legacy_hole_base_k,
100 (0xc0000 >> 10) - legacy_hole_base_k);
101 reserved_ram_resource(dev, index++, 0xc0000 >> 10,
102 (0x100000 - 0xc0000) >> 10);
Kyösti Mälkki1ec5e742012-07-26 23:51:20 +0300103
104#if CONFIG_CHROMEOS_RAMOOPS
Aaron Durbinc9650762013-03-22 22:03:09 -0500105 reserved_ram_resource(dev, index++,
106 CONFIG_CHROMEOS_RAMOOPS_RAM_START >> 10,
Kyösti Mälkki1ec5e742012-07-26 23:51:20 +0300107 CONFIG_CHROMEOS_RAMOOPS_RAM_SIZE >> 10);
108#endif
109
Nico Huber593e7de2015-11-04 15:46:00 +0100110 if ((bridge_silicon_revision() & BASE_REV_MASK) == BASE_REV_SNB) {
111 /* Required for SandyBridge sighting 3715511 */
112 bad_ram_resource(dev, index++, 0x20000000 >> 10, 0x00200000 >> 10);
113 bad_ram_resource(dev, index++, 0x40000000 >> 10, 0x00200000 >> 10);
114 }
Nico Huberbb9469c2015-10-21 11:49:23 +0200115
116 /* Reserve IOMMU BARs */
117 const u32 capid0_a = pci_read_config32(dev, 0xe4);
118 if (!(capid0_a & (1 << 23))) {
119 mmio_resource(dev, index++, IOMMU_BASE1 >> 10, 4);
120 mmio_resource(dev, index++, IOMMU_BASE2 >> 10, 4);
121 }
Stefan Reinauer00636b02012-04-04 00:08:51 +0200122}
123
Stefan Reinauer00636b02012-04-04 00:08:51 +0200124static void pci_domain_set_resources(device_t dev)
125{
126 uint64_t tom, me_base, touud;
127 uint32_t tseg_base, uma_size, tolud;
128 uint16_t ggc;
129 unsigned long long tomk;
130
131 /* Total Memory 2GB example:
132 *
133 * 00000000 0000MB-1992MB 1992MB RAM (writeback)
134 * 7c800000 1992MB-2000MB 8MB TSEG (SMRR)
135 * 7d000000 2000MB-2002MB 2MB GFX GTT (uncached)
136 * 7d200000 2002MB-2034MB 32MB GFX UMA (uncached)
137 * 7f200000 2034MB TOLUD
138 * 7f800000 2040MB MEBASE
139 * 7f800000 2040MB-2048MB 8MB ME UMA (uncached)
140 * 80000000 2048MB TOM
141 * 100000000 4096MB-4102MB 6MB RAM (writeback)
142 *
143 * Total Memory 4GB example:
144 *
145 * 00000000 0000MB-2768MB 2768MB RAM (writeback)
146 * ad000000 2768MB-2776MB 8MB TSEG (SMRR)
147 * ad800000 2776MB-2778MB 2MB GFX GTT (uncached)
148 * ada00000 2778MB-2810MB 32MB GFX UMA (uncached)
149 * afa00000 2810MB TOLUD
150 * ff800000 4088MB MEBASE
151 * ff800000 4088MB-4096MB 8MB ME UMA (uncached)
152 * 100000000 4096MB TOM
153 * 100000000 4096MB-5374MB 1278MB RAM (writeback)
154 * 14fe00000 5368MB TOUUD
155 */
156
157 /* Top of Upper Usable DRAM, including remap */
158 touud = pci_read_config32(dev, TOUUD+4);
159 touud <<= 32;
160 touud |= pci_read_config32(dev, TOUUD);
161
162 /* Top of Lower Usable DRAM */
163 tolud = pci_read_config32(dev, TOLUD);
164
165 /* Top of Memory - does not account for any UMA */
166 tom = pci_read_config32(dev, 0xa4);
167 tom <<= 32;
168 tom |= pci_read_config32(dev, 0xa0);
169
170 printk(BIOS_DEBUG, "TOUUD 0x%llx TOLUD 0x%08x TOM 0x%llx\n",
171 touud, tolud, tom);
172
173 /* ME UMA needs excluding if total memory <4GB */
174 me_base = pci_read_config32(dev, 0x74);
175 me_base <<= 32;
176 me_base |= pci_read_config32(dev, 0x70);
177
178 printk(BIOS_DEBUG, "MEBASE 0x%llx\n", me_base);
179
Patrick Rudolph240766a2015-10-15 15:33:25 +0200180 uma_memory_base = tolud;
Stefan Reinauer00636b02012-04-04 00:08:51 +0200181 tomk = tolud >> 10;
182 if (me_base == tolud) {
183 /* ME is from MEBASE-TOM */
184 uma_size = (tom - me_base) >> 10;
185 /* Increment TOLUD to account for ME as RAM */
186 tolud += uma_size << 10;
187 /* UMA starts at old TOLUD */
188 uma_memory_base = tomk * 1024ULL;
189 uma_memory_size = uma_size * 1024ULL;
190 printk(BIOS_DEBUG, "ME UMA base 0x%llx size %uM\n",
191 me_base, uma_size >> 10);
192 }
193
194 /* Graphics memory comes next */
195 ggc = pci_read_config16(dev, GGC);
196 if (!(ggc & 2)) {
197 printk(BIOS_DEBUG, "IGD decoded, subtracting ");
198
199 /* Graphics memory */
200 uma_size = ((ggc >> 3) & 0x1f) * 32 * 1024ULL;
201 printk(BIOS_DEBUG, "%uM UMA", uma_size >> 10);
202 tomk -= uma_size;
203 uma_memory_base = tomk * 1024ULL;
204 uma_memory_size += uma_size * 1024ULL;
205
206 /* GTT Graphics Stolen Memory Size (GGMS) */
207 uma_size = ((ggc >> 8) & 0x3) * 1024ULL;
208 tomk -= uma_size;
209 uma_memory_base = tomk * 1024ULL;
210 uma_memory_size += uma_size * 1024ULL;
211 printk(BIOS_DEBUG, " and %uM GTT\n", uma_size >> 10);
212 }
213
214 /* Calculate TSEG size from its base which must be below GTT */
215 tseg_base = pci_read_config32(dev, 0xb8);
216 uma_size = (uma_memory_base - tseg_base) >> 10;
217 tomk -= uma_size;
218 uma_memory_base = tomk * 1024ULL;
219 uma_memory_size += uma_size * 1024ULL;
220 printk(BIOS_DEBUG, "TSEG base 0x%08x size %uM\n",
221 tseg_base, uma_size >> 10);
222
223 printk(BIOS_INFO, "Available memory below 4GB: %lluM\n", tomk >> 10);
224
225 /* Report the memory regions */
226 ram_resource(dev, 3, 0, legacy_hole_base_k);
227 ram_resource(dev, 4, legacy_hole_base_k + legacy_hole_size_k,
228 (tomk - (legacy_hole_base_k + legacy_hole_size_k)));
229
230 /*
231 * If >= 4GB installed then memory from TOLUD to 4GB
232 * is remapped above TOM, TOUUD will account for both
233 */
234 touud >>= 10; /* Convert to KB */
235 if (touud > 4096 * 1024) {
236 ram_resource(dev, 5, 4096 * 1024, touud - (4096 * 1024));
237 printk(BIOS_INFO, "Available memory above 4GB: %lluM\n",
238 (touud >> 10) - 4096);
239 }
240
241 add_fixed_resources(dev, 6);
242
243 assign_resources(dev->link_list);
Stefan Reinauer00636b02012-04-04 00:08:51 +0200244}
245
246 /* TODO We could determine how many PCIe busses we need in
247 * the bar. For now that number is hardcoded to a max of 64.
248 * See e7525/northbridge.c for an example.
249 */
250static struct device_operations pci_domain_ops = {
251 .read_resources = pci_domain_read_resources,
252 .set_resources = pci_domain_set_resources,
253 .enable_resources = NULL,
254 .init = NULL,
255 .scan_bus = pci_domain_scan_bus,
Kyösti Mälkki872c9222013-07-03 09:44:28 +0300256 .ops_pci_bus = pci_bus_default_ops,
Nico Huber9d9ce0d2015-10-26 12:59:49 +0100257 .write_acpi_tables = northbridge_write_acpi_tables,
Stefan Reinauer00636b02012-04-04 00:08:51 +0200258};
259
260static void mc_read_resources(device_t dev)
261{
Kyösti Mälkkie25b5ef2016-12-02 08:56:05 +0200262 u32 pcie_config_base;
263 int buses;
Stefan Reinauer00636b02012-04-04 00:08:51 +0200264
265 pci_dev_read_resources(dev);
266
Stefan Reinauer00636b02012-04-04 00:08:51 +0200267 /* We use 0xcf as an unused index for our PCIe bar so that we find it again */
Kyösti Mälkkie25b5ef2016-12-02 08:56:05 +0200268 buses = get_pcie_bar(&pcie_config_base);
269 if (buses) {
270 struct resource *resource = new_resource(dev, 0xcf);
271 mmconf_resource_init(resource, pcie_config_base, buses);
272 }
Stefan Reinauer00636b02012-04-04 00:08:51 +0200273}
274
275static void mc_set_resources(device_t dev)
276{
277 struct resource *resource;
278
279 /* Report the PCIe BAR */
280 resource = find_resource(dev, 0xcf);
281 if (resource) {
282 report_resource_stored(dev, resource, "<mmconfig>");
283 }
284
285 /* And call the normal set_resources */
286 pci_dev_set_resources(dev);
287}
288
289static void intel_set_subsystem(device_t dev, unsigned vendor, unsigned device)
290{
291 if (!vendor || !device) {
292 pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
293 pci_read_config32(dev, PCI_VENDOR_ID));
294 } else {
295 pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
296 ((device & 0xffff) << 16) | (vendor & 0xffff));
297 }
298}
299
300static void northbridge_dmi_init(struct device *dev)
301{
302 u32 reg32;
303
304 /* Clear error status bits */
305 DMIBAR32(0x1c4) = 0xffffffff;
306 DMIBAR32(0x1d0) = 0xffffffff;
307
308 /* Steps prior to DMI ASPM */
Vincent Palatin0ff99b72012-03-28 16:10:29 -0700309 if ((bridge_silicon_revision() & BASE_REV_MASK) == BASE_REV_SNB) {
310 reg32 = DMIBAR32(0x250);
311 reg32 &= ~((1 << 22)|(1 << 20));
312 reg32 |= (1 << 21);
313 DMIBAR32(0x250) = reg32;
314 }
Stefan Reinauer00636b02012-04-04 00:08:51 +0200315
316 reg32 = DMIBAR32(0x238);
317 reg32 |= (1 << 29);
318 DMIBAR32(0x238) = reg32;
319
320 if (bridge_silicon_revision() >= SNB_STEP_D0) {
321 reg32 = DMIBAR32(0x1f8);
322 reg32 |= (1 << 16);
323 DMIBAR32(0x1f8) = reg32;
324 } else if (bridge_silicon_revision() >= SNB_STEP_D1) {
325 reg32 = DMIBAR32(0x1f8);
326 reg32 &= ~(1 << 26);
327 reg32 |= (1 << 16);
328 DMIBAR32(0x1f8) = reg32;
329
330 reg32 = DMIBAR32(0x1fc);
331 reg32 |= (1 << 12) | (1 << 23);
332 DMIBAR32(0x1fc) = reg32;
333 }
334
335 /* Enable ASPM on SNB link, should happen before PCH link */
Vincent Palatin0ff99b72012-03-28 16:10:29 -0700336 if ((bridge_silicon_revision() & BASE_REV_MASK) == BASE_REV_SNB) {
337 reg32 = DMIBAR32(0xd04);
338 reg32 |= (1 << 4);
339 DMIBAR32(0xd04) = reg32;
340 }
Stefan Reinauer00636b02012-04-04 00:08:51 +0200341
342 reg32 = DMIBAR32(0x88);
343 reg32 |= (1 << 1) | (1 << 0);
344 DMIBAR32(0x88) = reg32;
345}
346
Patrick Rudolph3660c0f2015-07-28 08:01:02 +0200347/* Disable unused PEG devices based on devicetree */
348static void disable_peg(void)
349{
350 struct device *dev;
351 u32 reg;
352
353 dev = dev_find_slot(0, PCI_DEVFN(0, 0));
354 reg = pci_read_config32(dev, DEVEN);
355
356 dev = dev_find_slot(0, PCI_DEVFN(1, 2));
Nico Huber2dc15e92016-02-04 18:59:48 +0100357 if (!dev || !dev->enabled) {
Patrick Rudolph3660c0f2015-07-28 08:01:02 +0200358 printk(BIOS_DEBUG, "Disabling PEG12.\n");
359 reg &= ~DEVEN_PEG12;
360 }
361 dev = dev_find_slot(0, PCI_DEVFN(1, 1));
Nico Huber2dc15e92016-02-04 18:59:48 +0100362 if (!dev || !dev->enabled) {
Patrick Rudolph3660c0f2015-07-28 08:01:02 +0200363 printk(BIOS_DEBUG, "Disabling PEG11.\n");
364 reg &= ~DEVEN_PEG11;
365 }
366 dev = dev_find_slot(0, PCI_DEVFN(1, 0));
Nico Huber2dc15e92016-02-04 18:59:48 +0100367 if (!dev || !dev->enabled) {
Patrick Rudolph3660c0f2015-07-28 08:01:02 +0200368 printk(BIOS_DEBUG, "Disabling PEG10.\n");
369 reg &= ~DEVEN_PEG10;
370 }
371 dev = dev_find_slot(0, PCI_DEVFN(2, 0));
Nico Huber2dc15e92016-02-04 18:59:48 +0100372 if (!dev || !dev->enabled) {
Patrick Rudolph3660c0f2015-07-28 08:01:02 +0200373 printk(BIOS_DEBUG, "Disabling IGD.\n");
374 reg &= ~DEVEN_IGD;
375 }
376 dev = dev_find_slot(0, PCI_DEVFN(6, 0));
Nico Huber2dc15e92016-02-04 18:59:48 +0100377 if (!dev || !dev->enabled) {
Patrick Rudolph3660c0f2015-07-28 08:01:02 +0200378 printk(BIOS_DEBUG, "Disabling PEG60.\n");
379 reg &= ~DEVEN_PEG60;
380 }
381
382 dev = dev_find_slot(0, PCI_DEVFN(0, 0));
383 pci_write_config32(dev, DEVEN, reg);
384 if (!(reg & (DEVEN_PEG60 | DEVEN_PEG10 | DEVEN_PEG11 | DEVEN_PEG12))) {
385 /* Set the PEG clock gating bit.
386 * Disables the IO clock on all PEG devices. */
387 MCHBAR32(0x7010) = MCHBAR32(0x7010) | 0x01;
388 printk(BIOS_DEBUG, "Disabling PEG IO clock.\n");
389 }
390}
391
Stefan Reinauer00636b02012-04-04 00:08:51 +0200392static void northbridge_init(struct device *dev)
393{
394 u8 bios_reset_cpl;
Duncan Lauriefe7b5d22012-06-23 20:14:07 -0700395 u32 bridge_type;
Stefan Reinauer00636b02012-04-04 00:08:51 +0200396
397 northbridge_dmi_init(dev);
398
Duncan Lauriefe7b5d22012-06-23 20:14:07 -0700399 bridge_type = MCHBAR32(0x5f10);
400 bridge_type &= ~0xff;
401
402 if ((bridge_silicon_revision() & BASE_REV_MASK) == BASE_REV_IVB) {
403 /* Enable Power Aware Interrupt Routing */
404 u8 pair = MCHBAR8(0x5418);
405 pair &= ~0xf; /* Clear 3:0 */
406 pair |= 0x4; /* Fixed Priority */
407 MCHBAR8(0x5418) = pair;
408
409 /* 30h for IvyBridge */
410 bridge_type |= 0x30;
411 } else {
412 /* 20h for Sandybridge */
413 bridge_type |= 0x20;
414 }
415 MCHBAR32(0x5f10) = bridge_type;
416
Patrick Rudolphaad34cd2015-10-21 18:05:01 +0200417 /* Turn off unused devices. Has to be done before
418 * setting BIOS_RESET_CPL.
419 */
420 disable_peg();
421
Stefan Reinauer00636b02012-04-04 00:08:51 +0200422 /*
423 * Set bit 0 of BIOS_RESET_CPL to indicate to the CPU
424 * that BIOS has initialized memory and power management
425 */
426 bios_reset_cpl = MCHBAR8(BIOS_RESET_CPL);
427 bios_reset_cpl |= 1;
428 MCHBAR8(BIOS_RESET_CPL) = bios_reset_cpl;
429 printk(BIOS_DEBUG, "Set BIOS_RESET_CPL\n");
430
431 /* Configure turbo power limits 1ms after reset complete bit */
432 mdelay(1);
433 set_power_limits(28);
434
Duncan Laurie77dbbac2012-06-25 09:51:59 -0700435 /*
436 * CPUs with configurable TDP also need power limits set
437 * in MCHBAR. Use same values from MSR_PKG_POWER_LIMIT.
438 */
439 if (cpu_config_tdp_levels()) {
440 msr_t msr = rdmsr(MSR_PKG_POWER_LIMIT);
441 MCHBAR32(0x59A0) = msr.lo;
442 MCHBAR32(0x59A4) = msr.hi;
443 }
444
Stefan Reinauer00636b02012-04-04 00:08:51 +0200445 /* Set here before graphics PM init */
446 MCHBAR32(0x5500) = 0x00100001;
447}
448
Vladimir Serbinenkoc16e9dfa2015-05-29 16:18:01 +0200449static u32 northbridge_get_base_reg(device_t dev, int reg)
450{
451 u32 value;
452
453 value = pci_read_config32(dev, reg);
454 /* Base registers are at 1MiB granularity. */
455 value &= ~((1 << 20) - 1);
456 return value;
457}
458
Nico Huber6f8b7df2016-10-08 18:42:46 +0200459u32 northbridge_get_tseg_base(void)
Vladimir Serbinenkoc16e9dfa2015-05-29 16:18:01 +0200460{
Nico Huber6f8b7df2016-10-08 18:42:46 +0200461 const device_t dev = dev_find_slot(0, PCI_DEVFN(0, 0));
Vladimir Serbinenkoc16e9dfa2015-05-29 16:18:01 +0200462
Nico Huber6f8b7df2016-10-08 18:42:46 +0200463 return northbridge_get_base_reg(dev, TSEG);
Vladimir Serbinenkoc16e9dfa2015-05-29 16:18:01 +0200464}
465
466void northbridge_write_smram(u8 smram)
467{
468 pci_write_config8(dev_find_slot(0, PCI_DEVFN(0, 0)), SMRAM, smram);
469}
470
Stefan Reinauer00636b02012-04-04 00:08:51 +0200471static struct pci_operations intel_pci_ops = {
472 .set_subsystem = intel_set_subsystem,
473};
474
475static struct device_operations mc_ops = {
476 .read_resources = mc_read_resources,
477 .set_resources = mc_set_resources,
478 .enable_resources = pci_dev_enable_resources,
479 .init = northbridge_init,
Stefan Reinauer00636b02012-04-04 00:08:51 +0200480 .scan_bus = 0,
481 .ops_pci = &intel_pci_ops,
Vladimir Serbinenko0a669912014-10-05 14:34:17 +0200482 .acpi_fill_ssdt_generator = generate_cpu_entries,
Stefan Reinauer00636b02012-04-04 00:08:51 +0200483};
484
Walter Murphy496f4a02012-04-23 11:08:03 -0700485static const struct pci_driver mc_driver_0100 __pci_driver = {
486 .ops = &mc_ops,
487 .vendor = PCI_VENDOR_ID_INTEL,
488 .device = 0x0100,
489};
490
Stefan Reinauer00636b02012-04-04 00:08:51 +0200491static const struct pci_driver mc_driver __pci_driver = {
492 .ops = &mc_ops,
493 .vendor = PCI_VENDOR_ID_INTEL,
494 .device = 0x0104, /* Sandy bridge */
495};
496
Damien Zammit35170382014-10-29 00:11:53 +1100497static const struct pci_driver mc_driver_150 __pci_driver = {
498 .ops = &mc_ops,
499 .vendor = PCI_VENDOR_ID_INTEL,
500 .device = 0x0150, /* Ivy bridge */
501};
502
Stefan Reinauer00636b02012-04-04 00:08:51 +0200503static const struct pci_driver mc_driver_1 __pci_driver = {
504 .ops = &mc_ops,
505 .vendor = PCI_VENDOR_ID_INTEL,
506 .device = 0x0154, /* Ivy bridge */
507};
508
509static void cpu_bus_init(device_t dev)
510{
511 initialize_cpus(dev->link_list);
512}
513
Stefan Reinauer00636b02012-04-04 00:08:51 +0200514static struct device_operations cpu_bus_ops = {
Edward O'Callaghan9f744622014-10-31 08:12:34 +1100515 .read_resources = DEVICE_NOOP,
516 .set_resources = DEVICE_NOOP,
517 .enable_resources = DEVICE_NOOP,
Stefan Reinauer00636b02012-04-04 00:08:51 +0200518 .init = cpu_bus_init,
519 .scan_bus = 0,
520};
521
522static void enable_dev(device_t dev)
523{
524 /* Set the operations if it is a special bus type */
Stefan Reinauer4aff4452013-02-12 14:17:15 -0800525 if (dev->path.type == DEVICE_PATH_DOMAIN) {
Stefan Reinauer00636b02012-04-04 00:08:51 +0200526 dev->ops = &pci_domain_ops;
Stefan Reinauer0aa37c42013-02-12 15:20:54 -0800527 } else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER) {
Stefan Reinauer00636b02012-04-04 00:08:51 +0200528 dev->ops = &cpu_bus_ops;
529 }
530}
531
532struct chip_operations northbridge_intel_sandybridge_ops = {
Damien Zammit35170382014-10-29 00:11:53 +1100533 CHIP_NAME("Intel SandyBridge/IvyBridge integrated Northbridge")
Stefan Reinauer00636b02012-04-04 00:08:51 +0200534 .enable_dev = enable_dev,
535};