From 1988780eca61e41f0d80c1f65987b3bc6f5115be Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Sun, 15 Apr 2012 20:39:37 +0000 Subject: If the dma-usable area changes after autoconf, recompute the buffer count and invoke bufadjust() accordingly. Similar to what sysctl kern.bufcachepercent does. --- sys/arch/sgi/sgi/ip22_machdep.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'sys/arch/sgi') diff --git a/sys/arch/sgi/sgi/ip22_machdep.c b/sys/arch/sgi/sgi/ip22_machdep.c index 2d357b9e1bf..9c49a90d58d 100644 --- a/sys/arch/sgi/sgi/ip22_machdep.c +++ b/sys/arch/sgi/sgi/ip22_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip22_machdep.c,v 1.4 2012/04/15 20:38:10 miod Exp $ */ +/* $OpenBSD: ip22_machdep.c,v 1.5 2012/04/15 20:39:36 miod Exp $ */ /* * Copyright (c) 2012 Miodrag Vallat. @@ -19,6 +19,8 @@ #include #include #include +#include +#include #include @@ -338,6 +340,15 @@ ip22_post_autoconf() * Relax DMA-reachable memory constraints if no 28-bit hpc(4) * device has attached. */ - if (hpc_old == 0) + if (hpc_old == 0) { + uint64_t dmapages_before, dmapages; + + dmapages_before = uvm_pagecount(&dma_constraint); dma_constraint.ucr_high = (1UL << 32) - 1; + dmapages = uvm_pagecount(&dma_constraint); + if (dmapages_before != dmapages) { + bufadjust(bufcachepercent * dmapages / 100); + bufhighpages = bufpages; + } + } } -- cgit v1.2.3