blob: 8d57c03b162b1b17a1057ab4ce18f33ce3c76841 [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>
Aaron Durbinbf396ff2013-02-11 21:50:35 -060038#include <romstage_handoff.h>
Aaron Durbin76c37002012-10-30 09:03:43 -050039#include "chip.h"
40#include "haswell.h"
41
Aaron Durbinc12ef972012-12-18 14:22:49 -060042static int get_pcie_bar(device_t dev, unsigned int index, u32 *base, u32 *len)
Aaron Durbin76c37002012-10-30 09:03:43 -050043{
Aaron Durbin76c37002012-10-30 09:03:43 -050044 u32 pciexbar_reg;
45
46 *base = 0;
47 *len = 0;
48
Aaron Durbinc12ef972012-12-18 14:22:49 -060049 pciexbar_reg = pci_read_config32(dev, index);
Aaron Durbin76c37002012-10-30 09:03:43 -050050
51 if (!(pciexbar_reg & (1 << 0)))
52 return 0;
53
54 switch ((pciexbar_reg >> 1) & 3) {
55 case 0: // 256MB
56 *base = pciexbar_reg & ((1 << 31)|(1 << 30)|(1 << 29)|(1 << 28));
57 *len = 256 * 1024 * 1024;
58 return 1;
59 case 1: // 128M
60 *base = pciexbar_reg & ((1 << 31)|(1 << 30)|(1 << 29)|(1 << 28)|(1 << 27));
61 *len = 128 * 1024 * 1024;
62 return 1;
63 case 2: // 64M
64 *base = pciexbar_reg & ((1 << 31)|(1 << 30)|(1 << 29)|(1 << 28)|(1 << 27)|(1 << 26));
65 *len = 64 * 1024 * 1024;
66 return 1;
67 }
68
69 return 0;
70}
71
Aaron Durbin76c37002012-10-30 09:03:43 -050072static void pci_domain_set_resources(device_t dev)
73{
Aaron Durbin76c37002012-10-30 09:03:43 -050074 assign_resources(dev->link_list);
Aaron Durbin76c37002012-10-30 09:03:43 -050075}
76
77 /* TODO We could determine how many PCIe busses we need in
78 * the bar. For now that number is hardcoded to a max of 64.
79 * See e7525/northbridge.c for an example.
80 */
81static struct device_operations pci_domain_ops = {
82 .read_resources = pci_domain_read_resources,
83 .set_resources = pci_domain_set_resources,
84 .enable_resources = NULL,
85 .init = NULL,
86 .scan_bus = pci_domain_scan_bus,
Kyösti Mälkki872c9222013-07-03 09:44:28 +030087 .ops_pci_bus = pci_bus_default_ops,
Aaron Durbin76c37002012-10-30 09:03:43 -050088};
89
Aaron Durbinc12ef972012-12-18 14:22:49 -060090static int get_bar(device_t dev, unsigned int index, u32 *base, u32 *len)
Aaron Durbin76c37002012-10-30 09:03:43 -050091{
Aaron Durbinc12ef972012-12-18 14:22:49 -060092 u32 bar;
Aaron Durbin76c37002012-10-30 09:03:43 -050093
Aaron Durbinc12ef972012-12-18 14:22:49 -060094 bar = pci_read_config32(dev, index);
Aaron Durbin76c37002012-10-30 09:03:43 -050095
Aaron Durbinc12ef972012-12-18 14:22:49 -060096 /* If not enabled don't report it. */
97 if (!(bar & 0x1))
98 return 0;
Aaron Durbin76c37002012-10-30 09:03:43 -050099
Aaron Durbinc12ef972012-12-18 14:22:49 -0600100 /* Knock down the enable bit. */
101 *base = bar & ~1;
102
103 return 1;
Aaron Durbin76c37002012-10-30 09:03:43 -0500104}
105
Aaron Durbinc12ef972012-12-18 14:22:49 -0600106/* There are special BARs that actually are programmed in the MCHBAR. These
107 * Intel special features, but they do consume resources that need to be
108 * accounted for. */
109static int get_bar_in_mchbar(device_t dev, unsigned int index, u32 *base,
110 u32 *len)
Aaron Durbin76c37002012-10-30 09:03:43 -0500111{
Aaron Durbinc12ef972012-12-18 14:22:49 -0600112 u32 bar;
Aaron Durbin76c37002012-10-30 09:03:43 -0500113
Aaron Durbinc12ef972012-12-18 14:22:49 -0600114 bar = MCHBAR32(index);
115
116 /* If not enabled don't report it. */
117 if (!(bar & 0x1))
118 return 0;
119
120 /* Knock down the enable bit. */
121 *base = bar & ~1;
122
123 return 1;
124}
125
126struct fixed_mmio_descriptor {
127 unsigned int index;
128 u32 size;
129 int (*get_resource)(device_t dev, unsigned int index,
130 u32 *base, u32 *size);
131 const char *description;
132};
133
134#define SIZE_KB(x) ((x)*1024)
135struct fixed_mmio_descriptor mc_fixed_resources[] = {
136 { PCIEXBAR, SIZE_KB(0), get_pcie_bar, "PCIEXBAR" },
137 { MCHBAR, SIZE_KB(32), get_bar, "MCHBAR" },
138 { DMIBAR, SIZE_KB(4), get_bar, "DMIBAR" },
139 { EPBAR, SIZE_KB(4), get_bar, "EPBAR" },
140 { 0x5420, SIZE_KB(4), get_bar_in_mchbar, "GDXCBAR" },
141 { 0x5408, SIZE_KB(16), get_bar_in_mchbar, "EDRAMBAR" },
142};
143#undef SIZE_KB
144
145/*
146 * Add all known fixed MMIO ranges that hang off the host bridge/memory
147 * controller device.
148 */
149static void mc_add_fixed_mmio_resources(device_t dev)
150{
151 int i;
152
153 for (i = 0; i < ARRAY_SIZE(mc_fixed_resources); i++) {
154 u32 base;
155 u32 size;
156 struct resource *resource;
157 unsigned int index;
158
159 size = mc_fixed_resources[i].size;
160 index = mc_fixed_resources[i].index;
161 if (!mc_fixed_resources[i].get_resource(dev, index,
162 &base, &size))
163 continue;
164
165 resource = new_resource(dev, mc_fixed_resources[i].index);
166 resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED |
167 IORESOURCE_STORED | IORESOURCE_RESERVE |
168 IORESOURCE_ASSIGNED;
169 resource->base = base;
170 resource->size = size;
171 printk(BIOS_DEBUG, "%s: Adding %s @ %x 0x%08lx-0x%08lx.\n",
172 __func__, mc_fixed_resources[i].description, index,
173 (unsigned long)base, (unsigned long)(base + size - 1));
174 }
175}
176
177/* Host Memory Map:
178 *
179 * +--------------------------+ TOUUD
180 * | |
181 * +--------------------------+ 4GiB
182 * | PCI Address Space |
183 * +--------------------------+ TOLUD (also maps into MC address space)
184 * | iGD |
185 * +--------------------------+ BDSM
186 * | GTT |
187 * +--------------------------+ BGSM
188 * | TSEG |
189 * +--------------------------+ TSEGMB
190 * | Usage DRAM |
191 * +--------------------------+ 0
192 *
193 * Some of the base registers above can be equal making the size of those
194 * regions 0. The reason is because the memory controller internally subtracts
195 * the base registers from each other to determine sizes of the regions. In
196 * other words, the memory map is in a fixed order no matter what.
197 */
198
199struct map_entry {
200 int reg;
201 int is_64_bit;
202 int is_limit;
203 const char *description;
204};
205
206static void read_map_entry(device_t dev, struct map_entry *entry,
207 uint64_t *result)
208{
209 uint64_t value;
210 uint64_t mask;
211
212 /* All registers are on a 1MiB granularity. */
213 mask = ((1ULL<<20)-1);
214 mask = ~mask;
215
216 value = 0;
217
218 if (entry->is_64_bit) {
219 value = pci_read_config32(dev, entry->reg + 4);
220 value <<= 32;
Aaron Durbin76c37002012-10-30 09:03:43 -0500221 }
222
Aaron Durbinc12ef972012-12-18 14:22:49 -0600223 value |= pci_read_config32(dev, entry->reg);
224 value &= mask;
225
226 if (entry->is_limit)
227 value |= ~mask;
228
229 *result = value;
230}
231
232#define MAP_ENTRY(reg_, is_64_, is_limit_, desc_) \
233 { \
234 .reg = reg_, \
235 .is_64_bit = is_64_, \
236 .is_limit = is_limit_, \
237 .description = desc_, \
238 }
239
240#define MAP_ENTRY_BASE_64(reg_, desc_) \
241 MAP_ENTRY(reg_, 1, 0, desc_)
242#define MAP_ENTRY_LIMIT_64(reg_, desc_) \
243 MAP_ENTRY(reg_, 1, 1, desc_)
244#define MAP_ENTRY_BASE_32(reg_, desc_) \
245 MAP_ENTRY(reg_, 0, 0, desc_)
246
247enum {
248 TOM_REG,
249 TOUUD_REG,
250 MESEG_BASE_REG,
251 MESEG_LIMIT_REG,
252 REMAP_BASE_REG,
253 REMAP_LIMIT_REG,
254 TOLUD_REG,
255 BGSM_REG,
256 BDSM_REG,
257 TSEG_REG,
258 // Must be last.
259 NUM_MAP_ENTRIES
260};
261
262static struct map_entry memory_map[NUM_MAP_ENTRIES] = {
263 [TOM_REG] = MAP_ENTRY_BASE_64(TOM, "TOM"),
264 [TOUUD_REG] = MAP_ENTRY_BASE_64(TOUUD, "TOUUD"),
265 [MESEG_BASE_REG] = MAP_ENTRY_BASE_64(MESEG_BASE, "MESEG_BASE"),
266 [MESEG_LIMIT_REG] = MAP_ENTRY_LIMIT_64(MESEG_LIMIT, "MESEG_LIMIT"),
267 [REMAP_BASE_REG] = MAP_ENTRY_BASE_64(REMAPBASE, "REMAP_BASE"),
268 [REMAP_LIMIT_REG] = MAP_ENTRY_LIMIT_64(REMAPLIMIT, "REMAP_LIMIT"),
269 [TOLUD_REG] = MAP_ENTRY_BASE_32(TOLUD, "TOLUD"),
Aaron Durbin15702602012-12-21 22:18:58 -0600270 [BDSM_REG] = MAP_ENTRY_BASE_32(BDSM, "BDSM"),
271 [BGSM_REG] = MAP_ENTRY_BASE_32(BGSM, "BGSM"),
Aaron Durbinc12ef972012-12-18 14:22:49 -0600272 [TSEG_REG] = MAP_ENTRY_BASE_32(TSEG, "TESGMB"),
273};
274
275static void mc_read_map_entries(device_t dev, uint64_t *values)
276{
277 int i;
278 for (i = 0; i < NUM_MAP_ENTRIES; i++) {
279 read_map_entry(dev, &memory_map[i], &values[i]);
280 }
281}
282
283static void mc_report_map_entries(device_t dev, uint64_t *values)
284{
285 int i;
286 for (i = 0; i < NUM_MAP_ENTRIES; i++) {
287 printk(BIOS_DEBUG, "MC MAP: %s: 0x%llx\n",
288 memory_map[i].description, values[i]);
289 }
290 /* One can validate the BDSM and BGSM against the GGC. */
291 printk(BIOS_DEBUG, "MC MAP: GGC: 0x%x\n", pci_read_config16(dev, GGC));
292}
293
294static void mc_add_dram_resources(device_t dev)
295{
296 unsigned long base_k, size_k;
Aaron Durbin27435d32013-06-03 09:46:56 -0500297 unsigned long touud_k;
Aaron Durbinc12ef972012-12-18 14:22:49 -0600298 unsigned long index;
299 struct resource *resource;
300 uint64_t mc_values[NUM_MAP_ENTRIES];
301
302 /* Read in the MAP registers and report their values. */
303 mc_read_map_entries(dev, &mc_values[0]);
304 mc_report_map_entries(dev, &mc_values[0]);
305
306 /*
Aaron Durbin1fef1f52012-12-19 17:15:43 -0600307 * These are the host memory ranges that should be added:
308 * - 0 -> SMM_DEFAULT_BASE : cacheable
309 * - SMM_DEFAULT_BASE -> SMM_DEFAULT_BASE + SMM_DEFAULT_SIZE :
310 * cacheable and reserved
311 * - SMM_DEFAULT_BASE + SMM_DEFAULT_SIZE -> 0xa0000 : cacheable
Aaron Durbinc12ef972012-12-18 14:22:49 -0600312 * - 0xc0000 -> TSEG : cacheable
Aaron Durbine6c3b1d2012-12-21 21:22:07 -0600313 * - TESG -> BGSM: cacheable with standard MTRRs and reserved
314 * - BGSM -> TOLUD: not cacheable with standard MTRRs and reserved
Aaron Durbinc12ef972012-12-18 14:22:49 -0600315 * - 4GiB -> TOUUD: cacheable
316 *
Aaron Durbin1fef1f52012-12-19 17:15:43 -0600317 * The default SMRAM space is reserved so that the range doesn't
318 * have to be saved during S3 Resume. Once marked reserved the OS
319 * cannot use the memory. This is a bit of an odd place to reserve
320 * the region, but the CPU devices don't have dev_ops->read_resources()
321 * called on them.
322 *
Aaron Durbinc12ef972012-12-18 14:22:49 -0600323 * The range 0xa0000 -> 0xc0000 does not have any resources
324 * associated with it to handle legacy VGA memory. If this range
325 * is not omitted the mtrr code will setup the area as cacheable
326 * causing VGA access to not work.
327 *
Aaron Durbine6c3b1d2012-12-21 21:22:07 -0600328 * The TSEG region is mapped as cacheable so that one can perform
329 * SMRAM relocation faster. Once the SMRR is enabled the SMRR takes
330 * precedence over the existing MTRRs covering this region.
331 *
Aaron Durbin1fef1f52012-12-19 17:15:43 -0600332 * It should be noted that cacheable entry types need to be added in
333 * order. The reason is that the current MTRR code assumes this and
334 * falls over itself if it isn't.
335 *
Aaron Durbinc12ef972012-12-18 14:22:49 -0600336 * The resource index starts low and should not meet or exceed
Aaron Durbin1fef1f52012-12-19 17:15:43 -0600337 * PCI_BASE_ADDRESS_0.
Aaron Durbinc12ef972012-12-18 14:22:49 -0600338 */
339 index = 0;
340
Aaron Durbin1fef1f52012-12-19 17:15:43 -0600341 /* 0 - > SMM_DEFAULT_BASE */
Aaron Durbinc12ef972012-12-18 14:22:49 -0600342 base_k = 0;
Aaron Durbin1fef1f52012-12-19 17:15:43 -0600343 size_k = SMM_DEFAULT_BASE >> 10;
Aaron Durbinc12ef972012-12-18 14:22:49 -0600344 ram_resource(dev, index++, base_k, size_k);
345
Aaron Durbin1fef1f52012-12-19 17:15:43 -0600346 /* SMM_DEFAULT_BASE -> SMM_DEFAULT_BASE + SMM_DEFAULT_SIZE */
347 resource = new_resource(dev, index++);
348 resource->base = SMM_DEFAULT_BASE;
349 resource->size = SMM_DEFAULT_SIZE;
350 resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED |
351 IORESOURCE_CACHEABLE | IORESOURCE_STORED |
352 IORESOURCE_RESERVE | IORESOURCE_ASSIGNED;
353
354 /* SMM_DEFAULT_BASE + SMM_DEFAULT_SIZE -> 0xa0000 */
355 base_k = (SMM_DEFAULT_BASE + SMM_DEFAULT_SIZE) >> 10;
356 size_k = (0xa0000 >> 10) - base_k;
357 ram_resource(dev, index++, base_k, size_k);
358
359 /* 0xc0000 -> TSEG */
Aaron Durbinc12ef972012-12-18 14:22:49 -0600360 base_k = 0xc0000 >> 10;
361 size_k = (unsigned long)(mc_values[TSEG_REG] >> 10) - base_k;
362 ram_resource(dev, index++, base_k, size_k);
363
Aaron Durbine6c3b1d2012-12-21 21:22:07 -0600364 /* TSEG -> BGSM */
Aaron Durbinc12ef972012-12-18 14:22:49 -0600365 resource = new_resource(dev, index++);
366 resource->base = mc_values[TSEG_REG];
Aaron Durbine6c3b1d2012-12-21 21:22:07 -0600367 resource->size = mc_values[BGSM_REG] - resource->base;
368 resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED |
369 IORESOURCE_STORED | IORESOURCE_RESERVE |
370 IORESOURCE_ASSIGNED | IORESOURCE_CACHEABLE;
371
372 /* BGSM -> TOLUD */
373 resource = new_resource(dev, index++);
374 resource->base = mc_values[BGSM_REG];
Aaron Durbinc12ef972012-12-18 14:22:49 -0600375 resource->size = mc_values[TOLUD_REG] - resource->base;
376 resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED |
377 IORESOURCE_STORED | IORESOURCE_RESERVE |
378 IORESOURCE_ASSIGNED;
379
380 /* 4GiB -> TOUUD */
381 base_k = 4096 * 1024; /* 4GiB */
Aaron Durbin27435d32013-06-03 09:46:56 -0500382 touud_k = mc_values[TOUUD_REG] >> 10;
383 size_k = touud_k - base_k;
384 if (touud_k > base_k)
Aaron Durbin5c66f082013-01-08 10:10:33 -0600385 ram_resource(dev, index++, base_k, size_k);
Aaron Durbinc12ef972012-12-18 14:22:49 -0600386
Aaron Durbinc9650762013-03-22 22:03:09 -0500387 /* Reserve everything between A segment and 1MB:
388 *
389 * 0xa0000 - 0xbffff: legacy VGA
390 * 0xc0000 - 0xfffff: RAM
391 */
392 mmio_resource(dev, index++, (0xa0000 >> 10), (0xc0000 - 0xa0000) >> 10);
393 reserved_ram_resource(dev, index++, (0xc0000 >> 10),
394 (0x100000 - 0xc0000) >> 10);
Aaron Durbinc12ef972012-12-18 14:22:49 -0600395#if CONFIG_CHROMEOS_RAMOOPS
Aaron Durbinc9650762013-03-22 22:03:09 -0500396 reserved_ram_resource(dev, index++,
397 CONFIG_CHROMEOS_RAMOOPS_RAM_START >> 10,
Aaron Durbinc12ef972012-12-18 14:22:49 -0600398 CONFIG_CHROMEOS_RAMOOPS_RAM_SIZE >> 10);
399#endif
Aaron Durbinc12ef972012-12-18 14:22:49 -0600400}
401
402static void mc_read_resources(device_t dev)
403{
404 /* Read standard PCI resources. */
405 pci_dev_read_resources(dev);
406
407 /* Add all fixed MMIO resources. */
408 mc_add_fixed_mmio_resources(dev);
409
410 /* Calculate and add DRAM resources. */
411 mc_add_dram_resources(dev);
Aaron Durbin76c37002012-10-30 09:03:43 -0500412}
413
414static void intel_set_subsystem(device_t dev, unsigned vendor, unsigned device)
415{
416 if (!vendor || !device) {
417 pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
418 pci_read_config32(dev, PCI_VENDOR_ID));
419 } else {
420 pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
421 ((device & 0xffff) << 16) | (vendor & 0xffff));
422 }
423}
424
Aaron Durbin76c37002012-10-30 09:03:43 -0500425static void northbridge_init(struct device *dev)
426{
Duncan Lauriec70353f2013-06-28 14:40:38 -0700427 u8 bios_reset_cpl, pair;
Aaron Durbin76c37002012-10-30 09:03:43 -0500428
Duncan Lauriec70353f2013-06-28 14:40:38 -0700429 /* Enable Power Aware Interrupt Routing */
430 pair = MCHBAR8(0x5418);
431 pair &= ~0x7; /* Clear 2:0 */
432 pair |= 0x4; /* Fixed Priority */
433 MCHBAR8(0x5418) = pair;
Aaron Durbin76c37002012-10-30 09:03:43 -0500434
435 /*
Duncan Lauriec70353f2013-06-28 14:40:38 -0700436 * Set bits 0+1 of BIOS_RESET_CPL to indicate to the CPU
Aaron Durbin76c37002012-10-30 09:03:43 -0500437 * that BIOS has initialized memory and power management
438 */
439 bios_reset_cpl = MCHBAR8(BIOS_RESET_CPL);
Duncan Lauriec70353f2013-06-28 14:40:38 -0700440 bios_reset_cpl |= 3;
Aaron Durbin76c37002012-10-30 09:03:43 -0500441 MCHBAR8(BIOS_RESET_CPL) = bios_reset_cpl;
442 printk(BIOS_DEBUG, "Set BIOS_RESET_CPL\n");
443
444 /* Configure turbo power limits 1ms after reset complete bit */
445 mdelay(1);
446 set_power_limits(28);
447
Aaron Durbin76c37002012-10-30 09:03:43 -0500448 /* Set here before graphics PM init */
449 MCHBAR32(0x5500) = 0x00100001;
450}
451
452static void northbridge_enable(device_t dev)
453{
454#if CONFIG_HAVE_ACPI_RESUME
Aaron Durbinbf396ff2013-02-11 21:50:35 -0600455 struct romstage_handoff *handoff;
456
457 handoff = cbmem_find(CBMEM_ID_ROMSTAGE_INFO);
458
459 if (handoff == NULL) {
Aaron Durbin76c37002012-10-30 09:03:43 -0500460 printk(BIOS_DEBUG, "Unknown boot method, assuming normal.\n");
Aaron Durbinbf396ff2013-02-11 21:50:35 -0600461 acpi_slp_type = 0;
462 } else if (handoff->s3_resume) {
463 printk(BIOS_DEBUG, "S3 Resume.\n");
464 acpi_slp_type = 3;
465 } else {
466 printk(BIOS_DEBUG, "Normal boot.\n");
467 acpi_slp_type = 0;
Aaron Durbin76c37002012-10-30 09:03:43 -0500468 }
469#endif
470}
471
472static struct pci_operations intel_pci_ops = {
473 .set_subsystem = intel_set_subsystem,
474};
475
476static struct device_operations mc_ops = {
477 .read_resources = mc_read_resources,
Aaron Durbinc12ef972012-12-18 14:22:49 -0600478 .set_resources = pci_dev_set_resources,
Aaron Durbin76c37002012-10-30 09:03:43 -0500479 .enable_resources = pci_dev_enable_resources,
480 .init = northbridge_init,
481 .enable = northbridge_enable,
482 .scan_bus = 0,
483 .ops_pci = &intel_pci_ops,
484};
485
Aaron Durbinc1989c42012-12-11 17:13:17 -0600486static const struct pci_driver mc_driver_hsw_mobile __pci_driver = {
Aaron Durbin76c37002012-10-30 09:03:43 -0500487 .ops = &mc_ops,
488 .vendor = PCI_VENDOR_ID_INTEL,
Aaron Durbin21efd8c2013-01-17 09:39:39 -0600489 .device = PCI_DEVICE_ID_HSW_MOBILE,
Aaron Durbin76c37002012-10-30 09:03:43 -0500490};
491
Duncan Lauriedf7be712012-12-17 11:22:57 -0800492static const struct pci_driver mc_driver_hsw_ult __pci_driver = {
493 .ops = &mc_ops,
494 .vendor = PCI_VENDOR_ID_INTEL,
Aaron Durbin21efd8c2013-01-17 09:39:39 -0600495 .device = PCI_DEVICE_ID_HSW_ULT,
Duncan Lauriedf7be712012-12-17 11:22:57 -0800496};
497
Aaron Durbin76c37002012-10-30 09:03:43 -0500498static void cpu_bus_init(device_t dev)
499{
Aaron Durbin7af20692013-01-14 14:54:41 -0600500 bsp_init_and_start_aps(dev->link_list);
Aaron Durbin76c37002012-10-30 09:03:43 -0500501}
502
503static void cpu_bus_noop(device_t dev)
504{
505}
506
507static struct device_operations cpu_bus_ops = {
508 .read_resources = cpu_bus_noop,
509 .set_resources = cpu_bus_noop,
510 .enable_resources = cpu_bus_noop,
511 .init = cpu_bus_init,
512 .scan_bus = 0,
513};
514
515static void enable_dev(device_t dev)
516{
517 /* Set the operations if it is a special bus type */
518 if (dev->path.type == DEVICE_PATH_DOMAIN) {
519 dev->ops = &pci_domain_ops;
520 } else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER) {
521 dev->ops = &cpu_bus_ops;
522 }
523}
524
525struct chip_operations northbridge_intel_haswell_ops = {
526 CHIP_NAME("Intel i7 (Haswell) integrated Northbridge")
527 .enable_dev = enable_dev,
528};