Use PAGE_SIZE rather than NBPG.

This commit is contained in:
thorpej 2003-04-01 02:01:43 +00:00
parent d58deb08c2
commit 52d8769e0b
9 changed files with 38 additions and 31 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.6 2003/01/17 21:55:24 thorpej Exp $ */
/* $NetBSD: machdep.c,v 1.7 2003/04/01 02:09:48 thorpej Exp $ */
/*-
* Copyright (c) 1998 Ben Harris
@ -32,7 +32,7 @@
#include <sys/param.h>
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.6 2003/01/17 21:55:24 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.7 2003/04/01 02:09:48 thorpej Exp $");
#include <sys/buf.h>
#include <sys/kernel.h>
@ -180,7 +180,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);
@ -217,7 +217,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);
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: mem.c,v 1.3 2002/10/23 09:10:25 jdolecek Exp $ */
/* $NetBSD: mem.c,v 1.4 2003/04/01 02:09:48 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -135,10 +135,10 @@ mmrw(dev, uio, flags)
}
if (zeropage == NULL) {
zeropage = (caddr_t)
malloc(NBPG, M_TEMP, M_WAITOK);
bzero(zeropage, NBPG);
malloc(PAGE_SIZE, M_TEMP, M_WAITOK);
bzero(zeropage, 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: if_ie_mvme.c,v 1.4 2002/10/02 16:34:26 thorpej Exp $ */
/* $NetBSD: if_ie_mvme.c,v 1.5 2003/04/01 02:01:43 thorpej Exp $ */
/*-
* Copyright (c) 1999, 2002 The NetBSD Foundation, Inc.
@ -287,7 +287,7 @@ ie_pcctwo_attach(parent, self, args)
0, &ps->ps_bush);
/* Get contiguous DMA-able memory for the IE chip */
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) != 0) {
printf("%s: Failed to allocate ether buffer\n", self->dv_xname);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_lmc_nbsd.c,v 1.20 2002/10/02 16:51:26 thorpej Exp $ */
/* $NetBSD: if_lmc_nbsd.c,v 1.21 2003/04/01 02:04:34 thorpej Exp $ */
/*-
* Copyright (c) 1997-1999 LAN Media Corporation (LMC)
@ -63,7 +63,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_lmc_nbsd.c,v 1.20 2002/10/02 16:51:26 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_lmc_nbsd.c,v 1.21 2003/04/01 02:04:34 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -141,6 +141,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_lmc_nbsd.c,v 1.20 2002/10/02 16:51:26 thorpej Exp
#endif /* __bsdi__ */
#if defined(__NetBSD__)
#include <uvm/uvm_extern.h>
#include <machine/bus.h>
#if defined(__alpha__)
#include <machine/intr.h>
@ -410,7 +411,7 @@ lmc_busdma_allocmem(
{
bus_dma_segment_t segs[1];
int nsegs, error;
error = bus_dmamem_alloc(sc->lmc_dmatag, size, 1, NBPG,
error = bus_dmamem_alloc(sc->lmc_dmatag, size, 1, PAGE_SIZE,
segs, sizeof(segs)/sizeof(segs[0]),
&nsegs, BUS_DMA_NOWAIT);
if (error == 0) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: mly.c,v 1.18 2003/03/31 03:23:38 perry Exp $ */
/* $NetBSD: mly.c,v 1.19 2003/04/01 02:04:34 thorpej Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mly.c,v 1.18 2003/03/31 03:23:38 perry Exp $");
__KERNEL_RCSID(0, "$NetBSD: mly.c,v 1.19 2003/04/01 02:04:34 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -2208,7 +2208,7 @@ mly_dmamem_alloc(struct mly_softc *mly, int size, bus_dmamap_t *dmamap,
state = 0;
if ((rv = bus_dmamem_alloc(mly->mly_dmat, size, NBPG, 0,
if ((rv = bus_dmamem_alloc(mly->mly_dmat, size, PAGE_SIZE, 0,
seg, 1, &rseg, BUS_DMA_NOWAIT)) != 0) {
printf("%s: dmamem_alloc = %d\n", mly->mly_dv.dv_xname, rv);
goto bad;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_uba.c,v 1.22 2001/11/13 07:11:24 lukem Exp $ */
/* $NetBSD: if_uba.c,v 1.23 2003/04/01 02:06:06 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_uba.c,v 1.22 2001/11/13 07:11:24 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_uba.c,v 1.23 2003/04/01 02:06:06 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -45,6 +45,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_uba.c,v 1.22 2001/11/13 07:11:24 lukem Exp $");
#include <sys/socket.h>
#include <sys/device.h>
#include <uvm/uvm_extern.h>
#include <net/if.h>
#include <machine/bus.h>
@ -95,7 +97,7 @@ if_ubaminit(struct ifubinfo *ifu, struct uba_softc *uh, int size,
*/
size = (size + UBA_PGOFSET) & ~UBA_PGOFSET;
totsz = size * nw;
if ((error = bus_dmamem_alloc(uh->uh_dmat, totsz, NBPG, 0,
if ((error = bus_dmamem_alloc(uh->uh_dmat, totsz, PAGE_SIZE, 0,
&seg, 1, &rseg, BUS_DMA_NOWAIT)))
return error;
if ((error = bus_dmamem_map(uh->uh_dmat, &seg, rseg, totsz, &vaddr,

View File

@ -1,4 +1,4 @@
/* $NetBSD: uba.c,v 1.64 2003/01/01 00:10:24 thorpej Exp $ */
/* $NetBSD: uba.c,v 1.65 2003/04/01 02:06:06 thorpej Exp $ */
/*
* Copyright (c) 1996 Jonathan Stone.
* Copyright (c) 1994, 1996 Ludd, University of Lule}, Sweden.
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uba.c,v 1.64 2003/01/01 00:10:24 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: uba.c,v 1.65 2003/04/01 02:06:06 thorpej Exp $");
#include <sys/param.h>
#include <sys/time.h>
@ -156,7 +156,7 @@ ubmemalloc(struct uba_softc *uh, struct ubinfo *ui, int flags)
int waitok = (flags & UBA_CANTWAIT ? BUS_DMA_NOWAIT : BUS_DMA_WAITOK);
int error;
if ((error = bus_dmamem_alloc(uh->uh_dmat, ui->ui_size, NBPG, 0,
if ((error = bus_dmamem_alloc(uh->uh_dmat, ui->ui_size, PAGE_SIZE, 0,
&ui->ui_seg, 1, &ui->ui_rseg, waitok)))
return error;
if ((error = bus_dmamem_map(uh->uh_dmat, &ui->ui_seg, ui->ui_rseg,

View File

@ -1,4 +1,4 @@
/* $NetBSD: asc_tcds.c,v 1.9 2003/02/22 05:13:35 tsutsui Exp $ */
/* $NetBSD: asc_tcds.c,v 1.10 2003/04/01 02:07:13 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -67,13 +67,15 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: asc_tcds.c,v 1.9 2003/02/22 05:13:35 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: asc_tcds.c,v 1.10 2003/04/01 02:07:13 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/buf.h>
#include <uvm/uvm_extern.h>
#include <dev/scsipi/scsi_all.h>
#include <dev/scsipi/scsipi_all.h>
#include <dev/scsipi/scsiconf.h>
@ -148,7 +150,7 @@ asc_tcds_match(parent, cf, aux)
return 1;
}
#define DMAMAX(a) (NBPG - ((a) & (NBPG - 1)))
#define DMAMAX(a) (PAGE_SIZE - ((a) & (PAGE_SIZE - 1)))
/*
* Attach this instance, and then all the sub-devices
@ -179,8 +181,8 @@ asc_tcds_attach(parent, self, aux)
* to support 8k transfers.
*/
asc->sc_dmat = tcdsdev->tcdsda_dmat;
if ((error = bus_dmamap_create(asc->sc_dmat, NBPG, 1, NBPG,
NBPG, BUS_DMA_NOWAIT, &asc->sc_dmamap)) < 0) {
if ((error = bus_dmamap_create(asc->sc_dmat, PAGE_SIZE, 1, PAGE_SIZE,
PAGE_SIZE, BUS_DMA_NOWAIT, &asc->sc_dmamap)) < 0) {
printf("failed to create dma map, error = %d\n", error);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: xmi.c,v 1.4 2003/01/01 00:12:06 thorpej Exp $ */
/* $NetBSD: xmi.c,v 1.5 2003/04/01 02:08:01 thorpej Exp $ */
/*
* Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved.
@ -35,12 +35,14 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: xmi.c,v 1.4 2003/01/01 00:12:06 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: xmi.c,v 1.5 2003/04/01 02:08:01 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <uvm/uvm_extern.h>
#include <machine/bus.h>
#include <machine/cpu.h>
@ -105,13 +107,13 @@ xmi_attach(struct xmi_softc *sc)
*/
for (nodenr = 0; nodenr < NNODEXMI; nodenr++) {
if (bus_space_map(sc->sc_iot, sc->sc_addr + XMI_NODE(nodenr),
NBPG, 0, &xa.xa_ioh)) {
PAGE_SIZE, 0, &xa.xa_ioh)) {
printf("xmi_attach: bus_space_map failed, node %d\n",
nodenr);
return;
}
if (badaddr((caddr_t)xa.xa_ioh, 4)) {
bus_space_unmap(sc->sc_iot, xa.xa_ioh, NBPG);
bus_space_unmap(sc->sc_iot, xa.xa_ioh, PAGE_SIZE);
continue;
}
xa.xa_nodenr = nodenr;