1 /*
2 * xen/include/asm-arm/iommu_fwspec.h
3 *
4 * Contains a common structure to hold the per-device firmware data and
5 * declaration of functions used to maintain that data
6 *
7 * Based on Linux's iommu_fwspec support you can find at:
8 * include/linux/iommu.h
9 *
10 * Copyright (C) 2007-2008 Advanced Micro Devices, Inc.
11 *
12 * Copyright (C) 2019 EPAM Systems Inc.
13 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms and conditions of the GNU General Public
16 * License, version 2, as published by the Free Software Foundation.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public
24 * License along with this program; If not, see <http://www.gnu.org/licenses/>.
25 */
26
27 #ifndef __ARCH_ARM_IOMMU_FWSPEC_H__
28 #define __ARCH_ARM_IOMMU_FWSPEC_H__
29
30 /* per-device IOMMU instance data */
31 struct iommu_fwspec {
32 /* this device's IOMMU */
33 struct device *iommu_dev;
34 /* IOMMU driver private data for this device */
35 void *iommu_priv;
36 /* number of associated device IDs */
37 unsigned int num_ids;
38 /* IDs which this device may present to the IOMMU */
39 uint32_t ids[];
40 };
41
42 int iommu_fwspec_init(struct device *dev, struct device *iommu_dev);
43 void iommu_fwspec_free(struct device *dev);
44 int iommu_fwspec_add_ids(struct device *dev, const uint32_t *ids,
45 unsigned int num_ids);
46
dev_iommu_fwspec_get(struct device * dev)47 static inline struct iommu_fwspec *dev_iommu_fwspec_get(struct device *dev)
48 {
49 return dev->iommu_fwspec;
50 }
51
dev_iommu_fwspec_set(struct device * dev,struct iommu_fwspec * fwspec)52 static inline void dev_iommu_fwspec_set(struct device *dev,
53 struct iommu_fwspec *fwspec)
54 {
55 dev->iommu_fwspec = fwspec;
56 }
57
58 #endif /* __ARCH_ARM_IOMMU_FWSPEC_H__ */
59
60 /*
61 * Local variables:
62 * mode: C
63 * c-file-style: "BSD"
64 * c-basic-offset: 4
65 * tab-width: 4
66 * indent-tabs-mode: nil
67 * End:
68 */
69