diff options
Diffstat (limited to 'arch/mips/mm/ioremap.c')
-rw-r--r-- | arch/mips/mm/ioremap.c | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/arch/mips/mm/ioremap.c b/arch/mips/mm/ioremap.c index adf352273f63..3101d1db5592 100644 --- a/arch/mips/mm/ioremap.c +++ b/arch/mips/mm/ioremap.c | |||
@@ -55,7 +55,7 @@ static inline int remap_area_pmd(pmd_t * pmd, unsigned long address, | |||
55 | if (address >= end) | 55 | if (address >= end) |
56 | BUG(); | 56 | BUG(); |
57 | do { | 57 | do { |
58 | pte_t * pte = pte_alloc_kernel(&init_mm, pmd, address); | 58 | pte_t * pte = pte_alloc_kernel(pmd, address); |
59 | if (!pte) | 59 | if (!pte) |
60 | return -ENOMEM; | 60 | return -ENOMEM; |
61 | remap_area_pte(pte, address, end - address, address + phys_addr, flags); | 61 | remap_area_pte(pte, address, end - address, address + phys_addr, flags); |
@@ -77,11 +77,15 @@ static int remap_area_pages(unsigned long address, phys_t phys_addr, | |||
77 | flush_cache_all(); | 77 | flush_cache_all(); |
78 | if (address >= end) | 78 | if (address >= end) |
79 | BUG(); | 79 | BUG(); |
80 | spin_lock(&init_mm.page_table_lock); | ||
81 | do { | 80 | do { |
81 | pud_t *pud; | ||
82 | pmd_t *pmd; | 82 | pmd_t *pmd; |
83 | pmd = pmd_alloc(&init_mm, dir, address); | 83 | |
84 | error = -ENOMEM; | 84 | error = -ENOMEM; |
85 | pud = pud_alloc(&init_mm, dir, address); | ||
86 | if (!pud) | ||
87 | break; | ||
88 | pmd = pmd_alloc(&init_mm, pud, address); | ||
85 | if (!pmd) | 89 | if (!pmd) |
86 | break; | 90 | break; |
87 | if (remap_area_pmd(pmd, address, end - address, | 91 | if (remap_area_pmd(pmd, address, end - address, |
@@ -91,21 +95,11 @@ static int remap_area_pages(unsigned long address, phys_t phys_addr, | |||
91 | address = (address + PGDIR_SIZE) & PGDIR_MASK; | 95 | address = (address + PGDIR_SIZE) & PGDIR_MASK; |
92 | dir++; | 96 | dir++; |
93 | } while (address && (address < end)); | 97 | } while (address && (address < end)); |
94 | spin_unlock(&init_mm.page_table_lock); | ||
95 | flush_tlb_all(); | 98 | flush_tlb_all(); |
96 | return error; | 99 | return error; |
97 | } | 100 | } |
98 | 101 | ||
99 | /* | 102 | /* |
100 | * Allow physical addresses to be fixed up to help 36 bit peripherals. | ||
101 | */ | ||
102 | phys_t __attribute__ ((weak)) | ||
103 | fixup_bigphys_addr(phys_t phys_addr, phys_t size) | ||
104 | { | ||
105 | return phys_addr; | ||
106 | } | ||
107 | |||
108 | /* | ||
109 | * Generic mapping function (not visible outside): | 103 | * Generic mapping function (not visible outside): |
110 | */ | 104 | */ |
111 | 105 | ||
@@ -121,7 +115,7 @@ fixup_bigphys_addr(phys_t phys_addr, phys_t size) | |||
121 | 115 | ||
122 | #define IS_LOW512(addr) (!((phys_t)(addr) & (phys_t) ~0x1fffffffULL)) | 116 | #define IS_LOW512(addr) (!((phys_t)(addr) & (phys_t) ~0x1fffffffULL)) |
123 | 117 | ||
124 | void * __ioremap(phys_t phys_addr, phys_t size, unsigned long flags) | 118 | void __iomem * __ioremap(phys_t phys_addr, phys_t size, unsigned long flags) |
125 | { | 119 | { |
126 | struct vm_struct * area; | 120 | struct vm_struct * area; |
127 | unsigned long offset; | 121 | unsigned long offset; |
@@ -141,7 +135,7 @@ void * __ioremap(phys_t phys_addr, phys_t size, unsigned long flags) | |||
141 | */ | 135 | */ |
142 | if (IS_LOW512(phys_addr) && IS_LOW512(last_addr) && | 136 | if (IS_LOW512(phys_addr) && IS_LOW512(last_addr) && |
143 | flags == _CACHE_UNCACHED) | 137 | flags == _CACHE_UNCACHED) |
144 | return (void *) KSEG1ADDR(phys_addr); | 138 | return (void __iomem *) CKSEG1ADDR(phys_addr); |
145 | 139 | ||
146 | /* | 140 | /* |
147 | * Don't allow anybody to remap normal RAM that we're using.. | 141 | * Don't allow anybody to remap normal RAM that we're using.. |
@@ -177,10 +171,10 @@ void * __ioremap(phys_t phys_addr, phys_t size, unsigned long flags) | |||
177 | return NULL; | 171 | return NULL; |
178 | } | 172 | } |
179 | 173 | ||
180 | return (void *) (offset + (char *)addr); | 174 | return (void __iomem *) (offset + (char *)addr); |
181 | } | 175 | } |
182 | 176 | ||
183 | #define IS_KSEG1(addr) (((unsigned long)(addr) & ~0x1fffffffUL) == KSEG1) | 177 | #define IS_KSEG1(addr) (((unsigned long)(addr) & ~0x1fffffffUL) == CKSEG1) |
184 | 178 | ||
185 | void __iounmap(volatile void __iomem *addr) | 179 | void __iounmap(volatile void __iomem *addr) |
186 | { | 180 | { |
@@ -190,10 +184,8 @@ void __iounmap(volatile void __iomem *addr) | |||
190 | return; | 184 | return; |
191 | 185 | ||
192 | p = remove_vm_area((void *) (PAGE_MASK & (unsigned long __force) addr)); | 186 | p = remove_vm_area((void *) (PAGE_MASK & (unsigned long __force) addr)); |
193 | if (!p) { | 187 | if (!p) |
194 | printk(KERN_ERR "iounmap: bad address %p\n", addr); | 188 | printk(KERN_ERR "iounmap: bad address %p\n", addr); |
195 | return; | ||
196 | } | ||
197 | 189 | ||
198 | kfree(p); | 190 | kfree(p); |
199 | } | 191 | } |