Dave Hansen | 22a9835 | 2006-03-27 01:16:04 -0800 | [diff] [blame] | 1 | #ifndef _LINUX_PFN_H_ |
| 2 | #define _LINUX_PFN_H_ |
| 3 | |
Jeremy Fitzhardinge | 947d049 | 2008-09-11 01:31:48 -0700 | [diff] [blame] | 4 | #ifndef __ASSEMBLY__ |
| 5 | #include <linux/types.h> |
Dan Williams | 34c0fd5 | 2016-01-15 16:56:14 -0800 | [diff] [blame] | 6 | |
| 7 | /* |
| 8 | * pfn_t: encapsulates a page-frame number that is optionally backed |
| 9 | * by memmap (struct page). Whether a pfn_t has a 'struct page' |
| 10 | * backing is indicated by flags in the high bits of the value. |
| 11 | */ |
| 12 | typedef struct { |
Dan Williams | db78c22 | 2016-02-11 16:13:17 -0800 | [diff] [blame] | 13 | u64 val; |
Dan Williams | 34c0fd5 | 2016-01-15 16:56:14 -0800 | [diff] [blame] | 14 | } pfn_t; |
Jeremy Fitzhardinge | 947d049 | 2008-09-11 01:31:48 -0700 | [diff] [blame] | 15 | #endif |
| 16 | |
Dave Hansen | 22a9835 | 2006-03-27 01:16:04 -0800 | [diff] [blame] | 17 | #define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK) |
| 18 | #define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) |
| 19 | #define PFN_DOWN(x) ((x) >> PAGE_SHIFT) |
Jeremy Fitzhardinge | 947d049 | 2008-09-11 01:31:48 -0700 | [diff] [blame] | 20 | #define PFN_PHYS(x) ((phys_addr_t)(x) << PAGE_SHIFT) |
Chen Gang | 8f235d1 | 2016-01-14 15:18:33 -0800 | [diff] [blame] | 21 | #define PHYS_PFN(x) ((unsigned long)((x) >> PAGE_SHIFT)) |
Dave Hansen | 22a9835 | 2006-03-27 01:16:04 -0800 | [diff] [blame] | 22 | |
| 23 | #endif |