diff options
author | Jonathan Corbet <corbet@lwn.net> | 2008-07-14 17:29:34 -0400 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2008-07-14 17:29:34 -0400 |
commit | 2fceef397f9880b212a74c418290ce69e7ac00eb (patch) | |
tree | d9cc09ab992825ef7fede4a688103503e3caf655 /arch/x86/mm/ioremap.c | |
parent | feae1ef116ed381625d3731c5ae4f4ebcb3fa302 (diff) | |
parent | bce7f793daec3e65ec5c5705d2457b81fe7b5725 (diff) |
Merge commit 'v2.6.26' into bkl-removal
Diffstat (limited to 'arch/x86/mm/ioremap.c')
-rw-r--r-- | arch/x86/mm/ioremap.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index 71bb3159031a..d1b867101e5f 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c | |||
@@ -300,6 +300,29 @@ void __iomem *ioremap_cache(resource_size_t phys_addr, unsigned long size) | |||
300 | } | 300 | } |
301 | EXPORT_SYMBOL(ioremap_cache); | 301 | EXPORT_SYMBOL(ioremap_cache); |
302 | 302 | ||
303 | static void __iomem *ioremap_default(resource_size_t phys_addr, | ||
304 | unsigned long size) | ||
305 | { | ||
306 | unsigned long flags; | ||
307 | void *ret; | ||
308 | int err; | ||
309 | |||
310 | /* | ||
311 | * - WB for WB-able memory and no other conflicting mappings | ||
312 | * - UC_MINUS for non-WB-able memory with no other conflicting mappings | ||
313 | * - Inherit from confliting mappings otherwise | ||
314 | */ | ||
315 | err = reserve_memtype(phys_addr, phys_addr + size, -1, &flags); | ||
316 | if (err < 0) | ||
317 | return NULL; | ||
318 | |||
319 | ret = (void *) __ioremap_caller(phys_addr, size, flags, | ||
320 | __builtin_return_address(0)); | ||
321 | |||
322 | free_memtype(phys_addr, phys_addr + size); | ||
323 | return (void __iomem *)ret; | ||
324 | } | ||
325 | |||
303 | /** | 326 | /** |
304 | * iounmap - Free a IO remapping | 327 | * iounmap - Free a IO remapping |
305 | * @addr: virtual address from ioremap_* | 328 | * @addr: virtual address from ioremap_* |
@@ -365,7 +388,7 @@ void *xlate_dev_mem_ptr(unsigned long phys) | |||
365 | if (page_is_ram(start >> PAGE_SHIFT)) | 388 | if (page_is_ram(start >> PAGE_SHIFT)) |
366 | return __va(phys); | 389 | return __va(phys); |
367 | 390 | ||
368 | addr = (void *)ioremap(start, PAGE_SIZE); | 391 | addr = (void *)ioremap_default(start, PAGE_SIZE); |
369 | if (addr) | 392 | if (addr) |
370 | addr = (void *)((unsigned long)addr | (phys & ~PAGE_MASK)); | 393 | addr = (void *)((unsigned long)addr | (phys & ~PAGE_MASK)); |
371 | 394 | ||
@@ -593,10 +616,11 @@ void __init early_iounmap(void *addr, unsigned long size) | |||
593 | unsigned long offset; | 616 | unsigned long offset; |
594 | unsigned int nrpages; | 617 | unsigned int nrpages; |
595 | enum fixed_addresses idx; | 618 | enum fixed_addresses idx; |
596 | unsigned int nesting; | 619 | int nesting; |
597 | 620 | ||
598 | nesting = --early_ioremap_nested; | 621 | nesting = --early_ioremap_nested; |
599 | WARN_ON(nesting < 0); | 622 | if (WARN_ON(nesting < 0)) |
623 | return; | ||
600 | 624 | ||
601 | if (early_ioremap_debug) { | 625 | if (early_ioremap_debug) { |
602 | printk(KERN_INFO "early_iounmap(%p, %08lx) [%d]\n", addr, | 626 | printk(KERN_INFO "early_iounmap(%p, %08lx) [%d]\n", addr, |