]> bbs.cooldavid.org Git - net-next-2.6.git/blame - drivers/scsi/gdth.h
[SCSI] gdth: Remove virt hosts
[net-next-2.6.git] / drivers / scsi / gdth.h
CommitLineData
1da177e4
LT
1#ifndef _GDTH_H
2#define _GDTH_H
3
4/*
5 * Header file for the GDT Disk Array/Storage RAID controllers driver for Linux
6 *
cbd5f69b 7 * gdth.h Copyright (C) 1995-06 ICP vortex, Achim Leubner
1da177e4
LT
8 * See gdth.c for further informations and
9 * below for supported controller types
10 *
11 * <achim_leubner@adaptec.com>
12 *
cbd5f69b 13 * $Id: gdth.h,v 1.58 2006/01/11 16:14:09 achim Exp $
1da177e4
LT
14 */
15
1da177e4
LT
16#include <linux/types.h>
17
18#ifndef TRUE
19#define TRUE 1
20#endif
21#ifndef FALSE
22#define FALSE 0
23#endif
24
25/* defines, macros */
26
27/* driver version */
cbd5f69b 28#define GDTH_VERSION_STR "3.05"
1da177e4 29#define GDTH_VERSION 3
cbd5f69b 30#define GDTH_SUBVERSION 5
1da177e4
LT
31
32/* protocol version */
33#define PROTOCOL_VERSION 1
34
35/* OEM IDs */
36#define OEM_ID_ICP 0x941c
37#define OEM_ID_INTEL 0x8000
38
39/* controller classes */
40#define GDT_ISA 0x01 /* ISA controller */
41#define GDT_EISA 0x02 /* EISA controller */
42#define GDT_PCI 0x03 /* PCI controller */
43#define GDT_PCINEW 0x04 /* new PCI controller */
44#define GDT_PCIMPR 0x05 /* PCI MPR controller */
45/* GDT_EISA, controller subtypes EISA */
46#define GDT3_ID 0x0130941c /* GDT3000/3020 */
47#define GDT3A_ID 0x0230941c /* GDT3000A/3020A/3050A */
48#define GDT3B_ID 0x0330941c /* GDT3000B/3010A */
49/* GDT_ISA */
50#define GDT2_ID 0x0120941c /* GDT2000/2020 */
51
52/* vendor ID, device IDs (PCI) */
53/* these defines should already exist in <linux/pci.h> */
54#ifndef PCI_VENDOR_ID_VORTEX
55#define PCI_VENDOR_ID_VORTEX 0x1119 /* PCI controller vendor ID */
56#endif
57#ifndef PCI_VENDOR_ID_INTEL
58#define PCI_VENDOR_ID_INTEL 0x8086
59#endif
60
61#ifndef PCI_DEVICE_ID_VORTEX_GDT60x0
62/* GDT_PCI */
63#define PCI_DEVICE_ID_VORTEX_GDT60x0 0 /* GDT6000/6020/6050 */
64#define PCI_DEVICE_ID_VORTEX_GDT6000B 1 /* GDT6000B/6010 */
65/* GDT_PCINEW */
66#define PCI_DEVICE_ID_VORTEX_GDT6x10 2 /* GDT6110/6510 */
67#define PCI_DEVICE_ID_VORTEX_GDT6x20 3 /* GDT6120/6520 */
68#define PCI_DEVICE_ID_VORTEX_GDT6530 4 /* GDT6530 */
69#define PCI_DEVICE_ID_VORTEX_GDT6550 5 /* GDT6550 */
70/* GDT_PCINEW, wide/ultra SCSI controllers */
71#define PCI_DEVICE_ID_VORTEX_GDT6x17 6 /* GDT6117/6517 */
72#define PCI_DEVICE_ID_VORTEX_GDT6x27 7 /* GDT6127/6527 */
73#define PCI_DEVICE_ID_VORTEX_GDT6537 8 /* GDT6537 */
74#define PCI_DEVICE_ID_VORTEX_GDT6557 9 /* GDT6557/6557-ECC */
75/* GDT_PCINEW, wide SCSI controllers */
76#define PCI_DEVICE_ID_VORTEX_GDT6x15 10 /* GDT6115/6515 */
77#define PCI_DEVICE_ID_VORTEX_GDT6x25 11 /* GDT6125/6525 */
78#define PCI_DEVICE_ID_VORTEX_GDT6535 12 /* GDT6535 */
79#define PCI_DEVICE_ID_VORTEX_GDT6555 13 /* GDT6555/6555-ECC */
80#endif
81
82#ifndef PCI_DEVICE_ID_VORTEX_GDT6x17RP
83/* GDT_MPR, RP series, wide/ultra SCSI */
84#define PCI_DEVICE_ID_VORTEX_GDT6x17RP 0x100 /* GDT6117RP/GDT6517RP */
85#define PCI_DEVICE_ID_VORTEX_GDT6x27RP 0x101 /* GDT6127RP/GDT6527RP */
86#define PCI_DEVICE_ID_VORTEX_GDT6537RP 0x102 /* GDT6537RP */
87#define PCI_DEVICE_ID_VORTEX_GDT6557RP 0x103 /* GDT6557RP */
88/* GDT_MPR, RP series, narrow/ultra SCSI */
89#define PCI_DEVICE_ID_VORTEX_GDT6x11RP 0x104 /* GDT6111RP/GDT6511RP */
90#define PCI_DEVICE_ID_VORTEX_GDT6x21RP 0x105 /* GDT6121RP/GDT6521RP */
91#endif
92#ifndef PCI_DEVICE_ID_VORTEX_GDT6x17RD
93/* GDT_MPR, RD series, wide/ultra SCSI */
94#define PCI_DEVICE_ID_VORTEX_GDT6x17RD 0x110 /* GDT6117RD/GDT6517RD */
95#define PCI_DEVICE_ID_VORTEX_GDT6x27RD 0x111 /* GDT6127RD/GDT6527RD */
96#define PCI_DEVICE_ID_VORTEX_GDT6537RD 0x112 /* GDT6537RD */
97#define PCI_DEVICE_ID_VORTEX_GDT6557RD 0x113 /* GDT6557RD */
98/* GDT_MPR, RD series, narrow/ultra SCSI */
99#define PCI_DEVICE_ID_VORTEX_GDT6x11RD 0x114 /* GDT6111RD/GDT6511RD */
100#define PCI_DEVICE_ID_VORTEX_GDT6x21RD 0x115 /* GDT6121RD/GDT6521RD */
101/* GDT_MPR, RD series, wide/ultra2 SCSI */
102#define PCI_DEVICE_ID_VORTEX_GDT6x18RD 0x118 /* GDT6118RD/GDT6518RD/
103 GDT6618RD */
104#define PCI_DEVICE_ID_VORTEX_GDT6x28RD 0x119 /* GDT6128RD/GDT6528RD/
105 GDT6628RD */
106#define PCI_DEVICE_ID_VORTEX_GDT6x38RD 0x11A /* GDT6538RD/GDT6638RD */
107#define PCI_DEVICE_ID_VORTEX_GDT6x58RD 0x11B /* GDT6558RD/GDT6658RD */
108/* GDT_MPR, RN series (64-bit PCI), wide/ultra2 SCSI */
109#define PCI_DEVICE_ID_VORTEX_GDT7x18RN 0x168 /* GDT7118RN/GDT7518RN/
110 GDT7618RN */
111#define PCI_DEVICE_ID_VORTEX_GDT7x28RN 0x169 /* GDT7128RN/GDT7528RN/
112 GDT7628RN */
113#define PCI_DEVICE_ID_VORTEX_GDT7x38RN 0x16A /* GDT7538RN/GDT7638RN */
114#define PCI_DEVICE_ID_VORTEX_GDT7x58RN 0x16B /* GDT7558RN/GDT7658RN */
115#endif
116
117#ifndef PCI_DEVICE_ID_VORTEX_GDT6x19RD
118/* GDT_MPR, RD series, Fibre Channel */
119#define PCI_DEVICE_ID_VORTEX_GDT6x19RD 0x210 /* GDT6519RD/GDT6619RD */
120#define PCI_DEVICE_ID_VORTEX_GDT6x29RD 0x211 /* GDT6529RD/GDT6629RD */
121/* GDT_MPR, RN series (64-bit PCI), Fibre Channel */
122#define PCI_DEVICE_ID_VORTEX_GDT7x19RN 0x260 /* GDT7519RN/GDT7619RN */
123#define PCI_DEVICE_ID_VORTEX_GDT7x29RN 0x261 /* GDT7529RN/GDT7629RN */
124#endif
125
126#ifndef PCI_DEVICE_ID_VORTEX_GDTMAXRP
127/* GDT_MPR, last device ID */
128#define PCI_DEVICE_ID_VORTEX_GDTMAXRP 0x2ff
129#endif
130
131#ifndef PCI_DEVICE_ID_VORTEX_GDTNEWRX
132/* new GDT Rx Controller */
133#define PCI_DEVICE_ID_VORTEX_GDTNEWRX 0x300
134#endif
135
136#ifndef PCI_DEVICE_ID_VORTEX_GDTNEWRX2
137/* new(2) GDT Rx Controller */
138#define PCI_DEVICE_ID_VORTEX_GDTNEWRX2 0x301
139#endif
140
141#ifndef PCI_DEVICE_ID_INTEL_SRC
142/* Intel Storage RAID Controller */
143#define PCI_DEVICE_ID_INTEL_SRC 0x600
144#endif
145
146#ifndef PCI_DEVICE_ID_INTEL_SRC_XSCALE
147/* Intel Storage RAID Controller */
148#define PCI_DEVICE_ID_INTEL_SRC_XSCALE 0x601
149#endif
150
151/* limits */
152#define GDTH_SCRATCH PAGE_SIZE /* 4KB scratch buffer */
153#define GDTH_MAXCMDS 120
154#define GDTH_MAXC_P_L 16 /* max. cmds per lun */
155#define GDTH_MAX_RAW 2 /* max. cmds per raw device */
156#define MAXOFFSETS 128
157#define MAXHA 16
158#define MAXID 127
159#define MAXLUN 8
160#define MAXBUS 6
161#define MAX_EVENTS 100 /* event buffer count */
162#define MAX_RES_ARGS 40 /* device reservation,
163 must be a multiple of 4 */
164#define MAXCYLS 1024
165#define HEADS 64
166#define SECS 32 /* mapping 64*32 */
167#define MEDHEADS 127
168#define MEDSECS 63 /* mapping 127*63 */
169#define BIGHEADS 255
170#define BIGSECS 63 /* mapping 255*63 */
171
172/* special command ptr. */
173#define UNUSED_CMND ((Scsi_Cmnd *)-1)
174#define INTERNAL_CMND ((Scsi_Cmnd *)-2)
175#define SCREEN_CMND ((Scsi_Cmnd *)-3)
176#define SPECIAL_SCP(p) (p==UNUSED_CMND || p==INTERNAL_CMND || p==SCREEN_CMND)
177
178/* controller services */
179#define SCSIRAWSERVICE 3
180#define CACHESERVICE 9
181#define SCREENSERVICE 11
182
183/* screenservice defines */
184#define MSG_INV_HANDLE -1 /* special message handle */
185#define MSGLEN 16 /* size of message text */
186#define MSG_SIZE 34 /* size of message structure */
187#define MSG_REQUEST 0 /* async. event: message */
188
189/* cacheservice defines */
190#define SECTOR_SIZE 0x200 /* always 512 bytes per sec. */
191
192/* DPMEM constants */
193#define DPMEM_MAGIC 0xC0FFEE11
194#define IC_HEADER_BYTES 48
195#define IC_QUEUE_BYTES 4
196#define DPMEM_COMMAND_OFFSET IC_HEADER_BYTES+IC_QUEUE_BYTES*MAXOFFSETS
197
198/* cluster_type constants */
199#define CLUSTER_DRIVE 1
200#define CLUSTER_MOUNTED 2
201#define CLUSTER_RESERVED 4
202#define CLUSTER_RESERVE_STATE (CLUSTER_DRIVE|CLUSTER_MOUNTED|CLUSTER_RESERVED)
203
204/* commands for all services, cache service */
205#define GDT_INIT 0 /* service initialization */
206#define GDT_READ 1 /* read command */
207#define GDT_WRITE 2 /* write command */
208#define GDT_INFO 3 /* information about devices */
209#define GDT_FLUSH 4 /* flush dirty cache buffers */
210#define GDT_IOCTL 5 /* ioctl command */
211#define GDT_DEVTYPE 9 /* additional information */
212#define GDT_MOUNT 10 /* mount cache device */
213#define GDT_UNMOUNT 11 /* unmount cache device */
214#define GDT_SET_FEAT 12 /* set feat. (scatter/gather) */
215#define GDT_GET_FEAT 13 /* get features */
216#define GDT_WRITE_THR 16 /* write through */
217#define GDT_READ_THR 17 /* read through */
218#define GDT_EXT_INFO 18 /* extended info */
219#define GDT_RESET 19 /* controller reset */
220#define GDT_RESERVE_DRV 20 /* reserve host drive */
221#define GDT_RELEASE_DRV 21 /* release host drive */
222#define GDT_CLUST_INFO 22 /* cluster info */
223#define GDT_RW_ATTRIBS 23 /* R/W attribs (write thru,..)*/
224#define GDT_CLUST_RESET 24 /* releases the cluster drives*/
225#define GDT_FREEZE_IO 25 /* freezes all IOs */
226#define GDT_UNFREEZE_IO 26 /* unfreezes all IOs */
227#define GDT_X_INIT_HOST 29 /* ext. init: 64 bit support */
228#define GDT_X_INFO 30 /* ext. info for drives>2TB */
229
230/* raw service commands */
231#define GDT_RESERVE 14 /* reserve dev. to raw serv. */
232#define GDT_RELEASE 15 /* release device */
233#define GDT_RESERVE_ALL 16 /* reserve all devices */
234#define GDT_RELEASE_ALL 17 /* release all devices */
235#define GDT_RESET_BUS 18 /* reset bus */
236#define GDT_SCAN_START 19 /* start device scan */
237#define GDT_SCAN_END 20 /* stop device scan */
238#define GDT_X_INIT_RAW 21 /* ext. init: 64 bit support */
239
240/* screen service commands */
241#define GDT_REALTIME 3 /* realtime clock to screens. */
242#define GDT_X_INIT_SCR 4 /* ext. init: 64 bit support */
243
244/* IOCTL command defines */
245#define SCSI_DR_INFO 0x00 /* SCSI drive info */
246#define SCSI_CHAN_CNT 0x05 /* SCSI channel count */
247#define SCSI_DR_LIST 0x06 /* SCSI drive list */
248#define SCSI_DEF_CNT 0x15 /* grown/primary defects */
249#define DSK_STATISTICS 0x4b /* SCSI disk statistics */
250#define IOCHAN_DESC 0x5d /* description of IO channel */
251#define IOCHAN_RAW_DESC 0x5e /* description of raw IO chn. */
252#define L_CTRL_PATTERN 0x20000000L /* SCSI IOCTL mask */
253#define ARRAY_INFO 0x12 /* array drive info */
254#define ARRAY_DRV_LIST 0x0f /* array drive list */
255#define ARRAY_DRV_LIST2 0x34 /* array drive list (new) */
256#define LA_CTRL_PATTERN 0x10000000L /* array IOCTL mask */
257#define CACHE_DRV_CNT 0x01 /* cache drive count */
258#define CACHE_DRV_LIST 0x02 /* cache drive list */
259#define CACHE_INFO 0x04 /* cache info */
260#define CACHE_CONFIG 0x05 /* cache configuration */
261#define CACHE_DRV_INFO 0x07 /* cache drive info */
262#define BOARD_FEATURES 0x15 /* controller features */
263#define BOARD_INFO 0x28 /* controller info */
264#define SET_PERF_MODES 0x82 /* set mode (coalescing,..) */
265#define GET_PERF_MODES 0x83 /* get mode */
266#define CACHE_READ_OEM_STRING_RECORD 0x84 /* read OEM string record */
267#define HOST_GET 0x10001L /* get host drive list */
268#define IO_CHANNEL 0x00020000L /* default IO channel */
269#define INVALID_CHANNEL 0x0000ffffL /* invalid channel */
270
271/* service errors */
272#define S_OK 1 /* no error */
273#define S_GENERR 6 /* general error */
274#define S_BSY 7 /* controller busy */
275#define S_CACHE_UNKNOWN 12 /* cache serv.: drive unknown */
276#define S_RAW_SCSI 12 /* raw serv.: target error */
277#define S_RAW_ILL 0xff /* raw serv.: illegal */
278#define S_NOFUNC -2 /* unknown function */
279#define S_CACHE_RESERV -24 /* cache: reserv. conflict */
280
281/* timeout values */
282#define INIT_RETRIES 100000 /* 100000 * 1ms = 100s */
283#define INIT_TIMEOUT 100000 /* 100000 * 1ms = 100s */
284#define POLL_TIMEOUT 10000 /* 10000 * 1ms = 10s */
285
286/* priorities */
287#define DEFAULT_PRI 0x20
288#define IOCTL_PRI 0x10
289#define HIGH_PRI 0x08
290
291/* data directions */
292#define GDTH_DATA_IN 0x01000000L /* data from target */
293#define GDTH_DATA_OUT 0x00000000L /* data to target */
294
295/* BMIC registers (EISA controllers) */
296#define ID0REG 0x0c80 /* board ID */
297#define EINTENABREG 0x0c89 /* interrupt enable */
298#define SEMA0REG 0x0c8a /* command semaphore */
299#define SEMA1REG 0x0c8b /* status semaphore */
300#define LDOORREG 0x0c8d /* local doorbell */
301#define EDENABREG 0x0c8e /* EISA system doorbell enab. */
302#define EDOORREG 0x0c8f /* EISA system doorbell */
303#define MAILBOXREG 0x0c90 /* mailbox reg. (16 bytes) */
304#define EISAREG 0x0cc0 /* EISA configuration */
305
306/* DMA memory mappings */
307#define GDTH_MAP_NONE 0
308#define GDTH_MAP_SINGLE 1
309#define GDTH_MAP_SG 2
310#define GDTH_MAP_IOCTL 3
311
312/* other defines */
313#define LINUX_OS 8 /* used for cache optim. */
314#define SCATTER_GATHER 1 /* s/g feature */
315#define SECS32 0x1f /* round capacity */
316#define BIOS_ID_OFFS 0x10 /* offset contr-ID in ISABIOS */
317#define LOCALBOARD 0 /* board node always 0 */
318#define ASYNCINDEX 0 /* cmd index async. event */
319#define SPEZINDEX 1 /* cmd index unknown service */
320#define COALINDEX (GDTH_MAXCMDS + 2)
321
322/* features */
323#define SCATTER_GATHER 1 /* s/g feature */
324#define GDT_WR_THROUGH 0x100 /* WRITE_THROUGH supported */
325#define GDT_64BIT 0x200 /* 64bit / drv>2TB support */
326
327#include "gdth_ioctl.h"
328
329/* screenservice message */
330typedef struct {
331 ulong32 msg_handle; /* message handle */
332 ulong32 msg_len; /* size of message */
333 ulong32 msg_alen; /* answer length */
334 unchar msg_answer; /* answer flag */
335 unchar msg_ext; /* more messages */
336 unchar msg_reserved[2];
337 char msg_text[MSGLEN+2]; /* the message text */
338} PACKED gdth_msg_str;
339
340
341/* IOCTL data structures */
342
343/* Status coalescing buffer for returning multiple requests per interrupt */
344typedef struct {
345 ulong32 status;
346 ulong32 ext_status;
347 ulong32 info0;
348 ulong32 info1;
349} PACKED gdth_coal_status;
350
351/* performance mode data structure */
352typedef struct {
353 ulong32 version; /* The version of this IOCTL structure. */
354 ulong32 st_mode; /* 0=dis., 1=st_buf_addr1 valid, 2=both */
355 ulong32 st_buff_addr1; /* physical address of status buffer 1 */
356 ulong32 st_buff_u_addr1; /* reserved for 64 bit addressing */
357 ulong32 st_buff_indx1; /* reserved command idx. for this buffer */
358 ulong32 st_buff_addr2; /* physical address of status buffer 1 */
359 ulong32 st_buff_u_addr2; /* reserved for 64 bit addressing */
360 ulong32 st_buff_indx2; /* reserved command idx. for this buffer */
361 ulong32 st_buff_size; /* size of each buffer in bytes */
362 ulong32 cmd_mode; /* 0 = mode disabled, 1 = cmd_buff_addr1 */
363 ulong32 cmd_buff_addr1; /* physical address of cmd buffer 1 */
364 ulong32 cmd_buff_u_addr1; /* reserved for 64 bit addressing */
365 ulong32 cmd_buff_indx1; /* cmd buf addr1 unique identifier */
366 ulong32 cmd_buff_addr2; /* physical address of cmd buffer 1 */
367 ulong32 cmd_buff_u_addr2; /* reserved for 64 bit addressing */
368 ulong32 cmd_buff_indx2; /* cmd buf addr1 unique identifier */
369 ulong32 cmd_buff_size; /* size of each cmd bufer in bytes */
370 ulong32 reserved1;
371 ulong32 reserved2;
372} PACKED gdth_perf_modes;
373
374/* SCSI drive info */
375typedef struct {
376 unchar vendor[8]; /* vendor string */
377 unchar product[16]; /* product string */
378 unchar revision[4]; /* revision */
379 ulong32 sy_rate; /* current rate for sync. tr. */
380 ulong32 sy_max_rate; /* max. rate for sync. tr. */
381 ulong32 no_ldrive; /* belongs to this log. drv.*/
382 ulong32 blkcnt; /* number of blocks */
383 ushort blksize; /* size of block in bytes */
384 unchar available; /* flag: access is available */
385 unchar init; /* medium is initialized */
386 unchar devtype; /* SCSI devicetype */
387 unchar rm_medium; /* medium is removable */
388 unchar wp_medium; /* medium is write protected */
389 unchar ansi; /* SCSI I/II or III? */
390 unchar protocol; /* same as ansi */
391 unchar sync; /* flag: sync. transfer enab. */
392 unchar disc; /* flag: disconnect enabled */
393 unchar queueing; /* flag: command queing enab. */
394 unchar cached; /* flag: caching enabled */
395 unchar target_id; /* target ID of device */
396 unchar lun; /* LUN id of device */
397 unchar orphan; /* flag: drive fragment */
398 ulong32 last_error; /* sense key or drive state */
399 ulong32 last_result; /* result of last command */
400 ulong32 check_errors; /* err. in last surface check */
401 unchar percent; /* progress for surface check */
402 unchar last_check; /* IOCTRL operation */
403 unchar res[2];
404 ulong32 flags; /* from 1.19/2.19: raw reserv.*/
405 unchar multi_bus; /* multi bus dev? (fibre ch.) */
406 unchar mb_status; /* status: available? */
407 unchar res2[2];
408 unchar mb_alt_status; /* status on second bus */
409 unchar mb_alt_bid; /* number of second bus */
410 unchar mb_alt_tid; /* target id on second bus */
411 unchar res3;
412 unchar fc_flag; /* from 1.22/2.22: info valid?*/
413 unchar res4;
414 ushort fc_frame_size; /* frame size (bytes) */
415 char wwn[8]; /* world wide name */
416} PACKED gdth_diskinfo_str;
417
418/* get SCSI channel count */
419typedef struct {
420 ulong32 channel_no; /* number of channel */
421 ulong32 drive_cnt; /* drive count */
422 unchar siop_id; /* SCSI processor ID */
423 unchar siop_state; /* SCSI processor state */
424} PACKED gdth_getch_str;
425
426/* get SCSI drive numbers */
427typedef struct {
428 ulong32 sc_no; /* SCSI channel */
429 ulong32 sc_cnt; /* sc_list[] elements */
430 ulong32 sc_list[MAXID]; /* minor device numbers */
431} PACKED gdth_drlist_str;
432
433/* get grown/primary defect count */
434typedef struct {
435 unchar sddc_type; /* 0x08: grown, 0x10: prim. */
436 unchar sddc_format; /* list entry format */
437 unchar sddc_len; /* list entry length */
438 unchar sddc_res;
439 ulong32 sddc_cnt; /* entry count */
440} PACKED gdth_defcnt_str;
441
442/* disk statistics */
443typedef struct {
444 ulong32 bid; /* SCSI channel */
445 ulong32 first; /* first SCSI disk */
446 ulong32 entries; /* number of elements */
447 ulong32 count; /* (R) number of init. el. */
448 ulong32 mon_time; /* time stamp */
449 struct {
450 unchar tid; /* target ID */
451 unchar lun; /* LUN */
452 unchar res[2];
453 ulong32 blk_size; /* block size in bytes */
454 ulong32 rd_count; /* bytes read */
455 ulong32 wr_count; /* bytes written */
456 ulong32 rd_blk_count; /* blocks read */
457 ulong32 wr_blk_count; /* blocks written */
458 ulong32 retries; /* retries */
459 ulong32 reassigns; /* reassigns */
460 } PACKED list[1];
461} PACKED gdth_dskstat_str;
462
463/* IO channel header */
464typedef struct {
465 ulong32 version; /* version (-1UL: newest) */
466 unchar list_entries; /* list entry count */
467 unchar first_chan; /* first channel number */
468 unchar last_chan; /* last channel number */
469 unchar chan_count; /* (R) channel count */
470 ulong32 list_offset; /* offset of list[0] */
471} PACKED gdth_iochan_header;
472
473/* get IO channel description */
474typedef struct {
475 gdth_iochan_header hdr;
476 struct {
477 ulong32 address; /* channel address */
478 unchar type; /* type (SCSI, FCAL) */
479 unchar local_no; /* local number */
480 ushort features; /* channel features */
481 } PACKED list[MAXBUS];
482} PACKED gdth_iochan_str;
483
484/* get raw IO channel description */
485typedef struct {
486 gdth_iochan_header hdr;
487 struct {
488 unchar proc_id; /* processor id */
489 unchar proc_defect; /* defect ? */
490 unchar reserved[2];
491 } PACKED list[MAXBUS];
492} PACKED gdth_raw_iochan_str;
493
494/* array drive component */
495typedef struct {
496 ulong32 al_controller; /* controller ID */
497 unchar al_cache_drive; /* cache drive number */
498 unchar al_status; /* cache drive state */
499 unchar al_res[2];
500} PACKED gdth_arraycomp_str;
501
502/* array drive information */
503typedef struct {
504 unchar ai_type; /* array type (RAID0,4,5) */
505 unchar ai_cache_drive_cnt; /* active cachedrives */
506 unchar ai_state; /* array drive state */
507 unchar ai_master_cd; /* master cachedrive */
508 ulong32 ai_master_controller; /* ID of master controller */
509 ulong32 ai_size; /* user capacity [sectors] */
510 ulong32 ai_striping_size; /* striping size [sectors] */
511 ulong32 ai_secsize; /* sector size [bytes] */
512 ulong32 ai_err_info; /* failed cache drive */
513 unchar ai_name[8]; /* name of the array drive */
514 unchar ai_controller_cnt; /* number of controllers */
515 unchar ai_removable; /* flag: removable */
516 unchar ai_write_protected; /* flag: write protected */
517 unchar ai_devtype; /* type: always direct access */
518 gdth_arraycomp_str ai_drives[35]; /* drive components: */
519 unchar ai_drive_entries; /* number of drive components */
520 unchar ai_protected; /* protection flag */
521 unchar ai_verify_state; /* state of a parity verify */
522 unchar ai_ext_state; /* extended array drive state */
523 unchar ai_expand_state; /* array expand state (>=2.18)*/
524 unchar ai_reserved[3];
525} PACKED gdth_arrayinf_str;
526
527/* get array drive list */
528typedef struct {
529 ulong32 controller_no; /* controller no. */
530 unchar cd_handle; /* master cachedrive */
531 unchar is_arrayd; /* Flag: is array drive? */
532 unchar is_master; /* Flag: is array master? */
533 unchar is_parity; /* Flag: is parity drive? */
534 unchar is_hotfix; /* Flag: is hotfix drive? */
535 unchar res[3];
536} PACKED gdth_alist_str;
537
538typedef struct {
539 ulong32 entries_avail; /* allocated entries */
540 ulong32 entries_init; /* returned entries */
541 ulong32 first_entry; /* first entry number */
542 ulong32 list_offset; /* offset of following list */
543 gdth_alist_str list[1]; /* list */
544} PACKED gdth_arcdl_str;
545
546/* cache info/config IOCTL */
547typedef struct {
548 ulong32 version; /* firmware version */
549 ushort state; /* cache state (on/off) */
550 ushort strategy; /* cache strategy */
551 ushort write_back; /* write back state (on/off) */
552 ushort block_size; /* cache block size */
553} PACKED gdth_cpar_str;
554
555typedef struct {
556 ulong32 csize; /* cache size */
557 ulong32 read_cnt; /* read/write counter */
558 ulong32 write_cnt;
559 ulong32 tr_hits; /* hits */
560 ulong32 sec_hits;
561 ulong32 sec_miss; /* misses */
562} PACKED gdth_cstat_str;
563
564typedef struct {
565 gdth_cpar_str cpar;
566 gdth_cstat_str cstat;
567} PACKED gdth_cinfo_str;
568
569/* cache drive info */
570typedef struct {
571 unchar cd_name[8]; /* cache drive name */
572 ulong32 cd_devtype; /* SCSI devicetype */
573 ulong32 cd_ldcnt; /* number of log. drives */
574 ulong32 cd_last_error; /* last error */
575 unchar cd_initialized; /* drive is initialized */
576 unchar cd_removable; /* media is removable */
577 unchar cd_write_protected; /* write protected */
578 unchar cd_flags; /* Pool Hot Fix? */
579 ulong32 ld_blkcnt; /* number of blocks */
580 ulong32 ld_blksize; /* blocksize */
581 ulong32 ld_dcnt; /* number of disks */
582 ulong32 ld_slave; /* log. drive index */
583 ulong32 ld_dtype; /* type of logical drive */
584 ulong32 ld_last_error; /* last error */
585 unchar ld_name[8]; /* log. drive name */
586 unchar ld_error; /* error */
587} PACKED gdth_cdrinfo_str;
588
589/* OEM string */
590typedef struct {
591 ulong32 ctl_version;
592 ulong32 file_major_version;
593 ulong32 file_minor_version;
594 ulong32 buffer_size;
595 ulong32 cpy_count;
596 ulong32 ext_error;
597 ulong32 oem_id;
598 ulong32 board_id;
599} PACKED gdth_oem_str_params;
600
601typedef struct {
602 unchar product_0_1_name[16];
603 unchar product_4_5_name[16];
604 unchar product_cluster_name[16];
605 unchar product_reserved[16];
606 unchar scsi_cluster_target_vendor_id[16];
607 unchar cluster_raid_fw_name[16];
608 unchar oem_brand_name[16];
609 unchar oem_raid_type[16];
610 unchar bios_type[13];
611 unchar bios_title[50];
612 unchar oem_company_name[37];
613 ulong32 pci_id_1;
614 ulong32 pci_id_2;
615 unchar validation_status[80];
616 unchar reserved_1[4];
617 unchar scsi_host_drive_inquiry_vendor_id[16];
618 unchar library_file_template[16];
619 unchar reserved_2[16];
620 unchar tool_name_1[32];
621 unchar tool_name_2[32];
622 unchar tool_name_3[32];
623 unchar oem_contact_1[84];
624 unchar oem_contact_2[84];
625 unchar oem_contact_3[84];
626} PACKED gdth_oem_str;
627
628typedef struct {
629 gdth_oem_str_params params;
630 gdth_oem_str text;
631} PACKED gdth_oem_str_ioctl;
632
633/* board features */
634typedef struct {
635 unchar chaining; /* Chaining supported */
636 unchar striping; /* Striping (RAID-0) supp. */
637 unchar mirroring; /* Mirroring (RAID-1) supp. */
638 unchar raid; /* RAID-4/5/10 supported */
639} PACKED gdth_bfeat_str;
640
641/* board info IOCTL */
642typedef struct {
643 ulong32 ser_no; /* serial no. */
644 unchar oem_id[2]; /* OEM ID */
645 ushort ep_flags; /* eprom flags */
646 ulong32 proc_id; /* processor ID */
647 ulong32 memsize; /* memory size (bytes) */
648 unchar mem_banks; /* memory banks */
649 unchar chan_type; /* channel type */
650 unchar chan_count; /* channel count */
651 unchar rdongle_pres; /* dongle present? */
652 ulong32 epr_fw_ver; /* (eprom) firmware version */
653 ulong32 upd_fw_ver; /* (update) firmware version */
654 ulong32 upd_revision; /* update revision */
655 char type_string[16]; /* controller name */
656 char raid_string[16]; /* RAID firmware name */
657 unchar update_pres; /* update present? */
658 unchar xor_pres; /* XOR engine present? */
659 unchar prom_type; /* ROM type (eprom/flash) */
660 unchar prom_count; /* number of ROM devices */
661 ulong32 dup_pres; /* duplexing module present? */
662 ulong32 chan_pres; /* number of expansion chn. */
663 ulong32 mem_pres; /* memory expansion inst. ? */
664 unchar ft_bus_system; /* fault bus supported? */
665 unchar subtype_valid; /* board_subtype valid? */
666 unchar board_subtype; /* subtype/hardware level */
667 unchar ramparity_pres; /* RAM parity check hardware? */
668} PACKED gdth_binfo_str;
669
670/* get host drive info */
671typedef struct {
672 char name[8]; /* host drive name */
673 ulong32 size; /* size (sectors) */
674 unchar host_drive; /* host drive number */
675 unchar log_drive; /* log. drive (master) */
676 unchar reserved;
677 unchar rw_attribs; /* r/w attribs */
678 ulong32 start_sec; /* start sector */
679} PACKED gdth_hentry_str;
680
681typedef struct {
682 ulong32 entries; /* entry count */
683 ulong32 offset; /* offset of entries */
684 unchar secs_p_head; /* sectors/head */
685 unchar heads_p_cyl; /* heads/cylinder */
686 unchar reserved;
687 unchar clust_drvtype; /* cluster drive type */
688 ulong32 location; /* controller number */
689 gdth_hentry_str entry[MAX_HDRIVES]; /* entries */
690} PACKED gdth_hget_str;
691
692
693/* DPRAM structures */
694
695/* interface area ISA/PCI */
696typedef struct {
697 unchar S_Cmd_Indx; /* special command */
698 unchar volatile S_Status; /* status special command */
699 ushort reserved1;
700 ulong32 S_Info[4]; /* add. info special command */
701 unchar volatile Sema0; /* command semaphore */
702 unchar reserved2[3];
703 unchar Cmd_Index; /* command number */
704 unchar reserved3[3];
705 ushort volatile Status; /* command status */
706 ushort Service; /* service(for async.events) */
707 ulong32 Info[2]; /* additional info */
708 struct {
709 ushort offset; /* command offs. in the DPRAM*/
710 ushort serv_id; /* service */
711 } PACKED comm_queue[MAXOFFSETS]; /* command queue */
712 ulong32 bios_reserved[2];
713 unchar gdt_dpr_cmd[1]; /* commands */
714} PACKED gdt_dpr_if;
715
716/* SRAM structure PCI controllers */
717typedef struct {
718 ulong32 magic; /* controller ID from BIOS */
719 ushort need_deinit; /* switch betw. BIOS/driver */
720 unchar switch_support; /* see need_deinit */
721 unchar padding[9];
722 unchar os_used[16]; /* OS code per service */
723 unchar unused[28];
724 unchar fw_magic; /* contr. ID from firmware */
725} PACKED gdt_pci_sram;
726
727/* SRAM structure EISA controllers (but NOT GDT3000/3020) */
728typedef struct {
729 unchar os_used[16]; /* OS code per service */
730 ushort need_deinit; /* switch betw. BIOS/driver */
731 unchar switch_support; /* see need_deinit */
732 unchar padding;
733} PACKED gdt_eisa_sram;
734
735
736/* DPRAM ISA controllers */
737typedef struct {
738 union {
739 struct {
740 unchar bios_used[0x3c00-32]; /* 15KB - 32Bytes BIOS */
741 ulong32 magic; /* controller (EISA) ID */
742 ushort need_deinit; /* switch betw. BIOS/driver */
743 unchar switch_support; /* see need_deinit */
744 unchar padding[9];
745 unchar os_used[16]; /* OS code per service */
746 } PACKED dp_sram;
747 unchar bios_area[0x4000]; /* 16KB reserved for BIOS */
748 } bu;
749 union {
750 gdt_dpr_if ic; /* interface area */
751 unchar if_area[0x3000]; /* 12KB for interface */
752 } u;
753 struct {
754 unchar memlock; /* write protection DPRAM */
755 unchar event; /* release event */
756 unchar irqen; /* board interrupts enable */
757 unchar irqdel; /* acknowledge board int. */
758 unchar volatile Sema1; /* status semaphore */
759 unchar rq; /* IRQ/DRQ configuration */
760 } PACKED io;
761} PACKED gdt2_dpram_str;
762
763/* DPRAM PCI controllers */
764typedef struct {
765 union {
766 gdt_dpr_if ic; /* interface area */
767 unchar if_area[0xff0-sizeof(gdt_pci_sram)];
768 } u;
769 gdt_pci_sram gdt6sr; /* SRAM structure */
770 struct {
771 unchar unused0[1];
772 unchar volatile Sema1; /* command semaphore */
773 unchar unused1[3];
774 unchar irqen; /* board interrupts enable */
775 unchar unused2[2];
776 unchar event; /* release event */
777 unchar unused3[3];
778 unchar irqdel; /* acknowledge board int. */
779 unchar unused4[3];
780 } PACKED io;
781} PACKED gdt6_dpram_str;
782
783/* PLX register structure (new PCI controllers) */
784typedef struct {
785 unchar cfg_reg; /* DPRAM cfg.(2:below 1MB,0:anywhere)*/
786 unchar unused1[0x3f];
787 unchar volatile sema0_reg; /* command semaphore */
788 unchar volatile sema1_reg; /* status semaphore */
789 unchar unused2[2];
790 ushort volatile status; /* command status */
791 ushort service; /* service */
792 ulong32 info[2]; /* additional info */
793 unchar unused3[0x10];
794 unchar ldoor_reg; /* PCI to local doorbell */
795 unchar unused4[3];
796 unchar volatile edoor_reg; /* local to PCI doorbell */
797 unchar unused5[3];
798 unchar control0; /* control0 register(unused) */
799 unchar control1; /* board interrupts enable */
800 unchar unused6[0x16];
801} PACKED gdt6c_plx_regs;
802
803/* DPRAM new PCI controllers */
804typedef struct {
805 union {
806 gdt_dpr_if ic; /* interface area */
807 unchar if_area[0x4000-sizeof(gdt_pci_sram)];
808 } u;
809 gdt_pci_sram gdt6sr; /* SRAM structure */
810} PACKED gdt6c_dpram_str;
811
812/* i960 register structure (PCI MPR controllers) */
813typedef struct {
814 unchar unused1[16];
815 unchar volatile sema0_reg; /* command semaphore */
816 unchar unused2;
817 unchar volatile sema1_reg; /* status semaphore */
818 unchar unused3;
819 ushort volatile status; /* command status */
820 ushort service; /* service */
821 ulong32 info[2]; /* additional info */
822 unchar ldoor_reg; /* PCI to local doorbell */
823 unchar unused4[11];
824 unchar volatile edoor_reg; /* local to PCI doorbell */
825 unchar unused5[7];
826 unchar edoor_en_reg; /* board interrupts enable */
827 unchar unused6[27];
828 ulong32 unused7[939];
829 ulong32 severity;
830 char evt_str[256]; /* event string */
831} PACKED gdt6m_i960_regs;
832
833/* DPRAM PCI MPR controllers */
834typedef struct {
835 gdt6m_i960_regs i960r; /* 4KB i960 registers */
836 union {
837 gdt_dpr_if ic; /* interface area */
838 unchar if_area[0x3000-sizeof(gdt_pci_sram)];
839 } u;
840 gdt_pci_sram gdt6sr; /* SRAM structure */
841} PACKED gdt6m_dpram_str;
842
843
844/* PCI resources */
845typedef struct {
846 struct pci_dev *pdev;
1da177e4
LT
847 ulong dpmem; /* DPRAM address */
848 ulong io; /* IO address */
849 ulong io_mm; /* IO address mem. mapped */
850 unchar irq; /* IRQ */
851} gdth_pci_str;
852
853
854/* controller information structure */
855typedef struct {
856 ushort oem_id; /* OEM */
857 ushort type; /* controller class */
858 ulong32 stype; /* subtype (PCI: device ID) */
1da177e4
LT
859 ushort fw_vers; /* firmware version */
860 ushort cache_feat; /* feat. cache serv. (s/g,..)*/
861 ushort raw_feat; /* feat. raw service (s/g,..)*/
862 ushort screen_feat; /* feat. raw service (s/g,..)*/
863 ushort bmic; /* BMIC address (EISA) */
864 void __iomem *brd; /* DPRAM address */
865 ulong32 brd_phys; /* slot number/BIOS address */
866 gdt6c_plx_regs *plx; /* PLX regs (new PCI contr.) */
867 gdth_cmd_str *pccb; /* address command structure */
868 ulong32 ccb_phys; /* phys. address */
869#ifdef INT_COAL
870 gdth_coal_status *coal_stat; /* buffer for coalescing int.*/
871 ulong64 coal_stat_phys; /* phys. address */
872#endif
873 char *pscratch; /* scratch (DMA) buffer */
874 ulong64 scratch_phys; /* phys. address */
875 unchar scratch_busy; /* in use? */
876 unchar dma64_support; /* 64-bit DMA supported? */
877 gdth_msg_str *pmsg; /* message buffer */
878 ulong64 msg_phys; /* phys. address */
879 unchar scan_mode; /* current scan mode */
880 unchar irq; /* IRQ */
881 unchar drq; /* DRQ (ISA controllers) */
882 ushort status; /* command status */
883 ushort service; /* service/firmware ver./.. */
884 ulong32 info;
885 ulong32 info2; /* additional info */
886 Scsi_Cmnd *req_first; /* top of request queue */
887 struct {
888 unchar present; /* Flag: host drive present? */
889 unchar is_logdrv; /* Flag: log. drive (master)? */
890 unchar is_arraydrv; /* Flag: array drive? */
891 unchar is_master; /* Flag: array drive master? */
892 unchar is_parity; /* Flag: parity drive? */
893 unchar is_hotfix; /* Flag: hotfix drive? */
894 unchar master_no; /* number of master drive */
895 unchar lock; /* drive locked? (hot plug) */
896 unchar heads; /* mapping */
897 unchar secs;
898 ushort devtype; /* further information */
899 ulong64 size; /* capacity */
900 unchar ldr_no; /* log. drive no. */
901 unchar rw_attribs; /* r/w attributes */
902 unchar cluster_type; /* cluster properties */
903 unchar media_changed; /* Flag:MOUNT/UNMOUNT occured */
904 ulong32 start_sec; /* start sector */
905 } hdr[MAX_LDRIVES]; /* host drives */
906 struct {
907 unchar lock; /* channel locked? (hot plug) */
908 unchar pdev_cnt; /* physical device count */
909 unchar local_no; /* local channel number */
910 unchar io_cnt[MAXID]; /* current IO count */
911 ulong32 address; /* channel address */
912 ulong32 id_list[MAXID]; /* IDs of the phys. devices */
913 } raw[MAXBUS]; /* SCSI channels */
914 struct {
915 Scsi_Cmnd *cmnd; /* pending request */
916 ushort service; /* service */
917 } cmd_tab[GDTH_MAXCMDS]; /* table of pend. requests */
918 unchar bus_cnt; /* SCSI bus count */
919 unchar tid_cnt; /* Target ID count */
920 unchar bus_id[MAXBUS]; /* IOP IDs */
921 unchar virt_bus; /* number of virtual bus */
922 unchar more_proc; /* more /proc info supported */
923 ushort cmd_cnt; /* command count in DPRAM */
924 ushort cmd_len; /* length of actual command */
925 ushort cmd_offs_dpmem; /* actual offset in DPRAM */
926 ushort ic_all_size; /* sizeof DPRAM interf. area */
927 gdth_cpar_str cpar; /* controller cache par. */
928 gdth_bfeat_str bfeat; /* controller features */
929 gdth_binfo_str binfo; /* controller info */
930 gdth_evt_data dvr; /* event structure */
931 spinlock_t smp_lock;
1da177e4 932 struct pci_dev *pdev;
1da177e4
LT
933 char oem_name[8];
934#ifdef GDTH_DMA_STATISTICS
935 ulong dma32_cnt, dma64_cnt; /* statistics: DMA buffer */
936#endif
f64a181d 937 struct scsi_device *sdev;
1da177e4
LT
938} gdth_ha_str;
939
940/* structure for scsi_register(), SCSI bus != 0 */
941typedef struct {
942 ushort hanum;
943 ushort busnum;
944} gdth_num_str;
945
946/* structure for scsi_register() */
947typedef struct {
948 gdth_num_str numext; /* must be the first element */
949 gdth_ha_str haext;
950 gdth_cmd_str cmdext;
951} gdth_ext_str;
952
953
954/* INQUIRY data format */
955typedef struct {
956 unchar type_qual;
957 unchar modif_rmb;
958 unchar version;
959 unchar resp_aenc;
960 unchar add_length;
961 unchar reserved1;
962 unchar reserved2;
963 unchar misc;
964 unchar vendor[8];
965 unchar product[16];
966 unchar revision[4];
967} PACKED gdth_inq_data;
968
969/* READ_CAPACITY data format */
970typedef struct {
971 ulong32 last_block_no;
972 ulong32 block_length;
973} PACKED gdth_rdcap_data;
974
975/* READ_CAPACITY (16) data format */
976typedef struct {
977 ulong64 last_block_no;
978 ulong32 block_length;
979} PACKED gdth_rdcap16_data;
980
981/* REQUEST_SENSE data format */
982typedef struct {
983 unchar errorcode;
984 unchar segno;
985 unchar key;
986 ulong32 info;
987 unchar add_length;
988 ulong32 cmd_info;
989 unchar adsc;
990 unchar adsq;
991 unchar fruc;
992 unchar key_spec[3];
993} PACKED gdth_sense_data;
994
995/* MODE_SENSE data format */
996typedef struct {
997 struct {
998 unchar data_length;
999 unchar med_type;
1000 unchar dev_par;
1001 unchar bd_length;
1002 } PACKED hd;
1003 struct {
1004 unchar dens_code;
1005 unchar block_count[3];
1006 unchar reserved;
1007 unchar block_length[3];
1008 } PACKED bd;
1009} PACKED gdth_modep_data;
1010
1011/* stack frame */
1012typedef struct {
1013 ulong b[10]; /* 32/64 bit compiler ! */
1014} PACKED gdth_stackframe;
1015
1016
1017/* function prototyping */
1018
1da177e4 1019int gdth_proc_info(struct Scsi_Host *, char *,char **,off_t,int,int);
1da177e4 1020
1da177e4 1021#endif