gdth.h 46 KB

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