summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2005-11-25 22:14:35 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2005-11-25 22:14:35 +0000
commit8596018af335478222d52e105836a21ba25b2484 (patch)
tree893228884a1909b3e6db268e2f52705fea8d125a /sys
parentf611219645d5c7b769376c8f7ba9c1ae89175d2c (diff)
Prefer vaddr_t and paddr_t types, instead of void * and heavy casts.
Improves readability, no functional change.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/mvme88k/dev/mainbus.c23
-rw-r--r--sys/arch/mvme88k/dev/vme.c22
-rw-r--r--sys/arch/mvme88k/dev/vme.h4
-rw-r--r--sys/arch/mvme88k/dev/vmel.c4
-rw-r--r--sys/arch/mvme88k/dev/vmes.c4
-rw-r--r--sys/arch/mvme88k/include/autoconf.h6
6 files changed, 30 insertions, 33 deletions
diff --git a/sys/arch/mvme88k/dev/mainbus.c b/sys/arch/mvme88k/dev/mainbus.c
index fc4cd90bed0..31feeb475a6 100644
--- a/sys/arch/mvme88k/dev/mainbus.c
+++ b/sys/arch/mvme88k/dev/mainbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mainbus.c,v 1.16 2005/10/13 19:48:35 miod Exp $ */
+/* $OpenBSD: mainbus.c,v 1.17 2005/11/25 22:14:31 miod Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 2004, Miodrag Vallat.
@@ -72,9 +72,6 @@ const struct mvme88k_bus_space_tag mainbus_bustag = {
extern struct extent *iomap_extent;
extern struct vm_map *iomap_map;
-void *mapiodev(void *, int);
-void unmapiodev(void *, int);
-
/*
* Obio (internal IO) space is mapped 1:1 (see pmap_bootstrap() for details).
*
@@ -112,7 +109,7 @@ mainbus_map(bus_addr_t addr, bus_size_t size, int flags,
if (addr >= threshold)
map = (vaddr_t)addr;
else {
- map = (vaddr_t)mapiodev((void *)addr, size);
+ map = mapiodev((paddr_t)addr, size);
}
if (map == NULL)
@@ -150,9 +147,9 @@ mainbus_vaddr(bus_space_handle_t handle)
* of pa. However, it is advisable to have pa page aligned since otherwise,
* we might have several mappings for a given chunk of the IO page.
*/
-void *
+vaddr_t
mapiodev(pa, size)
- void *pa;
+ paddr_t pa;
int size;
{
vaddr_t iova, tva, off;
@@ -162,8 +159,8 @@ mapiodev(pa, size)
if (size <= 0)
return NULL;
- ppa = trunc_page((paddr_t)pa);
- off = (paddr_t)pa & PGOFSET;
+ ppa = trunc_page(pa);
+ off = pa & PGOFSET;
size = round_page(off + size);
s = splhigh();
@@ -185,7 +182,7 @@ mapiodev(pa, size)
}
pmap_update(vm_map_pmap(iomap_map));
- return (void *)(iova + off);
+ return (iova + off);
}
/*
@@ -193,14 +190,14 @@ mapiodev(pa, size)
*/
void
unmapiodev(va, size)
- void *va;
+ vaddr_t va;
int size;
{
vaddr_t kva, off;
int s, error;
- off = (vaddr_t)va & PGOFSET;
- kva = trunc_page((vaddr_t)va);
+ off = va & PGOFSET;
+ kva = trunc_page(va);
size = round_page(off + size);
pmap_remove(vm_map_pmap(iomap_map), kva, kva + size);
diff --git a/sys/arch/mvme88k/dev/vme.c b/sys/arch/mvme88k/dev/vme.c
index 80ac43dddd2..8872652eeb4 100644
--- a/sys/arch/mvme88k/dev/vme.c
+++ b/sys/arch/mvme88k/dev/vme.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vme.c,v 1.39 2004/08/02 08:35:00 miod Exp $ */
+/* $OpenBSD: vme.c,v 1.40 2005/11/25 22:14:31 miod Exp $ */
/*
* Copyright (c) 2004, Miodrag Vallat.
* Copyright (c) 1999 Steve Murphree, Jr.
@@ -99,7 +99,7 @@ vme_map(bus_addr_t addr, bus_size_t size, int flags, bus_space_handle_t *ret)
#if 0
map = iomap_mapin(addr, size, 0);
#else
- map = (vaddr_t)mapiodev((void *)addr, size);
+ map = (vaddr_t)mapiodev((paddr_t)addr, size);
#endif
if (map == NULL)
return ENOMEM;
@@ -114,7 +114,7 @@ vme_unmap(bus_space_handle_t handle, bus_size_t size)
#if 0
iomap_mapout(handle, size);
#else
- unmapiodev((void *)handle, size);
+ unmapiodev((vaddr_t)handle, size);
#endif
}
@@ -334,7 +334,7 @@ vme_findvec(int skip)
* mappings, ie. the MVME147 cannot do 32 bit accesses to VME bus
* addresses from 0 to physmem.
*/
-void *
+paddr_t
vmepmap(sc, vmeaddr, bustype)
struct device *sc;
off_t vmeaddr;
@@ -379,17 +379,17 @@ vmepmap(sc, vmeaddr, bustype)
default:
return NULL;
}
- return ((void *)base);
+ return (base);
}
-static void *vmemap(struct vmesoftc *, off_t);
-static void vmeunmap(void *);
+static vaddr_t vmemap(struct vmesoftc *, off_t);
+static void vmeunmap(paddr_t);
/* if successful, returns the va of a vme bus mapping */
-static __inline__ void *
+static __inline__ vaddr_t
vmemap(struct vmesoftc *sc, off_t vmeaddr)
{
- void *pa;
+ paddr_t pa;
pa = vmepmap((struct device *)sc, vmeaddr, BUS_VMES);
if (pa == NULL)
@@ -398,7 +398,7 @@ vmemap(struct vmesoftc *sc, off_t vmeaddr)
}
static __inline__ void
-vmeunmap(void *va)
+vmeunmap(vaddr_t va)
{
unmapiodev(va, PAGE_SIZE);
}
@@ -413,7 +413,7 @@ vmerw(sc, uio, flags, bus)
vaddr_t v;
int c;
struct iovec *iov;
- void *vme;
+ paddr_t vme;
int error = 0;
while (uio->uio_resid > 0 && error == 0) {
diff --git a/sys/arch/mvme88k/dev/vme.h b/sys/arch/mvme88k/dev/vme.h
index 040731c3aeb..dbaf52ddc4b 100644
--- a/sys/arch/mvme88k/dev/vme.h
+++ b/sys/arch/mvme88k/dev/vme.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vme.h,v 1.16 2004/07/30 19:02:06 miod Exp $ */
+/* $OpenBSD: vme.h,v 1.17 2005/11/25 22:14:32 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -280,7 +280,7 @@ struct vmesoftc {
#define VME2_A16BASE 0xffff0000UL
#define VME2_A24BASE 0xff000000UL
-void *vmepmap(struct device *sc, off_t vmeaddr, int bustype);
+paddr_t vmepmap(struct device *sc, off_t vmeaddr, int bustype);
int vmerw(struct device *sc, struct uio *uio, int flags, int bus);
int vmeintr_establish(int, struct intrhand *, const char *);
int vme_findvec(int);
diff --git a/sys/arch/mvme88k/dev/vmel.c b/sys/arch/mvme88k/dev/vmel.c
index 77e464d63d4..89bdcce3550 100644
--- a/sys/arch/mvme88k/dev/vmel.c
+++ b/sys/arch/mvme88k/dev/vmel.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmel.c,v 1.15 2004/04/24 19:51:48 miod Exp $ */
+/* $OpenBSD: vmel.c,v 1.16 2005/11/25 22:14:32 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -157,7 +157,7 @@ vmelmmap(dev, off, prot)
{
int unit = minor(dev);
struct device *sc = (struct device *)vmel_cd.cd_devs[unit];
- void * pa;
+ paddr_t pa;
pa = vmepmap(sc->dv_parent, off, BUS_VMEL);
#ifdef DEBUG
diff --git a/sys/arch/mvme88k/dev/vmes.c b/sys/arch/mvme88k/dev/vmes.c
index 4e6ae197e86..c0a60f86177 100644
--- a/sys/arch/mvme88k/dev/vmes.c
+++ b/sys/arch/mvme88k/dev/vmes.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmes.c,v 1.18 2004/04/24 19:51:48 miod Exp $ */
+/* $OpenBSD: vmes.c,v 1.19 2005/11/25 22:14:32 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -162,7 +162,7 @@ vmesmmap(dev, off, prot)
{
int unit = minor(dev);
struct device *sc = (struct device *)vmes_cd.cd_devs[unit];
- void * pa;
+ paddr_t pa;
pa = vmepmap(sc->dv_parent, off, BUS_VMES);
#ifdef DEBUG
diff --git a/sys/arch/mvme88k/include/autoconf.h b/sys/arch/mvme88k/include/autoconf.h
index e88d4074970..c10fb329dac 100644
--- a/sys/arch/mvme88k/include/autoconf.h
+++ b/sys/arch/mvme88k/include/autoconf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.h,v 1.15 2004/07/20 20:33:19 miod Exp $ */
+/* $OpenBSD: autoconf.h,v 1.16 2005/11/25 22:14:34 miod Exp $ */
/*
* Copyright (c) 1999, Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -64,7 +64,7 @@ extern int bootbus; /* scsi bus (disk) */
extern struct device *bootdv; /* boot device */
-void *mapiodev(void *pa, int size);
-void unmapiodev(void *kva, int size);
+vaddr_t mapiodev(paddr_t pa, int size);
+void unmapiodev(vaddr_t kva, int size);
#endif