pfn.h 627 B

123456789101112131415161718192021222324
  1. #ifndef _LINUX_PFN_H_
  2. #define _LINUX_PFN_H_
  3. #ifndef __ASSEMBLY__
  4. #include <linux/types.h>
  5. /*
  6. * pfn_t: encapsulates a page-frame number that is optionally backed
  7. * by memmap (struct page). Whether a pfn_t has a 'struct page'
  8. * backing is indicated by flags in the high bits of the value.
  9. */
  10. typedef struct {
  11. u64 val;
  12. } pfn_t;
  13. #endif
  14. #define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK)
  15. #define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
  16. #define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
  17. #define PFN_PHYS(x) ((phys_addr_t)(x) << PAGE_SHIFT)
  18. #define PHYS_PFN(x) ((unsigned long)((x) >> PAGE_SHIFT))
  19. #endif