diff options
Diffstat (limited to 'arch/x86/include/asm/xen/pci.h')
-rw-r--r-- | arch/x86/include/asm/xen/pci.h | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/arch/x86/include/asm/xen/pci.h b/arch/x86/include/asm/xen/pci.h new file mode 100644 index 000000000000..4fbda9a3f339 --- /dev/null +++ b/arch/x86/include/asm/xen/pci.h | |||
@@ -0,0 +1,81 @@ | |||
1 | #ifndef _ASM_X86_XEN_PCI_H | ||
2 | #define _ASM_X86_XEN_PCI_H | ||
3 | |||
4 | #if defined(CONFIG_PCI_XEN) | ||
5 | extern int __init pci_xen_init(void); | ||
6 | extern int __init pci_xen_hvm_init(void); | ||
7 | #define pci_xen 1 | ||
8 | #else | ||
9 | #define pci_xen 0 | ||
10 | #define pci_xen_init (0) | ||
11 | static inline int pci_xen_hvm_init(void) | ||
12 | { | ||
13 | return -1; | ||
14 | } | ||
15 | #endif | ||
16 | #if defined(CONFIG_XEN_DOM0) | ||
17 | void __init xen_setup_pirqs(void); | ||
18 | int xen_find_device_domain_owner(struct pci_dev *dev); | ||
19 | int xen_register_device_domain_owner(struct pci_dev *dev, uint16_t domain); | ||
20 | int xen_unregister_device_domain_owner(struct pci_dev *dev); | ||
21 | #else | ||
22 | static inline void __init xen_setup_pirqs(void) | ||
23 | { | ||
24 | } | ||
25 | static inline int xen_find_device_domain_owner(struct pci_dev *dev) | ||
26 | { | ||
27 | return -1; | ||
28 | } | ||
29 | static inline int xen_register_device_domain_owner(struct pci_dev *dev, | ||
30 | uint16_t domain) | ||
31 | { | ||
32 | return -1; | ||
33 | } | ||
34 | static inline int xen_unregister_device_domain_owner(struct pci_dev *dev) | ||
35 | { | ||
36 | return -1; | ||
37 | } | ||
38 | #endif | ||
39 | |||
40 | #if defined(CONFIG_PCI_MSI) | ||
41 | #if defined(CONFIG_PCI_XEN) | ||
42 | /* The drivers/pci/xen-pcifront.c sets this structure to | ||
43 | * its own functions. | ||
44 | */ | ||
45 | struct xen_pci_frontend_ops { | ||
46 | int (*enable_msi)(struct pci_dev *dev, int vectors[]); | ||
47 | void (*disable_msi)(struct pci_dev *dev); | ||
48 | int (*enable_msix)(struct pci_dev *dev, int vectors[], int nvec); | ||
49 | void (*disable_msix)(struct pci_dev *dev); | ||
50 | }; | ||
51 | |||
52 | extern struct xen_pci_frontend_ops *xen_pci_frontend; | ||
53 | |||
54 | static inline int xen_pci_frontend_enable_msi(struct pci_dev *dev, | ||
55 | int vectors[]) | ||
56 | { | ||
57 | if (xen_pci_frontend && xen_pci_frontend->enable_msi) | ||
58 | return xen_pci_frontend->enable_msi(dev, vectors); | ||
59 | return -ENODEV; | ||
60 | } | ||
61 | static inline void xen_pci_frontend_disable_msi(struct pci_dev *dev) | ||
62 | { | ||
63 | if (xen_pci_frontend && xen_pci_frontend->disable_msi) | ||
64 | xen_pci_frontend->disable_msi(dev); | ||
65 | } | ||
66 | static inline int xen_pci_frontend_enable_msix(struct pci_dev *dev, | ||
67 | int vectors[], int nvec) | ||
68 | { | ||
69 | if (xen_pci_frontend && xen_pci_frontend->enable_msix) | ||
70 | return xen_pci_frontend->enable_msix(dev, vectors, nvec); | ||
71 | return -ENODEV; | ||
72 | } | ||
73 | static inline void xen_pci_frontend_disable_msix(struct pci_dev *dev) | ||
74 | { | ||
75 | if (xen_pci_frontend && xen_pci_frontend->disable_msix) | ||
76 | xen_pci_frontend->disable_msix(dev); | ||
77 | } | ||
78 | #endif /* CONFIG_PCI_XEN */ | ||
79 | #endif /* CONFIG_PCI_MSI */ | ||
80 | |||
81 | #endif /* _ASM_X86_XEN_PCI_H */ | ||