diff --git a/sys/dev/aic7xxx/aic7xxx.seq b/sys/dev/aic7xxx/aic7xxx.seq index 5ebb435a58f0..76d57f1054aa 100644 --- a/sys/dev/aic7xxx/aic7xxx.seq +++ b/sys/dev/aic7xxx/aic7xxx.seq @@ -39,7 +39,7 @@ * *-M************************************************************************/ -VERSION AIC7XXX_SEQ_VER "$Id: aic7xxx.seq,v 1.46 1996/10/28 17:00:24 gibbs Exp $" +VERSION AIC7XXX_SEQ_VER "$Id: aic7xxx.seq,v 1.47 1996/11/05 07:51:29 gibbs Exp $" #if defined(__NetBSD__) #include "../../../../dev/ic/aic7xxxreg.h" @@ -127,7 +127,7 @@ test_queue: * and get to work on it. */ test FLAGS, PAGESCBS jz dequeue_scb - call get_free_or_disc_scb + mov ALLZEROS call get_free_or_disc_scb cmp SINDEX, SCB_LIST_NULL je poll_for_work dequeue_scb: mov CUR_SCBID,QINFIFO @@ -534,14 +534,13 @@ p_mesgout_start: * a MESSAGE REJECT. */ p_mesgout_loop: - test SSTAT1,PHASEMIS jnz p_mesgout_phasemis - test SSTAT0,SPIORDY jz p_mesgout_loop + test SSTAT1,REQINIT jz p_mesgout_loop test SSTAT1,PHASEMIS jnz p_mesgout_phasemis cmp DINDEX,1 jne p_mesgout_outb /* last byte? */ mvi CLRSINT1,CLRATNO /* drop ATN */ p_mesgout_outb: dec DINDEX - or CLRSINT0, CLRSPIORDY + or CLRSINT1, CLRREQINIT mov SCSIDATL,SINDIR p_mesgout4: @@ -588,7 +587,6 @@ rej_mesgin: * and hope for the best. In any case, rejection should be a rare * occurrence - signal the driver when it happens. */ - or SCSISIGO,ATNO /* turn on ATNO */ mvi INTSTAT,SEND_REJECT /* let driver know */ mvi MSG_MESSAGE_REJECT call mk_mesg @@ -656,6 +654,12 @@ test_immediate: mvi INTSTAT,IMMEDDONE jmp dma_next_scb complete: + test FLAGS, PAGESCBS jz complete_post + mov A, QFULLCNT +complete_poll: + cmp QOUTQCNT, A je complete_poll + inc QOUTQCNT +complete_post: /* Post the SCB and issue an interrupt */ mov QOUTFIFO,SCB_TAG mvi INTSTAT,CMDCMPLT @@ -812,7 +816,6 @@ index_by_tag: not_found: mvi INTSTAT, NO_MATCH send_abort_msg: - or SCSISIGO,ATNO /* turn on ATNO */ test FLAGS, TAGGED_SCB jnz abort_tag_msg mvi MSG_ABORT call mk_mesg jmp mesgin_done @@ -876,6 +879,7 @@ mk_mesg: mvi INTSTAT,MSG_BUFFER_BUSY mk_mesg1: + or SCSISIGO,ATNO /* turn on ATNO */ mvi MSG_LEN,1 /* length = 1 */ mov MSG0,SINDEX /* 1-byte message */ mvi SEQCTL,0x10 ret /* !PAUSEDIS|FASTMODE */ @@ -897,16 +901,16 @@ mk_mesg1: */ inb_next: - or CLRSINT0, CLRSPIORDY + or CLRSINT1, CLRREQINIT mov NONE,SCSIDATL /*dummy read from latch to ACK*/ inb_next_wait: - test SSTAT1,PHASEMIS jnz mesgin_phasemis - test SSTAT0,SPIORDY jz inb_next_wait /* wait for next byte */ + test SSTAT1,REQINIT jz inb_next_wait /* wait for next byte */ inb_first: - mov DINDEX,SINDEX test SSTAT1,PHASEMIS jnz mesgin_phasemis + mov DINDEX,SINDEX mov DINDIR,SCSIBUSL ret /*read byte directly from bus*/ inb_last: + or CLRSINT1, CLRREQINIT mov NONE,SCSIDATL ret /*dummy read from latch to ACK*/ mesgin_phasemis: @@ -997,7 +1001,7 @@ findSCB1: * abort flag set, return not found. */ test FLAGS, PAGESCBS jz find_error - call get_free_or_disc_scb + mov ALLZEROS call get_free_or_disc_scb cmp ARG_1, SCB_LIST_NULL jne find_dma_scb mov SAVED_TCL call index_untagged_scb mov ARG_1, SINDIR /* SCBID of SCB to fetch */ @@ -1129,17 +1133,12 @@ index_untagged_scb2: get_free_or_disc_scb: - mov SINDEX, ALLZEROS - cmp FREE_SCBH, SCB_LIST_NULL jne get_free_scb - cmp DISCONNECTED_SCBH, SCB_LIST_NULL je return_error - mov SCBPTR, DISCONNECTED_SCBH -/* - * If we are starting a new transaction, we have to ensure that - * there is at least one SCB left in case a reselection wins out. - */ - test FLAGS, RESELECTED jnz dequeue_disc_scb - cmp SCB_NEXT, SCB_LIST_NULL je return_error + cmp FREE_SCBH, SCB_LIST_NULL jne dequeue_free_scb + cmp DISCONNECTED_SCBH, SCB_LIST_NULL jne dequeue_disc_scb +return_error: + mvi SINDEX, SCB_LIST_NULL ret dequeue_disc_scb: + mov SCBPTR, DISCONNECTED_SCBH /* * If we have a residual, then we are in the middle of some I/O * and we have to send this SCB back up to the kernel so that the @@ -1149,21 +1148,11 @@ dequeue_disc_scb: mvi DMAPARAMS, 0x9 /* HDMAEN | FIFORESET*/ mov SCB_TAG call dma_scb unlink_disc_scb: - call rem_scb_from_disc_list - ret -get_free_scb: -/* - * If we are starting a new transaction, we have to ensure that - * there is at least one SCB left in case a reselection wins out. - */ - test FLAGS, RESELECTED jnz dequeue_free_scb - cmp SCB_NEXT, SCB_LIST_NULL jne dequeue_free_scb - cmp DISCONNECTED_SCBH, SCB_LIST_NULL je return_error + /* jmp instead of call since we want to return anyway */ + mov SCBPTR jmp rem_scb_from_disc_list dequeue_free_scb: mov SCBPTR, FREE_SCBH mov FREE_SCBH, SCB_NEXT ret -return_error: - mvi SINDEX, SCB_LIST_NULL ret add_scb_to_free_list: mov SCB_NEXT, FREE_SCBH diff --git a/sys/dev/aic7xxx/aic7xxx_reg.h b/sys/dev/aic7xxx/aic7xxx_reg.h index cd91c9ef0927..bb039897bf2e 100644 --- a/sys/dev/aic7xxx/aic7xxx_reg.h +++ b/sys/dev/aic7xxx/aic7xxx_reg.h @@ -28,7 +28,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: aic7xxx_reg.h,v 1.14 1996/10/25 06:34:59 gibbs Exp $ + * $Id: aic7xxx_reg.h,v 1.15 1996/10/28 06:01:08 gibbs Exp $ */ /* @@ -653,7 +653,11 @@ * we can see what is getting thrown away. */ #define REJBYTE 0x030 -#define TARGID_MASK 0x031 +/* + * Since the sequencer cannot read QOUTCNT, we use this memory location + * to make sure that we don't overflow the QOUTFIFO when doing SCB Paging. + */ +#define QOUTQCNT 0x031 /* * Bit vector of targets that have disconnection disabled.