diff options
Diffstat (limited to 'arch/x86/mm/ioremap_64.c')
-rw-r--r-- | arch/x86/mm/ioremap_64.c | 48 |
1 files changed, 22 insertions, 26 deletions
diff --git a/arch/x86/mm/ioremap_64.c b/arch/x86/mm/ioremap_64.c index a37556124c8..bd962cc636c 100644 --- a/arch/x86/mm/ioremap_64.c +++ b/arch/x86/mm/ioremap_64.c @@ -1,6 +1,4 @@ /* - * arch/x86_64/mm/ioremap.c - * * Re-map IO memory to kernel address space so that we can access it. * This is needed for high PCI addresses that aren't mapped in the * 640k-1MB IO memory area on PC's @@ -33,9 +31,8 @@ EXPORT_SYMBOL(__phys_addr); * Fix up the linear direct mapping of the kernel to avoid cache attribute * conflicts. */ -static int -ioremap_change_attr(unsigned long phys_addr, unsigned long size, - unsigned long flags) +static int ioremap_change_attr(unsigned long phys_addr, unsigned long size, + unsigned long flags) { int err = 0; if (phys_addr + size - 1 < (end_pfn_map << PAGE_SHIFT)) { @@ -50,10 +47,12 @@ ioremap_change_attr(unsigned long phys_addr, unsigned long size, if (!lookup_address(vaddr, &level)) return err; /* - * Must use a address here and not struct page because the phys addr - * can be a in hole between nodes and not have an memmap entry. + * Must use a address here and not struct page because + * the phys addr can be a in hole between nodes and + * not have an memmap entry. */ - err = change_page_attr_addr(vaddr,npages,MAKE_GLOBAL(__PAGE_KERNEL|flags)); + err = change_page_attr_addr(vaddr,npages, + MAKE_GLOBAL(__PAGE_KERNEL|flags)); if (!err) global_flush_tlb(); } @@ -61,10 +60,6 @@ ioremap_change_attr(unsigned long phys_addr, unsigned long size, } /* - * Generic mapping function - */ - -/* * Remap an arbitrary physical address space into the kernel virtual * address space. Needed when the kernel wants to access high addresses * directly. @@ -73,10 +68,11 @@ ioremap_change_attr(unsigned long phys_addr, unsigned long size, * have to convert them into an offset in a page-aligned mapping, but the * caller shouldn't need to know that small detail. */ -void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags) +void __iomem *__ioremap(unsigned long phys_addr, unsigned long size, + unsigned long flags) { - void * addr; - struct vm_struct * area; + void *addr; + struct vm_struct *area; unsigned long offset, last_addr; pgprot_t pgprot; @@ -130,20 +126,19 @@ EXPORT_SYMBOL(__ioremap); * make bus memory CPU accessible via the readb/readw/readl/writeb/ * writew/writel functions and the other mmio helpers. The returned * address is not guaranteed to be usable directly as a virtual - * address. + * address. * * This version of ioremap ensures that the memory is marked uncachable * on the CPU as well as honouring existing caching rules from things like - * the PCI bus. Note that there are other caches and buffers on many + * the PCI bus. Note that there are other caches and buffers on many * busses. In particular driver authors should read up on PCI writes * * It's useful if some control registers are in such an area and * write combining or read caching is not desirable: - * + * * Must be freed with iounmap. */ - -void __iomem *ioremap_nocache (unsigned long phys_addr, unsigned long size) +void __iomem *ioremap_nocache(unsigned long phys_addr, unsigned long size) { return __ioremap(phys_addr, size, _PAGE_PCD | _PAGE_PWT); } @@ -159,13 +154,14 @@ void iounmap(volatile void __iomem *addr) { struct vm_struct *p, *o; - if (addr <= high_memory) - return; + if (addr <= high_memory) + return; if (addr >= phys_to_virt(ISA_START_ADDRESS) && - addr < phys_to_virt(ISA_END_ADDRESS)) + addr < phys_to_virt(ISA_END_ADDRESS)) return; - addr = (volatile void __iomem *)(PAGE_MASK & (unsigned long __force)addr); + addr = (volatile void __iomem *) + (PAGE_MASK & (unsigned long __force)addr); /* Use the vm area unlocked, assuming the caller ensures there isn't another iounmap for the same address in parallel. Reuse of the virtual address is prevented by @@ -179,7 +175,7 @@ void iounmap(volatile void __iomem *addr) read_unlock(&vmlist_lock); if (!p) { - printk("iounmap: bad address %p\n", addr); + printk(KERN_ERR "iounmap: bad address %p\n", addr); dump_stack(); return; } @@ -191,7 +187,7 @@ void iounmap(volatile void __iomem *addr) /* Finally remove it */ o = remove_vm_area((void *)addr); BUG_ON(p != o || o == NULL); - kfree(p); + kfree(p); } EXPORT_SYMBOL(iounmap); |