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