ips.h 44 KB

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