blob: 7059e2cbeef11e955372dd9605de7675d99ea346 [file] [log] [blame]
Aaron Durbin76c37002012-10-30 09:03:43 -05001/*
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
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
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/haswell/haswell.h>
27#include <cpu/x86/msr.h>
28#include <device/device.h>
29#include <device/pci.h>
30#include <device/pci_ids.h>
31#include <device/hypertransport.h>
32#include <stdlib.h>
33#include <string.h>
34#include <cpu/cpu.h>
Aaron Durbin1fef1f52012-12-19 17:15:43 -060035#include <cpu/x86/smm.h>
Aaron Durbin76c37002012-10-30 09:03:43 -050036#include <boot/tables.h>
37#include <cbmem.h>
38#include "chip.h"
39#include "haswell.h"
40
41static int bridge_revision_id = -1;
42
43int 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
64void cbmem_post_handling(void)
65{
66 update_mrc_cache();
67}
68
Aaron Durbinc12ef972012-12-18 14:22:49 -060069static int get_pcie_bar(device_t dev, unsigned int index, u32 *base, u32 *len)
Aaron Durbin76c37002012-10-30 09:03:43 -050070{
Aaron Durbin76c37002012-10-30 09:03:43 -050071 u32 pciexbar_reg;
72
73 *base = 0;
74 *len = 0;
75
Aaron Durbinc12ef972012-12-18 14:22:49 -060076 pciexbar_reg = pci_read_config32(dev, index);
Aaron Durbin76c37002012-10-30 09:03:43 -050077
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
Aaron Durbin76c37002012-10-30 09:03:43 -050099static void pci_domain_set_resources(device_t dev)
100{
Aaron Durbin76c37002012-10-30 09:03:43 -0500101 assign_resources(dev->link_list);
Aaron Durbin76c37002012-10-30 09:03:43 -0500102}
103
104 /* TODO We could determine how many PCIe busses we need in
105 * the bar. For now that number is hardcoded to a max of 64.
106 * See e7525/northbridge.c for an example.
107 */
108static struct device_operations pci_domain_ops = {
109 .read_resources = pci_domain_read_resources,
110 .set_resources = pci_domain_set_resources,
111 .enable_resources = NULL,
112 .init = NULL,
113 .scan_bus = pci_domain_scan_bus,
114#if CONFIG_MMCONF_SUPPORT_DEFAULT
115 .ops_pci_bus = &pci_ops_mmconf,
116#else
117 .ops_pci_bus = &pci_cf8_conf1,
118#endif
119};
120
Aaron Durbinc12ef972012-12-18 14:22:49 -0600121static int get_bar(device_t dev, unsigned int index, u32 *base, u32 *len)
Aaron Durbin76c37002012-10-30 09:03:43 -0500122{
Aaron Durbinc12ef972012-12-18 14:22:49 -0600123 u32 bar;
Aaron Durbin76c37002012-10-30 09:03:43 -0500124
Aaron Durbinc12ef972012-12-18 14:22:49 -0600125 bar = pci_read_config32(dev, index);
Aaron Durbin76c37002012-10-30 09:03:43 -0500126
Aaron Durbinc12ef972012-12-18 14:22:49 -0600127 /* If not enabled don't report it. */
128 if (!(bar & 0x1))
129 return 0;
Aaron Durbin76c37002012-10-30 09:03:43 -0500130
Aaron Durbinc12ef972012-12-18 14:22:49 -0600131 /* Knock down the enable bit. */
132 *base = bar & ~1;
133
134 return 1;
Aaron Durbin76c37002012-10-30 09:03:43 -0500135}
136
Aaron Durbinc12ef972012-12-18 14:22:49 -0600137/* There are special BARs that actually are programmed in the MCHBAR. These
138 * Intel special features, but they do consume resources that need to be
139 * accounted for. */
140static int get_bar_in_mchbar(device_t dev, unsigned int index, u32 *base,
141 u32 *len)
Aaron Durbin76c37002012-10-30 09:03:43 -0500142{
Aaron Durbinc12ef972012-12-18 14:22:49 -0600143 u32 bar;
Aaron Durbin76c37002012-10-30 09:03:43 -0500144
Aaron Durbinc12ef972012-12-18 14:22:49 -0600145 bar = MCHBAR32(index);
146
147 /* If not enabled don't report it. */
148 if (!(bar & 0x1))
149 return 0;
150
151 /* Knock down the enable bit. */
152 *base = bar & ~1;
153
154 return 1;
155}
156
157struct fixed_mmio_descriptor {
158 unsigned int index;
159 u32 size;
160 int (*get_resource)(device_t dev, unsigned int index,
161 u32 *base, u32 *size);
162 const char *description;
163};
164
165#define SIZE_KB(x) ((x)*1024)
166struct fixed_mmio_descriptor mc_fixed_resources[] = {
167 { PCIEXBAR, SIZE_KB(0), get_pcie_bar, "PCIEXBAR" },
168 { MCHBAR, SIZE_KB(32), get_bar, "MCHBAR" },
169 { DMIBAR, SIZE_KB(4), get_bar, "DMIBAR" },
170 { EPBAR, SIZE_KB(4), get_bar, "EPBAR" },
171 { 0x5420, SIZE_KB(4), get_bar_in_mchbar, "GDXCBAR" },
172 { 0x5408, SIZE_KB(16), get_bar_in_mchbar, "EDRAMBAR" },
173};
174#undef SIZE_KB
175
176/*
177 * Add all known fixed MMIO ranges that hang off the host bridge/memory
178 * controller device.
179 */
180static void mc_add_fixed_mmio_resources(device_t dev)
181{
182 int i;
183
184 for (i = 0; i < ARRAY_SIZE(mc_fixed_resources); i++) {
185 u32 base;
186 u32 size;
187 struct resource *resource;
188 unsigned int index;
189
190 size = mc_fixed_resources[i].size;
191 index = mc_fixed_resources[i].index;
192 if (!mc_fixed_resources[i].get_resource(dev, index,
193 &base, &size))
194 continue;
195
196 resource = new_resource(dev, mc_fixed_resources[i].index);
197 resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED |
198 IORESOURCE_STORED | IORESOURCE_RESERVE |
199 IORESOURCE_ASSIGNED;
200 resource->base = base;
201 resource->size = size;
202 printk(BIOS_DEBUG, "%s: Adding %s @ %x 0x%08lx-0x%08lx.\n",
203 __func__, mc_fixed_resources[i].description, index,
204 (unsigned long)base, (unsigned long)(base + size - 1));
205 }
206}
207
208/* Host Memory Map:
209 *
210 * +--------------------------+ TOUUD
211 * | |
212 * +--------------------------+ 4GiB
213 * | PCI Address Space |
214 * +--------------------------+ TOLUD (also maps into MC address space)
215 * | iGD |
216 * +--------------------------+ BDSM
217 * | GTT |
218 * +--------------------------+ BGSM
219 * | TSEG |
220 * +--------------------------+ TSEGMB
221 * | Usage DRAM |
222 * +--------------------------+ 0
223 *
224 * Some of the base registers above can be equal making the size of those
225 * regions 0. The reason is because the memory controller internally subtracts
226 * the base registers from each other to determine sizes of the regions. In
227 * other words, the memory map is in a fixed order no matter what.
228 */
229
230struct map_entry {
231 int reg;
232 int is_64_bit;
233 int is_limit;
234 const char *description;
235};
236
237static void read_map_entry(device_t dev, struct map_entry *entry,
238 uint64_t *result)
239{
240 uint64_t value;
241 uint64_t mask;
242
243 /* All registers are on a 1MiB granularity. */
244 mask = ((1ULL<<20)-1);
245 mask = ~mask;
246
247 value = 0;
248
249 if (entry->is_64_bit) {
250 value = pci_read_config32(dev, entry->reg + 4);
251 value <<= 32;
Aaron Durbin76c37002012-10-30 09:03:43 -0500252 }
253
Aaron Durbinc12ef972012-12-18 14:22:49 -0600254 value |= pci_read_config32(dev, entry->reg);
255 value &= mask;
256
257 if (entry->is_limit)
258 value |= ~mask;
259
260 *result = value;
261}
262
263#define MAP_ENTRY(reg_, is_64_, is_limit_, desc_) \
264 { \
265 .reg = reg_, \
266 .is_64_bit = is_64_, \
267 .is_limit = is_limit_, \
268 .description = desc_, \
269 }
270
271#define MAP_ENTRY_BASE_64(reg_, desc_) \
272 MAP_ENTRY(reg_, 1, 0, desc_)
273#define MAP_ENTRY_LIMIT_64(reg_, desc_) \
274 MAP_ENTRY(reg_, 1, 1, desc_)
275#define MAP_ENTRY_BASE_32(reg_, desc_) \
276 MAP_ENTRY(reg_, 0, 0, desc_)
277
278enum {
279 TOM_REG,
280 TOUUD_REG,
281 MESEG_BASE_REG,
282 MESEG_LIMIT_REG,
283 REMAP_BASE_REG,
284 REMAP_LIMIT_REG,
285 TOLUD_REG,
286 BGSM_REG,
287 BDSM_REG,
288 TSEG_REG,
289 // Must be last.
290 NUM_MAP_ENTRIES
291};
292
293static struct map_entry memory_map[NUM_MAP_ENTRIES] = {
294 [TOM_REG] = MAP_ENTRY_BASE_64(TOM, "TOM"),
295 [TOUUD_REG] = MAP_ENTRY_BASE_64(TOUUD, "TOUUD"),
296 [MESEG_BASE_REG] = MAP_ENTRY_BASE_64(MESEG_BASE, "MESEG_BASE"),
297 [MESEG_LIMIT_REG] = MAP_ENTRY_LIMIT_64(MESEG_LIMIT, "MESEG_LIMIT"),
298 [REMAP_BASE_REG] = MAP_ENTRY_BASE_64(REMAPBASE, "REMAP_BASE"),
299 [REMAP_LIMIT_REG] = MAP_ENTRY_LIMIT_64(REMAPLIMIT, "REMAP_LIMIT"),
300 [TOLUD_REG] = MAP_ENTRY_BASE_32(TOLUD, "TOLUD"),
301 [BGSM_REG] = MAP_ENTRY_BASE_32(BDSM, "BDSM"),
302 [BDSM_REG] = MAP_ENTRY_BASE_32(BGSM, "BGSM"),
303 [TSEG_REG] = MAP_ENTRY_BASE_32(TSEG, "TESGMB"),
304};
305
306static void mc_read_map_entries(device_t dev, uint64_t *values)
307{
308 int i;
309 for (i = 0; i < NUM_MAP_ENTRIES; i++) {
310 read_map_entry(dev, &memory_map[i], &values[i]);
311 }
312}
313
314static void mc_report_map_entries(device_t dev, uint64_t *values)
315{
316 int i;
317 for (i = 0; i < NUM_MAP_ENTRIES; i++) {
318 printk(BIOS_DEBUG, "MC MAP: %s: 0x%llx\n",
319 memory_map[i].description, values[i]);
320 }
321 /* One can validate the BDSM and BGSM against the GGC. */
322 printk(BIOS_DEBUG, "MC MAP: GGC: 0x%x\n", pci_read_config16(dev, GGC));
323}
324
325static void mc_add_dram_resources(device_t dev)
326{
327 unsigned long base_k, size_k;
328 unsigned long index;
329 struct resource *resource;
330 uint64_t mc_values[NUM_MAP_ENTRIES];
331
332 /* Read in the MAP registers and report their values. */
333 mc_read_map_entries(dev, &mc_values[0]);
334 mc_report_map_entries(dev, &mc_values[0]);
335
336 /*
Aaron Durbin1fef1f52012-12-19 17:15:43 -0600337 * These are the host memory ranges that should be added:
338 * - 0 -> SMM_DEFAULT_BASE : cacheable
339 * - SMM_DEFAULT_BASE -> SMM_DEFAULT_BASE + SMM_DEFAULT_SIZE :
340 * cacheable and reserved
341 * - SMM_DEFAULT_BASE + SMM_DEFAULT_SIZE -> 0xa0000 : cacheable
Aaron Durbinc12ef972012-12-18 14:22:49 -0600342 * - 0xc0000 -> TSEG : cacheable
343 * - TESG -> TOLUD: not cacheable with standard MTRRs and reserved
344 * - 4GiB -> TOUUD: cacheable
345 *
Aaron Durbin1fef1f52012-12-19 17:15:43 -0600346 * The default SMRAM space is reserved so that the range doesn't
347 * have to be saved during S3 Resume. Once marked reserved the OS
348 * cannot use the memory. This is a bit of an odd place to reserve
349 * the region, but the CPU devices don't have dev_ops->read_resources()
350 * called on them.
351 *
Aaron Durbinc12ef972012-12-18 14:22:49 -0600352 * The range 0xa0000 -> 0xc0000 does not have any resources
353 * associated with it to handle legacy VGA memory. If this range
354 * is not omitted the mtrr code will setup the area as cacheable
355 * causing VGA access to not work.
356 *
Aaron Durbin1fef1f52012-12-19 17:15:43 -0600357 * It should be noted that cacheable entry types need to be added in
358 * order. The reason is that the current MTRR code assumes this and
359 * falls over itself if it isn't.
360 *
Aaron Durbinc12ef972012-12-18 14:22:49 -0600361 * The resource index starts low and should not meet or exceed
Aaron Durbin1fef1f52012-12-19 17:15:43 -0600362 * PCI_BASE_ADDRESS_0.
Aaron Durbinc12ef972012-12-18 14:22:49 -0600363 */
364 index = 0;
365
Aaron Durbin1fef1f52012-12-19 17:15:43 -0600366 /* 0 - > SMM_DEFAULT_BASE */
Aaron Durbinc12ef972012-12-18 14:22:49 -0600367 base_k = 0;
Aaron Durbin1fef1f52012-12-19 17:15:43 -0600368 size_k = SMM_DEFAULT_BASE >> 10;
Aaron Durbinc12ef972012-12-18 14:22:49 -0600369 ram_resource(dev, index++, base_k, size_k);
370
Aaron Durbin1fef1f52012-12-19 17:15:43 -0600371 /* SMM_DEFAULT_BASE -> SMM_DEFAULT_BASE + SMM_DEFAULT_SIZE */
372 resource = new_resource(dev, index++);
373 resource->base = SMM_DEFAULT_BASE;
374 resource->size = SMM_DEFAULT_SIZE;
375 resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED |
376 IORESOURCE_CACHEABLE | IORESOURCE_STORED |
377 IORESOURCE_RESERVE | IORESOURCE_ASSIGNED;
378
379 /* SMM_DEFAULT_BASE + SMM_DEFAULT_SIZE -> 0xa0000 */
380 base_k = (SMM_DEFAULT_BASE + SMM_DEFAULT_SIZE) >> 10;
381 size_k = (0xa0000 >> 10) - base_k;
382 ram_resource(dev, index++, base_k, size_k);
383
384 /* 0xc0000 -> TSEG */
Aaron Durbinc12ef972012-12-18 14:22:49 -0600385 base_k = 0xc0000 >> 10;
386 size_k = (unsigned long)(mc_values[TSEG_REG] >> 10) - base_k;
387 ram_resource(dev, index++, base_k, size_k);
388
389 /* TSEG -> TOLUD */
390 resource = new_resource(dev, index++);
391 resource->base = mc_values[TSEG_REG];
392 resource->size = mc_values[TOLUD_REG] - resource->base;
393 resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED |
394 IORESOURCE_STORED | IORESOURCE_RESERVE |
395 IORESOURCE_ASSIGNED;
396
397 /* 4GiB -> TOUUD */
398 base_k = 4096 * 1024; /* 4GiB */
399 size_k = (unsigned long)(mc_values[TOUUD_REG] >> 10) - base_k;
400 ram_resource(dev, index++, base_k, size_k);
401
402 mmio_resource(dev, index++, legacy_hole_base_k, legacy_hole_size_k);
403#if CONFIG_CHROMEOS_RAMOOPS
404 mmio_resource(dev, index++, CONFIG_CHROMEOS_RAMOOPS_RAM_START >> 10,
405 CONFIG_CHROMEOS_RAMOOPS_RAM_SIZE >> 10);
406#endif
407
408 /* Leave some space for ACPI, PIRQ and MP tables */
409 high_tables_size = HIGH_MEMORY_SIZE;
410 high_tables_base = mc_values[TSEG_REG] - high_tables_size;
411}
412
413static void mc_read_resources(device_t dev)
414{
415 /* Read standard PCI resources. */
416 pci_dev_read_resources(dev);
417
418 /* Add all fixed MMIO resources. */
419 mc_add_fixed_mmio_resources(dev);
420
421 /* Calculate and add DRAM resources. */
422 mc_add_dram_resources(dev);
Aaron Durbin76c37002012-10-30 09:03:43 -0500423}
424
425static void intel_set_subsystem(device_t dev, unsigned vendor, unsigned device)
426{
427 if (!vendor || !device) {
428 pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
429 pci_read_config32(dev, PCI_VENDOR_ID));
430 } else {
431 pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
432 ((device & 0xffff) << 16) | (vendor & 0xffff));
433 }
434}
435
436static void northbridge_dmi_init(struct device *dev)
437{
438 u32 reg32;
439
440 /* Clear error status bits */
441 DMIBAR32(0x1c4) = 0xffffffff;
442 DMIBAR32(0x1d0) = 0xffffffff;
443
444 /* Steps prior to DMI ASPM */
445 if ((bridge_silicon_revision() & BASE_REV_MASK) == BASE_REV_SNB) {
446 reg32 = DMIBAR32(0x250);
447 reg32 &= ~((1 << 22)|(1 << 20));
448 reg32 |= (1 << 21);
449 DMIBAR32(0x250) = reg32;
450 }
451
452 reg32 = DMIBAR32(0x238);
453 reg32 |= (1 << 29);
454 DMIBAR32(0x238) = reg32;
455
456 if (bridge_silicon_revision() >= SNB_STEP_D0) {
457 reg32 = DMIBAR32(0x1f8);
458 reg32 |= (1 << 16);
459 DMIBAR32(0x1f8) = reg32;
460 } else if (bridge_silicon_revision() >= SNB_STEP_D1) {
461 reg32 = DMIBAR32(0x1f8);
462 reg32 &= ~(1 << 26);
463 reg32 |= (1 << 16);
464 DMIBAR32(0x1f8) = reg32;
465
466 reg32 = DMIBAR32(0x1fc);
467 reg32 |= (1 << 12) | (1 << 23);
468 DMIBAR32(0x1fc) = reg32;
469 }
470
471 /* Enable ASPM on SNB link, should happen before PCH link */
472 if ((bridge_silicon_revision() & BASE_REV_MASK) == BASE_REV_SNB) {
473 reg32 = DMIBAR32(0xd04);
474 reg32 |= (1 << 4);
475 DMIBAR32(0xd04) = reg32;
476 }
477
478 reg32 = DMIBAR32(0x88);
479 reg32 |= (1 << 1) | (1 << 0);
480 DMIBAR32(0x88) = reg32;
481}
482
483static void northbridge_init(struct device *dev)
484{
485 u8 bios_reset_cpl;
486 u32 bridge_type;
487
488 northbridge_dmi_init(dev);
489
490 bridge_type = MCHBAR32(0x5f10);
491 bridge_type &= ~0xff;
492
493 if ((bridge_silicon_revision() & BASE_REV_MASK) == BASE_REV_IVB) {
494 /* Enable Power Aware Interrupt Routing */
495 u8 pair = MCHBAR8(0x5418);
496 pair &= ~0xf; /* Clear 3:0 */
497 pair |= 0x4; /* Fixed Priority */
498 MCHBAR8(0x5418) = pair;
499
500 /* 30h for IvyBridge */
501 bridge_type |= 0x30;
502 } else {
503 /* 20h for Sandybridge */
504 bridge_type |= 0x20;
505 }
506 MCHBAR32(0x5f10) = bridge_type;
507
508 /*
509 * Set bit 0 of BIOS_RESET_CPL to indicate to the CPU
510 * that BIOS has initialized memory and power management
511 */
512 bios_reset_cpl = MCHBAR8(BIOS_RESET_CPL);
513 bios_reset_cpl |= 1;
514 MCHBAR8(BIOS_RESET_CPL) = bios_reset_cpl;
515 printk(BIOS_DEBUG, "Set BIOS_RESET_CPL\n");
516
517 /* Configure turbo power limits 1ms after reset complete bit */
518 mdelay(1);
519 set_power_limits(28);
520
521 /*
522 * CPUs with configurable TDP also need power limits set
523 * in MCHBAR. Use same values from MSR_PKG_POWER_LIMIT.
524 */
525 if (cpu_config_tdp_levels()) {
526 msr_t msr = rdmsr(MSR_PKG_POWER_LIMIT);
527 MCHBAR32(0x59A0) = msr.lo;
528 MCHBAR32(0x59A4) = msr.hi;
529 }
530
531 /* Set here before graphics PM init */
532 MCHBAR32(0x5500) = 0x00100001;
533}
534
535static void northbridge_enable(device_t dev)
536{
537#if CONFIG_HAVE_ACPI_RESUME
538 switch (pci_read_config32(dev, SKPAD)) {
539 case 0xcafebabe:
540 printk(BIOS_DEBUG, "Normal boot.\n");
541 acpi_slp_type=0;
542 break;
543 case 0xcafed00d:
544 printk(BIOS_DEBUG, "S3 Resume.\n");
545 acpi_slp_type=3;
546 break;
547 default:
548 printk(BIOS_DEBUG, "Unknown boot method, assuming normal.\n");
549 acpi_slp_type=0;
550 break;
551 }
552#endif
553}
554
555static struct pci_operations intel_pci_ops = {
556 .set_subsystem = intel_set_subsystem,
557};
558
559static struct device_operations mc_ops = {
560 .read_resources = mc_read_resources,
Aaron Durbinc12ef972012-12-18 14:22:49 -0600561 .set_resources = pci_dev_set_resources,
Aaron Durbin76c37002012-10-30 09:03:43 -0500562 .enable_resources = pci_dev_enable_resources,
563 .init = northbridge_init,
564 .enable = northbridge_enable,
565 .scan_bus = 0,
566 .ops_pci = &intel_pci_ops,
567};
568
Aaron Durbinc1989c42012-12-11 17:13:17 -0600569static const struct pci_driver mc_driver_hsw_mobile __pci_driver = {
Aaron Durbin76c37002012-10-30 09:03:43 -0500570 .ops = &mc_ops,
571 .vendor = PCI_VENDOR_ID_INTEL,
Aaron Durbinc1989c42012-12-11 17:13:17 -0600572 .device = 0x0c04, /* Mobile Haswell */
Aaron Durbin76c37002012-10-30 09:03:43 -0500573};
574
Duncan Lauriedf7be712012-12-17 11:22:57 -0800575static const struct pci_driver mc_driver_hsw_ult __pci_driver = {
576 .ops = &mc_ops,
577 .vendor = PCI_VENDOR_ID_INTEL,
578 .device = 0x0a04, /* ULT Haswell */
579};
580
Aaron Durbin76c37002012-10-30 09:03:43 -0500581static void cpu_bus_init(device_t dev)
582{
583 initialize_cpus(dev->link_list);
584}
585
586static void cpu_bus_noop(device_t dev)
587{
588}
589
590static struct device_operations cpu_bus_ops = {
591 .read_resources = cpu_bus_noop,
592 .set_resources = cpu_bus_noop,
593 .enable_resources = cpu_bus_noop,
594 .init = cpu_bus_init,
595 .scan_bus = 0,
596};
597
598static void enable_dev(device_t dev)
599{
600 /* Set the operations if it is a special bus type */
601 if (dev->path.type == DEVICE_PATH_DOMAIN) {
602 dev->ops = &pci_domain_ops;
603 } else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER) {
604 dev->ops = &cpu_bus_ops;
605 }
606}
607
608struct chip_operations northbridge_intel_haswell_ops = {
609 CHIP_NAME("Intel i7 (Haswell) integrated Northbridge")
610 .enable_dev = enable_dev,
611};