diff options
author | jhb <jhb@FreeBSD.org> | 2010-11-08 20:35:09 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2010-11-08 20:35:09 +0000 |
commit | bfc0fcbf5e493e04a8ec66e9d8c0b98cbe5db075 (patch) | |
tree | 6c6aa98a717af619eb82b7f2f15c5e0a2c1b1346 /sys/i386 | |
parent | dc5dbf87bcf2448420a9cacb5bc705c887318325 (diff) | |
download | FreeBSD-src-bfc0fcbf5e493e04a8ec66e9d8c0b98cbe5db075.zip FreeBSD-src-bfc0fcbf5e493e04a8ec66e9d8c0b98cbe5db075.tar.gz |
Sync the APIC startup sequence with amd64:
- Register APIC enumerators at SI_SUB_TUNABLES - 1 instead of SI_SUB_CPU - 1.
- Probe CPUs at SI_SUB_TUNABLES - 1. This allows i386 to set a truly
accurate mp_maxid value rather than always setting it to MAXCPU - 1.
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/acpica/madt.c | 2 | ||||
-rw-r--r-- | sys/i386/i386/mp_machdep.c | 19 | ||||
-rw-r--r-- | sys/i386/xen/mptable.c | 2 |
3 files changed, 19 insertions, 4 deletions
diff --git a/sys/i386/acpica/madt.c b/sys/i386/acpica/madt.c index bcf60b1..13bbb55 100644 --- a/sys/i386/acpica/madt.c +++ b/sys/i386/acpica/madt.c @@ -203,7 +203,7 @@ madt_register(void *dummy __unused) apic_register_enumerator(&madt_enumerator); } -SYSINIT(madt_register, SI_SUB_CPU - 1, SI_ORDER_SECOND, madt_register, NULL); +SYSINIT(madt_register, SI_SUB_TUNABLES - 1, SI_ORDER_FIRST, madt_register, NULL); /* * Call the handler routine for each entry in the MADT table. diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c index c4d2672..871ccb4 100644 --- a/sys/i386/i386/mp_machdep.c +++ b/sys/i386/i386/mp_machdep.c @@ -465,8 +465,10 @@ cpu_add(u_int apic_id, char boot_cpu) boot_cpu_id = apic_id; cpu_info[apic_id].cpu_bsp = 1; } - if (mp_ncpus < MAXCPU) + if (mp_ncpus < MAXCPU) { mp_ncpus++; + mp_maxid = mp_ncpus - 1; + } if (bootverbose) printf("SMP: Added CPU %d (%s)\n", apic_id, boot_cpu ? "BSP" : "AP"); @@ -476,7 +478,19 @@ void cpu_mp_setmaxid(void) { - mp_maxid = MAXCPU - 1; + /* + * mp_maxid should be already set by calls to cpu_add(). + * Just sanity check its value here. + */ + if (mp_ncpus == 0) + KASSERT(mp_maxid == 0, + ("%s: mp_ncpus is zero, but mp_maxid is not", __func__)); + else if (mp_ncpus == 1) + mp_maxid = 0; + else + KASSERT(mp_maxid >= mp_ncpus - 1, + ("%s: counters out of sync: max %d, count %d", __func__, + mp_maxid, mp_ncpus)); } int @@ -504,6 +518,7 @@ cpu_mp_probe(void) * One CPU was found, so this must be a UP system with * an I/O APIC. */ + mp_maxid = 0; return (0); } diff --git a/sys/i386/xen/mptable.c b/sys/i386/xen/mptable.c index fe01cd5..d9942ab 100644 --- a/sys/i386/xen/mptable.c +++ b/sys/i386/xen/mptable.c @@ -109,7 +109,7 @@ mptable_register(void *dummy __unused) apic_register_enumerator(&mptable_enumerator); } -SYSINIT(mptable_register, SI_SUB_CPU - 1, SI_ORDER_FIRST, mptable_register, +SYSINIT(mptable_register, SI_SUB_TUNABLES - 1, SI_ORDER_FIRST, mptable_register, NULL); |