--- //depot/projects/smpng/sys/amd64/amd64/mp_machdep.c 2011-01-14 18:03:53.000000000 0000 +++ //depot/user/jhb/ktrace/amd64/amd64/mp_machdep.c 2011-05-13 14:21:01.000000000 0000 @@ -983,13 +983,17 @@ /* wait for pending status end */ lapic_ipi_wait(-1); - /* do an INIT IPI: deassert RESET */ - lapic_ipi_raw(APIC_DEST_ALLESELF | APIC_TRIGMOD_LEVEL | - APIC_LEVEL_DEASSERT | APIC_DESTMODE_PHY | APIC_DELMODE_INIT, 0); + if (lapic_version() < 0x14) { + /* do an INIT IPI: deassert RESET */ + lapic_ipi_raw(APIC_DEST_ALLESELF | APIC_TRIGMOD_LEVEL | + APIC_LEVEL_DEASSERT | APIC_DESTMODE_PHY | APIC_DELMODE_INIT, 0); + + /* wait for pending status end */ + lapic_ipi_wait(-1); + } - /* wait for pending status end */ - DELAY(10000); /* wait ~10mS */ - lapic_ipi_wait(-1); + /* wait ~10mS */ + DELAY(10000); /* * next we do a STARTUP IPI: the previous INIT IPI might still be --- //depot/projects/smpng/sys/amd64/include/apicvar.h 2010-09-21 20:19:24.000000000 0000 +++ //depot/user/jhb/ktrace/amd64/include/apicvar.h 2011-05-13 14:21:01.000000000 0000 @@ -227,6 +227,7 @@ enum intr_trigger trigger); void lapic_set_tpr(u_int vector); void lapic_setup(int boot); +int lapic_version(void); #endif /* !LOCORE */ #endif /* _MACHINE_APICVAR_H_ */ --- //depot/projects/smpng/sys/i386/i386/mp_machdep.c 2010-11-08 20:38:02.000000000 0000 +++ //depot/user/jhb/ktrace/i386/i386/mp_machdep.c 2011-05-13 14:21:01.000000000 0000 @@ -1086,13 +1086,17 @@ /* wait for pending status end */ lapic_ipi_wait(-1); - /* do an INIT IPI: deassert RESET */ - lapic_ipi_raw(APIC_DEST_ALLESELF | APIC_TRIGMOD_LEVEL | - APIC_LEVEL_DEASSERT | APIC_DESTMODE_PHY | APIC_DELMODE_INIT, 0); + if (lapic_version() < 0x14) { + /* do an INIT IPI: deassert RESET */ + lapic_ipi_raw(APIC_DEST_ALLESELF | APIC_TRIGMOD_LEVEL | + APIC_LEVEL_DEASSERT | APIC_DESTMODE_PHY | APIC_DELMODE_INIT, 0); + + /* wait for pending status end */ + lapic_ipi_wait(-1); + } - /* wait for pending status end */ - DELAY(10000); /* wait ~10mS */ - lapic_ipi_wait(-1); + /* wait ~10mS */ + DELAY(10000); /* * next we do a STARTUP IPI: the previous INIT IPI might still be --- //depot/projects/smpng/sys/i386/include/apicvar.h 2010-09-21 20:19:24.000000000 0000 +++ //depot/user/jhb/ktrace/i386/include/apicvar.h 2011-05-13 14:21:01.000000000 0000 @@ -255,6 +255,7 @@ enum intr_trigger trigger); void lapic_set_tpr(u_int vector); void lapic_setup(int boot); +int lapic_version(void); #endif /* !LOCORE */ #endif /* _MACHINE_APICVAR_H_ */ --- //depot/projects/smpng/sys/x86/x86/io_apic.c 2011-01-05 17:06:25.000000000 0000 +++ //depot/user/jhb/ktrace/x86/x86/io_apic.c 2011-05-13 14:21:01.000000000 0000 @@ -97,7 +97,6 @@ struct ioapic { struct pic io_pic; u_int io_id:8; /* logical ID */ - u_int io_apic_id:4; u_int io_intbase:8; /* System Interrupt base */ u_int io_numintr:8; volatile ioapic_t *io_addr; /* XXX: should use bus_space */ @@ -528,15 +527,17 @@ io->io_pic = ioapic_template; mtx_lock_spin(&icu_lock); io->io_id = next_id++; - io->io_apic_id = ioapic_read(apic, IOAPIC_ID) >> APIC_ID_SHIFT; - if (apic_id != -1 && io->io_apic_id != apic_id) { - ioapic_write(apic, IOAPIC_ID, apic_id << APIC_ID_SHIFT); - mtx_unlock_spin(&icu_lock); - io->io_apic_id = apic_id; - printf("ioapic%u: Changing APIC ID to %d\n", io->io_id, - apic_id); - } else - mtx_unlock_spin(&icu_lock); + if (lapic_version() < 0x14) { + value = ioapic_read(apic, IOAPIC_ID) >> APIC_ID_SHIFT; + if (apic_id != -1 && value != apic_id) { + ioapic_write(apic, IOAPIC_ID, apic_id << APIC_ID_SHIFT); + mtx_unlock_spin(&icu_lock); + printf("ioapic%u: Changing APIC ID to %d\n", io->io_id, + apic_id); + mtx_lock_spin(&icu_lock); + } + } + mtx_unlock_spin(&icu_lock); if (intbase == -1) { intbase = next_ioapic_base; printf("ioapic%u: Assuming intbase of %d\n", io->io_id, --- //depot/projects/smpng/sys/x86/x86/local_apic.c 2011-01-13 17:17:59.000000000 0000 +++ //depot/user/jhb/ktrace/x86/x86/local_apic.c 2011-05-13 14:21:01.000000000 0000 @@ -318,6 +318,13 @@ #endif } +int +lapic_version(void) +{ + + return (lapic->version & APIC_VER_VERSION); +} + /* * Dump contents of local APIC registers */