be_mgmt.h 6.5 KB

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