eric patch
[coreboot.git] / src / devices / agp_device.c
1 /* (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/agp.h>
8
9 static void agp_tune_dev(device_t dev)
10 {
11         unsigned cap;
12         cap = pci_find_capability(dev, PCI_CAP_ID_AGP);
13         if (!cap) {
14                 return;
15         }
16         /* The OS is responsible for AGP tuning so do nothing here */
17 }
18
19 unsigned int agp_scan_bus(struct bus *bus,
20         unsigned min_devfn, unsigned max_devfn, unsigned int max)
21 {
22         device_t child;
23         max = pci_scan_bus(bus, min_devfn, max_devfn, max);
24         for(child = bus->children; child; child = child->sibling) {
25                 if (    (child->path.u.pci.devfn < min_devfn) ||
26                         (child->path.u.pci.devfn > max_devfn))
27                 {
28                         continue;
29                 }
30                 agp_tune_dev(child);
31         }
32         return max;
33 }
34
35 unsigned int agp_scan_bridge(device_t dev, unsigned int max)
36 {
37         return do_pci_scan_bridge(dev, max, agp_scan_bus);
38 }
39
40 /** Default device operations for AGP bridges */
41 static struct pci_operations agp_bus_ops_pci = {
42         .set_subsystem = 0,
43 };
44
45 struct device_operations default_agp_ops_bus = {
46         .read_resources   = pci_bus_read_resources,
47         .set_resources    = pci_dev_set_resources,
48         .enable_resources = pci_bus_enable_resources,
49         .init             = 0,
50         .scan_bus         = agp_scan_bridge,
51         .enable           = 0,
52         .reset_bus        = pci_bus_reset,
53         .ops_pci          = &agp_bus_ops_pci,
54 };