be_mgmt.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  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. * [email protected]
  8. */
  9. #ifndef _BEISCSI_MGMT_
  10. #define _BEISCSI_MGMT_
  11. #include <scsi/scsi_bsg_iscsi.h>
  12. #include "be_iscsi.h"
  13. #include "be_main.h"
  14. #define IP_ACTION_ADD 0x01
  15. #define IP_ACTION_DEL 0x02
  16. #define IP_V6_LEN 16
  17. #define IP_V4_LEN 4
  18. /* UE Status and Mask register */
  19. #define PCICFG_UE_STATUS_LOW 0xA0
  20. #define PCICFG_UE_STATUS_HIGH 0xA4
  21. #define PCICFG_UE_STATUS_MASK_LOW 0xA8
  22. #define PCICFG_UE_STATUS_MASK_HI 0xAC
  23. int mgmt_open_connection(struct beiscsi_hba *phba,
  24. struct sockaddr *dst_addr,
  25. struct beiscsi_endpoint *beiscsi_ep,
  26. struct be_dma_mem *nonemb_cmd);
  27. unsigned int mgmt_vendor_specific_fw_cmd(struct be_ctrl_info *ctrl,
  28. struct beiscsi_hba *phba,
  29. struct bsg_job *job,
  30. struct be_dma_mem *nonemb_cmd);
  31. #define BE_INVLDT_CMD_TBL_SZ 128
  32. struct invldt_cmd_tbl {
  33. unsigned short icd;
  34. unsigned short cid;
  35. } __packed;
  36. struct invldt_cmds_params_in {
  37. struct be_cmd_req_hdr hdr;
  38. unsigned int ref_handle;
  39. unsigned int icd_count;
  40. struct invldt_cmd_tbl table[BE_INVLDT_CMD_TBL_SZ];
  41. unsigned short cleanup_type;
  42. unsigned short unused;
  43. } __packed;
  44. struct invldt_cmds_params_out {
  45. struct be_cmd_resp_hdr hdr;
  46. unsigned int ref_handle;
  47. unsigned int icd_count;
  48. unsigned int icd_status[BE_INVLDT_CMD_TBL_SZ];
  49. } __packed;
  50. union be_invldt_cmds_params {
  51. struct invldt_cmds_params_in request;
  52. struct invldt_cmds_params_out response;
  53. } __packed;
  54. struct mgmt_hba_attributes {
  55. u8 flashrom_version_string[BEISCSI_VER_STRLEN];
  56. u8 manufacturer_name[BEISCSI_VER_STRLEN];
  57. u32 supported_modes;
  58. u8 seeprom_version_lo;
  59. u8 seeprom_version_hi;
  60. u8 rsvd0[2];
  61. u32 fw_cmd_data_struct_version;
  62. u32 ep_fw_data_struct_version;
  63. u8 ncsi_version_string[12];
  64. u32 default_extended_timeout;
  65. u8 controller_model_number[BEISCSI_VER_STRLEN];
  66. u8 controller_description[64];
  67. u8 controller_serial_number[BEISCSI_VER_STRLEN];
  68. u8 ip_version_string[BEISCSI_VER_STRLEN];
  69. u8 firmware_version_string[BEISCSI_VER_STRLEN];
  70. u8 bios_version_string[BEISCSI_VER_STRLEN];
  71. u8 redboot_version_string[BEISCSI_VER_STRLEN];
  72. u8 driver_version_string[BEISCSI_VER_STRLEN];
  73. u8 fw_on_flash_version_string[BEISCSI_VER_STRLEN];
  74. u32 functionalities_supported;
  75. u16 max_cdblength;
  76. u8 asic_revision;
  77. u8 generational_guid[16];
  78. u8 hba_port_count;
  79. u16 default_link_down_timeout;
  80. u8 iscsi_ver_min_max;
  81. u8 multifunction_device;
  82. u8 cache_valid;
  83. u8 hba_status;
  84. u8 max_domains_supported;
  85. u8 phy_port;
  86. u32 firmware_post_status;
  87. u32 hba_mtu[8];
  88. u8 iscsi_features;
  89. u8 asic_generation;
  90. u8 future_u8[2];
  91. u32 future_u32[3];
  92. } __packed;
  93. struct mgmt_controller_attributes {
  94. struct mgmt_hba_attributes hba_attribs;
  95. u16 pci_vendor_id;
  96. u16 pci_device_id;
  97. u16 pci_sub_vendor_id;
  98. u16 pci_sub_system_id;
  99. u8 pci_bus_number;
  100. u8 pci_device_number;
  101. u8 pci_function_number;
  102. u8 interface_type;
  103. u64 unique_identifier;
  104. u8 netfilters;
  105. u8 rsvd0[3];
  106. u32 future_u32[4];
  107. } __packed;
  108. struct be_mgmt_controller_attributes {
  109. struct be_cmd_req_hdr hdr;
  110. struct mgmt_controller_attributes params;
  111. } __packed;
  112. struct be_mgmt_controller_attributes_resp {
  113. struct be_cmd_resp_hdr hdr;
  114. struct mgmt_controller_attributes params;
  115. } __packed;
  116. struct be_bsg_vendor_cmd {
  117. struct be_cmd_req_hdr hdr;
  118. unsigned short region;
  119. unsigned short offset;
  120. unsigned short sector;
  121. } __packed;
  122. /* configuration management */
  123. #define GET_MGMT_CONTROLLER_WS(phba) (phba->pmgmt_ws)
  124. #define ISCSI_GET_PDU_TEMPLATE_ADDRESS(pc, pa) {\
  125. pa->lo = phba->init_mem[ISCSI_MEM_GLOBAL_HEADER].mem_array[0].\
  126. bus_address.u.a32.address_lo; \
  127. pa->hi = phba->init_mem[ISCSI_MEM_GLOBAL_HEADER].mem_array[0].\
  128. bus_address.u.a32.address_hi; \
  129. }
  130. #define BEISCSI_WRITE_FLASH 0
  131. #define BEISCSI_READ_FLASH 1
  132. struct beiscsi_endpoint {
  133. struct beiscsi_hba *phba;
  134. struct beiscsi_conn *conn;
  135. struct iscsi_endpoint *openiscsi_ep;
  136. unsigned short ip_type;
  137. char dst6_addr[ISCSI_ADDRESS_BUF_LEN];
  138. unsigned long dst_addr;
  139. unsigned short ep_cid;
  140. unsigned int fw_handle;
  141. u16 dst_tcpport;
  142. u16 cid_vld;
  143. };
  144. int beiscsi_mgmt_invalidate_icds(struct beiscsi_hba *phba,
  145. struct invldt_cmd_tbl *inv_tbl,
  146. unsigned int nents);
  147. int beiscsi_get_initiator_name(struct beiscsi_hba *phba, char *name, bool cfg);
  148. int beiscsi_if_en_dhcp(struct beiscsi_hba *phba, u32 ip_type);
  149. int beiscsi_if_en_static(struct beiscsi_hba *phba, u32 ip_type,
  150. u8 *ip, u8 *subnet);
  151. int beiscsi_if_set_gw(struct beiscsi_hba *phba, u32 ip_type, u8 *gw);
  152. int beiscsi_if_get_gw(struct beiscsi_hba *phba, u32 ip_type,
  153. struct be_cmd_get_def_gateway_resp *resp);
  154. int mgmt_get_nic_conf(struct beiscsi_hba *phba,
  155. struct be_cmd_get_nic_conf_resp *mac);
  156. int beiscsi_if_get_info(struct beiscsi_hba *phba, int ip_type,
  157. struct be_cmd_get_if_info_resp **if_info);
  158. unsigned int beiscsi_if_get_handle(struct beiscsi_hba *phba);
  159. int beiscsi_if_set_vlan(struct beiscsi_hba *phba, uint16_t vlan_tag);
  160. unsigned int beiscsi_boot_logout_sess(struct beiscsi_hba *phba);
  161. unsigned int beiscsi_boot_reopen_sess(struct beiscsi_hba *phba);
  162. unsigned int beiscsi_boot_get_sinfo(struct beiscsi_hba *phba);
  163. unsigned int __beiscsi_boot_get_shandle(struct beiscsi_hba *phba, int async);
  164. int beiscsi_boot_get_shandle(struct beiscsi_hba *phba, unsigned int *s_handle);
  165. ssize_t beiscsi_drvr_ver_disp(struct device *dev,
  166. struct device_attribute *attr, char *buf);
  167. ssize_t beiscsi_fw_ver_disp(struct device *dev,
  168. struct device_attribute *attr, char *buf);
  169. ssize_t beiscsi_active_session_disp(struct device *dev,
  170. struct device_attribute *attr, char *buf);
  171. ssize_t beiscsi_adap_family_disp(struct device *dev,
  172. struct device_attribute *attr, char *buf);
  173. ssize_t beiscsi_free_session_disp(struct device *dev,
  174. struct device_attribute *attr, char *buf);
  175. ssize_t beiscsi_phys_port_disp(struct device *dev,
  176. struct device_attribute *attr, char *buf);
  177. void beiscsi_offload_cxn_v0(struct beiscsi_offload_params *params,
  178. struct wrb_handle *pwrb_handle,
  179. struct be_mem_descriptor *mem_descr,
  180. struct hwi_wrb_context *pwrb_context);
  181. void beiscsi_offload_cxn_v2(struct beiscsi_offload_params *params,
  182. struct wrb_handle *pwrb_handle,
  183. struct hwi_wrb_context *pwrb_context);
  184. unsigned int beiscsi_invalidate_cxn(struct beiscsi_hba *phba,
  185. struct beiscsi_endpoint *beiscsi_ep);
  186. unsigned int beiscsi_upload_cxn(struct beiscsi_hba *phba,
  187. struct beiscsi_endpoint *beiscsi_ep);
  188. int be_cmd_modify_eq_delay(struct beiscsi_hba *phba,
  189. struct be_set_eqd *, int num);
  190. int beiscsi_logout_fw_sess(struct beiscsi_hba *phba,
  191. uint32_t fw_sess_handle);
  192. #endif