Import 2.3.18pre1
[davej-history.git] / drivers / scsi / ips.h
blob3f80b3c9154666c7f58e1df431073b86d74796e5
1 /*****************************************************************************/
2 /* ips.h -- driver for the IBM ServeRAID adapter */
3 /* */
4 /* Written By: Keith Mitchell, IBM Corporation */
5 /* */
6 /* Copyright (C) 1999 IBM Corporation */
7 /* */
8 /* This program is free software; you can redistribute it and/or modify */
9 /* it under the terms of the GNU General Public License as published by */
10 /* the Free Software Foundation; either version 2 of the License, or */
11 /* (at your option) any later version. */
12 /* */
13 /* This program is distributed in the hope that it will be useful, */
14 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
15 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
16 /* GNU General Public License for more details. */
17 /* */
18 /* NO WARRANTY */
19 /* THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR */
20 /* CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT */
21 /* LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, */
22 /* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is */
23 /* solely responsible for determining the appropriateness of using and */
24 /* distributing the Program and assumes all risks associated with its */
25 /* exercise of rights under this Agreement, including but not limited to */
26 /* the risks and costs of program errors, damage to or loss of data, */
27 /* programs or equipment, and unavailability or interruption of operations. */
28 /* */
29 /* DISCLAIMER OF LIABILITY */
30 /* NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY */
31 /* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL */
32 /* DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND */
33 /* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR */
34 /* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE */
35 /* USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED */
36 /* HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES */
37 /* */
38 /* You should have received a copy of the GNU General Public License */
39 /* along with this program; if not, write to the Free Software */
40 /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
41 /* */
42 /* Bugs/Comments/Suggestions should be mailed to: */
43 /* ipslinux@us.ibm.com */
44 /* */
45 /*****************************************************************************/
47 #ifndef _IPS_H_
48 #define _IPS_H_
50 #include <linux/config.h>
51 #include <asm/uaccess.h>
52 #include <asm/io.h>
54 /* Prototypes */
55 extern int ips_detect(Scsi_Host_Template *);
56 extern int ips_release(struct Scsi_Host *);
57 extern int ips_abort(Scsi_Cmnd *);
58 extern int ips_reset(Scsi_Cmnd *, unsigned int);
59 extern int ips_eh_abort(Scsi_Cmnd *);
60 extern int ips_eh_reset(Scsi_Cmnd *);
61 extern int ips_queue(Scsi_Cmnd *, void (*) (Scsi_Cmnd *));
62 extern int ips_biosparam(Disk *, kdev_t, int *);
63 extern const char * ips_info(struct Scsi_Host *);
64 extern void do_ipsintr(int, void *, struct pt_regs *);
67 * Some handy macros
69 #ifndef LinuxVersionCode
70 #define LinuxVersionCode(x,y,z) (((x)<<16)+((y)<<8)+(z))
71 #endif
73 #define HA(x) ((ips_ha_t *) x->hostdata)
74 #define IPS_COMMAND_ID(ha, scb) (int) (scb - ha->scbs)
75 #define VIRT_TO_BUS(x) (unsigned int)virt_to_bus((void *) x)
77 #define UDELAY udelay
78 #define MDELAY mdelay
80 #define verify_area_20(t,a,sz) (0) /* success */
81 #define PUT_USER put_user
82 #define __PUT_USER __put_user
83 #define PUT_USER_RET put_user_ret
84 #define GET_USER get_user
85 #define __GET_USER __get_user
86 #define GET_USER_RET get_user_ret
89 * Adapter address map equates
91 #define HISR 0x08 /* Host Interrupt Status Reg */
92 #define CCSAR 0x10 /* Cmd Channel System Addr Reg */
93 #define CCCR 0x14 /* Cmd Channel Control Reg */
94 #define SQHR 0x20 /* Status Q Head Reg */
95 #define SQTR 0x24 /* Status Q Tail Reg */
96 #define SQER 0x28 /* Status Q End Reg */
97 #define SQSR 0x2C /* Status Q Start Reg */
98 #define SCPR 0x05 /* Subsystem control port reg */
99 #define ISPR 0x06 /* interrupt status port reg */
100 #define CBSP 0x07 /* CBSP register */
103 * Adapter register bit equates
105 #define GHI 0x04 /* HISR General Host Interrupt */
106 #define SQO 0x02 /* HISR Status Q Overflow */
107 #define SCE 0x01 /* HISR Status Channel Enqueue */
108 #define SEMAPHORE 0x08 /* CCCR Semaphore Bit */
109 #define ILE 0x10 /* CCCR ILE Bit */
110 #define START_COMMAND 0x101A /* CCCR Start Command Channel */
111 #define START_STOP_BIT 0x0002 /* CCCR Start/Stop Bit */
112 #define RST 0x80 /* SCPR Reset Bit */
113 #define EBM 0x02 /* SCPR Enable Bus Master */
114 #define EI 0x80 /* HISR Enable Interrupts */
115 #define OP 0x01 /* OP bit in CBSP */
118 * Adapter Command ID Equates
120 #define GET_LOGICAL_DRIVE_INFO 0x19
121 #define GET_SUBSYS_PARAM 0x40
122 #define READ_NVRAM_CONFIGURATION 0x38
123 #define RW_NVRAM_PAGE 0xBC
124 #define IPS_READ 0x02
125 #define IPS_WRITE 0x03
126 #define ENQUIRY 0x05
127 #define FLUSH_CACHE 0x0A
128 #define NORM_STATE 0x00
129 #define READ_SCATTER_GATHER 0x82
130 #define WRITE_SCATTER_GATHER 0x83
131 #define DIRECT_CDB 0x04
132 #define DIRECT_CDB_SCATTER_GATHER 0x84
133 #define CONFIG_SYNC 0x58
134 #define POCL 0x30
135 #define GET_ERASE_ERROR_TABLE 0x17
136 #define RESET_CHANNEL 0x1A
137 #define CSL 0xFF
138 #define ADAPT_RESET 0xFF
141 * Adapter Equates
143 #define IPS_MAX_ADAPTERS 16
144 #define IPS_MAX_IOCTL 1
145 #define IPS_MAX_IOCTL_QUEUE 8
146 #define IPS_MAX_QUEUE 128
147 #define IPS_BLKSIZE 512
148 #define MAX_SG_ELEMENTS 17
149 #define MAX_LOGICAL_DRIVES 8
150 #define MAX_CHANNELS 3
151 #define MAX_TARGETS 15
152 #define MAX_CHUNKS 16
153 #define MAX_CMDS 64
154 #define IPS_MAX_XFER 0x10000
155 #define COMP_MODE_HEADS 128
156 #define COMP_MODE_SECTORS 32
157 #define NORM_MODE_HEADS 254
158 #define NORM_MODE_SECTORS 63
159 #define NVRAM_PAGE5_SIGNATURE 0xFFDDBB99
160 #define MAX_POST_BYTES 0x02
161 #define MAX_CONFIG_BYTES 0x02
162 #define GOOD_POST_BASIC_STATUS 0x80
163 #define SEMAPHORE_TIMEOUT 2000
164 #define IPS_INTR_OFF 0
165 #define IPS_INTR_ON 1
166 #define IPS_ADAPTER_ID 0xF
167 #define IPS_VENDORID 0x1014
168 #define IPS_DEVICEID 0x002E
169 #define TIMEOUT_10 0x10
170 #define TIMEOUT_60 0x20
171 #define TIMEOUT_20M 0x30
172 #define STATUS_SIZE 4
173 #define STATUS_Q_SIZE (MAX_CMDS+1) * STATUS_SIZE
174 #define ONE_MSEC 1
175 #define ONE_SEC 1000
178 * Adapter Basic Status Codes
180 #define BASIC_STATUS_MASK 0xFF
181 #define GSC_STATUS_MASK 0x0F
182 #define SSUCCESS 0x00
183 #define RECOVERED_ERROR 0x01
184 #define IPS_CHECK_CONDITION 0x02
185 #define INVAL_OPCO 0x03
186 #define INVAL_CMD_BLK 0x04
187 #define INVAL_PARM_BLK 0x05
188 #define IPS_BUSY 0x08
189 #define ADAPT_HARDWARE_ERROR 0x09
190 #define ADAPT_FIRMWARE_ERROR 0x0A
191 #define CMD_CMPLT_WERROR 0x0C
192 #define LOG_DRV_ERROR 0x0D
193 #define CMD_TIMEOUT 0x0E
194 #define PHYS_DRV_ERROR 0x0F
197 * Adapter Extended Status Equates
199 #define SELECTION_TIMEOUT 0xF0
200 #define DATA_OVER_UNDER_RUN 0xF2
201 #define EXT_HOST_RESET 0xF7
202 #define EXT_DEVICE_RESET 0xF8
203 #define EXT_RECOVERY 0xFC
204 #define EXT_CHECK_CONDITION 0xFF
207 * Operating System Defines
209 #define OS_WINDOWS_NT 0x01
210 #define OS_NETWARE 0x02
211 #define OS_OPENSERVER 0x03
212 #define OS_UNIXWARE 0x04
213 #define OS_SOLARIS 0x05
214 #define OS_OS2 0x06
215 #define OS_LINUX 0x07
216 #define OS_FREEBSD 0x08
219 * Adapter Command/Status Packet Definitions
221 #define IPS_SUCCESS 0x01 /* Successfully completed */
222 #define IPS_SUCCESS_IMM 0x02 /* Success - Immediately */
223 #define IPS_FAILURE 0x04 /* Completed with Error */
226 * Logical Drive Equates
228 #define OFF_LINE 0x02
229 #define OKAY 0x03
230 #define FREE 0x00
231 #define SYS 0x06
232 #define CRS 0x24
235 * DCDB Table Equates
237 #define NO_DISCONNECT 0x00
238 #define DISCONNECT_ALLOWED 0x80
239 #define NO_AUTO_REQUEST_SENSE 0x40
240 #define DATA_IN 0x01
241 #define DATA_OUT 0x02
242 #define TRANSFER_64K 0x08
243 #define NOTIMEOUT 0x00
244 #define TIMEOUT10 0x10
245 #define TIMEOUT60 0x20
246 #define TIMEOUT20M 0x30
249 * Host adapter Flags (bit numbers)
251 #define IPS_IN_INTR 0
252 #define IPS_IN_ABORT 1
253 #define IPS_IN_RESET 2
256 * SCB Flags
258 #define SCB_ACTIVE 0x00001
259 #define SCB_WAITING 0x00002
262 * Passthru stuff
264 #define COPPUSRCMD (('C'<<8) | 65)
265 #define IPS_NUMCTRLS (('C'<<8) | 68)
266 #define IPS_CTRLINFO (('C'<<8) | 69)
269 * Scsi_Host Template
271 #define IPS { \
272 next : NULL, \
273 module : NULL, \
274 proc_dir : NULL, \
275 proc_info : NULL, \
276 name : NULL, \
277 detect : ips_detect, \
278 release : ips_release, \
279 info : ips_info, \
280 command : NULL, \
281 queuecommand : ips_queue, \
282 eh_strategy_handler : NULL, \
283 eh_abort_handler : ips_eh_abort, \
284 eh_device_reset_handler : NULL, \
285 eh_bus_reset_handler : NULL, \
286 eh_host_reset_handler : ips_eh_reset, \
287 abort : ips_abort, \
288 reset : ips_reset, \
289 slave_attach : NULL, \
290 bios_param : ips_biosparam, \
291 can_queue : 0, \
292 this_id: -1, \
293 sg_tablesize : MAX_SG_ELEMENTS, \
294 cmd_per_lun: 16, \
295 present : 0, \
296 unchecked_isa_dma : 0, \
297 use_clustering : ENABLE_CLUSTERING, \
298 use_new_eh_code : 1 \
302 * IBM PCI Raid Command Formats
304 typedef struct {
305 u8 op_code;
306 u8 command_id;
307 u8 log_drv;
308 u8 sg_count;
309 u32 lba;
310 u32 sg_addr;
311 u16 sector_count;
312 u16 reserved;
313 u32 ccsar;
314 u32 cccr;
315 } BASIC_IO_CMD, *PBASIC_IO_CMD;
317 typedef struct {
318 u8 op_code;
319 u8 command_id;
320 u16 reserved;
321 u32 reserved2;
322 u32 buffer_addr;
323 u32 reserved3;
324 u32 ccsar;
325 u32 cccr;
326 } LOGICAL_INFO, *PLOGICAL_INFO;
328 typedef struct {
329 u8 op_code;
330 u8 command_id;
331 u8 reserved;
332 u8 reserved2;
333 u32 reserved3;
334 u32 buffer_addr;
335 u32 reserved4;
336 } IOCTL_INFO, *PIOCTL_INFO;
338 typedef struct {
339 u8 op_code;
340 u8 command_id;
341 u16 reserved;
342 u32 reserved2;
343 u32 dcdb_address;
344 u32 reserved3;
345 u32 ccsar;
346 u32 cccr;
347 } DCDB_CMD, *PDCDB_CMD;
349 typedef struct {
350 u8 op_code;
351 u8 command_id;
352 u8 channel;
353 u8 source_target;
354 u32 reserved;
355 u32 reserved2;
356 u32 reserved3;
357 u32 ccsar;
358 u32 cccr;
359 } CONFIG_SYNC_CMD, *PCONFIG_SYNC_CMD;
361 typedef struct {
362 u8 op_code;
363 u8 command_id;
364 u8 log_drv;
365 u8 control;
366 u32 reserved;
367 u32 reserved2;
368 u32 reserved3;
369 u32 ccsar;
370 u32 cccr;
371 } UNLOCK_STRIPE_CMD, *PUNLOCK_STRIPE_CMD;
373 typedef struct {
374 u8 op_code;
375 u8 command_id;
376 u8 reserved;
377 u8 state;
378 u32 reserved2;
379 u32 reserved3;
380 u32 reserved4;
381 u32 ccsar;
382 u32 cccr;
383 } FLUSH_CACHE_CMD, *PFLUSH_CACHE_CMD;
385 typedef struct {
386 u8 op_code;
387 u8 command_id;
388 u8 reserved;
389 u8 desc;
390 u32 reserved2;
391 u32 buffer_addr;
392 u32 reserved3;
393 u32 ccsar;
394 u32 cccr;
395 } STATUS_CMD, *PSTATUS_CMD;
397 typedef struct {
398 u8 op_code;
399 u8 command_id;
400 u8 page;
401 u8 write;
402 u32 reserved;
403 u32 buffer_addr;
404 u32 reserved2;
405 u32 ccsar;
406 u32 cccr;
407 } NVRAM_CMD, *PNVRAM_CMD;
409 typedef union {
410 BASIC_IO_CMD basic_io;
411 LOGICAL_INFO logical_info;
412 IOCTL_INFO ioctl_info;
413 DCDB_CMD dcdb;
414 CONFIG_SYNC_CMD config_sync;
415 UNLOCK_STRIPE_CMD unlock_stripe;
416 FLUSH_CACHE_CMD flush_cache;
417 STATUS_CMD status;
418 NVRAM_CMD nvram;
419 } HOST_COMMAND, *PHOST_COMMAND;
421 typedef struct {
422 u8 logical_id;
423 u8 reserved;
424 u8 raid_level;
425 u8 state;
426 u32 sector_count;
427 } DRIVE_INFO, *PDRIVE_INFO;
429 typedef struct {
430 u8 no_of_log_drive;
431 u8 reserved[3];
432 DRIVE_INFO drive_info[MAX_LOGICAL_DRIVES];
433 } LOGICAL_DRIVE_INFO, *PLOGICAL_DRIVE_INFO;
435 typedef struct {
436 u8 ha_num;
437 u8 bus_num;
438 u8 id;
439 u8 device_type;
440 u32 data_len;
441 u32 data_ptr;
442 u8 scsi_cdb[12];
443 u32 data_counter;
444 u32 block_size;
445 } NON_DISK_DEVICE_INFO, *PNON_DISK_DEVICE_INFO;
447 typedef struct {
448 u8 device_address;
449 u8 cmd_attribute;
450 u16 transfer_length;
451 u32 buffer_pointer;
452 u8 cdb_length;
453 u8 sense_length;
454 u8 sg_count;
455 u8 reserved;
456 u8 scsi_cdb[12];
457 u8 sense_info[64];
458 u8 scsi_status;
459 u8 reserved2[3];
460 } DCDB_TABLE, *PDCDB_TABLE;
462 typedef struct {
463 volatile u8 reserved;
464 volatile u8 command_id;
465 volatile u8 basic_status;
466 volatile u8 extended_status;
467 } STATUS, *PSTATUS;
469 typedef struct {
470 STATUS status[MAX_CMDS + 1];
471 volatile PSTATUS p_status_start;
472 volatile PSTATUS p_status_end;
473 volatile PSTATUS p_status_tail;
474 volatile u32 hw_status_start;
475 volatile u32 hw_status_tail;
476 LOGICAL_DRIVE_INFO logical_drive_info;
477 } ADAPTER_AREA, *PADAPTER_AREA;
479 typedef struct {
480 u8 ucLogDriveCount;
481 u8 ucMiscFlag;
482 u8 ucSLTFlag;
483 u8 ucBSTFlag;
484 u8 ucPwrChgCnt;
485 u8 ucWrongAdrCnt;
486 u8 ucUnidentCnt;
487 u8 ucNVramDevChgCnt;
488 u8 CodeBlkVersion[8];
489 u8 BootBlkVersion[8];
490 u32 ulDriveSize[MAX_LOGICAL_DRIVES];
491 u8 ucConcurrentCmdCount;
492 u8 ucMaxPhysicalDevices;
493 u16 usFlashRepgmCount;
494 u8 ucDefunctDiskCount;
495 u8 ucRebuildFlag;
496 u8 ucOfflineLogDrvCount;
497 u8 ucCriticalDrvCount;
498 u16 usConfigUpdateCount;
499 u8 ucBlkFlag;
500 u8 reserved;
501 u16 usAddrDeadDisk[MAX_CHANNELS * MAX_TARGETS];
502 } ENQCMD, *PENQCMD;
504 typedef struct {
505 u8 ucInitiator;
506 u8 ucParameters;
507 u8 ucMiscFlag;
508 u8 ucState;
509 u32 ulBlockCount;
510 u8 ucDeviceId[28];
511 } DEVSTATE, *PDEVSTATE;
513 typedef struct {
514 u8 ucChn;
515 u8 ucTgt;
516 u16 ucReserved;
517 u32 ulStartSect;
518 u32 ulNoOfSects;
519 } CHUNK, *PCHUNK;
521 typedef struct {
522 u16 ucUserField;
523 u8 ucState;
524 u8 ucRaidCacheParam;
525 u8 ucNoOfChunkUnits;
526 u8 ucStripeSize;
527 u8 ucParams;
528 u8 ucReserved;
529 u32 ulLogDrvSize;
530 CHUNK chunk[MAX_CHUNKS];
531 } LOGICAL_DRIVE, *PLOGICAL_DRIVE;
533 typedef struct {
534 u8 board_disc[8];
535 u8 processor[8];
536 u8 ucNoChanType;
537 u8 ucNoHostIntType;
538 u8 ucCompression;
539 u8 ucNvramType;
540 u32 ulNvramSize;
541 } HARDWARE_DISC, *PHARDWARE_DISC;
543 typedef struct {
544 u8 ucLogDriveCount;
545 u8 ucDateD;
546 u8 ucDateM;
547 u8 ucDateY;
548 u8 init_id[4];
549 u8 host_id[12];
550 u8 time_sign[8];
552 struct {
553 u32 usCfgDrvUpdateCnt:16;
554 u32 ConcurDrvStartCnt:4;
555 u32 StartupDelay:4;
556 u32 auto_rearrange:1;
557 u32 cd_boot:1;
558 u32 cluster:1;
559 u32 reserved:5;
560 } UserOpt;
562 u16 user_field;
563 u8 ucRebuildRate;
564 u8 ucReserve;
565 HARDWARE_DISC hardware_disc;
566 LOGICAL_DRIVE logical_drive[MAX_LOGICAL_DRIVES];
567 DEVSTATE dev[MAX_CHANNELS][MAX_TARGETS+1];
568 u8 reserved[512];
570 } CONFCMD, *PCONFCMD;
572 typedef struct {
573 u32 signature;
574 u8 reserved;
575 u8 adapter_slot;
576 u16 adapter_type;
577 u8 bios_high[4];
578 u8 bios_low[4];
579 u16 reserved2;
580 u8 reserved3;
581 u8 operating_system;
582 u8 driver_high[4];
583 u8 driver_low[4];
584 u8 reserved4[100];
585 } NVRAM_PAGE5, *PNVRAM_PAGE5;
587 typedef struct _SUBSYS_PARAM {
588 u32 param[128];
589 } SUBSYS_PARAM, *PSUBSYS_PARAM;
592 * Inquiry Data Format
594 typedef struct {
595 u8 DeviceType:5;
596 u8 DeviceTypeQualifier:3;
597 u8 DeviceTypeModifier:7;
598 u8 RemoveableMedia:1;
599 u8 Versions;
600 u8 ResponseDataFormat;
601 u8 AdditionalLength;
602 u16 Reserved;
603 u8 SoftReset:1;
604 u8 CommandQueue:1;
605 u8 Reserved2:1;
606 u8 LinkedCommands:1;
607 u8 Synchronous:1;
608 u8 Wide16Bit:1;
609 u8 Wide32Bit:1;
610 u8 RelativeAddressing:1;
611 u8 VendorId[8];
612 u8 ProductId[16];
613 u8 ProductRevisionLevel[4];
614 u8 VendorSpecific[20];
615 u8 Reserved3[40];
616 } INQUIRYDATA, *PINQUIRYDATA;
619 * Read Capacity Data Format
621 typedef struct {
622 u32 lba;
623 u32 len;
624 } CAPACITY_T;
627 * Sense Data Format
629 typedef struct {
630 u8 pg_pc:6; /* Page Code */
631 u8 pg_res1:2; /* Reserved */
632 u8 pg_len; /* Page Length */
633 u16 pg_trk_z; /* Tracks per zone */
634 u16 pg_asec_z; /* Alternate sectors per zone */
635 u16 pg_atrk_z; /* Alternate tracks per zone */
636 u16 pg_atrk_v; /* Alternate tracks per volume */
637 u16 pg_sec_t; /* Sectors per track */
638 u16 pg_bytes_s; /* Bytes per physical sectors */
639 u16 pg_intl; /* Interleave */
640 u16 pg_trkskew; /* Track skew factor */
641 u16 pg_cylskew; /* Cylinder Skew Factor */
642 u32 pg_res2:27; /* Reserved */
643 u32 pg_ins:1; /* Inhibit Slave */
644 u32 pg_surf:1; /* Allocate Surface Sectors */
645 u32 pg_rmb:1; /* Removeable */
646 u32 pg_hsec:1; /* Hard sector formatting */
647 u32 pg_ssec:1; /* Soft sector formatting */
648 } DADF_T;
650 typedef struct {
651 u8 pg_pc:6; /* Page Code */
652 u8 pg_res1:2; /* Reserved */
653 u8 pg_len; /* Page Length */
654 u16 pg_cylu; /* Number of cylinders (upper) */
655 u8 pg_cyll; /* Number of cylinders (lower) */
656 u8 pg_head; /* Number of heads */
657 u16 pg_wrpcompu; /* Write precomp (upper) */
658 u32 pg_wrpcompl:8; /* Write precomp (lower) */
659 u32 pg_redwrcur:24; /* Reduced write current */
660 u32 pg_drstep:16; /* Drive step rate */
661 u32 pg_landu:16; /* Landing zone cylinder (upper) */
662 u32 pg_landl:8; /* Landing zone cylinder (lower) */
663 u32 pg_res2:24; /* Reserved */
664 } RDDG_T;
666 struct blk_desc {
667 u8 bd_dencode;
668 u8 bd_nblks1;
669 u8 bd_nblks2;
670 u8 bd_nblks3;
671 u8 bd_res;
672 u8 bd_blen1;
673 u8 bd_blen2;
674 u8 bd_blen3;
677 typedef struct {
678 u8 plh_len; /* Data length */
679 u8 plh_type; /* Medium type */
680 u8 plh_res:7; /* Reserved */
681 u8 plh_wp:1; /* Write protect */
682 u8 plh_bdl; /* Block descriptor length */
683 } SENSE_PLH_T;
685 typedef struct {
686 SENSE_PLH_T plh;
687 struct blk_desc blk_desc;
689 union {
690 DADF_T pg3;
691 RDDG_T pg4;
692 } pdata;
693 } ips_mdata_t;
696 * Scatter Gather list format
698 typedef struct ips_sglist {
699 u32 address;
700 u32 length;
701 } SG_LIST, *PSG_LIST;
703 typedef struct _INFOSTR {
704 char *buffer;
705 int length;
706 int offset;
707 int pos;
708 } INFOSTR;
711 * Status Info
713 typedef struct ips_stat {
714 u32 residue_len;
715 u32 scb_addr;
716 } ips_stat_t;
719 * SCB Queue Format
721 typedef struct ips_scb_queue {
722 struct ips_scb *head;
723 struct ips_scb *tail;
724 unsigned int count;
725 } ips_scb_queue_t;
728 * Wait queue_format
730 typedef struct ips_wait_queue {
731 Scsi_Cmnd *head;
732 Scsi_Cmnd *tail;
733 unsigned int count;
734 } ips_wait_queue_t;
736 typedef struct ips_ha {
737 u8 ha_id[MAX_CHANNELS+1];
738 u32 io_addr; /* Base I/O address */
739 u8 irq; /* IRQ for adapter */
740 u8 ntargets; /* Number of targets */
741 u8 nbus; /* Number of buses */
742 u8 nlun; /* Number of Luns */
743 u16 ad_type; /* Adapter type */
744 u16 host_num; /* Adapter number */
745 u32 max_xfer; /* Maximum Xfer size */
746 u32 max_cmds; /* Max concurrent commands */
747 u32 num_ioctl; /* Number of Ioctls */
748 ips_stat_t sp; /* Status packer pointer */
749 struct ips_scb *scbs; /* Array of all CCBS */
750 struct ips_scb *scb_freelist; /* SCB free list */
751 ips_wait_queue_t scb_waitlist; /* Pending SCB list */
752 ips_wait_queue_t copp_waitlist; /* Pending PT list */
753 ips_scb_queue_t scb_activelist; /* Active SCB list */
754 BASIC_IO_CMD *dummy; /* dummy command */
755 ADAPTER_AREA *adapt; /* Adapter status area */
756 ENQCMD *enq; /* Adapter Enquiry data */
757 CONFCMD *conf; /* Adapter config data */
758 NVRAM_PAGE5 *nvram; /* NVRAM page 5 data */
759 SUBSYS_PARAM *subsys; /* Subsystem parameters */
760 u32 cmd_in_progress; /* Current command in progress*/
761 u32 flags; /* HA flags */
762 u8 waitflag; /* are we waiting for cmd */
763 u8 active;
764 u32 reserved:16; /* reserved space */
765 wait_queue_head_t copp_queue; /* passthru sync queue */
767 #if LINUX_VERSION_CODE >= LinuxVersionCode(2,1,0)
768 spinlock_t scb_lock;
769 spinlock_t copp_lock;
770 #endif
771 } ips_ha_t;
773 typedef void (*scb_callback) (ips_ha_t *, struct ips_scb *);
776 * SCB Format
778 typedef struct ips_scb {
779 HOST_COMMAND cmd;
780 DCDB_TABLE dcdb;
781 u8 target_id;
782 u8 bus;
783 u8 lun;
784 u8 cdb[12];
785 u32 scb_busaddr;
786 u32 data_busaddr;
787 u32 timeout;
788 u8 basic_status;
789 u8 extended_status;
790 u16 breakup;
791 u32 data_len;
792 u32 sg_len;
793 u32 flags;
794 u32 op_code;
795 SG_LIST *sg_list;
796 Scsi_Cmnd *scsi_cmd;
797 struct ips_scb *q_next;
798 scb_callback callback;
799 } ips_scb_t;
802 * Passthru Command Format
804 typedef struct {
805 u8 CoppID[4];
806 u32 CoppCmd;
807 u32 PtBuffer;
808 u8 *CmdBuffer;
809 u32 CmdBSize;
810 ips_scb_t CoppCP;
811 u32 TimeOut;
812 u8 BasicStatus;
813 u8 ExtendedStatus;
814 u16 reserved;
815 } ips_passthru_t;
817 #endif
822 * Overrides for Emacs so that we almost follow Linus's tabbing style.
823 * Emacs will notice this stuff at the end of the file and automatically
824 * adjust the settings for this buffer only. This must remain at the end
825 * of the file.
826 * ---------------------------------------------------------------------------
827 * Local variables:
828 * c-indent-level: 2
829 * c-brace-imaginary-offset: 0
830 * c-brace-offset: -2
831 * c-argdecl-indent: 2
832 * c-label-offset: -2
833 * c-continued-statement-offset: 2
834 * c-continued-brace-offset: 0
835 * indent-tabs-mode: nil
836 * tab-width: 8
837 * End: