diff options
| author | Warner Losh <imp@FreeBSD.org> | 2003-04-15 19:38:18 +0000 |
|---|---|---|
| committer | Warner Losh <imp@FreeBSD.org> | 2003-04-15 19:38:18 +0000 |
| commit | 7f2af527b064002a6dae5cc6f88e91f7d3d5a49f (patch) | |
| tree | 43efd586b9561ce308dd5c2db46ee48651d64d4c /sys/dev | |
| parent | 6d1a6a9a9ac4341f1bc4ff3f5187f0bea27788e8 (diff) | |
Notes
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/pci/pci.c | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index a450df845894..51fe63b9440f 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -1301,21 +1301,33 @@ pci_alloc_resource(device_t dev, device_t child, int type, int *rid, * XXX add support here for SYS_RES_IOPORT and SYS_RES_MEMORY */ if (device_get_parent(child) == dev) { - /* - * If the child device doesn't have an interrupt routed - * and is deserving of an interrupt, try to assign it one. - */ - if ((type == SYS_RES_IRQ) && - !PCI_INTERRUPT_VALID(cfg->intline) && - (cfg->intpin != 0)) { - cfg->intline = PCIB_ROUTE_INTERRUPT( - device_get_parent(dev), child, cfg->intpin); - if (PCI_INTERRUPT_VALID(cfg->intline)) { - pci_write_config(child, PCIR_INTLINE, - cfg->intline, 1); - resource_list_add(rl, SYS_RES_IRQ, 0, - cfg->intline, cfg->intline, 1); + switch (type) { + case SYS_RES_IRQ: + /* + * If the child device doesn't have an + * interrupt routed and is deserving of an + * interrupt, try to assign it one. + */ + if (!PCI_INTERRUPT_VALID(cfg->intline) && + (cfg->intpin != 0)) { + cfg->intline = PCIB_ROUTE_INTERRUPT( + device_get_parent(dev), child, cfg->intpin); + if (PCI_INTERRUPT_VALID(cfg->intline)) { + pci_write_config(child, PCIR_INTLINE, + cfg->intline, 1); + resource_list_add(rl, SYS_RES_IRQ, 0, + cfg->intline, cfg->intline, 1); + } } + break; + case SYS_RES_IOPORT: + case SYS_RES_MEMORY: + /* + * Enable the I/O mode. We should also be allocating + * resources too. XXX + */ + PCI_ENABLE_IO(dev, child, type); + break; } } |
