SMP: remove the tracking of apic id -> cpu id. Don't pass between bootloader and kernel.

Kernel doesn't use it, and it could be regenerated in the kernel if it did need it.

This also unlocks the apic range the bios can use. Previously the apic ids would have
to fit within 0..MAX_CPUS or it'd reject the cpu. Some boxes (mine in particular)
seem to sparsely populate the apic id so that the range is pretty large.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37108 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Travis Geiselbrecht 2010-06-12 01:01:54 +00:00
parent 977ffe5233
commit 9623c48284
3 changed files with 7 additions and 21 deletions

View File

@ -38,7 +38,6 @@ typedef struct {
uint32 ioapic_phys;
uint32 *ioapic;
uint32 cpu_apic_id[MAX_BOOT_CPUS];
uint32 cpu_os_id[MAX_BOOT_CPUS];
uint32 cpu_apic_version[MAX_BOOT_CPUS];
// hpet stuff
uint32 hpet_phys;

View File

@ -78,8 +78,13 @@ smp_get_current_cpu(void)
if (gKernelArgs.arch_args.apic == NULL)
return 0;
return gKernelArgs.arch_args.cpu_os_id[
(apic_read(APIC_ID) & 0xffffffff) >> 24];
uint8_t apic_id = (apic_read(APIC_ID) & 0xffffffff) >> 24;
for (int i = 0; i < gKernelArgs.num_cpus; i++) {
if (gKernelArgs.arch_args.cpu_apic_id[i] == apic_id)
return i;
}
return 0;
}
@ -165,16 +170,8 @@ smp_do_mp_config(mp_floating_struct *floatingStruct)
continue;
}
// skip if the apic id is too large
if (processor->apic_id >= MAX_BOOT_CPUS) {
TRACE(("smp: apic id too large (%d)\n", processor->apic_id));
continue;
}
gKernelArgs.arch_args.cpu_apic_id[gKernelArgs.num_cpus]
= processor->apic_id;
gKernelArgs.arch_args.cpu_os_id[processor->apic_id]
= gKernelArgs.num_cpus;
gKernelArgs.arch_args.cpu_apic_version[gKernelArgs.num_cpus]
= processor->apic_version;
@ -280,16 +277,8 @@ smp_do_acpi_config(void)
break;
}
// skip if the apic id is too large
if (localApic->apic_id >= MAX_BOOT_CPUS) {
TRACE(("smp: apic id too large (%d)\n", localApic->apic_id));
break;
}
gKernelArgs.arch_args.cpu_apic_id[gKernelArgs.num_cpus]
= localApic->apic_id;
gKernelArgs.arch_args.cpu_os_id[localApic->apic_id]
= gKernelArgs.num_cpus;
// TODO: how to find out? putting 0x10 in to indicate a local apic
gKernelArgs.arch_args.cpu_apic_version[gKernelArgs.num_cpus]
= 0x10;

View File

@ -34,7 +34,6 @@
#endif
static uint32 sCPUAPICIds[B_MAX_CPU_COUNT];
static uint32 sCPUOSIds[B_MAX_CPU_COUNT];
static uint32 sAPICVersions[B_MAX_CPU_COUNT];
extern "C" void init_sse(void);
@ -84,7 +83,6 @@ arch_smp_init(kernel_args *args)
// setup some globals
memcpy(sCPUAPICIds, args->arch_args.cpu_apic_id, sizeof(args->arch_args.cpu_apic_id));
memcpy(sCPUOSIds, args->arch_args.cpu_os_id, sizeof(args->arch_args.cpu_os_id));
memcpy(sAPICVersions, args->arch_args.cpu_apic_version, sizeof(args->arch_args.cpu_apic_version));
// set up the local apic on the boot cpu