1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright 2017 Broadcom. All Rights Reserved.
4 * The term "Broadcom" refers to Broadcom Limited and/or its subsidiaries.
7 * linux-drivers@broadcom.com
10 #ifndef _BEISCSI_MGMT_
11 #define _BEISCSI_MGMT_
13 #include <scsi/scsi_bsg_iscsi.h>
17 #define IP_ACTION_ADD 0x01
18 #define IP_ACTION_DEL 0x02
23 /* UE Status and Mask register */
24 #define PCICFG_UE_STATUS_LOW 0xA0
25 #define PCICFG_UE_STATUS_HIGH 0xA4
26 #define PCICFG_UE_STATUS_MASK_LOW 0xA8
27 #define PCICFG_UE_STATUS_MASK_HI 0xAC
29 int mgmt_open_connection(struct beiscsi_hba
*phba
,
30 struct sockaddr
*dst_addr
,
31 struct beiscsi_endpoint
*beiscsi_ep
,
32 struct be_dma_mem
*nonemb_cmd
);
34 unsigned int mgmt_vendor_specific_fw_cmd(struct be_ctrl_info
*ctrl
,
35 struct beiscsi_hba
*phba
,
37 struct be_dma_mem
*nonemb_cmd
);
39 #define BE_INVLDT_CMD_TBL_SZ 128
40 struct invldt_cmd_tbl
{
45 struct invldt_cmds_params_in
{
46 struct be_cmd_req_hdr hdr
;
47 unsigned int ref_handle
;
48 unsigned int icd_count
;
49 struct invldt_cmd_tbl table
[BE_INVLDT_CMD_TBL_SZ
];
50 unsigned short cleanup_type
;
51 unsigned short unused
;
54 struct invldt_cmds_params_out
{
55 struct be_cmd_resp_hdr hdr
;
56 unsigned int ref_handle
;
57 unsigned int icd_count
;
58 unsigned int icd_status
[BE_INVLDT_CMD_TBL_SZ
];
61 union be_invldt_cmds_params
{
62 struct invldt_cmds_params_in request
;
63 struct invldt_cmds_params_out response
;
66 struct mgmt_hba_attributes
{
67 u8 flashrom_version_string
[BEISCSI_VER_STRLEN
];
68 u8 manufacturer_name
[BEISCSI_VER_STRLEN
];
70 u8 seeprom_version_lo
;
71 u8 seeprom_version_hi
;
73 u32 fw_cmd_data_struct_version
;
74 u32 ep_fw_data_struct_version
;
75 u8 ncsi_version_string
[12];
76 u32 default_extended_timeout
;
77 u8 controller_model_number
[BEISCSI_VER_STRLEN
];
78 u8 controller_description
[64];
79 u8 controller_serial_number
[BEISCSI_VER_STRLEN
];
80 u8 ip_version_string
[BEISCSI_VER_STRLEN
];
81 u8 firmware_version_string
[BEISCSI_VER_STRLEN
];
82 u8 bios_version_string
[BEISCSI_VER_STRLEN
];
83 u8 redboot_version_string
[BEISCSI_VER_STRLEN
];
84 u8 driver_version_string
[BEISCSI_VER_STRLEN
];
85 u8 fw_on_flash_version_string
[BEISCSI_VER_STRLEN
];
86 u32 functionalities_supported
;
89 u8 generational_guid
[16];
91 u16 default_link_down_timeout
;
93 u8 multifunction_device
;
96 u8 max_domains_supported
;
98 u32 firmware_post_status
;
106 struct mgmt_controller_attributes
{
107 struct mgmt_hba_attributes hba_attribs
;
110 u16 pci_sub_vendor_id
;
111 u16 pci_sub_system_id
;
113 u8 pci_device_number
;
114 u8 pci_function_number
;
116 u64 unique_identifier
;
122 struct be_mgmt_controller_attributes
{
123 struct be_cmd_req_hdr hdr
;
124 struct mgmt_controller_attributes params
;
127 struct be_mgmt_controller_attributes_resp
{
128 struct be_cmd_resp_hdr hdr
;
129 struct mgmt_controller_attributes params
;
132 struct be_bsg_vendor_cmd
{
133 struct be_cmd_req_hdr hdr
;
134 unsigned short region
;
135 unsigned short offset
;
136 unsigned short sector
;
139 /* configuration management */
141 #define GET_MGMT_CONTROLLER_WS(phba) (phba->pmgmt_ws)
143 #define ISCSI_GET_PDU_TEMPLATE_ADDRESS(pc, pa) {\
144 pa->lo = phba->init_mem[ISCSI_MEM_GLOBAL_HEADER].mem_array[0].\
145 bus_address.u.a32.address_lo; \
146 pa->hi = phba->init_mem[ISCSI_MEM_GLOBAL_HEADER].mem_array[0].\
147 bus_address.u.a32.address_hi; \
150 #define BEISCSI_WRITE_FLASH 0
151 #define BEISCSI_READ_FLASH 1
153 struct beiscsi_endpoint
{
154 struct beiscsi_hba
*phba
;
155 struct beiscsi_conn
*conn
;
156 struct iscsi_endpoint
*openiscsi_ep
;
157 unsigned short ip_type
;
158 char dst6_addr
[ISCSI_ADDRESS_BUF_LEN
];
159 unsigned long dst_addr
;
160 unsigned short ep_cid
;
161 unsigned int fw_handle
;
166 int beiscsi_mgmt_invalidate_icds(struct beiscsi_hba
*phba
,
167 struct invldt_cmd_tbl
*inv_tbl
,
170 int beiscsi_get_initiator_name(struct beiscsi_hba
*phba
, char *name
, bool cfg
);
172 int beiscsi_if_en_dhcp(struct beiscsi_hba
*phba
, u32 ip_type
);
174 int beiscsi_if_en_static(struct beiscsi_hba
*phba
, u32 ip_type
,
177 int beiscsi_if_set_gw(struct beiscsi_hba
*phba
, u32 ip_type
, u8
*gw
);
179 int beiscsi_if_get_gw(struct beiscsi_hba
*phba
, u32 ip_type
,
180 struct be_cmd_get_def_gateway_resp
*resp
);
182 int mgmt_get_nic_conf(struct beiscsi_hba
*phba
,
183 struct be_cmd_get_nic_conf_resp
*mac
);
185 int beiscsi_if_get_info(struct beiscsi_hba
*phba
, int ip_type
,
186 struct be_cmd_get_if_info_resp
**if_info
);
188 unsigned int beiscsi_if_get_handle(struct beiscsi_hba
*phba
);
190 int beiscsi_if_set_vlan(struct beiscsi_hba
*phba
, uint16_t vlan_tag
);
192 unsigned int beiscsi_boot_logout_sess(struct beiscsi_hba
*phba
);
194 unsigned int beiscsi_boot_reopen_sess(struct beiscsi_hba
*phba
);
196 unsigned int beiscsi_boot_get_sinfo(struct beiscsi_hba
*phba
);
198 unsigned int __beiscsi_boot_get_shandle(struct beiscsi_hba
*phba
, int async
);
200 int beiscsi_boot_get_shandle(struct beiscsi_hba
*phba
, unsigned int *s_handle
);
202 ssize_t
beiscsi_drvr_ver_disp(struct device
*dev
,
203 struct device_attribute
*attr
, char *buf
);
205 ssize_t
beiscsi_fw_ver_disp(struct device
*dev
,
206 struct device_attribute
*attr
, char *buf
);
208 ssize_t
beiscsi_active_session_disp(struct device
*dev
,
209 struct device_attribute
*attr
, char *buf
);
211 ssize_t
beiscsi_adap_family_disp(struct device
*dev
,
212 struct device_attribute
*attr
, char *buf
);
215 ssize_t
beiscsi_free_session_disp(struct device
*dev
,
216 struct device_attribute
*attr
, char *buf
);
218 ssize_t
beiscsi_phys_port_disp(struct device
*dev
,
219 struct device_attribute
*attr
, char *buf
);
221 void beiscsi_offload_cxn_v0(struct beiscsi_offload_params
*params
,
222 struct wrb_handle
*pwrb_handle
,
223 struct be_mem_descriptor
*mem_descr
,
224 struct hwi_wrb_context
*pwrb_context
);
226 void beiscsi_offload_cxn_v2(struct beiscsi_offload_params
*params
,
227 struct wrb_handle
*pwrb_handle
,
228 struct hwi_wrb_context
*pwrb_context
);
230 unsigned int beiscsi_invalidate_cxn(struct beiscsi_hba
*phba
,
231 struct beiscsi_endpoint
*beiscsi_ep
);
233 unsigned int beiscsi_upload_cxn(struct beiscsi_hba
*phba
,
234 struct beiscsi_endpoint
*beiscsi_ep
);
236 int be_cmd_modify_eq_delay(struct beiscsi_hba
*phba
,
237 struct be_set_eqd
*, int num
);
239 int beiscsi_logout_fw_sess(struct beiscsi_hba
*phba
,
240 uint32_t fw_sess_handle
);