Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[deliverable/linux.git] / drivers / scsi / be2iscsi / be_mgmt.h
CommitLineData
6733b39a 1/**
255fa9a3 2 * Copyright (C) 2005 - 2011 Emulex
6733b39a
JK
3 * 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 *
255fa9a3 10 * Written by: Jayamohan Kallickal (jayamohan.kallickal@emulex.com)
6733b39a
JK
11 *
12 * Contact Information:
255fa9a3 13 * linux-drivers@emulex.com
6733b39a 14 *
255fa9a3
JK
15 * Emulex
16 * 3333 Susan Street
17 * Costa Mesa, CA 92626
6733b39a
JK
18 */
19
20#ifndef _BEISCSI_MGMT_
21#define _BEISCSI_MGMT_
22
ffce3e2e 23#include <scsi/scsi_bsg_iscsi.h>
6733b39a
JK
24#include "be_iscsi.h"
25#include "be_main.h"
26
0e43895e
MC
27#define IP_ACTION_ADD 0x01
28#define IP_ACTION_DEL 0x02
29
30#define IP_V6_LEN 16
31#define IP_V4_LEN 4
32
6733b39a
JK
33/**
34 * Pseudo amap definition in which each bit of the actual structure is defined
35 * as a byte: used to calculate offset/shift/mask of each field
36 */
37struct amap_mcc_sge {
38 u8 pa_lo[32]; /* dword 0 */
39 u8 pa_hi[32]; /* dword 1 */
40 u8 length[32]; /* DWORD 2 */
41} __packed;
42
43/**
44 * Pseudo amap definition in which each bit of the actual structure is defined
45 * as a byte: used to calculate offset/shift/mask of each field
46 */
47struct amap_mcc_wrb_payload {
48 union {
49 struct amap_mcc_sge sgl[19];
50 u8 embedded[59 * 32]; /* DWORDS 57 to 115 */
51 } u;
52} __packed;
53
54/**
55 * Pseudo amap definition in which each bit of the actual structure is defined
56 * as a byte: used to calculate offset/shift/mask of each field
57 */
58struct amap_mcc_wrb {
59 u8 embedded; /* DWORD 0 */
60 u8 rsvd0[2]; /* DWORD 0 */
61 u8 sge_count[5]; /* DWORD 0 */
62 u8 rsvd1[16]; /* DWORD 0 */
63 u8 special[8]; /* DWORD 0 */
64 u8 payload_length[32];
65 u8 tag[64]; /* DWORD 2 */
66 u8 rsvd2[32]; /* DWORD 4 */
67 struct amap_mcc_wrb_payload payload;
68};
69
70struct mcc_sge {
71 u32 pa_lo; /* dword 0 */
72 u32 pa_hi; /* dword 1 */
73 u32 length; /* DWORD 2 */
74} __packed;
75
76struct mcc_wrb_payload {
77 union {
78 struct mcc_sge sgl[19];
79 u32 embedded[59]; /* DWORDS 57 to 115 */
80 } u;
81} __packed;
82
83#define MCC_WRB_EMBEDDED_MASK 0x00000001
84
85struct mcc_wrb {
86 u32 dw[0]; /* DWORD 0 */
87 u32 payload_length;
88 u32 tag[2]; /* DWORD 2 */
89 u32 rsvd2[1]; /* DWORD 4 */
90 struct mcc_wrb_payload payload;
91};
92
03a12310 93int mgmt_epfw_cleanup(struct beiscsi_hba *phba, unsigned short chute);
3cbb7a74
JK
94int mgmt_open_connection(struct beiscsi_hba *phba,
95 struct sockaddr *dst_addr,
96 struct beiscsi_endpoint *beiscsi_ep,
97 struct be_dma_mem *nonemb_cmd);
6733b39a 98
03a12310 99unsigned int mgmt_upload_connection(struct beiscsi_hba *phba,
6733b39a
JK
100 unsigned short cid,
101 unsigned int upload_flag);
03a12310 102unsigned int mgmt_invalidate_icds(struct beiscsi_hba *phba,
4183122d 103 struct invalidate_command_table *inv_tbl,
3cbb7a74
JK
104 unsigned int num_invalidate, unsigned int cid,
105 struct be_dma_mem *nonemb_cmd);
ffce3e2e
JK
106unsigned int mgmt_vendor_specific_fw_cmd(struct be_ctrl_info *ctrl,
107 struct beiscsi_hba *phba,
108 struct bsg_job *job,
109 struct be_dma_mem *nonemb_cmd);
6733b39a
JK
110
111struct iscsi_invalidate_connection_params_in {
112 struct be_cmd_req_hdr hdr;
113 unsigned int session_handle;
114 unsigned short cid;
115 unsigned short unused;
116 unsigned short cleanup_type;
117 unsigned short save_cfg;
118} __packed;
119
120struct iscsi_invalidate_connection_params_out {
121 unsigned int session_handle;
122 unsigned short cid;
123 unsigned short unused;
124} __packed;
125
126union iscsi_invalidate_connection_params {
127 struct iscsi_invalidate_connection_params_in request;
128 struct iscsi_invalidate_connection_params_out response;
129} __packed;
130
6733b39a
JK
131struct invalidate_commands_params_in {
132 struct be_cmd_req_hdr hdr;
133 unsigned int ref_handle;
134 unsigned int icd_count;
135 struct invalidate_command_table table[128];
136 unsigned short cleanup_type;
137 unsigned short unused;
138} __packed;
139
140struct invalidate_commands_params_out {
141 unsigned int ref_handle;
142 unsigned int icd_count;
143 unsigned int icd_status[128];
144} __packed;
145
146union invalidate_commands_params {
147 struct invalidate_commands_params_in request;
148 struct invalidate_commands_params_out response;
149} __packed;
150
151struct mgmt_hba_attributes {
152 u8 flashrom_version_string[32];
153 u8 manufacturer_name[32];
154 u32 supported_modes;
155 u8 seeprom_version_lo;
156 u8 seeprom_version_hi;
157 u8 rsvd0[2];
158 u32 fw_cmd_data_struct_version;
159 u32 ep_fw_data_struct_version;
160 u32 future_reserved[12];
161 u32 default_extended_timeout;
162 u8 controller_model_number[32];
163 u8 controller_description[64];
164 u8 controller_serial_number[32];
165 u8 ip_version_string[32];
166 u8 firmware_version_string[32];
167 u8 bios_version_string[32];
168 u8 redboot_version_string[32];
169 u8 driver_version_string[32];
170 u8 fw_on_flash_version_string[32];
171 u32 functionalities_supported;
172 u16 max_cdblength;
173 u8 asic_revision;
174 u8 generational_guid[16];
175 u8 hba_port_count;
176 u16 default_link_down_timeout;
177 u8 iscsi_ver_min_max;
178 u8 multifunction_device;
179 u8 cache_valid;
180 u8 hba_status;
181 u8 max_domains_supported;
182 u8 phy_port;
183 u32 firmware_post_status;
184 u32 hba_mtu[8];
bfead3b2
JK
185 u8 iscsi_features;
186 u8 future_u8[3];
187 u32 future_u32[3];
6733b39a
JK
188} __packed;
189
190struct mgmt_controller_attributes {
191 struct mgmt_hba_attributes hba_attribs;
192 u16 pci_vendor_id;
193 u16 pci_device_id;
194 u16 pci_sub_vendor_id;
195 u16 pci_sub_system_id;
196 u8 pci_bus_number;
197 u8 pci_device_number;
198 u8 pci_function_number;
199 u8 interface_type;
200 u64 unique_identifier;
201 u8 netfilters;
202 u8 rsvd0[3];
203 u8 future_u32[4];
204} __packed;
205
206struct be_mgmt_controller_attributes {
207 struct be_cmd_req_hdr hdr;
208 struct mgmt_controller_attributes params;
209} __packed;
210
211struct be_mgmt_controller_attributes_resp {
212 struct be_cmd_resp_hdr hdr;
213 struct mgmt_controller_attributes params;
214} __packed;
215
ffce3e2e
JK
216struct be_bsg_vendor_cmd {
217 struct be_cmd_req_hdr hdr;
218 unsigned short region;
219 unsigned short offset;
220 unsigned short sector;
221} __packed;
222
6733b39a
JK
223/* configuration management */
224
225#define GET_MGMT_CONTROLLER_WS(phba) (phba->pmgmt_ws)
226
227/* MGMT CMD flags */
228
229#define MGMT_CMDH_FREE (1<<0)
230
231/* --- MGMT_ERROR_CODES --- */
232/* Error Codes returned in the status field of the CMD response header */
233#define MGMT_STATUS_SUCCESS 0 /* The CMD completed without errors */
234#define MGMT_STATUS_FAILED 1 /* Error status in the Status field of */
235 /* the CMD_RESPONSE_HEADER */
236
237#define ISCSI_GET_PDU_TEMPLATE_ADDRESS(pc, pa) {\
3ec78271 238 pa->lo = phba->init_mem[ISCSI_MEM_GLOBAL_HEADER].mem_array[0].\
6733b39a 239 bus_address.u.a32.address_lo; \
3ec78271 240 pa->hi = phba->init_mem[ISCSI_MEM_GLOBAL_HEADER].mem_array[0].\
6733b39a
JK
241 bus_address.u.a32.address_hi; \
242}
243
ffce3e2e
JK
244#define BEISCSI_WRITE_FLASH 0
245#define BEISCSI_READ_FLASH 1
246
6733b39a
JK
247struct beiscsi_endpoint {
248 struct beiscsi_hba *phba;
249 struct beiscsi_sess *sess;
250 struct beiscsi_conn *conn;
c2462288 251 struct iscsi_endpoint *openiscsi_ep;
6733b39a
JK
252 unsigned short ip_type;
253 char dst6_addr[ISCSI_ADDRESS_BUF_LEN];
254 unsigned long dst_addr;
255 unsigned short ep_cid;
256 unsigned int fw_handle;
257 u16 dst_tcpport;
258 u16 cid_vld;
259};
260
03a12310 261int mgmt_get_fw_config(struct be_ctrl_info *ctrl,
6733b39a
JK
262 struct beiscsi_hba *phba);
263
03a12310 264unsigned int mgmt_invalidate_connection(struct beiscsi_hba *phba,
6733b39a
JK
265 struct beiscsi_endpoint *beiscsi_ep,
266 unsigned short cid,
267 unsigned short issue_reset,
268 unsigned short savecfg_flag);
bfead3b2 269
0e43895e
MC
270int mgmt_set_ip(struct beiscsi_hba *phba,
271 struct iscsi_iface_param_info *ip_param,
272 struct iscsi_iface_param_info *subnet_param,
273 uint32_t boot_proto);
274
275unsigned int mgmt_get_boot_target(struct beiscsi_hba *phba);
276
277unsigned int mgmt_get_session_info(struct beiscsi_hba *phba,
278 u32 boot_session_handle,
279 struct be_dma_mem *nonemb_cmd);
280
281int mgmt_get_nic_conf(struct beiscsi_hba *phba,
282 struct be_cmd_get_nic_conf_resp *mac);
283
284int mgmt_get_if_info(struct beiscsi_hba *phba, int ip_type,
285 struct be_cmd_get_if_info_resp *if_info);
286
287int mgmt_get_gateway(struct beiscsi_hba *phba, int ip_type,
288 struct be_cmd_get_def_gateway_resp *gateway);
289
290int mgmt_set_gateway(struct beiscsi_hba *phba,
291 struct iscsi_iface_param_info *gateway_param);
292
6733b39a 293#endif
This page took 0.20803 seconds and 5 git commands to generate.