diff options
author | Eric Biederman <ebiederm@xmission.com> | 2004-10-14 19:29:29 +0000 |
---|---|---|
committer | Eric Biederman <ebiederm@xmission.com> | 2004-10-14 19:29:29 +0000 |
commit | fcd5ace00b333ce31b11b02a2243dfbf39307f10 (patch) | |
tree | d686d752ccea9b185b0008c70d8523749b26e2dd /src/cpu/intel/hyperthreading/intel_sibling.c | |
parent | 98e619b1cefcb9871185f4cc3db85fa430dcdbce (diff) | |
download | coreboot-fcd5ace00b333ce31b11b02a2243dfbf39307f10.tar.xz |
- Add new cvs code to cvs
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1657 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/cpu/intel/hyperthreading/intel_sibling.c')
-rw-r--r-- | src/cpu/intel/hyperthreading/intel_sibling.c | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/src/cpu/intel/hyperthreading/intel_sibling.c b/src/cpu/intel/hyperthreading/intel_sibling.c new file mode 100644 index 0000000000..001fea81b2 --- /dev/null +++ b/src/cpu/intel/hyperthreading/intel_sibling.c @@ -0,0 +1,74 @@ +#include <console/console.h> +#include <cpu/cpu.h> +#include <cpu/x86/lapic.h> +#include <cpu/intel/hyperthreading.h> +#include <device/device.h> +#include <pc80/mc146818rtc.h> +#include <smp/spinlock.h> + +static int first_time = 1; +static int disable_siblings = !CONFIG_LOGICAL_CPUS; + +void intel_sibling_init(device_t cpu) +{ + unsigned i, siblings; + struct cpuid_result result; + + /* On the bootstrap processor see if I want sibling cpus enabled */ + if (first_time) { + first_time = 0; + get_option(&disable_siblings, "hyper_threading"); + } + result = cpuid(1); + /* Is hypethreading supported */ + if (!(result.edx & (1 << 28))) { + return; + } + /* See how many sibling cpus we have */ + siblings = (result.ebx >> 16) & 0xff; + if (siblings < 1) { + siblings = 1; + } + +#if 1 + printk_debug("CPU: %u %d siblings\n", + cpu->path.u.apic.apic_id, + siblings); +#endif + + /* See if I am a sibling cpu */ + if (cpu->path.u.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; + unsigned long count; + /* Build the cpu device path */ + cpu_path.type = DEVICE_PATH_APIC; + cpu_path.u.apic.apic_id = cpu->path.u.apic.apic_id + i; + + + /* Allocate the new cpu device structure */ + new = alloc_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 */ + start_cpu(new); + } + +} + |