qla_fw.h 27 KB

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