summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/pci_map.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/dev/pci/pci_map.c b/sys/dev/pci/pci_map.c
index c652ebfbf60..a07f7d3c38e 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.18 2006/07/31 11:06:33 mickey Exp $ */
+/* $OpenBSD: pci_map.c,v 1.19 2006/12/12 18:28:54 deraadt Exp $ */
/* $NetBSD: pci_map.c,v 1.7 2000/05/10 16:58:42 thorpej Exp $ */
/*-
@@ -305,6 +305,12 @@ pci_mapreg_map(struct pci_attach_args *pa, int reg, pcireg_t type, int busflags,
int flags;
int rv;
+ if ((rv = pci_mapreg_info(pa->pa_pc, pa->pa_tag, reg, type,
+ &base, &size, &flags)) != 0)
+ return (rv);
+ if (base == 0)
+ return (EINVAL); /* disabled because of invalid BAR */
+
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;
@@ -317,16 +323,10 @@ pci_mapreg_map(struct pci_attach_args *pa, int reg, pcireg_t type, int busflags,
if (PCI_MAPREG_TYPE(type) == PCI_MAPREG_TYPE_IO) {
if ((pa->pa_flags & PCI_FLAGS_IO_ENABLED) == 0)
return (EINVAL);
- if ((rv = obsd_pci_io_find(pa->pa_pc, pa->pa_tag, reg, type,
- &base, &size, &flags)) != 0)
- return (rv);
tag = pa->pa_iot;
} else {
if ((pa->pa_flags & PCI_FLAGS_MEM_ENABLED) == 0)
return (EINVAL);
- if ((rv = obsd_pci_mem_find(pa->pa_pc, pa->pa_tag, reg, type,
- &base, &size, &flags)) != 0)
- return (rv);
tag = pa->pa_memt;
}