summaryrefslogtreecommitdiff
path: root/sys/arch/amd64
diff options
context:
space:
mode:
authorMartin Reindl <martin@cvs.openbsd.org>2007-10-28 10:25:10 +0000
committerMartin Reindl <martin@cvs.openbsd.org>2007-10-28 10:25:10 +0000
commit886a21154e5ae0a6b2bd4c36b087c14d63c78321 (patch)
tree80edf44f3aa6424cb26f44bcf028d1775bbe0613 /sys/arch/amd64
parente702204f9ecfe0f56bae6b5a64cce8793abecf9a (diff)
get rid of btoc/ctob in favor of atop/ptoa
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r--sys/arch/amd64/amd64/machdep.c4
-rw-r--r--sys/arch/amd64/amd64/mem.c8
-rw-r--r--sys/arch/amd64/amd64/rbus_machdep.c4
-rw-r--r--sys/arch/amd64/include/param.h6
4 files changed, 9 insertions, 13 deletions
diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c
index 677b286a7cd..dc2e00166ec 100644
--- a/sys/arch/amd64/amd64/machdep.c
+++ b/sys/arch/amd64/amd64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.62 2007/10/17 02:30:26 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.63 2007/10/28 10:25:09 martin Exp $ */
/* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */
/*-
@@ -298,7 +298,7 @@ cpu_startup(void)
printf("real mem = %lu (%luMB)\n", ptoa((psize_t)physmem),
ptoa((psize_t)physmem)/1024/1024);
- if (physmem >= btoc(1ULL << 32)) {
+ if (physmem >= atop(1ULL << 32)) {
extern int amdgart_enable;
amdgart_enable = 1;
diff --git a/sys/arch/amd64/amd64/mem.c b/sys/arch/amd64/amd64/mem.c
index 2fbcf0d1494..e25709e0bc7 100644
--- a/sys/arch/amd64/amd64/mem.c
+++ b/sys/arch/amd64/amd64/mem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mem.c,v 1.7 2007/09/17 15:34:38 chl Exp $ */
+/* $OpenBSD: mem.c,v 1.8 2007/10/28 10:25:09 martin Exp $ */
/*
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1982, 1986, 1990, 1993
@@ -189,7 +189,7 @@ mmmmap(dev_t dev, off_t off, int prot)
switch (minor(dev)) {
/* minor device 0 is physical memory */
case 0:
- if ((paddr_t)off > (paddr_t)ctob(physmem) && suser(p, 0) != 0)
+ if ((paddr_t)off > (paddr_t)ptoa(physmem) && suser(p, 0) != 0)
return -1;
return atop(off);
@@ -200,7 +200,7 @@ mmmmap(dev_t dev, off_t off, int prot)
case 1:
/* Allow mapping of the VGA framebuffer & BIOS only */
if ((off >= VGA_START && off <= BIOS_END) ||
- (unsigned)off > (unsigned)ctob(physmem))
+ (unsigned)off > (unsigned)ptoa(physmem))
return atop(off);
else
return -1;
@@ -208,7 +208,7 @@ mmmmap(dev_t dev, off_t off, int prot)
/* Allow mapping of the whole 1st megabyte
for x86emu */
if (off <= BIOS_END ||
- (unsigned)off > (unsigned)ctob(physmem))
+ (unsigned)off > (unsigned)ptoa(physmem))
return atop(off);
else
return -1;
diff --git a/sys/arch/amd64/amd64/rbus_machdep.c b/sys/arch/amd64/amd64/rbus_machdep.c
index 8c442904545..f147fda676c 100644
--- a/sys/arch/amd64/amd64/rbus_machdep.c
+++ b/sys/arch/amd64/amd64/rbus_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rbus_machdep.c,v 1.4 2007/09/12 13:56:40 chl Exp $ */
+/* $OpenBSD: rbus_machdep.c,v 1.5 2007/10/28 10:25:09 martin Exp $ */
/* $NetBSD: rbus_machdep.c,v 1.2 1999/10/15 06:43:06 haya Exp $ */
/*
@@ -69,7 +69,7 @@ rbus_pccbb_parent_mem(struct device *self, struct pci_attach_args *pa)
struct extent *ex;
size = RBUS_MEM_SIZE;
- start = min_start = max(RBUS_MEM_START, ctob(physmem));
+ start = min_start = max(RBUS_MEM_START, ptoa(physmem));
#if NPCIBIOS > 0
if ((ex = pciaddr_search(PCIADDR_SEARCH_MEM, &start, size)) == NULL)
#endif
diff --git a/sys/arch/amd64/include/param.h b/sys/arch/amd64/include/param.h
index 520dfd387a5..c72821b7b2f 100644
--- a/sys/arch/amd64/include/param.h
+++ b/sys/arch/amd64/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.14 2007/05/28 21:02:49 thib Exp $ */
+/* $OpenBSD: param.h,v 1.15 2007/10/28 10:25:09 martin Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -113,10 +113,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 */
#define dbtob(x) ((x) << DEV_BSHIFT)
#define btodb(x) ((x) >> DEV_BSHIFT)