0001
0002 #include <linux/bug.h>
0003 #include <linux/export.h>
0004 #include <linux/types.h>
0005 #include <linux/mmdebug.h>
0006 #include <linux/mm.h>
0007
0008 #include <asm/sections.h>
0009 #include <asm/memory.h>
0010 #include <asm/fixmap.h>
0011 #include <asm/dma.h>
0012
0013 #include "mm.h"
0014
0015 static inline bool __virt_addr_valid(unsigned long x)
0016 {
0017
0018
0019
0020
0021 if (!high_memory && x >= PAGE_OFFSET)
0022 return true;
0023
0024 if (high_memory && x >= PAGE_OFFSET && x < (unsigned long)high_memory)
0025 return true;
0026
0027
0028
0029
0030
0031
0032 if (x == MAX_DMA_ADDRESS)
0033 return true;
0034
0035 return false;
0036 }
0037
0038 phys_addr_t __virt_to_phys(unsigned long x)
0039 {
0040 WARN(!__virt_addr_valid(x),
0041 "virt_to_phys used for non-linear address: %pK (%pS)\n",
0042 (void *)x, (void *)x);
0043
0044 return __virt_to_phys_nodebug(x);
0045 }
0046 EXPORT_SYMBOL(__virt_to_phys);
0047
0048 phys_addr_t __phys_addr_symbol(unsigned long x)
0049 {
0050
0051
0052
0053 VIRTUAL_BUG_ON(x < (unsigned long)KERNEL_START ||
0054 x > (unsigned long)KERNEL_END);
0055
0056 return __pa_symbol_nodebug(x);
0057 }
0058 EXPORT_SYMBOL(__phys_addr_symbol);