18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef __ASM_SH_MMZONE_H 38c2ecf20Sopenharmony_ci#define __ASM_SH_MMZONE_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#ifdef CONFIG_NEED_MULTIPLE_NODES 68c2ecf20Sopenharmony_ci#include <linux/numa.h> 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ciextern struct pglist_data *node_data[]; 98c2ecf20Sopenharmony_ci#define NODE_DATA(nid) (node_data[nid]) 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_cistatic inline int pfn_to_nid(unsigned long pfn) 128c2ecf20Sopenharmony_ci{ 138c2ecf20Sopenharmony_ci int nid; 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci for (nid = 0; nid < MAX_NUMNODES; nid++) 168c2ecf20Sopenharmony_ci if (pfn >= node_start_pfn(nid) && pfn <= node_end_pfn(nid)) 178c2ecf20Sopenharmony_ci break; 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci return nid; 208c2ecf20Sopenharmony_ci} 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_cistatic inline struct pglist_data *pfn_to_pgdat(unsigned long pfn) 238c2ecf20Sopenharmony_ci{ 248c2ecf20Sopenharmony_ci return NODE_DATA(pfn_to_nid(pfn)); 258c2ecf20Sopenharmony_ci} 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci/* arch/sh/mm/numa.c */ 288c2ecf20Sopenharmony_civoid __init setup_bootmem_node(int nid, unsigned long start, unsigned long end); 298c2ecf20Sopenharmony_ci#else 308c2ecf20Sopenharmony_cistatic inline void 318c2ecf20Sopenharmony_cisetup_bootmem_node(int nid, unsigned long start, unsigned long end) 328c2ecf20Sopenharmony_ci{ 338c2ecf20Sopenharmony_ci} 348c2ecf20Sopenharmony_ci#endif /* CONFIG_NEED_MULTIPLE_NODES */ 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci/* Platform specific mem init */ 378c2ecf20Sopenharmony_civoid __init plat_mem_setup(void); 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci/* arch/sh/kernel/setup.c */ 408c2ecf20Sopenharmony_civoid __init __add_active_range(unsigned int nid, unsigned long start_pfn, 418c2ecf20Sopenharmony_ci unsigned long end_pfn); 428c2ecf20Sopenharmony_ci/* arch/sh/mm/init.c */ 438c2ecf20Sopenharmony_civoid __init allocate_pgdat(unsigned int nid); 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci#endif /* __ASM_SH_MMZONE_H */ 46