blob: 08428824ace239517784ea9e4ddd00a132a2c996 [file] [log] [blame]
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05301/**
Jayamohan Kallickal255fa9a2011-03-25 14:23:57 -07002 * Copyright (C) 2005 - 2011 Emulex
Jayamohan Kallickal6733b392009-09-05 07:36:35 +05303 * All rights reserved.
4 *
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.
9 *
Jayamohan Kallickal255fa9a2011-03-25 14:23:57 -070010 * Written by: Jayamohan Kallickal (jayamohan.kallickal@emulex.com)
Jayamohan Kallickal6733b392009-09-05 07:36:35 +053011 *
12 * Contact Information:
Jayamohan Kallickal255fa9a2011-03-25 14:23:57 -070013 * linux-drivers@emulex.com
Jayamohan Kallickal6733b392009-09-05 07:36:35 +053014 *
Jayamohan Kallickal255fa9a2011-03-25 14:23:57 -070015 * Emulex
16 * 3333 Susan Street
17 * Costa Mesa, CA 92626
Jayamohan Kallickal6733b392009-09-05 07:36:35 +053018 */
19
20#ifndef _BEISCSI_MGMT_
21#define _BEISCSI_MGMT_
22
23#include <linux/types.h>
24#include <linux/list.h>
25#include "be_iscsi.h"
26#include "be_main.h"
27
28/**
29 * Pseudo amap definition in which each bit of the actual structure is defined
30 * as a byte: used to calculate offset/shift/mask of each field
31 */
32struct amap_mcc_sge {
33 u8 pa_lo[32]; /* dword 0 */
34 u8 pa_hi[32]; /* dword 1 */
35 u8 length[32]; /* DWORD 2 */
36} __packed;
37
38/**
39 * Pseudo amap definition in which each bit of the actual structure is defined
40 * as a byte: used to calculate offset/shift/mask of each field
41 */
42struct amap_mcc_wrb_payload {
43 union {
44 struct amap_mcc_sge sgl[19];
45 u8 embedded[59 * 32]; /* DWORDS 57 to 115 */
46 } u;
47} __packed;
48
49/**
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
52 */
53struct amap_mcc_wrb {
54 u8 embedded; /* DWORD 0 */
55 u8 rsvd0[2]; /* DWORD 0 */
56 u8 sge_count[5]; /* DWORD 0 */
57 u8 rsvd1[16]; /* DWORD 0 */
58 u8 special[8]; /* DWORD 0 */
59 u8 payload_length[32];
60 u8 tag[64]; /* DWORD 2 */
61 u8 rsvd2[32]; /* DWORD 4 */
62 struct amap_mcc_wrb_payload payload;
63};
64
65struct mcc_sge {
66 u32 pa_lo; /* dword 0 */
67 u32 pa_hi; /* dword 1 */
68 u32 length; /* DWORD 2 */
69} __packed;
70
71struct mcc_wrb_payload {
72 union {
73 struct mcc_sge sgl[19];
74 u32 embedded[59]; /* DWORDS 57 to 115 */
75 } u;
76} __packed;
77
78#define MCC_WRB_EMBEDDED_MASK 0x00000001
79
80struct mcc_wrb {
81 u32 dw[0]; /* DWORD 0 */
82 u32 payload_length;
83 u32 tag[2]; /* DWORD 2 */
84 u32 rsvd2[1]; /* DWORD 4 */
85 struct mcc_wrb_payload payload;
86};
87
Jayamohan Kallickal03a12312010-07-22 04:17:16 +053088int mgmt_epfw_cleanup(struct beiscsi_hba *phba, unsigned short chute);
Jayamohan Kallickal3cbb7a72010-07-22 04:27:47 +053089int mgmt_open_connection(struct beiscsi_hba *phba,
90 struct sockaddr *dst_addr,
91 struct beiscsi_endpoint *beiscsi_ep,
92 struct be_dma_mem *nonemb_cmd);
Jayamohan Kallickal6733b392009-09-05 07:36:35 +053093
Jayamohan Kallickal03a12312010-07-22 04:17:16 +053094unsigned int mgmt_upload_connection(struct beiscsi_hba *phba,
Jayamohan Kallickal6733b392009-09-05 07:36:35 +053095 unsigned short cid,
96 unsigned int upload_flag);
Jayamohan Kallickal03a12312010-07-22 04:17:16 +053097unsigned int mgmt_invalidate_icds(struct beiscsi_hba *phba,
Jayamohan Kallickal41831222010-02-20 08:02:39 +053098 struct invalidate_command_table *inv_tbl,
Jayamohan Kallickal3cbb7a72010-07-22 04:27:47 +053099 unsigned int num_invalidate, unsigned int cid,
100 struct be_dma_mem *nonemb_cmd);
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530101
102struct iscsi_invalidate_connection_params_in {
103 struct be_cmd_req_hdr hdr;
104 unsigned int session_handle;
105 unsigned short cid;
106 unsigned short unused;
107 unsigned short cleanup_type;
108 unsigned short save_cfg;
109} __packed;
110
111struct iscsi_invalidate_connection_params_out {
112 unsigned int session_handle;
113 unsigned short cid;
114 unsigned short unused;
115} __packed;
116
117union iscsi_invalidate_connection_params {
118 struct iscsi_invalidate_connection_params_in request;
119 struct iscsi_invalidate_connection_params_out response;
120} __packed;
121
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530122struct invalidate_commands_params_in {
123 struct be_cmd_req_hdr hdr;
124 unsigned int ref_handle;
125 unsigned int icd_count;
126 struct invalidate_command_table table[128];
127 unsigned short cleanup_type;
128 unsigned short unused;
129} __packed;
130
131struct invalidate_commands_params_out {
132 unsigned int ref_handle;
133 unsigned int icd_count;
134 unsigned int icd_status[128];
135} __packed;
136
137union invalidate_commands_params {
138 struct invalidate_commands_params_in request;
139 struct invalidate_commands_params_out response;
140} __packed;
141
142struct mgmt_hba_attributes {
143 u8 flashrom_version_string[32];
144 u8 manufacturer_name[32];
145 u32 supported_modes;
146 u8 seeprom_version_lo;
147 u8 seeprom_version_hi;
148 u8 rsvd0[2];
149 u32 fw_cmd_data_struct_version;
150 u32 ep_fw_data_struct_version;
151 u32 future_reserved[12];
152 u32 default_extended_timeout;
153 u8 controller_model_number[32];
154 u8 controller_description[64];
155 u8 controller_serial_number[32];
156 u8 ip_version_string[32];
157 u8 firmware_version_string[32];
158 u8 bios_version_string[32];
159 u8 redboot_version_string[32];
160 u8 driver_version_string[32];
161 u8 fw_on_flash_version_string[32];
162 u32 functionalities_supported;
163 u16 max_cdblength;
164 u8 asic_revision;
165 u8 generational_guid[16];
166 u8 hba_port_count;
167 u16 default_link_down_timeout;
168 u8 iscsi_ver_min_max;
169 u8 multifunction_device;
170 u8 cache_valid;
171 u8 hba_status;
172 u8 max_domains_supported;
173 u8 phy_port;
174 u32 firmware_post_status;
175 u32 hba_mtu[8];
Jayamohan Kallickalbfead3b2009-10-23 11:52:33 +0530176 u8 iscsi_features;
177 u8 future_u8[3];
178 u32 future_u32[3];
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530179} __packed;
180
181struct mgmt_controller_attributes {
182 struct mgmt_hba_attributes hba_attribs;
183 u16 pci_vendor_id;
184 u16 pci_device_id;
185 u16 pci_sub_vendor_id;
186 u16 pci_sub_system_id;
187 u8 pci_bus_number;
188 u8 pci_device_number;
189 u8 pci_function_number;
190 u8 interface_type;
191 u64 unique_identifier;
192 u8 netfilters;
193 u8 rsvd0[3];
194 u8 future_u32[4];
195} __packed;
196
197struct be_mgmt_controller_attributes {
198 struct be_cmd_req_hdr hdr;
199 struct mgmt_controller_attributes params;
200} __packed;
201
202struct be_mgmt_controller_attributes_resp {
203 struct be_cmd_resp_hdr hdr;
204 struct mgmt_controller_attributes params;
205} __packed;
206
207/* configuration management */
208
209#define GET_MGMT_CONTROLLER_WS(phba) (phba->pmgmt_ws)
210
211/* MGMT CMD flags */
212
213#define MGMT_CMDH_FREE (1<<0)
214
215/* --- MGMT_ERROR_CODES --- */
216/* Error Codes returned in the status field of the CMD response header */
217#define MGMT_STATUS_SUCCESS 0 /* The CMD completed without errors */
218#define MGMT_STATUS_FAILED 1 /* Error status in the Status field of */
219 /* the CMD_RESPONSE_HEADER */
220
221#define ISCSI_GET_PDU_TEMPLATE_ADDRESS(pc, pa) {\
222 pa->lo = phba->init_mem[ISCSI_MEM_GLOBAL_HEADER].mem_array[0].\
223 bus_address.u.a32.address_lo; \
224 pa->hi = phba->init_mem[ISCSI_MEM_GLOBAL_HEADER].mem_array[0].\
225 bus_address.u.a32.address_hi; \
226}
227
228struct beiscsi_endpoint {
229 struct beiscsi_hba *phba;
230 struct beiscsi_sess *sess;
231 struct beiscsi_conn *conn;
Jayamohan Kallickalc2462282010-01-05 05:05:34 +0530232 struct iscsi_endpoint *openiscsi_ep;
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530233 unsigned short ip_type;
234 char dst6_addr[ISCSI_ADDRESS_BUF_LEN];
235 unsigned long dst_addr;
236 unsigned short ep_cid;
237 unsigned int fw_handle;
238 u16 dst_tcpport;
239 u16 cid_vld;
240};
241
Jayamohan Kallickal03a12312010-07-22 04:17:16 +0530242int mgmt_get_fw_config(struct be_ctrl_info *ctrl,
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530243 struct beiscsi_hba *phba);
244
Jayamohan Kallickal03a12312010-07-22 04:17:16 +0530245unsigned int mgmt_invalidate_connection(struct beiscsi_hba *phba,
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530246 struct beiscsi_endpoint *beiscsi_ep,
247 unsigned short cid,
248 unsigned short issue_reset,
249 unsigned short savecfg_flag);
Jayamohan Kallickalbfead3b2009-10-23 11:52:33 +0530250
Jayamohan Kallickal6733b392009-09-05 07:36:35 +0530251#endif