/root/src/xen/xen/drivers/passthrough/ats.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * This program is free software; you can redistribute it and/or modify it |
3 | | * under the terms and conditions of the GNU General Public License, |
4 | | * version 2, as published by the Free Software Foundation. |
5 | | * |
6 | | * This program is distributed in the hope it will be useful, but WITHOUT |
7 | | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
8 | | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
9 | | * more details. |
10 | | * |
11 | | * You should have received a copy of the GNU General Public License along with |
12 | | * this program; If not, see <http://www.gnu.org/licenses/>. |
13 | | */ |
14 | | |
15 | | #ifndef _ATS_H_ |
16 | | #define _ATS_H_ |
17 | | |
18 | | #include <xen/pci_regs.h> |
19 | | |
20 | 0 | #define ATS_REG_CAP 4 |
21 | 0 | #define ATS_REG_CTL 6 |
22 | 0 | #define ATS_QUEUE_DEPTH_MASK 0x1f |
23 | 0 | #define ATS_ENABLE (1<<15) |
24 | | |
25 | | extern bool_t ats_enabled; |
26 | | |
27 | | int enable_ats_device(struct pci_dev *pdev, struct list_head *ats_list); |
28 | | void disable_ats_device(struct pci_dev *pdev); |
29 | | |
30 | | static inline int pci_ats_enabled(int seg, int bus, int devfn) |
31 | 0 | { |
32 | 0 | u32 value; |
33 | 0 | int pos; |
34 | 0 |
|
35 | 0 | pos = pci_find_ext_capability(seg, bus, devfn, PCI_EXT_CAP_ID_ATS); |
36 | 0 | BUG_ON(!pos); |
37 | 0 |
|
38 | 0 | value = pci_conf_read16(seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), |
39 | 0 | pos + ATS_REG_CTL); |
40 | 0 | return value & ATS_ENABLE; |
41 | 0 | } Unexecuted instantiation: pci.c:pci_ats_enabled Unexecuted instantiation: iommu.c:pci_ats_enabled Unexecuted instantiation: qinval.c:pci_ats_enabled Unexecuted instantiation: ats.c:pci_ats_enabled Unexecuted instantiation: iommu_map.c:pci_ats_enabled Unexecuted instantiation: pci_amd_iommu.c:pci_ats_enabled Unexecuted instantiation: iommu_cmd.c:pci_ats_enabled |
42 | | |
43 | | static inline int pci_ats_device(int seg, int bus, int devfn) |
44 | 0 | { |
45 | 0 | if ( !ats_enabled ) |
46 | 0 | return 0; |
47 | 0 |
|
48 | 0 | return pci_find_ext_capability(seg, bus, devfn, PCI_EXT_CAP_ID_ATS); |
49 | 0 | } Unexecuted instantiation: pci.c:pci_ats_device Unexecuted instantiation: iommu.c:pci_ats_device Unexecuted instantiation: qinval.c:pci_ats_device Unexecuted instantiation: ats.c:pci_ats_device Unexecuted instantiation: iommu_map.c:pci_ats_device Unexecuted instantiation: pci_amd_iommu.c:pci_ats_device Unexecuted instantiation: iommu_cmd.c:pci_ats_device |
50 | | |
51 | | #endif /* _ATS_H_ */ |
52 | | |