blob: f320ee32d5a139a522c1b26f75e1076c9606f563 [file] [log] [blame]
Alex Nixonb5401a92010-03-18 16:31:34 -04001#ifndef _ASM_X86_XEN_PCI_H
2#define _ASM_X86_XEN_PCI_H
3
4#if defined(CONFIG_PCI_XEN)
5extern int __init pci_xen_init(void);
Stefano Stabellini3942b742010-06-24 17:50:18 +01006extern int __init pci_xen_hvm_init(void);
Alex Nixonb5401a92010-03-18 16:31:34 -04007#define pci_xen 1
8#else
9#define pci_xen 0
10#define pci_xen_init (0)
Stefano Stabellini3942b742010-06-24 17:50:18 +010011static inline int pci_xen_hvm_init(void)
12{
13 return -1;
14}
Alex Nixonb5401a92010-03-18 16:31:34 -040015#endif
Jeremy Fitzhardinge38aa66f2010-09-02 14:51:39 +010016#if defined(CONFIG_XEN_DOM0)
Konrad Rzeszutek Wilka0ee0562011-06-09 09:49:13 -040017int __init pci_xen_initial_domain(void);
Konrad Rzeszutek Wilkc55fa782010-11-08 14:13:35 -050018int xen_find_device_domain_owner(struct pci_dev *dev);
19int xen_register_device_domain_owner(struct pci_dev *dev, uint16_t domain);
20int xen_unregister_device_domain_owner(struct pci_dev *dev);
Jeremy Fitzhardinge38aa66f2010-09-02 14:51:39 +010021#else
Konrad Rzeszutek Wilka0ee0562011-06-09 09:49:13 -040022static inline int __init pci_xen_initial_domain(void)
Jeremy Fitzhardinge38aa66f2010-09-02 14:51:39 +010023{
Konrad Rzeszutek Wilka0ee0562011-06-09 09:49:13 -040024 return -1;
Jeremy Fitzhardinge38aa66f2010-09-02 14:51:39 +010025}
Konrad Rzeszutek Wilkc55fa782010-11-08 14:13:35 -050026static inline int xen_find_device_domain_owner(struct pci_dev *dev)
27{
28 return -1;
29}
30static inline int xen_register_device_domain_owner(struct pci_dev *dev,
31 uint16_t domain)
32{
33 return -1;
34}
35static inline int xen_unregister_device_domain_owner(struct pci_dev *dev)
36{
37 return -1;
38}
Jeremy Fitzhardinge38aa66f2010-09-02 14:51:39 +010039#endif
Alex Nixonb5401a92010-03-18 16:31:34 -040040
41#if defined(CONFIG_PCI_MSI)
42#if defined(CONFIG_PCI_XEN)
43/* The drivers/pci/xen-pcifront.c sets this structure to
44 * its own functions.
45 */
46struct xen_pci_frontend_ops {
Konrad Rzeszutek Wilkcc0f89c2011-02-17 12:02:23 -050047 int (*enable_msi)(struct pci_dev *dev, int vectors[]);
Alex Nixonb5401a92010-03-18 16:31:34 -040048 void (*disable_msi)(struct pci_dev *dev);
Konrad Rzeszutek Wilkcc0f89c2011-02-17 12:02:23 -050049 int (*enable_msix)(struct pci_dev *dev, int vectors[], int nvec);
Alex Nixonb5401a92010-03-18 16:31:34 -040050 void (*disable_msix)(struct pci_dev *dev);
51};
52
53extern struct xen_pci_frontend_ops *xen_pci_frontend;
54
55static inline int xen_pci_frontend_enable_msi(struct pci_dev *dev,
Konrad Rzeszutek Wilkcc0f89c2011-02-17 12:02:23 -050056 int vectors[])
Alex Nixonb5401a92010-03-18 16:31:34 -040057{
58 if (xen_pci_frontend && xen_pci_frontend->enable_msi)
59 return xen_pci_frontend->enable_msi(dev, vectors);
Konrad Rzeszutek Wilk2cfec6a2016-02-11 16:10:25 -050060 return -ENOSYS;
Alex Nixonb5401a92010-03-18 16:31:34 -040061}
62static inline void xen_pci_frontend_disable_msi(struct pci_dev *dev)
63{
64 if (xen_pci_frontend && xen_pci_frontend->disable_msi)
65 xen_pci_frontend->disable_msi(dev);
66}
67static inline int xen_pci_frontend_enable_msix(struct pci_dev *dev,
Konrad Rzeszutek Wilkcc0f89c2011-02-17 12:02:23 -050068 int vectors[], int nvec)
Alex Nixonb5401a92010-03-18 16:31:34 -040069{
70 if (xen_pci_frontend && xen_pci_frontend->enable_msix)
71 return xen_pci_frontend->enable_msix(dev, vectors, nvec);
Konrad Rzeszutek Wilk2cfec6a2016-02-11 16:10:25 -050072 return -ENOSYS;
Alex Nixonb5401a92010-03-18 16:31:34 -040073}
74static inline void xen_pci_frontend_disable_msix(struct pci_dev *dev)
75{
76 if (xen_pci_frontend && xen_pci_frontend->disable_msix)
77 xen_pci_frontend->disable_msix(dev);
78}
79#endif /* CONFIG_PCI_XEN */
80#endif /* CONFIG_PCI_MSI */
81
82#endif /* _ASM_X86_XEN_PCI_H */