1 #ifndef _AHA1740_H
2
3
4
5
6
7
8
9
10
11
12
13 #include <linux/types.h>
14
15
16 #define MINEISA 1
17 #define MAXEISA 8
18
19 #define SLOTBASE(x) ((x << 12)+ 0xc80 )
20 #define BASE (base)
21
22
23 #define HID0 (base + 0x0)
24 #define HID1 (base + 0x1)
25 #define HID2 (base + 0x2)
26 #define HID3 (base + 0x3)
27 #define EBCNTRL (base + 0x4)
28 #define PORTADR (base + 0x40)
29 #define BIOSADR (base + 0x41)
30 #define INTDEF (base + 0x42)
31 #define SCSIDEF (base + 0x43)
32 #define BUSDEF (base + 0x44)
33 #define RESV0 (base + 0x45)
34 #define RESV1 (base + 0x46)
35 #define RESV2 (base + 0x47)
36
37 #define HID_MFG "ADP"
38 #define HID_PRD 0
39 #define HID_REV 2
40 #define EBCNTRL_VALUE 1
41 #define PORTADDR_ENH 0x80
42
43 #define G2INTST (BASE + 0x56)
44 #define G2STAT (BASE + 0x57)
45 #define MBOXIN0 (BASE + 0x58)
46 #define MBOXIN1 (BASE + 0x59)
47 #define MBOXIN2 (BASE + 0x5a)
48 #define MBOXIN3 (BASE + 0x5b)
49 #define G2STAT2 (BASE + 0x5c)
50
51 #define G2INTST_MASK 0xf0
52 #define G2INTST_CCBGOOD 0x10
53 #define G2INTST_CCBRETRY 0x50
54 #define G2INTST_HARDFAIL 0x70
55 #define G2INTST_CMDGOOD 0xa0
56 #define G2INTST_CCBERROR 0xc0
57 #define G2INTST_ASNEVENT 0xd0
58 #define G2INTST_CMDERROR 0xe0
59
60 #define G2STAT_MBXOUT 4
61 #define G2STAT_INTPEND 2
62 #define G2STAT_BUSY 1
63
64 #define G2STAT2_READY 0
65
66
67 #define MBOXOUT0 (BASE + 0x50)
68 #define MBOXOUT1 (BASE + 0x51)
69 #define MBOXOUT2 (BASE + 0x52)
70 #define MBOXOUT3 (BASE + 0x53)
71 #define ATTN (BASE + 0x54)
72 #define G2CNTRL (BASE + 0x55)
73
74 #define ATTN_IMMED 0x10
75 #define ATTN_START 0x40
76 #define ATTN_ABORT 0x50
77
78 #define G2CNTRL_HRST 0x80
79 #define G2CNTRL_IRST 0x40
80 #define G2CNTRL_HRDY 0x20
81
82
83 struct aha1740_chain {
84 ulong dataptr;
85 ulong datalen;
86 };
87
88
89 #define any2scsi(up, p) \
90 (up)[0] = (((unsigned long)(p)) >> 16) ; \
91 (up)[1] = (((unsigned long)(p)) >> 8); \
92 (up)[2] = ((unsigned long)(p));
93
94 #define scsi2int(up) ( (((long)*(up)) << 16) + (((long)(up)[1]) << 8) + ((long)(up)[2]) )
95
96 #define xany2scsi(up, p) \
97 (up)[0] = ((long)(p)) >> 24; \
98 (up)[1] = ((long)(p)) >> 16; \
99 (up)[2] = ((long)(p)) >> 8; \
100 (up)[3] = ((long)(p));
101
102 #define xscsi2int(up) ( (((long)(up)[0]) << 24) + (((long)(up)[1]) << 16) \
103 + (((long)(up)[2]) << 8) + ((long)(up)[3]) )
104
105 #define MAX_CDB 12
106 #define MAX_SENSE 14
107 #define MAX_STATUS 32
108
109 struct ecb {
110 ushort cmdw;
111
112 ushort cne:1,
113 :6, di:1,
114 :2, ses:1,
115 :1, sg:1,
116 :1, dsb:1,
117 ars:1;
118
119 ushort lun:3,
120 tag:1,
121 tt:2,
122 nd:1,
123 :1, dat:1,
124 dir:1,
125 st:1,
126 chk:1,
127 :2, rec:1, :1;
128 ushort nil0;
129 ulong dataptr;
130 ulong datalen;
131 ulong statusptr;
132 ulong linkptr;
133 ulong nil1;
134 ulong senseptr;
135 unchar senselen;
136 unchar cdblen;
137 ushort datacheck;
138 unchar cdb[MAX_CDB];
139
140 unchar sense[MAX_SENSE];
141 unchar status[MAX_STATUS];
142 Scsi_Cmnd *SCpnt;
143 void (*done)(Scsi_Cmnd *);
144 };
145
146 #define AHA1740CMD_NOP 0x00
147 #define AHA1740CMD_INIT 0x01
148 #define AHA1740CMD_DIAG 0x05
149 #define AHA1740CMD_SCSI 0x06
150 #define AHA1740CMD_SENSE 0x08
151 #define AHA1740CMD_DOWN 0x09
152 #define AHA1740CMD_RINQ 0x0a
153 #define AHA1740CMD_TARG 0x10
154
155 int aha1740_detect(Scsi_Host_Template *);
156 int aha1740_command(Scsi_Cmnd *);
157 int aha1740_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
158 int aha1740_abort(Scsi_Cmnd *);
159 const char *aha1740_info(void);
160 int aha1740_reset(Scsi_Cmnd *);
161 int aha1740_biosparam(Disk *, int, int*);
162
163 #define AHA1740_ECBS 32
164 #define AHA1740_SCATTER 16
165
166 #ifndef NULL
167 #define NULL 0
168 #endif
169
170 #define AHA1740 {NULL, \
171 "Adaptec 1740", \
172 aha1740_detect, \
173 NULL, \
174 aha1740_info, \
175 aha1740_command, \
176 aha1740_queuecommand, \
177 aha1740_abort, \
178 aha1740_reset, \
179 NULL, \
180 aha1740_biosparam, \
181 AHA1740_ECBS, \
182 7, \
183 AHA1740_SCATTER, \
184 1, \
185 0, \
186 0, \
187 ENABLE_CLUSTERING}
188
189 #endif
190