Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _TOOLS_LINUX_MM_H
0003 #define _TOOLS_LINUX_MM_H
0004 
0005 #include <linux/mmzone.h>
0006 #include <uapi/linux/const.h>
0007 
0008 #define PAGE_SHIFT      12
0009 #define PAGE_SIZE       (_AC(1, UL) << PAGE_SHIFT)
0010 #define PAGE_MASK       (~(PAGE_SIZE - 1))
0011 
0012 #define PHYS_ADDR_MAX   (~(phys_addr_t)0)
0013 
0014 #define __ALIGN_KERNEL(x, a)        __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
0015 #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
0016 #define ALIGN(x, a)         __ALIGN_KERNEL((x), (a))
0017 #define ALIGN_DOWN(x, a)        __ALIGN_KERNEL((x) - ((a) - 1), (a))
0018 
0019 #define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)
0020 
0021 #define __va(x) ((void *)((unsigned long)(x)))
0022 #define __pa(x) ((unsigned long)(x))
0023 
0024 #define pfn_to_page(pfn) ((void *)((pfn) * PAGE_SIZE))
0025 
0026 #define phys_to_virt phys_to_virt
0027 static inline void *phys_to_virt(unsigned long address)
0028 {
0029     return __va(address);
0030 }
0031 
0032 void reserve_bootmem_region(phys_addr_t start, phys_addr_t end);
0033 
0034 static inline void totalram_pages_inc(void)
0035 {
0036 }
0037 
0038 static inline void totalram_pages_add(long count)
0039 {
0040 }
0041 
0042 #endif