1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Written by Pat Gaughen (gone@us.ibm.com) Mar 2002
12 #ifdef CONFIG_DISCONTIGMEM
14 extern struct pglist_data
*node_data
[];
15 #define NODE_DATA(nid) (node_data[nid])
17 #define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn)
19 #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT))
21 * pfn_valid should be made as fast as possible, and the current definition
22 * is valid for machines that are NUMA, but still contiguous, which is what
23 * is currently supported. A more generalised, but slower definition would
24 * be something like this - mbligh:
25 * ( pfn_to_pgdat(pfn) && ((pfn) < node_end_pfn(pfn_to_nid(pfn))) )
27 #if 1 /* M32R_FIXME */
28 #define pfn_valid(pfn) (1)
30 #define pfn_valid(pfn) ((pfn) < num_physpages)
34 * generic node memory support, the following assumptions apply:
37 static __inline__
int pfn_to_nid(unsigned long pfn
)
41 for (node
= 0 ; node
< MAX_NUMNODES
; node
++)
42 if (pfn
>= node_start_pfn(node
) && pfn
< node_end_pfn(node
))
48 static __inline__
struct pglist_data
*pfn_to_pgdat(unsigned long pfn
)
50 return(NODE_DATA(pfn_to_nid(pfn
)));
53 #endif /* CONFIG_DISCONTIGMEM */
54 #endif /* _ASM_MMZONE_H_ */