diff options
Diffstat (limited to 'arch/x86/mm/ioremap.c')
| -rw-r--r-- | arch/x86/mm/ioremap.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index f45d5e29a72e..aca924a30ee6 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c | |||
| @@ -38,8 +38,7 @@ unsigned long __phys_addr(unsigned long x) | |||
| 38 | } else { | 38 | } else { |
| 39 | VIRTUAL_BUG_ON(x < PAGE_OFFSET); | 39 | VIRTUAL_BUG_ON(x < PAGE_OFFSET); |
| 40 | x -= PAGE_OFFSET; | 40 | x -= PAGE_OFFSET; |
| 41 | VIRTUAL_BUG_ON(system_state == SYSTEM_BOOTING ? x > MAXMEM : | 41 | VIRTUAL_BUG_ON(!phys_addr_valid(x)); |
| 42 | !phys_addr_valid(x)); | ||
| 43 | } | 42 | } |
| 44 | return x; | 43 | return x; |
| 45 | } | 44 | } |
| @@ -56,10 +55,8 @@ bool __virt_addr_valid(unsigned long x) | |||
| 56 | if (x < PAGE_OFFSET) | 55 | if (x < PAGE_OFFSET) |
| 57 | return false; | 56 | return false; |
| 58 | x -= PAGE_OFFSET; | 57 | x -= PAGE_OFFSET; |
| 59 | if (system_state == SYSTEM_BOOTING ? | 58 | if (!phys_addr_valid(x)) |
| 60 | x > MAXMEM : !phys_addr_valid(x)) { | ||
| 61 | return false; | 59 | return false; |
| 62 | } | ||
| 63 | } | 60 | } |
| 64 | 61 | ||
| 65 | return pfn_valid(x >> PAGE_SHIFT); | 62 | return pfn_valid(x >> PAGE_SHIFT); |
| @@ -76,10 +73,9 @@ static inline int phys_addr_valid(unsigned long addr) | |||
| 76 | #ifdef CONFIG_DEBUG_VIRTUAL | 73 | #ifdef CONFIG_DEBUG_VIRTUAL |
| 77 | unsigned long __phys_addr(unsigned long x) | 74 | unsigned long __phys_addr(unsigned long x) |
| 78 | { | 75 | { |
| 79 | /* VMALLOC_* aren't constants; not available at the boot time */ | 76 | /* VMALLOC_* aren't constants */ |
| 80 | VIRTUAL_BUG_ON(x < PAGE_OFFSET); | 77 | VIRTUAL_BUG_ON(x < PAGE_OFFSET); |
| 81 | VIRTUAL_BUG_ON(system_state != SYSTEM_BOOTING && | 78 | VIRTUAL_BUG_ON(__vmalloc_start_set && is_vmalloc_addr((void *) x)); |
| 82 | is_vmalloc_addr((void *) x)); | ||
| 83 | return x - PAGE_OFFSET; | 79 | return x - PAGE_OFFSET; |
| 84 | } | 80 | } |
| 85 | EXPORT_SYMBOL(__phys_addr); | 81 | EXPORT_SYMBOL(__phys_addr); |
| @@ -89,7 +85,9 @@ bool __virt_addr_valid(unsigned long x) | |||
| 89 | { | 85 | { |
| 90 | if (x < PAGE_OFFSET) | 86 | if (x < PAGE_OFFSET) |
| 91 | return false; | 87 | return false; |
| 92 | if (system_state != SYSTEM_BOOTING && is_vmalloc_addr((void *) x)) | 88 | if (__vmalloc_start_set && is_vmalloc_addr((void *) x)) |
| 89 | return false; | ||
| 90 | if (x >= FIXADDR_START) | ||
| 93 | return false; | 91 | return false; |
| 94 | return pfn_valid((x - PAGE_OFFSET) >> PAGE_SHIFT); | 92 | return pfn_valid((x - PAGE_OFFSET) >> PAGE_SHIFT); |
| 95 | } | 93 | } |
| @@ -348,7 +346,7 @@ EXPORT_SYMBOL(ioremap_nocache); | |||
| 348 | * | 346 | * |
| 349 | * Must be freed with iounmap. | 347 | * Must be freed with iounmap. |
| 350 | */ | 348 | */ |
| 351 | void __iomem *ioremap_wc(unsigned long phys_addr, unsigned long size) | 349 | void __iomem *ioremap_wc(resource_size_t phys_addr, unsigned long size) |
| 352 | { | 350 | { |
| 353 | if (pat_enabled) | 351 | if (pat_enabled) |
| 354 | return __ioremap_caller(phys_addr, size, _PAGE_CACHE_WC, | 352 | return __ioremap_caller(phys_addr, size, _PAGE_CACHE_WC, |
| @@ -508,13 +506,19 @@ static inline pte_t * __init early_ioremap_pte(unsigned long addr) | |||
| 508 | return &bm_pte[pte_index(addr)]; | 506 | return &bm_pte[pte_index(addr)]; |
| 509 | } | 507 | } |
| 510 | 508 | ||
| 509 | static unsigned long slot_virt[FIX_BTMAPS_SLOTS] __initdata; | ||
| 510 | |||
| 511 | void __init early_ioremap_init(void) | 511 | void __init early_ioremap_init(void) |
| 512 | { | 512 | { |
| 513 | pmd_t *pmd; | 513 | pmd_t *pmd; |
| 514 | int i; | ||
| 514 | 515 | ||
| 515 | if (early_ioremap_debug) | 516 | if (early_ioremap_debug) |
| 516 | printk(KERN_INFO "early_ioremap_init()\n"); | 517 | printk(KERN_INFO "early_ioremap_init()\n"); |
| 517 | 518 | ||
| 519 | for (i = 0; i < FIX_BTMAPS_SLOTS; i++) | ||
| 520 | slot_virt[i] = fix_to_virt(FIX_BTMAP_BEGIN - NR_FIX_BTMAPS*i); | ||
| 521 | |||
| 518 | pmd = early_ioremap_pmd(fix_to_virt(FIX_BTMAP_BEGIN)); | 522 | pmd = early_ioremap_pmd(fix_to_virt(FIX_BTMAP_BEGIN)); |
| 519 | memset(bm_pte, 0, sizeof(bm_pte)); | 523 | memset(bm_pte, 0, sizeof(bm_pte)); |
| 520 | pmd_populate_kernel(&init_mm, pmd, bm_pte); | 524 | pmd_populate_kernel(&init_mm, pmd, bm_pte); |
| @@ -581,6 +585,7 @@ static inline void __init early_clear_fixmap(enum fixed_addresses idx) | |||
| 581 | 585 | ||
| 582 | static void __iomem *prev_map[FIX_BTMAPS_SLOTS] __initdata; | 586 | static void __iomem *prev_map[FIX_BTMAPS_SLOTS] __initdata; |
| 583 | static unsigned long prev_size[FIX_BTMAPS_SLOTS] __initdata; | 587 | static unsigned long prev_size[FIX_BTMAPS_SLOTS] __initdata; |
| 588 | |||
| 584 | static int __init check_early_ioremap_leak(void) | 589 | static int __init check_early_ioremap_leak(void) |
| 585 | { | 590 | { |
| 586 | int count = 0; | 591 | int count = 0; |
| @@ -602,7 +607,8 @@ static int __init check_early_ioremap_leak(void) | |||
| 602 | } | 607 | } |
| 603 | late_initcall(check_early_ioremap_leak); | 608 | late_initcall(check_early_ioremap_leak); |
| 604 | 609 | ||
| 605 | static void __init __iomem *__early_ioremap(unsigned long phys_addr, unsigned long size, pgprot_t prot) | 610 | static void __init __iomem * |
| 611 | __early_ioremap(unsigned long phys_addr, unsigned long size, pgprot_t prot) | ||
| 606 | { | 612 | { |
| 607 | unsigned long offset, last_addr; | 613 | unsigned long offset, last_addr; |
| 608 | unsigned int nrpages; | 614 | unsigned int nrpages; |
| @@ -668,9 +674,9 @@ static void __init __iomem *__early_ioremap(unsigned long phys_addr, unsigned lo | |||
| 668 | --nrpages; | 674 | --nrpages; |
| 669 | } | 675 | } |
| 670 | if (early_ioremap_debug) | 676 | if (early_ioremap_debug) |
| 671 | printk(KERN_CONT "%08lx + %08lx\n", offset, fix_to_virt(idx0)); | 677 | printk(KERN_CONT "%08lx + %08lx\n", offset, slot_virt[slot]); |
| 672 | 678 | ||
| 673 | prev_map[slot] = (void __iomem *)(offset + fix_to_virt(idx0)); | 679 | prev_map[slot] = (void __iomem *)(offset + slot_virt[slot]); |
| 674 | return prev_map[slot]; | 680 | return prev_map[slot]; |
| 675 | } | 681 | } |
| 676 | 682 | ||
| @@ -738,8 +744,3 @@ void __init early_iounmap(void __iomem *addr, unsigned long size) | |||
| 738 | } | 744 | } |
| 739 | prev_map[slot] = NULL; | 745 | prev_map[slot] = NULL; |
| 740 | } | 746 | } |
| 741 | |||
| 742 | void __this_fixmap_does_not_exist(void) | ||
| 743 | { | ||
| 744 | WARN_ON(1); | ||
| 745 | } | ||
