blob: 655824fa4c76aab29aaf00b21c6ed522cbaaf288 [file] [log] [blame]
Joerg Roedel5cdede22011-04-04 15:55:18 +02001#ifndef LINUX_PCI_ATS_H
2#define LINUX_PCI_ATS_H
3
4/* Address Translation Service */
5struct 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
15extern int pci_enable_ats(struct pci_dev *dev, int ps);
16extern void pci_disable_ats(struct pci_dev *dev);
17extern 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 */
24static 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
31static inline int pci_enable_ats(struct pci_dev *dev, int ps)
32{
33 return -ENODEV;
34}
35
36static inline void pci_disable_ats(struct pci_dev *dev)
37{
38}
39
40static inline int pci_ats_queue_depth(struct pci_dev *dev)
41{
42 return -ENODEV;
43}
44
45static 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*/