summaryrefslogtreecommitdiff
path: root/sys/arch/alpha
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2008-07-19 17:10:04 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2008-07-19 17:10:04 +0000
commita5e2012f2a5a4280032679f8430a5db1768b4724 (patch)
tree81a66a912470b764300c774b063c788ce5b03310 /sys/arch/alpha
parent29f78acd82dc70e616730f8e818c97d5dd5fcb31 (diff)
In _io_map(), make sure the whole range fits in one of the io windows,
instead of only the starting address. From NetBSD.
Diffstat (limited to 'sys/arch/alpha')
-rw-r--r--sys/arch/alpha/pci/pci_swiz_bus_io_chipdep.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/arch/alpha/pci/pci_swiz_bus_io_chipdep.c b/sys/arch/alpha/pci/pci_swiz_bus_io_chipdep.c
index c4dfa8f5000..da0d832a9dc 100644
--- a/sys/arch/alpha/pci/pci_swiz_bus_io_chipdep.c
+++ b/sys/arch/alpha/pci/pci_swiz_bus_io_chipdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pci_swiz_bus_io_chipdep.c,v 1.4 2007/03/16 21:22:27 robert Exp $ */
+/* $OpenBSD: pci_swiz_bus_io_chipdep.c,v 1.5 2008/07/19 17:10:03 miod Exp $ */
/* $NetBSD: pcs_bus_io_common.c,v 1.14 1996/12/02 22:19:35 cgd Exp $ */
/*
@@ -308,6 +308,7 @@ __C(CHIP,_io_map)(v, ioaddr, iosize, cacheable, iohp)
int cacheable;
bus_space_handle_t *iohp;
{
+ bus_addr_t ioend = ioaddr + (iosize - 1);
int error;
#ifdef EXTENT_DEBUG
@@ -325,19 +326,20 @@ __C(CHIP,_io_map)(v, ioaddr, iosize, cacheable, iohp)
#ifdef CHIP_IO_W1_BUS_START
if (ioaddr >= CHIP_IO_W1_BUS_START(v) &&
- ioaddr <= CHIP_IO_W1_BUS_END(v)) {
+ ioend <= CHIP_IO_W1_BUS_END(v)) {
*iohp = (ALPHA_PHYS_TO_K0SEG(CHIP_IO_W1_SYS_START(v)) >> 5) +
(ioaddr - CHIP_IO_W1_BUS_START(v));
} else
#endif
#ifdef CHIP_IO_W2_BUS_START
if (ioaddr >= CHIP_IO_W2_BUS_START(v) &&
- ioaddr <= CHIP_IO_W2_BUS_END(v)) {
+ ioend <= CHIP_IO_W2_BUS_END(v)) {
*iohp = (ALPHA_PHYS_TO_K0SEG(CHIP_IO_W2_SYS_START(v)) >> 5) +
(ioaddr - CHIP_IO_W2_BUS_START(v));
} else
#endif
{
+#ifdef EXTENT_DEBUG
printf("\n");
#ifdef CHIP_IO_W1_BUS_START
printf("%s: window[1]=0x%lx-0x%lx\n",
@@ -351,6 +353,8 @@ __C(CHIP,_io_map)(v, ioaddr, iosize, cacheable, iohp)
#endif
panic("%s: don't know how to map %lx",
__S(__C(CHIP,_io_map)), ioaddr);
+#endif
+ return (EINVAL);
}
return (0);