summaryrefslogtreecommitdiffstats
path: root/sys/pci/pci.c
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2000-10-16 07:24:00 +0000
committerimp <imp@FreeBSD.org>2000-10-16 07:24:00 +0000
commitd81515c140fdaa360121c179d2f5210424c61bc0 (patch)
tree0c6ef5049c470a092208b8b52e500e89a78c318d /sys/pci/pci.c
parent6313f62d80b04706f0b17e4e18e7d50ad4aae028 (diff)
downloadFreeBSD-src-d81515c140fdaa360121c179d2f5210424c61bc0.zip
FreeBSD-src-d81515c140fdaa360121c179d2f5210424c61bc0.tar.gz
When a pci device hasn't had an interrupt routed to it (signified by
the intline of 255) go ahead and route the interrupt when we allocate an interrupt. Submitted by: msmith
Diffstat (limited to 'sys/pci/pci.c')
-rw-r--r--sys/pci/pci.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/sys/pci/pci.c b/sys/pci/pci.c
index c0a4bb8..0d3df31 100644
--- a/sys/pci/pci.c
+++ b/sys/pci/pci.c
@@ -1286,6 +1286,25 @@ pci_alloc_resource(device_t dev, device_t child, int type, int *rid,
{
struct pci_devinfo *dinfo = device_get_ivars(child);
struct resource_list *rl = &dinfo->resources;
+ pcicfgregs *cfg = &dinfo->cfg;
+
+ /*
+ * Perform lazy resource allocation
+ *
+ * XXX add support here for SYS_RES_IOPORT and SYS_RES_MEMORY
+ */
+ if (device_get_parent(child) == dev) {
+ if ((type == SYS_RES_IRQ) && (cfg->intline == 255)) {
+ cfg->intline = PCIB_ROUTE_INTERRUPT(
+ device_get_parent(dev), pci_get_slot(child),
+ cfg->intpin);
+ if (cfg->intline != 255) {
+ /* XXX write back to PCI space? */
+ resource_list_add(rl, SYS_RES_IRQ, 0,
+ cfg->intline, cfg->intline, 1);
+ }
+ }
+ }
return resource_list_alloc(rl, dev, child, type, rid,
start, end, count, flags);
OpenPOWER on IntegriCloud