| 1634 | } |
| 1635 | |
| 1636 | static int |
| 1637 | smmu_map(device_t dev, struct iommu_domain *iodom, |
| 1638 | vm_offset_t va, vm_page_t *ma, vm_size_t size, |
| 1639 | vm_prot_t prot) |
| 1640 | { |
| 1641 | struct smmu_domain *domain; |
| 1642 | struct smmu_softc *sc; |
| 1643 | vm_paddr_t pa; |
| 1644 | int error; |
| 1645 | int i; |
| 1646 | |
| 1647 | sc = device_get_softc(dev); |
| 1648 | |
| 1649 | domain = (struct smmu_domain *)iodom; |
| 1650 | |
| 1651 | dprintf("%s: %lx -> %lx, %ld, domain %d\n", __func__, va, pa, size, |
| 1652 | domain->asid); |
| 1653 | |
| 1654 | for (i = 0; size > 0; size -= PAGE_SIZE) { |
| 1655 | pa = VM_PAGE_TO_PHYS(ma[i++]); |
| 1656 | error = pmap_senter(&domain->p, va, pa, prot, 0); |
| 1657 | if (error) |
| 1658 | return (error); |
| 1659 | smmu_tlbi_va(sc, va, domain->asid); |
| 1660 | va += PAGE_SIZE; |
| 1661 | } |
| 1662 | |
| 1663 | smmu_sync(sc); |
| 1664 | |
| 1665 | return (0); |
| 1666 | } |
| 1667 | |
| 1668 | static struct iommu_domain * |
| 1669 | smmu_domain_alloc(device_t dev, struct iommu_unit *iommu) |
nothing calls this directly
no test coverage detected