2 * PCI defines and function prototypes
3 * Copyright 1994, Drew Eckhardt
4 * Copyright 1997--1999 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
6 * For more information, please consult the following manuals (look at
7 * http://www.pcisig.com/ for how to get them):
9 * PCI BIOS Specification
10 * PCI Local Bus Specification
11 * PCI to PCI Bridge Specification
12 * PCI System Design Guide
18 #include <device/pci_def.h>
19 #include <device/resource.h>
20 #include <device/device.h>
21 #include <device/pci_ops.h>
24 /* Common pci operations without a standard interface */
25 struct pci_operations {
26 void (*set_subsystem)(device_t dev, unsigned vendor, unsigned device);
30 struct device_operations *ops;
31 unsigned short vendor;
32 unsigned short device;
35 #define __pci_driver __attribute__ ((used,__section__(".rodata.pci_driver")))
36 /** start of compile time generated pci driver array */
37 extern struct pci_driver pci_drivers[];
38 /** end of compile time generated pci driver array */
39 extern struct pci_driver epci_drivers[];
42 struct device_operations default_pci_ops_dev;
43 struct device_operations default_pci_ops_bus;
45 void pci_dev_read_resources(device_t dev);
46 void pci_bus_read_resources(device_t dev);
47 void pci_dev_set_resources(device_t dev);
48 void pci_dev_enable_resources(device_t dev);
49 void pci_bus_enable_resources(device_t dev);
50 unsigned int pci_scan_bridge(device_t bus, unsigned int max);
51 unsigned int pci_scan_bus(struct bus *bus, unsigned min_devfn, unsigned max_devfn, unsigned int max);
52 struct resource *pci_get_resource(struct device *dev, unsigned long index);
54 #define PCI_IO_BRIDGE_ALIGN 4096
55 #define PCI_MEM_BRIDGE_ALIGN (1024*1024)
57 static inline struct pci_operations *ops_pci(device_t dev)
59 struct pci_operations *pops;
61 if (dev && dev->ops) {
62 pops = dev->ops->ops_pci;