1 #ifndef _AHA1542_H
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 #include <linux/types.h>
35
36
37
38 #define STATUS(base) base
39 #define STST 0x80
40 #define DIAGF 0x40
41 #define INIT 0x20
42 #define IDLE 0x10
43 #define CDF 0x08
44 #define DF 0x04
45 #define INVDCMD 0x01
46 #define STATMASK 0xfd
47
48 #define INTRFLAGS(base) (STATUS(base)+2)
49 #define ANYINTR 0x80
50 #define SCRD 0x08
51 #define HACC 0x04
52 #define MBOA 0x02
53 #define MBIF 0x01
54 #define INTRMASK 0x8f
55
56
57 #define CONTROL(base) STATUS(base)
58 #define HRST 0x80
59 #define SRST 0x40
60 #define IRST 0x20
61 #define SCRST 0x10
62
63
64 #define DATA(base) (STATUS(base)+1)
65 #define CMD_NOP 0x00
66 #define CMD_MBINIT 0x01
67 #define CMD_START_SCSI 0x02
68 #define CMD_INQUIRY 0x04
69 #define CMD_EMBOI 0x05
70 #define CMD_BUSON_TIME 0x07
71 #define CMD_BUSOFF_TIME 0x08
72 #define CMD_DMASPEED 0x09
73 #define CMD_RETDEVS 0x0a
74 #define CMD_RETCONF 0x0b
75 #define CMD_RETSETUP 0x0d
76 #define CMD_ECHO 0x1f
77
78 #define CMD_EXTBIOS 0x28
79 #define CMD_MBENABLE 0x29
80
81
82 struct mailbox {
83 unchar status;
84 unchar ccbptr[3];
85 };
86
87
88 struct chain {
89 unchar datalen[3];
90 unchar dataptr[3];
91 };
92
93
94 #define any2scsi(up, p) \
95 (up)[0] = (((unsigned long)(p)) >> 16) ; \
96 (up)[1] = (((unsigned long)(p)) >> 8); \
97 (up)[2] = ((unsigned long)(p));
98
99 #define scsi2int(up) ( (((long)*(up)) << 16) + (((long)(up)[1]) << 8) + ((long)(up)[2]) )
100
101 #define xany2scsi(up, p) \
102 (up)[0] = ((long)(p)) >> 24; \
103 (up)[1] = ((long)(p)) >> 16; \
104 (up)[2] = ((long)(p)) >> 8; \
105 (up)[3] = ((long)(p));
106
107 #define xscsi2int(up) ( (((long)(up)[0]) << 24) + (((long)(up)[1]) << 16) \
108 + (((long)(up)[2]) << 8) + ((long)(up)[3]) )
109
110 #define MAX_CDB 12
111 #define MAX_SENSE 14
112
113 struct ccb {
114 unchar op;
115 unchar idlun;
116
117
118
119 unchar cdblen;
120 unchar rsalen;
121 unchar datalen[3];
122 unchar dataptr[3];
123 unchar linkptr[3];
124 unchar commlinkid;
125 unchar hastat;
126 unchar tarstat;
127 unchar reserved[2];
128 unchar cdb[MAX_CDB+MAX_SENSE];
129
130 };
131
132 int aha1542_detect(Scsi_Host_Template *);
133 int aha1542_command(Scsi_Cmnd *);
134 int aha1542_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
135 int aha1542_abort(Scsi_Cmnd *);
136 int aha1542_reset(Scsi_Cmnd *);
137 int aha1542_biosparam(Disk *, int, int*);
138
139 #define AHA1542_MAILBOXES 8
140 #define AHA1542_SCATTER 16
141 #define AHA1542_CMDLUN 1
142
143 #ifndef NULL
144 #define NULL 0
145 #endif
146
147 #define AHA1542 { NULL, NULL, \
148 "Adaptec 1542", \
149 aha1542_detect, \
150 NULL, \
151 NULL, \
152 aha1542_command, \
153 aha1542_queuecommand, \
154 aha1542_abort, \
155 aha1542_reset, \
156 NULL, \
157 aha1542_biosparam, \
158 AHA1542_MAILBOXES, \
159 7, \
160 AHA1542_SCATTER, \
161 AHA1542_CMDLUN, \
162 0, \
163 1, \
164 ENABLE_CLUSTERING}
165
166 #endif