diff options
Diffstat (limited to 'sys/arm64/iommu/iommu.c')
-rw-r--r-- | sys/arm64/iommu/iommu.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/sys/arm64/iommu/iommu.c b/sys/arm64/iommu/iommu.c index aa48dcf5ab5e..cb2b86c9dc41 100644 --- a/sys/arm64/iommu/iommu.c +++ b/sys/arm64/iommu/iommu.c @@ -35,9 +35,6 @@ #include "opt_platform.h" -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - #include <sys/param.h> #include <sys/bus.h> #include <sys/kernel.h> @@ -136,8 +133,9 @@ iommu_domain_alloc(struct iommu_unit *iommu) if (iodom == NULL) return (NULL); + KASSERT(iodom->end != 0, ("domain end is not set")); + iommu_domain_init(iommu, iodom, &domain_map_ops); - iodom->end = VM_MAXUSER_ADDRESS; iodom->iommu = iommu; iommu_gas_init_domain(iodom); @@ -168,11 +166,11 @@ iommu_domain_free(struct iommu_domain *iodom) } static void -iommu_tag_init(struct bus_dma_tag_iommu *t) +iommu_tag_init(struct iommu_domain *iodom, struct bus_dma_tag_iommu *t) { bus_addr_t maxaddr; - maxaddr = BUS_SPACE_MAXADDR; + maxaddr = MIN(iodom->end, BUS_SPACE_MAXADDR); t->common.ref_count = 0; t->common.impl = &bus_dma_iommu_impl; @@ -223,7 +221,7 @@ iommu_ctx_init(device_t requester, struct iommu_ctx *ioctx) tag->ctx = ioctx; tag->ctx->domain = iodom; - iommu_tag_init(tag); + iommu_tag_init(iodom, tag); return (error); } @@ -247,6 +245,7 @@ iommu_lookup(device_t dev) return (NULL); } +#ifdef FDT struct iommu_ctx * iommu_get_ctx_ofw(device_t dev, int channel) { @@ -332,6 +331,7 @@ iommu_get_ctx_ofw(device_t dev, int channel) return (ioctx); } +#endif struct iommu_ctx * iommu_get_ctx(struct iommu_unit *iommu, device_t requester, @@ -410,16 +410,10 @@ iommu_free_ctx(struct iommu_ctx *ioctx) static void iommu_domain_free_entry(struct iommu_map_entry *entry, bool free) { - struct iommu_domain *iodom; - - iodom = entry->domain; - - IOMMU_DOMAIN_LOCK(iodom); - iommu_gas_free_space(iodom, entry); - IOMMU_DOMAIN_UNLOCK(iodom); + iommu_gas_free_space(entry); if (free) - iommu_gas_free_entry(iodom, entry); + iommu_gas_free_entry(entry); else entry->flags = 0; } @@ -509,7 +503,8 @@ iommu_find(device_t dev, bool verbose) } void -iommu_domain_unload_entry(struct iommu_map_entry *entry, bool free) +iommu_domain_unload_entry(struct iommu_map_entry *entry, bool free, + bool cansleep __unused) { dprintf("%s\n", __func__); |