xref: /linux/drivers/scsi/qla4xxx/ql4_glbl.h (revision 0e7e85019c2709131b10c5f34b602cc6b94fe782)
1afaf5a2dSDavid Somayajulu /*
2afaf5a2dSDavid Somayajulu  * QLogic iSCSI HBA Driver
37d01d069SVikas Chaudhary  * Copyright (c)  2003-2010 QLogic Corporation
4afaf5a2dSDavid Somayajulu  *
5afaf5a2dSDavid Somayajulu  * See LICENSE.qla4xxx for copyright and licensing details.
6afaf5a2dSDavid Somayajulu  */
7afaf5a2dSDavid Somayajulu 
8afaf5a2dSDavid Somayajulu #ifndef __QLA4x_GBL_H
9afaf5a2dSDavid Somayajulu #define	__QLA4x_GBL_H
10afaf5a2dSDavid Somayajulu 
11e08c182cSDavid C Somayajulu struct iscsi_cls_conn;
12e08c182cSDavid C Somayajulu 
13f4f5df23SVikas Chaudhary int qla4xxx_hw_reset(struct scsi_qla_host *ha);
14f26b9044SDavid C Somayajulu int ql4xxx_lock_drvr_wait(struct scsi_qla_host *a);
15afaf5a2dSDavid Somayajulu int qla4xxx_send_command_to_isp(struct scsi_qla_host *ha, struct srb *srb);
16*0e7e8501SManish Rangankar int qla4xxx_initialize_adapter(struct scsi_qla_host *ha);
17afaf5a2dSDavid Somayajulu int qla4xxx_soft_reset(struct scsi_qla_host *ha);
187d12e780SDavid Howells irqreturn_t qla4xxx_intr_handler(int irq, void *dev_id);
19afaf5a2dSDavid Somayajulu 
20f4f5df23SVikas Chaudhary void qla4xxx_free_ddb(struct scsi_qla_host *ha, struct ddb_entry *ddb_entry);
21afaf5a2dSDavid Somayajulu void qla4xxx_process_aen(struct scsi_qla_host *ha, uint8_t process_aen);
22afaf5a2dSDavid Somayajulu 
23afaf5a2dSDavid Somayajulu int qla4xxx_get_dhcp_ip_address(struct scsi_qla_host *ha);
2409a0f719SVikas Chaudhary int qla4xxx_abort_task(struct scsi_qla_host *ha, struct srb *srb);
25afaf5a2dSDavid Somayajulu int qla4xxx_reset_lun(struct scsi_qla_host *ha, struct ddb_entry *ddb_entry,
26afaf5a2dSDavid Somayajulu 		      int lun);
27ce545039SMike Christie int qla4xxx_reset_target(struct scsi_qla_host *ha,
28ce545039SMike Christie 			 struct ddb_entry *ddb_entry);
29afaf5a2dSDavid Somayajulu int qla4xxx_get_flash(struct scsi_qla_host *ha, dma_addr_t dma_addr,
30afaf5a2dSDavid Somayajulu 		      uint32_t offset, uint32_t len);
31afaf5a2dSDavid Somayajulu int qla4xxx_get_firmware_status(struct scsi_qla_host *ha);
32afaf5a2dSDavid Somayajulu int qla4xxx_get_firmware_state(struct scsi_qla_host *ha);
33afaf5a2dSDavid Somayajulu int qla4xxx_initialize_fw_cb(struct scsi_qla_host *ha);
34afaf5a2dSDavid Somayajulu 
35afaf5a2dSDavid Somayajulu /* FIXME: Goodness!  this really wants a small struct to hold the
36afaf5a2dSDavid Somayajulu  * parameters. On x86 the args will get passed on the stack! */
37afaf5a2dSDavid Somayajulu int qla4xxx_get_fwddb_entry(struct scsi_qla_host *ha,
38afaf5a2dSDavid Somayajulu 			    uint16_t fw_ddb_index,
39afaf5a2dSDavid Somayajulu 			    struct dev_db_entry *fw_ddb_entry,
40afaf5a2dSDavid Somayajulu 			    dma_addr_t fw_ddb_entry_dma,
41afaf5a2dSDavid Somayajulu 			    uint32_t *num_valid_ddb_entries,
42afaf5a2dSDavid Somayajulu 			    uint32_t *next_ddb_index,
43afaf5a2dSDavid Somayajulu 			    uint32_t *fw_ddb_device_state,
44afaf5a2dSDavid Somayajulu 			    uint32_t *conn_err_detail,
45afaf5a2dSDavid Somayajulu 			    uint16_t *tcp_source_port_num,
46afaf5a2dSDavid Somayajulu 			    uint16_t *connection_id);
47afaf5a2dSDavid Somayajulu 
48afaf5a2dSDavid Somayajulu int qla4xxx_set_ddb_entry(struct scsi_qla_host * ha, uint16_t fw_ddb_index,
49b3a271a9SManish Rangankar 			  dma_addr_t fw_ddb_entry_dma, uint32_t *mbx_sts);
50d00efe3fSMike Christie uint8_t qla4xxx_get_ifcb(struct scsi_qla_host *ha, uint32_t *mbox_cmd,
51d00efe3fSMike Christie 			 uint32_t *mbox_sts, dma_addr_t init_fw_cb_dma);
52d00efe3fSMike Christie int qla4xxx_conn_close_sess_logout(struct scsi_qla_host *ha,
53d00efe3fSMike Christie 				   uint16_t fw_ddb_index,
54d00efe3fSMike Christie 				   uint16_t connection_id,
55d00efe3fSMike Christie 				   uint16_t option);
56d00efe3fSMike Christie int qla4xxx_disable_acb(struct scsi_qla_host *ha);
57d00efe3fSMike Christie int qla4xxx_set_acb(struct scsi_qla_host *ha, uint32_t *mbox_cmd,
58d00efe3fSMike Christie 		    uint32_t *mbox_sts, dma_addr_t acb_dma);
59d00efe3fSMike Christie int qla4xxx_get_acb(struct scsi_qla_host *ha, uint32_t *mbox_cmd,
60d00efe3fSMike Christie 		    uint32_t *mbox_sts, dma_addr_t acb_dma);
61b3a271a9SManish Rangankar void qla4xxx_mark_device_missing(struct iscsi_cls_session *cls_session);
62afaf5a2dSDavid Somayajulu u16 rd_nvram_word(struct scsi_qla_host *ha, int offset);
63afaf5a2dSDavid Somayajulu void qla4xxx_get_crash_record(struct scsi_qla_host *ha);
64afaf5a2dSDavid Somayajulu int qla4xxx_is_nvram_configuration_valid(struct scsi_qla_host *ha);
657ad633c0SHarish Zunjarrao int qla4xxx_about_firmware(struct scsi_qla_host *ha);
66afaf5a2dSDavid Somayajulu void qla4xxx_interrupt_service_routine(struct scsi_qla_host *ha,
67afaf5a2dSDavid Somayajulu 				       uint32_t intr_status);
68afaf5a2dSDavid Somayajulu int qla4xxx_init_rings(struct scsi_qla_host *ha);
69f4f5df23SVikas Chaudhary void qla4xxx_srb_compl(struct kref *ref);
70e08c182cSDavid C Somayajulu struct srb *qla4xxx_del_from_active_array(struct scsi_qla_host *ha,
71e08c182cSDavid C Somayajulu 		uint32_t index);
72821d6e54SVikas Chaudhary int qla4xxx_process_ddb_changed(struct scsi_qla_host *ha, uint32_t fw_ddb_index,
73821d6e54SVikas Chaudhary 		uint32_t state, uint32_t conn_error);
74e08c182cSDavid C Somayajulu void qla4xxx_dump_buffer(void *b, uint32_t size);
759d562913SDavid C Somayajulu int qla4xxx_send_marker_iocb(struct scsi_qla_host *ha,
769d562913SDavid C Somayajulu 	struct ddb_entry *ddb_entry, int lun, uint16_t mrkr_mod);
77d00efe3fSMike Christie int qla4xxx_set_flash(struct scsi_qla_host *ha, dma_addr_t dma_addr,
78d00efe3fSMike Christie 		      uint32_t offset, uint32_t length, uint32_t options);
79f4f5df23SVikas Chaudhary int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount,
80f4f5df23SVikas Chaudhary 		uint8_t outCount, uint32_t *mbx_cmd, uint32_t *mbx_sts);
81f4f5df23SVikas Chaudhary 
82f4f5df23SVikas Chaudhary void qla4xxx_queue_iocb(struct scsi_qla_host *ha);
83f4f5df23SVikas Chaudhary void qla4xxx_complete_iocb(struct scsi_qla_host *ha);
84f4f5df23SVikas Chaudhary int qla4xxx_get_sys_info(struct scsi_qla_host *ha);
85f4f5df23SVikas Chaudhary int qla4xxx_iospace_config(struct scsi_qla_host *ha);
86f4f5df23SVikas Chaudhary void qla4xxx_pci_config(struct scsi_qla_host *ha);
87f4f5df23SVikas Chaudhary int qla4xxx_start_firmware(struct scsi_qla_host *ha);
88f4f5df23SVikas Chaudhary irqreturn_t qla4xxx_intr_handler(int irq, void *dev_id);
89f4f5df23SVikas Chaudhary uint16_t qla4xxx_rd_shdw_req_q_out(struct scsi_qla_host *ha);
90f4f5df23SVikas Chaudhary uint16_t qla4xxx_rd_shdw_rsp_q_in(struct scsi_qla_host *ha);
91f4f5df23SVikas Chaudhary int qla4xxx_request_irqs(struct scsi_qla_host *ha);
92f4f5df23SVikas Chaudhary void qla4xxx_free_irqs(struct scsi_qla_host *ha);
93f4f5df23SVikas Chaudhary void qla4xxx_process_response_queue(struct scsi_qla_host *ha);
94f4f5df23SVikas Chaudhary void qla4xxx_wake_dpc(struct scsi_qla_host *ha);
95f4f5df23SVikas Chaudhary void qla4xxx_get_conn_event_log(struct scsi_qla_host *ha);
9621033639SNilesh Javali void qla4xxx_mailbox_premature_completion(struct scsi_qla_host *ha);
9791a772a4SKaren Higgins void qla4xxx_dump_registers(struct scsi_qla_host *ha);
98d00efe3fSMike Christie uint8_t qla4xxx_update_local_ifcb(struct scsi_qla_host *ha,
99d00efe3fSMike Christie 				  uint32_t *mbox_cmd,
100d00efe3fSMike Christie 				  uint32_t *mbox_sts,
101d00efe3fSMike Christie 				  struct addr_ctrl_blk *init_fw_cb,
102d00efe3fSMike Christie 				  dma_addr_t init_fw_cb_dma);
103f4f5df23SVikas Chaudhary 
104f4f5df23SVikas Chaudhary void qla4_8xxx_pci_config(struct scsi_qla_host *);
105f4f5df23SVikas Chaudhary int qla4_8xxx_iospace_config(struct scsi_qla_host *ha);
106f4f5df23SVikas Chaudhary int qla4_8xxx_load_risc(struct scsi_qla_host *);
107f4f5df23SVikas Chaudhary irqreturn_t qla4_8xxx_intr_handler(int irq, void *dev_id);
108f4f5df23SVikas Chaudhary void qla4_8xxx_queue_iocb(struct scsi_qla_host *ha);
109f4f5df23SVikas Chaudhary void qla4_8xxx_complete_iocb(struct scsi_qla_host *ha);
110f4f5df23SVikas Chaudhary 
111f4f5df23SVikas Chaudhary int qla4_8xxx_crb_win_lock(struct scsi_qla_host *);
112f4f5df23SVikas Chaudhary void qla4_8xxx_crb_win_unlock(struct scsi_qla_host *);
113f4f5df23SVikas Chaudhary int qla4_8xxx_pci_get_crb_addr_2M(struct scsi_qla_host *, ulong *);
114f4f5df23SVikas Chaudhary void qla4_8xxx_wr_32(struct scsi_qla_host *, ulong, u32);
115f4f5df23SVikas Chaudhary int qla4_8xxx_rd_32(struct scsi_qla_host *, ulong);
116f4f5df23SVikas Chaudhary int qla4_8xxx_pci_mem_read_2M(struct scsi_qla_host *, u64, void *, int);
117f4f5df23SVikas Chaudhary int qla4_8xxx_pci_mem_write_2M(struct scsi_qla_host *ha, u64, void *, int);
118f4f5df23SVikas Chaudhary int qla4_8xxx_isp_reset(struct scsi_qla_host *ha);
119f4f5df23SVikas Chaudhary void qla4_8xxx_interrupt_service_routine(struct scsi_qla_host *ha,
120f4f5df23SVikas Chaudhary 		uint32_t intr_status);
121f4f5df23SVikas Chaudhary uint16_t qla4_8xxx_rd_shdw_req_q_out(struct scsi_qla_host *ha);
122f4f5df23SVikas Chaudhary uint16_t qla4_8xxx_rd_shdw_rsp_q_in(struct scsi_qla_host *ha);
123f4f5df23SVikas Chaudhary int qla4_8xxx_get_sys_info(struct scsi_qla_host *ha);
124f4f5df23SVikas Chaudhary void qla4_8xxx_watchdog(struct scsi_qla_host *ha);
125f4f5df23SVikas Chaudhary int qla4_8xxx_stop_firmware(struct scsi_qla_host *ha);
126f4f5df23SVikas Chaudhary int qla4_8xxx_get_flash_info(struct scsi_qla_host *ha);
127f4f5df23SVikas Chaudhary void qla4_8xxx_enable_intrs(struct scsi_qla_host *ha);
128f4f5df23SVikas Chaudhary void qla4_8xxx_disable_intrs(struct scsi_qla_host *ha);
129f4f5df23SVikas Chaudhary int qla4_8xxx_enable_msix(struct scsi_qla_host *ha);
130f4f5df23SVikas Chaudhary void qla4_8xxx_disable_msix(struct scsi_qla_host *ha);
131f4f5df23SVikas Chaudhary irqreturn_t qla4_8xxx_msi_handler(int irq, void *dev_id);
132f4f5df23SVikas Chaudhary irqreturn_t qla4_8xxx_default_intr_handler(int irq, void *dev_id);
133f4f5df23SVikas Chaudhary irqreturn_t qla4_8xxx_msix_rsp_q(int irq, void *dev_id);
134f4f5df23SVikas Chaudhary void qla4xxx_mark_all_devices_missing(struct scsi_qla_host *ha);
135f4f5df23SVikas Chaudhary void qla4xxx_dead_adapter_cleanup(struct scsi_qla_host *ha);
136f4f5df23SVikas Chaudhary int qla4_8xxx_idc_lock(struct scsi_qla_host *ha);
137f4f5df23SVikas Chaudhary void qla4_8xxx_idc_unlock(struct scsi_qla_host *ha);
138f4f5df23SVikas Chaudhary int qla4_8xxx_device_state_handler(struct scsi_qla_host *ha);
139f4f5df23SVikas Chaudhary void qla4_8xxx_need_qsnt_handler(struct scsi_qla_host *ha);
140f4f5df23SVikas Chaudhary void qla4_8xxx_clear_drv_active(struct scsi_qla_host *ha);
141626115cdSAndrew Morton void qla4_8xxx_set_drv_active(struct scsi_qla_host *ha);
142b3a271a9SManish Rangankar int qla4xxx_conn_open(struct scsi_qla_host *ha, uint16_t fw_ddb_index);
143b3a271a9SManish Rangankar int qla4xxx_set_param_ddbentry(struct scsi_qla_host *ha,
144b3a271a9SManish Rangankar 			       struct ddb_entry *ddb_entry,
145b3a271a9SManish Rangankar 			       struct iscsi_cls_conn *cls_conn,
146b3a271a9SManish Rangankar 			       uint32_t *mbx_sts);
147b3a271a9SManish Rangankar int qla4xxx_session_logout_ddb(struct scsi_qla_host *ha,
148b3a271a9SManish Rangankar 			       struct ddb_entry *ddb_entry, int options);
149b3a271a9SManish Rangankar int qla4xxx_req_ddb_entry(struct scsi_qla_host *ha, uint32_t fw_ddb_index,
150b3a271a9SManish Rangankar 			  uint32_t *mbx_sts);
151b3a271a9SManish Rangankar int qla4xxx_clear_ddb_entry(struct scsi_qla_host *ha, uint32_t fw_ddb_index);
152b3a271a9SManish Rangankar int qla4xxx_send_passthru0(struct iscsi_task *task);
153b3a271a9SManish Rangankar int qla4xxx_get_mgmt_data(struct scsi_qla_host *ha, uint16_t fw_ddb_index,
154b3a271a9SManish Rangankar 			  uint16_t stats_size, dma_addr_t stats_dma);
155b3a271a9SManish Rangankar void qla4xxx_update_session_conn_param(struct scsi_qla_host *ha,
156b3a271a9SManish Rangankar 				       struct ddb_entry *ddb_entry);
157a355943cSVikas Chaudhary /* BSG Functions */
158a355943cSVikas Chaudhary int qla4xxx_bsg_request(struct bsg_job *bsg_job);
159a355943cSVikas Chaudhary int qla4xxx_process_vendor_specific(struct bsg_job *bsg_job);
160a355943cSVikas Chaudhary 
16111010fecSAndrew Vasquez extern int ql4xextended_error_logging;
162afaf5a2dSDavid Somayajulu extern int ql4xdontresethba;
163f4f5df23SVikas Chaudhary extern int ql4xenablemsix;
164f4f5df23SVikas Chaudhary 
1657ad633c0SHarish Zunjarrao extern struct device_attribute *qla4xxx_host_attrs[];
166afaf5a2dSDavid Somayajulu #endif /* _QLA4x_GBL_H */
167