summaryrefslogtreecommitdiff
path: root/sys/arch/sun3/dev/si_obio.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/sun3/dev/si_obio.c')
-rw-r--r--sys/arch/sun3/dev/si_obio.c108
1 files changed, 33 insertions, 75 deletions
diff --git a/sys/arch/sun3/dev/si_obio.c b/sys/arch/sun3/dev/si_obio.c
index 61c073f81a6..793c0a3b26c 100644
--- a/sys/arch/sun3/dev/si_obio.c
+++ b/sys/arch/sun3/dev/si_obio.c
@@ -1,10 +1,12 @@
-/* $NetBSD: si_obio.c,v 1.2 1996/06/17 23:21:35 gwr Exp $ */
+/* $NetBSD: si_obio.c,v 1.7 1996/11/20 18:57:00 gwr Exp $ */
-/*
- * Copyright (c) 1995 David Jones, Gordon W. Ross
- * Copyright (c) 1994 Adam Glass
+/*-
+ * Copyright (c) 1996 The NetBSD Foundation, Inc.
* All rights reserved.
*
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Adam Glass, David Jones, and Gordon W. Ross.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,23 +15,25 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. The name of the authors may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- * 4. All advertising materials mentioning features or use of this software
+ * 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by
- * Adam Glass, David Jones, and Gordon Ross
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
/*
@@ -128,9 +132,6 @@ struct cfattach si_obio_ca = {
/* Options. Interesting values are: 1,3,7 */
/* XXX: Using 1 for now to mask a (pmap?) bug not yet found... */
int si_obio_options = 1; /* XXX */
-#define SI_ENABLE_DMA 1 /* Use DMA (maybe polled) */
-#define SI_DMA_INTR 2 /* DMA completion interrupts */
-#define SI_DO_RESELECT 4 /* Allow disconnect/reselect */
static int
@@ -140,38 +141,16 @@ si_obio_match(parent, vcf, args)
{
struct cfdata *cf = vcf;
struct confargs *ca = args;
- int pa, x;
-
-#ifdef DIAGNOSTIC
- if (ca->ca_bustype != BUS_OBIO) {
- printf("si_obio_match: bustype %d?\n", ca->ca_bustype);
- return (0);
- }
-#endif
- /*
- * OBIO match functions may be called for every possible
- * physical address, so match only our physical address.
- */
- if ((pa = cf->cf_paddr) == -1) {
- /* Use our default PA. */
- pa = OBIO_NCR_SCSI;
- }
- if (pa != ca->ca_paddr)
+ /* Make sure there is something there... */
+ if (bus_peek(ca->ca_bustype, ca->ca_paddr + 1, 1) == -1)
return (0);
-#if 0
- if ((cpu_machine_id != SUN3_MACH_50) &&
- (cpu_machine_id != SUN3_MACH_60) )
- {
- /* Only 3/50 and 3/60 have the obio si. */
- return (0);
- }
-#endif
+ /* Default interrupt priority. */
+ if (ca->ca_intpri == -1)
+ ca->ca_intpri = 2;
- /* Make sure there is something there... */
- x = bus_peek(ca->ca_bustype, ca->ca_paddr + 1, 1);
- return (x != -1);
+ return (1);
}
static void
@@ -183,21 +162,10 @@ si_obio_attach(parent, self, args)
struct ncr5380_softc *ncr_sc = &sc->ncr_sc;
struct cfdata *cf = self->dv_cfdata;
struct confargs *ca = args;
- int intpri;
-
- /* Default interrupt level. */
- if ((intpri = cf->cf_intpri) == -1)
- intpri = 2;
- printf(" level %d", intpri);
- /* XXX: Get options from flags... */
- printf(" : options=%d\n", si_obio_options);
-
- ncr_sc->sc_flags = 0;
- if (si_obio_options & SI_DO_RESELECT)
- ncr_sc->sc_flags |= NCR5380_PERMIT_RESELECT;
- if ((si_obio_options & SI_DMA_INTR) == 0)
- ncr_sc->sc_flags |= NCR5380_FORCE_POLLING;
+ /* Get options from config flags... */
+ sc->sc_options = cf->cf_flags | si_obio_options;
+ printf(": options=%d\n", sc->sc_options);
sc->sc_adapter_type = ca->ca_bustype;
sc->sc_regs = (struct si_regs *)
@@ -218,21 +186,11 @@ si_obio_attach(parent, self, args)
ncr_sc->sc_intr_on = NULL;
ncr_sc->sc_intr_off = NULL;
- ncr_sc->sc_min_dma_len = MIN_DMA_LEN;
-
-#if 1 /* XXX - Temporary */
- /* XXX - In case we think DMA is completely broken... */
- if ((si_obio_options & SI_ENABLE_DMA) == 0) {
- /* Override this function pointer. */
- ncr_sc->sc_dma_alloc = NULL;
- }
-#endif
-
/* Need DVMA-capable memory for the UDC command block. */
sc->sc_dmacmd = dvma_malloc(sizeof (struct udc_table));
/* Attach interrupt handler. */
- isr_add_autovect(si_intr, (void *)sc, intpri);
+ isr_add_autovect(si_intr, (void *)sc, ca->ca_intpri);
/* Do the common attach stuff. */
si_attach(sc);