qla_bsg.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. /*
  2. * QLogic Fibre Channel HBA Driver
  3. * Copyright (c) 2003-2011 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_WRITE_I2C 0x10
  22. #define QL_VND_READ_I2C 0x11
  23. /* BSG Vendor specific subcode returns */
  24. #define EXT_STATUS_OK 0
  25. #define EXT_STATUS_ERR 1
  26. #define EXT_STATUS_INVALID_PARAM 6
  27. #define EXT_STATUS_MAILBOX 11
  28. #define EXT_STATUS_NO_MEMORY 17
  29. /* BSG definations for interpreting CommandSent field */
  30. #define INT_DEF_LB_LOOPBACK_CMD 0
  31. #define INT_DEF_LB_ECHO_CMD 1
  32. /* Loopback related definations */
  33. #define EXTERNAL_LOOPBACK 0xF2
  34. #define ENABLE_INTERNAL_LOOPBACK 0x02
  35. #define INTERNAL_LOOPBACK_MASK 0x000E
  36. #define MAX_ELS_FRAME_PAYLOAD 252
  37. #define ELS_OPCODE_BYTE 0x10
  38. /* BSG Vendor specific definations */
  39. #define A84_ISSUE_WRITE_TYPE_CMD 0
  40. #define A84_ISSUE_READ_TYPE_CMD 1
  41. #define A84_CLEANUP_CMD 2
  42. #define A84_ISSUE_RESET_OP_FW 3
  43. #define A84_ISSUE_RESET_DIAG_FW 4
  44. #define A84_ISSUE_UPDATE_OPFW_CMD 5
  45. #define A84_ISSUE_UPDATE_DIAGFW_CMD 6
  46. struct qla84_mgmt_param {
  47. union {
  48. struct {
  49. uint32_t start_addr;
  50. } mem; /* for QLA84_MGMT_READ/WRITE_MEM */
  51. struct {
  52. uint32_t id;
  53. #define QLA84_MGMT_CONFIG_ID_UIF 1
  54. #define QLA84_MGMT_CONFIG_ID_FCOE_COS 2
  55. #define QLA84_MGMT_CONFIG_ID_PAUSE 3
  56. #define QLA84_MGMT_CONFIG_ID_TIMEOUTS 4
  57. uint32_t param0;
  58. uint32_t param1;
  59. } config; /* for QLA84_MGMT_CHNG_CONFIG */
  60. struct {
  61. uint32_t type;
  62. #define QLA84_MGMT_INFO_CONFIG_LOG_DATA 1 /* Get Config Log Data */
  63. #define QLA84_MGMT_INFO_LOG_DATA 2 /* Get Log Data */
  64. #define QLA84_MGMT_INFO_PORT_STAT 3 /* Get Port Statistics */
  65. #define QLA84_MGMT_INFO_LIF_STAT 4 /* Get LIF Statistics */
  66. #define QLA84_MGMT_INFO_ASIC_STAT 5 /* Get ASIC Statistics */
  67. #define QLA84_MGMT_INFO_CONFIG_PARAMS 6 /* Get Config Parameters */
  68. #define QLA84_MGMT_INFO_PANIC_LOG 7 /* Get Panic Log */
  69. uint32_t context;
  70. /*
  71. * context definitions for QLA84_MGMT_INFO_CONFIG_LOG_DATA
  72. */
  73. #define IC_LOG_DATA_LOG_ID_DEBUG_LOG 0
  74. #define IC_LOG_DATA_LOG_ID_LEARN_LOG 1
  75. #define IC_LOG_DATA_LOG_ID_FC_ACL_INGRESS_LOG 2
  76. #define IC_LOG_DATA_LOG_ID_FC_ACL_EGRESS_LOG 3
  77. #define IC_LOG_DATA_LOG_ID_ETHERNET_ACL_INGRESS_LOG 4
  78. #define IC_LOG_DATA_LOG_ID_ETHERNET_ACL_EGRESS_LOG 5
  79. #define IC_LOG_DATA_LOG_ID_MESSAGE_TRANSMIT_LOG 6
  80. #define IC_LOG_DATA_LOG_ID_MESSAGE_RECEIVE_LOG 7
  81. #define IC_LOG_DATA_LOG_ID_LINK_EVENT_LOG 8
  82. #define IC_LOG_DATA_LOG_ID_DCX_LOG 9
  83. /*
  84. * context definitions for QLA84_MGMT_INFO_PORT_STAT
  85. */
  86. #define IC_PORT_STATISTICS_PORT_NUMBER_ETHERNET_PORT0 0
  87. #define IC_PORT_STATISTICS_PORT_NUMBER_ETHERNET_PORT1 1
  88. #define IC_PORT_STATISTICS_PORT_NUMBER_NSL_PORT0 2
  89. #define IC_PORT_STATISTICS_PORT_NUMBER_NSL_PORT1 3
  90. #define IC_PORT_STATISTICS_PORT_NUMBER_FC_PORT0 4
  91. #define IC_PORT_STATISTICS_PORT_NUMBER_FC_PORT1 5
  92. /*
  93. * context definitions for QLA84_MGMT_INFO_LIF_STAT
  94. */
  95. #define IC_LIF_STATISTICS_LIF_NUMBER_ETHERNET_PORT0 0
  96. #define IC_LIF_STATISTICS_LIF_NUMBER_ETHERNET_PORT1 1
  97. #define IC_LIF_STATISTICS_LIF_NUMBER_FC_PORT0 2
  98. #define IC_LIF_STATISTICS_LIF_NUMBER_FC_PORT1 3
  99. #define IC_LIF_STATISTICS_LIF_NUMBER_CPU 6
  100. } info; /* for QLA84_MGMT_GET_INFO */
  101. } u;
  102. };
  103. struct qla84_msg_mgmt {
  104. uint16_t cmd;
  105. #define QLA84_MGMT_READ_MEM 0x00
  106. #define QLA84_MGMT_WRITE_MEM 0x01
  107. #define QLA84_MGMT_CHNG_CONFIG 0x02
  108. #define QLA84_MGMT_GET_INFO 0x03
  109. uint16_t rsrvd;
  110. struct qla84_mgmt_param mgmtp;/* parameters for cmd */
  111. uint32_t len; /* bytes in payload following this struct */
  112. uint8_t payload[0]; /* payload for cmd */
  113. };
  114. struct qla_bsg_a84_mgmt {
  115. struct qla84_msg_mgmt mgmt;
  116. } __attribute__ ((packed));
  117. struct qla_scsi_addr {
  118. uint16_t bus;
  119. uint16_t target;
  120. } __attribute__ ((packed));
  121. struct qla_ext_dest_addr {
  122. union {
  123. uint8_t wwnn[8];
  124. uint8_t wwpn[8];
  125. uint8_t id[4];
  126. struct qla_scsi_addr scsi_addr;
  127. } dest_addr;
  128. uint16_t dest_type;
  129. #define EXT_DEF_TYPE_WWPN 2
  130. uint16_t lun;
  131. uint16_t padding[2];
  132. } __attribute__ ((packed));
  133. struct qla_port_param {
  134. struct qla_ext_dest_addr fc_scsi_addr;
  135. uint16_t mode;
  136. uint16_t speed;
  137. } __attribute__ ((packed));
  138. /* FRU VPD */
  139. #define MAX_FRU_SIZE 36
  140. struct qla_field_address {
  141. uint16_t offset;
  142. uint16_t device;
  143. uint16_t option;
  144. } __packed;
  145. struct qla_field_info {
  146. uint8_t version[MAX_FRU_SIZE];
  147. } __packed;
  148. struct qla_image_version {
  149. struct qla_field_address field_address;
  150. struct qla_field_info field_info;
  151. } __packed;
  152. struct qla_image_version_list {
  153. uint32_t count;
  154. struct qla_image_version version[0];
  155. } __packed;
  156. struct qla_status_reg {
  157. struct qla_field_address field_address;
  158. uint8_t status_reg;
  159. uint8_t reserved[7];
  160. } __packed;
  161. struct qla_i2c_access {
  162. uint16_t device;
  163. uint16_t offset;
  164. uint16_t option;
  165. uint16_t length;
  166. uint8_t buffer[0x40];
  167. } __packed;
  168. #endif