Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _LINUX_PFN_H_
0003 #define _LINUX_PFN_H_
0004 
0005 #ifndef __ASSEMBLY__
0006 #include <linux/types.h>
0007 
0008 /*
0009  * pfn_t: encapsulates a page-frame number that is optionally backed
0010  * by memmap (struct page).  Whether a pfn_t has a 'struct page'
0011  * backing is indicated by flags in the high bits of the value.
0012  */
0013 typedef struct {
0014     u64 val;
0015 } pfn_t;
0016 #endif
0017 
0018 #define PFN_ALIGN(x)    (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK)
0019 #define PFN_UP(x)   (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
0020 #define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
0021 #define PFN_PHYS(x) ((phys_addr_t)(x) << PAGE_SHIFT)
0022 #define PHYS_PFN(x) ((unsigned long)((x) >> PAGE_SHIFT))
0023 
0024 #endif