2 * Copyright (C) 2005 - 2010 ServerEngines
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 (jayamohank@serverengines.com)
12 * Contact Information:
13 * linux-drivers@serverengines.com
16 * 209 N. Fair Oaks Ave
21 #ifndef _BEISCSI_MGMT_
22 #define _BEISCSI_MGMT_
24 #include <linux/types.h>
25 #include <linux/list.h>
30 * Pseudo amap definition in which each bit of the actual structure is defined
31 * as a byte: used to calculate offset/shift/mask of each field
34 u8 pa_lo
[32]; /* dword 0 */
35 u8 pa_hi
[32]; /* dword 1 */
36 u8 length
[32]; /* DWORD 2 */
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
43 struct amap_mcc_wrb_payload
{
45 struct amap_mcc_sge sgl
[19];
46 u8 embedded
[59 * 32]; /* DWORDS 57 to 115 */
51 * Pseudo amap definition in which each bit of the actual structure is defined
52 * as a byte: used to calculate offset/shift/mask of each field
55 u8 embedded
; /* DWORD 0 */
56 u8 rsvd0
[2]; /* DWORD 0 */
57 u8 sge_count
[5]; /* DWORD 0 */
58 u8 rsvd1
[16]; /* DWORD 0 */
59 u8 special
[8]; /* DWORD 0 */
60 u8 payload_length
[32];
61 u8 tag
[64]; /* DWORD 2 */
62 u8 rsvd2
[32]; /* DWORD 4 */
63 struct amap_mcc_wrb_payload payload
;
67 u32 pa_lo
; /* dword 0 */
68 u32 pa_hi
; /* dword 1 */
69 u32 length
; /* DWORD 2 */
72 struct mcc_wrb_payload
{
74 struct mcc_sge sgl
[19];
75 u32 embedded
[59]; /* DWORDS 57 to 115 */
79 #define MCC_WRB_EMBEDDED_MASK 0x00000001
82 u32 dw
[0]; /* DWORD 0 */
84 u32 tag
[2]; /* DWORD 2 */
85 u32 rsvd2
[1]; /* DWORD 4 */
86 struct mcc_wrb_payload payload
;
89 unsigned char mgmt_epfw_cleanup(struct beiscsi_hba
*phba
, unsigned short chute
);
90 int mgmt_open_connection(struct beiscsi_hba
*phba
, struct sockaddr
*dst_addr
,
91 struct beiscsi_endpoint
*beiscsi_ep
);
93 unsigned char mgmt_upload_connection(struct beiscsi_hba
*phba
,
95 unsigned int upload_flag
);
96 unsigned char mgmt_invalidate_icds(struct beiscsi_hba
*phba
,
97 struct invalidate_command_table
*inv_tbl
,
98 unsigned int num_invalidate
, unsigned int cid
);
100 struct iscsi_invalidate_connection_params_in
{
101 struct be_cmd_req_hdr hdr
;
102 unsigned int session_handle
;
104 unsigned short unused
;
105 unsigned short cleanup_type
;
106 unsigned short save_cfg
;
109 struct iscsi_invalidate_connection_params_out
{
110 unsigned int session_handle
;
112 unsigned short unused
;
115 union iscsi_invalidate_connection_params
{
116 struct iscsi_invalidate_connection_params_in request
;
117 struct iscsi_invalidate_connection_params_out response
;
120 struct invalidate_commands_params_in
{
121 struct be_cmd_req_hdr hdr
;
122 unsigned int ref_handle
;
123 unsigned int icd_count
;
124 struct invalidate_command_table table
[128];
125 unsigned short cleanup_type
;
126 unsigned short unused
;
129 struct invalidate_commands_params_out
{
130 unsigned int ref_handle
;
131 unsigned int icd_count
;
132 unsigned int icd_status
[128];
135 union invalidate_commands_params
{
136 struct invalidate_commands_params_in request
;
137 struct invalidate_commands_params_out response
;
140 struct mgmt_hba_attributes
{
141 u8 flashrom_version_string
[32];
142 u8 manufacturer_name
[32];
144 u8 seeprom_version_lo
;
145 u8 seeprom_version_hi
;
147 u32 fw_cmd_data_struct_version
;
148 u32 ep_fw_data_struct_version
;
149 u32 future_reserved
[12];
150 u32 default_extended_timeout
;
151 u8 controller_model_number
[32];
152 u8 controller_description
[64];
153 u8 controller_serial_number
[32];
154 u8 ip_version_string
[32];
155 u8 firmware_version_string
[32];
156 u8 bios_version_string
[32];
157 u8 redboot_version_string
[32];
158 u8 driver_version_string
[32];
159 u8 fw_on_flash_version_string
[32];
160 u32 functionalities_supported
;
163 u8 generational_guid
[16];
165 u16 default_link_down_timeout
;
166 u8 iscsi_ver_min_max
;
167 u8 multifunction_device
;
170 u8 max_domains_supported
;
172 u32 firmware_post_status
;
179 struct mgmt_controller_attributes
{
180 struct mgmt_hba_attributes hba_attribs
;
183 u16 pci_sub_vendor_id
;
184 u16 pci_sub_system_id
;
186 u8 pci_device_number
;
187 u8 pci_function_number
;
189 u64 unique_identifier
;
195 struct be_mgmt_controller_attributes
{
196 struct be_cmd_req_hdr hdr
;
197 struct mgmt_controller_attributes params
;
200 struct be_mgmt_controller_attributes_resp
{
201 struct be_cmd_resp_hdr hdr
;
202 struct mgmt_controller_attributes params
;
205 /* configuration management */
207 #define GET_MGMT_CONTROLLER_WS(phba) (phba->pmgmt_ws)
211 #define MGMT_CMDH_FREE (1<<0)
213 /* --- MGMT_ERROR_CODES --- */
214 /* Error Codes returned in the status field of the CMD response header */
215 #define MGMT_STATUS_SUCCESS 0 /* The CMD completed without errors */
216 #define MGMT_STATUS_FAILED 1 /* Error status in the Status field of */
217 /* the CMD_RESPONSE_HEADER */
219 #define ISCSI_GET_PDU_TEMPLATE_ADDRESS(pc, pa) {\
220 pa->lo = phba->init_mem[ISCSI_MEM_GLOBAL_HEADER].mem_array[0].\
221 bus_address.u.a32.address_lo; \
222 pa->hi = phba->init_mem[ISCSI_MEM_GLOBAL_HEADER].mem_array[0].\
223 bus_address.u.a32.address_hi; \
226 struct beiscsi_endpoint
{
227 struct beiscsi_hba
*phba
;
228 struct beiscsi_sess
*sess
;
229 struct beiscsi_conn
*conn
;
230 struct iscsi_endpoint
*openiscsi_ep
;
231 unsigned short ip_type
;
232 char dst6_addr
[ISCSI_ADDRESS_BUF_LEN
];
233 unsigned long dst_addr
;
234 unsigned short ep_cid
;
235 unsigned int fw_handle
;
240 unsigned char mgmt_get_fw_config(struct be_ctrl_info
*ctrl
,
241 struct beiscsi_hba
*phba
);
243 unsigned char mgmt_invalidate_connection(struct beiscsi_hba
*phba
,
244 struct beiscsi_endpoint
*beiscsi_ep
,
246 unsigned short issue_reset
,
247 unsigned short savecfg_flag
);