Merge to Fedora kernel-2.6.18-1.2224_FC5 patched with stable patch-2.6.18.1-vs2.0...
[linux-2.6.git] / include / xen / pcifront.h
1 /*
2  * PCI Frontend - arch-dependendent declarations
3  *
4  *   Author: Ryan Wilson <hap9@epoch.ncsc.mil>
5  */
6 #ifndef __XEN_ASM_PCIFRONT_H__
7 #define __XEN_ASM_PCIFRONT_H__
8
9 #include <linux/spinlock.h>
10
11 #ifdef __KERNEL__
12
13 #ifndef __ia64__
14
15 struct pcifront_device;
16 struct pci_bus;
17
18 struct pcifront_sd {
19         int domain;
20         struct pcifront_device *pdev;
21 };
22
23 static inline struct pcifront_device *
24 pcifront_get_pdev(struct pcifront_sd *sd)
25 {
26         return sd->pdev;
27 }
28
29 static inline void pcifront_init_sd(struct pcifront_sd *sd, int domain,
30                                     struct pcifront_device *pdev)
31 {
32         sd->domain = domain;
33         sd->pdev = pdev;
34 }
35
36 #if defined(CONFIG_PCI_DOMAINS)
37 static inline int pci_domain_nr(struct pci_bus *bus)
38 {
39         struct pcifront_sd *sd = bus->sysdata;
40         return sd->domain;
41 }
42 static inline int pci_proc_domain(struct pci_bus *bus)
43 {
44         return pci_domain_nr(bus);
45 }
46 #endif /* CONFIG_PCI_DOMAINS */
47
48 #else /* __ia64__ */
49
50 #include <asm/pci.h>
51 #define pcifront_sd pci_controller
52
53 static inline struct pcifront_device *
54 pcifront_get_pdev(struct pcifront_sd *sd)
55 {
56         return (struct pcifront_device *)sd->platform_data;
57 }
58
59 static inline void pcifront_init_sd(struct pcifront_sd *sd, int domain,
60                                     struct pcifront_device *pdev)
61 {
62         sd->segment = domain;
63         sd->acpi_handle = NULL;
64         sd->iommu = NULL;
65         sd->windows = 0;
66         sd->window = NULL;
67         sd->platform_data = pdev;
68 }
69
70 #endif /* __ia64__ */
71
72 extern struct rw_semaphore pci_bus_sem;
73
74 #endif /* __KERNEL__ */
75
76 #endif /* __XEN_ASM_PCIFRONT_H__ */