Deleted Added
full compact
aic79xx.seq (116937) aic79xx.seq (123579)
1/*
2 * Adaptec U320 device driver firmware for Linux and FreeBSD.
3 *
4 * Copyright (c) 1994-2001 Justin T. Gibbs.
5 * Copyright (c) 2000-2002 Adaptec Inc.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 23 unchanged lines hidden (view full) ---

32 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
36 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
37 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 * POSSIBILITY OF SUCH DAMAGES.
39 *
1/*
2 * Adaptec U320 device driver firmware for Linux and FreeBSD.
3 *
4 * Copyright (c) 1994-2001 Justin T. Gibbs.
5 * Copyright (c) 2000-2002 Adaptec Inc.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 23 unchanged lines hidden (view full) ---

32 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
36 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
37 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 * POSSIBILITY OF SUCH DAMAGES.
39 *
40 * $FreeBSD: head/sys/dev/aic7xxx/aic79xx.seq 116937 2003-06-28 04:44:10Z gibbs $
40 * $FreeBSD: head/sys/dev/aic7xxx/aic79xx.seq 123579 2003-12-17 00:02:10Z gibbs $
41 */
42
41 */
42
43VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#96 $"
43VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#107 $"
44PATCH_ARG_LIST = "struct ahd_softc *ahd"
45PREFIX = "ahd_"
46
47#include "aic79xx.reg"
48#include "scsi_message.h"
49
50restart:
51if ((ahd->bugs & AHD_INTCOLLISION_BUG) != 0) {

--- 33 unchanged lines hidden (view full) ---

85 test SSTAT0, SELDI jnz select_in;
86 test SCSIPHASE, ~DATA_PHASE_MASK jz idle_loop_check_nonpackreq;
87 test SCSISIGO, ATNO jz idle_loop_check_nonpackreq;
88 call unexpected_nonpkt_phase_find_ctxt;
89idle_loop_check_nonpackreq:
90 test SSTAT2, NONPACKREQ jz . + 2;
91 call unexpected_nonpkt_phase_find_ctxt;
92 if ((ahd->bugs & AHD_FAINT_LED_BUG) != 0) {
44PATCH_ARG_LIST = "struct ahd_softc *ahd"
45PREFIX = "ahd_"
46
47#include "aic79xx.reg"
48#include "scsi_message.h"
49
50restart:
51if ((ahd->bugs & AHD_INTCOLLISION_BUG) != 0) {

--- 33 unchanged lines hidden (view full) ---

85 test SSTAT0, SELDI jnz select_in;
86 test SCSIPHASE, ~DATA_PHASE_MASK jz idle_loop_check_nonpackreq;
87 test SCSISIGO, ATNO jz idle_loop_check_nonpackreq;
88 call unexpected_nonpkt_phase_find_ctxt;
89idle_loop_check_nonpackreq:
90 test SSTAT2, NONPACKREQ jz . + 2;
91 call unexpected_nonpkt_phase_find_ctxt;
92 if ((ahd->bugs & AHD_FAINT_LED_BUG) != 0) {
93 /*
94 * On Rev A. hardware, the busy LED is only
95 * turned on automaically during selections
96 * and re-selections. Make the LED status
97 * more useful by forcing it to be on so
98 * long as one of our data FIFOs is active.
99 */
93 and A, FIFO0FREE|FIFO1FREE, DFFSTAT;
94 cmp A, FIFO0FREE|FIFO1FREE jne . + 3;
95 and SBLKCTL, ~DIAGLEDEN|DIAGLEDON;
96 jmp . + 2;
97 or SBLKCTL, DIAGLEDEN|DIAGLEDON;
98 }
99 call idle_loop_gsfifo_in_scsi_mode;
100 call idle_loop_service_fifos;
101 call idle_loop_cchan;
102 jmp idle_loop;
103
100 and A, FIFO0FREE|FIFO1FREE, DFFSTAT;
101 cmp A, FIFO0FREE|FIFO1FREE jne . + 3;
102 and SBLKCTL, ~DIAGLEDEN|DIAGLEDON;
103 jmp . + 2;
104 or SBLKCTL, DIAGLEDEN|DIAGLEDON;
105 }
106 call idle_loop_gsfifo_in_scsi_mode;
107 call idle_loop_service_fifos;
108 call idle_loop_cchan;
109 jmp idle_loop;
110
104BEGIN_CRITICAL;
105idle_loop_gsfifo:
106 SET_MODE(M_SCSI, M_SCSI)
111idle_loop_gsfifo:
112 SET_MODE(M_SCSI, M_SCSI)
113BEGIN_CRITICAL;
107idle_loop_gsfifo_in_scsi_mode:
108 test LQISTAT2, LQIGSAVAIL jz return;
109 /*
110 * We have received good status for this transaction. There may
111 * still be data in our FIFOs draining to the host. Complete
112 * the SCB only if all data has transferred to the host.
113 */
114good_status_IU_done:

--- 32 unchanged lines hidden (view full) ---

147 */
148 test SCB_FIFO_USE_COUNT, 0xFF jnz idle_loop_gsfifo_in_scsi_mode;
149 call complete;
150END_CRITICAL;
151 jmp idle_loop_gsfifo_in_scsi_mode;
152
153idle_loop_service_fifos:
154 SET_MODE(M_DFF0, M_DFF0)
114idle_loop_gsfifo_in_scsi_mode:
115 test LQISTAT2, LQIGSAVAIL jz return;
116 /*
117 * We have received good status for this transaction. There may
118 * still be data in our FIFOs draining to the host. Complete
119 * the SCB only if all data has transferred to the host.
120 */
121good_status_IU_done:

--- 32 unchanged lines hidden (view full) ---

154 */
155 test SCB_FIFO_USE_COUNT, 0xFF jnz idle_loop_gsfifo_in_scsi_mode;
156 call complete;
157END_CRITICAL;
158 jmp idle_loop_gsfifo_in_scsi_mode;
159
160idle_loop_service_fifos:
161 SET_MODE(M_DFF0, M_DFF0)
162BEGIN_CRITICAL;
155 test LONGJMP_ADDR[1], INVALID_ADDR jnz idle_loop_next_fifo;
156 call longjmp;
163 test LONGJMP_ADDR[1], INVALID_ADDR jnz idle_loop_next_fifo;
164 call longjmp;
165END_CRITICAL;
157idle_loop_next_fifo:
158 SET_MODE(M_DFF1, M_DFF1)
166idle_loop_next_fifo:
167 SET_MODE(M_DFF1, M_DFF1)
168BEGIN_CRITICAL;
159 test LONGJMP_ADDR[1], INVALID_ADDR jz longjmp;
169 test LONGJMP_ADDR[1], INVALID_ADDR jz longjmp;
170END_CRITICAL;
160return:
161 ret;
162
163idle_loop_cchan:
164 SET_MODE(M_CCHAN, M_CCHAN)
165 test QOFF_CTLSTA, HS_MAILBOX_ACT jz hs_mailbox_empty;
171return:
172 ret;
173
174idle_loop_cchan:
175 SET_MODE(M_CCHAN, M_CCHAN)
176 test QOFF_CTLSTA, HS_MAILBOX_ACT jz hs_mailbox_empty;
166 mov LOCAL_HS_MAILBOX, HS_MAILBOX;
167 or QOFF_CTLSTA, HS_MAILBOX_ACT;
177 or QOFF_CTLSTA, HS_MAILBOX_ACT;
178 mov LOCAL_HS_MAILBOX, HS_MAILBOX;
168hs_mailbox_empty:
169BEGIN_CRITICAL;
170 test CCSCBCTL, CCARREN|CCSCBEN jz scbdma_idle;
171 test CCSCBCTL, CCSCBDIR jnz fetch_new_scb_inprog;
172 test CCSCBCTL, CCSCBDONE jz return;
179hs_mailbox_empty:
180BEGIN_CRITICAL;
181 test CCSCBCTL, CCARREN|CCSCBEN jz scbdma_idle;
182 test CCSCBCTL, CCSCBDIR jnz fetch_new_scb_inprog;
183 test CCSCBCTL, CCSCBDONE jz return;
173END_CRITICAL;
174 /* FALLTHROUGH */
175scbdma_tohost_done:
176 test CCSCBCTL, CCARREN jz fill_qoutfifo_dmadone;
177 /*
178 * An SCB has been succesfully uploaded to the host.
179 * If the SCB was uploaded for some reason other than
180 * bad SCSI status (currently only for underruns), we
181 * queue the SCB for normal completion. Otherwise, we
182 * wait until any select-out activity has halted, and
184 /* FALLTHROUGH */
185scbdma_tohost_done:
186 test CCSCBCTL, CCARREN jz fill_qoutfifo_dmadone;
187 /*
188 * An SCB has been succesfully uploaded to the host.
189 * If the SCB was uploaded for some reason other than
190 * bad SCSI status (currently only for underruns), we
191 * queue the SCB for normal completion. Otherwise, we
192 * wait until any select-out activity has halted, and
183 * then notify the host so that the transaction can be
184 * dealt with.
193 * then queue the completion.
185 */
194 */
186 test SCB_SCSI_STATUS, 0xff jnz scbdma_notify_host;
187 and CCSCBCTL, ~(CCARREN|CCSCBEN);
188 bmov COMPLETE_DMA_SCB_HEAD, SCB_NEXT_COMPLETE, 2;
189 bmov SCB_NEXT_COMPLETE, COMPLETE_SCB_HEAD, 2;
190 bmov COMPLETE_SCB_HEAD, SCBPTR, 2 ret;
191scbdma_notify_host:
195 test SCB_SCSI_STATUS, 0xff jz scbdma_queue_completion;
192 SET_MODE(M_SCSI, M_SCSI)
193 test SCSISEQ0, ENSELO jnz return;
194 test SSTAT0, (SELDO|SELINGO) jnz return;
195 SET_MODE(M_CCHAN, M_CCHAN)
196 SET_MODE(M_SCSI, M_SCSI)
197 test SCSISEQ0, ENSELO jnz return;
198 test SSTAT0, (SELDO|SELINGO) jnz return;
199 SET_MODE(M_CCHAN, M_CCHAN)
196 /*
197 * Remove SCB and notify host.
198 */
200scbdma_queue_completion:
199 and CCSCBCTL, ~(CCARREN|CCSCBEN);
200 bmov COMPLETE_DMA_SCB_HEAD, SCB_NEXT_COMPLETE, 2;
201 and CCSCBCTL, ~(CCARREN|CCSCBEN);
202 bmov COMPLETE_DMA_SCB_HEAD, SCB_NEXT_COMPLETE, 2;
201 SET_SEQINTCODE(BAD_SCB_STATUS)
202 ret;
203 bmov SCB_NEXT_COMPLETE, COMPLETE_SCB_HEAD, 2;
204 bmov COMPLETE_SCB_HEAD, SCBPTR, 2 ret;
203fill_qoutfifo_dmadone:
204 and CCSCBCTL, ~(CCARREN|CCSCBEN);
205 call qoutfifo_updated;
206 mvi COMPLETE_SCB_DMAINPROG_HEAD[1], SCB_LIST_NULL;
207 bmov QOUTFIFO_NEXT_ADDR, SCBHADDR, 4;
208 test QOFF_CTLSTA, SDSCB_ROLLOVR jz return;
209 bmov QOUTFIFO_NEXT_ADDR, SHARED_DATA_ADDR, 4;
210 xor QOUTFIFO_ENTRY_VALID_TAG, QOUTFIFO_ENTRY_VALID_TOGGLE ret;
205fill_qoutfifo_dmadone:
206 and CCSCBCTL, ~(CCARREN|CCSCBEN);
207 call qoutfifo_updated;
208 mvi COMPLETE_SCB_DMAINPROG_HEAD[1], SCB_LIST_NULL;
209 bmov QOUTFIFO_NEXT_ADDR, SCBHADDR, 4;
210 test QOFF_CTLSTA, SDSCB_ROLLOVR jz return;
211 bmov QOUTFIFO_NEXT_ADDR, SHARED_DATA_ADDR, 4;
212 xor QOUTFIFO_ENTRY_VALID_TAG, QOUTFIFO_ENTRY_VALID_TOGGLE ret;
213END_CRITICAL;
211
212qoutfifo_updated:
213 /*
214 * If there are more commands waiting to be dma'ed
215 * to the host, always coalesce. Otherwise honor the
216 * host's wishes.
217 */
218 cmp COMPLETE_DMA_SCB_HEAD[1], SCB_LIST_NULL jne coalesce_by_count;

--- 266 unchanged lines hidden (view full) ---

485
486/*
487 * We have been reselected as an initiator
488 * or selected as a target.
489 */
490SET_SRC_MODE M_SCSI;
491SET_DST_MODE M_SCSI;
492select_in:
214
215qoutfifo_updated:
216 /*
217 * If there are more commands waiting to be dma'ed
218 * to the host, always coalesce. Otherwise honor the
219 * host's wishes.
220 */
221 cmp COMPLETE_DMA_SCB_HEAD[1], SCB_LIST_NULL jne coalesce_by_count;

--- 266 unchanged lines hidden (view full) ---

488
489/*
490 * We have been reselected as an initiator
491 * or selected as a target.
492 */
493SET_SRC_MODE M_SCSI;
494SET_DST_MODE M_SCSI;
495select_in:
496 if ((ahd->bugs & AHD_FAINT_LED_BUG) != 0) {
497 /*
498 * On Rev A. hardware, the busy LED is only
499 * turned on automaically during selections
500 * and re-selections. Make the LED status
501 * more useful by forcing it to be on from
502 * the point of selection until our idle
503 * loop determines that neither of our FIFOs
504 * are busy. This handles the non-packetized
505 * case nicely as we will not return to the
506 * idle loop until the busfree at the end of
507 * each transaction.
508 */
509 or SBLKCTL, DIAGLEDEN|DIAGLEDON;
510 }
493 if ((ahd->bugs & AHD_BUSFREEREV_BUG) != 0) {
494 /*
511 if ((ahd->bugs & AHD_BUSFREEREV_BUG) != 0) {
512 /*
495 * This exposes a window whereby a
496 * busfree just after a selection will
497 * be missed, but there is no other safe
498 * way to enable busfree detection if
499 * the busfreerev function is broken.
513 * Test to ensure that the bus has not
514 * already gone free prior to clearing
515 * any stale busfree status. This avoids
516 * a window whereby a busfree just after
517 * a selection could be missed.
500 */
518 */
519 test SCSISIGI, BSYI jz . + 2;
501 mvi CLRSINT1,CLRBUSFREE;
502 or SIMODE1, ENBUSFREE;
503 }
504 or SXFRCTL0, SPIOEN;
505 and SAVED_SCSIID, SELID_MASK, SELID;
506 and A, OID, IOWNID;
507 or SAVED_SCSIID, A;
508 mvi CLRSINT0, CLRSELDI;

--- 13 unchanged lines hidden (view full) ---

522 *
523 * In Non-Packetize Mode:
524 * Continue to our normal state machine.
525 */
526SET_SRC_MODE M_SCSI;
527SET_DST_MODE M_SCSI;
528select_out:
529BEGIN_CRITICAL;
520 mvi CLRSINT1,CLRBUSFREE;
521 or SIMODE1, ENBUSFREE;
522 }
523 or SXFRCTL0, SPIOEN;
524 and SAVED_SCSIID, SELID_MASK, SELID;
525 and A, OID, IOWNID;
526 or SAVED_SCSIID, A;
527 mvi CLRSINT0, CLRSELDI;

--- 13 unchanged lines hidden (view full) ---

541 *
542 * In Non-Packetize Mode:
543 * Continue to our normal state machine.
544 */
545SET_SRC_MODE M_SCSI;
546SET_DST_MODE M_SCSI;
547select_out:
548BEGIN_CRITICAL;
549 if ((ahd->bugs & AHD_FAINT_LED_BUG) != 0) {
550 /*
551 * On Rev A. hardware, the busy LED is only
552 * turned on automaically during selections
553 * and re-selections. Make the LED status
554 * more useful by forcing it to be on from
555 * the point of re-selection until our idle
556 * loop determines that neither of our FIFOs
557 * are busy. This handles the non-packetized
558 * case nicely as we will not return to the
559 * idle loop until the busfree at the end of
560 * each transaction.
561 */
562 or SBLKCTL, DIAGLEDEN|DIAGLEDON;
563 }
530 /* Clear out all SCBs that have been successfully sent. */
531 if ((ahd->bugs & AHD_SENT_SCB_UPDATE_BUG) != 0) {
532 /*
533 * For packetized, the LQO manager clears ENSELO on
534 * the assertion of SELDO. If we are non-packetized,
535 * LASTSCB and CURRSCB are accurate.
536 */
537 test SCSISEQ0, ENSELO jnz use_lastscb;

--- 105 unchanged lines hidden (view full) ---

643 SET_SEQINTCODE(TASKMGMT_FUNC_COMPLETE)
644 jmp idle_loop;
645
646select_out_non_packetized:
647 /* Non packetized request. */
648 and SCSISEQ0, ~ENSELO;
649 if ((ahd->bugs & AHD_BUSFREEREV_BUG) != 0) {
650 /*
564 /* Clear out all SCBs that have been successfully sent. */
565 if ((ahd->bugs & AHD_SENT_SCB_UPDATE_BUG) != 0) {
566 /*
567 * For packetized, the LQO manager clears ENSELO on
568 * the assertion of SELDO. If we are non-packetized,
569 * LASTSCB and CURRSCB are accurate.
570 */
571 test SCSISEQ0, ENSELO jnz use_lastscb;

--- 105 unchanged lines hidden (view full) ---

677 SET_SEQINTCODE(TASKMGMT_FUNC_COMPLETE)
678 jmp idle_loop;
679
680select_out_non_packetized:
681 /* Non packetized request. */
682 and SCSISEQ0, ~ENSELO;
683 if ((ahd->bugs & AHD_BUSFREEREV_BUG) != 0) {
684 /*
651 * This exposes a window whereby a
652 * busfree just after a selection will
653 * be missed, but there is no other safe
654 * way to enable busfree detection if
655 * the busfreerev function is broken.
685 * Test to ensure that the bus has not
686 * already gone free prior to clearing
687 * any stale busfree status. This avoids
688 * a window whereby a busfree just after
689 * a selection could be missed.
656 */
690 */
691 test SCSISIGI, BSYI jz . + 2;
657 mvi CLRSINT1,CLRBUSFREE;
658 or SIMODE1, ENBUSFREE;
659 }
660 mov SAVED_SCSIID, SCB_SCSIID;
661 mov SAVED_LUN, SCB_LUN;
662 mvi SEQ_FLAGS, NO_CDB_SENT;
663END_CRITICAL;
664 or SXFRCTL0, SPIOEN;

--- 56 unchanged lines hidden (view full) ---

721 mvi DFCNTRL, (PRELOADEN|SCSIEN|HDMAEN);
722 jmp p_command_xfer;
723p_command_embedded:
724 bmov SHCNT[0], SCB_CDB_LEN, 1;
725 bmov DFDAT, SCB_CDB_STORE, 16;
726 mvi DFCNTRL, SCSIEN;
727p_command_xfer:
728 and SEQ_FLAGS, ~NO_CDB_SENT;
692 mvi CLRSINT1,CLRBUSFREE;
693 or SIMODE1, ENBUSFREE;
694 }
695 mov SAVED_SCSIID, SCB_SCSIID;
696 mov SAVED_LUN, SCB_LUN;
697 mvi SEQ_FLAGS, NO_CDB_SENT;
698END_CRITICAL;
699 or SXFRCTL0, SPIOEN;

--- 56 unchanged lines hidden (view full) ---

756 mvi DFCNTRL, (PRELOADEN|SCSIEN|HDMAEN);
757 jmp p_command_xfer;
758p_command_embedded:
759 bmov SHCNT[0], SCB_CDB_LEN, 1;
760 bmov DFDAT, SCB_CDB_STORE, 16;
761 mvi DFCNTRL, SCSIEN;
762p_command_xfer:
763 and SEQ_FLAGS, ~NO_CDB_SENT;
729 test DFCNTRL, SCSIEN jnz .;
764 if ((ahd->features & AHD_FAST_CDB_DELIVERY) != 0) {
765 /*
766 * To speed up CDB delivery in Rev B, all CDB acks
767 * are "released" to the output sync as soon as the
768 * command phase starts. There is only one problem
769 * with this approach. If the target changes phase
770 * before all data are sent, we have left over acks
771 * that can go out on the bus in a data phase. Due
772 * to other chip contraints, this only happens if
773 * the target goes to data-in, but if the acks go
774 * out before we can test SDONE, we'll think that
775 * the transfer has completed successfully. Work
776 * around this by taking advantage of the 400ns or
777 * 800ns dead time between command phase and the REQ
778 * of the new phase. If the transfer has completed
779 * successfully, SCSIEN should fall *long* before we
780 * see a phase change. We thus treat any phasemiss
781 * that occurs before SCSIEN falls as an incomplete
782 * transfer.
783 */
784 test SSTAT1, PHASEMIS jnz p_command_xfer_failed;
785 test DFCNTRL, SCSIEN jnz . - 1;
786 } else {
787 test DFCNTRL, SCSIEN jnz .;
788 }
730 /*
731 * DMA Channel automatically disabled.
732 * Don't allow a data phase if the command
733 * was not fully transferred.
734 */
735 test SSTAT2, SDONE jnz ITloop;
789 /*
790 * DMA Channel automatically disabled.
791 * Don't allow a data phase if the command
792 * was not fully transferred.
793 */
794 test SSTAT2, SDONE jnz ITloop;
795p_command_xfer_failed:
736 or SEQ_FLAGS, NO_CDB_SENT;
737 jmp ITloop;
738
739
740/*
741 * Status phase. Wait for the data byte to appear, then read it
742 * and store it into the SCB.
743 */

--- 309 unchanged lines hidden (view full) ---

1053 test SCB_SCSI_STATUS,0xff jnz bad_status;
1054 /*
1055 * Check for residuals
1056 */
1057 test SCB_SGPTR, SG_LIST_NULL jnz complete; /* No xfer */
1058 test SCB_SGPTR, SG_FULL_RESID jnz upload_scb;/* Never xfered */
1059 test SCB_RESIDUAL_SGPTR, SG_LIST_NULL jz upload_scb;
1060complete:
796 or SEQ_FLAGS, NO_CDB_SENT;
797 jmp ITloop;
798
799
800/*
801 * Status phase. Wait for the data byte to appear, then read it
802 * and store it into the SCB.
803 */

--- 309 unchanged lines hidden (view full) ---

1113 test SCB_SCSI_STATUS,0xff jnz bad_status;
1114 /*
1115 * Check for residuals
1116 */
1117 test SCB_SGPTR, SG_LIST_NULL jnz complete; /* No xfer */
1118 test SCB_SGPTR, SG_FULL_RESID jnz upload_scb;/* Never xfered */
1119 test SCB_RESIDUAL_SGPTR, SG_LIST_NULL jz upload_scb;
1120complete:
1121BEGIN_CRITICAL;
1061 bmov SCB_NEXT_COMPLETE, COMPLETE_SCB_HEAD, 2;
1062 bmov COMPLETE_SCB_HEAD, SCBPTR, 2 ret;
1122 bmov SCB_NEXT_COMPLETE, COMPLETE_SCB_HEAD, 2;
1123 bmov COMPLETE_SCB_HEAD, SCBPTR, 2 ret;
1124END_CRITICAL;
1063bad_status:
1064 cmp SCB_SCSI_STATUS, STATUS_PKT_SENSE je upload_scb;
1065 call freeze_queue;
1066upload_scb:
1067 /*
1068 * Restore SCB TAG since we reuse this field
1069 * in the sequencer. We don't want to corrupt
1070 * it on the host.
1071 */
1072 bmov SCB_TAG, SCBPTR, 2;
1125bad_status:
1126 cmp SCB_SCSI_STATUS, STATUS_PKT_SENSE je upload_scb;
1127 call freeze_queue;
1128upload_scb:
1129 /*
1130 * Restore SCB TAG since we reuse this field
1131 * in the sequencer. We don't want to corrupt
1132 * it on the host.
1133 */
1134 bmov SCB_TAG, SCBPTR, 2;
1135BEGIN_CRITICAL;
1073 bmov SCB_NEXT_COMPLETE, COMPLETE_DMA_SCB_HEAD, 2;
1074 bmov COMPLETE_DMA_SCB_HEAD, SCBPTR, 2;
1075 or SCB_SGPTR, SG_STATUS_VALID ret;
1136 bmov SCB_NEXT_COMPLETE, COMPLETE_DMA_SCB_HEAD, 2;
1137 bmov COMPLETE_DMA_SCB_HEAD, SCBPTR, 2;
1138 or SCB_SGPTR, SG_STATUS_VALID ret;
1139END_CRITICAL;
1076
1077/*
1078 * Is it a disconnect message? Set a flag in the SCB to remind us
1079 * and await the bus going free. If this is an untagged transaction
1080 * store the SCB id for it in our untagged target table for lookup on
1081 * a reselction.
1082 */
1083mesgin_disconnect:

--- 30 unchanged lines hidden (view full) ---

1114 mov NONE, SCSIDAT; /* Ack the last byte */
1115 test MODE_PTR, ~(MK_MODE(M_DFF1, M_DFF1))
1116 jnz await_busfree_not_m_dff;
1117SET_SRC_MODE M_DFF1;
1118SET_DST_MODE M_DFF1;
1119await_busfree_clrchn:
1120 mvi DFFSXFRCTL, CLRCHN;
1121await_busfree_not_m_dff:
1140
1141/*
1142 * Is it a disconnect message? Set a flag in the SCB to remind us
1143 * and await the bus going free. If this is an untagged transaction
1144 * store the SCB id for it in our untagged target table for lookup on
1145 * a reselction.
1146 */
1147mesgin_disconnect:

--- 30 unchanged lines hidden (view full) ---

1178 mov NONE, SCSIDAT; /* Ack the last byte */
1179 test MODE_PTR, ~(MK_MODE(M_DFF1, M_DFF1))
1180 jnz await_busfree_not_m_dff;
1181SET_SRC_MODE M_DFF1;
1182SET_DST_MODE M_DFF1;
1183await_busfree_clrchn:
1184 mvi DFFSXFRCTL, CLRCHN;
1185await_busfree_not_m_dff:
1122 call clear_target_state;
1186 /* clear target specific flags */
1187 mvi SEQ_FLAGS, NOT_IDENTIFIED|NO_CDB_SENT;
1123 test SSTAT1,REQINIT|BUSFREE jz .;
1188 test SSTAT1,REQINIT|BUSFREE jz .;
1189 /*
1190 * We only set BUSFREE status once either a new
1191 * phase has been detected or we are really
1192 * BUSFREE. This allows the driver to know
1193 * that we are active on the bus even though
1194 * no identified transaction exists should a
1195 * timeout occur while awaiting busfree.
1196 */
1197 mvi LASTPHASE, P_BUSFREE;
1124 test SSTAT1, BUSFREE jnz idle_loop;
1125 SET_SEQINTCODE(MISSED_BUSFREE)
1126
1127
1128/*
1129 * Save data pointers message:
1130 * Copying RAM values back to SCB, for Save Data Pointers message, but
1131 * only if we've actually been into a data phase to change them. This

--- 38 unchanged lines hidden (view full) ---

1170 and SEQ_FLAGS, ~DPHASE;
1171 test MODE_PTR, ~(MK_MODE(M_DFF1, M_DFF1)) jnz msgin_rdptrs_get_fifo;
1172 mvi DFFSXFRCTL, RSTCHN|CLRSHCNT;
1173 SET_MODE(M_SCSI, M_SCSI)
1174msgin_rdptrs_get_fifo:
1175 call allocate_fifo;
1176 jmp mesgin_done;
1177
1198 test SSTAT1, BUSFREE jnz idle_loop;
1199 SET_SEQINTCODE(MISSED_BUSFREE)
1200
1201
1202/*
1203 * Save data pointers message:
1204 * Copying RAM values back to SCB, for Save Data Pointers message, but
1205 * only if we've actually been into a data phase to change them. This

--- 38 unchanged lines hidden (view full) ---

1244 and SEQ_FLAGS, ~DPHASE;
1245 test MODE_PTR, ~(MK_MODE(M_DFF1, M_DFF1)) jnz msgin_rdptrs_get_fifo;
1246 mvi DFFSXFRCTL, RSTCHN|CLRSHCNT;
1247 SET_MODE(M_SCSI, M_SCSI)
1248msgin_rdptrs_get_fifo:
1249 call allocate_fifo;
1250 jmp mesgin_done;
1251
1178clear_target_state:
1179 mvi LASTPHASE, P_BUSFREE;
1180 /* clear target specific flags */
1181 mvi SEQ_FLAGS, NOT_IDENTIFIED|NO_CDB_SENT ret;
1182
1183phase_lock:
1184 if ((ahd->bugs & AHD_EARLY_REQ_BUG) != 0) {
1185 /*
1186 * Don't ignore persistent REQ assertions just because
1187 * they were asserted within the bus settle delay window.
1188 * This allows us to tolerate devices like the GEM318
1189 * that violate the SCSI spec. We are careful not to
1190 * count REQ while we are waiting for it to fall during

--- 435 unchanged lines hidden (view full) ---

1626 test REG_ISR, LQIWORKONLQ jz main_isr;
1627 test SEQINTSRC, SAVEPTRS jz main_isr;
1628 test LONGJMP_ADDR[1], INVALID_ADDR jz saveptr_active_fifo;
1629 /*
1630 * Switch to the active FIFO after clearing the snapshot
1631 * savepointer in the current FIFO. We do this so that
1632 * a pending CTXTDONE or SAVEPTR is visible in the active
1633 * FIFO. This status is the only way we can detect if we
1252phase_lock:
1253 if ((ahd->bugs & AHD_EARLY_REQ_BUG) != 0) {
1254 /*
1255 * Don't ignore persistent REQ assertions just because
1256 * they were asserted within the bus settle delay window.
1257 * This allows us to tolerate devices like the GEM318
1258 * that violate the SCSI spec. We are careful not to
1259 * count REQ while we are waiting for it to fall during

--- 435 unchanged lines hidden (view full) ---

1695 test REG_ISR, LQIWORKONLQ jz main_isr;
1696 test SEQINTSRC, SAVEPTRS jz main_isr;
1697 test LONGJMP_ADDR[1], INVALID_ADDR jz saveptr_active_fifo;
1698 /*
1699 * Switch to the active FIFO after clearing the snapshot
1700 * savepointer in the current FIFO. We do this so that
1701 * a pending CTXTDONE or SAVEPTR is visible in the active
1702 * FIFO. This status is the only way we can detect if we
1634 * have lost the race (e.g. host paused us) and our attepts
1703 * have lost the race (e.g. host paused us) and our attempts
1635 * to disable the channel occurred after all REQs were
1636 * already seen and acked (REQINIT never comes true).
1637 */
1638 mvi DFFSXFRCTL, CLRCHN;
1639 xor MODE_PTR, MK_MODE(M_DFF1, M_DFF1);
1640 test DFCNTRL, DIRECTION jz interrupt_return;
1641 and DFCNTRL, ~SCSIEN;
1642snapshot_wait_data_valid:
1704 * to disable the channel occurred after all REQs were
1705 * already seen and acked (REQINIT never comes true).
1706 */
1707 mvi DFFSXFRCTL, CLRCHN;
1708 xor MODE_PTR, MK_MODE(M_DFF1, M_DFF1);
1709 test DFCNTRL, DIRECTION jz interrupt_return;
1710 and DFCNTRL, ~SCSIEN;
1711snapshot_wait_data_valid:
1643 test SEQINTSRC, (CTXTDONE|SAVEPTRS) jnz snapshot_data_valid;
1712 test SEQINTSRC, (CTXTDONE|SAVEPTRS) jnz interrupt_return;
1644 test SSTAT1, REQINIT jz snapshot_wait_data_valid;
1645snapshot_data_valid:
1646 or DFCNTRL, SCSIEN;
1647 or SEQINTCTL, IRET ret;
1648snapshot_saveptr:
1649 mvi DFFSXFRCTL, CLRCHN;
1650 or SEQINTCTL, IRET ret;
1651main_isr:

--- 150 unchanged lines hidden (view full) ---

1802 call setjmp;
1803 test DFSTATUS, FIFOEMP jz return;
1804pkt_saveptrs_check_status:
1805 or LONGJMP_ADDR[1], INVALID_ADDR;
1806 test REG0, SAVEPTRS jz unexpected_nonpkt_phase;
1807 dec SCB_FIFO_USE_COUNT;
1808 test SCB_CONTROL, STATUS_RCVD jnz pkt_complete_scb_if_fifos_idle;
1809 mvi DFFSXFRCTL, CLRCHN ret;
1713 test SSTAT1, REQINIT jz snapshot_wait_data_valid;
1714snapshot_data_valid:
1715 or DFCNTRL, SCSIEN;
1716 or SEQINTCTL, IRET ret;
1717snapshot_saveptr:
1718 mvi DFFSXFRCTL, CLRCHN;
1719 or SEQINTCTL, IRET ret;
1720main_isr:

--- 150 unchanged lines hidden (view full) ---

1871 call setjmp;
1872 test DFSTATUS, FIFOEMP jz return;
1873pkt_saveptrs_check_status:
1874 or LONGJMP_ADDR[1], INVALID_ADDR;
1875 test REG0, SAVEPTRS jz unexpected_nonpkt_phase;
1876 dec SCB_FIFO_USE_COUNT;
1877 test SCB_CONTROL, STATUS_RCVD jnz pkt_complete_scb_if_fifos_idle;
1878 mvi DFFSXFRCTL, CLRCHN ret;
1810END_CRITICAL;
1811
1812/*
1813 * LAST_SEG_DONE status has been seen in the current FIFO.
1814 * This indicates that all of the allowed data for this
1815 * command has transferred across the SCSI and host buses.
1816 * Check for overrun and see if we can complete this command.
1817 */
1818pkt_last_seg_done:
1879
1880/*
1881 * LAST_SEG_DONE status has been seen in the current FIFO.
1882 * This indicates that all of the allowed data for this
1883 * command has transferred across the SCSI and host buses.
1884 * Check for overrun and see if we can complete this command.
1885 */
1886pkt_last_seg_done:
1819BEGIN_CRITICAL;
1820 /*
1821 * Mark transfer as completed.
1822 */
1823 or SCB_SGPTR, SG_LIST_NULL;
1824
1825 /*
1826 * Wait for the current context to finish to verify that
1827 * no overrun condition has occurred.

--- 204 unchanged lines hidden ---
1887 /*
1888 * Mark transfer as completed.
1889 */
1890 or SCB_SGPTR, SG_LIST_NULL;
1891
1892 /*
1893 * Wait for the current context to finish to verify that
1894 * no overrun condition has occurred.

--- 204 unchanged lines hidden ---