summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2006-12-12 18:28:55 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2006-12-12 18:28:55 +0000
commit5c39e5187dc8cbba61dd6fbae73b1e9e7f9cceaf (patch)
tree09af70c5659af6e1255df9bf436c4b10f3feebea /sys/dev/pci
parentd18f6976a525c5abd2eec9f80b8349cfba2d559b (diff)
ignore bars which are 0; ok kettenis
Diffstat (limited to 'sys/dev/pci')
-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;
}