[PATCH] Unify pxm_to_node() and node_to_pxm()
[deliverable/linux.git] / arch / ia64 / kernel / acpi.c
index 58c93a30348cdfdc43bd6b7c5acbf36245141b75..d1c52cf678824ca380cc2b7c02b67718c167c676 100644 (file)
@@ -415,9 +415,6 @@ static int __initdata srat_num_cpus;        /* number of cpus */
 static u32 __devinitdata pxm_flag[PXM_FLAG_LEN];
 #define pxm_bit_set(bit)       (set_bit(bit,(void *)pxm_flag))
 #define pxm_bit_test(bit)      (test_bit(bit,(void *)pxm_flag))
-/* maps to convert between proximity domain and logical node ID */
-int __devinitdata pxm_to_nid_map[MAX_PXM_DOMAINS];
-int __initdata nid_to_pxm_map[MAX_NUMNODES];
 static struct acpi_table_slit __initdata *slit_table;
 
 static int get_processor_proximity_domain(struct acpi_table_processor_affinity *pa)
@@ -533,22 +530,17 @@ void __init acpi_numa_arch_fixup(void)
         * MCD - This can probably be dropped now.  No need for pxm ID to node ID
         * mapping with sparse node numbering iff MAX_PXM_DOMAINS <= MAX_NUMNODES.
         */
-       /* calculate total number of nodes in system from PXM bitmap */
-       memset(pxm_to_nid_map, -1, sizeof(pxm_to_nid_map));
-       memset(nid_to_pxm_map, -1, sizeof(nid_to_pxm_map));
        nodes_clear(node_online_map);
        for (i = 0; i < MAX_PXM_DOMAINS; i++) {
                if (pxm_bit_test(i)) {
-                       int nid = num_online_nodes();
-                       pxm_to_nid_map[i] = nid;
-                       nid_to_pxm_map[nid] = i;
+                       int nid = acpi_map_pxm_to_node(i);
                        node_set_online(nid);
                }
        }
 
        /* set logical node id in memory chunk structure */
        for (i = 0; i < num_node_memblks; i++)
-               node_memblk[i].nid = pxm_to_nid_map[node_memblk[i].nid];
+               node_memblk[i].nid = pxm_to_node(node_memblk[i].nid);
 
        /* assign memory bank numbers for each chunk on each node */
        for_each_online_node(i) {
@@ -562,7 +554,7 @@ void __init acpi_numa_arch_fixup(void)
 
        /* set logical node id in cpu structure */
        for (i = 0; i < srat_num_cpus; i++)
-               node_cpuid[i].nid = pxm_to_nid_map[node_cpuid[i].nid];
+               node_cpuid[i].nid = pxm_to_node(node_cpuid[i].nid);
 
        printk(KERN_INFO "Number of logical nodes in system = %d\n",
               num_online_nodes());
@@ -575,11 +567,11 @@ void __init acpi_numa_arch_fixup(void)
        for (i = 0; i < slit_table->localities; i++) {
                if (!pxm_bit_test(i))
                        continue;
-               node_from = pxm_to_nid_map[i];
+               node_from = pxm_to_node(i);
                for (j = 0; j < slit_table->localities; j++) {
                        if (!pxm_bit_test(j))
                                continue;
-                       node_to = pxm_to_nid_map[j];
+                       node_to = pxm_to_node(j);
                        node_distance(node_from, node_to) =
                            slit_table->entry[i * slit_table->localities + j];
                }
@@ -785,9 +777,9 @@ int acpi_map_cpu2node(acpi_handle handle, int cpu, long physid)
 
        /*
         * Assuming that the container driver would have set the proximity
-        * domain and would have initialized pxm_to_nid_map[pxm_id] && pxm_flag
+        * domain and would have initialized pxm_to_node(pxm_id) && pxm_flag
         */
-       node_cpuid[cpu].nid = (pxm_id < 0) ? 0 : pxm_to_nid_map[pxm_id];
+       node_cpuid[cpu].nid = (pxm_id < 0) ? 0 : pxm_to_node(pxm_id);
 
        node_cpuid[cpu].phys_id = physid;
 #endif
@@ -966,7 +958,7 @@ acpi_map_iosapic(acpi_handle handle, u32 depth, void *context, void **ret)
        if (pxm < 0)
                return AE_OK;
 
-       node = pxm_to_nid_map[pxm];
+       node = pxm_to_node(pxm);
 
        if (node >= MAX_NUMNODES || !node_online(node) ||
            cpus_empty(node_to_cpumask(node)))
This page took 0.029234 seconds and 5 git commands to generate.