myri10ge_mcp.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. #ifndef __MYRI10GE_MCP_H__
  2. #define __MYRI10GE_MCP_H__
  3. #define MXGEFW_VERSION_MAJOR 1
  4. #define MXGEFW_VERSION_MINOR 4
  5. /* 8 Bytes */
  6. struct mcp_dma_addr {
  7. __be32 high;
  8. __be32 low;
  9. };
  10. /* 4 Bytes */
  11. struct mcp_slot {
  12. __sum16 checksum;
  13. __be16 length;
  14. };
  15. /* 64 Bytes */
  16. struct mcp_cmd {
  17. __be32 cmd;
  18. __be32 data0; /* will be low portion if data > 32 bits */
  19. /* 8 */
  20. __be32 data1; /* will be high portion if data > 32 bits */
  21. __be32 data2; /* currently unused.. */
  22. /* 16 */
  23. struct mcp_dma_addr response_addr;
  24. /* 24 */
  25. u8 pad[40];
  26. };
  27. /* 8 Bytes */
  28. struct mcp_cmd_response {
  29. __be32 data;
  30. __be32 result;
  31. };
  32. /*
  33. * flags used in mcp_kreq_ether_send_t:
  34. *
  35. * The SMALL flag is only needed in the first segment. It is raised
  36. * for packets that are total less or equal 512 bytes.
  37. *
  38. * The CKSUM flag must be set in all segments.
  39. *
  40. * The PADDED flags is set if the packet needs to be padded, and it
  41. * must be set for all segments.
  42. *
  43. * The MXGEFW_FLAGS_ALIGN_ODD must be set if the cumulative
  44. * length of all previous segments was odd.
  45. */
  46. #define MXGEFW_FLAGS_SMALL 0x1
  47. #define MXGEFW_FLAGS_TSO_HDR 0x1
  48. #define MXGEFW_FLAGS_FIRST 0x2
  49. #define MXGEFW_FLAGS_ALIGN_ODD 0x4
  50. #define MXGEFW_FLAGS_CKSUM 0x8
  51. #define MXGEFW_FLAGS_TSO_LAST 0x8
  52. #define MXGEFW_FLAGS_NO_TSO 0x10
  53. #define MXGEFW_FLAGS_TSO_CHOP 0x10
  54. #define MXGEFW_FLAGS_TSO_PLD 0x20
  55. #define MXGEFW_SEND_SMALL_SIZE 1520
  56. #define MXGEFW_MAX_MTU 9400
  57. union mcp_pso_or_cumlen {
  58. u16 pseudo_hdr_offset;
  59. u16 cum_len;
  60. };
  61. #define MXGEFW_MAX_SEND_DESC 12
  62. #define MXGEFW_PAD 2
  63. /* 16 Bytes */
  64. struct mcp_kreq_ether_send {
  65. __be32 addr_high;
  66. __be32 addr_low;
  67. __be16 pseudo_hdr_offset;
  68. __be16 length;
  69. u8 pad;
  70. u8 rdma_count;
  71. u8 cksum_offset; /* where to start computing cksum */
  72. u8 flags; /* as defined above */
  73. };
  74. /* 8 Bytes */
  75. struct mcp_kreq_ether_recv {
  76. __be32 addr_high;
  77. __be32 addr_low;
  78. };
  79. /* Commands */
  80. #define MXGEFW_BOOT_HANDOFF 0xfc0000
  81. #define MXGEFW_BOOT_DUMMY_RDMA 0xfc01c0
  82. #define MXGEFW_ETH_CMD 0xf80000
  83. #define MXGEFW_ETH_SEND_4 0x200000
  84. #define MXGEFW_ETH_SEND_1 0x240000
  85. #define MXGEFW_ETH_SEND_2 0x280000
  86. #define MXGEFW_ETH_SEND_3 0x2c0000
  87. #define MXGEFW_ETH_RECV_SMALL 0x300000
  88. #define MXGEFW_ETH_RECV_BIG 0x340000
  89. #define MXGEFW_ETH_SEND(n) (0x200000 + (((n) & 0x03) * 0x40000))
  90. #define MXGEFW_ETH_SEND_OFFSET(n) (MXGEFW_ETH_SEND(n) - MXGEFW_ETH_SEND_4)
  91. enum myri10ge_mcp_cmd_type {
  92. MXGEFW_CMD_NONE = 0,
  93. /* Reset the mcp, it is left in a safe state, waiting
  94. * for the driver to set all its parameters */
  95. MXGEFW_CMD_RESET,
  96. /* get the version number of the current firmware..
  97. * (may be available in the eeprom strings..? */
  98. MXGEFW_GET_MCP_VERSION,
  99. /* Parameters which must be set by the driver before it can
  100. * issue MXGEFW_CMD_ETHERNET_UP. They persist until the next
  101. * MXGEFW_CMD_RESET is issued */
  102. MXGEFW_CMD_SET_INTRQ_DMA,
  103. MXGEFW_CMD_SET_BIG_BUFFER_SIZE, /* in bytes, power of 2 */
  104. MXGEFW_CMD_SET_SMALL_BUFFER_SIZE, /* in bytes */
  105. /* Parameters which refer to lanai SRAM addresses where the
  106. * driver must issue PIO writes for various things */
  107. MXGEFW_CMD_GET_SEND_OFFSET,
  108. MXGEFW_CMD_GET_SMALL_RX_OFFSET,
  109. MXGEFW_CMD_GET_BIG_RX_OFFSET,
  110. MXGEFW_CMD_GET_IRQ_ACK_OFFSET,
  111. MXGEFW_CMD_GET_IRQ_DEASSERT_OFFSET,
  112. /* Parameters which refer to rings stored on the MCP,
  113. * and whose size is controlled by the mcp */
  114. MXGEFW_CMD_GET_SEND_RING_SIZE, /* in bytes */
  115. MXGEFW_CMD_GET_RX_RING_SIZE, /* in bytes */
  116. /* Parameters which refer to rings stored in the host,
  117. * and whose size is controlled by the host. Note that
  118. * all must be physically contiguous and must contain
  119. * a power of 2 number of entries. */
  120. MXGEFW_CMD_SET_INTRQ_SIZE, /* in bytes */
  121. /* command to bring ethernet interface up. Above parameters
  122. * (plus mtu & mac address) must have been exchanged prior
  123. * to issuing this command */
  124. MXGEFW_CMD_ETHERNET_UP,
  125. /* command to bring ethernet interface down. No further sends
  126. * or receives may be processed until an MXGEFW_CMD_ETHERNET_UP
  127. * is issued, and all interrupt queues must be flushed prior
  128. * to ack'ing this command */
  129. MXGEFW_CMD_ETHERNET_DOWN,
  130. /* commands the driver may issue live, without resetting
  131. * the nic. Note that increasing the mtu "live" should
  132. * only be done if the driver has already supplied buffers
  133. * sufficiently large to handle the new mtu. Decreasing
  134. * the mtu live is safe */
  135. MXGEFW_CMD_SET_MTU,
  136. MXGEFW_CMD_GET_INTR_COAL_DELAY_OFFSET, /* in microseconds */
  137. MXGEFW_CMD_SET_STATS_INTERVAL, /* in microseconds */
  138. MXGEFW_CMD_SET_STATS_DMA_OBSOLETE, /* replaced by SET_STATS_DMA_V2 */
  139. MXGEFW_ENABLE_PROMISC,
  140. MXGEFW_DISABLE_PROMISC,
  141. MXGEFW_SET_MAC_ADDRESS,
  142. MXGEFW_ENABLE_FLOW_CONTROL,
  143. MXGEFW_DISABLE_FLOW_CONTROL,
  144. /* do a DMA test
  145. * data0,data1 = DMA address
  146. * data2 = RDMA length (MSH), WDMA length (LSH)
  147. * command return data = repetitions (MSH), 0.5-ms ticks (LSH)
  148. */
  149. MXGEFW_DMA_TEST,
  150. MXGEFW_ENABLE_ALLMULTI,
  151. MXGEFW_DISABLE_ALLMULTI,
  152. /* returns MXGEFW_CMD_ERROR_MULTICAST
  153. * if there is no room in the cache
  154. * data0,MSH(data1) = multicast group address */
  155. MXGEFW_JOIN_MULTICAST_GROUP,
  156. /* returns MXGEFW_CMD_ERROR_MULTICAST
  157. * if the address is not in the cache,
  158. * or is equal to FF-FF-FF-FF-FF-FF
  159. * data0,MSH(data1) = multicast group address */
  160. MXGEFW_LEAVE_MULTICAST_GROUP,
  161. MXGEFW_LEAVE_ALL_MULTICAST_GROUPS,
  162. MXGEFW_CMD_SET_STATS_DMA_V2,
  163. /* data0, data1 = bus addr,
  164. * data2 = sizeof(struct mcp_irq_data) from driver point of view, allows
  165. * adding new stuff to mcp_irq_data without changing the ABI */
  166. MXGEFW_CMD_UNALIGNED_TEST,
  167. /* same than DMA_TEST (same args) but abort with UNALIGNED on unaligned
  168. * chipset */
  169. MXGEFW_CMD_UNALIGNED_STATUS
  170. /* return data = boolean, true if the chipset is known to be unaligned */
  171. };
  172. enum myri10ge_mcp_cmd_status {
  173. MXGEFW_CMD_OK = 0,
  174. MXGEFW_CMD_UNKNOWN,
  175. MXGEFW_CMD_ERROR_RANGE,
  176. MXGEFW_CMD_ERROR_BUSY,
  177. MXGEFW_CMD_ERROR_EMPTY,
  178. MXGEFW_CMD_ERROR_CLOSED,
  179. MXGEFW_CMD_ERROR_HASH_ERROR,
  180. MXGEFW_CMD_ERROR_BAD_PORT,
  181. MXGEFW_CMD_ERROR_RESOURCES,
  182. MXGEFW_CMD_ERROR_MULTICAST,
  183. MXGEFW_CMD_ERROR_UNALIGNED
  184. };
  185. #define MXGEFW_OLD_IRQ_DATA_LEN 40
  186. struct mcp_irq_data {
  187. /* add new counters at the beginning */
  188. __be32 future_use[1];
  189. __be32 dropped_pause;
  190. __be32 dropped_unicast_filtered;
  191. __be32 dropped_bad_crc32;
  192. __be32 dropped_bad_phy;
  193. __be32 dropped_multicast_filtered;
  194. /* 40 Bytes */
  195. __be32 send_done_count;
  196. #define MXGEFW_LINK_DOWN 0
  197. #define MXGEFW_LINK_UP 1
  198. #define MXGEFW_LINK_MYRINET 2
  199. #define MXGEFW_LINK_UNKNOWN 3
  200. __be32 link_up;
  201. __be32 dropped_link_overflow;
  202. __be32 dropped_link_error_or_filtered;
  203. __be32 dropped_runt;
  204. __be32 dropped_overrun;
  205. __be32 dropped_no_small_buffer;
  206. __be32 dropped_no_big_buffer;
  207. __be32 rdma_tags_available;
  208. u8 tx_stopped;
  209. u8 link_down;
  210. u8 stats_updated;
  211. u8 valid;
  212. };
  213. #endif /* __MYRI10GE_MCP_H__ */