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 | |
Joerg Roedel | 466b3dd | 2011-10-30 16:35:08 +0100 | [diff] [blame] | 15 | #ifdef CONFIG_PCI_ATS |
Joerg Roedel | 5cdede2 | 2011-04-04 15:55:18 +0200 | [diff] [blame] | 16 | |
Bjorn Helgaas | f39d5b7 | 2013-04-12 12:02:59 -0600 | [diff] [blame] | 17 | int pci_enable_ats(struct pci_dev *dev, int ps); |
| 18 | void pci_disable_ats(struct pci_dev *dev); |
| 19 | int pci_ats_queue_depth(struct pci_dev *dev); |
Joerg Roedel | c320b97 | 2011-09-27 15:57:15 +0200 | [diff] [blame] | 20 | |
Joerg Roedel | 5cdede2 | 2011-04-04 15:55:18 +0200 | [diff] [blame] | 21 | /** |
| 22 | * pci_ats_enabled - query the ATS status |
| 23 | * @dev: the PCI device |
| 24 | * |
| 25 | * Returns 1 if ATS capability is enabled, or 0 if not. |
| 26 | */ |
| 27 | static inline int pci_ats_enabled(struct pci_dev *dev) |
| 28 | { |
| 29 | return dev->ats && dev->ats->is_enabled; |
| 30 | } |
| 31 | |
Joerg Roedel | 466b3dd | 2011-10-30 16:35:08 +0100 | [diff] [blame] | 32 | #else /* CONFIG_PCI_ATS */ |
Joerg Roedel | 5cdede2 | 2011-04-04 15:55:18 +0200 | [diff] [blame] | 33 | |
| 34 | static inline int pci_enable_ats(struct pci_dev *dev, int ps) |
| 35 | { |
| 36 | return -ENODEV; |
| 37 | } |
| 38 | |
| 39 | static inline void pci_disable_ats(struct pci_dev *dev) |
| 40 | { |
| 41 | } |
| 42 | |
| 43 | static inline int pci_ats_queue_depth(struct pci_dev *dev) |
| 44 | { |
| 45 | return -ENODEV; |
| 46 | } |
| 47 | |
| 48 | static inline int pci_ats_enabled(struct pci_dev *dev) |
| 49 | { |
| 50 | return 0; |
| 51 | } |
| 52 | |
Joerg Roedel | 466b3dd | 2011-10-30 16:35:08 +0100 | [diff] [blame] | 53 | #endif /* CONFIG_PCI_ATS */ |
Joerg Roedel | 5cdede2 | 2011-04-04 15:55:18 +0200 | [diff] [blame] | 54 | |
Joerg Roedel | c320b97 | 2011-09-27 15:57:15 +0200 | [diff] [blame] | 55 | #ifdef CONFIG_PCI_PRI |
| 56 | |
Bjorn Helgaas | f39d5b7 | 2013-04-12 12:02:59 -0600 | [diff] [blame] | 57 | int pci_enable_pri(struct pci_dev *pdev, u32 reqs); |
| 58 | void pci_disable_pri(struct pci_dev *pdev); |
Bjorn Helgaas | f39d5b7 | 2013-04-12 12:02:59 -0600 | [diff] [blame] | 59 | int pci_reset_pri(struct pci_dev *pdev); |
Joerg Roedel | c320b97 | 2011-09-27 15:57:15 +0200 | [diff] [blame] | 60 | |
| 61 | #else /* CONFIG_PCI_PRI */ |
| 62 | |
| 63 | static inline int pci_enable_pri(struct pci_dev *pdev, u32 reqs) |
| 64 | { |
| 65 | return -ENODEV; |
| 66 | } |
| 67 | |
| 68 | static inline void pci_disable_pri(struct pci_dev *pdev) |
| 69 | { |
| 70 | } |
| 71 | |
Joerg Roedel | c320b97 | 2011-09-27 15:57:15 +0200 | [diff] [blame] | 72 | static inline int pci_reset_pri(struct pci_dev *pdev) |
| 73 | { |
| 74 | return -ENODEV; |
| 75 | } |
| 76 | |
Joerg Roedel | c320b97 | 2011-09-27 15:57:15 +0200 | [diff] [blame] | 77 | #endif /* CONFIG_PCI_PRI */ |
| 78 | |
Joerg Roedel | 086ac11 | 2011-09-27 15:57:16 +0200 | [diff] [blame] | 79 | #ifdef CONFIG_PCI_PASID |
| 80 | |
Bjorn Helgaas | f39d5b7 | 2013-04-12 12:02:59 -0600 | [diff] [blame] | 81 | int pci_enable_pasid(struct pci_dev *pdev, int features); |
| 82 | void pci_disable_pasid(struct pci_dev *pdev); |
| 83 | int pci_pasid_features(struct pci_dev *pdev); |
| 84 | int pci_max_pasids(struct pci_dev *pdev); |
Joerg Roedel | 086ac11 | 2011-09-27 15:57:16 +0200 | [diff] [blame] | 85 | |
| 86 | #else /* CONFIG_PCI_PASID */ |
| 87 | |
| 88 | static inline int pci_enable_pasid(struct pci_dev *pdev, int features) |
| 89 | { |
| 90 | return -EINVAL; |
| 91 | } |
| 92 | |
| 93 | static inline void pci_disable_pasid(struct pci_dev *pdev) |
| 94 | { |
| 95 | } |
| 96 | |
| 97 | static inline int pci_pasid_features(struct pci_dev *pdev) |
| 98 | { |
| 99 | return -EINVAL; |
| 100 | } |
| 101 | |
| 102 | static inline int pci_max_pasids(struct pci_dev *pdev) |
| 103 | { |
| 104 | return -EINVAL; |
| 105 | } |
| 106 | |
| 107 | #endif /* CONFIG_PCI_PASID */ |
| 108 | |
| 109 | |
Joerg Roedel | 5cdede2 | 2011-04-04 15:55:18 +0200 | [diff] [blame] | 110 | #endif /* LINUX_PCI_ATS_H*/ |