qla_bsg.h 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. /*
  2. * QLogic Fibre Channel HBA Driver
  3. * Copyright (c) 2003-2014 QLogic Corporation
  4. *
  5. * See LICENSE.qla2xxx for copyright and licensing details.
  6. */
  7. #ifndef __QLA_BSG_H
  8. #define __QLA_BSG_H
  9. /* BSG Vendor specific commands */
  10. #define QL_VND_LOOPBACK 0x01
  11. #define QL_VND_A84_RESET 0x02
  12. #define QL_VND_A84_UPDATE_FW 0x03
  13. #define QL_VND_A84_MGMT_CMD 0x04
  14. #define QL_VND_IIDMA 0x05
  15. #define QL_VND_FCP_PRIO_CFG_CMD 0x06
  16. #define QL_VND_READ_FLASH 0x07
  17. #define QL_VND_UPDATE_FLASH 0x08
  18. #define QL_VND_SET_FRU_VERSION 0x0B
  19. #define QL_VND_READ_FRU_STATUS 0x0C
  20. #define QL_VND_WRITE_FRU_STATUS 0x0D
  21. #define QL_VND_DIAG_IO_CMD 0x0A
  22. #define QL_VND_WRITE_I2C 0x10
  23. #define QL_VND_READ_I2C 0x11
  24. #define QL_VND_FX00_MGMT_CMD 0x12
  25. #define QL_VND_SERDES_OP 0x13
  26. #define QL_VND_SERDES_OP_EX 0x14
  27. #define QL_VND_GET_FLASH_UPDATE_CAPS 0x15
  28. #define QL_VND_SET_FLASH_UPDATE_CAPS 0x16
  29. #define QL_VND_GET_BBCR_DATA 0x17
  30. #define QL_VND_GET_PRIV_STATS 0x18
  31. #define QL_VND_DPORT_DIAGNOSTICS 0x19
  32. #define QL_VND_GET_PRIV_STATS_EX 0x1A
  33. /* BSG Vendor specific subcode returns */
  34. #define EXT_STATUS_OK 0
  35. #define EXT_STATUS_ERR 1
  36. #define EXT_STATUS_BUSY 2
  37. #define EXT_STATUS_INVALID_PARAM 6
  38. #define EXT_STATUS_DATA_OVERRUN 7
  39. #define EXT_STATUS_DATA_UNDERRUN 8
  40. #define EXT_STATUS_MAILBOX 11
  41. #define EXT_STATUS_NO_MEMORY 17
  42. #define EXT_STATUS_DEVICE_OFFLINE 22
  43. /*
  44. * To support bidirectional iocb
  45. * BSG Vendor specific returns
  46. */
  47. #define EXT_STATUS_NOT_SUPPORTED 27
  48. #define EXT_STATUS_INVALID_CFG 28
  49. #define EXT_STATUS_DMA_ERR 29
  50. #define EXT_STATUS_TIMEOUT 30
  51. #define EXT_STATUS_THREAD_FAILED 31
  52. #define EXT_STATUS_DATA_CMP_FAILED 32
  53. /* BSG definations for interpreting CommandSent field */
  54. #define INT_DEF_LB_LOOPBACK_CMD 0
  55. #define INT_DEF_LB_ECHO_CMD 1
  56. /* Loopback related definations */
  57. #define INTERNAL_LOOPBACK 0xF1
  58. #define EXTERNAL_LOOPBACK 0xF2
  59. #define ENABLE_INTERNAL_LOOPBACK 0x02
  60. #define ENABLE_EXTERNAL_LOOPBACK 0x04
  61. #define INTERNAL_LOOPBACK_MASK 0x000E
  62. #define MAX_ELS_FRAME_PAYLOAD 252
  63. #define ELS_OPCODE_BYTE 0x10
  64. /* BSG Vendor specific definations */
  65. #define A84_ISSUE_WRITE_TYPE_CMD 0
  66. #define A84_ISSUE_READ_TYPE_CMD 1
  67. #define A84_CLEANUP_CMD 2
  68. #define A84_ISSUE_RESET_OP_FW 3
  69. #define A84_ISSUE_RESET_DIAG_FW 4
  70. #define A84_ISSUE_UPDATE_OPFW_CMD 5
  71. #define A84_ISSUE_UPDATE_DIAGFW_CMD 6
  72. struct qla84_mgmt_param {
  73. union {
  74. struct {
  75. uint32_t start_addr;
  76. } mem; /* for QLA84_MGMT_READ/WRITE_MEM */
  77. struct {
  78. uint32_t id;
  79. #define QLA84_MGMT_CONFIG_ID_UIF 1
  80. #define QLA84_MGMT_CONFIG_ID_FCOE_COS 2
  81. #define QLA84_MGMT_CONFIG_ID_PAUSE 3
  82. #define QLA84_MGMT_CONFIG_ID_TIMEOUTS 4
  83. uint32_t param0;
  84. uint32_t param1;
  85. } config; /* for QLA84_MGMT_CHNG_CONFIG */
  86. struct {
  87. uint32_t type;
  88. #define QLA84_MGMT_INFO_CONFIG_LOG_DATA 1 /* Get Config Log Data */
  89. #define QLA84_MGMT_INFO_LOG_DATA 2 /* Get Log Data */
  90. #define QLA84_MGMT_INFO_PORT_STAT 3 /* Get Port Statistics */
  91. #define QLA84_MGMT_INFO_LIF_STAT 4 /* Get LIF Statistics */
  92. #define QLA84_MGMT_INFO_ASIC_STAT 5 /* Get ASIC Statistics */
  93. #define QLA84_MGMT_INFO_CONFIG_PARAMS 6 /* Get Config Parameters */
  94. #define QLA84_MGMT_INFO_PANIC_LOG 7 /* Get Panic Log */
  95. uint32_t context;
  96. /*
  97. * context definitions for QLA84_MGMT_INFO_CONFIG_LOG_DATA
  98. */
  99. #define IC_LOG_DATA_LOG_ID_DEBUG_LOG 0
  100. #define IC_LOG_DATA_LOG_ID_LEARN_LOG 1
  101. #define IC_LOG_DATA_LOG_ID_FC_ACL_INGRESS_LOG 2
  102. #define IC_LOG_DATA_LOG_ID_FC_ACL_EGRESS_LOG 3
  103. #define IC_LOG_DATA_LOG_ID_ETHERNET_ACL_INGRESS_LOG 4
  104. #define IC_LOG_DATA_LOG_ID_ETHERNET_ACL_EGRESS_LOG 5
  105. #define IC_LOG_DATA_LOG_ID_MESSAGE_TRANSMIT_LOG 6
  106. #define IC_LOG_DATA_LOG_ID_MESSAGE_RECEIVE_LOG 7
  107. #define IC_LOG_DATA_LOG_ID_LINK_EVENT_LOG 8
  108. #define IC_LOG_DATA_LOG_ID_DCX_LOG 9
  109. /*
  110. * context definitions for QLA84_MGMT_INFO_PORT_STAT
  111. */
  112. #define IC_PORT_STATISTICS_PORT_NUMBER_ETHERNET_PORT0 0
  113. #define IC_PORT_STATISTICS_PORT_NUMBER_ETHERNET_PORT1 1
  114. #define IC_PORT_STATISTICS_PORT_NUMBER_NSL_PORT0 2
  115. #define IC_PORT_STATISTICS_PORT_NUMBER_NSL_PORT1 3
  116. #define IC_PORT_STATISTICS_PORT_NUMBER_FC_PORT0 4
  117. #define IC_PORT_STATISTICS_PORT_NUMBER_FC_PORT1 5
  118. /*
  119. * context definitions for QLA84_MGMT_INFO_LIF_STAT
  120. */
  121. #define IC_LIF_STATISTICS_LIF_NUMBER_ETHERNET_PORT0 0
  122. #define IC_LIF_STATISTICS_LIF_NUMBER_ETHERNET_PORT1 1
  123. #define IC_LIF_STATISTICS_LIF_NUMBER_FC_PORT0 2
  124. #define IC_LIF_STATISTICS_LIF_NUMBER_FC_PORT1 3
  125. #define IC_LIF_STATISTICS_LIF_NUMBER_CPU 6
  126. } info; /* for QLA84_MGMT_GET_INFO */
  127. } u;
  128. };
  129. struct qla84_msg_mgmt {
  130. uint16_t cmd;
  131. #define QLA84_MGMT_READ_MEM 0x00
  132. #define QLA84_MGMT_WRITE_MEM 0x01
  133. #define QLA84_MGMT_CHNG_CONFIG 0x02
  134. #define QLA84_MGMT_GET_INFO 0x03
  135. uint16_t rsrvd;
  136. struct qla84_mgmt_param mgmtp;/* parameters for cmd */
  137. uint32_t len; /* bytes in payload following this struct */
  138. uint8_t payload[0]; /* payload for cmd */
  139. };
  140. struct qla_bsg_a84_mgmt {
  141. struct qla84_msg_mgmt mgmt;
  142. } __attribute__ ((packed));
  143. struct qla_scsi_addr {
  144. uint16_t bus;
  145. uint16_t target;
  146. } __attribute__ ((packed));
  147. struct qla_ext_dest_addr {
  148. union {
  149. uint8_t wwnn[8];
  150. uint8_t wwpn[8];
  151. uint8_t id[4];
  152. struct qla_scsi_addr scsi_addr;
  153. } dest_addr;
  154. uint16_t dest_type;
  155. #define EXT_DEF_TYPE_WWPN 2
  156. uint16_t lun;
  157. uint16_t padding[2];
  158. } __attribute__ ((packed));
  159. struct qla_port_param {
  160. struct qla_ext_dest_addr fc_scsi_addr;
  161. uint16_t mode;
  162. uint16_t speed;
  163. } __attribute__ ((packed));
  164. /* FRU VPD */
  165. #define MAX_FRU_SIZE 36
  166. struct qla_field_address {
  167. uint16_t offset;
  168. uint16_t device;
  169. uint16_t option;
  170. } __packed;
  171. struct qla_field_info {
  172. uint8_t version[MAX_FRU_SIZE];
  173. } __packed;
  174. struct qla_image_version {
  175. struct qla_field_address field_address;
  176. struct qla_field_info field_info;
  177. } __packed;
  178. struct qla_image_version_list {
  179. uint32_t count;
  180. struct qla_image_version version[0];
  181. } __packed;
  182. struct qla_status_reg {
  183. struct qla_field_address field_address;
  184. uint8_t status_reg;
  185. uint8_t reserved[7];
  186. } __packed;
  187. struct qla_i2c_access {
  188. uint16_t device;
  189. uint16_t offset;
  190. uint16_t option;
  191. uint16_t length;
  192. uint8_t buffer[0x40];
  193. } __packed;
  194. /* 26xx serdes register interface */
  195. /* serdes reg commands */
  196. #define INT_SC_SERDES_READ_REG 1
  197. #define INT_SC_SERDES_WRITE_REG 2
  198. struct qla_serdes_reg {
  199. uint16_t cmd;
  200. uint16_t addr;
  201. uint16_t val;
  202. } __packed;
  203. struct qla_serdes_reg_ex {
  204. uint16_t cmd;
  205. uint32_t addr;
  206. uint32_t val;
  207. } __packed;
  208. struct qla_flash_update_caps {
  209. uint64_t capabilities;
  210. uint32_t outage_duration;
  211. uint8_t reserved[20];
  212. } __packed;
  213. /* BB_CR Status */
  214. #define QLA_BBCR_STATUS_DISABLED 0
  215. #define QLA_BBCR_STATUS_ENABLED 1
  216. #define QLA_BBCR_STATUS_UNKNOWN 2
  217. /* BB_CR State */
  218. #define QLA_BBCR_STATE_OFFLINE 0
  219. #define QLA_BBCR_STATE_ONLINE 1
  220. /* BB_CR Offline Reason Code */
  221. #define QLA_BBCR_REASON_PORT_SPEED 1
  222. #define QLA_BBCR_REASON_PEER_PORT 2
  223. #define QLA_BBCR_REASON_SWITCH 3
  224. #define QLA_BBCR_REASON_LOGIN_REJECT 4
  225. struct qla_bbcr_data {
  226. uint8_t status; /* 1 - enabled, 0 - Disabled */
  227. uint8_t state; /* 1 - online, 0 - offline */
  228. uint8_t configured_bbscn; /* 0-15 */
  229. uint8_t negotiated_bbscn; /* 0-15 */
  230. uint8_t offline_reason_code;
  231. uint16_t mbx1; /* Port state */
  232. uint8_t reserved[9];
  233. } __packed;
  234. struct qla_dport_diag {
  235. uint16_t options;
  236. uint32_t buf[16];
  237. uint8_t unused[62];
  238. } __packed;
  239. /* D_Port options */
  240. #define QLA_DPORT_RESULT 0x0
  241. #define QLA_DPORT_START 0x2
  242. #endif