coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
northbridge.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <commonlib/helpers.h>
4 #include <console/console.h>
5 #include <acpi/acpi.h>
6 #include <delay.h>
8 #include <device/device.h>
9 #include <device/pci.h>
10 #include <device/pci_def.h>
11 #include <device/pci_ids.h>
12 #include <device/pci_ops.h>
13 #include <boot/tables.h>
16 #include <types.h>
17 
18 #include "chip.h"
19 #include "haswell.h"
20 
21 static const char *northbridge_acpi_name(const struct device *dev)
22 {
23  if (dev->path.type == DEVICE_PATH_DOMAIN)
24  return "PCI0";
25 
26  if (dev->path.type != DEVICE_PATH_PCI || dev->bus->secondary != 0)
27  return NULL;
28 
29  switch (dev->path.pci.devfn) {
30  case PCI_DEVFN(0, 0):
31  return "MCHC";
32  }
33 
34  return NULL;
35 }
36 
37 static struct device_operations pci_domain_ops = {
39  .set_resources = pci_domain_set_resources,
40  .scan_bus = pci_domain_scan_bus,
41  .acpi_name = northbridge_acpi_name,
42  .write_acpi_tables = northbridge_write_acpi_tables,
43 };
44 
45 static int get_bar(struct device *dev, unsigned int index, u32 *base, u32 *len)
46 {
47  u32 bar = pci_read_config32(dev, index);
48 
49  /* If not enabled don't report it */
50  if (!(bar & 0x1))
51  return 0;
52 
53  /* Knock down the enable bit */
54  *base = bar & ~1;
55 
56  return 1;
57 }
58 
59 /*
60  * There are special BARs that actually are programmed in the MCHBAR. These Intel special
61  * features, but they do consume resources that need to be accounted for.
62  */
63 static int get_bar_in_mchbar(struct device *dev, unsigned int index, u32 *base, u32 *len)
64 {
65  u32 bar = mchbar_read32(index);
66 
67  /* If not enabled don't report it */
68  if (!(bar & 0x1))
69  return 0;
70 
71  /* Knock down the enable bit */
72  *base = bar & ~1;
73 
74  return 1;
75 }
76 
78  unsigned int index;
80  int (*get_resource)(struct device *dev, unsigned int index, u32 *base, u32 *size);
81  const char *description;
82 };
83 
85  { MCHBAR, MCH_BASE_SIZE, get_bar, "MCHBAR" },
86  { DMIBAR, DMI_BASE_SIZE, get_bar, "DMIBAR" },
87  { EPBAR, EP_BASE_SIZE, get_bar, "EPBAR" },
88  { GDXCBAR, GDXC_BASE_SIZE, get_bar_in_mchbar, "GDXCBAR" },
89  { EDRAMBAR, EDRAM_BASE_SIZE, get_bar_in_mchbar, "EDRAMBAR" },
90 };
91 
92 /* Add all known fixed MMIO ranges that hang off the host bridge/memory controller device. */
93 static void mc_add_fixed_mmio_resources(struct device *dev)
94 {
95  int i;
96 
97  for (i = 0; i < ARRAY_SIZE(mc_fixed_resources); i++) {
98  u32 base;
99  u32 size;
100  struct resource *resource;
101  unsigned int index;
102 
105  if (!mc_fixed_resources[i].get_resource(dev, index, &base, &size))
106  continue;
107 
111 
112  resource->base = base;
113  resource->size = size;
114  printk(BIOS_DEBUG, "%s: Adding %s @ %x 0x%08lx-0x%08lx.\n",
115  __func__, mc_fixed_resources[i].description, index,
116  (unsigned long)base, (unsigned long)(base + size - 1));
117  }
118 
120 }
121 
122 /*
123  * Host Memory Map:
124  *
125  * +--------------------------+ TOUUD
126  * | |
127  * +--------------------------+ 4GiB
128  * | PCI Address Space |
129  * +--------------------------+ TOLUD (also maps into MC address space)
130  * | iGD |
131  * +--------------------------+ BDSM
132  * | GTT |
133  * +--------------------------+ BGSM
134  * | TSEG |
135  * +--------------------------+ TSEGMB
136  * | DPR |
137  * +--------------------------+ (DPR top - DPR size)
138  * | Usage DRAM |
139  * +--------------------------+ 0
140  *
141  * Some of the base registers above can be equal, making the size of the regions within 0.
142  * This is because the memory controller internally subtracts the base registers from each
143  * other to determine sizes of the regions. In other words, the memory map regions are always
144  * in a fixed order, no matter what sizes they have.
145  */
146 
147 struct map_entry {
148  int reg;
150  int is_limit;
151  const char *description;
152 };
153 
154 static void read_map_entry(struct device *dev, struct map_entry *entry, uint64_t *result)
155 {
156  uint64_t value;
157  uint64_t mask;
158 
159  /* All registers have a 1MiB granularity */
160  mask = ((1ULL << 20) - 1);
161  mask = ~mask;
162 
163  value = 0;
164 
165  if (entry->is_64_bit) {
166  value = pci_read_config32(dev, entry->reg + 4);
167  value <<= 32;
168  }
169 
170  value |= pci_read_config32(dev, entry->reg);
171  value &= mask;
172 
173  if (entry->is_limit)
174  value |= ~mask;
175 
176  *result = value;
177 }
178 
179 #define MAP_ENTRY(reg_, is_64_, is_limit_, desc_) \
180  { \
181  .reg = reg_, \
182  .is_64_bit = is_64_, \
183  .is_limit = is_limit_, \
184  .description = desc_, \
185  }
186 
187 #define MAP_ENTRY_BASE_32(reg_, desc_) MAP_ENTRY(reg_, 0, 0, desc_)
188 #define MAP_ENTRY_BASE_64(reg_, desc_) MAP_ENTRY(reg_, 1, 0, desc_)
189 #define MAP_ENTRY_LIMIT_64(reg_, desc_) MAP_ENTRY(reg_, 1, 1, desc_)
190 
191 enum {
202  /* Must be last */
204 };
205 
206 static struct map_entry memory_map[NUM_MAP_ENTRIES] = {
207  [TOM_REG] = MAP_ENTRY_BASE_64(TOM, "TOM"),
208  [TOUUD_REG] = MAP_ENTRY_BASE_64(TOUUD, "TOUUD"),
209  [MESEG_BASE_REG] = MAP_ENTRY_BASE_64(MESEG_BASE, "MESEG_BASE"),
210  [MESEG_LIMIT_REG] = MAP_ENTRY_LIMIT_64(MESEG_LIMIT, "MESEG_LIMIT"),
211  [REMAP_BASE_REG] = MAP_ENTRY_BASE_64(REMAPBASE, "REMAP_BASE"),
212  [REMAP_LIMIT_REG] = MAP_ENTRY_LIMIT_64(REMAPLIMIT, "REMAP_LIMIT"),
213  [TOLUD_REG] = MAP_ENTRY_BASE_32(TOLUD, "TOLUD"),
214  [BDSM_REG] = MAP_ENTRY_BASE_32(BDSM, "BDSM"),
215  [BGSM_REG] = MAP_ENTRY_BASE_32(BGSM, "BGSM"),
216  [TSEG_REG] = MAP_ENTRY_BASE_32(TSEG, "TSEGMB"),
217 };
218 
219 static void mc_read_map_entries(struct device *dev, uint64_t *values)
220 {
221  int i;
222  for (i = 0; i < NUM_MAP_ENTRIES; i++) {
223  read_map_entry(dev, &memory_map[i], &values[i]);
224  }
225 }
226 
227 static void mc_report_map_entries(struct device *dev, uint64_t *values)
228 {
229  int i;
230  for (i = 0; i < NUM_MAP_ENTRIES; i++) {
231  printk(BIOS_DEBUG, "MC MAP: %s: 0x%llx\n",
232  memory_map[i].description, values[i]);
233  }
234  /* One can validate the BDSM and BGSM against the GGC */
235  printk(BIOS_DEBUG, "MC MAP: GGC: 0x%x\n", pci_read_config16(dev, GGC));
236 }
237 
238 static void mc_add_dram_resources(struct device *dev, int *resource_cnt)
239 {
240  unsigned long base_k, size_k, touud_k, index;
241  struct resource *resource;
242  uint64_t mc_values[NUM_MAP_ENTRIES];
243 
244  /* Read in the MAP registers and report their values */
245  mc_read_map_entries(dev, &mc_values[0]);
246  mc_report_map_entries(dev, &mc_values[0]);
247 
248  /*
249  * DMA Protected Range can be reserved below TSEG for PCODE patch
250  * or TXT/Boot Guard related data. Rather than report a base address,
251  * the DPR register reports the TOP of the region, which is the same
252  * as TSEG base. The region size is reported in MiB in bits 11:4.
253  */
254  const union dpr_register dpr = {
255  .raw = pci_read_config32(dev, DPR),
256  };
257  printk(BIOS_DEBUG, "MC MAP: DPR: 0x%x\n", dpr.raw);
258 
259  /*
260  * These are the host memory ranges that should be added:
261  * - 0 -> 0xa0000: cacheable
262  * - 0xc0000 -> TSEG: cacheable
263  * - TSEG -> BGSM: cacheable with standard MTRRs and reserved
264  * - BGSM -> TOLUD: not cacheable with standard MTRRs and reserved
265  * - 4GiB -> TOUUD: cacheable
266  *
267  * The default SMRAM space is reserved so that the range doesn't have to be saved
268  * during S3 Resume. Once marked reserved the OS cannot use the memory. This is a
269  * bit of an odd place to reserve the region, but the CPU devices don't have
270  * dev_ops->read_resources() called on them.
271  *
272  * The range 0xa0000 -> 0xc0000 does not have any resources associated with it to
273  * handle legacy VGA memory. If this range is not omitted the mtrr code will setup
274  * the area as cacheable, causing VGA access to not work.
275  *
276  * The TSEG region is mapped as cacheable so that one can perform SMRAM relocation
277  * faster. Once the SMRR is enabled, the SMRR takes precedence over the existing
278  * MTRRs covering this region.
279  *
280  * It should be noted that cacheable entry types need to be added in order. The reason
281  * is that the current MTRR code assumes this and falls over itself if it isn't.
282  *
283  * The resource index starts low and should not meet or exceed PCI_BASE_ADDRESS_0.
284  */
285  index = *resource_cnt;
286 
287  /* 0 - > 0xa0000 */
288  base_k = 0;
289  size_k = (0xa0000 >> 10) - base_k;
290  ram_resource(dev, index++, base_k, size_k);
291 
292  /* 0xc0000 -> TSEG - DPR */
293  base_k = 0xc0000 >> 10;
294  size_k = (unsigned long)(mc_values[TSEG_REG] >> 10) - base_k;
295  size_k -= dpr.size * MiB / KiB;
296  ram_resource(dev, index++, base_k, size_k);
297 
298  /* TSEG - DPR -> BGSM */
299  resource = new_resource(dev, index++);
300  resource->base = mc_values[TSEG_REG] - dpr.size * MiB;
301  resource->size = mc_values[BGSM_REG] - resource->base;
304 
305  /* BGSM -> TOLUD. If the IGD is disabled, BGSM can equal TOLUD. */
306  if (mc_values[BGSM_REG] != mc_values[TOLUD_REG]) {
307  resource = new_resource(dev, index++);
308  resource->base = mc_values[BGSM_REG];
309  resource->size = mc_values[TOLUD_REG] - resource->base;
312  }
313 
314  /* 4GiB -> TOUUD */
315  base_k = 4096 * 1024; /* 4GiB */
316  touud_k = mc_values[TOUUD_REG] >> 10;
317  size_k = touud_k - base_k;
318  if (touud_k > base_k)
319  ram_resource(dev, index++, base_k, size_k);
320 
321  /* Reserve everything between A segment and 1MB:
322  *
323  * 0xa0000 - 0xbffff: Legacy VGA
324  * 0xc0000 - 0xfffff: RAM
325  */
326  mmio_resource(dev, index++, (0xa0000 >> 10), (0xc0000 - 0xa0000) >> 10);
327  reserved_ram_resource(dev, index++, (0xc0000 >> 10), (0x100000 - 0xc0000) >> 10);
328 
329  *resource_cnt = index;
330 }
331 
332 static void mc_read_resources(struct device *dev)
333 {
334  int index = 0;
335  const bool vtd_capable = !(pci_read_config32(dev, CAPID0_A) & VTD_DISABLE);
336 
337  /* Read standard PCI resources */
339 
340  /* Add all fixed MMIO resources */
342 
343  /* Add VT-d MMIO resources, if capable */
344  if (vtd_capable) {
347  }
348 
349  /* Calculate and add DRAM resources */
350  mc_add_dram_resources(dev, &index);
351 }
352 
353 /*
354  * The Mini-HD audio device is disabled whenever the IGD is. This is because it provides
355  * audio over the integrated graphics port(s), which requires the IGD to be functional.
356  */
357 static void disable_devices(void)
358 {
359  static const struct {
360  const unsigned int devfn;
361  const u32 mask;
362  const char *const name;
363  } nb_devs[] = {
364  { PCI_DEVFN(1, 2), DEVEN_D1F2EN, "PEG12" },
365  { PCI_DEVFN(1, 1), DEVEN_D1F1EN, "PEG11" },
366  { PCI_DEVFN(1, 0), DEVEN_D1F0EN, "PEG10" },
367  { PCI_DEVFN(2, 0), DEVEN_D2EN | DEVEN_D3EN, "IGD" },
368  { PCI_DEVFN(3, 0), DEVEN_D3EN, "Mini-HD audio" },
369  { PCI_DEVFN(4, 0), DEVEN_D4EN, "\"device 4\"" },
370  { PCI_DEVFN(7, 0), DEVEN_D7EN, "\"device 7\"" },
371  };
372 
373  struct device *host_dev = pcidev_on_root(0, 0);
374  u32 deven;
375  size_t i;
376 
377  if (!host_dev)
378  return;
379 
380  deven = pci_read_config32(host_dev, DEVEN);
381 
382  for (i = 0; i < ARRAY_SIZE(nb_devs); i++) {
383  struct device *dev = pcidev_path_on_root(nb_devs[i].devfn);
384  if (!dev || !dev->enabled) {
385  printk(BIOS_DEBUG, "Disabling %s.\n", nb_devs[i].name);
386  deven &= ~nb_devs[i].mask;
387  }
388  }
389 
390  pci_write_config32(host_dev, DEVEN, deven);
391 }
392 
393 static void init_egress(void)
394 {
395  /* VC0: Enable, ID0, TC0 */
396  epbar_write32(EPVC0RCTL, 1 << 31 | 0 << 24 | 1 << 0);
397 
398  /* No Low Priority Extended VCs, one Extended VC */
399  epbar_write32(EPPVCCAP1, 0 << 4 | 1 << 0);
400 
401  /* VC1: Enable, ID1, TC1 */
402  epbar_write32(EPVC1RCTL, 1 << 31 | 1 << 24 | 1 << 1);
403 
404  /* Poll the VC1 Negotiation Pending bit */
405  while ((epbar_read16(EPVC1RSTS) & (1 << 1)) != 0)
406  ;
407 }
408 
409 static void northbridge_dmi_init(void)
410 {
411  const bool is_haswell_h = !CONFIG(INTEL_LYNXPOINT_LP);
412 
413  /* Steps prior to DMI ASPM */
414  if (is_haswell_h) {
415  /* Configure DMI De-Emphasis */
416  dmibar_setbits16(DMILCTL2, 1 << 6); /* 0b: -6.0 dB, 1b: -3.5 dB */
417 
418  dmibar_setbits32(DMIL0SLAT, 1 << 31);
419  dmibar_setbits32(DMILLTC, 1 << 29);
420 
421  dmibar_clrsetbits32(DMI_AFE_PM_TMR, 0x1f, 0x13);
422  }
423 
424  /* Clear error status bits */
425  dmibar_write32(DMIUESTS, 0xffffffff);
426  dmibar_write32(DMICESTS, 0xffffffff);
427 
428  if (is_haswell_h) {
429  /* Enable ASPM L0s and L1 on SA link, should happen before PCH link */
430  dmibar_setbits16(DMILCTL, 1 << 1 | 1 << 0);
431  }
432 }
433 
434 static void northbridge_topology_init(void)
435 {
436  const u32 eple_a[3] = { EPLE2A, EPLE3A, EPLE4A };
437  const u32 eple_d[3] = { EPLE2D, EPLE3D, EPLE4D };
438 
439  /* Set the CID1 Egress Port 0 Root Topology */
440  epbar_clrsetbits32(EPESD, 0xff << 16, 1 << 16);
441 
442  epbar_clrsetbits32(EPLE1D, 0xff << 16, 1 | 1 << 16);
443  epbar_write32(EPLE1A, CONFIG_FIXED_DMIBAR_MMIO_BASE);
444  epbar_write32(EPLE1A + 4, 0);
445 
446  for (unsigned int i = 0; i <= 2; i++) {
447  const struct device *const dev = pcidev_on_root(1, i);
448 
449  if (!dev || !dev->enabled)
450  continue;
451 
452  epbar_write32(eple_a[i], (u32)PCI_DEV(0, 1, i));
453  epbar_write32(eple_a[i] + 4, 0);
454 
455  epbar_clrsetbits32(eple_d[i], 0xff << 16, 1 | 1 << 16);
456 
457  pci_update_config32(dev, PEG_ESD, ~(0xff << 16), (1 << 16));
458  pci_write_config32(dev, PEG_LE1A, CONFIG_FIXED_EPBAR_MMIO_BASE);
459  pci_write_config32(dev, PEG_LE1A + 4, 0);
460  pci_update_config32(dev, PEG_LE1D, ~(0xff << 16), (1 << 16) | 1);
461 
462  /* Read and write to lock register */
463  pci_or_config32(dev, PEG_DCAP2, 0);
464  }
465 
466  /* Set the CID1 DMI Port Root Topology */
467  dmibar_clrsetbits32(DMIESD, 0xff << 16, 1 << 16);
468 
469  dmibar_clrsetbits32(DMILE1D, 0xffff << 16, 1 | 2 << 16);
470  dmibar_write32(DMILE1A, CONFIG_FIXED_RCBA_MMIO_BASE);
471  dmibar_write32(DMILE1A + 4, 0);
472 
473  dmibar_write32(DMILE2A, CONFIG_FIXED_EPBAR_MMIO_BASE);
474  dmibar_write32(DMILE2A + 4, 0);
475  dmibar_clrsetbits32(DMILE2D, 0xff << 16, 1 | 1 << 16);
476 
477  /* Program RO and Write-Once Registers */
480 }
481 
482 static void northbridge_init(struct device *dev)
483 {
484  init_egress();
487 
488  /* Enable Power Aware Interrupt Routing. */
489  mchbar_clrsetbits8(INTRDIRCTL, 0x7, 0x4); /* Clear 2:0, set Fixed Priority */
490 
491  disable_devices();
492 
493  /*
494  * Set bits 0 + 1 of BIOS_RESET_CPL to indicate to the CPU
495  * that BIOS has initialized memory and power management.
496  */
498  printk(BIOS_DEBUG, "Set BIOS_RESET_CPL\n");
499 
500  /* Configure turbo power limits 1ms after reset complete bit. */
501  mdelay(1);
502  set_power_limits(28);
503 }
504 
505 static void northbridge_final(struct device *dev)
506 {
507  pci_or_config16(dev, GGC, 1 << 0);
508  pci_or_config32(dev, DPR, 1 << 0);
509  pci_or_config32(dev, MESEG_LIMIT, 1 << 10);
510  pci_or_config32(dev, REMAPBASE, 1 << 0);
511  pci_or_config32(dev, REMAPLIMIT, 1 << 0);
512  pci_or_config32(dev, TOM, 1 << 0);
513  pci_or_config32(dev, TOUUD, 1 << 0);
514  pci_or_config32(dev, BDSM, 1 << 0);
515  pci_or_config32(dev, BGSM, 1 << 0);
516  pci_or_config32(dev, TSEG, 1 << 0);
517  pci_or_config32(dev, TOLUD, 1 << 0);
518 
519  /* Memory Controller Lockdown */
520  mchbar_setbits32(MC_LOCK, 0x8f);
521 
522  mchbar_setbits32(MMIO_PAVP_MSG, 1 << 0); /* PAVP */
523  mchbar_setbits32(PCU_DDR_PTM_CTL, 1 << 5); /* DDR PTM */
524  mchbar_setbits32(DMIVCLIM, 1 << 31);
525  mchbar_setbits32(CRDTLCK, 1 << 0);
526  mchbar_setbits32(MCARBLCK, 1 << 0);
527  mchbar_setbits32(REQLIM, 1 << 31);
528  mchbar_setbits32(UMAGFXCTL, 1 << 0); /* UMA GFX */
529  mchbar_setbits32(VTDTRKLCK, 1 << 0); /* VTDTRK */
530 
531  /* Read+write the following */
535 }
536 
537 static struct device_operations mc_ops = {
539  .set_resources = pci_dev_set_resources,
540  .enable_resources = pci_dev_enable_resources,
541  .init = northbridge_init,
542  .final = northbridge_final,
543  .acpi_fill_ssdt = generate_cpu_entries,
544  .ops_pci = &pci_dev_ops_pci,
545 };
546 
547 static const unsigned short mc_pci_device_ids[] = {
548  0x0c00, /* Desktop */
549  0x0c04, /* Mobile */
550  0x0a04, /* ULT */
551  0x0c08, /* Server */
552  0x0d00, /* Crystal Well Desktop */
553  0x0d04, /* Crystal Well Mobile */
554  0x0d08, /* Crystal Well Server (by extrapolation) */
555  0
556 };
557 
558 static const struct pci_driver mc_driver_hsw __pci_driver = {
559  .ops = &mc_ops,
560  .vendor = PCI_VID_INTEL,
561  .devices = mc_pci_device_ids,
562 };
563 
564 static struct device_operations cpu_bus_ops = {
566  .set_resources = noop_set_resources,
567  .init = mp_cpu_bus_init,
568 };
569 
570 static void enable_dev(struct device *dev)
571 {
572  /* Set the operations if it is a special bus type. */
573  if (dev->path.type == DEVICE_PATH_DOMAIN) {
574  dev->ops = &pci_domain_ops;
575  } else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER) {
576  dev->ops = &cpu_bus_ops;
577  }
578 }
579 
581  CHIP_NAME("Intel Haswell integrated Northbridge")
582  .enable_dev = enable_dev,
583 };
pte_t value
Definition: mmu.c:91
const char * name
Definition: mmu.c:92
#define ARRAY_SIZE(a)
Definition: helpers.h:12
#define MiB
Definition: helpers.h:76
#define KiB
Definition: helpers.h:75
#define printk(level,...)
Definition: stdlib.h:16
void generate_cpu_entries(const struct device *device)
Definition: acpi.c:334
void set_power_limits(u8 power_limit_1_time)
Definition: haswell_init.c:313
void mdelay(unsigned int msecs)
Definition: delay.c:2
DEVTREE_CONST struct device * pcidev_path_on_root(pci_devfn_t devfn)
Definition: device_const.c:255
DEVTREE_CONST struct device * pcidev_on_root(uint8_t dev, uint8_t fn)
Definition: device_const.c:260
struct resource * new_resource(struct device *dev, unsigned int index)
See if a resource structure already exists for a given index and if not allocate one.
Definition: device_util.c:346
void mmconf_resource(struct device *dev, unsigned long index)
Definition: device_util.c:857
@ CONFIG
Definition: dsi_common.h:201
#define REMAPLIMIT
Definition: e7505.h:36
#define REMAPBASE
Definition: e7505.h:35
#define mchbar_setbits32(addr, set)
Definition: fixed_bars.h:58
static __always_inline void mchbar_clrsetbits8(uintptr_t offset, uint8_t clear, uint8_t set)
Definition: fixed_bars.h:41
static __always_inline void epbar_clrsetbits32(uintptr_t offset, uint32_t clear, uint32_t set)
Definition: fixed_bars.h:161
static __always_inline void dmibar_write32(const uintptr_t offset, const uint32_t value)
Definition: fixed_bars.h:91
#define mchbar_setbits8(addr, set)
Definition: fixed_bars.h:56
#define dmibar_setbits32(addr, set)
Definition: fixed_bars.h:113
static __always_inline uint32_t mchbar_read32(const uintptr_t offset)
Definition: fixed_bars.h:21
static __always_inline uint16_t epbar_read16(const uintptr_t offset)
Definition: fixed_bars.h:126
#define dmibar_setbits16(addr, set)
Definition: fixed_bars.h:112
static __always_inline void dmibar_clrsetbits32(uintptr_t offset, uint32_t clear, uint32_t set)
Definition: fixed_bars.h:106
static __always_inline void epbar_write32(const uintptr_t offset, const uint32_t value)
Definition: fixed_bars.h:146
#define EPVC0RCTL
Definition: gm45.h:375
#define EPLE1A
Definition: gm45.h:390
#define EPPVCCAP1
Definition: gm45.h:371
#define DMIESD
Definition: gm45.h:356
#define DMIPVCCAP1
Definition: gm45.h:344
#define DMILE1D
Definition: gm45.h:358
#define EPVC1RCTL
Definition: gm45.h:379
#define DMILCTL
Definition: gm45.h:364
#define DMILE2D
Definition: gm45.h:360
#define EPESD
Definition: gm45.h:387
#define DMILCAP
Definition: gm45.h:363
#define DMILE2A
Definition: gm45.h:361
#define EPLE2A
Definition: gm45.h:392
#define DMILE1A
Definition: gm45.h:359
#define EPLE2D
Definition: gm45.h:391
#define EPLE1D
Definition: gm45.h:389
#define EPVC1RSTS
Definition: gm45.h:380
#define DMIUESTS
Definition: dmibar.h:46
#define DMICESTS
Definition: dmibar.h:47
#define DMIL0SLAT
Definition: dmibar.h:51
#define DMILCTL2
Definition: dmibar.h:43
#define DMILLTC
Definition: dmibar.h:52
#define DMI_AFE_PM_TMR
Definition: dmibar.h:54
#define EPLE3A
Definition: epbar.h:24
#define EPLE4D
Definition: epbar.h:25
#define EPLE3D
Definition: epbar.h:23
#define EPLE4A
Definition: epbar.h:26
#define GGC
Definition: host_bridge.h:9
#define MESEG_LIMIT
Definition: host_bridge.h:36
#define DEVEN_D2EN
Definition: host_bridge.h:20
#define DEVEN_D1F1EN
Definition: host_bridge.h:22
#define DEVEN_D1F0EN
Definition: host_bridge.h:21
#define DEVEN_D4EN
Definition: host_bridge.h:18
#define CAPID0_A
Definition: host_bridge.h:65
#define MCHBAR
Definition: host_bridge.h:7
#define TOLUD
Definition: host_bridge.h:61
#define MESEG_BASE
Definition: host_bridge.h:35
#define PCIEXBAR
Definition: host_bridge.h:32
#define TOUUD
Definition: host_bridge.h:57
#define DEVEN_D1F2EN
Definition: host_bridge.h:23
#define VTD_DISABLE
Definition: host_bridge.h:67
#define TSEG
Definition: host_bridge.h:60
#define BDSM
Definition: host_bridge.h:58
#define DMIBAR
Definition: host_bridge.h:33
#define EPBAR
Definition: host_bridge.h:6
#define DEVEN
Definition: host_bridge.h:16
#define DEVEN_D7EN
Definition: host_bridge.h:17
#define TOM
Definition: host_bridge.h:56
#define DPR
Definition: host_bridge.h:27
#define DEVEN_D3EN
Definition: host_bridge.h:19
#define BGSM
Definition: host_bridge.h:59
#define VDMBDFBARPAVP
Definition: mchbar.h:70
#define EDRAMBAR
Definition: mchbar.h:19
#define VDMBDFBARKVM
Definition: mchbar.h:69
#define MCARBLCK
Definition: mchbar.h:75
#define REQLIM
Definition: mchbar.h:72
#define INTRDIRCTL
Definition: mchbar.h:21
#define UMAGFXCTL
Definition: mchbar.h:68
#define HDAUDRID
Definition: mchbar.h:67
#define VTDTRKLCK
Definition: mchbar.h:71
#define DMIVCLIM
Definition: mchbar.h:73
#define GDXCBAR
Definition: mchbar.h:22
#define MMIO_PAVP_MSG
Definition: mchbar.h:25
#define MC_LOCK
Definition: mchbar.h:16
#define PCU_DDR_PTM_CTL
Definition: mchbar.h:27
#define CRDTLCK
Definition: mchbar.h:74
#define BIOS_RESET_CPL
Definition: mchbar.h:62
#define CHIP_NAME(X)
Definition: device.h:32
static void noop_read_resources(struct device *dev)
Standard device operations function pointers shims.
Definition: device.h:73
static void noop_set_resources(struct device *dev)
Definition: device.h:74
static void mp_cpu_bus_init(struct device *dev)
Definition: device.h:240
#define ram_resource(dev, idx, basek, sizek)
Definition: device.h:321
#define mmio_resource(dev, idx, basek, sizek)
Definition: device.h:334
#define reserved_ram_resource(dev, idx, basek, sizek)
Definition: device.h:324
static __always_inline void pci_or_config32(const struct device *dev, u16 reg, u32 ormask)
Definition: pci_ops.h:191
static __always_inline void pci_write_config32(const struct device *dev, u16 reg, u32 val)
Definition: pci_ops.h:76
static __always_inline void pci_update_config32(const struct device *dev, u16 reg, u32 mask, u32 or)
Definition: pci_ops.h:120
static __always_inline void pci_or_config16(const struct device *dev, u16 reg, u16 ormask)
Definition: pci_ops.h:180
static __always_inline u16 pci_read_config16(const struct device *dev, u16 reg)
Definition: pci_ops.h:52
static __always_inline u32 pci_read_config32(const struct device *dev, u16 reg)
Definition: pci_ops.h:58
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
Definition: loglevel.h:128
unsigned long northbridge_write_acpi_tables(struct device *device, unsigned long start)
result
Definition: mrc_cache.c:35
#define GFXVT_BASE_ADDRESS
Definition: memmap.h:18
#define DMI_BASE_SIZE
Definition: memmap.h:8
#define EP_BASE_SIZE
Definition: memmap.h:10
#define GDXC_BASE_SIZE
Definition: memmap.h:16
#define GFXVT_BASE_SIZE
Definition: memmap.h:19
#define VTVC0_BASE_ADDRESS
Definition: memmap.h:21
#define MCH_BASE_SIZE
Definition: memmap.h:6
#define VTVC0_BASE_SIZE
Definition: memmap.h:22
#define EDRAM_BASE_SIZE
Definition: memmap.h:13
static struct map_entry memory_map[NUM_MAP_ENTRIES]
Definition: northbridge.c:206
static struct device_operations cpu_bus_ops
Definition: northbridge.c:564
static int get_bar_in_mchbar(struct device *dev, unsigned int index, u32 *base, u32 *len)
Definition: northbridge.c:63
static void northbridge_topology_init(void)
Definition: northbridge.c:434
#define MAP_ENTRY_LIMIT_64(reg_, desc_)
Definition: northbridge.c:189
static struct device_operations pci_domain_ops
Definition: northbridge.c:37
static struct device_operations mc_ops
Definition: northbridge.c:537
static void mc_read_resources(struct device *dev)
Definition: northbridge.c:332
static void enable_dev(struct device *dev)
Definition: northbridge.c:570
static void mc_report_map_entries(struct device *dev, uint64_t *values)
Definition: northbridge.c:227
static void mc_add_fixed_mmio_resources(struct device *dev)
Definition: northbridge.c:93
#define MAP_ENTRY_BASE_64(reg_, desc_)
Definition: northbridge.c:188
static void disable_devices(void)
Definition: northbridge.c:357
static void mc_read_map_entries(struct device *dev, uint64_t *values)
Definition: northbridge.c:219
static void northbridge_dmi_init(void)
Definition: northbridge.c:409
#define MAP_ENTRY_BASE_32(reg_, desc_)
Definition: northbridge.c:187
static void init_egress(void)
Definition: northbridge.c:393
static void northbridge_final(struct device *dev)
Definition: northbridge.c:505
static const struct pci_driver mc_driver_hsw __pci_driver
Definition: northbridge.c:558
static const unsigned short mc_pci_device_ids[]
Definition: northbridge.c:547
static void read_map_entry(struct device *dev, struct map_entry *entry, uint64_t *result)
Definition: northbridge.c:154
@ TOM_REG
Definition: northbridge.c:192
@ TSEG_REG
Definition: northbridge.c:201
@ BDSM_REG
Definition: northbridge.c:200
@ BGSM_REG
Definition: northbridge.c:199
@ MESEG_LIMIT_REG
Definition: northbridge.c:195
@ TOUUD_REG
Definition: northbridge.c:193
@ NUM_MAP_ENTRIES
Definition: northbridge.c:203
@ MESEG_BASE_REG
Definition: northbridge.c:194
@ REMAP_BASE_REG
Definition: northbridge.c:196
@ TOLUD_REG
Definition: northbridge.c:198
@ REMAP_LIMIT_REG
Definition: northbridge.c:197
struct fixed_mmio_descriptor mc_fixed_resources[]
Definition: northbridge.c:84
static int get_bar(struct device *dev, unsigned int index, u32 *base, u32 *len)
Definition: northbridge.c:45
static const char * northbridge_acpi_name(const struct device *dev)
Definition: northbridge.c:21
static void northbridge_init(struct device *dev)
Definition: northbridge.c:482
struct chip_operations northbridge_intel_haswell_ops
Definition: northbridge.c:580
static void mc_add_dram_resources(struct device *dev, int *resource_cnt)
Definition: northbridge.c:238
@ DEVICE_PATH_PCI
Definition: path.h:9
@ DEVICE_PATH_CPU_CLUSTER
Definition: path.h:14
@ DEVICE_PATH_DOMAIN
Definition: path.h:13
#define PCI_DEVFN(slot, func)
Definition: pci_def.h:548
void pci_domain_read_resources(struct device *dev)
Definition: pci_device.c:547
void pci_dev_enable_resources(struct device *dev)
Definition: pci_device.c:721
void pci_domain_set_resources(struct device *dev)
Definition: pci_device.c:564
void pci_dev_read_resources(struct device *dev)
Definition: pci_device.c:534
struct pci_operations pci_dev_ops_pci
Default device operation for PCI devices.
Definition: pci_device.c:911
void pci_dev_set_resources(struct device *dev)
Definition: pci_device.c:691
void pci_domain_scan_bus(struct device *dev)
Scan a PCI domain.
Definition: pci_device.c:1610
#define PCI_VID_INTEL
Definition: pci_ids.h:2157
#define PCI_DEV(SEGBUS, DEV, FN)
Definition: pci_type.h:14
#define PEG_DCAP2
Definition: pcie_graphics.h:16
#define PEG_ESD
Definition: pcie_graphics.h:22
#define PEG_LE1D
Definition: pcie_graphics.h:23
#define PEG_LE1A
Definition: pcie_graphics.h:24
#define IORESOURCE_RESERVE
Definition: resource.h:30
#define IORESOURCE_MEM
Definition: resource.h:10
#define IORESOURCE_CACHEABLE
Definition: resource.h:19
#define IORESOURCE_STORED
Definition: resource.h:32
#define IORESOURCE_ASSIGNED
Definition: resource.h:34
#define IORESOURCE_FIXED
Definition: resource.h:36
uintptr_t base
Definition: uart.c:17
static const int mask[4]
Definition: gpio.c:308
#define NULL
Definition: stddef.h:19
uint32_t u32
Definition: stdint.h:51
unsigned long long uint64_t
Definition: stdint.h:17
uint16_t secondary
Definition: device.h:84
void(* read_resources)(struct device *dev)
Definition: device.h:39
struct pci_path pci
Definition: path.h:116
enum device_path_type type
Definition: path.h:114
Definition: device.h:107
struct device_path path
Definition: device.h:115
struct device_operations * ops
Definition: device.h:143
DEVTREE_CONST struct bus * bus
Definition: device.h:108
unsigned int enabled
Definition: device.h:122
const char * description
Definition: northbridge.c:81
int(* get_resource)(struct device *dev, unsigned int index, u32 *base, u32 *size)
Definition: northbridge.c:80
unsigned int index
Definition: northbridge.c:78
Definition: northbridge.c:147
int is_64_bit
Definition: northbridge.c:149
const char * description
Definition: northbridge.c:151
int reg
Definition: northbridge.c:148
int is_limit
Definition: northbridge.c:150
unsigned int devfn
Definition: path.h:54
unsigned long flags
Definition: resource.h:49
resource_t base
Definition: resource.h:45
unsigned long index
Definition: resource.h:50
resource_t size
Definition: resource.h:46
uint32_t raw
Definition: txt_register.h:174
uint32_t size
Definition: txt_register.h:170