/* * entered with dev->sc_xs pointing to the next xfer to perform */ void sci_donextcmd(struct sci_softc *dev) { struct scsipi_xfer *xs; struct scsipi_periph *periph; int flags, phase, stat; xs = dev->sc_xs; periph = xs->xs_periph; flags = xs->xs_control; if (flags & XS_CTL_DATA_IN) phase = DATA_IN_PHASE; else if (flags & XS_CTL_DATA_OUT) phase = DATA_OUT_PHASE; else phase = STATUS_PHASE; if (flags & XS_CTL_RESET) scireset(dev); dev->sc_stat[0] = -1; xs->cmd->bytes[0] |= periph->periph_lun << 5; if (phase == STATUS_PHASE || flags & XS_CTL_POLL) stat = sciicmd(dev, periph->periph_target, xs->cmd, xs->cmdlen, xs->data, xs->datalen, phase); else if (scigo(dev, xs) == 0) return; else stat = dev->sc_stat[0]; sci_scsidone(dev, stat); }
void sciabort(struct sci_softc *dev, const char *where) { printf ("%s: abort %s: csr = 0x%02x, bus = 0x%02x\n", device_xname(dev->sc_dev), where, *dev->sci_csr, *dev->sci_bus_csr); if (dev->sc_flags & SCI_SELECTED) { /* lets just hope it worked.. */ dev->sc_flags &= ~SCI_SELECTED; /* XXX */ scireset (dev); } }
void empscattach(device_t parent, device_t self, void *aux) { volatile u_char *rp; struct sci_softc *sc = device_private(self); struct zbus_args *zap; struct scsipi_adapter *adapt = &sc->sc_adapter; struct scsipi_channel *chan = &sc->sc_channel; printf("\n"); zap = aux; rp = (u_char *)zap->va + 0x5000; sc->sc_dev = self; sc->sci_data = rp; sc->sci_odata = rp; sc->sci_icmd = rp + 0x10; sc->sci_mode = rp + 0x20; sc->sci_tcmd = rp + 0x30; sc->sci_bus_csr = rp + 0x40; sc->sci_sel_enb = rp + 0x40; sc->sci_csr = rp + 0x50; sc->sci_dma_send = rp + 0x50; sc->sci_idata = rp + 0x60; sc->sci_trecv = rp + 0x60; sc->sci_iack = rp + 0x70; sc->sci_irecv = rp + 0x70; sc->sc_isr.isr_intr = empsc_intr; sc->sc_isr.isr_arg = sc; sc->sc_isr.isr_ipl = 2; add_isr(&sc->sc_isr); scireset(sc); /* * Fill in the scsipi_adapter. */ memset(adapt, 0, sizeof(*adapt)); adapt->adapt_dev = self; adapt->adapt_nchannels = 1; adapt->adapt_openings = 7; adapt->adapt_max_periph = 1; adapt->adapt_request = sci_scsipi_request; adapt->adapt_minphys = sci_minphys; /* * Fill in the scsipi_channel. */ memset(chan, 0, sizeof(*chan)); chan->chan_adapter = adapt; chan->chan_bustype = &scsi_bustype; chan->chan_channel = 0; chan->chan_ntargets = 8; chan->chan_nluns = 8; chan->chan_id = 7; /* * attach all scsi units on us */ config_found(self, chan, scsiprint); }
void mlhscattach(device_t parent, device_t self, void *aux) { volatile u_char *rp; struct sci_softc *sc = device_private(self); struct zbus_args *zap; struct scsipi_adapter *adapt = &sc->sc_adapter; struct scsipi_channel *chan = &sc->sc_channel; sc->sc_dev = self; printf("\n"); zap = aux; rp = zap->va; sc->sci_data = rp + 1; sc->sci_odata = rp + 1; sc->sci_icmd = rp + 3; sc->sci_mode = rp + 5; sc->sci_tcmd = rp + 7; sc->sci_bus_csr = rp + 9; sc->sci_sel_enb = rp + 9; sc->sci_csr = rp + 11; sc->sci_dma_send = rp + 11; sc->sci_idata = rp + 13; sc->sci_trecv = rp + 13; sc->sci_iack = rp + 15; sc->sci_irecv = rp + 15; sc->dma_xfer_in = mlhsc_dma_xfer_in; sc->dma_xfer_out = mlhsc_dma_xfer_out; scireset(sc); /* * Fill in the scsipi_adapter. */ memset(adapt, 0, sizeof(*adapt)); adapt->adapt_dev = self; adapt->adapt_nchannels = 1; adapt->adapt_openings = 7; adapt->adapt_max_periph = 1; adapt->adapt_request = sci_scsipi_request; adapt->adapt_minphys = sci_minphys; /* * Fill in the scsipi_channel. */ memset(chan, 0, sizeof(*chan)); chan->chan_adapter = adapt; chan->chan_bustype = &scsi_bustype; chan->chan_channel = 0; chan->chan_ntargets = 8; chan->chan_nluns = 8; chan->chan_id = 7; /* * attach all scsi units on us */ config_found(self, chan, scsiprint); }
void wstscattach(struct device *pdp, struct device *dp, void *auxp) { volatile u_char *rp; struct sci_softc *sc = (struct sci_softc *)dp; struct zbus_args *zap; struct scsipi_adapter *adapt = &sc->sc_adapter; struct scsipi_channel *chan = &sc->sc_channel; printf("\n"); zap = auxp; rp = zap->va; /* * set up 5380 register pointers * (Needs check on which Supra board this is - for now, * just do the WordSync) */ sc->sci_data = rp + 0; sc->sci_odata = rp + 0; sc->sci_icmd = rp + 2; sc->sci_mode = rp + 4; sc->sci_tcmd = rp + 6; sc->sci_bus_csr = rp + 8; sc->sci_sel_enb = rp + 8; sc->sci_csr = rp + 10; sc->sci_dma_send = rp + 10; sc->sci_idata = rp + 12; sc->sci_trecv = rp + 12; sc->sci_iack = rp + 14; sc->sci_irecv = rp + 14; if (supradma_pseudo == 2) { sc->dma_xfer_in = (int(*)(struct sci_softc *, int, u_char *, int))wstsc_dma_xfer_in2; sc->dma_xfer_out = (int(*)(struct sci_softc *, int, u_char *, int))wstsc_dma_xfer_out2; } else if (supradma_pseudo == 1) { sc->dma_xfer_in = wstsc_dma_xfer_in; sc->dma_xfer_out = wstsc_dma_xfer_out; } sc->sc_isr.isr_intr = wstsc_intr; sc->sc_isr.isr_arg = sc; sc->sc_isr.isr_ipl = 2; add_isr(&sc->sc_isr); scireset(sc); /* * Fill in the scsipi_adapter. */ memset(adapt, 0, sizeof(*adapt)); adapt->adapt_dev = &sc->sc_dev; adapt->adapt_nchannels = 1; adapt->adapt_openings = 7; adapt->adapt_max_periph = 1; adapt->adapt_request = sci_scsipi_request; adapt->adapt_minphys = sci_minphys; /* * Fill in the scsipi_channel. */ memset(chan, 0, sizeof(*chan)); chan->chan_adapter = adapt; chan->chan_bustype = &scsi_bustype; chan->chan_channel = 0; chan->chan_ntargets = 8; chan->chan_nluns = 8; chan->chan_id = 7; /* * attach all scsi units on us */ config_found(dp, chan, scsiprint); }