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