physaddr.c 356 B

123456789101112131415
  1. // SPDX-License-Identifier: GPL-2.0
  2. #include <linux/mmdebug.h>
  3. #include <linux/export.h>
  4. #include <linux/mm.h>
  5. #include <asm/page.h>
  6. unsigned long __phys_addr(unsigned long x, bool is_31bit)
  7. {
  8. VIRTUAL_BUG_ON(is_vmalloc_or_module_addr((void *)(x)));
  9. x = __pa_nodebug(x);
  10. if (is_31bit)
  11. VIRTUAL_BUG_ON(x >> 31);
  12. return x;
  13. }
  14. EXPORT_SYMBOL(__phys_addr);