Use PAGE_SIZE rather than NBPG.
This commit is contained in:
parent
f8d3a59131
commit
3faec1e02a
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_ade.c,v 1.20 2003/02/05 00:02:30 perry Exp $ */
|
||||
/* $NetBSD: if_ade.c,v 1.21 2003/04/01 02:17:17 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* NOTE: this version of if_de was modified for bounce buffers prior
|
||||
|
@ -167,6 +167,7 @@
|
|||
#if defined(INET)
|
||||
#include <netinet/if_inarp.h>
|
||||
#endif
|
||||
#include <uvm/uvm_extern.h>
|
||||
#include <machine/bus.h>
|
||||
#if defined(__alpha__)
|
||||
#include <machine/intr.h>
|
||||
|
@ -4193,7 +4194,7 @@ tulip_ifstart(
|
|||
do {
|
||||
int len = m0->m_len;
|
||||
caddr_t addr = mtod(m0, caddr_t);
|
||||
unsigned clsize = NBPG - (((u_long) addr) & PGOFSET);
|
||||
unsigned clsize = PAGE_SIZE - (((u_long) addr) & PGOFSET);
|
||||
|
||||
next_m0 = m0->m_next;
|
||||
while (len > 0) {
|
||||
|
@ -4261,7 +4262,7 @@ tulip_ifstart(
|
|||
if (partial)
|
||||
continue;
|
||||
#endif
|
||||
clsize = NBPG;
|
||||
clsize = PAGE_SIZE;
|
||||
}
|
||||
} while ((m0 = next_m0) != NULL);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.261 2003/01/17 22:11:18 thorpej Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.262 2003/04/01 02:18:51 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
|
||||
|
@ -75,7 +75,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.261 2003/01/17 22:11:18 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.262 2003/04/01 02:18:51 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -910,7 +910,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);
|
||||
|
@ -957,7 +957,7 @@ cpu_startup()
|
|||
printf("stolen memory for VM structures = %s\n", pbuf);
|
||||
}
|
||||
#endif
|
||||
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);
|
||||
|
||||
/*
|
||||
|
@ -1239,7 +1239,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.
|
||||
|
@ -1285,7 +1285,7 @@ bad:
|
|||
/*
|
||||
* Dump the kernel's image to the swap partition.
|
||||
*/
|
||||
#define BYTES_PER_DUMP NBPG
|
||||
#define BYTES_PER_DUMP PAGE_SIZE
|
||||
|
||||
void
|
||||
dumpsys()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mem.c,v 1.33 2002/10/23 09:10:28 jdolecek Exp $ */
|
||||
/* $NetBSD: mem.c,v 1.34 2003/04/01 02:18:52 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -46,7 +46,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.33 2002/10/23 09:10:28 jdolecek Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.34 2003/04/01 02:18:52 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/buf.h>
|
||||
|
@ -117,7 +117,7 @@ kmemphys:
|
|||
}
|
||||
|
||||
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)ALPHA_PHYS_TO_K0SEG(v), c, uio);
|
||||
break;
|
||||
|
@ -153,10 +153,10 @@ kmemphys:
|
|||
*/
|
||||
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;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pmap.c,v 1.196 2003/02/23 22:41:24 nathanw Exp $ */
|
||||
/* $NetBSD: pmap.c,v 1.197 2003/04/01 02:18:52 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -119,10 +119,6 @@
|
|||
* table pages may be added. User page table pages are
|
||||
* dynamically allocated and freed.
|
||||
*
|
||||
* This pmap implementation only supports NBPG == PAGE_SIZE.
|
||||
* In practice, this is not a problem since PAGE_SIZE is
|
||||
* initialized to the hardware page size in alpha_init().
|
||||
*
|
||||
* Bugs/misfeatures:
|
||||
*
|
||||
* - Some things could be optimized.
|
||||
|
@ -153,7 +149,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.196 2003/02/23 22:41:24 nathanw Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.197 2003/04/01 02:18:52 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -819,7 +815,7 @@ pmap_bootstrap(paddr_t ptaddr, u_int maxasn, u_long ncpuids)
|
|||
* for vm_fork().
|
||||
*/
|
||||
lev3mapsize = (VM_PHYS_SIZE + (ubc_nwins << ubc_winshift) +
|
||||
nbuf * MAXBSIZE + 16 * NCARGS + PAGER_MAP_SIZE) / NBPG +
|
||||
nbuf * MAXBSIZE + 16 * NCARGS + PAGER_MAP_SIZE) / PAGE_SIZE +
|
||||
(maxproc * UPAGES) + nkmempages;
|
||||
|
||||
#ifdef SYSVSHM
|
||||
|
@ -845,7 +841,7 @@ pmap_bootstrap(paddr_t ptaddr, u_int maxasn, u_long ncpuids)
|
|||
/*
|
||||
* Allocate a level 1 PTE table for the kernel.
|
||||
* This is always one page long.
|
||||
* IF THIS IS NOT A MULTIPLE OF NBPG, ALL WILL GO TO HELL.
|
||||
* IF THIS IS NOT A MULTIPLE OF PAGE_SIZE, ALL WILL GO TO HELL.
|
||||
*/
|
||||
kernel_lev1map = (pt_entry_t *)
|
||||
uvm_pageboot_alloc(sizeof(pt_entry_t) * NPTEPG);
|
||||
|
@ -853,7 +849,7 @@ pmap_bootstrap(paddr_t ptaddr, u_int maxasn, u_long ncpuids)
|
|||
/*
|
||||
* Allocate a level 2 PTE table for the kernel.
|
||||
* These must map all of the level3 PTEs.
|
||||
* IF THIS IS NOT A MULTIPLE OF NBPG, ALL WILL GO TO HELL.
|
||||
* IF THIS IS NOT A MULTIPLE OF PAGE_SIZE, ALL WILL GO TO HELL.
|
||||
*/
|
||||
lev2mapsize = roundup(howmany(lev3mapsize, NPTEPG), NPTEPG);
|
||||
lev2map = (pt_entry_t *)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bus_dma.c,v 1.51 2002/10/09 21:35:33 nathanw Exp $ */
|
||||
/* $NetBSD: bus_dma.c,v 1.52 2003/04/01 02:20:14 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.51 2002/10/09 21:35:33 nathanw Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.52 2003/04/01 02:20:14 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -161,7 +161,7 @@ _bus_dmamap_load_buffer_direct(bus_dma_tag_t t, 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;
|
||||
if (map->_dm_maxsegsz < sgsize)
|
||||
|
@ -547,7 +547,7 @@ _bus_dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs,
|
|||
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,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sgmap_common.c,v 1.19 2002/09/27 15:35:36 provos Exp $ */
|
||||
/* $NetBSD: sgmap_common.c,v 1.20 2003/04/01 02:20:14 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998, 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -39,7 +39,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: sgmap_common.c,v 1.19 2002/09/27 15:35:36 provos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sgmap_common.c,v 1.20 2003/04/01 02:20:14 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -93,7 +93,7 @@ alpha_sgmap_init(bus_dma_tag_t t, struct alpha_sgmap *sgmap, const char *name,
|
|||
* this must be aligned to the page table size. However,
|
||||
* some platforms have more strict alignment reqirements.
|
||||
*/
|
||||
ptsize = (sgvasize / NBPG) * ptesize;
|
||||
ptsize = (sgvasize / PAGE_SIZE) * ptesize;
|
||||
if (minptalign != 0) {
|
||||
if (minptalign < ptsize)
|
||||
minptalign = ptsize;
|
||||
|
@ -125,7 +125,7 @@ alpha_sgmap_init(bus_dma_tag_t t, struct alpha_sgmap *sgmap, const char *name,
|
|||
* Allocate a spill page if that hasn't already been done.
|
||||
*/
|
||||
if (alpha_sgmap_prefetch_spill_page_va == 0) {
|
||||
if (bus_dmamem_alloc(t, NBPG, 0, 0, &seg, 1, &rseg,
|
||||
if (bus_dmamem_alloc(t, PAGE_SIZE, 0, 0, &seg, 1, &rseg,
|
||||
BUS_DMA_NOWAIT)) {
|
||||
printf("unable to allocate spill page for sgmap `%s'\n",
|
||||
name);
|
||||
|
@ -134,7 +134,8 @@ alpha_sgmap_init(bus_dma_tag_t t, struct alpha_sgmap *sgmap, const char *name,
|
|||
alpha_sgmap_prefetch_spill_page_pa = seg.ds_addr;
|
||||
alpha_sgmap_prefetch_spill_page_va =
|
||||
ALPHA_PHYS_TO_K0SEG(alpha_sgmap_prefetch_spill_page_pa);
|
||||
memset((caddr_t)alpha_sgmap_prefetch_spill_page_va, 0, NBPG);
|
||||
memset((caddr_t)alpha_sgmap_prefetch_spill_page_va, 0,
|
||||
PAGE_SIZE);
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sgmap_typedep.c,v 1.23 2002/04/26 04:15:18 thorpej Exp $ */
|
||||
/* $NetBSD: sgmap_typedep.c,v 1.24 2003/04/01 02:20:14 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998, 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: sgmap_typedep.c,v 1.23 2002/04/26 04:15:18 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sgmap_typedep.c,v 1.24 2003/04/01 02:20:14 thorpej Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
|
||||
|
@ -109,11 +109,11 @@ __C(SGMAP_TYPE,_load_buffer)(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
|
|||
va = trunc_page(va);
|
||||
|
||||
boundary = map->_dm_boundary;
|
||||
alignment = NBPG;
|
||||
alignment = PAGE_SIZE;
|
||||
|
||||
sgvalen = (endva - va);
|
||||
if (spill) {
|
||||
sgvalen += NBPG;
|
||||
sgvalen += PAGE_SIZE;
|
||||
|
||||
/*
|
||||
* ARGH! If the addition of the spill page bumped us
|
||||
|
@ -164,7 +164,7 @@ __C(SGMAP_TYPE,_load_buffer)(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
|
|||
map->dm_segs[seg].ds_addr);
|
||||
#endif
|
||||
|
||||
for (; va < endva; va += NBPG, pteidx++,
|
||||
for (; va < endva; va += PAGE_SIZE, pteidx++,
|
||||
pte = &page_table[pteidx * SGMAP_PTE_SPACING]) {
|
||||
/* Get the physical address for this segment. */
|
||||
if (p != NULL)
|
||||
|
@ -414,11 +414,11 @@ __C(SGMAP_TYPE,_unload)(bus_dma_tag_t t, bus_dmamap_t map,
|
|||
osgva = sgva = trunc_page(sgva);
|
||||
|
||||
if (spill)
|
||||
esgva += NBPG;
|
||||
esgva += PAGE_SIZE;
|
||||
|
||||
/* Invalidate the PTEs for the mapping. */
|
||||
for (pteidx = sgva >> SGMAP_ADDR_PTEIDX_SHIFT;
|
||||
sgva < esgva; sgva += NBPG, pteidx++) {
|
||||
sgva < esgva; sgva += PAGE_SIZE, pteidx++) {
|
||||
pte = &page_table[pteidx * SGMAP_PTE_SPACING];
|
||||
#ifdef SGMAP_DEBUG
|
||||
if (__C(SGMAP_TYPE,_debug))
|
||||
|
|
Loading…
Reference in New Issue