diff options
author | Andy Whitcroft <apw@shadowen.org> | 2005-06-23 03:07:57 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-23 12:45:05 -0400 |
commit | 05b79bdcb48c18cd9b580c39e3efb9a1ab078151 (patch) | |
tree | 1767aaa7a4621ff4cf1a85c2078229de54272f30 /include/asm-i386/mmzone.h | |
parent | d41dee369bff3b9dcb6328d4d822926c28cc2594 (diff) |
[PATCH] sparsemem memory model for i386
Provide the architecture specific implementation for SPARSEMEM for i386 SMP
and NUMA systems.
Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Martin Bligh <mbligh@aracnet.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/asm-i386/mmzone.h')
-rw-r--r-- | include/asm-i386/mmzone.h | 89 |
1 files changed, 48 insertions, 41 deletions
diff --git a/include/asm-i386/mmzone.h b/include/asm-i386/mmzone.h index 48e46d403aa6..33ce5d37e894 100644 --- a/include/asm-i386/mmzone.h +++ b/include/asm-i386/mmzone.h | |||
@@ -8,7 +8,9 @@ | |||
8 | 8 | ||
9 | #include <asm/smp.h> | 9 | #include <asm/smp.h> |
10 | 10 | ||
11 | #ifdef CONFIG_DISCONTIGMEM | 11 | #if CONFIG_NUMA |
12 | extern struct pglist_data *node_data[]; | ||
13 | #define NODE_DATA(nid) (node_data[nid]) | ||
12 | 14 | ||
13 | #ifdef CONFIG_NUMA | 15 | #ifdef CONFIG_NUMA |
14 | #ifdef CONFIG_X86_NUMAQ | 16 | #ifdef CONFIG_X86_NUMAQ |
@@ -21,8 +23,28 @@ | |||
21 | #define get_zholes_size(n) (0) | 23 | #define get_zholes_size(n) (0) |
22 | #endif /* CONFIG_NUMA */ | 24 | #endif /* CONFIG_NUMA */ |
23 | 25 | ||
24 | extern struct pglist_data *node_data[]; | 26 | extern int get_memcfg_numa_flat(void ); |
25 | #define NODE_DATA(nid) (node_data[nid]) | 27 | /* |
28 | * This allows any one NUMA architecture to be compiled | ||
29 | * for, and still fall back to the flat function if it | ||
30 | * fails. | ||
31 | */ | ||
32 | static inline void get_memcfg_numa(void) | ||
33 | { | ||
34 | #ifdef CONFIG_X86_NUMAQ | ||
35 | if (get_memcfg_numaq()) | ||
36 | return; | ||
37 | #elif CONFIG_ACPI_SRAT | ||
38 | if (get_memcfg_from_srat()) | ||
39 | return; | ||
40 | #endif | ||
41 | |||
42 | get_memcfg_numa_flat(); | ||
43 | } | ||
44 | |||
45 | #endif /* CONFIG_NUMA */ | ||
46 | |||
47 | #ifdef CONFIG_DISCONTIGMEM | ||
26 | 48 | ||
27 | /* | 49 | /* |
28 | * generic node memory support, the following assumptions apply: | 50 | * generic node memory support, the following assumptions apply: |
@@ -48,26 +70,6 @@ static inline int pfn_to_nid(unsigned long pfn) | |||
48 | #endif | 70 | #endif |
49 | } | 71 | } |
50 | 72 | ||
51 | /* | ||
52 | * Following are macros that are specific to this numa platform. | ||
53 | */ | ||
54 | #define reserve_bootmem(addr, size) \ | ||
55 | reserve_bootmem_node(NODE_DATA(0), (addr), (size)) | ||
56 | #define alloc_bootmem(x) \ | ||
57 | __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) | ||
58 | #define alloc_bootmem_low(x) \ | ||
59 | __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, 0) | ||
60 | #define alloc_bootmem_pages(x) \ | ||
61 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) | ||
62 | #define alloc_bootmem_low_pages(x) \ | ||
63 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, 0) | ||
64 | #define alloc_bootmem_node(ignore, x) \ | ||
65 | __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) | ||
66 | #define alloc_bootmem_pages_node(ignore, x) \ | ||
67 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) | ||
68 | #define alloc_bootmem_low_pages_node(ignore, x) \ | ||
69 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, 0) | ||
70 | |||
71 | #define node_localnr(pfn, nid) ((pfn) - node_data[nid]->node_start_pfn) | 73 | #define node_localnr(pfn, nid) ((pfn) - node_data[nid]->node_start_pfn) |
72 | 74 | ||
73 | /* | 75 | /* |
@@ -121,28 +123,33 @@ static inline int pfn_valid(int pfn) | |||
121 | return (pfn < node_end_pfn(nid)); | 123 | return (pfn < node_end_pfn(nid)); |
122 | return 0; | 124 | return 0; |
123 | } | 125 | } |
124 | #endif | 126 | #endif /* CONFIG_X86_NUMAQ */ |
127 | |||
128 | #endif /* CONFIG_DISCONTIGMEM */ | ||
129 | |||
130 | #ifdef CONFIG_NEED_MULTIPLE_NODES | ||
125 | 131 | ||
126 | extern int get_memcfg_numa_flat(void ); | ||
127 | /* | 132 | /* |
128 | * This allows any one NUMA architecture to be compiled | 133 | * Following are macros that are specific to this numa platform. |
129 | * for, and still fall back to the flat function if it | ||
130 | * fails. | ||
131 | */ | 134 | */ |
132 | static inline void get_memcfg_numa(void) | 135 | #define reserve_bootmem(addr, size) \ |
133 | { | 136 | reserve_bootmem_node(NODE_DATA(0), (addr), (size)) |
134 | #ifdef CONFIG_X86_NUMAQ | 137 | #define alloc_bootmem(x) \ |
135 | if (get_memcfg_numaq()) | 138 | __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) |
136 | return; | 139 | #define alloc_bootmem_low(x) \ |
137 | #elif CONFIG_ACPI_SRAT | 140 | __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, 0) |
138 | if (get_memcfg_from_srat()) | 141 | #define alloc_bootmem_pages(x) \ |
139 | return; | 142 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) |
140 | #endif | 143 | #define alloc_bootmem_low_pages(x) \ |
141 | 144 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, 0) | |
142 | get_memcfg_numa_flat(); | 145 | #define alloc_bootmem_node(ignore, x) \ |
143 | } | 146 | __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) |
147 | #define alloc_bootmem_pages_node(ignore, x) \ | ||
148 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) | ||
149 | #define alloc_bootmem_low_pages_node(ignore, x) \ | ||
150 | __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, 0) | ||
144 | 151 | ||
145 | #endif /* CONFIG_DISCONTIGMEM */ | 152 | #endif /* CONFIG_NEED_MULTIPLE_NODES */ |
146 | 153 | ||
147 | extern int early_pfn_to_nid(unsigned long pfn); | 154 | extern int early_pfn_to_nid(unsigned long pfn); |
148 | 155 | ||