aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64
diff options
context:
space:
mode:
authorYasunori Goto <y-goto@jp.fujitsu.com>2006-06-23 05:03:19 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-23 10:42:48 -0400
commit762834e8bf46bf41ce9034d062a7c1f8563175f3 (patch)
treefb134ef41772ba61050a08cc4ed92c50cd057658 /arch/ia64
parentd6277db4ab271862ed599da08d78961c70f00002 (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')
-rw-r--r--arch/ia64/hp/common/sba_iommu.c2
-rw-r--r--arch/ia64/kernel/acpi.c24
-rw-r--r--arch/ia64/pci/pci.c2
-rw-r--r--arch/ia64/sn/kernel/setup.c4
4 files changed, 12 insertions, 20 deletions
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
index bdccd0b1eb60..3ce443e6c016 100644
--- a/arch/ia64/hp/common/sba_iommu.c
+++ b/arch/ia64/hp/common/sba_iommu.c
@@ -1958,7 +1958,7 @@ sba_map_ioc_to_node(struct ioc *ioc, acpi_handle handle)
1958 if (pxm < 0) 1958 if (pxm < 0)
1959 return; 1959 return;
1960 1960
1961 node = pxm_to_nid_map[pxm]; 1961 node = pxm_to_node(pxm);
1962 1962
1963 if (node >= MAX_NUMNODES || !node_online(node)) 1963 if (node >= MAX_NUMNODES || !node_online(node))
1964 return; 1964 return;
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 */
415static u32 __devinitdata pxm_flag[PXM_FLAG_LEN]; 415static 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 */
419int __devinitdata pxm_to_nid_map[MAX_PXM_DOMAINS];
420int __initdata nid_to_pxm_map[MAX_NUMNODES];
421static struct acpi_table_slit __initdata *slit_table; 418static struct acpi_table_slit __initdata *slit_table;
422 419
423static int get_processor_proximity_domain(struct acpi_table_processor_affinity *pa) 420static 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)))
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index ab829a22f8a4..cf7751b99d1c 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -352,7 +352,7 @@ pci_acpi_scan_root(struct acpi_device *device, int domain, int bus)
352 pxm = acpi_get_pxm(controller->acpi_handle); 352 pxm = acpi_get_pxm(controller->acpi_handle);
353#ifdef CONFIG_NUMA 353#ifdef CONFIG_NUMA
354 if (pxm >= 0) 354 if (pxm >= 0)
355 controller->node = pxm_to_nid_map[pxm]; 355 controller->node = pxm_to_node(pxm);
356#endif 356#endif
357 357
358 acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_window, 358 acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_window,
diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c
index 30988dfbddff..93577abae36d 100644
--- a/arch/ia64/sn/kernel/setup.c
+++ b/arch/ia64/sn/kernel/setup.c
@@ -139,7 +139,7 @@ static int __init pxm_to_nasid(int pxm)
139 int i; 139 int i;
140 int nid; 140 int nid;
141 141
142 nid = pxm_to_nid_map[pxm]; 142 nid = pxm_to_node(pxm);
143 for (i = 0; i < num_node_memblks; i++) { 143 for (i = 0; i < num_node_memblks; i++) {
144 if (node_memblk[i].nid == nid) { 144 if (node_memblk[i].nid == nid) {
145 return NASID_GET(node_memblk[i].start_paddr); 145 return NASID_GET(node_memblk[i].start_paddr);
@@ -704,7 +704,7 @@ void __init build_cnode_tables(void)
704 * cnode == node for all C & M bricks. 704 * cnode == node for all C & M bricks.
705 */ 705 */
706 for_each_online_node(node) { 706 for_each_online_node(node) {
707 nasid = pxm_to_nasid(nid_to_pxm_map[node]); 707 nasid = pxm_to_nasid(node_to_pxm(node));
708 sn_cnodeid_to_nasid[node] = nasid; 708 sn_cnodeid_to_nasid[node] = nasid;
709 physical_node_map[nasid] = node; 709 physical_node_map[nasid] = node;
710 } 710 }