2 * Copyright (C) 2005 - 2012 Emulex
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License version 2
7 * as published by the Free Software Foundation. The full GNU General
8 * Public License is included in this distribution in the file called COPYING.
10 * Written by: Jayamohan Kallickal (jayamohan.kallickal@emulex.com)
12 * Contact Information:
13 * linux-drivers@emulex.com
17 * Costa Mesa, CA 92626
20 #ifndef _BEISCSI_MGMT_
21 #define _BEISCSI_MGMT_
23 #include <scsi/scsi_bsg_iscsi.h>
27 #define IP_ACTION_ADD 0x01
28 #define IP_ACTION_DEL 0x02
33 /* UE Status and Mask register */
34 #define PCICFG_UE_STATUS_LOW 0xA0
35 #define PCICFG_UE_STATUS_HIGH 0xA4
36 #define PCICFG_UE_STATUS_MASK_LOW 0xA8
37 #define PCICFG_UE_STATUS_MASK_HI 0xAC
40 * Pseudo amap definition in which each bit of the actual structure is defined
41 * as a byte: used to calculate offset/shift/mask of each field
44 u8 pa_lo[32]; /* dword 0 */
45 u8 pa_hi[32]; /* dword 1 */
46 u8 length[32]; /* DWORD 2 */
50 * Pseudo amap definition in which each bit of the actual structure is defined
51 * as a byte: used to calculate offset/shift/mask of each field
53 struct amap_mcc_wrb_payload {
55 struct amap_mcc_sge sgl[19];
56 u8 embedded[59 * 32]; /* DWORDS 57 to 115 */
61 * Pseudo amap definition in which each bit of the actual structure is defined
62 * as a byte: used to calculate offset/shift/mask of each field
65 u8 embedded; /* DWORD 0 */
66 u8 rsvd0[2]; /* DWORD 0 */
67 u8 sge_count[5]; /* DWORD 0 */
68 u8 rsvd1[16]; /* DWORD 0 */
69 u8 special[8]; /* DWORD 0 */
70 u8 payload_length[32];
71 u8 tag[64]; /* DWORD 2 */
72 u8 rsvd2[32]; /* DWORD 4 */
73 struct amap_mcc_wrb_payload payload;
77 u32 pa_lo; /* dword 0 */
78 u32 pa_hi; /* dword 1 */
79 u32 length; /* DWORD 2 */
82 struct mcc_wrb_payload {
84 struct mcc_sge sgl[19];
85 u32 embedded[59]; /* DWORDS 57 to 115 */
89 #define MCC_WRB_EMBEDDED_MASK 0x00000001
92 u32 dw[0]; /* DWORD 0 */
94 u32 tag[2]; /* DWORD 2 */
95 u32 rsvd2[1]; /* DWORD 4 */
96 struct mcc_wrb_payload payload;
99 int mgmt_epfw_cleanup(struct beiscsi_hba *phba, unsigned short chute);
100 int mgmt_open_connection(struct beiscsi_hba *phba,
101 struct sockaddr *dst_addr,
102 struct beiscsi_endpoint *beiscsi_ep,
103 struct be_dma_mem *nonemb_cmd);
105 unsigned int mgmt_upload_connection(struct beiscsi_hba *phba,
107 unsigned int upload_flag);
108 unsigned int mgmt_invalidate_icds(struct beiscsi_hba *phba,
109 struct invalidate_command_table *inv_tbl,
110 unsigned int num_invalidate, unsigned int cid,
111 struct be_dma_mem *nonemb_cmd);
112 unsigned int mgmt_vendor_specific_fw_cmd(struct be_ctrl_info *ctrl,
113 struct beiscsi_hba *phba,
115 struct be_dma_mem *nonemb_cmd);
117 #define BEISCSI_NO_RST_ISSUE 0
118 struct iscsi_invalidate_connection_params_in {
119 struct be_cmd_req_hdr hdr;
120 unsigned int session_handle;
122 unsigned short unused;
123 unsigned short cleanup_type;
124 unsigned short save_cfg;
127 struct iscsi_invalidate_connection_params_out {
128 unsigned int session_handle;
130 unsigned short unused;
133 union iscsi_invalidate_connection_params {
134 struct iscsi_invalidate_connection_params_in request;
135 struct iscsi_invalidate_connection_params_out response;
138 struct invalidate_commands_params_in {
139 struct be_cmd_req_hdr hdr;
140 unsigned int ref_handle;
141 unsigned int icd_count;
142 struct invalidate_command_table table[128];
143 unsigned short cleanup_type;
144 unsigned short unused;
147 struct invalidate_commands_params_out {
148 unsigned int ref_handle;
149 unsigned int icd_count;
150 unsigned int icd_status[128];
153 union invalidate_commands_params {
154 struct invalidate_commands_params_in request;
155 struct invalidate_commands_params_out response;
158 struct mgmt_hba_attributes {
159 u8 flashrom_version_string[32];
160 u8 manufacturer_name[32];
162 u8 seeprom_version_lo;
163 u8 seeprom_version_hi;
165 u32 fw_cmd_data_struct_version;
166 u32 ep_fw_data_struct_version;
167 u32 future_reserved[12];
168 u32 default_extended_timeout;
169 u8 controller_model_number[32];
170 u8 controller_description[64];
171 u8 controller_serial_number[32];
172 u8 ip_version_string[32];
173 u8 firmware_version_string[32];
174 u8 bios_version_string[32];
175 u8 redboot_version_string[32];
176 u8 driver_version_string[32];
177 u8 fw_on_flash_version_string[32];
178 u32 functionalities_supported;
181 u8 generational_guid[16];
183 u16 default_link_down_timeout;
184 u8 iscsi_ver_min_max;
185 u8 multifunction_device;
188 u8 max_domains_supported;
190 u32 firmware_post_status;
197 struct mgmt_controller_attributes {
198 struct mgmt_hba_attributes hba_attribs;
201 u16 pci_sub_vendor_id;
202 u16 pci_sub_system_id;
204 u8 pci_device_number;
205 u8 pci_function_number;
207 u64 unique_identifier;
213 struct be_mgmt_controller_attributes {
214 struct be_cmd_req_hdr hdr;
215 struct mgmt_controller_attributes params;
218 struct be_mgmt_controller_attributes_resp {
219 struct be_cmd_resp_hdr hdr;
220 struct mgmt_controller_attributes params;
223 struct be_bsg_vendor_cmd {
224 struct be_cmd_req_hdr hdr;
225 unsigned short region;
226 unsigned short offset;
227 unsigned short sector;
230 /* configuration management */
232 #define GET_MGMT_CONTROLLER_WS(phba) (phba->pmgmt_ws)
236 #define MGMT_CMDH_FREE (1<<0)
238 /* --- MGMT_ERROR_CODES --- */
239 /* Error Codes returned in the status field of the CMD response header */
240 #define MGMT_STATUS_SUCCESS 0 /* The CMD completed without errors */
241 #define MGMT_STATUS_FAILED 1 /* Error status in the Status field of */
242 /* the CMD_RESPONSE_HEADER */
244 #define ISCSI_GET_PDU_TEMPLATE_ADDRESS(pc, pa) {\
245 pa->lo = phba->init_mem[ISCSI_MEM_GLOBAL_HEADER].mem_array[0].\
246 bus_address.u.a32.address_lo; \
247 pa->hi = phba->init_mem[ISCSI_MEM_GLOBAL_HEADER].mem_array[0].\
248 bus_address.u.a32.address_hi; \
251 #define BEISCSI_WRITE_FLASH 0
252 #define BEISCSI_READ_FLASH 1
254 struct beiscsi_endpoint {
255 struct beiscsi_hba *phba;
256 struct beiscsi_sess *sess;
257 struct beiscsi_conn *conn;
258 struct iscsi_endpoint *openiscsi_ep;
259 unsigned short ip_type;
260 char dst6_addr[ISCSI_ADDRESS_BUF_LEN];
261 unsigned long dst_addr;
262 unsigned short ep_cid;
263 unsigned int fw_handle;
268 int mgmt_get_fw_config(struct be_ctrl_info *ctrl,
269 struct beiscsi_hba *phba);
271 unsigned int mgmt_invalidate_connection(struct beiscsi_hba *phba,
272 struct beiscsi_endpoint *beiscsi_ep,
274 unsigned short issue_reset,
275 unsigned short savecfg_flag);
277 int mgmt_set_ip(struct beiscsi_hba *phba,
278 struct iscsi_iface_param_info *ip_param,
279 struct iscsi_iface_param_info *subnet_param,
280 uint32_t boot_proto);
282 unsigned int mgmt_get_boot_target(struct beiscsi_hba *phba);
284 unsigned int mgmt_reopen_session(struct beiscsi_hba *phba,
285 unsigned int reopen_type,
286 unsigned sess_handle);
288 unsigned int mgmt_get_session_info(struct beiscsi_hba *phba,
289 u32 boot_session_handle,
290 struct be_dma_mem *nonemb_cmd);
292 int mgmt_get_nic_conf(struct beiscsi_hba *phba,
293 struct be_cmd_get_nic_conf_resp *mac);
295 int mgmt_get_if_info(struct beiscsi_hba *phba, int ip_type,
296 struct be_cmd_get_if_info_resp *if_info);
298 int mgmt_get_gateway(struct beiscsi_hba *phba, int ip_type,
299 struct be_cmd_get_def_gateway_resp *gateway);
301 int mgmt_set_gateway(struct beiscsi_hba *phba,
302 struct iscsi_iface_param_info *gateway_param);
304 int be_mgmt_get_boot_shandle(struct beiscsi_hba *phba,
305 unsigned int *s_handle);
307 unsigned int mgmt_get_all_if_id(struct beiscsi_hba *phba);
309 int mgmt_set_vlan(struct beiscsi_hba *phba, uint16_t vlan_tag);
311 ssize_t beiscsi_drvr_ver_disp(struct device *dev,
312 struct device_attribute *attr, char *buf);
314 ssize_t beiscsi_adap_family_disp(struct device *dev,
315 struct device_attribute *attr, char *buf);
317 void beiscsi_offload_cxn_v0(struct beiscsi_offload_params *params,
318 struct wrb_handle *pwrb_handle,
319 struct be_mem_descriptor *mem_descr);
321 void beiscsi_offload_cxn_v2(struct beiscsi_offload_params *params,
322 struct wrb_handle *pwrb_handle);
323 void beiscsi_ue_detect(struct beiscsi_hba *phba);