xref: /openbmc/linux/drivers/scsi/qla4xxx/ql4_glbl.h (revision 63dc02bd)
1 /*
2  * QLogic iSCSI HBA Driver
3  * Copyright (c)  2003-2010 QLogic Corporation
4  *
5  * See LICENSE.qla4xxx for copyright and licensing details.
6  */
7 
8 #ifndef __QLA4x_GBL_H
9 #define	__QLA4x_GBL_H
10 
11 struct iscsi_cls_conn;
12 
13 int qla4xxx_hw_reset(struct scsi_qla_host *ha);
14 int ql4xxx_lock_drvr_wait(struct scsi_qla_host *a);
15 int qla4xxx_send_command_to_isp(struct scsi_qla_host *ha, struct srb *srb);
16 int qla4xxx_initialize_adapter(struct scsi_qla_host *ha, int is_reset);
17 int qla4xxx_soft_reset(struct scsi_qla_host *ha);
18 irqreturn_t qla4xxx_intr_handler(int irq, void *dev_id);
19 
20 void qla4xxx_free_ddb(struct scsi_qla_host *ha, struct ddb_entry *ddb_entry);
21 void qla4xxx_process_aen(struct scsi_qla_host *ha, uint8_t process_aen);
22 
23 int qla4xxx_get_dhcp_ip_address(struct scsi_qla_host *ha);
24 int qla4xxx_abort_task(struct scsi_qla_host *ha, struct srb *srb);
25 int qla4xxx_reset_lun(struct scsi_qla_host *ha, struct ddb_entry *ddb_entry,
26 		      int lun);
27 int qla4xxx_reset_target(struct scsi_qla_host *ha,
28 			 struct ddb_entry *ddb_entry);
29 int qla4xxx_get_flash(struct scsi_qla_host *ha, dma_addr_t dma_addr,
30 		      uint32_t offset, uint32_t len);
31 int qla4xxx_get_firmware_status(struct scsi_qla_host *ha);
32 int qla4xxx_get_firmware_state(struct scsi_qla_host *ha);
33 int qla4xxx_initialize_fw_cb(struct scsi_qla_host *ha);
34 
35 /* FIXME: Goodness!  this really wants a small struct to hold the
36  * parameters. On x86 the args will get passed on the stack! */
37 int qla4xxx_get_fwddb_entry(struct scsi_qla_host *ha,
38 			    uint16_t fw_ddb_index,
39 			    struct dev_db_entry *fw_ddb_entry,
40 			    dma_addr_t fw_ddb_entry_dma,
41 			    uint32_t *num_valid_ddb_entries,
42 			    uint32_t *next_ddb_index,
43 			    uint32_t *fw_ddb_device_state,
44 			    uint32_t *conn_err_detail,
45 			    uint16_t *tcp_source_port_num,
46 			    uint16_t *connection_id);
47 
48 int qla4xxx_set_ddb_entry(struct scsi_qla_host * ha, uint16_t fw_ddb_index,
49 			  dma_addr_t fw_ddb_entry_dma, uint32_t *mbx_sts);
50 uint8_t qla4xxx_get_ifcb(struct scsi_qla_host *ha, uint32_t *mbox_cmd,
51 			 uint32_t *mbox_sts, dma_addr_t init_fw_cb_dma);
52 int qla4xxx_conn_close_sess_logout(struct scsi_qla_host *ha,
53 				   uint16_t fw_ddb_index,
54 				   uint16_t connection_id,
55 				   uint16_t option);
56 int qla4xxx_disable_acb(struct scsi_qla_host *ha);
57 int qla4xxx_set_acb(struct scsi_qla_host *ha, uint32_t *mbox_cmd,
58 		    uint32_t *mbox_sts, dma_addr_t acb_dma);
59 int qla4xxx_get_acb(struct scsi_qla_host *ha, dma_addr_t acb_dma,
60 		    uint32_t acb_type, uint32_t len);
61 int qla4xxx_get_ip_state(struct scsi_qla_host *ha, uint32_t acb_idx,
62 			 uint32_t ip_idx, uint32_t *sts);
63 void qla4xxx_mark_device_missing(struct iscsi_cls_session *cls_session);
64 u16 rd_nvram_word(struct scsi_qla_host *ha, int offset);
65 u8 rd_nvram_byte(struct scsi_qla_host *ha, int offset);
66 void qla4xxx_get_crash_record(struct scsi_qla_host *ha);
67 int qla4xxx_is_nvram_configuration_valid(struct scsi_qla_host *ha);
68 int qla4xxx_about_firmware(struct scsi_qla_host *ha);
69 void qla4xxx_interrupt_service_routine(struct scsi_qla_host *ha,
70 				       uint32_t intr_status);
71 int qla4xxx_init_rings(struct scsi_qla_host *ha);
72 void qla4xxx_srb_compl(struct kref *ref);
73 struct srb *qla4xxx_del_from_active_array(struct scsi_qla_host *ha,
74 		uint32_t index);
75 int qla4xxx_process_ddb_changed(struct scsi_qla_host *ha, uint32_t fw_ddb_index,
76 		uint32_t state, uint32_t conn_error);
77 void qla4xxx_dump_buffer(void *b, uint32_t size);
78 int qla4xxx_send_marker_iocb(struct scsi_qla_host *ha,
79 	struct ddb_entry *ddb_entry, int lun, uint16_t mrkr_mod);
80 int qla4xxx_set_flash(struct scsi_qla_host *ha, dma_addr_t dma_addr,
81 		      uint32_t offset, uint32_t length, uint32_t options);
82 int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount,
83 		uint8_t outCount, uint32_t *mbx_cmd, uint32_t *mbx_sts);
84 int qla4xxx_get_chap_index(struct scsi_qla_host *ha, char *username,
85 			   char *password, int bidi, uint16_t *chap_index);
86 
87 void qla4xxx_queue_iocb(struct scsi_qla_host *ha);
88 void qla4xxx_complete_iocb(struct scsi_qla_host *ha);
89 int qla4xxx_get_sys_info(struct scsi_qla_host *ha);
90 int qla4xxx_iospace_config(struct scsi_qla_host *ha);
91 void qla4xxx_pci_config(struct scsi_qla_host *ha);
92 int qla4xxx_start_firmware(struct scsi_qla_host *ha);
93 irqreturn_t qla4xxx_intr_handler(int irq, void *dev_id);
94 uint16_t qla4xxx_rd_shdw_req_q_out(struct scsi_qla_host *ha);
95 uint16_t qla4xxx_rd_shdw_rsp_q_in(struct scsi_qla_host *ha);
96 int qla4xxx_request_irqs(struct scsi_qla_host *ha);
97 void qla4xxx_free_irqs(struct scsi_qla_host *ha);
98 void qla4xxx_process_response_queue(struct scsi_qla_host *ha);
99 void qla4xxx_wake_dpc(struct scsi_qla_host *ha);
100 void qla4xxx_get_conn_event_log(struct scsi_qla_host *ha);
101 void qla4xxx_mailbox_premature_completion(struct scsi_qla_host *ha);
102 void qla4xxx_dump_registers(struct scsi_qla_host *ha);
103 uint8_t qla4xxx_update_local_ifcb(struct scsi_qla_host *ha,
104 				  uint32_t *mbox_cmd,
105 				  uint32_t *mbox_sts,
106 				  struct addr_ctrl_blk *init_fw_cb,
107 				  dma_addr_t init_fw_cb_dma);
108 
109 void qla4_8xxx_pci_config(struct scsi_qla_host *);
110 int qla4_8xxx_iospace_config(struct scsi_qla_host *ha);
111 int qla4_8xxx_load_risc(struct scsi_qla_host *);
112 irqreturn_t qla4_8xxx_intr_handler(int irq, void *dev_id);
113 void qla4_8xxx_queue_iocb(struct scsi_qla_host *ha);
114 void qla4_8xxx_complete_iocb(struct scsi_qla_host *ha);
115 
116 int qla4_8xxx_crb_win_lock(struct scsi_qla_host *);
117 void qla4_8xxx_crb_win_unlock(struct scsi_qla_host *);
118 int qla4_8xxx_pci_get_crb_addr_2M(struct scsi_qla_host *, ulong *);
119 void qla4_8xxx_wr_32(struct scsi_qla_host *, ulong, u32);
120 int qla4_8xxx_rd_32(struct scsi_qla_host *, ulong);
121 int qla4_8xxx_pci_mem_read_2M(struct scsi_qla_host *, u64, void *, int);
122 int qla4_8xxx_pci_mem_write_2M(struct scsi_qla_host *ha, u64, void *, int);
123 int qla4_8xxx_isp_reset(struct scsi_qla_host *ha);
124 void qla4_8xxx_interrupt_service_routine(struct scsi_qla_host *ha,
125 		uint32_t intr_status);
126 uint16_t qla4_8xxx_rd_shdw_req_q_out(struct scsi_qla_host *ha);
127 uint16_t qla4_8xxx_rd_shdw_rsp_q_in(struct scsi_qla_host *ha);
128 int qla4_8xxx_get_sys_info(struct scsi_qla_host *ha);
129 void qla4_8xxx_watchdog(struct scsi_qla_host *ha);
130 int qla4_8xxx_stop_firmware(struct scsi_qla_host *ha);
131 int qla4_8xxx_get_flash_info(struct scsi_qla_host *ha);
132 void qla4_8xxx_enable_intrs(struct scsi_qla_host *ha);
133 void qla4_8xxx_disable_intrs(struct scsi_qla_host *ha);
134 int qla4_8xxx_enable_msix(struct scsi_qla_host *ha);
135 void qla4_8xxx_disable_msix(struct scsi_qla_host *ha);
136 irqreturn_t qla4_8xxx_msi_handler(int irq, void *dev_id);
137 irqreturn_t qla4_8xxx_default_intr_handler(int irq, void *dev_id);
138 irqreturn_t qla4_8xxx_msix_rsp_q(int irq, void *dev_id);
139 void qla4xxx_mark_all_devices_missing(struct scsi_qla_host *ha);
140 void qla4xxx_dead_adapter_cleanup(struct scsi_qla_host *ha);
141 int qla4_8xxx_idc_lock(struct scsi_qla_host *ha);
142 void qla4_8xxx_idc_unlock(struct scsi_qla_host *ha);
143 int qla4_8xxx_device_state_handler(struct scsi_qla_host *ha);
144 void qla4_8xxx_need_qsnt_handler(struct scsi_qla_host *ha);
145 void qla4_8xxx_clear_drv_active(struct scsi_qla_host *ha);
146 void qla4_8xxx_set_drv_active(struct scsi_qla_host *ha);
147 int qla4xxx_conn_open(struct scsi_qla_host *ha, uint16_t fw_ddb_index);
148 int qla4xxx_set_param_ddbentry(struct scsi_qla_host *ha,
149 			       struct ddb_entry *ddb_entry,
150 			       struct iscsi_cls_conn *cls_conn,
151 			       uint32_t *mbx_sts);
152 int qla4xxx_session_logout_ddb(struct scsi_qla_host *ha,
153 			       struct ddb_entry *ddb_entry, int options);
154 int qla4xxx_req_ddb_entry(struct scsi_qla_host *ha, uint32_t fw_ddb_index,
155 			  uint32_t *mbx_sts);
156 int qla4xxx_clear_ddb_entry(struct scsi_qla_host *ha, uint32_t fw_ddb_index);
157 int qla4xxx_send_passthru0(struct iscsi_task *task);
158 void qla4xxx_free_ddb_index(struct scsi_qla_host *ha);
159 int qla4xxx_get_mgmt_data(struct scsi_qla_host *ha, uint16_t fw_ddb_index,
160 			  uint16_t stats_size, dma_addr_t stats_dma);
161 void qla4xxx_update_session_conn_param(struct scsi_qla_host *ha,
162 				       struct ddb_entry *ddb_entry);
163 void qla4xxx_update_session_conn_fwddb_param(struct scsi_qla_host *ha,
164 					     struct ddb_entry *ddb_entry);
165 int qla4xxx_bootdb_by_index(struct scsi_qla_host *ha,
166 			    struct dev_db_entry *fw_ddb_entry,
167 			    dma_addr_t fw_ddb_entry_dma, uint16_t ddb_index);
168 int qla4xxx_get_chap(struct scsi_qla_host *ha, char *username,
169 		     char *password, uint16_t idx);
170 int qla4xxx_get_nvram(struct scsi_qla_host *ha, dma_addr_t nvram_dma,
171 		      uint32_t offset, uint32_t size);
172 int qla4xxx_set_nvram(struct scsi_qla_host *ha, dma_addr_t nvram_dma,
173 		      uint32_t offset, uint32_t size);
174 int qla4xxx_restore_factory_defaults(struct scsi_qla_host *ha,
175 				     uint32_t region, uint32_t field0,
176 				     uint32_t field1);
177 int qla4xxx_get_ddb_index(struct scsi_qla_host *ha, uint16_t *ddb_index);
178 void qla4xxx_login_flash_ddb(struct iscsi_cls_session *cls_session);
179 int qla4xxx_unblock_ddb(struct iscsi_cls_session *cls_session);
180 int qla4xxx_unblock_flash_ddb(struct iscsi_cls_session *cls_session);
181 int qla4xxx_flash_ddb_change(struct scsi_qla_host *ha, uint32_t fw_ddb_index,
182 			     struct ddb_entry *ddb_entry, uint32_t state);
183 int qla4xxx_ddb_change(struct scsi_qla_host *ha, uint32_t fw_ddb_index,
184 		       struct ddb_entry *ddb_entry, uint32_t state);
185 void qla4xxx_build_ddb_list(struct scsi_qla_host *ha, int is_reset);
186 int qla4xxx_post_aen_work(struct scsi_qla_host *ha, uint32_t aen_code,
187 			  uint32_t data_size, uint8_t *data);
188 int qla4xxx_ping_iocb(struct scsi_qla_host *ha, uint32_t options,
189 		      uint32_t payload_size, uint32_t pid, uint8_t *ipaddr);
190 int 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);
193 
194 /* BSG Functions */
195 int qla4xxx_bsg_request(struct bsg_job *bsg_job);
196 int qla4xxx_process_vendor_specific(struct bsg_job *bsg_job);
197 
198 void qla4xxx_arm_relogin_timer(struct ddb_entry *ddb_entry);
199 
200 extern int ql4xextended_error_logging;
201 extern int ql4xdontresethba;
202 extern int ql4xenablemsix;
203 
204 extern struct device_attribute *qla4xxx_host_attrs[];
205 #endif /* _QLA4x_GBL_H */
206