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