diff --git a/sys/arch/alpha/tc/asc.c b/sys/arch/alpha/tc/asc.c index 233a1de03e19..83d8c6eb6d45 100644 --- a/sys/arch/alpha/tc/asc.c +++ b/sys/arch/alpha/tc/asc.c @@ -1,4 +1,4 @@ -/* $NetBSD: asc.c,v 1.16 1999/09/22 03:32:26 mhitch Exp $ */ +/* $NetBSD: asc.c,v 1.17 2000/06/05 07:59:50 nisimura Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -78,7 +78,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: asc.c,v 1.16 1999/09/22 03:32:26 mhitch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: asc.c,v 1.17 2000/06/05 07:59:50 nisimura Exp $"); #include #include @@ -115,13 +115,6 @@ struct cfattach asc_tcds_ca = { sizeof(struct asc_tcds_softc), asc_tcds_match, asc_tcds_attach }; -struct scsipi_device asc_tcds_dev = { - NULL, /* Use default error handler */ - NULL, /* have a queue, served by this */ - NULL, /* have no async handler */ - NULL, /* Use default 'done' routine */ -}; - /* * Functions and the switch for the MI code. */ @@ -190,8 +183,7 @@ asc_tcds_attach(parent, self, aux) asc->sc_dma->sc_asc = asc; /* XXX */ - tcds_intr_establish(parent, tcdsdev->tcdsda_chip, - (int (*) __P((void *)))ncr53c9x_intr, sc); + tcds_intr_establish(parent, tcdsdev->tcdsda_chip, ncr53c9x_intr, sc); /* * XXX More of this should be in ncr53c9x_attach(), but @@ -233,9 +225,7 @@ asc_tcds_attach(parent, self, aux) sc->sc_maxxfer = 64 * 1024; /* Do the common parts of attachment. */ - sc->sc_adapter.scsipi_cmd = ncr53c9x_scsi_cmd; - sc->sc_adapter.scsipi_minphys = minphys; - ncr53c9x_attach(sc, &asc_tcds_dev); + ncr53c9x_attach(sc, NULL, NULL); } /* diff --git a/sys/arch/mac68k/obio/esp.c b/sys/arch/mac68k/obio/esp.c index 15e8e5092f80..30dbdf258ad2 100644 --- a/sys/arch/mac68k/obio/esp.c +++ b/sys/arch/mac68k/obio/esp.c @@ -1,4 +1,4 @@ -/* $NetBSD: esp.c,v 1.24 1999/10/19 17:00:41 thorpej Exp $ */ +/* $NetBSD: esp.c,v 1.25 2000/06/05 07:59:52 nisimura Exp $ */ /* * Copyright (c) 1997 Jason R. Thorpe. @@ -113,13 +113,6 @@ struct cfattach esp_ca = { sizeof(struct esp_softc), espmatch, espattach }; -struct scsipi_device esp_dev = { - NULL, /* Use default error handler */ - NULL, /* have a queue, served by this */ - NULL, /* have no async handler */ - NULL, /* Use default 'done' routine */ -}; - /* * Functions and the switch for the MI code. */ @@ -318,9 +311,7 @@ espattach(parent, self, aux) /* * Now try to attach all the sub-devices */ - sc->sc_adapter.scsipi_cmd = ncr53c9x_scsi_cmd; - sc->sc_adapter.scsipi_minphys = minphys; - ncr53c9x_attach(sc, &esp_dev); + ncr53c9x_attach(sc, NULL, NULL); } /* diff --git a/sys/arch/macppc/dev/esp.c b/sys/arch/macppc/dev/esp.c index 79d16fbd408c..19b4ccd44c6d 100644 --- a/sys/arch/macppc/dev/esp.c +++ b/sys/arch/macppc/dev/esp.c @@ -1,4 +1,4 @@ -/* $NetBSD: esp.c,v 1.9 1998/11/19 21:46:41 thorpej Exp $ */ +/* $NetBSD: esp.c,v 1.10 2000/06/05 07:59:51 nisimura Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -116,13 +116,6 @@ struct cfattach esp_ca = { sizeof(struct esp_softc), espmatch, espattach }; -struct scsipi_device esp_dev = { - NULL, /* Use default error handler */ - NULL, /* have a queue, served by this */ - NULL, /* have no async handler */ - NULL, /* Use default 'done' routine */ -}; - /* * Functions and the switch for the MI code. */ @@ -251,16 +244,13 @@ espattach(parent, self, aux) sc->sc_maxxfer = 64 * 1024; /* and the interuppts */ - intr_establish(esc->sc_pri, IST_LEVEL, IPL_BIO, (void *)ncr53c9x_intr, - sc); + intr_establish(esc->sc_pri, IST_LEVEL, IPL_BIO, ncr53c9x_intr, sc); /* Reset SCSI bus when halt. */ shutdownhook_establish(esp_shutdownhook, sc); /* Do the common parts of attachment. */ - sc->sc_adapter.scsipi_cmd = ncr53c9x_scsi_cmd; - sc->sc_adapter.scsipi_minphys = minphys; - ncr53c9x_attach(sc, &esp_dev); + ncr53c9x_attach(sc, NULL, NULL); /* Turn on target selection using the `dma' method */ ncr53c9x_dmaselect = 1; diff --git a/sys/arch/next68k/dev/esp.c b/sys/arch/next68k/dev/esp.c index 67dd8d4ff03f..f0dfc7d17573 100644 --- a/sys/arch/next68k/dev/esp.c +++ b/sys/arch/next68k/dev/esp.c @@ -1,4 +1,4 @@ -/* $NetBSD: esp.c,v 1.26 2000/06/04 19:14:53 cgd Exp $ */ +/* $NetBSD: esp.c,v 1.27 2000/06/05 07:59:51 nisimura Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -147,13 +147,6 @@ struct cfattach esp_ca = { sizeof(struct esp_softc), espmatch_intio, espattach_intio }; -struct scsipi_device esp_dev = { - NULL, /* Use default error handler */ - NULL, /* have a queue, served by this */ - NULL, /* have no async handler */ - NULL, /* Use default 'done' routine */ -}; - /* * Functions and the switch for the MI code. */ @@ -397,8 +390,7 @@ espattach_intio(parent, self, aux) } /* Establish interrupt channel */ - isrlink_autovec((int(*)__P((void*)))ncr53c9x_intr, sc, - NEXT_I_IPL(NEXT_I_SCSI), 0); + isrlink_autovec(ncr53c9x_intr, sc, NEXT_I_IPL(NEXT_I_SCSI), 0); INTR_ENABLE(NEXT_I_SCSI); /* register interrupt stats */ @@ -406,9 +398,7 @@ espattach_intio(parent, self, aux) sc->sc_dev.dv_xname, "intr"); /* Do the common parts of attachment. */ - sc->sc_adapter.scsipi_cmd = ncr53c9x_scsi_cmd; - sc->sc_adapter.scsipi_minphys = minphys; - ncr53c9x_attach(sc, &esp_dev); + ncr53c9x_attach(sc, NULL, NULL); } /* diff --git a/sys/arch/pmax/tc/asc_ioasic.c b/sys/arch/pmax/tc/asc_ioasic.c index d0d465a1b11e..a32c35152eea 100644 --- a/sys/arch/pmax/tc/asc_ioasic.c +++ b/sys/arch/pmax/tc/asc_ioasic.c @@ -1,4 +1,4 @@ -/* $NetBSD: asc_ioasic.c,v 1.7 2000/06/03 07:55:17 nisimura Exp $ */ +/* $NetBSD: asc_ioasic.c,v 1.8 2000/06/05 07:59:52 nisimura Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: asc_ioasic.c,v 1.7 2000/06/03 07:55:17 nisimura Exp $"); +__KERNEL_RCSID(0, "$NetBSD: asc_ioasic.c,v 1.8 2000/06/05 07:59:52 nisimura Exp $"); #include #include @@ -82,13 +82,6 @@ struct cfattach xasc_ioasic_ca = { sizeof(struct asc_softc), asc_ioasic_match, asc_ioasic_attach }; -static struct scsipi_device asc_ioasic_dev = { - NULL, /* Use default error handler */ - NULL, /* have a queue, served by this */ - NULL, /* have no async handler */ - NULL, /* Use default 'done' routine */ -}; - static u_char asc_read_reg __P((struct ncr53c9x_softc *, int)); static void asc_write_reg __P((struct ncr53c9x_softc *, int, u_char)); static int asc_dma_isintr __P((struct ncr53c9x_softc *sc)); @@ -162,7 +155,7 @@ asc_ioasic_attach(parent, self, aux) sc->sc_freq /= 1000000; ioasic_intr_establish(parent, d->iada_cookie, TC_IPL_BIO, - (int (*)(void *))ncr53c9x_intr, sc); + ncr53c9x_intr, sc); /* * XXX More of this should be in ncr53c9x_attach(), but @@ -197,9 +190,7 @@ asc_ioasic_attach(parent, self, aux) sc->sc_maxxfer = 64 * 1024; /* Do the common parts of attachment. */ - sc->sc_adapter.scsipi_cmd = ncr53c9x_scsi_cmd; - sc->sc_adapter.scsipi_minphys = minphys; - ncr53c9x_attach(sc, &asc_ioasic_dev); + ncr53c9x_attach(sc, NULL, NULL); } void diff --git a/sys/arch/pmax/tc/asc_pmaz.c b/sys/arch/pmax/tc/asc_pmaz.c index 3439a5ed67aa..c682413f32fd 100644 --- a/sys/arch/pmax/tc/asc_pmaz.c +++ b/sys/arch/pmax/tc/asc_pmaz.c @@ -1,4 +1,4 @@ -/* $NetBSD: asc_pmaz.c,v 1.5 2000/03/06 03:09:43 mhitch Exp $ */ +/* $NetBSD: asc_pmaz.c,v 1.6 2000/06/05 07:59:53 nisimura Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: asc_pmaz.c,v 1.5 2000/03/06 03:09:43 mhitch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: asc_pmaz.c,v 1.6 2000/06/05 07:59:53 nisimura Exp $"); #include #include @@ -80,13 +80,6 @@ struct cfattach xasc_pmaz_ca = { sizeof(struct asc_softc), asc_pmaz_match, asc_pmaz_attach }; -static struct scsipi_device asc_pmaz_dev = { - NULL, /* Use default error handler */ - NULL, /* have a queue, served by this */ - NULL, /* have no async handler */ - NULL, /* Use default 'done' routine */ -}; - static u_char asc_read_reg __P((struct ncr53c9x_softc *, int)); static void asc_write_reg __P((struct ncr53c9x_softc *, int, u_char)); static int asc_dma_isintr __P((struct ncr53c9x_softc *)); @@ -163,8 +156,7 @@ asc_pmaz_attach(parent, self, aux) } asc->sc_base = (caddr_t)ta->ta_addr; /* XXX XXX XXX */ - tc_intr_establish(parent, ta->ta_cookie, IPL_BIO, - (int (*)(void *))ncr53c9x_intr, sc); + tc_intr_establish(parent, ta->ta_cookie, IPL_BIO, ncr53c9x_intr, sc); sc->sc_id = 7; sc->sc_freq = (ta->ta_busspeed) ? 25000000 : 12500000; @@ -206,9 +198,7 @@ asc_pmaz_attach(parent, self, aux) sc->sc_maxxfer = 64 * 1024; /* Do the common parts of attachment. */ - sc->sc_adapter.scsipi_cmd = ncr53c9x_scsi_cmd; - sc->sc_adapter.scsipi_minphys = minphys; - ncr53c9x_attach(sc, &asc_pmaz_dev); + ncr53c9x_attach(sc, NULL, NULL); } static void diff --git a/sys/arch/sparc/dev/esp_obio.c b/sys/arch/sparc/dev/esp_obio.c index f20ff036f67f..09ecb13457f9 100644 --- a/sys/arch/sparc/dev/esp_obio.c +++ b/sys/arch/sparc/dev/esp_obio.c @@ -1,4 +1,4 @@ -/* $NetBSD: esp_obio.c,v 1.6 2000/06/04 19:15:01 cgd Exp $ */ +/* $NetBSD: esp_obio.c,v 1.7 2000/06/05 07:59:53 nisimura Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -79,13 +79,6 @@ struct cfattach esp_obio_ca = { sizeof(struct esp_softc), espmatch_obio, espattach_obio }; -static struct scsipi_device esp_obio_dev = { - NULL, /* Use default error handler */ - NULL, /* have a queue, served by this */ - NULL, /* have no async handler */ - NULL, /* Use default 'done' routine */ -}; - /* * Functions and the switch for the MI code. */ @@ -261,18 +254,14 @@ espattach_obio(parent, self, aux) } /* Establish interrupt channel */ - bus_intr_establish(esc->sc_bustag, - oba->oba_pri, 0, - (int(*)__P((void*)))ncr53c9x_intr, sc); + bus_intr_establish(esc->sc_bustag, oba->oba_pri, 0, ncr53c9x_intr, sc); /* register interrupt stats */ evcnt_attach_dynamic(&sc->sc_intrcnt, EVCNT_TYPE_INTR, NULL, sc->sc_dev.dv_xname, "intr"); /* Do the common parts of attachment. */ - sc->sc_adapter.scsipi_cmd = ncr53c9x_scsi_cmd; - sc->sc_adapter.scsipi_minphys = minphys; - ncr53c9x_attach(sc, &esp_obio_dev); + ncr53c9x_attach(sc, NULL, NULL); /* Turn on target selection using the `dma' method */ ncr53c9x_dmaselect = 1; diff --git a/sys/arch/sun3/dev/esp.c b/sys/arch/sun3/dev/esp.c index 61b437b4613a..47856eaeaf14 100644 --- a/sys/arch/sun3/dev/esp.c +++ b/sys/arch/sun3/dev/esp.c @@ -1,4 +1,4 @@ -/* $NetBSD: esp.c,v 1.11 2000/06/04 19:15:06 cgd Exp $ */ +/* $NetBSD: esp.c,v 1.12 2000/06/05 07:59:53 nisimura Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -77,13 +77,6 @@ struct cfattach esp_ca = { sizeof(struct esp_softc), espmatch, espattach }; -static struct scsipi_device esp_dev = { - NULL, /* Use default error handler */ - NULL, /* have a queue, served by this */ - NULL, /* have no async handler */ - NULL, /* Use default 'done' routine */ -}; - /* * Functions and the switch for the MI code. */ @@ -242,14 +235,12 @@ espattach(parent, self, aux) } /* and the interuppts */ - isr_add_autovect((void*)ncr53c9x_intr, sc, ca->ca_intpri); + isr_add_autovect(ncr53c9x_intr, sc, ca->ca_intpri); evcnt_attach_dynamic(&sc->sc_intrcnt, EVCNT_TYPE_INTR, NULL, sc->sc_dev.dv_xname, "intr"); /* Do the common parts of attachment. */ - sc->sc_adapter.scsipi_cmd = ncr53c9x_scsi_cmd; - sc->sc_adapter.scsipi_minphys = minphys; - ncr53c9x_attach(sc, &esp_dev); + ncr53c9x_attach(sc, NULL, NULL); #if 0 /* XXX - This doesn't work yet. Not sure why... */ diff --git a/sys/arch/vax/vsa/asc_vsbus.c b/sys/arch/vax/vsa/asc_vsbus.c index ff3a6d628f42..bee71622f820 100644 --- a/sys/arch/vax/vsa/asc_vsbus.c +++ b/sys/arch/vax/vsa/asc_vsbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: asc_vsbus.c,v 1.16 2000/06/05 00:09:20 matt Exp $ */ +/* $NetBSD: asc_vsbus.c,v 1.17 2000/06/05 07:59:54 nisimura Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: asc_vsbus.c,v 1.16 2000/06/05 00:09:20 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: asc_vsbus.c,v 1.17 2000/06/05 07:59:54 nisimura Exp $"); #include #include @@ -109,13 +109,6 @@ struct cfattach asc_vsbus_ca = { sizeof(struct asc_vsbus_softc), asc_vsbus_match, asc_vsbus_attach }; -static struct scsipi_device asc_vsbus_dev = { - NULL, /* Use the default error handler */ - NULL, /* have a queue, served by this */ - NULL, /* have no async handler */ - NULL, /* use the default done handler */ -}; - /* * Functions and the switch for the MI code */ @@ -313,9 +306,7 @@ asc_vsbus_attach(struct device *parent, struct device *self, void *aux) printf("\n%s", self->dv_xname); /* Pretty print */ /* Do the common parts of attachment. */ - sc->sc_adapter.scsipi_cmd = ncr53c9x_scsi_cmd; - sc->sc_adapter.scsipi_minphys = minphys; - ncr53c9x_attach(sc, &asc_vsbus_dev); + ncr53c9x_attach(sc, NULL, NULL); } /* diff --git a/sys/dev/ic/ncr53c9x.c b/sys/dev/ic/ncr53c9x.c index 4e99a15067cd..a6bb75d82209 100644 --- a/sys/dev/ic/ncr53c9x.c +++ b/sys/dev/ic/ncr53c9x.c @@ -1,4 +1,4 @@ -/* $NetBSD: ncr53c9x.c,v 1.49 2000/03/29 13:57:51 tsutsui Exp $ */ +/* $NetBSD: ncr53c9x.c,v 1.50 2000/06/05 07:59:54 nisimura Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -134,7 +134,7 @@ static inline void ncr53c9x_setsync __P((struct ncr53c9x_softc *, * Names for the NCR53c9x variants, correspnding to the variant tags * in ncr53c9xvar.h. */ -const char *ncr53c9x_variant_names[] = { +static const char *ncr53c9x_variant_names[] = { "ESP100", "ESP100A", "ESP200", @@ -146,13 +146,29 @@ const char *ncr53c9x_variant_names[] = { "AM53C974", }; +static struct scsipi_adapter ncr53c9x_adapter = { + 0, /* adapter refcnt */ + ncr53c9x_scsi_cmd, /* cmd */ + minphys, /* minphys */ + NULL, /* ioctl */ + NULL, /* getgeom */ +}; + +static struct scsipi_device ncr53c9x_device = { + NULL, /* use default error handler */ + NULL, /* have a queue, served by this */ + NULL, /* have no async handler */ + NULL, /* use default 'done' routine */ +}; + /* * Attach this instance, and then all the sub-devices */ void -ncr53c9x_attach(sc, dev) +ncr53c9x_attach(sc, adapter, device) struct ncr53c9x_softc *sc; - struct scsipi_device *dev; + struct scsipi_adapter *adapter; + struct scsipi_device *device; { /* @@ -212,8 +228,8 @@ ncr53c9x_attach(sc, dev) sc->sc_link.scsipi_scsi.channel = SCSI_CHANNEL_ONLY_ONE; sc->sc_link.adapter_softc = sc; sc->sc_link.scsipi_scsi.adapter_target = sc->sc_id; - sc->sc_link.adapter = &sc->sc_adapter; - sc->sc_link.device = dev; + sc->sc_link.adapter = (adapter) ? adapter : &ncr53c9x_adapter; + sc->sc_link.device = (device) ? device : &ncr53c9x_device; sc->sc_link.openings = 2; sc->sc_link.scsipi_scsi.max_target = 7; sc->sc_link.scsipi_scsi.max_lun = 7; diff --git a/sys/dev/ic/ncr53c9xvar.h b/sys/dev/ic/ncr53c9xvar.h index d53cb793946f..87b7923ba062 100644 --- a/sys/dev/ic/ncr53c9xvar.h +++ b/sys/dev/ic/ncr53c9xvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: ncr53c9xvar.h,v 1.23 2000/03/29 03:03:28 simonb Exp $ */ +/* $NetBSD: ncr53c9xvar.h,v 1.24 2000/06/05 07:59:54 nisimura Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -233,7 +233,6 @@ struct ncr53c9x_softc { struct evcnt sc_intrcnt; /* intr count */ struct scsipi_link sc_link; /* scsipi link struct */ - struct scsipi_adapter sc_adapter; /* scsipi adapter glue */ struct device *sc_child; /* attached scsibus, if any */ struct ncr53c9x_glue *sc_glue; /* glue to MD code */ @@ -395,7 +394,8 @@ struct ncr53c9x_softc { #define ncr53c9x_cpb2stp(sc, cpb) \ ((250 * (cpb)) / (sc)->sc_freq) -void ncr53c9x_attach __P((struct ncr53c9x_softc *, struct scsipi_device *)); +void ncr53c9x_attach __P((struct ncr53c9x_softc *, + struct scsipi_adapter *, struct scsipi_device *)); int ncr53c9x_detach __P((struct ncr53c9x_softc *, int)); int ncr53c9x_scsi_cmd __P((struct scsipi_xfer *)); void ncr53c9x_reset __P((struct ncr53c9x_softc *)); diff --git a/sys/dev/sbus/esp_sbus.c b/sys/dev/sbus/esp_sbus.c index 38f3a72ad74e..2824682a4d40 100644 --- a/sys/dev/sbus/esp_sbus.c +++ b/sys/dev/sbus/esp_sbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: esp_sbus.c,v 1.9 2000/06/04 19:15:13 cgd Exp $ */ +/* $NetBSD: esp_sbus.c,v 1.10 2000/06/05 07:59:55 nisimura Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -88,13 +88,6 @@ struct cfattach esp_dma_ca = { sizeof(struct esp_softc), espmatch_sbus, espattach_dma }; -static struct scsipi_device esp_sbus_dev = { - NULL, /* Use default error handler */ - NULL, /* have a queue, served by this */ - NULL, /* have no async handler */ - NULL, /* Use default 'done' routine */ -}; - /* * Functions and the switch for the MI code. */ @@ -393,16 +386,14 @@ espattach(esc, gluep) /* Establish interrupt channel */ icookie = bus_intr_establish(esc->sc_bustag, esc->sc_pri, 0, - (int(*)__P((void*)))ncr53c9x_intr, sc); + ncr53c9x_intr, sc); /* register interrupt stats */ evcnt_attach_dynamic(&sc->sc_intrcnt, EVCNT_TYPE_INTR, NULL, sc->sc_dev.dv_xname, "intr"); /* Do the common parts of attachment. */ - sc->sc_adapter.scsipi_cmd = ncr53c9x_scsi_cmd; - sc->sc_adapter.scsipi_minphys = minphys; - ncr53c9x_attach(sc, &esp_sbus_dev); + ncr53c9x_attach(sc, NULL, NULL); /* Turn on target selection using the `dma' method */ ncr53c9x_dmaselect = 1;