Use PAGE_SIZE rather than NBPG.

This commit is contained in:
thorpej 2003-04-02 02:45:36 +00:00
parent 3c0e6f55e1
commit 86f35f803c
13 changed files with 108 additions and 101 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: bus_dma.c,v 1.1 2003/03/05 22:08:28 matt Exp $ */
/* $NetBSD: bus_dma.c,v 1.2 2003/04/02 02:47:18 thorpej Exp $ */
#define DEBUG 1
@ -244,7 +244,7 @@ _bus_dmamap_load_buffer(t, map, buf, buflen, p, flags, lastaddrp, segp, first)
/*
* 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;
@ -746,7 +746,7 @@ _bus_dmamem_map(t, segs, nsegs, size, kvap, flags)
for (curseg = 0; curseg < nsegs; curseg++) {
for (addr = segs[curseg].ds_addr;
addr < (segs[curseg].ds_addr + 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");
pmap_enter(pmap_kernel(), va, addr,

View File

@ -1,4 +1,4 @@
/* $NetBSD: altivec.c,v 1.2 2003/03/05 05:27:25 matt Exp $ */
/* $NetBSD: altivec.c,v 1.3 2003/04/02 02:47:19 thorpej Exp $ */
/*
* Copyright (C) 1996 Wolfgang Solfrank.
@ -38,6 +38,8 @@
#include <sys/malloc.h>
#include <sys/pool.h>
#include <uvm/uvm_extern.h>
#include <powerpc/altivec.h>
#include <powerpc/spr.h>
#include <powerpc/psl.h>
@ -227,7 +229,7 @@ save_vec_lwp(l)
void
vzeropage(paddr_t pa)
{
const paddr_t ea = pa + NBPG;
const paddr_t ea = pa + PAGE_SIZE;
uint32_t vec[7], *vp = (void *) roundup((uintptr_t) vec, 16);
register_t omsr, msr;
@ -286,7 +288,7 @@ vzeropage(paddr_t pa)
void
vcopypage(paddr_t dst, paddr_t src)
{
const paddr_t edst = dst + NBPG;
const paddr_t edst = dst + PAGE_SIZE;
uint32_t vec[11], *vp = (void *) roundup((uintptr_t) vec, 16);
register_t omsr, msr;

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu_subr.c,v 1.5 2003/03/29 18:18:54 matt Exp $ */
/* $NetBSD: cpu_subr.c,v 1.6 2003/04/02 02:47:19 thorpej Exp $ */
/*-
* Copyright (c) 2001 Matt Thomas.
@ -111,8 +111,8 @@ cpu_probe_cache(void)
assoc = 4;
break;
default:
curcpu()->ci_ci.dcache_size = NBPG;
curcpu()->ci_ci.icache_size = NBPG;
curcpu()->ci_ci.dcache_size = PAGE_SIZE;
curcpu()->ci_ci.icache_size = PAGE_SIZE;
assoc = 1;
#undef K
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: oea_machdep.c,v 1.7 2003/03/29 18:09:59 matt Exp $ */
/* $NetBSD: oea_machdep.c,v 1.8 2003/04/02 02:47:19 thorpej Exp $ */
/*
* Copyright (C) 2002 Matt Thomas
@ -632,7 +632,7 @@ oea_startup(const char *model)
UVM_INH_NONE, UVM_ADV_NORMAL, 0)) != 0)
panic("startup: cannot allocate VM for msgbuf");
v = (caddr_t)minaddr;
for (i = 0; i < sz; i += NBPG) {
for (i = 0; i < sz; i += PAGE_SIZE) {
pmap_kenter_pa(minaddr + i, msgbuf_paddr + i,
VM_PROT_READ|VM_PROT_WRITE);
}
@ -684,7 +684,7 @@ oea_startup(const char *model)
struct vm_page *pg;
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);
@ -743,7 +743,7 @@ oea_startup(const char *model)
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);
/*
@ -822,10 +822,10 @@ mapiodev(paddr_t pa, psize_t len)
if (va == 0)
return NULL;
for (; len > 0; len -= NBPG) {
for (; len > 0; len -= PAGE_SIZE) {
pmap_kenter_pa(taddr, faddr, VM_PROT_READ | VM_PROT_WRITE);
faddr += NBPG;
taddr += NBPG;
faddr += PAGE_SIZE;
taddr += PAGE_SIZE;
}
pmap_update(pmap_kernel());
return (void *)(va + off);

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.5 2003/03/17 23:15:33 matt Exp $ */
/* $NetBSD: pmap.c,v 1.6 2003/04/02 02:47:19 thorpej Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
@ -108,7 +108,7 @@ int pmap_use_altivec;
volatile struct pteg *pmap_pteg_table;
unsigned int pmap_pteg_cnt;
unsigned int pmap_pteg_mask;
paddr_t pmap_memlimit = -NBPG; /* there is no limit */
paddr_t pmap_memlimit = -PAGE_SIZE; /* there is no limit */
struct pmap kernel_pmap_;
unsigned int pmap_pages_stolen;
@ -1708,7 +1708,7 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags)
was_exec == 0) {
DPRINTFN(ENTER, (" syncicache"));
PMAPCOUNT(exec_synced);
pmap_syncicache(pa, NBPG);
pmap_syncicache(pa, PAGE_SIZE);
if (pg != NULL) {
pmap_attr_save(pg, PTE_EXEC);
PMAPCOUNT(exec_cached);
@ -1868,7 +1868,7 @@ pmap_protect(pmap_t pm, vaddr_t va, vaddr_t endva, vm_prot_t prot)
s = splvm();
msr = pmap_interrupts_off();
for (; va < endva; va += NBPG) {
for (; va < endva; va += PAGE_SIZE) {
pvo = pmap_pvo_find_va(pm, va, &pteidx);
if (pvo == NULL)
continue;
@ -2197,7 +2197,7 @@ pmap_clear_bit(struct vm_page *pg, int ptebit)
} else {
DPRINTFN(EXEC, ("[pmap_clear_bit: %#lx: syncicache]\n",
pg->phys_addr));
pmap_syncicache(pg->phys_addr, NBPG);
pmap_syncicache(pg->phys_addr, PAGE_SIZE);
PMAPCOUNT(exec_synced_clear_modify);
}
}
@ -2213,7 +2213,7 @@ pmap_procwr(struct proc *p, vaddr_t va, size_t len)
s = splvm();
while (len > 0) {
size_t seglen = NBPG - offset;
size_t seglen = PAGE_SIZE - offset;
if (seglen > len)
seglen = len;
pvo = pmap_pvo_find_va(p->p_vmspace->vm_map.pmap, va, NULL);
@ -2609,12 +2609,12 @@ pmap_boot_find_memory(psize_t size, psize_t alignment, int at_end)
("pmap_boot_find_memory: size=%lx, alignment=%lx, at_end=%d",
size, alignment, at_end));
if (alignment < NBPG || (alignment & (alignment-1)) != 0)
if (alignment < PAGE_SIZE || (alignment & (alignment-1)) != 0)
panic("pmap_boot_find_memory: invalid alignment %lx",
alignment);
if (at_end) {
if (alignment != NBPG)
if (alignment != PAGE_SIZE)
panic("pmap_boot_find_memory: invalid ending "
"alignment %lx", alignment);
@ -2816,7 +2816,7 @@ pmap_bootstrap(paddr_t kernelstart, paddr_t kernelend)
* If the user imposed a memory limit, enforce it.
*/
else if (s >= pmap_memlimit) {
mp->start = -NBPG; /* let's know why */
mp->start = -PAGE_SIZE; /* let's know why */
mp->size = 0;
}
else {
@ -2897,7 +2897,7 @@ pmap_bootstrap(paddr_t kernelstart, paddr_t kernelend)
* with pages. So we just steal them before giving them to UVM.
*/
size = sizeof(pmap_pvo_table[0]) * pmap_pteg_cnt;
pmap_pvo_table = pmap_boot_find_memory(size, NBPG, 0);
pmap_pvo_table = pmap_boot_find_memory(size, PAGE_SIZE, 0);
#if defined(DIAGNOSTIC) || defined(DEBUG) || defined(PMAPCHECK)
if ( (uintptr_t) pmap_pvo_table + size > SEGMENT_LENGTH)
panic("pmap_bootstrap: pmap_pvo_table end (%p + %lx) > 256MB",
@ -2911,7 +2911,8 @@ pmap_bootstrap(paddr_t kernelstart, paddr_t kernelend)
/*
* Allocate msgbuf in high memory.
*/
msgbuf_paddr = (paddr_t) pmap_boot_find_memory(MSGBUFSIZE, NBPG, 1);
msgbuf_paddr =
(paddr_t) pmap_boot_find_memory(MSGBUFSIZE, PAGE_SIZE, 1);
#endif
#ifdef __HAVE_PMAP_PHYSSEG
@ -2920,7 +2921,7 @@ pmap_bootstrap(paddr_t kernelstart, paddr_t kernelend)
for (i = 0, mp = avail; i < avail_cnt; i++, mp++)
npgs += btoc(mp->size);
size = (sizeof(struct pvo_head) + 1) * npgs;
pmap_physseg.pvoh = pmap_boot_find_memory(size, NBPG, 0);
pmap_physseg.pvoh = pmap_boot_find_memory(size, PAGE_SIZE, 0);
pmap_physseg.attrs = (char *) &pmap_physseg.pvoh[npgs];
#if defined(DIAGNOSTIC) || defined(DEBUG) || defined(PMAPCHECK)
if ((uintptr_t)pmap_physseg.pvoh + size > SEGMENT_LENGTH)

View File

@ -1,4 +1,4 @@
/* $NetBSD: bus_dma.c,v 1.8 2003/03/16 05:37:37 matt Exp $ */
/* $NetBSD: bus_dma.c,v 1.9 2003/04/02 02:47:19 thorpej Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -189,7 +189,7 @@ _bus_dmamap_load_buffer(t, map, buf, buflen, p, flags, lastaddrp, segp, first)
/*
* 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;
@ -592,7 +592,7 @@ _bus_dmamem_map(t, segs, nsegs, size, kvap, flags)
for (addr = BUS_MEM_TO_PHYS(t, segs[curseg].ds_addr);
addr < (BUS_MEM_TO_PHYS(t, segs[curseg].ds_addr)
+ 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");
/*
@ -600,7 +600,7 @@ _bus_dmamem_map(t, segs, nsegs, size, kvap, flags)
* cache before we map it.
*/
if (flags & BUS_DMA_NOCACHE)
dcbf(addr, NBPG,
dcbf(addr, PAGE_SIZE,
curcpu()->ci_ci.dcache_line_size);
pmap_kenter_pa(va, addr,
VM_PROT_READ | VM_PROT_WRITE |

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_trace.c,v 1.27 2003/03/14 05:38:53 matt Exp $ */
/* $NetBSD: db_trace.c,v 1.28 2003/04/02 02:47:19 thorpej Exp $ */
/* $OpenBSD: db_trace.c,v 1.3 1997/03/21 02:10:48 niklas Exp $ */
/*
@ -157,7 +157,7 @@ db_stack_trace_print(addr, have_addr, count, modif, pr)
frame = (db_addr_t)ddb_regs.r[1];
}
for (;;) {
if (frame < NBPG)
if (frame < PAGE_SIZE)
break;
#ifdef PPC_OEA
if (kernel_only && !cold &&
@ -169,7 +169,7 @@ db_stack_trace_print(addr, have_addr, count, modif, pr)
frame = *(db_addr_t *)frame;
next_frame:
args = (db_addr_t *)(frame + 8);
if (frame < NBPG)
if (frame < PAGE_SIZE)
break;
#ifdef PPC_OEA
if (kernel_only && !cold &&

View File

@ -1,4 +1,4 @@
/* $NetBSD: openfirm.c,v 1.11 2001/09/24 13:22:33 wiz Exp $ */
/* $NetBSD: openfirm.c,v 1.12 2003/04/02 02:47:19 thorpej Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -33,6 +33,8 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <uvm/uvm_extern.h>
#include <machine/psl.h>
#include <machine/stdarg.h>
@ -184,7 +186,7 @@ OF_getprop(handle, prop, buf, buflen)
};
ofw_stack();
if (buflen > NBPG)
if (buflen > PAGE_SIZE)
return -1;
args.phandle = handle;
args.prop = prop;
@ -272,7 +274,7 @@ OF_instance_to_path(ihandle, buf, buflen)
1,
};
if (buflen > NBPG)
if (buflen > PAGE_SIZE)
return -1;
args.ihandle = ihandle;
args.buf = OF_buf;
@ -307,7 +309,7 @@ OF_package_to_path(phandle, buf, buflen)
};
ofw_stack();
if (buflen > NBPG)
if (buflen > PAGE_SIZE)
return -1;
args.phandle = phandle;
args.buf = OF_buf;
@ -433,7 +435,7 @@ OF_open(dname)
int l;
ofw_stack();
if ((l = strlen(dname)) >= NBPG)
if ((l = strlen(dname)) >= PAGE_SIZE)
return -1;
ofbcopy(dname, OF_buf, l + 1);
args.dname = OF_buf;
@ -463,7 +465,7 @@ OF_close(handle)
}
/*
* This assumes that character devices don't read in multiples of NBPG.
* This assumes that character devices don't read in multiples of PAGE_SIZE.
*/
int
OF_read(handle, addr, len)
@ -491,7 +493,7 @@ OF_read(handle, addr, len)
args.ihandle = handle;
args.addr = OF_buf;
for (; len > 0; len -= l, p += l) {
l = min(NBPG, len);
l = min(PAGE_SIZE, len);
args.len = l;
if (openfirmware(&args) == -1)
return -1;
@ -535,7 +537,7 @@ OF_write(handle, addr, len)
args.ihandle = handle;
args.addr = OF_buf;
for (; len > 0; len -= l, p += l) {
l = min(NBPG, len);
l = min(PAGE_SIZE, len);
ofbcopy(p, OF_buf, l);
args.len = l;
if (openfirmware(&args) == -1)
@ -590,7 +592,7 @@ OF_boot(bootspec)
};
int l;
if ((l = strlen(bootspec)) >= NBPG)
if ((l = strlen(bootspec)) >= PAGE_SIZE)
panic("OF_boot");
ofw_stack();
ofbcopy(bootspec, OF_buf, l + 1);

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap_subr.c,v 1.8 2003/02/03 17:10:11 matt Exp $ */
/* $NetBSD: pmap_subr.c,v 1.9 2003/04/02 02:47:19 thorpej Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
@ -150,7 +150,7 @@ pmap_zero_page(paddr_t pa)
*/
if ((linewidth = curcpu()->ci_ci.dcache_line_size) == 0) {
long *dp = (long *)pa;
long * const ep = dp + NBPG/sizeof(dp[0]);
long * const ep = dp + PAGE_SIZE/sizeof(dp[0]);
do {
dp[0] = 0; dp[1] = 0; dp[2] = 0; dp[3] = 0;
dp[4] = 0; dp[5] = 0; dp[6] = 0; dp[7] = 0;
@ -160,7 +160,7 @@ pmap_zero_page(paddr_t pa)
do {
__asm ("dcbz %0,%1" :: "b"(pa), "r"(i)); i += linewidth;
__asm ("dcbz %0,%1" :: "b"(pa), "r"(i)); i += linewidth;
} while (i < NBPG);
} while (i < PAGE_SIZE);
}
/*
@ -216,7 +216,7 @@ pmap_copy_page(paddr_t src, paddr_t dst)
/*
* Copy the page (memcpy is optimized, right? :)
*/
memcpy((void *) dst, (void *) src, NBPG);
memcpy((void *) dst, (void *) src, PAGE_SIZE);
return;
}
#endif
@ -233,7 +233,7 @@ pmap_copy_page(paddr_t src, paddr_t dst)
*/
sp = (const register_t *) src;
dp = (register_t *) dst;
for (i = 0; i < NBPG/sizeof(dp[0]); i += 8, dp += 8, sp += 8) {
for (i = 0; i < PAGE_SIZE/sizeof(dp[0]); i += 8, dp += 8, sp += 8) {
dp[0] = sp[0]; dp[1] = sp[1]; dp[2] = sp[2]; dp[3] = sp[3];
dp[4] = sp[4]; dp[5] = sp[5]; dp[6] = sp[6]; dp[7] = sp[7];
}
@ -312,7 +312,7 @@ pmap_pageidlezero(paddr_t pa)
#ifdef PPC_OEA
if (pa < SEGMENT_LENGTH) {
for (i = 0; i < NBPG / sizeof(dp[0]); i++) {
for (i = 0; i < PAGE_SIZE / sizeof(dp[0]); i++) {
if (sched_whichqs != 0)
return FALSE;
*dp++ = 0;
@ -333,7 +333,7 @@ pmap_pageidlezero(paddr_t pa)
/*
* Zero the page until a process becomes runnable.
*/
for (i = 0; i < NBPG / sizeof(dp[0]); i++) {
for (i = 0; i < PAGE_SIZE / sizeof(dp[0]); i++) {
if (sched_whichqs != 0) {
rv = FALSE;
break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.49 2003/03/14 05:37:14 matt Exp $ */
/* $NetBSD: vm_machdep.c,v 1.50 2003/04/02 02:47:19 thorpej Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -217,12 +217,12 @@ pagemove(from, to, size)
paddr_t pa;
vaddr_t va;
for (va = (vaddr_t)from; size > 0; size -= NBPG) {
for (va = (vaddr_t)from; size > 0; size -= PAGE_SIZE) {
(void) pmap_extract(pmap_kernel(), va, &pa);
pmap_kremove(va, NBPG);
pmap_kremove(va, PAGE_SIZE);
pmap_kenter_pa((vaddr_t)to, pa, VM_PROT_READ|VM_PROT_WRITE);
va += NBPG;
to += NBPG;
va += PAGE_SIZE;
to += PAGE_SIZE;
}
pmap_update(pmap_kernel());
}
@ -334,12 +334,12 @@ vmaprange(p, uaddr, len, prot)
len = round_page(off + len);
taddr = uvm_km_valloc_wait(phys_map, len);
kaddr = taddr + off;
for (; len > 0; len -= NBPG) {
for (; len > 0; len -= PAGE_SIZE) {
(void) pmap_extract(vm_map_pmap(&p->p_vmspace->vm_map),
faddr, &pa);
pmap_kenter_pa(taddr, pa, prot);
faddr += NBPG;
taddr += NBPG;
faddr += PAGE_SIZE;
taddr += PAGE_SIZE;
}
return (kaddr);
}
@ -390,7 +390,7 @@ vmapbuf(bp, len)
len = round_page(off + len);
taddr = uvm_km_valloc_wait(phys_map, len);
bp->b_data = (caddr_t)(taddr + off);
for (; len > 0; len -= NBPG) {
for (; len > 0; len -= PAGE_SIZE) {
(void) pmap_extract(vm_map_pmap(&bp->b_proc->p_vmspace->vm_map),
faddr, &pa);
/*
@ -398,8 +398,8 @@ vmapbuf(bp, len)
* appropriately set.
*/
pmap_kenter_pa(taddr, pa, prot);
faddr += NBPG;
taddr += NBPG;
faddr += PAGE_SIZE;
taddr += PAGE_SIZE;
}
pmap_update(pmap_kernel());
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: bus_dma.c,v 1.7 2003/03/13 13:44:18 scw Exp $ */
/* $NetBSD: bus_dma.c,v 1.8 2003/04/02 02:45:36 thorpej Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -39,7 +39,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.7 2003/03/13 13:44:18 scw Exp $");
__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.8 2003/04/02 02:45:36 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -202,7 +202,7 @@ _bus_dmamap_load_buffer_direct_common(void *cookie, bus_dmamap_t map,
/*
* 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;
@ -536,7 +536,7 @@ _bus_dmamap_sync_helper(vaddr_t va, paddr_t pa, vsize_t len, int inv)
void (*op)(vaddr_t, paddr_t, vsize_t);
vsize_t bytes;
KDASSERT((int)(va & (NBPG - 1)) == (int)(pa & (NBPG - 1)));
KDASSERT((int)(va & (PAGE_SIZE - 1)) == (int)(pa & (PAGE_SIZE - 1)));
if (len == 0)
return;
@ -582,8 +582,8 @@ _bus_dmamap_sync_helper(vaddr_t va, paddr_t pa, vsize_t len, int inv)
/*
* Align the region to a page boundary
*/
if ((va & (NBPG-1)) != 0) {
bytes = min(NBPG - (vsize_t)(va & (NBPG - 1)), len);
if ((va & (PAGE_SIZE-1)) != 0) {
bytes = min(PAGE_SIZE - (vsize_t)(va & (PAGE_SIZE - 1)), len);
(*op)(va, pa, bytes);
len -= bytes;
pa += bytes;
@ -594,7 +594,7 @@ _bus_dmamap_sync_helper(vaddr_t va, paddr_t pa, vsize_t len, int inv)
* Do things one page at a time
*/
while (len) {
bytes = min(NBPG, len);
bytes = min(PAGE_SIZE, len);
(*op)(va, pa, bytes);
len -= bytes;
pa += bytes;
@ -757,7 +757,7 @@ _bus_dmamem_map(void *cookie, bus_dma_segment_t *segs, int nsegs,
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: mem.c,v 1.6 2003/01/19 19:49:54 scw Exp $ */
/* $NetBSD: mem.c,v 1.7 2003/04/02 02:45:36 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -44,7 +44,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.6 2003/01/19 19:49:54 scw Exp $");
__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.7 2003/04/02 02:45:36 thorpej Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@ -115,9 +115,9 @@ mmrw(dev, uio, flags)
prot | PMAP_WIRED | PMAP_UNMANAGED);
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(), vmmap, vmmap + NBPG);
pmap_remove(pmap_kernel(), vmmap, vmmap + PAGE_SIZE);
pmap_update(pmap_kernel());
break;
@ -144,10 +144,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: pmap.c,v 1.29 2003/03/19 11:37:58 scw Exp $ */
/* $NetBSD: pmap.c,v 1.30 2003/04/02 02:45:36 thorpej Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@ -249,8 +249,8 @@ PMSTR(pmap_t pm)
/*
* The Primary IPT consists of an array of Hash Buckets, called PTE Groups,
* where each group is 8 PTEs in size. The number of groups is calculated
* at boot time such that there is one group for every two NBPG-sized pages
* of physical RAM.
* at boot time such that there is one group for every two PAGE_SIZE-sized
* pages of physical RAM.
*/
pteg_t *pmap_pteg_table; /* Primary IPT group */
int pmap_pteg_cnt; /* Number of PTE groups. A power of two */
@ -421,7 +421,7 @@ static vaddr_t pmap_copy_page_src_kva;
static vaddr_t pmap_copy_page_dst_kva;
static vaddr_t pmap_kva_avail_start;
static vaddr_t pmap_device_kva_start;
#define PMAP_BOOTSTRAP_DEVICE_KVA (NBPG * 512)
#define PMAP_BOOTSTRAP_DEVICE_KVA (PAGE_SIZE * 512)
vaddr_t vmmap;
paddr_t pmap_kseg0_pa;
@ -654,7 +654,7 @@ pmap_cache_sync_raise(vaddr_t va, ptel_t ptel, ptel_t clrbits)
* The page is being made no-exec, rd-only.
* Purge the data cache and invalidate insn cache.
*/
cpu_cache_dpurge_iinv(va, pa, NBPG);
cpu_cache_dpurge_iinv(va, pa, PAGE_SIZE);
break;
case SH5_PTEL_PR_W:
@ -662,7 +662,7 @@ pmap_cache_sync_raise(vaddr_t va, ptel_t ptel, ptel_t clrbits)
* The page is being made read-only.
* Purge the data-cache.
*/
cpu_cache_dpurge(va, pa, NBPG);
cpu_cache_dpurge(va, pa, PAGE_SIZE);
break;
case SH5_PTEL_PR_X:
@ -670,7 +670,7 @@ pmap_cache_sync_raise(vaddr_t va, ptel_t ptel, ptel_t clrbits)
* The page is being made no-exec.
* Invalidate the instruction cache.
*/
cpu_cache_iinv(va, pa, NBPG);
cpu_cache_iinv(va, pa, PAGE_SIZE);
break;
case 0:
@ -712,7 +712,7 @@ pmap_cache_sync_unmap(vaddr_t va, ptel_t ptel)
* The page was executable, and possibly writable.
* Purge the data cache and invalidate insn cache.
*/
cpu_cache_dpurge_iinv(va, pa, NBPG);
cpu_cache_dpurge_iinv(va, pa, PAGE_SIZE);
break;
case SH5_PTEL_PR_W:
@ -720,7 +720,7 @@ pmap_cache_sync_unmap(vaddr_t va, ptel_t ptel)
* The page was writable.
* Purge the data-cache.
*/
cpu_cache_dpurge(va, pa, NBPG);
cpu_cache_dpurge(va, pa, PAGE_SIZE);
break;
case 0:
@ -734,7 +734,7 @@ pmap_cache_sync_unmap(vaddr_t va, ptel_t ptel)
* The invalidate operation will actually cause a write-
* protection fault (!!!!) in this case.
*/
cpu_cache_dpurge(va, pa, NBPG);
cpu_cache_dpurge(va, pa, PAGE_SIZE);
break;
}
}
@ -1137,10 +1137,10 @@ pmap_bootstrap(vaddr_t avail, paddr_t kseg0base, struct mem_region *mr)
}
pmap_zero_page_kva = SH5_KSEG1_BASE;
pmap_copy_page_src_kva = pmap_zero_page_kva + NBPG;
pmap_copy_page_dst_kva = pmap_copy_page_src_kva + NBPG;
vmmap = pmap_copy_page_dst_kva + NBPG;
pmap_device_kva_start = vmmap + NBPG;
pmap_copy_page_src_kva = pmap_zero_page_kva + PAGE_SIZE;
pmap_copy_page_dst_kva = pmap_copy_page_src_kva + PAGE_SIZE;
vmmap = pmap_copy_page_dst_kva + PAGE_SIZE;
pmap_device_kva_start = vmmap + PAGE_SIZE;
pmap_kva_avail_start = pmap_device_kva_start +
PMAP_BOOTSTRAP_DEVICE_KVA;
@ -1190,9 +1190,9 @@ pmap_map_device(paddr_t pa, u_int len)
pmap_kernel_ipt_set_ptel(&pmap_kernel_ipt[idx], ptel);
va += NBPG;
pa += NBPG;
len -= NBPG;
va += PAGE_SIZE;
pa += PAGE_SIZE;
len -= PAGE_SIZE;
}
return (rv);
@ -1267,7 +1267,7 @@ pmap_virtual_space(vaddr_t *start, vaddr_t *end)
{
*start = pmap_kva_avail_start;
*end = SH5_KSEG1_BASE + ((KERNEL_IPT_SIZE - 1) * NBPG);
*end = SH5_KSEG1_BASE + ((KERNEL_IPT_SIZE - 1) * PAGE_SIZE);
}
/*
@ -1527,7 +1527,7 @@ pmap_copyzero_page_dpurge(paddr_t pa, struct evcnt *ev)
if (PVO_VADDR(pvo) < SH5_KSEG0_BASE && !PVO_PTEGIDX_ISSET(pvo))
continue;
cpu_cache_dpurge_iinv(PVO_VADDR(pvo), pa, NBPG);
cpu_cache_dpurge_iinv(PVO_VADDR(pvo), pa, PAGE_SIZE);
ev->ev_count++;
@ -2398,7 +2398,7 @@ pmap_protect(pmap_t pm, vaddr_t va, vaddr_t endva, vm_prot_t prot)
* We're doing a write-protect, and perhaps an execute-revoke.
*/
for (; va < endva; va += NBPG) {
for (; va < endva; va += PAGE_SIZE) {
s = splvm();
pvo = pmap_pvo_find_va(pm, va, &idx);
if (pvo == NULL) {
@ -2867,7 +2867,8 @@ pmap_write_trap(struct proc *p, int usermode, vaddr_t va)
*/
if (SH5_PTEL_CACHEABLE(pvo->pvo_ptel)) {
cpu_cache_dpurge(PVO_VADDR(pvo),
(paddr_t)(pvo->pvo_ptel & SH5_PTEL_PPN_MASK), NBPG);
(paddr_t)(pvo->pvo_ptel & SH5_PTEL_PPN_MASK),
PAGE_SIZE);
}
cpu_tlbinv_cookie((pteh_t)PVO_VADDR(pvo) | SH5_PTEH_SH,
@ -2922,7 +2923,7 @@ pmap_unmap_poolpage(vaddr_t va)
if (mp->mr_size && mp->mr_kvastart < SH5_KSEG1_BASE) {
pa = mp->mr_start + (paddr_t)(va - mp->mr_kvastart);
cpu_cache_dpurge(va, pa, NBPG);
cpu_cache_dpurge(va, pa, PAGE_SIZE);
return (pa);
}
@ -3031,7 +3032,7 @@ dump_kipt(void)
printf("\nKernel KSEG1 mappings:\n\n");
for (pt = &pmap_kernel_ipt[0], va = SH5_KSEG1_BASE;
pt != &pmap_kernel_ipt[KERNEL_IPT_SIZE]; pt++, va += NBPG) {
pt != &pmap_kernel_ipt[KERNEL_IPT_SIZE]; pt++, va += PAGE_SIZE) {
if (pt->ptel && pt->ptel < 0x80000000u)
printf("KVA: 0x%lx -> PTEL: 0x%lx\n", va,
(u_long)pt->ptel);
@ -3052,7 +3053,8 @@ validate_kipt(int cookie)
int errors = 0;
for (kpte = &pmap_kernel_ipt[0], va = SH5_KSEG1_BASE;
kpte != &pmap_kernel_ipt[KERNEL_IPT_SIZE]; kpte++, va += NBPG) {
kpte != &pmap_kernel_ipt[KERNEL_IPT_SIZE];
kpte++, va += PAGE_SIZE) {
if ((pt = kpte->ptel) == 0)
continue;