The interrupt controller lives at I/O 0x4d0/0x4d1.
[coreboot.git] / src / devices / pciexp_device.c
index cf6104ed95ff3d20c4a1eeff1f308c0b9c1c540b..790029ef1ea7602aa8b46a4568dcec482a3fe87b 100644 (file)
@@ -34,19 +34,27 @@ static void pciexp_tune_dev(device_t dev)
                /* error... */
                return;
        }
-       printk_debug("PCIEXP: tunning %s\n", dev_path(dev));
-#warning "IMPLEMENT PCI EXPRESS TUNING"
+#ifdef CONFIG_PCIE_TUNING
+       printk(BIOS_DEBUG, "PCIe: tuning %s\n", dev_path(dev));
+
+       // TODO make this depending on ASPM
+       /* Enable ASPM Role Based Error Reporting */
+       u32 reg32;
+       reg32 = pci_read_config32(dev, cap + PCI_EXP_DEVCAP);
+       reg32 |= PCI_EXP_DEVCAP_RBER;
+       pci_write_config32(dev, cap + PCI_EXP_DEVCAP, reg32);
+#endif
 }
 
-unsigned int pciexp_scan_bus(struct bus *bus, 
-       unsigned min_devfn, unsigned max_devfn, 
+unsigned int pciexp_scan_bus(struct bus *bus,
+       unsigned min_devfn, unsigned max_devfn,
        unsigned int max)
 {
        device_t child;
        max = pci_scan_bus(bus, min_devfn, max_devfn, max);
        for(child = bus->children; child; child = child->sibling) {
-               if (    (child->path.u.pci.devfn < min_devfn) ||
-                       (child->path.u.pci.devfn > max_devfn))
+               if (    (child->path.pci.devfn < min_devfn) ||
+                       (child->path.pci.devfn > max_devfn))
                {
                        continue;
                }