diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2009-03-01 21:40:00 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2009-03-01 21:40:00 +0000 |
commit | a1c26a0a8ac1138d2326c1b8cd8217a879778127 (patch) | |
tree | cf2bc9c7f85dd9cfec22b187ea8d2731bd8f8d48 | |
parent | f0a0bf4b3ff45615231918b572a707f8acafc137 (diff) |
Fix bus_space_map() on intio space, it is not mapped 1:1...
-rw-r--r-- | sys/arch/mvme68k/dev/mainbus.c | 13 | ||||
-rw-r--r-- | sys/arch/mvme68k/dev/osiop_mvme68k.c | 5 |
2 files changed, 11 insertions, 7 deletions
diff --git a/sys/arch/mvme68k/dev/mainbus.c b/sys/arch/mvme68k/dev/mainbus.c index 3f8f3cd7152..2d0ec308756 100644 --- a/sys/arch/mvme68k/dev/mainbus.c +++ b/sys/arch/mvme68k/dev/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.1 2009/02/17 22:28:40 miod Exp $ */ +/* $OpenBSD: mainbus.c,v 1.2 2009/03/01 21:39:59 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 2004, Miodrag Vallat. @@ -69,19 +69,24 @@ extern struct vm_map *iomap_map; * ``intiolimit'' (defined in locore.s). Since it is always mapped, * conversion between physical and kernel virtual addresses is easy. */ +#if 0 /* in <machine/cpu.h> for now */ #define ISIIOVA(va) \ ((va) >= intiobase && (va) < intiolimit) #define IIOV(pa) ((pa) - iiomapbase + intiobase) #define IIOP(va) ((va) - intiobase + iiomapbase) #define IIOPOFF(pa) ((pa) - iiomapbase) +#endif +#define ISIIOPA(pa) ((uint)IIOPOFF(pa) < ptoa(iiomapsize)) int mainbus_map(bus_addr_t addr, bus_size_t size, int flags, bus_space_handle_t *ret) { - /* 1:1 obio mappings (mc, pcctwo) */ - *ret = (bus_space_handle_t)addr; - return (0); + if (ISIIOPA(addr)) { + *ret = (bus_space_handle_t)IIOV(addr); + return (0); + } else + return (ENOMEM); } void diff --git a/sys/arch/mvme68k/dev/osiop_mvme68k.c b/sys/arch/mvme68k/dev/osiop_mvme68k.c index 2b8b56de9b3..682cae3900e 100644 --- a/sys/arch/mvme68k/dev/osiop_mvme68k.c +++ b/sys/arch/mvme68k/dev/osiop_mvme68k.c @@ -1,4 +1,4 @@ -/* $OpenBSD: osiop_mvme68k.c,v 1.2 2009/03/01 21:37:41 miod Exp $ */ +/* $OpenBSD: osiop_mvme68k.c,v 1.3 2009/03/01 21:39:59 miod Exp $ */ /* * Copyright (c) 2004, Miodrag Vallat. * @@ -95,8 +95,7 @@ osiop_mvme68k_attach(struct device *parent, struct device *self, void *aux) sc->sc_bst = ca->ca_iot; sc->sc_dmat = ca->ca_dmat; - /* XXX pass vaddr for now! */ - if (bus_space_map(sc->sc_bst, (bus_addr_t)ca->ca_vaddr, OSIOP_NREGS, 0, + if (bus_space_map(sc->sc_bst, (bus_addr_t)ca->ca_paddr, OSIOP_NREGS, 0, &sc->sc_reg) != 0) { printf(": couldn't map I/O ports\n"); return; |