From ab401c154c04f1e89dafe9ef9d1f198cea9feeca Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Wed, 30 Jan 2008 13:33:45 +0100 Subject: [PATCH] --- yaml --- r: 80447 b: refs/heads/master c: 1b42f51630c7eebce6fb780b480731eb81afd325 h: refs/heads/master i: 80445: 99432fffa05fcaa5e0466ec6b7eb2d5a025fd77b 80443: 8a12abbb09e666fc79d75f1258205980b3b8ad7c 80439: 3b783a39afe3a101c7b611c0e2a80380574de556 80431: 49ffdf06ff400e1ded57287459d3993371828b9f 80415: a012f6411f3f092f154a5650536df95f0b7b060b 80383: e13e23c6e7cdde50b1ecc2e62f8eb5ff2d816170 v: v3 --- [refs] | 2 +- trunk/arch/x86/mm/ioremap_32.c | 36 ++++++++++++++++++++++--------- trunk/include/asm-x86/fixmap_32.h | 9 ++++---- 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/[refs] b/[refs] index 84748fede58b..b7e49a2137c4 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 64a8f852a20e90bf3018d3ace5b7f514f39db4cd +refs/heads/master: 1b42f51630c7eebce6fb780b480731eb81afd325 diff --git a/trunk/arch/x86/mm/ioremap_32.c b/trunk/arch/x86/mm/ioremap_32.c index bfd7b8b2fe60..63f76ecae44c 100644 --- a/trunk/arch/x86/mm/ioremap_32.c +++ b/trunk/arch/x86/mm/ioremap_32.c @@ -291,23 +291,28 @@ static inline void __init early_clear_fixmap(enum fixed_addresses idx) __early_set_fixmap(idx, 0, __pgprot(0)); } + +int __initdata early_ioremap_nested; + void __init *early_ioremap(unsigned long phys_addr, unsigned long size) { unsigned long offset, last_addr; - unsigned int nrpages; - enum fixed_addresses idx; + unsigned int nrpages, nesting; + enum fixed_addresses idx0, idx; + + WARN_ON(system_state != SYSTEM_BOOTING); + + nesting = early_ioremap_nested; /* Don't allow wraparound or zero size */ last_addr = phys_addr + size - 1; if (!size || last_addr < phys_addr) return NULL; - /* - * Don't remap the low PCI/ISA area, it's always mapped.. - */ - if (phys_addr >= ISA_START_ADDRESS && last_addr < ISA_END_ADDRESS) - return phys_to_virt(phys_addr); + if (nesting >= FIX_BTMAPS_NESTING) + return NULL; + early_ioremap_nested++; /* * Mappings have to be page-aligned */ @@ -325,14 +330,16 @@ void __init *early_ioremap(unsigned long phys_addr, unsigned long size) /* * Ok, go for it.. */ - idx = FIX_BTMAP_BEGIN; + idx0 = FIX_BTMAP_BEGIN - NR_FIX_BTMAPS*nesting; + idx = idx0; while (nrpages > 0) { early_set_fixmap(idx, phys_addr); phys_addr += PAGE_SIZE; --idx; --nrpages; } - return (void*) (offset + fix_to_virt(FIX_BTMAP_BEGIN)); + + return (void*) (offset + fix_to_virt(idx0)); } void __init early_iounmap(void *addr, unsigned long size) @@ -341,17 +348,26 @@ void __init early_iounmap(void *addr, unsigned long size) unsigned long offset; unsigned int nrpages; enum fixed_addresses idx; + unsigned int nesting; + + nesting = --early_ioremap_nested; virt_addr = (unsigned long)addr; if (virt_addr < fix_to_virt(FIX_BTMAP_BEGIN)) return; + offset = virt_addr & ~PAGE_MASK; nrpages = PAGE_ALIGN(offset + size - 1) >> PAGE_SHIFT; - idx = FIX_BTMAP_BEGIN; + idx = FIX_BTMAP_BEGIN - NR_FIX_BTMAPS*nesting; while (nrpages > 0) { early_clear_fixmap(idx); --idx; --nrpages; } } + +void __this_fixmap_does_not_exist(void) +{ + WARN_ON(1); +} diff --git a/trunk/include/asm-x86/fixmap_32.h b/trunk/include/asm-x86/fixmap_32.h index 249e753ac805..0e990218a09c 100644 --- a/trunk/include/asm-x86/fixmap_32.h +++ b/trunk/include/asm-x86/fixmap_32.h @@ -65,7 +65,7 @@ enum fixed_addresses { #endif #ifdef CONFIG_X86_VISWS_APIC FIX_CO_CPU, /* Cobalt timer */ - FIX_CO_APIC, /* Cobalt APIC Redirection Table */ + FIX_CO_APIC, /* Cobalt APIC Redirection Table */ FIX_LI_PCIA, /* Lithium PCI Bridge A */ FIX_LI_PCIB, /* Lithium PCI Bridge B */ #endif @@ -74,7 +74,7 @@ enum fixed_addresses { #endif #ifdef CONFIG_X86_CYCLONE_TIMER FIX_CYCLONE_TIMER, /*cyclone timer register*/ -#endif +#endif #ifdef CONFIG_HIGHMEM FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */ FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1, @@ -91,9 +91,10 @@ enum fixed_addresses { #endif __end_of_permanent_fixed_addresses, /* temporary boot-time mappings, used before ioremap() is functional */ -#define NR_FIX_BTMAPS 16 +#define NR_FIX_BTMAPS 16 +#define FIX_BTMAPS_NESTING 4 FIX_BTMAP_END = __end_of_permanent_fixed_addresses, - FIX_BTMAP_BEGIN = FIX_BTMAP_END + NR_FIX_BTMAPS - 1, + FIX_BTMAP_BEGIN = FIX_BTMAP_END + NR_FIX_BTMAPS*FIX_BTMAPS_NESTING - 1, FIX_WP_TEST, __end_of_fixed_addresses };