diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2014-01-18 22:34:00 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2014-01-18 22:34:00 +0000 |
commit | 5061458ef220293321185647fd8e262a0c7f867f (patch) | |
tree | aa5e9934ad65373be813a821358e85291258c485 | |
parent | be20820e20c54a116dd9a8b6020522079bb9f144 (diff) |
instead of having every bit of glue set up and attach an identical
scsi_adapter struct, just do it once in the chip code.
ok krw@
-rw-r--r-- | sys/dev/ic/ncr53c9x.c | 15 | ||||
-rw-r--r-- | sys/dev/ic/ncr53c9xvar.h | 5 | ||||
-rw-r--r-- | sys/dev/pci/pcscp.c | 11 | ||||
-rw-r--r-- | sys/dev/pcmcia/esp_pcmcia.c | 11 | ||||
-rw-r--r-- | sys/dev/sbus/esp_sbus.c | 11 | ||||
-rw-r--r-- | sys/dev/tc/asc.c | 9 | ||||
-rw-r--r-- | sys/dev/tc/asc_tc.c | 6 | ||||
-rw-r--r-- | sys/dev/tc/asc_tcds.c | 6 |
8 files changed, 24 insertions, 50 deletions
diff --git a/sys/dev/ic/ncr53c9x.c b/sys/dev/ic/ncr53c9x.c index 7cbef588576..e63df7524c8 100644 --- a/sys/dev/ic/ncr53c9x.c +++ b/sys/dev/ic/ncr53c9x.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ncr53c9x.c,v 1.52 2011/11/08 18:18:41 krw Exp $ */ +/* $OpenBSD: ncr53c9x.c,v 1.53 2014/01/18 22:33:59 dlg Exp $ */ /* $NetBSD: ncr53c9x.c,v 1.56 2000/11/30 14:41:46 thorpej Exp $ */ /* @@ -149,6 +149,14 @@ struct cfdriver esp_cd = { NULL, "esp", DV_DULL }; +struct scsi_adapter ncr53c9x_adapter = { + ncr53c9x_scsi_cmd, /* cmd */ + scsi_minphys, /* minphys */ + NULL, /* lun probe */ + NULL, /* lun free */ + NULL /* ioctl */ +}; + /* * Names for the NCR53c9x variants, corresponding to the variant tags * in ncr53c9xvar.h. @@ -185,9 +193,8 @@ ncr53c9x_lunsearch(ti, lun) * Attach this instance, and then all the sub-devices */ void -ncr53c9x_attach(sc, adapter) +ncr53c9x_attach(sc) struct ncr53c9x_softc *sc; - struct scsi_adapter *adapter; { struct scsibus_attach_args saa; @@ -263,7 +270,7 @@ ncr53c9x_attach(sc, adapter) */ sc->sc_link.adapter_softc = sc; sc->sc_link.adapter_target = sc->sc_id; - sc->sc_link.adapter = adapter; + sc->sc_link.adapter = &ncr53c9x_adapter; sc->sc_link.openings = 2; sc->sc_link.adapter_buswidth = sc->sc_ntarg; diff --git a/sys/dev/ic/ncr53c9xvar.h b/sys/dev/ic/ncr53c9xvar.h index 65c8208d586..aeb50ae59f0 100644 --- a/sys/dev/ic/ncr53c9xvar.h +++ b/sys/dev/ic/ncr53c9xvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ncr53c9xvar.h,v 1.20 2010/06/28 18:31:02 krw Exp $ */ +/* $OpenBSD: ncr53c9xvar.h,v 1.21 2014/01/18 22:33:59 dlg Exp $ */ /* $NetBSD: ncr53c9xvar.h,v 1.13 1998/05/26 23:17:34 thorpej Exp $ */ /*- @@ -424,8 +424,7 @@ struct ncr53c9x_softc { #define ncr53c9x_cpb2stp(sc, cpb) \ ((250 * (cpb)) / (sc)->sc_freq) -void ncr53c9x_attach(struct ncr53c9x_softc *, - struct scsi_adapter *); +void ncr53c9x_attach(struct ncr53c9x_softc *); void ncr53c9x_scsi_cmd(struct scsi_xfer *); void ncr53c9x_reset(struct ncr53c9x_softc *); int ncr53c9x_intr(void *); diff --git a/sys/dev/pci/pcscp.c b/sys/dev/pci/pcscp.c index 76ac7900300..ccdc4855e4a 100644 --- a/sys/dev/pci/pcscp.c +++ b/sys/dev/pci/pcscp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcscp.c,v 1.18 2011/04/07 15:30:16 miod Exp $ */ +/* $OpenBSD: pcscp.c,v 1.19 2014/01/18 22:33:59 dlg Exp $ */ /* $NetBSD: pcscp.c,v 1.26 2003/10/19 10:25:42 tsutsui Exp $ */ /*- @@ -119,13 +119,6 @@ void pcscp_dma_go(struct ncr53c9x_softc *); void pcscp_dma_stop(struct ncr53c9x_softc *); int pcscp_dma_isactive(struct ncr53c9x_softc *); -struct scsi_adapter pcscp_adapter = { - ncr53c9x_scsi_cmd, /* cmd */ - scsi_minphys, /* scsi_minphys */ - 0, /* open */ - 0, /* close */ -}; - struct ncr53c9x_glue pcscp_glue = { pcscp_read_reg, pcscp_write_reg, @@ -298,7 +291,7 @@ pcscp_attach(struct device *parent, struct device *self, void *aux) /* Do the common parts of attachment. */ printf("%s", sc->sc_dev.dv_xname); - ncr53c9x_attach(sc, &pcscp_adapter); + ncr53c9x_attach(sc); /* Turn on target selection using the `dma' method */ sc->sc_features |= NCR_F_DMASELECT; diff --git a/sys/dev/pcmcia/esp_pcmcia.c b/sys/dev/pcmcia/esp_pcmcia.c index 752cb7fd198..e1bcadf2ebb 100644 --- a/sys/dev/pcmcia/esp_pcmcia.c +++ b/sys/dev/pcmcia/esp_pcmcia.c @@ -1,4 +1,4 @@ -/* $OpenBSD: esp_pcmcia.c,v 1.10 2011/03/31 13:05:27 jasper Exp $ */ +/* $OpenBSD: esp_pcmcia.c,v 1.11 2014/01/18 22:33:59 dlg Exp $ */ /* $NetBSD: esp_pcmcia.c,v 1.8 2000/06/05 15:36:45 tsutsui Exp $ */ /*- @@ -78,13 +78,6 @@ void esp_pcmcia_init(struct esp_pcmcia_softc *); int esp_pcmcia_detach(struct device *, int); int esp_pcmcia_enable(void *, int); -struct scsi_adapter esp_pcmcia_adapter = { - ncr53c9x_scsi_cmd, /* cmd */ - scsi_minphys, /* scsi_minphys */ - 0, /* open */ - 0, /* close */ -}; - struct cfattach esp_pcmcia_ca = { sizeof(struct esp_pcmcia_softc), esp_pcmcia_match, esp_pcmcia_attach }; @@ -208,7 +201,7 @@ esp_pcmcia_attach(parent, self, aux) * Initialize nca board itself. */ esc->sc_flags |= ESP_PCMCIA_ATTACHING; - ncr53c9x_attach(sc, &esp_pcmcia_adapter); + ncr53c9x_attach(sc); esc->sc_flags &= ~ESP_PCMCIA_ATTACHING; esc->sc_flags |= ESP_PCMCIA_ATTACHED; return; diff --git a/sys/dev/sbus/esp_sbus.c b/sys/dev/sbus/esp_sbus.c index 58852b43d3f..eacbdb15303 100644 --- a/sys/dev/sbus/esp_sbus.c +++ b/sys/dev/sbus/esp_sbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: esp_sbus.c,v 1.23 2010/06/28 18:31:02 krw Exp $ */ +/* $OpenBSD: esp_sbus.c,v 1.24 2014/01/18 22:33:59 dlg Exp $ */ /* $NetBSD: esp_sbus.c,v 1.14 2001/04/25 17:53:37 bouyer Exp $ */ /*- @@ -54,13 +54,6 @@ #include <dev/sbus/sbusvar.h> -struct scsi_adapter esp_switch = { - ncr53c9x_scsi_cmd, - scsi_minphys, /* no max at this level; handled by DMA code */ - NULL, - NULL, -}; - /* #define ESP_SBUS_DEBUG */ static int esp_unit_offset; @@ -507,7 +500,7 @@ espattach(struct esp_softc *esc, struct ncr53c9x_glue *gluep) sc->sc_features |= NCR_F_DMASELECT; /* Do the common parts of attachment. */ - ncr53c9x_attach(sc, &esp_switch); + ncr53c9x_attach(sc); } /* diff --git a/sys/dev/tc/asc.c b/sys/dev/tc/asc.c index ead505bdf44..2683fe7cf9d 100644 --- a/sys/dev/tc/asc.c +++ b/sys/dev/tc/asc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asc.c,v 1.25 2010/06/28 18:31:02 krw Exp $ */ +/* $OpenBSD: asc.c,v 1.26 2014/01/18 22:33:59 dlg Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -70,13 +70,6 @@ struct cfdriver asc_cd = { NULL, "asc", DV_DULL, }; -struct scsi_adapter asc_switch = { - ncr53c9x_scsi_cmd, - scsi_minphys, /* no max at this level; handled by DMA code */ - NULL, - NULL, -}; - /* * Glue functions */ diff --git a/sys/dev/tc/asc_tc.c b/sys/dev/tc/asc_tc.c index c5c3591b267..b7eb1069fbe 100644 --- a/sys/dev/tc/asc_tc.c +++ b/sys/dev/tc/asc_tc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asc_tc.c,v 1.11 2010/11/11 17:54:54 miod Exp $ */ +/* $OpenBSD: asc_tc.c,v 1.12 2014/01/18 22:33:59 dlg Exp $ */ /* $NetBSD: asc_tc.c,v 1.19 2001/11/15 09:48:19 lukem Exp $ */ /*- @@ -61,8 +61,6 @@ struct cfattach asc_tc_ca = { sizeof(struct asc_tc_softc), asc_tc_match, asc_tc_attach }; -extern struct scsi_adapter asc_switch; - int asc_dma_isintr(struct ncr53c9x_softc *); void asc_tc_reset(struct ncr53c9x_softc *); int asc_tc_intr(struct ncr53c9x_softc *); @@ -179,7 +177,7 @@ asc_tc_attach(parent, self, aux) sc->sc_freq /= 1000; /* Do the common parts of attachment. */ - ncr53c9x_attach(sc, &asc_switch); + ncr53c9x_attach(sc); } void diff --git a/sys/dev/tc/asc_tcds.c b/sys/dev/tc/asc_tcds.c index 4d3f4d1522a..64a40a8035d 100644 --- a/sys/dev/tc/asc_tcds.c +++ b/sys/dev/tc/asc_tcds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asc_tcds.c,v 1.7 2010/06/28 18:31:02 krw Exp $ */ +/* $OpenBSD: asc_tcds.c,v 1.8 2014/01/18 22:33:59 dlg Exp $ */ /* $NetBSD: asc_tcds.c,v 1.5 2001/11/15 09:48:19 lukem Exp $ */ /*- @@ -113,8 +113,6 @@ struct ncr53c9x_glue asc_tcds_glue = { tcds_clear_latched_intr, }; -extern struct scsi_adapter asc_switch; - int asc_tcds_match(parent, cf, aux) struct device *parent; @@ -210,7 +208,7 @@ asc_tcds_attach(parent, self, aux) sc->sc_maxxfer = 64 * 1024; /* Do the common parts of attachment. */ - ncr53c9x_attach(sc, &asc_switch); + ncr53c9x_attach(sc); } void |