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