How to set irq for PCI->PCMCIA adapter

M. Warner Losh imp at bsdimp.com
Sun Apr 6 21:52:23 PDT 2003


In message: <3E9015B2.CCD2C126 at fid4.com>
            "Michael C. Cambria" <mcc at fid4.com> writes:
: I have a PCI->PCMCIA adapter with a TI PCI1410 chip on it that I can't
: get to use an irq.  It only boots into polling mode.  Is there a way to
: set it?

Nope.  If your mobo can't route an interrupt, you current lose.  So
sorry.  Thank you for playing.  Sucks to be you.  However, a route out
of purgatory might be possible.

: I'm using ISA interrupt routing (hw.pcic.intr_path=1).

That's guaranteed to fail.  You *MUST* use PCI interrupts with PCI
add-in cards.  You cannot use ISA in this case since there's no path
to the south bridge isa interrupt lines (serial or parallel) in this case.

: If I don't, the
: system hangs at boot after printing "pci_cftintr_virgin: using routable
: interrupt 3"

OK.  Wanna try a patch?  This patch adds a tunable
hw.pci.irq_override_mask which allows you to override the IRQs that we
try when we have no other clue what to do.  There's likely some hint
SOMEWHERE that we can look at, but until someone can unearth it, we
gotta set it by hand.  You can set this in your boot loader for
testing and then in /boot/loader.conf.

BTW, this really sucks, and a better, more generic mechanism is
needed.  IIRC, I've seen some patches that provide a more generic
mechanism to do this, but can't find them in a quick web search now.

It likely would be a real good idea not to specify a mask with bit 3
set :-)

Warner

Index: sys/i386/pci/pci_cfgreg.c
===================================================================
diff -u pci_cfgreg.c pci_cfgreg.c
--- sys/i386/pci/pci_cfgreg.c	30 May 2001 09:51:10 -0000	1.2
+++ sys/i386/pci/pci_cfgreg.c	9 Dec 2002 07:26:11 -0000
@@ -37,6 +37,7 @@
 #include <sys/malloc.h>
 #include <sys/lock.h>
 #include <sys/mutex.h>
+#include <sys/sysctl.h>
 #include <vm/vm.h>
 #include <vm/pmap.h>
 #include <machine/md_var.h>
@@ -78,6 +79,17 @@
 
 static struct mtx pcicfg_mtx;
 
+/* sysctl vars */
+SYSCTL_NODE(_hw, OID_AUTO, pci, CTLFLAG_RD, 0, "PCI Bus parameters");
+
+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 @@
 	/* 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);


More information about the freebsd-mobile mailing list