From 9aba88bf29eee8bf58aadbfe1a307e48b7e1a14d Mon Sep 17 00:00:00 2001 From: David Greenman Date: Wed, 31 Aug 1994 06:17:49 +0000 Subject: [PATCH] Rather than exclude bounce buffers support with NOBOUNCE, include it with BOUNCE_BUFFERS. This is more intuitive, and is better for future multiplatform support. Added BOUNCE_BUFFERS option to the GENERIC and LINT kernel config files. --- sys/amd64/amd64/machdep.c | 6 +++--- sys/amd64/amd64/vm_machdep.c | 6 +++--- sys/conf/NOTES | 4 +++- sys/i386/conf/GENERICAH | 3 ++- sys/i386/conf/GENERICBT | 3 ++- sys/i386/conf/LINT | 4 +++- sys/i386/conf/NOTES | 4 +++- sys/i386/i386/machdep.c | 6 +++--- sys/i386/i386/vm_machdep.c | 6 +++--- sys/kern/vfs_bio.c | 4 +++- sys/scsi/cd.c | 4 ++-- sys/scsi/scsi_base.c | 14 +++++++------- sys/scsi/sd.c | 6 ++---- sys/scsi/st.c | 4 ++-- 14 files changed, 41 insertions(+), 33 deletions(-) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 3ba8234190e..f91eafc2b21 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.56 1994/08/24 11:45:19 sos Exp $ + * $Id: machdep.c,v 1.57 1994/08/27 16:14:12 davidg Exp $ */ #include "npx.h" @@ -255,7 +255,7 @@ again: valloc(swbuf, struct buf, nswbuf); valloc(buf, struct buf, nbuf); -#ifndef NOBOUNCE +#ifdef BOUNCE_BUFFERS /* * If there is more than 16MB of memory, allocate some bounce buffers */ @@ -321,7 +321,7 @@ again: printf("using %d buffers containing %d bytes of memory\n", nbuf, bufpages * CLBYTES); -#ifndef NOBOUNCE +#ifdef BOUNCE_BUFFERS /* * init bounce buffers */ diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 906ea751623..7f92a6474c6 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -38,7 +38,7 @@ * * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ - * $Id: vm_machdep.c,v 1.25 1994/08/07 03:31:52 davidg Exp $ + * $Id: vm_machdep.c,v 1.26 1994/08/07 14:53:11 davidg Exp $ */ #include "npx.h" @@ -55,7 +55,7 @@ #include #include -#ifndef NOBOUNCE +#ifdef BOUNCE_BUFFERS vm_map_t io_map; volatile int kvasfreecnt; @@ -512,7 +512,7 @@ vm_bounce_init() bouncefree = bouncepages; } -#endif /* NOBOUNCE */ +#endif /* BOUNCE_BUFFERS */ /* * quick version of vm_fault */ diff --git a/sys/conf/NOTES b/sys/conf/NOTES index 6f6516cfefb..1d0d378d63c 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -4,7 +4,7 @@ # # This kernel is NOT MEANT to be runnable! # -# $Id: LINT,v 1.73 1994/08/27 16:23:03 davidg Exp $ +# $Id: LINT,v 1.74 1994/08/28 06:46:25 davidg Exp $ # machine "i386" @@ -44,6 +44,8 @@ options "BLANK_SAVER" #syscons "blank" screen saver #options ALLOW_CONFLICT_IOADDR #no IO addr conflict checks (PS/2 mice) #options ALLOW_CONFLICT_IRQ #no IRQ conflict checks (mport serial) +options BOUNCE_BUFFERS #include support for DMA bounce buffers + options "TCP_COMPAT_42" #tcp/ip compatible with 4.2 # ^^^ NOT RECOMMENDED FOR NORMAL USE options UCONSOLE #x console support diff --git a/sys/i386/conf/GENERICAH b/sys/i386/conf/GENERICAH index 3818f1d0bdd..e0eb3860421 100644 --- a/sys/i386/conf/GENERICAH +++ b/sys/i386/conf/GENERICAH @@ -1,7 +1,7 @@ # # GENERICAH -- Generic machine with WD/AHx family disks # -# $Id: GENERICAH,v 1.36 1994/08/09 08:17:08 davidg Exp $ +# $Id: GENERICAH,v 1.37 1994/08/19 00:00:38 phk Exp $ # machine "i386" @@ -35,6 +35,7 @@ options "FAT_CURSOR" #block cursor in syscons or pccons options "SCSI_DELAY=15" #Be pessimistic about Joe SCSI device options "NCONS=4" #4 virtual consoles options "STAR_SAVER" #syscons "stars" screen saver +options BOUNCE_BUFFERS #include support for DMA bounce buffers config kernel root on wd0 swap on wd0 and wd1 and sd0 and sd1 dumps on wd0 diff --git a/sys/i386/conf/GENERICBT b/sys/i386/conf/GENERICBT index 246a20e8f32..ebe0ebaed78 100644 --- a/sys/i386/conf/GENERICBT +++ b/sys/i386/conf/GENERICBT @@ -1,7 +1,7 @@ # # GENERICBT -- Generic machine with WD/BTx family disks # -# $Id: GENERICBT,v 1.35 1994/07/28 05:53:44 davidg Exp $ +# $Id: GENERICBT,v 1.36 1994/08/09 08:17:09 davidg Exp $ # machine "i386" @@ -35,6 +35,7 @@ options "FAT_CURSOR" #block cursor in syscons or pccons options "SCSI_DELAY=15" #Be pessimistic about Joe SCSI device options "NCONS=4" #4 virtual consoles options "STAR_SAVER" #syscons "stars" screen saver +options BOUNCE_BUFFERS #include support for DMA bounce buffers config kernel root on wd0 swap on wd0 and wd1 and sd0 and sd1 dumps on wd0 diff --git a/sys/i386/conf/LINT b/sys/i386/conf/LINT index 6f6516cfefb..1d0d378d63c 100644 --- a/sys/i386/conf/LINT +++ b/sys/i386/conf/LINT @@ -4,7 +4,7 @@ # # This kernel is NOT MEANT to be runnable! # -# $Id: LINT,v 1.73 1994/08/27 16:23:03 davidg Exp $ +# $Id: LINT,v 1.74 1994/08/28 06:46:25 davidg Exp $ # machine "i386" @@ -44,6 +44,8 @@ options "BLANK_SAVER" #syscons "blank" screen saver #options ALLOW_CONFLICT_IOADDR #no IO addr conflict checks (PS/2 mice) #options ALLOW_CONFLICT_IRQ #no IRQ conflict checks (mport serial) +options BOUNCE_BUFFERS #include support for DMA bounce buffers + options "TCP_COMPAT_42" #tcp/ip compatible with 4.2 # ^^^ NOT RECOMMENDED FOR NORMAL USE options UCONSOLE #x console support diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES index 6f6516cfefb..1d0d378d63c 100644 --- a/sys/i386/conf/NOTES +++ b/sys/i386/conf/NOTES @@ -4,7 +4,7 @@ # # This kernel is NOT MEANT to be runnable! # -# $Id: LINT,v 1.73 1994/08/27 16:23:03 davidg Exp $ +# $Id: LINT,v 1.74 1994/08/28 06:46:25 davidg Exp $ # machine "i386" @@ -44,6 +44,8 @@ options "BLANK_SAVER" #syscons "blank" screen saver #options ALLOW_CONFLICT_IOADDR #no IO addr conflict checks (PS/2 mice) #options ALLOW_CONFLICT_IRQ #no IRQ conflict checks (mport serial) +options BOUNCE_BUFFERS #include support for DMA bounce buffers + options "TCP_COMPAT_42" #tcp/ip compatible with 4.2 # ^^^ NOT RECOMMENDED FOR NORMAL USE options UCONSOLE #x console support diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 3ba8234190e..f91eafc2b21 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.56 1994/08/24 11:45:19 sos Exp $ + * $Id: machdep.c,v 1.57 1994/08/27 16:14:12 davidg Exp $ */ #include "npx.h" @@ -255,7 +255,7 @@ again: valloc(swbuf, struct buf, nswbuf); valloc(buf, struct buf, nbuf); -#ifndef NOBOUNCE +#ifdef BOUNCE_BUFFERS /* * If there is more than 16MB of memory, allocate some bounce buffers */ @@ -321,7 +321,7 @@ again: printf("using %d buffers containing %d bytes of memory\n", nbuf, bufpages * CLBYTES); -#ifndef NOBOUNCE +#ifdef BOUNCE_BUFFERS /* * init bounce buffers */ diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index 906ea751623..7f92a6474c6 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -38,7 +38,7 @@ * * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ - * $Id: vm_machdep.c,v 1.25 1994/08/07 03:31:52 davidg Exp $ + * $Id: vm_machdep.c,v 1.26 1994/08/07 14:53:11 davidg Exp $ */ #include "npx.h" @@ -55,7 +55,7 @@ #include #include -#ifndef NOBOUNCE +#ifdef BOUNCE_BUFFERS vm_map_t io_map; volatile int kvasfreecnt; @@ -512,7 +512,7 @@ vm_bounce_init() bouncefree = bouncepages; } -#endif /* NOBOUNCE */ +#endif /* BOUNCE_BUFFERS */ /* * quick version of vm_fault */ diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 509615b7a32..22b5c8ac665 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -16,7 +16,7 @@ * 4. Modifications may be freely made to this file if the above conditions * are met. * - * $Id: vfs_bio.c,v 1.9 1994/08/18 22:35:06 wollman Exp $ + * $Id: vfs_bio.c,v 1.10 1994/08/30 18:19:11 davidg Exp $ */ #include @@ -608,8 +608,10 @@ biodone(register struct buf *bp) vwakeup(bp); } +#ifdef BOUNCE_BUFFERS if (bp->b_flags & B_BOUNCE) vm_bounce_free(bp); +#endif /* call optional completion function if requested */ if (bp->b_flags & B_CALL) { diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c index 9317450e215..dc03c6b832a 100644 --- a/sys/scsi/cd.c +++ b/sys/scsi/cd.c @@ -14,7 +14,7 @@ * * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 * - * $Id: cd.c,v 1.20 1994/08/27 16:14:31 davidg Exp $ + * $Id: cd.c,v 1.21 1994/08/29 21:25:11 ache Exp $ */ #define SPLCD splbio @@ -424,7 +424,7 @@ cdstrategy(bp) /* * Use a bounce buffer if necessary */ -#ifndef NOBOUNCE +#ifdef BOUNCE_BUFFERS if (cd->sc_link->flags & SDEV_BOUNCE) vm_bounce_alloc(bp); #endif diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c index 8cf9584c5a3..e254cd94199 100644 --- a/sys/scsi/scsi_base.c +++ b/sys/scsi/scsi_base.c @@ -8,7 +8,7 @@ * file. * * Written by Julian Elischer (julian@dialix.oz.au) - * $Id: scsi_base.c,v 1.10 1994/08/20 03:48:58 davidg Exp $ + * $Id: scsi_base.c,v 1.11 1994/08/27 16:14:33 davidg Exp $ */ #define SPLSD splbio @@ -440,10 +440,10 @@ scsi_scsi_cmd(sc_link, scsi_cmd, cmdlen, data_addr, datalen, retval = EFAULT; goto bad; } -#ifdef NOBOUNCE - xs->data = malloc(datalen, M_TEMP, M_WAITOK); -#else +#ifdef BOUNCE_BUFFERS xs->data = (caddr_t) vm_bounce_kva_alloc( (datalen + PAGE_SIZE - 1)/PAGE_SIZE); +#else + xs->data = malloc(datalen, M_TEMP, M_WAITOK); #endif /* I think waiting is ok *//*XXX */ switch ((int)(flags & (SCSI_DATA_IN | SCSI_DATA_OUT))) { @@ -527,10 +527,10 @@ retry: bcopy(xs->data, data_addr, datalen); break; } -#ifdef NOBOUNCE - free(xs->data, M_TEMP); -#else +#ifdef BOUNCE_BUFFERS vm_bounce_kva_alloc_free(xs->data, (datalen + PAGE_SIZE - 1)/PAGE_SIZE, 0); +#else + free(xs->data, M_TEMP); #endif } /* diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index 39bfcb5957d..cd4a958521a 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -14,7 +14,7 @@ * * Ported to run under 386BSD by Julian Elischer (julian@dialix.oz.au) Sept 1992 * - * $Id: sd.c,v 1.27 1994/08/30 00:12:11 jkh Exp $ + * $Id: sd.c,v 1.28 1994/08/30 14:31:38 ache Exp $ */ #define SPLSD splbio @@ -419,12 +419,10 @@ sdstrategy(bp) /* * Use a bounce buffer if necessary */ -/* -#ifndef NOBOUNCE +#ifdef BOUNCE_BUFFERS if (sd->sc_link->flags & SDEV_BOUNCE) vm_bounce_alloc(bp); #endif -*/ /* * Place it in the queue of disk activities for this disk diff --git a/sys/scsi/st.c b/sys/scsi/st.c index 65a3109d1a6..4ecbe23f989 100644 --- a/sys/scsi/st.c +++ b/sys/scsi/st.c @@ -12,7 +12,7 @@ * on the understanding that TFS is not responsible for the correct * functioning of this software in any circumstances. * - * $Id$ + * $Id: st.c,v 1.17 1994/08/02 07:52:34 davidg Exp $ */ /* @@ -904,7 +904,7 @@ ststrategy(bp) /* * Use a bounce buffer if necessary */ -#ifndef NOBOUNCE +#ifdef BOUNCE_BUFFERS if (st->sc_link->flags & SDEV_BOUNCE) vm_bounce_alloc(bp); #endif