From 3ebcec3e2872165a52081abc984ad365b52687ed Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Sun, 10 Sep 2000 01:11:53 +0000 Subject: Pull in two asc fixes from NetBSD, makes pmax port on DS5000/200 alive again --- sys/dev/tc/asc.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'sys') diff --git a/sys/dev/tc/asc.c b/sys/dev/tc/asc.c index 57f88ebc608..863abac8f8e 100644 --- a/sys/dev/tc/asc.c +++ b/sys/dev/tc/asc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asc.c,v 1.14 1998/05/18 00:25:06 millert Exp $ */ +/* $OpenBSD: asc.c,v 1.15 2000/09/10 01:11:52 miod Exp $ */ /* $NetBSD: asc.c,v 1.46 1998/05/08 15:39:01 mhitch Exp $ */ /*- @@ -754,10 +754,6 @@ asc_startcmd(asc, target) asc_logp = asc_log; #endif - /* preload the FIFO with the message to be sent */ - regs->asc_fifo = SCSI_DIS_REC_IDENTIFY; - tc_mb(); - /* initialize the DMA */ len = (*asc->dma_start)(asc, state, scsicmd->cmd, ASCDMA_WRITE, len, 0); @@ -778,6 +774,10 @@ asc_startcmd(asc, target) return; } + /* preload the FIFO with the message to be sent */ + regs->asc_fifo = SCSI_DIS_REC_IDENTIFY; + tc_mb(); + if (state->flags & TRY_SYNC) regs->asc_cmd = len = ASC_CMD_SEL_ATN_STOP; else @@ -903,25 +903,25 @@ again: state = &asc->st[asc->target]; switch (ASC_PHASE(status)) { case SCSI_PHASE_DATAI: - if ((asc->script - asc_scripts) == SCRIPT_DATA_IN + 1 || - (asc->script - asc_scripts) == SCRIPT_CONTINUE_IN) { - /* + case SCSI_PHASE_DATAO: + ASC_TC_GET(regs, len); + fifo = regs->asc_flags & ASC_FLAGS_FIFO_CNT; + if (len != 0 && ( + (asc->script - asc_scripts) == SCRIPT_DATA_IN + 1 || + (asc->script - asc_scripts) == SCRIPT_CONTINUE_IN || + (asc->script - asc_scripts) == SCRIPT_DATA_OUT + 1 || + (asc->script - asc_scripts) == SCRIPT_CONTINUE_OUT)) { /* * From the Mach driver: - * After a reconnect and restart dma in, we + * After a reconnect and restart dma in/out, we * seem to have gotten an interrupt even though * the DMA is running. The Mach driver just * ignores this interrupt. */ - ASC_TC_GET(regs, len); - fifo = regs->asc_flags & ASC_FLAGS_FIFO_CNT; printf("asc_intr: ignoring strange interrupt"); - printf(" tc %d fifo residue %d\n", len, fifo); + printf(" tc %d fifo residue %d script %d\n", + len, fifo, asc->script - asc_scripts); goto done; } - /* FALLTHROUGH */ - case SCSI_PHASE_DATAO: - ASC_TC_GET(regs, len); - fifo = regs->asc_flags & ASC_FLAGS_FIFO_CNT; printf("asc_intr: data overrun: buflen %d dmalen %d tc %d fifo %d\n", state->buflen, state->dmalen, len, fifo); goto abort; -- cgit v1.2.3