summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/dev/pci/brooktree848.c6
-rw-r--r--sys/vm/vm_page.c30
-rw-r--r--sys/vm/vm_page.h4
3 files changed, 37 insertions, 3 deletions
diff --git a/sys/dev/pci/brooktree848.c b/sys/dev/pci/brooktree848.c
index aafc04baa68..b0080d46008 100644
--- a/sys/dev/pci/brooktree848.c
+++ b/sys/dev/pci/brooktree848.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: brooktree848.c,v 1.6 1999/01/30 23:43:57 niklas Exp $ */
+/* $OpenBSD: brooktree848.c,v 1.7 1999/02/19 02:54:38 deraadt Exp $ */
/* $FreeBSD: brooktree848.c,v 1.64 1999/01/28 17:47:47 roger Exp $ */
/* BT848 Driver for Brooktree's Bt848, Bt849, Bt878 and Bt 879 based cards.
The Brooktree BT848 Driver driver is based upon Mark Tinguely and
@@ -6448,6 +6448,7 @@ vm_page_alloc_contig(size, low, high, alignment)
}
#else /* !UVM */
+#ifndef __OpenBSD__
#define TAILQ_FIRST(head) ((head)->tqh_first)
#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
@@ -6477,6 +6478,9 @@ vm_page_alloc_contig(size, low, high, alignment)
}
return addr;
}
+
+#endif
+
#endif /* !UVM */
#endif /* __NetBSD__ */
#endif
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index f2226691247..766c274f933 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_page.c,v 1.15 1998/10/30 18:28:03 mickey Exp $ */
+/* $OpenBSD: vm_page.c,v 1.16 1999/02/19 02:54:36 deraadt Exp $ */
/* $NetBSD: vm_page.c,v 1.41 1998/02/08 18:24:52 thorpej Exp $ */
#define VM_PAGE_ALLOC_MEMORY_STATS
@@ -115,6 +115,7 @@
#include <vm/vm.h>
#include <vm/vm_page.h>
+#include <vm/vm_kern.h>
#include <vm/vm_map.h>
#include <vm/vm_pageout.h>
@@ -1818,6 +1819,33 @@ vm_page_alloc_memory(size, low, high, alignment, boundary,
return (error);
}
+vm_offset_t
+vm_page_alloc_contig(size, low, high, alignment)
+ vm_offset_t size;
+ vm_offset_t low;
+ vm_offset_t high;
+ vm_offset_t alignment;
+{
+ struct pglist mlist;
+ struct vm_page *m;
+ vm_offset_t addr, tmp_addr;
+
+ TAILQ_INIT(&mlist);
+ if (vm_page_alloc_memory(size, low, high, alignment, 0,
+ &mlist, 1, FALSE))
+ return 0;
+ addr = tmp_addr = kmem_alloc_pageable(kernel_map, size);
+ for (m = TAILQ_FIRST(&mlist); m != NULL; m = TAILQ_NEXT(m, pageq)) {
+ vm_page_insert(m, kernel_object,
+ tmp_addr - VM_MIN_KERNEL_ADDRESS);
+ vm_page_wire(m);
+ pmap_enter(pmap_kernel(), tmp_addr, VM_PAGE_TO_PHYS(m),
+ VM_PROT_READ|VM_PROT_WRITE, TRUE);
+ tmp_addr += PAGE_SIZE;
+ }
+ return addr;
+}
+
/*
* vm_page_free_memory:
*
diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h
index 8ee9f33634a..0a0de773827 100644
--- a/sys/vm/vm_page.h
+++ b/sys/vm/vm_page.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_page.h,v 1.6 1998/03/20 15:40:38 niklas Exp $ */
+/* $OpenBSD: vm_page.h,v 1.7 1999/02/19 02:54:38 deraadt Exp $ */
/* $NetBSD: vm_page.h,v 1.24 1998/02/10 14:09:03 mrg Exp $ */
/*
@@ -327,6 +327,8 @@ static int vm_physseg_find __P((vm_offset_t, int *));
void vm_page_activate __P((vm_page_t));
vm_page_t vm_page_alloc __P((vm_object_t, vm_offset_t));
+vm_offset_t vm_page_alloc_contig(vm_offset_t, vm_offset_t,
+ vm_offset_t, vm_offset_t);
int vm_page_alloc_memory __P((vm_size_t size, vm_offset_t low,
vm_offset_t high, vm_offset_t alignment, vm_offset_t boundary,
struct pglist *rlist, int nsegs, int waitok));