summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2005-11-24 22:43:20 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2005-11-24 22:43:20 +0000
commit1b1b775efbf1ce5de10a4e90ce6f1b8fef11cf6d (patch)
tree8f11d2dab7028064b566ebe83b7f71890c6f1224 /sys
parent3b6fc494d6c3ea81b031d03cd56c0569869c875f (diff)
Prefer vaddr_t and paddr_t types in device softc, instead of void * and
heavy casts. Improves readability, no functional change.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/mvme68k/dev/cl.c8
-rw-r--r--sys/arch/mvme68k/dev/flash.c24
-rw-r--r--sys/arch/mvme68k/dev/if_ie.c10
-rw-r--r--sys/arch/mvme68k/dev/if_le.c12
-rw-r--r--sys/arch/mvme68k/dev/ipic.c9
-rw-r--r--sys/arch/mvme68k/dev/ipicreg.h4
-rw-r--r--sys/arch/mvme68k/dev/mc.c14
-rw-r--r--sys/arch/mvme68k/dev/memdevs.c6
-rw-r--r--sys/arch/mvme68k/dev/memdevs.h4
-rw-r--r--sys/arch/mvme68k/dev/nvram.c21
-rw-r--r--sys/arch/mvme68k/dev/pcc.c12
-rw-r--r--sys/arch/mvme68k/dev/pcctwo.c12
-rw-r--r--sys/arch/mvme68k/dev/sram.c14
-rw-r--r--sys/arch/mvme68k/dev/sshdma.c4
-rw-r--r--sys/arch/mvme68k/dev/vme.c58
-rw-r--r--sys/arch/mvme68k/dev/vme.h10
-rw-r--r--sys/arch/mvme68k/dev/vmel.c6
-rw-r--r--sys/arch/mvme68k/dev/vmes.c8
-rw-r--r--sys/arch/mvme68k/dev/vsdma.c4
-rw-r--r--sys/arch/mvme68k/dev/wl.c20
-rw-r--r--sys/arch/mvme68k/dev/zs.c17
-rw-r--r--sys/arch/mvme68k/include/autoconf.h12
-rw-r--r--sys/arch/mvme68k/include/cpu.h14
-rw-r--r--sys/arch/mvme68k/mvme68k/autoconf.c28
-rw-r--r--sys/arch/mvme68k/mvme68k/machdep.c9
-rw-r--r--sys/arch/mvme68k/mvme68k/pmap_bootstrap.c22
26 files changed, 178 insertions, 184 deletions
diff --git a/sys/arch/mvme68k/dev/cl.c b/sys/arch/mvme68k/dev/cl.c
index 074bbf34166..af78492f3d2 100644
--- a/sys/arch/mvme68k/dev/cl.c
+++ b/sys/arch/mvme68k/dev/cl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cl.c,v 1.40 2004/08/09 06:04:18 miod Exp $ */
+/* $OpenBSD: cl.c,v 1.41 2005/11/24 22:43:16 miod Exp $ */
/*
* Copyright (c) 1995 Dale Rahn. All rights reserved.
@@ -73,7 +73,7 @@
#define CL_RXINTR 0x02
struct cl_cons {
- void *cl_paddr;
+ paddr_t cl_paddr;
struct clreg *cl_vaddr;
volatile struct pcctworeg *pcctwoaddr;
u_char channel;
@@ -949,8 +949,8 @@ clcninit(cp)
{
struct clreg *cl_reg;
- cl_cons.cl_paddr = (void *)0xfff45000;
- cl_cons.cl_vaddr = (struct clreg *)IIOV(cl_cons.cl_paddr);
+ cl_cons.cl_paddr = 0xfff45000;
+ cl_cons.cl_vaddr = (struct clreg *)IIOV(cl_cons.cl_paddr);
cl_cons.pcctwoaddr = (void *)IIOV(0xfff42000);
cl_reg = cl_cons.cl_vaddr;
diff --git a/sys/arch/mvme68k/dev/flash.c b/sys/arch/mvme68k/dev/flash.c
index 3dfa7a22d56..673b216b97f 100644
--- a/sys/arch/mvme68k/dev/flash.c
+++ b/sys/arch/mvme68k/dev/flash.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: flash.c,v 1.15 2005/10/27 16:04:08 martin Exp $ */
+/* $OpenBSD: flash.c,v 1.16 2005/11/24 22:43:16 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -52,13 +52,13 @@
#include <mvme68k/dev/flashreg.h>
struct flashsoftc {
- struct device sc_dev;
- u_char * sc_paddr;
- volatile u_char * sc_vaddr;
- u_char sc_manu;
- u_char sc_ii;
- int sc_len;
- int sc_zonesize;
+ struct device sc_dev;
+ paddr_t sc_paddr;
+ volatile u_char *sc_vaddr;
+ u_char sc_manu;
+ u_char sc_ii;
+ int sc_len;
+ int sc_zonesize;
};
void flashattach(struct device *, struct device *, void *);
@@ -123,7 +123,7 @@ flashmatch(parent, cf, args)
return (0);
#endif
- if (badpaddr((paddr_t)ca->ca_paddr, 1))
+ if (badpaddr(ca->ca_paddr, 1))
return (0);
if (!mc_hasflash())
@@ -142,7 +142,7 @@ flashattach(parent, self, args)
int manu, ident;
sc->sc_paddr = ca->ca_paddr;
- sc->sc_vaddr = mapiodev(sc->sc_paddr, NBPG);
+ sc->sc_vaddr = (volatile u_char *)mapiodev(sc->sc_paddr, NBPG);
switch (cputyp) {
#ifdef MVME162
@@ -187,8 +187,8 @@ flashattach(parent, self, args)
sc->sc_vaddr[0] = FLCMD_CLEARSTAT;
sc->sc_vaddr[0] = FLCMD_RESET;
- unmapiodev((void *)sc->sc_vaddr, NBPG);
- sc->sc_vaddr = mapiodev(sc->sc_paddr, sc->sc_len);
+ unmapiodev((vaddr_t)sc->sc_vaddr, NBPG);
+ sc->sc_vaddr = (volatile u_char *)mapiodev(sc->sc_paddr, sc->sc_len);
if (sc->sc_vaddr == NULL) {
sc->sc_len = 0;
printf(" -- failed to map");
diff --git a/sys/arch/mvme68k/dev/if_ie.c b/sys/arch/mvme68k/dev/if_ie.c
index a50fcd5c92a..708a68ff125 100644
--- a/sys/arch/mvme68k/dev/if_ie.c
+++ b/sys/arch/mvme68k/dev/if_ie.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ie.c,v 1.29 2005/07/31 03:52:18 pascoe Exp $ */
+/* $OpenBSD: if_ie.c,v 1.30 2005/11/24 22:43:16 miod Exp $ */
/*-
* Copyright (c) 1999 Steve Murphree, Jr.
@@ -174,7 +174,7 @@ struct ie_softc {
caddr_t sc_iobase; /* KVA of base of 24 bit addr space */
caddr_t sc_maddr; /* KVA of base of chip's RAM (16bit addr sp.)*/
u_int sc_msize; /* how much RAM we have/use */
- caddr_t sc_reg; /* KVA of car's register */
+ vaddr_t sc_reg; /* KVA of car's register */
int sc_bustype;
struct arpcom sc_arpcom;/* system arpcom structure */
@@ -356,7 +356,7 @@ ie_obreset(arg)
void *arg;
{
struct ie_softc *sc = (struct ie_softc *)arg;
- volatile struct ieob *ieo = (struct ieob *) sc->sc_reg;
+ volatile struct ieob *ieo = (struct ieob *)sc->sc_reg;
volatile int t;
u_long a;
@@ -379,7 +379,7 @@ ie_obattend(arg)
void *arg;
{
struct ie_softc *sc = (struct ie_softc *)arg;
- volatile struct ieob *ieo = (struct ieob *) sc->sc_reg;
+ volatile struct ieob *ieo = (struct ieob *)sc->sc_reg;
ieo->attn = 1;
}
@@ -414,7 +414,7 @@ ieattach(parent, self, aux)
sc->memzero = bzero;
sc->sc_msize = etherlen;
sc->sc_reg = ca->ca_vaddr;
- ieo = (volatile struct ieob *) sc->sc_reg;
+ ieo = (volatile struct ieob *)sc->sc_reg;
/* Are we the boot device? */
if (ca->ca_paddr == bootaddr)
diff --git a/sys/arch/mvme68k/dev/if_le.c b/sys/arch/mvme68k/dev/if_le.c
index f9e9f6ea41c..db5c707d883 100644
--- a/sys/arch/mvme68k/dev/if_le.c
+++ b/sys/arch/mvme68k/dev/if_le.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_le.c,v 1.29 2004/07/30 22:29:45 miod Exp $ */
+/* $OpenBSD: if_le.c,v 1.30 2005/11/24 22:43:16 miod Exp $ */
/*-
* Copyright (c) 1982, 1992, 1993
@@ -276,7 +276,7 @@ lematch(parent, vcf, args)
{
struct confargs *ca = args;
/* check physical addr for bogus MVME162 addr @0xffffd200. weird XXX - smurph */
- if (cputyp == CPU_162 && ca->ca_paddr == (void *)0xffffd200)
+ if (cputyp == CPU_162 && ca->ca_paddr == 0xffffd200)
return (0);
return (!badvaddr((vaddr_t)ca->ca_vaddr, 2));
@@ -298,7 +298,7 @@ leattach(parent, self, aux)
struct confargs *ca = aux;
int pri = ca->ca_ipl;
extern void *etherbuf;
- caddr_t addr;
+ paddr_t addr;
int card;
/* XXX the following declarations should be elsewhere */
@@ -319,7 +319,7 @@ leattach(parent, self, aux)
* however, the board can be set up at any other address.
* XXX These physical addresses should be mapped in extio!!!
*/
- switch ((int)ca->ca_paddr) {
+ switch (ca->ca_paddr) {
case 0xffff1200:
card = 0;
break;
@@ -343,7 +343,7 @@ leattach(parent, self, aux)
return;
}
- addr = (caddr_t)(VLEMEMBASE - (card * VLEMEMSIZE));
+ addr = VLEMEMBASE - (card * VLEMEMSIZE);
sc->sc_mem = (void *)mapiodev(addr, VLEMEMSIZE);
if (sc->sc_mem == NULL) {
@@ -351,7 +351,7 @@ leattach(parent, self, aux)
sc->sc_dev.dv_xname);
return;
}
- sc->sc_addr = (paddr_t)addr & 0x00ffffff;
+ sc->sc_addr = addr & 0x00ffffff;
lesc->sc_r1 = (void *)ca->ca_vaddr;
lesc->sc_ipl = ca->ca_ipl;
diff --git a/sys/arch/mvme68k/dev/ipic.c b/sys/arch/mvme68k/dev/ipic.c
index ff766a2c20c..d707f80b9f7 100644
--- a/sys/arch/mvme68k/dev/ipic.c
+++ b/sys/arch/mvme68k/dev/ipic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipic.c,v 1.15 2004/07/30 22:29:45 miod Exp $ */
+/* $OpenBSD: ipic.c,v 1.16 2005/11/24 22:43:16 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -98,7 +98,8 @@ ipicscan(parent, child, args)
struct ipicsoftc *sc = (struct ipicsoftc *)parent;
struct confargs oca;
int slot, n = 0;
- caddr_t ipv, ipp;
+ vaddr_t ipv;
+ paddr_t ipp;
struct ipid *ipid;
/* XXX can we determine IPIC_IPSPACE automatically? */
@@ -108,7 +109,7 @@ ipicscan(parent, child, args)
continue;
ipv = mapiodev(ipp, NBPG);
- if (ipv == NULL)
+ if (ipv == 0)
continue;
ipid = (struct ipid *)(ipv + IPIC_IP_IDOFFSET);
@@ -152,7 +153,7 @@ ipicattach(parent, self, args)
struct confargs *ca = args;
sc->sc_ipic = (struct ipicreg *)ca->ca_vaddr;
- sc->sc_ipspace = (caddr_t)IPIC_IPSPACE;
+ sc->sc_ipspace = IPIC_IPSPACE;
sc->sc_nip = 2;
/*
diff --git a/sys/arch/mvme68k/dev/ipicreg.h b/sys/arch/mvme68k/dev/ipicreg.h
index 2f5b24b1fd9..dc789263a6d 100644
--- a/sys/arch/mvme68k/dev/ipicreg.h
+++ b/sys/arch/mvme68k/dev/ipicreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipicreg.h,v 1.6 2004/07/30 22:29:45 miod Exp $ */
+/* $OpenBSD: ipicreg.h,v 1.7 2005/11/24 22:43:16 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -104,7 +104,7 @@ struct ipicsoftc {
struct device sc_dev;
struct ipicreg *sc_ipic;
- caddr_t sc_ipspace;
+ vaddr_t sc_ipspace;
int sc_nip;
};
diff --git a/sys/arch/mvme68k/dev/mc.c b/sys/arch/mvme68k/dev/mc.c
index cbc4ad1929f..b348000d639 100644
--- a/sys/arch/mvme68k/dev/mc.c
+++ b/sys/arch/mvme68k/dev/mc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mc.c,v 1.16 2004/07/30 22:29:45 miod Exp $ */
+/* $OpenBSD: mc.c,v 1.17 2005/11/24 22:43:16 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -48,8 +48,8 @@
struct mcsoftc {
struct device sc_dev;
- void *sc_vaddr;
- void *sc_paddr;
+ vaddr_t sc_vaddr;
+ paddr_t sc_paddr;
struct mcreg *sc_mc;
struct intrhand sc_nmiih;
};
@@ -111,11 +111,11 @@ mc_scan(parent, child, args)
oca.ca_offset = cf->cf_loc[0];
oca.ca_ipl = cf->cf_loc[1];
if (oca.ca_offset != -1 && ISIIOVA(sc->sc_vaddr + oca.ca_offset)) {
- oca.ca_paddr = sc->sc_paddr + oca.ca_offset;
oca.ca_vaddr = sc->sc_vaddr + oca.ca_offset;
+ oca.ca_paddr = sc->sc_paddr + oca.ca_offset;
} else {
- oca.ca_paddr = (void *)-1;
- oca.ca_vaddr = (void *)-1;
+ oca.ca_vaddr = (vaddr_t)-1;
+ oca.ca_paddr = (paddr_t)-1;
}
oca.ca_bustype = BUS_MC;
oca.ca_name = cf->cf_driver->cd_name;
@@ -141,7 +141,7 @@ mcattach(parent, self, args)
* we must adjust our address
*/
sc->sc_paddr = ca->ca_paddr;
- sc->sc_vaddr = (void *)IIOV(sc->sc_paddr);
+ sc->sc_vaddr = IIOV(sc->sc_paddr);
sc->sc_mc = (struct mcreg *)(sc->sc_vaddr + MC_MCCHIP_OFF);
sys_mc = sc->sc_mc;
diff --git a/sys/arch/mvme68k/dev/memdevs.c b/sys/arch/mvme68k/dev/memdevs.c
index fc8abbee19d..7a70eebbd31 100644
--- a/sys/arch/mvme68k/dev/memdevs.c
+++ b/sys/arch/mvme68k/dev/memdevs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: memdevs.c,v 1.5 2003/06/02 05:09:14 deraadt Exp $ */
+/* $OpenBSD: memdevs.c,v 1.6 2005/11/24 22:43:16 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -41,7 +41,7 @@
/*ARGSUSED*/
int
memdevrw(base, len, uio, flags)
- caddr_t base;
+ vaddr_t base;
int len;
struct uio *uio;
int flags;
@@ -67,7 +67,7 @@ memdevrw(base, len, uio, flags)
c = len - v; /* till end of dev */
if (c == 0)
return (0);
- error = uiomove(base + v, c, uio);
+ error = uiomove((caddr_t)base + v, c, uio);
}
return (error);
}
diff --git a/sys/arch/mvme68k/dev/memdevs.h b/sys/arch/mvme68k/dev/memdevs.h
index ee2243d6462..0972a1956e1 100644
--- a/sys/arch/mvme68k/dev/memdevs.h
+++ b/sys/arch/mvme68k/dev/memdevs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: memdevs.h,v 1.2 2003/04/16 17:34:46 miod Exp $ */
+/* $OpenBSD: memdevs.h,v 1.3 2005/11/24 22:43:16 miod Exp $ */
/*
* Copyright (c) 2002, Miodrag Vallat.
* All rights reserved.
@@ -27,4 +27,4 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-extern int memdevrw(caddr_t, int, struct uio *, int);
+extern int memdevrw(vaddr_t, int, struct uio *, int);
diff --git a/sys/arch/mvme68k/dev/nvram.c b/sys/arch/mvme68k/dev/nvram.c
index fa8db67ccf5..b91c20b3b94 100644
--- a/sys/arch/mvme68k/dev/nvram.c
+++ b/sys/arch/mvme68k/dev/nvram.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nvram.c,v 1.15 2005/10/27 16:04:08 martin Exp $ */
+/* $OpenBSD: nvram.c,v 1.16 2005/11/24 22:43:16 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -52,9 +52,9 @@
#endif
struct nvramsoftc {
- struct device sc_dev;
- void * sc_paddr;
- void * sc_vaddr;
+ struct device sc_dev;
+ paddr_t sc_paddr;
+ vaddr_t sc_vaddr;
int sc_len;
struct clockreg *sc_regs;
};
@@ -77,9 +77,9 @@ nvrammatch(parent, vcf, args)
{
struct confargs *ca = args;
-/*X*/ if (ca->ca_vaddr == (void *)-1)
+/*X*/ if (ca->ca_vaddr == (vaddr_t)-1)
/*X*/ return (1);
- return (!badvaddr((vaddr_t)ca->ca_vaddr, 1));
+ return (!badvaddr(ca->ca_vaddr, 1));
}
void
@@ -91,17 +91,16 @@ nvramattach(parent, self, args)
struct nvramsoftc *sc = (struct nvramsoftc *)self;
sc->sc_paddr = ca->ca_paddr;
- sc->sc_vaddr = ca->ca_vaddr;
+ sc->sc_vaddr = (vaddr_t)ca->ca_vaddr;
sc->sc_len = MK48T08_SIZE;
if (cputyp == CPU_147)
sc->sc_len = MK48T02_SIZE;
-/*X*/ if (sc->sc_vaddr == (void *)-1)
-/*X*/ sc->sc_vaddr = mapiodev((void *)sc->sc_paddr,
-/*X*/ MAX(sc->sc_len, NBPG));
-/*X*/ if (sc->sc_vaddr == NULL)
+/*X*/ if (sc->sc_vaddr == -1)
+/*X*/ sc->sc_vaddr = mapiodev(sc->sc_paddr, MAX(sc->sc_len, NBPG));
+/*X*/ if (sc->sc_vaddr == 0)
/*X*/ panic("failed to map!");
sc->sc_regs = (struct clockreg *)(sc->sc_vaddr + sc->sc_len -
diff --git a/sys/arch/mvme68k/dev/pcc.c b/sys/arch/mvme68k/dev/pcc.c
index 45250dac7d7..793f3a9bd4d 100644
--- a/sys/arch/mvme68k/dev/pcc.c
+++ b/sys/arch/mvme68k/dev/pcc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcc.c,v 1.14 2004/07/30 22:29:45 miod Exp $ */
+/* $OpenBSD: pcc.c,v 1.15 2005/11/24 22:43:16 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -48,8 +48,8 @@
struct pccsoftc {
struct device sc_dev;
- void *sc_vaddr;
- void *sc_paddr;
+ vaddr_t sc_vaddr;
+ paddr_t sc_paddr;
struct pccreg *sc_pcc;
struct intrhand sc_nmiih;
};
@@ -113,8 +113,8 @@ pcc_scan(parent, child, args)
oca.ca_vaddr = sc->sc_vaddr + oca.ca_offset;
oca.ca_paddr = sc->sc_paddr + oca.ca_offset;
} else {
- oca.ca_vaddr = (void *)-1;
- oca.ca_paddr = (void *)-1;
+ oca.ca_vaddr = (vaddr_t)-1;
+ oca.ca_paddr = (paddr_t)-1;
}
oca.ca_bustype = BUS_PCC;
oca.ca_name = cf->cf_driver->cd_name;
@@ -140,7 +140,7 @@ pccattach(parent, self, args)
* we must adjust our address
*/
sc->sc_paddr = ca->ca_paddr;
- sc->sc_vaddr = (void *)IIOV(sc->sc_paddr);
+ sc->sc_vaddr = IIOV(sc->sc_paddr);
sc->sc_pcc = (struct pccreg *)(sc->sc_vaddr + PCCSPACE_PCCCHIP_OFF);
sys_pcc = sc->sc_pcc;
diff --git a/sys/arch/mvme68k/dev/pcctwo.c b/sys/arch/mvme68k/dev/pcctwo.c
index 7abf48ccfa8..fa6f6cd7ad6 100644
--- a/sys/arch/mvme68k/dev/pcctwo.c
+++ b/sys/arch/mvme68k/dev/pcctwo.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: pcctwo.c,v 1.14 2004/07/30 22:29:45 miod Exp $ */
+/* $OpenBSD: pcctwo.c,v 1.15 2005/11/24 22:43:16 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -49,8 +49,8 @@
struct pcctwosoftc {
struct device sc_dev;
- void *sc_vaddr; /* PCC2 space */
- void *sc_paddr;
+ vaddr_t sc_vaddr; /* PCC2 space */
+ paddr_t sc_paddr;
struct pcctworeg *sc_pcc2; /* the actual registers */
};
@@ -116,8 +116,8 @@ pcctwo_scan(parent, child, args)
oca.ca_vaddr = sc->sc_vaddr + oca.ca_offset;
oca.ca_paddr = sc->sc_paddr + oca.ca_offset;
} else {
- oca.ca_vaddr = (void *)-1;
- oca.ca_paddr = (void *)-1;
+ oca.ca_vaddr = (vaddr_t)-1;
+ oca.ca_paddr = (paddr_t)-1;
}
oca.ca_bustype = BUS_PCCTWO;
oca.ca_name = cf->cf_driver->cd_name;
@@ -143,7 +143,7 @@ pcctwoattach(parent, self, args)
* we must adjust our address
*/
sc->sc_paddr = ca->ca_paddr;
- sc->sc_vaddr = (void *)IIOV(sc->sc_paddr);
+ sc->sc_vaddr = IIOV(sc->sc_paddr);
sc->sc_pcc2 = (struct pcctworeg *)(sc->sc_vaddr + PCC2_PCC2CHIP_OFF);
sys_pcc2 = sc->sc_pcc2;
diff --git a/sys/arch/mvme68k/dev/sram.c b/sys/arch/mvme68k/dev/sram.c
index 871a4f19dc0..159dfb06e3b 100644
--- a/sys/arch/mvme68k/dev/sram.c
+++ b/sys/arch/mvme68k/dev/sram.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sram.c,v 1.15 2005/10/27 16:04:08 martin Exp $ */
+/* $OpenBSD: sram.c,v 1.16 2005/11/24 22:43:16 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -50,8 +50,8 @@
struct sramsoftc {
struct device sc_dev;
- void * sc_paddr;
- void * sc_vaddr;
+ paddr_t sc_paddr;
+ vaddr_t sc_vaddr;
int sc_len;
};
@@ -75,8 +75,8 @@ srammatch(parent, vcf, args)
if (cputyp == CPU_147)
return (0);
- if (ca->ca_vaddr == (void *)-1)
- return (!badpaddr((paddr_t)ca->ca_paddr, 1));
+ if (ca->ca_vaddr == (vaddr_t)-1)
+ return (!badpaddr(ca->ca_paddr, 1));
return (!badvaddr((vaddr_t)ca->ca_vaddr, 1));
}
@@ -134,8 +134,8 @@ sramattach(parent, self, args)
printf(": len %d", sc->sc_len);
sc->sc_paddr = ca->ca_paddr;
- sc->sc_vaddr = mapiodev((void *)sc->sc_paddr, sc->sc_len);
- if (sc->sc_vaddr == NULL) {
+ sc->sc_vaddr = mapiodev(sc->sc_paddr, sc->sc_len);
+ if (sc->sc_vaddr == 0) {
sc->sc_len = 0;
printf(" -- failed to map");
}
diff --git a/sys/arch/mvme68k/dev/sshdma.c b/sys/arch/mvme68k/dev/sshdma.c
index 2d14a9fc8c3..82970a76da8 100644
--- a/sys/arch/mvme68k/dev/sshdma.c
+++ b/sys/arch/mvme68k/dev/sshdma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshdma.c,v 1.11 2004/07/30 22:29:45 miod Exp $ */
+/* $OpenBSD: sshdma.c,v 1.12 2005/11/24 22:43:16 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -106,7 +106,7 @@ void *auxp;
int tmp;
extern int cpuspeed;
- sc->sc_sshp = rp = ca->ca_vaddr;
+ sc->sc_sshp = rp = (void *)ca->ca_vaddr;
/*
* ssh uses sc_clock_freq to define the dcntl & ctest7 reg values
* (was 0x0221, but i added SSH_CTEST7_SC0 for snooping control)
diff --git a/sys/arch/mvme68k/dev/vme.c b/sys/arch/mvme68k/dev/vme.c
index 58acfcc1733..e70206f9ead 100644
--- a/sys/arch/mvme68k/dev/vme.c
+++ b/sys/arch/mvme68k/dev/vme.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vme.c,v 1.22 2004/07/30 22:29:45 miod Exp $ */
+/* $OpenBSD: vme.c,v 1.23 2005/11/24 22:43:16 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -61,10 +61,10 @@ void vmeattach(struct device *, struct device *, void *);
void vme1chip_init(struct vmesoftc *sc);
void vme2chip_init(struct vmesoftc *sc);
-u_long vme2chip_map(u_long base, int len, int dwidth);
+paddr_t vme2chip_map(u_long base, int len, int dwidth);
int vme2abort(void *);
-void vmeunmap(void *, int);
+void vmeunmap(vaddr_t, int);
int vmeprint(void *, const char *);
static int vmebustype;
@@ -120,14 +120,14 @@ vmematch(parent, cf, args)
* mappings, ie. the MVME147 cannot do 32 bit accesses to VME bus
* addresses from 0 to physmem.
*/
-void *
+paddr_t
vmepmap(sc, vmeaddr, len, bustype)
struct vmesoftc *sc;
- void *vmeaddr;
+ paddr_t vmeaddr;
int len;
int bustype;
{
- u_int32_t base = (u_int32_t)vmeaddr;
+ paddr_t base = vmeaddr;
len = roundup(len, NBPG);
switch (vmebustype) {
@@ -154,7 +154,7 @@ vmepmap(sc, vmeaddr, len, bustype)
} else {
printf("%s: cannot map pa 0x%x len 0x%x\n",
sc->sc_dev.dv_xname, base, len);
- return (NULL);
+ return (0);
}
break;
case BUS_VMEL:
@@ -165,7 +165,7 @@ vmepmap(sc, vmeaddr, len, bustype)
else {
printf("%s: cannot map pa 0x%x len 0x%x\n",
sc->sc_dev.dv_xname, base, len);
- return (NULL);
+ return (0);
}
break;
}
@@ -194,8 +194,6 @@ vmepmap(sc, vmeaddr, len, bustype)
printf("vme2chip_map\n");
#endif
base = vme2chip_map(base, len, 16);
- if (base == NULL)
- return (NULL);
}
break;
case BUS_VMEL:
@@ -205,36 +203,35 @@ vmepmap(sc, vmeaddr, len, bustype)
base = base - VME2_A16BASE + VME2_A16D32BASE;
#endif
base = vme2chip_map(base, len, 32);
- if (base == NULL)
- return (NULL);
break;
}
break;
#endif
}
- return ((void *)base);
+ return (base);
}
/* if successful, returns the va of a vme bus mapping */
-void *
+vaddr_t
vmemap(sc, vmeaddr, len, bustype)
struct vmesoftc *sc;
- void *vmeaddr;
+ paddr_t vmeaddr;
int len;
int bustype;
{
- void *pa, *va;
+ paddr_t pa;
+ vaddr_t va;
pa = vmepmap(sc, vmeaddr, len, bustype);
- if (pa == NULL)
- return (NULL);
+ if (pa == 0)
+ return (0);
va = mapiodev(pa, len);
return (va);
}
void
vmeunmap(va, len)
- void *va;
+ vaddr_t va;
int len;
{
unmapiodev(va, len);
@@ -247,10 +244,10 @@ vmerw(sc, uio, flags, bus)
int flags;
int bus;
{
- register vm_offset_t v;
- register int c;
- register struct iovec *iov;
- void *vme;
+ vaddr_t v;
+ int c;
+ struct iovec *iov;
+ vaddr_t vme;
int error = 0;
while (uio->uio_resid > 0 && error == 0) {
@@ -269,9 +266,8 @@ vmerw(sc, uio, flags, bus)
c = NBPG - (v & PGOFSET);
if (c == 0)
return (0);
- vme = vmemap(sc, (void *)(v & ~PGOFSET),
- NBPG, BUS_VMES);
- if (vme == NULL) {
+ vme = vmemap(sc, trunc_page(v), NBPG, BUS_VMES);
+ if (vme == 0) {
error = EFAULT; /* XXX? */
continue;
}
@@ -308,7 +304,7 @@ vmescan(parent, child, args, bustype)
bzero(&oca, sizeof oca);
oca.ca_bustype = bustype;
- oca.ca_paddr = (void *)cf->cf_loc[0];
+ oca.ca_paddr = cf->cf_loc[0];
oca.ca_len = cf->cf_loc[1];
oca.ca_vec = cf->cf_loc[2];
oca.ca_ipl = cf->cf_loc[3];
@@ -317,13 +313,13 @@ vmescan(parent, child, args, bustype)
if (oca.ca_len == -1)
oca.ca_len = 4096;
- oca.ca_offset = (u_int)oca.ca_paddr;
+ oca.ca_offset = oca.ca_paddr;
oca.ca_vaddr = vmemap(sc, oca.ca_paddr, oca.ca_len, oca.ca_bustype);
- if (!oca.ca_vaddr)
- oca.ca_vaddr = (void *)-1;
+ if (oca.ca_vaddr == 0)
+ oca.ca_vaddr = (vaddr_t)-1;
oca.ca_name = cf->cf_driver->cd_name;
if ((*cf->cf_attach->ca_match)(parent, cf, &oca) == 0) {
- if (oca.ca_vaddr != (void *)-1)
+ if (oca.ca_vaddr != (vaddr_t)-1)
vmeunmap(oca.ca_vaddr, oca.ca_len);
return (0);
}
diff --git a/sys/arch/mvme68k/dev/vme.h b/sys/arch/mvme68k/dev/vme.h
index 171b1a67cd0..7cd8c651450 100644
--- a/sys/arch/mvme68k/dev/vme.h
+++ b/sys/arch/mvme68k/dev/vme.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vme.h,v 1.11 2004/07/30 22:29:45 miod Exp $ */
+/* $OpenBSD: vme.h,v 1.12 2005/11/24 22:43:16 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -27,7 +27,7 @@
struct vmesoftc {
struct device sc_dev;
- void * sc_vaddr;
+ vaddr_t sc_vaddr;
struct intrhand sc_abih; /* `abort' switch */
};
@@ -327,10 +327,8 @@ struct vme2reg {
#define VME2_A16BASE 0xffff0000UL
#define VME2_A24BASE 0xff000000UL
-void * vmepmap(struct vmesoftc *sc, void * vmeaddr, int len,
- int bustype);
-void * vmemap(struct vmesoftc *sc, void * vmeaddr, int len,
- int bustype);
+paddr_t vmepmap(struct vmesoftc *sc, paddr_t vmeaddr, int len, int bustype);
+vaddr_t vmemap(struct vmesoftc *sc, paddr_t vmeaddr, int len, int bustype);
int vmerw(struct vmesoftc *sc, struct uio *uio, int flags, int bus);
int vmeintr_establish(int, struct intrhand *, const char *);
diff --git a/sys/arch/mvme68k/dev/vmel.c b/sys/arch/mvme68k/dev/vmel.c
index b4b8af222ac..a16bf0824b3 100644
--- a/sys/arch/mvme68k/dev/vmel.c
+++ b/sys/arch/mvme68k/dev/vmel.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmel.c,v 1.13 2005/10/27 16:04:08 martin Exp $ */
+/* $OpenBSD: vmel.c,v 1.14 2005/11/24 22:43:16 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -162,9 +162,9 @@ vmelmmap(dev, off, prot)
{
int unit = minor(dev);
struct vmelsoftc *sc = (struct vmelsoftc *) vmel_cd.cd_devs[unit];
- void *pa;
+ paddr_t pa;
- pa = vmepmap(sc->sc_vme, (void *)(int)off, NBPG, BUS_VMEL);
+ pa = vmepmap(sc->sc_vme, (vaddr_t)off, NBPG, BUS_VMEL);
#ifdef DEBUG
printf("vmel %llx pa %p\n", off, pa);
#endif
diff --git a/sys/arch/mvme68k/dev/vmes.c b/sys/arch/mvme68k/dev/vmes.c
index 375c3adcf98..7c903ad19e2 100644
--- a/sys/arch/mvme68k/dev/vmes.c
+++ b/sys/arch/mvme68k/dev/vmes.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmes.c,v 1.13 2005/10/27 16:04:08 martin Exp $ */
+/* $OpenBSD: vmes.c,v 1.14 2005/11/24 22:43:16 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -162,10 +162,10 @@ vmesmmap(dev, off, prot)
{
int unit = minor(dev);
struct vmessoftc *sc = (struct vmessoftc *) vmes_cd.cd_devs[unit];
- void * pa;
+ paddr_t pa;
- pa = vmepmap(sc->sc_vme, (void *)(int)off, NBPG, BUS_VMES);
- if (pa == NULL)
+ pa = vmepmap(sc->sc_vme, (vaddr_t)off, NBPG, BUS_VMES);
+ if (pa == 0)
return (-1);
return (atop(pa));
}
diff --git a/sys/arch/mvme68k/dev/vsdma.c b/sys/arch/mvme68k/dev/vsdma.c
index 31d6f1ca22c..b6b7bdde561 100644
--- a/sys/arch/mvme68k/dev/vsdma.c
+++ b/sys/arch/mvme68k/dev/vsdma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vsdma.c,v 1.9 2004/07/30 22:29:45 miod Exp $ */
+/* $OpenBSD: vsdma.c,v 1.10 2005/11/24 22:43:16 miod Exp $ */
/*
* Copyright (c) 1999 Steve Murphree, Jr.
* All rights reserved.
@@ -101,7 +101,7 @@ vsattach(parent, self, auxp)
struct vsreg * rp;
int tmp;
- sc->sc_vsreg = rp = ca->ca_vaddr;
+ sc->sc_vsreg = rp = (void *)ca->ca_vaddr;
sc->sc_ipl = ca->ca_ipl;
sc->sc_nvec = ca->ca_vec + 0;
diff --git a/sys/arch/mvme68k/dev/wl.c b/sys/arch/mvme68k/dev/wl.c
index 80bc8e6b513..1854456e1d7 100644
--- a/sys/arch/mvme68k/dev/wl.c
+++ b/sys/arch/mvme68k/dev/wl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wl.c,v 1.17 2004/07/30 22:29:45 miod Exp $ */
+/* $OpenBSD: wl.c,v 1.18 2005/11/24 22:43:16 miod Exp $ */
/*
* Copyright (c) 1995 Dale Rahn. All rights reserved.
@@ -121,9 +121,9 @@ struct wlsoftc {
time_t sc_fotime; /* time of last fifo overrun */
u_char sc_memv;
- void *sc_memvme;
+ paddr_t sc_memvme;
void *sc_memp;
- void *sc_memkv;
+ vaddr_t sc_memkv;
struct clreg *cl_reg;
struct cl_info sc_cl[CLCD_PORTS_PER_CHIP];
@@ -252,11 +252,11 @@ wlattach(parent, self, aux)
sc->sc_vec = ca->ca_vec;
sc->sc_memv = 0xa5 + 0;
- sc->sc_memvme = (void *)((0xff00 + sc->sc_memv) << 16);
+ sc->sc_memvme = ((0xff00 + sc->sc_memv) << 16);
clb->reset.val = 0xff; /* reset card */
DELAY(1000);
- clb->sram.base = ((u_int)sc->sc_memvme >> 16) & 0xff;
+ clb->sram.base = (sc->sc_memvme >> 16) & 0xff;
DELAY(1000);
clb->master.val = 0x01; /* enable sram decoder */
DELAY(1000);
@@ -285,12 +285,12 @@ wlattach(parent, self, aux)
sc->sc_memkv = vmemap(((struct vmessoftc *)parent)->sc_vme,
sc->sc_memvme, WLRAMLEN, BUS_VMES);
sc->sc_memp = (void *)kvtop(sc->sc_memkv);
- if (sc->sc_memkv == NULL)
+ if (sc->sc_memkv == 0)
printf("%s: got no memory", sc->sc_dev.dv_xname);
else if (badvaddr(sc->sc_memkv, 1))
printf("%s: cannot tap 0x%08x", sc->sc_dev.dv_xname, sc->sc_memkv);
else {
- u_char *x = sc->sc_memkv;
+ u_char *x = (u_char *)sc->sc_memkv;
/*printf("%s: pa 0x%08x va 0x%08x", sc->sc_dev.dv_xname,
sc->sc_memp, sc->sc_memkv);*/
@@ -338,19 +338,19 @@ wlattach(parent, self, aux)
vmeintr_establish(ca->ca_vec + 2, &sc->sc_ih_t, sc->sc_txintrname);
vmeintr_establish(ca->ca_vec + 3, &sc->sc_ih_r, sc->sc_rxintrname);
- p = sc->sc_memkv;
+ p = (void *)sc->sc_memkv;
s = splhigh();
for (i = 0; i < CLCD_PORTS_PER_CHIP; i++) {
for (j = 0; j < 2; j++) {
sc->sc_cl[i].rx[j] = p;
- sc->sc_cl[i].rxp[j] = (void *)(p - sc->sc_memkv);
+ sc->sc_cl[i].rxp[j] = (void *)(p - (void *)sc->sc_memkv);
/*printf("%d:%d rx v %x p %x\n",
i, j, sc->sc_cl[i].rx[j], sc->sc_cl[i].rxp[j]);*/
p += CL_BUFSIZE;
}
for (j = 0; j < 2; j++) {
sc->sc_cl[i].tx[j] = p;
- sc->sc_cl[i].txp[j] = (void *)(p - sc->sc_memkv);
+ sc->sc_cl[i].txp[j] = (void *)(p - (void *)sc->sc_memkv);
/*printf("%d:%d tx v %x p %x\n",
i, j, sc->sc_cl[i].tx[j], sc->sc_cl[i].txp[j]);*/
p += CL_BUFSIZE;
diff --git a/sys/arch/mvme68k/dev/zs.c b/sys/arch/mvme68k/dev/zs.c
index cb8adbccf84..9a607d5ef32 100644
--- a/sys/arch/mvme68k/dev/zs.c
+++ b/sys/arch/mvme68k/dev/zs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zs.c,v 1.21 2005/05/01 09:55:49 miod Exp $ */
+/* $OpenBSD: zs.c,v 1.22 2005/11/24 22:43:16 miod Exp $ */
/*
* Copyright (c) 2000 Steve Murphree, Jr.
@@ -126,8 +126,7 @@ struct sccregs *zs_cons_scc;
void zsstart(struct tty *);
int zsparam(struct tty *, struct termios *);
int zsirq(void *);
-int zsregs(void *va, int unit, volatile u_char **crp,
- volatile u_char **drp);
+int zsregs(vaddr_t, int, volatile u_char **, volatile u_char **);
int zspclk(void);
u_long sir_zs;
@@ -1087,7 +1086,7 @@ zscninit(cp)
* on different MVME models, so we generate independent pointers
* to them.
*/
- size = zsregs(NULL, unit, &scc_cr, &scc_dr);
+ size = zsregs(0, unit, &scc_cr, &scc_dr);
*(scc_cr + size) = 0;
*(scc_cr + size) = 9;
@@ -1128,7 +1127,7 @@ u_long zs_cons_addrs_162[] = { ZS0_PHYS_162, ZS1_PHYS_162};
*/
int
zsregs(va, unit, crp, drp)
- void *va;
+ vaddr_t va;
int unit;
volatile u_char **crp, **drp;
{
@@ -1144,8 +1143,8 @@ zsregs(va, unit, crp, drp)
switch (cputyp) {
#ifdef MVME147
case CPU_147:
- if (!va)
- va = (void *)IIOV(zs_cons_addrs_147[unit]);
+ if (va == 0)
+ va = IIOV(zs_cons_addrs_147[unit]);
scc_adr_147 = (volatile struct scc_147 *)va;
scc_cr = &scc_adr_147->cr;
scc_dr = &scc_adr_147->dr;
@@ -1155,8 +1154,8 @@ zsregs(va, unit, crp, drp)
#if defined(MVME162) || defined(MVME172)
case CPU_162:
case CPU_172:
- if (!va)
- va = (void *)IIOV(zs_cons_addrs_162[unit]);
+ if (va == 0)
+ va = IIOV(zs_cons_addrs_162[unit]);
scc_adr_162 = (volatile struct scc_162 *)va;
scc_cr = &scc_adr_162->cr;
scc_dr = &scc_adr_162->dr;
diff --git a/sys/arch/mvme68k/include/autoconf.h b/sys/arch/mvme68k/include/autoconf.h
index d435c4c4aaa..0ffe2051fa7 100644
--- a/sys/arch/mvme68k/include/autoconf.h
+++ b/sys/arch/mvme68k/include/autoconf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.h,v 1.10 2005/08/01 15:45:28 miod Exp $ */
+/* $OpenBSD: autoconf.h,v 1.11 2005/11/24 22:43:19 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -30,8 +30,8 @@
struct confargs {
int ca_bustype;
- void *ca_vaddr;
- void *ca_paddr;
+ vaddr_t ca_vaddr;
+ paddr_t ca_paddr;
int ca_offset;
int ca_len;
int ca_ipl;
@@ -48,14 +48,14 @@ struct confargs {
#define BUS_IP 7 /* VME162 IP module bus */
/* the following are from the prom/bootblocks */
-void *bootaddr; /* PA of boot device */
+paddr_t bootaddr; /* PA of boot device */
int bootctrllun; /* ctrl_lun of boot device */
int bootdevlun; /* dev_lun of boot device */
int bootpart; /* boot partition (disk) */
struct device *bootdv; /* boot device */
-void *mapiodev(void *pa, int size);
-void unmapiodev(void *kva, int size);
+vaddr_t mapiodev(paddr_t, int);
+void unmapiodev(vaddr_t, int);
#endif
diff --git a/sys/arch/mvme68k/include/cpu.h b/sys/arch/mvme68k/include/cpu.h
index 3b84bc9941a..3622cf2563b 100644
--- a/sys/arch/mvme68k/include/cpu.h
+++ b/sys/arch/mvme68k/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.21 2005/08/14 12:52:39 miod Exp $ */
+/* $OpenBSD: cpu.h,v 1.22 2005/11/24 22:43:19 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -146,8 +146,8 @@ extern int want_resched;
extern int astpending;
#define aston() (astpending = 1)
-extern char *intiobase, *intiolimit;
-extern char *iiomapbase;
+extern vaddr_t intiobase, intiolimit;
+extern vaddr_t iiomapbase;
extern int iiomapsize;
/* physical memory sections for mvme147 */
@@ -168,10 +168,10 @@ extern int iiomapsize;
* conversion between physical and kernel virtual addresses is easy.
*/
#define ISIIOVA(va) \
- ((char *)(va) >= intiobase && (char *)(va) < intiolimit)
-#define IIOV(pa) ((int)(pa)-(int)iiomapbase+(int)intiobase)
-#define IIOP(va) ((int)(va)-(int)intiobase+(int)iiomapbase)
-#define IIOPOFF(pa) ((int)(pa)-(int)iiomapbase)
+ ((va) >= intiobase && (va) < intiolimit)
+#define IIOV(pa) ((pa) - iiomapbase + intiobase)
+#define IIOP(va) ((va) - intiobase + iiomapbase)
+#define IIOPOFF(pa) ((pa) - iiomapbase)
extern int cputyp;
#define CPU_147 0x147
diff --git a/sys/arch/mvme68k/mvme68k/autoconf.c b/sys/arch/mvme68k/mvme68k/autoconf.c
index 9ac3ca519f4..4b89c409631 100644
--- a/sys/arch/mvme68k/mvme68k/autoconf.c
+++ b/sys/arch/mvme68k/mvme68k/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.28 2004/12/25 23:02:25 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.29 2005/11/24 22:43:19 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -104,7 +104,7 @@ extern void dumpconf(void);
char extiospace[EXTENT_FIXED_STORAGE_SIZE(EIOMAPSIZE / 16)];
struct extent *extio;
-extern void *extiobase;
+extern vaddr_t extiobase;
void mainbus_attach(struct device *, struct device *, void *);
int mainbus_match(struct device *, void *, void *);
@@ -133,7 +133,7 @@ mainbus_print(args, bus)
{
struct confargs *ca = args;
- if (ca->ca_paddr != (void *)-1)
+ if (ca->ca_paddr != (paddr_t)-1)
printf(" addr 0x%x", (u_int32_t)ca->ca_paddr);
return (UNCONF);
}
@@ -147,8 +147,8 @@ mainbus_scan(parent, child, args)
struct confargs oca;
bzero(&oca, sizeof oca);
- oca.ca_paddr = (void *)cf->cf_loc[0];
- oca.ca_vaddr = (void *)-1;
+ oca.ca_paddr = cf->cf_loc[0];
+ oca.ca_vaddr = (vaddr_t)-1;
oca.ca_ipl = -1;
oca.ca_bustype = BUS_MAIN;
oca.ca_name = cf->cf_driver->cd_name;
@@ -200,19 +200,19 @@ cpu_configure()
* Allocate/deallocate a cache-inhibited range of kernel virtual address
* space mapping the indicated physical address range [pa - pa+size)
*/
-void *
+vaddr_t
mapiodev(pa, size)
- void *pa;
+ paddr_t pa;
int size;
{
int error;
- void *kva;
+ vaddr_t kva;
- if (size == 0)
+ if (size <= 0)
return NULL;
#ifdef DEBUG
- if (((int)pa & PGOFSET) || (size & PGOFSET))
+ if ((pa & PGOFSET) || (size & PGOFSET))
panic("mapiodev: unaligned");
#endif
@@ -222,24 +222,24 @@ mapiodev(pa, size)
if (error != 0)
return NULL;
- physaccess((vaddr_t)kva, (paddr_t)pa, size, PG_RW|PG_CI);
+ physaccess(kva, pa, size, PG_RW | PG_CI);
return (kva);
}
void
unmapiodev(kva, size)
- void *kva;
+ vaddr_t kva;
int size;
{
int error;
#ifdef DEBUG
- if (((int)kva & PGOFSET) || (size & PGOFSET))
+ if ((kva & PGOFSET) || (size & PGOFSET))
panic("unmapiodev: unaligned");
if (kva < extiobase || kva >= extiobase + ctob(EIOMAPSIZE))
panic("unmapiodev: bad address");
#endif
- physunaccess((vaddr_t)kva, size);
+ physunaccess(kva, size);
error = extent_free(extio, (u_long)kva, size, EX_NOWAIT);
diff --git a/sys/arch/mvme68k/mvme68k/machdep.c b/sys/arch/mvme68k/mvme68k/machdep.c
index 039cd09c5c3..9fe6a20cbc8 100644
--- a/sys/arch/mvme68k/mvme68k/machdep.c
+++ b/sys/arch/mvme68k/mvme68k/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.91 2005/11/24 22:41:29 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.92 2005/11/24 22:43:19 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -892,13 +892,14 @@ badpaddr(addr, size)
int size;
{
int off = (int)addr & PGOFSET;
- caddr_t v, p = (void *)((int)addr & ~PGOFSET);
+ vaddr_t v;
+ paddr_t p = trunc_page(addr);
int x;
v = mapiodev(p, NBPG);
- if (v == NULL)
+ if (v == 0)
return (1);
- x = badvaddr((vaddr_t)v + off, size);
+ x = badvaddr(v + off, size);
unmapiodev(v, NBPG);
return (x);
}
diff --git a/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c b/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c
index df7f3074fea..14b9a4eb26a 100644
--- a/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c
+++ b/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap_bootstrap.c,v 1.20 2005/10/27 16:04:08 martin Exp $ */
+/* $OpenBSD: pmap_bootstrap.c,v 1.21 2005/11/24 22:43:19 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -69,20 +69,20 @@
#include <uvm/uvm_extern.h>
-char *iiomapbase;
+vaddr_t iiomapbase;
int iiomapsize;
#define ETHERPAGES 16
void *etherbuf;
int etherlen;
-extern char *extiobase;
+extern vaddr_t extiobase;
extern int maxmem;
#define RELOC(v, t) *((t*)((u_int)&(v) + firstpa))
#define PA2VA(v, t) *((t*)((u_int)&(v)))
-#define MACHINE_IIOMAPSIZE RELOC(iiomapsize, int)
-#define MACHINE_INTIOBASE RELOC(iiomapbase, int)
+#define MACHINE_IIOMAPSIZE RELOC(iiomapsize, vaddr_t)
+#define MACHINE_INTIOBASE RELOC(iiomapbase, vaddr_t)
#define MACHINE_EIOMAPSIZE EIOMAPSIZE
#define PMAP_MD_LOCALS /* nothing */
@@ -95,7 +95,7 @@ do { \
#define PMAP_MD_MAPIOSPACE() \
do { \
- pte = &((u_int *)kptpa)[atop(etherbuf)]; \
+ pte = &((u_int *)kptpa)[atop((vaddr_t)etherbuf)]; \
epte = pte + ETHERPAGES; \
while (pte < epte) { \
*pte = (*pte & ~PG_CMASK) | PG_CIS | PG_U; \
@@ -113,9 +113,9 @@ do { \
*/
#define PMAP_MD_RELOC2() \
do { \
- RELOC(intiobase, char *) = (char *)iiobase; \
- RELOC(intiolimit, char *) = (char *)eiobase; \
- RELOC(extiobase, char *) = (char *)eiobase; \
+ RELOC(intiobase, vaddr_t) = (vaddr_t)iiobase; \
+ RELOC(intiolimit, vaddr_t) = (vaddr_t)eiobase; \
+ RELOC(extiobase, vaddr_t) = (vaddr_t)eiobase; \
} while (0)
#define PMAP_MD_MEMSIZE() \
@@ -137,8 +137,8 @@ pmap_init_md()
* mark as unavailable the regions which we have mapped in
* pmap_bootstrap().
*/
- addr = (vaddr_t) intiobase;
- if (uvm_map(kernel_map, &addr, ptoa(iiomapsize+EIOMAPSIZE),
+ addr = intiobase;
+ if (uvm_map(kernel_map, &addr, ptoa(iiomapsize + EIOMAPSIZE),
NULL, UVM_UNKNOWN_OFFSET, 0,
UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE,
UVM_INH_NONE, UVM_ADV_RANDOM, UVM_FLAG_FIXED)))