xref: /openbmc/linux/arch/arm64/mm/physaddr.c (revision 612a462a)
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>
6 
7 #include <asm/memory.h>
8 
9 phys_addr_t __virt_to_phys(unsigned long x)
10 {
11 	WARN(!__is_lm_address(x),
12 	     "virt_to_phys used for non-linear address: %pK (%pS)\n",
13 	      (void *)x,
14 	      (void *)x);
15 
16 	return __virt_to_phys_nodebug(x);
17 }
18 EXPORT_SYMBOL(__virt_to_phys);
19 
20 phys_addr_t __phys_addr_symbol(unsigned long x)
21 {
22 	/*
23 	 * This is bounds checking against the kernel image only.
24 	 * __pa_symbol should only be used on kernel symbol addresses.
25 	 */
26 	VIRTUAL_BUG_ON(x < (unsigned long) KERNEL_START ||
27 		       x > (unsigned long) KERNEL_END);
28 	return __pa_symbol_nodebug(x);
29 }
30 EXPORT_SYMBOL(__phys_addr_symbol);
31