aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-ppc64/mmzone.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-ppc64/mmzone.h')
-rw-r--r--include/asm-ppc64/mmzone.h44
1 files changed, 29 insertions, 15 deletions
diff --git a/include/asm-ppc64/mmzone.h b/include/asm-ppc64/mmzone.h
index 0619a41a3c9d..ed473f4b0152 100644
--- a/include/asm-ppc64/mmzone.h
+++ b/include/asm-ppc64/mmzone.h
@@ -10,9 +10,20 @@
10#include <linux/config.h> 10#include <linux/config.h>
11#include <asm/smp.h> 11#include <asm/smp.h>
12 12
13#ifdef CONFIG_DISCONTIGMEM 13/* generic non-linear memory support:
14 *
15 * 1) we will not split memory into more chunks than will fit into the
16 * flags field of the struct page
17 */
18
19
20#ifdef CONFIG_NEED_MULTIPLE_NODES
14 21
15extern struct pglist_data *node_data[]; 22extern struct pglist_data *node_data[];
23/*
24 * Return a pointer to the node data for node n.
25 */
26#define NODE_DATA(nid) (node_data[nid])
16 27
17/* 28/*
18 * Following are specific to this numa platform. 29 * Following are specific to this numa platform.
@@ -47,36 +58,32 @@ static inline int pa_to_nid(unsigned long pa)
47 return nid; 58 return nid;
48} 59}
49 60
50#define pfn_to_nid(pfn) pa_to_nid((pfn) << PAGE_SHIFT)
51
52/*
53 * Return a pointer to the node data for node n.
54 */
55#define NODE_DATA(nid) (node_data[nid])
56
57#define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn) 61#define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn)
58 62
59/* 63/*
60 * Following are macros that each numa implmentation must define. 64 * Following are macros that each numa implmentation must define.
61 */ 65 */
62 66
63/*
64 * Given a kernel address, find the home node of the underlying memory.
65 */
66#define kvaddr_to_nid(kaddr) pa_to_nid(__pa(kaddr))
67
68#define node_mem_map(nid) (NODE_DATA(nid)->node_mem_map)
69#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) 67#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
70#define node_end_pfn(nid) (NODE_DATA(nid)->node_end_pfn) 68#define node_end_pfn(nid) (NODE_DATA(nid)->node_end_pfn)
71 69
72#define local_mapnr(kvaddr) \ 70#define local_mapnr(kvaddr) \
73 ( (__pa(kvaddr) >> PAGE_SHIFT) - node_start_pfn(kvaddr_to_nid(kvaddr)) 71 ( (__pa(kvaddr) >> PAGE_SHIFT) - node_start_pfn(kvaddr_to_nid(kvaddr))
74 72
73#ifdef CONFIG_DISCONTIGMEM
74
75/*
76 * Given a kernel address, find the home node of the underlying memory.
77 */
78#define kvaddr_to_nid(kaddr) pa_to_nid(__pa(kaddr))
79
80#define pfn_to_nid(pfn) pa_to_nid((unsigned long)(pfn) << PAGE_SHIFT)
81
75/* Written this way to avoid evaluating arguments twice */ 82/* Written this way to avoid evaluating arguments twice */
76#define discontigmem_pfn_to_page(pfn) \ 83#define discontigmem_pfn_to_page(pfn) \
77({ \ 84({ \
78 unsigned long __tmp = pfn; \ 85 unsigned long __tmp = pfn; \
79 (node_mem_map(pfn_to_nid(__tmp)) + \ 86 (NODE_DATA(pfn_to_nid(__tmp))->node_mem_map + \
80 node_localnr(__tmp, pfn_to_nid(__tmp))); \ 87 node_localnr(__tmp, pfn_to_nid(__tmp))); \
81}) 88})
82 89
@@ -91,4 +98,11 @@ static inline int pa_to_nid(unsigned long pa)
91#define discontigmem_pfn_valid(pfn) ((pfn) < num_physpages) 98#define discontigmem_pfn_valid(pfn) ((pfn) < num_physpages)
92 99
93#endif /* CONFIG_DISCONTIGMEM */ 100#endif /* CONFIG_DISCONTIGMEM */
101
102#endif /* CONFIG_NEED_MULTIPLE_NODES */
103
104#ifdef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
105#define early_pfn_to_nid(pfn) pa_to_nid(((unsigned long)pfn) << PAGE_SHIFT)
106#endif
107
94#endif /* _ASM_MMZONE_H_ */ 108#endif /* _ASM_MMZONE_H_ */