1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LOONGARCH_SPARSEMEM_H
3 #define _LOONGARCH_SPARSEMEM_H
4 
5 #ifdef CONFIG_SPARSEMEM
6 
7 /*
8  * SECTION_SIZE_BITS		2^N: how big each section will be
9  * MAX_PHYSMEM_BITS		2^N: how much memory we can have in that space
10  */
11 #define SECTION_SIZE_BITS	29 /* 2^29 = Largest Huge Page Size */
12 #define MAX_PHYSMEM_BITS	48
13 
14 #ifdef CONFIG_SPARSEMEM_VMEMMAP
15 #define VMEMMAP_SIZE	(sizeof(struct page) * (1UL << (cpu_pabits + 1 - PAGE_SHIFT)))
16 #endif
17 
18 #endif /* CONFIG_SPARSEMEM */
19 
20 #ifndef VMEMMAP_SIZE
21 #define VMEMMAP_SIZE	0	/* 1, For FLATMEM; 2, For SPARSEMEM without VMEMMAP. */
22 #endif
23 
24 #ifdef CONFIG_MEMORY_HOTPLUG
25 int memory_add_physaddr_to_nid(u64 addr);
26 #define memory_add_physaddr_to_nid memory_add_physaddr_to_nid
27 #endif
28 
29 #define INIT_MEMBLOCK_RESERVED_REGIONS	(INIT_MEMBLOCK_REGIONS + NR_CPUS)
30 
31 #endif /* _LOONGARCH_SPARSEMEM_H */
32