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