Joerg Roedel | 5cdede2 | 2011-04-04 15:55:18 +0200 | [diff] [blame] | 1 | #ifndef LINUX_PCI_ATS_H |
| 2 | #define LINUX_PCI_ATS_H |
| 3 | |
Joerg Roedel | db3c33c | 2011-09-27 15:57:13 +0200 | [diff] [blame^] | 4 | #include <linux/pci.h> |
| 5 | |
Joerg Roedel | 5cdede2 | 2011-04-04 15:55:18 +0200 | [diff] [blame] | 6 | /* Address Translation Service */ |
| 7 | struct pci_ats { |
| 8 | int pos; /* capability position */ |
| 9 | int stu; /* Smallest Translation Unit */ |
| 10 | int qdep; /* Invalidate Queue Depth */ |
| 11 | int ref_cnt; /* Physical Function reference count */ |
| 12 | unsigned int is_enabled:1; /* Enable bit is set */ |
| 13 | }; |
| 14 | |
| 15 | #ifdef CONFIG_PCI_IOV |
| 16 | |
| 17 | extern int pci_enable_ats(struct pci_dev *dev, int ps); |
| 18 | extern void pci_disable_ats(struct pci_dev *dev); |
| 19 | extern int pci_ats_queue_depth(struct pci_dev *dev); |
| 20 | /** |
| 21 | * pci_ats_enabled - query the ATS status |
| 22 | * @dev: the PCI device |
| 23 | * |
| 24 | * Returns 1 if ATS capability is enabled, or 0 if not. |
| 25 | */ |
| 26 | static inline int pci_ats_enabled(struct pci_dev *dev) |
| 27 | { |
| 28 | return dev->ats && dev->ats->is_enabled; |
| 29 | } |
| 30 | |
| 31 | #else /* CONFIG_PCI_IOV */ |
| 32 | |
| 33 | static inline int pci_enable_ats(struct pci_dev *dev, int ps) |
| 34 | { |
| 35 | return -ENODEV; |
| 36 | } |
| 37 | |
| 38 | static inline void pci_disable_ats(struct pci_dev *dev) |
| 39 | { |
| 40 | } |
| 41 | |
| 42 | static inline int pci_ats_queue_depth(struct pci_dev *dev) |
| 43 | { |
| 44 | return -ENODEV; |
| 45 | } |
| 46 | |
| 47 | static inline int pci_ats_enabled(struct pci_dev *dev) |
| 48 | { |
| 49 | return 0; |
| 50 | } |
| 51 | |
| 52 | #endif /* CONFIG_PCI_IOV */ |
| 53 | |
| 54 | #endif /* LINUX_PCI_ATS_H*/ |