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