summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/alpha/include/pmap.h6
-rw-r--r--sys/arch/hppa/hppa/pmap.c32
-rw-r--r--sys/arch/hppa/include/pmap.h6
-rw-r--r--sys/arch/powerpc/include/pmap.h6
-rw-r--r--sys/arch/vax/include/pmap.h6
-rw-r--r--sys/uvm/uvm_km.c80
6 files changed, 53 insertions, 83 deletions
diff --git a/sys/arch/alpha/include/pmap.h b/sys/arch/alpha/include/pmap.h
index ca60221e62a..e61bba6497d 100644
--- a/sys/arch/alpha/include/pmap.h
+++ b/sys/arch/alpha/include/pmap.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.h,v 1.16 2004/05/20 09:20:41 kettenis Exp $ */
+/* $OpenBSD: pmap.h,v 1.17 2004/06/09 20:17:23 tedu Exp $ */
/* $NetBSD: pmap.h,v 1.37 2000/11/19 03:16:35 thorpej Exp $ */
/*-
@@ -201,8 +201,8 @@ extern pt_entry_t *VPT; /* Virtual Page Table */
/*
* Alternate mapping hooks for pool pages. Avoids thrashing the TLB.
*/
-#define PMAP_MAP_POOLPAGE(pg) ALPHA_PHYS_TO_K0SEG(VM_PAGE_TO_PHYS(pg))
-#define PMAP_UNMAP_POOLPAGE(va) PHYS_TO_VM_PAGE(ALPHA_K0SEG_TO_PHYS((va)))
+#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)))
paddr_t vtophys(vaddr_t);
diff --git a/sys/arch/hppa/hppa/pmap.c b/sys/arch/hppa/hppa/pmap.c
index 035817fc8fe..6a934e460d2 100644
--- a/sys/arch/hppa/hppa/pmap.c
+++ b/sys/arch/hppa/hppa/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.111 2004/05/27 21:04:07 tedu Exp $ */
+/* $OpenBSD: pmap.c,v 1.112 2004/06/09 20:17:23 tedu Exp $ */
/*
* Copyright (c) 1998-2004 Michael Shalayeff
@@ -99,34 +99,6 @@ int pmap_initialized;
u_int hppa_prot[8];
-/*
- * workaround until the uvm_km_getpage can be used this early.
- */
-void *hppa_pool_page_alloc(struct pool *, int);
-void hppa_pool_page_free(struct pool *, void *);
-
-void *
-hppa_pool_page_alloc(struct pool *pp, int flags)
-{
- boolean_t waitok = (flags & PR_WAITOK) ? TRUE : FALSE;
-
- return ((void *)uvm_km_alloc_poolpage1(kmem_map, uvmexp.kmem_object,
- waitok));
-}
-
-void
-hppa_pool_page_free(struct pool *pp, void *v)
-{
-
- uvm_km_free_poolpage1(kmem_map, (vaddr_t)v);
-}
-
-struct pool_allocator hppa_pool_allocator = {
- hppa_pool_page_alloc, hppa_pool_page_free, 0,
-};
-
-
-
#define pmap_sid(pmap, va) \
(((va & 0xc0000000) != 0xc0000000)? pmap->pmap_space : HPPA_SID_KERNEL)
@@ -616,7 +588,7 @@ pmap_init()
pool_init(&pmap_pmap_pool, sizeof(struct pmap), 0, 0, 0, "pmappl",
&pool_allocator_nointr);
pool_init(&pmap_pv_pool, sizeof(struct pv_entry), 0, 0, 0, "pmappv",
- &hppa_pool_allocator);
+ NULL);
pmap_initialized = 1;
diff --git a/sys/arch/hppa/include/pmap.h b/sys/arch/hppa/include/pmap.h
index 234b48230c4..fc8989bb30d 100644
--- a/sys/arch/hppa/include/pmap.h
+++ b/sys/arch/hppa/include/pmap.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.h,v 1.30 2004/05/20 09:20:42 kettenis Exp $ */
+/* $OpenBSD: pmap.h,v 1.31 2004/06/09 20:17:23 tedu Exp $ */
/*
* Copyright (c) 2002-2004 Michael Shalayeff
@@ -83,8 +83,8 @@ extern struct pdc_hwtlb pdc_hwtlb;
/*
* pool quickmaps
*/
-#define PMAP_MAP_POOLPAGE(pg) ((vaddr_t)VM_PAGE_TO_PHYS(pg))
-#define PMAP_UNMAP_POOLPAGE(va) PHYS_TO_VM_PAGE((paddr_t)(va))
+#define pmap_map_direct(pg) ((vaddr_t)VM_PAGE_TO_PHYS(pg))
+#define pmap_unmap_direct(va) PHYS_TO_VM_PAGE((paddr_t)(va))
/*
* 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 d68eaa69ec6..e3725de4621 100644
--- a/sys/arch/powerpc/include/pmap.h
+++ b/sys/arch/powerpc/include/pmap.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.h,v 1.35 2004/05/20 09:20:42 kettenis Exp $ */
+/* $OpenBSD: pmap.h,v 1.36 2004/06/09 20:17:23 tedu Exp $ */
/* $NetBSD: pmap.h,v 1.1 1996/09/30 16:34:29 ws Exp $ */
/*-
@@ -119,8 +119,8 @@ boolean_t pteclrbits(paddr_t pa, u_int mask, u_int clear);
* Really simple. 0x0->0x80000000 contain 1->1 mappings of the physical
* memory. - XXX
*/
-#define PMAP_MAP_POOLPAGE(pg) ((vaddr_t)VM_PAGE_TO_PHYS(pg))
-#define PMAP_UNMAP_POOLPAGE(va) PHYS_TO_VM_PAGE((paddr_t)va)
+#define pmap_map_direct(pg) ((vaddr_t)VM_PAGE_TO_PHYS(pg))
+#define pmap_unmap_direct(va) PHYS_TO_VM_PAGE((paddr_t)va)
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 77409fe25de..86115c91dca 100644
--- a/sys/arch/vax/include/pmap.h
+++ b/sys/arch/vax/include/pmap.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.h,v 1.21 2004/05/20 09:20:42 kettenis Exp $ */
+/* $OpenBSD: pmap.h,v 1.22 2004/06/09 20:17:24 tedu Exp $ */
/* $NetBSD: pmap.h,v 1.37 1999/08/01 13:48:07 ragge Exp $ */
/*
@@ -108,8 +108,8 @@ extern struct pmap kernel_pmap_store;
* Real nice (fast) routines to get the virtual address of a physical page
* (and vice versa).
*/
-#define PMAP_MAP_POOLPAGE(pg) (VM_PAGE_TO_PHYS(pg) | KERNBASE)
-#define PMAP_UNMAP_POOLPAGE(va) PHYS_TO_VM_PAGE((va) & ~KERNBASE)
+#define pmap_map_direct(pg) (VM_PAGE_TO_PHYS(pg) | KERNBASE)
+#define pmap_unmap_direct(va) PHYS_TO_VM_PAGE((va) & ~KERNBASE)
#define PMAP_STEAL_MEMORY
diff --git a/sys/uvm/uvm_km.c b/sys/uvm/uvm_km.c
index 10b102eacff..8ce61d98b05 100644
--- a/sys/uvm/uvm_km.c
+++ b/sys/uvm/uvm_km.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_km.c,v 1.40 2004/05/31 22:53:49 tedu Exp $ */
+/* $OpenBSD: uvm_km.c,v 1.41 2004/06/09 20:17:23 tedu Exp $ */
/* $NetBSD: uvm_km.c,v 1.42 2001/01/14 02:10:01 thorpej Exp $ */
/*
@@ -814,8 +814,8 @@ uvm_km_valloc_wait(map, size)
}
/* Sanity; must specify both or none. */
-#if (defined(PMAP_MAP_POOLPAGE) || defined(PMAP_UNMAP_POOLPAGE)) && \
- (!defined(PMAP_MAP_POOLPAGE) || !defined(PMAP_UNMAP_POOLPAGE))
+#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
@@ -832,7 +832,7 @@ uvm_km_alloc_poolpage1(map, obj, waitok)
struct uvm_object *obj;
boolean_t waitok;
{
-#if defined(PMAP_MAP_POOLPAGE)
+#if defined(pmap_map_direct)
struct vm_page *pg;
vaddr_t va;
@@ -845,7 +845,7 @@ uvm_km_alloc_poolpage1(map, obj, waitok)
} else
return (0);
}
- va = PMAP_MAP_POOLPAGE(pg);
+ va = pmap_map_direct(pg);
if (__predict_false(va == 0))
uvm_pagefree(pg);
return (va);
@@ -867,7 +867,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_POOLPAGE */
+#endif /* pmap_map_direct */
}
/*
@@ -882,8 +882,8 @@ uvm_km_free_poolpage1(map, addr)
vm_map_t map;
vaddr_t addr;
{
-#if defined(PMAP_UNMAP_POOLPAGE)
- uvm_pagefree(PMAP_UNMAP_POOLPAGE(addr));
+#if defined(pmap_unmap_direct)
+ uvm_pagefree(pmap_unmap_direct(addr));
#else
int s;
@@ -900,11 +900,39 @@ uvm_km_free_poolpage1(map, addr)
s = splvm();
uvm_km_free(map, addr, PAGE_SIZE);
splx(s);
-#endif /* PMAP_UNMAP_POOLPAGE */
+#endif /* pmap_unmap_direct */
}
+#if defined(pmap_map_direct)
/*
- * uvm_km_page allocator
+ * uvm_km_page allocator, pmap_map_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.
+ */
+void
+uvm_km_page_init(void)
+{
+ /* nothing */
+}
+
+void *
+uvm_km_getpage(boolean_t waitok)
+{
+
+ return ((void *)uvm_km_alloc_poolpage1(NULL, NULL, waitok));
+}
+
+void
+uvm_km_putpage(void *v)
+{
+
+ uvm_km_free_poolpage1(NULL, (vaddr_t)v);
+}
+
+#else
+/*
+ * uvm_km_page allocator, non pmap_map_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.
@@ -937,23 +965,7 @@ uvm_km_page_init(void)
for (i = 0; i < uvm_km_pages_lowat * 4; i++) {
-#if defined(PMAP_MAP_POOLPAGE)
- struct vm_page *pg;
- vaddr_t va;
-
- pg = uvm_pagealloc(NULL, 0, NULL, 0);
- if (__predict_false(pg == NULL))
- break;
-
- va = PMAP_MAP_POOLPAGE(pg);
- if (__predict_false(va == 0)) {
- uvm_pagefree(pg);
- break;
- }
- page = (void *)va;
-#else
page = (void *)uvm_km_alloc(kernel_map, PAGE_SIZE);
-#endif
page->next = uvm_km_pages_head;
uvm_km_pages_head = page;
}
@@ -985,22 +997,7 @@ uvm_km_thread(void *arg)
tsleep(&uvm_km_pages_head, PVM, "kmalloc", 0);
want = 16;
for (i = 0; i < want; i++) {
-#if defined(PMAP_MAP_POOLPAGE)
- struct vm_page *pg;
- vaddr_t va;
-
- pg = uvm_pagealloc(NULL, 0, NULL, UVM_PGA_USERESERVE);
- if (__predict_false(pg == NULL))
- break;
- va = PMAP_MAP_POOLPAGE(pg);
- if (__predict_false(va == 0)) {
- uvm_pagefree(pg);
- break;
- }
- page = (void *)va;
-#else
page = (void *)uvm_km_alloc(kernel_map, PAGE_SIZE);
-#endif
if (i == 0)
head = tail = page;
page->next = head;
@@ -1056,3 +1053,4 @@ uvm_km_putpage(void *v)
uvm_km_pages_free++;
splx(s);
}
+#endif