be_mgmt.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. /**
  2. * Copyright (C) 2005 - 2011 Emulex
  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@emulex.com)
  11. *
  12. * Contact Information:
  13. * linux-drivers@emulex.com
  14. *
  15. * Emulex
  16. * 3333 Susan Street
  17. * Costa Mesa, CA 92626
  18. */
  19. #ifndef _BEISCSI_MGMT_
  20. #define _BEISCSI_MGMT_
  21. #include <linux/types.h>
  22. #include <linux/list.h>
  23. #include "be_iscsi.h"
  24. #include "be_main.h"
  25. /**
  26. * Pseudo amap definition in which each bit of the actual structure is defined
  27. * as a byte: used to calculate offset/shift/mask of each field
  28. */
  29. struct amap_mcc_sge {
  30. u8 pa_lo[32]; /* dword 0 */
  31. u8 pa_hi[32]; /* dword 1 */
  32. u8 length[32]; /* DWORD 2 */
  33. } __packed;
  34. /**
  35. * Pseudo amap definition in which each bit of the actual structure is defined
  36. * as a byte: used to calculate offset/shift/mask of each field
  37. */
  38. struct amap_mcc_wrb_payload {
  39. union {
  40. struct amap_mcc_sge sgl[19];
  41. u8 embedded[59 * 32]; /* DWORDS 57 to 115 */
  42. } u;
  43. } __packed;
  44. /**
  45. * Pseudo amap definition in which each bit of the actual structure is defined
  46. * as a byte: used to calculate offset/shift/mask of each field
  47. */
  48. struct amap_mcc_wrb {
  49. u8 embedded; /* DWORD 0 */
  50. u8 rsvd0[2]; /* DWORD 0 */
  51. u8 sge_count[5]; /* DWORD 0 */
  52. u8 rsvd1[16]; /* DWORD 0 */
  53. u8 special[8]; /* DWORD 0 */
  54. u8 payload_length[32];
  55. u8 tag[64]; /* DWORD 2 */
  56. u8 rsvd2[32]; /* DWORD 4 */
  57. struct amap_mcc_wrb_payload payload;
  58. };
  59. struct mcc_sge {
  60. u32 pa_lo; /* dword 0 */
  61. u32 pa_hi; /* dword 1 */
  62. u32 length; /* DWORD 2 */
  63. } __packed;
  64. struct mcc_wrb_payload {
  65. union {
  66. struct mcc_sge sgl[19];
  67. u32 embedded[59]; /* DWORDS 57 to 115 */
  68. } u;
  69. } __packed;
  70. #define MCC_WRB_EMBEDDED_MASK 0x00000001
  71. struct mcc_wrb {
  72. u32 dw[0]; /* DWORD 0 */
  73. u32 payload_length;
  74. u32 tag[2]; /* DWORD 2 */
  75. u32 rsvd2[1]; /* DWORD 4 */
  76. struct mcc_wrb_payload payload;
  77. };
  78. int mgmt_epfw_cleanup(struct beiscsi_hba *phba, unsigned short chute);
  79. int mgmt_open_connection(struct beiscsi_hba *phba,
  80. struct sockaddr *dst_addr,
  81. struct beiscsi_endpoint *beiscsi_ep,
  82. struct be_dma_mem *nonemb_cmd);
  83. unsigned int mgmt_upload_connection(struct beiscsi_hba *phba,
  84. unsigned short cid,
  85. unsigned int upload_flag);
  86. unsigned int mgmt_invalidate_icds(struct beiscsi_hba *phba,
  87. struct invalidate_command_table *inv_tbl,
  88. unsigned int num_invalidate, unsigned int cid,
  89. struct be_dma_mem *nonemb_cmd);
  90. struct iscsi_invalidate_connection_params_in {
  91. struct be_cmd_req_hdr hdr;
  92. unsigned int session_handle;
  93. unsigned short cid;
  94. unsigned short unused;
  95. unsigned short cleanup_type;
  96. unsigned short save_cfg;
  97. } __packed;
  98. struct iscsi_invalidate_connection_params_out {
  99. unsigned int session_handle;
  100. unsigned short cid;
  101. unsigned short unused;
  102. } __packed;
  103. union iscsi_invalidate_connection_params {
  104. struct iscsi_invalidate_connection_params_in request;
  105. struct iscsi_invalidate_connection_params_out response;
  106. } __packed;
  107. struct invalidate_commands_params_in {
  108. struct be_cmd_req_hdr hdr;
  109. unsigned int ref_handle;
  110. unsigned int icd_count;
  111. struct invalidate_command_table table[128];
  112. unsigned short cleanup_type;
  113. unsigned short unused;
  114. } __packed;
  115. struct invalidate_commands_params_out {
  116. unsigned int ref_handle;
  117. unsigned int icd_count;
  118. unsigned int icd_status[128];
  119. } __packed;
  120. union invalidate_commands_params {
  121. struct invalidate_commands_params_in request;
  122. struct invalidate_commands_params_out response;
  123. } __packed;
  124. struct mgmt_hba_attributes {
  125. u8 flashrom_version_string[32];
  126. u8 manufacturer_name[32];
  127. u32 supported_modes;
  128. u8 seeprom_version_lo;
  129. u8 seeprom_version_hi;
  130. u8 rsvd0[2];
  131. u32 fw_cmd_data_struct_version;
  132. u32 ep_fw_data_struct_version;
  133. u32 future_reserved[12];
  134. u32 default_extended_timeout;
  135. u8 controller_model_number[32];
  136. u8 controller_description[64];
  137. u8 controller_serial_number[32];
  138. u8 ip_version_string[32];
  139. u8 firmware_version_string[32];
  140. u8 bios_version_string[32];
  141. u8 redboot_version_string[32];
  142. u8 driver_version_string[32];
  143. u8 fw_on_flash_version_string[32];
  144. u32 functionalities_supported;
  145. u16 max_cdblength;
  146. u8 asic_revision;
  147. u8 generational_guid[16];
  148. u8 hba_port_count;
  149. u16 default_link_down_timeout;
  150. u8 iscsi_ver_min_max;
  151. u8 multifunction_device;
  152. u8 cache_valid;
  153. u8 hba_status;
  154. u8 max_domains_supported;
  155. u8 phy_port;
  156. u32 firmware_post_status;
  157. u32 hba_mtu[8];
  158. u8 iscsi_features;
  159. u8 future_u8[3];
  160. u32 future_u32[3];
  161. } __packed;
  162. struct mgmt_controller_attributes {
  163. struct mgmt_hba_attributes hba_attribs;
  164. u16 pci_vendor_id;
  165. u16 pci_device_id;
  166. u16 pci_sub_vendor_id;
  167. u16 pci_sub_system_id;
  168. u8 pci_bus_number;
  169. u8 pci_device_number;
  170. u8 pci_function_number;
  171. u8 interface_type;
  172. u64 unique_identifier;
  173. u8 netfilters;
  174. u8 rsvd0[3];
  175. u8 future_u32[4];
  176. } __packed;
  177. struct be_mgmt_controller_attributes {
  178. struct be_cmd_req_hdr hdr;
  179. struct mgmt_controller_attributes params;
  180. } __packed;
  181. struct be_mgmt_controller_attributes_resp {
  182. struct be_cmd_resp_hdr hdr;
  183. struct mgmt_controller_attributes params;
  184. } __packed;
  185. /* configuration management */
  186. #define GET_MGMT_CONTROLLER_WS(phba) (phba->pmgmt_ws)
  187. /* MGMT CMD flags */
  188. #define MGMT_CMDH_FREE (1<<0)
  189. /* --- MGMT_ERROR_CODES --- */
  190. /* Error Codes returned in the status field of the CMD response header */
  191. #define MGMT_STATUS_SUCCESS 0 /* The CMD completed without errors */
  192. #define MGMT_STATUS_FAILED 1 /* Error status in the Status field of */
  193. /* the CMD_RESPONSE_HEADER */
  194. #define ISCSI_GET_PDU_TEMPLATE_ADDRESS(pc, pa) {\
  195. pa->lo = phba->init_mem[ISCSI_MEM_GLOBAL_HEADER].mem_array[0].\
  196. bus_address.u.a32.address_lo; \
  197. pa->hi = phba->init_mem[ISCSI_MEM_GLOBAL_HEADER].mem_array[0].\
  198. bus_address.u.a32.address_hi; \
  199. }
  200. struct beiscsi_endpoint {
  201. struct beiscsi_hba *phba;
  202. struct beiscsi_sess *sess;
  203. struct beiscsi_conn *conn;
  204. struct iscsi_endpoint *openiscsi_ep;
  205. unsigned short ip_type;
  206. char dst6_addr[ISCSI_ADDRESS_BUF_LEN];
  207. unsigned long dst_addr;
  208. unsigned short ep_cid;
  209. unsigned int fw_handle;
  210. u16 dst_tcpport;
  211. u16 cid_vld;
  212. };
  213. int mgmt_get_fw_config(struct be_ctrl_info *ctrl,
  214. struct beiscsi_hba *phba);
  215. unsigned int mgmt_invalidate_connection(struct beiscsi_hba *phba,
  216. struct beiscsi_endpoint *beiscsi_ep,
  217. unsigned short cid,
  218. unsigned short issue_reset,
  219. unsigned short savecfg_flag);
  220. #endif