printk_foo -> printk(BIOS_FOO, ...)
[coreboot.git] / src / devices / pciexp_device.c
index 5422a8eb180898b8483ee6b74ae1051dc18d8ac0..a14f00426fa98f8ca46f416ce506610aa9b8bb9f 100644 (file)
@@ -1,4 +1,22 @@
-/* (c) 2005 Linux Networx GPL see COPYING for details */
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2005 Linux Networx
+ * (Written by Eric Biederman <ebiederman@lnxi.com> for Linux Networx)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ */
 
 #include <console/console.h>
 #include <device/device.h>
@@ -16,8 +34,16 @@ 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, 
@@ -27,8 +53,8 @@ unsigned int pciexp_scan_bus(struct bus *bus,
        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;
                }