diff options
author | Andy Whitcroft <apw@shadowen.org> | 2005-06-23 03:08:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-23 12:45:06 -0400 |
commit | 145e664231648121026d470094c200851a446a73 (patch) | |
tree | c9362f4ec3e3114afb9b7134ae89152cbbc73cd4 /include/asm-ppc64/mmzone.h | |
parent | 74b30be2e183bd9a12d0350698996e3d1969f290 (diff) |
[PATCH] ppc64: sparsemem memory model
Provide the architecture specific implementation for SPARSEMEM for PPC64
systems.
Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Mike Kravetz <kravetz@us.ibm.com> (in part)
Signed-off-by: Martin Bligh <mbligh@aracnet.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/asm-ppc64/mmzone.h')
-rw-r--r-- | include/asm-ppc64/mmzone.h | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/include/asm-ppc64/mmzone.h b/include/asm-ppc64/mmzone.h index ecc4b07507d6..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 | ||
15 | extern struct pglist_data *node_data[]; | 22 | extern 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,30 +58,27 @@ 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_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) | 67 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) |
69 | #define node_end_pfn(nid) (NODE_DATA(nid)->node_end_pfn) | 68 | #define node_end_pfn(nid) (NODE_DATA(nid)->node_end_pfn) |
70 | 69 | ||
71 | #define local_mapnr(kvaddr) \ | 70 | #define local_mapnr(kvaddr) \ |
72 | ( (__pa(kvaddr) >> PAGE_SHIFT) - node_start_pfn(kvaddr_to_nid(kvaddr)) | 71 | ( (__pa(kvaddr) >> PAGE_SHIFT) - node_start_pfn(kvaddr_to_nid(kvaddr)) |
73 | 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 | |||
74 | /* Written this way to avoid evaluating arguments twice */ | 82 | /* Written this way to avoid evaluating arguments twice */ |
75 | #define discontigmem_pfn_to_page(pfn) \ | 83 | #define discontigmem_pfn_to_page(pfn) \ |
76 | ({ \ | 84 | ({ \ |
@@ -91,6 +99,8 @@ static inline int pa_to_nid(unsigned long pa) | |||
91 | 99 | ||
92 | #endif /* CONFIG_DISCONTIGMEM */ | 100 | #endif /* CONFIG_DISCONTIGMEM */ |
93 | 101 | ||
102 | #endif /* CONFIG_NEED_MULTIPLE_NODES */ | ||
103 | |||
94 | #ifdef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID | 104 | #ifdef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID |
95 | #define early_pfn_to_nid(pfn) pa_to_nid(((unsigned long)pfn) << PAGE_SHIFT) | 105 | #define early_pfn_to_nid(pfn) pa_to_nid(((unsigned long)pfn) << PAGE_SHIFT) |
96 | #endif | 106 | #endif |