ips.h 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252
  1. /*****************************************************************************/
  2. /* ips.h -- driver for the Adaptec / IBM ServeRAID controller */
  3. /* */
  4. /* Written By: Keith Mitchell, IBM Corporation */
  5. /* Jack Hammer, Adaptec, Inc. */
  6. /* David Jeffery, Adaptec, Inc. */
  7. /* */
  8. /* Copyright (C) 1999 IBM Corporation */
  9. /* Copyright (C) 2003 Adaptec, Inc. */
  10. /* */
  11. /* This program is free software; you can redistribute it and/or modify */
  12. /* it under the terms of the GNU General Public License as published by */
  13. /* the Free Software Foundation; either version 2 of the License, or */
  14. /* (at your option) any later version. */
  15. /* */
  16. /* This program is distributed in the hope that it will be useful, */
  17. /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
  18. /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
  19. /* GNU General Public License for more details. */
  20. /* */
  21. /* NO WARRANTY */
  22. /* THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR */
  23. /* CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT */
  24. /* LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, */
  25. /* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is */
  26. /* solely responsible for determining the appropriateness of using and */
  27. /* distributing the Program and assumes all risks associated with its */
  28. /* exercise of rights under this Agreement, including but not limited to */
  29. /* the risks and costs of program errors, damage to or loss of data, */
  30. /* programs or equipment, and unavailability or interruption of operations. */
  31. /* */
  32. /* DISCLAIMER OF LIABILITY */
  33. /* NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY */
  34. /* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL */
  35. /* DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND */
  36. /* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR */
  37. /* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE */
  38. /* USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED */
  39. /* HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES */
  40. /* */
  41. /* You should have received a copy of the GNU General Public License */
  42. /* along with this program; if not, write to the Free Software */
  43. /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
  44. /* */
  45. /* Bugs/Comments/Suggestions should be mailed to: */
  46. /* ipslinux@adaptec.com */
  47. /* */
  48. /*****************************************************************************/
  49. #ifndef _IPS_H_
  50. #define _IPS_H_
  51. #include <linux/nmi.h>
  52. #include <asm/uaccess.h>
  53. #include <asm/io.h>
  54. /*
  55. * Some handy macros
  56. */
  57. #define IPS_HA(x) ((ips_ha_t *) x->hostdata)
  58. #define IPS_COMMAND_ID(ha, scb) (int) (scb - ha->scbs)
  59. #define IPS_IS_TROMBONE(ha) (((ha->pcidev->device == IPS_DEVICEID_COPPERHEAD) && \
  60. (ha->pcidev->revision >= IPS_REVID_TROMBONE32) && \
  61. (ha->pcidev->revision <= IPS_REVID_TROMBONE64)) ? 1 : 0)
  62. #define IPS_IS_CLARINET(ha) (((ha->pcidev->device == IPS_DEVICEID_COPPERHEAD) && \
  63. (ha->pcidev->revision >= IPS_REVID_CLARINETP1) && \
  64. (ha->pcidev->revision <= IPS_REVID_CLARINETP3)) ? 1 : 0)
  65. #define IPS_IS_MORPHEUS(ha) (ha->pcidev->device == IPS_DEVICEID_MORPHEUS)
  66. #define IPS_IS_MARCO(ha) (ha->pcidev->device == IPS_DEVICEID_MARCO)
  67. #define IPS_USE_I2O_DELIVER(ha) ((IPS_IS_MORPHEUS(ha) || \
  68. (IPS_IS_TROMBONE(ha) && \
  69. (ips_force_i2o))) ? 1 : 0)
  70. #define IPS_USE_MEMIO(ha) ((IPS_IS_MORPHEUS(ha) || \
  71. ((IPS_IS_TROMBONE(ha) || IPS_IS_CLARINET(ha)) && \
  72. (ips_force_memio))) ? 1 : 0)
  73. #define IPS_HAS_ENH_SGLIST(ha) (IPS_IS_MORPHEUS(ha) || IPS_IS_MARCO(ha))
  74. #define IPS_USE_ENH_SGLIST(ha) ((ha)->flags & IPS_HA_ENH_SG)
  75. #define IPS_SGLIST_SIZE(ha) (IPS_USE_ENH_SGLIST(ha) ? \
  76. sizeof(IPS_ENH_SG_LIST) : sizeof(IPS_STD_SG_LIST))
  77. #define IPS_PRINTK(level, pcidev, format, arg...) \
  78. dev_printk(level , &((pcidev)->dev) , format , ## arg)
  79. #define MDELAY(n) \
  80. do { \
  81. mdelay(n); \
  82. touch_nmi_watchdog(); \
  83. } while (0)
  84. #ifndef min
  85. #define min(x,y) ((x) < (y) ? x : y)
  86. #endif
  87. #ifndef __iomem /* For clean compiles in earlier kernels without __iomem annotations */
  88. #define __iomem
  89. #endif
  90. #define pci_dma_hi32(a) ((a >> 16) >> 16)
  91. #define pci_dma_lo32(a) (a & 0xffffffff)
  92. #if (BITS_PER_LONG > 32) || defined(CONFIG_HIGHMEM64G)
  93. #define IPS_ENABLE_DMA64 (1)
  94. #else
  95. #define IPS_ENABLE_DMA64 (0)
  96. #endif
  97. /*
  98. * Adapter address map equates
  99. */
  100. #define IPS_REG_HISR 0x08 /* Host Interrupt Status Reg */
  101. #define IPS_REG_CCSAR 0x10 /* Cmd Channel System Addr Reg */
  102. #define IPS_REG_CCCR 0x14 /* Cmd Channel Control Reg */
  103. #define IPS_REG_SQHR 0x20 /* Status Q Head Reg */
  104. #define IPS_REG_SQTR 0x24 /* Status Q Tail Reg */
  105. #define IPS_REG_SQER 0x28 /* Status Q End Reg */
  106. #define IPS_REG_SQSR 0x2C /* Status Q Start Reg */
  107. #define IPS_REG_SCPR 0x05 /* Subsystem control port reg */
  108. #define IPS_REG_ISPR 0x06 /* interrupt status port reg */
  109. #define IPS_REG_CBSP 0x07 /* CBSP register */
  110. #define IPS_REG_FLAP 0x18 /* Flash address port */
  111. #define IPS_REG_FLDP 0x1C /* Flash data port */
  112. #define IPS_REG_NDAE 0x38 /* Anaconda 64 NDAE Register */
  113. #define IPS_REG_I2O_INMSGQ 0x40 /* I2O Inbound Message Queue */
  114. #define IPS_REG_I2O_OUTMSGQ 0x44 /* I2O Outbound Message Queue */
  115. #define IPS_REG_I2O_HIR 0x30 /* I2O Interrupt Status */
  116. #define IPS_REG_I960_IDR 0x20 /* i960 Inbound Doorbell */
  117. #define IPS_REG_I960_MSG0 0x18 /* i960 Outbound Reg 0 */
  118. #define IPS_REG_I960_MSG1 0x1C /* i960 Outbound Reg 1 */
  119. #define IPS_REG_I960_OIMR 0x34 /* i960 Oubound Int Mask Reg */
  120. /*
  121. * Adapter register bit equates
  122. */
  123. #define IPS_BIT_GHI 0x04 /* HISR General Host Interrupt */
  124. #define IPS_BIT_SQO 0x02 /* HISR Status Q Overflow */
  125. #define IPS_BIT_SCE 0x01 /* HISR Status Channel Enqueue */
  126. #define IPS_BIT_SEM 0x08 /* CCCR Semaphore Bit */
  127. #define IPS_BIT_ILE 0x10 /* CCCR ILE Bit */
  128. #define IPS_BIT_START_CMD 0x101A /* CCCR Start Command Channel */
  129. #define IPS_BIT_START_STOP 0x0002 /* CCCR Start/Stop Bit */
  130. #define IPS_BIT_RST 0x80 /* SCPR Reset Bit */
  131. #define IPS_BIT_EBM 0x02 /* SCPR Enable Bus Master */
  132. #define IPS_BIT_EI 0x80 /* HISR Enable Interrupts */
  133. #define IPS_BIT_OP 0x01 /* OP bit in CBSP */
  134. #define IPS_BIT_I2O_OPQI 0x08 /* General Host Interrupt */
  135. #define IPS_BIT_I960_MSG0I 0x01 /* Message Register 0 Interrupt*/
  136. #define IPS_BIT_I960_MSG1I 0x02 /* Message Register 1 Interrupt*/
  137. /*
  138. * Adapter Command ID Equates
  139. */
  140. #define IPS_CMD_GET_LD_INFO 0x19
  141. #define IPS_CMD_GET_SUBSYS 0x40
  142. #define IPS_CMD_READ_CONF 0x38
  143. #define IPS_CMD_RW_NVRAM_PAGE 0xBC
  144. #define IPS_CMD_READ 0x02
  145. #define IPS_CMD_WRITE 0x03
  146. #define IPS_CMD_FFDC 0xD7
  147. #define IPS_CMD_ENQUIRY 0x05
  148. #define IPS_CMD_FLUSH 0x0A
  149. #define IPS_CMD_READ_SG 0x82
  150. #define IPS_CMD_WRITE_SG 0x83
  151. #define IPS_CMD_DCDB 0x04
  152. #define IPS_CMD_DCDB_SG 0x84
  153. #define IPS_CMD_EXTENDED_DCDB 0x95
  154. #define IPS_CMD_EXTENDED_DCDB_SG 0x96
  155. #define IPS_CMD_CONFIG_SYNC 0x58
  156. #define IPS_CMD_ERROR_TABLE 0x17
  157. #define IPS_CMD_DOWNLOAD 0x20
  158. #define IPS_CMD_RW_BIOSFW 0x22
  159. #define IPS_CMD_GET_VERSION_INFO 0xC6
  160. #define IPS_CMD_RESET_CHANNEL 0x1A
  161. /*
  162. * Adapter Equates
  163. */
  164. #define IPS_CSL 0xFF
  165. #define IPS_POCL 0x30
  166. #define IPS_NORM_STATE 0x00
  167. #define IPS_MAX_ADAPTER_TYPES 3
  168. #define IPS_MAX_ADAPTERS 16
  169. #define IPS_MAX_IOCTL 1
  170. #define IPS_MAX_IOCTL_QUEUE 8
  171. #define IPS_MAX_QUEUE 128
  172. #define IPS_BLKSIZE 512
  173. #define IPS_MAX_SG 17
  174. #define IPS_MAX_LD 8
  175. #define IPS_MAX_CHANNELS 4
  176. #define IPS_MAX_TARGETS 15
  177. #define IPS_MAX_CHUNKS 16
  178. #define IPS_MAX_CMDS 128
  179. #define IPS_MAX_XFER 0x10000
  180. #define IPS_NVRAM_P5_SIG 0xFFDDBB99
  181. #define IPS_MAX_POST_BYTES 0x02
  182. #define IPS_MAX_CONFIG_BYTES 0x02
  183. #define IPS_GOOD_POST_STATUS 0x80
  184. #define IPS_SEM_TIMEOUT 2000
  185. #define IPS_IOCTL_COMMAND 0x0D
  186. #define IPS_INTR_ON 0
  187. #define IPS_INTR_IORL 1
  188. #define IPS_FFDC 99
  189. #define IPS_ADAPTER_ID 0xF
  190. #define IPS_VENDORID_IBM 0x1014
  191. #define IPS_VENDORID_ADAPTEC 0x9005
  192. #define IPS_DEVICEID_COPPERHEAD 0x002E
  193. #define IPS_DEVICEID_MORPHEUS 0x01BD
  194. #define IPS_DEVICEID_MARCO 0x0250
  195. #define IPS_SUBDEVICEID_4M 0x01BE
  196. #define IPS_SUBDEVICEID_4L 0x01BF
  197. #define IPS_SUBDEVICEID_4MX 0x0208
  198. #define IPS_SUBDEVICEID_4LX 0x020E
  199. #define IPS_SUBDEVICEID_5I2 0x0259
  200. #define IPS_SUBDEVICEID_5I1 0x0258
  201. #define IPS_SUBDEVICEID_6M 0x0279
  202. #define IPS_SUBDEVICEID_6I 0x028C
  203. #define IPS_SUBDEVICEID_7k 0x028E
  204. #define IPS_SUBDEVICEID_7M 0x028F
  205. #define IPS_IOCTL_SIZE 8192
  206. #define IPS_STATUS_SIZE 4
  207. #define IPS_STATUS_Q_SIZE (IPS_MAX_CMDS+1) * IPS_STATUS_SIZE
  208. #define IPS_IMAGE_SIZE 500 * 1024
  209. #define IPS_MEMMAP_SIZE 128
  210. #define IPS_ONE_MSEC 1
  211. #define IPS_ONE_SEC 1000
  212. /*
  213. * Geometry Settings
  214. */
  215. #define IPS_COMP_HEADS 128
  216. #define IPS_COMP_SECTORS 32
  217. #define IPS_NORM_HEADS 254
  218. #define IPS_NORM_SECTORS 63
  219. /*
  220. * Adapter Basic Status Codes
  221. */
  222. #define IPS_BASIC_STATUS_MASK 0xFF
  223. #define IPS_GSC_STATUS_MASK 0x0F
  224. #define IPS_CMD_SUCCESS 0x00
  225. #define IPS_CMD_RECOVERED_ERROR 0x01
  226. #define IPS_INVAL_OPCO 0x03
  227. #define IPS_INVAL_CMD_BLK 0x04
  228. #define IPS_INVAL_PARM_BLK 0x05
  229. #define IPS_BUSY 0x08
  230. #define IPS_CMD_CMPLT_WERROR 0x0C
  231. #define IPS_LD_ERROR 0x0D
  232. #define IPS_CMD_TIMEOUT 0x0E
  233. #define IPS_PHYS_DRV_ERROR 0x0F
  234. /*
  235. * Adapter Extended Status Equates
  236. */
  237. #define IPS_ERR_SEL_TO 0xF0
  238. #define IPS_ERR_OU_RUN 0xF2
  239. #define IPS_ERR_HOST_RESET 0xF7
  240. #define IPS_ERR_DEV_RESET 0xF8
  241. #define IPS_ERR_RECOVERY 0xFC
  242. #define IPS_ERR_CKCOND 0xFF
  243. /*
  244. * Operating System Defines
  245. */
  246. #define IPS_OS_WINDOWS_NT 0x01
  247. #define IPS_OS_NETWARE 0x02
  248. #define IPS_OS_OPENSERVER 0x03
  249. #define IPS_OS_UNIXWARE 0x04
  250. #define IPS_OS_SOLARIS 0x05
  251. #define IPS_OS_OS2 0x06
  252. #define IPS_OS_LINUX 0x07
  253. #define IPS_OS_FREEBSD 0x08
  254. /*
  255. * Adapter Revision ID's
  256. */
  257. #define IPS_REVID_SERVERAID 0x02
  258. #define IPS_REVID_NAVAJO 0x03
  259. #define IPS_REVID_SERVERAID2 0x04
  260. #define IPS_REVID_CLARINETP1 0x05
  261. #define IPS_REVID_CLARINETP2 0x07
  262. #define IPS_REVID_CLARINETP3 0x0D
  263. #define IPS_REVID_TROMBONE32 0x0F
  264. #define IPS_REVID_TROMBONE64 0x10
  265. /*
  266. * NVRAM Page 5 Adapter Defines
  267. */
  268. #define IPS_ADTYPE_SERVERAID 0x01
  269. #define IPS_ADTYPE_SERVERAID2 0x02
  270. #define IPS_ADTYPE_NAVAJO 0x03
  271. #define IPS_ADTYPE_KIOWA 0x04
  272. #define IPS_ADTYPE_SERVERAID3 0x05
  273. #define IPS_ADTYPE_SERVERAID3L 0x06
  274. #define IPS_ADTYPE_SERVERAID4H 0x07
  275. #define IPS_ADTYPE_SERVERAID4M 0x08
  276. #define IPS_ADTYPE_SERVERAID4L 0x09
  277. #define IPS_ADTYPE_SERVERAID4MX 0x0A
  278. #define IPS_ADTYPE_SERVERAID4LX 0x0B
  279. #define IPS_ADTYPE_SERVERAID5I2 0x0C
  280. #define IPS_ADTYPE_SERVERAID5I1 0x0D
  281. #define IPS_ADTYPE_SERVERAID6M 0x0E
  282. #define IPS_ADTYPE_SERVERAID6I 0x0F
  283. #define IPS_ADTYPE_SERVERAID7t 0x10
  284. #define IPS_ADTYPE_SERVERAID7k 0x11
  285. #define IPS_ADTYPE_SERVERAID7M 0x12
  286. /*
  287. * Adapter Command/Status Packet Definitions
  288. */
  289. #define IPS_SUCCESS 0x01 /* Successfully completed */
  290. #define IPS_SUCCESS_IMM 0x02 /* Success - Immediately */
  291. #define IPS_FAILURE 0x04 /* Completed with Error */
  292. /*
  293. * Logical Drive Equates
  294. */
  295. #define IPS_LD_OFFLINE 0x02
  296. #define IPS_LD_OKAY 0x03
  297. #define IPS_LD_FREE 0x00
  298. #define IPS_LD_SYS 0x06
  299. #define IPS_LD_CRS 0x24
  300. /*
  301. * DCDB Table Equates
  302. */
  303. #define IPS_NO_DISCONNECT 0x00
  304. #define IPS_DISCONNECT_ALLOWED 0x80
  305. #define IPS_NO_AUTO_REQSEN 0x40
  306. #define IPS_DATA_NONE 0x00
  307. #define IPS_DATA_UNK 0x00
  308. #define IPS_DATA_IN 0x01
  309. #define IPS_DATA_OUT 0x02
  310. #define IPS_TRANSFER64K 0x08
  311. #define IPS_NOTIMEOUT 0x00
  312. #define IPS_TIMEOUT10 0x10
  313. #define IPS_TIMEOUT60 0x20
  314. #define IPS_TIMEOUT20M 0x30
  315. /*
  316. * SCSI Inquiry Data Flags
  317. */
  318. #define IPS_SCSI_INQ_TYPE_DASD 0x00
  319. #define IPS_SCSI_INQ_TYPE_PROCESSOR 0x03
  320. #define IPS_SCSI_INQ_LU_CONNECTED 0x00
  321. #define IPS_SCSI_INQ_RD_REV2 0x02
  322. #define IPS_SCSI_INQ_REV2 0x02
  323. #define IPS_SCSI_INQ_REV3 0x03
  324. #define IPS_SCSI_INQ_Address16 0x01
  325. #define IPS_SCSI_INQ_Address32 0x02
  326. #define IPS_SCSI_INQ_MedChanger 0x08
  327. #define IPS_SCSI_INQ_MultiPort 0x10
  328. #define IPS_SCSI_INQ_EncServ 0x40
  329. #define IPS_SCSI_INQ_SoftReset 0x01
  330. #define IPS_SCSI_INQ_CmdQue 0x02
  331. #define IPS_SCSI_INQ_Linked 0x08
  332. #define IPS_SCSI_INQ_Sync 0x10
  333. #define IPS_SCSI_INQ_WBus16 0x20
  334. #define IPS_SCSI_INQ_WBus32 0x40
  335. #define IPS_SCSI_INQ_RelAdr 0x80
  336. /*
  337. * SCSI Request Sense Data Flags
  338. */
  339. #define IPS_SCSI_REQSEN_VALID 0x80
  340. #define IPS_SCSI_REQSEN_CURRENT_ERR 0x70
  341. #define IPS_SCSI_REQSEN_NO_SENSE 0x00
  342. /*
  343. * SCSI Mode Page Equates
  344. */
  345. #define IPS_SCSI_MP3_SoftSector 0x01
  346. #define IPS_SCSI_MP3_HardSector 0x02
  347. #define IPS_SCSI_MP3_Removeable 0x04
  348. #define IPS_SCSI_MP3_AllocateSurface 0x08
  349. /*
  350. * HA Flags
  351. */
  352. #define IPS_HA_ENH_SG 0x1
  353. /*
  354. * SCB Flags
  355. */
  356. #define IPS_SCB_MAP_SG 0x00008
  357. #define IPS_SCB_MAP_SINGLE 0X00010
  358. /*
  359. * Passthru stuff
  360. */
  361. #define IPS_COPPUSRCMD (('C'<<8) | 65)
  362. #define IPS_COPPIOCCMD (('C'<<8) | 66)
  363. #define IPS_NUMCTRLS (('C'<<8) | 68)
  364. #define IPS_CTRLINFO (('C'<<8) | 69)
  365. /* flashing defines */
  366. #define IPS_FW_IMAGE 0x00
  367. #define IPS_BIOS_IMAGE 0x01
  368. #define IPS_WRITE_FW 0x01
  369. #define IPS_WRITE_BIOS 0x02
  370. #define IPS_ERASE_BIOS 0x03
  371. #define IPS_BIOS_HEADER 0xC0
  372. /* time oriented stuff */
  373. #define IPS_IS_LEAP_YEAR(y) (((y % 4 == 0) && ((y % 100 != 0) || (y % 400 == 0))) ? 1 : 0)
  374. #define IPS_NUM_LEAP_YEARS_THROUGH(y) ((y) / 4 - (y) / 100 + (y) / 400)
  375. #define IPS_SECS_MIN 60
  376. #define IPS_SECS_HOUR 3600
  377. #define IPS_SECS_8HOURS 28800
  378. #define IPS_SECS_DAY 86400
  379. #define IPS_DAYS_NORMAL_YEAR 365
  380. #define IPS_DAYS_LEAP_YEAR 366
  381. #define IPS_EPOCH_YEAR 1970
  382. /*
  383. * Scsi_Host Template
  384. */
  385. static int ips_biosparam(struct scsi_device *sdev, struct block_device *bdev,
  386. sector_t capacity, int geom[]);
  387. static int ips_slave_configure(struct scsi_device *SDptr);
  388. /*
  389. * Raid Command Formats
  390. */
  391. typedef struct {
  392. uint8_t op_code;
  393. uint8_t command_id;
  394. uint8_t log_drv;
  395. uint8_t sg_count;
  396. uint32_t lba;
  397. uint32_t sg_addr;
  398. uint16_t sector_count;
  399. uint8_t segment_4G;
  400. uint8_t enhanced_sg;
  401. uint32_t ccsar;
  402. uint32_t cccr;
  403. } IPS_IO_CMD, *PIPS_IO_CMD;
  404. typedef struct {
  405. uint8_t op_code;
  406. uint8_t command_id;
  407. uint16_t reserved;
  408. uint32_t reserved2;
  409. uint32_t buffer_addr;
  410. uint32_t reserved3;
  411. uint32_t ccsar;
  412. uint32_t cccr;
  413. } IPS_LD_CMD, *PIPS_LD_CMD;
  414. typedef struct {
  415. uint8_t op_code;
  416. uint8_t command_id;
  417. uint8_t reserved;
  418. uint8_t reserved2;
  419. uint32_t reserved3;
  420. uint32_t buffer_addr;
  421. uint32_t reserved4;
  422. } IPS_IOCTL_CMD, *PIPS_IOCTL_CMD;
  423. typedef struct {
  424. uint8_t op_code;
  425. uint8_t command_id;
  426. uint8_t channel;
  427. uint8_t reserved3;
  428. uint8_t reserved4;
  429. uint8_t reserved5;
  430. uint8_t reserved6;
  431. uint8_t reserved7;
  432. uint8_t reserved8;
  433. uint8_t reserved9;
  434. uint8_t reserved10;
  435. uint8_t reserved11;
  436. uint8_t reserved12;
  437. uint8_t reserved13;
  438. uint8_t reserved14;
  439. uint8_t adapter_flag;
  440. } IPS_RESET_CMD, *PIPS_RESET_CMD;
  441. typedef struct {
  442. uint8_t op_code;
  443. uint8_t command_id;
  444. uint16_t reserved;
  445. uint32_t reserved2;
  446. uint32_t dcdb_address;
  447. uint16_t reserved3;
  448. uint8_t segment_4G;
  449. uint8_t enhanced_sg;
  450. uint32_t ccsar;
  451. uint32_t cccr;
  452. } IPS_DCDB_CMD, *PIPS_DCDB_CMD;
  453. typedef struct {
  454. uint8_t op_code;
  455. uint8_t command_id;
  456. uint8_t channel;
  457. uint8_t source_target;
  458. uint32_t reserved;
  459. uint32_t reserved2;
  460. uint32_t reserved3;
  461. uint32_t ccsar;
  462. uint32_t cccr;
  463. } IPS_CS_CMD, *PIPS_CS_CMD;
  464. typedef struct {
  465. uint8_t op_code;
  466. uint8_t command_id;
  467. uint8_t log_drv;
  468. uint8_t control;
  469. uint32_t reserved;
  470. uint32_t reserved2;
  471. uint32_t reserved3;
  472. uint32_t ccsar;
  473. uint32_t cccr;
  474. } IPS_US_CMD, *PIPS_US_CMD;
  475. typedef struct {
  476. uint8_t op_code;
  477. uint8_t command_id;
  478. uint8_t reserved;
  479. uint8_t state;
  480. uint32_t reserved2;
  481. uint32_t reserved3;
  482. uint32_t reserved4;
  483. uint32_t ccsar;
  484. uint32_t cccr;
  485. } IPS_FC_CMD, *PIPS_FC_CMD;
  486. typedef struct {
  487. uint8_t op_code;
  488. uint8_t command_id;
  489. uint8_t reserved;
  490. uint8_t desc;
  491. uint32_t reserved2;
  492. uint32_t buffer_addr;
  493. uint32_t reserved3;
  494. uint32_t ccsar;
  495. uint32_t cccr;
  496. } IPS_STATUS_CMD, *PIPS_STATUS_CMD;
  497. typedef struct {
  498. uint8_t op_code;
  499. uint8_t command_id;
  500. uint8_t page;
  501. uint8_t write;
  502. uint32_t reserved;
  503. uint32_t buffer_addr;
  504. uint32_t reserved2;
  505. uint32_t ccsar;
  506. uint32_t cccr;
  507. } IPS_NVRAM_CMD, *PIPS_NVRAM_CMD;
  508. typedef struct
  509. {
  510. uint8_t op_code;
  511. uint8_t command_id;
  512. uint16_t reserved;
  513. uint32_t count;
  514. uint32_t buffer_addr;
  515. uint32_t reserved2;
  516. } IPS_VERSION_INFO, *PIPS_VERSION_INFO;
  517. typedef struct {
  518. uint8_t op_code;
  519. uint8_t command_id;
  520. uint8_t reset_count;
  521. uint8_t reset_type;
  522. uint8_t second;
  523. uint8_t minute;
  524. uint8_t hour;
  525. uint8_t day;
  526. uint8_t reserved1[4];
  527. uint8_t month;
  528. uint8_t yearH;
  529. uint8_t yearL;
  530. uint8_t reserved2;
  531. } IPS_FFDC_CMD, *PIPS_FFDC_CMD;
  532. typedef struct {
  533. uint8_t op_code;
  534. uint8_t command_id;
  535. uint8_t type;
  536. uint8_t direction;
  537. uint32_t count;
  538. uint32_t buffer_addr;
  539. uint8_t total_packets;
  540. uint8_t packet_num;
  541. uint16_t reserved;
  542. } IPS_FLASHFW_CMD, *PIPS_FLASHFW_CMD;
  543. typedef struct {
  544. uint8_t op_code;
  545. uint8_t command_id;
  546. uint8_t type;
  547. uint8_t direction;
  548. uint32_t count;
  549. uint32_t buffer_addr;
  550. uint32_t offset;
  551. } IPS_FLASHBIOS_CMD, *PIPS_FLASHBIOS_CMD;
  552. typedef union {
  553. IPS_IO_CMD basic_io;
  554. IPS_LD_CMD logical_info;
  555. IPS_IOCTL_CMD ioctl_info;
  556. IPS_DCDB_CMD dcdb;
  557. IPS_CS_CMD config_sync;
  558. IPS_US_CMD unlock_stripe;
  559. IPS_FC_CMD flush_cache;
  560. IPS_STATUS_CMD status;
  561. IPS_NVRAM_CMD nvram;
  562. IPS_FFDC_CMD ffdc;
  563. IPS_FLASHFW_CMD flashfw;
  564. IPS_FLASHBIOS_CMD flashbios;
  565. IPS_VERSION_INFO version_info;
  566. IPS_RESET_CMD reset;
  567. } IPS_HOST_COMMAND, *PIPS_HOST_COMMAND;
  568. typedef struct {
  569. uint8_t logical_id;
  570. uint8_t reserved;
  571. uint8_t raid_level;
  572. uint8_t state;
  573. uint32_t sector_count;
  574. } IPS_DRIVE_INFO, *PIPS_DRIVE_INFO;
  575. typedef struct {
  576. uint8_t no_of_log_drive;
  577. uint8_t reserved[3];
  578. IPS_DRIVE_INFO drive_info[IPS_MAX_LD];
  579. } IPS_LD_INFO, *PIPS_LD_INFO;
  580. typedef struct {
  581. uint8_t device_address;
  582. uint8_t cmd_attribute;
  583. uint16_t transfer_length;
  584. uint32_t buffer_pointer;
  585. uint8_t cdb_length;
  586. uint8_t sense_length;
  587. uint8_t sg_count;
  588. uint8_t reserved;
  589. uint8_t scsi_cdb[12];
  590. uint8_t sense_info[64];
  591. uint8_t scsi_status;
  592. uint8_t reserved2[3];
  593. } IPS_DCDB_TABLE, *PIPS_DCDB_TABLE;
  594. typedef struct {
  595. uint8_t device_address;
  596. uint8_t cmd_attribute;
  597. uint8_t cdb_length;
  598. uint8_t reserved_for_LUN;
  599. uint32_t transfer_length;
  600. uint32_t buffer_pointer;
  601. uint16_t sg_count;
  602. uint8_t sense_length;
  603. uint8_t scsi_status;
  604. uint32_t reserved;
  605. uint8_t scsi_cdb[16];
  606. uint8_t sense_info[56];
  607. } IPS_DCDB_TABLE_TAPE, *PIPS_DCDB_TABLE_TAPE;
  608. typedef union {
  609. struct {
  610. volatile uint8_t reserved;
  611. volatile uint8_t command_id;
  612. volatile uint8_t basic_status;
  613. volatile uint8_t extended_status;
  614. } fields;
  615. volatile uint32_t value;
  616. } IPS_STATUS, *PIPS_STATUS;
  617. typedef struct {
  618. IPS_STATUS status[IPS_MAX_CMDS + 1];
  619. volatile PIPS_STATUS p_status_start;
  620. volatile PIPS_STATUS p_status_end;
  621. volatile PIPS_STATUS p_status_tail;
  622. volatile uint32_t hw_status_start;
  623. volatile uint32_t hw_status_tail;
  624. } IPS_ADAPTER, *PIPS_ADAPTER;
  625. typedef struct {
  626. uint8_t ucLogDriveCount;
  627. uint8_t ucMiscFlag;
  628. uint8_t ucSLTFlag;
  629. uint8_t ucBSTFlag;
  630. uint8_t ucPwrChgCnt;
  631. uint8_t ucWrongAdrCnt;
  632. uint8_t ucUnidentCnt;
  633. uint8_t ucNVramDevChgCnt;
  634. uint8_t CodeBlkVersion[8];
  635. uint8_t BootBlkVersion[8];
  636. uint32_t ulDriveSize[IPS_MAX_LD];
  637. uint8_t ucConcurrentCmdCount;
  638. uint8_t ucMaxPhysicalDevices;
  639. uint16_t usFlashRepgmCount;
  640. uint8_t ucDefunctDiskCount;
  641. uint8_t ucRebuildFlag;
  642. uint8_t ucOfflineLogDrvCount;
  643. uint8_t ucCriticalDrvCount;
  644. uint16_t usConfigUpdateCount;
  645. uint8_t ucBlkFlag;
  646. uint8_t reserved;
  647. uint16_t usAddrDeadDisk[IPS_MAX_CHANNELS * (IPS_MAX_TARGETS + 1)];
  648. } IPS_ENQ, *PIPS_ENQ;
  649. typedef struct {
  650. uint8_t ucInitiator;
  651. uint8_t ucParameters;
  652. uint8_t ucMiscFlag;
  653. uint8_t ucState;
  654. uint32_t ulBlockCount;
  655. uint8_t ucDeviceId[28];
  656. } IPS_DEVSTATE, *PIPS_DEVSTATE;
  657. typedef struct {
  658. uint8_t ucChn;
  659. uint8_t ucTgt;
  660. uint16_t ucReserved;
  661. uint32_t ulStartSect;
  662. uint32_t ulNoOfSects;
  663. } IPS_CHUNK, *PIPS_CHUNK;
  664. typedef struct {
  665. uint16_t ucUserField;
  666. uint8_t ucState;
  667. uint8_t ucRaidCacheParam;
  668. uint8_t ucNoOfChunkUnits;
  669. uint8_t ucStripeSize;
  670. uint8_t ucParams;
  671. uint8_t ucReserved;
  672. uint32_t ulLogDrvSize;
  673. IPS_CHUNK chunk[IPS_MAX_CHUNKS];
  674. } IPS_LD, *PIPS_LD;
  675. typedef struct {
  676. uint8_t board_disc[8];
  677. uint8_t processor[8];
  678. uint8_t ucNoChanType;
  679. uint8_t ucNoHostIntType;
  680. uint8_t ucCompression;
  681. uint8_t ucNvramType;
  682. uint32_t ulNvramSize;
  683. } IPS_HARDWARE, *PIPS_HARDWARE;
  684. typedef struct {
  685. uint8_t ucLogDriveCount;
  686. uint8_t ucDateD;
  687. uint8_t ucDateM;
  688. uint8_t ucDateY;
  689. uint8_t init_id[4];
  690. uint8_t host_id[12];
  691. uint8_t time_sign[8];
  692. uint32_t UserOpt;
  693. uint16_t user_field;
  694. uint8_t ucRebuildRate;
  695. uint8_t ucReserve;
  696. IPS_HARDWARE hardware_disc;
  697. IPS_LD logical_drive[IPS_MAX_LD];
  698. IPS_DEVSTATE dev[IPS_MAX_CHANNELS][IPS_MAX_TARGETS+1];
  699. uint8_t reserved[512];
  700. } IPS_CONF, *PIPS_CONF;
  701. typedef struct {
  702. uint32_t signature;
  703. uint8_t reserved1;
  704. uint8_t adapter_slot;
  705. uint16_t adapter_type;
  706. uint8_t ctrl_bios[8];
  707. uint8_t versioning; /* 1 = Versioning Supported, else 0 */
  708. uint8_t version_mismatch; /* 1 = Versioning MisMatch, else 0 */
  709. uint8_t reserved2;
  710. uint8_t operating_system;
  711. uint8_t driver_high[4];
  712. uint8_t driver_low[4];
  713. uint8_t BiosCompatibilityID[8];
  714. uint8_t ReservedForOS2[8];
  715. uint8_t bios_high[4]; /* Adapter's Flashed BIOS Version */
  716. uint8_t bios_low[4];
  717. uint8_t adapter_order[16]; /* BIOS Telling us the Sort Order */
  718. uint8_t Filler[60];
  719. } IPS_NVRAM_P5, *PIPS_NVRAM_P5;
  720. /*--------------------------------------------------------------------------*/
  721. /* Data returned from a GetVersion Command */
  722. /*--------------------------------------------------------------------------*/
  723. /* SubSystem Parameter[4] */
  724. #define IPS_GET_VERSION_SUPPORT 0x00018000 /* Mask for Versioning Support */
  725. typedef struct
  726. {
  727. uint32_t revision;
  728. uint8_t bootBlkVersion[32];
  729. uint8_t bootBlkAttributes[4];
  730. uint8_t codeBlkVersion[32];
  731. uint8_t biosVersion[32];
  732. uint8_t biosAttributes[4];
  733. uint8_t compatibilityId[32];
  734. uint8_t reserved[4];
  735. } IPS_VERSION_DATA;
  736. typedef struct _IPS_SUBSYS {
  737. uint32_t param[128];
  738. } IPS_SUBSYS, *PIPS_SUBSYS;
  739. /**
  740. ** SCSI Structures
  741. **/
  742. /*
  743. * Inquiry Data Format
  744. */
  745. typedef struct {
  746. uint8_t DeviceType;
  747. uint8_t DeviceTypeQualifier;
  748. uint8_t Version;
  749. uint8_t ResponseDataFormat;
  750. uint8_t AdditionalLength;
  751. uint8_t Reserved;
  752. uint8_t Flags[2];
  753. uint8_t VendorId[8];
  754. uint8_t ProductId[16];
  755. uint8_t ProductRevisionLevel[4];
  756. uint8_t Reserved2; /* Provides NULL terminator to name */
  757. } IPS_SCSI_INQ_DATA, *PIPS_SCSI_INQ_DATA;
  758. /*
  759. * Read Capacity Data Format
  760. */
  761. typedef struct {
  762. uint32_t lba;
  763. uint32_t len;
  764. } IPS_SCSI_CAPACITY;
  765. /*
  766. * Request Sense Data Format
  767. */
  768. typedef struct {
  769. uint8_t ResponseCode;
  770. uint8_t SegmentNumber;
  771. uint8_t Flags;
  772. uint8_t Information[4];
  773. uint8_t AdditionalLength;
  774. uint8_t CommandSpecific[4];
  775. uint8_t AdditionalSenseCode;
  776. uint8_t AdditionalSenseCodeQual;
  777. uint8_t FRUCode;
  778. uint8_t SenseKeySpecific[3];
  779. } IPS_SCSI_REQSEN;
  780. /*
  781. * Sense Data Format - Page 3
  782. */
  783. typedef struct {
  784. uint8_t PageCode;
  785. uint8_t PageLength;
  786. uint16_t TracksPerZone;
  787. uint16_t AltSectorsPerZone;
  788. uint16_t AltTracksPerZone;
  789. uint16_t AltTracksPerVolume;
  790. uint16_t SectorsPerTrack;
  791. uint16_t BytesPerSector;
  792. uint16_t Interleave;
  793. uint16_t TrackSkew;
  794. uint16_t CylinderSkew;
  795. uint8_t flags;
  796. uint8_t reserved[3];
  797. } IPS_SCSI_MODE_PAGE3;
  798. /*
  799. * Sense Data Format - Page 4
  800. */
  801. typedef struct {
  802. uint8_t PageCode;
  803. uint8_t PageLength;
  804. uint16_t CylindersHigh;
  805. uint8_t CylindersLow;
  806. uint8_t Heads;
  807. uint16_t WritePrecompHigh;
  808. uint8_t WritePrecompLow;
  809. uint16_t ReducedWriteCurrentHigh;
  810. uint8_t ReducedWriteCurrentLow;
  811. uint16_t StepRate;
  812. uint16_t LandingZoneHigh;
  813. uint8_t LandingZoneLow;
  814. uint8_t flags;
  815. uint8_t RotationalOffset;
  816. uint8_t Reserved;
  817. uint16_t MediumRotationRate;
  818. uint8_t Reserved2[2];
  819. } IPS_SCSI_MODE_PAGE4;
  820. /*
  821. * Sense Data Format - Page 8
  822. */
  823. typedef struct {
  824. uint8_t PageCode;
  825. uint8_t PageLength;
  826. uint8_t flags;
  827. uint8_t RetentPrio;
  828. uint16_t DisPrefetchLen;
  829. uint16_t MinPrefetchLen;
  830. uint16_t MaxPrefetchLen;
  831. uint16_t MaxPrefetchCeiling;
  832. } IPS_SCSI_MODE_PAGE8;
  833. /*
  834. * Sense Data Format - Block Descriptor (DASD)
  835. */
  836. typedef struct {
  837. uint32_t NumberOfBlocks;
  838. uint8_t DensityCode;
  839. uint16_t BlockLengthHigh;
  840. uint8_t BlockLengthLow;
  841. } IPS_SCSI_MODE_PAGE_BLKDESC;
  842. /*
  843. * Sense Data Format - Mode Page Header
  844. */
  845. typedef struct {
  846. uint8_t DataLength;
  847. uint8_t MediumType;
  848. uint8_t Reserved;
  849. uint8_t BlockDescLength;
  850. } IPS_SCSI_MODE_PAGE_HEADER;
  851. typedef struct {
  852. IPS_SCSI_MODE_PAGE_HEADER hdr;
  853. IPS_SCSI_MODE_PAGE_BLKDESC blkdesc;
  854. union {
  855. IPS_SCSI_MODE_PAGE3 pg3;
  856. IPS_SCSI_MODE_PAGE4 pg4;
  857. IPS_SCSI_MODE_PAGE8 pg8;
  858. } pdata;
  859. } IPS_SCSI_MODE_PAGE_DATA;
  860. /*
  861. * Scatter Gather list format
  862. */
  863. typedef struct ips_sglist {
  864. uint32_t address;
  865. uint32_t length;
  866. } IPS_STD_SG_LIST;
  867. typedef struct ips_enh_sglist {
  868. uint32_t address_lo;
  869. uint32_t address_hi;
  870. uint32_t length;
  871. uint32_t reserved;
  872. } IPS_ENH_SG_LIST;
  873. typedef union {
  874. void *list;
  875. IPS_STD_SG_LIST *std_list;
  876. IPS_ENH_SG_LIST *enh_list;
  877. } IPS_SG_LIST;
  878. typedef struct {
  879. char *option_name;
  880. int *option_flag;
  881. int option_value;
  882. } IPS_OPTION;
  883. /*
  884. * Status Info
  885. */
  886. typedef struct ips_stat {
  887. uint32_t residue_len;
  888. void *scb_addr;
  889. uint8_t padding[12 - sizeof(void *)];
  890. } ips_stat_t;
  891. /*
  892. * SCB Queue Format
  893. */
  894. typedef struct ips_scb_queue {
  895. struct ips_scb *head;
  896. struct ips_scb *tail;
  897. int count;
  898. } ips_scb_queue_t;
  899. /*
  900. * Wait queue_format
  901. */
  902. typedef struct ips_wait_queue {
  903. struct scsi_cmnd *head;
  904. struct scsi_cmnd *tail;
  905. int count;
  906. } ips_wait_queue_t;
  907. typedef struct ips_copp_wait_item {
  908. struct scsi_cmnd *scsi_cmd;
  909. struct ips_copp_wait_item *next;
  910. } ips_copp_wait_item_t;
  911. typedef struct ips_copp_queue {
  912. struct ips_copp_wait_item *head;
  913. struct ips_copp_wait_item *tail;
  914. int count;
  915. } ips_copp_queue_t;
  916. /* forward decl for host structure */
  917. struct ips_ha;
  918. typedef struct {
  919. int (*reset)(struct ips_ha *);
  920. int (*issue)(struct ips_ha *, struct ips_scb *);
  921. int (*isinit)(struct ips_ha *);
  922. int (*isintr)(struct ips_ha *);
  923. int (*init)(struct ips_ha *);
  924. int (*erasebios)(struct ips_ha *);
  925. int (*programbios)(struct ips_ha *, char *, uint32_t, uint32_t);
  926. int (*verifybios)(struct ips_ha *, char *, uint32_t, uint32_t);
  927. void (*statinit)(struct ips_ha *);
  928. int (*intr)(struct ips_ha *);
  929. void (*enableint)(struct ips_ha *);
  930. uint32_t (*statupd)(struct ips_ha *);
  931. } ips_hw_func_t;
  932. typedef struct ips_ha {
  933. uint8_t ha_id[IPS_MAX_CHANNELS+1];
  934. uint32_t dcdb_active[IPS_MAX_CHANNELS];
  935. uint32_t io_addr; /* Base I/O address */
  936. uint8_t ntargets; /* Number of targets */
  937. uint8_t nbus; /* Number of buses */
  938. uint8_t nlun; /* Number of Luns */
  939. uint16_t ad_type; /* Adapter type */
  940. uint16_t host_num; /* Adapter number */
  941. uint32_t max_xfer; /* Maximum Xfer size */
  942. uint32_t max_cmds; /* Max concurrent commands */
  943. uint32_t num_ioctl; /* Number of Ioctls */
  944. ips_stat_t sp; /* Status packer pointer */
  945. struct ips_scb *scbs; /* Array of all CCBS */
  946. struct ips_scb *scb_freelist; /* SCB free list */
  947. ips_wait_queue_t scb_waitlist; /* Pending SCB list */
  948. ips_copp_queue_t copp_waitlist; /* Pending PT list */
  949. ips_scb_queue_t scb_activelist; /* Active SCB list */
  950. IPS_IO_CMD *dummy; /* dummy command */
  951. IPS_ADAPTER *adapt; /* Adapter status area */
  952. IPS_LD_INFO *logical_drive_info; /* Adapter Logical Drive Info */
  953. dma_addr_t logical_drive_info_dma_addr; /* Logical Drive Info DMA Address */
  954. IPS_ENQ *enq; /* Adapter Enquiry data */
  955. IPS_CONF *conf; /* Adapter config data */
  956. IPS_NVRAM_P5 *nvram; /* NVRAM page 5 data */
  957. IPS_SUBSYS *subsys; /* Subsystem parameters */
  958. char *ioctl_data; /* IOCTL data area */
  959. uint32_t ioctl_datasize; /* IOCTL data size */
  960. uint32_t cmd_in_progress; /* Current command in progress*/
  961. int flags; /* */
  962. uint8_t waitflag; /* are we waiting for cmd */
  963. uint8_t active;
  964. int ioctl_reset; /* IOCTL Requested Reset Flag */
  965. uint16_t reset_count; /* number of resets */
  966. time_t last_ffdc; /* last time we sent ffdc info*/
  967. uint8_t slot_num; /* PCI Slot Number */
  968. int ioctl_len; /* size of ioctl buffer */
  969. dma_addr_t ioctl_busaddr; /* dma address of ioctl buffer*/
  970. uint8_t bios_version[8]; /* BIOS Revision */
  971. uint32_t mem_addr; /* Memory mapped address */
  972. uint32_t io_len; /* Size of IO Address */
  973. uint32_t mem_len; /* Size of memory address */
  974. char __iomem *mem_ptr; /* Memory mapped Ptr */
  975. char __iomem *ioremap_ptr;/* ioremapped memory pointer */
  976. ips_hw_func_t func; /* hw function pointers */
  977. struct pci_dev *pcidev; /* PCI device handle */
  978. char *flash_data; /* Save Area for flash data */
  979. int flash_len; /* length of flash buffer */
  980. u32 flash_datasize; /* Save Area for flash data size */
  981. dma_addr_t flash_busaddr; /* dma address of flash buffer*/
  982. dma_addr_t enq_busaddr; /* dma address of enq struct */
  983. uint8_t requires_esl; /* Requires an EraseStripeLock */
  984. } ips_ha_t;
  985. typedef void (*ips_scb_callback) (ips_ha_t *, struct ips_scb *);
  986. /*
  987. * SCB Format
  988. */
  989. typedef struct ips_scb {
  990. IPS_HOST_COMMAND cmd;
  991. IPS_DCDB_TABLE dcdb;
  992. uint8_t target_id;
  993. uint8_t bus;
  994. uint8_t lun;
  995. uint8_t cdb[12];
  996. uint32_t scb_busaddr;
  997. uint32_t old_data_busaddr; // Obsolete, but kept for old utility compatibility
  998. uint32_t timeout;
  999. uint8_t basic_status;
  1000. uint8_t extended_status;
  1001. uint8_t breakup;
  1002. uint8_t sg_break;
  1003. uint32_t data_len;
  1004. uint32_t sg_len;
  1005. uint32_t flags;
  1006. uint32_t op_code;
  1007. IPS_SG_LIST sg_list;
  1008. struct scsi_cmnd *scsi_cmd;
  1009. struct ips_scb *q_next;
  1010. ips_scb_callback callback;
  1011. uint32_t sg_busaddr;
  1012. int sg_count;
  1013. dma_addr_t data_busaddr;
  1014. } ips_scb_t;
  1015. typedef struct ips_scb_pt {
  1016. IPS_HOST_COMMAND cmd;
  1017. IPS_DCDB_TABLE dcdb;
  1018. uint8_t target_id;
  1019. uint8_t bus;
  1020. uint8_t lun;
  1021. uint8_t cdb[12];
  1022. uint32_t scb_busaddr;
  1023. uint32_t data_busaddr;
  1024. uint32_t timeout;
  1025. uint8_t basic_status;
  1026. uint8_t extended_status;
  1027. uint16_t breakup;
  1028. uint32_t data_len;
  1029. uint32_t sg_len;
  1030. uint32_t flags;
  1031. uint32_t op_code;
  1032. IPS_SG_LIST *sg_list;
  1033. struct scsi_cmnd *scsi_cmd;
  1034. struct ips_scb *q_next;
  1035. ips_scb_callback callback;
  1036. } ips_scb_pt_t;
  1037. /*
  1038. * Passthru Command Format
  1039. */
  1040. typedef struct {
  1041. uint8_t CoppID[4];
  1042. uint32_t CoppCmd;
  1043. uint32_t PtBuffer;
  1044. uint8_t *CmdBuffer;
  1045. uint32_t CmdBSize;
  1046. ips_scb_pt_t CoppCP;
  1047. uint32_t TimeOut;
  1048. uint8_t BasicStatus;
  1049. uint8_t ExtendedStatus;
  1050. uint8_t AdapterType;
  1051. uint8_t reserved;
  1052. } ips_passthru_t;
  1053. #endif
  1054. /* The Version Information below gets created by SED during the build process. */
  1055. /* Do not modify the next line; it's what SED is looking for to do the insert. */
  1056. /* Version Info */
  1057. /*************************************************************************
  1058. *
  1059. * VERSION.H -- version numbers and copyright notices in various formats
  1060. *
  1061. *************************************************************************/
  1062. #define IPS_VER_MAJOR 7
  1063. #define IPS_VER_MAJOR_STRING __stringify(IPS_VER_MAJOR)
  1064. #define IPS_VER_MINOR 12
  1065. #define IPS_VER_MINOR_STRING __stringify(IPS_VER_MINOR)
  1066. #define IPS_VER_BUILD 05
  1067. #define IPS_VER_BUILD_STRING __stringify(IPS_VER_BUILD)
  1068. #define IPS_VER_STRING IPS_VER_MAJOR_STRING "." \
  1069. IPS_VER_MINOR_STRING "." IPS_VER_BUILD_STRING
  1070. #define IPS_RELEASE_ID 0x00020000
  1071. #define IPS_BUILD_IDENT 761
  1072. #define IPS_LEGALCOPYRIGHT_STRING "(C) Copyright IBM Corp. 1994, 2002. All Rights Reserved."
  1073. #define IPS_ADAPTECCOPYRIGHT_STRING "(c) Copyright Adaptec, Inc. 2002 to 2004. All Rights Reserved."
  1074. #define IPS_DELLCOPYRIGHT_STRING "(c) Copyright Dell 2004. All Rights Reserved."
  1075. #define IPS_NT_LEGALCOPYRIGHT_STRING "(C) Copyright IBM Corp. 1994, 2002."
  1076. /* Version numbers for various adapters */
  1077. #define IPS_VER_SERVERAID1 "2.25.01"
  1078. #define IPS_VER_SERVERAID2 "2.88.13"
  1079. #define IPS_VER_NAVAJO "2.88.13"
  1080. #define IPS_VER_SERVERAID3 "6.10.24"
  1081. #define IPS_VER_SERVERAID4H "7.12.02"
  1082. #define IPS_VER_SERVERAID4MLx "7.12.02"
  1083. #define IPS_VER_SARASOTA "7.12.02"
  1084. #define IPS_VER_MARCO "7.12.02"
  1085. #define IPS_VER_SEBRING "7.12.02"
  1086. #define IPS_VER_KEYWEST "7.12.02"
  1087. /* Compatibility IDs for various adapters */
  1088. #define IPS_COMPAT_UNKNOWN ""
  1089. #define IPS_COMPAT_CURRENT "KW710"
  1090. #define IPS_COMPAT_SERVERAID1 "2.25.01"
  1091. #define IPS_COMPAT_SERVERAID2 "2.88.13"
  1092. #define IPS_COMPAT_NAVAJO "2.88.13"
  1093. #define IPS_COMPAT_KIOWA "2.88.13"
  1094. #define IPS_COMPAT_SERVERAID3H "SB610"
  1095. #define IPS_COMPAT_SERVERAID3L "SB610"
  1096. #define IPS_COMPAT_SERVERAID4H "KW710"
  1097. #define IPS_COMPAT_SERVERAID4M "KW710"
  1098. #define IPS_COMPAT_SERVERAID4L "KW710"
  1099. #define IPS_COMPAT_SERVERAID4Mx "KW710"
  1100. #define IPS_COMPAT_SERVERAID4Lx "KW710"
  1101. #define IPS_COMPAT_SARASOTA "KW710"
  1102. #define IPS_COMPAT_MARCO "KW710"
  1103. #define IPS_COMPAT_SEBRING "KW710"
  1104. #define IPS_COMPAT_TAMPA "KW710"
  1105. #define IPS_COMPAT_KEYWEST "KW710"
  1106. #define IPS_COMPAT_BIOS "KW710"
  1107. #define IPS_COMPAT_MAX_ADAPTER_TYPE 18
  1108. #define IPS_COMPAT_ID_LENGTH 8
  1109. #define IPS_DEFINE_COMPAT_TABLE(tablename) \
  1110. char tablename[IPS_COMPAT_MAX_ADAPTER_TYPE] [IPS_COMPAT_ID_LENGTH] = { \
  1111. IPS_COMPAT_UNKNOWN, \
  1112. IPS_COMPAT_SERVERAID1, \
  1113. IPS_COMPAT_SERVERAID2, \
  1114. IPS_COMPAT_NAVAJO, \
  1115. IPS_COMPAT_KIOWA, \
  1116. IPS_COMPAT_SERVERAID3H, \
  1117. IPS_COMPAT_SERVERAID3L, \
  1118. IPS_COMPAT_SERVERAID4H, \
  1119. IPS_COMPAT_SERVERAID4M, \
  1120. IPS_COMPAT_SERVERAID4L, \
  1121. IPS_COMPAT_SERVERAID4Mx, \
  1122. IPS_COMPAT_SERVERAID4Lx, \
  1123. IPS_COMPAT_SARASOTA, /* one-channel variety of SARASOTA */ \
  1124. IPS_COMPAT_SARASOTA, /* two-channel variety of SARASOTA */ \
  1125. IPS_COMPAT_MARCO, \
  1126. IPS_COMPAT_SEBRING, \
  1127. IPS_COMPAT_TAMPA, \
  1128. IPS_COMPAT_KEYWEST \
  1129. }
  1130. /*
  1131. * Overrides for Emacs so that we almost follow Linus's tabbing style.
  1132. * Emacs will notice this stuff at the end of the file and automatically
  1133. * adjust the settings for this buffer only. This must remain at the end
  1134. * of the file.
  1135. * ---------------------------------------------------------------------------
  1136. * Local variables:
  1137. * c-indent-level: 2
  1138. * c-brace-imaginary-offset: 0
  1139. * c-brace-offset: -2
  1140. * c-argdecl-indent: 2
  1141. * c-label-offset: -2
  1142. * c-continued-statement-offset: 2
  1143. * c-continued-brace-offset: 0
  1144. * indent-tabs-mode: nil
  1145. * tab-width: 8
  1146. * End:
  1147. */