the btoc/ctob/btop macros must use CLBYTES, not NBPG. How this should

work in the long run is an open issue; some parts must be reworked
in a MI way.
This commit is contained in:
ragge 1998-11-29 14:48:51 +00:00
parent c738e45cd6
commit f07a586dc6
13 changed files with 44 additions and 40 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kdb.c,v 1.12 1998/03/02 17:03:12 ragge Exp $ */
/* $NetBSD: kdb.c,v 1.13 1998/11/29 14:48:51 ragge Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
* All rights reserved.
@ -190,7 +190,7 @@ kdbgo(usc, bp)
caddr_t addr;
o = (int)bp->b_un.b_addr & PGOFSET;
npf = btoc(bp->b_bcount + o) + 1;
npf = vax_btoc(bp->b_bcount + o) + 1;
addr = bp->b_un.b_addr;
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_de.c,v 1.34 1998/11/05 19:48:46 ragge Exp $ */
/* $NetBSD: if_de.c,v 1.35 1998/11/29 14:48:52 ragge Exp $ */
/*
* Copyright (c) 1982, 1986, 1989 Regents of the University of California.
@ -276,7 +276,7 @@ deinit(ds)
return;
if ((ifp->if_flags & IFF_RUNNING) == 0) {
if (if_ubaminit(&ds->ds_deuba, (void *)ds->ds_dev.dv_parent,
sizeof (struct ether_header), (int)btoc(ETHERMTU),
sizeof (struct ether_header), (int)vax_btoc(ETHERMTU),
ds->ds_ifr, NRCV, ds->ds_ifw, NXMT) == 0) {
printf("%s: can't initialize\n", ds->ds_dev.dv_xname);
ds->ds_if.if_flags &= ~IFF_UP;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_qe.c,v 1.32 1998/11/05 19:48:46 ragge Exp $ */
/* $NetBSD: if_qe.c,v 1.33 1998/11/29 14:48:52 ragge Exp $ */
/*
* Copyright (c) 1988 Regents of the University of California.
@ -479,7 +479,7 @@ qeinit(sc)
* init buffers and maps
*/
if (if_ubaminit(&sc->qe_uba, (void *)sc->qe_dev.dv_parent,
sizeof (struct ether_header), (int)btoc(MAXPACKETSIZE),
sizeof (struct ether_header), (int)vax_btoc(MAXPACKETSIZE),
sc->qe_ifr, NRCV, sc->qe_ifw, NXMT) == 0) {
fail:
printf("%s: can't allocate uba resources\n",

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_uba.c,v 1.13 1998/11/05 19:48:46 ragge Exp $ */
/* $NetBSD: if_uba.c,v 1.14 1998/11/29 14:48:52 ragge Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@ -237,7 +237,7 @@ if_ubaget(ifu, ifr, totlen, ifp)
pp = mtod(m, char *);
cpte = (struct pte *)kvtopte(cp);
ppte = (struct pte *)kvtopte(pp);
x = btop(cp - ifr->ifrw_addr);
x = vax_btop(cp - ifr->ifrw_addr);
ip = (int *)&ifr->ifrw_mr[x];
for (i = 0; i < MCLBYTES/NBPG; i++) {
struct pte t;
@ -352,7 +352,7 @@ if_ubaput(ifu, ifw, m)
int *ip;
pte = (struct pte *)kvtopte(dp);
x = btop(cp - ifw->ifw_addr);
x = vax_btop(cp - ifw->ifw_addr);
ip = (int *)&ifw->ifw_mr[x];
for (i = 0; i < MCLBYTES/NBPG; i++)
*ip++ = ifw->ifw_proto | pte++->pg_pfn;

View File

@ -1,4 +1,4 @@
/* $NetBSD: param.h,v 1.32 1998/08/25 17:35:23 ragge Exp $ */
/* $NetBSD: param.h,v 1.33 1998/11/29 14:48:51 ragge Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@ -135,18 +135,21 @@
*/
/* pages ("clicks") to disk blocks */
#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT))
#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT))
#define ctod(x) ((x) << (CLSHIFT - DEV_BSHIFT))
#define dtoc(x) ((x) >> (CLSHIFT - DEV_BSHIFT))
/* clicks to bytes */
#define ctob(x) ((x) << PGSHIFT)
#define btoc(x) (((unsigned)(x) + PGOFSET) >> PGSHIFT)
#define btop(x) (((unsigned)(x)) >> PGSHIFT)
#define ctob(x) ((x) << CLSHIFT)
#define btoc(x) (((unsigned)(x) + CLOFSET) >> CLSHIFT)
#define btop(x) (((unsigned)(x)) >> CLSHIFT)
/* bytes to disk blocks */
#define btodb(x) ((x) >> DEV_BSHIFT)
#define dbtob(x) ((x) << DEV_BSHIFT)
#define vax_btoc(x) (((unsigned)(x) + PGOFSET) >> PGSHIFT)
#define vax_btop(x) (((unsigned)(x)) >> PGSHIFT)
/*
* Map a ``block device block'' to a file system block.
* This should be device dependent, and will be if we
@ -156,6 +159,8 @@
#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
#ifdef _KERNEL
#ifndef lint
#define splx(reg) \
({ \
register int val; \
@ -164,7 +169,7 @@
: "g" (reg)); \
val; \
})
#endif
#define spl0() splx(0) /* IPL0 */
#define splsoftclock() splx(8) /* IPL08 */
@ -189,7 +194,6 @@
#define vunmapbuf(p,q)
#endif
#ifdef _KERNEL
/* Prototype needed for delay() */
#ifndef _LOCORE
void delay __P((int));

View File

@ -1,4 +1,4 @@
/* $NetBSD: qd.c,v 1.9 1998/11/05 19:48:04 ragge Exp $ */
/* $NetBSD: qd.c,v 1.10 1998/11/29 14:48:52 ragge Exp $ */
/*-
* Copyright (c) 1988 Regents of the University of California.
@ -910,21 +910,21 @@ qdclose(dev, flag, mode, p)
*/
mapix = VTOP((int)qd->template) - VTOP(qvmem[0]);
ptep = (int *)(QVmap[0] + mapix);
for (i = 0; i < btop(TMPSIZE); i++, ptep++)
for (i = 0; i < vax_btop(TMPSIZE); i++, ptep++)
*ptep = (*ptep & ~PG_PROT) | PG_V | PG_KW;
/*
* ADDER
*/
mapix = VTOP((int)qd->adder) - VTOP(qvmem[0]);
ptep = (int *)(QVmap[0] + mapix);
for (i = 0; i < btop(REGSIZE); i++, ptep++)
for (i = 0; i < vax_btop(REGSIZE); i++, ptep++)
*ptep = (*ptep & ~PG_PROT) | PG_V | PG_KW;
/*
* COLOR MAPS
*/
mapix = VTOP((int)qd->red) - VTOP(qvmem[0]);
ptep = (int *)(QVmap[0] + mapix);
for (i = 0; i < btop(CLRSIZE); i++, ptep++)
for (i = 0; i < vax_btop(CLRSIZE); i++, ptep++)
*ptep = (*ptep & ~PG_PROT) | PG_V | PG_KW;
}
@ -949,7 +949,7 @@ qdclose(dev, flag, mode, p)
}
ptep = (int *)
((VTOP(DMAheader[unit]*4)) + (mfpr(PR_SBR)|0x80000000));
for (i = 0; i < btop(DMAbuf_size); i++, ptep++)
for (i = 0; i < vax_btop(DMAbuf_size); i++, ptep++)
*ptep = (*ptep & ~PG_PROT) | PG_V | PG_KW;
ubarelse(uh, &Qbus_unmap[unit]);
}
@ -1194,7 +1194,7 @@ qdioctl(dev, cmd, datap, flags, p)
*/
mapix = VTOP((int)qd->template) - VTOP(qvmem[0]);
ptep = (int *)(QVmap[0] + mapix);
for (i = 0; i < btop(TMPSIZE); i++, ptep++)
for (i = 0; i < vax_btop(TMPSIZE); i++, ptep++)
*ptep = (*ptep & ~PG_PROT) | PG_RW | PG_V;
/*
@ -1202,7 +1202,7 @@ qdioctl(dev, cmd, datap, flags, p)
*/
mapix = VTOP((int)qd->adder) - VTOP(qvmem[0]);
ptep = (int *)(QVmap[0] + mapix);
for (i = 0; i < btop(REGSIZE); i++, ptep++)
for (i = 0; i < vax_btop(REGSIZE); i++, ptep++)
*ptep = (*ptep & ~PG_PROT) | PG_RW | PG_V;
/*
@ -1210,7 +1210,7 @@ qdioctl(dev, cmd, datap, flags, p)
*/
mapix = VTOP((int)qd->red) - VTOP(qvmem[0]);
ptep = (int *)(QVmap[0] + mapix);
for (i = 0; i < btop(CLRSIZE); i++, ptep++)
for (i = 0; i < vax_btop(CLRSIZE); i++, ptep++)
*ptep = (*ptep & ~PG_PROT) | PG_RW | PG_V;
/*
@ -1238,7 +1238,7 @@ qdioctl(dev, cmd, datap, flags, p)
qdflags[unit].mapped |= MAPDMA;
ptep = (int *) ((VTOP(DMAheader[unit]) * 4)
+ (mfpr(PR_SBR) | 0x80000000));
for (i = 0; i < btop(DMAbuf_size); i++, ptep++)
for (i = 0; i < vax_btop(DMAbuf_size); i++, ptep++)
*ptep = (*ptep & ~PG_PROT) | PG_RW | PG_V;
mtpr(0, PR_TBIA); /* invalidate translation buffer */
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: uba.c,v 1.37 1998/11/05 19:48:04 ragge Exp $ */
/* $NetBSD: uba.c,v 1.38 1998/11/29 14:48:53 ragge Exp $ */
/*
* Copyright (c) 1996 Jonathan Stone.
* Copyright (c) 1994, 1996 Ludd, University of Lule}, Sweden.
@ -596,7 +596,7 @@ ubasetup(uh, bp, flags)
flags &= ~UBA_NEEDBDP;
o = (int)bp->b_un.b_addr & PGOFSET;
npf = btoc(bp->b_bcount + o) + 1;
npf = vax_btoc(bp->b_bcount + o) + 1;
if (npf > UBA_MAXNMR)
panic("uba xfer too big");
a = spluba();

View File

@ -1,4 +1,4 @@
/* $NetBSD: disksubr.c,v 1.17 1998/11/05 19:46:18 ragge Exp $ */
/* $NetBSD: disksubr.c,v 1.18 1998/11/29 14:48:53 ragge Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@ -264,7 +264,7 @@ disk_reallymapin(bp, map, reg, flag)
caddr_t addr;
o = (int)bp->b_un.b_addr & PGOFSET;
npf = btoc(bp->b_bcount + o) + 1;
npf = vax_btoc(bp->b_bcount + o) + 1;
addr = bp->b_un.b_addr;
p = bp->b_proc;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ka650.c,v 1.13 1998/05/22 09:26:33 ragge Exp $ */
/* $NetBSD: ka650.c,v 1.14 1998/11/29 14:48:53 ragge Exp $ */
/*
* Copyright (c) 1988 The Regents of the University of California.
* All rights reserved.
@ -119,7 +119,7 @@ uvaxIII_steal_pages()
* interprocessor registers and cache diag space.
*/
MAPPHYS(junk, 2, VM_PROT_READ|VM_PROT_WRITE); /* SCB & vectors */
MAPVIRT(nexus, btoc(0x400000)); /* Qbus map registers */
MAPVIRT(nexus, vax_btoc(0x400000)); /* Qbus map registers */
pmap_map((vm_offset_t)nexus, 0x20088000, 0x20090000,
VM_PROT_READ|VM_PROT_WRITE);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ka750.c,v 1.24 1998/05/22 09:26:33 ragge Exp $ */
/* $NetBSD: ka750.c,v 1.25 1998/11/29 14:48:53 ragge Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 The Regents of the University of California.
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@ -271,7 +271,7 @@ ka750_steal_pages()
* We also set up virtual area for SBI.
*/
MAPPHYS(junk, V750PGS, VM_PROT_READ|VM_PROT_WRITE);
MAPVIRT(nexus, btoc(NEX750SZ));
MAPVIRT(nexus, vax_btoc(NEX750SZ));
pmap_map((vm_offset_t)nexus, NEX750, NEX750 + NEX750SZ,
VM_PROT_READ|VM_PROT_WRITE);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ka780.c,v 1.9 1998/05/22 09:26:33 ragge Exp $ */
/* $NetBSD: ka780.c,v 1.10 1998/11/29 14:48:53 ragge Exp $ */
/*-
* Copyright (c) 1982, 1986, 1988 The Regents of the University of California.
* All rights reserved.
@ -342,7 +342,7 @@ ka780_steal_pages()
int junk;
MAPPHYS(junk, 4, VM_PROT_READ|VM_PROT_WRITE);
MAPVIRT(nexus, btoc(8192*16));
MAPVIRT(nexus, vax_btoc(8192*16));
pmap_map((vm_offset_t)nexus, 0x20000000, 0x20020000,
VM_PROT_READ|VM_PROT_WRITE);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ka860.c,v 1.10 1998/05/22 09:26:33 ragge Exp $ */
/* $NetBSD: ka860.c,v 1.11 1998/11/29 14:48:53 ragge Exp $ */
/*
* Copyright (c) 1986, 1988 Regents of the University of California.
* All rights reserved.
@ -293,7 +293,7 @@ ka86_steal_pages()
(u_int)IOA8600(3) + IOAMAPSIZ, VM_PROT_READ|VM_PROT_WRITE);
/* Map in possible nexus space */
MAPVIRT(nexus, btoc(NEXSIZE * MAXNNEXUS));
MAPVIRT(nexus, vax_btoc(NEXSIZE * MAXNNEXUS));
pmap_map((vm_offset_t)nexus, (u_int)NEXA8600,
(u_int)NEXA8600 + NNEX8600 * NEXSIZE, VM_PROT_READ|VM_PROT_WRITE);
pmap_map((vm_offset_t)&nexus[NNEXSBI], (u_int)NEXB8600,

View File

@ -1,4 +1,4 @@
/* $NetBSD: uba.c,v 1.37 1998/11/05 19:48:04 ragge Exp $ */
/* $NetBSD: uba.c,v 1.38 1998/11/29 14:48:53 ragge Exp $ */
/*
* Copyright (c) 1996 Jonathan Stone.
* Copyright (c) 1994, 1996 Ludd, University of Lule}, Sweden.
@ -596,7 +596,7 @@ ubasetup(uh, bp, flags)
flags &= ~UBA_NEEDBDP;
o = (int)bp->b_un.b_addr & PGOFSET;
npf = btoc(bp->b_bcount + o) + 1;
npf = vax_btoc(bp->b_bcount + o) + 1;
if (npf > UBA_MAXNMR)
panic("uba xfer too big");
a = spluba();