summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMartin Reindl <martin@cvs.openbsd.org>2007-09-22 09:57:41 +0000
committerMartin Reindl <martin@cvs.openbsd.org>2007-09-22 09:57:41 +0000
commit4d5f4442c51a6c709703b7cc56b5fd143a46ec69 (patch)
tree3c03849038fc9e4aa527326b6d63a5e6d88e6c6c /sys
parent2b06a9b9fda98edfa12a5f5d052640501c31862c (diff)
replace even more ctob and btoc with ptoa and atop respectively plus
uvm_extern.h where needed
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/hppa/dev/mem.c12
-rw-r--r--sys/arch/hppa/hppa/machdep.c10
-rw-r--r--sys/arch/hppa/hppa/pmap.c4
-rw-r--r--sys/arch/hppa/include/param.h6
-rw-r--r--sys/compat/hpux/hpux_compat.c4
-rw-r--r--sys/dev/ic/oosiopvar.h8
6 files changed, 21 insertions, 23 deletions
diff --git a/sys/arch/hppa/dev/mem.c b/sys/arch/hppa/dev/mem.c
index 8ec11720f09..1fc411dd313 100644
--- a/sys/arch/hppa/dev/mem.c
+++ b/sys/arch/hppa/dev/mem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mem.c,v 1.28 2006/05/29 08:09:16 mickey Exp $ */
+/* $OpenBSD: mem.c,v 1.29 2007/09/22 09:57:40 martin Exp $ */
/*
* Copyright (c) 1998-2004 Michael Shalayeff
@@ -345,12 +345,12 @@ mmrw(dev, uio, flags)
/* If the address isn't in RAM, bail. */
v = uio->uio_offset;
- if (btoc(v) > physmem) {
+ if (atop(v) > physmem) {
error = EFAULT;
/* this will break us out of the loop */
continue;
}
- c = ctob(physmem) - v;
+ c = ptoa(physmem) - v;
c = min(c, uio->uio_resid);
error = uiomove((caddr_t)v, c, uio);
break;
@@ -359,7 +359,7 @@ mmrw(dev, uio, flags)
v = uio->uio_offset;
o = v & PGOFSET;
c = min(uio->uio_resid, (int)(PAGE_SIZE - o));
- if (btoc(v) > physmem && !uvm_kernacc((caddr_t)v,
+ if (atop(v) > physmem && !uvm_kernacc((caddr_t)v,
c, (uio->uio_rw == UIO_READ) ? B_READ : B_WRITE)) {
error = EFAULT;
/* this will break us out of the loop */
@@ -412,8 +412,8 @@ mmmmap(dev, off, prot)
* Allow access only in RAM.
*/
#if 0
- if (off < ctob(firstusablepage) ||
- off >= ctob(lastusablepage + 1))
+ if (off < ptoa(firstusablepage) ||
+ off >= ptoa(lastusablepage + 1))
return (-1);
#endif
return (atop(off));
diff --git a/sys/arch/hppa/hppa/machdep.c b/sys/arch/hppa/hppa/machdep.c
index 72689101aca..730635d052e 100644
--- a/sys/arch/hppa/hppa/machdep.c
+++ b/sys/arch/hppa/hppa/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.164 2007/07/22 19:24:45 kettenis Exp $ */
+/* $OpenBSD: machdep.c,v 1.165 2007/09/22 09:57:40 martin Exp $ */
/*
* Copyright (c) 1999-2003 Michael Shalayeff
@@ -365,8 +365,8 @@ hppa_init(start)
avail_end = trunc_page(PAGE0->imm_max_mem);
if (avail_end > SYSCALLGATE)
avail_end = SYSCALLGATE;
- physmem = btoc(avail_end);
- resvmem = btoc(((vaddr_t)&kernel_text));
+ physmem = atop(avail_end);
+ resvmem = atop(((vaddr_t)&kernel_text));
/* we hope this won't fail */
hppa_ex = extent_create("mem", 0x0, 0xffffffff, M_DEVBUF,
@@ -634,7 +634,7 @@ cpu_startup(void)
printf("%s\n", cpu_model);
printf("real mem = %u (%u reserved for PROM, %u used by OpenBSD)\n",
- ctob(physmem), ctob(resvmem), ctob(resvphysmem - resvmem));
+ ptoa(physmem), ptoa(resvmem), ptoa(resvphysmem - resvmem));
/*
* Determine how many buffers to allocate.
@@ -1050,7 +1050,7 @@ dumpsys(void)
if (!(error = cpu_dump())) {
- bytes = ctob(physmem);
+ bytes = ptoa(physmem);
maddr = NULL;
blkno = dumplo + cpu_dumpsize();
dump = bdevsw[major(dumpdev)].d_dump;
diff --git a/sys/arch/hppa/hppa/pmap.c b/sys/arch/hppa/hppa/pmap.c
index bded164170c..fd45a09faa4 100644
--- a/sys/arch/hppa/hppa/pmap.c
+++ b/sys/arch/hppa/hppa/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.130 2007/04/13 18:57:49 art Exp $ */
+/* $OpenBSD: pmap.c,v 1.131 2007/09/22 09:57:40 martin Exp $ */
/*
* Copyright (c) 1998-2004 Michael Shalayeff
@@ -540,7 +540,7 @@ pmap_bootstrap(vstart)
if (nkpdes < 4)
nkpdes = 4; /* ... but no less than four */
nkpdes += HPPA_IOLEN / PDE_SIZE; /* ... and io space too */
- npdes = nkpdes + (physmem + btoc(PDE_SIZE) - 1) / btoc(PDE_SIZE);
+ npdes = nkpdes + (physmem + atop(PDE_SIZE) - 1) / atop(PDE_SIZE);
/* map the pdes */
for (va = 0; npdes--; va += PDE_SIZE, addr += PAGE_SIZE) {
diff --git a/sys/arch/hppa/include/param.h b/sys/arch/hppa/include/param.h
index edf08d13765..14cded0dece 100644
--- a/sys/arch/hppa/include/param.h
+++ b/sys/arch/hppa/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.36 2007/07/15 19:25:49 kettenis Exp $ */
+/* $OpenBSD: param.h,v 1.37 2007/09/22 09:57:40 martin Exp $ */
/*
* Copyright (c) 1988-1994, The University of Utah and
@@ -93,10 +93,6 @@
#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT))
#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT))
-/* pages to bytes */
-#define ctob(x) ((x) << PGSHIFT)
-#define btoc(x) (((x) + PGOFSET) >> PGSHIFT)
-
#define btodb(x) ((x) >> DEV_BSHIFT)
#define dbtob(x) ((x) << DEV_BSHIFT)
diff --git a/sys/compat/hpux/hpux_compat.c b/sys/compat/hpux/hpux_compat.c
index e08f25d2911..a1c2e0f65b9 100644
--- a/sys/compat/hpux/hpux_compat.c
+++ b/sys/compat/hpux/hpux_compat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hpux_compat.c,v 1.28 2004/07/09 21:33:44 mickey Exp $ */
+/* $OpenBSD: hpux_compat.c,v 1.29 2007/09/22 09:57:40 martin Exp $ */
/* $NetBSD: hpux_compat.c,v 1.35 1997/05/08 16:19:48 mycroft Exp $ */
/*
@@ -489,7 +489,7 @@ hpux_sys_ulimit(p, v, retval)
case 3:
limp = &p->p_rlimit[RLIMIT_DATA];
- *retval = ctob(p->p_vmspace->vm_tsize) + limp->rlim_max;
+ *retval = ptoa(p->p_vmspace->vm_tsize) + limp->rlim_max;
break;
default:
diff --git a/sys/dev/ic/oosiopvar.h b/sys/dev/ic/oosiopvar.h
index f6a9ade3cd8..6d670aeabd7 100644
--- a/sys/dev/ic/oosiopvar.h
+++ b/sys/dev/ic/oosiopvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: oosiopvar.h,v 1.2 2004/03/14 12:23:49 miod Exp $ */
+/* $OpenBSD: oosiopvar.h,v 1.3 2007/09/22 09:57:40 martin Exp $ */
/* $NetBSD: oosiopvar.h,v 1.2 2003/05/03 18:11:23 wiz Exp $ */
/*
@@ -27,10 +27,12 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <uvm/uvm_extern.h>
+
#define OOSIOP_NTGT 8 /* Max targets */
#define OOSIOP_NCB 32 /* Initial command buffers */
-#define OOSIOP_NSG (MIN(btoc(MAXPHYS) + 1, 32)) /* Max S/G operation */
-#define OOSIOP_MAX_XFER ctob(OOSIOP_NSG - 1)
+#define OOSIOP_NSG (MIN(atop(MAXPHYS) + 1, 32)) /* Max S/G operation */
+#define OOSIOP_MAX_XFER ptoa(OOSIOP_NSG - 1)
struct oosiop_xfer {
/* script for scatter/gather DMA (move*nsg+jump) */