1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2b8b572e1SStephen Rothwell #ifndef _ASM_POWERPC_SPARSEMEM_H
3b8b572e1SStephen Rothwell #define _ASM_POWERPC_SPARSEMEM_H 1
4b8b572e1SStephen Rothwell #ifdef __KERNEL__
5b8b572e1SStephen Rothwell 
6b8b572e1SStephen Rothwell #ifdef CONFIG_SPARSEMEM
7b8b572e1SStephen Rothwell /*
8b8b572e1SStephen Rothwell  * SECTION_SIZE_BITS		2^N: how big each section will be
9b8b572e1SStephen Rothwell  * MAX_PHYSADDR_BITS		2^N: how much physical address space we have
10b8b572e1SStephen Rothwell  * MAX_PHYSMEM_BITS		2^N: how much memory we can have in that space
11b8b572e1SStephen Rothwell  */
12b8b572e1SStephen Rothwell #define SECTION_SIZE_BITS       24
13b8b572e1SStephen Rothwell 
14048ee099SAneesh Kumar K.V #define MAX_PHYSADDR_BITS       46
15048ee099SAneesh Kumar K.V #define MAX_PHYSMEM_BITS        46
16b8b572e1SStephen Rothwell 
17b8b572e1SStephen Rothwell #endif /* CONFIG_SPARSEMEM */
18b8b572e1SStephen Rothwell 
19b8b572e1SStephen Rothwell #ifdef CONFIG_MEMORY_HOTPLUG
20a1194097SAnton Blanchard extern int create_section_mapping(unsigned long start, unsigned long end);
21b8b572e1SStephen Rothwell extern int remove_section_mapping(unsigned long start, unsigned long end);
2236b390fdSMichael Ellerman 
2336b390fdSMichael Ellerman #ifdef CONFIG_PPC_BOOK3S_64
2436b390fdSMichael Ellerman extern void resize_hpt_for_hotplug(unsigned long new_mem_size);
2536b390fdSMichael Ellerman #else
2636b390fdSMichael Ellerman static inline void resize_hpt_for_hotplug(unsigned long new_mem_size) { }
2736b390fdSMichael Ellerman #endif
2836b390fdSMichael Ellerman 
29b8b572e1SStephen Rothwell #ifdef CONFIG_NUMA
30b8b572e1SStephen Rothwell extern int hot_add_scn_to_nid(unsigned long scn_addr);
31b8b572e1SStephen Rothwell #else
32b8b572e1SStephen Rothwell static inline int hot_add_scn_to_nid(unsigned long scn_addr)
33b8b572e1SStephen Rothwell {
34b8b572e1SStephen Rothwell 	return 0;
35b8b572e1SStephen Rothwell }
36b8b572e1SStephen Rothwell #endif /* CONFIG_NUMA */
37b8b572e1SStephen Rothwell #endif /* CONFIG_MEMORY_HOTPLUG */
38b8b572e1SStephen Rothwell 
39b8b572e1SStephen Rothwell #endif /* __KERNEL__ */
40b8b572e1SStephen Rothwell #endif /* _ASM_POWERPC_SPARSEMEM_H */
41