ips.h 44 KB

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