pci.h (1814B)
1/* SPDX-License-Identifier: GPL-2.0 */ 2#ifndef _ASM_X86_XEN_PCI_H 3#define _ASM_X86_XEN_PCI_H 4 5#if defined(CONFIG_PCI_XEN) 6extern int __init pci_xen_init(void); 7extern int __init pci_xen_hvm_init(void); 8#define pci_xen 1 9#else 10#define pci_xen 0 11#define pci_xen_init (0) 12static inline int pci_xen_hvm_init(void) 13{ 14 return -1; 15} 16#endif 17#ifdef CONFIG_XEN_PV_DOM0 18int __init pci_xen_initial_domain(void); 19#else 20static inline int __init pci_xen_initial_domain(void) 21{ 22 return -1; 23} 24#endif 25 26#if defined(CONFIG_PCI_MSI) 27#if defined(CONFIG_PCI_XEN) 28/* The drivers/pci/xen-pcifront.c sets this structure to 29 * its own functions. 30 */ 31struct xen_pci_frontend_ops { 32 int (*enable_msi)(struct pci_dev *dev, int vectors[]); 33 void (*disable_msi)(struct pci_dev *dev); 34 int (*enable_msix)(struct pci_dev *dev, int vectors[], int nvec); 35 void (*disable_msix)(struct pci_dev *dev); 36}; 37 38extern struct xen_pci_frontend_ops *xen_pci_frontend; 39 40static inline int xen_pci_frontend_enable_msi(struct pci_dev *dev, 41 int vectors[]) 42{ 43 if (xen_pci_frontend && xen_pci_frontend->enable_msi) 44 return xen_pci_frontend->enable_msi(dev, vectors); 45 return -ENOSYS; 46} 47static inline void xen_pci_frontend_disable_msi(struct pci_dev *dev) 48{ 49 if (xen_pci_frontend && xen_pci_frontend->disable_msi) 50 xen_pci_frontend->disable_msi(dev); 51} 52static inline int xen_pci_frontend_enable_msix(struct pci_dev *dev, 53 int vectors[], int nvec) 54{ 55 if (xen_pci_frontend && xen_pci_frontend->enable_msix) 56 return xen_pci_frontend->enable_msix(dev, vectors, nvec); 57 return -ENOSYS; 58} 59static inline void xen_pci_frontend_disable_msix(struct pci_dev *dev) 60{ 61 if (xen_pci_frontend && xen_pci_frontend->disable_msix) 62 xen_pci_frontend->disable_msix(dev); 63} 64#endif /* CONFIG_PCI_XEN */ 65#endif /* CONFIG_PCI_MSI */ 66 67#endif /* _ASM_X86_XEN_PCI_H */