diff options
author | Martin Reindl <martin@cvs.openbsd.org> | 2005-10-21 18:55:01 +0000 |
---|---|---|
committer | Martin Reindl <martin@cvs.openbsd.org> | 2005-10-21 18:55:01 +0000 |
commit | f03881052695cd865e0fa7559dce85d675435856 (patch) | |
tree | 870bc78f0ec6853f7dcb36923482479d90cd8d36 /sys/arch | |
parent | cb2bbe7b848812e95fd0f7336412c92d8312ef97 (diff) |
use the MI trunc_page() and round_page() macros instead of rolling or own
ok weingart@ deraadt@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/amd64/amd64/acpi_machdep.c | 6 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/bus_space.c | 14 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/db_memrw.c | 4 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/mpbios.c | 6 | ||||
-rw-r--r-- | sys/arch/amd64/include/param.h | 4 |
5 files changed, 16 insertions, 18 deletions
diff --git a/sys/arch/amd64/amd64/acpi_machdep.c b/sys/arch/amd64/amd64/acpi_machdep.c index c9596fe5368..a14d4f03f31 100644 --- a/sys/arch/amd64/amd64/acpi_machdep.c +++ b/sys/arch/amd64/amd64/acpi_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi_machdep.c,v 1.1 2005/06/02 20:09:38 tholo Exp $ */ +/* $OpenBSD: acpi_machdep.c,v 1.2 2005/10/21 18:55:00 martin Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * @@ -38,8 +38,8 @@ u_int8_t *acpi_scan(struct acpi_mem_map *, paddr_t, size_t); int acpi_map(paddr_t pa, size_t len, struct acpi_mem_map *handle) { - paddr_t pgpa = x86_trunc_page(pa); - paddr_t endpa = x86_round_page(pa + len); + paddr_t pgpa = trunc_page(pa); + paddr_t endpa = round_page(pa + len); vaddr_t va = uvm_km_valloc(kernel_map, endpa - pgpa); if (va == 0) diff --git a/sys/arch/amd64/amd64/bus_space.c b/sys/arch/amd64/amd64/bus_space.c index a99b33dcd7c..e0518f9f447 100644 --- a/sys/arch/amd64/amd64/bus_space.c +++ b/sys/arch/amd64/amd64/bus_space.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bus_space.c,v 1.1 2004/01/28 01:39:38 mickey Exp $ */ +/* $OpenBSD: bus_space.c,v 1.2 2005/10/21 18:55:00 martin Exp $ */ /* $NetBSD: bus_space.c,v 1.2 2003/03/14 18:47:53 christos Exp $ */ /*- @@ -265,8 +265,8 @@ x86_mem_add_mapping(bpa, size, cacheable, bshp) pt_entry_t *pte; int32_t cpumask = 0; - pa = x86_trunc_page(bpa); - endpa = x86_round_page(bpa + size); + pa = trunc_page(bpa); + endpa = round_page(bpa + size); #ifdef DIAGNOSTIC if (endpa <= pa) @@ -343,8 +343,8 @@ _x86_memio_unmap(t, bsh, size, adrp) bpa = (bus_addr_t)ISA_PHYSADDR(bsh); } else { - va = x86_trunc_page(bsh); - endva = x86_round_page(bsh + size); + va = trunc_page(bsh); + endva = round_page(bsh + size); #ifdef DIAGNOSTIC if (endva <= va) { @@ -398,8 +398,8 @@ x86_memio_unmap(t, bsh, size) goto ok; } - va = x86_trunc_page(bsh); - endva = x86_round_page(bsh + size); + va = trunc_page(bsh); + endva = round_page(bsh + size); #ifdef DIAGNOSTIC if (endva <= va) diff --git a/sys/arch/amd64/amd64/db_memrw.c b/sys/arch/amd64/amd64/db_memrw.c index fa6768b3691..77805cce231 100644 --- a/sys/arch/amd64/amd64/db_memrw.c +++ b/sys/arch/amd64/amd64/db_memrw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_memrw.c,v 1.2 2005/05/27 19:32:39 art Exp $ */ +/* $OpenBSD: db_memrw.c,v 1.3 2005/10/21 18:55:00 martin Exp $ */ /* $NetBSD: db_memrw.c,v 1.1 2003/04/26 18:39:27 fvdl Exp $ */ /*- @@ -132,7 +132,7 @@ db_write_text(vaddr_t addr, size_t size, char *data) if (oldpte & PG_PS) pgva = (vaddr_t)dst & PG_LGFRAME; else - pgva = x86_trunc_page(dst); + pgva = trunc_page((vaddr_t)dst); /* * Compute number of bytes that can be written diff --git a/sys/arch/amd64/amd64/mpbios.c b/sys/arch/amd64/amd64/mpbios.c index dde327e3d0b..a5e459fc6fd 100644 --- a/sys/arch/amd64/amd64/mpbios.c +++ b/sys/arch/amd64/amd64/mpbios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpbios.c,v 1.2 2005/07/18 02:43:24 fgsch Exp $ */ +/* $OpenBSD: mpbios.c,v 1.3 2005/10/21 18:55:00 martin Exp $ */ /* $NetBSD: mpbios.c,v 1.7 2003/05/15 16:32:50 fvdl Exp $ */ /*- @@ -229,8 +229,8 @@ mpbios_map(pa, len, handle) int len; struct mp_map *handle; { - paddr_t pgpa = x86_trunc_page(pa); - paddr_t endpa = x86_round_page(pa + len); + paddr_t pgpa = trunc_page(pa); + paddr_t endpa = round_page(pa + len); vaddr_t va = uvm_km_valloc(kernel_map, endpa - pgpa); vaddr_t retva = va + (pa & PGOFSET); diff --git a/sys/arch/amd64/include/param.h b/sys/arch/amd64/include/param.h index 9d820046376..b0cd6e3a805 100644 --- a/sys/arch/amd64/include/param.h +++ b/sys/arch/amd64/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.6 2005/07/31 15:31:11 miod Exp $ */ +/* $OpenBSD: param.h,v 1.7 2005/10/21 18:55:00 martin Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -153,8 +153,6 @@ #define x86_trunc_pdr(x) ((unsigned long)(x) & ~(NBPD_L2 - 1)) #define x86_btod(x) ((unsigned long)(x) >> L2_SHIFT) #define x86_dtob(x) ((unsigned long)(x) << L2_SHIFT) -#define x86_round_page(x) ((((unsigned long)(x)) + PGOFSET) & ~PGOFSET) -#define x86_trunc_page(x) ((unsigned long)(x) & ~PGOFSET) #define x86_btop(x) ((unsigned long)(x) >> PGSHIFT) #define x86_ptob(x) ((unsigned long)(x) << PGSHIFT) |