diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2006-12-10 16:14:23 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2006-12-10 16:14:23 +0000 |
commit | e6d061f3c8691343402c856cf60a7cf4fc04f0c4 (patch) | |
tree | a93e1a28971563fb6d8912d9d6e22e0584837818 /sys/arch/sparc | |
parent | 9a4ce0926fa2cb418e26650757609de24f07598f (diff) |
Allow ``flags 0'' to work to disable DMA for si(4) and sw(4) - it would get
ignored previously.
Diffstat (limited to 'sys/arch/sparc')
-rw-r--r-- | sys/arch/sparc/conf/GENERIC | 7 | ||||
-rw-r--r-- | sys/arch/sparc/conf/RAMDISK | 7 | ||||
-rw-r--r-- | sys/arch/sparc/conf/SUN4 | 7 | ||||
-rw-r--r-- | sys/arch/sparc/dev/si.c | 72 |
4 files changed, 43 insertions, 50 deletions
diff --git a/sys/arch/sparc/conf/GENERIC b/sys/arch/sparc/conf/GENERIC index d1ed844d077..465502156cd 100644 --- a/sys/arch/sparc/conf/GENERIC +++ b/sys/arch/sparc/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.88 2006/12/09 20:06:46 miod Exp $ +# $OpenBSD: GENERIC,v 1.89 2006/12/10 16:14:20 miod Exp $ # # For further information on compiling OpenBSD kernels, see the config(8) # man page. @@ -222,15 +222,14 @@ xy* at xyc? # E.g. the following would enable DMA, interrupts, and reselect: # si0 at vmes0 addr 0xff200000 level 3 vect 0x40 flags 0x07 # -# By default, DMA is enabled in the driver. -si0 at vmes0 addr 0xff200000 level 3 vect 0x40 +si0 at vmes0 addr 0xff200000 level 3 vect 0x40 flags 0x01 # NCR5380-based "SCSI Weird" on-board SCSI interface found # on sun4/100 systems. The flags are the same as the "si" # controller. Note, while DMA is enabled by default, only # polled DMA works at this time, and reselects do not work # on this particular controller. -sw0 at obio0 addr 0x0a000000 level 3 +sw0 at obio0 addr 0x0a000000 level 3 flags 0x01 # Sun "bwtwo" black and white framebuffer, found on sun4, sun4c, and sun4m # systems. diff --git a/sys/arch/sparc/conf/RAMDISK b/sys/arch/sparc/conf/RAMDISK index 353a53e5a88..d99b0e16c2c 100644 --- a/sys/arch/sparc/conf/RAMDISK +++ b/sys/arch/sparc/conf/RAMDISK @@ -1,4 +1,4 @@ -# $OpenBSD: RAMDISK,v 1.59 2006/12/09 20:06:46 miod Exp $ +# $OpenBSD: RAMDISK,v 1.60 2006/12/10 16:14:20 miod Exp $ # $NetBSD: GENERIC,v 1.28.2.1 1996/07/02 23:55:22 jtc Exp $ # Machine architecture; required by config(8) @@ -227,15 +227,14 @@ xy* at xyc? # E.g. the following would enable DMA, interrupts, and reselect: # si0 at vmes0 addr 0xff200000 level 3 vect 0x40 flags 0x07 # -# By default, DMA is enabled in the driver. -si0 at vmes0 addr 0xff200000 level 3 vect 0x40 +si0 at vmes0 addr 0xff200000 level 3 vect 0x40 flags 0x01 # NCR5380-based "SCSI Weird" on-board SCSI interface found # on sun4/100 systems. The flags are the same as the "si" # controller. Note, while DMA is enabled by default, only # polled DMA works at this time, and reselects do not work # on this particular controller. -sw0 at obio0 addr 0x0a000000 level 3 +sw0 at obio0 addr 0x0a000000 level 3 flags 0x01 # Sun "bwtwo" black and white framebuffer, found on sun4, sun4c, and sun4m # systems. diff --git a/sys/arch/sparc/conf/SUN4 b/sys/arch/sparc/conf/SUN4 index f3ac769aa54..5f56dcad435 100644 --- a/sys/arch/sparc/conf/SUN4 +++ b/sys/arch/sparc/conf/SUN4 @@ -1,4 +1,4 @@ -# $OpenBSD: SUN4,v 1.34 2006/12/09 20:06:46 miod Exp $ +# $OpenBSD: SUN4,v 1.35 2006/12/10 16:14:20 miod Exp $ # $NetBSD: GENERIC,v 1.28.2.1 1996/07/02 23:55:22 jtc Exp $ # Machine architecture; required by config(8) @@ -123,15 +123,14 @@ xy* at xyc? # E.g. the following would enable DMA, interrupts, and reselect: # si0 at vmes0 addr 0xff200000 level 3 vect 0x40 flags 0x07 # -# By default, DMA is enabled in the driver. -si0 at vmes0 addr 0xff200000 level 3 vect 0x40 +si0 at vmes0 addr 0xff200000 level 3 vect 0x40 flags 0x01 # NCR5380-based "SCSI Weird" on-board SCSI interface found # on sun4/100 systems. The flags are the same as the "si" # controller. Note, while DMA is enabled by default, only # polled DMA works at this time, and reselects do not work # on this particular controller. -sw0 at obio0 addr 0x0a000000 level 3 +sw0 at obio0 addr 0x0a000000 level 3 flags 0x01 # Sun "bwtwo" black and white framebuffer, found on sun4, sun4c, and sun4m # systems. diff --git a/sys/arch/sparc/dev/si.c b/sys/arch/sparc/dev/si.c index b8a9e864885..62230803147 100644 --- a/sys/arch/sparc/dev/si.c +++ b/sys/arch/sparc/dev/si.c @@ -1,4 +1,4 @@ -/* $OpenBSD: si.c,v 1.22 2006/11/28 23:59:45 dlg Exp $ */ +/* $OpenBSD: si.c,v 1.23 2006/12/10 16:14:22 miod Exp $ */ /* $NetBSD: si.c,v 1.38 1997/08/27 11:24:20 bouyer Exp $ */ /*- @@ -177,26 +177,19 @@ struct si_softc { }; /* - * Options. By default, DMA is enabled and DMA completion interrupts - * and reselect are disabled. You may enable additional features + * Options. By default, configuration files enable DMA and disable + * DMA completion interrupts and reselect. You may enable additional features * the `flags' directive in your kernel's configuration file. * - * Alternatively, you can patch your kernel with DDB or some other - * mechanism. The sc_options member of the softc is OR'd with - * the value in si_options. - * * On the "sw", interrupts (and thus) reselection don't work, so they're - * disabled by default. DMA is still a little dangerous, too. - * - * Note, there's a separate sw_options to make life easier. + * disabled. DMA is still a little dangerous, too. */ #define SI_ENABLE_DMA 0x01 /* Use DMA (maybe polled) */ #define SI_DMA_INTR 0x02 /* DMA completion interrupts */ #define SI_DO_RESELECT 0x04 /* Allow disconnect/reselect */ #define SI_OPTIONS_MASK (SI_ENABLE_DMA|SI_DMA_INTR|SI_DO_RESELECT) +#define SW_OPTIONS_MASK (SI_ENABLE_DMA) #define SI_OPTIONS_BITS "\10\3RESELECT\2DMA_INTR\1DMA" -int si_options = SI_ENABLE_DMA; -int sw_options = SI_ENABLE_DMA; /* How long to wait for DMA before declaring an error. */ int si_dma_intr_timo = 500; /* ticks (sec. X 100) */ @@ -342,12 +335,8 @@ si_attach(parent, self, args) * Pull in the options flags. Allow the user to completely * override the default values. */ - if ((ncr_sc->sc_dev.dv_cfdata->cf_flags & SI_OPTIONS_MASK) != 0) - sc->sc_options = - (ncr_sc->sc_dev.dv_cfdata->cf_flags & SI_OPTIONS_MASK); - else - sc->sc_options = - (ca->ca_bustype == BUS_OBIO) ? sw_options : si_options; + sc->sc_options = ncr_sc->sc_dev.dv_cfdata->cf_flags & + (ca->ca_bustype == BUS_OBIO ? SW_OPTIONS_MASK : SI_OPTIONS_MASK); /* Map the controller registers. */ regs = (struct si_regs *) @@ -379,31 +368,37 @@ si_attach(parent, self, args) */ ncr_sc->sc_pio_out = ncr5380_pio_out; ncr_sc->sc_pio_in = ncr5380_pio_in; - ncr_sc->sc_dma_alloc = si_dma_alloc; - ncr_sc->sc_dma_free = si_dma_free; - ncr_sc->sc_dma_poll = si_dma_poll; + if (sc->sc_options & SI_ENABLE_DMA) { + ncr_sc->sc_dma_alloc = si_dma_alloc; + ncr_sc->sc_dma_free = si_dma_free; + ncr_sc->sc_dma_poll = si_dma_poll; + } switch (ca->ca_bustype) { case BUS_VME16: - ncr_sc->sc_dma_setup = si_vme_dma_setup; - ncr_sc->sc_dma_start = si_vme_dma_start; - ncr_sc->sc_dma_eop = si_vme_dma_stop; - ncr_sc->sc_dma_stop = si_vme_dma_stop; - if (sc->sc_options & SI_DO_RESELECT) { - /* - * Need to enable interrupts (and DMA!) - * on this H/W for reselect to work. - */ - ncr_sc->sc_intr_on = si_vme_intr_on; - ncr_sc->sc_intr_off = si_vme_intr_off; + if (sc->sc_options & SI_ENABLE_DMA) { + ncr_sc->sc_dma_setup = si_vme_dma_setup; + ncr_sc->sc_dma_start = si_vme_dma_start; + ncr_sc->sc_dma_eop = si_vme_dma_stop; + ncr_sc->sc_dma_stop = si_vme_dma_stop; + if (sc->sc_options & SI_DO_RESELECT) { + /* + * Need to enable interrupts (and DMA!) + * on this H/W for reselect to work. + */ + ncr_sc->sc_intr_on = si_vme_intr_on; + ncr_sc->sc_intr_off = si_vme_intr_off; + } } break; case BUS_OBIO: - ncr_sc->sc_dma_setup = si_obio_dma_setup; - ncr_sc->sc_dma_start = si_obio_dma_start; - ncr_sc->sc_dma_eop = si_obio_dma_stop; - ncr_sc->sc_dma_stop = si_obio_dma_stop; + if (sc->sc_options & SI_ENABLE_DMA) { + ncr_sc->sc_dma_setup = si_obio_dma_setup; + ncr_sc->sc_dma_start = si_obio_dma_start; + ncr_sc->sc_dma_eop = si_obio_dma_stop; + ncr_sc->sc_dma_stop = si_obio_dma_stop; + } ncr_sc->sc_intr_on = si_obio_intr_on; ncr_sc->sc_intr_off = si_obio_intr_off; break; @@ -416,7 +411,8 @@ si_attach(parent, self, args) ncr_sc->sc_flags = 0; if ((sc->sc_options & SI_DO_RESELECT) == 0) ncr_sc->sc_flags |= NCR5380_PERMIT_RESELECT; - if ((sc->sc_options & SI_DMA_INTR) == 0) + if ((sc->sc_options & (SI_ENABLE_DMA | SI_DMA_INTR)) != + (SI_ENABLE_DMA | SI_DMA_INTR)) ncr_sc->sc_flags |= NCR5380_FORCE_POLLING; ncr_sc->sc_min_dma_len = MIN_DMA_LEN; @@ -469,11 +465,11 @@ si_attach(parent, self, args) break; } printf(" pri %d\n", ra->ra_intr[0].int_pri); +#ifdef DEBUG if (sc->sc_options) { printf("%s: options=%b\n", ncr_sc->sc_dev.dv_xname, sc->sc_options, SI_OPTIONS_BITS); } -#ifdef DEBUG if (si_debug) printf("si: Set TheSoftC=%p TheRegs=%p\n", sc, regs); ncr_sc->sc_link.flags |= si_link_flags; |