MADT MP probe: Rework cpuid mapping, and cpuid to apicid mapping
- Don't use the ACPI ProcessorID as our cpuid, some BIOSes count ProcessorID
from 1, and ACPI standards actually allow that. Instead, except for BSP,
we set the processor's cpuid in the order that we found the MADT LAPIC
entry.
- Since MADT does not provide a way to identify the BSP, we will have to do
it ourselves:
Split the madt_parse() into three parts:
o madt_check(), preliminary length and revision check.
o madt_pass1(), locate the LAPIC address.
o madt_pass2(), set mp_naps and map cpuid to apicid.
After madt_pass1(), the lapic is mapped, so we could get the current CPU's
apic id. Since the current CPU is BSP, we have the BSP's apic id.
In madt_pass2(), we match the MADT LAPIC entry's apic_id field against the
the value read from the current CPU's lapic id field. Any matching means
that entry contains information concerning BSP.
Reported-by: tuxillo on EFnet #dragonflybsd