Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright 2017 Broadcom. All Rights Reserved.
0004  * The term "Broadcom" refers to Broadcom Limited and/or its subsidiaries.
0005  *
0006  * Contact Information:
0007  * linux-drivers@broadcom.com
0008  */
0009 
0010 #ifndef _BEISCSI_MGMT_
0011 #define _BEISCSI_MGMT_
0012 
0013 #include <scsi/scsi_bsg_iscsi.h>
0014 #include "be_iscsi.h"
0015 #include "be_main.h"
0016 
0017 #define IP_ACTION_ADD   0x01
0018 #define IP_ACTION_DEL   0x02
0019 
0020 #define IP_V6_LEN   16
0021 #define IP_V4_LEN   4
0022 
0023 /* UE Status and Mask register */
0024 #define PCICFG_UE_STATUS_LOW            0xA0
0025 #define PCICFG_UE_STATUS_HIGH           0xA4
0026 #define PCICFG_UE_STATUS_MASK_LOW       0xA8
0027 #define PCICFG_UE_STATUS_MASK_HI        0xAC
0028 
0029 int mgmt_open_connection(struct beiscsi_hba *phba,
0030              struct sockaddr *dst_addr,
0031              struct beiscsi_endpoint *beiscsi_ep,
0032              struct be_dma_mem *nonemb_cmd);
0033 
0034 unsigned int mgmt_vendor_specific_fw_cmd(struct be_ctrl_info *ctrl,
0035                      struct beiscsi_hba *phba,
0036                      struct bsg_job *job,
0037                      struct be_dma_mem *nonemb_cmd);
0038 
0039 #define BE_INVLDT_CMD_TBL_SZ    128
0040 struct invldt_cmd_tbl {
0041     unsigned short icd;
0042     unsigned short cid;
0043 } __packed;
0044 
0045 struct invldt_cmds_params_in {
0046     struct be_cmd_req_hdr hdr;
0047     unsigned int ref_handle;
0048     unsigned int icd_count;
0049     struct invldt_cmd_tbl table[BE_INVLDT_CMD_TBL_SZ];
0050     unsigned short cleanup_type;
0051     unsigned short unused;
0052 } __packed;
0053 
0054 struct invldt_cmds_params_out {
0055     struct be_cmd_resp_hdr hdr;
0056     unsigned int ref_handle;
0057     unsigned int icd_count;
0058     unsigned int icd_status[BE_INVLDT_CMD_TBL_SZ];
0059 } __packed;
0060 
0061 union be_invldt_cmds_params {
0062     struct invldt_cmds_params_in request;
0063     struct invldt_cmds_params_out response;
0064 } __packed;
0065 
0066 struct mgmt_hba_attributes {
0067     u8 flashrom_version_string[BEISCSI_VER_STRLEN];
0068     u8 manufacturer_name[BEISCSI_VER_STRLEN];
0069     u32 supported_modes;
0070     u8 seeprom_version_lo;
0071     u8 seeprom_version_hi;
0072     u8 rsvd0[2];
0073     u32 fw_cmd_data_struct_version;
0074     u32 ep_fw_data_struct_version;
0075     u8 ncsi_version_string[12];
0076     u32 default_extended_timeout;
0077     u8 controller_model_number[BEISCSI_VER_STRLEN];
0078     u8 controller_description[64];
0079     u8 controller_serial_number[BEISCSI_VER_STRLEN];
0080     u8 ip_version_string[BEISCSI_VER_STRLEN];
0081     u8 firmware_version_string[BEISCSI_VER_STRLEN];
0082     u8 bios_version_string[BEISCSI_VER_STRLEN];
0083     u8 redboot_version_string[BEISCSI_VER_STRLEN];
0084     u8 driver_version_string[BEISCSI_VER_STRLEN];
0085     u8 fw_on_flash_version_string[BEISCSI_VER_STRLEN];
0086     u32 functionalities_supported;
0087     u16 max_cdblength;
0088     u8 asic_revision;
0089     u8 generational_guid[16];
0090     u8 hba_port_count;
0091     u16 default_link_down_timeout;
0092     u8 iscsi_ver_min_max;
0093     u8 multifunction_device;
0094     u8 cache_valid;
0095     u8 hba_status;
0096     u8 max_domains_supported;
0097     u8 phy_port;
0098     u32 firmware_post_status;
0099     u32 hba_mtu[8];
0100     u8 iscsi_features;
0101     u8 asic_generation;
0102     u8 future_u8[2];
0103     u32 future_u32[3];
0104 } __packed;
0105 
0106 struct mgmt_controller_attributes {
0107     struct mgmt_hba_attributes hba_attribs;
0108     u16 pci_vendor_id;
0109     u16 pci_device_id;
0110     u16 pci_sub_vendor_id;
0111     u16 pci_sub_system_id;
0112     u8 pci_bus_number;
0113     u8 pci_device_number;
0114     u8 pci_function_number;
0115     u8 interface_type;
0116     u64 unique_identifier;
0117     u8 netfilters;
0118     u8 rsvd0[3];
0119     u32 future_u32[4];
0120 } __packed;
0121 
0122 struct be_mgmt_controller_attributes {
0123     struct be_cmd_req_hdr hdr;
0124     struct mgmt_controller_attributes params;
0125 } __packed;
0126 
0127 struct be_mgmt_controller_attributes_resp {
0128     struct be_cmd_resp_hdr hdr;
0129     struct mgmt_controller_attributes params;
0130 } __packed;
0131 
0132 struct be_bsg_vendor_cmd {
0133     struct be_cmd_req_hdr hdr;
0134     unsigned short region;
0135     unsigned short offset;
0136     unsigned short sector;
0137 } __packed;
0138 
0139 /* configuration management */
0140 
0141 #define GET_MGMT_CONTROLLER_WS(phba)    (phba->pmgmt_ws)
0142 
0143 #define ISCSI_GET_PDU_TEMPLATE_ADDRESS(pc, pa) {\
0144     pa->lo = phba->init_mem[ISCSI_MEM_GLOBAL_HEADER].mem_array[0].\
0145                     bus_address.u.a32.address_lo;  \
0146     pa->hi = phba->init_mem[ISCSI_MEM_GLOBAL_HEADER].mem_array[0].\
0147                     bus_address.u.a32.address_hi;  \
0148 }
0149 
0150 #define BEISCSI_WRITE_FLASH 0
0151 #define BEISCSI_READ_FLASH 1
0152 
0153 struct beiscsi_endpoint {
0154     struct beiscsi_hba *phba;
0155     struct beiscsi_conn *conn;
0156     struct iscsi_endpoint *openiscsi_ep;
0157     unsigned short ip_type;
0158     char dst6_addr[ISCSI_ADDRESS_BUF_LEN];
0159     unsigned long dst_addr;
0160     unsigned short ep_cid;
0161     unsigned int fw_handle;
0162     u16 dst_tcpport;
0163     u16 cid_vld;
0164 };
0165 
0166 int beiscsi_mgmt_invalidate_icds(struct beiscsi_hba *phba,
0167                  struct invldt_cmd_tbl *inv_tbl,
0168                  unsigned int nents);
0169 
0170 int beiscsi_get_initiator_name(struct beiscsi_hba *phba, char *name, bool cfg);
0171 
0172 int beiscsi_if_en_dhcp(struct beiscsi_hba *phba, u32 ip_type);
0173 
0174 int beiscsi_if_en_static(struct beiscsi_hba *phba, u32 ip_type,
0175              u8 *ip, u8 *subnet);
0176 
0177 int beiscsi_if_set_gw(struct beiscsi_hba *phba, u32 ip_type, u8 *gw);
0178 
0179 int beiscsi_if_get_gw(struct beiscsi_hba *phba, u32 ip_type,
0180               struct be_cmd_get_def_gateway_resp *resp);
0181 
0182 int mgmt_get_nic_conf(struct beiscsi_hba *phba,
0183               struct be_cmd_get_nic_conf_resp *mac);
0184 
0185 int beiscsi_if_get_info(struct beiscsi_hba *phba, int ip_type,
0186             struct be_cmd_get_if_info_resp **if_info);
0187 
0188 unsigned int beiscsi_if_get_handle(struct beiscsi_hba *phba);
0189 
0190 int beiscsi_if_set_vlan(struct beiscsi_hba *phba, uint16_t vlan_tag);
0191 
0192 unsigned int beiscsi_boot_logout_sess(struct beiscsi_hba *phba);
0193 
0194 unsigned int beiscsi_boot_reopen_sess(struct beiscsi_hba *phba);
0195 
0196 unsigned int beiscsi_boot_get_sinfo(struct beiscsi_hba *phba);
0197 
0198 unsigned int __beiscsi_boot_get_shandle(struct beiscsi_hba *phba, int async);
0199 
0200 int beiscsi_boot_get_shandle(struct beiscsi_hba *phba, unsigned int *s_handle);
0201 
0202 ssize_t beiscsi_drvr_ver_disp(struct device *dev,
0203                    struct device_attribute *attr, char *buf);
0204 
0205 ssize_t beiscsi_fw_ver_disp(struct device *dev,
0206                  struct device_attribute *attr, char *buf);
0207 
0208 ssize_t beiscsi_active_session_disp(struct device *dev,
0209                      struct device_attribute *attr, char *buf);
0210 
0211 ssize_t beiscsi_adap_family_disp(struct device *dev,
0212                   struct device_attribute *attr, char *buf);
0213 
0214 
0215 ssize_t beiscsi_free_session_disp(struct device *dev,
0216                    struct device_attribute *attr, char *buf);
0217 
0218 ssize_t beiscsi_phys_port_disp(struct device *dev,
0219                 struct device_attribute *attr, char *buf);
0220 
0221 void beiscsi_offload_cxn_v0(struct beiscsi_offload_params *params,
0222                  struct wrb_handle *pwrb_handle,
0223                  struct be_mem_descriptor *mem_descr,
0224                  struct hwi_wrb_context *pwrb_context);
0225 
0226 void beiscsi_offload_cxn_v2(struct beiscsi_offload_params *params,
0227                  struct wrb_handle *pwrb_handle,
0228                  struct hwi_wrb_context *pwrb_context);
0229 
0230 unsigned int beiscsi_invalidate_cxn(struct beiscsi_hba *phba,
0231                     struct beiscsi_endpoint *beiscsi_ep);
0232 
0233 unsigned int beiscsi_upload_cxn(struct beiscsi_hba *phba,
0234                 struct beiscsi_endpoint *beiscsi_ep);
0235 
0236 int be_cmd_modify_eq_delay(struct beiscsi_hba *phba,
0237              struct be_set_eqd *, int num);
0238 
0239 int beiscsi_logout_fw_sess(struct beiscsi_hba *phba,
0240                 uint32_t fw_sess_handle);
0241 
0242 #endif