gdth.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:54k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

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