new asc.c from Ralph Campbell

This commit is contained in:
dean 1994-11-28 19:05:54 +00:00
parent 820aec410e
commit fcf0991366
2 changed files with 102 additions and 18 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: asc.c,v 1.7 1994/11/15 18:59:40 dean Exp $ */
/* $NetBSD: asc.c,v 1.8 1994/11/28 19:05:54 dean Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -35,7 +35,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)asc.c 8.2 (Berkeley) 1/4/94
* @(#)asc.c 8.3 (Berkeley) 7/3/94
*/
/*
@ -66,7 +66,7 @@
/*
* HISTORY
* Log: scsi_53C94_hdw.c,v
* Log: scsi_53C94_hdw.c,v
* Revision 2.5 91/02/05 17:45:07 mrt
* Added author notices
* [91/02/04 11:18:43 mrt]
@ -904,6 +904,7 @@ again:
/* save number of bytes still to be sent or received */
state->dmaresid = len;
state->flags &= ~DMA_IN_PROGRESS;
ASC_TC_PUT(regs, 0);
#ifdef DEBUG
if (asc_logp == asc_log)
asc_log[NLOG - 1].resid = len;
@ -934,9 +935,11 @@ again:
else
state->script = asc->script;
} else if (state->flags & DMA_IN) {
if (len)
printf("asc_intr: 1: len %d (fifo %d)\n", len,
fifo); /* XXX */
if (len) {
printf("asc_intr: 1: bn %d len %d (fifo %d)\n",
asc_debug_bn, len, fifo); /* XXX */
goto abort;
}
/* setup state to resume to */
if (state->flags & DMA_IN_PROGRESS) {
len = state->dmalen;
@ -954,9 +957,11 @@ again:
state->script =
&asc_scripts[SCRIPT_RESUME_NO_DATA];
} else if (state->flags & DMA_OUT) {
if (len)
if (len) {
printf("asc_intr: 2: len %d (fifo %d)\n", len,
fifo); /* XXX */
goto abort;
}
/*
* If this is the last chunk, the next expected
* state is to get status.
@ -1111,7 +1116,7 @@ abort:
#if 0
panic("asc_intr");
#else
for (;;);
boot(4); /* XXX */
#endif
}
@ -1142,7 +1147,8 @@ asc_get_status(asc, status, ss, ir)
* Get the last two bytes in the FIFO.
*/
if ((data = regs->asc_flags & ASC_FLAGS_FIFO_CNT) != 2) {
printf("asc_get_status: fifo cnt %d\n", data); /* XXX */
printf("asc_get_status: cmdreg %x, fifo cnt %d\n",
regs->asc_cmd, data); /* XXX */
#ifdef DEBUG
asc_DumpLog("get_status"); /* XXX */
#endif
@ -1264,6 +1270,12 @@ asc_dma_in(asc, status, ss, ir)
/* setup to start reading the next chunk */
len = state->buflen;
#ifdef DEBUG
if (asc_logp == asc_log)
asc_log[NLOG - 1].resid = len;
else
asc_logp[-1].resid = len;
#endif
if (len > state->dmaBufSize)
len = state->dmaBufSize;
state->dmalen = len;
@ -1329,6 +1341,12 @@ asc_resume_in(asc, status, ss, ir)
/* setup to start reading the next chunk */
len = state->buflen;
#ifdef DEBUG
if (asc_logp == asc_log)
asc_log[NLOG - 1].resid = len;
else
asc_logp[-1].resid = len;
#endif
if (len > state->dmaBufSize)
len = state->dmaBufSize;
state->dmalen = len;
@ -1369,6 +1387,12 @@ asc_resume_dma_in(asc, status, ss, ir)
state->dmalen, len, off); /* XXX */
regs->asc_res_fifo = state->dmaBufAddr[off];
}
#ifdef DEBUG
if (asc_logp == asc_log)
asc_log[NLOG - 1].resid = len;
else
asc_logp[-1].resid = len;
#endif
(*asc->dma_start)(asc, state, state->dmaBufAddr + off, ASCDMA_READ);
ASC_TC_PUT(regs, len);
#ifdef DEBUG
@ -1413,6 +1437,12 @@ asc_dma_out(asc, status, ss, ir)
/* setup for this chunk */
len = state->buflen;
#ifdef DEBUG
if (asc_logp == asc_log)
asc_log[NLOG - 1].resid = len;
else
asc_logp[-1].resid = len;
#endif
if (len > state->dmaBufSize)
len = state->dmaBufSize;
state->dmalen = len;
@ -1477,6 +1507,12 @@ asc_resume_out(asc, status, ss, ir)
/* setup for this chunk */
len = state->buflen;
#ifdef DEBUG
if (asc_logp == asc_log)
asc_log[NLOG - 1].resid = len;
else
asc_logp[-1].resid = len;
#endif
if (len > state->dmaBufSize)
len = state->dmaBufSize;
state->dmalen = len;
@ -1520,6 +1556,12 @@ asc_resume_dma_out(asc, status, ss, ir)
off++;
len--;
}
#ifdef DEBUG
if (asc_logp == asc_log)
asc_log[NLOG - 1].resid = len;
else
asc_logp[-1].resid = len;
#endif
(*asc->dma_start)(asc, state, state->dmaBufAddr + off, ASCDMA_WRITE);
ASC_TC_PUT(regs, len);
#ifdef DEBUG

