Use PAGE_SIZE rather than NBPG.

This commit is contained in:
thorpej 2003-04-02 02:19:29 +00:00
parent 295e297794
commit 9f7d0893c1
13 changed files with 88 additions and 83 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_le.c,v 1.27 2002/10/02 05:28:13 thorpej Exp $ */
/* $NetBSD: if_le.c,v 1.28 2003/04/02 02:19:29 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -84,6 +84,8 @@
#include <sys/socket.h>
#include <sys/device.h>
#include <uvm/uvm_extern.h>
#include <net/if.h>
#include <net/if_ether.h>
#include <net/if_media.h>
@ -193,7 +195,7 @@ le_pcc_attach(parent, self, aux)
bus_space_map(pa->pa_bust, pa->pa_offset, 4, 0, &lsc->sc_bush);
/* Get contiguous DMA-able memory for the lance */
if (bus_dmamem_alloc(pa->pa_dmat, ether_data_buff_size, NBPG, 0,
if (bus_dmamem_alloc(pa->pa_dmat, ether_data_buff_size, PAGE_SIZE, 0,
&seg, 1, &rseg,
BUS_DMA_NOWAIT | BUS_DMA_ONBOARD_RAM | BUS_DMA_24BIT)) {
printf("%s: Failed to allocate ether buffer\n", self->dv_xname);

View File

@ -1,4 +1,4 @@
/* $NetBSD: sbic.c,v 1.19 2002/10/20 02:37:29 chs Exp $ */
/* $NetBSD: sbic.c,v 1.20 2003/04/02 02:19:29 thorpej Exp $ */
/*
* Changes Copyright (c) 1996 Steve Woodford
@ -314,10 +314,10 @@ sbic_load_ptrs(dev)
vaddr = acb->sc_kv.dc_addr;
paddr = acb->sc_pa.dc_addr = (char *) kvtop((caddr_t)vaddr);
for (count = (NBPG - ((int)vaddr & PGOFSET));
for (count = (PAGE_SIZE - ((int)vaddr & PGOFSET));
count < acb->sc_kv.dc_count &&
(char*)kvtop((caddr_t)(vaddr + count + 4)) == paddr + count + 4;
count += NBPG)
count += PAGE_SIZE)
; /* Do nothing */
/*
@ -2546,7 +2546,7 @@ sbiccheckdmap(bp, len, mask)
while ( len ) {
phy_buf = kvtop((caddr_t)buffer);
phy_len = NBPG - ((int) buffer & PGOFSET);
phy_len = PAGE_SIZE - ((int) buffer & PGOFSET);
if ( len < phy_len )
phy_len = len;

View File

@ -1,4 +1,4 @@
/* $NetBSD: bus_dma.c,v 1.20 2002/06/02 14:44:37 drochner Exp $ */
/* $NetBSD: bus_dma.c,v 1.21 2003/04/02 02:19:29 thorpej Exp $ */
/*
* This file was taken from from next68k/dev/bus_dma.c, which was originally
@ -46,7 +46,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.20 2002/06/02 14:44:37 drochner Exp $");
__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.21 2003/04/02 02:19:29 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -183,7 +183,7 @@ _bus_dmamap_load_buffer_direct_common(t, map, buf, buflen, p, flags,
/*
* Compute the segment size, and adjust counts.
*/
sgsize = NBPG - ((u_long)vaddr & PGOFSET);
sgsize = PAGE_SIZE - ((u_long)vaddr & PGOFSET);
if (buflen < sgsize)
sgsize = buflen;
@ -513,15 +513,15 @@ _bus_dmamap_sync_0460(t, map, offset, len, ops)
e = (pe + 15) & ~0xf;
/* flush cache line (060 too) */
while((p < e) && (p % NBPG)) {
while((p < e) && (p % PAGE_SIZE)) {
DCFL_40(p);
p += 16;
}
/* flush page (060 too) */
while((p + NBPG) <= e) {
while((p + PAGE_SIZE) <= e) {
DCFP_40(p);
p += NBPG;
p += PAGE_SIZE;
}
/* flush cache line (060 too) */
@ -553,17 +553,17 @@ _bus_dmamap_sync_0460(t, map, offset, len, ops)
e = pe & ~0xf;
/* purge cache line */
while((p < e) && (p % NBPG)) {
while((p < e) && (p % PAGE_SIZE)) {
DCPL_40(p);
ICPL_40(p);
p += 16;
}
/* purge page */
while((p + NBPG) <= e) {
while((p + PAGE_SIZE) <= e) {
DCPP_40(p);
ICPP_40(p);
p += NBPG;
p += PAGE_SIZE;
}
/* purge cache line */
@ -762,7 +762,7 @@ _bus_dmamem_map(t, segs, nsegs, size, kvap, flags)
for (curseg = 0; curseg < nsegs; curseg++) {
for (addr = segs[curseg]._ds_cpuaddr;
addr < (segs[curseg]._ds_cpuaddr + segs[curseg].ds_len);
addr += NBPG, va += NBPG, size -= NBPG) {
addr += PAGE_SIZE, va += PAGE_SIZE, size -= PAGE_SIZE) {
if (size == 0)
panic("_bus_dmamem_map: size botch");

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.96 2003/01/17 23:42:05 thorpej Exp $ */
/* $NetBSD: machdep.c,v 1.97 2003/04/02 02:19:30 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -137,7 +137,7 @@ int safepri = PSL_LOWIPL;
#ifndef ETHER_DATA_BUFF_PAGES
#define ETHER_DATA_BUFF_PAGES 4
#endif
u_long ether_data_buff_size = ETHER_DATA_BUFF_PAGES * NBPG;
u_long ether_data_buff_size = ETHER_DATA_BUFF_PAGES * PAGE_SIZE;
u_char mvme_ea[6];
extern u_int lowram;
@ -276,8 +276,8 @@ mvme68k_init()
* 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());
@ -509,7 +509,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);
@ -548,7 +548,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);
/*
@ -859,7 +859,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;
/*
@ -972,7 +972,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.
@ -1079,8 +1079,8 @@ dumpsys()
/* Limit size for next transfer. */
n = bytes - i;
if (n > NBPG)
n = NBPG;
if (n > PAGE_SIZE)
n = PAGE_SIZE;
pmap_enter(pmap_kernel(), (vaddr_t)vmmap, maddr,
VM_PROT_READ, VM_PROT_READ|PMAP_WIRED);
@ -1152,7 +1152,7 @@ initcpu()
* VAC machines as it loses big time.
*/
if (mappedcopysize == 0) {
mappedcopysize = NBPG;
mappedcopysize = PAGE_SIZE;
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: mem.c,v 1.20 2002/10/23 09:11:39 jdolecek Exp $ */
/* $NetBSD: mem.c,v 1.21 2003/04/02 02:19:30 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -119,10 +119,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;
@ -156,7 +156,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.18 2002/11/05 07:41:33 chs Exp $ */
/* $NetBSD: pmap_bootstrap.c,v 1.19 2003/04/02 02:19:30 thorpej Exp $ */
/*
* Copyright (c) 1991, 1993
@ -139,16 +139,16 @@ pmap_bootstrap(nextpa, firstpa)
#endif
kstsize = 1;
kstpa = nextpa;
nextpa += kstsize * NBPG;
nextpa += kstsize * PAGE_SIZE;
kptpa = nextpa;
nptpages = RELOC(Sysptsize, int) +
(iiomappages + NPTEPG - 1) / NPTEPG;
nextpa += nptpages * NBPG;
nextpa += nptpages * PAGE_SIZE;
iiopa = nextpa - iiomappages * sizeof(pt_entry_t);
kptmpa = nextpa;
nextpa += NBPG;
nextpa += PAGE_SIZE;
lkptpa = nextpa;
nextpa += NBPG;
nextpa += PAGE_SIZE;
p0upa = nextpa;
nextpa += USPACE;
@ -252,7 +252,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.
@ -278,8 +278,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.
@ -322,7 +322,7 @@ pmap_bootstrap(nextpa, firstpa)
protopte = firstpa | 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
@ -338,7 +338,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
@ -353,7 +353,7 @@ pmap_bootstrap(nextpa, firstpa)
}
while (pte < epte) {
*pte++ = protopte;
protopte += NBPG;
protopte += PAGE_SIZE;
}
/*
* Finally, validate the internal IO space PTEs (RW+CI).
@ -363,7 +363,7 @@ pmap_bootstrap(nextpa, firstpa)
protopte = RELOC(intiobase_phys, u_int) | PG_RW | PG_CI | PG_U | PG_V;
while (pte < epte) {
*pte++ = protopte;
protopte += NBPG;
protopte += PAGE_SIZE;
}
/*
@ -553,11 +553,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.64 2003/01/28 22:35:11 wiz Exp $ */
/* $NetBSD: trap.c,v 1.65 2003/04/02 02:19:30 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -790,7 +790,7 @@ writeback(fp, docachepush)
(void) pmap_extract(pmap_kernel(), (vaddr_t)fa, &pa);
DCFL_40(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",

View File

@ -1,4 +1,4 @@
/* $NetBSD: aic.c,v 1.8 1997/08/27 11:24:03 bouyer Exp $ */
/* $NetBSD: aic.c,v 1.9 2003/04/02 02:24:14 thorpej Exp $ */
/* Written by Phil Nelson for the pc532. Used source with the following
* copyrights as a model.
@ -59,6 +59,9 @@
#include <sys/user.h>
#include <sys/dkbad.h>
#include <sys/disklabel.h>
#include <uvm/uvm_extern.h>
#include <dev/scsipi/scsi_all.h>
#include <dev/scsipi/scsipi_all.h>
#include <dev/scsipi/scsiconf.h>
@ -110,8 +113,8 @@ int aicattach(struct pc532_device *dvp)
void aicminphys(struct buf *bp)
{
if(bp->b_bcount > ((AIC_NSEG - 1) * NBPG))
bp->b_bcount = ((AIC_NSEG - 1) * NBPG);
if(bp->b_bcount > ((AIC_NSEG - 1) * PAGE_SIZE))
bp->b_bcount = ((AIC_NSEG - 1) * PAGE_SIZE);
minphys(bp);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ieee_handler.c,v 1.13 2002/05/26 07:37:08 simonb Exp $ */
/* $NetBSD: ieee_handler.c,v 1.14 2003/04/02 02:24:15 thorpej Exp $ */
/*
* IEEE floating point support for NS32081 and NS32381 fpus.
@ -83,7 +83,7 @@
#ifdef MACH
/* Mach only defines this if KERNEL, NetBSD defines it always */
# define ns532_round_page(addr) (((addr) + NBPG - 1) & ~(NBPG - 1))
# define ns532_round_page(addr) (((addr) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: kgdb_machdep.c,v 1.8 2000/06/29 07:51:46 mrg Exp $ */
/* $NetBSD: kgdb_machdep.c,v 1.9 2003/04/02 02:24:15 thorpej Exp $ */
/*
* Copyright (c) 1996 Matthias Pfaller.
@ -61,7 +61,7 @@ kgdb_acc(va, len)
pte = kvtopte(va);
if ((*pte & PG_V) == 0)
return (0);
va += NBPG;
va += PAGE_SIZE;
} while (va < last_va);
return (1);

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.136 2003/01/21 20:50:43 kleink Exp $ */
/* $NetBSD: machdep.c,v 1.137 2003/04/02 02:24:16 thorpej Exp $ */
/*-
* Copyright (c) 1996 Matthias Pfaller.
@ -163,8 +163,8 @@ cpu_startup()
/* msgbuf_paddr was init'd in pmap */
for (i = 0; i < btoc(MSGBUFSIZE); i++)
pmap_kenter_pa(msgbuf_vaddr + i * NBPG,
msgbuf_paddr + i * NBPG, VM_PROT_READ | VM_PROT_WRITE);
pmap_kenter_pa(msgbuf_vaddr + i * PAGE_SIZE,
msgbuf_paddr + i * PAGE_SIZE, VM_PROT_READ | VM_PROT_WRITE);
pmap_update(pmap_kernel());
initmsgbuf((caddr_t)msgbuf_vaddr, round_page(MSGBUFSIZE));
@ -212,7 +212,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);
@ -258,7 +258,7 @@ cpu_startup()
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);
/*
@ -702,7 +702,7 @@ cpu_dump()
/*
* 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.
@ -748,7 +748,7 @@ bad:
/*
* Dump the kernel's image to the swap partition.
*/
#define BYTES_PER_DUMP NBPG /* must be a multiple of pagesize XXX small */
#define BYTES_PER_DUMP PAGE_SIZE /* must be a multiple of pagesize XXX small */
static vaddr_t dumpspace;
vaddr_t
@ -896,8 +896,8 @@ alloc_pages(pages)
int pages;
{
paddr_t p = avail_start;
avail_start += pages * NBPG;
memset((caddr_t) p, 0, pages * NBPG);
avail_start += pages * PAGE_SIZE;
memset((caddr_t) p, 0, pages * PAGE_SIZE);
return(p);
}
@ -924,10 +924,10 @@ map(pd, virtual, physical, protection, size)
}
if (physical != (paddr_t) -1) {
pt[ix2] = (pt_entry_t) (physical | protection | PG_V);
physical += NBPG;
size -= NBPG;
physical += PAGE_SIZE;
size -= PAGE_SIZE;
} else {
size -= (PTES_PER_PTP - ix2) * NBPG;
size -= (PTES_PER_PTP - ix2) * PAGE_SIZE;
ix2 = PTES_PER_PTP - 1;
}
if (++ix2 == PTES_PER_PTP) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: mem.c,v 1.33 2002/11/21 00:22:10 simonb Exp $ */
/* $NetBSD: mem.c,v 1.34 2003/04/02 02:24:16 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -113,10 +113,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());
break;
@ -141,10 +141,10 @@ mmrw(dev, uio, flags)
}
if (zeropage == NULL) {
zeropage = (caddr_t)
malloc(NBPG, M_TEMP, M_WAITOK);
memset(zeropage, 0, NBPG);
malloc(PAGE_SIZE, M_TEMP, M_WAITOK);
memset(zeropage, 0, PAGE_SIZE);
}
c = min(iov->iov_len, NBPG);
c = min(iov->iov_len, PAGE_SIZE);
error = uiomove(zeropage, c, uio);
break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.53 2002/09/22 05:41:27 gmcgarry Exp $ */
/* $NetBSD: vm_machdep.c,v 1.54 2003/04/02 02:24:16 thorpej Exp $ */
/*-
* Copyright (c) 1996 Matthias Pfaller.
@ -265,7 +265,7 @@ setredzone(pte, vaddr)
/*
* Move pages from one kernel virtual address to another.
* Both addresses are assumed to reside in the Sysmap,
* and size must be a multiple of NBPG.
* and size must be a multiple of PAGE_SIZE.
*/
void
pagemove(from, to, size)
@ -274,12 +274,12 @@ pagemove(from, to, size)
{
register pt_entry_t *fpte, *tpte, ofpte, otpte;
if (size % NBPG)
if (size % PAGE_SIZE)
panic("pagemove");
fpte = kvtopte((vaddr_t)from);
tpte = kvtopte((vaddr_t)to);
if (size <= NBPG * 16) {
if (size <= PAGE_SIZE * 16) {
while (size > 0) {
otpte = *tpte;
ofpte = *fpte;
@ -289,17 +289,17 @@ pagemove(from, to, size)
tlbflush_entry((vaddr_t) to);
if (ofpte & PG_V)
tlbflush_entry((vaddr_t) from);
from += NBPG;
to += NBPG;
size -= NBPG;
from += PAGE_SIZE;
to += PAGE_SIZE;
size -= PAGE_SIZE;
}
} else {
while (size > 0) {
*tpte++ = *fpte;
*fpte++ = 0;
from += NBPG;
to += NBPG;
size -= NBPG;
from += PAGE_SIZE;
to += PAGE_SIZE;
size -= PAGE_SIZE;
}
tlbflush();
}