diff options
author | imp <imp@FreeBSD.org> | 2003-04-15 19:38:18 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2003-04-15 19:38:18 +0000 |
commit | bcfb4701c622c0065629450cc34178f47365eee9 (patch) | |
tree | 43efd586b9561ce308dd5c2db46ee48651d64d4c /sys | |
parent | ee9586205424c714206cac19273ca20ce51452cc (diff) | |
download | FreeBSD-src-bcfb4701c622c0065629450cc34178f47365eee9.zip FreeBSD-src-bcfb4701c622c0065629450cc34178f47365eee9.tar.gz |
When the driver allocates memory or I/O ports, enable that bit in the
command config register. At the present, this represents a nop
because these bits should have been set earlier in the process. In
the future, we'll only set these bits when the driver requests the
resource, not when the bus code detects the resource.
Reviewed by: mdodd
Diffstat (limited to 'sys')
-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 a450df8..51fe63b 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; } } |