xref: /openbmc/linux/arch/sh/include/asm/mmzone.h (revision 762f99f4f3cb41a775b5157dd761217beba65873)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2f15cbe6fSPaul Mundt #ifndef __ASM_SH_MMZONE_H
3f15cbe6fSPaul Mundt #define __ASM_SH_MMZONE_H
4f15cbe6fSPaul Mundt 
5*a9ee6cf5SMike Rapoport #ifdef CONFIG_NUMA
66bff1592SPaul Mundt #include <linux/numa.h>
76bff1592SPaul Mundt 
8f15cbe6fSPaul Mundt extern struct pglist_data *node_data[];
9f15cbe6fSPaul Mundt #define NODE_DATA(nid)		(node_data[nid])
10f15cbe6fSPaul Mundt 
pfn_to_nid(unsigned long pfn)11f15cbe6fSPaul Mundt static inline int pfn_to_nid(unsigned long pfn)
12f15cbe6fSPaul Mundt {
13f15cbe6fSPaul Mundt 	int nid;
14f15cbe6fSPaul Mundt 
15f15cbe6fSPaul Mundt 	for (nid = 0; nid < MAX_NUMNODES; nid++)
16f15cbe6fSPaul Mundt 		if (pfn >= node_start_pfn(nid) && pfn <= node_end_pfn(nid))
17f15cbe6fSPaul Mundt 			break;
18f15cbe6fSPaul Mundt 
19f15cbe6fSPaul Mundt 	return nid;
20f15cbe6fSPaul Mundt }
21f15cbe6fSPaul Mundt 
pfn_to_pgdat(unsigned long pfn)22f15cbe6fSPaul Mundt static inline struct pglist_data *pfn_to_pgdat(unsigned long pfn)
23f15cbe6fSPaul Mundt {
24f15cbe6fSPaul Mundt 	return NODE_DATA(pfn_to_nid(pfn));
25f15cbe6fSPaul Mundt }
26f15cbe6fSPaul Mundt 
27f15cbe6fSPaul Mundt /* arch/sh/mm/numa.c */
28f15cbe6fSPaul Mundt void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end);
29f15cbe6fSPaul Mundt #else
30f15cbe6fSPaul Mundt static inline void
setup_bootmem_node(int nid,unsigned long start,unsigned long end)31f15cbe6fSPaul Mundt setup_bootmem_node(int nid, unsigned long start, unsigned long end)
32f15cbe6fSPaul Mundt {
33f15cbe6fSPaul Mundt }
34*a9ee6cf5SMike Rapoport #endif /* CONFIG_NUMA */
35f15cbe6fSPaul Mundt 
36f15cbe6fSPaul Mundt /* Platform specific mem init */
37f15cbe6fSPaul Mundt void __init plat_mem_setup(void);
38f15cbe6fSPaul Mundt 
39f15cbe6fSPaul Mundt /* arch/sh/kernel/setup.c */
40f15cbe6fSPaul Mundt void __init __add_active_range(unsigned int nid, unsigned long start_pfn,
41f15cbe6fSPaul Mundt 			       unsigned long end_pfn);
424bc277acSPaul Mundt /* arch/sh/mm/init.c */
434bc277acSPaul Mundt void __init allocate_pgdat(unsigned int nid);
44f15cbe6fSPaul Mundt 
45f15cbe6fSPaul Mundt #endif /* __ASM_SH_MMZONE_H */
46