be_mgmt.h 7.1 KB

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