summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2006-01-22 18:37:59 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2006-01-22 18:37:59 +0000
commit1f158e584073b8dec2d5cba982d36d6d024fd0fc (patch)
tree89c0b7986a955d044c138b8c875def10ca373cc1
parent7a7dc30f45c1d269199fdc9e9daddc31a061a2f1 (diff)
Add bus_space_vaddr() and use it instead of accessing private bus_space
fields. No functional change.
-rw-r--r--sys/arch/mac68k/dev/asc.c6
-rw-r--r--sys/arch/mac68k/dev/esp.c5
-rw-r--r--sys/arch/mac68k/dev/grf_iv.c8
-rw-r--r--sys/arch/mac68k/dev/grf_mv.c8
-rw-r--r--sys/arch/mac68k/include/bus.h4
5 files changed, 18 insertions, 13 deletions
diff --git a/sys/arch/mac68k/dev/asc.c b/sys/arch/mac68k/dev/asc.c
index babfd4d34e9..9e196a90e3e 100644
--- a/sys/arch/mac68k/dev/asc.c
+++ b/sys/arch/mac68k/dev/asc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: asc.c,v 1.21 2005/10/23 19:00:26 martin Exp $ */
+/* $OpenBSD: asc.c,v 1.22 2006/01/22 18:37:56 miod Exp $ */
/* $NetBSD: asc.c,v 1.20 1997/02/24 05:47:33 scottr Exp $ */
/*
@@ -284,8 +284,8 @@ ascmmap(dev, off, prot)
sc = asc_cd.cd_devs[unit];
if (off >= 0 && off < MAC68K_ASC_LEN) {
- (void)pmap_extract(pmap_kernel(), (vaddr_t)sc->sc_handle.base,
- &pa);
+ (void)pmap_extract(pmap_kernel(),
+ (vaddr_t)bus_space_vaddr(sc->sc_tag, sc->sc_handle), &pa);
return atop(pa + off);
}
diff --git a/sys/arch/mac68k/dev/esp.c b/sys/arch/mac68k/dev/esp.c
index 578fc98caec..624fa3eb0ab 100644
--- a/sys/arch/mac68k/dev/esp.c
+++ b/sys/arch/mac68k/dev/esp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: esp.c,v 1.24 2006/01/04 20:30:58 miod Exp $ */
+/* $OpenBSD: esp.c,v 1.25 2006/01/22 18:37:56 miod Exp $ */
/* $NetBSD: esp.c,v 1.17 1998/09/05 15:15:35 pk Exp $ */
/*
@@ -589,7 +589,8 @@ static __inline__ int
esp_dafb_have_dreq(esc)
struct esp_softc *esc;
{
- return (*(volatile u_int32_t *)(esc->sc_bsh.base) & 0x200);
+ return (*(volatile u_int32_t *)
+ bus_space_vaddr(esc->sc_tag, esc->sc_bsh) & 0x200);
}
static __inline__ int
diff --git a/sys/arch/mac68k/dev/grf_iv.c b/sys/arch/mac68k/dev/grf_iv.c
index 1430c726424..db29a43e28e 100644
--- a/sys/arch/mac68k/dev/grf_iv.c
+++ b/sys/arch/mac68k/dev/grf_iv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grf_iv.c,v 1.36 2006/01/20 00:09:36 miod Exp $ */
+/* $OpenBSD: grf_iv.c,v 1.37 2006/01/22 18:37:56 miod Exp $ */
/* $NetBSD: grf_iv.c,v 1.17 1997/02/20 00:23:27 scottr Exp $ */
/*
@@ -338,12 +338,14 @@ macfb_obio_attach(struct device *parent, struct device *self, void *aux)
if (sc->sc_basepa <= mac68k_vidphys &&
mac68k_vidphys < (sc->sc_basepa + length))
- videoaddr = sc->sc_handle.base + sc->sc_fbofs; /* XXX big ol' hack */
+ videoaddr =
+ (vaddr_t)bus_space_vaddr(sc->sc_tag, sc->sc_handle) +
+ sc->sc_fbofs;
dc = malloc(sizeof(*dc), M_DEVBUF, M_WAITOK);
bzero(dc, sizeof(*dc));
- dc->dc_vaddr = (vaddr_t)sc->sc_handle.base; /* XXX yet another hack */
+ dc->dc_vaddr = (vaddr_t)bus_space_vaddr(sc->sc_tag, sc->sc_handle);
dc->dc_paddr = sc->sc_basepa;
dc->dc_offset = sc->sc_fbofs;
dc->dc_wid = videosize & 0xffff;
diff --git a/sys/arch/mac68k/dev/grf_mv.c b/sys/arch/mac68k/dev/grf_mv.c
index b6473bb7d4d..b851cd50957 100644
--- a/sys/arch/mac68k/dev/grf_mv.c
+++ b/sys/arch/mac68k/dev/grf_mv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grf_mv.c,v 1.30 2006/01/10 21:19:14 miod Exp $ */
+/* $OpenBSD: grf_mv.c,v 1.31 2006/01/22 18:37:56 miod Exp $ */
/* $NetBSD: grf_nubus.c,v 1.62 2001/01/22 20:27:02 briggs Exp $ */
/*
@@ -195,7 +195,7 @@ macfb_nubus_attach(struct device *parent, struct device *self, void *aux)
dc = malloc(sizeof(*dc), M_DEVBUF, M_WAITOK);
bzero(dc, sizeof(*dc));
- dc->dc_vaddr = (vaddr_t)sc->sc_handle.base; /* XXX evil hack */
+ dc->dc_vaddr = (vaddr_t)bus_space_vaddr(sc->sc_tag, sc->sc_handle);
dc->dc_paddr = sc->sc_basepa;
dc->dc_offset = image.offset;
dc->dc_wid = image.right - image.left;
@@ -494,7 +494,7 @@ grfmv_intr_cb264(void *vsc)
struct macfb_softc *sc = (struct macfb_softc *)vsc;
volatile char *slotbase;
- slotbase = (volatile char *)(sc->sc_handle.base); /* XXX evil hack */
+ slotbase = (volatile char *)bus_space_vaddr(sc->sc_tag, sc->sc_handle);
asm volatile(" movl %0,a0
movl a0@(0xff6028),d0
andl #0x2,d0
@@ -547,7 +547,7 @@ grfmv_intr_cb364(void *vsc)
struct macfb_softc *sc = (struct macfb_softc *)vsc;
volatile char *slotbase;
- slotbase = (volatile char *)(sc->sc_handle.base); /* XXX evil hack */
+ slotbase = (volatile char *)bus_space_vaddr(sc->sc_tag, sc->sc_handle);
asm volatile(" movl %0,a0
movl a0@(0xfe6028),d0
andl #0x2,d0
diff --git a/sys/arch/mac68k/include/bus.h b/sys/arch/mac68k/include/bus.h
index 3fa7c8a41b5..dc61bafb5b0 100644
--- a/sys/arch/mac68k/include/bus.h
+++ b/sys/arch/mac68k/include/bus.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus.h,v 1.10 2006/01/17 00:08:35 miod Exp $ */
+/* $OpenBSD: bus.h,v 1.11 2006/01/22 18:37:58 miod Exp $ */
/* $NetBSD: bus.h,v 1.9 1998/01/13 18:32:15 scottr Exp $ */
/*-
@@ -493,4 +493,6 @@ __MAC68K_copy_region_N(4)
#define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */
#define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */
+#define bus_space_vaddr(t, h) (void *)((h).base)
+
#endif /* _MAC68K_BUS_H_ */