Skip to content

Commit

Permalink
x86: unify ioremap
Browse files Browse the repository at this point in the history
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Thomas Gleixner authored and Ingo Molnar committed Jan 30, 2008
1 parent e4c1b97 commit 240d3a7
Show file tree
Hide file tree
Showing 2 changed files with 313 additions and 22 deletions.
18 changes: 18 additions & 0 deletions arch/x86/mm/ioremap_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@
#include <asm/pgtable.h>
#include <asm/tlbflush.h>

#ifdef CONFIG_X86_64

unsigned long __phys_addr(unsigned long x)
{
if (x >= __START_KERNEL_map)
return x - __START_KERNEL_map + phys_base;
return x - PAGE_OFFSET;
}
EXPORT_SYMBOL(__phys_addr);

#endif

/*
* Fix up the linear direct mapping of the kernel to avoid cache attribute
* conflicts.
Expand Down Expand Up @@ -49,6 +61,7 @@ static int ioremap_change_attr(unsigned long phys_addr, unsigned long size,
* memmap entry.
*/
err = change_page_attr_addr(vaddr, npages, prot);

if (!err)
global_flush_tlb();

Expand Down Expand Up @@ -83,6 +96,7 @@ void __iomem *__ioremap(unsigned long phys_addr, unsigned long size,
if (phys_addr >= ISA_START_ADDRESS && last_addr < ISA_END_ADDRESS)
return (__force void __iomem *)phys_to_virt(phys_addr);

#ifdef CONFIG_X86_32
/*
* Don't allow anybody to remap normal RAM that we're using..
*/
Expand All @@ -98,6 +112,7 @@ void __iomem *__ioremap(unsigned long phys_addr, unsigned long size,
if (!PageReserved(page))
return NULL;
}
#endif

pgprot = MAKE_GLOBAL(__PAGE_KERNEL | flags);

Expand Down Expand Up @@ -211,6 +226,7 @@ void iounmap(volatile void __iomem *addr)
}
EXPORT_SYMBOL(iounmap);

#ifdef CONFIG_X86_32

int __initdata early_ioremap_debug;

Expand Down Expand Up @@ -443,3 +459,5 @@ void __this_fixmap_does_not_exist(void)
{
WARN_ON(1);
}

#endif /* CONFIG_X86_32 */
Loading

0 comments on commit 240d3a7

Please sign in to comment.