qlcnic_hw.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. #ifndef __QLCNIC_HW_H
  2. #define __QLCNIC_HW_H
  3. /* Common registers in 83xx and 82xx */
  4. enum qlcnic_regs {
  5. QLCNIC_PEG_HALT_STATUS1 = 0,
  6. QLCNIC_PEG_HALT_STATUS2,
  7. QLCNIC_PEG_ALIVE_COUNTER,
  8. QLCNIC_FLASH_LOCK_OWNER,
  9. QLCNIC_FW_CAPABILITIES,
  10. QLCNIC_CRB_DRV_ACTIVE,
  11. QLCNIC_CRB_DEV_STATE,
  12. QLCNIC_CRB_DRV_STATE,
  13. QLCNIC_CRB_DRV_SCRATCH,
  14. QLCNIC_CRB_DEV_PARTITION_INFO,
  15. QLCNIC_CRB_DRV_IDC_VER,
  16. QLCNIC_FW_VERSION_MAJOR,
  17. QLCNIC_FW_VERSION_MINOR,
  18. QLCNIC_FW_VERSION_SUB,
  19. QLCNIC_CRB_DEV_NPAR_STATE,
  20. QLCNIC_FW_IMG_VALID,
  21. QLCNIC_CMDPEG_STATE,
  22. QLCNIC_RCVPEG_STATE,
  23. QLCNIC_ASIC_TEMP,
  24. QLCNIC_FW_API,
  25. QLCNIC_DRV_OP_MODE,
  26. QLCNIC_FLASH_LOCK,
  27. QLCNIC_FLASH_UNLOCK,
  28. };
  29. /* Read from an address offset from BAR0, existing registers */
  30. #define QLC_SHARED_REG_RD32(a, addr) \
  31. readl(((a)->ahw->pci_base0) + ((a)->ahw->reg_tbl[addr]))
  32. /* Write to an address offset from BAR0, existing registers */
  33. #define QLC_SHARED_REG_WR32(a, addr, value) \
  34. writel(value, ((a)->ahw->pci_base0) + ((a)->ahw->reg_tbl[addr]))
  35. /* Read from a direct address offset from BAR0, additional registers */
  36. #define QLCRDX(ahw, addr) \
  37. readl(((ahw)->pci_base0) + ((ahw)->ext_reg_tbl[addr]))
  38. /* Write to a direct address offset from BAR0, additional registers */
  39. #define QLCWRX(ahw, addr, value) \
  40. writel(value, (((ahw)->pci_base0) + ((ahw)->ext_reg_tbl[addr])))
  41. #define QLCNIC_CMD_CONFIGURE_IP_ADDR 0x1
  42. #define QLCNIC_CMD_CONFIG_INTRPT 0x2
  43. #define QLCNIC_CMD_CREATE_RX_CTX 0x7
  44. #define QLCNIC_CMD_DESTROY_RX_CTX 0x8
  45. #define QLCNIC_CMD_CREATE_TX_CTX 0x9
  46. #define QLCNIC_CMD_DESTROY_TX_CTX 0xa
  47. #define QLCNIC_CMD_CONFIGURE_LRO 0xC
  48. #define QLCNIC_CMD_CONFIGURE_MAC_LEARNING 0xD
  49. #define QLCNIC_CMD_GET_STATISTICS 0xF
  50. #define QLCNIC_CMD_INTRPT_TEST 0x11
  51. #define QLCNIC_CMD_SET_MTU 0x12
  52. #define QLCNIC_CMD_READ_PHY 0x13
  53. #define QLCNIC_CMD_WRITE_PHY 0x14
  54. #define QLCNIC_CMD_READ_HW_REG 0x15
  55. #define QLCNIC_CMD_GET_FLOW_CTL 0x16
  56. #define QLCNIC_CMD_SET_FLOW_CTL 0x17
  57. #define QLCNIC_CMD_READ_MAX_MTU 0x18
  58. #define QLCNIC_CMD_READ_MAX_LRO 0x19
  59. #define QLCNIC_CMD_MAC_ADDRESS 0x1f
  60. #define QLCNIC_CMD_GET_PCI_INFO 0x20
  61. #define QLCNIC_CMD_GET_NIC_INFO 0x21
  62. #define QLCNIC_CMD_SET_NIC_INFO 0x22
  63. #define QLCNIC_CMD_GET_ESWITCH_CAPABILITY 0x24
  64. #define QLCNIC_CMD_TOGGLE_ESWITCH 0x25
  65. #define QLCNIC_CMD_GET_ESWITCH_STATUS 0x26
  66. #define QLCNIC_CMD_SET_PORTMIRRORING 0x27
  67. #define QLCNIC_CMD_CONFIGURE_ESWITCH 0x28
  68. #define QLCNIC_CMD_GET_ESWITCH_PORT_CONFIG 0x29
  69. #define QLCNIC_CMD_GET_ESWITCH_STATS 0x2a
  70. #define QLCNIC_CMD_CONFIG_PORT 0x2e
  71. #define QLCNIC_CMD_TEMP_SIZE 0x2f
  72. #define QLCNIC_CMD_GET_TEMP_HDR 0x30
  73. #define QLCNIC_CMD_GET_MAC_STATS 0x37
  74. #define QLCNIC_CMD_SET_DRV_VER 0x38
  75. #define QLCNIC_CMD_CONFIGURE_RSS 0x41
  76. #define QLCNIC_CMD_CONFIG_INTR_COAL 0x43
  77. #define QLCNIC_CMD_CONFIGURE_LED 0x44
  78. #define QLCNIC_CMD_CONFIG_MAC_VLAN 0x45
  79. #define QLCNIC_CMD_GET_LINK_EVENT 0x48
  80. #define QLCNIC_CMD_CONFIGURE_MAC_RX_MODE 0x49
  81. #define QLCNIC_CMD_CONFIGURE_HW_LRO 0x4A
  82. #define QLCNIC_CMD_INIT_NIC_FUNC 0x60
  83. #define QLCNIC_CMD_STOP_NIC_FUNC 0x61
  84. #define QLCNIC_CMD_IDC_ACK 0x63
  85. #define QLCNIC_CMD_SET_PORT_CONFIG 0x66
  86. #define QLCNIC_CMD_GET_PORT_CONFIG 0x67
  87. #define QLCNIC_CMD_GET_LINK_STATUS 0x68
  88. #define QLCNIC_CMD_SET_LED_CONFIG 0x69
  89. #define QLCNIC_CMD_GET_LED_CONFIG 0x6A
  90. #define QLCNIC_CMD_ADD_RCV_RINGS 0x0B
  91. #define QLCNIC_INTRPT_INTX 1
  92. #define QLCNIC_INTRPT_MSIX 3
  93. #define QLCNIC_INTRPT_ADD 1
  94. #define QLCNIC_INTRPT_DEL 2
  95. #define QLCNIC_GET_CURRENT_MAC 1
  96. #define QLCNIC_SET_STATION_MAC 2
  97. #define QLCNIC_GET_DEFAULT_MAC 3
  98. #define QLCNIC_GET_FAC_DEF_MAC 4
  99. #define QLCNIC_SET_FAC_DEF_MAC 5
  100. #define QLCNIC_MBX_LINK_EVENT 0x8001
  101. #define QLCNIC_MBX_COMP_EVENT 0x8100
  102. #define QLCNIC_MBX_REQUEST_EVENT 0x8101
  103. #define QLCNIC_MBX_TIME_EXTEND_EVENT 0x8102
  104. #define QLCNIC_MBX_SFP_INSERT_EVENT 0x8130
  105. #define QLCNIC_MBX_SFP_REMOVE_EVENT 0x8131
  106. struct qlcnic_mailbox_metadata {
  107. u32 cmd;
  108. u32 in_args;
  109. u32 out_args;
  110. };
  111. /* Mailbox ownership */
  112. #define QLCNIC_GET_OWNER(val) ((val) & (BIT_0 | BIT_1))
  113. #define QLCNIC_SET_OWNER 1
  114. #define QLCNIC_CLR_OWNER 0
  115. #define QLCNIC_MBX_TIMEOUT 10000
  116. #define QLCNIC_MBX_RSP_OK 1
  117. #define QLCNIC_MBX_PORT_RSP_OK 0x1a
  118. struct qlcnic_pci_info;
  119. struct qlcnic_info;
  120. struct qlcnic_cmd_args;
  121. struct ethtool_stats;
  122. struct pci_device_id;
  123. struct qlcnic_host_sds_ring;
  124. struct qlcnic_host_tx_ring;
  125. struct qlcnic_host_tx_ring;
  126. struct qlcnic_hardware_context;
  127. struct qlcnic_adapter;
  128. int qlcnic_82xx_start_firmware(struct qlcnic_adapter *);
  129. int qlcnic_82xx_hw_read_wx_2M(struct qlcnic_adapter *adapter, ulong);
  130. int qlcnic_82xx_hw_write_wx_2M(struct qlcnic_adapter *, ulong, u32);
  131. int qlcnic_82xx_config_hw_lro(struct qlcnic_adapter *adapter, int);
  132. int qlcnic_82xx_nic_set_promisc(struct qlcnic_adapter *adapter, u32);
  133. int qlcnic_82xx_napi_add(struct qlcnic_adapter *adapter,
  134. struct net_device *netdev);
  135. void qlcnic_82xx_change_filter(struct qlcnic_adapter *adapter,
  136. u64 *uaddr, __le16 vlan_id);
  137. void qlcnic_82xx_config_intr_coalesce(struct qlcnic_adapter *adapter);
  138. int qlcnic_82xx_config_rss(struct qlcnic_adapter *adapter, int);
  139. void qlcnic_82xx_config_ipaddr(struct qlcnic_adapter *adapter,
  140. __be32, int);
  141. int qlcnic_82xx_linkevent_request(struct qlcnic_adapter *adapter, int);
  142. void qlcnic_82xx_process_rcv_ring_diag(struct qlcnic_host_sds_ring *sds_ring);
  143. int qlcnic_82xx_clear_lb_mode(struct qlcnic_adapter *adapter, u8);
  144. int qlcnic_82xx_set_lb_mode(struct qlcnic_adapter *, u8);
  145. void qlcnic_82xx_write_crb(struct qlcnic_adapter *, char *, loff_t, size_t);
  146. void qlcnic_82xx_read_crb(struct qlcnic_adapter *, char *, loff_t, size_t);
  147. void qlcnic_82xx_dev_request_reset(struct qlcnic_adapter *, u32);
  148. int qlcnic_82xx_setup_intr(struct qlcnic_adapter *, u8);
  149. irqreturn_t qlcnic_82xx_clear_legacy_intr(struct qlcnic_adapter *);
  150. int qlcnic_82xx_issue_cmd(struct qlcnic_adapter *adapter,
  151. struct qlcnic_cmd_args *);
  152. int qlcnic_82xx_fw_cmd_create_rx_ctx(struct qlcnic_adapter *);
  153. int qlcnic_82xx_fw_cmd_create_tx_ctx(struct qlcnic_adapter *,
  154. struct qlcnic_host_tx_ring *tx_ring, int);
  155. int qlcnic_82xx_sre_macaddr_change(struct qlcnic_adapter *, u8 *, __le16, u8);
  156. int qlcnic_82xx_get_mac_address(struct qlcnic_adapter *, u8*);
  157. int qlcnic_82xx_get_nic_info(struct qlcnic_adapter *, struct qlcnic_info *, u8);
  158. int qlcnic_82xx_set_nic_info(struct qlcnic_adapter *, struct qlcnic_info *);
  159. int qlcnic_82xx_get_pci_info(struct qlcnic_adapter *, struct qlcnic_pci_info*);
  160. int qlcnic_82xx_alloc_mbx_args(struct qlcnic_cmd_args *,
  161. struct qlcnic_adapter *, u32);
  162. int qlcnic_82xx_hw_write_wx_2M(struct qlcnic_adapter *, ulong, u32);
  163. int qlcnic_82xx_get_board_info(struct qlcnic_adapter *);
  164. int qlcnic_82xx_config_led(struct qlcnic_adapter *, u32, u32);
  165. void qlcnic_82xx_get_func_no(struct qlcnic_adapter *);
  166. int qlcnic_82xx_api_lock(struct qlcnic_adapter *);
  167. void qlcnic_82xx_api_unlock(struct qlcnic_adapter *);
  168. void qlcnic_82xx_napi_enable(struct qlcnic_adapter *);
  169. void qlcnic_82xx_napi_disable(struct qlcnic_adapter *);
  170. void qlcnic_82xx_napi_del(struct qlcnic_adapter *);
  171. #endif /* __QLCNIC_HW_H_ */