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 hyperthreading supported */
24 if (!(result.edx & (1 << 28))) {
27 /* See how many sibling cpus we have */
28 siblings = (result.ebx >> 16) & 0xff;
34 printk(BIOS_DEBUG, "CPU: %u %d siblings\n",
35 cpu->path.apic.apic_id,
39 /* See if I am a sibling cpu */
40 if (cpu->path.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;
51 /* Build the cpu device path */
52 cpu_path.type = DEVICE_PATH_APIC;
53 cpu_path.apic.apic_id = cpu->path.apic.apic_id + i;
56 /* Allocate the new cpu device structure */
57 new = alloc_dev(cpu->bus, &cpu_path);
64 printk(BIOS_DEBUG, "CPU: %u has sibling %u\n",
65 cpu->path.apic.apic_id,
66 new->path.apic.apic_id);
68 /* Start the new cpu */
69 if (!start_cpu(new)) {
70 /* Record the error in cpu? */
71 printk(BIOS_ERR, "CPU %u would not start!\n",
72 new->path.apic.apic_id);