From caaa004d3305f4bd44dfccc00895c7a3baa34e89 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Tue, 13 Jul 2004 14:51:30 +0000 Subject: #define __HAVE_PMAP_DIRECT and use it. requested by art --- sys/arch/alpha/include/pmap.h | 3 ++- sys/arch/hppa/include/pmap.h | 3 ++- sys/arch/powerpc/include/pmap.h | 3 ++- sys/arch/vax/include/pmap.h | 3 ++- sys/uvm/uvm_km.c | 22 ++++++++-------------- 5 files changed, 16 insertions(+), 18 deletions(-) (limited to 'sys') diff --git a/sys/arch/alpha/include/pmap.h b/sys/arch/alpha/include/pmap.h index 1a5c4784915..215e4015ce0 100644 --- a/sys/arch/alpha/include/pmap.h +++ b/sys/arch/alpha/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.18 2004/06/13 21:49:12 niklas Exp $ */ +/* $OpenBSD: pmap.h,v 1.19 2004/07/13 14:51:29 tedu Exp $ */ /* $NetBSD: pmap.h,v 1.37 2000/11/19 03:16:35 thorpej Exp $ */ /*- @@ -203,6 +203,7 @@ extern pt_entry_t *VPT; /* Virtual Page Table */ */ #define pmap_map_direct(pg) ALPHA_PHYS_TO_K0SEG(VM_PAGE_TO_PHYS(pg)) #define pmap_unmap_direct(va) PHYS_TO_VM_PAGE(ALPHA_K0SEG_TO_PHYS((va))) +#define __HAVE_PMAP_DIRECT paddr_t vtophys(vaddr_t); diff --git a/sys/arch/hppa/include/pmap.h b/sys/arch/hppa/include/pmap.h index fc8989bb30d..f70b2e3448d 100644 --- a/sys/arch/hppa/include/pmap.h +++ b/sys/arch/hppa/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.31 2004/06/09 20:17:23 tedu Exp $ */ +/* $OpenBSD: pmap.h,v 1.32 2004/07/13 14:51:29 tedu Exp $ */ /* * Copyright (c) 2002-2004 Michael Shalayeff @@ -85,6 +85,7 @@ extern struct pdc_hwtlb pdc_hwtlb; */ #define pmap_map_direct(pg) ((vaddr_t)VM_PAGE_TO_PHYS(pg)) #define pmap_unmap_direct(va) PHYS_TO_VM_PAGE((paddr_t)(va)) +#define __HAVE_PMAP_DIRECT /* * according to the parisc manual aliased va's should be diff --git a/sys/arch/powerpc/include/pmap.h b/sys/arch/powerpc/include/pmap.h index e3725de4621..30afd6d892d 100644 --- a/sys/arch/powerpc/include/pmap.h +++ b/sys/arch/powerpc/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.36 2004/06/09 20:17:23 tedu Exp $ */ +/* $OpenBSD: pmap.h,v 1.37 2004/07/13 14:51:29 tedu Exp $ */ /* $NetBSD: pmap.h,v 1.1 1996/09/30 16:34:29 ws Exp $ */ /*- @@ -121,6 +121,7 @@ boolean_t pteclrbits(paddr_t pa, u_int mask, u_int clear); */ #define pmap_map_direct(pg) ((vaddr_t)VM_PAGE_TO_PHYS(pg)) #define pmap_unmap_direct(va) PHYS_TO_VM_PAGE((paddr_t)va) +#define __HAVE_PMAP_DIRECT void pmap_bootstrap(u_int kernelstart, u_int kernelend); diff --git a/sys/arch/vax/include/pmap.h b/sys/arch/vax/include/pmap.h index 86115c91dca..791bca39020 100644 --- a/sys/arch/vax/include/pmap.h +++ b/sys/arch/vax/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.22 2004/06/09 20:17:24 tedu Exp $ */ +/* $OpenBSD: pmap.h,v 1.23 2004/07/13 14:51:29 tedu Exp $ */ /* $NetBSD: pmap.h,v 1.37 1999/08/01 13:48:07 ragge Exp $ */ /* @@ -110,6 +110,7 @@ extern struct pmap kernel_pmap_store; */ #define pmap_map_direct(pg) (VM_PAGE_TO_PHYS(pg) | KERNBASE) #define pmap_unmap_direct(va) PHYS_TO_VM_PAGE((va) & ~KERNBASE) +#define __HAVE_PMAP_DIRECT #define PMAP_STEAL_MEMORY diff --git a/sys/uvm/uvm_km.c b/sys/uvm/uvm_km.c index 8ce61d98b05..f8ce0486b85 100644 --- a/sys/uvm/uvm_km.c +++ b/sys/uvm/uvm_km.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_km.c,v 1.41 2004/06/09 20:17:23 tedu Exp $ */ +/* $OpenBSD: uvm_km.c,v 1.42 2004/07/13 14:51:29 tedu Exp $ */ /* $NetBSD: uvm_km.c,v 1.42 2001/01/14 02:10:01 thorpej Exp $ */ /* @@ -813,12 +813,6 @@ uvm_km_valloc_wait(map, size) return uvm_km_valloc_prefer_wait(map, size, UVM_UNKNOWN_OFFSET); } -/* Sanity; must specify both or none. */ -#if (defined(pmap_map_direct) || defined(pmap_unmap_direct)) && \ - (!defined(pmap_map_direct) || !defined(pmap_unmap_direct)) -#error Must specify MAP and UNMAP together. -#endif - /* * uvm_km_alloc_poolpage: allocate a page for the pool allocator * @@ -832,7 +826,7 @@ uvm_km_alloc_poolpage1(map, obj, waitok) struct uvm_object *obj; boolean_t waitok; { -#if defined(pmap_map_direct) +#if defined(__HAVE_PMAP_DIRECT) struct vm_page *pg; vaddr_t va; @@ -867,7 +861,7 @@ uvm_km_alloc_poolpage1(map, obj, waitok) va = uvm_km_kmemalloc(map, obj, PAGE_SIZE, waitok ? 0 : UVM_KMF_NOWAIT); splx(s); return (va); -#endif /* pmap_map_direct */ +#endif /* __HAVE_PMAP_DIRECT */ } /* @@ -882,7 +876,7 @@ uvm_km_free_poolpage1(map, addr) vm_map_t map; vaddr_t addr; { -#if defined(pmap_unmap_direct) +#if defined(__HAVE_PMAP_DIRECT) uvm_pagefree(pmap_unmap_direct(addr)); #else int s; @@ -900,12 +894,12 @@ uvm_km_free_poolpage1(map, addr) s = splvm(); uvm_km_free(map, addr, PAGE_SIZE); splx(s); -#endif /* pmap_unmap_direct */ +#endif /* __HAVE_PMAP_DIRECT */ } -#if defined(pmap_map_direct) +#if defined(__HAVE_PMAP_DIRECT) /* - * uvm_km_page allocator, pmap_map_direct arch + * uvm_km_page allocator, __HAVE_PMAP_DIRECT arch * On architectures with machine memory direct mapped into a portion * of KVM, we have very little work to do. Just get a physical page, * and find and return its VA. We use the poolpage functions for this. @@ -932,7 +926,7 @@ uvm_km_putpage(void *v) #else /* - * uvm_km_page allocator, non pmap_map_direct archs + * uvm_km_page allocator, non __HAVE_PMAP_DIRECT archs * This is a special allocator that uses a reserve of free pages * to fulfill requests. It is fast and interrupt safe, but can only * return page sized regions. Its primary use is as a backend for pool. -- cgit v1.2.3