summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2005-11-23 09:32:47 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2005-11-23 09:32:47 +0000
commitf0b99874bcc46c2cd20298d03ab79b8024bbba3f (patch)
tree3b0440e20085125abfa3edf037dc7a4211737f36
parentb798e30277e3f181d9ea559fa8f352c70f5bbcb9 (diff)
prioritise <16m memory for isa bus_dma'ble memorble memory allocations
-rw-r--r--sys/arch/i386/i386/machdep.c12
-rw-r--r--sys/arch/i386/isa/isa_machdep.c7
-rw-r--r--sys/arch/i386/isa/isa_machdep.h7
3 files changed, 15 insertions, 11 deletions
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index 6923d56d28f..e6177e83bc0 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.332 2005/11/18 17:11:57 brad Exp $ */
+/* $OpenBSD: machdep.c,v 1.333 2005/11/23 09:32:46 mickey Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -4160,12 +4160,16 @@ _bus_dmamem_alloc_range(t, size, alignment, boundary, segs, nsegs, rsegs,
/* Always round the size. */
size = round_page(size);
+ TAILQ_INIT(&mlist);
/*
* Allocate pages from the VM system.
+ * For non-ISA mappings first try higher memory segments.
*/
- TAILQ_INIT(&mlist);
- error = uvm_pglistalloc(size, low, high,
- alignment, boundary, &mlist, nsegs, (flags & BUS_DMA_NOWAIT) == 0);
+ if (high <= ISA_DMA_BOUNCE_THRESHOLD || (error = uvm_pglistalloc(size,
+ round_page(ISA_DMA_BOUNCE_THRESHOLD), high, alignment, boundary,
+ &mlist, nsegs, (flags & BUS_DMA_NOWAIT) == 0)))
+ error = uvm_pglistalloc(size, low, high, alignment, boundary,
+ &mlist, nsegs, (flags & BUS_DMA_NOWAIT) == 0);
if (error)
return (error);
diff --git a/sys/arch/i386/isa/isa_machdep.c b/sys/arch/i386/isa/isa_machdep.c
index 6598f51e810..c833ec18d38 100644
--- a/sys/arch/i386/isa/isa_machdep.c
+++ b/sys/arch/i386/isa/isa_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: isa_machdep.c,v 1.52 2005/11/23 09:24:54 mickey Exp $ */
+/* $OpenBSD: isa_machdep.c,v 1.53 2005/11/23 09:32:46 mickey Exp $ */
/* $NetBSD: isa_machdep.c,v 1.22 1997/06/12 23:57:32 thorpej Exp $ */
#define ISA_DMA_STATS
@@ -144,11 +144,6 @@
#include "isadma.h"
-/*
- * ISA can only DMA to 0-16M.
- */
-#define ISA_DMA_BOUNCE_THRESHOLD 0x00ffffff
-
extern paddr_t avail_end;
#define IDTVEC(name) __CONCAT(X,name)
diff --git a/sys/arch/i386/isa/isa_machdep.h b/sys/arch/i386/isa/isa_machdep.h
index 6c502120dd0..9847f0e4db6 100644
--- a/sys/arch/i386/isa/isa_machdep.h
+++ b/sys/arch/i386/isa/isa_machdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: isa_machdep.h,v 1.19 2003/06/02 23:27:47 millert Exp $ */
+/* $OpenBSD: isa_machdep.h,v 1.20 2005/11/23 09:32:46 mickey Exp $ */
/* $NetBSD: isa_machdep.h,v 1.7 1997/06/06 23:28:42 thorpej Exp $ */
/*-
@@ -83,6 +83,11 @@
#include <machine/bus.h>
/*
+ * ISA can only DMA to 0-16M.
+ */
+#define ISA_DMA_BOUNCE_THRESHOLD 0x00ffffff
+
+/*
* XXX THIS FILE IS A MESS. copyright: berkeley's probably.
* contents from isavar.h and isareg.h, mostly the latter.
* perhaps charles's?