2022-02-02 12:03:04 +01:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
#ifndef _TOOLS_LINUX_MM_H
|
|
|
|
#define _TOOLS_LINUX_MM_H
|
|
|
|
|
2024-03-27 16:23:48 +01:00
|
|
|
#include <linux/align.h>
|
2022-02-02 12:03:04 +01:00
|
|
|
#include <linux/mmzone.h>
|
|
|
|
|
|
|
|
#define PAGE_SHIFT 12
|
|
|
|
#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
|
|
|
|
#define PAGE_MASK (~(PAGE_SIZE - 1))
|
|
|
|
|
|
|
|
#define PHYS_ADDR_MAX (~(phys_addr_t)0)
|
|
|
|
|
|
|
|
#define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)
|
2024-05-07 07:58:32 +00:00
|
|
|
#define PAGE_ALIGN_DOWN(addr) ALIGN_DOWN(addr, PAGE_SIZE)
|
2022-02-02 12:03:04 +01:00
|
|
|
|
|
|
|
#define __va(x) ((void *)((unsigned long)(x)))
|
|
|
|
#define __pa(x) ((unsigned long)(x))
|
|
|
|
|
|
|
|
#define pfn_to_page(pfn) ((void *)((pfn) * PAGE_SIZE))
|
|
|
|
|
|
|
|
#define phys_to_virt phys_to_virt
|
|
|
|
static inline void *phys_to_virt(unsigned long address)
|
|
|
|
{
|
|
|
|
return __va(address);
|
|
|
|
}
|
|
|
|
|
2023-09-11 22:32:56 +08:00
|
|
|
void reserve_bootmem_region(phys_addr_t start, phys_addr_t end, int nid);
|
2022-02-02 12:03:04 +01:00
|
|
|
|
|
|
|
static inline void totalram_pages_inc(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void totalram_pages_add(long count)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2024-04-02 13:26:59 +00:00
|
|
|
static inline int early_pfn_to_nid(unsigned long pfn)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-02-02 12:03:04 +01:00
|
|
|
#endif
|