summaryrefslogtreecommitdiff
path: root/sys/arch/sparc/dev
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2006-12-10 16:14:23 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2006-12-10 16:14:23 +0000
commite6d061f3c8691343402c856cf60a7cf4fc04f0c4 (patch)
treea93e1a28971563fb6d8912d9d6e22e0584837818 /sys/arch/sparc/dev
parent9a4ce0926fa2cb418e26650757609de24f07598f (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/dev')
-rw-r--r--sys/arch/sparc/dev/si.c72
1 files changed, 34 insertions, 38 deletions
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;