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