summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2009-09-17 19:28:23 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2009-09-17 19:28:23 +0000
commitd00e143c3a6e9ab84955a0c5615dd9a763f69d0e (patch)
tree25de0952af37ce6a5809a6a0be7a94cceec68c0d /sys/arch
parent0563bf644d37b669c9f366e9c51f4af81d7fa87c (diff)
Fail bus_space_map() calls if the flags can't be honoured (such as
BUS_SPACE_MAP_LINEAR in i/o space, or noncacheable linear TURBOchannel mappings). From NetBSD
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/alpha/pci/pci_bwx_bus_io_chipdep.c8
-rw-r--r--sys/arch/alpha/pci/pci_swiz_bus_io_chipdep.c8
-rw-r--r--sys/arch/alpha/tc/tc_bus_mem.c10
3 files changed, 22 insertions, 4 deletions
diff --git a/sys/arch/alpha/pci/pci_bwx_bus_io_chipdep.c b/sys/arch/alpha/pci/pci_bwx_bus_io_chipdep.c
index 7c3590184fb..ad52b0fbed8 100644
--- a/sys/arch/alpha/pci/pci_bwx_bus_io_chipdep.c
+++ b/sys/arch/alpha/pci/pci_bwx_bus_io_chipdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pci_bwx_bus_io_chipdep.c,v 1.7 2009/07/30 21:39:15 miod Exp $ */
+/* $OpenBSD: pci_bwx_bus_io_chipdep.c,v 1.8 2009/09/17 19:28:20 miod Exp $ */
/* $NetBSD: pcs_bus_io_common.c,v 1.14 1996/12/02 22:19:35 cgd Exp $ */
/*
@@ -289,6 +289,12 @@ __C(CHIP,_io_map)(v, ioaddr, iosize, flags, iohp)
{
int error;
+ /*
+ * Can't map i/o space linearly.
+ */
+ if (flags & BUS_SPACE_MAP_LINEAR)
+ return (EOPNOTSUPP);
+
#ifdef EXTENT_DEBUG
printf("io: allocating 0x%lx to 0x%lx\n", ioaddr, ioaddr + iosize - 1);
#endif
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 d694c97af79..b97def42166 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.7 2009/07/30 21:39:15 miod Exp $ */
+/* $OpenBSD: pci_swiz_bus_io_chipdep.c,v 1.8 2009/09/17 19:28:20 miod Exp $ */
/* $NetBSD: pcs_bus_io_common.c,v 1.14 1996/12/02 22:19:35 cgd Exp $ */
/*
@@ -311,6 +311,12 @@ __C(CHIP,_io_map)(v, ioaddr, iosize, flags, iohp)
bus_addr_t ioend = ioaddr + (iosize - 1);
int error;
+ /*
+ * Can't map i/o space linearly.
+ */
+ if (flags & BUS_SPACE_MAP_LINEAR)
+ return (EOPNOTSUPP);
+
#ifdef EXTENT_DEBUG
printf("io: allocating 0x%lx to 0x%lx\n", ioaddr, ioaddr + iosize - 1);
#endif
diff --git a/sys/arch/alpha/tc/tc_bus_mem.c b/sys/arch/alpha/tc/tc_bus_mem.c
index af6bfc8b9f6..1904cc0eb9c 100644
--- a/sys/arch/alpha/tc/tc_bus_mem.c
+++ b/sys/arch/alpha/tc/tc_bus_mem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tc_bus_mem.c,v 1.14 2009/07/26 18:48:54 miod Exp $ */
+/* $OpenBSD: tc_bus_mem.c,v 1.15 2009/09/17 19:28:22 miod Exp $ */
/* $NetBSD: tc_bus_mem.c,v 1.25 2001/09/04 05:31:28 thorpej Exp $ */
/*
@@ -238,10 +238,16 @@ tc_mem_map(v, memaddr, memsize, flags, memhp)
int flags;
bus_space_handle_t *memhp;
{
+ int cacheable = flags & BUS_SPACE_MAP_CACHEABLE;
+ int linear = flags & BUS_SPACE_MAP_LINEAR;
+
+ /* Requests for linear uncacheable space can't be satisfied. */
+ if (linear && !cacheable)
+ return (EOPNOTSUPP);
if (memaddr & 0x7)
panic("tc_mem_map needs 8 byte alignment");
- if (flags & BUS_SPACE_MAP_CACHEABLE)
+ if (cacheable)
*memhp = ALPHA_PHYS_TO_K0SEG(memaddr);
else
*memhp = ALPHA_PHYS_TO_K0SEG(TC_DENSE_TO_SPARSE(memaddr));