]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/i386/cpu_topology.c
xnu-3789.70.16.tar.gz
[apple/xnu.git] / osfmk / i386 / cpu_topology.c
index 6be77e6ffb3b04f2a97cb6ce149ca3ca72fa54a6..a8517d148d92ff9ba4d5274e93d48a3d3bb12904 100644 (file)
@@ -33,7 +33,7 @@
 #include <i386/cpu_topology.h>
 #include <i386/cpu_threads.h>
 #include <i386/machine_cpu.h>
-#include <i386/lock.h>
+#include <i386/bit_routines.h>
 #include <i386/cpu_data.h>
 #include <i386/lapic.h>
 #include <i386/machine_routines.h>
@@ -106,17 +106,10 @@ cpu_topology_sort(int ncpus)
        }
 
        /*
-        * Fix up logical numbers and reset the map kept by the lapic code.
+        * Finalize logical numbers and map kept by the lapic code.
         */
-       for (i = 1; i < ncpus; i++) {
+       for (i = 0; i < ncpus; i++) {
                cpu_data_t      *cpup = cpu_datap(i);
-               x86_core_t      *core = cpup->lcpu.core;
-               x86_die_t       *die  = cpup->lcpu.die;
-               x86_pkg_t       *pkg  = cpup->lcpu.package;
-
-               assert(core != NULL);
-               assert(die != NULL);
-               assert(pkg != NULL);
 
                if (cpup->cpu_number != i) {
                        kprintf("cpu_datap(%d):%p local apic id 0x%x "
@@ -125,16 +118,11 @@ cpu_topology_sort(int ncpus)
                                cpup->cpu_number);
                }
                cpup->cpu_number = i;
-               cpup->lcpu.cpu_num = i;
-               cpup->lcpu.pnum = cpup->cpu_phys_number;
                lapic_cpu_map(cpup->cpu_phys_number, i);
-               x86_set_lcpu_numbers(&cpup->lcpu);
-               x86_set_core_numbers(core, &cpup->lcpu);
-               x86_set_die_numbers(die, &cpup->lcpu);
-               x86_set_pkg_numbers(pkg, &cpup->lcpu);
+               x86_set_logical_topology(&cpup->lcpu, cpup->cpu_phys_number, i);
        }
 
-       validate_topology();
+       x86_validate_topology();
 
        ml_set_interrupts_enabled(istate);
        TOPO_DBG("cpu_topology_start() LLC is L%d\n", topoParms.LLCDepth + 1);
@@ -187,7 +175,7 @@ cpu_topology_sort(int ncpus)
                        if (lcpup->lnum == 0)
                                lprim = cpup->cpu_processor;
 
-                       processor_meta_init(cpup->cpu_processor, lprim);
+                       processor_set_primary(cpup->cpu_processor, lprim);
                }
        }
 }