diff options
author | Yasunori Goto <y-goto@jp.fujitsu.com> | 2006-06-23 05:03:19 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-23 10:42:48 -0400 |
commit | 762834e8bf46bf41ce9034d062a7c1f8563175f3 (patch) | |
tree | fb134ef41772ba61050a08cc4ed92c50cd057658 /arch/i386/kernel | |
parent | d6277db4ab271862ed599da08d78961c70f00002 (diff) |
[PATCH] Unify pxm_to_node() and node_to_pxm()
Consolidate the various arch-specific implementations of pxm_to_node() and
node_to_pxm() into a single generic version.
Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Andi Kleen <ak@muc.de>
Cc: Dave Hansen <haveblue@us.ibm.com>
Cc: "Brown, Len" <len.brown@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/i386/kernel')
-rw-r--r-- | arch/i386/kernel/srat.c | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/arch/i386/kernel/srat.c b/arch/i386/kernel/srat.c index 52b3ed5d2cb5..989c85255dbe 100644 --- a/arch/i386/kernel/srat.c +++ b/arch/i386/kernel/srat.c | |||
@@ -39,7 +39,6 @@ | |||
39 | #define NODE_ARRAY_OFFSET(x) ((x) % 8) /* 8 bits/char */ | 39 | #define NODE_ARRAY_OFFSET(x) ((x) % 8) /* 8 bits/char */ |
40 | #define BMAP_SET(bmap, bit) ((bmap)[NODE_ARRAY_INDEX(bit)] |= 1 << NODE_ARRAY_OFFSET(bit)) | 40 | #define BMAP_SET(bmap, bit) ((bmap)[NODE_ARRAY_INDEX(bit)] |= 1 << NODE_ARRAY_OFFSET(bit)) |
41 | #define BMAP_TEST(bmap, bit) ((bmap)[NODE_ARRAY_INDEX(bit)] & (1 << NODE_ARRAY_OFFSET(bit))) | 41 | #define BMAP_TEST(bmap, bit) ((bmap)[NODE_ARRAY_INDEX(bit)] & (1 << NODE_ARRAY_OFFSET(bit))) |
42 | #define MAX_PXM_DOMAINS 256 /* 1 byte and no promises about values */ | ||
43 | /* bitmap length; _PXM is at most 255 */ | 42 | /* bitmap length; _PXM is at most 255 */ |
44 | #define PXM_BITMAP_LEN (MAX_PXM_DOMAINS / 8) | 43 | #define PXM_BITMAP_LEN (MAX_PXM_DOMAINS / 8) |
45 | static u8 pxm_bitmap[PXM_BITMAP_LEN]; /* bitmap of proximity domains */ | 44 | static u8 pxm_bitmap[PXM_BITMAP_LEN]; /* bitmap of proximity domains */ |
@@ -213,19 +212,11 @@ static __init void node_read_chunk(int nid, struct node_memory_chunk_s *memory_c | |||
213 | node_end_pfn[nid] = memory_chunk->end_pfn; | 212 | node_end_pfn[nid] = memory_chunk->end_pfn; |
214 | } | 213 | } |
215 | 214 | ||
216 | static u8 pxm_to_nid_map[MAX_PXM_DOMAINS];/* _PXM to logical node ID map */ | ||
217 | |||
218 | int pxm_to_node(int pxm) | ||
219 | { | ||
220 | return pxm_to_nid_map[pxm]; | ||
221 | } | ||
222 | |||
223 | /* Parse the ACPI Static Resource Affinity Table */ | 215 | /* Parse the ACPI Static Resource Affinity Table */ |
224 | static int __init acpi20_parse_srat(struct acpi_table_srat *sratp) | 216 | static int __init acpi20_parse_srat(struct acpi_table_srat *sratp) |
225 | { | 217 | { |
226 | u8 *start, *end, *p; | 218 | u8 *start, *end, *p; |
227 | int i, j, nid; | 219 | int i, j, nid; |
228 | u8 nid_to_pxm_map[MAX_NUMNODES];/* logical node ID to _PXM map */ | ||
229 | 220 | ||
230 | start = (u8 *)(&(sratp->reserved) + 1); /* skip header */ | 221 | start = (u8 *)(&(sratp->reserved) + 1); /* skip header */ |
231 | p = start; | 222 | p = start; |
@@ -235,10 +226,6 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp) | |||
235 | memset(node_memory_chunk, 0, sizeof(node_memory_chunk)); | 226 | memset(node_memory_chunk, 0, sizeof(node_memory_chunk)); |
236 | memset(zholes_size, 0, sizeof(zholes_size)); | 227 | memset(zholes_size, 0, sizeof(zholes_size)); |
237 | 228 | ||
238 | /* -1 in these maps means not available */ | ||
239 | memset(pxm_to_nid_map, -1, sizeof(pxm_to_nid_map)); | ||
240 | memset(nid_to_pxm_map, -1, sizeof(nid_to_pxm_map)); | ||
241 | |||
242 | num_memory_chunks = 0; | 229 | num_memory_chunks = 0; |
243 | while (p < end) { | 230 | while (p < end) { |
244 | switch (*p) { | 231 | switch (*p) { |
@@ -278,9 +265,7 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp) | |||
278 | nodes_clear(node_online_map); | 265 | nodes_clear(node_online_map); |
279 | for (i = 0; i < MAX_PXM_DOMAINS; i++) { | 266 | for (i = 0; i < MAX_PXM_DOMAINS; i++) { |
280 | if (BMAP_TEST(pxm_bitmap, i)) { | 267 | if (BMAP_TEST(pxm_bitmap, i)) { |
281 | nid = num_online_nodes(); | 268 | int nid = acpi_map_pxm_to_node(i); |
282 | pxm_to_nid_map[i] = nid; | ||
283 | nid_to_pxm_map[nid] = i; | ||
284 | node_set_online(nid); | 269 | node_set_online(nid); |
285 | } | 270 | } |
286 | } | 271 | } |
@@ -288,7 +273,7 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp) | |||
288 | 273 | ||
289 | /* set cnode id in memory chunk structure */ | 274 | /* set cnode id in memory chunk structure */ |
290 | for (i = 0; i < num_memory_chunks; i++) | 275 | for (i = 0; i < num_memory_chunks; i++) |
291 | node_memory_chunk[i].nid = pxm_to_nid_map[node_memory_chunk[i].pxm]; | 276 | node_memory_chunk[i].nid = pxm_to_node(node_memory_chunk[i].pxm); |
292 | 277 | ||
293 | printk("pxm bitmap: "); | 278 | printk("pxm bitmap: "); |
294 | for (i = 0; i < sizeof(pxm_bitmap); i++) { | 279 | for (i = 0; i < sizeof(pxm_bitmap); i++) { |