From 862d95a85cd356a57dc937c7ff26046eabe4bd01 Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Thu, 29 Jan 2004 12:00:33 +0000 Subject: Don't assume 1:1 mapping for bus_spac anymore. --- sys/arch/mvmeppc/mvmeppc/bus_space.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'sys') diff --git a/sys/arch/mvmeppc/mvmeppc/bus_space.c b/sys/arch/mvmeppc/mvmeppc/bus_space.c index 9ab3036642c..5c3928a7e77 100644 --- a/sys/arch/mvmeppc/mvmeppc/bus_space.c +++ b/sys/arch/mvmeppc/mvmeppc/bus_space.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bus_space.c,v 1.5 2002/10/12 01:09:43 krw Exp $ */ +/* $OpenBSD: bus_space.c,v 1.6 2004/01/29 12:00:32 miod Exp $ */ /* $NetBSD: bus_space.c,v 1.4 2001/06/15 15:50:05 nonaka Exp $ */ /*- @@ -44,6 +44,8 @@ #include #include +#include + #include static int prep_memio_map(bus_space_tag_t, bus_addr_t, bus_size_t, int, @@ -130,12 +132,11 @@ prep_memio_map(t, bpa, size, flags, bshp) * Before we go any further, let's make sure that this * region is available. */ - error = extent_alloc_region(ex, bpa, size, - EX_NOWAIT | (ioport_malloc_safe ? EX_MALLOCOK : 0)); - if (error) + if ((error = extent_alloc_region(ex, bpa, size, + EX_NOWAIT | (ioport_malloc_safe ? EX_MALLOCOK : 0))) != 0) return (error); - *bshp = t->pbs_base + bpa; + *bshp = (bus_space_handle_t)mapiodev(t->pbs_base + bpa, size); return (0); } @@ -159,7 +160,8 @@ prep_memio_unmap(t, bsh, size) else panic("prep_memio_unmap: bad bus space tag"); - bpa = bsh - t->pbs_base; + pmap_extract(pmap_kernel(), (vaddr_t)bsh, (paddr_t *)&bpa); + unmapiodev((void *)bsh, size); if (extent_free(ex, bpa, size, EX_NOWAIT | (ioport_malloc_safe ? EX_MALLOCOK : 0))) { -- cgit v1.2.3