clean
[linux-2.4.21-pre4.git] / drivers / scsi / 3w-xxxx.h
1 /* 
2    3w-xxxx.h -- 3ware Storage Controller device driver for Linux.
3    
4    Written By: Adam Radford <linux@3ware.com>
5    Modifications By: Joel Jacobson <linux@3ware.com>
6                      Arnaldo Carvalho de Melo <acme@conectiva.com.br>
7                      Brad Strand <linux@3ware.com>
8
9    Copyright (C) 1999-2002 3ware Inc.
10
11    Kernel compatablity By:      Andre Hedrick <andre@suse.com>
12    Non-Copyright (C) 2000       Andre Hedrick <andre@suse.com>
13
14    This program is free software; you can redistribute it and/or modify
15    it under the terms of the GNU General Public License as published by
16    the Free Software Foundation; version 2 of the License.
17
18    This program is distributed in the hope that it will be useful,           
19    but WITHOUT ANY WARRANTY; without even the implied warranty of            
20    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             
21    GNU General Public License for more details.                              
22
23    NO WARRANTY                                                               
24    THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR        
25    CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT      
26    LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,      
27    MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is    
28    solely responsible for determining the appropriateness of using and       
29    distributing the Program and assumes all risks associated with its        
30    exercise of rights under this Agreement, including but not limited to     
31    the risks and costs of program errors, damage to or loss of data,         
32    programs or equipment, and unavailability or interruption of operations.  
33
34    DISCLAIMER OF LIABILITY                                                   
35    NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY   
36    DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL        
37    DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND   
38    ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR     
39    TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE    
40    USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED  
41    HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES             
42
43    You should have received a copy of the GNU General Public License         
44    along with this program; if not, write to the Free Software               
45    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
46
47    Bugs/Comments/Suggestions should be mailed to:                            
48    linux@3ware.com
49    
50    For more information, goto:
51    http://www.3ware.com
52 */
53
54 #ifndef _3W_XXXX_H
55 #define _3W_XXXX_H
56
57 #include <linux/version.h>
58 #include <linux/types.h>
59 #include <linux/kdev_t.h>
60
61 /* AEN strings */
62 static char *tw_aen_string[] = {
63         "INFO: AEN queue empty",                       // 0x000
64         "INFO: Soft reset occurred",                   // 0x001
65         "ERROR: Unit degraded: Unit #",                // 0x002
66         "ERROR: Controller error",                     // 0x003 
67         "ERROR: Rebuild failed: Unit #",               // 0x004
68         "INFO: Rebuild complete: Unit #",              // 0x005
69         "ERROR: Incomplete unit detected: Unit #",     // 0x006
70         "INFO: Initialization complete: Unit #",       // 0x007
71         "WARNING: Unclean shutdown detected: Unit #",  // 0x008
72         "WARNING: ATA port timeout: Port #",           // 0x009
73         "ERROR: Drive error: Port #",                  // 0x00A
74         "INFO: Rebuild started: Unit #",               // 0x00B 
75         "INFO: Initialization started: Unit #",        // 0x00C
76         "ERROR: Logical unit deleted: Unit #",         // 0x00D
77         NULL,                                          // 0x00E unused
78         "WARNING: SMART threshold exceeded: Port #",   // 0x00F
79         NULL, NULL, NULL, NULL, NULL,
80         NULL, NULL, NULL, NULL, NULL,
81         NULL, NULL, NULL, NULL, NULL,
82         NULL, NULL,                                    // 0x010-0x020 unused
83         "WARNING: ATA UDMA downgrade: Port #",         // 0x021
84         "WARNING: ATA UDMA upgrade: Port #",           // 0x022
85         "WARNING: Sector repair occurred: Port #",     // 0x023
86         "ERROR: SBUF integrity check failure",         // 0x024
87         "ERROR: Lost cached write: Port #",            // 0x025
88         "ERROR: Drive ECC error detected: Port #",     // 0x026
89         "ERROR: DCB checksum error: Port #",           // 0x027
90         "ERROR: DCB unsupported version: Port #",      // 0x028
91         "INFO: Verify started: Unit #",                // 0x029
92         "ERROR: Verify failed: Port #",                // 0x02A
93         "INFO: Verify complete: Unit #",               // 0x02B
94         "WARNING: Overwrote bad sector during rebuild: Port #",  //0x02C
95         "ERROR: Encountered bad sector during rebuild: Port #",  //0x02D
96         "ERROR: Replacement drive is too small: Port #",         //0x02E
97         "WARNING: Verify error: Unit not previously initialized: Unit #", //0x02F
98         "ERROR: Drive not supported: Port #"           // 0x030
99 };
100
101 /* 
102    Sense key lookup table 
103    Format: ESDC/flags,SenseKey,AdditionalSenseCode,AdditionalSenseCodeQualifier
104 */
105 static unsigned char tw_sense_table[][4] =
106 {
107   /* Codes for newer firmware */
108                             // ATA Error                    SCSI Error
109   {0x01, 0x03, 0x13, 0x00}, // Address mark not found       Address mark not found for data field
110   {0x04, 0x0b, 0x00, 0x00}, // Aborted command              Aborted command
111   {0x10, 0x0b, 0x14, 0x00}, // ID not found                 Recorded entity not found
112   {0x40, 0x03, 0x11, 0x00}, // Uncorrectable ECC error      Unrecovered read error
113   {0x61, 0x04, 0x00, 0x00}, // Device fault                 Hardware error
114   {0x84, 0x0b, 0x47, 0x00}, // Data CRC error               SCSI parity error
115   {0xd0, 0x0b, 0x00, 0x00}, // Device busy                  Aborted command
116   {0xd1, 0x0b, 0x00, 0x00}, // Device busy                  Aborted command
117
118   /* Codes for older firmware */
119                             // 3ware Error                  SCSI Error
120   {0x09, 0x0b, 0x00, 0x00}, // Unrecovered disk error       Aborted command
121   {0x37, 0x0b, 0x04, 0x00}, // Unit offline                 Logical unit not ready
122   {0x51, 0x0b, 0x00, 0x00}  // Unspecified                  Aborted command
123 };
124
125 /* Control register bit definitions */
126 #define TW_CONTROL_CLEAR_HOST_INTERRUPT        0x00080000
127 #define TW_CONTROL_CLEAR_ATTENTION_INTERRUPT   0x00040000
128 #define TW_CONTROL_MASK_COMMAND_INTERRUPT      0x00020000
129 #define TW_CONTROL_MASK_RESPONSE_INTERRUPT     0x00010000
130 #define TW_CONTROL_UNMASK_COMMAND_INTERRUPT    0x00008000
131 #define TW_CONTROL_UNMASK_RESPONSE_INTERRUPT   0x00004000
132 #define TW_CONTROL_CLEAR_ERROR_STATUS          0x00000200
133 #define TW_CONTROL_ISSUE_SOFT_RESET            0x00000100
134 #define TW_CONTROL_ENABLE_INTERRUPTS           0x00000080
135 #define TW_CONTROL_DISABLE_INTERRUPTS          0x00000040
136 #define TW_CONTROL_ISSUE_HOST_INTERRUPT        0x00000020
137 #define TW_CONTROL_CLEAR_PARITY_ERROR          0x00800000
138 #define TW_CONTROL_CLEAR_QUEUE_ERROR           0x00400000
139 #define TW_CONTROL_CLEAR_PCI_ABORT             0x00100000
140 #define TW_CONTROL_CLEAR_SBUF_WRITE_ERROR      0x00000008
141
142 /* Status register bit definitions */
143 #define TW_STATUS_MAJOR_VERSION_MASK           0xF0000000
144 #define TW_STATUS_MINOR_VERSION_MASK           0x0F000000
145 #define TW_STATUS_PCI_PARITY_ERROR             0x00800000
146 #define TW_STATUS_QUEUE_ERROR                  0x00400000
147 #define TW_STATUS_MICROCONTROLLER_ERROR        0x00200000
148 #define TW_STATUS_PCI_ABORT                    0x00100000
149 #define TW_STATUS_HOST_INTERRUPT               0x00080000
150 #define TW_STATUS_ATTENTION_INTERRUPT          0x00040000
151 #define TW_STATUS_COMMAND_INTERRUPT            0x00020000
152 #define TW_STATUS_RESPONSE_INTERRUPT           0x00010000
153 #define TW_STATUS_COMMAND_QUEUE_FULL           0x00008000
154 #define TW_STATUS_RESPONSE_QUEUE_EMPTY         0x00004000
155 #define TW_STATUS_MICROCONTROLLER_READY        0x00002000
156 #define TW_STATUS_COMMAND_QUEUE_EMPTY          0x00001000
157 #define TW_STATUS_ALL_INTERRUPTS               0x000F0000
158 #define TW_STATUS_CLEARABLE_BITS               0x00D00000
159 #define TW_STATUS_EXPECTED_BITS                0x00002000
160 #define TW_STATUS_UNEXPECTED_BITS              0x00F00008
161 #define TW_STATUS_SBUF_WRITE_ERROR             0x00000008
162 #define TW_STATUS_VALID_INTERRUPT              0x00DF0008
163
164 /* RESPONSE QUEUE BIT DEFINITIONS */
165 #define TW_RESPONSE_ID_MASK                    0x00000FF0
166
167 /* PCI related defines */
168 #define TW_IO_ADDRESS_RANGE                    0x10
169 #define TW_DEVICE_NAME                         "3ware Storage Controller"
170 #define TW_VENDOR_ID (0x13C1)   /* 3ware */
171 #define TW_DEVICE_ID (0x1000)   /* Storage Controller */
172 #define TW_DEVICE_ID2 (0x1001)  /* 7000 series controller */
173 #define TW_NUMDEVICES 2
174 #define TW_PCI_CLEAR_PARITY_ERRORS 0xc100
175 #define TW_PCI_CLEAR_PCI_ABORT     0x2000
176
177 /* Command packet opcodes */
178 #define TW_OP_NOP             0x0
179 #define TW_OP_INIT_CONNECTION 0x1
180 #define TW_OP_READ            0x2
181 #define TW_OP_WRITE           0x3
182 #define TW_OP_VERIFY          0x4
183 #define TW_OP_GET_PARAM       0x12
184 #define TW_OP_SET_PARAM       0x13
185 #define TW_OP_SECTOR_INFO     0x1a
186 #define TW_OP_AEN_LISTEN      0x1c
187 #define TW_OP_FLUSH_CACHE     0x0e
188 #define TW_CMD_PACKET         0x1d
189 #define TW_ATA_PASSTHRU       0x1e
190 #define TW_CMD_PACKET_WITH_DATA 0x1f
191
192 /* Asynchronous Event Notification (AEN) Codes */
193 #define TW_AEN_QUEUE_EMPTY       0x0000
194 #define TW_AEN_SOFT_RESET        0x0001
195 #define TW_AEN_DEGRADED_MIRROR   0x0002
196 #define TW_AEN_CONTROLLER_ERROR  0x0003
197 #define TW_AEN_REBUILD_FAIL      0x0004
198 #define TW_AEN_REBUILD_DONE      0x0005
199 #define TW_AEN_QUEUE_FULL        0x00ff
200 #define TW_AEN_TABLE_UNDEFINED   0x15
201 #define TW_AEN_APORT_TIMEOUT     0x0009
202 #define TW_AEN_DRIVE_ERROR       0x000A
203 #define TW_AEN_SMART_FAIL        0x000F
204 #define TW_AEN_SBUF_FAIL         0x0024
205
206 /* Misc defines */
207 #define TW_ALIGNMENT_6000                     64 /* 64 bytes */
208 #define TW_ALIGNMENT_7000                     4  /* 4 bytes */
209 #define TW_MAX_UNITS                          16
210 #define TW_COMMAND_ALIGNMENT_MASK             0x1ff
211 #define TW_INIT_MESSAGE_CREDITS               0x100
212 #define TW_INIT_COMMAND_PACKET_SIZE           0x3
213 #define TW_POLL_MAX_RETRIES                   20000
214 #define TW_MAX_SGL_LENGTH                     62
215 #define TW_ATA_PASS_SGL_MAX                   60
216 #define TW_MAX_PASSTHRU_BYTES                 4096
217 #define TW_Q_LENGTH                           256
218 #define TW_MAX_BOUNCEBUF                      16
219 #define TW_Q_START                            0
220 #define TW_MAX_SLOT                           32
221 #define TW_MAX_PCI_BUSES                      255
222 #define TW_MAX_RESET_TRIES                    3
223 #define TW_UNIT_INFORMATION_TABLE_BASE        0x300
224 #define TW_MAX_CMDS_PER_LUN                   255
225 #define TW_BLOCK_SIZE                         0x200 /* 512-byte blocks */
226 #define TW_IOCTL                              0x80
227 #define TW_UNIT_ONLINE                        1
228 #define TW_IN_INTR                            1
229 #define TW_IN_IOCTL                           2
230 #define TW_MAX_SECTORS                        256
231 #define TW_MAX_BOUNCE_SECTORS                 128
232 #define TW_AEN_WAIT_TIME                      1000
233 #define TW_IOCTL_WAIT_TIME                    (1 * HZ) /* 1 second */
234 #define TW_MAX_CDB_LEN                        16
235 #define TW_ISR_DONT_COMPLETE                  2
236 #define TW_ISR_DONT_RESULT                    3
237 #define TW_IOCTL_TIMEOUT                      25 /* 25 seconds */
238
239 /* Macros */
240 #define TW_STATUS_ERRORS(x) \
241         (((x & TW_STATUS_PCI_ABORT) || \
242         (x & TW_STATUS_PCI_PARITY_ERROR) || \
243         (x & TW_STATUS_QUEUE_ERROR) || \
244         (x & TW_STATUS_MICROCONTROLLER_ERROR)) && \
245         (x & TW_STATUS_MICROCONTROLLER_READY))
246
247 #ifdef TW_DEBUG
248 #define dprintk(msg...) printk(msg)
249 #else
250 #define dprintk(msg...) do { } while(0)
251 #endif
252
253 /* Scatter Gather List Entry */
254 typedef struct TAG_TW_SG_Entry {
255         u32 address;
256         u32 length;
257 } TW_SG_Entry;
258
259 typedef unsigned char TW_Sector[512];
260
261 /* Command Packet */
262 typedef struct TW_Command {
263         /* First DWORD */
264         struct {
265                 unsigned char opcode:5;
266                 unsigned char sgl_offset:3;
267         } byte0;
268         unsigned char size;
269         unsigned char request_id;
270         struct {
271                 unsigned char unit:4;
272                 unsigned char host_id:4;
273         } byte3;
274         /* Second DWORD */
275         unsigned char status;
276         unsigned char flags;
277         union {
278                 unsigned short block_count;
279                 unsigned short parameter_count;
280                 unsigned short message_credits;
281         } byte6;
282         union {
283                 struct {
284                         u32 lba;
285                         TW_SG_Entry sgl[TW_MAX_SGL_LENGTH];
286                         u32 padding;    /* pad to 512 bytes */
287                 } io;
288                 struct {
289                         TW_SG_Entry sgl[TW_MAX_SGL_LENGTH];
290                         u32 padding[2];
291                 } param;
292                 struct {
293                         u32 response_queue_pointer;
294                         u32 padding[125];
295                 } init_connection;
296                 struct {
297                         char version[504];
298                 } ioctl_miniport_version;
299         } byte8;
300 } TW_Command;
301
302 typedef struct TAG_TW_Ioctl {
303 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,15)
304         int buffer;
305 #endif
306         unsigned char opcode;
307         unsigned short table_id;
308         unsigned char parameter_id;
309         unsigned char parameter_size_bytes;
310         unsigned char unit_index;
311         unsigned char data[1];
312 } TW_Ioctl;
313
314 /* GetParam descriptor */
315 typedef struct {
316         unsigned short  table_id;
317         unsigned char   parameter_id;
318         unsigned char   parameter_size_bytes;
319         unsigned char   data[1];
320 } TW_Param, *PTW_Param;
321
322 /* Response queue */
323 typedef union TAG_TW_Response_Queue {
324         struct {
325                 u32 undefined_1: 4;
326                 u32 response_id: 8;
327                 u32 undefined_2: 20;
328         } u;
329         u32 value;
330 } TW_Response_Queue;
331
332 typedef struct TAG_TW_Registers {
333         u32 base_addr;
334         u32 control_reg_addr;
335         u32 status_reg_addr;
336         u32 command_que_addr;
337         u32 response_que_addr;
338 } TW_Registers;
339
340 typedef struct TAG_TW_Info {
341         char *buffer;
342         int length;
343         int offset;
344         int position;
345 } TW_Info;
346
347 typedef int TW_Cmd_State;
348
349 #define TW_S_INITIAL   0x1  /* Initial state */
350 #define TW_S_STARTED   0x2  /* Id in use */
351 #define TW_S_POSTED    0x4  /* Posted to the controller */
352 #define TW_S_PENDING   0x8  /* Waiting to be posted in isr */
353 #define TW_S_COMPLETED 0x10 /* Completed by isr */
354 #define TW_S_FINISHED  0x20 /* I/O completely done */
355 #define TW_START_MASK (TW_S_STARTED | TW_S_POSTED | TW_S_PENDING | TW_S_COMPLETED)
356
357 /* Command header for ATA pass-thru */
358 typedef struct TAG_TW_Passthru
359 {
360         struct {
361                 unsigned char opcode:5;
362                 unsigned char sgloff:3;
363         } byte0;
364         unsigned char size;
365         unsigned char request_id;
366         struct {
367                 unsigned char aport:4;
368                 unsigned char host_id:4;
369         } byte3;
370         unsigned char status;
371         unsigned char flags;
372         unsigned short param;
373         unsigned short features;
374         unsigned short sector_count;
375         unsigned short sector_num;
376         unsigned short cylinder_lo;
377         unsigned short cylinder_hi;
378         unsigned char drive_head;
379         unsigned char command;
380         TW_SG_Entry sg_list[TW_ATA_PASS_SGL_MAX];
381         unsigned char padding[12];
382 } TW_Passthru;
383
384 typedef struct TAG_TW_Device_Extension {
385         TW_Registers            registers;
386         unsigned long           *alignment_virtual_address[TW_Q_LENGTH];
387         unsigned long           alignment_physical_address[TW_Q_LENGTH];
388         unsigned long           *bounce_buffer[TW_Q_LENGTH];
389         unsigned long           bounce_buffer_phys[TW_Q_LENGTH];
390         int                     is_unit_present[TW_MAX_UNITS];
391         int                     is_raid_five[TW_MAX_UNITS];
392         int                     num_units;
393         int                     num_raid_five;
394         unsigned long           *command_packet_virtual_address[TW_Q_LENGTH];
395         unsigned long           command_packet_physical_address[TW_Q_LENGTH];
396         struct pci_dev          *tw_pci_dev;
397         Scsi_Cmnd               *srb[TW_Q_LENGTH];
398         unsigned char           free_queue[TW_Q_LENGTH];
399         unsigned char           free_head;
400         unsigned char           free_tail;
401         unsigned char           free_wrap;
402         unsigned char           pending_queue[TW_Q_LENGTH];
403         unsigned char           pending_head;
404         unsigned char           pending_tail;
405         TW_Cmd_State            state[TW_Q_LENGTH];
406         u32                     posted_request_count;
407         u32                     max_posted_request_count;
408         u32                     request_count_marked_pending;
409         u32                     pending_request_count;
410         u32                     max_pending_request_count;
411         u32                     max_sgl_entries;
412         u32                     sgl_entries;
413         u32                     num_aborts;
414         u32                     num_resets;
415         u32                     sector_count;
416         u32                     max_sector_count;
417         u32                     aen_count;
418         struct Scsi_Host        *host;
419         spinlock_t              tw_lock;
420         int                     ioctl_size[TW_Q_LENGTH];
421         unsigned short          aen_queue[TW_Q_LENGTH];
422         unsigned char           aen_head;
423         unsigned char           aen_tail;
424         volatile long           flags; /* long req'd for set_bit --RR */
425         unsigned long           *ioctl_data[TW_Q_LENGTH];
426         int                     reset_print;
427         char                    online;
428 } TW_Device_Extension;
429
430 /* Function prototypes */
431 int tw_aen_complete(TW_Device_Extension *tw_dev, int request_id);
432 int tw_aen_drain_queue(TW_Device_Extension *tw_dev);
433 int tw_aen_read_queue(TW_Device_Extension *tw_dev, int request_id);
434 int tw_allocate_memory(TW_Device_Extension *tw_dev, int size, int which);
435 int tw_check_bits(u32 status_reg_value);
436 int tw_check_errors(TW_Device_Extension *tw_dev);
437 void tw_clear_all_interrupts(TW_Device_Extension *tw_dev);
438 void tw_clear_attention_interrupt(TW_Device_Extension *tw_dev);
439 void tw_clear_host_interrupt(TW_Device_Extension *tw_dev);
440 int tw_decode_bits(TW_Device_Extension *tw_dev, u32 status_reg_value, int print_host);
441 int tw_decode_sense(TW_Device_Extension *tw_dev, int request_id, int fill_sense);
442 void tw_disable_interrupts(TW_Device_Extension *tw_dev);
443 void tw_empty_response_que(TW_Device_Extension *tw_dev);
444 void tw_enable_interrupts(TW_Device_Extension *tw_dev);
445 void tw_enable_and_clear_interrupts(TW_Device_Extension *tw_dev);
446 int tw_findcards(Scsi_Host_Template *tw_host);
447 void tw_free_device_extension(TW_Device_Extension *tw_dev);
448 int tw_initconnection(TW_Device_Extension *tw_dev, int message_credits);
449 int tw_initialize_device_extension(TW_Device_Extension *tw_dev);
450 int tw_initialize_units(TW_Device_Extension *tw_dev);
451 int tw_ioctl(TW_Device_Extension *tw_dev, int request_id);
452 int tw_ioctl_complete(TW_Device_Extension *tw_dev, int request_id);
453 void tw_mask_command_interrupt(TW_Device_Extension *tw_dev);
454 int tw_poll_status(TW_Device_Extension *tw_dev, u32 flag, int seconds);
455 int tw_poll_status_gone(TW_Device_Extension *tw_dev, u32 flag, int seconds);
456 int tw_post_command_packet(TW_Device_Extension *tw_dev, int request_id);
457 int tw_reset_device_extension(TW_Device_Extension *tw_dev);
458 int tw_reset_sequence(TW_Device_Extension *tw_dev);
459 int tw_scsi_biosparam(Disk *disk, kdev_t dev, int geom[]);
460 int tw_scsi_detect(Scsi_Host_Template *tw_host);
461 int tw_scsi_eh_abort(Scsi_Cmnd *SCpnt);
462 int tw_scsi_eh_reset(Scsi_Cmnd *SCpnt);
463 int tw_scsi_proc_info(char *buffer, char **start, off_t offset, int length, int inode, int inout);
464 int tw_scsi_queue(Scsi_Cmnd *cmd, void (*done) (Scsi_Cmnd *));
465 int tw_scsi_release(struct Scsi_Host *tw_host);
466 int tw_scsiop_inquiry(TW_Device_Extension *tw_dev, int request_id);
467 int tw_scsiop_inquiry_complete(TW_Device_Extension *tw_dev, int request_id);
468 int tw_scsiop_mode_sense(TW_Device_Extension *tw_dev, int request_id);
469 int tw_scsiop_mode_sense_complete(TW_Device_Extension *tw_dev, int request_id);
470 int tw_scsiop_read_capacity(TW_Device_Extension *tw_dev, int request_id);
471 int tw_scsiop_read_capacity_complete(TW_Device_Extension *tw_dev, int request_id);
472 int tw_scsiop_read_write(TW_Device_Extension *tw_dev, int request_id);
473 int tw_scsiop_request_sense(TW_Device_Extension *tw_dev, int request_id);
474 int tw_scsiop_synchronize_cache(TW_Device_Extension *tw_dev, int request_id);
475 int tw_scsiop_test_unit_ready(TW_Device_Extension *tw_dev, int request_id);
476 int tw_setfeature(TW_Device_Extension *tw_dev, int parm, int param_size, 
477                   unsigned char *val);
478 int tw_setup_irq(TW_Device_Extension *tw_dev);
479 int tw_shutdown_device(TW_Device_Extension *tw_dev);
480 void tw_soft_reset(TW_Device_Extension *tw_dev);
481 int tw_state_request_finish(TW_Device_Extension *tw_dev,int request_id);
482 int tw_state_request_start(TW_Device_Extension *tw_dev, int *request_id);
483 void tw_unmask_command_interrupt(TW_Device_Extension *tw_dev);
484
485 /* Scsi_Host_Template Initializer */
486 #ifdef BLK_BOUNCE_HIGH
487 #define TWXXXX {                                        \
488         next : NULL,                                    \
489         module : NULL,                                  \
490         proc_name : "3w-xxxx",                          \
491         proc_info : tw_scsi_proc_info,                  \
492         name : "3ware Storage Controller",              \
493         detect : tw_scsi_detect,                        \
494         release : tw_scsi_release,                      \
495         info : NULL,                                    \
496         ioctl : NULL,                                   \
497         command : NULL,                                 \
498         queuecommand : tw_scsi_queue,                   \
499         eh_strategy_handler : NULL,                     \
500         eh_abort_handler : tw_scsi_eh_abort,            \
501         eh_device_reset_handler : NULL,                 \
502         eh_bus_reset_handler : NULL,                    \
503         eh_host_reset_handler : tw_scsi_eh_reset,       \
504         abort : NULL,                                   \
505         reset : NULL,                                   \
506         slave_attach : NULL,                            \
507         bios_param : tw_scsi_biosparam,                 \
508         can_queue : TW_Q_LENGTH-1,                      \
509         this_id: -1,                                    \
510         sg_tablesize : TW_MAX_SGL_LENGTH,               \
511         cmd_per_lun: TW_MAX_CMDS_PER_LUN,               \
512         present : 0,                                    \
513         unchecked_isa_dma : 0,                          \
514         use_clustering : ENABLE_CLUSTERING,             \
515         use_new_eh_code : 1,                            \
516         emulated : 1,                                   \
517         highmem_io : 1                                  \
518 }
519 #else
520 #define TWXXXX {                                        \
521         next : NULL,                                    \
522         module : NULL,                                  \
523         proc_name : "3w-xxxx",                          \
524         proc_info : tw_scsi_proc_info,                  \
525         name : "3ware Storage Controller",              \
526         detect : tw_scsi_detect,                        \
527         release : tw_scsi_release,                      \
528         info : NULL,                                    \
529         ioctl : NULL,                                   \
530         command : NULL,                                 \
531         queuecommand : tw_scsi_queue,                   \
532         eh_strategy_handler : NULL,                     \
533         eh_abort_handler : tw_scsi_eh_abort,            \
534         eh_device_reset_handler : NULL,                 \
535         eh_bus_reset_handler : NULL,                    \
536         eh_host_reset_handler : tw_scsi_eh_reset,       \
537         abort : NULL,                                   \
538         reset : NULL,                                   \
539         slave_attach : NULL,                            \
540         bios_param : tw_scsi_biosparam,                 \
541         can_queue : TW_Q_LENGTH-1,                      \
542         this_id: -1,                                    \
543         sg_tablesize : TW_MAX_SGL_LENGTH,               \
544         cmd_per_lun: TW_MAX_CMDS_PER_LUN,               \
545         present : 0,                                    \
546         unchecked_isa_dma : 0,                          \
547         use_clustering : ENABLE_CLUSTERING,             \
548         use_new_eh_code : 1,                            \
549         emulated : 1                                    \
550 }
551 #endif /* BLK_BOUNCE_HIGH */
552 #endif /* _3W_XXXX_H */