diff options
author | Martin Reindl <martin@cvs.openbsd.org> | 2007-11-04 13:43:40 +0000 |
---|---|---|
committer | Martin Reindl <martin@cvs.openbsd.org> | 2007-11-04 13:43:40 +0000 |
commit | 03b7854a5f55c1c5037acf4c3727dc11004a288e (patch) | |
tree | af095fa6937131224a5d4d74ac7c3ad553215e54 | |
parent | 9ca9c9b5b03559ce53f033908a7d1a55ced590aa (diff) |
replace even more ctob/btoc with ptoa/atop
-rw-r--r-- | sys/arch/macppc/macppc/machdep.c | 24 | ||||
-rw-r--r-- | sys/arch/mvmeppc/mvmeppc/autoconf.c | 6 | ||||
-rw-r--r-- | sys/arch/mvmeppc/mvmeppc/machdep.c | 12 | ||||
-rw-r--r-- | sys/arch/mvmeppc/mvmeppc/ppc1_machdep.c | 4 | ||||
-rw-r--r-- | sys/arch/powerpc/include/param.h | 7 | ||||
-rw-r--r-- | sys/arch/powerpc/powerpc/pmap.c | 8 |
6 files changed, 28 insertions, 33 deletions
diff --git a/sys/arch/macppc/macppc/machdep.c b/sys/arch/macppc/macppc/machdep.c index ba5be68cfda..042b585a223 100644 --- a/sys/arch/macppc/macppc/machdep.c +++ b/sys/arch/macppc/macppc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.93 2007/06/06 17:15:12 deraadt Exp $ */ +/* $OpenBSD: machdep.c,v 1.94 2007/11/04 13:43:38 martin Exp $ */ /* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */ /* @@ -304,31 +304,31 @@ initppc(startkernel, endkernel, args) pmap_bootstrap(startkernel, endkernel); /* now that we know physmem size, map physical memory with BATs */ - if (physmem > btoc(0x10000000)) { + if (physmem > atop(0x10000000)) { battable[0x1].batl = BATL(0x10000000, BAT_M); battable[0x1].batu = BATU(0x10000000); } - if (physmem > btoc(0x20000000)) { + if (physmem > atop(0x20000000)) { battable[0x2].batl = BATL(0x20000000, BAT_M); battable[0x2].batu = BATU(0x20000000); } - if (physmem > btoc(0x30000000)) { + if (physmem > atop(0x30000000)) { battable[0x3].batl = BATL(0x30000000, BAT_M); battable[0x3].batu = BATU(0x30000000); } - if (physmem > btoc(0x40000000)) { + if (physmem > atop(0x40000000)) { battable[0x4].batl = BATL(0x40000000, BAT_M); battable[0x4].batu = BATU(0x40000000); } - if (physmem > btoc(0x50000000)) { + if (physmem > atop(0x50000000)) { battable[0x5].batl = BATL(0x50000000, BAT_M); battable[0x5].batu = BATU(0x50000000); } - if (physmem > btoc(0x60000000)) { + if (physmem > atop(0x60000000)) { battable[0x6].batl = BATL(0x60000000, BAT_M); battable[0x6].batu = BATU(0x60000000); } - if (physmem > btoc(0x70000000)) { + if (physmem > atop(0x70000000)) { battable[0x7].batl = BATL(0x70000000, BAT_M); battable[0x7].batu = BATU(0x70000000); } @@ -490,8 +490,8 @@ cpu_startup() printf("%s", version); - printf("real mem = %u (%uMB)\n", ctob(physmem), - ctob(physmem)/1024/1024); + printf("real mem = %u (%uMB)\n", ptoa(physmem), + ptoa(physmem)/1024/1024); /* * Find out how much space we need, allocate it, @@ -835,7 +835,7 @@ dumpsys() error = cpu_dump(); for (i = 0; !error && i < ndumpmem; i++) { npg = dumpmem[i].end - dumpmem[i].start; - maddr = ctob(dumpmem[i].start); + maddr = ptoa(dumpmem[i].start); blkno = dumplo + btodb(maddr) + 1; for (j = npg; j; @@ -844,7 +844,7 @@ dumpsys() /* Print out how many MBs we have to go. */ if (dbtob(blkno - dumplo) % (1024 * 1024) < NBPG) printf("%d ", - (ctob(dumpsize) - maddr) / (1024 * 1024)); + (ptoa(dumpsize) - maddr) / (1024 * 1024)); pmap_enter(pmap_kernel(), dumpspace, maddr, VM_PROT_READ, PMAP_WIRED); diff --git a/sys/arch/mvmeppc/mvmeppc/autoconf.c b/sys/arch/mvmeppc/mvmeppc/autoconf.c index e1399cc2d83..1c851f5ff73 100644 --- a/sys/arch/mvmeppc/mvmeppc/autoconf.c +++ b/sys/arch/mvmeppc/mvmeppc/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.19 2007/06/01 23:14:07 deraadt Exp $ */ +/* $OpenBSD: autoconf.c,v 1.20 2007/11/04 13:43:39 martin Exp $ */ /* * Copyright (c) 1996, 1997 Per Fogelstrom * Copyright (c) 1995 Theo de Raadt @@ -37,7 +37,7 @@ * from: Utah Hdr: autoconf.c 1.31 91/01/21 * * from: @(#)autoconf.c 8.1 (Berkeley) 6/10/93 - * $Id: autoconf.c,v 1.19 2007/06/01 23:14:07 deraadt Exp $ + * $Id: autoconf.c,v 1.20 2007/11/04 13:43:39 martin Exp $ */ /* @@ -133,7 +133,7 @@ dumpconf(void) if (nblks <= ctod(1)) return; - dumpsize = btoc(IOM_END + ctob(dumpmem_high)); + dumpsize = atop(IOM_END + ptoa(dumpmem_high)); /* Always skip the first CLBYTES, in case there is a label there. */ if (dumplo < ctod(1)) diff --git a/sys/arch/mvmeppc/mvmeppc/machdep.c b/sys/arch/mvmeppc/mvmeppc/machdep.c index c48a32cdcfa..fd2efae5e55 100644 --- a/sys/arch/mvmeppc/mvmeppc/machdep.c +++ b/sys/arch/mvmeppc/mvmeppc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.53 2007/05/26 20:26:51 pedro Exp $ */ +/* $OpenBSD: machdep.c,v 1.54 2007/11/04 13:43:39 martin Exp $ */ /* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */ /* @@ -284,15 +284,15 @@ initppc(startkernel, endkernel, args) /* MVME2[67]00 max out at 256MB, and we need BAT2 for now. */ #else /* use BATs to map 1GB memory, no pageable BATs now */ - if (physmem > btoc(0x10000000)) { + if (physmem > atop(0x10000000)) { ppc_mtdbat1l(BATL(0x10000000, BAT_M)); ppc_mtdbat1u(BATU(0x10000000)); } - if (physmem > btoc(0x20000000)) { + if (physmem > atop(0x20000000)) { ppc_mtdbat2l(BATL(0x20000000, BAT_M)); ppc_mtdbat2u(BATU(0x20000000)); } - if (physmem > btoc(0x30000000)) { + if (physmem > atop(0x30000000)) { ppc_mtdbat3l(BATL(0x30000000, BAT_M)); ppc_mtdbat3u(BATU(0x30000000)); } @@ -395,8 +395,8 @@ cpu_startup() printf("%s", version); - printf("real mem = %u (%uMB)\n", ctob(physmem), - ctob(physmem)/1024/1024); + printf("real mem = %u (%uMB)\n", ptoa(physmem), + ptoa(physmem)/1024/1024); /* * Find out how much space we need, allocate it, diff --git a/sys/arch/mvmeppc/mvmeppc/ppc1_machdep.c b/sys/arch/mvmeppc/mvmeppc/ppc1_machdep.c index f0ec63c34a3..a898fe8bb03 100644 --- a/sys/arch/mvmeppc/mvmeppc/ppc1_machdep.c +++ b/sys/arch/mvmeppc/mvmeppc/ppc1_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ppc1_machdep.c,v 1.16 2005/12/17 07:31:26 miod Exp $ */ +/* $OpenBSD: ppc1_machdep.c,v 1.17 2007/11/04 13:43:39 martin Exp $ */ /* $NetBSD: ofw_machdep.c,v 1.1 1996/09/30 16:34:50 ws Exp $ */ /* @@ -132,7 +132,7 @@ size_memory(void) break; *look = save; } - physmem = btoc(trunc_page((unsigned)look)); /* in pages */ + physmem = atop(trunc_page((unsigned)look)); /* in pages */ total_mem = trunc_page((unsigned)look); #ifdef USE_BUG /* Initialize the off-board (non-local) memory. */ diff --git a/sys/arch/powerpc/include/param.h b/sys/arch/powerpc/include/param.h index dd40e4052fe..89d2ac92102 100644 --- a/sys/arch/powerpc/include/param.h +++ b/sys/arch/powerpc/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.29 2007/05/28 21:02:49 thib Exp $ */ +/* $OpenBSD: param.h,v 1.30 2007/11/04 13:43:39 martin Exp $ */ /* $NetBSD: param.h,v 1.1 1996/09/30 16:34:28 ws Exp $ */ /*- @@ -86,11 +86,6 @@ */ #define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT)) #define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT)) -/* - * bytes to pages - */ -#define ctob(x) ((x) << PGSHIFT) -#define btoc(x) (((x) + PGOFSET) >> PGSHIFT) /* * bytes to disk blocks diff --git a/sys/arch/powerpc/powerpc/pmap.c b/sys/arch/powerpc/powerpc/pmap.c index d303f6cd5f1..fbd61b827fe 100644 --- a/sys/arch/powerpc/powerpc/pmap.c +++ b/sys/arch/powerpc/powerpc/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.102 2007/09/15 14:28:17 krw Exp $ */ +/* $OpenBSD: pmap.c,v 1.103 2007/11/04 13:43:39 martin Exp $ */ /* * Copyright (c) 2001, 2002, 2007 Dale Rahn. @@ -1269,7 +1269,7 @@ pmap_avail_setup(void) ndumpmem = 0; for (mp = pmap_mem; mp->size !=0; mp++, ndumpmem++) { - physmem += btoc(mp->size); + physmem += atop(mp->size); dumpmem[ndumpmem].start = atop(mp->start); dumpmem[ndumpmem].end = atop(mp->start + mp->size); } @@ -1526,7 +1526,7 @@ pmap_bootstrap(u_int kernelstart, u_int kernelend) pmap_ptab_cnt <<= 1; } else { pmap_ptab_cnt = HTABENTS_32; - while (HTABSIZE_32 < (ctob(physmem) >> 7)) + while (HTABSIZE_32 < (ptoa(physmem) >> 7)) pmap_ptab_cnt <<= 1; } /* @@ -1601,7 +1601,7 @@ pmap_bootstrap(u_int kernelstart, u_int kernelend) if (ppc_proc_is_64b) { for(i = 0; i < 0x10000; i++) - pmap_kenter_cache(ctob(i), ctob(i), VM_PROT_ALL, + pmap_kenter_cache(ptoa(i), ptoa(i), VM_PROT_ALL, PMAP_CACHE_WB); asm volatile ("sync; mtsdr1 %0; isync" :: "r"((u_int)pmap_ptable64 | HTABSIZE_64)); |