Source-Changes-HG archive

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

[src/trunk]: src/sys Add a ncr5380_attach() routine which does part of the in...



details:   https://anonhg.NetBSD.org/src/rev/04804665c04a
branches:  trunk
changeset: 483780:04804665c04a
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Sat Mar 18 16:13:22 2000 +0000

description:
Add a ncr5380_attach() routine which does part of the initialization, attaches
the scsibus, and does the addref/delref dance.

diffstat:

 sys/arch/arm32/podulebus/csa.c  |  32 ++----------------
 sys/arch/arm32/podulebus/oak.c  |  32 ++----------------
 sys/arch/mac68k/dev/sbc.c       |  11 +------
 sys/arch/mac68k/dev/sbcvar.h    |   3 +-
 sys/arch/mac68k/obio/sbc_obio.c |  20 +++---------
 sys/arch/pc532/dev/ncr.c        |  34 +++-----------------
 sys/arch/sparc/dev/si.c         |  37 +++------------------
 sys/arch/sun3/dev/si.c          |  35 +++-----------------
 sys/arch/sun3/dev/si_sebuf.c    |  34 +++-----------------
 sys/arch/vax/vsa/ncr.c          |  36 +++------------------
 sys/dev/ic/ncr5380sbc.c         |  68 ++++++++++++++++++++++++++++++++++++----
 sys/dev/ic/ncr5380var.h         |   7 ++-
 sys/dev/isa/nca_isa.c           |  43 ++++---------------------
 13 files changed, 115 insertions(+), 277 deletions(-)

diffs (truncated from 770 to 300 lines):

diff -r 3015bdf1dc70 -r 04804665c04a sys/arch/arm32/podulebus/csa.c
--- a/sys/arch/arm32/podulebus/csa.c    Sat Mar 18 15:01:33 2000 +0000
+++ b/sys/arch/arm32/podulebus/csa.c    Sat Mar 18 16:13:22 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: csa.c,v 1.4 1998/11/19 21:44:59 thorpej Exp $  */
+/*     $NetBSD: csa.c,v 1.5 2000/03/18 16:13:22 mycroft Exp $  */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -75,14 +75,6 @@
 
 void csa_attach __P((struct device *, struct device *, void *));
 int  csa_match  __P((struct device *, struct cfdata *, void *));
-static void csa_minphys __P((struct buf *bp));
-
-struct scsipi_device csa_scsidev = {
-       NULL,           /* use default error handler */
-       NULL,           /* do not have a start functio */
-       NULL,           /* have no async handler */
-       NULL,           /* Use default done routine */
-};
 
 /*
  * Cumana SCSI 1 softc structure.
@@ -185,19 +177,12 @@
        sc->sc_ncr5380.sc_pio_in = ncr5380_pio_in;
        sc->sc_ncr5380.sc_pio_out = ncr5380_pio_out;
 
-       sc->sc_ncr5380.sc_adapter.scsipi_cmd = ncr5380_scsi_cmd;
-       sc->sc_ncr5380.sc_adapter.scsipi_minphys = csa_minphys;
-
-       sc->sc_ncr5380.sc_link.scsipi_scsi.channel = SCSI_CHANNEL_ONLY_ONE;
-       sc->sc_ncr5380.sc_link.adapter_softc = sc;
+       /* Provide an override for the host id */
        sc->sc_ncr5380.sc_link.scsipi_scsi.adapter_target = 7;
-       sc->sc_ncr5380.sc_link.adapter = &sc->sc_ncr5380.sc_adapter;
-       sc->sc_ncr5380.sc_link.device = &csa_scsidev;
-
-       /* Provide an override for the host id */
        sprintf(hi_option, "%s.hostid", sc->sc_ncr5380.sc_dev.dv_xname);
        (void)get_bootconf_option(boot_args, hi_option,
            BOOTOPT_TYPE_INT, &sc->sc_ncr5380.sc_link.scsipi_scsi.adapter_target);
