1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _TOOLS_LINUX_MM_H
3 #define _TOOLS_LINUX_MM_H
5 #include <linux/mmzone.h>
6 #include <uapi/linux/const.h>
9 #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
10 #define PAGE_MASK (~(PAGE_SIZE - 1))
12 #define PHYS_ADDR_MAX (~(phys_addr_t)0)
14 #define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
15 #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
16 #define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
17 #define ALIGN_DOWN(x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a))
19 #define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)
21 #define __va(x) ((void *)((unsigned long)(x)))
22 #define __pa(x) ((unsigned long)(x))
24 #define pfn_to_page(pfn) ((void *)((pfn) * PAGE_SIZE))
26 #define phys_to_virt phys_to_virt
27 static inline void *phys_to_virt(unsigned long address)
32 void reserve_bootmem_region(phys_addr_t start, phys_addr_t end);
34 static inline void totalram_pages_inc(void)
38 static inline void totalram_pages_add(long count)