MFi386: Various apic fixes and tweaks

* Don't recursively panic if we've already paniced and the local apic is
  now stuck.
* Add hw.apic.* tunables/sysctls for extint controls
* Change "lapic%d timer" to "cpu%d timer" intname to match i386
This commit is contained in:
Peter Wemm 2005-10-26 22:32:30 +00:00
parent cb89fb11b7
commit a9fbe5d07b
2 changed files with 20 additions and 6 deletions

View file

@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/sysctl.h>
#include <vm/vm.h>
#include <vm/pmap.h>
@ -130,6 +131,12 @@ struct pic ioapic_template = { ioapic_enable_source, ioapic_disable_source,
static int bsp_id, current_cluster, logical_clusters, next_ioapic_base;
static u_int next_id, program_logical_dest;
SYSCTL_NODE(_hw, OID_AUTO, apic, CTLFLAG_RD, 0, "APIC options");
static int enable_extint;
SYSCTL_INT(_hw_apic, OID_AUTO, enable_extint, CTLFLAG_RDTUN, &enable_extint, 0,
"Enable the ExtINT pin in the first I/O APIC");
TUNABLE_INT("hw.apic.enable_extint", &enable_extint);
static __inline void
_ioapic_eoi_source(struct intsrc *isrc)
{
@ -287,7 +294,7 @@ ioapic_program_intpin(struct ioapic_intsrc *intpin)
switch (intpin->io_vector) {
case VECTOR_EXTINT:
KASSERT(intpin->io_edgetrigger,
("EXTINT not edge triggered"));
("ExtINT not edge triggered"));
low |= IOART_DELEXINT;
break;
case VECTOR_NMI:
@ -681,7 +688,10 @@ ioapic_set_extint(void *cookie, u_int pin)
return (EINVAL);
io->io_pins[pin].io_bus = APIC_BUS_UNKNOWN;
io->io_pins[pin].io_vector = VECTOR_EXTINT;
io->io_pins[pin].io_masked = 1;
if (enable_extint)
io->io_pins[pin].io_masked = 0;
else
io->io_pins[pin].io_masked = 1;
io->io_pins[pin].io_edgetrigger = 1;
io->io_pins[pin].io_activehi = 1;
if (bootverbose)

View file

@ -312,7 +312,7 @@ lapic_setup(void)
/* Program timer LVT and setup handler. */
lapic->lvt_timer = lvt_mode(la, LVT_TIMER, lapic->lvt_timer);
snprintf(buf, sizeof(buf), "lapic%d: timer", lapic_id());
snprintf(buf, sizeof(buf), "cpu%d: timer", PCPU_GET(cpuid));
intrcnt_add(buf, &la->la_timer_count);
if (PCPU_GET(cpuid) != 0) {
KASSERT(lapic_timer_period != 0, ("lapic%u: zero divisor",
@ -322,7 +322,7 @@ lapic_setup(void)
lapic_timer_enable_intr();
}
/* XXX: Performance counter, error, and thermal LVTs */
/* XXX: Error and thermal LVTs */
intr_restore(eflags);
}
@ -927,8 +927,12 @@ lapic_ipi_vectored(u_int vector, int dest)
}
/* Wait for an earlier IPI to finish. */
if (!lapic_ipi_wait(BEFORE_SPIN))
panic("APIC: Previous IPI is stuck");
if (!lapic_ipi_wait(BEFORE_SPIN)) {
if (panicstr != NULL)
return;
else
panic("APIC: Previous IPI is stuck");
}
lapic_ipi_raw(icrlo, destfield);