+       sc->sc_ncr5380.sc_adapter.scsipi_minphys = minphys;
 
        printf(" host=%d, using 8 bit PIO", sc->sc_ncr5380.sc_link.scsipi_scsi.adapter_target);
 
@@ -214,16 +199,7 @@
        printf("\n");
        *sc->sc_ctrl = 0;
 
-       ncr5380_init(&sc->sc_ncr5380);
-       ncr5380_reset_scsibus(&sc->sc_ncr5380);
-       config_found(&sc->sc_ncr5380.sc_dev, &sc->sc_ncr5380.sc_link, scsiprint);
-}
-
-static void
-csa_minphys(bp)
-       struct buf *bp;
-{
-       return(minphys(bp));
+       ncr5380_attach(&sc->sc_ncr5380);
 }
 
 int
diff -r 3015bdf1dc70 -r 04804665c04a sys/arch/arm32/podulebus/oak.c
--- a/sys/arch/arm32/podulebus/oak.c    Sat Mar 18 15:01:33 2000 +0000
+++ b/sys/arch/arm32/podulebus/oak.c    Sat Mar 18 16:13:22 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: oak.c,v 1.16 1998/11/19 21:44:59 thorpej Exp $ */
+/*     $NetBSD: oak.c,v 1.17 2000/03/18 16:13:22 mycroft Exp $ */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -60,14 +60,6 @@
 
 void oak_attach __P((struct device *, struct device *, void *));
 int  oak_match  __P((struct device *, struct cfdata *, void *));
-static void oak_minphys __P((struct buf *bp));
-
-struct scsipi_device oak_scsidev = {
-       NULL,           /* use default error handler */
-       NULL,           /* do not have a start functio */
-       NULL,           /* have no async handler */
-       NULL,           /* Use default done routine */
-};
 
 /*
  * Oak SCSI 1 softc structure.
@@ -158,31 +150,15 @@
        sc->sc_ncr5380.sc_pio_in = ncr5380_pio_in;
        sc->sc_ncr5380.sc_pio_out = ncr5380_pio_out;
 
-       sc->sc_ncr5380.sc_adapter.scsipi_cmd = ncr5380_scsi_cmd;
-       sc->sc_ncr5380.sc_adapter.scsipi_minphys = oak_minphys;
-
-       sc->sc_ncr5380.sc_link.scsipi_scsi.channel = SCSI_CHANNEL_ONLY_ONE;
-       sc->sc_ncr5380.sc_link.adapter_softc = sc;
+       /* Provide an override for the host id */
        sc->sc_ncr5380.sc_link.scsipi_scsi.adapter_target = 7;
-       sc->sc_ncr5380.sc_link.adapter = &sc->sc_ncr5380.sc_adapter;
-       sc->sc_ncr5380.sc_link.device = &oak_scsidev;
-
-       /* Provide an override for the host id */
        sprintf(hi_option, "%s.hostid", sc->sc_ncr5380.sc_dev.dv_xname);
        (void)get_bootconf_option(boot_args, hi_option,
            BOOTOPT_TYPE_INT, &sc->sc_ncr5380.sc_link.scsipi_scsi.adapter_target);
+       sc->sc_ncr5380.sc_adapter.scsipi_minphys = minphys;
 
        printf(" host=%d, using 8 bit PIO\n",
            sc->sc_ncr5380.sc_link.scsipi_scsi.adapter_target);
 
-       ncr5380_init(&sc->sc_ncr5380);
-       ncr5380_reset_scsibus(&sc->sc_ncr5380);
-       config_found(&sc->sc_ncr5380.sc_dev, &sc->sc_ncr5380.sc_link, scsiprint);
+       ncr5380_attach(&sc->sc_ncr5380);
 }
