qla_fw.h 27 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073
  1. /********************************************************************************
  2. * QLOGIC LINUX SOFTWARE
  3. *
  4. * QLogic ISP2x00 device driver for Linux 2.6.x
  5. * Copyright (C) 2003-2005 QLogic Corporation
  6. * (www.qlogic.com)
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License as published by the
  10. * Free Software Foundation; either version 2, or (at your option) any
  11. * later version.
  12. *
  13. * This program is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. **
  18. ******************************************************************************/
  19. #ifndef __QLA_FW_H
  20. #define __QLA_FW_H
  21. #define RISC_SADDRESS 0x100000
  22. #define MBS_CHECKSUM_ERROR 0x4010
  23. /*
  24. * Firmware Options.
  25. */
  26. #define FO1_ENABLE_PUREX BIT_10
  27. #define FO1_DISABLE_LED_CTRL BIT_6
  28. #define FO2_ENABLE_SEL_CLASS2 BIT_5
  29. #define FO3_NO_ABTS_ON_LINKDOWN BIT_14
  30. /*
  31. * Port Database structure definition for ISP 24xx.
  32. */
  33. #define PDO_FORCE_ADISC BIT_1
  34. #define PDO_FORCE_PLOGI BIT_0
  35. #define PORT_DATABASE_24XX_SIZE 64
  36. struct port_database_24xx {
  37. uint16_t flags;
  38. #define PDF_TASK_RETRY_ID BIT_14
  39. #define PDF_FC_TAPE BIT_7
  40. #define PDF_ACK0_CAPABLE BIT_6
  41. #define PDF_FCP2_CONF BIT_5
  42. #define PDF_CLASS_2 BIT_4
  43. #define PDF_HARD_ADDR BIT_1
  44. uint8_t current_login_state;
  45. uint8_t last_login_state;
  46. #define PDS_PLOGI_PENDING 0x03
  47. #define PDS_PLOGI_COMPLETE 0x04
  48. #define PDS_PRLI_PENDING 0x05
  49. #define PDS_PRLI_COMPLETE 0x06
  50. #define PDS_PORT_UNAVAILABLE 0x07
  51. #define PDS_PRLO_PENDING 0x09
  52. #define PDS_LOGO_PENDING 0x11
  53. #define PDS_PRLI2_PENDING 0x12
  54. uint8_t hard_address[3];
  55. uint8_t reserved_1;
  56. uint8_t port_id[3];
  57. uint8_t sequence_id;
  58. uint16_t port_timer;
  59. uint16_t nport_handle; /* N_PORT handle. */
  60. uint16_t receive_data_size;
  61. uint16_t reserved_2;
  62. uint8_t prli_svc_param_word_0[2]; /* Big endian */
  63. /* Bits 15-0 of word 0 */
  64. uint8_t prli_svc_param_word_3[2]; /* Big endian */
  65. /* Bits 15-0 of word 3 */
  66. uint8_t port_name[WWN_SIZE];
  67. uint8_t node_name[WWN_SIZE];
  68. uint8_t reserved_3[24];
  69. };
  70. struct nvram_24xx {
  71. /* NVRAM header. */
  72. uint8_t id[4];
  73. uint16_t nvram_version;
  74. uint16_t reserved_0;
  75. /* Firmware Initialization Control Block. */
  76. uint16_t version;
  77. uint16_t reserved_1;
  78. uint16_t frame_payload_size;
  79. uint16_t execution_throttle;
  80. uint16_t exchange_count;
  81. uint16_t hard_address;
  82. uint8_t port_name[WWN_SIZE];
  83. uint8_t node_name[WWN_SIZE];
  84. uint16_t login_retry_count;
  85. uint16_t link_down_on_nos;
  86. uint16_t interrupt_delay_timer;
  87. uint16_t login_timeout;
  88. uint32_t firmware_options_1;
  89. uint32_t firmware_options_2;
  90. uint32_t firmware_options_3;
  91. /* Offset 56. */
  92. /*
  93. * BIT 0 = Control Enable
  94. * BIT 1-15 =
  95. *
  96. * BIT 0-7 = Reserved
  97. * BIT 8-10 = Output Swing 1G
  98. * BIT 11-13 = Output Emphasis 1G
  99. * BIT 14-15 = Reserved
  100. *
  101. * BIT 0-7 = Reserved
  102. * BIT 8-10 = Output Swing 2G
  103. * BIT 11-13 = Output Emphasis 2G
  104. * BIT 14-15 = Reserved
  105. *
  106. * BIT 0-7 = Reserved
  107. * BIT 8-10 = Output Swing 4G
  108. * BIT 11-13 = Output Emphasis 4G
  109. * BIT 14-15 = Reserved
  110. */
  111. uint16_t seriallink_options[4];
  112. uint16_t reserved_2[16];
  113. /* Offset 96. */
  114. uint16_t reserved_3[16];
  115. /* PCIe table entries. */
  116. uint16_t reserved_4[16];
  117. /* Offset 160. */
  118. uint16_t reserved_5[16];
  119. /* Offset 192. */
  120. uint16_t reserved_6[16];
  121. /* Offset 224. */
  122. uint16_t reserved_7[16];
  123. /*
  124. * BIT 0 = Enable spinup delay
  125. * BIT 1 = Disable BIOS
  126. * BIT 2 = Enable Memory Map BIOS
  127. * BIT 3 = Enable Selectable Boot
  128. * BIT 4 = Disable RISC code load
  129. * BIT 5 =
  130. * BIT 6 =
  131. * BIT 7 =
  132. *
  133. * BIT 8 =
  134. * BIT 9 =
  135. * BIT 10 = Enable lip full login
  136. * BIT 11 = Enable target reset
  137. * BIT 12 =
  138. * BIT 13 =
  139. * BIT 14 =
  140. * BIT 15 = Enable alternate WWN
  141. *
  142. * BIT 16-31 =
  143. */
  144. uint32_t host_p;
  145. uint8_t alternate_port_name[WWN_SIZE];
  146. uint8_t alternate_node_name[WWN_SIZE];
  147. uint8_t boot_port_name[WWN_SIZE];
  148. uint16_t boot_lun_number;
  149. uint16_t reserved_8;
  150. uint8_t alt1_boot_port_name[WWN_SIZE];
  151. uint16_t alt1_boot_lun_number;
  152. uint16_t reserved_9;
  153. uint8_t alt2_boot_port_name[WWN_SIZE];
  154. uint16_t alt2_boot_lun_number;
  155. uint16_t reserved_10;
  156. uint8_t alt3_boot_port_name[WWN_SIZE];
  157. uint16_t alt3_boot_lun_number;
  158. uint16_t reserved_11;
  159. /*
  160. * BIT 0 = Selective Login
  161. * BIT 1 = Alt-Boot Enable
  162. * BIT 2 = Reserved
  163. * BIT 3 = Boot Order List
  164. * BIT 4 = Reserved
  165. * BIT 5 = Selective LUN
  166. * BIT 6 = Reserved
  167. * BIT 7-31 =
  168. */
  169. uint32_t efi_parameters;
  170. uint8_t reset_delay;
  171. uint8_t reserved_12;
  172. uint16_t reserved_13;
  173. uint16_t boot_id_number;
  174. uint16_t reserved_14;
  175. uint16_t max_luns_per_target;
  176. uint16_t reserved_15;
  177. uint16_t port_down_retry_count;
  178. uint16_t link_down_timeout;
  179. /* FCode parameters. */
  180. uint16_t fcode_parameter;
  181. uint16_t reserved_16[3];
  182. /* Offset 352. */
  183. uint8_t prev_drv_ver_major;
  184. uint8_t prev_drv_ver_submajob;
  185. uint8_t prev_drv_ver_minor;
  186. uint8_t prev_drv_ver_subminor;
  187. uint16_t prev_bios_ver_major;
  188. uint16_t prev_bios_ver_minor;
  189. uint16_t prev_efi_ver_major;
  190. uint16_t prev_efi_ver_minor;
  191. uint16_t prev_fw_ver_major;
  192. uint8_t prev_fw_ver_minor;
  193. uint8_t prev_fw_ver_subminor;
  194. uint16_t reserved_17[8];
  195. /* Offset 384. */
  196. uint16_t reserved_18[16];
  197. /* Offset 416. */
  198. uint16_t reserved_19[16];
  199. /* Offset 448. */
  200. uint16_t reserved_20[16];
  201. /* Offset 480. */
  202. uint8_t model_name[16];
  203. uint16_t reserved_21[2];
  204. /* Offset 500. */
  205. /* HW Parameter Block. */
  206. uint16_t pcie_table_sig;
  207. uint16_t pcie_table_offset;
  208. uint16_t subsystem_vendor_id;
  209. uint16_t subsystem_device_id;
  210. uint32_t checksum;
  211. };
  212. /*
  213. * ISP Initialization Control Block.
  214. * Little endian except where noted.
  215. */
  216. #define ICB_VERSION 1
  217. struct init_cb_24xx {
  218. uint16_t version;
  219. uint16_t reserved_1;
  220. uint16_t frame_payload_size;
  221. uint16_t execution_throttle;
  222. uint16_t exchange_count;
  223. uint16_t hard_address;
  224. uint8_t port_name[WWN_SIZE]; /* Big endian. */
  225. uint8_t node_name[WWN_SIZE]; /* Big endian. */
  226. uint16_t response_q_inpointer;
  227. uint16_t request_q_outpointer;
  228. uint16_t login_retry_count;
  229. uint16_t prio_request_q_outpointer;
  230. uint16_t response_q_length;
  231. uint16_t request_q_length;
  232. uint16_t link_down_timeout; /* Milliseconds. */
  233. uint16_t prio_request_q_length;
  234. uint32_t request_q_address[2];
  235. uint32_t response_q_address[2];
  236. uint32_t prio_request_q_address[2];
  237. uint8_t reserved_2[8];
  238. uint16_t atio_q_inpointer;
  239. uint16_t atio_q_length;
  240. uint32_t atio_q_address[2];
  241. uint16_t interrupt_delay_timer; /* 100us increments. */
  242. uint16_t login_timeout;
  243. /*
  244. * BIT 0 = Enable Hard Loop Id
  245. * BIT 1 = Enable Fairness
  246. * BIT 2 = Enable Full-Duplex
  247. * BIT 3 = Reserved
  248. * BIT 4 = Enable Target Mode
  249. * BIT 5 = Disable Initiator Mode
  250. * BIT 6 = Reserved
  251. * BIT 7 = Reserved
  252. *
  253. * BIT 8 = Reserved
  254. * BIT 9 = Non Participating LIP
  255. * BIT 10 = Descending Loop ID Search
  256. * BIT 11 = Acquire Loop ID in LIPA
  257. * BIT 12 = Reserved
  258. * BIT 13 = Full Login after LIP
  259. * BIT 14 = Node Name Option
  260. * BIT 15-31 = Reserved
  261. */
  262. uint32_t firmware_options_1;
  263. /*
  264. * BIT 0 = Operation Mode bit 0
  265. * BIT 1 = Operation Mode bit 1
  266. * BIT 2 = Operation Mode bit 2
  267. * BIT 3 = Operation Mode bit 3
  268. * BIT 4 = Connection Options bit 0
  269. * BIT 5 = Connection Options bit 1
  270. * BIT 6 = Connection Options bit 2
  271. * BIT 7 = Enable Non part on LIHA failure
  272. *
  273. * BIT 8 = Enable Class 2
  274. * BIT 9 = Enable ACK0
  275. * BIT 10 = Reserved
  276. * BIT 11 = Enable FC-SP Security
  277. * BIT 12 = FC Tape Enable
  278. * BIT 13-31 = Reserved
  279. */
  280. uint32_t firmware_options_2;
  281. /*
  282. * BIT 0 = Reserved
  283. * BIT 1 = Soft ID only
  284. * BIT 2 = Reserved
  285. * BIT 3 = Reserved
  286. * BIT 4 = FCP RSP Payload bit 0
  287. * BIT 5 = FCP RSP Payload bit 1
  288. * BIT 6 = Enable Receive Out-of-Order data frame handling
  289. * BIT 7 = Disable Automatic PLOGI on Local Loop
  290. *
  291. * BIT 8 = Reserved
  292. * BIT 9 = Enable Out-of-Order FCP_XFER_RDY relative offset handling
  293. * BIT 10 = Reserved
  294. * BIT 11 = Reserved
  295. * BIT 12 = Reserved
  296. * BIT 13 = Data Rate bit 0
  297. * BIT 14 = Data Rate bit 1
  298. * BIT 15 = Data Rate bit 2
  299. * BIT 16-31 = Reserved
  300. */
  301. uint32_t firmware_options_3;
  302. uint8_t reserved_3[24];
  303. };
  304. /*
  305. * ISP queue - command entry structure definition.
  306. */
  307. #define COMMAND_TYPE_6 0x48 /* Command Type 6 entry */
  308. struct cmd_type_6 {
  309. uint8_t entry_type; /* Entry type. */
  310. uint8_t entry_count; /* Entry count. */
  311. uint8_t sys_define; /* System defined. */
  312. uint8_t entry_status; /* Entry Status. */
  313. uint32_t handle; /* System handle. */
  314. uint16_t nport_handle; /* N_PORT handle. */
  315. uint16_t timeout; /* Command timeout. */
  316. uint16_t dseg_count; /* Data segment count. */
  317. uint16_t fcp_rsp_dsd_len; /* FCP_RSP DSD length. */
  318. uint8_t lun[8]; /* FCP LUN (BE). */
  319. uint16_t control_flags; /* Control flags. */
  320. #define CF_DATA_SEG_DESCR_ENABLE BIT_2
  321. #define CF_READ_DATA BIT_1
  322. #define CF_WRITE_DATA BIT_0
  323. uint16_t fcp_cmnd_dseg_len; /* Data segment length. */
  324. uint32_t fcp_cmnd_dseg_address[2]; /* Data segment address. */
  325. uint32_t fcp_rsp_dseg_address[2]; /* Data segment address. */
  326. uint32_t byte_count; /* Total byte count. */
  327. uint8_t port_id[3]; /* PortID of destination port. */
  328. uint8_t vp_index;
  329. uint32_t fcp_data_dseg_address[2]; /* Data segment address. */
  330. uint16_t fcp_data_dseg_len; /* Data segment length. */
  331. uint16_t reserved_1; /* MUST be set to 0. */
  332. };
  333. #define COMMAND_TYPE_7 0x18 /* Command Type 7 entry */
  334. struct cmd_type_7 {
  335. uint8_t entry_type; /* Entry type. */
  336. uint8_t entry_count; /* Entry count. */
  337. uint8_t sys_define; /* System defined. */
  338. uint8_t entry_status; /* Entry Status. */
  339. uint32_t handle; /* System handle. */
  340. uint16_t nport_handle; /* N_PORT handle. */
  341. uint16_t timeout; /* Command timeout. */
  342. #define FW_MAX_TIMEOUT 0x1999
  343. uint16_t dseg_count; /* Data segment count. */
  344. uint16_t reserved_1;
  345. uint8_t lun[8]; /* FCP LUN (BE). */
  346. uint16_t task_mgmt_flags; /* Task management flags. */
  347. #define TMF_CLEAR_ACA BIT_14
  348. #define TMF_TARGET_RESET BIT_13
  349. #define TMF_LUN_RESET BIT_12
  350. #define TMF_CLEAR_TASK_SET BIT_10
  351. #define TMF_ABORT_TASK_SET BIT_9
  352. #define TMF_READ_DATA BIT_1
  353. #define TMF_WRITE_DATA BIT_0
  354. uint8_t task;
  355. #define TSK_SIMPLE 0
  356. #define TSK_HEAD_OF_QUEUE 1
  357. #define TSK_ORDERED 2
  358. #define TSK_ACA 4
  359. #define TSK_UNTAGGED 5
  360. uint8_t crn;
  361. uint8_t fcp_cdb[MAX_CMDSZ]; /* SCSI command words. */
  362. uint32_t byte_count; /* Total byte count. */
  363. uint8_t port_id[3]; /* PortID of destination port. */
  364. uint8_t vp_index;
  365. uint32_t dseg_0_address[2]; /* Data segment 0 address. */
  366. uint32_t dseg_0_len; /* Data segment 0 length. */
  367. };
  368. /*
  369. * ISP queue - status entry structure definition.
  370. */
  371. #define STATUS_TYPE 0x03 /* Status entry. */
  372. struct sts_entry_24xx {
  373. uint8_t entry_type; /* Entry type. */
  374. uint8_t entry_count; /* Entry count. */
  375. uint8_t sys_define; /* System defined. */
  376. uint8_t entry_status; /* Entry Status. */
  377. uint32_t handle; /* System handle. */
  378. uint16_t comp_status; /* Completion status. */
  379. uint16_t ox_id; /* OX_ID used by the firmware. */
  380. uint32_t residual_len; /* Residual transfer length. */
  381. uint16_t reserved_1;
  382. uint16_t state_flags; /* State flags. */
  383. #define SF_TRANSFERRED_DATA BIT_11
  384. #define SF_FCP_RSP_DMA BIT_0
  385. uint16_t reserved_2;
  386. uint16_t scsi_status; /* SCSI status. */
  387. #define SS_CONFIRMATION_REQ BIT_12
  388. uint32_t rsp_residual_count; /* FCP RSP residual count. */
  389. uint32_t sense_len; /* FCP SENSE length. */
  390. uint32_t rsp_data_len; /* FCP response data length. */
  391. uint8_t data[28]; /* FCP response/sense information. */
  392. };
  393. /*
  394. * Status entry completion status
  395. */
  396. #define CS_DATA_REASSEMBLY_ERROR 0x11 /* Data Reassembly Error.. */
  397. #define CS_ABTS_BY_TARGET 0x13 /* Target send ABTS to abort IOCB. */
  398. #define CS_FW_RESOURCE 0x2C /* Firmware Resource Unavailable. */
  399. #define CS_TASK_MGMT_OVERRUN 0x30 /* Task management overrun (8+). */
  400. #define CS_ABORT_BY_TARGET 0x47 /* Abort By Target. */
  401. /*
  402. * ISP queue - marker entry structure definition.
  403. */
  404. #define MARKER_TYPE 0x04 /* Marker entry. */
  405. struct mrk_entry_24xx {
  406. uint8_t entry_type; /* Entry type. */
  407. uint8_t entry_count; /* Entry count. */
  408. uint8_t handle_count; /* Handle count. */
  409. uint8_t entry_status; /* Entry Status. */
  410. uint32_t handle; /* System handle. */
  411. uint16_t nport_handle; /* N_PORT handle. */
  412. uint8_t modifier; /* Modifier (7-0). */
  413. #define MK_SYNC_ID_LUN 0 /* Synchronize ID/LUN */
  414. #define MK_SYNC_ID 1 /* Synchronize ID */
  415. #define MK_SYNC_ALL 2 /* Synchronize all ID/LUN */
  416. uint8_t reserved_1;
  417. uint8_t reserved_2;
  418. uint8_t vp_index;
  419. uint16_t reserved_3;
  420. uint8_t lun[8]; /* FCP LUN (BE). */
  421. uint8_t reserved_4[40];
  422. };
  423. /*
  424. * ISP queue - CT Pass-Through entry structure definition.
  425. */
  426. #define CT_IOCB_TYPE 0x29 /* CT Pass-Through IOCB entry */
  427. struct ct_entry_24xx {
  428. uint8_t entry_type; /* Entry type. */
  429. uint8_t entry_count; /* Entry count. */
  430. uint8_t sys_define; /* System Defined. */
  431. uint8_t entry_status; /* Entry Status. */
  432. uint32_t handle; /* System handle. */
  433. uint16_t comp_status; /* Completion status. */
  434. uint16_t nport_handle; /* N_PORT handle. */
  435. uint16_t cmd_dsd_count;
  436. uint8_t vp_index;
  437. uint8_t reserved_1;
  438. uint16_t timeout; /* Command timeout. */
  439. uint16_t reserved_2;
  440. uint16_t rsp_dsd_count;
  441. uint8_t reserved_3[10];
  442. uint32_t rsp_byte_count;
  443. uint32_t cmd_byte_count;
  444. uint32_t dseg_0_address[2]; /* Data segment 0 address. */
  445. uint32_t dseg_0_len; /* Data segment 0 length. */
  446. uint32_t dseg_1_address[2]; /* Data segment 1 address. */
  447. uint32_t dseg_1_len; /* Data segment 1 length. */
  448. };
  449. /*
  450. * ISP queue - ELS Pass-Through entry structure definition.
  451. */
  452. #define ELS_IOCB_TYPE 0x53 /* ELS Pass-Through IOCB entry */
  453. struct els_entry_24xx {
  454. uint8_t entry_type; /* Entry type. */
  455. uint8_t entry_count; /* Entry count. */
  456. uint8_t sys_define; /* System Defined. */
  457. uint8_t entry_status; /* Entry Status. */
  458. uint32_t handle; /* System handle. */
  459. uint16_t reserved_1;
  460. uint16_t nport_handle; /* N_PORT handle. */
  461. uint16_t tx_dsd_count;
  462. uint8_t vp_index;
  463. uint8_t sof_type;
  464. #define EST_SOFI3 (1 << 4)
  465. #define EST_SOFI2 (3 << 4)
  466. uint32_t rx_xchg_address[2]; /* Receive exchange address. */
  467. uint16_t rx_dsd_count;
  468. uint8_t opcode;
  469. uint8_t reserved_2;
  470. uint8_t port_id[3];
  471. uint8_t reserved_3;
  472. uint16_t reserved_4;
  473. uint16_t control_flags; /* Control flags. */
  474. #define ECF_PAYLOAD_DESCR_MASK (BIT_15|BIT_14|BIT_13)
  475. #define EPD_ELS_COMMAND (0 << 13)
  476. #define EPD_ELS_ACC (1 << 13)
  477. #define EPD_ELS_RJT (2 << 13)
  478. #define EPD_RX_XCHG (3 << 13)
  479. #define ECF_CLR_PASSTHRU_PEND BIT_12
  480. #define ECF_INCL_FRAME_HDR BIT_11
  481. uint32_t rx_byte_count;
  482. uint32_t tx_byte_count;
  483. uint32_t tx_address[2]; /* Data segment 0 address. */
  484. uint32_t tx_len; /* Data segment 0 length. */
  485. uint32_t rx_address[2]; /* Data segment 1 address. */
  486. uint32_t rx_len; /* Data segment 1 length. */
  487. };
  488. /*
  489. * ISP queue - Mailbox Command entry structure definition.
  490. */
  491. #define MBX_IOCB_TYPE 0x39
  492. struct mbx_entry_24xx {
  493. uint8_t entry_type; /* Entry type. */
  494. uint8_t entry_count; /* Entry count. */
  495. uint8_t handle_count; /* Handle count. */
  496. uint8_t entry_status; /* Entry Status. */
  497. uint32_t handle; /* System handle. */
  498. uint16_t mbx[28];
  499. };
  500. #define LOGINOUT_PORT_IOCB_TYPE 0x52 /* Login/Logout Port entry. */
  501. struct logio_entry_24xx {
  502. uint8_t entry_type; /* Entry type. */
  503. uint8_t entry_count; /* Entry count. */
  504. uint8_t sys_define; /* System defined. */
  505. uint8_t entry_status; /* Entry Status. */
  506. uint32_t handle; /* System handle. */
  507. uint16_t comp_status; /* Completion status. */
  508. #define CS_LOGIO_ERROR 0x31 /* Login/Logout IOCB error. */
  509. uint16_t nport_handle; /* N_PORT handle. */
  510. uint16_t control_flags; /* Control flags. */
  511. /* Modifiers. */
  512. #define LCF_FCP2_OVERRIDE BIT_9 /* Set/Reset word 3 of PRLI. */
  513. #define LCF_CLASS_2 BIT_8 /* Enable class 2 during PLOGI. */
  514. #define LCF_FREE_NPORT BIT_7 /* Release NPORT handle after LOGO. */
  515. #define LCF_EXPL_LOGO BIT_6 /* Perform an explicit LOGO. */
  516. #define LCF_SKIP_PRLI BIT_5 /* Skip PRLI after PLOGI. */
  517. #define LCF_IMPL_LOGO_ALL BIT_5 /* Implicit LOGO to all ports. */
  518. #define LCF_COND_PLOGI BIT_4 /* PLOGI only if not logged-in. */
  519. #define LCF_IMPL_LOGO BIT_4 /* Perform an implicit LOGO. */
  520. #define LCF_IMPL_PRLO BIT_4 /* Perform an implicit PRLO. */
  521. /* Commands. */
  522. #define LCF_COMMAND_PLOGI 0x00 /* PLOGI. */
  523. #define LCF_COMMAND_PRLI 0x01 /* PRLI. */
  524. #define LCF_COMMAND_PDISC 0x02 /* PDISC. */
  525. #define LCF_COMMAND_ADISC 0x03 /* ADISC. */
  526. #define LCF_COMMAND_LOGO 0x08 /* LOGO. */
  527. #define LCF_COMMAND_PRLO 0x09 /* PRLO. */
  528. #define LCF_COMMAND_TPRLO 0x0A /* TPRLO. */
  529. uint8_t vp_index;
  530. uint8_t reserved_1;
  531. uint8_t port_id[3]; /* PortID of destination port. */
  532. uint8_t rsp_size; /* Response size in 32bit words. */
  533. uint32_t io_parameter[11]; /* General I/O parameters. */
  534. #define LSC_SCODE_NOLINK 0x01
  535. #define LSC_SCODE_NOIOCB 0x02
  536. #define LSC_SCODE_NOXCB 0x03
  537. #define LSC_SCODE_CMD_FAILED 0x04
  538. #define LSC_SCODE_NOFABRIC 0x05
  539. #define LSC_SCODE_FW_NOT_READY 0x07
  540. #define LSC_SCODE_NOT_LOGGED_IN 0x09
  541. #define LSC_SCODE_NOPCB 0x0A
  542. #define LSC_SCODE_ELS_REJECT 0x18
  543. #define LSC_SCODE_CMD_PARAM_ERR 0x19
  544. #define LSC_SCODE_PORTID_USED 0x1A
  545. #define LSC_SCODE_NPORT_USED 0x1B
  546. #define LSC_SCODE_NONPORT 0x1C
  547. #define LSC_SCODE_LOGGED_IN 0x1D
  548. #define LSC_SCODE_NOFLOGI_ACC 0x1F
  549. };
  550. #define TSK_MGMT_IOCB_TYPE 0x14
  551. struct tsk_mgmt_entry {
  552. uint8_t entry_type; /* Entry type. */
  553. uint8_t entry_count; /* Entry count. */
  554. uint8_t handle_count; /* Handle count. */
  555. uint8_t entry_status; /* Entry Status. */
  556. uint32_t handle; /* System handle. */
  557. uint16_t nport_handle; /* N_PORT handle. */
  558. uint16_t reserved_1;
  559. uint16_t delay; /* Activity delay in seconds. */
  560. uint16_t timeout; /* Command timeout. */
  561. uint8_t lun[8]; /* FCP LUN (BE). */
  562. uint32_t control_flags; /* Control Flags. */
  563. #define TCF_NOTMCMD_TO_TARGET BIT_31
  564. #define TCF_LUN_RESET BIT_4
  565. #define TCF_ABORT_TASK_SET BIT_3
  566. #define TCF_CLEAR_TASK_SET BIT_2
  567. #define TCF_TARGET_RESET BIT_1
  568. #define TCF_CLEAR_ACA BIT_0
  569. uint8_t reserved_2[20];
  570. uint8_t port_id[3]; /* PortID of destination port. */
  571. uint8_t vp_index;
  572. uint8_t reserved_3[12];
  573. };
  574. #define ABORT_IOCB_TYPE 0x33
  575. struct abort_entry_24xx {
  576. uint8_t entry_type; /* Entry type. */
  577. uint8_t entry_count; /* Entry count. */
  578. uint8_t handle_count; /* Handle count. */
  579. uint8_t entry_status; /* Entry Status. */
  580. uint32_t handle; /* System handle. */
  581. uint16_t nport_handle; /* N_PORT handle. */
  582. /* or Completion status. */
  583. uint16_t options; /* Options. */
  584. #define AOF_NO_ABTS BIT_0 /* Do not send any ABTS. */
  585. uint32_t handle_to_abort; /* System handle to abort. */
  586. uint8_t reserved_1[32];
  587. uint8_t port_id[3]; /* PortID of destination port. */
  588. uint8_t vp_index;
  589. uint8_t reserved_2[12];
  590. };
  591. /*
  592. * ISP I/O Register Set structure definitions.
  593. */
  594. struct device_reg_24xx {
  595. uint32_t flash_addr; /* Flash/NVRAM BIOS address. */
  596. #define FARX_DATA_FLAG BIT_31
  597. #define FARX_ACCESS_FLASH_CONF 0x7FFD0000
  598. #define FARX_ACCESS_FLASH_DATA 0x7FF00000
  599. #define FARX_ACCESS_NVRAM_CONF 0x7FFF0000
  600. #define FARX_ACCESS_NVRAM_DATA 0x7FFE0000
  601. #define FA_NVRAM_FUNC0_ADDR 0x80
  602. #define FA_NVRAM_FUNC1_ADDR 0x180
  603. #define FA_NVRAM_VPD_SIZE 0x80
  604. #define FA_NVRAM_VPD0_ADDR 0x00
  605. #define FA_NVRAM_VPD1_ADDR 0x100
  606. /*
  607. * RISC code begins at offset 512KB
  608. * within flash. Consisting of two
  609. * contiguous RISC code segments.
  610. */
  611. #define FA_RISC_CODE_ADDR 0x20000
  612. #define FA_RISC_CODE_SEGMENTS 2
  613. uint32_t flash_data; /* Flash/NVRAM BIOS data. */
  614. uint32_t ctrl_status; /* Control/Status. */
  615. #define CSRX_FLASH_ACCESS_ERROR BIT_18 /* Flash/NVRAM Access Error. */
  616. #define CSRX_DMA_ACTIVE BIT_17 /* DMA Active status. */
  617. #define CSRX_DMA_SHUTDOWN BIT_16 /* DMA Shutdown control status. */
  618. #define CSRX_FUNCTION BIT_15 /* Function number. */
  619. /* PCI-X Bus Mode. */
  620. #define CSRX_PCIX_BUS_MODE_MASK (BIT_11|BIT_10|BIT_9|BIT_8)
  621. #define PBM_PCI_33MHZ (0 << 8)
  622. #define PBM_PCIX_M1_66MHZ (1 << 8)
  623. #define PBM_PCIX_M1_100MHZ (2 << 8)
  624. #define PBM_PCIX_M1_133MHZ (3 << 8)
  625. #define PBM_PCIX_M2_66MHZ (5 << 8)
  626. #define PBM_PCIX_M2_100MHZ (6 << 8)
  627. #define PBM_PCIX_M2_133MHZ (7 << 8)
  628. #define PBM_PCI_66MHZ (8 << 8)
  629. /* Max Write Burst byte count. */
  630. #define CSRX_MAX_WRT_BURST_MASK (BIT_5|BIT_4)
  631. #define MWB_512_BYTES (0 << 4)
  632. #define MWB_1024_BYTES (1 << 4)
  633. #define MWB_2048_BYTES (2 << 4)
  634. #define MWB_4096_BYTES (3 << 4)
  635. #define CSRX_64BIT_SLOT BIT_2 /* PCI 64-Bit Bus Slot. */
  636. #define CSRX_FLASH_ENABLE BIT_1 /* Flash BIOS Read/Write enable. */
  637. #define CSRX_ISP_SOFT_RESET BIT_0 /* ISP soft reset. */
  638. uint32_t ictrl; /* Interrupt control. */
  639. #define ICRX_EN_RISC_INT BIT_3 /* Enable RISC interrupts on PCI. */
  640. uint32_t istatus; /* Interrupt status. */
  641. #define ISRX_RISC_INT BIT_3 /* RISC interrupt. */
  642. uint32_t unused_1[2]; /* Gap. */
  643. /* Request Queue. */
  644. uint32_t req_q_in; /* In-Pointer. */
  645. uint32_t req_q_out; /* Out-Pointer. */
  646. /* Response Queue. */
  647. uint32_t rsp_q_in; /* In-Pointer. */
  648. uint32_t rsp_q_out; /* Out-Pointer. */
  649. /* Priority Request Queue. */
  650. uint32_t preq_q_in; /* In-Pointer. */
  651. uint32_t preq_q_out; /* Out-Pointer. */
  652. uint32_t unused_2[2]; /* Gap. */
  653. /* ATIO Queue. */
  654. uint32_t atio_q_in; /* In-Pointer. */
  655. uint32_t atio_q_out; /* Out-Pointer. */
  656. uint32_t host_status;
  657. #define HSRX_RISC_INT BIT_15 /* RISC to Host interrupt. */
  658. #define HSRX_RISC_PAUSED BIT_8 /* RISC Paused. */
  659. uint32_t hccr; /* Host command & control register. */
  660. /* HCCR statuses. */
  661. #define HCCRX_HOST_INT BIT_6 /* Host to RISC interrupt bit. */
  662. #define HCCRX_RISC_RESET BIT_5 /* RISC Reset mode bit. */
  663. #define HCCRX_RISC_PAUSE BIT_4 /* RISC Pause mode bit. */
  664. /* HCCR commands. */
  665. /* NOOP. */
  666. #define HCCRX_NOOP 0x00000000
  667. /* Set RISC Reset. */
  668. #define HCCRX_SET_RISC_RESET 0x10000000
  669. /* Clear RISC Reset. */
  670. #define HCCRX_CLR_RISC_RESET 0x20000000
  671. /* Set RISC Pause. */
  672. #define HCCRX_SET_RISC_PAUSE 0x30000000
  673. /* Releases RISC Pause. */
  674. #define HCCRX_REL_RISC_PAUSE 0x40000000
  675. /* Set HOST to RISC interrupt. */
  676. #define HCCRX_SET_HOST_INT 0x50000000
  677. /* Clear HOST to RISC interrupt. */
  678. #define HCCRX_CLR_HOST_INT 0x60000000
  679. /* Clear RISC to PCI interrupt. */
  680. #define HCCRX_CLR_RISC_INT 0xA0000000
  681. uint32_t gpiod; /* GPIO Data register. */
  682. /* LED update mask. */
  683. #define GPDX_LED_UPDATE_MASK (BIT_20|BIT_19|BIT_18)
  684. /* Data update mask. */
  685. #define GPDX_DATA_UPDATE_MASK (BIT_17|BIT_16)
  686. /* LED control mask. */
  687. #define GPDX_LED_COLOR_MASK (BIT_4|BIT_3|BIT_2)
  688. /* LED bit values. Color names as
  689. * referenced in fw spec.
  690. */
  691. #define GPDX_LED_YELLOW_ON BIT_2
  692. #define GPDX_LED_GREEN_ON BIT_3
  693. #define GPDX_LED_AMBER_ON BIT_4
  694. /* Data in/out. */
  695. #define GPDX_DATA_INOUT (BIT_1|BIT_0)
  696. uint32_t gpioe; /* GPIO Enable register. */
  697. /* Enable update mask. */
  698. #define GPEX_ENABLE_UPDATE_MASK (BIT_17|BIT_16)
  699. /* Enable. */
  700. #define GPEX_ENABLE (BIT_1|BIT_0)
  701. uint32_t iobase_addr; /* I/O Bus Base Address register. */
  702. uint32_t unused_3[10]; /* Gap. */
  703. uint16_t mailbox0;
  704. uint16_t mailbox1;
  705. uint16_t mailbox2;
  706. uint16_t mailbox3;
  707. uint16_t mailbox4;
  708. uint16_t mailbox5;
  709. uint16_t mailbox6;
  710. uint16_t mailbox7;
  711. uint16_t mailbox8;
  712. uint16_t mailbox9;
  713. uint16_t mailbox10;
  714. uint16_t mailbox11;
  715. uint16_t mailbox12;
  716. uint16_t mailbox13;
  717. uint16_t mailbox14;
  718. uint16_t mailbox15;
  719. uint16_t mailbox16;
  720. uint16_t mailbox17;
  721. uint16_t mailbox18;
  722. uint16_t mailbox19;
  723. uint16_t mailbox20;
  724. uint16_t mailbox21;
  725. uint16_t mailbox22;
  726. uint16_t mailbox23;
  727. uint16_t mailbox24;
  728. uint16_t mailbox25;
  729. uint16_t mailbox26;
  730. uint16_t mailbox27;
  731. uint16_t mailbox28;
  732. uint16_t mailbox29;
  733. uint16_t mailbox30;
  734. uint16_t mailbox31;
  735. };
  736. /* MID Support ***************************************************************/
  737. #define MAX_MID_VPS 125
  738. struct mid_conf_entry_24xx {
  739. uint16_t reserved_1;
  740. /*
  741. * BIT 0 = Enable Hard Loop Id
  742. * BIT 1 = Acquire Loop ID in LIPA
  743. * BIT 2 = ID not Acquired
  744. * BIT 3 = Enable VP
  745. * BIT 4 = Enable Initiator Mode
  746. * BIT 5 = Disable Target Mode
  747. * BIT 6-7 = Reserved
  748. */
  749. uint8_t options;
  750. uint8_t hard_address;
  751. uint8_t port_name[WWN_SIZE];
  752. uint8_t node_name[WWN_SIZE];
  753. };
  754. struct mid_init_cb_24xx {
  755. struct init_cb_24xx init_cb;
  756. uint16_t count;
  757. uint16_t options;
  758. struct mid_conf_entry_24xx entries[MAX_MID_VPS];
  759. };
  760. struct mid_db_entry_24xx {
  761. uint16_t status;
  762. #define MDBS_NON_PARTIC BIT_3
  763. #define MDBS_ID_ACQUIRED BIT_1
  764. #define MDBS_ENABLED BIT_0
  765. uint8_t options;
  766. uint8_t hard_address;
  767. uint8_t port_name[WWN_SIZE];
  768. uint8_t node_name[WWN_SIZE];
  769. uint8_t port_id[3];
  770. uint8_t reserved_1;
  771. };
  772. struct mid_db_24xx {
  773. struct mid_db_entry_24xx entries[MAX_MID_VPS];
  774. };
  775. #define VP_CTRL_IOCB_TYPE 0x30 /* Vitual Port Control entry. */
  776. struct vp_ctrl_entry_24xx {
  777. uint8_t entry_type; /* Entry type. */
  778. uint8_t entry_count; /* Entry count. */
  779. uint8_t sys_define; /* System defined. */
  780. uint8_t entry_status; /* Entry Status. */
  781. uint32_t handle; /* System handle. */
  782. uint16_t vp_idx_failed;
  783. uint16_t comp_status; /* Completion status. */
  784. #define CS_VCE_ACQ_ID_ERROR 0x02 /* Error while acquireing ID. */
  785. #define CS_VCE_BUSY 0x05 /* Firmware not ready to accept cmd. */
  786. uint16_t command;
  787. #define VCE_COMMAND_ENABLE_VPS 0x00 /* Enable VPs. */
  788. #define VCE_COMMAND_DISABLE_VPS 0x08 /* Disable VPs. */
  789. #define VCE_COMMAND_DISABLE_VPS_REINIT 0x09 /* Disable VPs and reinit link. */
  790. #define VCE_COMMAND_DISABLE_VPS_LOGO 0x0a /* Disable VPs and LOGO ports. */
  791. uint16_t vp_count;
  792. uint8_t vp_idx_map[16];
  793. uint8_t reserved_4[32];
  794. };
  795. #define VP_CONFIG_IOCB_TYPE 0x31 /* Vitual Port Config entry. */
  796. struct vp_config_entry_24xx {
  797. uint8_t entry_type; /* Entry type. */
  798. uint8_t entry_count; /* Entry count. */
  799. uint8_t sys_define; /* System defined. */
  800. uint8_t entry_status; /* Entry Status. */
  801. uint32_t handle; /* System handle. */
  802. uint16_t reserved_1;
  803. uint16_t comp_status; /* Completion status. */
  804. #define CS_VCT_STS_ERROR 0x01 /* Specified VPs were not disabled. */
  805. #define CS_VCT_CNT_ERROR 0x02 /* Invalid VP count. */
  806. #define CS_VCT_ERROR 0x03 /* Unknown error. */
  807. #define CS_VCT_IDX_ERROR 0x02 /* Invalid VP index. */
  808. #define CS_VCT_BUSY 0x05 /* Firmware not ready to accept cmd. */
  809. uint8_t command;
  810. #define VCT_COMMAND_MOD_VPS 0x00 /* Enable VPs. */
  811. #define VCT_COMMAND_MOD_ENABLE_VPS 0x08 /* Disable VPs. */
  812. uint8_t vp_count;
  813. uint8_t vp_idx1;
  814. uint8_t vp_idx2;
  815. uint8_t options_idx1;
  816. uint8_t hard_address_idx1;
  817. uint16_t reserved_2;
  818. uint8_t port_name_idx1[WWN_SIZE];
  819. uint8_t node_name_idx1[WWN_SIZE];
  820. uint8_t options_idx2;
  821. uint8_t hard_address_idx2;
  822. uint16_t reserved_3;
  823. uint8_t port_name_idx2[WWN_SIZE];
  824. uint8_t node_name_idx2[WWN_SIZE];
  825. uint8_t reserved_4[8];
  826. };
  827. #define VP_RPT_ID_IOCB_TYPE 0x32 /* Report ID Acquisition entry. */
  828. struct vp_rpt_id_entry_24xx {
  829. uint8_t entry_type; /* Entry type. */
  830. uint8_t entry_count; /* Entry count. */
  831. uint8_t sys_define; /* System defined. */
  832. uint8_t entry_status; /* Entry Status. */
  833. uint32_t handle; /* System handle. */
  834. uint16_t vp_count; /* Format 0 -- | VP setup | VP acq |. */
  835. /* Format 1 -- | VP count |. */
  836. uint16_t vp_idx; /* Format 0 -- Reserved. */
  837. /* Format 1 -- VP status and index. */
  838. uint8_t port_id[3];
  839. uint8_t format;
  840. uint8_t vp_idx_map[16];
  841. uint8_t reserved_4[32];
  842. };
  843. /* END MID Support ***********************************************************/
  844. #endif