blob: 4eab42bf2af9cae3b9e7b92163598cf675953690 [file] [log] [blame]
Joerg Roedel5cdede22011-04-04 15:55:18 +02001#ifndef LINUX_PCI_ATS_H
2#define LINUX_PCI_ATS_H
3
Joerg Roedeldb3c33c2011-09-27 15:57:13 +02004#include <linux/pci.h>
5
Joerg Roedel5cdede22011-04-04 15:55:18 +02006/* 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);
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 */
26static 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
33static inline int pci_enable_ats(struct pci_dev *dev, int ps)
34{
35 return -ENODEV;
36}
37
38static inline void pci_disable_ats(struct pci_dev *dev)
39{
40}
41
42static inline int pci_ats_queue_depth(struct pci_dev *dev)
43{
44 return -ENODEV;
45}
46
47static 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*/