View File

@ -1,4 +1,4 @@
/* $NetBSD: asc.c,v 1.7 1994/11/15 18:59:40 dean Exp $ */
/* $NetBSD: asc.c,v 1.8 1994/11/28 19:05:54 dean Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -35,7 +35,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)asc.c 8.2 (Berkeley) 1/4/94
* @(#)asc.c 8.3 (Berkeley) 7/3/94
*/
/*
@ -66,7 +66,7 @@
/*
* HISTORY
* Log: scsi_53C94_hdw.c,v
* Log: scsi_53C94_hdw.c,v
* Revision 2.5 91/02/05 17:45:07 mrt
* Added author notices
* [91/02/04 11:18:43 mrt]
@ -904,6 +904,7 @@ again:
/* save number of bytes still to be sent or received */
state->dmaresid = len;
state->flags &= ~DMA_IN_PROGRESS;
ASC_TC_PUT(regs, 0);
#ifdef DEBUG
if (asc_logp == asc_log)
asc_log[NLOG - 1].resid = len;
@ -934,9 +935,11 @@ again:
else
state->script = asc->script;
} else if (state->flags & DMA_IN) {
if (len)
printf("asc_intr: 1: len %d (fifo %d)\n", len,
fifo); /* XXX */
if (len) {
printf("asc_intr: 1: bn %d len %d (fifo %d)\n",
asc_debug_bn, len, fifo); /* XXX */
goto abort;
}
/* setup state to resume to */
if (state->flags & DMA_IN_PROGRESS) {
len = state->dmalen;
@ -954,9 +957,11 @@ again:
state->script =
&asc_scripts[SCRIPT_RESUME_NO_DATA];
} else if (state->flags & DMA_OUT) {
if (len)
if (len) {
printf("asc_intr: 2: len %d (fifo %d)\n", len,
fifo); /* XXX */
goto abort;
}
/*
* If this is the last chunk, the next expected
* state is to get status.
@ -1111,7 +1116,7 @@ abort:
#if 0
panic("asc_intr");
#else
for (;;);
boot(4); /* XXX */
#endif
}
@ -1142,7 +1147,8 @@ asc_get_status(asc, status, ss, ir)
* Get the last two bytes in the FIFO.
*/
if ((data = regs->asc_flags & ASC_FLAGS_FIFO_CNT) != 2) {
printf("asc_get_status: fifo cnt %d\n", data); /* XXX */
printf("asc_get_status: cmdreg %x, fifo cnt %d\n",
regs->asc_cmd, data); /* XXX */
#ifdef DEBUG
asc_DumpLog("get_status"); /* XXX */
#endif
@ -1264,6 +1270,12 @@ asc_dma_in(asc, status, ss, ir)
/* setup to start reading the next chunk */
len = state->buflen;
#ifdef DEBUG
if (asc_logp == asc_log)
asc_log[NLOG - 1].resid = len;
else
asc_logp[-1].resid = len;
#endif
if (len > state->dmaBufSize)
len = state->dmaBufSize;
state->dmalen = len;
@ -1329,6 +1341,12 @@ asc_resume_in(asc, status, ss, ir)
/* setup to start reading the next chunk */
len = state->buflen;
#ifdef DEBUG
if (asc_logp == asc_log)
asc_log[NLOG - 1].resid = len;
else
asc_logp[-1].resid = len;
#endif
if (len > state->dmaBufSize)
len = state->dmaBufSize;
state->dmalen = len;
@ -1369,6 +1387,12 @@ asc_resume_dma_in(asc, status, ss, ir)
state->dmalen, len, off); /* XXX */
regs->asc_res_fifo = state->dmaBufAddr[off];
}
#ifdef DEBUG
if (asc_logp == asc_log)
asc_log[NLOG - 1].resid = len;
else
asc_logp[-1].resid = len;
#endif
(*asc->dma_start)(asc, state, state->dmaBufAddr + off, ASCDMA_READ);
ASC_TC_PUT(regs, len);
#ifdef DEBUG
@ -1413,6 +1437,12 @@ asc_dma_out(asc, status, ss, ir)
/* setup for this chunk */
len = state->buflen;
#ifdef DEBUG
if (asc_logp == asc_log)
asc_log[NLOG - 1].resid = len;
else
asc_logp[-1].resid = len;
#endif
if (len > state->dmaBufSize)
len = state->dmaBufSize;
state->dmalen = len;
@ -1477,6 +1507,12 @@ asc_resume_out(asc, status, ss, ir)
/* setup for this chunk */
len = state->buflen;
#ifdef DEBUG
if (asc_logp == asc_log)
asc_log[NLOG - 1].resid = len;
else
asc_logp[-1].resid = len;
#endif
if (len > state->dmaBufSize)
len = state->dmaBufSize;
state->dmalen = len;
@ -1520,6 +1556,12 @@ asc_resume_dma_out(asc, status, ss, ir)
off++;
len--;
}
#ifdef DEBUG
if (asc_logp == asc_log)
asc_log[NLOG - 1].resid = len;
else
asc_logp[-1].resid = len;
#endif
(*asc->dma_start)(asc, state, state->dmaBufAddr + off, ASCDMA_WRITE);
ASC_TC_PUT(regs, len);
#ifdef DEBUG