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