Lines Matching full:iommu

3  * iommu.c:  IOMMU specific routines for memory management.
26 #include <asm/iommu.h>
60 struct iommu_struct *iommu; in sbus_iommu_init() local
67 iommu = kmalloc(sizeof(struct iommu_struct), GFP_KERNEL); in sbus_iommu_init()
68 if (!iommu) { in sbus_iommu_init()
69 prom_printf("Unable to allocate iommu structure\n"); in sbus_iommu_init()
73 iommu->regs = of_ioremap(&op->resource[0], 0, PAGE_SIZE * 3, in sbus_iommu_init()
75 if (!iommu->regs) { in sbus_iommu_init()
76 prom_printf("Cannot map IOMMU registers\n"); in sbus_iommu_init()
80 control = sbus_readl(&iommu->regs->control); in sbus_iommu_init()
85 sbus_writel(control, &iommu->regs->control); in sbus_iommu_init()
87 iommu_invalidate(iommu->regs); in sbus_iommu_init()
88 iommu->start = IOMMU_START; in sbus_iommu_init()
89 iommu->end = 0xffffffff; in sbus_iommu_init()
91 /* Allocate IOMMU page table */ in sbus_iommu_init()
98 prom_printf("Unable to allocate iommu table [0x%lx]\n", in sbus_iommu_init()
102 iommu->page_table = (iopte_t *)tmp; in sbus_iommu_init()
105 memset(iommu->page_table, 0, IOMMU_NPTES*sizeof(iopte_t)); in sbus_iommu_init()
109 base = __pa((unsigned long)iommu->page_table) >> 4; in sbus_iommu_init()
110 sbus_writel(base, &iommu->regs->base); in sbus_iommu_init()
111 iommu_invalidate(iommu->regs); in sbus_iommu_init()
115 prom_printf("Unable to allocate iommu bitmap [%d]\n", in sbus_iommu_init()
119 bit_map_init(&iommu->usemap, bitmap, IOMMU_NPTES); in sbus_iommu_init()
124 iommu->usemap.num_colors = vac_cache_size >> PAGE_SHIFT; in sbus_iommu_init()
126 iommu->usemap.num_colors = 1; in sbus_iommu_init()
128 printk(KERN_INFO "IOMMU: impl %d vers %d table 0x%p[%d B] map [%d b]\n", in sbus_iommu_init()
129 impl, vers, iommu->page_table, in sbus_iommu_init()
132 op->dev.archdata.iommu = iommu; in sbus_iommu_init()
144 for_each_node_by_name(dp, "iommu") { in iommu_init()
187 struct iommu_struct *iommu = dev->archdata.iommu; in __sbus_iommu_map_page() local
214 ioptex = bit_map_string_get(&iommu->usemap, npages, pfn); in __sbus_iommu_map_page()
216 panic("iommu out"); in __sbus_iommu_map_page()
217 busa0 = iommu->start + (ioptex << PAGE_SHIFT); in __sbus_iommu_map_page()
218 iopte0 = &iommu->page_table[ioptex]; in __sbus_iommu_map_page()
224 iommu_invalidate_page(iommu->regs, busa); in __sbus_iommu_map_page()
283 struct iommu_struct *iommu = dev->archdata.iommu; in sbus_iommu_unmap_page() local
287 unsigned int ioptex = (busa - iommu->start) >> PAGE_SHIFT; in sbus_iommu_unmap_page()
290 BUG_ON(busa < iommu->start); in sbus_iommu_unmap_page()
292 iopte_val(iommu->page_table[ioptex + i]) = 0; in sbus_iommu_unmap_page()
293 iommu_invalidate_page(iommu->regs, busa); in sbus_iommu_unmap_page()
296 bit_map_clear(&iommu->usemap, ioptex, npages); in sbus_iommu_unmap_page()
316 struct iommu_struct *iommu = dev->archdata.iommu; in sbus_iommu_alloc() local
318 iopte_t *iopte = iommu->page_table; in sbus_iommu_alloc()
340 ioptex = bit_map_string_get(&iommu->usemap, len >> PAGE_SHIFT, in sbus_iommu_alloc()
343 panic("iommu out"); in sbus_iommu_alloc()
378 * IOMMU page table modifications, and usage of non-cacheable in sbus_iommu_alloc()
385 iommu_invalidate(iommu->regs); in sbus_iommu_alloc()
387 *dma_handle = iommu->start + (ioptex << PAGE_SHIFT); in sbus_iommu_alloc()
398 struct iommu_struct *iommu = dev->archdata.iommu; in sbus_iommu_free() local
399 iopte_t *iopte = iommu->page_table; in sbus_iommu_free()
401 int ioptex = (busa - iommu->start) >> PAGE_SHIFT; in sbus_iommu_free()
417 iommu_invalidate(iommu->regs); in sbus_iommu_free()
418 bit_map_clear(&iommu->usemap, ioptex, len >> PAGE_SHIFT); in sbus_iommu_free()