diff --git a/sys/arch/sun2/dev/if_ie_obio.c b/sys/arch/sun2/dev/if_ie_obio.c index 4277ec15596f..9cb5d5fb7271 100644 --- a/sys/arch/sun2/dev/if_ie_obio.c +++ b/sys/arch/sun2/dev/if_ie_obio.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ie_obio.c,v 1.5 2002/10/02 16:02:22 thorpej Exp $ */ +/* $NetBSD: if_ie_obio.c,v 1.6 2003/04/01 15:48:40 thorpej Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -371,13 +371,13 @@ ie_obio_attach(parent, self, aux) * (a side-effect of this double-map is that the ISCP and SCB * structures also get aliased there, but we ignore this). The * first page at `maddr' is only used for ISCP, SCB and the aliased - * SCP; the actual buffers start at maddr+NBPG. + * SCP; the actual buffers start at maddr+PAGE_SIZE. * * In a picture: |---//--- ISCP-SCB-----scp-|--//- buffers -//-|... |iscp-scb-----SCP-| | | | | | | | - | |<----- NBPG --->| | |<----- NBPG -+-->| + | |<---PAGE_SIZE-->| | |<--PAGE_SIZE-+-->| | |<------------- msize ------------->| | ^ | | | | | | \@maddr (last page dbl mapped) @@ -415,8 +415,8 @@ ie_obio_attach(parent, self, aux) * Rest of first page is unused (wasted!); the other pages * are used for buffers. */ - sc->buf_area = NBPG; - sc->buf_area_sz = msize - NBPG; + sc->buf_area = PAGE_SIZE; + sc->buf_area_sz = msize - PAGE_SIZE; if (i82586_proberam(sc) == 0) { printf(": memory probe failed\n"); diff --git a/sys/arch/sun2/sun2/db_machdep.c b/sys/arch/sun2/sun2/db_machdep.c index 355e712ee41b..c2b63c631c61 100644 --- a/sys/arch/sun2/sun2/db_machdep.c +++ b/sys/arch/sun2/sun2/db_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_machdep.c,v 1.2 2001/06/11 21:35:59 fredette Exp $ */ +/* $NetBSD: db_machdep.c,v 1.3 2003/04/01 15:47:48 thorpej Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -43,6 +43,8 @@ #include #include +#include + #include #include #include @@ -125,7 +127,7 @@ db_mach_pagemap(addr, have_addr, count, modif) db_printf("0x%08lx [%02x] 0x%08x", va, sme, pte); pte_print(pte); - db_next = va + NBPG; + db_next = va + PAGE_SIZE; } static void diff --git a/sys/arch/sun2/sun2/idprom.c b/sys/arch/sun2/sun2/idprom.c index 1908ede18c61..4e12e247b988 100644 --- a/sys/arch/sun2/sun2/idprom.c +++ b/sys/arch/sun2/sun2/idprom.c @@ -1,4 +1,4 @@ -/* $NetBSD: idprom.c,v 1.2 2001/11/30 18:06:55 fredette Exp $ */ +/* $NetBSD: idprom.c,v 1.3 2003/04/01 15:47:48 thorpej Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -45,6 +45,8 @@ #include #include +#include + #include #include @@ -143,7 +145,7 @@ idprom_get(dst) len = IDPROM_SIZE; do { x = get_control_byte(src); - src += NBPG; + src += PAGE_SIZE; *dst++ = x; } while (--len > 0); } diff --git a/sys/arch/sun2/sun2/locore2.c b/sys/arch/sun2/sun2/locore2.c index 827fe5c996b7..3e6697a0014c 100644 --- a/sys/arch/sun2/sun2/locore2.c +++ b/sys/arch/sun2/sun2/locore2.c @@ -1,4 +1,4 @@ -/* $NetBSD: locore2.c,v 1.8 2003/01/18 06:58:34 thorpej Exp $ */ +/* $NetBSD: locore2.c,v 1.9 2003/04/01 15:47:48 thorpej Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -289,7 +289,7 @@ _bootstrap() /* * Now unmap the PROM's physical/virtual pages zero through three. */ - for(va = 0; va < NBPG * 4; va += NBPG) + for(va = 0; va < PAGE_SIZE * 4; va += PAGE_SIZE) set_pte(va, PG_INVAL); /* diff --git a/sys/arch/sun2/sun2/machdep.c b/sys/arch/sun2/sun2/machdep.c index 6e7f2d9cda8f..ea3643a34f62 100644 --- a/sys/arch/sun2/sun2/machdep.c +++ b/sys/arch/sun2/sun2/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.21 2003/01/18 06:58:34 thorpej Exp $ */ +/* $NetBSD: machdep.c,v 1.22 2003/04/01 15:47:48 thorpej Exp $ */ /* * Copyright (c) 2001 Matthew Fredette. @@ -260,7 +260,7 @@ cpu_startup() * Its mapping was prepared in pmap_bootstrap(). * Also, offset some to avoid PROM scribbles. */ - v = (caddr_t) (NBPG * 4); + v = (caddr_t) (PAGE_SIZE * 4); msgbufaddr = (caddr_t)(v + MSGBUFOFF); initmsgbuf(msgbufaddr, MSGBUFSIZE); @@ -299,7 +299,7 @@ cpu_startup() /* * Get scratch page for dumpsys(). */ - if ((dumppage = uvm_km_alloc(kernel_map, NBPG)) == 0) + if ((dumppage = uvm_km_alloc(kernel_map, PAGE_SIZE)) == 0) panic("startup: alloc dumppage"); /* @@ -341,7 +341,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); @@ -378,7 +378,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); /* @@ -386,7 +386,7 @@ cpu_startup() * This page is handed to pmap_enter() therefore * it has to be in the normal kernel VA range. */ - vmmap = uvm_km_valloc_wait(kernel_map, NBPG); + vmmap = uvm_km_valloc_wait(kernel_map, PAGE_SIZE); /* * Allocate dma map for devices on the bus. @@ -625,7 +625,7 @@ long dumplo = 0; /* blocks */ /* * This is called by main to set dumplo, 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. @@ -678,8 +678,8 @@ extern paddr_t avail_start; * Write a crash dump. The format while in swap is: * kcore_seg_t cpu_hdr; * cpu_kcore_hdr_t cpu_data; - * padding (NBPG-sizeof(kcore_seg_t)) - * pagemap (2*NBPG) + * padding (PAGE_SIZE-sizeof(kcore_seg_t)) + * pagemap (2*PAGE_SIZE) * physical memory... */ void @@ -731,7 +731,7 @@ dumpsys() blkno = dumplo; todo = dumpsize; /* pages */ vaddr = (char*)dumppage; - memset(vaddr, 0, NBPG); + memset(vaddr, 0, PAGE_SIZE); /* Set pointers to all three parts. */ kseg_p = (kcore_seg_t *)vaddr; @@ -744,25 +744,25 @@ dumpsys() /* Fill in cpu_kcore_hdr_t part. */ strncpy(chdr_p->name, kernel_arch, sizeof(chdr_p->name)); - chdr_p->page_size = NBPG; + chdr_p->page_size = PAGE_SIZE; chdr_p->kernbase = KERNBASE; /* Fill in the sun2_kcore_hdr part (MMU state). */ pmap_kcore_hdr(sh); /* Write out the dump header. */ - error = (*dsw->d_dump)(dumpdev, blkno, vaddr, NBPG); + error = (*dsw->d_dump)(dumpdev, blkno, vaddr, PAGE_SIZE); if (error) goto fail; - blkno += btodb(NBPG); + blkno += btodb(PAGE_SIZE); /* translation RAM (pages zero through seven) */ - for(chunk = 0; chunk < (NBPG * 8); chunk += NBPG) { + for(chunk = 0; chunk < (PAGE_SIZE * 8); chunk += PAGE_SIZE) { pmap_get_pagemap((int*)vaddr, chunk); - error = (*dsw->d_dump)(dumpdev, blkno, vaddr, NBPG); + error = (*dsw->d_dump)(dumpdev, blkno, vaddr, PAGE_SIZE); if (error) goto fail; - blkno += btodb(NBPG); + blkno += btodb(PAGE_SIZE); } /* @@ -785,11 +785,11 @@ dumpsys() if ((todo & 0xf) == 0) printf("\r%4d", todo); vaddr = (char*)(paddr + KERNBASE); - error = (*dsw->d_dump)(dumpdev, blkno, vaddr, NBPG); + error = (*dsw->d_dump)(dumpdev, blkno, vaddr, PAGE_SIZE); if (error) goto fail; - paddr += NBPG; - blkno += btodb(NBPG); + paddr += PAGE_SIZE; + blkno += btodb(PAGE_SIZE); --todo; } while (--chunk > 0); @@ -800,13 +800,13 @@ dumpsys() printf("\r%4d", todo); pmap_kenter_pa(vmmap, paddr | PMAP_NC, VM_PROT_READ); pmap_update(pmap_kernel()); - error = (*dsw->d_dump)(dumpdev, blkno, vaddr, NBPG); - pmap_kremove(vmmap, NBPG); + error = (*dsw->d_dump)(dumpdev, blkno, vaddr, PAGE_SIZE); + pmap_kremove(vmmap, PAGE_SIZE); pmap_update(pmap_kernel()); if (error) goto fail; - paddr += NBPG; - blkno += btodb(NBPG); + paddr += PAGE_SIZE; + blkno += btodb(PAGE_SIZE); } while (--todo > 0); printf("\rdump succeeded\n"); diff --git a/sys/arch/sun2/sun2/mem.c b/sys/arch/sun2/sun2/mem.c index 0b5a61a4d1cf..725b299dcdfc 100644 --- a/sys/arch/sun2/sun2/mem.c +++ b/sys/arch/sun2/sun2/mem.c @@ -1,4 +1,4 @@ -/* $NetBSD: mem.c,v 1.9 2002/10/23 09:12:22 jdolecek Exp $ */ +/* $NetBSD: mem.c,v 1.10 2003/04/01 15:47:48 thorpej Exp $ */ /* * Copyright (c) 1994, 1995 Gordon W. Ross @@ -153,10 +153,10 @@ mmrw(dev, uio, flags) trunc_page(v), prot, prot|PMAP_WIRED); pmap_update(pmap_kernel()); o = v & 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; @@ -174,7 +174,7 @@ mmrw(dev, uio, flags) * most requests are less than one page anyway. */ o = v & PGOFSET; - c = min(uio->uio_resid, (int)(NBPG - o)); + c = min(uio->uio_resid, (int)(PAGE_SIZE - o)); rw = (uio->uio_rw == UIO_READ) ? B_READ : B_WRITE; if (!(uvm_kernacc((caddr_t)v, c, rw) || promacc((caddr_t)v, c, rw))) @@ -203,10 +203,10 @@ mmrw(dev, uio, flags) */ if (devzeropage == NULL) { devzeropage = (caddr_t) - malloc(NBPG, M_TEMP, M_WAITOK); - memset(devzeropage, 0, NBPG); + malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + memset(devzeropage, 0, PAGE_SIZE); } - c = min(iov->iov_len, NBPG); + c = min(iov->iov_len, PAGE_SIZE); error = uiomove(devzeropage, c, uio); break; diff --git a/sys/arch/sun2/sun2/pmap.c b/sys/arch/sun2/sun2/pmap.c index ea5a8c9302b0..7212e8a326b2 100644 --- a/sys/arch/sun2/sun2/pmap.c +++ b/sys/arch/sun2/sun2/pmap.c @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.19 2003/01/18 06:58:35 thorpej Exp $ */ +/* $NetBSD: pmap.c,v 1.20 2003/04/01 15:47:49 thorpej Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -218,8 +218,8 @@ static int temp_seg_inuse; * to be used in copy/zero operations. */ vaddr_t tmp_vpages[2] = { - NBPG * 8, - NBPG * 9 }; + PAGE_SIZE * 8, + PAGE_SIZE * 9 }; int tmp_vpages_inuse; static int pmap_version = 1; @@ -734,7 +734,7 @@ pmeg_mon_init(sva, eva, keep) if (sme != SEGINV) { valid = 0; endseg = sva + NBSG; - for (pgva = sva; pgva < endseg; pgva += NBPG) { + for (pgva = sva; pgva < endseg; pgva += PAGE_SIZE) { pte = get_pte(pgva); if (pte & PG_VALID) { valid++; @@ -771,7 +771,7 @@ pmeg_clean(pmegp) sme = pmegp->pmeg_index; set_segmap(temp_seg_va, sme); - for (va = 0; va < NBSG; va += NBPG) + for (va = 0; va < NBSG; va += PAGE_SIZE) set_pte(temp_seg_va + va, PG_INVAL); set_segmap(temp_seg_va, SEGINV); @@ -1037,7 +1037,7 @@ pmeg_verify_empty(va) vaddr_t eva; int pte; - for (eva = va + NBSG; va < eva; va += NBPG) { + for (eva = va + NBSG; va < eva; va += PAGE_SIZE) { pte = get_pte(va); if (pte & PG_VALID) panic("pmeg_verify_empty"); @@ -1331,7 +1331,7 @@ pv_remove_all(pa) while ((pv = *head) != NULL) { pmap = pv->pv_pmap; va = pv->pv_va; - pmap_remove1(pmap, va, va + NBPG); + pmap_remove1(pmap, va, va + PAGE_SIZE); #ifdef PMAP_DEBUG /* Make sure it went away. */ if (pv == *head) { @@ -1564,7 +1564,7 @@ pmap_bootstrap(nextva) * Done allocating PAGES of virtual space, so * clean out the rest of the last used segment. */ - for (va = nextva; va < virtual_avail; va += NBPG) + for (va = nextva; va < virtual_avail; va += PAGE_SIZE) set_pte(va, PG_INVAL); /* @@ -1637,14 +1637,14 @@ pmap_bootstrap(nextva) * vector table - just in case something happens before then * and we drop into the PROM. */ - eva = va + NBPG * 4; + eva = va + PAGE_SIZE * 4; va = eva; /* * We use pages four through seven for the msgbuf. */ - eva = va + NBPG * 4; - for(; va < eva; va += NBPG) { + eva = va + PAGE_SIZE * 4; + for(; va < eva; va += PAGE_SIZE) { pte = get_pte(va); pte |= (PG_SYSTEM | PG_WRITE | PG_NC); set_pte(va, pte); @@ -1658,16 +1658,16 @@ pmap_bootstrap(nextva) * and nine for this. */ set_pte(va, PG_INVAL); - va += NBPG; + va += PAGE_SIZE; set_pte(va, PG_INVAL); - va += NBPG; + va += PAGE_SIZE; /* * Pages ten and eleven remain for the temporary kernel stack, * which is set up by locore.s. Hopefully this is enough space. */ - eva = va + NBPG * 2; - for(; va < eva ; va += NBPG) { + eva = va + PAGE_SIZE * 2; + for(; va < eva ; va += PAGE_SIZE) { pte = get_pte(va); pte &= ~(PG_NC); pte |= (PG_SYSTEM | PG_WRITE); @@ -1691,7 +1691,7 @@ pmap_bootstrap(nextva) /* Kernel text is read-only */ pte |= (PG_SYSTEM); set_pte(va, pte); - va += NBPG; + va += PAGE_SIZE; } /* data, bss, etc. */ while (va < nextva) { @@ -1702,7 +1702,7 @@ pmap_bootstrap(nextva) pte &= ~(PG_NC); pte |= (PG_SYSTEM | PG_WRITE); set_pte(va, pte); - va += NBPG; + va += PAGE_SIZE; } /* @@ -1855,9 +1855,9 @@ pmap_map(va, pa, endpa, prot) sz = endpa - pa; do { pmap_enter(kernel_pmap, va, pa, prot, 0); - va += NBPG; - pa += NBPG; - sz -= NBPG; + va += PAGE_SIZE; + pa += PAGE_SIZE; + sz -= PAGE_SIZE; } while (sz > 0); pmap_update(kernel_pmap); return(va); @@ -2521,7 +2521,7 @@ pmap_kremove(va, len) #endif /* Invalidate the PTEs in the given range. */ - for (pgva = va; pgva < neva; pgva += NBPG) { + for (pgva = va; pgva < neva; pgva += PAGE_SIZE) { pte = get_pte(pgva); if (pte & PG_VALID) { #ifdef HAVECACHE @@ -3220,7 +3220,7 @@ pmap_protect_mmu(pmap, sva, eva) #endif /* Remove write permission in the given range. */ - for (pgva = sva; pgva < eva; pgva += NBPG) { + for (pgva = sva; pgva < eva; pgva += PAGE_SIZE) { pte = get_pte(pgva); if (pte & PG_VALID) { #ifdef HAVECACHE @@ -3281,7 +3281,7 @@ pmap_protect_noctx(pmap, sva, eva) eva += (temp_seg_va - segva); /* Remove write permission in the given range. */ - for (pgva = sva; pgva < eva; pgva += NBPG) { + for (pgva = sva; pgva < eva; pgva += PAGE_SIZE) { pte = get_pte(pgva); if (pte & PG_VALID) { /* No cache flush needed. */ @@ -3466,7 +3466,7 @@ pmap_remove_mmu(pmap, sva, eva) #endif /* Invalidate the PTEs in the given range. */ - for (pgva = sva; pgva < eva; pgva += NBPG) { + for (pgva = sva; pgva < eva; pgva += PAGE_SIZE) { pte = get_pte(pgva); if (pte & PG_VALID) { #ifdef HAVECACHE @@ -3573,7 +3573,7 @@ pmap_remove_noctx(pmap, sva, eva) eva += (temp_seg_va - segva); /* Invalidate the PTEs in the given range. */ - for (pgva = sva; pgva < eva; pgva += NBPG) { + for (pgva = sva; pgva < eva; pgva += PAGE_SIZE) { pte = get_pte(pgva); if (pte & PG_VALID) { /* No cache flush needed. */ @@ -3855,7 +3855,8 @@ pmap_get_pagemap(pt, off) int saved_ctx; sme = (off / (NPAGSEG * sizeof(*pt))); /* PMEG to start on */ - sme_end = sme + (NBPG / (NPAGSEG * sizeof(*pt))); /* where to stop */ + sme_end = + sme + (PAGE_SIZE / (NPAGSEG * sizeof(*pt))); /* where to stop */ va_end = temp_seg_va + NBSG; saved_ctx = get_context(); @@ -3865,7 +3866,7 @@ pmap_get_pagemap(pt, off) va = temp_seg_va; do { *pt++ = get_pte(va); - va += NBPG; + va += PAGE_SIZE; } while (va < va_end); sme++; } while (sme < sme_end); @@ -3896,7 +3897,7 @@ get_pte_pmeg(int pmeg_num, int page_num) va = temp_seg_va; set_segmap(temp_seg_va, pmeg_num); - va += NBPG*page_num; + va += PAGE_SIZE*page_num; pte = get_pte(va); set_segmap(temp_seg_va, SEGINV); @@ -3925,7 +3926,7 @@ set_pte_pmeg(int pmeg_num, int page_num, int pte) /* We never access data in temp_seg_va so no need to flush. */ va = temp_seg_va; set_segmap(temp_seg_va, pmeg_num); - va += NBPG*page_num; + va += PAGE_SIZE*page_num; set_pte(va, pte); set_segmap(temp_seg_va, SEGINV); diff --git a/sys/arch/sun2/sun2/promlib.c b/sys/arch/sun2/sun2/promlib.c index 0654139841c4..707741217d6a 100644 --- a/sys/arch/sun2/sun2/promlib.c +++ b/sys/arch/sun2/sun2/promlib.c @@ -1,4 +1,4 @@ -/* $NetBSD: promlib.c,v 1.9 2002/05/30 22:43:07 thorpej Exp $ */ +/* $NetBSD: promlib.c,v 1.10 2003/04/01 15:47:49 thorpej Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -41,6 +41,8 @@ #include #include +#include + #include #define _SUN2_PROMLIB_PRIVATE #include @@ -86,7 +88,8 @@ _prom_swap_ptes(swapout, swapin) int pte_number; vaddr_t va; - for(pte_number = 0, va = 0; pte_number < 4; pte_number++, va += NBPG) { + for (pte_number = 0, va = 0; pte_number < 4; + pte_number++, va += PAGE_SIZE) { swapout[pte_number] = get_pte(va); set_pte(va, swapin[pte_number]); }