From d81515c140fdaa360121c179d2f5210424c61bc0 Mon Sep 17 00:00:00 2001 From: imp Date: Mon, 16 Oct 2000 07:24:00 +0000 Subject: 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 --- sys/dev/pci/pci.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'sys/dev/pci/pci.c') diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index c0a4bb8..0d3df31 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/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); -- cgit v1.1