x86/mm/pat: Don't report PAT on CPUs that don't support it
[linux/fpc-iii.git] / arch / arm / mm / physaddr.c
blob02e60f495608c8b8086771c496b5c904c469cf65
1 #include <linux/bug.h>
2 #include <linux/export.h>
3 #include <linux/types.h>
4 #include <linux/mmdebug.h>
5 #include <linux/mm.h>
7 #include <asm/sections.h>
8 #include <asm/memory.h>
9 #include <asm/fixmap.h>
10 #include <asm/dma.h>
12 #include "mm.h"
14 static inline bool __virt_addr_valid(unsigned long x)
17 * high_memory does not get immediately defined, and there
18 * are early callers of __pa() against PAGE_OFFSET
20 if (!high_memory && x >= PAGE_OFFSET)
21 return true;
23 if (high_memory && x >= PAGE_OFFSET && x < (unsigned long)high_memory)
24 return true;
27 * MAX_DMA_ADDRESS is a virtual address that may not correspond to an
28 * actual physical address. Enough code relies on __pa(MAX_DMA_ADDRESS)
29 * that we just need to work around it and always return true.
31 if (x == MAX_DMA_ADDRESS)
32 return true;
34 return false;
37 phys_addr_t __virt_to_phys(unsigned long x)
39 WARN(!__virt_addr_valid(x),
40 "virt_to_phys used for non-linear address: %pK (%pS)\n",
41 (void *)x, (void *)x);
43 return __virt_to_phys_nodebug(x);
45 EXPORT_SYMBOL(__virt_to_phys);
47 phys_addr_t __phys_addr_symbol(unsigned long x)
49 /* This is bounds checking against the kernel image only.
50 * __pa_symbol should only be used on kernel symbol addresses.
52 VIRTUAL_BUG_ON(x < (unsigned long)KERNEL_START ||
53 x > (unsigned long)KERNEL_END);
55 return __pa_symbol_nodebug(x);
57 EXPORT_SYMBOL(__phys_addr_symbol);