ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / drivers / pci / pci.h
1 /* Functions internal to the PCI core code */
2
3 extern int pci_hotplug (struct device *dev, char **envp, int num_envp,
4                          char *buffer, int buffer_size);
5 extern void pci_create_sysfs_dev_files(struct pci_dev *pdev);
6 extern int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
7                                   unsigned long size, unsigned long align,
8                                   unsigned long min, unsigned int type_mask,
9                                   void (*alignf)(void *, struct resource *,
10                                                  unsigned long, unsigned long),
11                                   void *alignf_data);
12 /* PCI /proc functions */
13 #ifdef CONFIG_PROC_FS
14 extern int pci_proc_attach_device(struct pci_dev *dev);
15 extern int pci_proc_detach_device(struct pci_dev *dev);
16 extern int pci_proc_attach_bus(struct pci_bus *bus);
17 extern int pci_proc_detach_bus(struct pci_bus *bus);
18 #else
19 static inline int pci_proc_attach_device(struct pci_dev *dev) { return 0; }
20 static inline int pci_proc_detach_device(struct pci_dev *dev) { return 0; }
21 static inline int pci_proc_attach_bus(struct pci_bus *bus) { return 0; }
22 static inline int pci_proc_detach_bus(struct pci_bus *bus) { return 0; }
23 #endif
24
25 /* Functions for PCI Hotplug drivers to use */
26 extern struct pci_bus * pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr);
27 extern unsigned int pci_do_scan_bus(struct pci_bus *bus);
28 extern int pci_remove_device_safe(struct pci_dev *dev);
29 extern unsigned char pci_max_busnr(void);
30 extern unsigned char pci_bus_max_busnr(struct pci_bus *bus);
31 extern int pci_bus_find_capability (struct pci_bus *bus, unsigned int devfn, int cap);
32
33 struct pci_dev_wrapped {
34         struct pci_dev  *dev;
35         void            *data;
36 };
37
38 struct pci_bus_wrapped {
39         struct pci_bus  *bus;
40         void            *data;
41 };
42
43 struct pci_visit {
44         int (* pre_visit_pci_bus)       (struct pci_bus_wrapped *,
45                                          struct pci_dev_wrapped *);
46         int (* post_visit_pci_bus)      (struct pci_bus_wrapped *,
47                                          struct pci_dev_wrapped *);
48
49         int (* pre_visit_pci_dev)       (struct pci_dev_wrapped *,
50                                          struct pci_bus_wrapped *);
51         int (* visit_pci_dev)           (struct pci_dev_wrapped *,
52                                          struct pci_bus_wrapped *);
53         int (* post_visit_pci_dev)      (struct pci_dev_wrapped *,
54                                          struct pci_bus_wrapped *);
55 };
56
57 extern int pci_visit_dev(struct pci_visit *fn,
58                          struct pci_dev_wrapped *wrapped_dev,
59                          struct pci_bus_wrapped *wrapped_parent);
60
61 /* Lock for read/write access to pci device and bus lists */
62 extern spinlock_t pci_bus_lock;
63
64 extern int pciehp_msi_quirk;