blob: 5422a8eb180898b8483ee6b74ae1051dc18d8ac0 [file] [log] [blame]
Yinghai Lu13f1c2a2005-07-08 02:49:49 +00001/* (c) 2005 Linux Networx GPL see COPYING for details */
2
3#include <console/console.h>
4#include <device/device.h>
5#include <device/pci.h>
6#include <device/pci_ids.h>
7#include <device/pciexp.h>
8
9
10static void pciexp_tune_dev(device_t dev)
11{
12 unsigned cap;
13
14 cap = pci_find_capability(dev, PCI_CAP_ID_PCIE);
15 if (!cap) {
16 /* error... */
17 return;
18 }
19 printk_debug("PCIEXP: tunning %s\n", dev_path(dev));
20#warning "IMPLEMENT PCI EXPRESS TUNING"
21}
22
23unsigned int pciexp_scan_bus(struct bus *bus,
24 unsigned min_devfn, unsigned max_devfn,
25 unsigned int max)
26{
27 device_t child;
28 max = pci_scan_bus(bus, min_devfn, max_devfn, max);
29 for(child = bus->children; child; child = child->sibling) {
30 if ( (child->path.u.pci.devfn < min_devfn) ||
31 (child->path.u.pci.devfn > max_devfn))
32 {
33 continue;
34 }
35 pciexp_tune_dev(child);
36 }
37 return max;
38}
39
40
41unsigned int pciexp_scan_bridge(device_t dev, unsigned int max)
42{
43 return do_pci_scan_bridge(dev, max, pciexp_scan_bus);
44}
45
46/** Default device operations for PCI Express bridges */
47static struct pci_operations pciexp_bus_ops_pci = {
48 .set_subsystem = 0,
49};
50
51struct device_operations default_pciexp_ops_bus = {
52 .read_resources = pci_bus_read_resources,
53 .set_resources = pci_dev_set_resources,
54 .enable_resources = pci_bus_enable_resources,
55 .init = 0,
56 .scan_bus = pciexp_scan_bridge,
57 .enable = 0,
58 .reset_bus = pci_bus_reset,
59 .ops_pci = &pciexp_bus_ops_pci,
60};