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 u32 dataptr;
85 u32 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 u16 cmdw;
111
112 u16 cne:1,
113 :6, di:1,
114 :2, ses:1,
115 :1, sg:1,
116 :1, dsb:1,
117 ars:1;
118
119 u16 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 u16 nil0;
129 u32 dataptr;
130 u32 datalen;
131 u32 statusptr;
132 u32 linkptr;
133 u32 nil1;
134 u32 senseptr;
135 u8 senselen;
136 u8 cdblen;
137 u16 datacheck;
138 u8 cdb[MAX_CDB];
139
140 u8 sense[MAX_SENSE];
141 u8 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 int aha1740_reset(Scsi_Cmnd *);
160 int aha1740_biosparam(Disk *, int, int*);
161
162 #define AHA1740_ECBS 32
163 #define AHA1740_SCATTER 16
164
165 #ifndef NULL
166 #define NULL 0
167 #endif
168
169 #define AHA1740 {NULL, NULL, \
170 NULL, \
171 "aha1740", \
172 PROC_SCSI_AHA1740, \
173 "Adaptec 174x (EISA)", \
174 aha1740_detect, \
175 NULL, \
176 NULL, \
177 aha1740_command, \
178 aha1740_queuecommand, \
179 aha1740_abort, \
180 aha1740_reset, \
181 NULL, \
182 aha1740_biosparam, \
183 AHA1740_ECBS, \
184 7, \
185 AHA1740_SCATTER, \
186 1, \
187 0, \
188 0, \
189 ENABLE_CLUSTERING}
190
191 #endif
192