2 * This file is part of the coreboot project.
4 * Copyright (C) 2005 Linux Networx
5 * (Written by Eric Biederman <ebiederman@lnxi.com> for Linux Networx)
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.
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.
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
21 #include <console/console.h>
22 #include <device/device.h>
23 #include <device/pci.h>
24 #include <device/pci_ids.h>
25 #include <device/pciexp.h>
28 static void pciexp_tune_dev(device_t dev)
32 cap = pci_find_capability(dev, PCI_CAP_ID_PCIE);
37 // printk_debug("PCIe: tuning %s\n", dev_path(dev));
38 /* TODO: Implement PCI Express tuning. */
41 unsigned int pciexp_scan_bus(struct bus *bus,
42 unsigned min_devfn, unsigned max_devfn,
46 max = pci_scan_bus(bus, min_devfn, max_devfn, max);
47 for(child = bus->children; child; child = child->sibling) {
48 if ( (child->path.pci.devfn < min_devfn) ||
49 (child->path.pci.devfn > max_devfn))
53 pciexp_tune_dev(child);
59 unsigned int pciexp_scan_bridge(device_t dev, unsigned int max)
61 return do_pci_scan_bridge(dev, max, pciexp_scan_bus);
64 /** Default device operations for PCI Express bridges */
65 static struct pci_operations pciexp_bus_ops_pci = {
69 struct device_operations default_pciexp_ops_bus = {
70 .read_resources = pci_bus_read_resources,
71 .set_resources = pci_dev_set_resources,
72 .enable_resources = pci_bus_enable_resources,
74 .scan_bus = pciexp_scan_bridge,
76 .reset_bus = pci_bus_reset,
77 .ops_pci = &pciexp_bus_ops_pci,