Honor maxcores Reference: /n/patches.lsub.org/patch/mpacpifix.2 Date: Mon Jul 16 15:47:22 CES 2012 Signed-off-by: paurea@lsub.org --- /sys/src/nix/k10/mp.c Thu Jul 12 15:17:52 2012 +++ /sys/src/nix/k10/mp.c Mon Jul 16 15:18:51 2012 @@ -417,7 +417,7 @@ mpsinit(int maxcores) { u8int *p; - int i, n; + int i, n, ncleft; _MP_ *mp; PCMP *pcmp; @@ -479,8 +479,8 @@ * for later interrupt enabling and application processor * startup. */ - maxcores = mpparse(pcmp, maxcores); - mpacpi(maxcores); + ncleft = mpparse(pcmp, maxcores); + mpacpi(ncleft); apicdump(); ioapicdump(); --- /sys/src/nix/k10/mpacpi.c Thu Jul 5 23:25:04 2012 +++ /sys/src/nix/k10/mpacpi.c Mon Jul 16 15:45:23 2012 @@ -11,7 +11,7 @@ extern Madt *apics; int -mpacpi(int maxcores) +mpacpi(int ncleft) { char *already; int np, bp; @@ -25,16 +25,20 @@ already = ""; switch(st->type){ case ASlapic: - if(st->lapic.id > Napic || np == maxcores) + /* this table is supposed to have all of them if it exists */ + if(st->lapic.id > Napic) break; apic = xlapic + st->lapic.id; bp = (np++ == 0); if(apic->useable){ already = "(mp)"; - goto pr; } - apicinit(st->lapic.id, apics->lapicpa, bp); - pr: + else if(ncleft != 0){ + ncleft--; + apicinit(st->lapic.id, apics->lapicpa, bp); + } else + already = "(off)"; + print("apic proc %d/%d apicid %d %s\n", np-1, apic->machno, st->lapic.id, already); break; case ASioapic: @@ -53,5 +57,5 @@ break; } } - return maxcores - np; + return ncleft; }