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