-
-static void
-oak_minphys(bp)
-       struct buf *bp;
-{
-       return(minphys(bp));
-}
diff -r 3015bdf1dc70 -r 04804665c04a sys/arch/mac68k/dev/sbc.c
--- a/sys/arch/mac68k/dev/sbc.c Sat Mar 18 15:01:33 2000 +0000
+++ b/sys/arch/mac68k/dev/sbc.c Sat Mar 18 16:13:22 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sbc.c,v 1.40 1999/11/02 06:42:26 scottr Exp $  */
+/*     $NetBSD: sbc.c,v 1.41 2000/03/18 16:13:23 mycroft Exp $ */
 
 /*
  * Copyright (C) 1996 Scott Reynolds.  All rights reserved.
@@ -89,15 +89,6 @@
 int    sbc_link_flags = 0 /* | SDEV_DB2 */;
 int    sbc_options = 0 /* | SBC_PDMA */;
 
-/* This is copied from julian's bt driver */
-/* "so we have a default dev struct for our link struct." */
-struct scsipi_device sbc_dev = {
-       NULL,           /* Use default error handler.       */
-       NULL,           /* Use default start handler.           */
-       NULL,           /* Use default async handler.       */
-       NULL,           /* Use default "done" routine.      */
-};
-
 extern label_t *nofault;
 extern caddr_t m68k_fault_addr;
 
diff -r 3015bdf1dc70 -r 04804665c04a sys/arch/mac68k/dev/sbcvar.h
--- a/sys/arch/mac68k/dev/sbcvar.h      Sat Mar 18 15:01:33 2000 +0000
+++ b/sys/arch/mac68k/dev/sbcvar.h      Sat Mar 18 16:13:22 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sbcvar.h,v 1.8 2000/02/14 07:01:47 scottr Exp $        */
+/*     $NetBSD: sbcvar.h,v 1.9 2000/03/18 16:13:24 mycroft Exp $       */
 
 /*
  * Copyright (C) 1996 Scott Reynolds.  All rights reserved.
@@ -86,7 +86,6 @@
 extern int     sbc_debug;
 extern int     sbc_link_flags;
 extern int     sbc_options;
-extern struct scsipi_device sbc_dev;
 
 int    sbc_pdma_in __P((struct ncr5380_softc *, int, int, u_char *));
 int    sbc_pdma_out __P((struct ncr5380_softc *, int, int, u_char *));
diff -r 3015bdf1dc70 -r 04804665c04a sys/arch/mac68k/obio/sbc_obio.c
--- a/sys/arch/mac68k/obio/sbc_obio.c   Sat Mar 18 15:01:33 2000 +0000
+++ b/sys/arch/mac68k/obio/sbc_obio.c   Sat Mar 18 16:13:22 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sbc_obio.c,v 1.10 1998/12/22 08:47:07 scottr Exp $     */
+/*     $NetBSD: sbc_obio.c,v 1.11 2000/03/18 16:13:24 mycroft Exp $    */
 
 /*
  * Copyright (C) 1996,1997 Scott Reynolds.  All rights reserved.
@@ -160,20 +160,10 @@
        }
 
        /*
-        * Fill in the adapter.
-        */
-       ncr_sc->sc_adapter.scsipi_cmd = ncr5380_scsi_cmd;
-       ncr_sc->sc_adapter.scsipi_minphys = minphys;
-
-       /*
         * Fill in the prototype scsi_link.
         */
-       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 = &sbc_dev;
-       ncr_sc->sc_link.type = BUS_SCSI;
+       ncr_sc->sc_adapter.scsipi_minphys = minphys;
 
        /*
         * Initialize fields used by the MI code
@@ -243,12 +233,12 @@
        ncr_sc->sc_link.flags |= sbc_link_flags;
 #endif
 
+       sc->sc_ncr5380.sc_link.scsipi_scsi.adapter_target = 7;
+
        /*
         *  Initialize the SCSI controller itself.
         */
