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 #ifndef NCR53c7x0_H
40 #define NCR53c7x0_H
41
42
43
44
45
46
47
48
49 #ifdef HOSTS_C
50 #include <linux/scsicam.h>
51 extern int NCR53c7xx_abort(Scsi_Cmnd *);
52 extern int NCR53c7xx_detect(Scsi_Host_Template *tpnt);
53 extern const char *NCR53c7xx_info(void);
54 extern int NCR53c7xx_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
55 extern int NCR53c7xx_reset(Scsi_Cmnd *);
56
57 #define NCR53c7xx {NULL, "NCR53c{7,8}xx (rel 3)", NCR53c7xx_detect, \
58 NULL, NCR53c7xx_info, \
59 NULL, NCR53c7xx_queue_command, NCR53c7xx_abort, NCR53c7xx_reset,\
60 NULL, scsicam_bios_param, \
61 1, 7, 255 , \
62 1 , 0, 0, DISABLE_CLUSTERING}
63 #else
64
65
66
67
68 #define SCNTL0_REG 0x00
69 #define SCNTL0_ARB1 0x80
70 #define SCNTL0_ARB2 0x40
71 #define SCNTL0_STRT 0x20
72 #define SCNTL0_WATN 0x10
73 #define SCNTL0_EPC 0x08
74
75 #define SCNTL0_EPG_700 0x04
76 #define SCNTL0_AAP 0x02
77 #define SCNTL0_TRG 0x01
78
79
80
81 #define SCNTL1_REG 0x01
82 #define SCNTL1_EXC 0x80
83 #define SCNTL1_ADB 0x40
84 #define SCNTL1_ESR_700 0x20
85
86 #define SCNTL1_DHP_800 0x20
87
88 #define SCNTL1_CON 0x10
89 #define SCNTL1_RST 0x08
90 #define SCNTL1_AESP 0x04
91 #define SCNTL1_SND_700 0x02
92 #define SCNTL1_IARB_800 0x02
93
94
95 #define SCNTL1_RCV_700 0x01
96 #define SCNTL1_SST_800 0x01
97
98
99
100 #define SCNTL2_REG_800 0x02
101 #define SCNTL2_800_SDU 0x80
102
103
104
105 #define SCNTL3_REG_800 0x03
106 #define SCNTL3_800_SCF_SHIFT 4
107 #define SCNTL3_800_SCF_MASK 0x70
108 #define SCNTL3_800_SCF2 0x40
109 #define SCNTL3_800_SCF1 0x20
110 #define SCNTL3_800_SCF0 0x10
111
112
113
114
115 #define SCNTL3_800_CCF_SHIFT 0
116 #define SCNTL3_800_CCF_MASK 0x07
117 #define SCNTL3_800_CCF2 0x04
118 #define SCNTL3_800_CCF1 0x02
119 #define SCNTL3_800_CCF0 0x01
120
121
122
123
124
125
126
127
128 #define SDID_REG_700 0x02
129 #define SDID_REG_800 0x06
130
131 #define GP_REG_800 0x07
132 #define GP_800_IO1 0x02
133 #define GP_800_IO2 0x01
134
135
136
137 #define SIEN_REG_700 0x03
138 #define SIEN0_REG_800 0x40
139 #define SIEN_MA 0x80
140 #define SIEN_FC 0x40
141 #define SIEN_700_STO 0x20
142 #define SIEN_800_SEL 0x20
143 #define SIEN_700_SEL 0x10
144 #define SIEN_800_RESEL 0x10
145 #define SIEN_SGE 0x08
146 #define SIEN_UDC 0x04
147 #define SIEN_RST 0x02
148 #define SIEN_PAR 0x01
149
150
151
152
153
154
155
156
157
158
159 #define SCID_REG 0x04
160
161 #define SCID_800_RRE 0x40
162 #define SCID_800_SRE 0x20
163
164 #define SCID_800_ENC_MASK 0x07
165
166
167 #define SXFER_REG 0x05
168 #define SXFER_DHP 0x80
169
170 #define SXFER_TP2 0x40
171 #define SXFER_TP1 0x20
172 #define SXFER_TP0 0x10
173 #define SXFER_TP_MASK 0x70
174 #define SXFER_TP_SHIFT 4
175 #define SXFER_TP_4 0x00
176 #define SXFER_TP_5 0x10
177 #define SXFER_TP_6 0x20
178 #define SXFER_TP_7 0x30
179 #define SXFER_TP_8 0x40
180 #define SXFER_TP_9 0x50
181 #define SXFER_TP_10 0x60
182 #define SXFER_TP_11 0x70
183
184 #define SXFER_MO3 0x08
185 #define SXFER_MO2 0x04
186 #define SXFER_MO1 0x02
187 #define SXFER_MO0 0x01
188 #define SXFER_MO_MASK 0x0f
189 #define SXFER_MO_SHIFT 0
190
191
192
193
194
195
196
197 #define SODL_REG_700 0x06
198 #define SODL_REG_800 0x54
199
200
201
202
203
204
205
206
207
208
209 #define SBCL_REG 0x0b
210 #define SBCL_REQ 0x80
211 #define SBCL_ACK 0x40
212 #define SBCL_BSY 0x20
213 #define SBCL_SEL 0x10
214 #define SBCL_ATN 0x08
215 #define SBCL_MSG 0x04
216 #define SBCL_CD 0x02
217 #define SBCL_IO 0x01
218 #define SBCL_PHASE_CMDOUT SBCL_CD
219 #define SBCL_PHASE_DATAIN SBCL_IO
220 #define SBCL_PHASE_DATAOUT 0
221 #define SBCL_PHASE_MSGIN (SBCL_CD|SBCL_IO|SBCL_MSG)
222 #define SBCL_PHASE_MSGOUT (SBCL_CD|SBCL_MSG)
223 #define SBCL_PHASE_STATIN (SBCL_CD|SBCL_IO)
224 #define SBCL_PHASE_MASK (SBCL_CD|SBCL_IO|SBCL_MSG)
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242 #define SFBR_REG 0x08
243
244
245
246
247
248
249
250 #define SIDL_REG_700 0x09
251 #define SIDL_REG_800 0x50
252
253
254
255
256
257
258
259 #define SBDL_REG_700 0x0a
260 #define SBDL_REG_800 0x58
261
262 #define SSID_REG_800 0x0a
263 #define SSID_800_VAL 0x80
264 #define SSID_800_ENCID_MASK 0x07
265
266
267
268
269
270
271 #define SOCL_REG 0x0b
272 #define SOCL_REQ 0x80
273 #define SOCL_ACK 0x40
274 #define SOCL_BSY 0x20
275 #define SOCL_SEL 0x10
276 #define SOCL_ATN 0x08
277 #define SOCL_MSG 0x04
278 #define SOCL_CD 0x02
279 #define SOCL_IO 0x01
280
281
282
283
284
285
286
287 #define SBCL_SSCF1 0x02
288 #define SBCL_SSCF0 0x01
289 #define SBCL_SSCF_MASK 0x03
290
291
292
293
294
295
296 #define DSTAT_REG 0x0c
297 #define DSTAT_DFE 0x80
298 #define DSTAT_800_MDPE 0x40
299 #define DSTAT_800_BF 0x20
300 #define DSTAT_ABRT 0x10
301 #define DSTAT_SSI 0x08
302 #define DSTAT_SIR 0x04
303
304
305 #define DSTAT_WTD 0x02
306 #define DSTAT_OPC 0x01
307 #define DSTAT_800_IID 0x01
308
309
310 #define SSTAT0_REG 0x0d
311 #define SIST0_REG_800 0x42
312 #define SSTAT0_MA 0x80
313
314
315 #define SSTAT0_CMP 0x40
316 #define SSTAT0_700_STO 0x20
317 #define SIST0_800_SEL 0x20
318 #define SSTAT0_700_SEL 0x10
319 #define SIST0_800_RSL 0x10
320 #define SSTAT0_SGE 0x08
321 #define SSTAT0_UDC 0x04
322 #define SSTAT0_RST 0x02
323 #define SSTAT0_PAR 0x01
324
325 #define SSTAT1_REG 0x0e
326 #define SSTAT1_ILF 0x80
327 #define SSTAT1_ORF 0x40
328 #define SSTAT1_OLF 0x20
329 #define SSTAT1_AIP 0x10
330 #define SSTAT1_LOA 0x08
331 #define SSTAT1_WOA 0x04
332 #define SSTAT1_RST 0x02
333 #define SSTAT1_SDP 0x01
334
335 #define SSTAT2_REG 0x0f
336 #define SSTAT2_FF3 0x80
337 #define SSTAT2_FF2 0x40
338 #define SSTAT2_FF1 0x20
339 #define SSTAT2_FF0 0x10
340 #define SSTAT2_FF_MASK 0xf0
341
342
343
344
345
346 #define SSTAT2_SDP 0x08
347 #define SSTAT2_MSG 0x04
348 #define SSTAT2_CD 0x02
349 #define SSTAT2_IO 0x01
350
351
352
353 #define SCRATCHA_REG_00 0x10
354
355 #define DSA_REG 0x10
356
357 #define CTEST0_REG_700 0x14
358 #define CTEST0_REG_800 0x18
359
360 #define CTEST0_700_RTRG 0x02
361 #define CTEST0_700_DDIR 0x01
362
363
364
365
366 #define CTEST1_REG_700 0x15
367 #define CTEST1_REG_800 0x19
368 #define CTEST1_FMT3 0x80
369 #define CTEST1_FMT2 0x40
370 #define CTEST1_FMT1 0x20
371 #define CTEST1_FMT0 0x10
372
373 #define CTEST1_FFL3 0x08
374 #define CTEST1_FFL2 0x04
375 #define CTEST1_FFL1 0x02
376 #define CTEST1_FFL0 0x01
377
378 #define CTEST2_REG_700 0x16
379 #define CTEST2_REG_800 0x1a
380
381 #define CTEST2_800_DDIR 0x80
382 #define CTEST2_800_SIGP 0x40
383
384 #define CTEST2_800_CIO 0x20 .
385 #define CTEST2_800_CM 0x10
386
387
388 #define CTEST2_700_SOFF 0x20
389
390
391
392
393
394
395
396 #define CTEST2_700_SFP 0x10
397
398
399
400 #define CTEST2_700_DFP 0x08
401
402
403
404 #define CTEST2_TEOP 0x04
405
406
407
408 #define CTEST2_DREQ 0x02
409
410 #define CTEST2_800_DACK 0x01
411
412
413
414
415
416
417
418
419 #define CTEST3_REG_700 0x17
420
421 #define CTEST3_REG_800 0x1b
422 #define CTEST3_800_V3 0x80
423 #define CTEST3_800_V2 0x40
424 #define CTEST3_800_V1 0x20
425 #define CTEST3_800_V0 0x10
426 #define CTEST3_800_FLF 0x08
427 #define CTEST3_800_CLF 0x04
428 #define CTEST3_800_FM 0x02
429
430
431 #define CTEST4_REG_700 0x18
432 #define CTEST4_REG_800 0x21
433
434 #define CTEST4_800_BDIS 0x80
435 #define CTEST4_ZMOD 0x40
436 #define CTEST4_SZM 0x20
437 #define CTEST4_700_SLBE 0x10
438 #define CTEST4_800_SRTM 0x10
439 #define CTEST4_700_SFWR 0x08
440
441
442
443 #define CTEST4_800_MPEE 0x08
444
445
446
447
448
449
450
451
452 #define CTEST4_FBL2 0x04
453 #define CTEST4_FBL1 0x02
454 #define CTEST4_FBL0 0x01
455 #define CTEST4_FBL_MASK 0x07
456 #define CTEST4_FBL_0 0x04
457 #define CTEST4_FBL_1 0x05
458 #define CTEST4_FBL_2 0x06
459 #define CTEST4_FBL_3 0x07
460 #define CTEST4_800_SAVE (CTEST4_800_BDIS)
461
462
463 #define CTEST5_REG_700 0x19
464 #define CTEST5_REG_800 0x22
465
466
467
468
469
470 #define CTEST5_ADCK 0x80
471
472
473
474
475 #define CTEST5_BBCK 0x40
476
477
478
479
480
481
482
483
484
485 #define CTEST5_700_ROFF 0x20
486
487
488
489
490
491 #define CTEST5_MASR 0x10
492 #define CTEST5_DDIR 0x08
493
494
495
496 #define CTEST5_700_EOP 0x04
497 #define CTEST5_700_DREQ 0x02
498 #define CTEST5_700_DACK 0x01
499
500
501
502
503
504
505 #define CTEST6_REG_700 0x1a
506 #define CTEST6_REG_800 0x23
507
508 #define CTEST7_REG 0x1b
509
510 #define CTEST7_10_CDIS 0x80
511 #define CTEST7_10_SC1 0x40
512 #define CTEST7_10_SC0 0x20
513 #define CTEST7_10_SC_MASK 0x60
514
515 #define CTEST7_0060_FM 0x20
516 #define CTEST7_STD 0x10
517 #define CTEST7_DFP 0x08
518 #define CTEST7_EVP 0x04
519 #define CTEST7_10_TT1 0x02
520 #define CTEST7_00_DC 0x02
521
522 #define CTEST7_DIFF 0x01
523
524 #define CTEST7_SAVE ( CTEST7_EVP | CTEST7_DIFF )
525
526
527 #define TEMP_REG 0x1c
528
529 #define DFIFO_REG 0x20
530
531
532
533
534 #define DFIFO_00_FLF 0x80
535 #define DFIFO_00_CLF 0x40
536 #define DFIFO_BO6 0x40
537 #define DFIFO_BO5 0x20
538 #define DFIFO_BO4 0x10
539 #define DFIFO_BO3 0x08
540 #define DFIFO_BO2 0x04
541 #define DFIFO_BO1 0x02
542 #define DFIFO_BO0 0x01
543 #define DFIFO_10_BO_MASK 0x7f
544 #define DFIFO_00_BO_MASK 0x3f
545
546
547
548
549
550
551 #define ISTAT_REG_700 0x21
552 #define ISTAT_REG_800 0x14
553 #define ISTAT_ABRT 0x80
554
555
556 #define ISTAT_10_SRST 0x40
557 #define ISTAT_10_SIGP 0x20
558
559 #define ISTAT_800_SEM 0x10
560 #define ISTAT_CON 0x08
561 #define ISTAT_800_INTF 0x04
562 #define ISTAT_700_PRE 0x04
563
564
565
566
567 #define ISTAT_SIP 0x02
568
569
570
571 #define ISTAT_DIP 0x01
572
573
574
575
576 #define CTEST8_REG 0x22
577 #define CTEST8_0066_EAS 0x80
578
579
580 #define CTEST8_0066_EFM 0x40
581 #define CTEST8_0066_GRP 0x20
582
583
584
585
586 #define CTEST8_0066_TE 0x10
587
588
589
590
591 #define CTEST8_0066_HSC 0x08
592 #define CTEST8_0066_SRA 0x04
593
594
595
596 #define CTEST8_0066_DAS 0x02
597
598
599 #define CTEST8_0066_LDE 0x01
600
601
602
603
604
605
606
607
608
609 #define CTEST8_10_V3 0x80
610 #define CTEST8_10_V2 0x40
611 #define CTEST8_10_V1 0x20
612 #define CTEST8_10_V0 0x10
613 #define CTEST8_10_V_MASK 0xf0
614 #define CTEST8_10_FLF 0x08
615 #define CTEST8_10_CLF 0x04
616 #define CTEST8_10_FM 0x02
617 #define CTEST8_10_SM 0x01
618
619
620
621
622
623
624
625
626
627
628
629
630 #define CTEST9_REG_00 0x23
631 #define LCRC_REG_10 0x23
632
633
634
635
636
637
638
639
640
641
642 #define DBC_REG 0x24
643
644
645
646
647
648
649 #define DBC_TCI_TRUE (1 << 19)
650 #define DBC_TCI_COMPARE_DATA (1 << 18)
651 #define DBC_TCI_COMPARE_PHASE (1 << 17)
652 #define DBC_TCI_WAIT_FOR_VALID (1 << 16)
653
654 #define DBC_TCI_MASK_MASK 0xff00
655 #define DBC_TCI_MASK_SHIFT 8
656 #define DBC_TCI_DATA_MASK 0xff
657 #define DBC_TCI_DATA_SHIFT 0
658
659 #define DBC_RWRI_IMMEDIATE_MASK 0xff00
660 #define DBC_RWRI_IMMEDIATE_SHIFT 8
661 #define DBC_RWRI_ADDRESS_MASK 0x3f0000
662 #define DBC_RWRI_ADDRESS_SHIFT 16
663
664
665
666
667
668 #define DCMD_REG 0x27
669 #define DCMD_TYPE_MASK 0xc0
670 #define DCMD_TYPE_BMI 0x00
671 #define DCMD_BMI_IO 0x01
672 #define DCMD_BMI_CD 0x02
673 #define DCMD_BMI_MSG 0x04
674
675 #define DCMD_BMI_OP_MASK 0x18
676 #define DCMD_BMI_OP_MOVE_T 0x00
677 #define DCMD_BMI_OP_MOVE_I 0x08
678
679 #define DCMD_BMI_INDIRECT 0x20
680
681 #define DCMD_TYPE_TCI 0x80
682
683 #define DCMD_TCI_IO 0x01
684 #define DCMD_TCI_CD 0x02
685 #define DCMD_TCI_MSG 0x04
686 #define DCMD_TCI_OP_MASK 0x38
687 #define DCMD_TCI_OP_JUMP 0x00
688 #define DCMD_TCI_OP_CALL 0x08
689 #define DCMD_TCI_OP_RETURN 0x10
690 #define DCMD_TCI_OP_INT 0x18
691
692 #define DCMD_TYPE_RWRI 0x40
693
694 #define DCMD_RWRI_OPC_MASK 0x38
695 #define DCMD_RWRI_OPC_WRITE 0x28
696 #define DCMD_RWRI_OPC_READ 0x30
697 #define DCMD_RWRI_OPC_MODIFY 0x38
698
699 #define DCMD_RWRI_OP_MASK 0x07
700 #define DCMD_RWRI_OP_MOVE 0x00
701 #define DCMD_RWRI_OP_SHL 0x01
702 #define DCMD_RWRI_OP_OR 0x02
703 #define DCMD_RWRI_OP_XOR 0x03
704 #define DCMD_RWRI_OP_AND 0x04
705 #define DCMD_RWRI_OP_SHR 0x05
706 #define DCMD_RWRI_OP_ADD 0x06
707 #define DCMD_RWRI_OP_ADDC 0x07
708
709 #define DCMD_TYPE_MMI 0xc0
710
711
712
713 #define DNAD_REG 0x28
714
715 #define DSP_REG 0x2c
716 #define DSPS_REG 0x30
717
718 #define DMODE_REG_00 0x34
719 #define DMODE_00_BL1 0x80
720 #define DMODE_00_BL0 0x40
721 #define DMODE_BL_MASK 0xc0
722
723 #define DMODE_BL_2 0x00
724 #define DMODE_BL_4 0x40
725 #define DMODE_BL_8 0x80
726 #define DMODE_BL_16 0xc0
727
728 #define DMODE_700_BW16 0x20
729 #define DMODE_700_286 0x10
730 #define DMODE_700_IOM 0x08
731 #define DMODE_700_FAM 0x04
732 #define DMODE_700_PIPE 0x02
733
734
735 #define DMODE_MAN 0x01
736
737
738
739
740
741 #define DMODE_700_SAVE ( DMODE_00_BL_MASK | DMODE_00_BW16 | DMODE_00_286 )
742
743
744 #define SCRATCHA_REG_800 0x34
745
746 #define SCRATCB_REG_10 0x34
747
748 #define DMODE_REG_10 0x38
749 #define DMODE_800_SIOM 0x20
750 #define DMODE_800_DIOM 0x10
751 #define DMODE_800_ERL 0x08
752
753
754 #define DIEN_REG 0x39
755
756 #define DIEN_800_MDPE 0x40
757 #define DIEN_800_BF 0x20
758 #define DIEN_ABRT 0x10
759 #define DIEN_SSI 0x08
760 #define DIEN_SIR 0x04
761
762
763
764 #define DIEN_700_WTD 0x02
765 #define DIEN_700_OPC 0x01
766
767
768 #define DIEN_800_IID 0x01
769
770
771
772
773
774 #define DWT_REG 0x3a
775
776
777 #define DCNTL_REG 0x3b
778 #define DCNTL_700_CF1 0x80
779 #define DCNTL_700_CF0 0x40
780 #define DCNTL_700_CF_MASK 0xc0
781
782 #define DCNTL_700_CF_2 0x00
783 #define DCNTL_700_CF_1_5 0x40
784 #define DCNTL_700_CF_1 0x80
785 #define DCNTL_700_CF_3 0xc0
786
787 #define DCNTL_700_S16 0x20
788 #define DCNTL_SSM 0x10
789 #define DCNTL_700_LLM 0x08
790
791 #define DCNTL_800_IRQM 0x08
792 #define DCNTL_STD 0x04
793
794 #define DCNTL_00_RST 0x01
795
796
797
798 #define DCNTL_10_COM 0x01
799
800 #define DCNTL_700_SAVE ( DCNTL_CF_MASK | DCNTL_S16)
801
802
803
804 #define SCRATCHB_REG_00 0x3c
805 #define SCRATCHB_REG_800 0x5c
806
807 #define ADDER_REG_10 0x3c
808
809 #define SIEN1_REG_800 0x41
810 #define SIEN1_800_STO 0x04
811 #define SIEN1_800_GEN 0x02
812 #define SIEN1_800_HTH 0x01
813
814 #define SIST1_REG_800 0x43
815 #define SIST1_800_STO 0x04
816 #define SIST1_800_GEN 0x02
817 #define SIST1_800_HTH 0x01
818
819 #define SLPAR_REG_800 0x44
820
821 #define MACNTL_REG_800 0x46
822 #define MACNTL_800_TYP3 0x80
823 #define MACNTL_800_TYP2 0x40
824 #define MACNTL_800_TYP1 0x20
825 #define MACNTL_800_TYP0 0x10
826 #define MACNTL_800_DWR 0x08
827 #define MACNTL_800_DRD 0x04
828 #define MACNTL_800_PSCPT 0x02
829 #define MACNTL_800_SCPTS 0x01
830
831 #define GPCNTL_REG_800 0x47
832
833
834 #define STIME0_REG_800 0x48
835 #define STIME0_800_HTH_MASK 0xf0
836 #define STIME0_800_HTH_SHIFT 4
837 #define STIME0_800_SEL_MASK 0x0f
838 #define STIME0_800_SEL_SHIFT 0
839
840 #define STIME1_REG_800 0x49
841 #define STIME1_800_GEN_MASK 0x0f
842
843 #define RESPID_REG_800 0x4a
844
845 #define STEST0_REG_800 0x4c
846 #define STEST0_800_SLT 0x08
847 #define STEST0_800_ART 0x04
848 #define STEST0_800_SOZ 0x02
849 #define STEST0_800_SOM 0x01
850
851 #define STEST1_REG_800 0x4d
852 #define STEST1_800_SCLK 0x80
853
854 #define STEST2_REG_800 0x4e
855 #define STEST2_800_SCE 0x80
856 #define STEST2_800_ROF 0x40
857 #define STEST2_800_SLB 0x10
858 #define STEST2_800_SZM 0x08
859 #define STEST2_800_EXT 0x02
860 #define STEST2_800_LOW 0x01
861
862 #define STEST3_REG_800 0x4f
863 #define STEST3_800_TE 0x80
864 #define STEST3_800_STR 0x40
865 #define STEST3_800_HSC 0x20
866 #define STEST3_800_DSI 0x10
867 #define STEST3_800_TTM 0x04
868 #define STEST3_800_CSF 0x02
869 #define STEST3_800_STW 0x01
870
871
872
873
874
875 #define OPTION_PARITY 0x1
876 #define OPTION_TAGGED_QUEUE 0x2
877 #define OPTION_700 0x8
878 #define OPTION_INTFLY 0x10
879 #define OPTION_DEBUG_INTR 0x20
880 #define OPTION_DEBUG_INIT_ONLY 0x40
881
882
883
884 #define OPTION_DEBUG_READ_ONLY 0x80
885
886 #define OPTION_DEBUG_TRACE 0x100
887
888
889 #define OPTION_DEBUG_SINGLE 0x200
890
891 #define OPTION_SYNCHRONOUS 0x400
892 #define OPTION_MEMORY_MAPPED 0x800
893
894 #define OPTION_IO_MAPPED 0x1000
895
896 #define OPTION_DEBUG_PROBE_ONLY 0x2000
897 #define OPTION_DEBUG_TESTS_ONLY 0x4000
898
899 #define OPTION_DEBUG_TEST0 0x08000
900 #define OPTION_DEBUG_TEST1 0x10000
901 #define OPTION_DEBUG_TEST2 0x20000
902
903 #define OPTION_DEBUG_DUMP 0x40000
904 #define OPTION_DEBUG_TARGET_LIMIT 0x80000
905 #define OPTION_DEBUG_NCOMMANDS_LIMIT 0x100000
906 #define OPTION_DEBUG_SCRIPT 0x200000
907 #define OPTION_DEBUG_FIXUP 0x400000
908 #define OPTION_DEBUG_DSA 0x800000
909 #define OPTION_DEBUG_CORRUPTION 0x1000000
910
911 #if !defined(PERM_OPTIONS)
912 #define PERM_OPTIONS 0
913 #endif
914
915 struct NCR53c7x0_synchronous {
916 unsigned long select_indirect;
917 unsigned long script[6];
918
919 unsigned renegotiate:1;
920
921 };
922
923 #define CMD_FLAG_SDTR 1
924
925 #define CMD_FLAG_WDTR 2
926
927 #define CMD_FLAG_DID_SDTR 4
928
929 struct NCR53c7x0_table_indirect {
930 unsigned long count;
931 void *address;
932 };
933
934 struct NCR53c7x0_cmd {
935 void *real;
936 Scsi_Cmnd *cmd;
937
938
939
940
941 int size;
942
943
944 int flags;
945
946 unsigned char select[11];
947
948
949
950
951
952
953 struct NCR53c7x0_cmd *next, *prev;
954
955
956 unsigned long *data_transfer_start;
957 unsigned long *data_transfer_end;
958
959
960 unsigned long residual[8];
961
962
963
964
965
966
967
968 unsigned long dsa[0];
969
970
971 };
972
973 struct NCR53c7x0_break {
974 unsigned long *address, old_instruction[2];
975 struct NCR53c7x0_break *next;
976 unsigned char old_size;
977 };
978
979
980 #define STATE_HALTED 0
981
982
983
984
985
986 #define STATE_WAITING 1
987
988 #define STATE_RUNNING 2
989
990
991
992
993 #define STATE_ABORTING 3
994
995
996
997
998
999
1000
1001
1002
1003 #define SPECIFIC_INT_NOTHING 0
1004 #define SPECIFIC_INT_RESTART 1
1005 #define SPECIFIC_INT_ABORT 2
1006 #define SPECIFIC_INT_PANIC 3
1007 #define SPECIFIC_INT_DONE 4
1008 #define SPECIFIC_INT_BREAK 5
1009
1010 struct NCR53c7x0_hostdata {
1011 int size;
1012
1013 struct Scsi_Host *next;
1014 int board;
1015
1016
1017
1018
1019
1020 int chip;
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035 unsigned char pci_bus, pci_device_fn;
1036 unsigned pci_valid:1;
1037
1038 unsigned long *dsp;
1039
1040
1041
1042 unsigned dsp_changed:1;
1043
1044
1045 unsigned char dstat;
1046 unsigned dstat_valid:1;
1047
1048 unsigned expecting_iid:1;
1049 unsigned expecting_sto:1;
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062 void (* init_fixup)(struct Scsi_Host *host);
1063 void (* init_save_regs)(struct Scsi_Host *host);
1064 void (* dsa_fixup)(struct NCR53c7x0_cmd *cmd);
1065 void (* soft_reset)(struct Scsi_Host *host);
1066 int (* run_tests)(struct Scsi_Host *host);
1067
1068
1069
1070
1071
1072
1073
1074 int (* dstat_sir_intr)(struct Scsi_Host *host, struct NCR53c7x0_cmd *cmd);
1075
1076
1077
1078
1079
1080
1081
1082 long dsa_start;
1083 long dsa_end;
1084 long dsa_next;
1085 long dsa_prev;
1086 long dsa_cmnd;
1087 long dsa_select;
1088 long dsa_msgout;
1089 long dsa_cmdout;
1090 long dsa_dataout;
1091 long dsa_datain;
1092 long dsa_msgin;
1093 long dsa_msgout_other;
1094 long dsa_write_sync;
1095 long dsa_write_resume;
1096 long dsa_jump_resume;
1097 long dsa_check_reselect;
1098 long dsa_status;
1099
1100
1101
1102
1103
1104
1105 long E_accept_message;
1106 long E_dsa_code_template;
1107 long E_dsa_code_template_end;
1108 long E_command_complete;
1109 long E_msg_in;
1110 long E_initiator_abort;
1111 long E_other_transfer;
1112 long E_target_abort;
1113 long E_schedule;
1114 long E_debug_break;
1115 long E_reject_message;
1116 long E_respond_message;
1117 long E_select;
1118 long E_select_msgout;
1119 long E_test_0;
1120 long E_test_1;
1121 long E_test_2;
1122 long E_test_3;
1123 long E_dsa_zero;
1124 long E_dsa_jump_resume;
1125
1126 int options;
1127 long test_completed;
1128 int test_running;
1129 int test_source;
1130 volatile int test_dest;
1131
1132 volatile int state;
1133
1134
1135 unsigned char dmode;
1136
1137
1138
1139 unsigned char istat;
1140
1141
1142
1143
1144 int scsi_clock;
1145
1146
1147
1148
1149
1150 volatile int intrs;
1151 unsigned char saved_dmode;
1152 unsigned char saved_ctest4;
1153 unsigned char saved_ctest7;
1154 unsigned char saved_dcntl;
1155 unsigned char saved_scntl3;
1156
1157 unsigned char this_id_mask;
1158
1159
1160 struct NCR53c7x0_break *breakpoints,
1161 *breakpoint_current;
1162
1163
1164 int debug_size;
1165 volatile int debug_count;
1166 volatile char *debug_buf;
1167 volatile char *debug_write;
1168 volatile char *debug_read;
1169
1170
1171 int debug_print_limit;
1172
1173
1174
1175
1176 unsigned char debug_lun_limit[8];
1177
1178
1179
1180 int debug_count_limit;
1181
1182
1183
1184
1185 volatile unsigned idle:1;
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195 volatile struct NCR53c7x0_synchronous sync[8];
1196
1197 volatile struct NCR53c7x0_cmd *issue_queue;
1198
1199
1200 volatile struct NCR53c7x0_cmd *running_list;
1201
1202
1203 volatile struct NCR53c7x0_cmd *current;
1204
1205
1206
1207 volatile unsigned char busy[8][8];
1208
1209
1210
1211
1212
1213
1214
1215
1216 volatile struct NCR53c7x0_cmd *finished_queue;
1217
1218
1219
1220 volatile unsigned char *issue_dsa_head;
1221
1222
1223
1224
1225
1226 volatile unsigned char *issue_dsa_tail;
1227 volatile unsigned char msg_buf[16];
1228
1229
1230 volatile struct NCR53c7x0_cmd *reconnect_dsa_head;
1231
1232
1233
1234 volatile unsigned char reselected_identify;
1235 volatile unsigned char reselected_tag;
1236
1237 int script_count;
1238 unsigned long script[0];
1239
1240 };
1241
1242 #define IRQ_NONE 255
1243 #define DMA_NONE 255
1244 #define IRQ_AUTO 254
1245 #define DMA_AUTO 254
1246
1247 #define BOARD_GENERIC 0
1248
1249 #define NCR53c7x0_insn_size(insn) \
1250 (((insn) & DCMD_TYPE_MASK) == DCMD_TYPE_MMI ? 3 : 2)
1251
1252
1253 #define NCR53c7x0_local_declare() \
1254 volatile unsigned char *NCR53c7x0_address_memory; \
1255 unsigned short NCR53c7x0_address_io; \
1256 int NCR53c7x0_memory_mapped
1257
1258 #define NCR53c7x0_local_setup(host) \
1259 NCR53c7x0_address_memory = (void *) (host)->base; \
1260 NCR53c7x0_address_io = (unsigned short) (host)->io_port; \
1261 NCR53c7x0_memory_mapped = ((struct NCR53c7x0_hostdata *) \
1262 host->hostdata)-> options & OPTION_MEMORY_MAPPED
1263
1264 #define NCR53c7x0_read8(address) \
1265 (NCR53c7x0_memory_mapped ? \
1266 *( (NCR53c7x0_address_memory) + (address)) : \
1267 inb(NCR53c7x0_address_io + (address)))
1268
1269 #define NCR53c7x0_read16(address) \
1270 (NCR53c7x0_memory_mapped ? \
1271 *((unsigned short *) (NCR53c7x0_address_memory) + (address)) : \
1272 inw(NCR53c7x0_address_io + (address)))
1273
1274 #define NCR53c7x0_read32(address) \
1275 (NCR53c7x0_memory_mapped ? \
1276 *((unsigned long *) (NCR53c7x0_address_memory) + (address)) : \
1277 inl(NCR53c7x0_address_io + (address)))
1278
1279 #define NCR53c7x0_write8(address,value) \
1280 (NCR53c7x0_memory_mapped ? \
1281 *((unsigned char *) (NCR53c7x0_address_memory) + (address)) = \
1282 (value) : \
1283 outb((value), NCR53c7x0_address_io + (address)))
1284
1285 #define NCR53c7x0_write16(address,value) \
1286 (NCR53c7x0_memory_mapped ? \
1287 *((unsigned short *) (NCR53c7x0_address_memory) + (address)) = \
1288 (value) : \
1289 outw((value), NCR53c7x0_address_io + (address)))
1290
1291 #define NCR53c7x0_write32(address,value) \
1292 (NCR53c7x0_memory_mapped ? \
1293 *((unsigned long *) (NCR53c7x0_address_memory) + (address)) = \
1294 (value) : \
1295 outl((value), NCR53c7x0_address_io + (address)))
1296
1297 #define patch_abs_32(script, offset, symbol, value) \
1298 for (i = 0; i < (sizeof (A_##symbol##_used) / sizeof \
1299 (unsigned long)); ++i) { \
1300 (script)[A_##symbol##_used[i] - (offset)] += (value); \
1301 if (hostdata->options & OPTION_DEBUG_FIXUP) \
1302 printk("scsi%d : %s reference %d at 0x%lx in %s is now 0x%lx\n",\
1303 host->host_no, #symbol, i, A_##symbol##_used[i] - \
1304 (offset), #script, (script)[A_##symbol##_used[i] - \
1305 (offset)]); \
1306 }
1307
1308 #define patch_abs_rwri_data(script, offset, symbol, value) \
1309 for (i = 0; i < (sizeof (A_##symbol##_used) / sizeof \
1310 (unsigned long)); ++i) \
1311 (script)[A_##symbol##_used[i] - (offset)] = \
1312 ((script)[A_##symbol##_used[i] - (offset)] & \
1313 ~DBC_RWRI_IMMEDIATE_MASK) | \
1314 (((value) << DBC_RWRI_IMMEDIATE_SHIFT) & \
1315 DBC_RWRI_IMMEDIATE_MASK)
1316
1317 #define patch_dsa_32(dsa, symbol, word, value) \
1318 { \
1319 (dsa)[(hostdata->##symbol - hostdata->dsa_start) / sizeof(long) \
1320 + (word)] = (unsigned long) (value); \
1321 if (hostdata->options & OPTION_DEBUG_DSA) \
1322 printk("scsi : dsa %s symbol %s(%ld) word %d now 0x%lx\n", \
1323 #dsa, #symbol, (long) hostdata->##symbol, \
1324 (int) (word), (long) (value)); \
1325 }
1326
1327
1328
1329 #endif
1330 #endif