pci: Fix manual interrupt routing support
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Mon, 6 Feb 2012 03:02:18 +0000 (11:02 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Mon, 6 Feb 2012 03:06:16 +0000 (11:06 +0800)
- Add function id to tunable name
- Call BUS_CONFIG_INTR upon manually assigned interrupt

Tested-by: swildner@
sys/bus/pci/pci.c

index 62768d2..89f78d2 100644 (file)
@@ -2690,10 +2690,16 @@ pci_assign_interrupt(device_t bus, device_t dev, int force_route)
        /* Let the user override the IRQ with a tunable. */
        irq = PCI_INVALID_IRQ;
        ksnprintf(tunable_name, sizeof(tunable_name),
-           "hw.pci%d.%d.%d.INT%c.irq",
-           cfg->domain, cfg->bus, cfg->slot, cfg->intpin + 'A' - 1);
-       if (TUNABLE_INT_FETCH(tunable_name, &irq) && (irq >= 255 || irq <= 0))
-               irq = PCI_INVALID_IRQ;
+           "hw.pci%d.%d.%d.%d.INT%c.irq",
+           cfg->domain, cfg->bus, cfg->slot, cfg->func, cfg->intpin + 'A' - 1);
+       if (TUNABLE_INT_FETCH(tunable_name, &irq)) {
+               if (irq >= 255 || irq <= 0) {
+                       irq = PCI_INVALID_IRQ;
+               } else {
+                       BUS_CONFIG_INTR(bus, dev, irq,
+                           INTR_TRIGGER_LEVEL, INTR_POLARITY_LOW);
+               }
+       }
 
        /*
         * If we didn't get an IRQ via the tunable, then we either use the