From e86bd39aab710871fb9ff7e8cc8f697a214afcc4 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Fri, 1 Aug 2003 21:31:36 +0000 Subject: [PATCH] Add hw.pci.irq_override_mask, which is a mask of interrupts that are considered to be good to try when it otherwise has no clue about which interrupts to try. This is a band-aide and we really should try to balance the IRQs that we arbitrarily pick, but it should help some people that would otherwise get bad IRQs. --- sys/i386/pci/pci_cfgreg.c | 14 ++++++++++++++ sys/i386/pci/pci_pir.c | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/sys/i386/pci/pci_cfgreg.c b/sys/i386/pci/pci_cfgreg.c index 31c0e629d773..53d22613638d 100644 --- a/sys/i386/pci/pci_cfgreg.c +++ b/sys/i386/pci/pci_cfgreg.c @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -78,6 +79,17 @@ static int pci_route_count; static struct mtx pcicfg_mtx; +/* sysctl vars */ +SYSCTL_DECL(_hw_pci); + +static uint32_t pci_irq_override_mask = 0xdef4; +TUNABLE_INT("hw.pci.irq_override_mask", &pci_irq_override_mask); +SYSCTL_INT(_hw_pci, OID_AUTO, irq_override_mask, CTLFLAG_RD, + &pci_irq_override_mask, 0xdef4, + "Mask of allowed irqs to try to route when it has no good clue about\n" + "which irqs it should use."); + + /* * Some BIOS writers seem to want to ignore the spec and put * 0 in the intline rather than 255 to indicate none. Some use @@ -515,6 +527,8 @@ pci_cfgintr_virgin(struct PIR_entry *pe, int pin) /* life is tough, so just pick an interrupt */ for (irq = 0; irq < 16; irq++) { ibit = (1 << irq); + if ((ibit & pci_irq_override_mask) == 0) + continue; if (pe->pe_intpin[pin - 1].irqs & ibit) { PRVERB(("pci_cfgintr_virgin: using routable interrupt %d\n", irq)); return(irq); diff --git a/sys/i386/pci/pci_pir.c b/sys/i386/pci/pci_pir.c index 31c0e629d773..53d22613638d 100644 --- a/sys/i386/pci/pci_pir.c +++ b/sys/i386/pci/pci_pir.c @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -78,6 +79,17 @@ static int pci_route_count; static struct mtx pcicfg_mtx; +/* sysctl vars */ +SYSCTL_DECL(_hw_pci); + +static uint32_t pci_irq_override_mask = 0xdef4; +TUNABLE_INT("hw.pci.irq_override_mask", &pci_irq_override_mask); +SYSCTL_INT(_hw_pci, OID_AUTO, irq_override_mask, CTLFLAG_RD, + &pci_irq_override_mask, 0xdef4, + "Mask of allowed irqs to try to route when it has no good clue about\n" + "which irqs it should use."); + + /* * Some BIOS writers seem to want to ignore the spec and put * 0 in the intline rather than 255 to indicate none. Some use @@ -515,6 +527,8 @@ pci_cfgintr_virgin(struct PIR_entry *pe, int pin) /* life is tough, so just pick an interrupt */ for (irq = 0; irq < 16; irq++) { ibit = (1 << irq); + if ((ibit & pci_irq_override_mask) == 0) + continue; if (pe->pe_intpin[pin - 1].irqs & ibit) { PRVERB(("pci_cfgintr_virgin: using routable interrupt %d\n", irq)); return(irq);