ips.h 41 KB

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