18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef _LOONGARCH_SPARSEMEM_H 38c2ecf20Sopenharmony_ci#define _LOONGARCH_SPARSEMEM_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#ifdef CONFIG_SPARSEMEM 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci/* 88c2ecf20Sopenharmony_ci * SECTION_SIZE_BITS 2^N: how big each section will be 98c2ecf20Sopenharmony_ci * MAX_PHYSMEM_BITS 2^N: how much memory we can have in that space 108c2ecf20Sopenharmony_ci */ 118c2ecf20Sopenharmony_ci#define SECTION_SIZE_BITS 29 /* 2^29 = Largest Huge Page Size */ 128c2ecf20Sopenharmony_ci#define MAX_PHYSMEM_BITS 48 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#ifdef CONFIG_SPARSEMEM_VMEMMAP 158c2ecf20Sopenharmony_ci#define VMEMMAP_SIZE (sizeof(struct page) * (1UL << (cpu_pabits + 1 - PAGE_SHIFT))) 168c2ecf20Sopenharmony_ci#endif 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci#include <linux/mm_types.h> 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#endif /* CONFIG_SPARSEMEM */ 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci#ifndef VMEMMAP_SIZE 238c2ecf20Sopenharmony_ci#define VMEMMAP_SIZE 0 /* 1, For FLATMEM; 2, For SPARSEMEM without VMEMMAP. */ 248c2ecf20Sopenharmony_ci#endif 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci#ifdef CONFIG_MEMORY_HOTPLUG 278c2ecf20Sopenharmony_ciint memory_add_physaddr_to_nid(u64 addr); 288c2ecf20Sopenharmony_ci#define memory_add_physaddr_to_nid memory_add_physaddr_to_nid 298c2ecf20Sopenharmony_ci#endif 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci#define INIT_MEMBLOCK_RESERVED_REGIONS (INIT_MEMBLOCK_REGIONS + NR_CPUS) 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci#endif /* _LOONGARCH_SPARSEMEM_H */ 34