diff options
Diffstat (limited to 'arch/sparc')
-rw-r--r-- | arch/sparc/include/asm/iommu_32.h | 10 | ||||
-rw-r--r-- | arch/sparc/mm/iommu.c | 20 |
2 files changed, 18 insertions, 12 deletions
diff --git a/arch/sparc/include/asm/iommu_32.h b/arch/sparc/include/asm/iommu_32.h index 70c589c05a10..f6c066b52fd6 100644 --- a/arch/sparc/include/asm/iommu_32.h +++ b/arch/sparc/include/asm/iommu_32.h | |||
@@ -99,7 +99,7 @@ struct iommu_regs { | |||
99 | #define IOPTE_WAZ 0x00000001 /* Write as zeros */ | 99 | #define IOPTE_WAZ 0x00000001 /* Write as zeros */ |
100 | 100 | ||
101 | struct iommu_struct { | 101 | struct iommu_struct { |
102 | struct iommu_regs *regs; | 102 | struct iommu_regs __iomem *regs; |
103 | iopte_t *page_table; | 103 | iopte_t *page_table; |
104 | /* For convenience */ | 104 | /* For convenience */ |
105 | unsigned long start; /* First managed virtual address */ | 105 | unsigned long start; /* First managed virtual address */ |
@@ -108,14 +108,14 @@ struct iommu_struct { | |||
108 | struct bit_map usemap; | 108 | struct bit_map usemap; |
109 | }; | 109 | }; |
110 | 110 | ||
111 | static inline void iommu_invalidate(struct iommu_regs *regs) | 111 | static inline void iommu_invalidate(struct iommu_regs __iomem *regs) |
112 | { | 112 | { |
113 | regs->tlbflush = 0; | 113 | sbus_writel(0, ®s->tlbflush); |
114 | } | 114 | } |
115 | 115 | ||
116 | static inline void iommu_invalidate_page(struct iommu_regs *regs, unsigned long ba) | 116 | static inline void iommu_invalidate_page(struct iommu_regs __iomem *regs, unsigned long ba) |
117 | { | 117 | { |
118 | regs->pageflush = (ba & PAGE_MASK); | 118 | sbus_writel(ba & PAGE_MASK, ®s->pageflush); |
119 | } | 119 | } |
120 | 120 | ||
121 | #endif /* !(_SPARC_IOMMU_H) */ | 121 | #endif /* !(_SPARC_IOMMU_H) */ |
diff --git a/arch/sparc/mm/iommu.c b/arch/sparc/mm/iommu.c index 35384cb60b21..491511d37e37 100644 --- a/arch/sparc/mm/iommu.c +++ b/arch/sparc/mm/iommu.c | |||
@@ -58,6 +58,8 @@ static void __init sbus_iommu_init(struct platform_device *op) | |||
58 | struct iommu_struct *iommu; | 58 | struct iommu_struct *iommu; |
59 | unsigned int impl, vers; | 59 | unsigned int impl, vers; |
60 | unsigned long *bitmap; | 60 | unsigned long *bitmap; |
61 | unsigned long control; | ||
62 | unsigned long base; | ||
61 | unsigned long tmp; | 63 | unsigned long tmp; |
62 | 64 | ||
63 | iommu = kmalloc(sizeof(struct iommu_struct), GFP_KERNEL); | 65 | iommu = kmalloc(sizeof(struct iommu_struct), GFP_KERNEL); |
@@ -72,12 +74,14 @@ static void __init sbus_iommu_init(struct platform_device *op) | |||
72 | prom_printf("Cannot map IOMMU registers\n"); | 74 | prom_printf("Cannot map IOMMU registers\n"); |
73 | prom_halt(); | 75 | prom_halt(); |
74 | } | 76 | } |
75 | impl = (iommu->regs->control & IOMMU_CTRL_IMPL) >> 28; | 77 | |
76 | vers = (iommu->regs->control & IOMMU_CTRL_VERS) >> 24; | 78 | control = sbus_readl(&iommu->regs->control); |
77 | tmp = iommu->regs->control; | 79 | impl = (control & IOMMU_CTRL_IMPL) >> 28; |
78 | tmp &= ~(IOMMU_CTRL_RNGE); | 80 | vers = (control & IOMMU_CTRL_VERS) >> 24; |
79 | tmp |= (IOMMU_RNGE_256MB | IOMMU_CTRL_ENAB); | 81 | control &= ~(IOMMU_CTRL_RNGE); |
80 | iommu->regs->control = tmp; | 82 | control |= (IOMMU_RNGE_256MB | IOMMU_CTRL_ENAB); |
83 | sbus_writel(control, &iommu->regs->control); | ||
84 | |||
81 | iommu_invalidate(iommu->regs); | 85 | iommu_invalidate(iommu->regs); |
82 | iommu->start = IOMMU_START; | 86 | iommu->start = IOMMU_START; |
83 | iommu->end = 0xffffffff; | 87 | iommu->end = 0xffffffff; |
@@ -99,7 +103,9 @@ static void __init sbus_iommu_init(struct platform_device *op) | |||
99 | memset(iommu->page_table, 0, IOMMU_NPTES*sizeof(iopte_t)); | 103 | memset(iommu->page_table, 0, IOMMU_NPTES*sizeof(iopte_t)); |
100 | flush_cache_all(); | 104 | flush_cache_all(); |
101 | flush_tlb_all(); | 105 | flush_tlb_all(); |
102 | 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); | ||
103 | iommu_invalidate(iommu->regs); | 109 | iommu_invalidate(iommu->regs); |
104 | 110 | ||
105 | bitmap = kmalloc(IOMMU_NPTES>>3, GFP_KERNEL); | 111 | bitmap = kmalloc(IOMMU_NPTES>>3, GFP_KERNEL); |