x86, mm: Include the entire kernel memory map in trampoline_pgd
[deliverable/linux.git] / arch / x86 / mm / ioremap.c
1 /*
2 * Re-map IO memory to kernel address space so that we can access it.
3 * This is needed for high PCI addresses that aren't mapped in the
4 * 640k-1MB IO memory area on PC's
5 *
6 * (C) Copyright 1995 1996 Linus Torvalds
7 */
8
9 #include <linux/bootmem.h>
10 #include <linux/init.h>
11 #include <linux/io.h>
12 #include <linux/module.h>
13 #include <linux/slab.h>
14 #include <linux/vmalloc.h>
15 #include <linux/mmiotrace.h>
16
17 #include <asm/cacheflush.h>
18 #include <asm/e820.h>
19 #include <asm/fixmap.h>
20 #include <asm/pgtable.h>
21 #include <asm/tlbflush.h>
22 #include <asm/pgalloc.h>
23 #include <asm/pat.h>
24
25 #include "physaddr.h"
26
27 /*
28 * Fix up the linear direct mapping of the kernel to avoid cache attribute
29 * conflicts.
30 */
31 int ioremap_change_attr(unsigned long vaddr, unsigned long size,
32 unsigned long prot_val)
33 {
34 unsigned long nrpages = size >> PAGE_SHIFT;
35 int err;
36
37 switch (prot_val) {
38 case _PAGE_CACHE_UC:
39 default:
40 err = _set_memory_uc(vaddr, nrpages);
41 break;
42 case _PAGE_CACHE_WC:
43 err = _set_memory_wc(vaddr, nrpages);
44 break;
45 case _PAGE_CACHE_WB:
46 err = _set_memory_wb(vaddr, nrpages);
47 break;
48 }
49
50 return err;
51 }
52
53 #ifdef CONFIG_X86_64
54 static void ident_pte_range(unsigned long paddr, unsigned long vaddr,
55 pmd_t *ppmd, pmd_t *vpmd, unsigned long end)
56 {
57 pte_t *ppte = pte_offset_kernel(ppmd, paddr);
58 pte_t *vpte = pte_offset_kernel(vpmd, vaddr);
59
60 do {
61 set_pte(ppte, *vpte);
62 } while (ppte++, vpte++, vaddr += PAGE_SIZE, vaddr != end);
63 }
64
65 static int ident_pmd_range(unsigned long paddr, unsigned long vaddr,
66 pud_t *ppud, pud_t *vpud, unsigned long end)
67 {
68 pmd_t *ppmd = pmd_offset(ppud, paddr);
69 pmd_t *vpmd = pmd_offset(vpud, vaddr);
70 unsigned long next;
71
72 do {
73 next = pmd_addr_end(vaddr, end);
74
75 if (!pmd_present(*ppmd)) {
76 pte_t *ppte = (pte_t *)get_zeroed_page(GFP_KERNEL);
77 if (!ppte)
78 return 1;
79
80 set_pmd(ppmd, __pmd(_KERNPG_TABLE | __pa(ppte)));
81 }
82
83 ident_pte_range(paddr, vaddr, ppmd, vpmd, next);
84 } while (ppmd++, vpmd++, vaddr = next, vaddr != end);
85
86 return 0;
87 }
88
89 static int ident_pud_range(unsigned long paddr, unsigned long vaddr,
90 pgd_t *ppgd, pgd_t *vpgd, unsigned long end)
91 {
92 pud_t *ppud = pud_offset(ppgd, paddr);
93 pud_t *vpud = pud_offset(vpgd, vaddr);
94 unsigned long next;
95
96 do {
97 next = pud_addr_end(vaddr, end);
98
99 if (!pud_present(*ppud)) {
100 pmd_t *ppmd = (pmd_t *)get_zeroed_page(GFP_KERNEL);
101 if (!ppmd)
102 return 1;
103
104 set_pud(ppud, __pud(_KERNPG_TABLE | __pa(ppmd)));
105 }
106
107 if (ident_pmd_range(paddr, vaddr, ppud, vpud, next))
108 return 1;
109 } while (ppud++, vpud++, vaddr = next, vaddr != end);
110
111 return 0;
112 }
113
114 static int insert_identity_mapping(resource_size_t paddr, unsigned long vaddr,
115 unsigned long size)
116 {
117 unsigned long end = vaddr + size;
118 unsigned long next;
119 pgd_t *vpgd, *ppgd;
120
121 /* Don't map over the guard hole. */
122 if (paddr >= 0x800000000000 || paddr + size > 0x800000000000)
123 return 1;
124
125 ppgd = __va(real_mode_header->trampoline_pgd) + pgd_index(paddr);
126
127 vpgd = pgd_offset_k(vaddr);
128 do {
129 next = pgd_addr_end(vaddr, end);
130
131 if (!pgd_present(*ppgd)) {
132 pud_t *ppud = (pud_t *)get_zeroed_page(GFP_KERNEL);
133 if (!ppud)
134 return 1;
135
136 set_pgd(ppgd, __pgd(_KERNPG_TABLE | __pa(ppud)));
137 }
138
139 if (ident_pud_range(paddr, vaddr, ppgd, vpgd, next))
140 return 1;
141 } while (ppgd++, vpgd++, vaddr = next, vaddr != end);
142
143 return 0;
144 }
145 #else
146 static inline int insert_identity_mapping(resource_size_t paddr,
147 unsigned long vaddr,
148 unsigned long size)
149 {
150 return 0;
151 }
152 #endif /* CONFIG_X86_64 */
153
154 /*
155 * Remap an arbitrary physical address space into the kernel virtual
156 * address space. Needed when the kernel wants to access high addresses
157 * directly.
158 *
159 * NOTE! We need to allow non-page-aligned mappings too: we will obviously
160 * have to convert them into an offset in a page-aligned mapping, but the
161 * caller shouldn't need to know that small detail.
162 */
163 static void __iomem *__ioremap_caller(resource_size_t phys_addr,
164 unsigned long size, unsigned long prot_val, void *caller)
165 {
166 unsigned long offset, vaddr;
167 resource_size_t pfn, last_pfn, last_addr;
168 const resource_size_t unaligned_phys_addr = phys_addr;
169 const unsigned long unaligned_size = size;
170 struct vm_struct *area;
171 unsigned long new_prot_val;
172 pgprot_t prot;
173 int retval;
174 void __iomem *ret_addr;
175
176 /* Don't allow wraparound or zero size */
177 last_addr = phys_addr + size - 1;
178 if (!size || last_addr < phys_addr)
179 return NULL;
180
181 if (!phys_addr_valid(phys_addr)) {
182 printk(KERN_WARNING "ioremap: invalid physical address %llx\n",
183 (unsigned long long)phys_addr);
184 WARN_ON_ONCE(1);
185 return NULL;
186 }
187
188 /*
189 * Don't remap the low PCI/ISA area, it's always mapped..
190 */
191 if (is_ISA_range(phys_addr, last_addr))
192 return (__force void __iomem *)phys_to_virt(phys_addr);
193
194 /*
195 * Don't allow anybody to remap normal RAM that we're using..
196 */
197 last_pfn = last_addr >> PAGE_SHIFT;
198 for (pfn = phys_addr >> PAGE_SHIFT; pfn <= last_pfn; pfn++) {
199 int is_ram = page_is_ram(pfn);
200
201 if (is_ram && pfn_valid(pfn) && !PageReserved(pfn_to_page(pfn)))
202 return NULL;
203 WARN_ON_ONCE(is_ram);
204 }
205
206 /*
207 * Mappings have to be page-aligned
208 */
209 offset = phys_addr & ~PAGE_MASK;
210 phys_addr &= PHYSICAL_PAGE_MASK;
211 size = PAGE_ALIGN(last_addr+1) - phys_addr;
212
213 retval = reserve_memtype(phys_addr, (u64)phys_addr + size,
214 prot_val, &new_prot_val);
215 if (retval) {
216 printk(KERN_ERR "ioremap reserve_memtype failed %d\n", retval);
217 return NULL;
218 }
219
220 if (prot_val != new_prot_val) {
221 if (!is_new_memtype_allowed(phys_addr, size,
222 prot_val, new_prot_val)) {
223 printk(KERN_ERR
224 "ioremap error for 0x%llx-0x%llx, requested 0x%lx, got 0x%lx\n",
225 (unsigned long long)phys_addr,
226 (unsigned long long)(phys_addr + size),
227 prot_val, new_prot_val);
228 goto err_free_memtype;
229 }
230 prot_val = new_prot_val;
231 }
232
233 switch (prot_val) {
234 case _PAGE_CACHE_UC:
235 default:
236 prot = PAGE_KERNEL_IO_NOCACHE;
237 break;
238 case _PAGE_CACHE_UC_MINUS:
239 prot = PAGE_KERNEL_IO_UC_MINUS;
240 break;
241 case _PAGE_CACHE_WC:
242 prot = PAGE_KERNEL_IO_WC;
243 break;
244 case _PAGE_CACHE_WB:
245 prot = PAGE_KERNEL_IO;
246 break;
247 }
248
249 /*
250 * Ok, go for it..
251 */
252 area = get_vm_area_caller(size, VM_IOREMAP, caller);
253 if (!area)
254 goto err_free_memtype;
255 area->phys_addr = phys_addr;
256 vaddr = (unsigned long) area->addr;
257
258 if (kernel_map_sync_memtype(phys_addr, size, prot_val))
259 goto err_free_area;
260
261 if (ioremap_page_range(vaddr, vaddr + size, phys_addr, prot))
262 goto err_free_area;
263
264 ret_addr = (void __iomem *) (vaddr + offset);
265 mmiotrace_ioremap(unaligned_phys_addr, unaligned_size, ret_addr);
266
267 if (insert_identity_mapping(phys_addr, vaddr, size))
268 printk(KERN_WARNING "ioremap: unable to map 0x%llx in identity pagetable\n",
269 (unsigned long long)phys_addr);
270
271 /*
272 * Check if the request spans more than any BAR in the iomem resource
273 * tree.
274 */
275 WARN_ONCE(iomem_map_sanity_check(unaligned_phys_addr, unaligned_size),
276 KERN_INFO "Info: mapping multiple BARs. Your kernel is fine.");
277
278 return ret_addr;
279 err_free_area:
280 free_vm_area(area);
281 err_free_memtype:
282 free_memtype(phys_addr, phys_addr + size);
283 return NULL;
284 }
285
286 /**
287 * ioremap_nocache - map bus memory into CPU space
288 * @phys_addr: bus address of the memory
289 * @size: size of the resource to map
290 *
291 * ioremap_nocache performs a platform specific sequence of operations to
292 * make bus memory CPU accessible via the readb/readw/readl/writeb/
293 * writew/writel functions and the other mmio helpers. The returned
294 * address is not guaranteed to be usable directly as a virtual
295 * address.
296 *
297 * This version of ioremap ensures that the memory is marked uncachable
298 * on the CPU as well as honouring existing caching rules from things like
299 * the PCI bus. Note that there are other caches and buffers on many
300 * busses. In particular driver authors should read up on PCI writes
301 *
302 * It's useful if some control registers are in such an area and
303 * write combining or read caching is not desirable:
304 *
305 * Must be freed with iounmap.
306 */
307 void __iomem *ioremap_nocache(resource_size_t phys_addr, unsigned long size)
308 {
309 /*
310 * Ideally, this should be:
311 * pat_enabled ? _PAGE_CACHE_UC : _PAGE_CACHE_UC_MINUS;
312 *
313 * Till we fix all X drivers to use ioremap_wc(), we will use
314 * UC MINUS.
315 */
316 unsigned long val = _PAGE_CACHE_UC_MINUS;
317
318 return __ioremap_caller(phys_addr, size, val,
319 __builtin_return_address(0));
320 }
321 EXPORT_SYMBOL(ioremap_nocache);
322
323 /**
324 * ioremap_wc - map memory into CPU space write combined
325 * @phys_addr: bus address of the memory
326 * @size: size of the resource to map
327 *
328 * This version of ioremap ensures that the memory is marked write combining.
329 * Write combining allows faster writes to some hardware devices.
330 *
331 * Must be freed with iounmap.
332 */
333 void __iomem *ioremap_wc(resource_size_t phys_addr, unsigned long size)
334 {
335 if (pat_enabled)
336 return __ioremap_caller(phys_addr, size, _PAGE_CACHE_WC,
337 __builtin_return_address(0));
338 else
339 return ioremap_nocache(phys_addr, size);
340 }
341 EXPORT_SYMBOL(ioremap_wc);
342
343 void __iomem *ioremap_cache(resource_size_t phys_addr, unsigned long size)
344 {
345 return __ioremap_caller(phys_addr, size, _PAGE_CACHE_WB,
346 __builtin_return_address(0));
347 }
348 EXPORT_SYMBOL(ioremap_cache);
349
350 void __iomem *ioremap_prot(resource_size_t phys_addr, unsigned long size,
351 unsigned long prot_val)
352 {
353 return __ioremap_caller(phys_addr, size, (prot_val & _PAGE_CACHE_MASK),
354 __builtin_return_address(0));
355 }
356 EXPORT_SYMBOL(ioremap_prot);
357
358 /**
359 * iounmap - Free a IO remapping
360 * @addr: virtual address from ioremap_*
361 *
362 * Caller must ensure there is only one unmapping for the same pointer.
363 */
364 void iounmap(volatile void __iomem *addr)
365 {
366 struct vm_struct *p, *o;
367
368 if ((void __force *)addr <= high_memory)
369 return;
370
371 /*
372 * __ioremap special-cases the PCI/ISA range by not instantiating a
373 * vm_area and by simply returning an address into the kernel mapping
374 * of ISA space. So handle that here.
375 */
376 if ((void __force *)addr >= phys_to_virt(ISA_START_ADDRESS) &&
377 (void __force *)addr < phys_to_virt(ISA_END_ADDRESS))
378 return;
379
380 addr = (volatile void __iomem *)
381 (PAGE_MASK & (unsigned long __force)addr);
382
383 mmiotrace_iounmap(addr);
384
385 /* Use the vm area unlocked, assuming the caller
386 ensures there isn't another iounmap for the same address
387 in parallel. Reuse of the virtual address is prevented by
388 leaving it in the global lists until we're done with it.
389 cpa takes care of the direct mappings. */
390 read_lock(&vmlist_lock);
391 for (p = vmlist; p; p = p->next) {
392 if (p->addr == (void __force *)addr)
393 break;
394 }
395 read_unlock(&vmlist_lock);
396
397 if (!p) {
398 printk(KERN_ERR "iounmap: bad address %p\n", addr);
399 dump_stack();
400 return;
401 }
402
403 free_memtype(p->phys_addr, p->phys_addr + get_vm_area_size(p));
404
405 /* Finally remove it */
406 o = remove_vm_area((void __force *)addr);
407 BUG_ON(p != o || o == NULL);
408 kfree(p);
409 }
410 EXPORT_SYMBOL(iounmap);
411
412 /*
413 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
414 * access
415 */
416 void *xlate_dev_mem_ptr(unsigned long phys)
417 {
418 void *addr;
419 unsigned long start = phys & PAGE_MASK;
420
421 /* If page is RAM, we can use __va. Otherwise ioremap and unmap. */
422 if (page_is_ram(start >> PAGE_SHIFT))
423 return __va(phys);
424
425 addr = (void __force *)ioremap_cache(start, PAGE_SIZE);
426 if (addr)
427 addr = (void *)((unsigned long)addr | (phys & ~PAGE_MASK));
428
429 return addr;
430 }
431
432 void unxlate_dev_mem_ptr(unsigned long phys, void *addr)
433 {
434 if (page_is_ram(phys >> PAGE_SHIFT))
435 return;
436
437 iounmap((void __iomem *)((unsigned long)addr & PAGE_MASK));
438 return;
439 }
440
441 static int __initdata early_ioremap_debug;
442
443 static int __init early_ioremap_debug_setup(char *str)
444 {
445 early_ioremap_debug = 1;
446
447 return 0;
448 }
449 early_param("early_ioremap_debug", early_ioremap_debug_setup);
450
451 static __initdata int after_paging_init;
452 static pte_t bm_pte[PAGE_SIZE/sizeof(pte_t)] __page_aligned_bss;
453
454 static inline pmd_t * __init early_ioremap_pmd(unsigned long addr)
455 {
456 /* Don't assume we're using swapper_pg_dir at this point */
457 pgd_t *base = __va(read_cr3());
458 pgd_t *pgd = &base[pgd_index(addr)];
459 pud_t *pud = pud_offset(pgd, addr);
460 pmd_t *pmd = pmd_offset(pud, addr);
461
462 return pmd;
463 }
464
465 static inline pte_t * __init early_ioremap_pte(unsigned long addr)
466 {
467 return &bm_pte[pte_index(addr)];
468 }
469
470 bool __init is_early_ioremap_ptep(pte_t *ptep)
471 {
472 return ptep >= &bm_pte[0] && ptep < &bm_pte[PAGE_SIZE/sizeof(pte_t)];
473 }
474
475 static unsigned long slot_virt[FIX_BTMAPS_SLOTS] __initdata;
476
477 void __init early_ioremap_init(void)
478 {
479 pmd_t *pmd;
480 int i;
481
482 if (early_ioremap_debug)
483 printk(KERN_INFO "early_ioremap_init()\n");
484
485 for (i = 0; i < FIX_BTMAPS_SLOTS; i++)
486 slot_virt[i] = __fix_to_virt(FIX_BTMAP_BEGIN - NR_FIX_BTMAPS*i);
487
488 pmd = early_ioremap_pmd(fix_to_virt(FIX_BTMAP_BEGIN));
489 memset(bm_pte, 0, sizeof(bm_pte));
490 pmd_populate_kernel(&init_mm, pmd, bm_pte);
491
492 /*
493 * The boot-ioremap range spans multiple pmds, for which
494 * we are not prepared:
495 */
496 #define __FIXADDR_TOP (-PAGE_SIZE)
497 BUILD_BUG_ON((__fix_to_virt(FIX_BTMAP_BEGIN) >> PMD_SHIFT)
498 != (__fix_to_virt(FIX_BTMAP_END) >> PMD_SHIFT));
499 #undef __FIXADDR_TOP
500 if (pmd != early_ioremap_pmd(fix_to_virt(FIX_BTMAP_END))) {
501 WARN_ON(1);
502 printk(KERN_WARNING "pmd %p != %p\n",
503 pmd, early_ioremap_pmd(fix_to_virt(FIX_BTMAP_END)));
504 printk(KERN_WARNING "fix_to_virt(FIX_BTMAP_BEGIN): %08lx\n",
505 fix_to_virt(FIX_BTMAP_BEGIN));
506 printk(KERN_WARNING "fix_to_virt(FIX_BTMAP_END): %08lx\n",
507 fix_to_virt(FIX_BTMAP_END));
508
509 printk(KERN_WARNING "FIX_BTMAP_END: %d\n", FIX_BTMAP_END);
510 printk(KERN_WARNING "FIX_BTMAP_BEGIN: %d\n",
511 FIX_BTMAP_BEGIN);
512 }
513 }
514
515 void __init early_ioremap_reset(void)
516 {
517 after_paging_init = 1;
518 }
519
520 static void __init __early_set_fixmap(enum fixed_addresses idx,
521 phys_addr_t phys, pgprot_t flags)
522 {
523 unsigned long addr = __fix_to_virt(idx);
524 pte_t *pte;
525
526 if (idx >= __end_of_fixed_addresses) {
527 BUG();
528 return;
529 }
530 pte = early_ioremap_pte(addr);
531
532 if (pgprot_val(flags))
533 set_pte(pte, pfn_pte(phys >> PAGE_SHIFT, flags));
534 else
535 pte_clear(&init_mm, addr, pte);
536 __flush_tlb_one(addr);
537 }
538
539 static inline void __init early_set_fixmap(enum fixed_addresses idx,
540 phys_addr_t phys, pgprot_t prot)
541 {
542 if (after_paging_init)
543 __set_fixmap(idx, phys, prot);
544 else
545 __early_set_fixmap(idx, phys, prot);
546 }
547
548 static inline void __init early_clear_fixmap(enum fixed_addresses idx)
549 {
550 if (after_paging_init)
551 clear_fixmap(idx);
552 else
553 __early_set_fixmap(idx, 0, __pgprot(0));
554 }
555
556 static void __iomem *prev_map[FIX_BTMAPS_SLOTS] __initdata;
557 static unsigned long prev_size[FIX_BTMAPS_SLOTS] __initdata;
558
559 void __init fixup_early_ioremap(void)
560 {
561 int i;
562
563 for (i = 0; i < FIX_BTMAPS_SLOTS; i++) {
564 if (prev_map[i]) {
565 WARN_ON(1);
566 break;
567 }
568 }
569
570 early_ioremap_init();
571 }
572
573 static int __init check_early_ioremap_leak(void)
574 {
575 int count = 0;
576 int i;
577
578 for (i = 0; i < FIX_BTMAPS_SLOTS; i++)
579 if (prev_map[i])
580 count++;
581
582 if (!count)
583 return 0;
584 WARN(1, KERN_WARNING
585 "Debug warning: early ioremap leak of %d areas detected.\n",
586 count);
587 printk(KERN_WARNING
588 "please boot with early_ioremap_debug and report the dmesg.\n");
589
590 return 1;
591 }
592 late_initcall(check_early_ioremap_leak);
593
594 static void __init __iomem *
595 __early_ioremap(resource_size_t phys_addr, unsigned long size, pgprot_t prot)
596 {
597 unsigned long offset;
598 resource_size_t last_addr;
599 unsigned int nrpages;
600 enum fixed_addresses idx0, idx;
601 int i, slot;
602
603 WARN_ON(system_state != SYSTEM_BOOTING);
604
605 slot = -1;
606 for (i = 0; i < FIX_BTMAPS_SLOTS; i++) {
607 if (!prev_map[i]) {
608 slot = i;
609 break;
610 }
611 }
612
613 if (slot < 0) {
614 printk(KERN_INFO "early_iomap(%08llx, %08lx) not found slot\n",
615 (u64)phys_addr, size);
616 WARN_ON(1);
617 return NULL;
618 }
619
620 if (early_ioremap_debug) {
621 printk(KERN_INFO "early_ioremap(%08llx, %08lx) [%d] => ",
622 (u64)phys_addr, size, slot);
623 dump_stack();
624 }
625
626 /* Don't allow wraparound or zero size */
627 last_addr = phys_addr + size - 1;
628 if (!size || last_addr < phys_addr) {
629 WARN_ON(1);
630 return NULL;
631 }
632
633 prev_size[slot] = size;
634 /*
635 * Mappings have to be page-aligned
636 */
637 offset = phys_addr & ~PAGE_MASK;
638 phys_addr &= PAGE_MASK;
639 size = PAGE_ALIGN(last_addr + 1) - phys_addr;
640
641 /*
642 * Mappings have to fit in the FIX_BTMAP area.
643 */
644 nrpages = size >> PAGE_SHIFT;
645 if (nrpages > NR_FIX_BTMAPS) {
646 WARN_ON(1);
647 return NULL;
648 }
649
650 /*
651 * Ok, go for it..
652 */
653 idx0 = FIX_BTMAP_BEGIN - NR_FIX_BTMAPS*slot;
654 idx = idx0;
655 while (nrpages > 0) {
656 early_set_fixmap(idx, phys_addr, prot);
657 phys_addr += PAGE_SIZE;
658 --idx;
659 --nrpages;
660 }
661 if (early_ioremap_debug)
662 printk(KERN_CONT "%08lx + %08lx\n", offset, slot_virt[slot]);
663
664 prev_map[slot] = (void __iomem *)(offset + slot_virt[slot]);
665 return prev_map[slot];
666 }
667
668 /* Remap an IO device */
669 void __init __iomem *
670 early_ioremap(resource_size_t phys_addr, unsigned long size)
671 {
672 return __early_ioremap(phys_addr, size, PAGE_KERNEL_IO);
673 }
674
675 /* Remap memory */
676 void __init __iomem *
677 early_memremap(resource_size_t phys_addr, unsigned long size)
678 {
679 return __early_ioremap(phys_addr, size, PAGE_KERNEL);
680 }
681
682 void __init early_iounmap(void __iomem *addr, unsigned long size)
683 {
684 unsigned long virt_addr;
685 unsigned long offset;
686 unsigned int nrpages;
687 enum fixed_addresses idx;
688 int i, slot;
689
690 slot = -1;
691 for (i = 0; i < FIX_BTMAPS_SLOTS; i++) {
692 if (prev_map[i] == addr) {
693 slot = i;
694 break;
695 }
696 }
697
698 if (slot < 0) {
699 printk(KERN_INFO "early_iounmap(%p, %08lx) not found slot\n",
700 addr, size);
701 WARN_ON(1);
702 return;
703 }
704
705 if (prev_size[slot] != size) {
706 printk(KERN_INFO "early_iounmap(%p, %08lx) [%d] size not consistent %08lx\n",
707 addr, size, slot, prev_size[slot]);
708 WARN_ON(1);
709 return;
710 }
711
712 if (early_ioremap_debug) {
713 printk(KERN_INFO "early_iounmap(%p, %08lx) [%d]\n", addr,
714 size, slot);
715 dump_stack();
716 }
717
718 virt_addr = (unsigned long)addr;
719 if (virt_addr < fix_to_virt(FIX_BTMAP_BEGIN)) {
720 WARN_ON(1);
721 return;
722 }
723 offset = virt_addr & ~PAGE_MASK;
724 nrpages = PAGE_ALIGN(offset + size) >> PAGE_SHIFT;
725
726 idx = FIX_BTMAP_BEGIN - NR_FIX_BTMAPS*slot;
727 while (nrpages > 0) {
728 early_clear_fixmap(idx);
729 --idx;
730 --nrpages;
731 }
732 prev_map[slot] = NULL;
733 }
This page took 0.058289 seconds and 5 git commands to generate.