qlcnic_hw.h 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. /*
  2. * QLogic qlcnic NIC Driver
  3. * Copyright (c) 2009-2013 QLogic Corporation
  4. *
  5. * See LICENSE.qlcnic for copyright and licensing details.
  6. */
  7. #ifndef __QLCNIC_HW_H
  8. #define __QLCNIC_HW_H
  9. /* Common registers in 83xx and 82xx */
  10. enum qlcnic_regs {
  11. QLCNIC_PEG_HALT_STATUS1 = 0,
  12. QLCNIC_PEG_HALT_STATUS2,
  13. QLCNIC_PEG_ALIVE_COUNTER,
  14. QLCNIC_FLASH_LOCK_OWNER,
  15. QLCNIC_FW_CAPABILITIES,
  16. QLCNIC_CRB_DRV_ACTIVE,
  17. QLCNIC_CRB_DEV_STATE,
  18. QLCNIC_CRB_DRV_STATE,
  19. QLCNIC_CRB_DRV_SCRATCH,
  20. QLCNIC_CRB_DEV_PARTITION_INFO,
  21. QLCNIC_CRB_DRV_IDC_VER,
  22. QLCNIC_FW_VERSION_MAJOR,
  23. QLCNIC_FW_VERSION_MINOR,
  24. QLCNIC_FW_VERSION_SUB,
  25. QLCNIC_CRB_DEV_NPAR_STATE,
  26. QLCNIC_FW_IMG_VALID,
  27. QLCNIC_CMDPEG_STATE,
  28. QLCNIC_RCVPEG_STATE,
  29. QLCNIC_ASIC_TEMP,
  30. QLCNIC_FW_API,
  31. QLCNIC_DRV_OP_MODE,
  32. QLCNIC_FLASH_LOCK,
  33. QLCNIC_FLASH_UNLOCK,
  34. };
  35. /* Read from an address offset from BAR0, existing registers */
  36. #define QLC_SHARED_REG_RD32(a, addr) \
  37. readl(((a)->ahw->pci_base0) + ((a)->ahw->reg_tbl[addr]))
  38. /* Write to an address offset from BAR0, existing registers */
  39. #define QLC_SHARED_REG_WR32(a, addr, value) \
  40. writel(value, ((a)->ahw->pci_base0) + ((a)->ahw->reg_tbl[addr]))
  41. /* Read from a direct address offset from BAR0, additional registers */
  42. #define QLCRDX(ahw, addr) \
  43. readl(((ahw)->pci_base0) + ((ahw)->ext_reg_tbl[addr]))
  44. /* Write to a direct address offset from BAR0, additional registers */
  45. #define QLCWRX(ahw, addr, value) \
  46. writel(value, (((ahw)->pci_base0) + ((ahw)->ext_reg_tbl[addr])))
  47. #define QLCNIC_CMD_CONFIGURE_IP_ADDR 0x1
  48. #define QLCNIC_CMD_CONFIG_INTRPT 0x2
  49. #define QLCNIC_CMD_CREATE_RX_CTX 0x7
  50. #define QLCNIC_CMD_DESTROY_RX_CTX 0x8
  51. #define QLCNIC_CMD_CREATE_TX_CTX 0x9
  52. #define QLCNIC_CMD_DESTROY_TX_CTX 0xa
  53. #define QLCNIC_CMD_CONFIGURE_LRO 0xC
  54. #define QLCNIC_CMD_CONFIGURE_MAC_LEARNING 0xD
  55. #define QLCNIC_CMD_GET_STATISTICS 0xF
  56. #define QLCNIC_CMD_INTRPT_TEST 0x11
  57. #define QLCNIC_CMD_SET_MTU 0x12
  58. #define QLCNIC_CMD_READ_PHY 0x13
  59. #define QLCNIC_CMD_WRITE_PHY 0x14
  60. #define QLCNIC_CMD_READ_HW_REG 0x15
  61. #define QLCNIC_CMD_GET_FLOW_CTL 0x16
  62. #define QLCNIC_CMD_SET_FLOW_CTL 0x17
  63. #define QLCNIC_CMD_READ_MAX_MTU 0x18
  64. #define QLCNIC_CMD_READ_MAX_LRO 0x19
  65. #define QLCNIC_CMD_MAC_ADDRESS 0x1f
  66. #define QLCNIC_CMD_GET_PCI_INFO 0x20
  67. #define QLCNIC_CMD_GET_NIC_INFO 0x21
  68. #define QLCNIC_CMD_SET_NIC_INFO 0x22
  69. #define QLCNIC_CMD_GET_ESWITCH_CAPABILITY 0x24
  70. #define QLCNIC_CMD_TOGGLE_ESWITCH 0x25
  71. #define QLCNIC_CMD_GET_ESWITCH_STATUS 0x26
  72. #define QLCNIC_CMD_SET_PORTMIRRORING 0x27
  73. #define QLCNIC_CMD_CONFIGURE_ESWITCH 0x28
  74. #define QLCNIC_CMD_GET_ESWITCH_PORT_CONFIG 0x29
  75. #define QLCNIC_CMD_GET_ESWITCH_STATS 0x2a
  76. #define QLCNIC_CMD_CONFIG_PORT 0x2e
  77. #define QLCNIC_CMD_TEMP_SIZE 0x2f
  78. #define QLCNIC_CMD_GET_TEMP_HDR 0x30
  79. #define QLCNIC_CMD_BC_EVENT_SETUP 0x31
  80. #define QLCNIC_CMD_CONFIG_VPORT 0x32
  81. #define QLCNIC_CMD_DCB_QUERY_CAP 0x34
  82. #define QLCNIC_CMD_DCB_QUERY_PARAM 0x35
  83. #define QLCNIC_CMD_GET_MAC_STATS 0x37
  84. #define QLCNIC_CMD_82XX_SET_DRV_VER 0x38
  85. #define QLCNIC_CMD_MQ_TX_CONFIG_INTR 0x39
  86. #define QLCNIC_CMD_GET_LED_STATUS 0x3C
  87. #define QLCNIC_CMD_CONFIGURE_RSS 0x41
  88. #define QLCNIC_CMD_CONFIG_INTR_COAL 0x43
  89. #define QLCNIC_CMD_CONFIGURE_LED 0x44
  90. #define QLCNIC_CMD_CONFIG_MAC_VLAN 0x45
  91. #define QLCNIC_CMD_GET_LINK_EVENT 0x48
  92. #define QLCNIC_CMD_CONFIGURE_MAC_RX_MODE 0x49
  93. #define QLCNIC_CMD_CONFIGURE_HW_LRO 0x4A
  94. #define QLCNIC_CMD_SET_INGRESS_ENCAP 0x4E
  95. #define QLCNIC_CMD_INIT_NIC_FUNC 0x60
  96. #define QLCNIC_CMD_STOP_NIC_FUNC 0x61
  97. #define QLCNIC_CMD_IDC_ACK 0x63
  98. #define QLCNIC_CMD_SET_PORT_CONFIG 0x66
  99. #define QLCNIC_CMD_GET_PORT_CONFIG 0x67
  100. #define QLCNIC_CMD_GET_LINK_STATUS 0x68
  101. #define QLCNIC_CMD_SET_LED_CONFIG 0x69
  102. #define QLCNIC_CMD_GET_LED_CONFIG 0x6A
  103. #define QLCNIC_CMD_83XX_SET_DRV_VER 0x6F
  104. #define QLCNIC_CMD_ADD_RCV_RINGS 0x0B
  105. #define QLCNIC_CMD_83XX_EXTEND_ISCSI_DUMP_CAP 0x37
  106. #define QLCNIC_INTRPT_INTX 1
  107. #define QLCNIC_INTRPT_MSIX 3
  108. #define QLCNIC_INTRPT_ADD 1
  109. #define QLCNIC_INTRPT_DEL 2
  110. #define QLCNIC_GET_CURRENT_MAC 1
  111. #define QLCNIC_SET_STATION_MAC 2
  112. #define QLCNIC_GET_DEFAULT_MAC 3
  113. #define QLCNIC_GET_FAC_DEF_MAC 4
  114. #define QLCNIC_SET_FAC_DEF_MAC 5
  115. #define QLCNIC_MBX_LINK_EVENT 0x8001
  116. #define QLCNIC_MBX_BC_EVENT 0x8002
  117. #define QLCNIC_MBX_COMP_EVENT 0x8100
  118. #define QLCNIC_MBX_REQUEST_EVENT 0x8101
  119. #define QLCNIC_MBX_TIME_EXTEND_EVENT 0x8102
  120. #define QLCNIC_MBX_DCBX_CONFIG_CHANGE_EVENT 0x8110
  121. #define QLCNIC_MBX_SFP_INSERT_EVENT 0x8130
  122. #define QLCNIC_MBX_SFP_REMOVE_EVENT 0x8131
  123. struct qlcnic_mailbox_metadata {
  124. u32 cmd;
  125. u32 in_args;
  126. u32 out_args;
  127. };
  128. /* Mailbox ownership */
  129. #define QLCNIC_GET_OWNER(val) ((val) & (BIT_0 | BIT_1))
  130. #define QLCNIC_SET_OWNER 1
  131. #define QLCNIC_CLR_OWNER 0
  132. #define QLCNIC_MBX_TIMEOUT 5000
  133. #define QLCNIC_MBX_RSP_OK 1
  134. #define QLCNIC_MBX_PORT_RSP_OK 0x1a
  135. #define QLCNIC_MBX_ASYNC_EVENT BIT_15
  136. /* Set HW Tx ring limit for 82xx adapter. */
  137. #define QLCNIC_MAX_HW_TX_RINGS 8
  138. #define QLCNIC_MAX_HW_VNIC_TX_RINGS 4
  139. #define QLCNIC_MAX_TX_RINGS 8
  140. #define QLCNIC_MAX_SDS_RINGS 8
  141. struct qlcnic_pci_info;
  142. struct qlcnic_info;
  143. struct qlcnic_cmd_args;
  144. struct ethtool_stats;
  145. struct pci_device_id;
  146. struct qlcnic_host_sds_ring;
  147. struct qlcnic_host_tx_ring;
  148. struct qlcnic_hardware_context;
  149. struct qlcnic_adapter;
  150. struct qlcnic_fw_dump;
  151. int qlcnic_82xx_hw_read_wx_2M(struct qlcnic_adapter *adapter, ulong, int *);
  152. int qlcnic_82xx_hw_write_wx_2M(struct qlcnic_adapter *, ulong, u32);
  153. int qlcnic_82xx_config_hw_lro(struct qlcnic_adapter *adapter, int);
  154. int qlcnic_82xx_nic_set_promisc(struct qlcnic_adapter *adapter, u32);
  155. int qlcnic_82xx_napi_add(struct qlcnic_adapter *adapter,
  156. struct net_device *netdev);
  157. void qlcnic_82xx_get_beacon_state(struct qlcnic_adapter *);
  158. void qlcnic_82xx_change_filter(struct qlcnic_adapter *adapter,
  159. u64 *uaddr, u16 vlan_id,
  160. struct qlcnic_host_tx_ring *tx_ring);
  161. int qlcnic_82xx_config_intr_coalesce(struct qlcnic_adapter *,
  162. struct ethtool_coalesce *);
  163. int qlcnic_82xx_set_rx_coalesce(struct qlcnic_adapter *);
  164. int qlcnic_82xx_config_rss(struct qlcnic_adapter *adapter, int);
  165. void qlcnic_82xx_config_ipaddr(struct qlcnic_adapter *adapter,
  166. __be32, int);
  167. int qlcnic_82xx_linkevent_request(struct qlcnic_adapter *adapter, int);
  168. void qlcnic_82xx_process_rcv_ring_diag(struct qlcnic_host_sds_ring *sds_ring);
  169. int qlcnic_82xx_clear_lb_mode(struct qlcnic_adapter *adapter, u8);
  170. int qlcnic_82xx_set_lb_mode(struct qlcnic_adapter *, u8);
  171. void qlcnic_82xx_write_crb(struct qlcnic_adapter *, char *, loff_t, size_t);
  172. void qlcnic_82xx_read_crb(struct qlcnic_adapter *, char *, loff_t, size_t);
  173. int qlcnic_82xx_issue_cmd(struct qlcnic_adapter *adapter,
  174. struct qlcnic_cmd_args *);
  175. int qlcnic_82xx_mq_intrpt(struct qlcnic_adapter *, int);
  176. int qlcnic_82xx_config_intrpt(struct qlcnic_adapter *, u8);
  177. int qlcnic_82xx_fw_cmd_create_rx_ctx(struct qlcnic_adapter *);
  178. int qlcnic_82xx_fw_cmd_create_tx_ctx(struct qlcnic_adapter *,
  179. struct qlcnic_host_tx_ring *tx_ring, int);
  180. void qlcnic_82xx_fw_cmd_del_rx_ctx(struct qlcnic_adapter *);
  181. void qlcnic_82xx_fw_cmd_del_tx_ctx(struct qlcnic_adapter *,
  182. struct qlcnic_host_tx_ring *);
  183. int qlcnic_82xx_sre_macaddr_change(struct qlcnic_adapter *, u8 *, u16, u8);
  184. int qlcnic_82xx_get_mac_address(struct qlcnic_adapter *, u8*, u8);
  185. int qlcnic_82xx_get_nic_info(struct qlcnic_adapter *, struct qlcnic_info *, u8);
  186. int qlcnic_82xx_set_nic_info(struct qlcnic_adapter *, struct qlcnic_info *);
  187. int qlcnic_82xx_get_pci_info(struct qlcnic_adapter *, struct qlcnic_pci_info*);
  188. int qlcnic_82xx_alloc_mbx_args(struct qlcnic_cmd_args *,
  189. struct qlcnic_adapter *, u32);
  190. int qlcnic_82xx_hw_write_wx_2M(struct qlcnic_adapter *, ulong, u32);
  191. int qlcnic_82xx_get_board_info(struct qlcnic_adapter *);
  192. int qlcnic_82xx_config_led(struct qlcnic_adapter *, u32, u32);
  193. void qlcnic_82xx_get_func_no(struct qlcnic_adapter *);
  194. int qlcnic_82xx_api_lock(struct qlcnic_adapter *);
  195. void qlcnic_82xx_api_unlock(struct qlcnic_adapter *);
  196. void qlcnic_82xx_napi_enable(struct qlcnic_adapter *);
  197. void qlcnic_82xx_napi_disable(struct qlcnic_adapter *);
  198. void qlcnic_82xx_napi_del(struct qlcnic_adapter *);
  199. int qlcnic_82xx_shutdown(struct pci_dev *);
  200. int qlcnic_82xx_resume(struct qlcnic_adapter *);
  201. void qlcnic_clr_all_drv_state(struct qlcnic_adapter *adapter, u8 failed);
  202. void qlcnic_fw_poll_work(struct work_struct *work);
  203. u32 qlcnic_82xx_get_saved_state(void *, u32);
  204. void qlcnic_82xx_set_saved_state(void *, u32, u32);
  205. void qlcnic_82xx_cache_tmpl_hdr_values(struct qlcnic_fw_dump *);
  206. u32 qlcnic_82xx_get_cap_size(void *, int);
  207. void qlcnic_82xx_set_sys_info(void *, int, u32);
  208. void qlcnic_82xx_store_cap_mask(void *, u32);
  209. #endif /* __QLCNIC_HW_H_ */