From c2c5fd345dc80a24eac76d6faff685d80cb17085 Mon Sep 17 00:00:00 2001 From: "Justin T. Gibbs" Date: Sun, 31 Mar 1996 03:02:37 +0000 Subject: [PATCH] aic7xxx.seq: Fix support for the aic7850 by looking only at the relavent bits of the QINCNT. The 7850 puts random garbage in the high bits and all my attempts to determine the cause of this failed. This approach does seem to work around the problem. Don't trust SCSIPERR to tell us when there is a parity error. On some revs of the 7870 and the 7880, this bit follows the parity of the current byte. Instead of using a SEQINT to tell the kernel, re-enable the standard parity error interrupt since it seems to pause the sequencer right at the time of the error which is the effect we were looking for anyway. aic7xxx_reg.h: Remove PARITY_ERROR seqeuncer interrupt type, its no longer used. Define QCOUNTMASK as the SRAM location for the mask to use on the QINCNT register. QCOUNTMASK is determined by the number of SCBs supported by the device we're working on. aic7xxx_asm.c Properly check the return value of fopen, and define the arg list in getopt correctly. Submitted by: Pete Bentley --- sys/dev/aic7xxx/aic7xxx.seq | 14 +++----------- sys/dev/aic7xxx/aic7xxx_asm.c | 8 ++++---- sys/dev/aic7xxx/aic7xxx_reg.h | 14 ++++++-------- sys/dev/aic7xxx/aicasm.c | 8 ++++---- sys/dev/aic7xxx/aicasm/aicasm.c | 8 ++++---- 5 files changed, 21 insertions(+), 31 deletions(-) diff --git a/sys/dev/aic7xxx/aic7xxx.seq b/sys/dev/aic7xxx/aic7xxx.seq index 8a7f5590b37..7f5d8b4cb8f 100644 --- a/sys/dev/aic7xxx/aic7xxx.seq +++ b/sys/dev/aic7xxx/aic7xxx.seq @@ -41,7 +41,7 @@ * *-M************************************************************************/ -VERSION AIC7XXX_SEQ_VER "$Id: aic7xxx.seq,v 1.30 1996/01/29 03:12:02 gibbs Exp $" +VERSION AIC7XXX_SEQ_VER "$Id: aic7xxx.seq,v 1.31 1996/03/10 07:02:31 gibbs Exp $" #include "../../dev/aic7xxx/aic7xxx_reg.h" @@ -94,7 +94,8 @@ poll_for_work: start2: test SSTAT0,SELDI jnz reselect cmp WAITING_SCBH,SCB_LIST_NULL jne start_waiting - test QINCNT,0xff jz poll_for_work + mov A, QCNTMASK + test QINCNT,A jz poll_for_work /* * We have at least one queued SCB now and we don't have any @@ -273,15 +274,6 @@ ITloop: test SSTAT1,BUSFREE jnz p_busfree test SSTAT1,REQINIT jz ITloop -/* - * If we've had a parity error, let the driver know before - * we overwrite LASTPHASE. - */ - test SSTAT1, SCSIPERR jz parity_okay - or CLRSINT1, CLRSCSIPERR - mvi INTSTAT, PARITY_ERROR - -parity_okay: and A,PHASE_MASK,SCSISIGI mov LASTPHASE,A mov SCSISIGO,A diff --git a/sys/dev/aic7xxx/aic7xxx_asm.c b/sys/dev/aic7xxx/aic7xxx_asm.c index 402b33760e5..cd1330e9d3b 100644 --- a/sys/dev/aic7xxx/aic7xxx_asm.c +++ b/sys/dev/aic7xxx/aic7xxx_asm.c @@ -43,7 +43,7 @@ * are token separators. * *-M*************************************************************************/ -static char id[] = "$Id: aic7xxx_asm.c,v 1.10 1996/01/03 06:25:31 gibbs Exp $"; +static char id[] = "$Id: aic7xxx_asm.c,v 1.11 1996/01/05 01:48:07 gibbs Exp $"; #include #include #include @@ -585,7 +585,7 @@ main(int argc, char **argv) int fd[2]; ofile = NULL; - while ((c = getopt(argc, argv, "dho:vD")) != EOF) { + while ((c = getopt(argc, argv, "dho:vD:")) != EOF) { switch (c) { case 'd': debug = !0; @@ -603,7 +603,7 @@ main(int argc, char **argv) } case 'o': - if ((ofile = fopen(optarg, "w")) < 0) { + if ((ofile = fopen(optarg, "w")) == NULL) { perror(optarg); exit(EXIT_FAILURE); } @@ -636,7 +636,7 @@ main(int argc, char **argv) } if (!ofile) { - if ((ofile = fopen(ADOTOUT, "w")) < 0) { + if ((ofile = fopen(ADOTOUT, "w")) == NULL) { perror(ADOTOUT); exit(EXIT_FAILURE); } diff --git a/sys/dev/aic7xxx/aic7xxx_reg.h b/sys/dev/aic7xxx/aic7xxx_reg.h index 4c421c59869..f45e4093114 100644 --- a/sys/dev/aic7xxx/aic7xxx_reg.h +++ b/sys/dev/aic7xxx/aic7xxx_reg.h @@ -18,7 +18,7 @@ * 4. Modifications may be freely made to this file if the above conditions * are met. * - * $Id: aic7xxx_reg.h,v 1.5 1996/01/29 03:12:06 gibbs Exp $ + * $Id: aic7xxx_reg.h,v 1.6 1996/03/10 07:02:32 gibbs Exp $ */ /* @@ -424,10 +424,6 @@ * when we were expecting * another msgin byte. */ -#define PARITY_ERROR 0xe1 /* - * Sequencer detected a parity - * error. - */ #define BRKADRINT 0x08 #define SCSIINT 0x04 #define CMDCMPLT 0x02 @@ -705,9 +701,11 @@ * head of list of SCBs awaiting * selection */ -#define WAITING_SCBT 0x058 /* - * tail of list of SCBs awaiting - * selection +#define QCNTMASK 0x058 /* + * Mask of bits to test against + * when looking at the Queue Count + * registers. Works around a bug + * on aic7850 chips. */ #define COMP_SCBCOUNT 0x059 #define SCB_LIST_NULL 0xff diff --git a/sys/dev/aic7xxx/aicasm.c b/sys/dev/aic7xxx/aicasm.c index 402b33760e5..cd1330e9d3b 100644 --- a/sys/dev/aic7xxx/aicasm.c +++ b/sys/dev/aic7xxx/aicasm.c @@ -43,7 +43,7 @@ * are token separators. * *-M*************************************************************************/ -static char id[] = "$Id: aic7xxx_asm.c,v 1.10 1996/01/03 06:25:31 gibbs Exp $"; +static char id[] = "$Id: aic7xxx_asm.c,v 1.11 1996/01/05 01:48:07 gibbs Exp $"; #include #include #include @@ -585,7 +585,7 @@ main(int argc, char **argv) int fd[2]; ofile = NULL; - while ((c = getopt(argc, argv, "dho:vD")) != EOF) { + while ((c = getopt(argc, argv, "dho:vD:")) != EOF) { switch (c) { case 'd': debug = !0; @@ -603,7 +603,7 @@ main(int argc, char **argv) } case 'o': - if ((ofile = fopen(optarg, "w")) < 0) { + if ((ofile = fopen(optarg, "w")) == NULL) { perror(optarg); exit(EXIT_FAILURE); } @@ -636,7 +636,7 @@ main(int argc, char **argv) } if (!ofile) { - if ((ofile = fopen(ADOTOUT, "w")) < 0) { + if ((ofile = fopen(ADOTOUT, "w")) == NULL) { perror(ADOTOUT); exit(EXIT_FAILURE); } diff --git a/sys/dev/aic7xxx/aicasm/aicasm.c b/sys/dev/aic7xxx/aicasm/aicasm.c index 402b33760e5..cd1330e9d3b 100644 --- a/sys/dev/aic7xxx/aicasm/aicasm.c +++ b/sys/dev/aic7xxx/aicasm/aicasm.c @@ -43,7 +43,7 @@ * are token separators. * *-M*************************************************************************/ -static char id[] = "$Id: aic7xxx_asm.c,v 1.10 1996/01/03 06:25:31 gibbs Exp $"; +static char id[] = "$Id: aic7xxx_asm.c,v 1.11 1996/01/05 01:48:07 gibbs Exp $"; #include #include #include @@ -585,7 +585,7 @@ main(int argc, char **argv) int fd[2]; ofile = NULL; - while ((c = getopt(argc, argv, "dho:vD")) != EOF) { + while ((c = getopt(argc, argv, "dho:vD:")) != EOF) { switch (c) { case 'd': debug = !0; @@ -603,7 +603,7 @@ main(int argc, char **argv) } case 'o': - if ((ofile = fopen(optarg, "w")) < 0) { + if ((ofile = fopen(optarg, "w")) == NULL) { perror(optarg); exit(EXIT_FAILURE); } @@ -636,7 +636,7 @@ main(int argc, char **argv) } if (!ofile) { - if ((ofile = fopen(ADOTOUT, "w")) < 0) { + if ((ofile = fopen(ADOTOUT, "w")) == NULL) { perror(ADOTOUT); exit(EXIT_FAILURE); }