diff options
Diffstat (limited to 'arch/x86/mm/ioremap.c')
-rw-r--r-- | arch/x86/mm/ioremap.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index 804de18abcc2..71bb3159031a 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c | |||
@@ -149,7 +149,8 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr, | |||
149 | * Don't allow anybody to remap normal RAM that we're using.. | 149 | * Don't allow anybody to remap normal RAM that we're using.. |
150 | */ | 150 | */ |
151 | for (pfn = phys_addr >> PAGE_SHIFT; | 151 | for (pfn = phys_addr >> PAGE_SHIFT; |
152 | (pfn << PAGE_SHIFT) < last_addr; pfn++) { | 152 | (pfn << PAGE_SHIFT) < (last_addr & PAGE_MASK); |
153 | pfn++) { | ||
153 | 154 | ||
154 | int is_ram = page_is_ram(pfn); | 155 | int is_ram = page_is_ram(pfn); |
155 | 156 | ||
@@ -176,11 +177,11 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr, | |||
176 | /* | 177 | /* |
177 | * Do not fallback to certain memory types with certain | 178 | * Do not fallback to certain memory types with certain |
178 | * requested type: | 179 | * requested type: |
179 | * - request is uncached, return cannot be write-back | 180 | * - request is uc-, return cannot be write-back |
180 | * - request is uncached, return cannot be write-combine | 181 | * - request is uc-, return cannot be write-combine |
181 | * - request is write-combine, return cannot be write-back | 182 | * - request is write-combine, return cannot be write-back |
182 | */ | 183 | */ |
183 | if ((prot_val == _PAGE_CACHE_UC && | 184 | if ((prot_val == _PAGE_CACHE_UC_MINUS && |
184 | (new_prot_val == _PAGE_CACHE_WB || | 185 | (new_prot_val == _PAGE_CACHE_WB || |
185 | new_prot_val == _PAGE_CACHE_WC)) || | 186 | new_prot_val == _PAGE_CACHE_WC)) || |
186 | (prot_val == _PAGE_CACHE_WC && | 187 | (prot_val == _PAGE_CACHE_WC && |
@@ -201,6 +202,9 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr, | |||
201 | default: | 202 | default: |
202 | prot = PAGE_KERNEL_NOCACHE; | 203 | prot = PAGE_KERNEL_NOCACHE; |
203 | break; | 204 | break; |
205 | case _PAGE_CACHE_UC_MINUS: | ||
206 | prot = PAGE_KERNEL_UC_MINUS; | ||
207 | break; | ||
204 | case _PAGE_CACHE_WC: | 208 | case _PAGE_CACHE_WC: |
205 | prot = PAGE_KERNEL_WC; | 209 | prot = PAGE_KERNEL_WC; |
206 | break; | 210 | break; |
@@ -255,7 +259,16 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr, | |||
255 | */ | 259 | */ |
256 | void __iomem *ioremap_nocache(resource_size_t phys_addr, unsigned long size) | 260 | void __iomem *ioremap_nocache(resource_size_t phys_addr, unsigned long size) |
257 | { | 261 | { |
258 | return __ioremap_caller(phys_addr, size, _PAGE_CACHE_UC, | 262 | /* |
263 | * Ideally, this should be: | ||
264 | * pat_wc_enabled ? _PAGE_CACHE_UC : _PAGE_CACHE_UC_MINUS; | ||
265 | * | ||
266 | * Till we fix all X drivers to use ioremap_wc(), we will use | ||
267 | * UC MINUS. | ||
268 | */ | ||
269 | unsigned long val = _PAGE_CACHE_UC_MINUS; | ||
270 | |||
271 | return __ioremap_caller(phys_addr, size, val, | ||
259 | __builtin_return_address(0)); | 272 | __builtin_return_address(0)); |
260 | } | 273 | } |
261 | EXPORT_SYMBOL(ioremap_nocache); | 274 | EXPORT_SYMBOL(ioremap_nocache); |