1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_POWERPC_SPARSEMEM_H
3 #define _ASM_POWERPC_SPARSEMEM_H 1
4 #ifdef __KERNEL__
5 
6 #ifdef CONFIG_SPARSEMEM
7 /*
8  * SECTION_SIZE_BITS		2^N: how big each section will be
9  * MAX_PHYSADDR_BITS		2^N: how much physical address space we have
10  * MAX_PHYSMEM_BITS		2^N: how much memory we can have in that space
11  */
12 #define SECTION_SIZE_BITS       24
13 
14 #define MAX_PHYSADDR_BITS       46
15 #define MAX_PHYSMEM_BITS        46
16 
17 #endif /* CONFIG_SPARSEMEM */
18 
19 #ifdef CONFIG_MEMORY_HOTPLUG
20 extern int create_section_mapping(unsigned long start, unsigned long end, int nid);
21 extern int remove_section_mapping(unsigned long start, unsigned long end);
22 
23 #ifdef CONFIG_PPC_BOOK3S_64
24 extern void resize_hpt_for_hotplug(unsigned long new_mem_size);
25 #else
26 static inline void resize_hpt_for_hotplug(unsigned long new_mem_size) { }
27 #endif
28 
29 #ifdef CONFIG_NUMA
30 extern int hot_add_scn_to_nid(unsigned long scn_addr);
31 #else
32 static inline int hot_add_scn_to_nid(unsigned long scn_addr)
33 {
34 	return 0;
35 }
36 #endif /* CONFIG_NUMA */
37 #endif /* CONFIG_MEMORY_HOTPLUG */
38 
39 #endif /* __KERNEL__ */
40 #endif /* _ASM_POWERPC_SPARSEMEM_H */
41