Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/news68k/dev Sync with MI ncr5380sbc changes.



details:   https://anonhg.NetBSD.org/src/rev/91f8846fa6b4
branches:  trunk
changeset: 483846:91f8846fa6b4
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sun Mar 19 16:28:04 2000 +0000

description:
Sync with MI ncr5380sbc changes.

XXX CXD1180 quirk code should be merged into the MI ncr5380sbc driver...

diffstat:

 sys/arch/news68k/dev/ncr5380sbc.c |  73 ++++++++++++++++++++++++++++++++++----
 sys/arch/news68k/dev/si.c         |  20 +---------
 2 files changed, 66 insertions(+), 27 deletions(-)

diffs (163 lines):

diff -r b8940457f775 -r 91f8846fa6b4 sys/arch/news68k/dev/ncr5380sbc.c
--- a/sys/arch/news68k/dev/ncr5380sbc.c Sun Mar 19 16:24:38 2000 +0000
+++ b/sys/arch/news68k/dev/ncr5380sbc.c Sun Mar 19 16:28:04 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ncr5380sbc.c,v 1.1 1999/12/09 14:53:06 tsutsui Exp $   */
+/*     $NetBSD: ncr5380sbc.c,v 1.2 2000/03/19 16:28:04 tsutsui Exp $   */
 
 /*
  * Copyright (c) 1995 David Jones, Gordon W. Ross
@@ -95,6 +95,7 @@
 #include <dev/ic/ncr5380reg.h>
 #include <dev/ic/ncr5380var.h>
 
+static void    ncr5380_reset_scsibus __P((struct ncr5380_softc *));
 static void    ncr5380_sched __P((struct ncr5380_softc *));
 static void    ncr5380_done __P((struct ncr5380_softc *));
 
@@ -367,10 +368,6 @@
                for (j = 0; j < 8; j++)
                        sc->sc_matrix[i][j] = NULL;
 
-       sc->sc_link.openings = 2;       /* XXX - Not SCI_OPENINGS */
-       sc->sc_link.scsipi_scsi.max_target = 7;
-       sc->sc_link.scsipi_scsi.max_lun = 7;
-       sc->sc_link.type = BUS_SCSI;
        sc->sc_prevphase = PHASE_INVALID;
        sc->sc_state = NCR_IDLE;
 
@@ -391,7 +388,7 @@
 }
 
 
-void
+static void
 ncr5380_reset_scsibus(sc)
        struct ncr5380_softc *sc;
 {
@@ -419,9 +416,10 @@
  * This may also called for a DMA timeout (at splbio).
  */
 int
-ncr5380_intr(sc)
-       struct ncr5380_softc *sc;
+ncr5380_intr(arg)
+       void *arg;
 {
+       struct ncr5380_softc *sc = arg;
        int claimed = 0;
 
        /*
@@ -2606,6 +2604,63 @@
        db_printf("sc_prevphase=%d\n",  sc->sc_prevphase);
        db_printf("sc_msgpriq=0x%x\n",  sc->sc_msgpriq);
 }
-
 #endif /* DDB */
 #endif /* NCR5380_DEBUG */
+
+struct scsipi_device ncr5380_dev = {
+       NULL,                   /* Use default error handler */
+       NULL,                   /* have a queue, served by this */
+       NULL,                   /* have no async handler */
+       NULL,                   /* Use default 'done' routine */
+};
+
+void
+ncr5380_attach(sc)
+       struct ncr5380_softc *sc;
+{
+
+       /*
+        * Fill in the adapter.
+        */
+       sc->sc_adapter.scsipi_cmd = ncr5380_scsi_cmd;
+
+       /*
+        * Fill in the prototype scsipi_link
+        */
+       sc->sc_link.scsipi_scsi.channel = SCSI_CHANNEL_ONLY_ONE;
+       sc->sc_link.adapter_softc = sc;
+       sc->sc_link.adapter = &sc->sc_adapter;
+       sc->sc_link.device = &ncr5380_dev;
+       sc->sc_link.openings = 2;
+       sc->sc_link.scsipi_scsi.max_target = 7;
+       sc->sc_link.scsipi_scsi.max_lun = 7;
+       sc->sc_link.type = BUS_SCSI;
+
+       /*
+        * Add reference to adapter so that we drop the reference after
+        * config_found() to make sure the adatper is disabled.
+        */
+       if (scsipi_adapter_addref(&sc->sc_link) != 0) {
+               printf("%s: unable to enable controller\n",
+                   sc->sc_dev.dv_xname);
+               return;
+       }
+
+       ncr5380_init(sc);       /* Init chip and driver */
+       ncr5380_reset_scsibus(sc);
+
+       /*
+        * Ask the adapter what subunits are present
+        */
+       (void) config_found(&sc->sc_dev, &sc->sc_link, scsiprint);
+       scsipi_adapter_delref(&sc->sc_link);
+}
+
+int
+ncr5380_detach(sc, flags)
+       struct ncr5380_softc *sc;
+       int flags;
+{
+
+       return (EOPNOTSUPP);
+}
diff -r b8940457f775 -r 91f8846fa6b4 sys/arch/news68k/dev/si.c
--- a/sys/arch/news68k/dev/si.c Sun Mar 19 16:24:38 2000 +0000
+++ b/sys/arch/news68k/dev/si.c Sun Mar 19 16:28:04 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: si.c,v 1.3 2000/02/08 16:17:32 tsutsui Exp $   */
+/*     $NetBSD: si.c,v 1.4 2000/03/19 16:28:04 tsutsui Exp $   */
 
 /*
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -90,13 +90,6 @@
 void si_dma_eop __P((struct ncr5380_softc *));
 void si_dma_stop __P((struct ncr5380_softc *));
 
-struct scsipi_device si_scsidev = {
-       NULL,           /* use default error handler */
-       NULL,           /* do not have a start functio */
-       NULL,           /* have no async handler */
-       NULL,           /* Use default done routine */
-};
-
 struct cfattach si_ca = {
        sizeof(struct si_softc), si_match, si_attach
 };
@@ -189,23 +182,14 @@
        ncr_sc->sc_pio_in  = ncr5380_pio_in;
        ncr_sc->sc_pio_out = ncr5380_pio_out;
 
-       ncr_sc->sc_adapter.scsipi_cmd = ncr5380_scsi_cmd;
        ncr_sc->sc_adapter.scsipi_minphys = minphys;
-
-       ncr_sc->sc_link.scsipi_scsi.channel = SCSI_CHANNEL_ONLY_ONE;
-       ncr_sc->sc_link.adapter_softc = sc;
        ncr_sc->sc_link.scsipi_scsi.adapter_target = 7;
-       ncr_sc->sc_link.adapter = &ncr_sc->sc_adapter;
-       ncr_sc->sc_link.device = &si_scsidev;
-       ncr_sc->sc_link.type = BUS_SCSI;
 
        /* soft reset DMAC */
        sc->sc_regs = (void *)IIOV(DMAC_BASE);
        sc->sc_regs->ctl = DC_CTL_RST;
 
-       ncr5380_init(ncr_sc);
-       ncr5380_reset_scsibus(ncr_sc);
-       config_found(&(ncr_sc->sc_dev), &(ncr_sc->sc_link), scsiprint);
+       ncr5380_attach(ncr_sc);
 }
 
 int



Home | Main Index | Thread Index | Old Index