-       ncr5380_init(ncr_sc);
-       ncr5380_reset_scsibus(ncr_sc);
-       config_found(self, &(ncr_sc->sc_link), scsiprint);
+       ncr5380_attach(ncr_sc);
 }
 
 /*
diff -r 3015bdf1dc70 -r 04804665c04a sys/arch/pc532/dev/ncr.c
--- a/sys/arch/pc532/dev/ncr.c  Sat Mar 18 15:01:33 2000 +0000
+++ b/sys/arch/pc532/dev/ncr.c  Sat Mar 18 16:13:22 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ncr.c,v 1.43 1998/11/19 21:48:00 thorpej Exp $ */
+/*     $NetBSD: ncr.c,v 1.44 2000/03/18 16:13:24 mycroft Exp $ */
 
 /*
  * Copyright (c) 1996, 1997 Matthias Pfaller.
@@ -81,13 +81,6 @@
  */
 int ncr_default_options = 0;
 
-struct scsipi_device ncr_dev = {
-       NULL,                   /* use default error handler            */
-       NULL,                   /* do not have a start function         */
-       NULL,                   /* have no async handler                */
-       NULL                    /* Use default done routine             */
-};
-
 struct cfattach ncr_ca = {
        sizeof(struct ncr5380_softc), ncr_match, ncr_attach
 };
@@ -132,22 +125,6 @@
                printf("\n");
 
        /*
-        * Fill in the adapter.
-        */
-       sc->sc_adapter.scsipi_cmd = ncr5380_scsi_cmd;
-       sc->sc_adapter.scsipi_minphys = minphys;
-
-       /*
-        * Fill in the prototype scsi_link.
-        */
-       sc->sc_link.scsipi_scsi.channel        = SCSI_CHANNEL_ONLY_ONE;
-       sc->sc_link.adapter_softc  = sc;
-       sc->sc_link.scsipi_scsi.adapter_target = 7;
-       sc->sc_link.adapter        = &sc->sc_adapter;
-       sc->sc_link.device         = &ncr_dev;
-       sc->sc_link.type = BUS_SCSI;
-
-       /*
         * Initialize NCR5380 register addresses.
         */
        sc->sci_r0 = NCR5380 + 0;
@@ -180,14 +157,13 @@
        intr_establish(IR_SCSI1, ncr_intr, (void *)sc, sc->sc_dev.dv_xname,
                IPL_BIO, IPL_BIO, RISING_EDGE);
 
+       sc->sc_link.scsipi_scsi.adapter_target = 7;
+       sc->sc_adapter.scsipi_minphys = minphys;
+
        /*
         *  Initialize the SCSI controller itself.
         */
-       ncr5380_init(sc);
-       if (flags & NCR_RESET_BUS)
-               ncr5380_reset_scsibus(sc);
-
-       config_found(self, &(sc->sc_link), scsiprint);
+       ncr5380_attach(sc);
 }
 
 static void
diff -r 3015bdf1dc70 -r 04804665c04a sys/arch/sparc/dev/si.c
--- a/sys/arch/sparc/dev/si.c   Sat Mar 18 15:01:33 2000 +0000
+++ b/sys/arch/sparc/dev/si.c   Sat Mar 18 16:13:22 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: si.c,v 1.55 2000/03/13 23:52:33 soren Exp $    */
+/*     $NetBSD: si.c,v 1.56 2000/03/18 16:13:25 mycroft Exp $  */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -244,15 +244,6 @@
 void si_obio_intr_on __P((struct ncr5380_softc *));
 void si_obio_intr_off __P((struct ncr5380_softc *));
 
-/* This is copied from julian's bt driver */
-/* "so we have a default dev struct for our link struct." */
-static struct scsipi_device si_dev = {
-       NULL,           /* Use default error handler.           */
-       NULL,           /* Use default start handler.           */
-       NULL,           /* Use default async handler.           */
-       NULL,           /* Use default "done" routine.          */
-};
-
 



Home | Main Index | Thread Index | Old Index