From 95281cabaded672e1e6a03eecac95e7c6ff86e3a Mon Sep 17 00:00:00 2001 From: thorpej Date: Tue, 1 Apr 2003 23:19:08 +0000 Subject: [PATCH] Use PAGE_SIZE rather than NBPG. --- sys/arch/arm/arm32/arm32_machdep.c | 10 ++-- sys/arch/arm/arm32/bus_dma.c | 8 ++-- sys/arch/arm/arm32/mem.c | 14 +++--- sys/arch/arm/arm32/pmap.c | 50 ++++++++++---------- sys/arch/arm/arm32/stubs.c | 13 ++--- sys/arch/arm/arm32/vm_machdep.c | 10 ++-- sys/arch/arm/footbridge/footbridge_io.c | 8 ++-- sys/arch/arm/footbridge/footbridge_machdep.c | 6 +-- sys/arch/arm/iomd/beep.c | 14 +++--- sys/arch/arm/iomd/iomd_dma.c | 4 +- sys/arch/arm/iomd/lmcaudio.c | 26 +++++----- sys/arch/arm/iomd/vidc20config.c | 8 ++-- sys/arch/arm/iomd/vidcaudio.c | 24 +++++----- sys/arch/arm/ofw/ofwgencfg_machdep.c | 6 +-- sys/arch/arm/s3c2xx0/s3c2800_pci.c | 6 +-- sys/arch/arm/sa11x0/sa11x0.c | 6 ++- sys/arch/arm/xscale/pxa2x0_lcd.c | 9 ++-- 17 files changed, 114 insertions(+), 108 deletions(-) diff --git a/sys/arch/arm/arm32/arm32_machdep.c b/sys/arch/arm/arm32/arm32_machdep.c index dddde796e318..45f36c01ce4d 100644 --- a/sys/arch/arm/arm32/arm32_machdep.c +++ b/sys/arch/arm/arm32/arm32_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: arm32_machdep.c,v 1.28 2003/02/23 23:40:01 thorpej Exp $ */ +/* $NetBSD: arm32_machdep.c,v 1.29 2003/04/01 23:19:08 thorpej Exp $ */ /* * Copyright (c) 1994-1998 Mark Brinicombe. @@ -222,8 +222,8 @@ cpu_startup() /* msgbufphys was setup during the secondary boot strap */ for (loop = 0; loop < btoc(MSGBUFSIZE); ++loop) - pmap_kenter_pa((vaddr_t)msgbufaddr + loop * NBPG, - msgbufphys + loop * NBPG, VM_PROT_READ|VM_PROT_WRITE); + pmap_kenter_pa((vaddr_t)msgbufaddr + loop * PAGE_SIZE, + msgbufphys + loop * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE); pmap_update(pmap_kernel()); initmsgbuf(msgbufaddr, round_page(MSGBUFSIZE)); @@ -279,7 +279,7 @@ cpu_startup() * "base" pages for the rest. */ curbuf = (vaddr_t) buffers + (loop * MAXBSIZE); - curbufsize = NBPG * ((loop < residual) ? (base+1) : base); + curbufsize = PAGE_SIZE * ((loop < residual) ? (base+1) : base); while (curbufsize) { pg = uvm_pagealloc(NULL, 0, NULL, 0); @@ -315,7 +315,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); /* diff --git a/sys/arch/arm/arm32/bus_dma.c b/sys/arch/arm/arm32/bus_dma.c index 744bcbb755ec..45a003a606f0 100644 --- a/sys/arch/arm/arm32/bus_dma.c +++ b/sys/arch/arm/arm32/bus_dma.c @@ -1,4 +1,4 @@ -/* $NetBSD: bus_dma.c,v 1.26 2003/03/27 19:42:30 mycroft Exp $ */ +/* $NetBSD: bus_dma.c,v 1.27 2003/04/01 23:21:12 thorpej Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -692,7 +692,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) { #ifdef DEBUG_DMA printf("wiring p%lx to v%lx", addr, va); #endif /* DEBUG_DMA */ @@ -710,7 +710,7 @@ _bus_dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, * uncacheable. */ if (flags & BUS_DMA_COHERENT) { - cpu_dcache_wbinv_range(va, NBPG); + cpu_dcache_wbinv_range(va, PAGE_SIZE); cpu_drain_writebuf(); ptep = vtopte(va); *ptep &= ~L2_S_CACHE_MASK; @@ -879,7 +879,7 @@ _bus_dmamap_load_buffer(bus_dma_tag_t t, bus_dmamap_t map, void *buf, /* * 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; diff --git a/sys/arch/arm/arm32/mem.c b/sys/arch/arm/arm32/mem.c index 418ca49a44f5..56a3c3972d25 100644 --- a/sys/arch/arm/arm32/mem.c +++ b/sys/arch/arm/arm32/mem.c @@ -1,4 +1,4 @@ -/* $NetBSD: mem.c,v 1.8 2002/10/23 09:10:40 jdolecek Exp $ */ +/* $NetBSD: mem.c,v 1.9 2003/04/01 23:19:09 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -43,7 +43,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.8 2002/10/23 09:10:40 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.9 2003/04/01 23:19:09 thorpej Exp $"); #include #include @@ -114,10 +114,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)memhook + o, c, uio); pmap_remove(pmap_kernel(), (vaddr_t)memhook, - (vaddr_t)memhook + NBPG); + (vaddr_t)memhook + PAGE_SIZE); pmap_update(pmap_kernel()); break; @@ -142,10 +142,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; diff --git a/sys/arch/arm/arm32/pmap.c b/sys/arch/arm/arm32/pmap.c index 7b2f8e6a0c8c..5add0be11197 100644 --- a/sys/arch/arm/arm32/pmap.c +++ b/sys/arch/arm/arm32/pmap.c @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.129 2003/03/29 07:58:16 bsh Exp $ */ +/* $NetBSD: pmap.c,v 1.130 2003/04/01 23:19:09 thorpej Exp $ */ /* * Copyright (c) 2002 Wasabi Systems, Inc. @@ -144,7 +144,7 @@ #include #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.129 2003/03/29 07:58:16 bsh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.130 2003/04/01 23:19:09 thorpej Exp $"); #ifdef PMAP_DEBUG #define PDEBUG(_lev_,_stat_) \ @@ -383,7 +383,7 @@ struct pv_page_info { * (note: won't work on systems where NPBG isn't a constant) */ -#define PVE_PER_PVPAGE ((NBPG - sizeof(struct pv_page_info)) / \ +#define PVE_PER_PVPAGE ((PAGE_SIZE - sizeof(struct pv_page_info)) / \ sizeof(struct pv_entry)) /* @@ -1091,7 +1091,7 @@ pmap_init(void) * the memory that is useable in a user process. */ avail_start = 0; - avail_end = physmem * NBPG; + avail_end = physmem * PAGE_SIZE; /* * now we need to free enough pv_entry structures to allow us to get @@ -1250,7 +1250,7 @@ pmap_alloc_l1pt(void) pmap_kenter_pa(va, pa, VM_PROT_READ|VM_PROT_WRITE); - va += NBPG; + va += PAGE_SIZE; m = m->pageq.tqe_next; } @@ -1586,7 +1586,7 @@ pmap_destroy(struct pmap *pmap) if (vector_page < KERNEL_BASE) { /* Remove the vector page mapping */ - pmap_remove(pmap, vector_page, vector_page + NBPG); + pmap_remove(pmap, vector_page, vector_page + PAGE_SIZE); pmap_update(pmap); } @@ -1773,7 +1773,7 @@ pmap_clean_page(struct pv_entry *pv, boolean_t is_src) * XXX not invalidate, too. Investigate further. * XXX --thorpej@netbsd.org */ - cpu_idcache_wbinv_range(page_to_clean, NBPG); + cpu_idcache_wbinv_range(page_to_clean, PAGE_SIZE); } else if (cache_needs_cleaning) { cpu_idcache_wbinv_all(); return (1); @@ -1812,7 +1812,7 @@ pmap_zero_page_generic(paddr_t phys) cpu_tlb_flushD_SE(cdstp); cpu_cpwait(); bzero_page(cdstp); - cpu_dcache_wbinv_range(cdstp, NBPG); + cpu_dcache_wbinv_range(cdstp, PAGE_SIZE); } #endif /* ARM_MMU_GENERIC == 1 */ @@ -1877,7 +1877,7 @@ pmap_pageidlezero(paddr_t phys) cpu_cpwait(); for (i = 0, ptr = (int *)cdstp; - i < (NBPG / sizeof(int)); i++) { + i < (PAGE_SIZE / sizeof(int)); i++) { if (sched_whichqs != 0) { /* * A process has become ready. Abort now, @@ -1896,7 +1896,7 @@ pmap_pageidlezero(paddr_t phys) * if we aborted we'll rezero this page again later so don't * purge it unless we finished it */ - cpu_dcache_wbinv_range(cdstp, NBPG); + cpu_dcache_wbinv_range(cdstp, PAGE_SIZE); return (rv); } @@ -1945,9 +1945,9 @@ pmap_copy_page_generic(paddr_t src, paddr_t dst) cpu_tlb_flushD_SE(cdstp); cpu_cpwait(); bcopy_page(csrcp, cdstp); - cpu_dcache_inv_range(csrcp, NBPG); + cpu_dcache_inv_range(csrcp, PAGE_SIZE); simple_unlock(&src_pg->mdpage.pvh_slock); /* cache is safe again */ - cpu_dcache_wbinv_range(cdstp, NBPG); + cpu_dcache_wbinv_range(cdstp, PAGE_SIZE); } #endif /* ARM_MMU_GENERIC == 1 */ @@ -2265,7 +2265,7 @@ pmap_vac_me_user(struct pmap *pmap, struct vm_page *pg, pt_entry_t *ptes, (npv->pv_pmap == kpmap && !clear_cache && kern_cacheable < 4)) { cpu_idcache_wbinv_range(npv->pv_va, - NBPG); + PAGE_SIZE); cpu_tlb_flushID_SE(npv->pv_va); } } @@ -2450,7 +2450,7 @@ pmap_remove(struct pmap *pmap, vaddr_t sva, vaddr_t eva) } } else if (pmap_active == 0) PTE_FLUSH(pte); - sva += NBPG; + sva += PAGE_SIZE; pte++; } @@ -2464,7 +2464,7 @@ pmap_remove(struct pmap *pmap, vaddr_t sva, vaddr_t eva) for (cnt = 0; cnt < cleanlist_idx; cnt++) { if (pmap_active) { cpu_idcache_wbinv_range(cleanlist[cnt].va, - NBPG); + PAGE_SIZE); *cleanlist[cnt].pte = 0; cpu_tlb_flushID_SE(cleanlist[cnt].va); PTE_SYNC(cleanlist[cnt].pte); @@ -2654,7 +2654,7 @@ pmap_protect(struct pmap *pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot) } next: - sva += NBPG; + sva += PAGE_SIZE; pte++; } pmap_unmap_ptes(pmap); @@ -2761,7 +2761,7 @@ pmap_enter(struct pmap *pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, (prot & VM_PROT_WRITE) == 0) { /* Yup, flush the cache if current pmap. */ if (pmap_is_curpmap(pmap)) - cpu_dcache_wb_range(va, NBPG); + cpu_dcache_wb_range(va, PAGE_SIZE); } /* Has the wiring changed ? */ @@ -2775,7 +2775,7 @@ pmap_enter(struct pmap *pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, struct vm_page *opg; /* We are replacing the page with a new one. */ - cpu_idcache_wbinv_range(va, NBPG); + cpu_idcache_wbinv_range(va, PAGE_SIZE); /* * If it is part of our managed memory then we @@ -3286,7 +3286,7 @@ pmap_clearbit(struct vm_page *pg, u_int maskbits) * current if it is flush it, * otherwise it won't be in the cache */ - cpu_idcache_wbinv_range(pv->pv_va, NBPG); + cpu_idcache_wbinv_range(pv->pv_va, PAGE_SIZE); } /* make the pte read only */ @@ -3304,12 +3304,12 @@ pmap_clearbit(struct vm_page *pg, u_int maskbits) */ if (npte & L2_S_PROT_W) { cpu_idcache_wbinv_range(pv->pv_va, - NBPG); + PAGE_SIZE); } else if ((npte & L2_TYPE_MASK) != L2_TYPE_INV) { /* XXXJRT need idcache_inv_range */ cpu_idcache_wbinv_range(pv->pv_va, - NBPG); + PAGE_SIZE); } } @@ -3843,7 +3843,7 @@ pmap_map_chunk(vaddr_t l1pt, vaddr_t va, paddr_t pa, vsize_t size, vsize_t resid; u_int i; - resid = (size + (NBPG - 1)) & ~(NBPG - 1); + resid = (size + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1); if (l1pt == 0) panic("pmap_map_chunk: no L1 table provided"); @@ -3910,9 +3910,9 @@ pmap_map_chunk(vaddr_t l1pt, vaddr_t va, paddr_t pa, vsize_t size, #endif pte[(va >> PGSHIFT) & 0x3ff] = L2_S_PROTO | pa | L2_S_PROT(PTE_KERNEL, prot) | fl; - va += NBPG; - pa += NBPG; - resid -= NBPG; + va += PAGE_SIZE; + pa += PAGE_SIZE; + resid -= PAGE_SIZE; } #ifdef VERBOSE_INIT_ARM printf("\n"); diff --git a/sys/arch/arm/arm32/stubs.c b/sys/arch/arm/arm32/stubs.c index c30da3fdf1fb..42b0794d85a5 100644 --- a/sys/arch/arm/arm32/stubs.c +++ b/sys/arch/arm/arm32/stubs.c @@ -1,4 +1,4 @@ -/* $NetBSD: stubs.c,v 1.12 2003/03/23 15:49:25 chris Exp $ */ +/* $NetBSD: stubs.c,v 1.13 2003/04/01 23:19:09 thorpej Exp $ */ /* * Copyright (c) 1994-1998 Mark Brinicombe. @@ -163,19 +163,20 @@ dumpsys() for (block = 0; block < bootconfig.dramblocks && error == 0; ++block) { addr = bootconfig.dram[block].address; for (;addr < (bootconfig.dram[block].address - + (bootconfig.dram[block].pages * NBPG)); addr += NBPG) { + + (bootconfig.dram[block].pages * PAGE_SIZE)); + addr += PAGE_SIZE) { if ((len % (1024*1024)) == 0) printf("%d ", len / (1024*1024)); pmap_kenter_pa(dumpspace, addr, VM_PROT_READ); pmap_update(pmap_kernel()); error = (*bdev->d_dump)(dumpdev, - blkno, (caddr_t) dumpspace, NBPG); - pmap_kremove(dumpspace, NBPG); + blkno, (caddr_t) dumpspace, PAGE_SIZE); + pmap_kremove(dumpspace, PAGE_SIZE); pmap_update(pmap_kernel()); if (error) break; - blkno += btodb(NBPG); - len += NBPG; + blkno += btodb(PAGE_SIZE); + len += PAGE_SIZE; } } diff --git a/sys/arch/arm/arm32/vm_machdep.c b/sys/arch/arm/arm32/vm_machdep.c index 2d5f78d3c54d..f9e018cd2115 100644 --- a/sys/arch/arm/arm32/vm_machdep.c +++ b/sys/arch/arm/arm32/vm_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: vm_machdep.c,v 1.24 2003/01/17 22:28:49 thorpej Exp $ */ +/* $NetBSD: vm_machdep.c,v 1.25 2003/04/01 23:19:09 thorpej Exp $ */ /* * Copyright (c) 1994-1998 Mark Brinicombe. @@ -297,7 +297,7 @@ cpu_swapout(l) if (vector_page < KERNEL_BASE) { /* Free the system page mapping */ pmap_remove(p->p_vmspace->vm_map.pmap, vector_page, - vector_page + NBPG); + vector_page + PAGE_SIZE); pmap_update(p->p_vmspace->vm_map.pmap); } #endif @@ -307,7 +307,7 @@ cpu_swapout(l) /* * 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 @@ -318,7 +318,7 @@ pagemove(from, to, size) pt_entry_t *fpte, *tpte; size_t ptecnt = size >> PAGE_SHIFT; - if (size % NBPG) + if (size % PAGE_SIZE) panic("pagemove: size=%08lx", (u_long) size); #ifdef PMAP_DEBUG @@ -342,7 +342,7 @@ pagemove(from, to, size) while (size > 0) { *tpte++ = *fpte; *fpte++ = 0; - size -= NBPG; + size -= PAGE_SIZE; } PTE_SYNC_RANGE(vtopte((vaddr_t)from), ptecnt); PTE_SYNC_RANGE(vtopte((vaddr_t)to), ptecnt); diff --git a/sys/arch/arm/footbridge/footbridge_io.c b/sys/arch/arm/footbridge/footbridge_io.c index f4d6b9b2763f..8459d5ead242 100644 --- a/sys/arch/arm/footbridge/footbridge_io.c +++ b/sys/arch/arm/footbridge/footbridge_io.c @@ -1,4 +1,4 @@ -/* $NetBSD: footbridge_io.c,v 1.8 2003/03/23 14:12:25 chris Exp $ */ +/* $NetBSD: footbridge_io.c,v 1.9 2003/04/01 23:19:10 thorpej Exp $ */ /* * Copyright (c) 1997 Causality Limited @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: footbridge_io.c,v 1.8 2003/03/23 14:12:25 chris Exp $"); +__KERNEL_RCSID(0, "$NetBSD: footbridge_io.c,v 1.9 2003/04/01 23:19:10 thorpej Exp $"); #include #include @@ -220,8 +220,8 @@ footbridge_mem_bs_map(t, bpa, size, cacheable, bshp) while (startpa < endpa) { pmap_enter(pmap_kernel(), va, (bus_addr_t)t + startpa, VM_PROT_READ | VM_PROT_WRITE, 0); - va += NBPG; - startpa += NBPG; + va += PAGE_SIZE; + startpa += PAGE_SIZE; } pmap_update(pmap_kernel()); diff --git a/sys/arch/arm/footbridge/footbridge_machdep.c b/sys/arch/arm/footbridge/footbridge_machdep.c index 2841ef7b92b2..0db245522a5f 100644 --- a/sys/arch/arm/footbridge/footbridge_machdep.c +++ b/sys/arch/arm/footbridge/footbridge_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: footbridge_machdep.c,v 1.9 2003/03/23 14:12:25 chris Exp $ */ +/* $NetBSD: footbridge_machdep.c,v 1.10 2003/04/01 23:19:10 thorpej Exp $ */ /* * Copyright (c) 1997 Mark Brinicombe. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: footbridge_machdep.c,v 1.9 2003/03/23 14:12:25 chris Exp $"); +__KERNEL_RCSID(0, "$NetBSD: footbridge_machdep.c,v 1.10 2003/04/01 23:19:10 thorpej Exp $"); #include #include @@ -64,5 +64,5 @@ void footbridge_sa110_cc_setup(void) { sa1_cache_clean_addr = DC21285_CACHE_FLUSH_VBASE; - sa1_cache_clean_size = (NBPG * 4); + sa1_cache_clean_size = (PAGE_SIZE * 4); } diff --git a/sys/arch/arm/iomd/beep.c b/sys/arch/arm/iomd/beep.c index 1208a17cc1d4..b349e49419b3 100644 --- a/sys/arch/arm/iomd/beep.c +++ b/sys/arch/arm/iomd/beep.c @@ -1,4 +1,4 @@ -/* $NetBSD: beep.c,v 1.16 2002/10/23 09:10:42 jdolecek Exp $ */ +/* $NetBSD: beep.c,v 1.17 2003/04/01 23:19:10 thorpej Exp $ */ /* * Copyright (c) 1995 Mark Brinicombe @@ -42,7 +42,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: beep.c,v 1.16 2002/10/23 09:10:42 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: beep.c,v 1.17 2003/04/01 23:19:10 thorpej Exp $"); #include #include @@ -135,19 +135,19 @@ beepattach(struct device *parent, struct device *self, void *aux) sc->sc_open = 0; sc->sc_count = 0; - sc->sc_buffer0 = uvm_km_zalloc(kernel_map, NBPG); + sc->sc_buffer0 = uvm_km_zalloc(kernel_map, PAGE_SIZE); if (sc->sc_buffer0 == 0) panic("beep: Cannot allocate buffer memory"); - if ((sc->sc_buffer0 & (NBPG -1)) != 0) + if ((sc->sc_buffer0 & (PAGE_SIZE -1)) != 0) panic("beep: Cannot allocate page aligned buffer"); sc->sc_buffer1 = sc->sc_buffer0; (void) pmap_extract(pmap_kernel(), (vaddr_t)sc->sc_buffer0, (paddr_t *)&sc->sc_sound_cur0); - sc->sc_sound_end0 = (sc->sc_sound_cur0 + NBPG - 16) | 0x00000000; + sc->sc_sound_end0 = (sc->sc_sound_cur0 + PAGE_SIZE - 16) | 0x00000000; (void) pmap_extract(pmap_kernel(), (vaddr_t)sc->sc_buffer1, (paddr_t *)&sc->sc_sound_cur1); - sc->sc_sound_end1 = (sc->sc_sound_cur1 + NBPG - 16) | 0x00000000; + sc->sc_sound_end1 = (sc->sc_sound_cur1 + PAGE_SIZE - 16) | 0x00000000; bcopy(beep_waveform, (void *)sc->sc_buffer0, sizeof(beep_waveform)); @@ -284,7 +284,7 @@ beepioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) case BEEP_SET: /* printf("set %08x\n", (u_int)data); printf("set %08x %08x\n", (u_int)wave->addr, wave->size);*/ - if (wave->size < 16 || wave->size > NBPG) + if (wave->size < 16 || wave->size > PAGE_SIZE) return(ENXIO); copyin(wave->addr, (char *)sc->sc_buffer0, wave->size); sc->sc_sound_end0 = (sc->sc_sound_cur0 + wave->size - 16); diff --git a/sys/arch/arm/iomd/iomd_dma.c b/sys/arch/arm/iomd/iomd_dma.c index 40f47d1a4cbb..da77eddf9ed8 100644 --- a/sys/arch/arm/iomd/iomd_dma.c +++ b/sys/arch/arm/iomd/iomd_dma.c @@ -1,4 +1,4 @@ -/* $NetBSD: iomd_dma.c,v 1.6 2002/09/27 15:35:45 provos Exp $ */ +/* $NetBSD: iomd_dma.c,v 1.7 2003/04/01 23:19:10 thorpej Exp $ */ /* * Copyright (c) 1995 Scott Stevens @@ -206,7 +206,7 @@ fill: #endif if (dp->dc_len == 0) goto done; PHYS(dp->dc_nextaddr, &cur); - len = NBPG - (cur & PGOFSET); + len = PAGE_SIZE - (cur & PGOFSET); if (len > dp->dc_len) { /* Last buffer */ len = dp->dc_len; diff --git a/sys/arch/arm/iomd/lmcaudio.c b/sys/arch/arm/iomd/lmcaudio.c index 178fa2cbf666..1a61d6d3933a 100644 --- a/sys/arch/arm/iomd/lmcaudio.c +++ b/sys/arch/arm/iomd/lmcaudio.c @@ -1,4 +1,4 @@ -/* $NetBSD: lmcaudio.c,v 1.10 2002/10/02 15:45:12 thorpej Exp $ */ +/* $NetBSD: lmcaudio.c,v 1.11 2003/04/01 23:19:10 thorpej Exp $ */ /* * Copyright (c) 1996, Danny C Tsen. @@ -235,11 +235,11 @@ lmcaudio_attach(parent, self, aux) /* Program the silence buffer and reset the DMA channel */ - ag.silence = uvm_km_alloc(kernel_map, NBPG); - ag.beep = uvm_km_zalloc(kernel_map, NBPG); + ag.silence = uvm_km_alloc(kernel_map, PAGE_SIZE); + ag.beep = uvm_km_zalloc(kernel_map, PAGE_SIZE); if (ag.silence == NULL || ag.beep == NULL) panic("lmcaudio: Cannot allocate memory"); - memset((char *)ag.silence, 0, NBPG); + memset((char *)ag.silence, 0, PAGE_SIZE); memcpy((char *)ag.beep, (char *)beep_waveform, sizeof(beep_waveform)); conv_jap((u_char *)ag.beep, sizeof(beep_waveform)); @@ -381,14 +381,14 @@ lmcaudio_round_blocksize(addr, blk) int blk; { - if (blk > NBPG) - blk = NBPG; + if (blk > PAGE_SIZE) + blk = PAGE_SIZE; else if (blk & 0x0f) /* quad word */ blk &= ~0x0f; return (blk); } -#define ROUND(s) ( ((int)s) & (~(NBPG-1)) ) +#define ROUND(s) ( ((int)s) & (~(PAGE_SIZE-1)) ) int lmcaudio_start_output(addr, p, cc, intr, arg) @@ -406,10 +406,10 @@ lmcaudio_start_output(addr, p, cc, intr, arg) /* * Not on quad word boundary. */ - memcpy((char *)ag.silence, p, (cc > NBPG ? NBPG : cc)); + memcpy((char *)ag.silence, p, (cc > PAGE_SIZE ? PAGE_SIZE : cc)); p = (void *)ag.silence; - if (cc > NBPG) { - cc = NBPG; + if (cc > PAGE_SIZE) { + cc = PAGE_SIZE; } } lmcaudio_dma_program((vaddr_t)p, (vaddr_t)(p+cc), intr, arg); @@ -609,12 +609,12 @@ lmcaudio_shutdown() printf ( "lmcaudio: stop output\n" ); #endif - memset((char *)ag.silence, 0, NBPG); + memset((char *)ag.silence, 0, PAGE_SIZE); PHYS(ag.silence, &pa); IOMD_WRITE_WORD(IOMD_SD0CURA, pa); - IOMD_WRITE_WORD(IOMD_SD0ENDA, (pa + NBPG - 16) | 0x80000000); + IOMD_WRITE_WORD(IOMD_SD0ENDA, (pa + PAGE_SIZE - 16) | 0x80000000); disable_irq(sdma_channel); IOMD_WRITE_WORD(IOMD_SD0CR, 0x90); /* Reset State Machine */ } @@ -702,7 +702,7 @@ lmcaudio_intr(arg) ag.arg = NULL; } if (ag.drain == 1) { - lmcaudio_dma_program(ag.silence, ag.silence+NBPG, + lmcaudio_dma_program(ag.silence, ag.silence+PAGE_SIZE, lmcaudio_dummy_routine, NULL); } return 0; diff --git a/sys/arch/arm/iomd/vidc20config.c b/sys/arch/arm/iomd/vidc20config.c index 58c313961bd9..b88744f526e0 100644 --- a/sys/arch/arm/iomd/vidc20config.c +++ b/sys/arch/arm/iomd/vidc20config.c @@ -1,4 +1,4 @@ -/* $NetBSD: vidc20config.c,v 1.15 2002/10/01 12:09:49 reinoud Exp $ */ +/* $NetBSD: vidc20config.c,v 1.16 2003/04/01 23:19:10 thorpej Exp $ */ /* * Copyright (c) 2001 Reinoud Zandijk @@ -48,7 +48,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: vidc20config.c,v 1.15 2002/10/01 12:09:49 reinoud Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vidc20config.c,v 1.16 2003/04/01 23:19:10 thorpej Exp $"); #include #include @@ -320,7 +320,7 @@ vidcvideo_coldinit(void) dispsize = videomemory.vidm_size; transfersize = 16; } else { - dispsize = bootconfig.vram[0].pages * NBPG; + dispsize = bootconfig.vram[0].pages * PAGE_SIZE; transfersize = dispsize >> 10; }; @@ -581,7 +581,7 @@ vidcvideo_cursor_init(int width, int height) if (!cursor_data) { /* Allocate cursor memory first time round */ - cursor_data = (char *)uvm_km_zalloc(kernel_map, NBPG); + cursor_data = (char *)uvm_km_zalloc(kernel_map, PAGE_SIZE); if (!cursor_data) panic("Cannot allocate memory for hardware cursor"); (void) pmap_extract(pmap_kernel(), (vaddr_t)cursor_data, &pa); diff --git a/sys/arch/arm/iomd/vidcaudio.c b/sys/arch/arm/iomd/vidcaudio.c index 1140ab4673ff..f55cc861d44a 100644 --- a/sys/arch/arm/iomd/vidcaudio.c +++ b/sys/arch/arm/iomd/vidcaudio.c @@ -1,4 +1,4 @@ -/* $NetBSD: vidcaudio.c,v 1.13 2002/10/02 15:45:13 thorpej Exp $ */ +/* $NetBSD: vidcaudio.c,v 1.14 2003/04/01 23:19:11 thorpej Exp $ */ /* * Copyright (c) 1995 Melvin Tang-Richardson @@ -38,7 +38,7 @@ #include /* proc.h */ -__KERNEL_RCSID(0, "$NetBSD: vidcaudio.c,v 1.13 2002/10/02 15:45:13 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vidcaudio.c,v 1.14 2003/04/01 23:19:11 thorpej Exp $"); #include /* autoconfig functions */ #include /* device calls */ @@ -216,11 +216,11 @@ vidcaudio_attach(parent, self, aux) vidcaudio_rate(32); /* 24*1024*/ /* Program the silence buffer and reset the DMA channel */ - ag.silence = uvm_km_alloc(kernel_map, NBPG); + ag.silence = uvm_km_alloc(kernel_map, PAGE_SIZE); if (ag.silence == NULL) panic("vidcaudio: Cannot allocate memory"); - memset((char *)ag.silence, 0, NBPG); + memset((char *)ag.silence, 0, PAGE_SIZE); memcpy((char *)ag.silence, (char *)beep_waveform, sizeof(beep_waveform)); ag.buffer = 0; @@ -255,7 +255,7 @@ vidcaudio_attach(parent, self, aux) printf("\n"); - vidcaudio_dma_program(ag.silence, ag.silence+NBPG-16, + vidcaudio_dma_program(ag.silence, ag.silence+PAGE_SIZE-16, vidcaudio_dummy_routine, NULL); audio_attach_mi(&vidcaudio_hw_if, sc, &sc->device); @@ -343,12 +343,12 @@ vidcaudio_round_blocksize(addr, blk) void *addr; int blk; { - if (blk > NBPG) - blk = NBPG; + if (blk > PAGE_SIZE) + blk = PAGE_SIZE; return (blk); } -#define ROUND(s) ( ((int)s) & (~(NBPG-1)) ) +#define ROUND(s) ( ((int)s) & (~(PAGE_SIZE-1)) ) int vidcaudio_start_output(addr, p, cc, intr, arg) @@ -374,7 +374,7 @@ vidcaudio_start_output(addr, p, cc, intr, arg) printf("vidcaudio: DMA over page boundary requested." " Fixing up\n"); #endif - memcpy(p, (char *)ag.silence, cc > NBPG ? NBPG : cc); + memcpy(p, (char *)ag.silence, cc > PAGE_SIZE ? PAGE_SIZE : cc); p = (void *)ag.silence; /* @@ -386,9 +386,9 @@ vidcaudio_start_output(addr, p, cc, intr, arg) * truncate the buffer and tell the user. */ - if (cc > NBPG) { + if (cc > PAGE_SIZE) { printf("vidcaudio: DMA buffer truncated. I could fix this up\n"); - cc = NBPG; + cc = PAGE_SIZE; } } vidcaudio_dma_program((vaddr_t)p, (vaddr_t)((char *)p+cc), @@ -595,7 +595,7 @@ vidcaudio_shutdown(void) printf("vidcaudio: stop output\n"); #endif IOMD_WRITE_WORD(IOMD_SD0CURB, ag.silence); - IOMD_WRITE_WORD(IOMD_SD0ENDB, (ag.silence + NBPG - 16) | (1<<30)); + IOMD_WRITE_WORD(IOMD_SD0ENDB, (ag.silence + PAGE_SIZE - 16) | (1<<30)); disable_irq(sound_dma_intr); } diff --git a/sys/arch/arm/ofw/ofwgencfg_machdep.c b/sys/arch/arm/ofw/ofwgencfg_machdep.c index 6fd1fd599feb..6d4992cc7b9a 100644 --- a/sys/arch/arm/ofw/ofwgencfg_machdep.c +++ b/sys/arch/arm/ofw/ofwgencfg_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: ofwgencfg_machdep.c,v 1.4 2002/10/02 05:02:31 thorpej Exp $ */ +/* $NetBSD: ofwgencfg_machdep.c,v 1.5 2003/04/01 23:19:11 thorpej Exp $ */ /* * Copyright 1997 @@ -174,8 +174,8 @@ initarm(ofw_handle) * this routine. All we need to do is prepare for abort-handling * and undefined exceptions. */ - set_stackptr(PSR_UND32_MODE, undstack.pv_va + NBPG); - set_stackptr(PSR_ABT32_MODE, abtstack.pv_va + NBPG); + set_stackptr(PSR_UND32_MODE, undstack.pv_va + PAGE_SIZE); + set_stackptr(PSR_ABT32_MODE, abtstack.pv_va + PAGE_SIZE); /* Set-up exception handlers. * Take control of selected vectors from OFW. diff --git a/sys/arch/arm/s3c2xx0/s3c2800_pci.c b/sys/arch/arm/s3c2xx0/s3c2800_pci.c index 2a5e8ed11c49..0d052328de0b 100644 --- a/sys/arch/arm/s3c2xx0/s3c2800_pci.c +++ b/sys/arch/arm/s3c2xx0/s3c2800_pci.c @@ -1,4 +1,4 @@ -/* $NetBSD: s3c2800_pci.c,v 1.2 2003/01/01 00:46:15 thorpej Exp $ */ +/* $NetBSD: s3c2800_pci.c,v 1.3 2003/04/01 23:19:11 thorpej Exp $ */ /* * Copyright (c) 2002 Fujitsu Component Limited @@ -382,8 +382,8 @@ sspci_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flag, * want. */ pmap_enter(pmap_kernel(), va, (bus_addr_t) t + startpa, VM_PROT_READ | VM_PROT_WRITE, 0); - va += NBPG; - startpa += NBPG; + va += PAGE_SIZE; + startpa += PAGE_SIZE; } pmap_update(pmap_kernel()); diff --git a/sys/arch/arm/sa11x0/sa11x0.c b/sys/arch/arm/sa11x0/sa11x0.c index 7cc2775f36bd..d693f9283b0b 100644 --- a/sys/arch/arm/sa11x0/sa11x0.c +++ b/sys/arch/arm/sa11x0/sa11x0.c @@ -1,4 +1,4 @@ -/* $NetBSD: sa11x0.c,v 1.10 2003/01/01 00:46:15 thorpej Exp $ */ +/* $NetBSD: sa11x0.c,v 1.11 2003/04/01 23:19:11 thorpej Exp $ */ /*- * Copyright (c) 2001, The NetBSD Foundation, Inc. All rights reserved. @@ -61,6 +61,8 @@ #include #include +#include + #include #include @@ -164,7 +166,7 @@ sa11x0_attach(parent, self, aux) panic("%s: unable to map DMAC registers", self->dv_xname); /* Map the reset controller registers */ - if (bus_space_map(sc->sc_iot, SARCR_BASE, NBPG, + if (bus_space_map(sc->sc_iot, SARCR_BASE, PAGE_SIZE, 0, &sc->sc_reseth)) panic("%s: unable to map reset registers", self->dv_xname); diff --git a/sys/arch/arm/xscale/pxa2x0_lcd.c b/sys/arch/arm/xscale/pxa2x0_lcd.c index 9ee29fa9e232..18096b498b30 100644 --- a/sys/arch/arm/xscale/pxa2x0_lcd.c +++ b/sys/arch/arm/xscale/pxa2x0_lcd.c @@ -1,4 +1,4 @@ -/* $Id: pxa2x0_lcd.c,v 1.1 2002/10/19 19:31:40 bsh Exp $ */ +/* $Id: pxa2x0_lcd.c,v 1.2 2003/04/01 23:19:12 thorpej Exp $ */ /* * Copyright (c) 2002 Genetec Corporation. All rights reserved. @@ -43,6 +43,8 @@ #include #include /* for cold */ +#include + #include #include #include @@ -413,11 +415,12 @@ pxa2x0_lcd_new_screen( struct pxa2x0_lcd_softc *sc, } buf_pa = scr->segs[0].ds_addr; - desc_pa = buf_pa + roundup(size, NBPG) - 3*sizeof *desc; + desc_pa = buf_pa + roundup(size, PAGE_SIZE) - 3*sizeof *desc; /* make descriptors at the top of mapped memory */ desc = (struct lcd_dma_descriptor *)( - (caddr_t)(scr->buf_va) + roundup(size, NBPG) - 3*sizeof *desc); + (caddr_t)(scr->buf_va) + roundup(size, PAGE_SIZE) - + 3*sizeof *desc); desc[0].fdadr = desc_pa; desc[0].fsadr = buf_pa;