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/ia64/kernel/acpi.c | |
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/ia64/kernel/acpi.c')
-rw-r--r-- | arch/ia64/kernel/acpi.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c index 58c93a30348c..d1c52cf67882 100644 --- a/arch/ia64/kernel/acpi.c +++ b/arch/ia64/kernel/acpi.c | |||
@@ -415,9 +415,6 @@ static int __initdata srat_num_cpus; /* number of cpus */ | |||
415 | static u32 __devinitdata pxm_flag[PXM_FLAG_LEN]; | 415 | static u32 __devinitdata pxm_flag[PXM_FLAG_LEN]; |
416 | #define pxm_bit_set(bit) (set_bit(bit,(void *)pxm_flag)) | 416 | #define pxm_bit_set(bit) (set_bit(bit,(void *)pxm_flag)) |
417 | #define pxm_bit_test(bit) (test_bit(bit,(void *)pxm_flag)) | 417 | #define pxm_bit_test(bit) (test_bit(bit,(void *)pxm_flag)) |
418 | /* maps to convert between proximity domain and logical node ID */ | ||
419 | int __devinitdata pxm_to_nid_map[MAX_PXM_DOMAINS]; | ||
420 | int __initdata nid_to_pxm_map[MAX_NUMNODES]; | ||
421 | static struct acpi_table_slit __initdata *slit_table; | 418 | static struct acpi_table_slit __initdata *slit_table; |
422 | 419 | ||
423 | static int get_processor_proximity_domain(struct acpi_table_processor_affinity *pa) | 420 | static int get_processor_proximity_domain(struct acpi_table_processor_affinity *pa) |
@@ -533,22 +530,17 @@ void __init acpi_numa_arch_fixup(void) | |||
533 | * MCD - This can probably be dropped now. No need for pxm ID to node ID | 530 | * MCD - This can probably be dropped now. No need for pxm ID to node ID |
534 | * mapping with sparse node numbering iff MAX_PXM_DOMAINS <= MAX_NUMNODES. | 531 | * mapping with sparse node numbering iff MAX_PXM_DOMAINS <= MAX_NUMNODES. |
535 | */ | 532 | */ |
536 | /* calculate total number of nodes in system from PXM bitmap */ | ||
537 | memset(pxm_to_nid_map, -1, sizeof(pxm_to_nid_map)); | ||
538 | memset(nid_to_pxm_map, -1, sizeof(nid_to_pxm_map)); | ||
539 | nodes_clear(node_online_map); | 533 | nodes_clear(node_online_map); |
540 | for (i = 0; i < MAX_PXM_DOMAINS; i++) { | 534 | for (i = 0; i < MAX_PXM_DOMAINS; i++) { |
541 | if (pxm_bit_test(i)) { | 535 | if (pxm_bit_test(i)) { |
542 | int nid = num_online_nodes(); | 536 | int nid = acpi_map_pxm_to_node(i); |
543 | pxm_to_nid_map[i] = nid; | ||
544 | nid_to_pxm_map[nid] = i; | ||
545 | node_set_online(nid); | 537 | node_set_online(nid); |
546 | } | 538 | } |
547 | } | 539 | } |
548 | 540 | ||
549 | /* set logical node id in memory chunk structure */ | 541 | /* set logical node id in memory chunk structure */ |
550 | for (i = 0; i < num_node_memblks; i++) | 542 | for (i = 0; i < num_node_memblks; i++) |
551 | node_memblk[i].nid = pxm_to_nid_map[node_memblk[i].nid]; | 543 | node_memblk[i].nid = pxm_to_node(node_memblk[i].nid); |
552 | 544 | ||
553 | /* assign memory bank numbers for each chunk on each node */ | 545 | /* assign memory bank numbers for each chunk on each node */ |
554 | for_each_online_node(i) { | 546 | for_each_online_node(i) { |
@@ -562,7 +554,7 @@ void __init acpi_numa_arch_fixup(void) | |||
562 | 554 | ||
563 | /* set logical node id in cpu structure */ | 555 | /* set logical node id in cpu structure */ |
564 | for (i = 0; i < srat_num_cpus; i++) | 556 | for (i = 0; i < srat_num_cpus; i++) |
565 | node_cpuid[i].nid = pxm_to_nid_map[node_cpuid[i].nid]; | 557 | node_cpuid[i].nid = pxm_to_node(node_cpuid[i].nid); |
566 | 558 | ||
567 | printk(KERN_INFO "Number of logical nodes in system = %d\n", | 559 | printk(KERN_INFO "Number of logical nodes in system = %d\n", |
568 | num_online_nodes()); | 560 | num_online_nodes()); |
@@ -575,11 +567,11 @@ void __init acpi_numa_arch_fixup(void) | |||
575 | for (i = 0; i < slit_table->localities; i++) { | 567 | for (i = 0; i < slit_table->localities; i++) { |
576 | if (!pxm_bit_test(i)) | 568 | if (!pxm_bit_test(i)) |
577 | continue; | 569 | continue; |
578 | node_from = pxm_to_nid_map[i]; | 570 | node_from = pxm_to_node(i); |
579 | for (j = 0; j < slit_table->localities; j++) { | 571 | for (j = 0; j < slit_table->localities; j++) { |
580 | if (!pxm_bit_test(j)) | 572 | if (!pxm_bit_test(j)) |
581 | continue; | 573 | continue; |
582 | node_to = pxm_to_nid_map[j]; | 574 | node_to = pxm_to_node(j); |
583 | node_distance(node_from, node_to) = | 575 | node_distance(node_from, node_to) = |
584 | slit_table->entry[i * slit_table->localities + j]; | 576 | slit_table->entry[i * slit_table->localities + j]; |
585 | } | 577 | } |
@@ -785,9 +777,9 @@ int acpi_map_cpu2node(acpi_handle handle, int cpu, long physid) | |||
785 | 777 | ||
786 | /* | 778 | /* |
787 | * Assuming that the container driver would have set the proximity | 779 | * Assuming that the container driver would have set the proximity |
788 | * domain and would have initialized pxm_to_nid_map[pxm_id] && pxm_flag | 780 | * domain and would have initialized pxm_to_node(pxm_id) && pxm_flag |
789 | */ | 781 | */ |
790 | node_cpuid[cpu].nid = (pxm_id < 0) ? 0 : pxm_to_nid_map[pxm_id]; | 782 | node_cpuid[cpu].nid = (pxm_id < 0) ? 0 : pxm_to_node(pxm_id); |
791 | 783 | ||
792 | node_cpuid[cpu].phys_id = physid; | 784 | node_cpuid[cpu].phys_id = physid; |
793 | #endif | 785 | #endif |
@@ -966,7 +958,7 @@ acpi_map_iosapic(acpi_handle handle, u32 depth, void *context, void **ret) | |||
966 | if (pxm < 0) | 958 | if (pxm < 0) |
967 | return AE_OK; | 959 | return AE_OK; |
968 | 960 | ||
969 | node = pxm_to_nid_map[pxm]; | 961 | node = pxm_to_node(pxm); |
970 | 962 | ||
971 | if (node >= MAX_NUMNODES || !node_online(node) || | 963 | if (node >= MAX_NUMNODES || !node_online(node) || |
972 | cpus_empty(node_to_cpumask(node))) | 964 | cpus_empty(node_to_cpumask(node))) |