1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42 struct SYM_FWA_SCR {
43 u32 start [ 11];
44 u32 getjob_begin [ 4];
45 u32 _sms_a10 [ 5];
46 u32 getjob_end [ 4];
47 u32 _sms_a20 [ 4];
48 #ifdef SYM_CONF_TARGET_ROLE_SUPPORT
49 u32 select [ 8];
50 #else
51 u32 select [ 6];
52 #endif
53 u32 _sms_a30 [ 5];
54 u32 wf_sel_done [ 2];
55 u32 send_ident [ 2];
56 #ifdef SYM_CONF_IARB_SUPPORT
57 u32 select2 [ 8];
58 #else
59 u32 select2 [ 2];
60 #endif
61 u32 command [ 2];
62 u32 dispatch [ 28];
63 u32 sel_no_cmd [ 10];
64 u32 init [ 6];
65 u32 clrack [ 4];
66 u32 datai_done [ 11];
67 u32 datai_done_wsr [ 20];
68 u32 datao_done [ 11];
69 u32 datao_done_wss [ 6];
70 u32 datai_phase [ 5];
71 u32 datao_phase [ 5];
72 u32 msg_in [ 2];
73 u32 msg_in2 [ 10];
74 #ifdef SYM_CONF_IARB_SUPPORT
75 u32 status [ 14];
76 #else
77 u32 status [ 10];
78 #endif
79 u32 complete [ 6];
80 u32 complete2 [ 8];
81 u32 _sms_a40 [ 12];
82 u32 done [ 5];
83 u32 _sms_a50 [ 5];
84 u32 _sms_a60 [ 2];
85 u32 done_end [ 4];
86 u32 complete_error [ 5];
87 u32 save_dp [ 11];
88 u32 restore_dp [ 7];
89 u32 disconnect [ 11];
90 u32 disconnect2 [ 5];
91 u32 _sms_a65 [ 3];
92 #ifdef SYM_CONF_IARB_SUPPORT
93 u32 idle [ 4];
94 #else
95 u32 idle [ 2];
96 #endif
97 #ifdef SYM_CONF_IARB_SUPPORT
98 u32 ungetjob [ 7];
99 #else
100 u32 ungetjob [ 5];
101 #endif
102 #ifdef SYM_CONF_TARGET_ROLE_SUPPORT
103 u32 reselect [ 4];
104 #else
105 u32 reselect [ 2];
106 #endif
107 u32 reselected [ 19];
108 u32 _sms_a70 [ 6];
109 u32 _sms_a80 [ 4];
110 u32 reselected1 [ 25];
111 u32 _sms_a90 [ 4];
112 u32 resel_lun0 [ 7];
113 u32 _sms_a100 [ 4];
114 u32 resel_tag [ 8];
115 #if SYM_CONF_MAX_TASK*4 > 512
116 u32 _sms_a110 [ 23];
117 #elif SYM_CONF_MAX_TASK*4 > 256
118 u32 _sms_a110 [ 17];
119 #else
120 u32 _sms_a110 [ 13];
121 #endif
122 u32 _sms_a120 [ 2];
123 u32 resel_go [ 4];
124 u32 _sms_a130 [ 7];
125 u32 resel_dsa [ 2];
126 u32 resel_dsa1 [ 4];
127 u32 _sms_a140 [ 7];
128 u32 resel_no_tag [ 4];
129 u32 _sms_a145 [ 7];
130 u32 data_in [SYM_CONF_MAX_SG * 2];
131 u32 data_in2 [ 4];
132 u32 data_out [SYM_CONF_MAX_SG * 2];
133 u32 data_out2 [ 4];
134 u32 pm0_data [ 12];
135 u32 pm0_data_out [ 6];
136 u32 pm0_data_end [ 7];
137 u32 pm_data_end [ 4];
138 u32 _sms_a150 [ 4];
139 u32 pm1_data [ 12];
140 u32 pm1_data_out [ 6];
141 u32 pm1_data_end [ 9];
142 };
143
144
145
146
147
148 struct SYM_FWB_SCR {
149 u32 no_data [ 2];
150 #ifdef SYM_CONF_TARGET_ROLE_SUPPORT
151 u32 sel_for_abort [ 18];
152 #else
153 u32 sel_for_abort [ 16];
154 #endif
155 u32 sel_for_abort_1 [ 2];
156 u32 msg_in_etc [ 12];
157 u32 msg_received [ 5];
158 u32 msg_weird_seen [ 5];
159 u32 msg_extended [ 17];
160 u32 _sms_b10 [ 4];
161 u32 msg_bad [ 6];
162 u32 msg_weird [ 4];
163 u32 msg_weird1 [ 8];
164 u32 wdtr_resp [ 6];
165 u32 send_wdtr [ 4];
166 u32 sdtr_resp [ 6];
167 u32 send_sdtr [ 4];
168 u32 ppr_resp [ 6];
169 u32 send_ppr [ 4];
170 u32 nego_bad_phase [ 4];
171 u32 msg_out [ 4];
172 u32 msg_out_done [ 4];
173 u32 data_ovrun [ 3];
174 u32 data_ovrun1 [ 22];
175 u32 data_ovrun2 [ 8];
176 u32 abort_resel [ 16];
177 u32 resend_ident [ 4];
178 u32 ident_break [ 4];
179 u32 ident_break_atn [ 4];
180 u32 sdata_in [ 6];
181 u32 resel_bad_lun [ 4];
182 u32 bad_i_t_l [ 4];
183 u32 bad_i_t_l_q [ 4];
184 u32 bad_status [ 7];
185 u32 wsr_ma_helper [ 4];
186
187
188 u32 zero [ 1];
189 u32 scratch [ 1];
190 u32 scratch1 [ 1];
191 u32 prev_done [ 1];
192 u32 done_pos [ 1];
193 u32 nextjob [ 1];
194 u32 startpos [ 1];
195 u32 targtbl [ 1];
196 };
197
198
199
200
201
202 struct SYM_FWZ_SCR {
203 u32 snooptest [ 9];
204 u32 snoopend [ 2];
205 };
206
207 static struct SYM_FWA_SCR SYM_FWA_SCR = {
208 {
209
210
211
212
213
214 SCR_REG_REG (gpreg, SCR_AND, 0xfe),
215 0,
216
217
218
219 SCR_FROM_REG (ctest2),
220 0,
221
222
223
224
225
226 SCR_FROM_REG (istat),
227 0,
228
229
230
231
232
233 SCR_COPY (4),
234 PADDR_B (startpos),
235 RADDR_1 (scratcha),
236 SCR_INT ^ IFTRUE (MASK (SEM, SEM)),
237 SIR_SCRIPT_STOPPED,
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252 },{
253
254
255
256
257
258 SCR_COPY (4),
259 RADDR_1 (scratcha),
260 PADDR_A (_sms_a10),
261 SCR_COPY (8),
262 },{
263 0,
264 PADDR_B (nextjob),
265
266
267
268
269
270 SCR_COPY (4),
271 PADDR_B (nextjob),
272 RADDR_1 (dsa),
273 },{
274 SCR_COPY (4),
275 RADDR_1 (dsa),
276 PADDR_A (_sms_a20),
277 SCR_COPY (4),
278 },{
279 0,
280 RADDR_1 (temp),
281 SCR_RETURN,
282 0,
283 },{
284
285
286
287
288
289
290
291
292
293
294
295 #ifdef SYM_CONF_TARGET_ROLE_SUPPORT
296 SCR_CLR (SCR_TRG),
297 0,
298 #endif
299
300
301
302 SCR_SEL_TBL_ATN ^ offsetof (struct sym_dsb, select),
303 PADDR_A (ungetjob),
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331 SCR_COPY (4),
332 RADDR_1 (dsa),
333 PADDR_A (_sms_a30),
334 SCR_COPY (sizeof(struct sym_ccbh)),
335 },{
336 0,
337 HADDR_1 (ccb_head),
338
339
340
341 SCR_COPY (4),
342 HADDR_1 (ccb_head.status),
343 RADDR_1 (scr0),
344 },{
345 SCR_INT ^ IFFALSE (WHEN (SCR_MSG_OUT)),
346 SIR_SEL_ATN_NO_MSG_OUT,
347 },{
348
349
350
351
352
353 SCR_MOVE_TBL ^ SCR_MSG_OUT,
354 offsetof (struct sym_dsb, smsg),
355 },{
356 #ifdef SYM_CONF_IARB_SUPPORT
357
358
359
360
361 SCR_FROM_REG (HF_REG),
362 0,
363 SCR_JUMPR ^ IFFALSE (MASK (HF_HINT_IARB, HF_HINT_IARB)),
364 8,
365 SCR_REG_REG (scntl1, SCR_OR, IARB),
366 0,
367 #endif
368
369
370
371
372 SCR_JUMP ^ IFFALSE (WHEN (SCR_COMMAND)),
373 PADDR_A (sel_no_cmd),
374 },{
375
376
377
378 SCR_MOVE_TBL ^ SCR_COMMAND,
379 offsetof (struct sym_dsb, cmd),
380 },{
381
382
383
384
385
386 SCR_JUMP ^ IFTRUE (WHEN (SCR_MSG_IN)),
387 PADDR_A (msg_in),
388 SCR_JUMP ^ IFTRUE (IF (SCR_DATA_OUT)),
389 PADDR_A (datao_phase),
390 SCR_JUMP ^ IFTRUE (IF (SCR_DATA_IN)),
391 PADDR_A (datai_phase),
392 SCR_JUMP ^ IFTRUE (IF (SCR_STATUS)),
393 PADDR_A (status),
394 SCR_JUMP ^ IFTRUE (IF (SCR_COMMAND)),
395 PADDR_A (command),
396 SCR_JUMP ^ IFTRUE (IF (SCR_MSG_OUT)),
397 PADDR_B (msg_out),
398
399
400
401
402 SCR_JUMPR ^ IFFALSE (WHEN (SCR_ILG_OUT)),
403 16,
404 SCR_MOVE_ABS (1) ^ SCR_ILG_OUT,
405 HADDR_1 (scratch),
406 SCR_JUMPR ^ IFTRUE (WHEN (SCR_ILG_OUT)),
407 -16,
408 SCR_JUMPR ^ IFFALSE (WHEN (SCR_ILG_IN)),
409 16,
410 SCR_MOVE_ABS (1) ^ SCR_ILG_IN,
411 HADDR_1 (scratch),
412 SCR_JUMPR ^ IFTRUE (WHEN (SCR_ILG_IN)),
413 -16,
414 SCR_INT,
415 SIR_BAD_PHASE,
416 SCR_JUMP,
417 PADDR_A (dispatch),
418 },{
419
420
421
422
423
424
425
426 SCR_JUMP ^ IFTRUE (WHEN (SCR_MSG_OUT)),
427 PADDR_B (resend_ident),
428
429
430
431
432
433 SCR_JUMP ^ IFTRUE (WHEN (SCR_MSG_IN)),
434 PADDR_A (dispatch),
435 SCR_FROM_REG (HS_REG),
436 0,
437 SCR_INT ^ IFTRUE (DATA (HS_NEGOTIATE)),
438 SIR_NEGO_FAILED,
439
440
441
442 SCR_JUMP,
443 PADDR_A (dispatch),
444 },{
445
446
447
448
449
450
451 SCR_FROM_REG (sstat0),
452 0,
453 SCR_JUMPR ^ IFTRUE (MASK (IRST, IRST)),
454 -16,
455 SCR_JUMP,
456 PADDR_A (start),
457 },{
458
459
460
461 SCR_CLR (SCR_ACK),
462 0,
463 SCR_JUMP,
464 PADDR_A (dispatch),
465 },{
466
467
468
469 SCR_COPY (4),
470 RADDR_1 (temp),
471 HADDR_1 (ccb_head.lastp),
472
473
474
475
476 SCR_FROM_REG (scntl2),
477 0,
478 SCR_JUMP ^ IFTRUE (MASK (WSR, WSR)),
479 PADDR_A (datai_done_wsr),
480 SCR_JUMP ^ IFTRUE (WHEN (SCR_STATUS)),
481 PADDR_A (status),
482 SCR_JUMP,
483 PADDR_A (dispatch),
484 },{
485
486
487
488
489 SCR_REG_REG (scntl2, SCR_OR, WSR),
490 0,
491
492
493
494
495
496 SCR_INT ^ IFFALSE (WHEN (SCR_MSG_IN)),
497 SIR_SWIDE_OVERRUN,
498 SCR_JUMP ^ IFFALSE (WHEN (SCR_MSG_IN)),
499 PADDR_A (dispatch),
500
501
502
503
504
505
506
507 SCR_MOVE_ABS (1) ^ SCR_MSG_IN,
508 HADDR_1 (msgin[0]),
509 SCR_INT ^ IFFALSE (DATA (M_IGN_RESIDUE)),
510 SIR_SWIDE_OVERRUN,
511 SCR_JUMP ^ IFFALSE (DATA (M_IGN_RESIDUE)),
512 PADDR_A (msg_in2),
513
514
515
516
517 SCR_CLR (SCR_ACK),
518 0,
519 SCR_MOVE_ABS (1) ^ SCR_MSG_IN,
520 HADDR_1 (msgin[1]),
521 SCR_CLR (SCR_ACK),
522 0,
523 SCR_JUMP,
524 PADDR_A (dispatch),
525 },{
526
527
528
529 SCR_COPY (4),
530 RADDR_1 (temp),
531 HADDR_1 (ccb_head.lastp),
532
533
534
535
536 SCR_FROM_REG (scntl2),
537 0,
538 SCR_JUMP ^ IFTRUE (MASK (WSS, WSS)),
539 PADDR_A (datao_done_wss),
540 SCR_JUMP ^ IFTRUE (WHEN (SCR_STATUS)),
541 PADDR_A (status),
542 SCR_JUMP,
543 PADDR_A (dispatch),
544 },{
545
546
547
548 SCR_REG_REG (scntl2, SCR_OR, WSS),
549 0,
550
551
552
553
554 SCR_INT,
555 SIR_SODL_UNDERRUN,
556 SCR_JUMP,
557 PADDR_A (dispatch),
558 },{
559
560
561
562 SCR_COPY (4),
563 HADDR_1 (ccb_head.lastp),
564 RADDR_1 (temp),
565 SCR_RETURN,
566 0,
567 },{
568
569
570
571 SCR_COPY (4),
572 HADDR_1 (ccb_head.lastp),
573 RADDR_1 (temp),
574 SCR_RETURN,
575 0,
576 },{
577
578
579
580
581
582
583 SCR_MOVE_ABS (1) ^ SCR_MSG_IN,
584 HADDR_1 (msgin[0]),
585 },{
586
587
588
589
590 SCR_JUMP ^ IFTRUE (DATA (M_COMPLETE)),
591 PADDR_A (complete),
592 SCR_JUMP ^ IFTRUE (DATA (M_DISCONNECT)),
593 PADDR_A (disconnect),
594 SCR_JUMP ^ IFTRUE (DATA (M_SAVE_DP)),
595 PADDR_A (save_dp),
596 SCR_JUMP ^ IFTRUE (DATA (M_RESTORE_DP)),
597 PADDR_A (restore_dp),
598
599
600
601
602
603 SCR_JUMP,
604 PADDR_B (msg_in_etc),
605 },{
606
607
608
609 SCR_MOVE_ABS (1) ^ SCR_STATUS,
610 HADDR_1 (scratch),
611 #ifdef SYM_CONF_IARB_SUPPORT
612
613
614
615
616
617 SCR_JUMPR ^ IFTRUE (DATA (S_GOOD)),
618 8,
619 SCR_REG_REG (scntl1, SCR_AND, ~IARB),
620 0,
621 #endif
622
623
624
625
626 SCR_TO_REG (SS_REG),
627 0,
628 SCR_LOAD_REG (HS_REG, HS_COMPLETE),
629 0,
630
631
632
633
634 SCR_JUMP ^ IFTRUE (WHEN (SCR_MSG_IN)),
635 PADDR_A (msg_in),
636 SCR_JUMP,
637 PADDR_A (dispatch),
638 },{
639
640
641
642
643
644
645
646
647
648 SCR_REG_REG (scntl2, SCR_AND, 0x7f),
649 0,
650
651
652
653 SCR_CLR (SCR_ACK|SCR_ATN),
654 0,
655
656
657
658 SCR_WAIT_DISC,
659 0,
660 },{
661
662
663
664 SCR_COPY (4),
665 RADDR_1 (scr0),
666 HADDR_1 (ccb_head.status),
667
668
669
670
671 SCR_COPY (4),
672 RADDR_1 (dsa),
673 PADDR_A (_sms_a40),
674 SCR_COPY (sizeof(struct sym_ccbh)),
675 HADDR_1 (ccb_head),
676 },{
677 0,
678
679
680
681
682
683
684
685
686 SCR_COPY (4),
687 HADDR_1 (ccb_head.status),
688 RADDR_1 (scr0),
689
690
691
692
693 SCR_FROM_REG (SS_REG),
694 0,
695 SCR_CALL ^ IFFALSE (DATA (S_GOOD)),
696 PADDR_B (bad_status),
697
698
699
700
701
702 SCR_FROM_REG (HF_REG),
703 0,
704 SCR_JUMP ^ IFFALSE (MASK (0 ,(HF_SENSE|HF_EXT_ERR))),
705 PADDR_A (complete_error),
706 },{
707
708
709
710
711
712
713
714 SCR_COPY (4),
715 PADDR_B (done_pos),
716 PADDR_A (_sms_a50),
717 SCR_COPY (4),
718 RADDR_1 (dsa),
719 },{
720 0,
721 SCR_COPY (4),
722 PADDR_B (done_pos),
723 PADDR_A (_sms_a60),
724
725
726
727
728
729
730
731 SCR_COPY (8),
732 },{
733 0,
734 PADDR_B (prev_done),
735 },{
736 SCR_INT_FLY,
737 0,
738 SCR_JUMP,
739 PADDR_A (start),
740 },{
741 SCR_COPY (4),
742 PADDR_B (startpos),
743 RADDR_1 (scratcha),
744 SCR_INT,
745 SIR_COMPLETE_ERROR,
746 },{
747
748
749
750
751 SCR_CLR (SCR_ACK),
752 0,
753
754
755
756
757
758
759 SCR_REG_REG (HF_REG, SCR_OR, HF_DP_SAVED),
760 0,
761
762
763
764
765 SCR_COPY (4),
766 HADDR_1 (ccb_head.lastp),
767 HADDR_1 (ccb_head.savep),
768
769
770
771
772 SCR_JUMP ^ IFTRUE (WHEN (SCR_MSG_IN)),
773 PADDR_A (msg_in),
774 SCR_JUMP,
775 PADDR_A (dispatch),
776 },{
777
778
779
780
781 SCR_CLR (SCR_ACK),
782 0,
783
784
785
786 SCR_COPY (4),
787 HADDR_1 (ccb_head.savep),
788 HADDR_1 (ccb_head.lastp),
789 SCR_JUMP,
790 PADDR_A (dispatch),
791 },{
792
793
794
795
796
797
798 SCR_REG_REG (scntl2, SCR_AND, 0x7f),
799 0,
800 SCR_CLR (SCR_ACK|SCR_ATN),
801 0,
802
803
804
805 SCR_WAIT_DISC,
806 0,
807
808
809
810 SCR_LOAD_REG (HS_REG, HS_DISCONNECT),
811 0,
812
813
814
815 SCR_COPY (4),
816 RADDR_1 (scr0),
817 HADDR_1 (ccb_head.status),
818 },{
819
820
821
822
823 SCR_COPY (4),
824 RADDR_1 (dsa),
825 PADDR_A (_sms_a65),
826 SCR_COPY (sizeof(struct sym_ccbh)),
827 HADDR_1 (ccb_head),
828 },{
829 0,
830 SCR_JUMP,
831 PADDR_A (start),
832 },{
833
834
835
836
837
838
839 SCR_REG_REG (gpreg, SCR_OR, 0x01),
840 0,
841 #ifdef SYM_CONF_IARB_SUPPORT
842 SCR_JUMPR,
843 8,
844 #endif
845 },{
846 #ifdef SYM_CONF_IARB_SUPPORT
847
848
849
850
851
852 SCR_REG_REG (scntl1, SCR_OR, IARB),
853 0,
854 #endif
855
856
857
858
859
860
861 SCR_LOAD_REG (dsa, 0xff),
862 0,
863 SCR_COPY (4),
864 RADDR_1 (scratcha),
865 PADDR_B (startpos),
866 },{
867 #ifdef SYM_CONF_TARGET_ROLE_SUPPORT
868
869
870
871 SCR_CLR (SCR_TRG),
872 0,
873 #endif
874
875
876
877 SCR_WAIT_RESEL,
878 PADDR_A(start),
879 },{
880
881
882
883
884
885 SCR_REG_REG (gpreg, SCR_AND, 0xfe),
886 0,
887
888
889
890 SCR_REG_SFBR (ssid, SCR_AND, 0x8F),
891 0,
892 SCR_TO_REG (sdid),
893 0,
894
895
896
897 SCR_COPY (4),
898 PADDR_B (targtbl),
899 RADDR_1 (dsa),
900 SCR_SFBR_REG (dsa, SCR_SHL, 0),
901 0,
902 SCR_REG_REG (dsa, SCR_SHL, 0),
903 0,
904 SCR_REG_REG (dsa, SCR_AND, 0x3c),
905 0,
906 SCR_COPY (4),
907 RADDR_1 (dsa),
908 PADDR_A (_sms_a70),
909 SCR_COPY (4),
910 },{
911 0,
912 RADDR_1 (dsa),
913
914
915
916
917 SCR_COPY (4),
918 RADDR_1 (dsa),
919 PADDR_A (_sms_a80),
920 SCR_COPY (sizeof(struct sym_tcbh)),
921 },{
922 0,
923 HADDR_1 (tcb_head),
924
925
926
927
928 SCR_INT ^ IFFALSE (WHEN (SCR_MSG_IN)),
929 SIR_RESEL_NO_MSG_IN,
930 },{
931
932
933
934 SCR_COPY (1),
935 HADDR_1 (tcb_head.wval),
936 RADDR_1 (scntl3),
937 SCR_COPY (1),
938 HADDR_1 (tcb_head.sval),
939 RADDR_1 (sxfer),
940
941
942
943 SCR_MOVE_ABS (1) ^ SCR_MSG_IN,
944 HADDR_1 (msgin),
945
946
947
948
949 SCR_JUMP ^ IFTRUE (MASK (0x80, 0xbf)),
950 PADDR_A (resel_lun0),
951
952
953
954
955 SCR_INT ^ IFFALSE (MASK (0x80, 0x80)),
956 SIR_RESEL_NO_IDENTIFY,
957
958
959
960
961 SCR_COPY (4),
962 HADDR_1 (tcb_head.luntbl_sa),
963 RADDR_1 (dsa),
964 SCR_SFBR_REG (dsa, SCR_SHL, 0),
965 0,
966 SCR_REG_REG (dsa, SCR_SHL, 0),
967 0,
968 SCR_REG_REG (dsa, SCR_AND, 0xfc),
969 0,
970 SCR_COPY (4),
971 RADDR_1 (dsa),
972 PADDR_A (_sms_a90),
973 SCR_COPY (4),
974 },{
975 0,
976 RADDR_1 (dsa),
977 SCR_JUMPR,
978 12,
979 },{
980
981
982
983 SCR_COPY (4),
984 HADDR_1 (tcb_head.lun0_sa),
985 RADDR_1 (dsa),
986
987
988
989
990 SCR_COPY (4),
991 RADDR_1 (dsa),
992 PADDR_A (_sms_a100),
993 SCR_COPY (4),
994 },{
995 0,
996 RADDR_1 (temp),
997 SCR_RETURN,
998 0,
999
1000 },{
1001
1002
1003
1004 SCR_CLR (SCR_ACK),
1005 0,
1006
1007
1008
1009
1010
1011
1012 SCR_MOVE_ABS (2) ^ SCR_MSG_IN,
1013 HADDR_1 (msgin),
1014
1015
1016
1017
1018 SCR_COPY (4),
1019 RADDR_1 (dsa),
1020 PADDR_A (_sms_a110),
1021 SCR_COPY (sizeof(struct sym_lcbh)),
1022 },{
1023 0,
1024 HADDR_1 (lcb_head),
1025
1026
1027
1028
1029 SCR_COPY (4),
1030 HADDR_1 (lcb_head.itlq_tbl_sa),
1031 RADDR_1 (dsa),
1032
1033
1034
1035
1036 SCR_REG_SFBR (sidl, SCR_SHL, 0),
1037 0,
1038 #if SYM_CONF_MAX_TASK*4 > 512
1039 SCR_JUMPR ^ IFFALSE (CARRYSET),
1040 8,
1041 SCR_REG_REG (dsa1, SCR_OR, 2),
1042 0,
1043 SCR_REG_REG (sfbr, SCR_SHL, 0),
1044 0,
1045 SCR_JUMPR ^ IFFALSE (CARRYSET),
1046 8,
1047 SCR_REG_REG (dsa1, SCR_OR, 1),
1048 0,
1049 #elif SYM_CONF_MAX_TASK*4 > 256
1050 SCR_JUMPR ^ IFFALSE (CARRYSET),
1051 8,
1052 SCR_REG_REG (dsa1, SCR_OR, 1),
1053 0,
1054 #endif
1055
1056
1057
1058
1059 SCR_SFBR_REG (dsa, SCR_AND, 0xfc),
1060 0,
1061 SCR_COPY (4),
1062 RADDR_1 (dsa),
1063 PADDR_A (_sms_a120),
1064 SCR_COPY (4),
1065 },{
1066 0,
1067 RADDR_1 (dsa),
1068 },{
1069 SCR_COPY (4),
1070 RADDR_1 (dsa),
1071 PADDR_A (_sms_a130),
1072
1073
1074
1075
1076
1077
1078 SCR_COPY (8),
1079 },{
1080 0,
1081 PADDR_B (scratch),
1082 SCR_COPY (4),
1083 PADDR_B (scratch1),
1084 RADDR_1 (temp),
1085 SCR_RETURN,
1086 0,
1087
1088 },{
1089
1090
1091
1092 SCR_CLR (SCR_ACK),
1093 0,
1094 },{
1095
1096
1097
1098
1099 SCR_COPY (4),
1100 RADDR_1 (dsa),
1101 PADDR_A (_sms_a140),
1102 SCR_COPY (sizeof(struct sym_ccbh)),
1103 },{
1104 0,
1105 HADDR_1 (ccb_head),
1106
1107
1108
1109 SCR_COPY (4),
1110 HADDR_1 (ccb_head.status),
1111 RADDR_1 (scr0),
1112
1113
1114
1115 SCR_JUMP,
1116 PADDR_A (dispatch),
1117 },{
1118
1119
1120
1121
1122 SCR_COPY (4),
1123 RADDR_1 (dsa),
1124 PADDR_A (_sms_a145),
1125 SCR_COPY (sizeof(struct sym_lcbh)),
1126 },{
1127 0,
1128 HADDR_1 (lcb_head),
1129
1130
1131
1132 SCR_COPY (4),
1133 HADDR_1 (lcb_head.itl_task_sa),
1134 RADDR_1 (dsa),
1135 SCR_JUMP,
1136 PADDR_A (resel_go),
1137 },{
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148 0
1149 },{
1150 SCR_CALL,
1151 PADDR_A (datai_done),
1152 SCR_JUMP,
1153 PADDR_B (data_ovrun),
1154 },{
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165 0
1166 },{
1167 SCR_CALL,
1168 PADDR_A (datao_done),
1169 SCR_JUMP,
1170 PADDR_B (data_ovrun),
1171 },{
1172
1173
1174
1175
1176 SCR_FROM_REG (HF_REG),
1177 0,
1178
1179
1180
1181 SCR_JUMP ^ IFFALSE (WHEN (SCR_DATA_IN)),
1182 PADDR_A (pm0_data_out),
1183
1184
1185
1186
1187 SCR_JUMP ^ IFFALSE (MASK (HF_DATA_IN, HF_DATA_IN)),
1188 PADDR_B (data_ovrun),
1189
1190
1191
1192
1193 SCR_REG_REG (HF_REG, SCR_OR, HF_IN_PM0),
1194 0,
1195
1196
1197
1198 SCR_CHMOV_TBL ^ SCR_DATA_IN,
1199 offsetof (struct sym_ccb, phys.pm0.sg),
1200 SCR_JUMP,
1201 PADDR_A (pm0_data_end),
1202 },{
1203
1204
1205
1206
1207 SCR_JUMP ^ IFTRUE (MASK (HF_DATA_IN, HF_DATA_IN)),
1208 PADDR_B (data_ovrun),
1209
1210
1211
1212
1213 SCR_REG_REG (HF_REG, SCR_OR, HF_IN_PM0),
1214 0,
1215
1216
1217
1218 SCR_CHMOV_TBL ^ SCR_DATA_OUT,
1219 offsetof (struct sym_ccb, phys.pm0.sg),
1220 },{
1221
1222
1223
1224
1225 SCR_REG_REG (HF_REG, SCR_AND, (~HF_IN_PM0)),
1226 0,
1227
1228
1229
1230
1231
1232 SCR_COPY (4),
1233 RADDR_1 (dsa),
1234 RADDR_1 (scratcha),
1235 SCR_REG_REG (scratcha, SCR_ADD, offsetof (struct sym_ccb,phys.pm0.ret)),
1236 0,
1237 },{
1238 SCR_COPY (4),
1239 RADDR_1 (scratcha),
1240 PADDR_A (_sms_a150),
1241 SCR_COPY (4),
1242 },{
1243 0,
1244 RADDR_1 (temp),
1245 SCR_RETURN,
1246 0,
1247 },{
1248
1249
1250
1251
1252 SCR_FROM_REG (HF_REG),
1253 0,
1254
1255
1256
1257 SCR_JUMP ^ IFFALSE (WHEN (SCR_DATA_IN)),
1258 PADDR_A (pm1_data_out),
1259
1260
1261
1262
1263 SCR_JUMP ^ IFFALSE (MASK (HF_DATA_IN, HF_DATA_IN)),
1264 PADDR_B (data_ovrun),
1265
1266
1267
1268
1269 SCR_REG_REG (HF_REG, SCR_OR, HF_IN_PM1),
1270 0,
1271
1272
1273
1274 SCR_CHMOV_TBL ^ SCR_DATA_IN,
1275 offsetof (struct sym_ccb, phys.pm1.sg),
1276 SCR_JUMP,
1277 PADDR_A (pm1_data_end),
1278 },{
1279
1280
1281
1282
1283 SCR_JUMP ^ IFTRUE (MASK (HF_DATA_IN, HF_DATA_IN)),
1284 PADDR_B (data_ovrun),
1285
1286
1287
1288
1289 SCR_REG_REG (HF_REG, SCR_OR, HF_IN_PM1),
1290 0,
1291
1292
1293
1294 SCR_CHMOV_TBL ^ SCR_DATA_OUT,
1295 offsetof (struct sym_ccb, phys.pm1.sg),
1296 },{
1297
1298
1299
1300
1301 SCR_REG_REG (HF_REG, SCR_AND, (~HF_IN_PM1)),
1302 0,
1303
1304
1305
1306
1307
1308 SCR_COPY (4),
1309 RADDR_1 (dsa),
1310 RADDR_1 (scratcha),
1311 SCR_REG_REG (scratcha, SCR_ADD, offsetof (struct sym_ccb,phys.pm1.ret)),
1312 0,
1313 SCR_JUMP,
1314 PADDR_A (pm_data_end),
1315 }
1316 };
1317
1318 static struct SYM_FWB_SCR SYM_FWB_SCR = {
1319 {
1320 SCR_JUMP,
1321 PADDR_B (data_ovrun),
1322 },{
1323
1324
1325
1326
1327
1328
1329
1330
1331 #ifdef SYM_CONF_TARGET_ROLE_SUPPORT
1332
1333
1334
1335 SCR_CLR (SCR_TRG),
1336 0,
1337 #endif
1338
1339
1340
1341 SCR_SEL_TBL_ATN ^ offsetof (struct sym_hcb, abrt_sel),
1342 PADDR_A (reselect),
1343
1344
1345
1346
1347 SCR_JUMPR ^ IFFALSE (WHEN (SCR_MSG_OUT)),
1348 -8,
1349
1350
1351
1352 SCR_INT,
1353 SIR_TARGET_SELECTED,
1354
1355
1356
1357
1358
1359
1360 SCR_REG_REG (scntl2, SCR_AND, 0x7f),
1361 0,
1362 SCR_MOVE_TBL ^ SCR_MSG_OUT,
1363 offsetof (struct sym_hcb, abrt_tbl),
1364 SCR_CLR (SCR_ACK|SCR_ATN),
1365 0,
1366 SCR_WAIT_DISC,
1367 0,
1368
1369
1370
1371 SCR_INT,
1372 SIR_ABORT_SENT,
1373 },{
1374
1375
1376
1377 SCR_JUMP,
1378 PADDR_A (start),
1379 },{
1380
1381
1382
1383
1384 SCR_JUMP ^ IFTRUE (DATA (M_EXTENDED)),
1385 PADDR_B (msg_extended),
1386
1387
1388
1389
1390 SCR_JUMP ^ IFTRUE (MASK (0x00, 0xf0)),
1391 PADDR_B (msg_received),
1392 SCR_JUMP ^ IFTRUE (MASK (0x10, 0xf0)),
1393 PADDR_B (msg_received),
1394
1395
1396
1397
1398 SCR_JUMP ^ IFFALSE (MASK (0x20, 0xf0)),
1399 PADDR_B (msg_weird_seen),
1400 SCR_CLR (SCR_ACK),
1401 0,
1402 SCR_MOVE_ABS (1) ^ SCR_MSG_IN,
1403 HADDR_1 (msgin[1]),
1404 },{
1405 SCR_COPY (4),
1406 HADDR_1 (scratch),
1407 RADDR_1 (scratcha),
1408 SCR_INT,
1409 SIR_MSG_RECEIVED,
1410 },{
1411 SCR_COPY (4),
1412 HADDR_1 (scratch),
1413 RADDR_1 (scratcha),
1414 SCR_INT,
1415 SIR_MSG_WEIRD,
1416 },{
1417
1418
1419
1420
1421 SCR_CLR (SCR_ACK),
1422 0,
1423 SCR_MOVE_ABS (1) ^ SCR_MSG_IN,
1424 HADDR_1 (msgin[1]),
1425
1426
1427
1428
1429 SCR_JUMP ^ IFTRUE (DATA (0)),
1430 PADDR_B (msg_weird_seen),
1431 SCR_TO_REG (scratcha),
1432 0,
1433 SCR_REG_REG (sfbr, SCR_ADD, (256-8)),
1434 0,
1435 SCR_JUMP ^ IFTRUE (CARRYSET),
1436 PADDR_B (msg_weird_seen),
1437
1438
1439
1440
1441
1442 SCR_COPY (1),
1443 RADDR_1 (scratcha),
1444 PADDR_B (_sms_b10),
1445 SCR_CLR (SCR_ACK),
1446 0,
1447 },{
1448 SCR_MOVE_ABS (0) ^ SCR_MSG_IN,
1449 HADDR_1 (msgin[2]),
1450 SCR_JUMP,
1451 PADDR_B (msg_received),
1452 },{
1453
1454
1455
1456 SCR_INT,
1457 SIR_REJECT_TO_SEND,
1458 SCR_SET (SCR_ATN),
1459 0,
1460 SCR_JUMP,
1461 PADDR_A (clrack),
1462 },{
1463
1464
1465
1466
1467 SCR_INT,
1468 SIR_REJECT_TO_SEND,
1469 SCR_SET (SCR_ATN),
1470 0,
1471 },{
1472 SCR_CLR (SCR_ACK),
1473 0,
1474 SCR_JUMP ^ IFFALSE (WHEN (SCR_MSG_IN)),
1475 PADDR_A (dispatch),
1476 SCR_MOVE_ABS (1) ^ SCR_MSG_IN,
1477 HADDR_1 (scratch),
1478 SCR_JUMP,
1479 PADDR_B (msg_weird1),
1480 },{
1481
1482
1483
1484 SCR_SET (SCR_ATN),
1485 0,
1486 SCR_CLR (SCR_ACK),
1487 0,
1488 SCR_JUMP ^ IFFALSE (WHEN (SCR_MSG_OUT)),
1489 PADDR_B (nego_bad_phase),
1490 },{
1491
1492
1493
1494 SCR_MOVE_ABS (4) ^ SCR_MSG_OUT,
1495 HADDR_1 (msgout),
1496 SCR_JUMP,
1497 PADDR_B (msg_out_done),
1498 },{
1499
1500
1501
1502 SCR_SET (SCR_ATN),
1503 0,
1504 SCR_CLR (SCR_ACK),
1505 0,
1506 SCR_JUMP ^ IFFALSE (WHEN (SCR_MSG_OUT)),
1507 PADDR_B (nego_bad_phase),
1508 },{
1509
1510
1511
1512 SCR_MOVE_ABS (5) ^ SCR_MSG_OUT,
1513 HADDR_1 (msgout),
1514 SCR_JUMP,
1515 PADDR_B (msg_out_done),
1516 },{
1517
1518
1519
1520 SCR_SET (SCR_ATN),
1521 0,
1522 SCR_CLR (SCR_ACK),
1523 0,
1524 SCR_JUMP ^ IFFALSE (WHEN (SCR_MSG_OUT)),
1525 PADDR_B (nego_bad_phase),
1526 },{
1527
1528
1529
1530 SCR_MOVE_ABS (8) ^ SCR_MSG_OUT,
1531 HADDR_1 (msgout),
1532 SCR_JUMP,
1533 PADDR_B (msg_out_done),
1534 },{
1535 SCR_INT,
1536 SIR_NEGO_PROTO,
1537 SCR_JUMP,
1538 PADDR_A (dispatch),
1539 },{
1540
1541
1542
1543
1544
1545 SCR_MOVE_ABS (1) ^ SCR_MSG_OUT,
1546 HADDR_1 (msgout),
1547
1548
1549
1550
1551 SCR_JUMP ^ IFTRUE (WHEN (SCR_MSG_OUT)),
1552 PADDR_B (msg_out),
1553 },{
1554
1555
1556
1557
1558 SCR_INT,
1559 SIR_MSG_OUT_DONE,
1560
1561
1562
1563 SCR_JUMP,
1564 PADDR_A (dispatch),
1565 },{
1566
1567
1568
1569
1570 SCR_COPY (4),
1571 PADDR_B (zero),
1572 RADDR_1 (scratcha),
1573 },{
1574
1575
1576
1577
1578
1579 SCR_JUMPR ^ IFFALSE (WHEN (SCR_DATA_OUT)),
1580 16,
1581 SCR_CHMOV_ABS (1) ^ SCR_DATA_OUT,
1582 HADDR_1 (scratch),
1583 SCR_JUMP,
1584 PADDR_B (data_ovrun2),
1585
1586
1587
1588
1589 SCR_FROM_REG (scntl2),
1590 0,
1591 SCR_JUMPR ^ IFFALSE (MASK (WSR, WSR)),
1592 16,
1593 SCR_REG_REG (scntl2, SCR_OR, WSR),
1594 0,
1595 SCR_JUMP,
1596 PADDR_B (data_ovrun2),
1597
1598
1599
1600
1601
1602
1603 SCR_JUMPR ^ IFTRUE (WHEN (SCR_DATA_IN)),
1604 16,
1605 SCR_INT,
1606 SIR_DATA_OVERRUN,
1607 SCR_JUMP,
1608 PADDR_A (dispatch),
1609 SCR_CHMOV_ABS (1) ^ SCR_DATA_IN,
1610 HADDR_1 (scratch),
1611 },{
1612
1613
1614
1615
1616
1617 SCR_REG_REG (scratcha, SCR_ADD, 0x01),
1618 0,
1619 SCR_REG_REG (scratcha1, SCR_ADDC, 0),
1620 0,
1621 SCR_REG_REG (scratcha2, SCR_ADDC, 0),
1622 0,
1623
1624
1625
1626 SCR_JUMP,
1627 PADDR_B (data_ovrun1),
1628 },{
1629 SCR_SET (SCR_ATN),
1630 0,
1631 SCR_CLR (SCR_ACK),
1632 0,
1633
1634
1635
1636
1637 SCR_REG_REG (scntl2, SCR_AND, 0x7f),
1638 0,
1639 SCR_MOVE_ABS (1) ^ SCR_MSG_OUT,
1640 HADDR_1 (msgout),
1641 SCR_CLR (SCR_ACK|SCR_ATN),
1642 0,
1643 SCR_WAIT_DISC,
1644 0,
1645 SCR_INT,
1646 SIR_RESEL_ABORTED,
1647 SCR_JUMP,
1648 PADDR_A (start),
1649 },{
1650
1651
1652
1653
1654
1655
1656 SCR_SET (SCR_ATN),
1657 0,
1658 SCR_JUMP,
1659 PADDR_A (send_ident),
1660 },{
1661 SCR_CLR (SCR_ATN),
1662 0,
1663 SCR_JUMP,
1664 PADDR_A (select2),
1665 },{
1666 SCR_SET (SCR_ATN),
1667 0,
1668 SCR_JUMP,
1669 PADDR_A (select2),
1670 },{
1671 SCR_CHMOV_TBL ^ SCR_DATA_IN,
1672 offsetof (struct sym_dsb, sense),
1673 SCR_CALL,
1674 PADDR_A (datai_done),
1675 SCR_JUMP,
1676 PADDR_B (data_ovrun),
1677 },{
1678
1679
1680
1681
1682
1683 SCR_INT,
1684 SIR_RESEL_BAD_LUN,
1685 SCR_JUMP,
1686 PADDR_B (abort_resel),
1687 },{
1688
1689
1690
1691
1692
1693 SCR_INT,
1694 SIR_RESEL_BAD_I_T_L,
1695 SCR_JUMP,
1696 PADDR_B (abort_resel),
1697 },{
1698
1699
1700
1701
1702
1703 SCR_INT,
1704 SIR_RESEL_BAD_I_T_L_Q,
1705 SCR_JUMP,
1706 PADDR_B (abort_resel),
1707 },{
1708
1709
1710
1711
1712
1713
1714 SCR_COPY (4),
1715 PADDR_B (startpos),
1716 RADDR_1 (scratcha),
1717 SCR_INT ^ IFFALSE (DATA (S_COND_MET)),
1718 SIR_BAD_SCSI_STATUS,
1719 SCR_RETURN,
1720 0,
1721 },{
1722
1723
1724
1725
1726 SCR_CHMOV_TBL ^ SCR_DATA_IN,
1727 offsetof (struct sym_ccb, phys.wresid),
1728 SCR_JUMP,
1729 PADDR_A (dispatch),
1730
1731 },{
1732 SCR_DATA_ZERO,
1733 },{
1734 SCR_DATA_ZERO,
1735 },{
1736 SCR_DATA_ZERO,
1737 },{
1738 SCR_DATA_ZERO,
1739 },{
1740 SCR_DATA_ZERO,
1741 },{
1742 SCR_DATA_ZERO,
1743 },{
1744 SCR_DATA_ZERO,
1745 },{
1746 SCR_DATA_ZERO,
1747 }
1748 };
1749
1750 static struct SYM_FWZ_SCR SYM_FWZ_SCR = {
1751 {
1752
1753
1754
1755 SCR_COPY (4),
1756 HADDR_1 (scratch),
1757 RADDR_1 (scratcha),
1758
1759
1760
1761 SCR_COPY (4),
1762 RADDR_1 (temp),
1763 HADDR_1 (scratch),
1764
1765
1766
1767 SCR_COPY (4),
1768 HADDR_1 (scratch),
1769 RADDR_1 (temp),
1770 },{
1771
1772
1773
1774 SCR_INT,
1775 99,
1776 }
1777 };