1 #include <console/console.h>
3 #include <cpu/x86/lapic.h>
4 #include <cpu/intel/hyperthreading.h>
5 #include <device/device.h>
6 #include <pc80/mc146818rtc.h>
7 #include <smp/spinlock.h>
9 static int first_time = 1;
10 static int disable_siblings = !CONFIG_LOGICAL_CPUS;
12 void intel_sibling_init(device_t cpu)
15 struct cpuid_result result;
17 /* On the bootstrap processor see if I want sibling cpus enabled */
20 get_option(&disable_siblings, "hyper_threading");
23 /* Is hypethreading supported */
24 if (!(result.edx & (1 << 28))) {
27 /* See how many sibling cpus we have */
28 siblings = (result.ebx >> 16) & 0xff;
34 printk_debug("CPU: %u %d siblings\n",
35 cpu->path.u.apic.apic_id,
39 /* See if I am a sibling cpu */
40 if (cpu->path.u.apic.apic_id & (siblings -1)) {
41 if (disable_siblings) {
47 /* I am the primary cpu start up my siblings */
48 for(i = 1; i < siblings; i++) {
49 struct device_path cpu_path;
52 /* Build the cpu device path */
53 cpu_path.type = DEVICE_PATH_APIC;
54 cpu_path.u.apic.apic_id = cpu->path.u.apic.apic_id + i;
57 /* Allocate the new cpu device structure */
58 new = alloc_dev(cpu->bus, &cpu_path);
65 printk_debug("CPU: %u has sibling %u\n",
66 cpu->path.u.apic.apic_id,
67 new->path.u.apic.apic_id);
69 /* Start the new cpu */