PCI: Add implementation for PRI capability
[deliverable/linux.git] / include / linux / pci-ats.h
CommitLineData
5cdede24
JR
1#ifndef LINUX_PCI_ATS_H
2#define LINUX_PCI_ATS_H
3
db3c33c6
JR
4#include <linux/pci.h>
5
5cdede24
JR
6/* Address Translation Service */
7struct 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
17extern int pci_enable_ats(struct pci_dev *dev, int ps);
18extern void pci_disable_ats(struct pci_dev *dev);
19extern int pci_ats_queue_depth(struct pci_dev *dev);
c320b976 20
5cdede24
JR
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 */
27static inline int pci_ats_enabled(struct pci_dev *dev)
28{
29 return dev->ats && dev->ats->is_enabled;
30}
31
32#else /* CONFIG_PCI_IOV */
33
34static inline int pci_enable_ats(struct pci_dev *dev, int ps)
35{
36 return -ENODEV;
37}
38
39static inline void pci_disable_ats(struct pci_dev *dev)
40{
41}
42
43static inline int pci_ats_queue_depth(struct pci_dev *dev)
44{
45 return -ENODEV;
46}
47
48static inline int pci_ats_enabled(struct pci_dev *dev)
49{
50 return 0;
51}
52
53#endif /* CONFIG_PCI_IOV */
54
c320b976
JR
55#ifdef CONFIG_PCI_PRI
56
57extern int pci_enable_pri(struct pci_dev *pdev, u32 reqs);
58extern void pci_disable_pri(struct pci_dev *pdev);
59extern bool pci_pri_enabled(struct pci_dev *pdev);
60extern int pci_reset_pri(struct pci_dev *pdev);
61extern bool pci_pri_stopped(struct pci_dev *pdev);
62extern int pci_pri_status(struct pci_dev *pdev);
63
64#else /* CONFIG_PCI_PRI */
65
66static inline int pci_enable_pri(struct pci_dev *pdev, u32 reqs)
67{
68 return -ENODEV;
69}
70
71static inline void pci_disable_pri(struct pci_dev *pdev)
72{
73}
74
75static inline bool pci_pri_enabled(struct pci_dev *pdev)
76{
77 return false;
78}
79
80static inline int pci_reset_pri(struct pci_dev *pdev)
81{
82 return -ENODEV;
83}
84
85static inline bool pci_pri_stopped(struct pci_dev *pdev)
86{
87 return true;
88}
89
90static inline int pci_pri_status(struct pci_dev *pdev)
91{
92 return -ENODEV;
93}
94#endif /* CONFIG_PCI_PRI */
95
5cdede24 96#endif /* LINUX_PCI_ATS_H*/
This page took 0.077043 seconds and 5 git commands to generate.