From 1beb381637754c4d763a6081472215c03e03146d Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Sat, 7 Jun 2003 15:00:19 +0000 Subject: [PATCH] - Adjust the comment about re-routing PCI interrupts to be less ia64-specific. - When trying to re-route interrupts, don't change cfg->intline if the re-route fails by returning an invalid vector. This fixes machines without any way of routing interrupts such as older PC's without a $PIR table. We do not currently write the new intline value back to the hardware, but we should. That will likely be added in a later commit. --- sys/dev/pci/pci.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 41412f0eaf96..dd0ba09963bb 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -782,7 +782,7 @@ pci_add_resources(device_t pcib, device_t dev) pcicfgregs *cfg = &dinfo->cfg; struct resource_list *rl = &dinfo->resources; struct pci_quirk *q; - int b, i, f, s; + int b, i, irq, f, s; b = cfg->bus; s = cfg->slot; @@ -800,14 +800,18 @@ pci_add_resources(device_t pcib, device_t dev) if (cfg->intpin > 0 && PCI_INTERRUPT_VALID(cfg->intline)) { #if defined(__ia64__) || (defined(__i386__) && !defined(SMP)) /* - * Re-route interrupts on ia64 so that we can get the - * I/O SAPIC interrupt numbers (the BIOS leaves legacy - * PIC interrupt numbers in the intline registers). + * Try to re-route interrupts. Sometimes the BIOS or + * firmware may leave bogus values in these registers. + * If the re-route fails, then just stick with what we + * have. */ - cfg->intline = PCIB_ROUTE_INTERRUPT(pcib, dev, cfg->intpin); + irq = PCIB_ROUTE_INTERRUPT(pcib, dev, cfg->intpin); + if (PCI_INTERRUPT_VALID(irq)) + cfg->intline = irq; + else #endif - resource_list_add(rl, SYS_RES_IRQ, 0, cfg->intline, - cfg->intline, 1); + irq = cfg->intline; + resource_list_add(rl, SYS_RES_IRQ, 0, irq, irq, 1); } }