ql4_glbl.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. /*
  2. * QLogic iSCSI HBA Driver
  3. * Copyright (c) 2003-2013 QLogic Corporation
  4. *
  5. * See LICENSE.qla4xxx for copyright and licensing details.
  6. */
  7. #ifndef __QLA4x_GBL_H
  8. #define __QLA4x_GBL_H
  9. struct iscsi_cls_conn;
  10. int qla4xxx_hw_reset(struct scsi_qla_host *ha);
  11. int ql4xxx_lock_drvr_wait(struct scsi_qla_host *a);
  12. int qla4xxx_send_command_to_isp(struct scsi_qla_host *ha, struct srb *srb);
  13. int qla4xxx_initialize_adapter(struct scsi_qla_host *ha, int is_reset);
  14. int qla4xxx_soft_reset(struct scsi_qla_host *ha);
  15. irqreturn_t qla4xxx_intr_handler(int irq, void *dev_id);
  16. void qla4xxx_free_ddb(struct scsi_qla_host *ha, struct ddb_entry *ddb_entry);
  17. void qla4xxx_process_aen(struct scsi_qla_host *ha, uint8_t process_aen);
  18. int qla4xxx_get_dhcp_ip_address(struct scsi_qla_host *ha);
  19. int qla4xxx_abort_task(struct scsi_qla_host *ha, struct srb *srb);
  20. int qla4xxx_reset_lun(struct scsi_qla_host *ha, struct ddb_entry *ddb_entry,
  21. uint64_t lun);
  22. int qla4xxx_reset_target(struct scsi_qla_host *ha,
  23. struct ddb_entry *ddb_entry);
  24. int qla4xxx_get_flash(struct scsi_qla_host *ha, dma_addr_t dma_addr,
  25. uint32_t offset, uint32_t len);
  26. int qla4xxx_get_firmware_status(struct scsi_qla_host *ha);
  27. int qla4xxx_get_firmware_state(struct scsi_qla_host *ha);
  28. int qla4xxx_initialize_fw_cb(struct scsi_qla_host *ha);
  29. /* FIXME: Goodness! this really wants a small struct to hold the
  30. * parameters. On x86 the args will get passed on the stack! */
  31. int qla4xxx_get_fwddb_entry(struct scsi_qla_host *ha,
  32. uint16_t fw_ddb_index,
  33. struct dev_db_entry *fw_ddb_entry,
  34. dma_addr_t fw_ddb_entry_dma,
  35. uint32_t *num_valid_ddb_entries,
  36. uint32_t *next_ddb_index,
  37. uint32_t *fw_ddb_device_state,
  38. uint32_t *conn_err_detail,
  39. uint16_t *tcp_source_port_num,
  40. uint16_t *connection_id);
  41. int qla4xxx_set_ddb_entry(struct scsi_qla_host * ha, uint16_t fw_ddb_index,
  42. dma_addr_t fw_ddb_entry_dma, uint32_t *mbx_sts);
  43. uint8_t qla4xxx_get_ifcb(struct scsi_qla_host *ha, uint32_t *mbox_cmd,
  44. uint32_t *mbox_sts, dma_addr_t init_fw_cb_dma);
  45. int qla4xxx_conn_close_sess_logout(struct scsi_qla_host *ha,
  46. uint16_t fw_ddb_index,
  47. uint16_t connection_id,
  48. uint16_t option);
  49. int qla4xxx_disable_acb(struct scsi_qla_host *ha);
  50. int qla4xxx_set_acb(struct scsi_qla_host *ha, uint32_t *mbox_cmd,
  51. uint32_t *mbox_sts, dma_addr_t acb_dma);
  52. int qla4xxx_get_acb(struct scsi_qla_host *ha, dma_addr_t acb_dma,
  53. uint32_t acb_type, uint32_t len);
  54. int qla4xxx_get_ip_state(struct scsi_qla_host *ha, uint32_t acb_idx,
  55. uint32_t ip_idx, uint32_t *sts);
  56. void qla4xxx_mark_device_missing(struct iscsi_cls_session *cls_session);
  57. u16 rd_nvram_word(struct scsi_qla_host *ha, int offset);
  58. u8 rd_nvram_byte(struct scsi_qla_host *ha, int offset);
  59. void qla4xxx_get_crash_record(struct scsi_qla_host *ha);
  60. int qla4xxx_is_nvram_configuration_valid(struct scsi_qla_host *ha);
  61. int qla4xxx_about_firmware(struct scsi_qla_host *ha);
  62. void qla4xxx_interrupt_service_routine(struct scsi_qla_host *ha,
  63. uint32_t intr_status);
  64. int qla4xxx_init_rings(struct scsi_qla_host *ha);
  65. void qla4xxx_srb_compl(struct kref *ref);
  66. struct srb *qla4xxx_del_from_active_array(struct scsi_qla_host *ha,
  67. uint32_t index);
  68. int qla4xxx_process_ddb_changed(struct scsi_qla_host *ha, uint32_t fw_ddb_index,
  69. uint32_t state, uint32_t conn_error);
  70. void qla4xxx_dump_buffer(void *b, uint32_t size);
  71. int qla4xxx_send_marker_iocb(struct scsi_qla_host *ha,
  72. struct ddb_entry *ddb_entry, uint64_t lun, uint16_t mrkr_mod);
  73. int qla4xxx_set_flash(struct scsi_qla_host *ha, dma_addr_t dma_addr,
  74. uint32_t offset, uint32_t length, uint32_t options);
  75. int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount,
  76. uint8_t outCount, uint32_t *mbx_cmd, uint32_t *mbx_sts);
  77. int qla4xxx_get_chap_index(struct scsi_qla_host *ha, char *username,
  78. char *password, int bidi, uint16_t *chap_index);
  79. int qla4xxx_set_chap(struct scsi_qla_host *ha, char *username, char *password,
  80. uint16_t idx, int bidi);
  81. void qla4xxx_queue_iocb(struct scsi_qla_host *ha);
  82. void qla4xxx_complete_iocb(struct scsi_qla_host *ha);
  83. int qla4xxx_get_sys_info(struct scsi_qla_host *ha);
  84. int qla4xxx_iospace_config(struct scsi_qla_host *ha);
  85. void qla4xxx_pci_config(struct scsi_qla_host *ha);
  86. int qla4xxx_start_firmware(struct scsi_qla_host *ha);
  87. irqreturn_t qla4xxx_intr_handler(int irq, void *dev_id);
  88. uint16_t qla4xxx_rd_shdw_req_q_out(struct scsi_qla_host *ha);
  89. uint16_t qla4xxx_rd_shdw_rsp_q_in(struct scsi_qla_host *ha);
  90. int qla4xxx_request_irqs(struct scsi_qla_host *ha);
  91. void qla4xxx_free_irqs(struct scsi_qla_host *ha);
  92. void qla4xxx_process_response_queue(struct scsi_qla_host *ha);
  93. void qla4xxx_wake_dpc(struct scsi_qla_host *ha);
  94. void qla4xxx_get_conn_event_log(struct scsi_qla_host *ha);
  95. void qla4xxx_mailbox_premature_completion(struct scsi_qla_host *ha);
  96. void qla4xxx_dump_registers(struct scsi_qla_host *ha);
  97. uint8_t qla4xxx_update_local_ifcb(struct scsi_qla_host *ha,
  98. uint32_t *mbox_cmd,
  99. uint32_t *mbox_sts,
  100. struct addr_ctrl_blk *init_fw_cb,
  101. dma_addr_t init_fw_cb_dma);
  102. void qla4_8xxx_pci_config(struct scsi_qla_host *);
  103. int qla4_8xxx_iospace_config(struct scsi_qla_host *ha);
  104. int qla4_8xxx_load_risc(struct scsi_qla_host *);
  105. irqreturn_t qla4_82xx_intr_handler(int irq, void *dev_id);
  106. void qla4_82xx_queue_iocb(struct scsi_qla_host *ha);
  107. void qla4_82xx_complete_iocb(struct scsi_qla_host *ha);
  108. int qla4_82xx_crb_win_lock(struct scsi_qla_host *);
  109. void qla4_82xx_crb_win_unlock(struct scsi_qla_host *);
  110. int qla4_82xx_pci_get_crb_addr_2M(struct scsi_qla_host *, ulong *);
  111. void qla4_82xx_wr_32(struct scsi_qla_host *, ulong, u32);
  112. uint32_t qla4_82xx_rd_32(struct scsi_qla_host *, ulong);
  113. int qla4_82xx_pci_mem_read_2M(struct scsi_qla_host *, u64, void *, int);
  114. int qla4_82xx_pci_mem_write_2M(struct scsi_qla_host *ha, u64, void *, int);
  115. int qla4_82xx_isp_reset(struct scsi_qla_host *ha);
  116. void qla4_82xx_interrupt_service_routine(struct scsi_qla_host *ha,
  117. uint32_t intr_status);
  118. uint16_t qla4_82xx_rd_shdw_req_q_out(struct scsi_qla_host *ha);
  119. uint16_t qla4_82xx_rd_shdw_rsp_q_in(struct scsi_qla_host *ha);
  120. int qla4_8xxx_get_sys_info(struct scsi_qla_host *ha);
  121. void qla4_8xxx_watchdog(struct scsi_qla_host *ha);
  122. int qla4_8xxx_stop_firmware(struct scsi_qla_host *ha);
  123. int qla4_8xxx_get_flash_info(struct scsi_qla_host *ha);
  124. void qla4_82xx_enable_intrs(struct scsi_qla_host *ha);
  125. void qla4_82xx_disable_intrs(struct scsi_qla_host *ha);
  126. int qla4_8xxx_enable_msix(struct scsi_qla_host *ha);
  127. void qla4_8xxx_disable_msix(struct scsi_qla_host *ha);
  128. irqreturn_t qla4_8xxx_msi_handler(int irq, void *dev_id);
  129. irqreturn_t qla4_8xxx_default_intr_handler(int irq, void *dev_id);
  130. irqreturn_t qla4_8xxx_msix_rsp_q(int irq, void *dev_id);
  131. void qla4xxx_mark_all_devices_missing(struct scsi_qla_host *ha);
  132. void qla4xxx_dead_adapter_cleanup(struct scsi_qla_host *ha);
  133. int qla4_82xx_idc_lock(struct scsi_qla_host *ha);
  134. void qla4_82xx_idc_unlock(struct scsi_qla_host *ha);
  135. int qla4_8xxx_device_state_handler(struct scsi_qla_host *ha);
  136. void qla4_8xxx_need_qsnt_handler(struct scsi_qla_host *ha);
  137. void qla4_8xxx_clear_drv_active(struct scsi_qla_host *ha);
  138. void qla4_8xxx_set_drv_active(struct scsi_qla_host *ha);
  139. int qla4xxx_conn_open(struct scsi_qla_host *ha, uint16_t fw_ddb_index);
  140. int qla4xxx_set_param_ddbentry(struct scsi_qla_host *ha,
  141. struct ddb_entry *ddb_entry,
  142. struct iscsi_cls_conn *cls_conn,
  143. uint32_t *mbx_sts);
  144. int qla4xxx_session_logout_ddb(struct scsi_qla_host *ha,
  145. struct ddb_entry *ddb_entry, int options);
  146. int qla4xxx_req_ddb_entry(struct scsi_qla_host *ha, uint32_t fw_ddb_index,
  147. uint32_t *mbx_sts);
  148. int qla4xxx_clear_ddb_entry(struct scsi_qla_host *ha, uint32_t fw_ddb_index);
  149. int qla4xxx_send_passthru0(struct iscsi_task *task);
  150. void qla4xxx_free_ddb_index(struct scsi_qla_host *ha);
  151. int qla4xxx_get_mgmt_data(struct scsi_qla_host *ha, uint16_t fw_ddb_index,
  152. uint16_t stats_size, dma_addr_t stats_dma);
  153. void qla4xxx_update_session_conn_param(struct scsi_qla_host *ha,
  154. struct ddb_entry *ddb_entry);
  155. void qla4xxx_update_session_conn_fwddb_param(struct scsi_qla_host *ha,
  156. struct ddb_entry *ddb_entry);
  157. int qla4xxx_bootdb_by_index(struct scsi_qla_host *ha,
  158. struct dev_db_entry *fw_ddb_entry,
  159. dma_addr_t fw_ddb_entry_dma, uint16_t ddb_index);
  160. int qla4xxx_get_chap(struct scsi_qla_host *ha, char *username,
  161. char *password, uint16_t idx);
  162. int qla4xxx_get_nvram(struct scsi_qla_host *ha, dma_addr_t nvram_dma,
  163. uint32_t offset, uint32_t size);
  164. int qla4xxx_set_nvram(struct scsi_qla_host *ha, dma_addr_t nvram_dma,
  165. uint32_t offset, uint32_t size);
  166. int qla4xxx_restore_factory_defaults(struct scsi_qla_host *ha,
  167. uint32_t region, uint32_t field0,
  168. uint32_t field1);
  169. int qla4xxx_get_ddb_index(struct scsi_qla_host *ha, uint16_t *ddb_index);
  170. void qla4xxx_login_flash_ddb(struct iscsi_cls_session *cls_session);
  171. int qla4xxx_unblock_ddb(struct iscsi_cls_session *cls_session);
  172. int qla4xxx_unblock_flash_ddb(struct iscsi_cls_session *cls_session);
  173. int qla4xxx_flash_ddb_change(struct scsi_qla_host *ha, uint32_t fw_ddb_index,
  174. struct ddb_entry *ddb_entry, uint32_t state);
  175. int qla4xxx_ddb_change(struct scsi_qla_host *ha, uint32_t fw_ddb_index,
  176. struct ddb_entry *ddb_entry, uint32_t state);
  177. void qla4xxx_build_ddb_list(struct scsi_qla_host *ha, int is_reset);
  178. int qla4xxx_post_aen_work(struct scsi_qla_host *ha,
  179. enum iscsi_host_event_code aen_code,
  180. uint32_t data_size, uint8_t *data);
  181. int qla4xxx_ping_iocb(struct scsi_qla_host *ha, uint32_t options,
  182. uint32_t payload_size, uint32_t pid, uint8_t *ipaddr);
  183. int qla4xxx_post_ping_evt_work(struct scsi_qla_host *ha,
  184. uint32_t status, uint32_t pid,
  185. uint32_t data_size, uint8_t *data);
  186. int qla4xxx_flashdb_by_index(struct scsi_qla_host *ha,
  187. struct dev_db_entry *fw_ddb_entry,
  188. dma_addr_t fw_ddb_entry_dma, uint16_t ddb_index);
  189. /* BSG Functions */
  190. int qla4xxx_bsg_request(struct bsg_job *bsg_job);
  191. int qla4xxx_process_vendor_specific(struct bsg_job *bsg_job);
  192. void qla4xxx_arm_relogin_timer(struct ddb_entry *ddb_entry);
  193. int qla4xxx_get_minidump_template(struct scsi_qla_host *ha,
  194. dma_addr_t phys_addr);
  195. int qla4xxx_req_template_size(struct scsi_qla_host *ha);
  196. void qla4_8xxx_alloc_sysfs_attr(struct scsi_qla_host *ha);
  197. void qla4_8xxx_free_sysfs_attr(struct scsi_qla_host *ha);
  198. void qla4xxx_alloc_fw_dump(struct scsi_qla_host *ha);
  199. int qla4_82xx_try_start_fw(struct scsi_qla_host *ha);
  200. int qla4_8xxx_need_reset(struct scsi_qla_host *ha);
  201. int qla4_82xx_md_rd_32(struct scsi_qla_host *ha, uint32_t off, uint32_t *data);
  202. int qla4_82xx_md_wr_32(struct scsi_qla_host *ha, uint32_t off, uint32_t data);
  203. void qla4_82xx_rom_lock_recovery(struct scsi_qla_host *ha);
  204. void qla4_82xx_queue_mbox_cmd(struct scsi_qla_host *ha, uint32_t *mbx_cmd,
  205. int incount);
  206. void qla4_82xx_process_mbox_intr(struct scsi_qla_host *ha, int outcount);
  207. void qla4xxx_queue_mbox_cmd(struct scsi_qla_host *ha, uint32_t *mbx_cmd,
  208. int incount);
  209. void qla4xxx_process_mbox_intr(struct scsi_qla_host *ha, int outcount);
  210. void qla4_8xxx_dump_peg_reg(struct scsi_qla_host *ha);
  211. void qla4_83xx_disable_intrs(struct scsi_qla_host *ha);
  212. void qla4_83xx_enable_intrs(struct scsi_qla_host *ha);
  213. int qla4_83xx_start_firmware(struct scsi_qla_host *ha);
  214. irqreturn_t qla4_83xx_intr_handler(int irq, void *dev_id);
  215. void qla4_83xx_interrupt_service_routine(struct scsi_qla_host *ha,
  216. uint32_t intr_status);
  217. int qla4_83xx_isp_reset(struct scsi_qla_host *ha);
  218. void qla4_83xx_queue_iocb(struct scsi_qla_host *ha);
  219. void qla4_83xx_complete_iocb(struct scsi_qla_host *ha);
  220. uint32_t qla4_83xx_rd_reg(struct scsi_qla_host *ha, ulong addr);
  221. void qla4_83xx_wr_reg(struct scsi_qla_host *ha, ulong addr, uint32_t val);
  222. int qla4_83xx_rd_reg_indirect(struct scsi_qla_host *ha, uint32_t addr,
  223. uint32_t *data);
  224. int qla4_83xx_wr_reg_indirect(struct scsi_qla_host *ha, uint32_t addr,
  225. uint32_t data);
  226. int qla4_83xx_drv_lock(struct scsi_qla_host *ha);
  227. void qla4_83xx_drv_unlock(struct scsi_qla_host *ha);
  228. void qla4_83xx_rom_lock_recovery(struct scsi_qla_host *ha);
  229. void qla4_83xx_queue_mbox_cmd(struct scsi_qla_host *ha, uint32_t *mbx_cmd,
  230. int incount);
  231. void qla4_83xx_process_mbox_intr(struct scsi_qla_host *ha, int outcount);
  232. void qla4_83xx_read_reset_template(struct scsi_qla_host *ha);
  233. void qla4_83xx_set_idc_dontreset(struct scsi_qla_host *ha);
  234. int qla4_83xx_idc_dontreset(struct scsi_qla_host *ha);
  235. int qla4_83xx_lockless_flash_read_u32(struct scsi_qla_host *ha,
  236. uint32_t flash_addr, uint8_t *p_data,
  237. int u32_word_count);
  238. void qla4_83xx_clear_idc_dontreset(struct scsi_qla_host *ha);
  239. void qla4_83xx_need_reset_handler(struct scsi_qla_host *ha);
  240. int qla4_83xx_flash_read_u32(struct scsi_qla_host *ha, uint32_t flash_addr,
  241. uint8_t *p_data, int u32_word_count);
  242. void qla4_83xx_get_idc_param(struct scsi_qla_host *ha);
  243. void qla4_8xxx_set_rst_ready(struct scsi_qla_host *ha);
  244. void qla4_8xxx_clear_rst_ready(struct scsi_qla_host *ha);
  245. int qla4_8xxx_device_bootstrap(struct scsi_qla_host *ha);
  246. void qla4_8xxx_get_minidump(struct scsi_qla_host *ha);
  247. int qla4_8xxx_intr_disable(struct scsi_qla_host *ha);
  248. int qla4_8xxx_intr_enable(struct scsi_qla_host *ha);
  249. int qla4_8xxx_set_param(struct scsi_qla_host *ha, int param);
  250. int qla4_8xxx_update_idc_reg(struct scsi_qla_host *ha);
  251. int qla4_83xx_post_idc_ack(struct scsi_qla_host *ha);
  252. void qla4_83xx_disable_pause(struct scsi_qla_host *ha);
  253. void qla4_83xx_enable_mbox_intrs(struct scsi_qla_host *ha);
  254. int qla4_83xx_can_perform_reset(struct scsi_qla_host *ha);
  255. int qla4xxx_get_default_ddb(struct scsi_qla_host *ha, uint32_t options,
  256. dma_addr_t dma_addr);
  257. int qla4xxx_get_uni_chap_at_index(struct scsi_qla_host *ha, char *username,
  258. char *password, uint16_t chap_index);
  259. int qla4xxx_disable_acb(struct scsi_qla_host *ha);
  260. int qla4xxx_set_acb(struct scsi_qla_host *ha, uint32_t *mbox_cmd,
  261. uint32_t *mbox_sts, dma_addr_t acb_dma);
  262. int qla4xxx_get_acb(struct scsi_qla_host *ha, dma_addr_t acb_dma,
  263. uint32_t acb_type, uint32_t len);
  264. int qla4_84xx_config_acb(struct scsi_qla_host *ha, int acb_config);
  265. int qla4_8xxx_ms_mem_write_128b(struct scsi_qla_host *ha,
  266. uint64_t addr, uint32_t *data, uint32_t count);
  267. uint8_t qla4xxx_set_ipaddr_state(uint8_t fw_ipaddr_state);
  268. int qla4_83xx_get_port_config(struct scsi_qla_host *ha, uint32_t *config);
  269. int qla4_83xx_set_port_config(struct scsi_qla_host *ha, uint32_t *config);
  270. int qla4_8xxx_check_init_adapter_retry(struct scsi_qla_host *ha);
  271. int qla4_83xx_is_detached(struct scsi_qla_host *ha);
  272. int qla4xxx_sysfs_ddb_export(struct scsi_qla_host *ha);
  273. extern int ql4xextended_error_logging;
  274. extern int ql4xdontresethba;
  275. extern int ql4xenablemsix;
  276. extern int ql4xmdcapmask;
  277. extern int ql4xenablemd;
  278. extern struct device_attribute *qla4xxx_host_attrs[];
  279. #endif /* _QLA4x_GBL_H */