diff options
Diffstat (limited to 'arch/sparc/mm/iommu.c')
-rw-r--r-- | arch/sparc/mm/iommu.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/arch/sparc/mm/iommu.c b/arch/sparc/mm/iommu.c index 28f96f27c768..491511d37e37 100644 --- a/arch/sparc/mm/iommu.c +++ b/arch/sparc/mm/iommu.c | |||
@@ -27,6 +27,8 @@ | |||
27 | #include <asm/iommu.h> | 27 | #include <asm/iommu.h> |
28 | #include <asm/dma.h> | 28 | #include <asm/dma.h> |
29 | 29 | ||
30 | #include "mm_32.h" | ||
31 | |||
30 | /* | 32 | /* |
31 | * This can be sized dynamically, but we will do this | 33 | * This can be sized dynamically, but we will do this |
32 | * only when we have a guidance about actual I/O pressures. | 34 | * only when we have a guidance about actual I/O pressures. |
@@ -37,9 +39,6 @@ | |||
37 | #define IOMMU_NPTES (IOMMU_WINSIZE/PAGE_SIZE) /* 64K PTEs, 256KB */ | 39 | #define IOMMU_NPTES (IOMMU_WINSIZE/PAGE_SIZE) /* 64K PTEs, 256KB */ |
38 | #define IOMMU_ORDER 6 /* 4096 * (1<<6) */ | 40 | #define IOMMU_ORDER 6 /* 4096 * (1<<6) */ |
39 | 41 | ||
40 | /* srmmu.c */ | ||
41 | extern int viking_mxcc_present; | ||
42 | extern int flush_page_for_dma_global; | ||
43 | static int viking_flush; | 42 | static int viking_flush; |
44 | /* viking.S */ | 43 | /* viking.S */ |
45 | extern void viking_flush_page(unsigned long page); | 44 | extern void viking_flush_page(unsigned long page); |
@@ -59,6 +58,8 @@ static void __init sbus_iommu_init(struct platform_device *op) | |||
59 | struct iommu_struct *iommu; | 58 | struct iommu_struct *iommu; |
60 | unsigned int impl, vers; | 59 | unsigned int impl, vers; |
61 | unsigned long *bitmap; | 60 | unsigned long *bitmap; |
61 | unsigned long control; | ||
62 | unsigned long base; | ||
62 | unsigned long tmp; | 63 | unsigned long tmp; |
63 | 64 | ||
64 | iommu = kmalloc(sizeof(struct iommu_struct), GFP_KERNEL); | 65 | iommu = kmalloc(sizeof(struct iommu_struct), GFP_KERNEL); |
@@ -73,12 +74,14 @@ static void __init sbus_iommu_init(struct platform_device *op) | |||
73 | prom_printf("Cannot map IOMMU registers\n"); | 74 | prom_printf("Cannot map IOMMU registers\n"); |
74 | prom_halt(); | 75 | prom_halt(); |
75 | } | 76 | } |
76 | impl = (iommu->regs->control & IOMMU_CTRL_IMPL) >> 28; | 77 | |
77 | vers = (iommu->regs->control & IOMMU_CTRL_VERS) >> 24; | 78 | control = sbus_readl(&iommu->regs->control); |
78 | tmp = iommu->regs->control; | 79 | impl = (control & IOMMU_CTRL_IMPL) >> 28; |
79 | tmp &= ~(IOMMU_CTRL_RNGE); | 80 | vers = (control & IOMMU_CTRL_VERS) >> 24; |
80 | tmp |= (IOMMU_RNGE_256MB | IOMMU_CTRL_ENAB); | 81 | control &= ~(IOMMU_CTRL_RNGE); |
81 | iommu->regs->control = tmp; | 82 | control |= (IOMMU_RNGE_256MB | IOMMU_CTRL_ENAB); |
83 | sbus_writel(control, &iommu->regs->control); | ||
84 | |||
82 | iommu_invalidate(iommu->regs); | 85 | iommu_invalidate(iommu->regs); |
83 | iommu->start = IOMMU_START; | 86 | iommu->start = IOMMU_START; |
84 | iommu->end = 0xffffffff; | 87 | iommu->end = 0xffffffff; |
@@ -100,7 +103,9 @@ static void __init sbus_iommu_init(struct platform_device *op) | |||
100 | memset(iommu->page_table, 0, IOMMU_NPTES*sizeof(iopte_t)); | 103 | memset(iommu->page_table, 0, IOMMU_NPTES*sizeof(iopte_t)); |
101 | flush_cache_all(); | 104 | flush_cache_all(); |
102 | flush_tlb_all(); | 105 | flush_tlb_all(); |
103 | iommu->regs->base = __pa((unsigned long) iommu->page_table) >> 4; | 106 | |
107 | base = __pa((unsigned long)iommu->page_table) >> 4; | ||
108 | sbus_writel(base, &iommu->regs->base); | ||
104 | iommu_invalidate(iommu->regs); | 109 | iommu_invalidate(iommu->regs); |
105 | 110 | ||
106 | bitmap = kmalloc(IOMMU_NPTES>>3, GFP_KERNEL); | 111 | bitmap = kmalloc(IOMMU_NPTES>>3, GFP_KERNEL); |