]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
b5401a96 AN |
2 | #ifndef _ASM_X86_XEN_PCI_H |
3 | #define _ASM_X86_XEN_PCI_H | |
4 | ||
5 | #if defined(CONFIG_PCI_XEN) | |
6 | extern int __init pci_xen_init(void); | |
3942b740 | 7 | extern int __init pci_xen_hvm_init(void); |
b5401a96 AN |
8 | #define pci_xen 1 |
9 | #else | |
10 | #define pci_xen 0 | |
11 | #define pci_xen_init (0) | |
3942b740 SS |
12 | static inline int pci_xen_hvm_init(void) |
13 | { | |
14 | return -1; | |
15 | } | |
b5401a96 | 16 | #endif |
38aa66fc | 17 | #if defined(CONFIG_XEN_DOM0) |
a0ee0567 | 18 | int __init pci_xen_initial_domain(void); |
c55fa78b KRW |
19 | int xen_find_device_domain_owner(struct pci_dev *dev); |
20 | int xen_register_device_domain_owner(struct pci_dev *dev, uint16_t domain); | |
21 | int xen_unregister_device_domain_owner(struct pci_dev *dev); | |
38aa66fc | 22 | #else |
a0ee0567 | 23 | static inline int __init pci_xen_initial_domain(void) |
38aa66fc | 24 | { |
a0ee0567 | 25 | return -1; |
38aa66fc | 26 | } |
c55fa78b KRW |
27 | static inline int xen_find_device_domain_owner(struct pci_dev *dev) |
28 | { | |
29 | return -1; | |
30 | } | |
31 | static inline int xen_register_device_domain_owner(struct pci_dev *dev, | |
32 | uint16_t domain) | |
33 | { | |
34 | return -1; | |
35 | } | |
36 | static inline int xen_unregister_device_domain_owner(struct pci_dev *dev) | |
37 | { | |
38 | return -1; | |
39 | } | |
38aa66fc | 40 | #endif |
b5401a96 AN |
41 | |
42 | #if defined(CONFIG_PCI_MSI) | |
43 | #if defined(CONFIG_PCI_XEN) | |
44 | /* The drivers/pci/xen-pcifront.c sets this structure to | |
45 | * its own functions. | |
46 | */ | |
47 | struct xen_pci_frontend_ops { | |
cc0f89c4 | 48 | int (*enable_msi)(struct pci_dev *dev, int vectors[]); |
b5401a96 | 49 | void (*disable_msi)(struct pci_dev *dev); |
cc0f89c4 | 50 | int (*enable_msix)(struct pci_dev *dev, int vectors[], int nvec); |
b5401a96 AN |
51 | void (*disable_msix)(struct pci_dev *dev); |
52 | }; | |
53 | ||
54 | extern struct xen_pci_frontend_ops *xen_pci_frontend; | |
55 | ||
56 | static inline int xen_pci_frontend_enable_msi(struct pci_dev *dev, | |
cc0f89c4 | 57 | int vectors[]) |
b5401a96 AN |
58 | { |
59 | if (xen_pci_frontend && xen_pci_frontend->enable_msi) | |
60 | return xen_pci_frontend->enable_msi(dev, vectors); | |
2cfec6a2 | 61 | return -ENOSYS; |
b5401a96 AN |
62 | } |
63 | static inline void xen_pci_frontend_disable_msi(struct pci_dev *dev) | |
64 | { | |
65 | if (xen_pci_frontend && xen_pci_frontend->disable_msi) | |
66 | xen_pci_frontend->disable_msi(dev); | |
67 | } | |
68 | static inline int xen_pci_frontend_enable_msix(struct pci_dev *dev, | |
cc0f89c4 | 69 | int vectors[], int nvec) |
b5401a96 AN |
70 | { |
71 | if (xen_pci_frontend && xen_pci_frontend->enable_msix) | |
72 | return xen_pci_frontend->enable_msix(dev, vectors, nvec); | |
2cfec6a2 | 73 | return -ENOSYS; |
b5401a96 AN |
74 | } |
75 | static inline void xen_pci_frontend_disable_msix(struct pci_dev *dev) | |
76 | { | |
77 | if (xen_pci_frontend && xen_pci_frontend->disable_msix) | |
78 | xen_pci_frontend->disable_msix(dev); | |
79 | } | |
80 | #endif /* CONFIG_PCI_XEN */ | |
81 | #endif /* CONFIG_PCI_MSI */ | |
82 | ||
83 | #endif /* _ASM_X86_XEN_PCI_H */ |