Use PAGE_SIZE rather than NBPG.

This commit is contained in:
thorpej 2003-04-02 02:34:12 +00:00
parent 9f7d0893c1
commit 30c52ef9c3
5 changed files with 43 additions and 40 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: esp.c,v 1.42 2002/10/02 04:22:52 thorpej Exp $ */
/* $NetBSD: esp.c,v 1.43 2003/04/02 02:34:12 thorpej Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -93,6 +93,8 @@
#include <sys/user.h>
#include <sys/queue.h>
#include <uvm/uvm_extern.h>
#include <dev/scsipi/scsi_all.h>
#include <dev/scsipi/scsipi_all.h>
#include <dev/scsipi/scsiconf.h>
@ -249,7 +251,8 @@ findchannel_defer(self)
nextdma_setconf (esc->sc_dma, cb_arg, sc);
error = bus_dmamap_create(esc->sc_dma->sc_dmat,
sc->sc_maxxfer, sc->sc_maxxfer/NBPG+1, sc->sc_maxxfer,
sc->sc_maxxfer,
sc->sc_maxxfer/PAGE_SIZE+1, sc->sc_maxxfer,
0, BUS_DMA_ALLOCNOW, &esc->sc_main_dmamap);
if (error) {
panic("%s: can't create main i/o DMA map, error = %d",

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.55 2003/01/18 06:09:55 thorpej Exp $ */
/* $NetBSD: machdep.c,v 1.56 2003/04/02 02:34:13 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -227,8 +227,8 @@ next68k_init(void)
* Initialize error message buffer (at end of core).
*/
for (i = 0; i < btoc(round_page(MSGBUFSIZE)); i++)
pmap_enter(pmap_kernel(), (vaddr_t)msgbufaddr + i * NBPG,
msgbufpa + i * NBPG, VM_PROT_READ|VM_PROT_WRITE,
pmap_enter(pmap_kernel(), (vaddr_t)msgbufaddr + i * PAGE_SIZE,
msgbufpa + i * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE,
VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED);
initmsgbuf(msgbufaddr, round_page(MSGBUFSIZE));
pmap_update(pmap_kernel());
@ -345,7 +345,7 @@ cpu_startup()
* "base" pages for the rest.
*/
curbuf = (vaddr_t) buffers + (i * MAXBSIZE);
curbufsize = NBPG * ((i < residual) ? (base+1) : base);
curbufsize = PAGE_SIZE * ((i < residual) ? (base+1) : base);
while (curbufsize) {
pg = uvm_pagealloc(NULL, 0, NULL, 0);
@ -384,7 +384,7 @@ cpu_startup()
#endif
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
printf("avail memory = %s\n", pbuf);
format_bytes(pbuf, sizeof(pbuf), bufpages * NBPG);
format_bytes(pbuf, sizeof(pbuf), bufpages * PAGE_SIZE);
printf("using %u buffers containing %s of memory\n", nbuf, pbuf);
/*
@ -672,7 +672,7 @@ cpu_init_kcore_hdr()
* Initialize the `dispatcher' portion of the header.
*/
strcpy(h->name, machine);
h->page_size = NBPG;
h->page_size = PAGE_SIZE;
h->kernbase = KERNBASE;
/*
@ -768,7 +768,7 @@ long dumplo = 0; /* blocks */
/*
* This is called by main to set dumplo and dumpsize.
* Dumps always skip the first NBPG of disk space
* Dumps always skip the first PAGE_SIZE of disk space
* in case there might be a disk label stored there.
* If there is extra space, put dump at the end to
* reduce the chance that swapping trashes it.
@ -794,7 +794,7 @@ cpu_dumpconf()
/*
* Check do see if we will fit. Note we always skip the
* first NBPG in case there is a disk label there.
* first PAGE_SIZE in case there is a disk label there.
*/
if (nblks < (ctod(dumpsize) + chdrsize + ctod(1))) {
dumpsize = 0;
@ -855,7 +855,7 @@ dumpsys()
goto bad;
for (pg = 0; pg < dumpsize; pg++) {
#define NPGMB (1024*1024/NBPG)
#define NPGMB (1024*1024/PAGE_SIZE)
/* print out how many MBs we have dumped */
if (pg && (pg % NPGMB) == 0)
printf("%d ", pg / NPGMB);
@ -864,12 +864,12 @@ dumpsys()
VM_PROT_READ, VM_PROT_READ|PMAP_WIRED);
pmap_update(pmap_kernel());
error = (*dump)(dumpdev, blkno, vmmap, NBPG);
error = (*dump)(dumpdev, blkno, vmmap, PAGE_SIZE);
bad:
switch (error) {
case 0:
maddr += NBPG;
blkno += btodb(NBPG);
maddr += PAGE_SIZE;
blkno += btodb(PAGE_SIZE);
break;
case ENXIO:
@ -912,7 +912,7 @@ initcpu()
if (ectype == EC_VIRT)
mappedcopysize = -1; /* in case it was patched */
else
mappedcopysize = NBPG;
mappedcopysize = PAGE_SIZE;
#endif
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: mem.c,v 1.18 2002/10/23 09:11:42 jdolecek Exp $ */
/* $NetBSD: mem.c,v 1.19 2003/04/02 02:34:13 thorpej Exp $ */
/*
* This file was taken from mvme68k/mvme68k/mem.c
@ -125,10 +125,10 @@ mmrw(dev, uio, flags)
trunc_page(v), prot, prot|PMAP_WIRED);
pmap_update(pmap_kernel());
o = uio->uio_offset & PGOFSET;
c = min(uio->uio_resid, (int)(NBPG - o));
c = min(uio->uio_resid, (int)(PAGE_SIZE - o));
error = uiomove((caddr_t)vmmap + o, c, uio);
pmap_remove(pmap_kernel(), (vaddr_t)vmmap,
(vaddr_t)vmmap + NBPG);
(vaddr_t)vmmap + PAGE_SIZE);
pmap_update(pmap_kernel());
continue;
@ -162,7 +162,7 @@ mmrw(dev, uio, flags)
extern caddr_t Segtabzero;
devzeropage = Segtabzero;
}
c = min(iov->iov_len, NBPG);
c = min(iov->iov_len, PAGE_SIZE);
error = uiomove(devzeropage, c, uio);
continue;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap_bootstrap.c,v 1.11 2002/11/05 07:41:40 chs Exp $ */
/* $NetBSD: pmap_bootstrap.c,v 1.12 2003/04/02 02:34:13 thorpej Exp $ */
/*
* This file was taken from mvme68k/mvme68k/pmap_bootstrap.c
@ -166,11 +166,11 @@ pmap_bootstrap(nextpa, firstpa)
#endif
kstsize = 1;
kstpa = nextpa;
nextpa += kstsize * NBPG;
nextpa += kstsize * PAGE_SIZE;
kptpa = nextpa;
nptpages = RELOC(Sysptsize, int) +
(IIOMAPSIZE + MONOMAPSIZE + COLORMAPSIZE + NPTEPG - 1) / NPTEPG;
nextpa += nptpages * NBPG;
nextpa += nptpages * PAGE_SIZE;
eiiopa = nextpa; /* just a reference for later */
iiopa = nextpa - IIOMAPSIZE * sizeof(pt_entry_t);
@ -181,9 +181,9 @@ pmap_bootstrap(nextpa, firstpa)
colorpa = ecolorpa - COLORMAPSIZE * sizeof(pt_entry_t);
kptmpa = nextpa;
nextpa += NBPG;
nextpa += PAGE_SIZE;
lkptpa = nextpa;
nextpa += NBPG;
nextpa += PAGE_SIZE;
p0upa = nextpa;
nextpa += USPACE;
@ -287,7 +287,7 @@ pmap_bootstrap(nextpa, firstpa)
protopte = kptpa | PG_RW | PG_CI | PG_U | PG_V;
while (pte < epte) {
*pte++ = protopte;
protopte += NBPG;
protopte += PAGE_SIZE;
}
/*
* Invalidate all but the last remaining entry.
@ -317,8 +317,8 @@ pmap_bootstrap(nextpa, firstpa)
while (pte < epte) {
*ste++ = protoste;
*pte++ = protopte;
protoste += NBPG;
protopte += NBPG;
protoste += PAGE_SIZE;
protopte += PAGE_SIZE;
}
/*
* Invalidate all but the last remaining entries in both.
@ -360,12 +360,12 @@ pmap_bootstrap(nextpa, firstpa)
* Validate PTEs for kernel text (RO). The first page
* of kernel text remains invalid; see locore.s
*/
pte = &((u_int *)kptpa)[m68k_btop(KERNBASE + NBPG)];
pte = &((u_int *)kptpa)[m68k_btop(KERNBASE + PAGE_SIZE)];
epte = &pte[m68k_btop(m68k_trunc_page(&etext))];
protopte = (firstpa + NBPG) | PG_RO | PG_U | PG_V;
protopte = (firstpa + PAGE_SIZE) | PG_RO | PG_U | PG_V;
while (pte < epte) {
*pte++ = protopte;
protopte += NBPG;
protopte += PAGE_SIZE;
}
/*
* Validate PTEs for kernel data/bss, dynamic data allocated
@ -381,7 +381,7 @@ pmap_bootstrap(nextpa, firstpa)
protopte |= PG_CCB;
while (pte < epte) {
*pte++ = protopte;
protopte += NBPG;
protopte += PAGE_SIZE;
}
/*
* map the kernel segment table cache invalidated for
@ -396,7 +396,7 @@ pmap_bootstrap(nextpa, firstpa)
}
while (pte < epte) {
*pte++ = protopte;
protopte += NBPG;
protopte += PAGE_SIZE;
}
/*
* Finally, validate the internal IO space PTEs (RW+CI).
@ -410,7 +410,7 @@ pmap_bootstrap(nextpa, firstpa)
protopte = INTIOBASE | PG_RW | PG_CI | PG_U | PG_V;
while (pte < epte) {
*pte++ = protopte;
protopte += NBPG;
protopte += PAGE_SIZE;
}
/* validate the mono fb space PTEs */
@ -419,7 +419,7 @@ pmap_bootstrap(nextpa, firstpa)
protopte = MONOBASE | PG_RW | PG_CI | PG_U | PG_V;
while (pte < epte) {
*pte++ = protopte;
protopte += NBPG;
protopte += PAGE_SIZE;
}
/* validate the color fb space PTEs */
@ -428,7 +428,7 @@ pmap_bootstrap(nextpa, firstpa)
protopte = COLORBASE | PG_RW | PG_CI | PG_U | PG_V;
while (pte < epte) {
*pte++ = protopte;
protopte += NBPG;
protopte += PAGE_SIZE;
}
/*
@ -639,11 +639,11 @@ pmap_bootstrap(nextpa, firstpa)
vaddr_t va = RELOC(virtual_avail, vaddr_t);
RELOC(CADDR1, caddr_t) = (caddr_t)va;
va += NBPG;
va += PAGE_SIZE;
RELOC(CADDR2, caddr_t) = (caddr_t)va;
va += NBPG;
va += PAGE_SIZE;
RELOC(vmmap, caddr_t) = (caddr_t)va;
va += NBPG;
va += PAGE_SIZE;
RELOC(msgbufaddr, caddr_t) = (caddr_t)va;
va += m68k_round_page(MSGBUFSIZE);
RELOC(virtual_avail, vaddr_t) = va;

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.40 2003/01/28 22:35:13 wiz Exp $ */
/* $NetBSD: trap.c,v 1.41 2003/04/02 02:34:13 thorpej Exp $ */
/*
* This file was taken from mvme68k/mvme68k/trap.c
@ -779,7 +779,7 @@ writeback(fp, docachepush)
(void) pmap_extract(pmap_kernel(), (vaddr_t)fa, &pa);
DCFL(pa);
pmap_remove(pmap_kernel(), (vaddr_t)vmmap,
(vaddr_t)&vmmap[NBPG]);
(vaddr_t)&vmmap[PAGE_SIZE]);
pmap_update(pmap_kernel());
} else
printf("WARNING: pid %d(%s) uid %d: CPUSH not done\n",