Intel cpus: copy model_6ex CAR code
[coreboot.git] / src / cpu / intel / hyperthreading / intel_sibling.c
index 13bfdf35fb1ce8782a7417d3c4c6374bafae4918..e988664ddaafdc28322bf459f4734d2e81be88a1 100644 (file)
@@ -5,6 +5,11 @@
 #include <device/device.h>
 #include <pc80/mc146818rtc.h>
 #include <smp/spinlock.h>
+#include <assert.h>
+
+#if CONFIG_SERIAL_CPU_INIT==0
+#error Intel hyper-threading requires serialized cpu init
+#endif
 
 static int first_time = 1;
 static int disable_siblings = !CONFIG_LOGICAL_CPUS;
@@ -20,7 +25,7 @@ void intel_sibling_init(device_t cpu)
                get_option(&disable_siblings, "hyper_threading");
        }
        result = cpuid(1);
-       /* Is hypethreading supported */
+       /* Is hyperthreading supported */
        if (!(result.edx & (1 << 28))) {
                return;
        }
@@ -30,48 +35,39 @@ void intel_sibling_init(device_t cpu)
                siblings = 1;
        }
 
-#if 1
-       printk_debug("CPU: %u %d siblings\n",
-               cpu->path.u.apic.apic_id,
+       printk(BIOS_DEBUG, "CPU: %u %d siblings\n",
+               cpu->path.apic.apic_id,
                siblings);
-#endif
 
        /* See if I am a sibling cpu */
-       if (cpu->path.u.apic.apic_id & (siblings -1)) {
+       if (cpu->path.apic.apic_id & (siblings -1)) {
                if (disable_siblings) {
                        cpu->enabled = 0;
                }
                return;
        }
-       
+
        /* I am the primary cpu start up my siblings */
        for(i = 1; i < siblings; i++) {
                struct device_path cpu_path;
                device_t new;
                /* Build the cpu device path */
                cpu_path.type = DEVICE_PATH_APIC;
-               cpu_path.u.apic.apic_id = cpu->path.u.apic.apic_id + i;
+               cpu_path.apic.apic_id = cpu->path.apic.apic_id + i;
 
 
-               /* Allocate the new cpu device structure */
-               new = alloc_dev(cpu->bus, &cpu_path);
+               /* Allocate new cpu device structure iff sibling CPU
+                * was not in static device tree.
+                */
+               new = alloc_find_dev(cpu->bus, &cpu_path);
 
                if (!new) {
                        continue;
                }
 
-#if 1
-               printk_debug("CPU: %u has sibling %u\n", 
-                       cpu->path.u.apic.apic_id,
-                       new->path.u.apic.apic_id);
-#endif
-               /* Start the new cpu */
-               if (!start_cpu(new)) {
-                       /* Record the error in cpu? */
-                       printk_err("CPU %u would not start!\n",
-                               new->path.u.apic.apic_id);
-               }
+               printk(BIOS_DEBUG, "CPU: %u has sibling %u\n",
+                       cpu->path.apic.apic_id,
+                       new->path.apic.apic_id);
        }
-       
 }