1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _TOOLS_LINUX_MM_H 3 #define _TOOLS_LINUX_MM_H 4 5 #include <linux/mmzone.h> 6 #include <uapi/linux/const.h> 7 8 #define PAGE_SHIFT 12 9 #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) 10 #define PAGE_MASK (~(PAGE_SIZE - 1)) 11 12 #define PHYS_ADDR_MAX (~(phys_addr_t)0) 13 14 #define ALIGN(x, a) __ALIGN_KERNEL((x), (a)) 15 #define ALIGN_DOWN(x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a)) 16 17 #define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE) 18 19 #define __va(x) ((void *)((unsigned long)(x))) 20 #define __pa(x) ((unsigned long)(x)) 21 22 #define pfn_to_page(pfn) ((void *)((pfn) * PAGE_SIZE)) 23 24 #define phys_to_virt phys_to_virt 25 static inline void *phys_to_virt(unsigned long address) 26 { 27 return __va(address); 28 } 29 30 void reserve_bootmem_region(phys_addr_t start, phys_addr_t end, int nid); 31 32 static inline void totalram_pages_inc(void) 33 { 34 } 35 36 static inline void totalram_pages_add(long count) 37 { 38 } 39 40 #endif 41