2 * aQuantia Corporation Network Driver
3 * Copyright (C) 2014-2017 aQuantia Corporation. All rights reserved
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
10 /* File aq_hw.h: Declaration of abstract interface for NIC hardware specific
17 #include "aq_common.h"
19 #include "hw_atl/hw_atl_utils.h"
21 /* NIC H/W capabilities */
25 unsigned int hw_priv_flags
;
34 u32 hw_alive_check_addr
;
47 struct aq_hw_link_status_s
{
73 #define AQ_HW_IRQ_INVALID 0U
74 #define AQ_HW_IRQ_LEGACY 1U
75 #define AQ_HW_IRQ_MSI 2U
76 #define AQ_HW_IRQ_MSIX 3U
78 #define AQ_HW_POWER_STATE_D0 0U
79 #define AQ_HW_POWER_STATE_D3 3U
81 #define AQ_HW_FLAG_STARTED 0x00000004U
82 #define AQ_HW_FLAG_STOPPING 0x00000008U
83 #define AQ_HW_FLAG_RESETTING 0x00000010U
84 #define AQ_HW_FLAG_CLOSING 0x00000020U
85 #define AQ_HW_LINK_DOWN 0x04000000U
86 #define AQ_HW_FLAG_ERR_UNPLUG 0x40000000U
87 #define AQ_HW_FLAG_ERR_HW 0x80000000U
89 #define AQ_HW_FLAG_ERRORS (AQ_HW_FLAG_ERR_HW | AQ_HW_FLAG_ERR_UNPLUG)
91 #define AQ_NIC_FLAGS_IS_NOT_READY (AQ_NIC_FLAG_STOPPING | \
92 AQ_NIC_FLAG_RESETTING | AQ_NIC_FLAG_CLOSING | \
93 AQ_NIC_FLAG_ERR_UNPLUG | AQ_NIC_FLAG_ERR_HW)
95 #define AQ_NIC_FLAGS_IS_NOT_TX_READY (AQ_NIC_FLAGS_IS_NOT_READY | \
98 #define AQ_HW_MEDIA_TYPE_TP 1U
99 #define AQ_HW_MEDIA_TYPE_FIBRE 2U
104 struct aq_nic_cfg_s
*aq_nic_cfg
;
105 const struct aq_fw_ops
*aq_fw_ops
;
107 struct aq_hw_link_status_s aq_link_status
;
108 struct hw_aq_atl_utils_mbox mbox
;
109 struct hw_atl_stats_s last_stats
;
110 struct aq_stats_s curr_stats
;
114 unsigned int chip_features
;
120 struct hw_aq_atl_utils_fw_rpc rpc
;
124 struct aq_ring_param_s
;
129 int (*hw_ring_tx_xmit
)(struct aq_hw_s
*self
, struct aq_ring_s
*aq_ring
,
132 int (*hw_ring_rx_receive
)(struct aq_hw_s
*self
,
133 struct aq_ring_s
*aq_ring
);
135 int (*hw_ring_rx_fill
)(struct aq_hw_s
*self
, struct aq_ring_s
*aq_ring
,
136 unsigned int sw_tail_old
);
138 int (*hw_ring_tx_head_update
)(struct aq_hw_s
*self
,
139 struct aq_ring_s
*aq_ring
);
141 int (*hw_set_mac_address
)(struct aq_hw_s
*self
, u8
*mac_addr
);
143 int (*hw_reset
)(struct aq_hw_s
*self
);
145 int (*hw_init
)(struct aq_hw_s
*self
, u8
*mac_addr
);
147 int (*hw_start
)(struct aq_hw_s
*self
);
149 int (*hw_stop
)(struct aq_hw_s
*self
);
151 int (*hw_ring_tx_init
)(struct aq_hw_s
*self
, struct aq_ring_s
*aq_ring
,
152 struct aq_ring_param_s
*aq_ring_param
);
154 int (*hw_ring_tx_start
)(struct aq_hw_s
*self
,
155 struct aq_ring_s
*aq_ring
);
157 int (*hw_ring_tx_stop
)(struct aq_hw_s
*self
,
158 struct aq_ring_s
*aq_ring
);
160 int (*hw_ring_rx_init
)(struct aq_hw_s
*self
,
161 struct aq_ring_s
*aq_ring
,
162 struct aq_ring_param_s
*aq_ring_param
);
164 int (*hw_ring_rx_start
)(struct aq_hw_s
*self
,
165 struct aq_ring_s
*aq_ring
);
167 int (*hw_ring_rx_stop
)(struct aq_hw_s
*self
,
168 struct aq_ring_s
*aq_ring
);
170 int (*hw_irq_enable
)(struct aq_hw_s
*self
, u64 mask
);
172 int (*hw_irq_disable
)(struct aq_hw_s
*self
, u64 mask
);
174 int (*hw_irq_read
)(struct aq_hw_s
*self
, u64
*mask
);
176 int (*hw_packet_filter_set
)(struct aq_hw_s
*self
,
177 unsigned int packet_filter
);
179 int (*hw_multicast_list_set
)(struct aq_hw_s
*self
,
180 u8 ar_mac
[AQ_CFG_MULTICAST_ADDRESS_MAX
]
184 int (*hw_interrupt_moderation_set
)(struct aq_hw_s
*self
);
186 int (*hw_rss_set
)(struct aq_hw_s
*self
,
187 struct aq_rss_parameters
*rss_params
);
189 int (*hw_rss_hash_set
)(struct aq_hw_s
*self
,
190 struct aq_rss_parameters
*rss_params
);
192 int (*hw_get_regs
)(struct aq_hw_s
*self
,
193 const struct aq_hw_caps_s
*aq_hw_caps
,
196 struct aq_stats_s
*(*hw_get_hw_stats
)(struct aq_hw_s
*self
);
198 int (*hw_get_fw_version
)(struct aq_hw_s
*self
, u32
*fw_version
);
200 int (*hw_deinit
)(struct aq_hw_s
*self
);
202 int (*hw_set_power
)(struct aq_hw_s
*self
, unsigned int power_state
);
206 int (*init
)(struct aq_hw_s
*self
);
208 int (*reset
)(struct aq_hw_s
*self
);
210 int (*get_mac_permanent
)(struct aq_hw_s
*self
, u8
*mac
);
212 int (*set_link_speed
)(struct aq_hw_s
*self
, u32 speed
);
214 int (*set_state
)(struct aq_hw_s
*self
, enum hal_atl_utils_fw_state_e state
);
216 int (*update_link_status
)(struct aq_hw_s
*self
);
218 int (*update_stats
)(struct aq_hw_s
*self
);