summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2006-12-11 20:57:41 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2006-12-11 20:57:41 +0000
commite231741f7089c00bca4d3aa2781dd927a3a39fa7 (patch)
tree5f86783cd27ff2c71d47b1c04e493952cd2e3be2 /sys/arch
parent97889fe59edb152e2c04893ee1fe4e395a0adefd (diff)
do not bus_space_map devices which are at address 0; ok kettenis
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/i386/pci/geodesc.c5
-rw-r--r--sys/arch/i386/pci/gscpcib.c5
-rw-r--r--sys/arch/i386/pci/gscpm.c5
3 files changed, 9 insertions, 6 deletions
diff --git a/sys/arch/i386/pci/geodesc.c b/sys/arch/i386/pci/geodesc.c
index ee839b67b76..128c5caa0fc 100644
--- a/sys/arch/i386/pci/geodesc.c
+++ b/sys/arch/i386/pci/geodesc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: geodesc.c,v 1.8 2006/10/18 19:09:14 deraadt Exp $ */
+/* $OpenBSD: geodesc.c,v 1.9 2006/12/11 20:57:40 deraadt Exp $ */
/*
* Copyright (c) 2003 Markus Friedl <markus@openbsd.org>
@@ -97,7 +97,8 @@ geodesc_attach(struct device *parent, struct device *self, void *aux)
reg = pci_conf_read(pa->pa_pc, pa->pa_tag, SC1100_F5_SCRATCHPAD);
sc->sc_iot = pa->pa_iot;
- if (bus_space_map(sc->sc_iot, reg, 64, 0, &sc->sc_ioh)) {
+ if (reg == 0 ||
+ bus_space_map(sc->sc_iot, reg, 64, 0, &sc->sc_ioh)) {
printf(": unable to map registers at 0x%x\n", reg);
return;
}
diff --git a/sys/arch/i386/pci/gscpcib.c b/sys/arch/i386/pci/gscpcib.c
index 23816855dd5..9a4f538f19a 100644
--- a/sys/arch/i386/pci/gscpcib.c
+++ b/sys/arch/i386/pci/gscpcib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gscpcib.c,v 1.4 2006/01/05 15:32:46 grange Exp $ */
+/* $OpenBSD: gscpcib.c,v 1.5 2006/12/11 20:57:40 deraadt Exp $ */
/*
* Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org>
*
@@ -97,7 +97,8 @@ gscpcib_attach(struct device *parent, struct device *self, void *aux)
/* Map GPIO I/O space */
gpiobase = pci_conf_read(pa->pa_pc, pa->pa_tag, GSCGPIO_BASE);
sc->sc_gpio_iot = pa->pa_iot;
- if (bus_space_map(sc->sc_gpio_iot, PCI_MAPREG_IO_ADDR(gpiobase),
+ if (PCI_MAPREG_IO_ADDR(gpiobase) == 0 ||
+ bus_space_map(sc->sc_gpio_iot, PCI_MAPREG_IO_ADDR(gpiobase),
GSCGPIO_SIZE, 0, &sc->sc_gpio_ioh)) {
printf(": failed to map GPIO I/O space");
goto corepcib;
diff --git a/sys/arch/i386/pci/gscpm.c b/sys/arch/i386/pci/gscpm.c
index 3117c9081fe..343fcf60466 100644
--- a/sys/arch/i386/pci/gscpm.c
+++ b/sys/arch/i386/pci/gscpm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gscpm.c,v 1.4 2006/01/26 20:34:26 mickey Exp $ */
+/* $OpenBSD: gscpm.c,v 1.5 2006/12/11 20:57:40 deraadt Exp $ */
/*
* Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org>
*
@@ -107,7 +107,8 @@ gscpm_attach(struct device *parent, struct device *self, void *aux)
/* Map ACPI registers */
acpibase = pci_conf_read(sc->sc_pc, sc->sc_tag, GSCPM_ACPIBASE);
- if (bus_space_map(sc->sc_iot, PCI_MAPREG_IO_ADDR(acpibase),
+ if (PCI_MAPREG_IO_ADDR(acpibase) == 0 ||
+ bus_space_map(sc->sc_iot, PCI_MAPREG_IO_ADDR(acpibase),
GSCPM_ACPISIZE, 0, &sc->sc_acpi_ioh)) {
printf(": failed to map ACPI registers\n");
return;