2004-05-18 00:12:34 +04:00
|
|
|
/* $NetBSD: siop_common.c,v 1.36 2004/05/17 20:12:34 bouyer Exp $ */
|
2000-05-15 11:48:24 +04:00
|
|
|
|
|
|
|
/*
|
2002-04-23 21:33:27 +04:00
|
|
|
* Copyright (c) 2000, 2002 Manuel Bouyer.
|
2000-05-15 11:48:24 +04:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
2002-04-24 00:41:13 +04:00
|
|
|
* This product includes software developed by Manuel Bouyer.
|
2000-05-15 11:48:24 +04:00
|
|
|
* 4. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* SYM53c7/8xx PCI-SCSI I/O Processors driver */
|
|
|
|
|
2001-11-13 16:14:31 +03:00
|
|
|
#include <sys/cdefs.h>
|
2004-05-18 00:12:34 +04:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: siop_common.c,v 1.36 2004/05/17 20:12:34 bouyer Exp $");
|
2001-11-13 16:14:31 +03:00
|
|
|
|
2000-05-15 11:48:24 +04:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/device.h>
|
|
|
|
#include <sys/malloc.h>
|
|
|
|
#include <sys/buf.h>
|
|
|
|
#include <sys/kernel.h>
|
|
|
|
#include <sys/scsiio.h>
|
|
|
|
|
2002-04-23 21:33:27 +04:00
|
|
|
#include <uvm/uvm_extern.h>
|
|
|
|
|
2000-05-15 11:48:24 +04:00
|
|
|
#include <machine/endian.h>
|
|
|
|
#include <machine/bus.h>
|
|
|
|
|
|
|
|
#include <dev/scsipi/scsi_all.h>
|
|
|
|
#include <dev/scsipi/scsi_message.h>
|
|
|
|
#include <dev/scsipi/scsipi_all.h>
|
|
|
|
|
|
|
|
#include <dev/scsipi/scsiconf.h>
|
|
|
|
|
|
|
|
#include <dev/ic/siopreg.h>
|
|
|
|
#include <dev/ic/siopvar_common.h>
|
|
|
|
|
2002-04-18 16:03:15 +04:00
|
|
|
#include "opt_siop.h"
|
|
|
|
|
2000-05-15 19:16:59 +04:00
|
|
|
#undef DEBUG
|
|
|
|
#undef DEBUG_DR
|
2002-04-23 21:33:27 +04:00
|
|
|
#undef DEBUG_NEG
|
|
|
|
|
|
|
|
int
|
|
|
|
siop_common_attach(sc)
|
|
|
|
struct siop_common_softc *sc;
|
|
|
|
{
|
|
|
|
int error, i;
|
|
|
|
bus_dma_segment_t seg;
|
|
|
|
int rseg;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Allocate DMA-safe memory for the script and map it.
|
|
|
|
*/
|
|
|
|
if ((sc->features & SF_CHIP_RAM) == 0) {
|
|
|
|
error = bus_dmamem_alloc(sc->sc_dmat, PAGE_SIZE,
|
|
|
|
PAGE_SIZE, 0, &seg, 1, &rseg, BUS_DMA_NOWAIT);
|
|
|
|
if (error) {
|
2003-01-31 03:26:25 +03:00
|
|
|
aprint_error(
|
|
|
|
"%s: unable to allocate script DMA memory, "
|
2002-04-23 21:33:27 +04:00
|
|
|
"error = %d\n", sc->sc_dev.dv_xname, error);
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
error = bus_dmamem_map(sc->sc_dmat, &seg, rseg, PAGE_SIZE,
|
|
|
|
(caddr_t *)&sc->sc_script,
|
|
|
|
BUS_DMA_NOWAIT|BUS_DMA_COHERENT);
|
|
|
|
if (error) {
|
2003-01-31 03:26:25 +03:00
|
|
|
aprint_error("%s: unable to map script DMA memory, "
|
2002-04-23 21:33:27 +04:00
|
|
|
"error = %d\n", sc->sc_dev.dv_xname, error);
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
error = bus_dmamap_create(sc->sc_dmat, PAGE_SIZE, 1,
|
|
|
|
PAGE_SIZE, 0, BUS_DMA_NOWAIT, &sc->sc_scriptdma);
|
|
|
|
if (error) {
|
2003-01-31 03:26:25 +03:00
|
|
|
aprint_error("%s: unable to create script DMA map, "
|
2002-04-23 21:33:27 +04:00
|
|
|
"error = %d\n", sc->sc_dev.dv_xname, error);
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
error = bus_dmamap_load(sc->sc_dmat, sc->sc_scriptdma,
|
|
|
|
sc->sc_script, PAGE_SIZE, NULL, BUS_DMA_NOWAIT);
|
|
|
|
if (error) {
|
2003-01-31 03:26:25 +03:00
|
|
|
aprint_error("%s: unable to load script DMA map, "
|
2002-04-23 21:33:27 +04:00
|
|
|
"error = %d\n", sc->sc_dev.dv_xname, error);
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
sc->sc_scriptaddr =
|
|
|
|
sc->sc_scriptdma->dm_segs[0].ds_addr;
|
|
|
|
sc->ram_size = PAGE_SIZE;
|
|
|
|
}
|
|
|
|
|
|
|
|
sc->sc_adapt.adapt_dev = &sc->sc_dev;
|
|
|
|
sc->sc_adapt.adapt_nchannels = 1;
|
|
|
|
sc->sc_adapt.adapt_openings = 0;
|
|
|
|
sc->sc_adapt.adapt_ioctl = siop_ioctl;
|
|
|
|
sc->sc_adapt.adapt_minphys = minphys;
|
|
|
|
|
|
|
|
memset(&sc->sc_chan, 0, sizeof(sc->sc_chan));
|
|
|
|
sc->sc_chan.chan_adapter = &sc->sc_adapt;
|
|
|
|
sc->sc_chan.chan_bustype = &scsi_bustype;
|
|
|
|
sc->sc_chan.chan_channel = 0;
|
|
|
|
sc->sc_chan.chan_flags = SCSIPI_CHAN_CANGROW;
|
|
|
|
sc->sc_chan.chan_ntargets =
|
|
|
|
(sc->features & SF_BUS_WIDE) ? 16 : 8;
|
|
|
|
sc->sc_chan.chan_nluns = 8;
|
|
|
|
sc->sc_chan.chan_id =
|
|
|
|
bus_space_read_1(sc->sc_rt, sc->sc_rh, SIOP_SCID);
|
|
|
|
if (sc->sc_chan.chan_id == 0 ||
|
|
|
|
sc->sc_chan.chan_id >= sc->sc_chan.chan_ntargets)
|
|
|
|
sc->sc_chan.chan_id = SIOP_DEFAULT_TARGET;
|
|
|
|
|
|
|
|
for (i = 0; i < 16; i++)
|
|
|
|
sc->targets[i] = NULL;
|
|
|
|
|
|
|
|
/* find min/max sync period for this chip */
|
|
|
|
sc->st_maxsync = 0;
|
|
|
|
sc->dt_maxsync = 0;
|
|
|
|
sc->st_minsync = 255;
|
|
|
|
sc->dt_minsync = 255;
|
|
|
|
for (i = 0; i < sizeof(scf_period) / sizeof(scf_period[0]); i++) {
|
|
|
|
if (sc->clock_period != scf_period[i].clock)
|
|
|
|
continue;
|
|
|
|
if (sc->st_maxsync < scf_period[i].period)
|
|
|
|
sc->st_maxsync = scf_period[i].period;
|
|
|
|
if (sc->st_minsync > scf_period[i].period)
|
|
|
|
sc->st_minsync = scf_period[i].period;
|
|
|
|
}
|
|
|
|
if (sc->st_maxsync == 255 || sc->st_minsync == 0)
|
2002-09-27 19:35:29 +04:00
|
|
|
panic("siop: can't find my sync parameters");
|
2002-04-23 21:33:27 +04:00
|
|
|
for (i = 0; i < sizeof(dt_scf_period) / sizeof(dt_scf_period[0]); i++) {
|
|
|
|
if (sc->clock_period != dt_scf_period[i].clock)
|
|
|
|
continue;
|
|
|
|
if (sc->dt_maxsync < dt_scf_period[i].period)
|
|
|
|
sc->dt_maxsync = dt_scf_period[i].period;
|
|
|
|
if (sc->dt_minsync > dt_scf_period[i].period)
|
|
|
|
sc->dt_minsync = dt_scf_period[i].period;
|
|
|
|
}
|
|
|
|
if (sc->dt_maxsync == 255 || sc->dt_minsync == 0)
|
2002-09-27 19:35:29 +04:00
|
|
|
panic("siop: can't find my sync parameters");
|
2002-04-23 21:33:27 +04:00
|
|
|
return 0;
|
|
|
|
}
|
2000-05-15 11:48:24 +04:00
|
|
|
|
|
|
|
void
|
|
|
|
siop_common_reset(sc)
|
2002-04-20 04:15:54 +04:00
|
|
|
struct siop_common_softc *sc;
|
2000-05-15 11:48:24 +04:00
|
|
|
{
|
|
|
|
u_int32_t stest3;
|
|
|
|
|
|
|
|
/* reset the chip */
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_ISTAT, ISTAT_SRST);
|
|
|
|
delay(1000);
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_ISTAT, 0);
|
|
|
|
|
|
|
|
/* init registers */
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_SCNTL0,
|
|
|
|
SCNTL0_ARB_MASK | SCNTL0_EPC | SCNTL0_AAP);
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_SCNTL1, 0);
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_SCNTL3, sc->clock_div);
|
2000-10-06 20:35:13 +04:00
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_SXFER, 0);
|
2000-05-15 11:48:24 +04:00
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_DIEN, 0xff);
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_SIEN0,
|
|
|
|
0xff & ~(SIEN0_CMP | SIEN0_SEL | SIEN0_RSL));
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_SIEN1,
|
|
|
|
0xff & ~(SIEN1_HTH | SIEN1_GEN));
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_STEST2, 0);
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_STEST3, STEST3_TE);
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_STIME0,
|
|
|
|
(0xb << STIME0_SEL_SHIFT));
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_SCID,
|
2001-04-25 21:53:04 +04:00
|
|
|
sc->sc_chan.chan_id | SCID_RRE);
|
2000-05-15 11:48:24 +04:00
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_RESPID0,
|
2001-04-25 21:53:04 +04:00
|
|
|
1 << sc->sc_chan.chan_id);
|
2000-05-15 11:48:24 +04:00
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_DCNTL,
|
|
|
|
(sc->features & SF_CHIP_PF) ? DCNTL_COM | DCNTL_PFEN : DCNTL_COM);
|
2004-03-11 01:02:53 +03:00
|
|
|
if (sc->features & SF_CHIP_AAIP)
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh,
|
|
|
|
SIOP_AIPCNTL1, AIPCNTL1_DIS);
|
2000-05-15 11:48:24 +04:00
|
|
|
|
|
|
|
/* enable clock doubler or quadruler if appropriate */
|
|
|
|
if (sc->features & (SF_CHIP_DBLR | SF_CHIP_QUAD)) {
|
|
|
|
stest3 = bus_space_read_1(sc->sc_rt, sc->sc_rh, SIOP_STEST3);
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_STEST1,
|
|
|
|
STEST1_DBLEN);
|
|
|
|
if (sc->features & SF_CHIP_QUAD) {
|
|
|
|
/* wait for PPL to lock */
|
|
|
|
while ((bus_space_read_1(sc->sc_rt, sc->sc_rh,
|
|
|
|
SIOP_STEST4) & STEST4_LOCK) == 0)
|
|
|
|
delay(10);
|
|
|
|
} else {
|
|
|
|
/* data sheet says 20us - more won't hurt */
|
|
|
|
delay(100);
|
|
|
|
}
|
|
|
|
/* halt scsi clock, select doubler/quad, restart clock */
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_STEST3,
|
|
|
|
stest3 | STEST3_HSC);
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_STEST1,
|
|
|
|
STEST1_DBLEN | STEST1_DBLSEL);
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_STEST3, stest3);
|
|
|
|
} else {
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_STEST1, 0);
|
|
|
|
}
|
|
|
|
if (sc->features & SF_CHIP_FIFO)
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_CTEST5,
|
|
|
|
bus_space_read_1(sc->sc_rt, sc->sc_rh, SIOP_CTEST5) |
|
|
|
|
CTEST5_DFS);
|
2002-04-23 14:38:37 +04:00
|
|
|
if (sc->features & SF_CHIP_LED0) {
|
|
|
|
/* Set GPIO0 as output if software LED control is required */
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_GPCNTL,
|
|
|
|
bus_space_read_1(sc->sc_rt, sc->sc_rh, SIOP_GPCNTL) & 0xfe);
|
|
|
|
}
|
2002-04-23 21:33:27 +04:00
|
|
|
if (sc->features & SF_BUS_ULTRA3) {
|
|
|
|
/* reset SCNTL4 */
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_SCNTL4, 0);
|
|
|
|
}
|
2002-05-04 22:43:22 +04:00
|
|
|
sc->mode = bus_space_read_1(sc->sc_rt, sc->sc_rh, SIOP_STEST4) &
|
|
|
|
STEST4_MODE_MASK;
|
2002-08-29 22:23:52 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* initialise the RAM. Without this we may get scsi gross errors on
|
|
|
|
* the 1010
|
|
|
|
*/
|
|
|
|
if (sc->features & SF_CHIP_RAM)
|
|
|
|
bus_space_set_region_4(sc->sc_ramt, sc->sc_ramh,
|
|
|
|
0, 0, sc->ram_size / 4);
|
2000-05-15 11:48:24 +04:00
|
|
|
sc->sc_reset(sc);
|
|
|
|
}
|
|
|
|
|
2000-10-23 18:56:16 +04:00
|
|
|
/* prepare tables before sending a cmd */
|
|
|
|
void
|
|
|
|
siop_setuptables(siop_cmd)
|
2002-04-20 04:15:54 +04:00
|
|
|
struct siop_common_cmd *siop_cmd;
|
2000-10-23 18:56:16 +04:00
|
|
|
{
|
|
|
|
int i;
|
2002-04-20 04:15:54 +04:00
|
|
|
struct siop_common_softc *sc = siop_cmd->siop_sc;
|
2000-10-23 18:56:16 +04:00
|
|
|
struct scsipi_xfer *xs = siop_cmd->xs;
|
2001-04-25 21:53:04 +04:00
|
|
|
int target = xs->xs_periph->periph_target;
|
|
|
|
int lun = xs->xs_periph->periph_lun;
|
|
|
|
int msgoffset = 1;
|
2000-10-23 18:56:16 +04:00
|
|
|
|
2002-04-20 04:15:54 +04:00
|
|
|
siop_cmd->siop_tables->id = htole32(sc->targets[target]->id);
|
2002-04-23 21:33:27 +04:00
|
|
|
memset(siop_cmd->siop_tables->msg_out, 0,
|
|
|
|
sizeof(siop_cmd->siop_tables->msg_out));
|
2001-04-25 21:53:04 +04:00
|
|
|
/* request sense doesn't disconnect */
|
|
|
|
if (xs->xs_control & XS_CTL_REQSENSE)
|
2002-04-20 04:15:54 +04:00
|
|
|
siop_cmd->siop_tables->msg_out[0] = MSG_IDENTIFY(lun, 0);
|
2002-05-04 22:11:06 +04:00
|
|
|
else if ((sc->features & SF_CHIP_GEBUG) &&
|
|
|
|
(sc->targets[target]->flags & TARF_ISWIDE) == 0)
|
|
|
|
/*
|
|
|
|
* 1010 bug: it seems that the 1010 has problems with reselect
|
|
|
|
* when not in wide mode (generate false SCSI gross error).
|
|
|
|
* The FreeBSD sym driver has comments about it but their
|
|
|
|
* workaround (disable SCSI gross error reporting) doesn't
|
|
|
|
* work with my adapter. So disable disconnect when not
|
|
|
|
* wide.
|
|
|
|
*/
|
|
|
|
siop_cmd->siop_tables->msg_out[0] = MSG_IDENTIFY(lun, 0);
|
2001-04-25 21:53:04 +04:00
|
|
|
else
|
2002-04-20 04:15:54 +04:00
|
|
|
siop_cmd->siop_tables->msg_out[0] = MSG_IDENTIFY(lun, 1);
|
2001-04-25 21:53:04 +04:00
|
|
|
if (xs->xs_tag_type != 0) {
|
|
|
|
if ((sc->targets[target]->flags & TARF_TAG) == 0) {
|
|
|
|
scsipi_printaddr(xs->xs_periph);
|
|
|
|
printf(": tagged command type %d id %d\n",
|
|
|
|
siop_cmd->xs->xs_tag_type, siop_cmd->xs->xs_tag_id);
|
2002-09-27 19:35:29 +04:00
|
|
|
panic("tagged command for non-tagging device");
|
2001-04-25 21:53:04 +04:00
|
|
|
}
|
|
|
|
siop_cmd->flags |= CMDFL_TAG;
|
2002-04-20 04:15:54 +04:00
|
|
|
siop_cmd->siop_tables->msg_out[1] = siop_cmd->xs->xs_tag_type;
|
2002-04-22 19:48:55 +04:00
|
|
|
/*
|
|
|
|
* use siop_cmd->tag not xs->xs_tag_id, caller may want a
|
|
|
|
* different one
|
|
|
|
*/
|
|
|
|
siop_cmd->siop_tables->msg_out[2] = siop_cmd->tag;
|
2001-04-25 21:53:04 +04:00
|
|
|
msgoffset = 3;
|
2002-04-23 00:31:49 +04:00
|
|
|
}
|
2002-04-29 19:45:05 +04:00
|
|
|
siop_cmd->siop_tables->t_msgout.count= htole32(msgoffset);
|
2000-10-23 18:56:16 +04:00
|
|
|
if (sc->targets[target]->status == TARST_ASYNC) {
|
2002-05-04 22:43:22 +04:00
|
|
|
if ((sc->targets[target]->flags & TARF_DT) &&
|
|
|
|
(sc->mode == STEST4_MODE_LVD)) {
|
2002-04-23 21:33:27 +04:00
|
|
|
sc->targets[target]->status = TARST_PPR_NEG;
|
|
|
|
siop_ppr_msg(siop_cmd, msgoffset, sc->dt_minsync,
|
|
|
|
sc->maxoff);
|
|
|
|
} else if (sc->targets[target]->flags & TARF_WIDE) {
|
2000-10-23 18:56:16 +04:00
|
|
|
sc->targets[target]->status = TARST_WIDE_NEG;
|
2001-04-25 21:53:04 +04:00
|
|
|
siop_wdtr_msg(siop_cmd, msgoffset,
|
|
|
|
MSG_EXT_WDTR_BUS_16_BIT);
|
2000-10-23 18:56:16 +04:00
|
|
|
} else if (sc->targets[target]->flags & TARF_SYNC) {
|
|
|
|
sc->targets[target]->status = TARST_SYNC_NEG;
|
2002-04-23 21:33:27 +04:00
|
|
|
siop_sdtr_msg(siop_cmd, msgoffset, sc->st_minsync,
|
|
|
|
(sc->maxoff > 31) ? 31 : sc->maxoff);
|
2000-10-23 18:56:16 +04:00
|
|
|
} else {
|
|
|
|
sc->targets[target]->status = TARST_OK;
|
2001-04-25 21:53:04 +04:00
|
|
|
siop_update_xfer_mode(sc, target);
|
2000-10-23 18:56:16 +04:00
|
|
|
}
|
|
|
|
}
|
2002-04-20 04:15:54 +04:00
|
|
|
siop_cmd->siop_tables->status =
|
2000-10-24 03:18:10 +04:00
|
|
|
htole32(SCSI_SIOP_NOSTATUS); /* set invalid status */
|
2000-10-23 18:56:16 +04:00
|
|
|
|
2002-04-20 04:15:54 +04:00
|
|
|
siop_cmd->siop_tables->cmd.count =
|
2000-10-23 18:56:16 +04:00
|
|
|
htole32(siop_cmd->dmamap_cmd->dm_segs[0].ds_len);
|
2002-04-20 04:15:54 +04:00
|
|
|
siop_cmd->siop_tables->cmd.addr =
|
2000-10-23 18:56:16 +04:00
|
|
|
htole32(siop_cmd->dmamap_cmd->dm_segs[0].ds_addr);
|
2001-04-25 21:53:04 +04:00
|
|
|
if (xs->xs_control & (XS_CTL_DATA_IN | XS_CTL_DATA_OUT)) {
|
2000-10-23 18:56:16 +04:00
|
|
|
for (i = 0; i < siop_cmd->dmamap_data->dm_nsegs; i++) {
|
2002-04-20 04:15:54 +04:00
|
|
|
siop_cmd->siop_tables->data[i].count =
|
2000-10-23 18:56:16 +04:00
|
|
|
htole32(siop_cmd->dmamap_data->dm_segs[i].ds_len);
|
2002-04-20 04:15:54 +04:00
|
|
|
siop_cmd->siop_tables->data[i].addr =
|
2000-10-23 18:56:16 +04:00
|
|
|
htole32(siop_cmd->dmamap_data->dm_segs[i].ds_addr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-05-15 11:48:24 +04:00
|
|
|
int
|
|
|
|
siop_wdtr_neg(siop_cmd)
|
2002-04-20 04:15:54 +04:00
|
|
|
struct siop_common_cmd *siop_cmd;
|
2000-05-15 11:48:24 +04:00
|
|
|
{
|
2002-04-20 04:15:54 +04:00
|
|
|
struct siop_common_softc *sc = siop_cmd->siop_sc;
|
|
|
|
struct siop_common_target *siop_target = siop_cmd->siop_target;
|
2001-04-25 21:53:04 +04:00
|
|
|
int target = siop_cmd->xs->xs_periph->periph_target;
|
2002-04-20 04:15:54 +04:00
|
|
|
struct siop_common_xfer *tables = siop_cmd->siop_tables;
|
2000-05-15 11:48:24 +04:00
|
|
|
|
|
|
|
if (siop_target->status == TARST_WIDE_NEG) {
|
|
|
|
/* we initiated wide negotiation */
|
2000-10-18 21:06:52 +04:00
|
|
|
switch (tables->msg_in[3]) {
|
2000-05-15 11:48:24 +04:00
|
|
|
case MSG_EXT_WDTR_BUS_8_BIT:
|
2000-10-18 21:06:52 +04:00
|
|
|
siop_target->flags &= ~TARF_ISWIDE;
|
2000-05-15 11:48:24 +04:00
|
|
|
sc->targets[target]->id &= ~(SCNTL3_EWS << 24);
|
|
|
|
break;
|
|
|
|
case MSG_EXT_WDTR_BUS_16_BIT:
|
2000-10-18 21:06:52 +04:00
|
|
|
if (siop_target->flags & TARF_WIDE) {
|
|
|
|
siop_target->flags |= TARF_ISWIDE;
|
2000-05-15 11:48:24 +04:00
|
|
|
sc->targets[target]->id |= (SCNTL3_EWS << 24);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* FALLTHROUH */
|
|
|
|
default:
|
|
|
|
/*
|
2002-07-18 15:59:06 +04:00
|
|
|
* hum, we got more than what we can handle, shouldn't
|
2000-05-15 11:48:24 +04:00
|
|
|
* happen. Reject, and stay async
|
|
|
|
*/
|
2000-10-18 21:06:52 +04:00
|
|
|
siop_target->flags &= ~TARF_ISWIDE;
|
2000-05-15 11:48:24 +04:00
|
|
|
siop_target->status = TARST_OK;
|
2001-04-25 21:53:04 +04:00
|
|
|
siop_target->offset = siop_target->period = 0;
|
|
|
|
siop_update_xfer_mode(sc, target);
|
2000-05-15 11:48:24 +04:00
|
|
|
printf("%s: rejecting invalid wide negotiation from "
|
|
|
|
"target %d (%d)\n", sc->sc_dev.dv_xname, target,
|
2000-10-18 21:06:52 +04:00
|
|
|
tables->msg_in[3]);
|
|
|
|
tables->t_msgout.count= htole32(1);
|
|
|
|
tables->msg_out[0] = MSG_MESSAGE_REJECT;
|
2000-05-15 11:48:24 +04:00
|
|
|
return SIOP_NEG_MSGOUT;
|
|
|
|
}
|
2000-10-18 21:06:52 +04:00
|
|
|
tables->id = htole32(sc->targets[target]->id);
|
2000-05-15 11:48:24 +04:00
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh,
|
|
|
|
SIOP_SCNTL3,
|
|
|
|
(sc->targets[target]->id >> 24) & 0xff);
|
|
|
|
/* we now need to do sync */
|
2000-10-18 21:06:52 +04:00
|
|
|
if (siop_target->flags & TARF_SYNC) {
|
2000-07-24 19:15:00 +04:00
|
|
|
siop_target->status = TARST_SYNC_NEG;
|
2002-04-23 21:33:27 +04:00
|
|
|
siop_sdtr_msg(siop_cmd, 0, sc->st_minsync,
|
|
|
|
(sc->maxoff > 31) ? 31 : sc->maxoff);
|
2000-07-24 19:15:00 +04:00
|
|
|
return SIOP_NEG_MSGOUT;
|
|
|
|
} else {
|
|
|
|
siop_target->status = TARST_OK;
|
2001-04-25 21:53:04 +04:00
|
|
|
siop_update_xfer_mode(sc, target);
|
2000-07-24 19:15:00 +04:00
|
|
|
return SIOP_NEG_ACK;
|
|
|
|
}
|
2000-05-15 11:48:24 +04:00
|
|
|
} else {
|
|
|
|
/* target initiated wide negotiation */
|
2000-10-18 21:06:52 +04:00
|
|
|
if (tables->msg_in[3] >= MSG_EXT_WDTR_BUS_16_BIT
|
|
|
|
&& (siop_target->flags & TARF_WIDE)) {
|
|
|
|
siop_target->flags |= TARF_ISWIDE;
|
2000-05-15 11:48:24 +04:00
|
|
|
sc->targets[target]->id |= SCNTL3_EWS << 24;
|
|
|
|
} else {
|
2000-10-18 21:06:52 +04:00
|
|
|
siop_target->flags &= ~TARF_ISWIDE;
|
2000-05-15 11:48:24 +04:00
|
|
|
sc->targets[target]->id &= ~(SCNTL3_EWS << 24);
|
|
|
|
}
|
2000-10-18 21:06:52 +04:00
|
|
|
tables->id = htole32(sc->targets[target]->id);
|
2000-05-15 11:48:24 +04:00
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_SCNTL3,
|
|
|
|
(sc->targets[target]->id >> 24) & 0xff);
|
|
|
|
/*
|
|
|
|
* we did reset wide parameters, so fall back to async,
|
2000-10-06 20:39:04 +04:00
|
|
|
* but don't schedule a sync neg, target should initiate it
|
2000-05-15 11:48:24 +04:00
|
|
|
*/
|
|
|
|
siop_target->status = TARST_OK;
|
2001-04-25 21:53:04 +04:00
|
|
|
siop_target->offset = siop_target->period = 0;
|
|
|
|
siop_update_xfer_mode(sc, target);
|
2000-10-23 18:56:16 +04:00
|
|
|
siop_wdtr_msg(siop_cmd, 0, (siop_target->flags & TARF_ISWIDE) ?
|
|
|
|
MSG_EXT_WDTR_BUS_16_BIT : MSG_EXT_WDTR_BUS_8_BIT);
|
2000-05-15 11:48:24 +04:00
|
|
|
return SIOP_NEG_MSGOUT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-04-23 21:33:27 +04:00
|
|
|
int
|
|
|
|
siop_ppr_neg(siop_cmd)
|
|
|
|
struct siop_common_cmd *siop_cmd;
|
|
|
|
{
|
|
|
|
struct siop_common_softc *sc = siop_cmd->siop_sc;
|
|
|
|
struct siop_common_target *siop_target = siop_cmd->siop_target;
|
|
|
|
int target = siop_cmd->xs->xs_periph->periph_target;
|
|
|
|
struct siop_common_xfer *tables = siop_cmd->siop_tables;
|
|
|
|
int sync, offset, options, scf = 0;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
#ifdef DEBUG_NEG
|
|
|
|
printf("%s: anserw on ppr negotiation:", sc->sc_dev.dv_xname);
|
|
|
|
for (i = 0; i < 8; i++)
|
|
|
|
printf(" 0x%x", tables->msg_in[i]);
|
|
|
|
printf("\n");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (siop_target->status == TARST_PPR_NEG) {
|
|
|
|
/* we initiated PPR negotiation */
|
|
|
|
sync = tables->msg_in[3];
|
|
|
|
offset = tables->msg_in[5];
|
|
|
|
options = tables->msg_in[7];
|
|
|
|
if (options != MSG_EXT_PPR_DT) {
|
|
|
|
/* should't happen */
|
|
|
|
printf("%s: ppr negotiation for target %d: "
|
|
|
|
"no DT option\n", sc->sc_dev.dv_xname, target);
|
|
|
|
siop_target->status = TARST_ASYNC;
|
|
|
|
siop_target->flags &= ~(TARF_DT | TARF_ISDT);
|
|
|
|
siop_target->offset = 0;
|
|
|
|
siop_target->period = 0;
|
|
|
|
goto reject;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (offset > sc->maxoff || sync < sc->dt_minsync ||
|
|
|
|
sync > sc->dt_maxsync) {
|
|
|
|
printf("%s: ppr negotiation for target %d: "
|
|
|
|
"offset (%d) or sync (%d) out of range\n",
|
|
|
|
sc->sc_dev.dv_xname, target, offset, sync);
|
|
|
|
/* should not happen */
|
|
|
|
siop_target->offset = 0;
|
|
|
|
siop_target->period = 0;
|
|
|
|
goto reject;
|
|
|
|
} else {
|
|
|
|
for (i = 0; i <
|
|
|
|
sizeof(dt_scf_period) / sizeof(dt_scf_period[0]);
|
|
|
|
i++) {
|
|
|
|
if (sc->clock_period != dt_scf_period[i].clock)
|
|
|
|
continue;
|
|
|
|
if (dt_scf_period[i].period == sync) {
|
|
|
|
/* ok, found it. we now are sync. */
|
|
|
|
siop_target->offset = offset;
|
|
|
|
siop_target->period = sync;
|
|
|
|
scf = dt_scf_period[i].scf;
|
|
|
|
siop_target->flags |= TARF_ISDT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((siop_target->flags & TARF_ISDT) == 0) {
|
|
|
|
printf("%s: ppr negotiation for target %d: "
|
|
|
|
"sync (%d) incompatible with adapter\n",
|
|
|
|
sc->sc_dev.dv_xname, target, sync);
|
|
|
|
/*
|
|
|
|
* we didn't find it in our table, do async
|
|
|
|
* send reject msg, start SDTR/WDTR neg
|
|
|
|
*/
|
|
|
|
siop_target->status = TARST_ASYNC;
|
|
|
|
siop_target->flags &= ~(TARF_DT | TARF_ISDT);
|
|
|
|
siop_target->offset = 0;
|
|
|
|
siop_target->period = 0;
|
|
|
|
goto reject;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (tables->msg_in[6] != 1) {
|
|
|
|
printf("%s: ppr negotiation for target %d: "
|
|
|
|
"transfer width (%d) incompatible with dt\n",
|
|
|
|
sc->sc_dev.dv_xname, target, tables->msg_in[6]);
|
|
|
|
/* DT mode can only be done with wide transfers */
|
|
|
|
siop_target->status = TARST_ASYNC;
|
|
|
|
goto reject;
|
|
|
|
}
|
|
|
|
siop_target->flags |= TARF_ISWIDE;
|
|
|
|
sc->targets[target]->id |= (SCNTL3_EWS << 24);
|
|
|
|
sc->targets[target]->id &= ~(SCNTL3_SCF_MASK << 24);
|
|
|
|
sc->targets[target]->id |= scf << (24 + SCNTL3_SCF_SHIFT);
|
|
|
|
sc->targets[target]->id &= ~(SXFER_MO_MASK << 8);
|
|
|
|
sc->targets[target]->id |=
|
|
|
|
(siop_target->offset & SXFER_MO_MASK) << 8;
|
|
|
|
sc->targets[target]->id &= ~0xff;
|
|
|
|
sc->targets[target]->id |= SCNTL4_U3EN;
|
|
|
|
siop_target->status = TARST_OK;
|
|
|
|
siop_update_xfer_mode(sc, target);
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_SCNTL3,
|
|
|
|
(sc->targets[target]->id >> 24) & 0xff);
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_SXFER,
|
|
|
|
(sc->targets[target]->id >> 8) & 0xff);
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_SCNTL4,
|
|
|
|
sc->targets[target]->id & 0xff);
|
|
|
|
return SIOP_NEG_ACK;
|
|
|
|
} else {
|
|
|
|
/* target initiated PPR negotiation, shouldn't happen */
|
|
|
|
printf("%s: rejecting invalid PPR negotiation from "
|
|
|
|
"target %d\n", sc->sc_dev.dv_xname, target);
|
|
|
|
reject:
|
|
|
|
tables->t_msgout.count= htole32(1);
|
|
|
|
tables->msg_out[0] = MSG_MESSAGE_REJECT;
|
|
|
|
return SIOP_NEG_MSGOUT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-05-15 11:48:24 +04:00
|
|
|
int
|
|
|
|
siop_sdtr_neg(siop_cmd)
|
2002-04-20 04:15:54 +04:00
|
|
|
struct siop_common_cmd *siop_cmd;
|
2000-05-15 11:48:24 +04:00
|
|
|
{
|
2002-04-20 04:15:54 +04:00
|
|
|
struct siop_common_softc *sc = siop_cmd->siop_sc;
|
|
|
|
struct siop_common_target *siop_target = siop_cmd->siop_target;
|
2001-04-25 21:53:04 +04:00
|
|
|
int target = siop_cmd->xs->xs_periph->periph_target;
|
2002-04-23 21:33:27 +04:00
|
|
|
int sync, maxoffset, offset, i;
|
2000-05-15 11:48:24 +04:00
|
|
|
int send_msgout = 0;
|
2002-04-20 04:15:54 +04:00
|
|
|
struct siop_common_xfer *tables = siop_cmd->siop_tables;
|
2000-05-15 11:48:24 +04:00
|
|
|
|
2002-04-23 21:33:27 +04:00
|
|
|
/* limit to Ultra/2 parameters, need PPR for Ultra/3 */
|
|
|
|
maxoffset = (sc->maxoff > 31) ? 31 : sc->maxoff;
|
|
|
|
|
2000-10-18 21:06:52 +04:00
|
|
|
sync = tables->msg_in[3];
|
|
|
|
offset = tables->msg_in[4];
|
2000-05-15 11:48:24 +04:00
|
|
|
|
|
|
|
if (siop_target->status == TARST_SYNC_NEG) {
|
|
|
|
/* we initiated sync negotiation */
|
|
|
|
siop_target->status = TARST_OK;
|
|
|
|
#ifdef DEBUG
|
|
|
|
printf("sdtr: sync %d offset %d\n", sync, offset);
|
|
|
|
#endif
|
2002-04-23 21:33:27 +04:00
|
|
|
if (offset > maxoffset || sync < sc->st_minsync ||
|
|
|
|
sync > sc->st_maxsync)
|
2000-05-15 11:48:24 +04:00
|
|
|
goto reject;
|
|
|
|
for (i = 0; i < sizeof(scf_period) / sizeof(scf_period[0]);
|
|
|
|
i++) {
|
|
|
|
if (sc->clock_period != scf_period[i].clock)
|
|
|
|
continue;
|
|
|
|
if (scf_period[i].period == sync) {
|
|
|
|
/* ok, found it. we now are sync. */
|
2001-04-25 21:53:04 +04:00
|
|
|
siop_target->offset = offset;
|
|
|
|
siop_target->period = sync;
|
2000-05-15 11:48:24 +04:00
|
|
|
sc->targets[target]->id &=
|
|
|
|
~(SCNTL3_SCF_MASK << 24);
|
|
|
|
sc->targets[target]->id |= scf_period[i].scf
|
|
|
|
<< (24 + SCNTL3_SCF_SHIFT);
|
2002-04-23 21:33:27 +04:00
|
|
|
if (sync < 25 && /* Ultra */
|
|
|
|
(sc->features & SF_BUS_ULTRA3) == 0)
|
2000-05-15 11:48:24 +04:00
|
|
|
sc->targets[target]->id |=
|
|
|
|
SCNTL3_ULTRA << 24;
|
|
|
|
else
|
|
|
|
sc->targets[target]->id &=
|
|
|
|
~(SCNTL3_ULTRA << 24);
|
|
|
|
sc->targets[target]->id &=
|
2000-10-06 20:35:13 +04:00
|
|
|
~(SXFER_MO_MASK << 8);
|
2000-05-15 11:48:24 +04:00
|
|
|
sc->targets[target]->id |=
|
2000-10-06 20:35:13 +04:00
|
|
|
(offset & SXFER_MO_MASK) << 8;
|
2002-04-29 19:45:05 +04:00
|
|
|
sc->targets[target]->id &= ~0xff; /* scntl4 */
|
2000-05-15 11:48:24 +04:00
|
|
|
goto end;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* we didn't find it in our table, do async and send reject
|
|
|
|
* msg
|
|
|
|
*/
|
|
|
|
reject:
|
|
|
|
send_msgout = 1;
|
2000-10-18 21:06:52 +04:00
|
|
|
tables->t_msgout.count= htole32(1);
|
|
|
|
tables->msg_out[0] = MSG_MESSAGE_REJECT;
|
2000-05-15 11:48:24 +04:00
|
|
|
sc->targets[target]->id &= ~(SCNTL3_SCF_MASK << 24);
|
|
|
|
sc->targets[target]->id &= ~(SCNTL3_ULTRA << 24);
|
2000-10-06 20:35:13 +04:00
|
|
|
sc->targets[target]->id &= ~(SXFER_MO_MASK << 8);
|
2002-04-29 19:45:05 +04:00
|
|
|
sc->targets[target]->id &= ~0xff; /* scntl4 */
|
2001-04-25 21:53:04 +04:00
|
|
|
siop_target->offset = siop_target->period = 0;
|
2000-05-15 11:48:24 +04:00
|
|
|
} else { /* target initiated sync neg */
|
|
|
|
#ifdef DEBUG
|
|
|
|
printf("sdtr (target): sync %d offset %d\n", sync, offset);
|
|
|
|
#endif
|
2002-04-23 21:33:27 +04:00
|
|
|
if (offset == 0 || sync > sc->st_maxsync) { /* async */
|
2000-05-15 11:48:24 +04:00
|
|
|
goto async;
|
|
|
|
}
|
2002-04-23 21:33:27 +04:00
|
|
|
if (offset > maxoffset)
|
|
|
|
offset = maxoffset;
|
|
|
|
if (sync < sc->st_minsync)
|
|
|
|
sync = sc->st_minsync;
|
2000-05-15 11:48:24 +04:00
|
|
|
/* look for sync period */
|
|
|
|
for (i = 0; i < sizeof(scf_period) / sizeof(scf_period[0]);
|
|
|
|
i++) {
|
|
|
|
if (sc->clock_period != scf_period[i].clock)
|
|
|
|
continue;
|
|
|
|
if (scf_period[i].period == sync) {
|
|
|
|
/* ok, found it. we now are sync. */
|
2001-04-25 21:53:04 +04:00
|
|
|
siop_target->offset = offset;
|
|
|
|
siop_target->period = sync;
|
2000-05-15 11:48:24 +04:00
|
|
|
sc->targets[target]->id &=
|
|
|
|
~(SCNTL3_SCF_MASK << 24);
|
|
|
|
sc->targets[target]->id |= scf_period[i].scf
|
|
|
|
<< (24 + SCNTL3_SCF_SHIFT);
|
2002-04-23 21:33:27 +04:00
|
|
|
if (sync < 25 && /* Ultra */
|
|
|
|
(sc->features & SF_BUS_ULTRA3) == 0)
|
2000-05-15 11:48:24 +04:00
|
|
|
sc->targets[target]->id |=
|
|
|
|
SCNTL3_ULTRA << 24;
|
|
|
|
else
|
|
|
|
sc->targets[target]->id &=
|
|
|
|
~(SCNTL3_ULTRA << 24);
|
|
|
|
sc->targets[target]->id &=
|
2000-10-06 20:35:13 +04:00
|
|
|
~(SXFER_MO_MASK << 8);
|
2000-05-15 11:48:24 +04:00
|
|
|
sc->targets[target]->id |=
|
2000-10-06 20:35:13 +04:00
|
|
|
(offset & SXFER_MO_MASK) << 8;
|
2002-04-29 19:45:05 +04:00
|
|
|
sc->targets[target]->id &= ~0xff; /* scntl4 */
|
2000-10-23 18:56:16 +04:00
|
|
|
siop_sdtr_msg(siop_cmd, 0, sync, offset);
|
2000-05-15 11:48:24 +04:00
|
|
|
send_msgout = 1;
|
|
|
|
goto end;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
async:
|
2001-04-25 21:53:04 +04:00
|
|
|
siop_target->offset = siop_target->period = 0;
|
2000-05-15 11:48:24 +04:00
|
|
|
sc->targets[target]->id &= ~(SCNTL3_SCF_MASK << 24);
|
|
|
|
sc->targets[target]->id &= ~(SCNTL3_ULTRA << 24);
|
2000-10-06 20:35:13 +04:00
|
|
|
sc->targets[target]->id &= ~(SXFER_MO_MASK << 8);
|
2002-04-29 19:45:05 +04:00
|
|
|
sc->targets[target]->id &= ~0xff; /* scntl4 */
|
2000-10-23 18:56:16 +04:00
|
|
|
siop_sdtr_msg(siop_cmd, 0, 0, 0);
|
2000-05-15 11:48:24 +04:00
|
|
|
send_msgout = 1;
|
|
|
|
}
|
|
|
|
end:
|
2001-04-25 21:53:04 +04:00
|
|
|
if (siop_target->status == TARST_OK)
|
|
|
|
siop_update_xfer_mode(sc, target);
|
2000-05-15 11:48:24 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
printf("id now 0x%x\n", sc->targets[target]->id);
|
|
|
|
#endif
|
2000-10-18 21:06:52 +04:00
|
|
|
tables->id = htole32(sc->targets[target]->id);
|
2000-05-15 11:48:24 +04:00
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_SCNTL3,
|
|
|
|
(sc->targets[target]->id >> 24) & 0xff);
|
2000-10-06 20:35:13 +04:00
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_SXFER,
|
2000-05-15 11:48:24 +04:00
|
|
|
(sc->targets[target]->id >> 8) & 0xff);
|
|
|
|
if (send_msgout) {
|
|
|
|
return SIOP_NEG_MSGOUT;
|
|
|
|
} else {
|
|
|
|
return SIOP_NEG_ACK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-10-23 18:56:16 +04:00
|
|
|
void
|
|
|
|
siop_sdtr_msg(siop_cmd, offset, ssync, soff)
|
2002-04-20 04:15:54 +04:00
|
|
|
struct siop_common_cmd *siop_cmd;
|
2000-10-23 18:56:16 +04:00
|
|
|
int offset;
|
|
|
|
int ssync, soff;
|
|
|
|
{
|
2002-04-20 04:15:54 +04:00
|
|
|
siop_cmd->siop_tables->msg_out[offset + 0] = MSG_EXTENDED;
|
|
|
|
siop_cmd->siop_tables->msg_out[offset + 1] = MSG_EXT_SDTR_LEN;
|
|
|
|
siop_cmd->siop_tables->msg_out[offset + 2] = MSG_EXT_SDTR;
|
|
|
|
siop_cmd->siop_tables->msg_out[offset + 3] = ssync;
|
|
|
|
siop_cmd->siop_tables->msg_out[offset + 4] = soff;
|
|
|
|
siop_cmd->siop_tables->t_msgout.count =
|
2000-10-23 18:56:16 +04:00
|
|
|
htole32(offset + MSG_EXT_SDTR_LEN + 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
siop_wdtr_msg(siop_cmd, offset, wide)
|
2002-04-20 04:15:54 +04:00
|
|
|
struct siop_common_cmd *siop_cmd;
|
2000-10-23 18:56:16 +04:00
|
|
|
int offset;
|
|
|
|
{
|
2002-04-20 04:15:54 +04:00
|
|
|
siop_cmd->siop_tables->msg_out[offset + 0] = MSG_EXTENDED;
|
|
|
|
siop_cmd->siop_tables->msg_out[offset + 1] = MSG_EXT_WDTR_LEN;
|
|
|
|
siop_cmd->siop_tables->msg_out[offset + 2] = MSG_EXT_WDTR;
|
|
|
|
siop_cmd->siop_tables->msg_out[offset + 3] = wide;
|
|
|
|
siop_cmd->siop_tables->t_msgout.count =
|
2000-10-23 18:56:16 +04:00
|
|
|
htole32(offset + MSG_EXT_WDTR_LEN + 2);
|
|
|
|
}
|
|
|
|
|
2002-04-23 21:33:27 +04:00
|
|
|
void
|
|
|
|
siop_ppr_msg(siop_cmd, offset, ssync, soff)
|
|
|
|
struct siop_common_cmd *siop_cmd;
|
|
|
|
int offset;
|
|
|
|
int ssync, soff;
|
|
|
|
{
|
|
|
|
siop_cmd->siop_tables->msg_out[offset + 0] = MSG_EXTENDED;
|
|
|
|
siop_cmd->siop_tables->msg_out[offset + 1] = MSG_EXT_PPR_LEN;
|
|
|
|
siop_cmd->siop_tables->msg_out[offset + 2] = MSG_EXT_PPR;
|
|
|
|
siop_cmd->siop_tables->msg_out[offset + 3] = ssync;
|
|
|
|
siop_cmd->siop_tables->msg_out[offset + 4] = 0; /* reserved */
|
|
|
|
siop_cmd->siop_tables->msg_out[offset + 5] = soff;
|
|
|
|
siop_cmd->siop_tables->msg_out[offset + 6] = 1; /* wide */
|
|
|
|
siop_cmd->siop_tables->msg_out[offset + 7] = MSG_EXT_PPR_DT;
|
|
|
|
siop_cmd->siop_tables->t_msgout.count =
|
|
|
|
htole32(offset + MSG_EXT_PPR_LEN + 2);
|
|
|
|
}
|
|
|
|
|
2000-05-15 11:48:24 +04:00
|
|
|
void
|
|
|
|
siop_minphys(bp)
|
|
|
|
struct buf *bp;
|
|
|
|
{
|
|
|
|
minphys(bp);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-04-25 21:53:04 +04:00
|
|
|
siop_ioctl(chan, cmd, arg, flag, p)
|
|
|
|
struct scsipi_channel *chan;
|
2000-05-15 11:48:24 +04:00
|
|
|
u_long cmd;
|
|
|
|
caddr_t arg;
|
|
|
|
int flag;
|
|
|
|
struct proc *p;
|
|
|
|
{
|
2002-04-20 04:15:54 +04:00
|
|
|
struct siop_common_softc *sc = (void *)chan->chan_adapter->adapt_dev;
|
2000-05-15 11:48:24 +04:00
|
|
|
|
|
|
|
switch (cmd) {
|
|
|
|
case SCBUSIORESET:
|
2002-04-26 00:05:10 +04:00
|
|
|
/*
|
|
|
|
* abort the script. This will trigger an interrupt, which will
|
|
|
|
* trigger a bus reset.
|
|
|
|
* We can't safely trigger the reset here as we can't access
|
|
|
|
* the required register while the script is running.
|
|
|
|
*/
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_ISTAT, ISTAT_ABRT);
|
2000-05-15 11:48:24 +04:00
|
|
|
return (0);
|
|
|
|
default:
|
|
|
|
return (ENOTTY);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-05-17 22:37:02 +04:00
|
|
|
siop_ma(siop_cmd)
|
2002-04-20 04:15:54 +04:00
|
|
|
struct siop_common_cmd *siop_cmd;
|
2000-05-15 11:48:24 +04:00
|
|
|
{
|
|
|
|
int offset, dbc, sstat;
|
2002-04-20 04:15:54 +04:00
|
|
|
struct siop_common_softc *sc = siop_cmd->siop_sc;
|
2004-05-17 22:37:02 +04:00
|
|
|
scr_table_t *table; /* table with partial xfer */
|
2000-05-15 11:48:24 +04:00
|
|
|
|
2004-05-17 22:37:02 +04:00
|
|
|
/*
|
|
|
|
* compute how much of the current table didn't get handled when
|
|
|
|
* a phase mismatch occurs
|
|
|
|
*/
|
2000-05-15 11:48:24 +04:00
|
|
|
if ((siop_cmd->xs->xs_control & (XS_CTL_DATA_OUT | XS_CTL_DATA_IN))
|
|
|
|
== 0)
|
2004-05-17 22:37:02 +04:00
|
|
|
return; /* no valid data transfer */
|
|
|
|
|
2000-05-15 11:48:24 +04:00
|
|
|
offset = bus_space_read_1(sc->sc_rt, sc->sc_rh, SIOP_SCRATCHA + 1);
|
|
|
|
if (offset >= SIOP_NSG) {
|
|
|
|
printf("%s: bad offset in siop_sdp (%d)\n",
|
|
|
|
sc->sc_dev.dv_xname, offset);
|
|
|
|
return;
|
|
|
|
}
|
2002-04-20 04:15:54 +04:00
|
|
|
table = &siop_cmd->siop_tables->data[offset];
|
2000-05-15 11:48:24 +04:00
|
|
|
#ifdef DEBUG_DR
|
2004-05-17 22:37:02 +04:00
|
|
|
printf("siop_ma: offset %d count=%d addr=0x%x ", offset,
|
2000-05-15 11:48:24 +04:00
|
|
|
table->count, table->addr);
|
|
|
|
#endif
|
|
|
|
dbc = bus_space_read_4(sc->sc_rt, sc->sc_rh, SIOP_DBC) & 0x00ffffff;
|
|
|
|
if (siop_cmd->xs->xs_control & XS_CTL_DATA_OUT) {
|
2001-03-12 13:00:50 +03:00
|
|
|
if (sc->features & SF_CHIP_DFBC) {
|
|
|
|
dbc +=
|
|
|
|
bus_space_read_2(sc->sc_rt, sc->sc_rh, SIOP_DFBC);
|
2000-05-15 11:48:24 +04:00
|
|
|
} else {
|
2001-03-12 13:00:50 +03:00
|
|
|
/* need to account stale data in FIFO */
|
|
|
|
int dfifo =
|
|
|
|
bus_space_read_1(sc->sc_rt, sc->sc_rh, SIOP_DFIFO);
|
|
|
|
if (sc->features & SF_CHIP_FIFO) {
|
|
|
|
dfifo |= (bus_space_read_1(sc->sc_rt, sc->sc_rh,
|
|
|
|
SIOP_CTEST5) & CTEST5_BOMASK) << 8;
|
|
|
|
dbc += (dfifo - (dbc & 0x3ff)) & 0x3ff;
|
|
|
|
} else {
|
|
|
|
dbc += (dfifo - (dbc & 0x7f)) & 0x7f;
|
|
|
|
}
|
2000-05-15 11:48:24 +04:00
|
|
|
}
|
|
|
|
sstat = bus_space_read_1(sc->sc_rt, sc->sc_rh, SIOP_SSTAT0);
|
|
|
|
if (sstat & SSTAT0_OLF)
|
|
|
|
dbc++;
|
2001-03-12 13:00:50 +03:00
|
|
|
if ((sstat & SSTAT0_ORF) && (sc->features & SF_CHIP_DFBC) == 0)
|
2000-05-15 11:48:24 +04:00
|
|
|
dbc++;
|
2000-10-18 21:06:52 +04:00
|
|
|
if (siop_cmd->siop_target->flags & TARF_ISWIDE) {
|
2000-05-15 11:48:24 +04:00
|
|
|
sstat = bus_space_read_1(sc->sc_rt, sc->sc_rh,
|
|
|
|
SIOP_SSTAT2);
|
|
|
|
if (sstat & SSTAT2_OLF1)
|
|
|
|
dbc++;
|
2001-03-12 13:00:50 +03:00
|
|
|
if ((sstat & SSTAT2_ORF1) &&
|
|
|
|
(sc->features & SF_CHIP_DFBC) == 0)
|
2000-05-15 11:48:24 +04:00
|
|
|
dbc++;
|
|
|
|
}
|
|
|
|
/* clear the FIFO */
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_CTEST3,
|
|
|
|
bus_space_read_1(sc->sc_rt, sc->sc_rh, SIOP_CTEST3) |
|
|
|
|
CTEST3_CLF);
|
|
|
|
}
|
2004-05-17 22:37:02 +04:00
|
|
|
siop_cmd->flags |= CMDFL_RESID;
|
|
|
|
siop_cmd->resid = dbc;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
siop_sdp(siop_cmd, offset)
|
|
|
|
struct siop_common_cmd *siop_cmd;
|
|
|
|
int offset;
|
|
|
|
{
|
|
|
|
scr_table_t *table;
|
|
|
|
|
|
|
|
if ((siop_cmd->xs->xs_control & (XS_CTL_DATA_OUT | XS_CTL_DATA_IN))
|
|
|
|
== 0)
|
|
|
|
return; /* no data pointers to save */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* offset == SIOP_NSG may be a valid condition if we get a Save data
|
|
|
|
* pointer when the xfer is done. Just ignore the Save data pointer
|
|
|
|
* in this case
|
|
|
|
*/
|
|
|
|
if (offset == SIOP_NSG)
|
|
|
|
return;
|
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
if (offset > SIOP_NSG) {
|
|
|
|
scsipi_printaddr(siop_cmd->xs->xs_periph);
|
|
|
|
printf(": offset %d > %d\n", offset, SIOP_NSG);
|
|
|
|
panic("siop_sdp: offset");
|
|
|
|
}
|
2000-05-15 11:48:24 +04:00
|
|
|
#endif
|
2004-05-17 22:37:02 +04:00
|
|
|
/*
|
|
|
|
* Save data pointer. We do this by adjusting the tables to point
|
|
|
|
* at the begginning of the data not yet transfered.
|
|
|
|
* offset points to the first table with untransfered data.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* before doing that we decrease resid from the ammount of data which
|
|
|
|
* has been transfered.
|
|
|
|
*/
|
|
|
|
siop_update_resid(siop_cmd, offset);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* First let see if we have a resid from a phase mismatch. If so,
|
|
|
|
* we have to adjst the table at offset to remove transfered data.
|
|
|
|
*/
|
|
|
|
if (siop_cmd->flags & CMDFL_RESID) {
|
|
|
|
siop_cmd->flags &= ~CMDFL_RESID;
|
|
|
|
table = &siop_cmd->siop_tables->data[offset];
|
|
|
|
/* "cut" already transfered data from this table */
|
|
|
|
table->addr =
|
|
|
|
htole32(le32toh(table->addr) +
|
|
|
|
le32toh(table->count) - siop_cmd->resid);
|
|
|
|
table->count = htole32(siop_cmd->resid);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* now we can remove entries which have been transfered.
|
|
|
|
* We just move the entries with data left at the beggining of the
|
|
|
|
* tables
|
|
|
|
*/
|
|
|
|
memmove(&siop_cmd->siop_tables->data[0],
|
|
|
|
&siop_cmd->siop_tables->data[offset],
|
|
|
|
(SIOP_NSG - offset) * sizeof(scr_table_t));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
siop_update_resid(siop_cmd, offset)
|
|
|
|
struct siop_common_cmd *siop_cmd;
|
|
|
|
int offset;
|
|
|
|
{
|
|
|
|
scr_table_t *table;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if ((siop_cmd->xs->xs_control & (XS_CTL_DATA_OUT | XS_CTL_DATA_IN))
|
|
|
|
== 0)
|
|
|
|
return; /* no data to transfer */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* update resid. First account for the table entries which have
|
|
|
|
* been fully completed.
|
|
|
|
*/
|
|
|
|
for (i = 0; i < offset; i++)
|
|
|
|
siop_cmd->xs->resid -=
|
|
|
|
le32toh(siop_cmd->siop_tables->data[i].count);
|
|
|
|
/*
|
|
|
|
* if CMDFL_RESID is set, the last table (pointed by offset) is a
|
|
|
|
* partial transfers. If not, offset points to the entry folloing
|
|
|
|
* the last full transfer.
|
|
|
|
*/
|
|
|
|
if (siop_cmd->flags & CMDFL_RESID) {
|
|
|
|
table = &siop_cmd->siop_tables->data[offset];
|
|
|
|
siop_cmd->xs->resid -= le32toh(table->count) - siop_cmd->resid;
|
|
|
|
}
|
2000-05-15 11:48:24 +04:00
|
|
|
}
|
|
|
|
|
2004-05-18 00:12:34 +04:00
|
|
|
int
|
|
|
|
siop_iwr(siop_cmd)
|
|
|
|
struct siop_common_cmd *siop_cmd;
|
|
|
|
{
|
|
|
|
int offset;
|
|
|
|
scr_table_t *table; /* table with IWR */
|
|
|
|
struct siop_common_softc *sc = siop_cmd->siop_sc;
|
|
|
|
/* handle ignore wide residue messages */
|
|
|
|
|
|
|
|
/* if target isn't wide, reject */
|
|
|
|
if ((siop_cmd->siop_target->flags & TARF_ISWIDE) == 0) {
|
|
|
|
siop_cmd->siop_tables->t_msgout.count= htole32(1);
|
|
|
|
siop_cmd->siop_tables->msg_out[0] = MSG_MESSAGE_REJECT;
|
|
|
|
return SIOP_NEG_MSGOUT;
|
|
|
|
}
|
|
|
|
/* get index of current command in table */
|
|
|
|
offset = bus_space_read_1(sc->sc_rt, sc->sc_rh, SIOP_SCRATCHA + 1);
|
|
|
|
/*
|
|
|
|
* if the current table did complete, we're now pointing at the
|
|
|
|
* next one. Go back one if we didn't see a phase mismatch.
|
|
|
|
*/
|
|
|
|
if ((siop_cmd->flags & CMDFL_RESID) == 0)
|
|
|
|
offset--;
|
|
|
|
table = &siop_cmd->siop_tables->data[offset];
|
|
|
|
|
|
|
|
if ((siop_cmd->flags & CMDFL_RESID) == 0) {
|
|
|
|
if (le32toh(table->count) & 1) {
|
|
|
|
/* we really got the number of bytes we expected */
|
|
|
|
return SIOP_NEG_ACK;
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* now we really had a short xfer, by one byte.
|
|
|
|
* handle it just as if we had a phase mistmatch
|
|
|
|
* (there is a resid of one for this table).
|
|
|
|
* Update scratcha1 to reflect the fact that
|
|
|
|
* this xfer isn't complete.
|
|
|
|
*/
|
|
|
|
siop_cmd->flags |= CMDFL_RESID;
|
|
|
|
siop_cmd->resid = 1;
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh,
|
|
|
|
SIOP_SCRATCHA + 1, offset);
|
|
|
|
return SIOP_NEG_ACK;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* we already have a short xfer for this table; it's
|
|
|
|
* just one byte less than we though it was
|
|
|
|
*/
|
|
|
|
siop_cmd->resid--;
|
|
|
|
return SIOP_NEG_ACK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-05-15 11:48:24 +04:00
|
|
|
void
|
|
|
|
siop_clearfifo(sc)
|
2002-04-20 04:15:54 +04:00
|
|
|
struct siop_common_softc *sc;
|
2000-05-15 11:48:24 +04:00
|
|
|
{
|
|
|
|
int timeout = 0;
|
|
|
|
int ctest3 = bus_space_read_1(sc->sc_rt, sc->sc_rh, SIOP_CTEST3);
|
|
|
|
|
|
|
|
#ifdef DEBUG_INTR
|
|
|
|
printf("DMA fifo not empty !\n");
|
|
|
|
#endif
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_CTEST3,
|
|
|
|
ctest3 | CTEST3_CLF);
|
|
|
|
while ((bus_space_read_1(sc->sc_rt, sc->sc_rh, SIOP_CTEST3) &
|
|
|
|
CTEST3_CLF) != 0) {
|
|
|
|
delay(1);
|
|
|
|
if (++timeout > 1000) {
|
|
|
|
printf("clear fifo failed\n");
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_CTEST3,
|
|
|
|
bus_space_read_1(sc->sc_rt, sc->sc_rh,
|
|
|
|
SIOP_CTEST3) & ~CTEST3_CLF);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2000-06-13 00:13:41 +04:00
|
|
|
|
|
|
|
int
|
|
|
|
siop_modechange(sc)
|
2002-04-20 04:15:54 +04:00
|
|
|
struct siop_common_softc *sc;
|
2000-06-13 00:13:41 +04:00
|
|
|
{
|
|
|
|
int retry;
|
2002-05-04 22:43:22 +04:00
|
|
|
int sist0, sist1, stest2;
|
2000-06-13 00:13:41 +04:00
|
|
|
for (retry = 0; retry < 5; retry++) {
|
|
|
|
/*
|
|
|
|
* datasheet says to wait 100ms and re-read SIST1,
|
2001-04-25 21:53:04 +04:00
|
|
|
* to check that DIFFSENSE is stable.
|
2000-06-13 00:13:41 +04:00
|
|
|
* We may delay() 5 times for 100ms at interrupt time;
|
|
|
|
* hopefully this will not happen often.
|
|
|
|
*/
|
|
|
|
delay(100000);
|
|
|
|
sist0 = bus_space_read_1(sc->sc_rt, sc->sc_rh, SIOP_SIST0);
|
|
|
|
sist1 = bus_space_read_1(sc->sc_rt, sc->sc_rh, SIOP_SIST1);
|
|
|
|
if (sist1 & SIEN1_SBMC)
|
|
|
|
continue; /* we got an irq again */
|
2002-05-04 22:43:22 +04:00
|
|
|
sc->mode = bus_space_read_1(sc->sc_rt, sc->sc_rh, SIOP_STEST4) &
|
2000-06-13 00:13:41 +04:00
|
|
|
STEST4_MODE_MASK;
|
|
|
|
stest2 = bus_space_read_1(sc->sc_rt, sc->sc_rh, SIOP_STEST2);
|
2002-05-04 22:43:22 +04:00
|
|
|
switch(sc->mode) {
|
2000-06-13 00:13:41 +04:00
|
|
|
case STEST4_MODE_DIF:
|
|
|
|
printf("%s: switching to differential mode\n",
|
|
|
|
sc->sc_dev.dv_xname);
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_STEST2,
|
|
|
|
stest2 | STEST2_DIF);
|
|
|
|
break;
|
|
|
|
case STEST4_MODE_SE:
|
|
|
|
printf("%s: switching to single-ended mode\n",
|
|
|
|
sc->sc_dev.dv_xname);
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_STEST2,
|
|
|
|
stest2 & ~STEST2_DIF);
|
|
|
|
break;
|
|
|
|
case STEST4_MODE_LVD:
|
|
|
|
printf("%s: switching to LVD mode\n",
|
|
|
|
sc->sc_dev.dv_xname);
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_STEST2,
|
|
|
|
stest2 & ~STEST2_DIF);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
printf("%s: invalid SCSI mode 0x%x\n",
|
2002-05-04 22:43:22 +04:00
|
|
|
sc->sc_dev.dv_xname, sc->mode);
|
2000-06-13 00:13:41 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
printf("%s: timeout waiting for DIFFSENSE to stabilise\n",
|
|
|
|
sc->sc_dev.dv_xname);
|
|
|
|
return 0;
|
|
|
|
}
|
2000-07-24 19:15:00 +04:00
|
|
|
|
|
|
|
void
|
|
|
|
siop_resetbus(sc)
|
2002-04-20 04:15:54 +04:00
|
|
|
struct siop_common_softc *sc;
|
2000-07-24 19:15:00 +04:00
|
|
|
{
|
|
|
|
int scntl1;
|
|
|
|
scntl1 = bus_space_read_1(sc->sc_rt, sc->sc_rh, SIOP_SCNTL1);
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_SCNTL1,
|
|
|
|
scntl1 | SCNTL1_RST);
|
|
|
|
/* minimum 25 us, more time won't hurt */
|
|
|
|
delay(100);
|
|
|
|
bus_space_write_1(sc->sc_rt, sc->sc_rh, SIOP_SCNTL1, scntl1);
|
|
|
|
}
|
2002-04-20 04:15:54 +04:00
|
|
|
|
|
|
|
void
|
|
|
|
siop_update_xfer_mode(sc, target)
|
|
|
|
struct siop_common_softc *sc;
|
|
|
|
int target;
|
|
|
|
{
|
|
|
|
struct siop_common_target *siop_target = sc->targets[target];
|
|
|
|
struct scsipi_xfer_mode xm;
|
|
|
|
|
|
|
|
xm.xm_target = target;
|
|
|
|
xm.xm_mode = 0;
|
|
|
|
xm.xm_period = 0;
|
|
|
|
xm.xm_offset = 0;
|
|
|
|
|
2002-05-04 22:11:06 +04:00
|
|
|
|
2002-04-20 04:15:54 +04:00
|
|
|
if (siop_target->flags & TARF_ISWIDE)
|
|
|
|
xm.xm_mode |= PERIPH_CAP_WIDE16;
|
|
|
|
if (siop_target->period) {
|
|
|
|
xm.xm_period = siop_target->period;
|
|
|
|
xm.xm_offset = siop_target->offset;
|
|
|
|
xm.xm_mode |= PERIPH_CAP_SYNC;
|
|
|
|
}
|
2002-05-05 19:23:22 +04:00
|
|
|
if (siop_target->flags & TARF_TAG) {
|
|
|
|
/* 1010 workaround: can't do disconnect if not wide, so can't do tag */
|
|
|
|
if ((sc->features & SF_CHIP_GEBUG) == 0 ||
|
|
|
|
(sc->targets[target]->flags & TARF_ISWIDE))
|
|
|
|
xm.xm_mode |= PERIPH_CAP_TQING;
|
|
|
|
}
|
|
|
|
|
2002-04-20 04:15:54 +04:00
|
|
|
scsipi_async_event(&sc->sc_chan, ASYNC_EVENT_XFER_MODE, &xm);
|
|
|
|
}
|