blob: 1132953235c0708bd87e1b9eea777bb705f54cb3 [file] [log] [blame]
Dave Hansen22a98352006-03-27 01:16:04 -08001#ifndef _LINUX_PFN_H_
2#define _LINUX_PFN_H_
3
Jeremy Fitzhardinge947d0492008-09-11 01:31:48 -07004#ifndef __ASSEMBLY__
5#include <linux/types.h>
Dan Williams34c0fd52016-01-15 16:56:14 -08006
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 */
12typedef struct {
Dan Williamsdb78c222016-02-11 16:13:17 -080013 u64 val;
Dan Williams34c0fd52016-01-15 16:56:14 -080014} pfn_t;
Jeremy Fitzhardinge947d0492008-09-11 01:31:48 -070015#endif
16
Dave Hansen22a98352006-03-27 01:16:04 -080017#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 Fitzhardinge947d0492008-09-11 01:31:48 -070020#define PFN_PHYS(x) ((phys_addr_t)(x) << PAGE_SHIFT)
Chen Gang8f235d12016-01-14 15:18:33 -080021#define PHYS_PFN(x) ((unsigned long)((x) >> PAGE_SHIFT))
Dave Hansen22a98352006-03-27 01:16:04 -080022
23#endif