summaryrefslogtreecommitdiff
path: root/xen/arch/arm/include/asm/iommu_fwspec.h
blob: 5cdb53f8e84bd09b22bc03be9e4481717a5e715a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
 * xen/include/asm-arm/iommu_fwspec.h
 *
 * Contains a common structure to hold the per-device firmware data and
 * declaration of functions used to maintain that data
 *
 * Based on Linux's iommu_fwspec support you can find at:
 *    include/linux/iommu.h
 *
 * Copyright (C) 2007-2008 Advanced Micro Devices, Inc.
 *
 * Copyright (C) 2019 EPAM Systems Inc.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms and conditions of the GNU General Public
 * License, version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef __ARCH_ARM_IOMMU_FWSPEC_H__
#define __ARCH_ARM_IOMMU_FWSPEC_H__

/* per-device IOMMU instance data */
struct iommu_fwspec {
    /* this device's IOMMU */
    struct device *iommu_dev;
    /* IOMMU driver private data for this device */
    void *iommu_priv;
    /* number of associated device IDs */
    unsigned int num_ids;
    /* IDs which this device may present to the IOMMU */
    uint32_t ids[];
};

int iommu_fwspec_init(struct device *dev, struct device *iommu_dev);
void iommu_fwspec_free(struct device *dev);
int iommu_fwspec_add_ids(struct device *dev, const uint32_t *ids,
                         unsigned int num_ids);

static inline struct iommu_fwspec *dev_iommu_fwspec_get(struct device *dev)
{
    return dev->iommu_fwspec;
}

static inline void dev_iommu_fwspec_set(struct device *dev,
                                        struct iommu_fwspec *fwspec)
{
    dev->iommu_fwspec = fwspec;
}

#endif /* __ARCH_ARM_IOMMU_FWSPEC_H__ */

/*
 * Local variables:
 * mode: C
 * c-file-style: "BSD"
 * c-basic-offset: 4
 * tab-width: 4
 * indent-tabs-mode: nil
 * End:
 */