diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2006-07-04 18:07:30 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2006-07-04 18:07:30 +0000 |
commit | 3608a6714c5af67249bc89f89d148f1bf781b3fe (patch) | |
tree | 27a7720afc985f6ea709279045e08ce7416a7a75 /sys/dev/pci/pci_map.c | |
parent | 2ee332f19d8c17ffec6b2885a1433ae59f06f12d (diff) |
Do not blindly enable io and mem space for all matched PCI devices. This is
known to be wrong for legacy VGA devices. It also seems to have bad side
effects for some unconfigured PCI-PCI bridges. Instead, enable io or mem
space when we map it.
ok deraadt@
Diffstat (limited to 'sys/dev/pci/pci_map.c')
-rw-r--r-- | sys/dev/pci/pci_map.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/dev/pci/pci_map.c b/sys/dev/pci/pci_map.c index aee590c3b27..c95487360bf 100644 --- a/sys/dev/pci/pci_map.c +++ b/sys/dev/pci/pci_map.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_map.c,v 1.16 2006/05/31 08:58:05 jason Exp $ */ +/* $OpenBSD: pci_map.c,v 1.17 2006/07/04 18:07:29 kettenis Exp $ */ /* $NetBSD: pci_map.c,v 1.7 2000/05/10 16:58:42 thorpej Exp $ */ /*- @@ -306,9 +306,19 @@ pci_mapreg_map(struct pci_attach_args *pa, int reg, pcireg_t type, int busflags, bus_space_handle_t handle; bus_addr_t base; bus_size_t size; + pcireg_t csr; int flags; int rv; + csr = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG); + if (PCI_MAPREG_TYPE(type) == PCI_MAPREG_TYPE_IO) + csr |= PCI_COMMAND_IO_ENABLE; + else + csr |= PCI_COMMAND_MEM_ENABLE; + /* XXX Should this only be done for devices that do DMA? */ + csr |= PCI_COMMAND_MASTER_ENABLE; + pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG, csr); + if (PCI_MAPREG_TYPE(type) == PCI_MAPREG_TYPE_IO) { if ((pa->pa_flags & PCI_FLAGS_IO_ENABLED) == 0) return (EINVAL); |