Linux Audio

Check our new training course

Loading...
v5.9
  1/* SPDX-License-Identifier: GPL-2.0-only */
  2/*
  3 * Copyright 2017 Broadcom. All Rights Reserved.
  4 * The term "Broadcom" refers to Broadcom Limited and/or its subsidiaries.
 
 
 
 
 
 
  5 *
  6 * Contact Information:
  7 * linux-drivers@broadcom.com
 
 
 
 
  8 */
  9
 10#ifndef _BEISCSI_MGMT_
 11#define _BEISCSI_MGMT_
 12
 13#include <scsi/scsi_bsg_iscsi.h>
 14#include "be_iscsi.h"
 15#include "be_main.h"
 16
 17#define IP_ACTION_ADD	0x01
 18#define IP_ACTION_DEL	0x02
 19
 20#define IP_V6_LEN	16
 21#define IP_V4_LEN	4
 22
 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
 28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 29int 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);
 33
 
 
 
 
 
 
 
 34unsigned int mgmt_vendor_specific_fw_cmd(struct be_ctrl_info *ctrl,
 35					 struct beiscsi_hba *phba,
 36					 struct bsg_job *job,
 37					 struct be_dma_mem *nonemb_cmd);
 38
 39#define BE_INVLDT_CMD_TBL_SZ	128
 40struct invldt_cmd_tbl {
 41	unsigned short icd;
 
 42	unsigned short cid;
 
 
 
 43} __packed;
 44
 45struct 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;
 52} __packed;
 53
 54struct 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];
 59} __packed;
 60
 61union be_invldt_cmds_params {
 62	struct invldt_cmds_params_in request;
 63	struct invldt_cmds_params_out response;
 64} __packed;
 65
 66struct mgmt_hba_attributes {
 67	u8 flashrom_version_string[BEISCSI_VER_STRLEN];
 68	u8 manufacturer_name[BEISCSI_VER_STRLEN];
 69	u32 supported_modes;
 70	u8 seeprom_version_lo;
 71	u8 seeprom_version_hi;
 72	u8 rsvd0[2];
 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;
 87	u16 max_cdblength;
 88	u8 asic_revision;
 89	u8 generational_guid[16];
 90	u8 hba_port_count;
 91	u16 default_link_down_timeout;
 92	u8 iscsi_ver_min_max;
 93	u8 multifunction_device;
 94	u8 cache_valid;
 95	u8 hba_status;
 96	u8 max_domains_supported;
 97	u8 phy_port;
 98	u32 firmware_post_status;
 99	u32 hba_mtu[8];
100	u8 iscsi_features;
101	u8 asic_generation;
102	u8 future_u8[2];
103	u32 future_u32[3];
104} __packed;
105
106struct mgmt_controller_attributes {
107	struct mgmt_hba_attributes hba_attribs;
108	u16 pci_vendor_id;
109	u16 pci_device_id;
110	u16 pci_sub_vendor_id;
111	u16 pci_sub_system_id;
112	u8 pci_bus_number;
113	u8 pci_device_number;
114	u8 pci_function_number;
115	u8 interface_type;
116	u64 unique_identifier;
117	u8 netfilters;
118	u8 rsvd0[3];
119	u32 future_u32[4];
120} __packed;
121
122struct be_mgmt_controller_attributes {
123	struct be_cmd_req_hdr hdr;
124	struct mgmt_controller_attributes params;
125} __packed;
126
127struct be_mgmt_controller_attributes_resp {
128	struct be_cmd_resp_hdr hdr;
129	struct mgmt_controller_attributes params;
130} __packed;
131
132struct be_bsg_vendor_cmd {
133	struct be_cmd_req_hdr hdr;
134	unsigned short region;
135	unsigned short offset;
136	unsigned short sector;
137} __packed;
138
139/* configuration management */
140
141#define GET_MGMT_CONTROLLER_WS(phba)    (phba->pmgmt_ws)
142
 
 
 
 
 
 
 
 
 
 
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;  \
148}
149
150#define BEISCSI_WRITE_FLASH 0
151#define BEISCSI_READ_FLASH 1
152
153struct 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;
162	u16 dst_tcpport;
163	u16 cid_vld;
164};
165
166int beiscsi_mgmt_invalidate_icds(struct beiscsi_hba *phba,
167				 struct invldt_cmd_tbl *inv_tbl,
168				 unsigned int nents);
169
170int beiscsi_get_initiator_name(struct beiscsi_hba *phba, char *name, bool cfg);
171
172int beiscsi_if_en_dhcp(struct beiscsi_hba *phba, u32 ip_type);
173
174int beiscsi_if_en_static(struct beiscsi_hba *phba, u32 ip_type,
175			 u8 *ip, u8 *subnet);
176
177int beiscsi_if_set_gw(struct beiscsi_hba *phba, u32 ip_type, u8 *gw);
178
179int beiscsi_if_get_gw(struct beiscsi_hba *phba, u32 ip_type,
180		      struct be_cmd_get_def_gateway_resp *resp);
181
182int mgmt_get_nic_conf(struct beiscsi_hba *phba,
183		      struct be_cmd_get_nic_conf_resp *mac);
184
185int beiscsi_if_get_info(struct beiscsi_hba *phba, int ip_type,
186			struct be_cmd_get_if_info_resp **if_info);
187
188unsigned int beiscsi_if_get_handle(struct beiscsi_hba *phba);
189
190int beiscsi_if_set_vlan(struct beiscsi_hba *phba, uint16_t vlan_tag);
191
192unsigned int beiscsi_boot_logout_sess(struct beiscsi_hba *phba);
193
194unsigned int beiscsi_boot_reopen_sess(struct beiscsi_hba *phba);
195
196unsigned int beiscsi_boot_get_sinfo(struct beiscsi_hba *phba);
197
198unsigned int __beiscsi_boot_get_shandle(struct beiscsi_hba *phba, int async);
199
200int beiscsi_boot_get_shandle(struct beiscsi_hba *phba, unsigned int *s_handle);
201
202ssize_t beiscsi_drvr_ver_disp(struct device *dev,
203			       struct device_attribute *attr, char *buf);
204
205ssize_t beiscsi_fw_ver_disp(struct device *dev,
206			     struct device_attribute *attr, char *buf);
207
208ssize_t beiscsi_active_session_disp(struct device *dev,
209				     struct device_attribute *attr, char *buf);
210
211ssize_t beiscsi_adap_family_disp(struct device *dev,
212				  struct device_attribute *attr, char *buf);
213
214
215ssize_t beiscsi_free_session_disp(struct device *dev,
216				   struct device_attribute *attr, char *buf);
217
218ssize_t beiscsi_phys_port_disp(struct device *dev,
219				struct device_attribute *attr, char *buf);
220
221void 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);
225
226void beiscsi_offload_cxn_v2(struct beiscsi_offload_params *params,
227			     struct wrb_handle *pwrb_handle,
228			     struct hwi_wrb_context *pwrb_context);
229
230unsigned int beiscsi_invalidate_cxn(struct beiscsi_hba *phba,
231				    struct beiscsi_endpoint *beiscsi_ep);
232
233unsigned int beiscsi_upload_cxn(struct beiscsi_hba *phba,
234				struct beiscsi_endpoint *beiscsi_ep);
235
236int be_cmd_modify_eq_delay(struct beiscsi_hba *phba,
237			 struct be_set_eqd *, int num);
238
239int beiscsi_logout_fw_sess(struct beiscsi_hba *phba,
240			    uint32_t fw_sess_handle);
241
242#endif
v4.10.11
  1/**
  2 * Copyright (C) 2005 - 2016 Broadcom
  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 *
 10 * Written by: Jayamohan Kallickal (jayamohan.kallickal@broadcom.com)
 11 *
 12 * Contact Information:
 13 * linux-drivers@broadcom.com
 14 *
 15 * Emulex
 16 * 3333 Susan Street
 17 * Costa Mesa, CA 92626
 18 */
 19
 20#ifndef _BEISCSI_MGMT_
 21#define _BEISCSI_MGMT_
 22
 23#include <scsi/scsi_bsg_iscsi.h>
 24#include "be_iscsi.h"
 25#include "be_main.h"
 26
 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
 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
 38
 39/**
 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
 42 */
 43struct amap_mcc_sge {
 44	u8 pa_lo[32];		/* dword 0 */
 45	u8 pa_hi[32];		/* dword 1 */
 46	u8 length[32];		/* DWORD 2 */
 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_payload {
 54	union {
 55		struct amap_mcc_sge sgl[19];
 56		u8 embedded[59 * 32];	/* DWORDS 57 to 115 */
 57	} u;
 58} __packed;
 59
 60/**
 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
 63 */
 64struct amap_mcc_wrb {
 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;
 74};
 75
 76struct mcc_sge {
 77	u32 pa_lo;		/* dword 0 */
 78	u32 pa_hi;		/* dword 1 */
 79	u32 length;		/* DWORD 2 */
 80} __packed;
 81
 82struct mcc_wrb_payload {
 83	union {
 84		struct mcc_sge sgl[19];
 85		u32 embedded[59];	/* DWORDS 57 to 115 */
 86	} u;
 87} __packed;
 88
 89#define MCC_WRB_EMBEDDED_MASK                0x00000001
 90
 91struct mcc_wrb {
 92	u32 dw[0];		/* DWORD 0 */
 93	u32 payload_length;
 94	u32 tag[2];		/* DWORD 2 */
 95	u32 rsvd2[1];		/* DWORD 4 */
 96	struct mcc_wrb_payload payload;
 97};
 98
 99int mgmt_open_connection(struct beiscsi_hba *phba,
100			 struct sockaddr *dst_addr,
101			 struct beiscsi_endpoint *beiscsi_ep,
102			 struct be_dma_mem *nonemb_cmd);
103
104unsigned int mgmt_upload_connection(struct beiscsi_hba *phba,
105				     unsigned short cid,
106				     unsigned int upload_flag);
107unsigned int mgmt_invalidate_icds(struct beiscsi_hba *phba,
108				struct invalidate_command_table *inv_tbl,
109				unsigned int num_invalidate, unsigned int cid,
110				struct be_dma_mem *nonemb_cmd);
111unsigned int mgmt_vendor_specific_fw_cmd(struct be_ctrl_info *ctrl,
112					 struct beiscsi_hba *phba,
113					 struct bsg_job *job,
114					 struct be_dma_mem *nonemb_cmd);
115
116#define BEISCSI_NO_RST_ISSUE	0
117struct iscsi_invalidate_connection_params_in {
118	struct be_cmd_req_hdr hdr;
119	unsigned int session_handle;
120	unsigned short cid;
121	unsigned short unused;
122	unsigned short cleanup_type;
123	unsigned short save_cfg;
124} __packed;
125
126struct iscsi_invalidate_connection_params_out {
127	unsigned int session_handle;
128	unsigned short cid;
129	unsigned short unused;
130} __packed;
131
132union iscsi_invalidate_connection_params {
133	struct iscsi_invalidate_connection_params_in request;
134	struct iscsi_invalidate_connection_params_out response;
135} __packed;
136
137struct invalidate_commands_params_in {
138	struct be_cmd_req_hdr hdr;
139	unsigned int ref_handle;
140	unsigned int icd_count;
141	struct invalidate_command_table table[128];
142	unsigned short cleanup_type;
143	unsigned short unused;
144} __packed;
145
146struct invalidate_commands_params_out {
 
147	unsigned int ref_handle;
148	unsigned int icd_count;
149	unsigned int icd_status[128];
150} __packed;
151
152union invalidate_commands_params {
153	struct invalidate_commands_params_in request;
154	struct invalidate_commands_params_out response;
155} __packed;
156
157struct mgmt_hba_attributes {
158	u8 flashrom_version_string[BEISCSI_VER_STRLEN];
159	u8 manufacturer_name[BEISCSI_VER_STRLEN];
160	u32 supported_modes;
161	u8 seeprom_version_lo;
162	u8 seeprom_version_hi;
163	u8 rsvd0[2];
164	u32 fw_cmd_data_struct_version;
165	u32 ep_fw_data_struct_version;
166	u8 ncsi_version_string[12];
167	u32 default_extended_timeout;
168	u8 controller_model_number[BEISCSI_VER_STRLEN];
169	u8 controller_description[64];
170	u8 controller_serial_number[BEISCSI_VER_STRLEN];
171	u8 ip_version_string[BEISCSI_VER_STRLEN];
172	u8 firmware_version_string[BEISCSI_VER_STRLEN];
173	u8 bios_version_string[BEISCSI_VER_STRLEN];
174	u8 redboot_version_string[BEISCSI_VER_STRLEN];
175	u8 driver_version_string[BEISCSI_VER_STRLEN];
176	u8 fw_on_flash_version_string[BEISCSI_VER_STRLEN];
177	u32 functionalities_supported;
178	u16 max_cdblength;
179	u8 asic_revision;
180	u8 generational_guid[16];
181	u8 hba_port_count;
182	u16 default_link_down_timeout;
183	u8 iscsi_ver_min_max;
184	u8 multifunction_device;
185	u8 cache_valid;
186	u8 hba_status;
187	u8 max_domains_supported;
188	u8 phy_port;
189	u32 firmware_post_status;
190	u32 hba_mtu[8];
191	u8 iscsi_features;
192	u8 asic_generation;
193	u8 future_u8[2];
194	u32 future_u32[3];
195} __packed;
196
197struct mgmt_controller_attributes {
198	struct mgmt_hba_attributes hba_attribs;
199	u16 pci_vendor_id;
200	u16 pci_device_id;
201	u16 pci_sub_vendor_id;
202	u16 pci_sub_system_id;
203	u8 pci_bus_number;
204	u8 pci_device_number;
205	u8 pci_function_number;
206	u8 interface_type;
207	u64 unique_identifier;
208	u8 netfilters;
209	u8 rsvd0[3];
210	u32 future_u32[4];
211} __packed;
212
213struct be_mgmt_controller_attributes {
214	struct be_cmd_req_hdr hdr;
215	struct mgmt_controller_attributes params;
216} __packed;
217
218struct be_mgmt_controller_attributes_resp {
219	struct be_cmd_resp_hdr hdr;
220	struct mgmt_controller_attributes params;
221} __packed;
222
223struct be_bsg_vendor_cmd {
224	struct be_cmd_req_hdr hdr;
225	unsigned short region;
226	unsigned short offset;
227	unsigned short sector;
228} __packed;
229
230/* configuration management */
231
232#define GET_MGMT_CONTROLLER_WS(phba)    (phba->pmgmt_ws)
233
234/* MGMT CMD flags */
235
236#define MGMT_CMDH_FREE                (1<<0)
237
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  */
243
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;  \
249}
250
251#define BEISCSI_WRITE_FLASH 0
252#define BEISCSI_READ_FLASH 1
253
254struct 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;
264	u16 dst_tcpport;
265	u16 cid_vld;
266};
267
268unsigned int mgmt_invalidate_connection(struct beiscsi_hba *phba,
269					 struct beiscsi_endpoint *beiscsi_ep,
270					 unsigned short cid,
271					 unsigned short issue_reset,
272					 unsigned short savecfg_flag);
273
274int beiscsi_if_en_dhcp(struct beiscsi_hba *phba, u32 ip_type);
275
276int beiscsi_if_en_static(struct beiscsi_hba *phba, u32 ip_type,
277			 u8 *ip, u8 *subnet);
278
279int beiscsi_if_set_gw(struct beiscsi_hba *phba, u32 ip_type, u8 *gw);
280
281int beiscsi_if_get_gw(struct beiscsi_hba *phba, u32 ip_type,
282		      struct be_cmd_get_def_gateway_resp *resp);
283
284int mgmt_get_nic_conf(struct beiscsi_hba *phba,
285		      struct be_cmd_get_nic_conf_resp *mac);
286
287int beiscsi_if_get_info(struct beiscsi_hba *phba, int ip_type,
288			struct be_cmd_get_if_info_resp **if_info);
289
290unsigned int beiscsi_if_get_handle(struct beiscsi_hba *phba);
291
292int beiscsi_if_set_vlan(struct beiscsi_hba *phba, uint16_t vlan_tag);
293
294unsigned int beiscsi_boot_logout_sess(struct beiscsi_hba *phba);
295
296unsigned int beiscsi_boot_reopen_sess(struct beiscsi_hba *phba);
297
298unsigned int beiscsi_boot_get_sinfo(struct beiscsi_hba *phba);
299
300unsigned int __beiscsi_boot_get_shandle(struct beiscsi_hba *phba, int async);
301
302int beiscsi_boot_get_shandle(struct beiscsi_hba *phba, unsigned int *s_handle);
303
304ssize_t beiscsi_drvr_ver_disp(struct device *dev,
305			       struct device_attribute *attr, char *buf);
306
307ssize_t beiscsi_fw_ver_disp(struct device *dev,
308			     struct device_attribute *attr, char *buf);
309
310ssize_t beiscsi_active_session_disp(struct device *dev,
311				     struct device_attribute *attr, char *buf);
312
313ssize_t beiscsi_adap_family_disp(struct device *dev,
314				  struct device_attribute *attr, char *buf);
315
316
317ssize_t beiscsi_free_session_disp(struct device *dev,
318				   struct device_attribute *attr, char *buf);
319
320ssize_t beiscsi_phys_port_disp(struct device *dev,
321				struct device_attribute *attr, char *buf);
322
323void beiscsi_offload_cxn_v0(struct beiscsi_offload_params *params,
324			     struct wrb_handle *pwrb_handle,
325			     struct be_mem_descriptor *mem_descr,
326			     struct hwi_wrb_context *pwrb_context);
327
328void beiscsi_offload_cxn_v2(struct beiscsi_offload_params *params,
329			     struct wrb_handle *pwrb_handle,
330			     struct hwi_wrb_context *pwrb_context);
 
 
 
 
 
 
331
332int be_cmd_modify_eq_delay(struct beiscsi_hba *phba,
333			 struct be_set_eqd *, int num);
334
335int beiscsi_logout_fw_sess(struct beiscsi_hba *phba,
336			    uint32_t fw_sess_handle);
337
338#endif