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