1 |
1626 |
jcastillo |
/**************************************************************************
|
2 |
|
|
* Initio A100 device driver for Linux.
|
3 |
|
|
*
|
4 |
|
|
* Copyright (c) 1994-1998 Initio Corporation
|
5 |
|
|
* All rights reserved.
|
6 |
|
|
*
|
7 |
|
|
* This program is free software; you can redistribute it and/or modify
|
8 |
|
|
* it under the terms of the GNU General Public License as published by
|
9 |
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
10 |
|
|
* any later version.
|
11 |
|
|
*
|
12 |
|
|
* This program is distributed in the hope that it will be useful,
|
13 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
|
|
* GNU General Public License for more details.
|
16 |
|
|
*
|
17 |
|
|
* You should have received a copy of the GNU General Public License
|
18 |
|
|
* along with this program; see the file COPYING. If not, write to
|
19 |
|
|
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
20 |
|
|
*
|
21 |
|
|
* --------------------------------------------------------------------------
|
22 |
|
|
*
|
23 |
|
|
* Redistribution and use in source and binary forms, with or without
|
24 |
|
|
* modification, are permitted provided that the following conditions
|
25 |
|
|
* are met:
|
26 |
|
|
* 1. Redistributions of source code must retain the above copyright
|
27 |
|
|
* notice, this list of conditions, and the following disclaimer,
|
28 |
|
|
* without modification, immediately at the beginning of the file.
|
29 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
30 |
|
|
* notice, this list of conditions and the following disclaimer in the
|
31 |
|
|
* documentation and/or other materials provided with the distribution.
|
32 |
|
|
* 3. The name of the author may not be used to endorse or promote products
|
33 |
|
|
* derived from this software without specific prior written permission.
|
34 |
|
|
*
|
35 |
|
|
* Where this Software is combined with software released under the terms of
|
36 |
|
|
* the GNU Public License ("GPL") and the terms of the GPL would require the
|
37 |
|
|
* combined work to also be released under the terms of the GPL, the terms
|
38 |
|
|
* and conditions of this License will apply in addition to those of the
|
39 |
|
|
* GPL with the exception of any terms or conditions of this License that
|
40 |
|
|
* conflict with, or are expressly prohibited by, the GPL.
|
41 |
|
|
*
|
42 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
43 |
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
44 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
45 |
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
|
46 |
|
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
47 |
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
48 |
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
49 |
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
50 |
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
51 |
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
52 |
|
|
* SUCH DAMAGE.
|
53 |
|
|
*
|
54 |
|
|
**************************************************************************
|
55 |
|
|
*
|
56 |
|
|
* Module: inia100.h
|
57 |
|
|
* Description: INI-A100U2W LINUX device driver header
|
58 |
|
|
* Revision History:
|
59 |
|
|
* 06/18/98 HL, Initial production Version 1.02
|
60 |
|
|
* 12/19/98 bv, Use spinlocks for 2.1.95 and up
|
61 |
|
|
****************************************************************************/
|
62 |
|
|
|
63 |
|
|
#ifndef CVT_LINUX_VERSION
|
64 |
|
|
#define CVT_LINUX_VERSION(V,P,S) (((V) * 65536) + ((P) * 256) + (S))
|
65 |
|
|
#endif
|
66 |
|
|
|
67 |
|
|
#ifndef LINUX_VERSION_CODE
|
68 |
|
|
#include <linux/version.h>
|
69 |
|
|
#endif
|
70 |
|
|
|
71 |
|
|
#include "sd.h"
|
72 |
|
|
|
73 |
|
|
extern int inia100_detect(Scsi_Host_Template *);
|
74 |
|
|
extern int inia100_command(Scsi_Cmnd *);
|
75 |
|
|
extern int inia100_queue(Scsi_Cmnd *, void (*done) (Scsi_Cmnd *));
|
76 |
|
|
extern int inia100_abort(Scsi_Cmnd *);
|
77 |
|
|
extern int inia100_reset(Scsi_Cmnd *, unsigned int);
|
78 |
|
|
|
79 |
|
|
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(1, 3, 0)
|
80 |
|
|
extern int inia100_biosparam(Scsi_Disk *, kdev_t, int *); /*for linux v2.0 */
|
81 |
|
|
extern struct proc_dir_entry proc_scsi_inia100;
|
82 |
|
|
#else
|
83 |
|
|
extern int inia100_biosparam(Disk *, int, int *); /*for linux v1.13 */
|
84 |
|
|
#endif
|
85 |
|
|
|
86 |
|
|
#define inia100_REVID "Initio INI-A100U2W SCSI device driver; Revision: 1.02a"
|
87 |
|
|
|
88 |
|
|
#if LINUX_VERSION_CODE < CVT_LINUX_VERSION(1, 3, 0)
|
89 |
|
|
#define INIA100 { \
|
90 |
|
|
NULL, \
|
91 |
|
|
NULL, \
|
92 |
|
|
inia100_REVID, \
|
93 |
|
|
inia100_detect, \
|
94 |
|
|
NULL, \
|
95 |
|
|
NULL, \
|
96 |
|
|
inia100_command, \
|
97 |
|
|
inia100_queue, \
|
98 |
|
|
inia100_abort, \
|
99 |
|
|
inia100_reset, \
|
100 |
|
|
NULL, \
|
101 |
|
|
inia100_biosparam, \
|
102 |
|
|
1, \
|
103 |
|
|
7, \
|
104 |
|
|
SG_ALL, \
|
105 |
|
|
1, \
|
106 |
|
|
0, \
|
107 |
|
|
0, \
|
108 |
|
|
ENABLE_CLUSTERING \
|
109 |
|
|
}
|
110 |
|
|
|
111 |
|
|
#else
|
112 |
|
|
|
113 |
|
|
#if LINUX_VERSION_CODE < CVT_LINUX_VERSION(2, 1, 75)
|
114 |
|
|
#define INIA100 { \
|
115 |
|
|
NULL, \
|
116 |
|
|
NULL, \
|
117 |
|
|
&proc_scsi_inia100, \
|
118 |
|
|
NULL, \
|
119 |
|
|
inia100_REVID, \
|
120 |
|
|
inia100_detect, \
|
121 |
|
|
NULL, \
|
122 |
|
|
NULL, \
|
123 |
|
|
inia100_command, \
|
124 |
|
|
inia100_queue, \
|
125 |
|
|
inia100_abort, \
|
126 |
|
|
inia100_reset, \
|
127 |
|
|
NULL, \
|
128 |
|
|
inia100_biosparam, \
|
129 |
|
|
1, \
|
130 |
|
|
7, \
|
131 |
|
|
0, \
|
132 |
|
|
1, \
|
133 |
|
|
0, \
|
134 |
|
|
0, \
|
135 |
|
|
ENABLE_CLUSTERING \
|
136 |
|
|
}
|
137 |
|
|
#else /* Version >= 2.1.75 */
|
138 |
|
|
#define INIA100 { \
|
139 |
|
|
next: NULL, \
|
140 |
|
|
module: NULL, \
|
141 |
|
|
proc_dir: &proc_scsi_inia100, \
|
142 |
|
|
proc_info: NULL, \
|
143 |
|
|
name: inia100_REVID, \
|
144 |
|
|
detect: inia100_detect, \
|
145 |
|
|
release: NULL, \
|
146 |
|
|
info: NULL, \
|
147 |
|
|
command: inia100_command, \
|
148 |
|
|
queuecommand: inia100_queue, \
|
149 |
|
|
eh_strategy_handler: NULL, \
|
150 |
|
|
eh_abort_handler: NULL, \
|
151 |
|
|
eh_device_reset_handler: NULL, \
|
152 |
|
|
eh_bus_reset_handler: NULL, \
|
153 |
|
|
eh_host_reset_handler: NULL, \
|
154 |
|
|
abort: inia100_abort, \
|
155 |
|
|
reset: inia100_reset, \
|
156 |
|
|
slave_attach: NULL, \
|
157 |
|
|
bios_param: inia100_biosparam, \
|
158 |
|
|
can_queue: 1, \
|
159 |
|
|
this_id: 1, \
|
160 |
|
|
sg_tablesize: SG_ALL, \
|
161 |
|
|
cmd_per_lun: 1, \
|
162 |
|
|
present: 0, \
|
163 |
|
|
unchecked_isa_dma: 0, \
|
164 |
|
|
use_clustering: ENABLE_CLUSTERING, \
|
165 |
|
|
use_new_eh_code: 0 \
|
166 |
|
|
}
|
167 |
|
|
#endif
|
168 |
|
|
#endif
|
169 |
|
|
|
170 |
|
|
#define VIRT_TO_BUS(i) (unsigned int) virt_to_bus((void *)(i))
|
171 |
|
|
#define ULONG unsigned long
|
172 |
|
|
#define PVOID void *
|
173 |
|
|
#define USHORT unsigned short
|
174 |
|
|
#define UCHAR unsigned char
|
175 |
|
|
#define BYTE unsigned char
|
176 |
|
|
#define WORD unsigned short
|
177 |
|
|
#define DWORD unsigned long
|
178 |
|
|
#define UBYTE unsigned char
|
179 |
|
|
#define UWORD unsigned short
|
180 |
|
|
#define UDWORD unsigned long
|
181 |
|
|
#ifdef ALPHA
|
182 |
|
|
#define U32 unsigned int
|
183 |
|
|
#else
|
184 |
|
|
#define U32 unsigned long
|
185 |
|
|
#endif
|
186 |
|
|
|
187 |
|
|
#ifndef NULL
|
188 |
|
|
#define NULL 0 /* zero */
|
189 |
|
|
#endif
|
190 |
|
|
#ifndef TRUE
|
191 |
|
|
#define TRUE (1) /* boolean true */
|
192 |
|
|
#endif
|
193 |
|
|
#ifndef FALSE
|
194 |
|
|
#define FALSE (0) /* boolean false */
|
195 |
|
|
#endif
|
196 |
|
|
#ifndef FAILURE
|
197 |
|
|
#define FAILURE (-1)
|
198 |
|
|
#endif
|
199 |
|
|
#if 1
|
200 |
|
|
#define ORC_MAXQUEUE 245
|
201 |
|
|
#else
|
202 |
|
|
#define ORC_MAXQUEUE 25
|
203 |
|
|
#endif
|
204 |
|
|
|
205 |
|
|
#define TOTAL_SG_ENTRY 32
|
206 |
|
|
#define MAX_TARGETS 16
|
207 |
|
|
#define IMAX_CDB 15
|
208 |
|
|
#define SENSE_SIZE 14
|
209 |
|
|
#define MAX_SUPPORTED_ADAPTERS 4
|
210 |
|
|
#define SUCCESSFUL 0x00
|
211 |
|
|
|
212 |
|
|
#define I920_DEVICE_ID 0x0002 /* Initio's inic-950 product ID */
|
213 |
|
|
|
214 |
|
|
/************************************************************************/
|
215 |
|
|
/* Scatter-Gather Element Structure */
|
216 |
|
|
/************************************************************************/
|
217 |
|
|
typedef struct ORC_SG_Struc {
|
218 |
|
|
U32 SG_Ptr; /* Data Pointer */
|
219 |
|
|
U32 SG_Len; /* Data Length */
|
220 |
|
|
} ORC_SG;
|
221 |
|
|
|
222 |
|
|
|
223 |
|
|
/* SCSI related definition */
|
224 |
|
|
#define DISC_NOT_ALLOW 0x80 /* Disconnect is not allowed */
|
225 |
|
|
#define DISC_ALLOW 0xC0 /* Disconnect is allowed */
|
226 |
|
|
|
227 |
|
|
|
228 |
|
|
#define ORC_OFFSET_SCB 16
|
229 |
|
|
#define ORC_MAX_SCBS 250
|
230 |
|
|
#define MAX_CHANNELS 2
|
231 |
|
|
#define MAX_ESCB_ELE 64
|
232 |
|
|
#define TCF_DRV_255_63 0x0400
|
233 |
|
|
|
234 |
|
|
/********************************************************/
|
235 |
|
|
/* Orchid Configuration Register Set */
|
236 |
|
|
/********************************************************/
|
237 |
|
|
#define ORC_PVID 0x00 /* Vendor ID */
|
238 |
|
|
#define ORC_VENDOR_ID 0x1101 /* Orchid vendor ID */
|
239 |
|
|
#define ORC_PDID 0x02 /* Device ID */
|
240 |
|
|
#define ORC_DEVICE_ID 0x1060 /* Orchid device ID */
|
241 |
|
|
#define ORC_COMMAND 0x04 /* Command */
|
242 |
|
|
#define BUSMS 0x04 /* BUS MASTER Enable */
|
243 |
|
|
#define IOSPA 0x01 /* IO Space Enable */
|
244 |
|
|
#define ORC_STATUS 0x06 /* Status register */
|
245 |
|
|
#define ORC_REVISION 0x08 /* Revision number */
|
246 |
|
|
#define ORC_BASE 0x10 /* Base address */
|
247 |
|
|
#define ORC_BIOS 0x50 /* Expansion ROM base address */
|
248 |
|
|
#define ORC_INT_NUM 0x3C /* Interrupt line */
|
249 |
|
|
#define ORC_INT_PIN 0x3D /* Interrupt pin */
|
250 |
|
|
|
251 |
|
|
/********************************************************/
|
252 |
|
|
/* Orchid Host Command Set */
|
253 |
|
|
/********************************************************/
|
254 |
|
|
#define ORC_CMD_NOP 0x00 /* Host command - NOP */
|
255 |
|
|
#define ORC_CMD_VERSION 0x01 /* Host command - Get F/W version */
|
256 |
|
|
#define ORC_CMD_ECHO 0x02 /* Host command - ECHO */
|
257 |
|
|
#define ORC_CMD_SET_NVM 0x03 /* Host command - Set NVRAM */
|
258 |
|
|
#define ORC_CMD_GET_NVM 0x04 /* Host command - Get NVRAM */
|
259 |
|
|
#define ORC_CMD_GET_BUS_STATUS 0x05 /* Host command - Get SCSI bus status */
|
260 |
|
|
#define ORC_CMD_ABORT_SCB 0x06 /* Host command - Abort SCB */
|
261 |
|
|
#define ORC_CMD_ISSUE_SCB 0x07 /* Host command - Issue SCB */
|
262 |
|
|
|
263 |
|
|
/********************************************************/
|
264 |
|
|
/* Orchid Register Set */
|
265 |
|
|
/********************************************************/
|
266 |
|
|
#define ORC_GINTS 0xA0 /* Global Interrupt Status */
|
267 |
|
|
#define QINT 0x04 /* Reply Queue Interrupt */
|
268 |
|
|
#define ORC_GIMSK 0xA1 /* Global Interrupt MASK */
|
269 |
|
|
#define MQINT 0x04 /* Mask Reply Queue Interrupt */
|
270 |
|
|
#define ORC_GCFG 0xA2 /* Global Configure */
|
271 |
|
|
#define EEPRG 0x01 /* Enable EEPROM programming */
|
272 |
|
|
#define ORC_GSTAT 0xA3 /* Global status */
|
273 |
|
|
#define WIDEBUS 0x10 /* Wide SCSI Devices connected */
|
274 |
|
|
#define ORC_HDATA 0xA4 /* Host Data */
|
275 |
|
|
#define ORC_HCTRL 0xA5 /* Host Control */
|
276 |
|
|
#define SCSIRST 0x80 /* SCSI bus reset */
|
277 |
|
|
#define HDO 0x40 /* Host data out */
|
278 |
|
|
#define HOSTSTOP 0x02 /* Host stop RISC engine */
|
279 |
|
|
#define DEVRST 0x01 /* Device reset */
|
280 |
|
|
#define ORC_HSTUS 0xA6 /* Host Status */
|
281 |
|
|
#define HDI 0x02 /* Host data in */
|
282 |
|
|
#define RREADY 0x01 /* RISC engine is ready to receive */
|
283 |
|
|
#define ORC_NVRAM 0xA7 /* Nvram port address */
|
284 |
|
|
#define SE2CS 0x008
|
285 |
|
|
#define SE2CLK 0x004
|
286 |
|
|
#define SE2DO 0x002
|
287 |
|
|
#define SE2DI 0x001
|
288 |
|
|
#define ORC_PQUEUE 0xA8 /* Posting queue FIFO */
|
289 |
|
|
#define ORC_PQCNT 0xA9 /* Posting queue FIFO Cnt */
|
290 |
|
|
#define ORC_RQUEUE 0xAA /* Reply queue FIFO */
|
291 |
|
|
#define ORC_RQUEUECNT 0xAB /* Reply queue FIFO Cnt */
|
292 |
|
|
#define ORC_FWBASEADR 0xAC /* Firmware base address */
|
293 |
|
|
|
294 |
|
|
#define ORC_EBIOSADR0 0xB0 /* External Bios address */
|
295 |
|
|
#define ORC_EBIOSADR1 0xB1 /* External Bios address */
|
296 |
|
|
#define ORC_EBIOSADR2 0xB2 /* External Bios address */
|
297 |
|
|
#define ORC_EBIOSDATA 0xB3 /* External Bios address */
|
298 |
|
|
|
299 |
|
|
#define ORC_SCBSIZE 0xB7 /* SCB size register */
|
300 |
|
|
#define ORC_SCBBASE0 0xB8 /* SCB base address 0 */
|
301 |
|
|
#define ORC_SCBBASE1 0xBC /* SCB base address 1 */
|
302 |
|
|
|
303 |
|
|
#define ORC_RISCCTL 0xE0 /* RISC Control */
|
304 |
|
|
#define PRGMRST 0x002
|
305 |
|
|
#define DOWNLOAD 0x001
|
306 |
|
|
#define ORC_PRGMCTR0 0xE2 /* RISC program counter */
|
307 |
|
|
#define ORC_PRGMCTR1 0xE3 /* RISC program counter */
|
308 |
|
|
#define ORC_RISCRAM 0xEC /* RISC RAM data port 4 bytes */
|
309 |
|
|
|
310 |
|
|
typedef struct orc_extended_scb { /* Extended SCB */
|
311 |
|
|
ORC_SG ESCB_SGList[TOTAL_SG_ENTRY]; /*0 Start of SG list */
|
312 |
|
|
Scsi_Cmnd *SCB_Srb; /*50 SRB Pointer */
|
313 |
|
|
} ESCB;
|
314 |
|
|
|
315 |
|
|
/***********************************************************************
|
316 |
|
|
SCSI Control Block
|
317 |
|
|
************************************************************************/
|
318 |
|
|
typedef struct orc_scb { /* Scsi_Ctrl_Blk */
|
319 |
|
|
UBYTE SCB_Opcode; /*00 SCB command code&residual */
|
320 |
|
|
UBYTE SCB_Flags; /*01 SCB Flags */
|
321 |
|
|
UBYTE SCB_Target; /*02 Target Id */
|
322 |
|
|
UBYTE SCB_Lun; /*03 Lun */
|
323 |
|
|
U32 SCB_Reserved0; /*04 Reserved for ORCHID must 0 */
|
324 |
|
|
U32 SCB_XferLen; /*08 Data Transfer Length */
|
325 |
|
|
U32 SCB_Reserved1; /*0C Reserved for ORCHID must 0 */
|
326 |
|
|
U32 SCB_SGLen; /*10 SG list # * 8 */
|
327 |
|
|
U32 SCB_SGPAddr; /*14 SG List Buf physical Addr */
|
328 |
|
|
U32 SCB_SGPAddrHigh; /*18 SG Buffer high physical Addr */
|
329 |
|
|
UBYTE SCB_HaStat; /*1C Host Status */
|
330 |
|
|
UBYTE SCB_TaStat; /*1D Target Status */
|
331 |
|
|
UBYTE SCB_Status; /*1E SCB status */
|
332 |
|
|
UBYTE SCB_Link; /*1F Link pointer, default 0xFF */
|
333 |
|
|
UBYTE SCB_SenseLen; /*20 Sense Allocation Length */
|
334 |
|
|
UBYTE SCB_CDBLen; /*21 CDB Length */
|
335 |
|
|
UBYTE SCB_Ident; /*22 Identify */
|
336 |
|
|
UBYTE SCB_TagMsg; /*23 Tag Message */
|
337 |
|
|
UBYTE SCB_CDB[IMAX_CDB]; /*24 SCSI CDBs */
|
338 |
|
|
UBYTE SCB_ScbIdx; /*3C Index for this ORCSCB */
|
339 |
|
|
U32 SCB_SensePAddr; /*34 Sense Buffer physical Addr */
|
340 |
|
|
|
341 |
|
|
ESCB *SCB_EScb; /*38 Extended SCB Pointer */
|
342 |
|
|
#ifndef ALPHA
|
343 |
|
|
UBYTE SCB_Reserved2[4]; /*3E Reserved for Driver use */
|
344 |
|
|
#endif
|
345 |
|
|
} ORC_SCB;
|
346 |
|
|
|
347 |
|
|
/* Opcodes of ORCSCB_Opcode */
|
348 |
|
|
#define ORC_EXECSCSI 0x00 /* SCSI initiator command with residual */
|
349 |
|
|
#define ORC_BUSDEVRST 0x01 /* SCSI Bus Device Reset */
|
350 |
|
|
|
351 |
|
|
/* Status of ORCSCB_Status */
|
352 |
|
|
#define SCB_COMPLETE 0x00 /* SCB request completed */
|
353 |
|
|
#define SCB_POST 0x01 /* SCB is posted by the HOST */
|
354 |
|
|
|
355 |
|
|
/* Bit Definition for ORCSCB_Flags */
|
356 |
|
|
#define SCF_DISINT 0x01 /* Disable HOST interrupt */
|
357 |
|
|
#define SCF_DIR 0x18 /* Direction bits */
|
358 |
|
|
#define SCF_NO_DCHK 0x00 /* Direction determined by SCSI */
|
359 |
|
|
#define SCF_DIN 0x08 /* From Target to Initiator */
|
360 |
|
|
#define SCF_DOUT 0x10 /* From Initiator to Target */
|
361 |
|
|
#define SCF_NO_XF 0x18 /* No data transfer */
|
362 |
|
|
#define SCF_POLL 0x40
|
363 |
|
|
|
364 |
|
|
/* Error Codes for ORCSCB_HaStat */
|
365 |
|
|
#define HOST_SEL_TOUT 0x11
|
366 |
|
|
#define HOST_DO_DU 0x12
|
367 |
|
|
#define HOST_BUS_FREE 0x13
|
368 |
|
|
#define HOST_BAD_PHAS 0x14
|
369 |
|
|
#define HOST_INV_CMD 0x16
|
370 |
|
|
#define HOST_SCSI_RST 0x1B
|
371 |
|
|
#define HOST_DEV_RST 0x1C
|
372 |
|
|
|
373 |
|
|
|
374 |
|
|
/* Error Codes for ORCSCB_TaStat */
|
375 |
|
|
#define TARGET_CHK_COND 0x02
|
376 |
|
|
#define TARGET_BUSY 0x08
|
377 |
|
|
#define TARGET_TAG_FULL 0x28
|
378 |
|
|
|
379 |
|
|
|
380 |
|
|
/* Queue tag msg: Simple_quque_tag, Head_of_queue_tag, Ordered_queue_tag */
|
381 |
|
|
#define MSG_STAG 0x20
|
382 |
|
|
#define MSG_HTAG 0x21
|
383 |
|
|
#define MSG_OTAG 0x22
|
384 |
|
|
|
385 |
|
|
#define MSG_IGNOREWIDE 0x23
|
386 |
|
|
|
387 |
|
|
#define MSG_IDENT 0x80
|
388 |
|
|
#define MSG_DISC 0x40 /* Disconnect allowed */
|
389 |
|
|
|
390 |
|
|
|
391 |
|
|
/* SCSI MESSAGE */
|
392 |
|
|
#define MSG_EXTEND 0x01
|
393 |
|
|
#define MSG_SDP 0x02
|
394 |
|
|
#define MSG_ABORT 0x06
|
395 |
|
|
#define MSG_REJ 0x07
|
396 |
|
|
#define MSG_NOP 0x08
|
397 |
|
|
#define MSG_PARITY 0x09
|
398 |
|
|
#define MSG_DEVRST 0x0C
|
399 |
|
|
#define MSG_STAG 0x20
|
400 |
|
|
|
401 |
|
|
/***********************************************************************
|
402 |
|
|
Target Device Control Structure
|
403 |
|
|
**********************************************************************/
|
404 |
|
|
|
405 |
|
|
typedef struct ORC_Tar_Ctrl_Struc {
|
406 |
|
|
UBYTE TCS_DrvDASD; /* 6 */
|
407 |
|
|
UBYTE TCS_DrvSCSI; /* 7 */
|
408 |
|
|
UBYTE TCS_DrvHead; /* 8 */
|
409 |
|
|
UWORD TCS_DrvFlags; /* 4 */
|
410 |
|
|
UBYTE TCS_DrvSector; /* 7 */
|
411 |
|
|
} ORC_TCS, *PORC_TCS;
|
412 |
|
|
|
413 |
|
|
/* Bit Definition for TCF_DrvFlags */
|
414 |
|
|
#define TCS_DF_NODASD_SUPT 0x20 /* Suppress OS/2 DASD Mgr support */
|
415 |
|
|
#define TCS_DF_NOSCSI_SUPT 0x40 /* Suppress OS/2 SCSI Mgr support */
|
416 |
|
|
|
417 |
|
|
|
418 |
|
|
/***********************************************************************
|
419 |
|
|
Host Adapter Control Structure
|
420 |
|
|
************************************************************************/
|
421 |
|
|
typedef struct ORC_Ha_Ctrl_Struc {
|
422 |
|
|
USHORT HCS_Base; /* 00 */
|
423 |
|
|
UBYTE HCS_Index; /* 02 */
|
424 |
|
|
UBYTE HCS_Intr; /* 04 */
|
425 |
|
|
UBYTE HCS_SCSI_ID; /* 06 H/A SCSI ID */
|
426 |
|
|
UBYTE HCS_BIOS; /* 07 BIOS configuration */
|
427 |
|
|
|
428 |
|
|
UBYTE HCS_Flags; /* 0B */
|
429 |
|
|
UBYTE HCS_HAConfig1; /* 1B SCSI0MAXTags */
|
430 |
|
|
UBYTE HCS_MaxTar; /* 1B SCSI0MAXTags */
|
431 |
|
|
|
432 |
|
|
USHORT HCS_Units; /* Number of units this adapter */
|
433 |
|
|
USHORT HCS_AFlags; /* Adapter info. defined flags */
|
434 |
|
|
ULONG HCS_Timeout; /* Adapter timeout value */
|
435 |
|
|
PVOID HCS_virScbArray; /* 28 Virtual Pointer to SCB array */
|
436 |
|
|
U32 HCS_physScbArray; /* Scb Physical address */
|
437 |
|
|
PVOID HCS_virEscbArray; /* Virtual pointer to ESCB Scatter list */
|
438 |
|
|
U32 HCS_physEscbArray; /* scatter list Physical address */
|
439 |
|
|
UBYTE TargetFlag[16]; /* 30 target configuration, TCF_EN_TAG */
|
440 |
|
|
UBYTE MaximumTags[16]; /* 40 ORC_MAX_SCBS */
|
441 |
|
|
UBYTE ActiveTags[16][16]; /* 50 */
|
442 |
|
|
ORC_TCS HCS_Tcs[16]; /* 28 */
|
443 |
|
|
U32 BitAllocFlag[MAX_CHANNELS][8]; /* Max STB is 256, So 256/32 */
|
444 |
|
|
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
|
445 |
|
|
spinlock_t BitAllocFlagLock;
|
446 |
|
|
#endif
|
447 |
|
|
Scsi_Cmnd *pSRB_head;
|
448 |
|
|
Scsi_Cmnd *pSRB_tail;
|
449 |
|
|
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
|
450 |
|
|
spinlock_t pSRB_lock;
|
451 |
|
|
#endif
|
452 |
|
|
} ORC_HCS;
|
453 |
|
|
|
454 |
|
|
/* Bit Definition for HCS_Flags */
|
455 |
|
|
|
456 |
|
|
#define HCF_SCSI_RESET 0x01 /* SCSI BUS RESET */
|
457 |
|
|
#define HCF_PARITY 0x02 /* parity card */
|
458 |
|
|
#define HCF_LVDS 0x10 /* parity card */
|
459 |
|
|
|
460 |
|
|
/* Bit Definition for TargetFlag */
|
461 |
|
|
|
462 |
|
|
#define TCF_EN_255 0x08
|
463 |
|
|
#define TCF_EN_TAG 0x10
|
464 |
|
|
#define TCF_BUSY 0x20
|
465 |
|
|
#define TCF_DISCONNECT 0x40
|
466 |
|
|
#define TCF_SPIN_UP 0x80
|
467 |
|
|
|
468 |
|
|
/* Bit Definition for HCS_AFlags */
|
469 |
|
|
#define HCS_AF_IGNORE 0x01 /* Adapter ignore */
|
470 |
|
|
#define HCS_AF_DISABLE_RESET 0x10 /* Adapter disable reset */
|
471 |
|
|
#define HCS_AF_DISABLE_ADPT 0x80 /* Adapter disable */
|
472 |
|
|
|
473 |
|
|
|
474 |
|
|
/*---------------------------------------*/
|
475 |
|
|
/* TimeOut for RESET to complete (30s) */
|
476 |
|
|
/* */
|
477 |
|
|
/* After a RESET the drive is checked */
|
478 |
|
|
/* every 200ms. */
|
479 |
|
|
/*---------------------------------------*/
|
480 |
|
|
#define DELAYED_RESET_MAX (30*1000L)
|
481 |
|
|
#define DELAYED_RESET_INTERVAL 200L
|
482 |
|
|
|
483 |
|
|
/*----------------------------------------------*/
|
484 |
|
|
/* TimeOut for IRQ from last interrupt (5s) */
|
485 |
|
|
/*----------------------------------------------*/
|
486 |
|
|
#define IRQ_TIMEOUT_INTERVAL (5*1000L)
|
487 |
|
|
|
488 |
|
|
/*----------------------------------------------*/
|
489 |
|
|
/* Retry Delay interval (200ms) */
|
490 |
|
|
/*----------------------------------------------*/
|
491 |
|
|
#define DELAYED_RETRY_INTERVAL 200L
|
492 |
|
|
|
493 |
|
|
#define INQUIRY_SIZE 36
|
494 |
|
|
#define CAPACITY_SIZE 8
|
495 |
|
|
#define DEFAULT_SENSE_LEN 14
|
496 |
|
|
|
497 |
|
|
#define DEVICE_NOT_FOUND 0x86
|
498 |
|
|
|
499 |
|
|
/*----------------------------------------------*/
|
500 |
|
|
/* Definition for PCI device */
|
501 |
|
|
/*----------------------------------------------*/
|
502 |
|
|
#define MAX_PCI_DEVICES 21
|
503 |
|
|
#define MAX_PCI_BUSES 8
|