summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2006-12-11 18:16:38 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2006-12-11 18:16:38 +0000
commitcf8c382c7360f5cca81208b17363bcea5f55a4b7 (patch)
tree7958440b60fd62a411b6beac6e1219a424250f5b /sys/dev
parent7ccdcd3c5ea86264604d56b0d8b94ac6cc5d3e68 (diff)
do not bus_space_map devices which are at address 0; ok kettenis
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/alipm.c5
-rw-r--r--sys/dev/pci/amdpm.c8
-rw-r--r--sys/dev/pci/nviic.c5
-rw-r--r--sys/dev/pci/piixpm.c5
-rw-r--r--sys/dev/pci/viapm.c5
5 files changed, 17 insertions, 11 deletions
diff --git a/sys/dev/pci/alipm.c b/sys/dev/pci/alipm.c
index c10994de08a..c22b82b1f22 100644
--- a/sys/dev/pci/alipm.c
+++ b/sys/dev/pci/alipm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: alipm.c,v 1.10 2006/05/09 18:49:56 kettenis Exp $ */
+/* $OpenBSD: alipm.c,v 1.11 2006/12/11 18:16:37 deraadt Exp $ */
/*
* Copyright (c) 2005 Mark Kettenis
@@ -151,7 +151,8 @@ alipm_attach(struct device *parent, struct device *self, void *aux)
/* Map I/O space */
iobase = pci_conf_read(pa->pa_pc, pa->pa_tag, ALIPM_BASE);
sc->sc_iot = pa->pa_iot;
- if (bus_space_map(sc->sc_iot, iobase >> 16,
+ if (iobase == 0 ||
+ bus_space_map(sc->sc_iot, iobase >> 16,
iosize, 0, &sc->sc_ioh)) {
printf(": can't map I/O space\n");
return;
diff --git a/sys/dev/pci/amdpm.c b/sys/dev/pci/amdpm.c
index 3311ae4812d..8af6cb8aca4 100644
--- a/sys/dev/pci/amdpm.c
+++ b/sys/dev/pci/amdpm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: amdpm.c,v 1.19 2006/11/28 16:17:57 kettenis Exp $ */
+/* $OpenBSD: amdpm.c,v 1.20 2006/12/11 18:16:37 deraadt Exp $ */
/*
* Copyright (c) 2006 Alexander Yurchenko <grange@openbsd.org>
@@ -241,7 +241,8 @@ amdpm_attach(struct device *parent, struct device *self, void *aux)
}
reg = pci_conf_read(pa->pa_pc, pa->pa_tag, AMDPM_PMPTR);
- if (bus_space_map(sc->sc_iot, AMDPM_PMBASE(reg), AMDPM_PMSIZE,
+ if (AMDPM_PMBASE(reg) == 0 ||
+ bus_space_map(sc->sc_iot, AMDPM_PMBASE(reg), AMDPM_PMSIZE,
0, &sc->sc_ioh)) {
printf("\n");
return;
@@ -296,7 +297,8 @@ amdpm_attach(struct device *parent, struct device *self, void *aux)
}
} else if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_NVIDIA) {
reg = pci_conf_read(pa->pa_pc, pa->pa_tag, NFPM_PMPTR);
- if (bus_space_map(sc->sc_iot, AMDPM_PMBASE(reg), AMDPM_SMB_SIZE, 0,
+ if (AMDPM_PMBASE(reg) == 0 ||
+ bus_space_map(sc->sc_iot, AMDPM_PMBASE(reg), AMDPM_SMB_SIZE, 0,
&sc->sc_i2c_ioh)) {
printf(": failed to map I2C subregion\n");
return;
diff --git a/sys/dev/pci/nviic.c b/sys/dev/pci/nviic.c
index ffeccf36bc7..9970bc6db1f 100644
--- a/sys/dev/pci/nviic.c
+++ b/sys/dev/pci/nviic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nviic.c,v 1.8 2006/11/06 04:00:15 brad Exp $ */
+/* $OpenBSD: nviic.c,v 1.9 2006/12/11 18:16:37 deraadt Exp $ */
/*
* Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
@@ -167,7 +167,8 @@ nviic_attach(struct device *parent, struct device *self, void *aux)
nc = &sc->sc_nc[i];
reg = pci_conf_read(pa->pa_pc, pa->pa_tag, baseregs[i]);
- if (bus_space_map(sc->sc_iot, NVI_SMBASE(reg), NVI_SMBASE_SIZE,
+ if (NVI_SMBASE(reg) == 0 ||
+ bus_space_map(sc->sc_iot, NVI_SMBASE(reg), NVI_SMBASE_SIZE,
0, &nc->nc_ioh)) {
printf("%s: unable to map space for bus %d\n",
DEVNAME(sc), i);
diff --git a/sys/dev/pci/piixpm.c b/sys/dev/pci/piixpm.c
index 9635cc155e5..49956c2fd80 100644
--- a/sys/dev/pci/piixpm.c
+++ b/sys/dev/pci/piixpm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: piixpm.c,v 1.24 2006/09/28 18:19:14 grange Exp $ */
+/* $OpenBSD: piixpm.c,v 1.25 2006/12/11 18:16:37 deraadt Exp $ */
/*
* Copyright (c) 2005, 2006 Alexander Yurchenko <grange@openbsd.org>
@@ -127,7 +127,8 @@ piixpm_attach(struct device *parent, struct device *self, void *aux)
/* Map I/O space */
sc->sc_iot = pa->pa_iot;
base = pci_conf_read(pa->pa_pc, pa->pa_tag, PIIX_SMB_BASE) & 0xffff;
- if (bus_space_map(sc->sc_iot, PCI_MAPREG_IO_ADDR(base),
+ if (PCI_MAPREG_IO_ADDR(base) == 0 ||
+ bus_space_map(sc->sc_iot, PCI_MAPREG_IO_ADDR(base),
PIIX_SMB_SIZE, 0, &sc->sc_ioh)) {
printf(": can't map I/O space\n");
return;
diff --git a/sys/dev/pci/viapm.c b/sys/dev/pci/viapm.c
index 1b0d103c120..a3bfbde1050 100644
--- a/sys/dev/pci/viapm.c
+++ b/sys/dev/pci/viapm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: viapm.c,v 1.5 2006/01/12 22:25:46 kettenis Exp $ */
+/* $OpenBSD: viapm.c,v 1.6 2006/12/11 18:16:37 deraadt Exp $ */
/*
* Copyright (c) 2005 Mark Kettenis <kettenis@openbsd.org>
@@ -153,7 +153,8 @@ viapm_attach(struct device *parent, struct device *self, void *aux)
/* Map I/O space */
sc->sc_iot = pa->pa_iot;
iobase = pci_conf_read(pa->pa_pc, pa->pa_tag, VIAPM_SMB_BASE);
- if (bus_space_map(sc->sc_iot, iobase & 0xfffe,
+ if (iobase == 0 ||
+ bus_space_map(sc->sc_iot, iobase & 0xfffe,
VIAPM_SMB_SIZE, 0, &sc->sc_ioh)) {
printf(": can't map I/O space\n");
return;