summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Reindl <martin@cvs.openbsd.org>2008-04-27 17:48:11 +0000
committerMartin Reindl <martin@cvs.openbsd.org>2008-04-27 17:48:11 +0000
commit3d245af8182de9c1f4255b677e31e5c592e12585 (patch)
tree7eecc7944a753929ae17db76ababd18da6e775a5
parent7046c098af8880891ee39c99d5f5fa11ce76ef4b (diff)
replace ctob/btoc by ptoa/atop
-rw-r--r--sys/arch/hppa64/dev/mem.c12
-rw-r--r--sys/arch/hppa64/hppa64/machdep.c10
-rw-r--r--sys/arch/hppa64/hppa64/pmap.c4
-rw-r--r--sys/arch/hppa64/include/param.h6
4 files changed, 14 insertions, 18 deletions
diff --git a/sys/arch/hppa64/dev/mem.c b/sys/arch/hppa64/dev/mem.c
index 6f6d5f7dd95..67299590181 100644
--- a/sys/arch/hppa64/dev/mem.c
+++ b/sys/arch/hppa64/dev/mem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mem.c,v 1.4 2007/09/22 16:21:32 krw Exp $ */
+/* $OpenBSD: mem.c,v 1.5 2008/04/27 17:48:09 martin Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@@ -186,12 +186,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;
@@ -200,7 +200,7 @@ mmrw(dev, uio, flags)
v = uio->uio_offset;
o = v & PAGE_MASK;
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 */
@@ -252,8 +252,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/hppa64/hppa64/machdep.c b/sys/arch/hppa64/hppa64/machdep.c
index 4f9e53bb6c0..6e2644fc791 100644
--- a/sys/arch/hppa64/hppa64/machdep.c
+++ b/sys/arch/hppa64/hppa64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.10 2008/04/20 21:42:00 kettenis Exp $ */
+/* $OpenBSD: machdep.c,v 1.11 2008/04/27 17:48:10 martin Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@@ -254,8 +254,8 @@ TODO hpmc/toc/pfr
avail_end = trunc_page(PAGE0->imm_max_mem);
if (avail_end > 0x4000000)
avail_end = 0x4000000;
- 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", 0, HPPA_PHYSMAP, M_DEVBUF,
@@ -395,7 +395,7 @@ cpu_startup(void)
*/
printf("%s%s\n", version, 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.
@@ -777,7 +777,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/hppa64/hppa64/pmap.c b/sys/arch/hppa64/hppa64/pmap.c
index 0ae1920f6a3..e04c55ff31b 100644
--- a/sys/arch/hppa64/hppa64/pmap.c
+++ b/sys/arch/hppa64/hppa64/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.5 2007/04/13 18:57:49 art Exp $ */
+/* $OpenBSD: pmap.c,v 1.6 2008/04/27 17:48:10 martin Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@@ -506,7 +506,7 @@ pmap_bootstrap(vstart)
kpm->pm_stats.resident_count++; /* count PTP as resident */
}
- pmap_maphys(0x1000000, ctob(physmem));
+ pmap_maphys(0x1000000, ptoa(physmem));
eaddr = physmem - atop(round_page(MSGBUFSIZE));
resvphysmem = atop(addr);
diff --git a/sys/arch/hppa64/include/param.h b/sys/arch/hppa64/include/param.h
index 46672941b54..3c1a9a2d9a5 100644
--- a/sys/arch/hppa64/include/param.h
+++ b/sys/arch/hppa64/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.10 2008/04/20 11:53:11 kettenis Exp $ */
+/* $OpenBSD: param.h,v 1.11 2008/04/27 17:48:10 martin Exp $ */
/*
* Copyright (c) 1988-1994, The University of Utah and
@@ -84,10 +84,6 @@
#define ctod(x) ((x) << (PAGE_SHIFT - DEV_BSHIFT))
#define dtoc(x) ((x) >> (PAGE_SHIFT - DEV_BSHIFT))
-/* pages to bytes */
-#define ctob(x) ((x) << PAGE_SHIFT)
-#define btoc(x) (((x) + PAGE_MASK) >> PAGE_SHIFT)
-
#define btodb(x) ((x) >> DEV_BSHIFT)
#define dbtob(x) ((x) << DEV_BSHIFT)