aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/mm/ioremap_32.c36
-rw-r--r--include/asm-x86/fixmap_32.h9
2 files changed, 31 insertions, 14 deletions
diff --git a/arch/x86/mm/ioremap_32.c b/arch/x86/mm/ioremap_32.c
index bfd7b8b2fe60..63f76ecae44c 100644
--- a/arch/x86/mm/ioremap_32.c
+++ b/arch/x86/mm/ioremap_32.c
@@ -291,23 +291,28 @@ static inline void __init early_clear_fixmap(enum fixed_addresses idx)
291 __early_set_fixmap(idx, 0, __pgprot(0)); 291 __early_set_fixmap(idx, 0, __pgprot(0));
292} 292}
293 293
294
295int __initdata early_ioremap_nested;
296
294void __init *early_ioremap(unsigned long phys_addr, unsigned long size) 297void __init *early_ioremap(unsigned long phys_addr, unsigned long size)
295{ 298{
296 unsigned long offset, last_addr; 299 unsigned long offset, last_addr;
297 unsigned int nrpages; 300 unsigned int nrpages, nesting;
298 enum fixed_addresses idx; 301 enum fixed_addresses idx0, idx;
302
303 WARN_ON(system_state != SYSTEM_BOOTING);
304
305 nesting = early_ioremap_nested;
299 306
300 /* Don't allow wraparound or zero size */ 307 /* Don't allow wraparound or zero size */
301 last_addr = phys_addr + size - 1; 308 last_addr = phys_addr + size - 1;
302 if (!size || last_addr < phys_addr) 309 if (!size || last_addr < phys_addr)
303 return NULL; 310 return NULL;
304 311
305 /* 312 if (nesting >= FIX_BTMAPS_NESTING)
306 * Don't remap the low PCI/ISA area, it's always mapped.. 313 return NULL;
307 */
308 if (phys_addr >= ISA_START_ADDRESS && last_addr < ISA_END_ADDRESS)
309 return phys_to_virt(phys_addr);
310 314
315 early_ioremap_nested++;
311 /* 316 /*
312 * Mappings have to be page-aligned 317 * Mappings have to be page-aligned
313 */ 318 */
@@ -325,14 +330,16 @@ void __init *early_ioremap(unsigned long phys_addr, unsigned long size)
325 /* 330 /*
326 * Ok, go for it.. 331 * Ok, go for it..
327 */ 332 */
328 idx = FIX_BTMAP_BEGIN; 333 idx0 = FIX_BTMAP_BEGIN - NR_FIX_BTMAPS*nesting;
334 idx = idx0;
329 while (nrpages > 0) { 335 while (nrpages > 0) {
330 early_set_fixmap(idx, phys_addr); 336 early_set_fixmap(idx, phys_addr);
331 phys_addr += PAGE_SIZE; 337 phys_addr += PAGE_SIZE;
332 --idx; 338 --idx;
333 --nrpages; 339 --nrpages;
334 } 340 }
335 return (void*) (offset + fix_to_virt(FIX_BTMAP_BEGIN)); 341
342 return (void*) (offset + fix_to_virt(idx0));
336} 343}
337 344
338void __init early_iounmap(void *addr, unsigned long size) 345void __init early_iounmap(void *addr, unsigned long size)
@@ -341,17 +348,26 @@ void __init early_iounmap(void *addr, unsigned long size)
341 unsigned long offset; 348 unsigned long offset;
342 unsigned int nrpages; 349 unsigned int nrpages;
343 enum fixed_addresses idx; 350 enum fixed_addresses idx;
351 unsigned int nesting;
352
353 nesting = --early_ioremap_nested;
344 354
345 virt_addr = (unsigned long)addr; 355 virt_addr = (unsigned long)addr;
346 if (virt_addr < fix_to_virt(FIX_BTMAP_BEGIN)) 356 if (virt_addr < fix_to_virt(FIX_BTMAP_BEGIN))
347 return; 357 return;
358
348 offset = virt_addr & ~PAGE_MASK; 359 offset = virt_addr & ~PAGE_MASK;
349 nrpages = PAGE_ALIGN(offset + size - 1) >> PAGE_SHIFT; 360 nrpages = PAGE_ALIGN(offset + size - 1) >> PAGE_SHIFT;
350 361
351 idx = FIX_BTMAP_BEGIN; 362 idx = FIX_BTMAP_BEGIN - NR_FIX_BTMAPS*nesting;
352 while (nrpages > 0) { 363 while (nrpages > 0) {
353 early_clear_fixmap(idx); 364 early_clear_fixmap(idx);
354 --idx; 365 --idx;
355 --nrpages; 366 --nrpages;
356 } 367 }
357} 368}
369
370void __this_fixmap_does_not_exist(void)
371{
372 WARN_ON(1);
373}
diff --git a/include/asm-x86/fixmap_32.h b/include/asm-x86/fixmap_32.h
index 249e753ac805..0e990218a09c 100644
--- a/include/asm-x86/fixmap_32.h
+++ b/include/asm-x86/fixmap_32.h
@@ -65,7 +65,7 @@ enum fixed_addresses {
65#endif 65#endif
66#ifdef CONFIG_X86_VISWS_APIC 66#ifdef CONFIG_X86_VISWS_APIC
67 FIX_CO_CPU, /* Cobalt timer */ 67 FIX_CO_CPU, /* Cobalt timer */
68 FIX_CO_APIC, /* Cobalt APIC Redirection Table */ 68 FIX_CO_APIC, /* Cobalt APIC Redirection Table */
69 FIX_LI_PCIA, /* Lithium PCI Bridge A */ 69 FIX_LI_PCIA, /* Lithium PCI Bridge A */
70 FIX_LI_PCIB, /* Lithium PCI Bridge B */ 70 FIX_LI_PCIB, /* Lithium PCI Bridge B */
71#endif 71#endif
@@ -74,7 +74,7 @@ enum fixed_addresses {
74#endif 74#endif
75#ifdef CONFIG_X86_CYCLONE_TIMER 75#ifdef CONFIG_X86_CYCLONE_TIMER
76 FIX_CYCLONE_TIMER, /*cyclone timer register*/ 76 FIX_CYCLONE_TIMER, /*cyclone timer register*/
77#endif 77#endif
78#ifdef CONFIG_HIGHMEM 78#ifdef CONFIG_HIGHMEM
79 FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */ 79 FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */
80 FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1, 80 FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
@@ -91,9 +91,10 @@ enum fixed_addresses {
91#endif 91#endif
92 __end_of_permanent_fixed_addresses, 92 __end_of_permanent_fixed_addresses,
93 /* temporary boot-time mappings, used before ioremap() is functional */ 93 /* temporary boot-time mappings, used before ioremap() is functional */
94#define NR_FIX_BTMAPS 16 94#define NR_FIX_BTMAPS 16
95#define FIX_BTMAPS_NESTING 4
95 FIX_BTMAP_END = __end_of_permanent_fixed_addresses, 96 FIX_BTMAP_END = __end_of_permanent_fixed_addresses,
96 FIX_BTMAP_BEGIN = FIX_BTMAP_END + NR_FIX_BTMAPS - 1, 97 FIX_BTMAP_BEGIN = FIX_BTMAP_END + NR_FIX_BTMAPS*FIX_BTMAPS_NESTING - 1,
97 FIX_WP_TEST, 98 FIX_WP_TEST,
98 __end_of_fixed_addresses 99 __end_of_fixed_addresses
99}; 100};