Commit 4e8e1bca6e2584f2b29744f4cfdbb9bbf151d177
Committed by
Jeff Kirsher
1 parent
73d80953df
Exists in
smarc-imx_3.14.28_1.0.0_ga
and in
1 other branch
ixgbe: add new media type.
This patch adds support for a new media type fiber_fixed. This is useful to avoid all the SFP+ hot plug support path on devices who's fix fiber need not worry about such things. This patch is needed for a following patch that adds support for "fiber_fixed" devices. v2: cleaned up logging message based on feedback from David Miller Signed-off-by: Don Skidmore <donald.c.skidmore@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Showing 4 changed files with 95 additions and 7 deletions Inline Diff
drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel 10 Gigabit PCI Express Linux driver | 3 | Intel 10 Gigabit PCI Express Linux driver |
4 | Copyright(c) 1999 - 2013 Intel Corporation. | 4 | Copyright(c) 1999 - 2013 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
8 | version 2, as published by the Free Software Foundation. | 8 | version 2, as published by the Free Software Foundation. |
9 | 9 | ||
10 | This program is distributed in the hope it will be useful, but WITHOUT | 10 | This program is distributed in the hope it will be useful, but WITHOUT |
11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | 11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
12 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | 12 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
13 | more details. | 13 | more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License along with | 15 | You should have received a copy of the GNU General Public License along with |
16 | this program; if not, write to the Free Software Foundation, Inc., | 16 | this program; if not, write to the Free Software Foundation, Inc., |
17 | 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | 17 | 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. |
18 | 18 | ||
19 | The full GNU General Public License is included in this distribution in | 19 | The full GNU General Public License is included in this distribution in |
20 | the file called "COPYING". | 20 | the file called "COPYING". |
21 | 21 | ||
22 | Contact Information: | 22 | Contact Information: |
23 | e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> | 23 | e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> |
24 | Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 24 | Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
25 | 25 | ||
26 | *******************************************************************************/ | 26 | *******************************************************************************/ |
27 | 27 | ||
28 | #include <linux/pci.h> | 28 | #include <linux/pci.h> |
29 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
30 | #include <linux/sched.h> | 30 | #include <linux/sched.h> |
31 | 31 | ||
32 | #include "ixgbe.h" | 32 | #include "ixgbe.h" |
33 | #include "ixgbe_phy.h" | 33 | #include "ixgbe_phy.h" |
34 | #include "ixgbe_mbx.h" | 34 | #include "ixgbe_mbx.h" |
35 | 35 | ||
36 | #define IXGBE_82599_MAX_TX_QUEUES 128 | 36 | #define IXGBE_82599_MAX_TX_QUEUES 128 |
37 | #define IXGBE_82599_MAX_RX_QUEUES 128 | 37 | #define IXGBE_82599_MAX_RX_QUEUES 128 |
38 | #define IXGBE_82599_RAR_ENTRIES 128 | 38 | #define IXGBE_82599_RAR_ENTRIES 128 |
39 | #define IXGBE_82599_MC_TBL_SIZE 128 | 39 | #define IXGBE_82599_MC_TBL_SIZE 128 |
40 | #define IXGBE_82599_VFT_TBL_SIZE 128 | 40 | #define IXGBE_82599_VFT_TBL_SIZE 128 |
41 | #define IXGBE_82599_RX_PB_SIZE 512 | 41 | #define IXGBE_82599_RX_PB_SIZE 512 |
42 | 42 | ||
43 | static void ixgbe_disable_tx_laser_multispeed_fiber(struct ixgbe_hw *hw); | 43 | static void ixgbe_disable_tx_laser_multispeed_fiber(struct ixgbe_hw *hw); |
44 | static void ixgbe_enable_tx_laser_multispeed_fiber(struct ixgbe_hw *hw); | 44 | static void ixgbe_enable_tx_laser_multispeed_fiber(struct ixgbe_hw *hw); |
45 | static void ixgbe_flap_tx_laser_multispeed_fiber(struct ixgbe_hw *hw); | 45 | static void ixgbe_flap_tx_laser_multispeed_fiber(struct ixgbe_hw *hw); |
46 | static s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw, | 46 | static s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw, |
47 | ixgbe_link_speed speed, | 47 | ixgbe_link_speed speed, |
48 | bool autoneg_wait_to_complete); | 48 | bool autoneg_wait_to_complete); |
49 | static s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw, | 49 | static s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw, |
50 | ixgbe_link_speed speed, | 50 | ixgbe_link_speed speed, |
51 | bool autoneg_wait_to_complete); | 51 | bool autoneg_wait_to_complete); |
52 | static s32 ixgbe_start_mac_link_82599(struct ixgbe_hw *hw, | 52 | static s32 ixgbe_start_mac_link_82599(struct ixgbe_hw *hw, |
53 | bool autoneg_wait_to_complete); | 53 | bool autoneg_wait_to_complete); |
54 | static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw, | 54 | static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw, |
55 | ixgbe_link_speed speed, | 55 | ixgbe_link_speed speed, |
56 | bool autoneg_wait_to_complete); | 56 | bool autoneg_wait_to_complete); |
57 | static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw, | 57 | static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw, |
58 | ixgbe_link_speed speed, | 58 | ixgbe_link_speed speed, |
59 | bool autoneg_wait_to_complete); | 59 | bool autoneg_wait_to_complete); |
60 | static s32 ixgbe_verify_fw_version_82599(struct ixgbe_hw *hw); | 60 | static s32 ixgbe_verify_fw_version_82599(struct ixgbe_hw *hw); |
61 | 61 | ||
62 | static bool ixgbe_mng_enabled(struct ixgbe_hw *hw) | 62 | static bool ixgbe_mng_enabled(struct ixgbe_hw *hw) |
63 | { | 63 | { |
64 | u32 fwsm, manc, factps; | 64 | u32 fwsm, manc, factps; |
65 | 65 | ||
66 | fwsm = IXGBE_READ_REG(hw, IXGBE_FWSM); | 66 | fwsm = IXGBE_READ_REG(hw, IXGBE_FWSM); |
67 | if ((fwsm & IXGBE_FWSM_MODE_MASK) != IXGBE_FWSM_FW_MODE_PT) | 67 | if ((fwsm & IXGBE_FWSM_MODE_MASK) != IXGBE_FWSM_FW_MODE_PT) |
68 | return false; | 68 | return false; |
69 | 69 | ||
70 | manc = IXGBE_READ_REG(hw, IXGBE_MANC); | 70 | manc = IXGBE_READ_REG(hw, IXGBE_MANC); |
71 | if (!(manc & IXGBE_MANC_RCV_TCO_EN)) | 71 | if (!(manc & IXGBE_MANC_RCV_TCO_EN)) |
72 | return false; | 72 | return false; |
73 | 73 | ||
74 | factps = IXGBE_READ_REG(hw, IXGBE_FACTPS); | 74 | factps = IXGBE_READ_REG(hw, IXGBE_FACTPS); |
75 | if (factps & IXGBE_FACTPS_MNGCG) | 75 | if (factps & IXGBE_FACTPS_MNGCG) |
76 | return false; | 76 | return false; |
77 | 77 | ||
78 | return true; | 78 | return true; |
79 | } | 79 | } |
80 | 80 | ||
81 | static void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw) | 81 | static void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw) |
82 | { | 82 | { |
83 | struct ixgbe_mac_info *mac = &hw->mac; | 83 | struct ixgbe_mac_info *mac = &hw->mac; |
84 | 84 | ||
85 | /* enable the laser control functions for SFP+ fiber | 85 | /* enable the laser control functions for SFP+ fiber |
86 | * and MNG not enabled | 86 | * and MNG not enabled |
87 | */ | 87 | */ |
88 | if ((mac->ops.get_media_type(hw) == ixgbe_media_type_fiber) && | 88 | if ((mac->ops.get_media_type(hw) == ixgbe_media_type_fiber) && |
89 | !hw->mng_fw_enabled) { | 89 | !hw->mng_fw_enabled) { |
90 | mac->ops.disable_tx_laser = | 90 | mac->ops.disable_tx_laser = |
91 | &ixgbe_disable_tx_laser_multispeed_fiber; | 91 | &ixgbe_disable_tx_laser_multispeed_fiber; |
92 | mac->ops.enable_tx_laser = | 92 | mac->ops.enable_tx_laser = |
93 | &ixgbe_enable_tx_laser_multispeed_fiber; | 93 | &ixgbe_enable_tx_laser_multispeed_fiber; |
94 | mac->ops.flap_tx_laser = &ixgbe_flap_tx_laser_multispeed_fiber; | 94 | mac->ops.flap_tx_laser = &ixgbe_flap_tx_laser_multispeed_fiber; |
95 | } else { | 95 | } else { |
96 | mac->ops.disable_tx_laser = NULL; | 96 | mac->ops.disable_tx_laser = NULL; |
97 | mac->ops.enable_tx_laser = NULL; | 97 | mac->ops.enable_tx_laser = NULL; |
98 | mac->ops.flap_tx_laser = NULL; | 98 | mac->ops.flap_tx_laser = NULL; |
99 | } | 99 | } |
100 | 100 | ||
101 | if (hw->phy.multispeed_fiber) { | 101 | if (hw->phy.multispeed_fiber) { |
102 | /* Set up dual speed SFP+ support */ | 102 | /* Set up dual speed SFP+ support */ |
103 | mac->ops.setup_link = &ixgbe_setup_mac_link_multispeed_fiber; | 103 | mac->ops.setup_link = &ixgbe_setup_mac_link_multispeed_fiber; |
104 | } else { | 104 | } else { |
105 | if ((mac->ops.get_media_type(hw) == | 105 | if ((mac->ops.get_media_type(hw) == |
106 | ixgbe_media_type_backplane) && | 106 | ixgbe_media_type_backplane) && |
107 | (hw->phy.smart_speed == ixgbe_smart_speed_auto || | 107 | (hw->phy.smart_speed == ixgbe_smart_speed_auto || |
108 | hw->phy.smart_speed == ixgbe_smart_speed_on) && | 108 | hw->phy.smart_speed == ixgbe_smart_speed_on) && |
109 | !ixgbe_verify_lesm_fw_enabled_82599(hw)) | 109 | !ixgbe_verify_lesm_fw_enabled_82599(hw)) |
110 | mac->ops.setup_link = &ixgbe_setup_mac_link_smartspeed; | 110 | mac->ops.setup_link = &ixgbe_setup_mac_link_smartspeed; |
111 | else | 111 | else |
112 | mac->ops.setup_link = &ixgbe_setup_mac_link_82599; | 112 | mac->ops.setup_link = &ixgbe_setup_mac_link_82599; |
113 | } | 113 | } |
114 | } | 114 | } |
115 | 115 | ||
116 | static s32 ixgbe_setup_sfp_modules_82599(struct ixgbe_hw *hw) | 116 | static s32 ixgbe_setup_sfp_modules_82599(struct ixgbe_hw *hw) |
117 | { | 117 | { |
118 | s32 ret_val = 0; | 118 | s32 ret_val = 0; |
119 | u16 list_offset, data_offset, data_value; | 119 | u16 list_offset, data_offset, data_value; |
120 | bool got_lock = false; | 120 | bool got_lock = false; |
121 | 121 | ||
122 | if (hw->phy.sfp_type != ixgbe_sfp_type_unknown) { | 122 | if (hw->phy.sfp_type != ixgbe_sfp_type_unknown) { |
123 | ixgbe_init_mac_link_ops_82599(hw); | 123 | ixgbe_init_mac_link_ops_82599(hw); |
124 | 124 | ||
125 | hw->phy.ops.reset = NULL; | 125 | hw->phy.ops.reset = NULL; |
126 | 126 | ||
127 | ret_val = ixgbe_get_sfp_init_sequence_offsets(hw, &list_offset, | 127 | ret_val = ixgbe_get_sfp_init_sequence_offsets(hw, &list_offset, |
128 | &data_offset); | 128 | &data_offset); |
129 | if (ret_val != 0) | 129 | if (ret_val != 0) |
130 | goto setup_sfp_out; | 130 | goto setup_sfp_out; |
131 | 131 | ||
132 | /* PHY config will finish before releasing the semaphore */ | 132 | /* PHY config will finish before releasing the semaphore */ |
133 | ret_val = hw->mac.ops.acquire_swfw_sync(hw, | 133 | ret_val = hw->mac.ops.acquire_swfw_sync(hw, |
134 | IXGBE_GSSR_MAC_CSR_SM); | 134 | IXGBE_GSSR_MAC_CSR_SM); |
135 | if (ret_val != 0) { | 135 | if (ret_val != 0) { |
136 | ret_val = IXGBE_ERR_SWFW_SYNC; | 136 | ret_val = IXGBE_ERR_SWFW_SYNC; |
137 | goto setup_sfp_out; | 137 | goto setup_sfp_out; |
138 | } | 138 | } |
139 | 139 | ||
140 | hw->eeprom.ops.read(hw, ++data_offset, &data_value); | 140 | hw->eeprom.ops.read(hw, ++data_offset, &data_value); |
141 | while (data_value != 0xffff) { | 141 | while (data_value != 0xffff) { |
142 | IXGBE_WRITE_REG(hw, IXGBE_CORECTL, data_value); | 142 | IXGBE_WRITE_REG(hw, IXGBE_CORECTL, data_value); |
143 | IXGBE_WRITE_FLUSH(hw); | 143 | IXGBE_WRITE_FLUSH(hw); |
144 | hw->eeprom.ops.read(hw, ++data_offset, &data_value); | 144 | hw->eeprom.ops.read(hw, ++data_offset, &data_value); |
145 | } | 145 | } |
146 | 146 | ||
147 | /* Release the semaphore */ | 147 | /* Release the semaphore */ |
148 | hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_MAC_CSR_SM); | 148 | hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_MAC_CSR_SM); |
149 | /* | 149 | /* |
150 | * Delay obtaining semaphore again to allow FW access, | 150 | * Delay obtaining semaphore again to allow FW access, |
151 | * semaphore_delay is in ms usleep_range needs us. | 151 | * semaphore_delay is in ms usleep_range needs us. |
152 | */ | 152 | */ |
153 | usleep_range(hw->eeprom.semaphore_delay * 1000, | 153 | usleep_range(hw->eeprom.semaphore_delay * 1000, |
154 | hw->eeprom.semaphore_delay * 2000); | 154 | hw->eeprom.semaphore_delay * 2000); |
155 | 155 | ||
156 | /* Need SW/FW semaphore around AUTOC writes if LESM on, | 156 | /* Need SW/FW semaphore around AUTOC writes if LESM on, |
157 | * likewise reset_pipeline requires lock as it also writes | 157 | * likewise reset_pipeline requires lock as it also writes |
158 | * AUTOC. | 158 | * AUTOC. |
159 | */ | 159 | */ |
160 | if (ixgbe_verify_lesm_fw_enabled_82599(hw)) { | 160 | if (ixgbe_verify_lesm_fw_enabled_82599(hw)) { |
161 | ret_val = hw->mac.ops.acquire_swfw_sync(hw, | 161 | ret_val = hw->mac.ops.acquire_swfw_sync(hw, |
162 | IXGBE_GSSR_MAC_CSR_SM); | 162 | IXGBE_GSSR_MAC_CSR_SM); |
163 | if (ret_val) | 163 | if (ret_val) |
164 | goto setup_sfp_out; | 164 | goto setup_sfp_out; |
165 | 165 | ||
166 | got_lock = true; | 166 | got_lock = true; |
167 | } | 167 | } |
168 | 168 | ||
169 | /* Restart DSP and set SFI mode */ | 169 | /* Restart DSP and set SFI mode */ |
170 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC, ((hw->mac.orig_autoc) | | 170 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC, ((hw->mac.orig_autoc) | |
171 | IXGBE_AUTOC_LMS_10G_SERIAL)); | 171 | IXGBE_AUTOC_LMS_10G_SERIAL)); |
172 | hw->mac.cached_autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC); | 172 | hw->mac.cached_autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC); |
173 | ret_val = ixgbe_reset_pipeline_82599(hw); | 173 | ret_val = ixgbe_reset_pipeline_82599(hw); |
174 | 174 | ||
175 | if (got_lock) { | 175 | if (got_lock) { |
176 | hw->mac.ops.release_swfw_sync(hw, | 176 | hw->mac.ops.release_swfw_sync(hw, |
177 | IXGBE_GSSR_MAC_CSR_SM); | 177 | IXGBE_GSSR_MAC_CSR_SM); |
178 | got_lock = false; | 178 | got_lock = false; |
179 | } | 179 | } |
180 | 180 | ||
181 | if (ret_val) { | 181 | if (ret_val) { |
182 | hw_dbg(hw, " sfp module setup not complete\n"); | 182 | hw_dbg(hw, " sfp module setup not complete\n"); |
183 | ret_val = IXGBE_ERR_SFP_SETUP_NOT_COMPLETE; | 183 | ret_val = IXGBE_ERR_SFP_SETUP_NOT_COMPLETE; |
184 | goto setup_sfp_out; | 184 | goto setup_sfp_out; |
185 | } | 185 | } |
186 | } | 186 | } |
187 | 187 | ||
188 | setup_sfp_out: | 188 | setup_sfp_out: |
189 | return ret_val; | 189 | return ret_val; |
190 | } | 190 | } |
191 | 191 | ||
192 | static s32 ixgbe_get_invariants_82599(struct ixgbe_hw *hw) | 192 | static s32 ixgbe_get_invariants_82599(struct ixgbe_hw *hw) |
193 | { | 193 | { |
194 | struct ixgbe_mac_info *mac = &hw->mac; | 194 | struct ixgbe_mac_info *mac = &hw->mac; |
195 | 195 | ||
196 | ixgbe_init_mac_link_ops_82599(hw); | 196 | ixgbe_init_mac_link_ops_82599(hw); |
197 | 197 | ||
198 | mac->mcft_size = IXGBE_82599_MC_TBL_SIZE; | 198 | mac->mcft_size = IXGBE_82599_MC_TBL_SIZE; |
199 | mac->vft_size = IXGBE_82599_VFT_TBL_SIZE; | 199 | mac->vft_size = IXGBE_82599_VFT_TBL_SIZE; |
200 | mac->num_rar_entries = IXGBE_82599_RAR_ENTRIES; | 200 | mac->num_rar_entries = IXGBE_82599_RAR_ENTRIES; |
201 | mac->max_rx_queues = IXGBE_82599_MAX_RX_QUEUES; | 201 | mac->max_rx_queues = IXGBE_82599_MAX_RX_QUEUES; |
202 | mac->max_tx_queues = IXGBE_82599_MAX_TX_QUEUES; | 202 | mac->max_tx_queues = IXGBE_82599_MAX_TX_QUEUES; |
203 | mac->max_msix_vectors = ixgbe_get_pcie_msix_count_generic(hw); | 203 | mac->max_msix_vectors = ixgbe_get_pcie_msix_count_generic(hw); |
204 | 204 | ||
205 | return 0; | 205 | return 0; |
206 | } | 206 | } |
207 | 207 | ||
208 | /** | 208 | /** |
209 | * ixgbe_init_phy_ops_82599 - PHY/SFP specific init | 209 | * ixgbe_init_phy_ops_82599 - PHY/SFP specific init |
210 | * @hw: pointer to hardware structure | 210 | * @hw: pointer to hardware structure |
211 | * | 211 | * |
212 | * Initialize any function pointers that were not able to be | 212 | * Initialize any function pointers that were not able to be |
213 | * set during get_invariants because the PHY/SFP type was | 213 | * set during get_invariants because the PHY/SFP type was |
214 | * not known. Perform the SFP init if necessary. | 214 | * not known. Perform the SFP init if necessary. |
215 | * | 215 | * |
216 | **/ | 216 | **/ |
217 | static s32 ixgbe_init_phy_ops_82599(struct ixgbe_hw *hw) | 217 | static s32 ixgbe_init_phy_ops_82599(struct ixgbe_hw *hw) |
218 | { | 218 | { |
219 | struct ixgbe_mac_info *mac = &hw->mac; | 219 | struct ixgbe_mac_info *mac = &hw->mac; |
220 | struct ixgbe_phy_info *phy = &hw->phy; | 220 | struct ixgbe_phy_info *phy = &hw->phy; |
221 | s32 ret_val = 0; | 221 | s32 ret_val = 0; |
222 | 222 | ||
223 | /* Identify the PHY or SFP module */ | 223 | /* Identify the PHY or SFP module */ |
224 | ret_val = phy->ops.identify(hw); | 224 | ret_val = phy->ops.identify(hw); |
225 | 225 | ||
226 | /* Setup function pointers based on detected SFP module and speeds */ | 226 | /* Setup function pointers based on detected SFP module and speeds */ |
227 | ixgbe_init_mac_link_ops_82599(hw); | 227 | ixgbe_init_mac_link_ops_82599(hw); |
228 | 228 | ||
229 | /* If copper media, overwrite with copper function pointers */ | 229 | /* If copper media, overwrite with copper function pointers */ |
230 | if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper) { | 230 | if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper) { |
231 | mac->ops.setup_link = &ixgbe_setup_copper_link_82599; | 231 | mac->ops.setup_link = &ixgbe_setup_copper_link_82599; |
232 | mac->ops.get_link_capabilities = | 232 | mac->ops.get_link_capabilities = |
233 | &ixgbe_get_copper_link_capabilities_generic; | 233 | &ixgbe_get_copper_link_capabilities_generic; |
234 | } | 234 | } |
235 | 235 | ||
236 | /* Set necessary function pointers based on phy type */ | 236 | /* Set necessary function pointers based on phy type */ |
237 | switch (hw->phy.type) { | 237 | switch (hw->phy.type) { |
238 | case ixgbe_phy_tn: | 238 | case ixgbe_phy_tn: |
239 | phy->ops.check_link = &ixgbe_check_phy_link_tnx; | 239 | phy->ops.check_link = &ixgbe_check_phy_link_tnx; |
240 | phy->ops.setup_link = &ixgbe_setup_phy_link_tnx; | 240 | phy->ops.setup_link = &ixgbe_setup_phy_link_tnx; |
241 | phy->ops.get_firmware_version = | 241 | phy->ops.get_firmware_version = |
242 | &ixgbe_get_phy_firmware_version_tnx; | 242 | &ixgbe_get_phy_firmware_version_tnx; |
243 | break; | 243 | break; |
244 | default: | 244 | default: |
245 | break; | 245 | break; |
246 | } | 246 | } |
247 | 247 | ||
248 | return ret_val; | 248 | return ret_val; |
249 | } | 249 | } |
250 | 250 | ||
251 | /** | 251 | /** |
252 | * ixgbe_get_link_capabilities_82599 - Determines link capabilities | 252 | * ixgbe_get_link_capabilities_82599 - Determines link capabilities |
253 | * @hw: pointer to hardware structure | 253 | * @hw: pointer to hardware structure |
254 | * @speed: pointer to link speed | 254 | * @speed: pointer to link speed |
255 | * @autoneg: true when autoneg or autotry is enabled | 255 | * @autoneg: true when autoneg or autotry is enabled |
256 | * | 256 | * |
257 | * Determines the link capabilities by reading the AUTOC register. | 257 | * Determines the link capabilities by reading the AUTOC register. |
258 | **/ | 258 | **/ |
259 | static s32 ixgbe_get_link_capabilities_82599(struct ixgbe_hw *hw, | 259 | static s32 ixgbe_get_link_capabilities_82599(struct ixgbe_hw *hw, |
260 | ixgbe_link_speed *speed, | 260 | ixgbe_link_speed *speed, |
261 | bool *autoneg) | 261 | bool *autoneg) |
262 | { | 262 | { |
263 | s32 status = 0; | 263 | s32 status = 0; |
264 | u32 autoc = 0; | 264 | u32 autoc = 0; |
265 | 265 | ||
266 | /* Determine 1G link capabilities off of SFP+ type */ | 266 | /* Determine 1G link capabilities off of SFP+ type */ |
267 | if (hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0 || | 267 | if (hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0 || |
268 | hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1 || | 268 | hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core1 || |
269 | hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 || | 269 | hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 || |
270 | hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 || | 270 | hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1 || |
271 | hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 || | 271 | hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 || |
272 | hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1) { | 272 | hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1) { |
273 | *speed = IXGBE_LINK_SPEED_1GB_FULL; | 273 | *speed = IXGBE_LINK_SPEED_1GB_FULL; |
274 | *autoneg = true; | 274 | *autoneg = true; |
275 | goto out; | 275 | goto out; |
276 | } | 276 | } |
277 | 277 | ||
278 | /* | 278 | /* |
279 | * Determine link capabilities based on the stored value of AUTOC, | 279 | * Determine link capabilities based on the stored value of AUTOC, |
280 | * which represents EEPROM defaults. If AUTOC value has not been | 280 | * which represents EEPROM defaults. If AUTOC value has not been |
281 | * stored, use the current register value. | 281 | * stored, use the current register value. |
282 | */ | 282 | */ |
283 | if (hw->mac.orig_link_settings_stored) | 283 | if (hw->mac.orig_link_settings_stored) |
284 | autoc = hw->mac.orig_autoc; | 284 | autoc = hw->mac.orig_autoc; |
285 | else | 285 | else |
286 | autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC); | 286 | autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC); |
287 | 287 | ||
288 | switch (autoc & IXGBE_AUTOC_LMS_MASK) { | 288 | switch (autoc & IXGBE_AUTOC_LMS_MASK) { |
289 | case IXGBE_AUTOC_LMS_1G_LINK_NO_AN: | 289 | case IXGBE_AUTOC_LMS_1G_LINK_NO_AN: |
290 | *speed = IXGBE_LINK_SPEED_1GB_FULL; | 290 | *speed = IXGBE_LINK_SPEED_1GB_FULL; |
291 | *autoneg = false; | 291 | *autoneg = false; |
292 | break; | 292 | break; |
293 | 293 | ||
294 | case IXGBE_AUTOC_LMS_10G_LINK_NO_AN: | 294 | case IXGBE_AUTOC_LMS_10G_LINK_NO_AN: |
295 | *speed = IXGBE_LINK_SPEED_10GB_FULL; | 295 | *speed = IXGBE_LINK_SPEED_10GB_FULL; |
296 | *autoneg = false; | 296 | *autoneg = false; |
297 | break; | 297 | break; |
298 | 298 | ||
299 | case IXGBE_AUTOC_LMS_1G_AN: | 299 | case IXGBE_AUTOC_LMS_1G_AN: |
300 | *speed = IXGBE_LINK_SPEED_1GB_FULL; | 300 | *speed = IXGBE_LINK_SPEED_1GB_FULL; |
301 | *autoneg = true; | 301 | *autoneg = true; |
302 | break; | 302 | break; |
303 | 303 | ||
304 | case IXGBE_AUTOC_LMS_10G_SERIAL: | 304 | case IXGBE_AUTOC_LMS_10G_SERIAL: |
305 | *speed = IXGBE_LINK_SPEED_10GB_FULL; | 305 | *speed = IXGBE_LINK_SPEED_10GB_FULL; |
306 | *autoneg = false; | 306 | *autoneg = false; |
307 | break; | 307 | break; |
308 | 308 | ||
309 | case IXGBE_AUTOC_LMS_KX4_KX_KR: | 309 | case IXGBE_AUTOC_LMS_KX4_KX_KR: |
310 | case IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN: | 310 | case IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN: |
311 | *speed = IXGBE_LINK_SPEED_UNKNOWN; | 311 | *speed = IXGBE_LINK_SPEED_UNKNOWN; |
312 | if (autoc & IXGBE_AUTOC_KR_SUPP) | 312 | if (autoc & IXGBE_AUTOC_KR_SUPP) |
313 | *speed |= IXGBE_LINK_SPEED_10GB_FULL; | 313 | *speed |= IXGBE_LINK_SPEED_10GB_FULL; |
314 | if (autoc & IXGBE_AUTOC_KX4_SUPP) | 314 | if (autoc & IXGBE_AUTOC_KX4_SUPP) |
315 | *speed |= IXGBE_LINK_SPEED_10GB_FULL; | 315 | *speed |= IXGBE_LINK_SPEED_10GB_FULL; |
316 | if (autoc & IXGBE_AUTOC_KX_SUPP) | 316 | if (autoc & IXGBE_AUTOC_KX_SUPP) |
317 | *speed |= IXGBE_LINK_SPEED_1GB_FULL; | 317 | *speed |= IXGBE_LINK_SPEED_1GB_FULL; |
318 | *autoneg = true; | 318 | *autoneg = true; |
319 | break; | 319 | break; |
320 | 320 | ||
321 | case IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII: | 321 | case IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII: |
322 | *speed = IXGBE_LINK_SPEED_100_FULL; | 322 | *speed = IXGBE_LINK_SPEED_100_FULL; |
323 | if (autoc & IXGBE_AUTOC_KR_SUPP) | 323 | if (autoc & IXGBE_AUTOC_KR_SUPP) |
324 | *speed |= IXGBE_LINK_SPEED_10GB_FULL; | 324 | *speed |= IXGBE_LINK_SPEED_10GB_FULL; |
325 | if (autoc & IXGBE_AUTOC_KX4_SUPP) | 325 | if (autoc & IXGBE_AUTOC_KX4_SUPP) |
326 | *speed |= IXGBE_LINK_SPEED_10GB_FULL; | 326 | *speed |= IXGBE_LINK_SPEED_10GB_FULL; |
327 | if (autoc & IXGBE_AUTOC_KX_SUPP) | 327 | if (autoc & IXGBE_AUTOC_KX_SUPP) |
328 | *speed |= IXGBE_LINK_SPEED_1GB_FULL; | 328 | *speed |= IXGBE_LINK_SPEED_1GB_FULL; |
329 | *autoneg = true; | 329 | *autoneg = true; |
330 | break; | 330 | break; |
331 | 331 | ||
332 | case IXGBE_AUTOC_LMS_SGMII_1G_100M: | 332 | case IXGBE_AUTOC_LMS_SGMII_1G_100M: |
333 | *speed = IXGBE_LINK_SPEED_1GB_FULL | IXGBE_LINK_SPEED_100_FULL; | 333 | *speed = IXGBE_LINK_SPEED_1GB_FULL | IXGBE_LINK_SPEED_100_FULL; |
334 | *autoneg = false; | 334 | *autoneg = false; |
335 | break; | 335 | break; |
336 | 336 | ||
337 | default: | 337 | default: |
338 | status = IXGBE_ERR_LINK_SETUP; | 338 | status = IXGBE_ERR_LINK_SETUP; |
339 | goto out; | 339 | goto out; |
340 | break; | 340 | break; |
341 | } | 341 | } |
342 | 342 | ||
343 | if (hw->phy.multispeed_fiber) { | 343 | if (hw->phy.multispeed_fiber) { |
344 | *speed |= IXGBE_LINK_SPEED_10GB_FULL | | 344 | *speed |= IXGBE_LINK_SPEED_10GB_FULL | |
345 | IXGBE_LINK_SPEED_1GB_FULL; | 345 | IXGBE_LINK_SPEED_1GB_FULL; |
346 | *autoneg = true; | 346 | *autoneg = true; |
347 | } | 347 | } |
348 | 348 | ||
349 | out: | 349 | out: |
350 | return status; | 350 | return status; |
351 | } | 351 | } |
352 | 352 | ||
353 | /** | 353 | /** |
354 | * ixgbe_get_media_type_82599 - Get media type | 354 | * ixgbe_get_media_type_82599 - Get media type |
355 | * @hw: pointer to hardware structure | 355 | * @hw: pointer to hardware structure |
356 | * | 356 | * |
357 | * Returns the media type (fiber, copper, backplane) | 357 | * Returns the media type (fiber, copper, backplane) |
358 | **/ | 358 | **/ |
359 | static enum ixgbe_media_type ixgbe_get_media_type_82599(struct ixgbe_hw *hw) | 359 | static enum ixgbe_media_type ixgbe_get_media_type_82599(struct ixgbe_hw *hw) |
360 | { | 360 | { |
361 | enum ixgbe_media_type media_type; | 361 | enum ixgbe_media_type media_type; |
362 | 362 | ||
363 | /* Detect if there is a copper PHY attached. */ | 363 | /* Detect if there is a copper PHY attached. */ |
364 | switch (hw->phy.type) { | 364 | switch (hw->phy.type) { |
365 | case ixgbe_phy_cu_unknown: | 365 | case ixgbe_phy_cu_unknown: |
366 | case ixgbe_phy_tn: | 366 | case ixgbe_phy_tn: |
367 | media_type = ixgbe_media_type_copper; | 367 | media_type = ixgbe_media_type_copper; |
368 | goto out; | 368 | goto out; |
369 | default: | 369 | default: |
370 | break; | 370 | break; |
371 | } | 371 | } |
372 | 372 | ||
373 | switch (hw->device_id) { | 373 | switch (hw->device_id) { |
374 | case IXGBE_DEV_ID_82599_KX4: | 374 | case IXGBE_DEV_ID_82599_KX4: |
375 | case IXGBE_DEV_ID_82599_KX4_MEZZ: | 375 | case IXGBE_DEV_ID_82599_KX4_MEZZ: |
376 | case IXGBE_DEV_ID_82599_COMBO_BACKPLANE: | 376 | case IXGBE_DEV_ID_82599_COMBO_BACKPLANE: |
377 | case IXGBE_DEV_ID_82599_KR: | 377 | case IXGBE_DEV_ID_82599_KR: |
378 | case IXGBE_DEV_ID_82599_BACKPLANE_FCOE: | 378 | case IXGBE_DEV_ID_82599_BACKPLANE_FCOE: |
379 | case IXGBE_DEV_ID_82599_XAUI_LOM: | 379 | case IXGBE_DEV_ID_82599_XAUI_LOM: |
380 | /* Default device ID is mezzanine card KX/KX4 */ | 380 | /* Default device ID is mezzanine card KX/KX4 */ |
381 | media_type = ixgbe_media_type_backplane; | 381 | media_type = ixgbe_media_type_backplane; |
382 | break; | 382 | break; |
383 | case IXGBE_DEV_ID_82599_SFP: | 383 | case IXGBE_DEV_ID_82599_SFP: |
384 | case IXGBE_DEV_ID_82599_SFP_FCOE: | 384 | case IXGBE_DEV_ID_82599_SFP_FCOE: |
385 | case IXGBE_DEV_ID_82599_SFP_EM: | 385 | case IXGBE_DEV_ID_82599_SFP_EM: |
386 | case IXGBE_DEV_ID_82599_SFP_SF2: | 386 | case IXGBE_DEV_ID_82599_SFP_SF2: |
387 | case IXGBE_DEV_ID_82599_SFP_SF_QP: | 387 | case IXGBE_DEV_ID_82599_SFP_SF_QP: |
388 | case IXGBE_DEV_ID_82599EN_SFP: | 388 | case IXGBE_DEV_ID_82599EN_SFP: |
389 | media_type = ixgbe_media_type_fiber; | 389 | media_type = ixgbe_media_type_fiber; |
390 | break; | 390 | break; |
391 | case IXGBE_DEV_ID_82599_CX4: | 391 | case IXGBE_DEV_ID_82599_CX4: |
392 | media_type = ixgbe_media_type_cx4; | 392 | media_type = ixgbe_media_type_cx4; |
393 | break; | 393 | break; |
394 | case IXGBE_DEV_ID_82599_T3_LOM: | 394 | case IXGBE_DEV_ID_82599_T3_LOM: |
395 | media_type = ixgbe_media_type_copper; | 395 | media_type = ixgbe_media_type_copper; |
396 | break; | 396 | break; |
397 | case IXGBE_DEV_ID_82599_LS: | 397 | case IXGBE_DEV_ID_82599_LS: |
398 | media_type = ixgbe_media_type_fiber_lco; | 398 | media_type = ixgbe_media_type_fiber_lco; |
399 | break; | 399 | break; |
400 | default: | 400 | default: |
401 | media_type = ixgbe_media_type_unknown; | 401 | media_type = ixgbe_media_type_unknown; |
402 | break; | 402 | break; |
403 | } | 403 | } |
404 | out: | 404 | out: |
405 | return media_type; | 405 | return media_type; |
406 | } | 406 | } |
407 | 407 | ||
408 | /** | 408 | /** |
409 | * ixgbe_start_mac_link_82599 - Setup MAC link settings | 409 | * ixgbe_start_mac_link_82599 - Setup MAC link settings |
410 | * @hw: pointer to hardware structure | 410 | * @hw: pointer to hardware structure |
411 | * @autoneg_wait_to_complete: true when waiting for completion is needed | 411 | * @autoneg_wait_to_complete: true when waiting for completion is needed |
412 | * | 412 | * |
413 | * Configures link settings based on values in the ixgbe_hw struct. | 413 | * Configures link settings based on values in the ixgbe_hw struct. |
414 | * Restarts the link. Performs autonegotiation if needed. | 414 | * Restarts the link. Performs autonegotiation if needed. |
415 | **/ | 415 | **/ |
416 | static s32 ixgbe_start_mac_link_82599(struct ixgbe_hw *hw, | 416 | static s32 ixgbe_start_mac_link_82599(struct ixgbe_hw *hw, |
417 | bool autoneg_wait_to_complete) | 417 | bool autoneg_wait_to_complete) |
418 | { | 418 | { |
419 | u32 autoc_reg; | 419 | u32 autoc_reg; |
420 | u32 links_reg; | 420 | u32 links_reg; |
421 | u32 i; | 421 | u32 i; |
422 | s32 status = 0; | 422 | s32 status = 0; |
423 | bool got_lock = false; | 423 | bool got_lock = false; |
424 | 424 | ||
425 | if (ixgbe_verify_lesm_fw_enabled_82599(hw)) { | 425 | if (ixgbe_verify_lesm_fw_enabled_82599(hw)) { |
426 | status = hw->mac.ops.acquire_swfw_sync(hw, | 426 | status = hw->mac.ops.acquire_swfw_sync(hw, |
427 | IXGBE_GSSR_MAC_CSR_SM); | 427 | IXGBE_GSSR_MAC_CSR_SM); |
428 | if (status) | 428 | if (status) |
429 | goto out; | 429 | goto out; |
430 | 430 | ||
431 | got_lock = true; | 431 | got_lock = true; |
432 | } | 432 | } |
433 | 433 | ||
434 | /* Restart link */ | 434 | /* Restart link */ |
435 | ixgbe_reset_pipeline_82599(hw); | 435 | ixgbe_reset_pipeline_82599(hw); |
436 | 436 | ||
437 | if (got_lock) | 437 | if (got_lock) |
438 | hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_MAC_CSR_SM); | 438 | hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_MAC_CSR_SM); |
439 | 439 | ||
440 | /* Only poll for autoneg to complete if specified to do so */ | 440 | /* Only poll for autoneg to complete if specified to do so */ |
441 | if (autoneg_wait_to_complete) { | 441 | if (autoneg_wait_to_complete) { |
442 | autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC); | 442 | autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC); |
443 | if ((autoc_reg & IXGBE_AUTOC_LMS_MASK) == | 443 | if ((autoc_reg & IXGBE_AUTOC_LMS_MASK) == |
444 | IXGBE_AUTOC_LMS_KX4_KX_KR || | 444 | IXGBE_AUTOC_LMS_KX4_KX_KR || |
445 | (autoc_reg & IXGBE_AUTOC_LMS_MASK) == | 445 | (autoc_reg & IXGBE_AUTOC_LMS_MASK) == |
446 | IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN || | 446 | IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN || |
447 | (autoc_reg & IXGBE_AUTOC_LMS_MASK) == | 447 | (autoc_reg & IXGBE_AUTOC_LMS_MASK) == |
448 | IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII) { | 448 | IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII) { |
449 | links_reg = 0; /* Just in case Autoneg time = 0 */ | 449 | links_reg = 0; /* Just in case Autoneg time = 0 */ |
450 | for (i = 0; i < IXGBE_AUTO_NEG_TIME; i++) { | 450 | for (i = 0; i < IXGBE_AUTO_NEG_TIME; i++) { |
451 | links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS); | 451 | links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS); |
452 | if (links_reg & IXGBE_LINKS_KX_AN_COMP) | 452 | if (links_reg & IXGBE_LINKS_KX_AN_COMP) |
453 | break; | 453 | break; |
454 | msleep(100); | 454 | msleep(100); |
455 | } | 455 | } |
456 | if (!(links_reg & IXGBE_LINKS_KX_AN_COMP)) { | 456 | if (!(links_reg & IXGBE_LINKS_KX_AN_COMP)) { |
457 | status = IXGBE_ERR_AUTONEG_NOT_COMPLETE; | 457 | status = IXGBE_ERR_AUTONEG_NOT_COMPLETE; |
458 | hw_dbg(hw, "Autoneg did not complete.\n"); | 458 | hw_dbg(hw, "Autoneg did not complete.\n"); |
459 | } | 459 | } |
460 | } | 460 | } |
461 | } | 461 | } |
462 | 462 | ||
463 | /* Add delay to filter out noises during initial link setup */ | 463 | /* Add delay to filter out noises during initial link setup */ |
464 | msleep(50); | 464 | msleep(50); |
465 | 465 | ||
466 | out: | 466 | out: |
467 | return status; | 467 | return status; |
468 | } | 468 | } |
469 | 469 | ||
470 | /** | 470 | /** |
471 | * ixgbe_disable_tx_laser_multispeed_fiber - Disable Tx laser | 471 | * ixgbe_disable_tx_laser_multispeed_fiber - Disable Tx laser |
472 | * @hw: pointer to hardware structure | 472 | * @hw: pointer to hardware structure |
473 | * | 473 | * |
474 | * The base drivers may require better control over SFP+ module | 474 | * The base drivers may require better control over SFP+ module |
475 | * PHY states. This includes selectively shutting down the Tx | 475 | * PHY states. This includes selectively shutting down the Tx |
476 | * laser on the PHY, effectively halting physical link. | 476 | * laser on the PHY, effectively halting physical link. |
477 | **/ | 477 | **/ |
478 | static void ixgbe_disable_tx_laser_multispeed_fiber(struct ixgbe_hw *hw) | 478 | static void ixgbe_disable_tx_laser_multispeed_fiber(struct ixgbe_hw *hw) |
479 | { | 479 | { |
480 | u32 esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP); | 480 | u32 esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP); |
481 | 481 | ||
482 | /* Disable tx laser; allow 100us to go dark per spec */ | 482 | /* Disable tx laser; allow 100us to go dark per spec */ |
483 | esdp_reg |= IXGBE_ESDP_SDP3; | 483 | esdp_reg |= IXGBE_ESDP_SDP3; |
484 | IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg); | 484 | IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg); |
485 | IXGBE_WRITE_FLUSH(hw); | 485 | IXGBE_WRITE_FLUSH(hw); |
486 | udelay(100); | 486 | udelay(100); |
487 | } | 487 | } |
488 | 488 | ||
489 | /** | 489 | /** |
490 | * ixgbe_enable_tx_laser_multispeed_fiber - Enable Tx laser | 490 | * ixgbe_enable_tx_laser_multispeed_fiber - Enable Tx laser |
491 | * @hw: pointer to hardware structure | 491 | * @hw: pointer to hardware structure |
492 | * | 492 | * |
493 | * The base drivers may require better control over SFP+ module | 493 | * The base drivers may require better control over SFP+ module |
494 | * PHY states. This includes selectively turning on the Tx | 494 | * PHY states. This includes selectively turning on the Tx |
495 | * laser on the PHY, effectively starting physical link. | 495 | * laser on the PHY, effectively starting physical link. |
496 | **/ | 496 | **/ |
497 | static void ixgbe_enable_tx_laser_multispeed_fiber(struct ixgbe_hw *hw) | 497 | static void ixgbe_enable_tx_laser_multispeed_fiber(struct ixgbe_hw *hw) |
498 | { | 498 | { |
499 | u32 esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP); | 499 | u32 esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP); |
500 | 500 | ||
501 | /* Enable tx laser; allow 100ms to light up */ | 501 | /* Enable tx laser; allow 100ms to light up */ |
502 | esdp_reg &= ~IXGBE_ESDP_SDP3; | 502 | esdp_reg &= ~IXGBE_ESDP_SDP3; |
503 | IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg); | 503 | IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg); |
504 | IXGBE_WRITE_FLUSH(hw); | 504 | IXGBE_WRITE_FLUSH(hw); |
505 | msleep(100); | 505 | msleep(100); |
506 | } | 506 | } |
507 | 507 | ||
508 | /** | 508 | /** |
509 | * ixgbe_flap_tx_laser_multispeed_fiber - Flap Tx laser | 509 | * ixgbe_flap_tx_laser_multispeed_fiber - Flap Tx laser |
510 | * @hw: pointer to hardware structure | 510 | * @hw: pointer to hardware structure |
511 | * | 511 | * |
512 | * When the driver changes the link speeds that it can support, | 512 | * When the driver changes the link speeds that it can support, |
513 | * it sets autotry_restart to true to indicate that we need to | 513 | * it sets autotry_restart to true to indicate that we need to |
514 | * initiate a new autotry session with the link partner. To do | 514 | * initiate a new autotry session with the link partner. To do |
515 | * so, we set the speed then disable and re-enable the tx laser, to | 515 | * so, we set the speed then disable and re-enable the tx laser, to |
516 | * alert the link partner that it also needs to restart autotry on its | 516 | * alert the link partner that it also needs to restart autotry on its |
517 | * end. This is consistent with true clause 37 autoneg, which also | 517 | * end. This is consistent with true clause 37 autoneg, which also |
518 | * involves a loss of signal. | 518 | * involves a loss of signal. |
519 | **/ | 519 | **/ |
520 | static void ixgbe_flap_tx_laser_multispeed_fiber(struct ixgbe_hw *hw) | 520 | static void ixgbe_flap_tx_laser_multispeed_fiber(struct ixgbe_hw *hw) |
521 | { | 521 | { |
522 | if (hw->mac.autotry_restart) { | 522 | if (hw->mac.autotry_restart) { |
523 | ixgbe_disable_tx_laser_multispeed_fiber(hw); | 523 | ixgbe_disable_tx_laser_multispeed_fiber(hw); |
524 | ixgbe_enable_tx_laser_multispeed_fiber(hw); | 524 | ixgbe_enable_tx_laser_multispeed_fiber(hw); |
525 | hw->mac.autotry_restart = false; | 525 | hw->mac.autotry_restart = false; |
526 | } | 526 | } |
527 | } | 527 | } |
528 | 528 | ||
529 | /** | 529 | /** |
530 | * ixgbe_set_fiber_fixed_speed - Set module link speed for fixed fiber | ||
531 | * @hw: pointer to hardware structure | ||
532 | * @speed: link speed to set | ||
533 | * | ||
534 | * We set the module speed differently for fixed fiber. For other | ||
535 | * multi-speed devices we don't have an error value so here if we | ||
536 | * detect an error we just log it and exit. | ||
537 | */ | ||
538 | static void ixgbe_set_fiber_fixed_speed(struct ixgbe_hw *hw, | ||
539 | ixgbe_link_speed speed) | ||
540 | { | ||
541 | s32 status; | ||
542 | u8 rs, eeprom_data; | ||
543 | |||
544 | switch (speed) { | ||
545 | case IXGBE_LINK_SPEED_10GB_FULL: | ||
546 | /* one bit mask same as setting on */ | ||
547 | rs = IXGBE_SFF_SOFT_RS_SELECT_10G; | ||
548 | break; | ||
549 | case IXGBE_LINK_SPEED_1GB_FULL: | ||
550 | rs = IXGBE_SFF_SOFT_RS_SELECT_1G; | ||
551 | break; | ||
552 | default: | ||
553 | hw_dbg(hw, "Invalid fixed module speed\n"); | ||
554 | return; | ||
555 | } | ||
556 | |||
557 | /* Set RS0 */ | ||
558 | status = hw->phy.ops.read_i2c_byte(hw, IXGBE_SFF_SFF_8472_OSCB, | ||
559 | IXGBE_I2C_EEPROM_DEV_ADDR2, | ||
560 | &eeprom_data); | ||
561 | if (status) { | ||
562 | hw_dbg(hw, "Failed to read Rx Rate Select RS0\n"); | ||
563 | goto out; | ||
564 | } | ||
565 | |||
566 | eeprom_data = (eeprom_data & ~IXGBE_SFF_SOFT_RS_SELECT_MASK) & rs; | ||
567 | |||
568 | status = hw->phy.ops.write_i2c_byte(hw, IXGBE_SFF_SFF_8472_OSCB, | ||
569 | IXGBE_I2C_EEPROM_DEV_ADDR2, | ||
570 | eeprom_data); | ||
571 | if (status) { | ||
572 | hw_dbg(hw, "Failed to write Rx Rate Select RS0\n"); | ||
573 | goto out; | ||
574 | } | ||
575 | |||
576 | /* Set RS1 */ | ||
577 | status = hw->phy.ops.read_i2c_byte(hw, IXGBE_SFF_SFF_8472_ESCB, | ||
578 | IXGBE_I2C_EEPROM_DEV_ADDR2, | ||
579 | &eeprom_data); | ||
580 | if (status) { | ||
581 | hw_dbg(hw, "Failed to read Rx Rate Select RS1\n"); | ||
582 | goto out; | ||
583 | } | ||
584 | |||
585 | eeprom_data = (eeprom_data & ~IXGBE_SFF_SOFT_RS_SELECT_MASK) & rs; | ||
586 | |||
587 | status = hw->phy.ops.write_i2c_byte(hw, IXGBE_SFF_SFF_8472_ESCB, | ||
588 | IXGBE_I2C_EEPROM_DEV_ADDR2, | ||
589 | eeprom_data); | ||
590 | if (status) { | ||
591 | hw_dbg(hw, "Failed to write Rx Rate Select RS1\n"); | ||
592 | goto out; | ||
593 | } | ||
594 | out: | ||
595 | return; | ||
596 | } | ||
597 | |||
598 | /** | ||
530 | * ixgbe_setup_mac_link_multispeed_fiber - Set MAC link speed | 599 | * ixgbe_setup_mac_link_multispeed_fiber - Set MAC link speed |
531 | * @hw: pointer to hardware structure | 600 | * @hw: pointer to hardware structure |
532 | * @speed: new link speed | 601 | * @speed: new link speed |
533 | * @autoneg_wait_to_complete: true when waiting for completion is needed | 602 | * @autoneg_wait_to_complete: true when waiting for completion is needed |
534 | * | 603 | * |
535 | * Set the link speed in the AUTOC register and restarts link. | 604 | * Set the link speed in the AUTOC register and restarts link. |
536 | **/ | 605 | **/ |
537 | static s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw, | 606 | static s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw, |
538 | ixgbe_link_speed speed, | 607 | ixgbe_link_speed speed, |
539 | bool autoneg_wait_to_complete) | 608 | bool autoneg_wait_to_complete) |
540 | { | 609 | { |
541 | s32 status = 0; | 610 | s32 status = 0; |
542 | ixgbe_link_speed link_speed = IXGBE_LINK_SPEED_UNKNOWN; | 611 | ixgbe_link_speed link_speed = IXGBE_LINK_SPEED_UNKNOWN; |
543 | ixgbe_link_speed highest_link_speed = IXGBE_LINK_SPEED_UNKNOWN; | 612 | ixgbe_link_speed highest_link_speed = IXGBE_LINK_SPEED_UNKNOWN; |
544 | u32 speedcnt = 0; | 613 | u32 speedcnt = 0; |
545 | u32 esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP); | 614 | u32 esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP); |
546 | u32 i = 0; | 615 | u32 i = 0; |
547 | bool link_up = false; | 616 | bool link_up = false; |
548 | bool autoneg = false; | 617 | bool autoneg = false; |
549 | 618 | ||
550 | /* Mask off requested but non-supported speeds */ | 619 | /* Mask off requested but non-supported speeds */ |
551 | status = hw->mac.ops.get_link_capabilities(hw, &link_speed, | 620 | status = hw->mac.ops.get_link_capabilities(hw, &link_speed, |
552 | &autoneg); | 621 | &autoneg); |
553 | if (status != 0) | 622 | if (status != 0) |
554 | return status; | 623 | return status; |
555 | 624 | ||
556 | speed &= link_speed; | 625 | speed &= link_speed; |
557 | 626 | ||
558 | /* | 627 | /* |
559 | * Try each speed one by one, highest priority first. We do this in | 628 | * Try each speed one by one, highest priority first. We do this in |
560 | * software because 10gb fiber doesn't support speed autonegotiation. | 629 | * software because 10gb fiber doesn't support speed autonegotiation. |
561 | */ | 630 | */ |
562 | if (speed & IXGBE_LINK_SPEED_10GB_FULL) { | 631 | if (speed & IXGBE_LINK_SPEED_10GB_FULL) { |
563 | speedcnt++; | 632 | speedcnt++; |
564 | highest_link_speed = IXGBE_LINK_SPEED_10GB_FULL; | 633 | highest_link_speed = IXGBE_LINK_SPEED_10GB_FULL; |
565 | 634 | ||
566 | /* If we already have link at this speed, just jump out */ | 635 | /* If we already have link at this speed, just jump out */ |
567 | status = hw->mac.ops.check_link(hw, &link_speed, &link_up, | 636 | status = hw->mac.ops.check_link(hw, &link_speed, &link_up, |
568 | false); | 637 | false); |
569 | if (status != 0) | 638 | if (status != 0) |
570 | return status; | 639 | return status; |
571 | 640 | ||
572 | if ((link_speed == IXGBE_LINK_SPEED_10GB_FULL) && link_up) | 641 | if ((link_speed == IXGBE_LINK_SPEED_10GB_FULL) && link_up) |
573 | goto out; | 642 | goto out; |
574 | 643 | ||
575 | /* Set the module link speed */ | 644 | /* Set the module link speed */ |
576 | esdp_reg |= (IXGBE_ESDP_SDP5_DIR | IXGBE_ESDP_SDP5); | 645 | if (hw->phy.media_type == ixgbe_media_type_fiber_fixed) { |
577 | IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg); | 646 | ixgbe_set_fiber_fixed_speed(hw, |
578 | IXGBE_WRITE_FLUSH(hw); | 647 | IXGBE_LINK_SPEED_10GB_FULL); |
648 | } else { | ||
649 | esdp_reg |= (IXGBE_ESDP_SDP5_DIR | IXGBE_ESDP_SDP5); | ||
650 | IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg); | ||
651 | IXGBE_WRITE_FLUSH(hw); | ||
652 | } | ||
579 | 653 | ||
580 | /* Allow module to change analog characteristics (1G->10G) */ | 654 | /* Allow module to change analog characteristics (1G->10G) */ |
581 | msleep(40); | 655 | msleep(40); |
582 | 656 | ||
583 | status = ixgbe_setup_mac_link_82599(hw, | 657 | status = ixgbe_setup_mac_link_82599(hw, |
584 | IXGBE_LINK_SPEED_10GB_FULL, | 658 | IXGBE_LINK_SPEED_10GB_FULL, |
585 | autoneg_wait_to_complete); | 659 | autoneg_wait_to_complete); |
586 | if (status != 0) | 660 | if (status != 0) |
587 | return status; | 661 | return status; |
588 | 662 | ||
589 | /* Flap the tx laser if it has not already been done */ | 663 | /* Flap the tx laser if it has not already been done */ |
590 | if (hw->mac.ops.flap_tx_laser) | 664 | if (hw->mac.ops.flap_tx_laser) |
591 | hw->mac.ops.flap_tx_laser(hw); | 665 | hw->mac.ops.flap_tx_laser(hw); |
592 | 666 | ||
593 | /* | 667 | /* |
594 | * Wait for the controller to acquire link. Per IEEE 802.3ap, | 668 | * Wait for the controller to acquire link. Per IEEE 802.3ap, |
595 | * Section 73.10.2, we may have to wait up to 500ms if KR is | 669 | * Section 73.10.2, we may have to wait up to 500ms if KR is |
596 | * attempted. 82599 uses the same timing for 10g SFI. | 670 | * attempted. 82599 uses the same timing for 10g SFI. |
597 | */ | 671 | */ |
598 | for (i = 0; i < 5; i++) { | 672 | for (i = 0; i < 5; i++) { |
599 | /* Wait for the link partner to also set speed */ | 673 | /* Wait for the link partner to also set speed */ |
600 | msleep(100); | 674 | msleep(100); |
601 | 675 | ||
602 | /* If we have link, just jump out */ | 676 | /* If we have link, just jump out */ |
603 | status = hw->mac.ops.check_link(hw, &link_speed, | 677 | status = hw->mac.ops.check_link(hw, &link_speed, |
604 | &link_up, false); | 678 | &link_up, false); |
605 | if (status != 0) | 679 | if (status != 0) |
606 | return status; | 680 | return status; |
607 | 681 | ||
608 | if (link_up) | 682 | if (link_up) |
609 | goto out; | 683 | goto out; |
610 | } | 684 | } |
611 | } | 685 | } |
612 | 686 | ||
613 | if (speed & IXGBE_LINK_SPEED_1GB_FULL) { | 687 | if (speed & IXGBE_LINK_SPEED_1GB_FULL) { |
614 | speedcnt++; | 688 | speedcnt++; |
615 | if (highest_link_speed == IXGBE_LINK_SPEED_UNKNOWN) | 689 | if (highest_link_speed == IXGBE_LINK_SPEED_UNKNOWN) |
616 | highest_link_speed = IXGBE_LINK_SPEED_1GB_FULL; | 690 | highest_link_speed = IXGBE_LINK_SPEED_1GB_FULL; |
617 | 691 | ||
618 | /* If we already have link at this speed, just jump out */ | 692 | /* If we already have link at this speed, just jump out */ |
619 | status = hw->mac.ops.check_link(hw, &link_speed, &link_up, | 693 | status = hw->mac.ops.check_link(hw, &link_speed, &link_up, |
620 | false); | 694 | false); |
621 | if (status != 0) | 695 | if (status != 0) |
622 | return status; | 696 | return status; |
623 | 697 | ||
624 | if ((link_speed == IXGBE_LINK_SPEED_1GB_FULL) && link_up) | 698 | if ((link_speed == IXGBE_LINK_SPEED_1GB_FULL) && link_up) |
625 | goto out; | 699 | goto out; |
626 | 700 | ||
627 | /* Set the module link speed */ | 701 | /* Set the module link speed */ |
628 | esdp_reg &= ~IXGBE_ESDP_SDP5; | 702 | if (hw->phy.media_type == ixgbe_media_type_fiber_fixed) { |
629 | esdp_reg |= IXGBE_ESDP_SDP5_DIR; | 703 | ixgbe_set_fiber_fixed_speed(hw, |
630 | IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg); | 704 | IXGBE_LINK_SPEED_1GB_FULL); |
631 | IXGBE_WRITE_FLUSH(hw); | 705 | } else { |
706 | esdp_reg &= ~IXGBE_ESDP_SDP5; | ||
707 | esdp_reg |= IXGBE_ESDP_SDP5_DIR; | ||
708 | IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg); | ||
709 | IXGBE_WRITE_FLUSH(hw); | ||
710 | } | ||
632 | 711 | ||
633 | /* Allow module to change analog characteristics (10G->1G) */ | 712 | /* Allow module to change analog characteristics (10G->1G) */ |
634 | msleep(40); | 713 | msleep(40); |
635 | 714 | ||
636 | status = ixgbe_setup_mac_link_82599(hw, | 715 | status = ixgbe_setup_mac_link_82599(hw, |
637 | IXGBE_LINK_SPEED_1GB_FULL, | 716 | IXGBE_LINK_SPEED_1GB_FULL, |
638 | autoneg_wait_to_complete); | 717 | autoneg_wait_to_complete); |
639 | if (status != 0) | 718 | if (status != 0) |
640 | return status; | 719 | return status; |
641 | 720 | ||
642 | /* Flap the tx laser if it has not already been done */ | 721 | /* Flap the tx laser if it has not already been done */ |
643 | if (hw->mac.ops.flap_tx_laser) | 722 | if (hw->mac.ops.flap_tx_laser) |
644 | hw->mac.ops.flap_tx_laser(hw); | 723 | hw->mac.ops.flap_tx_laser(hw); |
645 | 724 | ||
646 | /* Wait for the link partner to also set speed */ | 725 | /* Wait for the link partner to also set speed */ |
647 | msleep(100); | 726 | msleep(100); |
648 | 727 | ||
649 | /* If we have link, just jump out */ | 728 | /* If we have link, just jump out */ |
650 | status = hw->mac.ops.check_link(hw, &link_speed, &link_up, | 729 | status = hw->mac.ops.check_link(hw, &link_speed, &link_up, |
651 | false); | 730 | false); |
652 | if (status != 0) | 731 | if (status != 0) |
653 | return status; | 732 | return status; |
654 | 733 | ||
655 | if (link_up) | 734 | if (link_up) |
656 | goto out; | 735 | goto out; |
657 | } | 736 | } |
658 | 737 | ||
659 | /* | 738 | /* |
660 | * We didn't get link. Configure back to the highest speed we tried, | 739 | * We didn't get link. Configure back to the highest speed we tried, |
661 | * (if there was more than one). We call ourselves back with just the | 740 | * (if there was more than one). We call ourselves back with just the |
662 | * single highest speed that the user requested. | 741 | * single highest speed that the user requested. |
663 | */ | 742 | */ |
664 | if (speedcnt > 1) | 743 | if (speedcnt > 1) |
665 | status = ixgbe_setup_mac_link_multispeed_fiber(hw, | 744 | status = ixgbe_setup_mac_link_multispeed_fiber(hw, |
666 | highest_link_speed, | 745 | highest_link_speed, |
667 | autoneg_wait_to_complete); | 746 | autoneg_wait_to_complete); |
668 | 747 | ||
669 | out: | 748 | out: |
670 | /* Set autoneg_advertised value based on input link speed */ | 749 | /* Set autoneg_advertised value based on input link speed */ |
671 | hw->phy.autoneg_advertised = 0; | 750 | hw->phy.autoneg_advertised = 0; |
672 | 751 | ||
673 | if (speed & IXGBE_LINK_SPEED_10GB_FULL) | 752 | if (speed & IXGBE_LINK_SPEED_10GB_FULL) |
674 | hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_10GB_FULL; | 753 | hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_10GB_FULL; |
675 | 754 | ||
676 | if (speed & IXGBE_LINK_SPEED_1GB_FULL) | 755 | if (speed & IXGBE_LINK_SPEED_1GB_FULL) |
677 | hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_1GB_FULL; | 756 | hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_1GB_FULL; |
678 | 757 | ||
679 | return status; | 758 | return status; |
680 | } | 759 | } |
681 | 760 | ||
682 | /** | 761 | /** |
683 | * ixgbe_setup_mac_link_smartspeed - Set MAC link speed using SmartSpeed | 762 | * ixgbe_setup_mac_link_smartspeed - Set MAC link speed using SmartSpeed |
684 | * @hw: pointer to hardware structure | 763 | * @hw: pointer to hardware structure |
685 | * @speed: new link speed | 764 | * @speed: new link speed |
686 | * @autoneg_wait_to_complete: true when waiting for completion is needed | 765 | * @autoneg_wait_to_complete: true when waiting for completion is needed |
687 | * | 766 | * |
688 | * Implements the Intel SmartSpeed algorithm. | 767 | * Implements the Intel SmartSpeed algorithm. |
689 | **/ | 768 | **/ |
690 | static s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw, | 769 | static s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw, |
691 | ixgbe_link_speed speed, | 770 | ixgbe_link_speed speed, |
692 | bool autoneg_wait_to_complete) | 771 | bool autoneg_wait_to_complete) |
693 | { | 772 | { |
694 | s32 status = 0; | 773 | s32 status = 0; |
695 | ixgbe_link_speed link_speed = IXGBE_LINK_SPEED_UNKNOWN; | 774 | ixgbe_link_speed link_speed = IXGBE_LINK_SPEED_UNKNOWN; |
696 | s32 i, j; | 775 | s32 i, j; |
697 | bool link_up = false; | 776 | bool link_up = false; |
698 | u32 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC); | 777 | u32 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC); |
699 | 778 | ||
700 | /* Set autoneg_advertised value based on input link speed */ | 779 | /* Set autoneg_advertised value based on input link speed */ |
701 | hw->phy.autoneg_advertised = 0; | 780 | hw->phy.autoneg_advertised = 0; |
702 | 781 | ||
703 | if (speed & IXGBE_LINK_SPEED_10GB_FULL) | 782 | if (speed & IXGBE_LINK_SPEED_10GB_FULL) |
704 | hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_10GB_FULL; | 783 | hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_10GB_FULL; |
705 | 784 | ||
706 | if (speed & IXGBE_LINK_SPEED_1GB_FULL) | 785 | if (speed & IXGBE_LINK_SPEED_1GB_FULL) |
707 | hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_1GB_FULL; | 786 | hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_1GB_FULL; |
708 | 787 | ||
709 | if (speed & IXGBE_LINK_SPEED_100_FULL) | 788 | if (speed & IXGBE_LINK_SPEED_100_FULL) |
710 | hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_100_FULL; | 789 | hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_100_FULL; |
711 | 790 | ||
712 | /* | 791 | /* |
713 | * Implement Intel SmartSpeed algorithm. SmartSpeed will reduce the | 792 | * Implement Intel SmartSpeed algorithm. SmartSpeed will reduce the |
714 | * autoneg advertisement if link is unable to be established at the | 793 | * autoneg advertisement if link is unable to be established at the |
715 | * highest negotiated rate. This can sometimes happen due to integrity | 794 | * highest negotiated rate. This can sometimes happen due to integrity |
716 | * issues with the physical media connection. | 795 | * issues with the physical media connection. |
717 | */ | 796 | */ |
718 | 797 | ||
719 | /* First, try to get link with full advertisement */ | 798 | /* First, try to get link with full advertisement */ |
720 | hw->phy.smart_speed_active = false; | 799 | hw->phy.smart_speed_active = false; |
721 | for (j = 0; j < IXGBE_SMARTSPEED_MAX_RETRIES; j++) { | 800 | for (j = 0; j < IXGBE_SMARTSPEED_MAX_RETRIES; j++) { |
722 | status = ixgbe_setup_mac_link_82599(hw, speed, | 801 | status = ixgbe_setup_mac_link_82599(hw, speed, |
723 | autoneg_wait_to_complete); | 802 | autoneg_wait_to_complete); |
724 | if (status != 0) | 803 | if (status != 0) |
725 | goto out; | 804 | goto out; |
726 | 805 | ||
727 | /* | 806 | /* |
728 | * Wait for the controller to acquire link. Per IEEE 802.3ap, | 807 | * Wait for the controller to acquire link. Per IEEE 802.3ap, |
729 | * Section 73.10.2, we may have to wait up to 500ms if KR is | 808 | * Section 73.10.2, we may have to wait up to 500ms if KR is |
730 | * attempted, or 200ms if KX/KX4/BX/BX4 is attempted, per | 809 | * attempted, or 200ms if KX/KX4/BX/BX4 is attempted, per |
731 | * Table 9 in the AN MAS. | 810 | * Table 9 in the AN MAS. |
732 | */ | 811 | */ |
733 | for (i = 0; i < 5; i++) { | 812 | for (i = 0; i < 5; i++) { |
734 | mdelay(100); | 813 | mdelay(100); |
735 | 814 | ||
736 | /* If we have link, just jump out */ | 815 | /* If we have link, just jump out */ |
737 | status = hw->mac.ops.check_link(hw, &link_speed, | 816 | status = hw->mac.ops.check_link(hw, &link_speed, |
738 | &link_up, false); | 817 | &link_up, false); |
739 | if (status != 0) | 818 | if (status != 0) |
740 | goto out; | 819 | goto out; |
741 | 820 | ||
742 | if (link_up) | 821 | if (link_up) |
743 | goto out; | 822 | goto out; |
744 | } | 823 | } |
745 | } | 824 | } |
746 | 825 | ||
747 | /* | 826 | /* |
748 | * We didn't get link. If we advertised KR plus one of KX4/KX | 827 | * We didn't get link. If we advertised KR plus one of KX4/KX |
749 | * (or BX4/BX), then disable KR and try again. | 828 | * (or BX4/BX), then disable KR and try again. |
750 | */ | 829 | */ |
751 | if (((autoc_reg & IXGBE_AUTOC_KR_SUPP) == 0) || | 830 | if (((autoc_reg & IXGBE_AUTOC_KR_SUPP) == 0) || |
752 | ((autoc_reg & IXGBE_AUTOC_KX4_KX_SUPP_MASK) == 0)) | 831 | ((autoc_reg & IXGBE_AUTOC_KX4_KX_SUPP_MASK) == 0)) |
753 | goto out; | 832 | goto out; |
754 | 833 | ||
755 | /* Turn SmartSpeed on to disable KR support */ | 834 | /* Turn SmartSpeed on to disable KR support */ |
756 | hw->phy.smart_speed_active = true; | 835 | hw->phy.smart_speed_active = true; |
757 | status = ixgbe_setup_mac_link_82599(hw, speed, | 836 | status = ixgbe_setup_mac_link_82599(hw, speed, |
758 | autoneg_wait_to_complete); | 837 | autoneg_wait_to_complete); |
759 | if (status != 0) | 838 | if (status != 0) |
760 | goto out; | 839 | goto out; |
761 | 840 | ||
762 | /* | 841 | /* |
763 | * Wait for the controller to acquire link. 600ms will allow for | 842 | * Wait for the controller to acquire link. 600ms will allow for |
764 | * the AN link_fail_inhibit_timer as well for multiple cycles of | 843 | * the AN link_fail_inhibit_timer as well for multiple cycles of |
765 | * parallel detect, both 10g and 1g. This allows for the maximum | 844 | * parallel detect, both 10g and 1g. This allows for the maximum |
766 | * connect attempts as defined in the AN MAS table 73-7. | 845 | * connect attempts as defined in the AN MAS table 73-7. |
767 | */ | 846 | */ |
768 | for (i = 0; i < 6; i++) { | 847 | for (i = 0; i < 6; i++) { |
769 | mdelay(100); | 848 | mdelay(100); |
770 | 849 | ||
771 | /* If we have link, just jump out */ | 850 | /* If we have link, just jump out */ |
772 | status = hw->mac.ops.check_link(hw, &link_speed, | 851 | status = hw->mac.ops.check_link(hw, &link_speed, |
773 | &link_up, false); | 852 | &link_up, false); |
774 | if (status != 0) | 853 | if (status != 0) |
775 | goto out; | 854 | goto out; |
776 | 855 | ||
777 | if (link_up) | 856 | if (link_up) |
778 | goto out; | 857 | goto out; |
779 | } | 858 | } |
780 | 859 | ||
781 | /* We didn't get link. Turn SmartSpeed back off. */ | 860 | /* We didn't get link. Turn SmartSpeed back off. */ |
782 | hw->phy.smart_speed_active = false; | 861 | hw->phy.smart_speed_active = false; |
783 | status = ixgbe_setup_mac_link_82599(hw, speed, | 862 | status = ixgbe_setup_mac_link_82599(hw, speed, |
784 | autoneg_wait_to_complete); | 863 | autoneg_wait_to_complete); |
785 | 864 | ||
786 | out: | 865 | out: |
787 | if (link_up && (link_speed == IXGBE_LINK_SPEED_1GB_FULL)) | 866 | if (link_up && (link_speed == IXGBE_LINK_SPEED_1GB_FULL)) |
788 | hw_dbg(hw, "Smartspeed has downgraded the link speed from " | 867 | hw_dbg(hw, "Smartspeed has downgraded the link speed from " |
789 | "the maximum advertised\n"); | 868 | "the maximum advertised\n"); |
790 | return status; | 869 | return status; |
791 | } | 870 | } |
792 | 871 | ||
793 | /** | 872 | /** |
794 | * ixgbe_setup_mac_link_82599 - Set MAC link speed | 873 | * ixgbe_setup_mac_link_82599 - Set MAC link speed |
795 | * @hw: pointer to hardware structure | 874 | * @hw: pointer to hardware structure |
796 | * @speed: new link speed | 875 | * @speed: new link speed |
797 | * @autoneg_wait_to_complete: true when waiting for completion is needed | 876 | * @autoneg_wait_to_complete: true when waiting for completion is needed |
798 | * | 877 | * |
799 | * Set the link speed in the AUTOC register and restarts link. | 878 | * Set the link speed in the AUTOC register and restarts link. |
800 | **/ | 879 | **/ |
801 | static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw, | 880 | static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw, |
802 | ixgbe_link_speed speed, | 881 | ixgbe_link_speed speed, |
803 | bool autoneg_wait_to_complete) | 882 | bool autoneg_wait_to_complete) |
804 | { | 883 | { |
805 | s32 status = 0; | 884 | s32 status = 0; |
806 | u32 autoc, pma_pmd_1g, link_mode, start_autoc; | 885 | u32 autoc, pma_pmd_1g, link_mode, start_autoc; |
807 | u32 autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2); | 886 | u32 autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2); |
808 | u32 orig_autoc = 0; | 887 | u32 orig_autoc = 0; |
809 | u32 pma_pmd_10g_serial = autoc2 & IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_MASK; | 888 | u32 pma_pmd_10g_serial = autoc2 & IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_MASK; |
810 | u32 links_reg; | 889 | u32 links_reg; |
811 | u32 i; | 890 | u32 i; |
812 | ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN; | 891 | ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN; |
813 | bool got_lock = false; | 892 | bool got_lock = false; |
814 | bool autoneg = false; | 893 | bool autoneg = false; |
815 | 894 | ||
816 | /* Check to see if speed passed in is supported. */ | 895 | /* Check to see if speed passed in is supported. */ |
817 | status = hw->mac.ops.get_link_capabilities(hw, &link_capabilities, | 896 | status = hw->mac.ops.get_link_capabilities(hw, &link_capabilities, |
818 | &autoneg); | 897 | &autoneg); |
819 | if (status != 0) | 898 | if (status != 0) |
820 | goto out; | 899 | goto out; |
821 | 900 | ||
822 | speed &= link_capabilities; | 901 | speed &= link_capabilities; |
823 | 902 | ||
824 | if (speed == IXGBE_LINK_SPEED_UNKNOWN) { | 903 | if (speed == IXGBE_LINK_SPEED_UNKNOWN) { |
825 | status = IXGBE_ERR_LINK_SETUP; | 904 | status = IXGBE_ERR_LINK_SETUP; |
826 | goto out; | 905 | goto out; |
827 | } | 906 | } |
828 | 907 | ||
829 | /* Use stored value (EEPROM defaults) of AUTOC to find KR/KX4 support*/ | 908 | /* Use stored value (EEPROM defaults) of AUTOC to find KR/KX4 support*/ |
830 | if (hw->mac.orig_link_settings_stored) | 909 | if (hw->mac.orig_link_settings_stored) |
831 | autoc = hw->mac.orig_autoc; | 910 | autoc = hw->mac.orig_autoc; |
832 | else | 911 | else |
833 | autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC); | 912 | autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC); |
834 | 913 | ||
835 | orig_autoc = autoc; | 914 | orig_autoc = autoc; |
836 | start_autoc = hw->mac.cached_autoc; | 915 | start_autoc = hw->mac.cached_autoc; |
837 | link_mode = autoc & IXGBE_AUTOC_LMS_MASK; | 916 | link_mode = autoc & IXGBE_AUTOC_LMS_MASK; |
838 | pma_pmd_1g = autoc & IXGBE_AUTOC_1G_PMA_PMD_MASK; | 917 | pma_pmd_1g = autoc & IXGBE_AUTOC_1G_PMA_PMD_MASK; |
839 | 918 | ||
840 | if (link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR || | 919 | if (link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR || |
841 | link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN || | 920 | link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN || |
842 | link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII) { | 921 | link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII) { |
843 | /* Set KX4/KX/KR support according to speed requested */ | 922 | /* Set KX4/KX/KR support according to speed requested */ |
844 | autoc &= ~(IXGBE_AUTOC_KX4_KX_SUPP_MASK | IXGBE_AUTOC_KR_SUPP); | 923 | autoc &= ~(IXGBE_AUTOC_KX4_KX_SUPP_MASK | IXGBE_AUTOC_KR_SUPP); |
845 | if (speed & IXGBE_LINK_SPEED_10GB_FULL) { | 924 | if (speed & IXGBE_LINK_SPEED_10GB_FULL) { |
846 | if (orig_autoc & IXGBE_AUTOC_KX4_SUPP) | 925 | if (orig_autoc & IXGBE_AUTOC_KX4_SUPP) |
847 | autoc |= IXGBE_AUTOC_KX4_SUPP; | 926 | autoc |= IXGBE_AUTOC_KX4_SUPP; |
848 | if ((orig_autoc & IXGBE_AUTOC_KR_SUPP) && | 927 | if ((orig_autoc & IXGBE_AUTOC_KR_SUPP) && |
849 | (hw->phy.smart_speed_active == false)) | 928 | (hw->phy.smart_speed_active == false)) |
850 | autoc |= IXGBE_AUTOC_KR_SUPP; | 929 | autoc |= IXGBE_AUTOC_KR_SUPP; |
851 | } | 930 | } |
852 | if (speed & IXGBE_LINK_SPEED_1GB_FULL) | 931 | if (speed & IXGBE_LINK_SPEED_1GB_FULL) |
853 | autoc |= IXGBE_AUTOC_KX_SUPP; | 932 | autoc |= IXGBE_AUTOC_KX_SUPP; |
854 | } else if ((pma_pmd_1g == IXGBE_AUTOC_1G_SFI) && | 933 | } else if ((pma_pmd_1g == IXGBE_AUTOC_1G_SFI) && |
855 | (link_mode == IXGBE_AUTOC_LMS_1G_LINK_NO_AN || | 934 | (link_mode == IXGBE_AUTOC_LMS_1G_LINK_NO_AN || |
856 | link_mode == IXGBE_AUTOC_LMS_1G_AN)) { | 935 | link_mode == IXGBE_AUTOC_LMS_1G_AN)) { |
857 | /* Switch from 1G SFI to 10G SFI if requested */ | 936 | /* Switch from 1G SFI to 10G SFI if requested */ |
858 | if ((speed == IXGBE_LINK_SPEED_10GB_FULL) && | 937 | if ((speed == IXGBE_LINK_SPEED_10GB_FULL) && |
859 | (pma_pmd_10g_serial == IXGBE_AUTOC2_10G_SFI)) { | 938 | (pma_pmd_10g_serial == IXGBE_AUTOC2_10G_SFI)) { |
860 | autoc &= ~IXGBE_AUTOC_LMS_MASK; | 939 | autoc &= ~IXGBE_AUTOC_LMS_MASK; |
861 | autoc |= IXGBE_AUTOC_LMS_10G_SERIAL; | 940 | autoc |= IXGBE_AUTOC_LMS_10G_SERIAL; |
862 | } | 941 | } |
863 | } else if ((pma_pmd_10g_serial == IXGBE_AUTOC2_10G_SFI) && | 942 | } else if ((pma_pmd_10g_serial == IXGBE_AUTOC2_10G_SFI) && |
864 | (link_mode == IXGBE_AUTOC_LMS_10G_SERIAL)) { | 943 | (link_mode == IXGBE_AUTOC_LMS_10G_SERIAL)) { |
865 | /* Switch from 10G SFI to 1G SFI if requested */ | 944 | /* Switch from 10G SFI to 1G SFI if requested */ |
866 | if ((speed == IXGBE_LINK_SPEED_1GB_FULL) && | 945 | if ((speed == IXGBE_LINK_SPEED_1GB_FULL) && |
867 | (pma_pmd_1g == IXGBE_AUTOC_1G_SFI)) { | 946 | (pma_pmd_1g == IXGBE_AUTOC_1G_SFI)) { |
868 | autoc &= ~IXGBE_AUTOC_LMS_MASK; | 947 | autoc &= ~IXGBE_AUTOC_LMS_MASK; |
869 | if (autoneg) | 948 | if (autoneg) |
870 | autoc |= IXGBE_AUTOC_LMS_1G_AN; | 949 | autoc |= IXGBE_AUTOC_LMS_1G_AN; |
871 | else | 950 | else |
872 | autoc |= IXGBE_AUTOC_LMS_1G_LINK_NO_AN; | 951 | autoc |= IXGBE_AUTOC_LMS_1G_LINK_NO_AN; |
873 | } | 952 | } |
874 | } | 953 | } |
875 | 954 | ||
876 | if (autoc != start_autoc) { | 955 | if (autoc != start_autoc) { |
877 | /* Need SW/FW semaphore around AUTOC writes if LESM is on, | 956 | /* Need SW/FW semaphore around AUTOC writes if LESM is on, |
878 | * likewise reset_pipeline requires us to hold this lock as | 957 | * likewise reset_pipeline requires us to hold this lock as |
879 | * it also writes to AUTOC. | 958 | * it also writes to AUTOC. |
880 | */ | 959 | */ |
881 | if (ixgbe_verify_lesm_fw_enabled_82599(hw)) { | 960 | if (ixgbe_verify_lesm_fw_enabled_82599(hw)) { |
882 | status = hw->mac.ops.acquire_swfw_sync(hw, | 961 | status = hw->mac.ops.acquire_swfw_sync(hw, |
883 | IXGBE_GSSR_MAC_CSR_SM); | 962 | IXGBE_GSSR_MAC_CSR_SM); |
884 | if (status != 0) | 963 | if (status != 0) |
885 | goto out; | 964 | goto out; |
886 | 965 | ||
887 | got_lock = true; | 966 | got_lock = true; |
888 | } | 967 | } |
889 | 968 | ||
890 | /* Restart link */ | 969 | /* Restart link */ |
891 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc); | 970 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc); |
892 | hw->mac.cached_autoc = autoc; | 971 | hw->mac.cached_autoc = autoc; |
893 | ixgbe_reset_pipeline_82599(hw); | 972 | ixgbe_reset_pipeline_82599(hw); |
894 | 973 | ||
895 | if (got_lock) | 974 | if (got_lock) |
896 | hw->mac.ops.release_swfw_sync(hw, | 975 | hw->mac.ops.release_swfw_sync(hw, |
897 | IXGBE_GSSR_MAC_CSR_SM); | 976 | IXGBE_GSSR_MAC_CSR_SM); |
898 | 977 | ||
899 | /* Only poll for autoneg to complete if specified to do so */ | 978 | /* Only poll for autoneg to complete if specified to do so */ |
900 | if (autoneg_wait_to_complete) { | 979 | if (autoneg_wait_to_complete) { |
901 | if (link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR || | 980 | if (link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR || |
902 | link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN || | 981 | link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN || |
903 | link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII) { | 982 | link_mode == IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII) { |
904 | links_reg = 0; /*Just in case Autoneg time=0*/ | 983 | links_reg = 0; /*Just in case Autoneg time=0*/ |
905 | for (i = 0; i < IXGBE_AUTO_NEG_TIME; i++) { | 984 | for (i = 0; i < IXGBE_AUTO_NEG_TIME; i++) { |
906 | links_reg = | 985 | links_reg = |
907 | IXGBE_READ_REG(hw, IXGBE_LINKS); | 986 | IXGBE_READ_REG(hw, IXGBE_LINKS); |
908 | if (links_reg & IXGBE_LINKS_KX_AN_COMP) | 987 | if (links_reg & IXGBE_LINKS_KX_AN_COMP) |
909 | break; | 988 | break; |
910 | msleep(100); | 989 | msleep(100); |
911 | } | 990 | } |
912 | if (!(links_reg & IXGBE_LINKS_KX_AN_COMP)) { | 991 | if (!(links_reg & IXGBE_LINKS_KX_AN_COMP)) { |
913 | status = | 992 | status = |
914 | IXGBE_ERR_AUTONEG_NOT_COMPLETE; | 993 | IXGBE_ERR_AUTONEG_NOT_COMPLETE; |
915 | hw_dbg(hw, "Autoneg did not " | 994 | hw_dbg(hw, "Autoneg did not " |
916 | "complete.\n"); | 995 | "complete.\n"); |
917 | } | 996 | } |
918 | } | 997 | } |
919 | } | 998 | } |
920 | 999 | ||
921 | /* Add delay to filter out noises during initial link setup */ | 1000 | /* Add delay to filter out noises during initial link setup */ |
922 | msleep(50); | 1001 | msleep(50); |
923 | } | 1002 | } |
924 | 1003 | ||
925 | out: | 1004 | out: |
926 | return status; | 1005 | return status; |
927 | } | 1006 | } |
928 | 1007 | ||
929 | /** | 1008 | /** |
930 | * ixgbe_setup_copper_link_82599 - Set the PHY autoneg advertised field | 1009 | * ixgbe_setup_copper_link_82599 - Set the PHY autoneg advertised field |
931 | * @hw: pointer to hardware structure | 1010 | * @hw: pointer to hardware structure |
932 | * @speed: new link speed | 1011 | * @speed: new link speed |
933 | * @autoneg_wait_to_complete: true if waiting is needed to complete | 1012 | * @autoneg_wait_to_complete: true if waiting is needed to complete |
934 | * | 1013 | * |
935 | * Restarts link on PHY and MAC based on settings passed in. | 1014 | * Restarts link on PHY and MAC based on settings passed in. |
936 | **/ | 1015 | **/ |
937 | static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw, | 1016 | static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw, |
938 | ixgbe_link_speed speed, | 1017 | ixgbe_link_speed speed, |
939 | bool autoneg_wait_to_complete) | 1018 | bool autoneg_wait_to_complete) |
940 | { | 1019 | { |
941 | s32 status; | 1020 | s32 status; |
942 | 1021 | ||
943 | /* Setup the PHY according to input speed */ | 1022 | /* Setup the PHY according to input speed */ |
944 | status = hw->phy.ops.setup_link_speed(hw, speed, | 1023 | status = hw->phy.ops.setup_link_speed(hw, speed, |
945 | autoneg_wait_to_complete); | 1024 | autoneg_wait_to_complete); |
946 | /* Set up MAC */ | 1025 | /* Set up MAC */ |
947 | ixgbe_start_mac_link_82599(hw, autoneg_wait_to_complete); | 1026 | ixgbe_start_mac_link_82599(hw, autoneg_wait_to_complete); |
948 | 1027 | ||
949 | return status; | 1028 | return status; |
950 | } | 1029 | } |
951 | 1030 | ||
952 | /** | 1031 | /** |
953 | * ixgbe_reset_hw_82599 - Perform hardware reset | 1032 | * ixgbe_reset_hw_82599 - Perform hardware reset |
954 | * @hw: pointer to hardware structure | 1033 | * @hw: pointer to hardware structure |
955 | * | 1034 | * |
956 | * Resets the hardware by resetting the transmit and receive units, masks | 1035 | * Resets the hardware by resetting the transmit and receive units, masks |
957 | * and clears all interrupts, perform a PHY reset, and perform a link (MAC) | 1036 | * and clears all interrupts, perform a PHY reset, and perform a link (MAC) |
958 | * reset. | 1037 | * reset. |
959 | **/ | 1038 | **/ |
960 | static s32 ixgbe_reset_hw_82599(struct ixgbe_hw *hw) | 1039 | static s32 ixgbe_reset_hw_82599(struct ixgbe_hw *hw) |
961 | { | 1040 | { |
962 | ixgbe_link_speed link_speed; | 1041 | ixgbe_link_speed link_speed; |
963 | s32 status; | 1042 | s32 status; |
964 | u32 ctrl, i, autoc2; | 1043 | u32 ctrl, i, autoc2; |
965 | u32 curr_lms; | 1044 | u32 curr_lms; |
966 | bool link_up = false; | 1045 | bool link_up = false; |
967 | 1046 | ||
968 | /* Call adapter stop to disable tx/rx and clear interrupts */ | 1047 | /* Call adapter stop to disable tx/rx and clear interrupts */ |
969 | status = hw->mac.ops.stop_adapter(hw); | 1048 | status = hw->mac.ops.stop_adapter(hw); |
970 | if (status != 0) | 1049 | if (status != 0) |
971 | goto reset_hw_out; | 1050 | goto reset_hw_out; |
972 | 1051 | ||
973 | /* flush pending Tx transactions */ | 1052 | /* flush pending Tx transactions */ |
974 | ixgbe_clear_tx_pending(hw); | 1053 | ixgbe_clear_tx_pending(hw); |
975 | 1054 | ||
976 | /* PHY ops must be identified and initialized prior to reset */ | 1055 | /* PHY ops must be identified and initialized prior to reset */ |
977 | 1056 | ||
978 | /* Identify PHY and related function pointers */ | 1057 | /* Identify PHY and related function pointers */ |
979 | status = hw->phy.ops.init(hw); | 1058 | status = hw->phy.ops.init(hw); |
980 | 1059 | ||
981 | if (status == IXGBE_ERR_SFP_NOT_SUPPORTED) | 1060 | if (status == IXGBE_ERR_SFP_NOT_SUPPORTED) |
982 | goto reset_hw_out; | 1061 | goto reset_hw_out; |
983 | 1062 | ||
984 | /* Setup SFP module if there is one present. */ | 1063 | /* Setup SFP module if there is one present. */ |
985 | if (hw->phy.sfp_setup_needed) { | 1064 | if (hw->phy.sfp_setup_needed) { |
986 | status = hw->mac.ops.setup_sfp(hw); | 1065 | status = hw->mac.ops.setup_sfp(hw); |
987 | hw->phy.sfp_setup_needed = false; | 1066 | hw->phy.sfp_setup_needed = false; |
988 | } | 1067 | } |
989 | 1068 | ||
990 | if (status == IXGBE_ERR_SFP_NOT_SUPPORTED) | 1069 | if (status == IXGBE_ERR_SFP_NOT_SUPPORTED) |
991 | goto reset_hw_out; | 1070 | goto reset_hw_out; |
992 | 1071 | ||
993 | /* Reset PHY */ | 1072 | /* Reset PHY */ |
994 | if (hw->phy.reset_disable == false && hw->phy.ops.reset != NULL) | 1073 | if (hw->phy.reset_disable == false && hw->phy.ops.reset != NULL) |
995 | hw->phy.ops.reset(hw); | 1074 | hw->phy.ops.reset(hw); |
996 | 1075 | ||
997 | /* remember AUTOC from before we reset */ | 1076 | /* remember AUTOC from before we reset */ |
998 | if (hw->mac.cached_autoc) | 1077 | if (hw->mac.cached_autoc) |
999 | curr_lms = hw->mac.cached_autoc & IXGBE_AUTOC_LMS_MASK; | 1078 | curr_lms = hw->mac.cached_autoc & IXGBE_AUTOC_LMS_MASK; |
1000 | else | 1079 | else |
1001 | curr_lms = IXGBE_READ_REG(hw, IXGBE_AUTOC) & | 1080 | curr_lms = IXGBE_READ_REG(hw, IXGBE_AUTOC) & |
1002 | IXGBE_AUTOC_LMS_MASK; | 1081 | IXGBE_AUTOC_LMS_MASK; |
1003 | 1082 | ||
1004 | mac_reset_top: | 1083 | mac_reset_top: |
1005 | /* | 1084 | /* |
1006 | * Issue global reset to the MAC. Needs to be SW reset if link is up. | 1085 | * Issue global reset to the MAC. Needs to be SW reset if link is up. |
1007 | * If link reset is used when link is up, it might reset the PHY when | 1086 | * If link reset is used when link is up, it might reset the PHY when |
1008 | * mng is using it. If link is down or the flag to force full link | 1087 | * mng is using it. If link is down or the flag to force full link |
1009 | * reset is set, then perform link reset. | 1088 | * reset is set, then perform link reset. |
1010 | */ | 1089 | */ |
1011 | ctrl = IXGBE_CTRL_LNK_RST; | 1090 | ctrl = IXGBE_CTRL_LNK_RST; |
1012 | if (!hw->force_full_reset) { | 1091 | if (!hw->force_full_reset) { |
1013 | hw->mac.ops.check_link(hw, &link_speed, &link_up, false); | 1092 | hw->mac.ops.check_link(hw, &link_speed, &link_up, false); |
1014 | if (link_up) | 1093 | if (link_up) |
1015 | ctrl = IXGBE_CTRL_RST; | 1094 | ctrl = IXGBE_CTRL_RST; |
1016 | } | 1095 | } |
1017 | 1096 | ||
1018 | ctrl |= IXGBE_READ_REG(hw, IXGBE_CTRL); | 1097 | ctrl |= IXGBE_READ_REG(hw, IXGBE_CTRL); |
1019 | IXGBE_WRITE_REG(hw, IXGBE_CTRL, ctrl); | 1098 | IXGBE_WRITE_REG(hw, IXGBE_CTRL, ctrl); |
1020 | IXGBE_WRITE_FLUSH(hw); | 1099 | IXGBE_WRITE_FLUSH(hw); |
1021 | 1100 | ||
1022 | /* Poll for reset bit to self-clear indicating reset is complete */ | 1101 | /* Poll for reset bit to self-clear indicating reset is complete */ |
1023 | for (i = 0; i < 10; i++) { | 1102 | for (i = 0; i < 10; i++) { |
1024 | udelay(1); | 1103 | udelay(1); |
1025 | ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL); | 1104 | ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL); |
1026 | if (!(ctrl & IXGBE_CTRL_RST_MASK)) | 1105 | if (!(ctrl & IXGBE_CTRL_RST_MASK)) |
1027 | break; | 1106 | break; |
1028 | } | 1107 | } |
1029 | 1108 | ||
1030 | if (ctrl & IXGBE_CTRL_RST_MASK) { | 1109 | if (ctrl & IXGBE_CTRL_RST_MASK) { |
1031 | status = IXGBE_ERR_RESET_FAILED; | 1110 | status = IXGBE_ERR_RESET_FAILED; |
1032 | hw_dbg(hw, "Reset polling failed to complete.\n"); | 1111 | hw_dbg(hw, "Reset polling failed to complete.\n"); |
1033 | } | 1112 | } |
1034 | 1113 | ||
1035 | msleep(50); | 1114 | msleep(50); |
1036 | 1115 | ||
1037 | /* | 1116 | /* |
1038 | * Double resets are required for recovery from certain error | 1117 | * Double resets are required for recovery from certain error |
1039 | * conditions. Between resets, it is necessary to stall to allow time | 1118 | * conditions. Between resets, it is necessary to stall to allow time |
1040 | * for any pending HW events to complete. | 1119 | * for any pending HW events to complete. |
1041 | */ | 1120 | */ |
1042 | if (hw->mac.flags & IXGBE_FLAGS_DOUBLE_RESET_REQUIRED) { | 1121 | if (hw->mac.flags & IXGBE_FLAGS_DOUBLE_RESET_REQUIRED) { |
1043 | hw->mac.flags &= ~IXGBE_FLAGS_DOUBLE_RESET_REQUIRED; | 1122 | hw->mac.flags &= ~IXGBE_FLAGS_DOUBLE_RESET_REQUIRED; |
1044 | goto mac_reset_top; | 1123 | goto mac_reset_top; |
1045 | } | 1124 | } |
1046 | 1125 | ||
1047 | /* | 1126 | /* |
1048 | * Store the original AUTOC/AUTOC2 values if they have not been | 1127 | * Store the original AUTOC/AUTOC2 values if they have not been |
1049 | * stored off yet. Otherwise restore the stored original | 1128 | * stored off yet. Otherwise restore the stored original |
1050 | * values since the reset operation sets back to defaults. | 1129 | * values since the reset operation sets back to defaults. |
1051 | */ | 1130 | */ |
1052 | hw->mac.cached_autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC); | 1131 | hw->mac.cached_autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC); |
1053 | autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2); | 1132 | autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2); |
1054 | 1133 | ||
1055 | /* Enable link if disabled in NVM */ | 1134 | /* Enable link if disabled in NVM */ |
1056 | if (autoc2 & IXGBE_AUTOC2_LINK_DISABLE_MASK) { | 1135 | if (autoc2 & IXGBE_AUTOC2_LINK_DISABLE_MASK) { |
1057 | autoc2 &= ~IXGBE_AUTOC2_LINK_DISABLE_MASK; | 1136 | autoc2 &= ~IXGBE_AUTOC2_LINK_DISABLE_MASK; |
1058 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC2, autoc2); | 1137 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC2, autoc2); |
1059 | IXGBE_WRITE_FLUSH(hw); | 1138 | IXGBE_WRITE_FLUSH(hw); |
1060 | } | 1139 | } |
1061 | 1140 | ||
1062 | if (hw->mac.orig_link_settings_stored == false) { | 1141 | if (hw->mac.orig_link_settings_stored == false) { |
1063 | hw->mac.orig_autoc = hw->mac.cached_autoc; | 1142 | hw->mac.orig_autoc = hw->mac.cached_autoc; |
1064 | hw->mac.orig_autoc2 = autoc2; | 1143 | hw->mac.orig_autoc2 = autoc2; |
1065 | hw->mac.orig_link_settings_stored = true; | 1144 | hw->mac.orig_link_settings_stored = true; |
1066 | } else { | 1145 | } else { |
1067 | 1146 | ||
1068 | /* If MNG FW is running on a multi-speed device that | 1147 | /* If MNG FW is running on a multi-speed device that |
1069 | * doesn't autoneg with out driver support we need to | 1148 | * doesn't autoneg with out driver support we need to |
1070 | * leave LMS in the state it was before we MAC reset. | 1149 | * leave LMS in the state it was before we MAC reset. |
1071 | * Likewise if we support WoL we don't want change the | 1150 | * Likewise if we support WoL we don't want change the |
1072 | * LMS state either. | 1151 | * LMS state either. |
1073 | */ | 1152 | */ |
1074 | if ((hw->phy.multispeed_fiber && hw->mng_fw_enabled) || | 1153 | if ((hw->phy.multispeed_fiber && hw->mng_fw_enabled) || |
1075 | hw->wol_enabled) | 1154 | hw->wol_enabled) |
1076 | hw->mac.orig_autoc = | 1155 | hw->mac.orig_autoc = |
1077 | (hw->mac.orig_autoc & ~IXGBE_AUTOC_LMS_MASK) | | 1156 | (hw->mac.orig_autoc & ~IXGBE_AUTOC_LMS_MASK) | |
1078 | curr_lms; | 1157 | curr_lms; |
1079 | 1158 | ||
1080 | if (hw->mac.cached_autoc != hw->mac.orig_autoc) { | 1159 | if (hw->mac.cached_autoc != hw->mac.orig_autoc) { |
1081 | /* Need SW/FW semaphore around AUTOC writes if LESM is | 1160 | /* Need SW/FW semaphore around AUTOC writes if LESM is |
1082 | * on, likewise reset_pipeline requires us to hold | 1161 | * on, likewise reset_pipeline requires us to hold |
1083 | * this lock as it also writes to AUTOC. | 1162 | * this lock as it also writes to AUTOC. |
1084 | */ | 1163 | */ |
1085 | bool got_lock = false; | 1164 | bool got_lock = false; |
1086 | if (ixgbe_verify_lesm_fw_enabled_82599(hw)) { | 1165 | if (ixgbe_verify_lesm_fw_enabled_82599(hw)) { |
1087 | status = hw->mac.ops.acquire_swfw_sync(hw, | 1166 | status = hw->mac.ops.acquire_swfw_sync(hw, |
1088 | IXGBE_GSSR_MAC_CSR_SM); | 1167 | IXGBE_GSSR_MAC_CSR_SM); |
1089 | if (status) | 1168 | if (status) |
1090 | goto reset_hw_out; | 1169 | goto reset_hw_out; |
1091 | 1170 | ||
1092 | got_lock = true; | 1171 | got_lock = true; |
1093 | } | 1172 | } |
1094 | 1173 | ||
1095 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC, hw->mac.orig_autoc); | 1174 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC, hw->mac.orig_autoc); |
1096 | hw->mac.cached_autoc = hw->mac.orig_autoc; | 1175 | hw->mac.cached_autoc = hw->mac.orig_autoc; |
1097 | ixgbe_reset_pipeline_82599(hw); | 1176 | ixgbe_reset_pipeline_82599(hw); |
1098 | 1177 | ||
1099 | if (got_lock) | 1178 | if (got_lock) |
1100 | hw->mac.ops.release_swfw_sync(hw, | 1179 | hw->mac.ops.release_swfw_sync(hw, |
1101 | IXGBE_GSSR_MAC_CSR_SM); | 1180 | IXGBE_GSSR_MAC_CSR_SM); |
1102 | } | 1181 | } |
1103 | 1182 | ||
1104 | if ((autoc2 & IXGBE_AUTOC2_UPPER_MASK) != | 1183 | if ((autoc2 & IXGBE_AUTOC2_UPPER_MASK) != |
1105 | (hw->mac.orig_autoc2 & IXGBE_AUTOC2_UPPER_MASK)) { | 1184 | (hw->mac.orig_autoc2 & IXGBE_AUTOC2_UPPER_MASK)) { |
1106 | autoc2 &= ~IXGBE_AUTOC2_UPPER_MASK; | 1185 | autoc2 &= ~IXGBE_AUTOC2_UPPER_MASK; |
1107 | autoc2 |= (hw->mac.orig_autoc2 & | 1186 | autoc2 |= (hw->mac.orig_autoc2 & |
1108 | IXGBE_AUTOC2_UPPER_MASK); | 1187 | IXGBE_AUTOC2_UPPER_MASK); |
1109 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC2, autoc2); | 1188 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC2, autoc2); |
1110 | } | 1189 | } |
1111 | } | 1190 | } |
1112 | 1191 | ||
1113 | /* Store the permanent mac address */ | 1192 | /* Store the permanent mac address */ |
1114 | hw->mac.ops.get_mac_addr(hw, hw->mac.perm_addr); | 1193 | hw->mac.ops.get_mac_addr(hw, hw->mac.perm_addr); |
1115 | 1194 | ||
1116 | /* | 1195 | /* |
1117 | * Store MAC address from RAR0, clear receive address registers, and | 1196 | * Store MAC address from RAR0, clear receive address registers, and |
1118 | * clear the multicast table. Also reset num_rar_entries to 128, | 1197 | * clear the multicast table. Also reset num_rar_entries to 128, |
1119 | * since we modify this value when programming the SAN MAC address. | 1198 | * since we modify this value when programming the SAN MAC address. |
1120 | */ | 1199 | */ |
1121 | hw->mac.num_rar_entries = 128; | 1200 | hw->mac.num_rar_entries = 128; |
1122 | hw->mac.ops.init_rx_addrs(hw); | 1201 | hw->mac.ops.init_rx_addrs(hw); |
1123 | 1202 | ||
1124 | /* Store the permanent SAN mac address */ | 1203 | /* Store the permanent SAN mac address */ |
1125 | hw->mac.ops.get_san_mac_addr(hw, hw->mac.san_addr); | 1204 | hw->mac.ops.get_san_mac_addr(hw, hw->mac.san_addr); |
1126 | 1205 | ||
1127 | /* Add the SAN MAC address to the RAR only if it's a valid address */ | 1206 | /* Add the SAN MAC address to the RAR only if it's a valid address */ |
1128 | if (is_valid_ether_addr(hw->mac.san_addr)) { | 1207 | if (is_valid_ether_addr(hw->mac.san_addr)) { |
1129 | hw->mac.ops.set_rar(hw, hw->mac.num_rar_entries - 1, | 1208 | hw->mac.ops.set_rar(hw, hw->mac.num_rar_entries - 1, |
1130 | hw->mac.san_addr, 0, IXGBE_RAH_AV); | 1209 | hw->mac.san_addr, 0, IXGBE_RAH_AV); |
1131 | 1210 | ||
1132 | /* Save the SAN MAC RAR index */ | 1211 | /* Save the SAN MAC RAR index */ |
1133 | hw->mac.san_mac_rar_index = hw->mac.num_rar_entries - 1; | 1212 | hw->mac.san_mac_rar_index = hw->mac.num_rar_entries - 1; |
1134 | 1213 | ||
1135 | /* Reserve the last RAR for the SAN MAC address */ | 1214 | /* Reserve the last RAR for the SAN MAC address */ |
1136 | hw->mac.num_rar_entries--; | 1215 | hw->mac.num_rar_entries--; |
1137 | } | 1216 | } |
1138 | 1217 | ||
1139 | /* Store the alternative WWNN/WWPN prefix */ | 1218 | /* Store the alternative WWNN/WWPN prefix */ |
1140 | hw->mac.ops.get_wwn_prefix(hw, &hw->mac.wwnn_prefix, | 1219 | hw->mac.ops.get_wwn_prefix(hw, &hw->mac.wwnn_prefix, |
1141 | &hw->mac.wwpn_prefix); | 1220 | &hw->mac.wwpn_prefix); |
1142 | 1221 | ||
1143 | reset_hw_out: | 1222 | reset_hw_out: |
1144 | return status; | 1223 | return status; |
1145 | } | 1224 | } |
1146 | 1225 | ||
1147 | /** | 1226 | /** |
1148 | * ixgbe_reinit_fdir_tables_82599 - Reinitialize Flow Director tables. | 1227 | * ixgbe_reinit_fdir_tables_82599 - Reinitialize Flow Director tables. |
1149 | * @hw: pointer to hardware structure | 1228 | * @hw: pointer to hardware structure |
1150 | **/ | 1229 | **/ |
1151 | s32 ixgbe_reinit_fdir_tables_82599(struct ixgbe_hw *hw) | 1230 | s32 ixgbe_reinit_fdir_tables_82599(struct ixgbe_hw *hw) |
1152 | { | 1231 | { |
1153 | int i; | 1232 | int i; |
1154 | u32 fdirctrl = IXGBE_READ_REG(hw, IXGBE_FDIRCTRL); | 1233 | u32 fdirctrl = IXGBE_READ_REG(hw, IXGBE_FDIRCTRL); |
1155 | fdirctrl &= ~IXGBE_FDIRCTRL_INIT_DONE; | 1234 | fdirctrl &= ~IXGBE_FDIRCTRL_INIT_DONE; |
1156 | 1235 | ||
1157 | /* | 1236 | /* |
1158 | * Before starting reinitialization process, | 1237 | * Before starting reinitialization process, |
1159 | * FDIRCMD.CMD must be zero. | 1238 | * FDIRCMD.CMD must be zero. |
1160 | */ | 1239 | */ |
1161 | for (i = 0; i < IXGBE_FDIRCMD_CMD_POLL; i++) { | 1240 | for (i = 0; i < IXGBE_FDIRCMD_CMD_POLL; i++) { |
1162 | if (!(IXGBE_READ_REG(hw, IXGBE_FDIRCMD) & | 1241 | if (!(IXGBE_READ_REG(hw, IXGBE_FDIRCMD) & |
1163 | IXGBE_FDIRCMD_CMD_MASK)) | 1242 | IXGBE_FDIRCMD_CMD_MASK)) |
1164 | break; | 1243 | break; |
1165 | udelay(10); | 1244 | udelay(10); |
1166 | } | 1245 | } |
1167 | if (i >= IXGBE_FDIRCMD_CMD_POLL) { | 1246 | if (i >= IXGBE_FDIRCMD_CMD_POLL) { |
1168 | hw_dbg(hw, "Flow Director previous command isn't complete, " | 1247 | hw_dbg(hw, "Flow Director previous command isn't complete, " |
1169 | "aborting table re-initialization.\n"); | 1248 | "aborting table re-initialization.\n"); |
1170 | return IXGBE_ERR_FDIR_REINIT_FAILED; | 1249 | return IXGBE_ERR_FDIR_REINIT_FAILED; |
1171 | } | 1250 | } |
1172 | 1251 | ||
1173 | IXGBE_WRITE_REG(hw, IXGBE_FDIRFREE, 0); | 1252 | IXGBE_WRITE_REG(hw, IXGBE_FDIRFREE, 0); |
1174 | IXGBE_WRITE_FLUSH(hw); | 1253 | IXGBE_WRITE_FLUSH(hw); |
1175 | /* | 1254 | /* |
1176 | * 82599 adapters flow director init flow cannot be restarted, | 1255 | * 82599 adapters flow director init flow cannot be restarted, |
1177 | * Workaround 82599 silicon errata by performing the following steps | 1256 | * Workaround 82599 silicon errata by performing the following steps |
1178 | * before re-writing the FDIRCTRL control register with the same value. | 1257 | * before re-writing the FDIRCTRL control register with the same value. |
1179 | * - write 1 to bit 8 of FDIRCMD register & | 1258 | * - write 1 to bit 8 of FDIRCMD register & |
1180 | * - write 0 to bit 8 of FDIRCMD register | 1259 | * - write 0 to bit 8 of FDIRCMD register |
1181 | */ | 1260 | */ |
1182 | IXGBE_WRITE_REG(hw, IXGBE_FDIRCMD, | 1261 | IXGBE_WRITE_REG(hw, IXGBE_FDIRCMD, |
1183 | (IXGBE_READ_REG(hw, IXGBE_FDIRCMD) | | 1262 | (IXGBE_READ_REG(hw, IXGBE_FDIRCMD) | |
1184 | IXGBE_FDIRCMD_CLEARHT)); | 1263 | IXGBE_FDIRCMD_CLEARHT)); |
1185 | IXGBE_WRITE_FLUSH(hw); | 1264 | IXGBE_WRITE_FLUSH(hw); |
1186 | IXGBE_WRITE_REG(hw, IXGBE_FDIRCMD, | 1265 | IXGBE_WRITE_REG(hw, IXGBE_FDIRCMD, |
1187 | (IXGBE_READ_REG(hw, IXGBE_FDIRCMD) & | 1266 | (IXGBE_READ_REG(hw, IXGBE_FDIRCMD) & |
1188 | ~IXGBE_FDIRCMD_CLEARHT)); | 1267 | ~IXGBE_FDIRCMD_CLEARHT)); |
1189 | IXGBE_WRITE_FLUSH(hw); | 1268 | IXGBE_WRITE_FLUSH(hw); |
1190 | /* | 1269 | /* |
1191 | * Clear FDIR Hash register to clear any leftover hashes | 1270 | * Clear FDIR Hash register to clear any leftover hashes |
1192 | * waiting to be programmed. | 1271 | * waiting to be programmed. |
1193 | */ | 1272 | */ |
1194 | IXGBE_WRITE_REG(hw, IXGBE_FDIRHASH, 0x00); | 1273 | IXGBE_WRITE_REG(hw, IXGBE_FDIRHASH, 0x00); |
1195 | IXGBE_WRITE_FLUSH(hw); | 1274 | IXGBE_WRITE_FLUSH(hw); |
1196 | 1275 | ||
1197 | IXGBE_WRITE_REG(hw, IXGBE_FDIRCTRL, fdirctrl); | 1276 | IXGBE_WRITE_REG(hw, IXGBE_FDIRCTRL, fdirctrl); |
1198 | IXGBE_WRITE_FLUSH(hw); | 1277 | IXGBE_WRITE_FLUSH(hw); |
1199 | 1278 | ||
1200 | /* Poll init-done after we write FDIRCTRL register */ | 1279 | /* Poll init-done after we write FDIRCTRL register */ |
1201 | for (i = 0; i < IXGBE_FDIR_INIT_DONE_POLL; i++) { | 1280 | for (i = 0; i < IXGBE_FDIR_INIT_DONE_POLL; i++) { |
1202 | if (IXGBE_READ_REG(hw, IXGBE_FDIRCTRL) & | 1281 | if (IXGBE_READ_REG(hw, IXGBE_FDIRCTRL) & |
1203 | IXGBE_FDIRCTRL_INIT_DONE) | 1282 | IXGBE_FDIRCTRL_INIT_DONE) |
1204 | break; | 1283 | break; |
1205 | usleep_range(1000, 2000); | 1284 | usleep_range(1000, 2000); |
1206 | } | 1285 | } |
1207 | if (i >= IXGBE_FDIR_INIT_DONE_POLL) { | 1286 | if (i >= IXGBE_FDIR_INIT_DONE_POLL) { |
1208 | hw_dbg(hw, "Flow Director Signature poll time exceeded!\n"); | 1287 | hw_dbg(hw, "Flow Director Signature poll time exceeded!\n"); |
1209 | return IXGBE_ERR_FDIR_REINIT_FAILED; | 1288 | return IXGBE_ERR_FDIR_REINIT_FAILED; |
1210 | } | 1289 | } |
1211 | 1290 | ||
1212 | /* Clear FDIR statistics registers (read to clear) */ | 1291 | /* Clear FDIR statistics registers (read to clear) */ |
1213 | IXGBE_READ_REG(hw, IXGBE_FDIRUSTAT); | 1292 | IXGBE_READ_REG(hw, IXGBE_FDIRUSTAT); |
1214 | IXGBE_READ_REG(hw, IXGBE_FDIRFSTAT); | 1293 | IXGBE_READ_REG(hw, IXGBE_FDIRFSTAT); |
1215 | IXGBE_READ_REG(hw, IXGBE_FDIRMATCH); | 1294 | IXGBE_READ_REG(hw, IXGBE_FDIRMATCH); |
1216 | IXGBE_READ_REG(hw, IXGBE_FDIRMISS); | 1295 | IXGBE_READ_REG(hw, IXGBE_FDIRMISS); |
1217 | IXGBE_READ_REG(hw, IXGBE_FDIRLEN); | 1296 | IXGBE_READ_REG(hw, IXGBE_FDIRLEN); |
1218 | 1297 | ||
1219 | return 0; | 1298 | return 0; |
1220 | } | 1299 | } |
1221 | 1300 | ||
1222 | /** | 1301 | /** |
1223 | * ixgbe_fdir_enable_82599 - Initialize Flow Director control registers | 1302 | * ixgbe_fdir_enable_82599 - Initialize Flow Director control registers |
1224 | * @hw: pointer to hardware structure | 1303 | * @hw: pointer to hardware structure |
1225 | * @fdirctrl: value to write to flow director control register | 1304 | * @fdirctrl: value to write to flow director control register |
1226 | **/ | 1305 | **/ |
1227 | static void ixgbe_fdir_enable_82599(struct ixgbe_hw *hw, u32 fdirctrl) | 1306 | static void ixgbe_fdir_enable_82599(struct ixgbe_hw *hw, u32 fdirctrl) |
1228 | { | 1307 | { |
1229 | int i; | 1308 | int i; |
1230 | 1309 | ||
1231 | /* Prime the keys for hashing */ | 1310 | /* Prime the keys for hashing */ |
1232 | IXGBE_WRITE_REG(hw, IXGBE_FDIRHKEY, IXGBE_ATR_BUCKET_HASH_KEY); | 1311 | IXGBE_WRITE_REG(hw, IXGBE_FDIRHKEY, IXGBE_ATR_BUCKET_HASH_KEY); |
1233 | IXGBE_WRITE_REG(hw, IXGBE_FDIRSKEY, IXGBE_ATR_SIGNATURE_HASH_KEY); | 1312 | IXGBE_WRITE_REG(hw, IXGBE_FDIRSKEY, IXGBE_ATR_SIGNATURE_HASH_KEY); |
1234 | 1313 | ||
1235 | /* | 1314 | /* |
1236 | * Poll init-done after we write the register. Estimated times: | 1315 | * Poll init-done after we write the register. Estimated times: |
1237 | * 10G: PBALLOC = 11b, timing is 60us | 1316 | * 10G: PBALLOC = 11b, timing is 60us |
1238 | * 1G: PBALLOC = 11b, timing is 600us | 1317 | * 1G: PBALLOC = 11b, timing is 600us |
1239 | * 100M: PBALLOC = 11b, timing is 6ms | 1318 | * 100M: PBALLOC = 11b, timing is 6ms |
1240 | * | 1319 | * |
1241 | * Multiple these timings by 4 if under full Rx load | 1320 | * Multiple these timings by 4 if under full Rx load |
1242 | * | 1321 | * |
1243 | * So we'll poll for IXGBE_FDIR_INIT_DONE_POLL times, sleeping for | 1322 | * So we'll poll for IXGBE_FDIR_INIT_DONE_POLL times, sleeping for |
1244 | * 1 msec per poll time. If we're at line rate and drop to 100M, then | 1323 | * 1 msec per poll time. If we're at line rate and drop to 100M, then |
1245 | * this might not finish in our poll time, but we can live with that | 1324 | * this might not finish in our poll time, but we can live with that |
1246 | * for now. | 1325 | * for now. |
1247 | */ | 1326 | */ |
1248 | IXGBE_WRITE_REG(hw, IXGBE_FDIRCTRL, fdirctrl); | 1327 | IXGBE_WRITE_REG(hw, IXGBE_FDIRCTRL, fdirctrl); |
1249 | IXGBE_WRITE_FLUSH(hw); | 1328 | IXGBE_WRITE_FLUSH(hw); |
1250 | for (i = 0; i < IXGBE_FDIR_INIT_DONE_POLL; i++) { | 1329 | for (i = 0; i < IXGBE_FDIR_INIT_DONE_POLL; i++) { |
1251 | if (IXGBE_READ_REG(hw, IXGBE_FDIRCTRL) & | 1330 | if (IXGBE_READ_REG(hw, IXGBE_FDIRCTRL) & |
1252 | IXGBE_FDIRCTRL_INIT_DONE) | 1331 | IXGBE_FDIRCTRL_INIT_DONE) |
1253 | break; | 1332 | break; |
1254 | usleep_range(1000, 2000); | 1333 | usleep_range(1000, 2000); |
1255 | } | 1334 | } |
1256 | 1335 | ||
1257 | if (i >= IXGBE_FDIR_INIT_DONE_POLL) | 1336 | if (i >= IXGBE_FDIR_INIT_DONE_POLL) |
1258 | hw_dbg(hw, "Flow Director poll time exceeded!\n"); | 1337 | hw_dbg(hw, "Flow Director poll time exceeded!\n"); |
1259 | } | 1338 | } |
1260 | 1339 | ||
1261 | /** | 1340 | /** |
1262 | * ixgbe_init_fdir_signature_82599 - Initialize Flow Director signature filters | 1341 | * ixgbe_init_fdir_signature_82599 - Initialize Flow Director signature filters |
1263 | * @hw: pointer to hardware structure | 1342 | * @hw: pointer to hardware structure |
1264 | * @fdirctrl: value to write to flow director control register, initially | 1343 | * @fdirctrl: value to write to flow director control register, initially |
1265 | * contains just the value of the Rx packet buffer allocation | 1344 | * contains just the value of the Rx packet buffer allocation |
1266 | **/ | 1345 | **/ |
1267 | s32 ixgbe_init_fdir_signature_82599(struct ixgbe_hw *hw, u32 fdirctrl) | 1346 | s32 ixgbe_init_fdir_signature_82599(struct ixgbe_hw *hw, u32 fdirctrl) |
1268 | { | 1347 | { |
1269 | /* | 1348 | /* |
1270 | * Continue setup of fdirctrl register bits: | 1349 | * Continue setup of fdirctrl register bits: |
1271 | * Move the flexible bytes to use the ethertype - shift 6 words | 1350 | * Move the flexible bytes to use the ethertype - shift 6 words |
1272 | * Set the maximum length per hash bucket to 0xA filters | 1351 | * Set the maximum length per hash bucket to 0xA filters |
1273 | * Send interrupt when 64 filters are left | 1352 | * Send interrupt when 64 filters are left |
1274 | */ | 1353 | */ |
1275 | fdirctrl |= (0x6 << IXGBE_FDIRCTRL_FLEX_SHIFT) | | 1354 | fdirctrl |= (0x6 << IXGBE_FDIRCTRL_FLEX_SHIFT) | |
1276 | (0xA << IXGBE_FDIRCTRL_MAX_LENGTH_SHIFT) | | 1355 | (0xA << IXGBE_FDIRCTRL_MAX_LENGTH_SHIFT) | |
1277 | (4 << IXGBE_FDIRCTRL_FULL_THRESH_SHIFT); | 1356 | (4 << IXGBE_FDIRCTRL_FULL_THRESH_SHIFT); |
1278 | 1357 | ||
1279 | /* write hashes and fdirctrl register, poll for completion */ | 1358 | /* write hashes and fdirctrl register, poll for completion */ |
1280 | ixgbe_fdir_enable_82599(hw, fdirctrl); | 1359 | ixgbe_fdir_enable_82599(hw, fdirctrl); |
1281 | 1360 | ||
1282 | return 0; | 1361 | return 0; |
1283 | } | 1362 | } |
1284 | 1363 | ||
1285 | /** | 1364 | /** |
1286 | * ixgbe_init_fdir_perfect_82599 - Initialize Flow Director perfect filters | 1365 | * ixgbe_init_fdir_perfect_82599 - Initialize Flow Director perfect filters |
1287 | * @hw: pointer to hardware structure | 1366 | * @hw: pointer to hardware structure |
1288 | * @fdirctrl: value to write to flow director control register, initially | 1367 | * @fdirctrl: value to write to flow director control register, initially |
1289 | * contains just the value of the Rx packet buffer allocation | 1368 | * contains just the value of the Rx packet buffer allocation |
1290 | **/ | 1369 | **/ |
1291 | s32 ixgbe_init_fdir_perfect_82599(struct ixgbe_hw *hw, u32 fdirctrl) | 1370 | s32 ixgbe_init_fdir_perfect_82599(struct ixgbe_hw *hw, u32 fdirctrl) |
1292 | { | 1371 | { |
1293 | /* | 1372 | /* |
1294 | * Continue setup of fdirctrl register bits: | 1373 | * Continue setup of fdirctrl register bits: |
1295 | * Turn perfect match filtering on | 1374 | * Turn perfect match filtering on |
1296 | * Report hash in RSS field of Rx wb descriptor | 1375 | * Report hash in RSS field of Rx wb descriptor |
1297 | * Initialize the drop queue | 1376 | * Initialize the drop queue |
1298 | * Move the flexible bytes to use the ethertype - shift 6 words | 1377 | * Move the flexible bytes to use the ethertype - shift 6 words |
1299 | * Set the maximum length per hash bucket to 0xA filters | 1378 | * Set the maximum length per hash bucket to 0xA filters |
1300 | * Send interrupt when 64 (0x4 * 16) filters are left | 1379 | * Send interrupt when 64 (0x4 * 16) filters are left |
1301 | */ | 1380 | */ |
1302 | fdirctrl |= IXGBE_FDIRCTRL_PERFECT_MATCH | | 1381 | fdirctrl |= IXGBE_FDIRCTRL_PERFECT_MATCH | |
1303 | IXGBE_FDIRCTRL_REPORT_STATUS | | 1382 | IXGBE_FDIRCTRL_REPORT_STATUS | |
1304 | (IXGBE_FDIR_DROP_QUEUE << IXGBE_FDIRCTRL_DROP_Q_SHIFT) | | 1383 | (IXGBE_FDIR_DROP_QUEUE << IXGBE_FDIRCTRL_DROP_Q_SHIFT) | |
1305 | (0x6 << IXGBE_FDIRCTRL_FLEX_SHIFT) | | 1384 | (0x6 << IXGBE_FDIRCTRL_FLEX_SHIFT) | |
1306 | (0xA << IXGBE_FDIRCTRL_MAX_LENGTH_SHIFT) | | 1385 | (0xA << IXGBE_FDIRCTRL_MAX_LENGTH_SHIFT) | |
1307 | (4 << IXGBE_FDIRCTRL_FULL_THRESH_SHIFT); | 1386 | (4 << IXGBE_FDIRCTRL_FULL_THRESH_SHIFT); |
1308 | 1387 | ||
1309 | /* write hashes and fdirctrl register, poll for completion */ | 1388 | /* write hashes and fdirctrl register, poll for completion */ |
1310 | ixgbe_fdir_enable_82599(hw, fdirctrl); | 1389 | ixgbe_fdir_enable_82599(hw, fdirctrl); |
1311 | 1390 | ||
1312 | return 0; | 1391 | return 0; |
1313 | } | 1392 | } |
1314 | 1393 | ||
1315 | /* | 1394 | /* |
1316 | * These defines allow us to quickly generate all of the necessary instructions | 1395 | * These defines allow us to quickly generate all of the necessary instructions |
1317 | * in the function below by simply calling out IXGBE_COMPUTE_SIG_HASH_ITERATION | 1396 | * in the function below by simply calling out IXGBE_COMPUTE_SIG_HASH_ITERATION |
1318 | * for values 0 through 15 | 1397 | * for values 0 through 15 |
1319 | */ | 1398 | */ |
1320 | #define IXGBE_ATR_COMMON_HASH_KEY \ | 1399 | #define IXGBE_ATR_COMMON_HASH_KEY \ |
1321 | (IXGBE_ATR_BUCKET_HASH_KEY & IXGBE_ATR_SIGNATURE_HASH_KEY) | 1400 | (IXGBE_ATR_BUCKET_HASH_KEY & IXGBE_ATR_SIGNATURE_HASH_KEY) |
1322 | #define IXGBE_COMPUTE_SIG_HASH_ITERATION(_n) \ | 1401 | #define IXGBE_COMPUTE_SIG_HASH_ITERATION(_n) \ |
1323 | do { \ | 1402 | do { \ |
1324 | u32 n = (_n); \ | 1403 | u32 n = (_n); \ |
1325 | if (IXGBE_ATR_COMMON_HASH_KEY & (0x01 << n)) \ | 1404 | if (IXGBE_ATR_COMMON_HASH_KEY & (0x01 << n)) \ |
1326 | common_hash ^= lo_hash_dword >> n; \ | 1405 | common_hash ^= lo_hash_dword >> n; \ |
1327 | else if (IXGBE_ATR_BUCKET_HASH_KEY & (0x01 << n)) \ | 1406 | else if (IXGBE_ATR_BUCKET_HASH_KEY & (0x01 << n)) \ |
1328 | bucket_hash ^= lo_hash_dword >> n; \ | 1407 | bucket_hash ^= lo_hash_dword >> n; \ |
1329 | else if (IXGBE_ATR_SIGNATURE_HASH_KEY & (0x01 << n)) \ | 1408 | else if (IXGBE_ATR_SIGNATURE_HASH_KEY & (0x01 << n)) \ |
1330 | sig_hash ^= lo_hash_dword << (16 - n); \ | 1409 | sig_hash ^= lo_hash_dword << (16 - n); \ |
1331 | if (IXGBE_ATR_COMMON_HASH_KEY & (0x01 << (n + 16))) \ | 1410 | if (IXGBE_ATR_COMMON_HASH_KEY & (0x01 << (n + 16))) \ |
1332 | common_hash ^= hi_hash_dword >> n; \ | 1411 | common_hash ^= hi_hash_dword >> n; \ |
1333 | else if (IXGBE_ATR_BUCKET_HASH_KEY & (0x01 << (n + 16))) \ | 1412 | else if (IXGBE_ATR_BUCKET_HASH_KEY & (0x01 << (n + 16))) \ |
1334 | bucket_hash ^= hi_hash_dword >> n; \ | 1413 | bucket_hash ^= hi_hash_dword >> n; \ |
1335 | else if (IXGBE_ATR_SIGNATURE_HASH_KEY & (0x01 << (n + 16))) \ | 1414 | else if (IXGBE_ATR_SIGNATURE_HASH_KEY & (0x01 << (n + 16))) \ |
1336 | sig_hash ^= hi_hash_dword << (16 - n); \ | 1415 | sig_hash ^= hi_hash_dword << (16 - n); \ |
1337 | } while (0); | 1416 | } while (0); |
1338 | 1417 | ||
1339 | /** | 1418 | /** |
1340 | * ixgbe_atr_compute_sig_hash_82599 - Compute the signature hash | 1419 | * ixgbe_atr_compute_sig_hash_82599 - Compute the signature hash |
1341 | * @stream: input bitstream to compute the hash on | 1420 | * @stream: input bitstream to compute the hash on |
1342 | * | 1421 | * |
1343 | * This function is almost identical to the function above but contains | 1422 | * This function is almost identical to the function above but contains |
1344 | * several optomizations such as unwinding all of the loops, letting the | 1423 | * several optomizations such as unwinding all of the loops, letting the |
1345 | * compiler work out all of the conditional ifs since the keys are static | 1424 | * compiler work out all of the conditional ifs since the keys are static |
1346 | * defines, and computing two keys at once since the hashed dword stream | 1425 | * defines, and computing two keys at once since the hashed dword stream |
1347 | * will be the same for both keys. | 1426 | * will be the same for both keys. |
1348 | **/ | 1427 | **/ |
1349 | static u32 ixgbe_atr_compute_sig_hash_82599(union ixgbe_atr_hash_dword input, | 1428 | static u32 ixgbe_atr_compute_sig_hash_82599(union ixgbe_atr_hash_dword input, |
1350 | union ixgbe_atr_hash_dword common) | 1429 | union ixgbe_atr_hash_dword common) |
1351 | { | 1430 | { |
1352 | u32 hi_hash_dword, lo_hash_dword, flow_vm_vlan; | 1431 | u32 hi_hash_dword, lo_hash_dword, flow_vm_vlan; |
1353 | u32 sig_hash = 0, bucket_hash = 0, common_hash = 0; | 1432 | u32 sig_hash = 0, bucket_hash = 0, common_hash = 0; |
1354 | 1433 | ||
1355 | /* record the flow_vm_vlan bits as they are a key part to the hash */ | 1434 | /* record the flow_vm_vlan bits as they are a key part to the hash */ |
1356 | flow_vm_vlan = ntohl(input.dword); | 1435 | flow_vm_vlan = ntohl(input.dword); |
1357 | 1436 | ||
1358 | /* generate common hash dword */ | 1437 | /* generate common hash dword */ |
1359 | hi_hash_dword = ntohl(common.dword); | 1438 | hi_hash_dword = ntohl(common.dword); |
1360 | 1439 | ||
1361 | /* low dword is word swapped version of common */ | 1440 | /* low dword is word swapped version of common */ |
1362 | lo_hash_dword = (hi_hash_dword >> 16) | (hi_hash_dword << 16); | 1441 | lo_hash_dword = (hi_hash_dword >> 16) | (hi_hash_dword << 16); |
1363 | 1442 | ||
1364 | /* apply flow ID/VM pool/VLAN ID bits to hash words */ | 1443 | /* apply flow ID/VM pool/VLAN ID bits to hash words */ |
1365 | hi_hash_dword ^= flow_vm_vlan ^ (flow_vm_vlan >> 16); | 1444 | hi_hash_dword ^= flow_vm_vlan ^ (flow_vm_vlan >> 16); |
1366 | 1445 | ||
1367 | /* Process bits 0 and 16 */ | 1446 | /* Process bits 0 and 16 */ |
1368 | IXGBE_COMPUTE_SIG_HASH_ITERATION(0); | 1447 | IXGBE_COMPUTE_SIG_HASH_ITERATION(0); |
1369 | 1448 | ||
1370 | /* | 1449 | /* |
1371 | * apply flow ID/VM pool/VLAN ID bits to lo hash dword, we had to | 1450 | * apply flow ID/VM pool/VLAN ID bits to lo hash dword, we had to |
1372 | * delay this because bit 0 of the stream should not be processed | 1451 | * delay this because bit 0 of the stream should not be processed |
1373 | * so we do not add the vlan until after bit 0 was processed | 1452 | * so we do not add the vlan until after bit 0 was processed |
1374 | */ | 1453 | */ |
1375 | lo_hash_dword ^= flow_vm_vlan ^ (flow_vm_vlan << 16); | 1454 | lo_hash_dword ^= flow_vm_vlan ^ (flow_vm_vlan << 16); |
1376 | 1455 | ||
1377 | /* Process remaining 30 bit of the key */ | 1456 | /* Process remaining 30 bit of the key */ |
1378 | IXGBE_COMPUTE_SIG_HASH_ITERATION(1); | 1457 | IXGBE_COMPUTE_SIG_HASH_ITERATION(1); |
1379 | IXGBE_COMPUTE_SIG_HASH_ITERATION(2); | 1458 | IXGBE_COMPUTE_SIG_HASH_ITERATION(2); |
1380 | IXGBE_COMPUTE_SIG_HASH_ITERATION(3); | 1459 | IXGBE_COMPUTE_SIG_HASH_ITERATION(3); |
1381 | IXGBE_COMPUTE_SIG_HASH_ITERATION(4); | 1460 | IXGBE_COMPUTE_SIG_HASH_ITERATION(4); |
1382 | IXGBE_COMPUTE_SIG_HASH_ITERATION(5); | 1461 | IXGBE_COMPUTE_SIG_HASH_ITERATION(5); |
1383 | IXGBE_COMPUTE_SIG_HASH_ITERATION(6); | 1462 | IXGBE_COMPUTE_SIG_HASH_ITERATION(6); |
1384 | IXGBE_COMPUTE_SIG_HASH_ITERATION(7); | 1463 | IXGBE_COMPUTE_SIG_HASH_ITERATION(7); |
1385 | IXGBE_COMPUTE_SIG_HASH_ITERATION(8); | 1464 | IXGBE_COMPUTE_SIG_HASH_ITERATION(8); |
1386 | IXGBE_COMPUTE_SIG_HASH_ITERATION(9); | 1465 | IXGBE_COMPUTE_SIG_HASH_ITERATION(9); |
1387 | IXGBE_COMPUTE_SIG_HASH_ITERATION(10); | 1466 | IXGBE_COMPUTE_SIG_HASH_ITERATION(10); |
1388 | IXGBE_COMPUTE_SIG_HASH_ITERATION(11); | 1467 | IXGBE_COMPUTE_SIG_HASH_ITERATION(11); |
1389 | IXGBE_COMPUTE_SIG_HASH_ITERATION(12); | 1468 | IXGBE_COMPUTE_SIG_HASH_ITERATION(12); |
1390 | IXGBE_COMPUTE_SIG_HASH_ITERATION(13); | 1469 | IXGBE_COMPUTE_SIG_HASH_ITERATION(13); |
1391 | IXGBE_COMPUTE_SIG_HASH_ITERATION(14); | 1470 | IXGBE_COMPUTE_SIG_HASH_ITERATION(14); |
1392 | IXGBE_COMPUTE_SIG_HASH_ITERATION(15); | 1471 | IXGBE_COMPUTE_SIG_HASH_ITERATION(15); |
1393 | 1472 | ||
1394 | /* combine common_hash result with signature and bucket hashes */ | 1473 | /* combine common_hash result with signature and bucket hashes */ |
1395 | bucket_hash ^= common_hash; | 1474 | bucket_hash ^= common_hash; |
1396 | bucket_hash &= IXGBE_ATR_HASH_MASK; | 1475 | bucket_hash &= IXGBE_ATR_HASH_MASK; |
1397 | 1476 | ||
1398 | sig_hash ^= common_hash << 16; | 1477 | sig_hash ^= common_hash << 16; |
1399 | sig_hash &= IXGBE_ATR_HASH_MASK << 16; | 1478 | sig_hash &= IXGBE_ATR_HASH_MASK << 16; |
1400 | 1479 | ||
1401 | /* return completed signature hash */ | 1480 | /* return completed signature hash */ |
1402 | return sig_hash ^ bucket_hash; | 1481 | return sig_hash ^ bucket_hash; |
1403 | } | 1482 | } |
1404 | 1483 | ||
1405 | /** | 1484 | /** |
1406 | * ixgbe_atr_add_signature_filter_82599 - Adds a signature hash filter | 1485 | * ixgbe_atr_add_signature_filter_82599 - Adds a signature hash filter |
1407 | * @hw: pointer to hardware structure | 1486 | * @hw: pointer to hardware structure |
1408 | * @input: unique input dword | 1487 | * @input: unique input dword |
1409 | * @common: compressed common input dword | 1488 | * @common: compressed common input dword |
1410 | * @queue: queue index to direct traffic to | 1489 | * @queue: queue index to direct traffic to |
1411 | **/ | 1490 | **/ |
1412 | s32 ixgbe_fdir_add_signature_filter_82599(struct ixgbe_hw *hw, | 1491 | s32 ixgbe_fdir_add_signature_filter_82599(struct ixgbe_hw *hw, |
1413 | union ixgbe_atr_hash_dword input, | 1492 | union ixgbe_atr_hash_dword input, |
1414 | union ixgbe_atr_hash_dword common, | 1493 | union ixgbe_atr_hash_dword common, |
1415 | u8 queue) | 1494 | u8 queue) |
1416 | { | 1495 | { |
1417 | u64 fdirhashcmd; | 1496 | u64 fdirhashcmd; |
1418 | u32 fdircmd; | 1497 | u32 fdircmd; |
1419 | 1498 | ||
1420 | /* | 1499 | /* |
1421 | * Get the flow_type in order to program FDIRCMD properly | 1500 | * Get the flow_type in order to program FDIRCMD properly |
1422 | * lowest 2 bits are FDIRCMD.L4TYPE, third lowest bit is FDIRCMD.IPV6 | 1501 | * lowest 2 bits are FDIRCMD.L4TYPE, third lowest bit is FDIRCMD.IPV6 |
1423 | */ | 1502 | */ |
1424 | switch (input.formatted.flow_type) { | 1503 | switch (input.formatted.flow_type) { |
1425 | case IXGBE_ATR_FLOW_TYPE_TCPV4: | 1504 | case IXGBE_ATR_FLOW_TYPE_TCPV4: |
1426 | case IXGBE_ATR_FLOW_TYPE_UDPV4: | 1505 | case IXGBE_ATR_FLOW_TYPE_UDPV4: |
1427 | case IXGBE_ATR_FLOW_TYPE_SCTPV4: | 1506 | case IXGBE_ATR_FLOW_TYPE_SCTPV4: |
1428 | case IXGBE_ATR_FLOW_TYPE_TCPV6: | 1507 | case IXGBE_ATR_FLOW_TYPE_TCPV6: |
1429 | case IXGBE_ATR_FLOW_TYPE_UDPV6: | 1508 | case IXGBE_ATR_FLOW_TYPE_UDPV6: |
1430 | case IXGBE_ATR_FLOW_TYPE_SCTPV6: | 1509 | case IXGBE_ATR_FLOW_TYPE_SCTPV6: |
1431 | break; | 1510 | break; |
1432 | default: | 1511 | default: |
1433 | hw_dbg(hw, " Error on flow type input\n"); | 1512 | hw_dbg(hw, " Error on flow type input\n"); |
1434 | return IXGBE_ERR_CONFIG; | 1513 | return IXGBE_ERR_CONFIG; |
1435 | } | 1514 | } |
1436 | 1515 | ||
1437 | /* configure FDIRCMD register */ | 1516 | /* configure FDIRCMD register */ |
1438 | fdircmd = IXGBE_FDIRCMD_CMD_ADD_FLOW | IXGBE_FDIRCMD_FILTER_UPDATE | | 1517 | fdircmd = IXGBE_FDIRCMD_CMD_ADD_FLOW | IXGBE_FDIRCMD_FILTER_UPDATE | |
1439 | IXGBE_FDIRCMD_LAST | IXGBE_FDIRCMD_QUEUE_EN; | 1518 | IXGBE_FDIRCMD_LAST | IXGBE_FDIRCMD_QUEUE_EN; |
1440 | fdircmd |= input.formatted.flow_type << IXGBE_FDIRCMD_FLOW_TYPE_SHIFT; | 1519 | fdircmd |= input.formatted.flow_type << IXGBE_FDIRCMD_FLOW_TYPE_SHIFT; |
1441 | fdircmd |= (u32)queue << IXGBE_FDIRCMD_RX_QUEUE_SHIFT; | 1520 | fdircmd |= (u32)queue << IXGBE_FDIRCMD_RX_QUEUE_SHIFT; |
1442 | 1521 | ||
1443 | /* | 1522 | /* |
1444 | * The lower 32-bits of fdirhashcmd is for FDIRHASH, the upper 32-bits | 1523 | * The lower 32-bits of fdirhashcmd is for FDIRHASH, the upper 32-bits |
1445 | * is for FDIRCMD. Then do a 64-bit register write from FDIRHASH. | 1524 | * is for FDIRCMD. Then do a 64-bit register write from FDIRHASH. |
1446 | */ | 1525 | */ |
1447 | fdirhashcmd = (u64)fdircmd << 32; | 1526 | fdirhashcmd = (u64)fdircmd << 32; |
1448 | fdirhashcmd |= ixgbe_atr_compute_sig_hash_82599(input, common); | 1527 | fdirhashcmd |= ixgbe_atr_compute_sig_hash_82599(input, common); |
1449 | IXGBE_WRITE_REG64(hw, IXGBE_FDIRHASH, fdirhashcmd); | 1528 | IXGBE_WRITE_REG64(hw, IXGBE_FDIRHASH, fdirhashcmd); |
1450 | 1529 | ||
1451 | hw_dbg(hw, "Tx Queue=%x hash=%x\n", queue, (u32)fdirhashcmd); | 1530 | hw_dbg(hw, "Tx Queue=%x hash=%x\n", queue, (u32)fdirhashcmd); |
1452 | 1531 | ||
1453 | return 0; | 1532 | return 0; |
1454 | } | 1533 | } |
1455 | 1534 | ||
1456 | #define IXGBE_COMPUTE_BKT_HASH_ITERATION(_n) \ | 1535 | #define IXGBE_COMPUTE_BKT_HASH_ITERATION(_n) \ |
1457 | do { \ | 1536 | do { \ |
1458 | u32 n = (_n); \ | 1537 | u32 n = (_n); \ |
1459 | if (IXGBE_ATR_BUCKET_HASH_KEY & (0x01 << n)) \ | 1538 | if (IXGBE_ATR_BUCKET_HASH_KEY & (0x01 << n)) \ |
1460 | bucket_hash ^= lo_hash_dword >> n; \ | 1539 | bucket_hash ^= lo_hash_dword >> n; \ |
1461 | if (IXGBE_ATR_BUCKET_HASH_KEY & (0x01 << (n + 16))) \ | 1540 | if (IXGBE_ATR_BUCKET_HASH_KEY & (0x01 << (n + 16))) \ |
1462 | bucket_hash ^= hi_hash_dword >> n; \ | 1541 | bucket_hash ^= hi_hash_dword >> n; \ |
1463 | } while (0); | 1542 | } while (0); |
1464 | 1543 | ||
1465 | /** | 1544 | /** |
1466 | * ixgbe_atr_compute_perfect_hash_82599 - Compute the perfect filter hash | 1545 | * ixgbe_atr_compute_perfect_hash_82599 - Compute the perfect filter hash |
1467 | * @atr_input: input bitstream to compute the hash on | 1546 | * @atr_input: input bitstream to compute the hash on |
1468 | * @input_mask: mask for the input bitstream | 1547 | * @input_mask: mask for the input bitstream |
1469 | * | 1548 | * |
1470 | * This function serves two main purposes. First it applys the input_mask | 1549 | * This function serves two main purposes. First it applys the input_mask |
1471 | * to the atr_input resulting in a cleaned up atr_input data stream. | 1550 | * to the atr_input resulting in a cleaned up atr_input data stream. |
1472 | * Secondly it computes the hash and stores it in the bkt_hash field at | 1551 | * Secondly it computes the hash and stores it in the bkt_hash field at |
1473 | * the end of the input byte stream. This way it will be available for | 1552 | * the end of the input byte stream. This way it will be available for |
1474 | * future use without needing to recompute the hash. | 1553 | * future use without needing to recompute the hash. |
1475 | **/ | 1554 | **/ |
1476 | void ixgbe_atr_compute_perfect_hash_82599(union ixgbe_atr_input *input, | 1555 | void ixgbe_atr_compute_perfect_hash_82599(union ixgbe_atr_input *input, |
1477 | union ixgbe_atr_input *input_mask) | 1556 | union ixgbe_atr_input *input_mask) |
1478 | { | 1557 | { |
1479 | 1558 | ||
1480 | u32 hi_hash_dword, lo_hash_dword, flow_vm_vlan; | 1559 | u32 hi_hash_dword, lo_hash_dword, flow_vm_vlan; |
1481 | u32 bucket_hash = 0; | 1560 | u32 bucket_hash = 0; |
1482 | 1561 | ||
1483 | /* Apply masks to input data */ | 1562 | /* Apply masks to input data */ |
1484 | input->dword_stream[0] &= input_mask->dword_stream[0]; | 1563 | input->dword_stream[0] &= input_mask->dword_stream[0]; |
1485 | input->dword_stream[1] &= input_mask->dword_stream[1]; | 1564 | input->dword_stream[1] &= input_mask->dword_stream[1]; |
1486 | input->dword_stream[2] &= input_mask->dword_stream[2]; | 1565 | input->dword_stream[2] &= input_mask->dword_stream[2]; |
1487 | input->dword_stream[3] &= input_mask->dword_stream[3]; | 1566 | input->dword_stream[3] &= input_mask->dword_stream[3]; |
1488 | input->dword_stream[4] &= input_mask->dword_stream[4]; | 1567 | input->dword_stream[4] &= input_mask->dword_stream[4]; |
1489 | input->dword_stream[5] &= input_mask->dword_stream[5]; | 1568 | input->dword_stream[5] &= input_mask->dword_stream[5]; |
1490 | input->dword_stream[6] &= input_mask->dword_stream[6]; | 1569 | input->dword_stream[6] &= input_mask->dword_stream[6]; |
1491 | input->dword_stream[7] &= input_mask->dword_stream[7]; | 1570 | input->dword_stream[7] &= input_mask->dword_stream[7]; |
1492 | input->dword_stream[8] &= input_mask->dword_stream[8]; | 1571 | input->dword_stream[8] &= input_mask->dword_stream[8]; |
1493 | input->dword_stream[9] &= input_mask->dword_stream[9]; | 1572 | input->dword_stream[9] &= input_mask->dword_stream[9]; |
1494 | input->dword_stream[10] &= input_mask->dword_stream[10]; | 1573 | input->dword_stream[10] &= input_mask->dword_stream[10]; |
1495 | 1574 | ||
1496 | /* record the flow_vm_vlan bits as they are a key part to the hash */ | 1575 | /* record the flow_vm_vlan bits as they are a key part to the hash */ |
1497 | flow_vm_vlan = ntohl(input->dword_stream[0]); | 1576 | flow_vm_vlan = ntohl(input->dword_stream[0]); |
1498 | 1577 | ||
1499 | /* generate common hash dword */ | 1578 | /* generate common hash dword */ |
1500 | hi_hash_dword = ntohl(input->dword_stream[1] ^ | 1579 | hi_hash_dword = ntohl(input->dword_stream[1] ^ |
1501 | input->dword_stream[2] ^ | 1580 | input->dword_stream[2] ^ |
1502 | input->dword_stream[3] ^ | 1581 | input->dword_stream[3] ^ |
1503 | input->dword_stream[4] ^ | 1582 | input->dword_stream[4] ^ |
1504 | input->dword_stream[5] ^ | 1583 | input->dword_stream[5] ^ |
1505 | input->dword_stream[6] ^ | 1584 | input->dword_stream[6] ^ |
1506 | input->dword_stream[7] ^ | 1585 | input->dword_stream[7] ^ |
1507 | input->dword_stream[8] ^ | 1586 | input->dword_stream[8] ^ |
1508 | input->dword_stream[9] ^ | 1587 | input->dword_stream[9] ^ |
1509 | input->dword_stream[10]); | 1588 | input->dword_stream[10]); |
1510 | 1589 | ||
1511 | /* low dword is word swapped version of common */ | 1590 | /* low dword is word swapped version of common */ |
1512 | lo_hash_dword = (hi_hash_dword >> 16) | (hi_hash_dword << 16); | 1591 | lo_hash_dword = (hi_hash_dword >> 16) | (hi_hash_dword << 16); |
1513 | 1592 | ||
1514 | /* apply flow ID/VM pool/VLAN ID bits to hash words */ | 1593 | /* apply flow ID/VM pool/VLAN ID bits to hash words */ |
1515 | hi_hash_dword ^= flow_vm_vlan ^ (flow_vm_vlan >> 16); | 1594 | hi_hash_dword ^= flow_vm_vlan ^ (flow_vm_vlan >> 16); |
1516 | 1595 | ||
1517 | /* Process bits 0 and 16 */ | 1596 | /* Process bits 0 and 16 */ |
1518 | IXGBE_COMPUTE_BKT_HASH_ITERATION(0); | 1597 | IXGBE_COMPUTE_BKT_HASH_ITERATION(0); |
1519 | 1598 | ||
1520 | /* | 1599 | /* |
1521 | * apply flow ID/VM pool/VLAN ID bits to lo hash dword, we had to | 1600 | * apply flow ID/VM pool/VLAN ID bits to lo hash dword, we had to |
1522 | * delay this because bit 0 of the stream should not be processed | 1601 | * delay this because bit 0 of the stream should not be processed |
1523 | * so we do not add the vlan until after bit 0 was processed | 1602 | * so we do not add the vlan until after bit 0 was processed |
1524 | */ | 1603 | */ |
1525 | lo_hash_dword ^= flow_vm_vlan ^ (flow_vm_vlan << 16); | 1604 | lo_hash_dword ^= flow_vm_vlan ^ (flow_vm_vlan << 16); |
1526 | 1605 | ||
1527 | /* Process remaining 30 bit of the key */ | 1606 | /* Process remaining 30 bit of the key */ |
1528 | IXGBE_COMPUTE_BKT_HASH_ITERATION(1); | 1607 | IXGBE_COMPUTE_BKT_HASH_ITERATION(1); |
1529 | IXGBE_COMPUTE_BKT_HASH_ITERATION(2); | 1608 | IXGBE_COMPUTE_BKT_HASH_ITERATION(2); |
1530 | IXGBE_COMPUTE_BKT_HASH_ITERATION(3); | 1609 | IXGBE_COMPUTE_BKT_HASH_ITERATION(3); |
1531 | IXGBE_COMPUTE_BKT_HASH_ITERATION(4); | 1610 | IXGBE_COMPUTE_BKT_HASH_ITERATION(4); |
1532 | IXGBE_COMPUTE_BKT_HASH_ITERATION(5); | 1611 | IXGBE_COMPUTE_BKT_HASH_ITERATION(5); |
1533 | IXGBE_COMPUTE_BKT_HASH_ITERATION(6); | 1612 | IXGBE_COMPUTE_BKT_HASH_ITERATION(6); |
1534 | IXGBE_COMPUTE_BKT_HASH_ITERATION(7); | 1613 | IXGBE_COMPUTE_BKT_HASH_ITERATION(7); |
1535 | IXGBE_COMPUTE_BKT_HASH_ITERATION(8); | 1614 | IXGBE_COMPUTE_BKT_HASH_ITERATION(8); |
1536 | IXGBE_COMPUTE_BKT_HASH_ITERATION(9); | 1615 | IXGBE_COMPUTE_BKT_HASH_ITERATION(9); |
1537 | IXGBE_COMPUTE_BKT_HASH_ITERATION(10); | 1616 | IXGBE_COMPUTE_BKT_HASH_ITERATION(10); |
1538 | IXGBE_COMPUTE_BKT_HASH_ITERATION(11); | 1617 | IXGBE_COMPUTE_BKT_HASH_ITERATION(11); |
1539 | IXGBE_COMPUTE_BKT_HASH_ITERATION(12); | 1618 | IXGBE_COMPUTE_BKT_HASH_ITERATION(12); |
1540 | IXGBE_COMPUTE_BKT_HASH_ITERATION(13); | 1619 | IXGBE_COMPUTE_BKT_HASH_ITERATION(13); |
1541 | IXGBE_COMPUTE_BKT_HASH_ITERATION(14); | 1620 | IXGBE_COMPUTE_BKT_HASH_ITERATION(14); |
1542 | IXGBE_COMPUTE_BKT_HASH_ITERATION(15); | 1621 | IXGBE_COMPUTE_BKT_HASH_ITERATION(15); |
1543 | 1622 | ||
1544 | /* | 1623 | /* |
1545 | * Limit hash to 13 bits since max bucket count is 8K. | 1624 | * Limit hash to 13 bits since max bucket count is 8K. |
1546 | * Store result at the end of the input stream. | 1625 | * Store result at the end of the input stream. |
1547 | */ | 1626 | */ |
1548 | input->formatted.bkt_hash = bucket_hash & 0x1FFF; | 1627 | input->formatted.bkt_hash = bucket_hash & 0x1FFF; |
1549 | } | 1628 | } |
1550 | 1629 | ||
1551 | /** | 1630 | /** |
1552 | * ixgbe_get_fdirtcpm_82599 - generate a tcp port from atr_input_masks | 1631 | * ixgbe_get_fdirtcpm_82599 - generate a tcp port from atr_input_masks |
1553 | * @input_mask: mask to be bit swapped | 1632 | * @input_mask: mask to be bit swapped |
1554 | * | 1633 | * |
1555 | * The source and destination port masks for flow director are bit swapped | 1634 | * The source and destination port masks for flow director are bit swapped |
1556 | * in that bit 15 effects bit 0, 14 effects 1, 13, 2 etc. In order to | 1635 | * in that bit 15 effects bit 0, 14 effects 1, 13, 2 etc. In order to |
1557 | * generate a correctly swapped value we need to bit swap the mask and that | 1636 | * generate a correctly swapped value we need to bit swap the mask and that |
1558 | * is what is accomplished by this function. | 1637 | * is what is accomplished by this function. |
1559 | **/ | 1638 | **/ |
1560 | static u32 ixgbe_get_fdirtcpm_82599(union ixgbe_atr_input *input_mask) | 1639 | static u32 ixgbe_get_fdirtcpm_82599(union ixgbe_atr_input *input_mask) |
1561 | { | 1640 | { |
1562 | u32 mask = ntohs(input_mask->formatted.dst_port); | 1641 | u32 mask = ntohs(input_mask->formatted.dst_port); |
1563 | mask <<= IXGBE_FDIRTCPM_DPORTM_SHIFT; | 1642 | mask <<= IXGBE_FDIRTCPM_DPORTM_SHIFT; |
1564 | mask |= ntohs(input_mask->formatted.src_port); | 1643 | mask |= ntohs(input_mask->formatted.src_port); |
1565 | mask = ((mask & 0x55555555) << 1) | ((mask & 0xAAAAAAAA) >> 1); | 1644 | mask = ((mask & 0x55555555) << 1) | ((mask & 0xAAAAAAAA) >> 1); |
1566 | mask = ((mask & 0x33333333) << 2) | ((mask & 0xCCCCCCCC) >> 2); | 1645 | mask = ((mask & 0x33333333) << 2) | ((mask & 0xCCCCCCCC) >> 2); |
1567 | mask = ((mask & 0x0F0F0F0F) << 4) | ((mask & 0xF0F0F0F0) >> 4); | 1646 | mask = ((mask & 0x0F0F0F0F) << 4) | ((mask & 0xF0F0F0F0) >> 4); |
1568 | return ((mask & 0x00FF00FF) << 8) | ((mask & 0xFF00FF00) >> 8); | 1647 | return ((mask & 0x00FF00FF) << 8) | ((mask & 0xFF00FF00) >> 8); |
1569 | } | 1648 | } |
1570 | 1649 | ||
1571 | /* | 1650 | /* |
1572 | * These two macros are meant to address the fact that we have registers | 1651 | * These two macros are meant to address the fact that we have registers |
1573 | * that are either all or in part big-endian. As a result on big-endian | 1652 | * that are either all or in part big-endian. As a result on big-endian |
1574 | * systems we will end up byte swapping the value to little-endian before | 1653 | * systems we will end up byte swapping the value to little-endian before |
1575 | * it is byte swapped again and written to the hardware in the original | 1654 | * it is byte swapped again and written to the hardware in the original |
1576 | * big-endian format. | 1655 | * big-endian format. |
1577 | */ | 1656 | */ |
1578 | #define IXGBE_STORE_AS_BE32(_value) \ | 1657 | #define IXGBE_STORE_AS_BE32(_value) \ |
1579 | (((u32)(_value) >> 24) | (((u32)(_value) & 0x00FF0000) >> 8) | \ | 1658 | (((u32)(_value) >> 24) | (((u32)(_value) & 0x00FF0000) >> 8) | \ |
1580 | (((u32)(_value) & 0x0000FF00) << 8) | ((u32)(_value) << 24)) | 1659 | (((u32)(_value) & 0x0000FF00) << 8) | ((u32)(_value) << 24)) |
1581 | 1660 | ||
1582 | #define IXGBE_WRITE_REG_BE32(a, reg, value) \ | 1661 | #define IXGBE_WRITE_REG_BE32(a, reg, value) \ |
1583 | IXGBE_WRITE_REG((a), (reg), IXGBE_STORE_AS_BE32(ntohl(value))) | 1662 | IXGBE_WRITE_REG((a), (reg), IXGBE_STORE_AS_BE32(ntohl(value))) |
1584 | 1663 | ||
1585 | #define IXGBE_STORE_AS_BE16(_value) \ | 1664 | #define IXGBE_STORE_AS_BE16(_value) \ |
1586 | ntohs(((u16)(_value) >> 8) | ((u16)(_value) << 8)) | 1665 | ntohs(((u16)(_value) >> 8) | ((u16)(_value) << 8)) |
1587 | 1666 | ||
1588 | s32 ixgbe_fdir_set_input_mask_82599(struct ixgbe_hw *hw, | 1667 | s32 ixgbe_fdir_set_input_mask_82599(struct ixgbe_hw *hw, |
1589 | union ixgbe_atr_input *input_mask) | 1668 | union ixgbe_atr_input *input_mask) |
1590 | { | 1669 | { |
1591 | /* mask IPv6 since it is currently not supported */ | 1670 | /* mask IPv6 since it is currently not supported */ |
1592 | u32 fdirm = IXGBE_FDIRM_DIPv6; | 1671 | u32 fdirm = IXGBE_FDIRM_DIPv6; |
1593 | u32 fdirtcpm; | 1672 | u32 fdirtcpm; |
1594 | 1673 | ||
1595 | /* | 1674 | /* |
1596 | * Program the relevant mask registers. If src/dst_port or src/dst_addr | 1675 | * Program the relevant mask registers. If src/dst_port or src/dst_addr |
1597 | * are zero, then assume a full mask for that field. Also assume that | 1676 | * are zero, then assume a full mask for that field. Also assume that |
1598 | * a VLAN of 0 is unspecified, so mask that out as well. L4type | 1677 | * a VLAN of 0 is unspecified, so mask that out as well. L4type |
1599 | * cannot be masked out in this implementation. | 1678 | * cannot be masked out in this implementation. |
1600 | * | 1679 | * |
1601 | * This also assumes IPv4 only. IPv6 masking isn't supported at this | 1680 | * This also assumes IPv4 only. IPv6 masking isn't supported at this |
1602 | * point in time. | 1681 | * point in time. |
1603 | */ | 1682 | */ |
1604 | 1683 | ||
1605 | /* verify bucket hash is cleared on hash generation */ | 1684 | /* verify bucket hash is cleared on hash generation */ |
1606 | if (input_mask->formatted.bkt_hash) | 1685 | if (input_mask->formatted.bkt_hash) |
1607 | hw_dbg(hw, " bucket hash should always be 0 in mask\n"); | 1686 | hw_dbg(hw, " bucket hash should always be 0 in mask\n"); |
1608 | 1687 | ||
1609 | /* Program FDIRM and verify partial masks */ | 1688 | /* Program FDIRM and verify partial masks */ |
1610 | switch (input_mask->formatted.vm_pool & 0x7F) { | 1689 | switch (input_mask->formatted.vm_pool & 0x7F) { |
1611 | case 0x0: | 1690 | case 0x0: |
1612 | fdirm |= IXGBE_FDIRM_POOL; | 1691 | fdirm |= IXGBE_FDIRM_POOL; |
1613 | case 0x7F: | 1692 | case 0x7F: |
1614 | break; | 1693 | break; |
1615 | default: | 1694 | default: |
1616 | hw_dbg(hw, " Error on vm pool mask\n"); | 1695 | hw_dbg(hw, " Error on vm pool mask\n"); |
1617 | return IXGBE_ERR_CONFIG; | 1696 | return IXGBE_ERR_CONFIG; |
1618 | } | 1697 | } |
1619 | 1698 | ||
1620 | switch (input_mask->formatted.flow_type & IXGBE_ATR_L4TYPE_MASK) { | 1699 | switch (input_mask->formatted.flow_type & IXGBE_ATR_L4TYPE_MASK) { |
1621 | case 0x0: | 1700 | case 0x0: |
1622 | fdirm |= IXGBE_FDIRM_L4P; | 1701 | fdirm |= IXGBE_FDIRM_L4P; |
1623 | if (input_mask->formatted.dst_port || | 1702 | if (input_mask->formatted.dst_port || |
1624 | input_mask->formatted.src_port) { | 1703 | input_mask->formatted.src_port) { |
1625 | hw_dbg(hw, " Error on src/dst port mask\n"); | 1704 | hw_dbg(hw, " Error on src/dst port mask\n"); |
1626 | return IXGBE_ERR_CONFIG; | 1705 | return IXGBE_ERR_CONFIG; |
1627 | } | 1706 | } |
1628 | case IXGBE_ATR_L4TYPE_MASK: | 1707 | case IXGBE_ATR_L4TYPE_MASK: |
1629 | break; | 1708 | break; |
1630 | default: | 1709 | default: |
1631 | hw_dbg(hw, " Error on flow type mask\n"); | 1710 | hw_dbg(hw, " Error on flow type mask\n"); |
1632 | return IXGBE_ERR_CONFIG; | 1711 | return IXGBE_ERR_CONFIG; |
1633 | } | 1712 | } |
1634 | 1713 | ||
1635 | switch (ntohs(input_mask->formatted.vlan_id) & 0xEFFF) { | 1714 | switch (ntohs(input_mask->formatted.vlan_id) & 0xEFFF) { |
1636 | case 0x0000: | 1715 | case 0x0000: |
1637 | /* mask VLAN ID, fall through to mask VLAN priority */ | 1716 | /* mask VLAN ID, fall through to mask VLAN priority */ |
1638 | fdirm |= IXGBE_FDIRM_VLANID; | 1717 | fdirm |= IXGBE_FDIRM_VLANID; |
1639 | case 0x0FFF: | 1718 | case 0x0FFF: |
1640 | /* mask VLAN priority */ | 1719 | /* mask VLAN priority */ |
1641 | fdirm |= IXGBE_FDIRM_VLANP; | 1720 | fdirm |= IXGBE_FDIRM_VLANP; |
1642 | break; | 1721 | break; |
1643 | case 0xE000: | 1722 | case 0xE000: |
1644 | /* mask VLAN ID only, fall through */ | 1723 | /* mask VLAN ID only, fall through */ |
1645 | fdirm |= IXGBE_FDIRM_VLANID; | 1724 | fdirm |= IXGBE_FDIRM_VLANID; |
1646 | case 0xEFFF: | 1725 | case 0xEFFF: |
1647 | /* no VLAN fields masked */ | 1726 | /* no VLAN fields masked */ |
1648 | break; | 1727 | break; |
1649 | default: | 1728 | default: |
1650 | hw_dbg(hw, " Error on VLAN mask\n"); | 1729 | hw_dbg(hw, " Error on VLAN mask\n"); |
1651 | return IXGBE_ERR_CONFIG; | 1730 | return IXGBE_ERR_CONFIG; |
1652 | } | 1731 | } |
1653 | 1732 | ||
1654 | switch (input_mask->formatted.flex_bytes & 0xFFFF) { | 1733 | switch (input_mask->formatted.flex_bytes & 0xFFFF) { |
1655 | case 0x0000: | 1734 | case 0x0000: |
1656 | /* Mask Flex Bytes, fall through */ | 1735 | /* Mask Flex Bytes, fall through */ |
1657 | fdirm |= IXGBE_FDIRM_FLEX; | 1736 | fdirm |= IXGBE_FDIRM_FLEX; |
1658 | case 0xFFFF: | 1737 | case 0xFFFF: |
1659 | break; | 1738 | break; |
1660 | default: | 1739 | default: |
1661 | hw_dbg(hw, " Error on flexible byte mask\n"); | 1740 | hw_dbg(hw, " Error on flexible byte mask\n"); |
1662 | return IXGBE_ERR_CONFIG; | 1741 | return IXGBE_ERR_CONFIG; |
1663 | } | 1742 | } |
1664 | 1743 | ||
1665 | /* Now mask VM pool and destination IPv6 - bits 5 and 2 */ | 1744 | /* Now mask VM pool and destination IPv6 - bits 5 and 2 */ |
1666 | IXGBE_WRITE_REG(hw, IXGBE_FDIRM, fdirm); | 1745 | IXGBE_WRITE_REG(hw, IXGBE_FDIRM, fdirm); |
1667 | 1746 | ||
1668 | /* store the TCP/UDP port masks, bit reversed from port layout */ | 1747 | /* store the TCP/UDP port masks, bit reversed from port layout */ |
1669 | fdirtcpm = ixgbe_get_fdirtcpm_82599(input_mask); | 1748 | fdirtcpm = ixgbe_get_fdirtcpm_82599(input_mask); |
1670 | 1749 | ||
1671 | /* write both the same so that UDP and TCP use the same mask */ | 1750 | /* write both the same so that UDP and TCP use the same mask */ |
1672 | IXGBE_WRITE_REG(hw, IXGBE_FDIRTCPM, ~fdirtcpm); | 1751 | IXGBE_WRITE_REG(hw, IXGBE_FDIRTCPM, ~fdirtcpm); |
1673 | IXGBE_WRITE_REG(hw, IXGBE_FDIRUDPM, ~fdirtcpm); | 1752 | IXGBE_WRITE_REG(hw, IXGBE_FDIRUDPM, ~fdirtcpm); |
1674 | 1753 | ||
1675 | /* store source and destination IP masks (big-enian) */ | 1754 | /* store source and destination IP masks (big-enian) */ |
1676 | IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRSIP4M, | 1755 | IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRSIP4M, |
1677 | ~input_mask->formatted.src_ip[0]); | 1756 | ~input_mask->formatted.src_ip[0]); |
1678 | IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRDIP4M, | 1757 | IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRDIP4M, |
1679 | ~input_mask->formatted.dst_ip[0]); | 1758 | ~input_mask->formatted.dst_ip[0]); |
1680 | 1759 | ||
1681 | return 0; | 1760 | return 0; |
1682 | } | 1761 | } |
1683 | 1762 | ||
1684 | s32 ixgbe_fdir_write_perfect_filter_82599(struct ixgbe_hw *hw, | 1763 | s32 ixgbe_fdir_write_perfect_filter_82599(struct ixgbe_hw *hw, |
1685 | union ixgbe_atr_input *input, | 1764 | union ixgbe_atr_input *input, |
1686 | u16 soft_id, u8 queue) | 1765 | u16 soft_id, u8 queue) |
1687 | { | 1766 | { |
1688 | u32 fdirport, fdirvlan, fdirhash, fdircmd; | 1767 | u32 fdirport, fdirvlan, fdirhash, fdircmd; |
1689 | 1768 | ||
1690 | /* currently IPv6 is not supported, must be programmed with 0 */ | 1769 | /* currently IPv6 is not supported, must be programmed with 0 */ |
1691 | IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRSIPv6(0), | 1770 | IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRSIPv6(0), |
1692 | input->formatted.src_ip[0]); | 1771 | input->formatted.src_ip[0]); |
1693 | IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRSIPv6(1), | 1772 | IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRSIPv6(1), |
1694 | input->formatted.src_ip[1]); | 1773 | input->formatted.src_ip[1]); |
1695 | IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRSIPv6(2), | 1774 | IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRSIPv6(2), |
1696 | input->formatted.src_ip[2]); | 1775 | input->formatted.src_ip[2]); |
1697 | 1776 | ||
1698 | /* record the source address (big-endian) */ | 1777 | /* record the source address (big-endian) */ |
1699 | IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRIPSA, input->formatted.src_ip[0]); | 1778 | IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRIPSA, input->formatted.src_ip[0]); |
1700 | 1779 | ||
1701 | /* record the first 32 bits of the destination address (big-endian) */ | 1780 | /* record the first 32 bits of the destination address (big-endian) */ |
1702 | IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRIPDA, input->formatted.dst_ip[0]); | 1781 | IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRIPDA, input->formatted.dst_ip[0]); |
1703 | 1782 | ||
1704 | /* record source and destination port (little-endian)*/ | 1783 | /* record source and destination port (little-endian)*/ |
1705 | fdirport = ntohs(input->formatted.dst_port); | 1784 | fdirport = ntohs(input->formatted.dst_port); |
1706 | fdirport <<= IXGBE_FDIRPORT_DESTINATION_SHIFT; | 1785 | fdirport <<= IXGBE_FDIRPORT_DESTINATION_SHIFT; |
1707 | fdirport |= ntohs(input->formatted.src_port); | 1786 | fdirport |= ntohs(input->formatted.src_port); |
1708 | IXGBE_WRITE_REG(hw, IXGBE_FDIRPORT, fdirport); | 1787 | IXGBE_WRITE_REG(hw, IXGBE_FDIRPORT, fdirport); |
1709 | 1788 | ||
1710 | /* record vlan (little-endian) and flex_bytes(big-endian) */ | 1789 | /* record vlan (little-endian) and flex_bytes(big-endian) */ |
1711 | fdirvlan = IXGBE_STORE_AS_BE16(input->formatted.flex_bytes); | 1790 | fdirvlan = IXGBE_STORE_AS_BE16(input->formatted.flex_bytes); |
1712 | fdirvlan <<= IXGBE_FDIRVLAN_FLEX_SHIFT; | 1791 | fdirvlan <<= IXGBE_FDIRVLAN_FLEX_SHIFT; |
1713 | fdirvlan |= ntohs(input->formatted.vlan_id); | 1792 | fdirvlan |= ntohs(input->formatted.vlan_id); |
1714 | IXGBE_WRITE_REG(hw, IXGBE_FDIRVLAN, fdirvlan); | 1793 | IXGBE_WRITE_REG(hw, IXGBE_FDIRVLAN, fdirvlan); |
1715 | 1794 | ||
1716 | /* configure FDIRHASH register */ | 1795 | /* configure FDIRHASH register */ |
1717 | fdirhash = input->formatted.bkt_hash; | 1796 | fdirhash = input->formatted.bkt_hash; |
1718 | fdirhash |= soft_id << IXGBE_FDIRHASH_SIG_SW_INDEX_SHIFT; | 1797 | fdirhash |= soft_id << IXGBE_FDIRHASH_SIG_SW_INDEX_SHIFT; |
1719 | IXGBE_WRITE_REG(hw, IXGBE_FDIRHASH, fdirhash); | 1798 | IXGBE_WRITE_REG(hw, IXGBE_FDIRHASH, fdirhash); |
1720 | 1799 | ||
1721 | /* | 1800 | /* |
1722 | * flush all previous writes to make certain registers are | 1801 | * flush all previous writes to make certain registers are |
1723 | * programmed prior to issuing the command | 1802 | * programmed prior to issuing the command |
1724 | */ | 1803 | */ |
1725 | IXGBE_WRITE_FLUSH(hw); | 1804 | IXGBE_WRITE_FLUSH(hw); |
1726 | 1805 | ||
1727 | /* configure FDIRCMD register */ | 1806 | /* configure FDIRCMD register */ |
1728 | fdircmd = IXGBE_FDIRCMD_CMD_ADD_FLOW | IXGBE_FDIRCMD_FILTER_UPDATE | | 1807 | fdircmd = IXGBE_FDIRCMD_CMD_ADD_FLOW | IXGBE_FDIRCMD_FILTER_UPDATE | |
1729 | IXGBE_FDIRCMD_LAST | IXGBE_FDIRCMD_QUEUE_EN; | 1808 | IXGBE_FDIRCMD_LAST | IXGBE_FDIRCMD_QUEUE_EN; |
1730 | if (queue == IXGBE_FDIR_DROP_QUEUE) | 1809 | if (queue == IXGBE_FDIR_DROP_QUEUE) |
1731 | fdircmd |= IXGBE_FDIRCMD_DROP; | 1810 | fdircmd |= IXGBE_FDIRCMD_DROP; |
1732 | fdircmd |= input->formatted.flow_type << IXGBE_FDIRCMD_FLOW_TYPE_SHIFT; | 1811 | fdircmd |= input->formatted.flow_type << IXGBE_FDIRCMD_FLOW_TYPE_SHIFT; |
1733 | fdircmd |= (u32)queue << IXGBE_FDIRCMD_RX_QUEUE_SHIFT; | 1812 | fdircmd |= (u32)queue << IXGBE_FDIRCMD_RX_QUEUE_SHIFT; |
1734 | fdircmd |= (u32)input->formatted.vm_pool << IXGBE_FDIRCMD_VT_POOL_SHIFT; | 1813 | fdircmd |= (u32)input->formatted.vm_pool << IXGBE_FDIRCMD_VT_POOL_SHIFT; |
1735 | 1814 | ||
1736 | IXGBE_WRITE_REG(hw, IXGBE_FDIRCMD, fdircmd); | 1815 | IXGBE_WRITE_REG(hw, IXGBE_FDIRCMD, fdircmd); |
1737 | 1816 | ||
1738 | return 0; | 1817 | return 0; |
1739 | } | 1818 | } |
1740 | 1819 | ||
1741 | s32 ixgbe_fdir_erase_perfect_filter_82599(struct ixgbe_hw *hw, | 1820 | s32 ixgbe_fdir_erase_perfect_filter_82599(struct ixgbe_hw *hw, |
1742 | union ixgbe_atr_input *input, | 1821 | union ixgbe_atr_input *input, |
1743 | u16 soft_id) | 1822 | u16 soft_id) |
1744 | { | 1823 | { |
1745 | u32 fdirhash; | 1824 | u32 fdirhash; |
1746 | u32 fdircmd = 0; | 1825 | u32 fdircmd = 0; |
1747 | u32 retry_count; | 1826 | u32 retry_count; |
1748 | s32 err = 0; | 1827 | s32 err = 0; |
1749 | 1828 | ||
1750 | /* configure FDIRHASH register */ | 1829 | /* configure FDIRHASH register */ |
1751 | fdirhash = input->formatted.bkt_hash; | 1830 | fdirhash = input->formatted.bkt_hash; |
1752 | fdirhash |= soft_id << IXGBE_FDIRHASH_SIG_SW_INDEX_SHIFT; | 1831 | fdirhash |= soft_id << IXGBE_FDIRHASH_SIG_SW_INDEX_SHIFT; |
1753 | IXGBE_WRITE_REG(hw, IXGBE_FDIRHASH, fdirhash); | 1832 | IXGBE_WRITE_REG(hw, IXGBE_FDIRHASH, fdirhash); |
1754 | 1833 | ||
1755 | /* flush hash to HW */ | 1834 | /* flush hash to HW */ |
1756 | IXGBE_WRITE_FLUSH(hw); | 1835 | IXGBE_WRITE_FLUSH(hw); |
1757 | 1836 | ||
1758 | /* Query if filter is present */ | 1837 | /* Query if filter is present */ |
1759 | IXGBE_WRITE_REG(hw, IXGBE_FDIRCMD, IXGBE_FDIRCMD_CMD_QUERY_REM_FILT); | 1838 | IXGBE_WRITE_REG(hw, IXGBE_FDIRCMD, IXGBE_FDIRCMD_CMD_QUERY_REM_FILT); |
1760 | 1839 | ||
1761 | for (retry_count = 10; retry_count; retry_count--) { | 1840 | for (retry_count = 10; retry_count; retry_count--) { |
1762 | /* allow 10us for query to process */ | 1841 | /* allow 10us for query to process */ |
1763 | udelay(10); | 1842 | udelay(10); |
1764 | /* verify query completed successfully */ | 1843 | /* verify query completed successfully */ |
1765 | fdircmd = IXGBE_READ_REG(hw, IXGBE_FDIRCMD); | 1844 | fdircmd = IXGBE_READ_REG(hw, IXGBE_FDIRCMD); |
1766 | if (!(fdircmd & IXGBE_FDIRCMD_CMD_MASK)) | 1845 | if (!(fdircmd & IXGBE_FDIRCMD_CMD_MASK)) |
1767 | break; | 1846 | break; |
1768 | } | 1847 | } |
1769 | 1848 | ||
1770 | if (!retry_count) | 1849 | if (!retry_count) |
1771 | err = IXGBE_ERR_FDIR_REINIT_FAILED; | 1850 | err = IXGBE_ERR_FDIR_REINIT_FAILED; |
1772 | 1851 | ||
1773 | /* if filter exists in hardware then remove it */ | 1852 | /* if filter exists in hardware then remove it */ |
1774 | if (fdircmd & IXGBE_FDIRCMD_FILTER_VALID) { | 1853 | if (fdircmd & IXGBE_FDIRCMD_FILTER_VALID) { |
1775 | IXGBE_WRITE_REG(hw, IXGBE_FDIRHASH, fdirhash); | 1854 | IXGBE_WRITE_REG(hw, IXGBE_FDIRHASH, fdirhash); |
1776 | IXGBE_WRITE_FLUSH(hw); | 1855 | IXGBE_WRITE_FLUSH(hw); |
1777 | IXGBE_WRITE_REG(hw, IXGBE_FDIRCMD, | 1856 | IXGBE_WRITE_REG(hw, IXGBE_FDIRCMD, |
1778 | IXGBE_FDIRCMD_CMD_REMOVE_FLOW); | 1857 | IXGBE_FDIRCMD_CMD_REMOVE_FLOW); |
1779 | } | 1858 | } |
1780 | 1859 | ||
1781 | return err; | 1860 | return err; |
1782 | } | 1861 | } |
1783 | 1862 | ||
1784 | /** | 1863 | /** |
1785 | * ixgbe_read_analog_reg8_82599 - Reads 8 bit Omer analog register | 1864 | * ixgbe_read_analog_reg8_82599 - Reads 8 bit Omer analog register |
1786 | * @hw: pointer to hardware structure | 1865 | * @hw: pointer to hardware structure |
1787 | * @reg: analog register to read | 1866 | * @reg: analog register to read |
1788 | * @val: read value | 1867 | * @val: read value |
1789 | * | 1868 | * |
1790 | * Performs read operation to Omer analog register specified. | 1869 | * Performs read operation to Omer analog register specified. |
1791 | **/ | 1870 | **/ |
1792 | static s32 ixgbe_read_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 *val) | 1871 | static s32 ixgbe_read_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 *val) |
1793 | { | 1872 | { |
1794 | u32 core_ctl; | 1873 | u32 core_ctl; |
1795 | 1874 | ||
1796 | IXGBE_WRITE_REG(hw, IXGBE_CORECTL, IXGBE_CORECTL_WRITE_CMD | | 1875 | IXGBE_WRITE_REG(hw, IXGBE_CORECTL, IXGBE_CORECTL_WRITE_CMD | |
1797 | (reg << 8)); | 1876 | (reg << 8)); |
1798 | IXGBE_WRITE_FLUSH(hw); | 1877 | IXGBE_WRITE_FLUSH(hw); |
1799 | udelay(10); | 1878 | udelay(10); |
1800 | core_ctl = IXGBE_READ_REG(hw, IXGBE_CORECTL); | 1879 | core_ctl = IXGBE_READ_REG(hw, IXGBE_CORECTL); |
1801 | *val = (u8)core_ctl; | 1880 | *val = (u8)core_ctl; |
1802 | 1881 | ||
1803 | return 0; | 1882 | return 0; |
1804 | } | 1883 | } |
1805 | 1884 | ||
1806 | /** | 1885 | /** |
1807 | * ixgbe_write_analog_reg8_82599 - Writes 8 bit Omer analog register | 1886 | * ixgbe_write_analog_reg8_82599 - Writes 8 bit Omer analog register |
1808 | * @hw: pointer to hardware structure | 1887 | * @hw: pointer to hardware structure |
1809 | * @reg: atlas register to write | 1888 | * @reg: atlas register to write |
1810 | * @val: value to write | 1889 | * @val: value to write |
1811 | * | 1890 | * |
1812 | * Performs write operation to Omer analog register specified. | 1891 | * Performs write operation to Omer analog register specified. |
1813 | **/ | 1892 | **/ |
1814 | static s32 ixgbe_write_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 val) | 1893 | static s32 ixgbe_write_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 val) |
1815 | { | 1894 | { |
1816 | u32 core_ctl; | 1895 | u32 core_ctl; |
1817 | 1896 | ||
1818 | core_ctl = (reg << 8) | val; | 1897 | core_ctl = (reg << 8) | val; |
1819 | IXGBE_WRITE_REG(hw, IXGBE_CORECTL, core_ctl); | 1898 | IXGBE_WRITE_REG(hw, IXGBE_CORECTL, core_ctl); |
1820 | IXGBE_WRITE_FLUSH(hw); | 1899 | IXGBE_WRITE_FLUSH(hw); |
1821 | udelay(10); | 1900 | udelay(10); |
1822 | 1901 | ||
1823 | return 0; | 1902 | return 0; |
1824 | } | 1903 | } |
1825 | 1904 | ||
1826 | /** | 1905 | /** |
1827 | * ixgbe_start_hw_82599 - Prepare hardware for Tx/Rx | 1906 | * ixgbe_start_hw_82599 - Prepare hardware for Tx/Rx |
1828 | * @hw: pointer to hardware structure | 1907 | * @hw: pointer to hardware structure |
1829 | * | 1908 | * |
1830 | * Starts the hardware using the generic start_hw function | 1909 | * Starts the hardware using the generic start_hw function |
1831 | * and the generation start_hw function. | 1910 | * and the generation start_hw function. |
1832 | * Then performs revision-specific operations, if any. | 1911 | * Then performs revision-specific operations, if any. |
1833 | **/ | 1912 | **/ |
1834 | static s32 ixgbe_start_hw_82599(struct ixgbe_hw *hw) | 1913 | static s32 ixgbe_start_hw_82599(struct ixgbe_hw *hw) |
1835 | { | 1914 | { |
1836 | s32 ret_val = 0; | 1915 | s32 ret_val = 0; |
1837 | 1916 | ||
1838 | ret_val = ixgbe_start_hw_generic(hw); | 1917 | ret_val = ixgbe_start_hw_generic(hw); |
1839 | if (ret_val != 0) | 1918 | if (ret_val != 0) |
1840 | goto out; | 1919 | goto out; |
1841 | 1920 | ||
1842 | ret_val = ixgbe_start_hw_gen2(hw); | 1921 | ret_val = ixgbe_start_hw_gen2(hw); |
1843 | if (ret_val != 0) | 1922 | if (ret_val != 0) |
1844 | goto out; | 1923 | goto out; |
1845 | 1924 | ||
1846 | /* We need to run link autotry after the driver loads */ | 1925 | /* We need to run link autotry after the driver loads */ |
1847 | hw->mac.autotry_restart = true; | 1926 | hw->mac.autotry_restart = true; |
1848 | hw->mac.rx_pb_size = IXGBE_82599_RX_PB_SIZE; | 1927 | hw->mac.rx_pb_size = IXGBE_82599_RX_PB_SIZE; |
1849 | 1928 | ||
1850 | if (ret_val == 0) | 1929 | if (ret_val == 0) |
1851 | ret_val = ixgbe_verify_fw_version_82599(hw); | 1930 | ret_val = ixgbe_verify_fw_version_82599(hw); |
1852 | out: | 1931 | out: |
1853 | return ret_val; | 1932 | return ret_val; |
1854 | } | 1933 | } |
1855 | 1934 | ||
1856 | /** | 1935 | /** |
1857 | * ixgbe_identify_phy_82599 - Get physical layer module | 1936 | * ixgbe_identify_phy_82599 - Get physical layer module |
1858 | * @hw: pointer to hardware structure | 1937 | * @hw: pointer to hardware structure |
1859 | * | 1938 | * |
1860 | * Determines the physical layer module found on the current adapter. | 1939 | * Determines the physical layer module found on the current adapter. |
1861 | * If PHY already detected, maintains current PHY type in hw struct, | 1940 | * If PHY already detected, maintains current PHY type in hw struct, |
1862 | * otherwise executes the PHY detection routine. | 1941 | * otherwise executes the PHY detection routine. |
1863 | **/ | 1942 | **/ |
1864 | static s32 ixgbe_identify_phy_82599(struct ixgbe_hw *hw) | 1943 | static s32 ixgbe_identify_phy_82599(struct ixgbe_hw *hw) |
1865 | { | 1944 | { |
1866 | s32 status = IXGBE_ERR_PHY_ADDR_INVALID; | 1945 | s32 status = IXGBE_ERR_PHY_ADDR_INVALID; |
1867 | 1946 | ||
1868 | /* Detect PHY if not unknown - returns success if already detected. */ | 1947 | /* Detect PHY if not unknown - returns success if already detected. */ |
1869 | status = ixgbe_identify_phy_generic(hw); | 1948 | status = ixgbe_identify_phy_generic(hw); |
1870 | if (status != 0) { | 1949 | if (status != 0) { |
1871 | /* 82599 10GBASE-T requires an external PHY */ | 1950 | /* 82599 10GBASE-T requires an external PHY */ |
1872 | if (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_copper) | 1951 | if (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_copper) |
1873 | goto out; | 1952 | goto out; |
1874 | else | 1953 | else |
1875 | status = ixgbe_identify_sfp_module_generic(hw); | 1954 | status = ixgbe_identify_sfp_module_generic(hw); |
1876 | } | 1955 | } |
1877 | 1956 | ||
1878 | /* Set PHY type none if no PHY detected */ | 1957 | /* Set PHY type none if no PHY detected */ |
1879 | if (hw->phy.type == ixgbe_phy_unknown) { | 1958 | if (hw->phy.type == ixgbe_phy_unknown) { |
1880 | hw->phy.type = ixgbe_phy_none; | 1959 | hw->phy.type = ixgbe_phy_none; |
1881 | status = 0; | 1960 | status = 0; |
1882 | } | 1961 | } |
1883 | 1962 | ||
1884 | /* Return error if SFP module has been detected but is not supported */ | 1963 | /* Return error if SFP module has been detected but is not supported */ |
1885 | if (hw->phy.type == ixgbe_phy_sfp_unsupported) | 1964 | if (hw->phy.type == ixgbe_phy_sfp_unsupported) |
1886 | status = IXGBE_ERR_SFP_NOT_SUPPORTED; | 1965 | status = IXGBE_ERR_SFP_NOT_SUPPORTED; |
1887 | 1966 | ||
1888 | out: | 1967 | out: |
1889 | return status; | 1968 | return status; |
1890 | } | 1969 | } |
1891 | 1970 | ||
1892 | /** | 1971 | /** |
1893 | * ixgbe_get_supported_physical_layer_82599 - Returns physical layer type | 1972 | * ixgbe_get_supported_physical_layer_82599 - Returns physical layer type |
1894 | * @hw: pointer to hardware structure | 1973 | * @hw: pointer to hardware structure |
1895 | * | 1974 | * |
1896 | * Determines physical layer capabilities of the current configuration. | 1975 | * Determines physical layer capabilities of the current configuration. |
1897 | **/ | 1976 | **/ |
1898 | static u32 ixgbe_get_supported_physical_layer_82599(struct ixgbe_hw *hw) | 1977 | static u32 ixgbe_get_supported_physical_layer_82599(struct ixgbe_hw *hw) |
1899 | { | 1978 | { |
1900 | u32 physical_layer = IXGBE_PHYSICAL_LAYER_UNKNOWN; | 1979 | u32 physical_layer = IXGBE_PHYSICAL_LAYER_UNKNOWN; |
1901 | u32 autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC); | 1980 | u32 autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC); |
1902 | u32 autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2); | 1981 | u32 autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2); |
1903 | u32 pma_pmd_10g_serial = autoc2 & IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_MASK; | 1982 | u32 pma_pmd_10g_serial = autoc2 & IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_MASK; |
1904 | u32 pma_pmd_10g_parallel = autoc & IXGBE_AUTOC_10G_PMA_PMD_MASK; | 1983 | u32 pma_pmd_10g_parallel = autoc & IXGBE_AUTOC_10G_PMA_PMD_MASK; |
1905 | u32 pma_pmd_1g = autoc & IXGBE_AUTOC_1G_PMA_PMD_MASK; | 1984 | u32 pma_pmd_1g = autoc & IXGBE_AUTOC_1G_PMA_PMD_MASK; |
1906 | u16 ext_ability = 0; | 1985 | u16 ext_ability = 0; |
1907 | u8 comp_codes_10g = 0; | 1986 | u8 comp_codes_10g = 0; |
1908 | u8 comp_codes_1g = 0; | 1987 | u8 comp_codes_1g = 0; |
1909 | 1988 | ||
1910 | hw->phy.ops.identify(hw); | 1989 | hw->phy.ops.identify(hw); |
1911 | 1990 | ||
1912 | switch (hw->phy.type) { | 1991 | switch (hw->phy.type) { |
1913 | case ixgbe_phy_tn: | 1992 | case ixgbe_phy_tn: |
1914 | case ixgbe_phy_cu_unknown: | 1993 | case ixgbe_phy_cu_unknown: |
1915 | hw->phy.ops.read_reg(hw, MDIO_PMA_EXTABLE, MDIO_MMD_PMAPMD, | 1994 | hw->phy.ops.read_reg(hw, MDIO_PMA_EXTABLE, MDIO_MMD_PMAPMD, |
1916 | &ext_ability); | 1995 | &ext_ability); |
1917 | if (ext_ability & MDIO_PMA_EXTABLE_10GBT) | 1996 | if (ext_ability & MDIO_PMA_EXTABLE_10GBT) |
1918 | physical_layer |= IXGBE_PHYSICAL_LAYER_10GBASE_T; | 1997 | physical_layer |= IXGBE_PHYSICAL_LAYER_10GBASE_T; |
1919 | if (ext_ability & MDIO_PMA_EXTABLE_1000BT) | 1998 | if (ext_ability & MDIO_PMA_EXTABLE_1000BT) |
1920 | physical_layer |= IXGBE_PHYSICAL_LAYER_1000BASE_T; | 1999 | physical_layer |= IXGBE_PHYSICAL_LAYER_1000BASE_T; |
1921 | if (ext_ability & MDIO_PMA_EXTABLE_100BTX) | 2000 | if (ext_ability & MDIO_PMA_EXTABLE_100BTX) |
1922 | physical_layer |= IXGBE_PHYSICAL_LAYER_100BASE_TX; | 2001 | physical_layer |= IXGBE_PHYSICAL_LAYER_100BASE_TX; |
1923 | goto out; | 2002 | goto out; |
1924 | default: | 2003 | default: |
1925 | break; | 2004 | break; |
1926 | } | 2005 | } |
1927 | 2006 | ||
1928 | switch (autoc & IXGBE_AUTOC_LMS_MASK) { | 2007 | switch (autoc & IXGBE_AUTOC_LMS_MASK) { |
1929 | case IXGBE_AUTOC_LMS_1G_AN: | 2008 | case IXGBE_AUTOC_LMS_1G_AN: |
1930 | case IXGBE_AUTOC_LMS_1G_LINK_NO_AN: | 2009 | case IXGBE_AUTOC_LMS_1G_LINK_NO_AN: |
1931 | if (pma_pmd_1g == IXGBE_AUTOC_1G_KX_BX) { | 2010 | if (pma_pmd_1g == IXGBE_AUTOC_1G_KX_BX) { |
1932 | physical_layer = IXGBE_PHYSICAL_LAYER_1000BASE_KX | | 2011 | physical_layer = IXGBE_PHYSICAL_LAYER_1000BASE_KX | |
1933 | IXGBE_PHYSICAL_LAYER_1000BASE_BX; | 2012 | IXGBE_PHYSICAL_LAYER_1000BASE_BX; |
1934 | goto out; | 2013 | goto out; |
1935 | } else | 2014 | } else |
1936 | /* SFI mode so read SFP module */ | 2015 | /* SFI mode so read SFP module */ |
1937 | goto sfp_check; | 2016 | goto sfp_check; |
1938 | break; | 2017 | break; |
1939 | case IXGBE_AUTOC_LMS_10G_LINK_NO_AN: | 2018 | case IXGBE_AUTOC_LMS_10G_LINK_NO_AN: |
1940 | if (pma_pmd_10g_parallel == IXGBE_AUTOC_10G_CX4) | 2019 | if (pma_pmd_10g_parallel == IXGBE_AUTOC_10G_CX4) |
1941 | physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_CX4; | 2020 | physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_CX4; |
1942 | else if (pma_pmd_10g_parallel == IXGBE_AUTOC_10G_KX4) | 2021 | else if (pma_pmd_10g_parallel == IXGBE_AUTOC_10G_KX4) |
1943 | physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_KX4; | 2022 | physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_KX4; |
1944 | else if (pma_pmd_10g_parallel == IXGBE_AUTOC_10G_XAUI) | 2023 | else if (pma_pmd_10g_parallel == IXGBE_AUTOC_10G_XAUI) |
1945 | physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_XAUI; | 2024 | physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_XAUI; |
1946 | goto out; | 2025 | goto out; |
1947 | break; | 2026 | break; |
1948 | case IXGBE_AUTOC_LMS_10G_SERIAL: | 2027 | case IXGBE_AUTOC_LMS_10G_SERIAL: |
1949 | if (pma_pmd_10g_serial == IXGBE_AUTOC2_10G_KR) { | 2028 | if (pma_pmd_10g_serial == IXGBE_AUTOC2_10G_KR) { |
1950 | physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_KR; | 2029 | physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_KR; |
1951 | goto out; | 2030 | goto out; |
1952 | } else if (pma_pmd_10g_serial == IXGBE_AUTOC2_10G_SFI) | 2031 | } else if (pma_pmd_10g_serial == IXGBE_AUTOC2_10G_SFI) |
1953 | goto sfp_check; | 2032 | goto sfp_check; |
1954 | break; | 2033 | break; |
1955 | case IXGBE_AUTOC_LMS_KX4_KX_KR: | 2034 | case IXGBE_AUTOC_LMS_KX4_KX_KR: |
1956 | case IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN: | 2035 | case IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN: |
1957 | if (autoc & IXGBE_AUTOC_KX_SUPP) | 2036 | if (autoc & IXGBE_AUTOC_KX_SUPP) |
1958 | physical_layer |= IXGBE_PHYSICAL_LAYER_1000BASE_KX; | 2037 | physical_layer |= IXGBE_PHYSICAL_LAYER_1000BASE_KX; |
1959 | if (autoc & IXGBE_AUTOC_KX4_SUPP) | 2038 | if (autoc & IXGBE_AUTOC_KX4_SUPP) |
1960 | physical_layer |= IXGBE_PHYSICAL_LAYER_10GBASE_KX4; | 2039 | physical_layer |= IXGBE_PHYSICAL_LAYER_10GBASE_KX4; |
1961 | if (autoc & IXGBE_AUTOC_KR_SUPP) | 2040 | if (autoc & IXGBE_AUTOC_KR_SUPP) |
1962 | physical_layer |= IXGBE_PHYSICAL_LAYER_10GBASE_KR; | 2041 | physical_layer |= IXGBE_PHYSICAL_LAYER_10GBASE_KR; |
1963 | goto out; | 2042 | goto out; |
1964 | break; | 2043 | break; |
1965 | default: | 2044 | default: |
1966 | goto out; | 2045 | goto out; |
1967 | break; | 2046 | break; |
1968 | } | 2047 | } |
1969 | 2048 | ||
1970 | sfp_check: | 2049 | sfp_check: |
1971 | /* SFP check must be done last since DA modules are sometimes used to | 2050 | /* SFP check must be done last since DA modules are sometimes used to |
1972 | * test KR mode - we need to id KR mode correctly before SFP module. | 2051 | * test KR mode - we need to id KR mode correctly before SFP module. |
1973 | * Call identify_sfp because the pluggable module may have changed */ | 2052 | * Call identify_sfp because the pluggable module may have changed */ |
1974 | hw->phy.ops.identify_sfp(hw); | 2053 | hw->phy.ops.identify_sfp(hw); |
1975 | if (hw->phy.sfp_type == ixgbe_sfp_type_not_present) | 2054 | if (hw->phy.sfp_type == ixgbe_sfp_type_not_present) |
1976 | goto out; | 2055 | goto out; |
1977 | 2056 | ||
1978 | switch (hw->phy.type) { | 2057 | switch (hw->phy.type) { |
1979 | case ixgbe_phy_sfp_passive_tyco: | 2058 | case ixgbe_phy_sfp_passive_tyco: |
1980 | case ixgbe_phy_sfp_passive_unknown: | 2059 | case ixgbe_phy_sfp_passive_unknown: |
1981 | physical_layer = IXGBE_PHYSICAL_LAYER_SFP_PLUS_CU; | 2060 | physical_layer = IXGBE_PHYSICAL_LAYER_SFP_PLUS_CU; |
1982 | break; | 2061 | break; |
1983 | case ixgbe_phy_sfp_ftl_active: | 2062 | case ixgbe_phy_sfp_ftl_active: |
1984 | case ixgbe_phy_sfp_active_unknown: | 2063 | case ixgbe_phy_sfp_active_unknown: |
1985 | physical_layer = IXGBE_PHYSICAL_LAYER_SFP_ACTIVE_DA; | 2064 | physical_layer = IXGBE_PHYSICAL_LAYER_SFP_ACTIVE_DA; |
1986 | break; | 2065 | break; |
1987 | case ixgbe_phy_sfp_avago: | 2066 | case ixgbe_phy_sfp_avago: |
1988 | case ixgbe_phy_sfp_ftl: | 2067 | case ixgbe_phy_sfp_ftl: |
1989 | case ixgbe_phy_sfp_intel: | 2068 | case ixgbe_phy_sfp_intel: |
1990 | case ixgbe_phy_sfp_unknown: | 2069 | case ixgbe_phy_sfp_unknown: |
1991 | hw->phy.ops.read_i2c_eeprom(hw, | 2070 | hw->phy.ops.read_i2c_eeprom(hw, |
1992 | IXGBE_SFF_1GBE_COMP_CODES, &comp_codes_1g); | 2071 | IXGBE_SFF_1GBE_COMP_CODES, &comp_codes_1g); |
1993 | hw->phy.ops.read_i2c_eeprom(hw, | 2072 | hw->phy.ops.read_i2c_eeprom(hw, |
1994 | IXGBE_SFF_10GBE_COMP_CODES, &comp_codes_10g); | 2073 | IXGBE_SFF_10GBE_COMP_CODES, &comp_codes_10g); |
1995 | if (comp_codes_10g & IXGBE_SFF_10GBASESR_CAPABLE) | 2074 | if (comp_codes_10g & IXGBE_SFF_10GBASESR_CAPABLE) |
1996 | physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_SR; | 2075 | physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_SR; |
1997 | else if (comp_codes_10g & IXGBE_SFF_10GBASELR_CAPABLE) | 2076 | else if (comp_codes_10g & IXGBE_SFF_10GBASELR_CAPABLE) |
1998 | physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_LR; | 2077 | physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_LR; |
1999 | else if (comp_codes_1g & IXGBE_SFF_1GBASET_CAPABLE) | 2078 | else if (comp_codes_1g & IXGBE_SFF_1GBASET_CAPABLE) |
2000 | physical_layer = IXGBE_PHYSICAL_LAYER_1000BASE_T; | 2079 | physical_layer = IXGBE_PHYSICAL_LAYER_1000BASE_T; |
2001 | break; | 2080 | break; |
2002 | default: | 2081 | default: |
2003 | break; | 2082 | break; |
2004 | } | 2083 | } |
2005 | 2084 | ||
2006 | out: | 2085 | out: |
2007 | return physical_layer; | 2086 | return physical_layer; |
2008 | } | 2087 | } |
2009 | 2088 | ||
2010 | /** | 2089 | /** |
2011 | * ixgbe_enable_rx_dma_82599 - Enable the Rx DMA unit on 82599 | 2090 | * ixgbe_enable_rx_dma_82599 - Enable the Rx DMA unit on 82599 |
2012 | * @hw: pointer to hardware structure | 2091 | * @hw: pointer to hardware structure |
2013 | * @regval: register value to write to RXCTRL | 2092 | * @regval: register value to write to RXCTRL |
2014 | * | 2093 | * |
2015 | * Enables the Rx DMA unit for 82599 | 2094 | * Enables the Rx DMA unit for 82599 |
2016 | **/ | 2095 | **/ |
2017 | static s32 ixgbe_enable_rx_dma_82599(struct ixgbe_hw *hw, u32 regval) | 2096 | static s32 ixgbe_enable_rx_dma_82599(struct ixgbe_hw *hw, u32 regval) |
2018 | { | 2097 | { |
2019 | /* | 2098 | /* |
2020 | * Workaround for 82599 silicon errata when enabling the Rx datapath. | 2099 | * Workaround for 82599 silicon errata when enabling the Rx datapath. |
2021 | * If traffic is incoming before we enable the Rx unit, it could hang | 2100 | * If traffic is incoming before we enable the Rx unit, it could hang |
2022 | * the Rx DMA unit. Therefore, make sure the security engine is | 2101 | * the Rx DMA unit. Therefore, make sure the security engine is |
2023 | * completely disabled prior to enabling the Rx unit. | 2102 | * completely disabled prior to enabling the Rx unit. |
2024 | */ | 2103 | */ |
2025 | hw->mac.ops.disable_rx_buff(hw); | 2104 | hw->mac.ops.disable_rx_buff(hw); |
2026 | 2105 | ||
2027 | IXGBE_WRITE_REG(hw, IXGBE_RXCTRL, regval); | 2106 | IXGBE_WRITE_REG(hw, IXGBE_RXCTRL, regval); |
2028 | 2107 | ||
2029 | hw->mac.ops.enable_rx_buff(hw); | 2108 | hw->mac.ops.enable_rx_buff(hw); |
2030 | 2109 | ||
2031 | return 0; | 2110 | return 0; |
2032 | } | 2111 | } |
2033 | 2112 | ||
2034 | /** | 2113 | /** |
2035 | * ixgbe_verify_fw_version_82599 - verify fw version for 82599 | 2114 | * ixgbe_verify_fw_version_82599 - verify fw version for 82599 |
2036 | * @hw: pointer to hardware structure | 2115 | * @hw: pointer to hardware structure |
2037 | * | 2116 | * |
2038 | * Verifies that installed the firmware version is 0.6 or higher | 2117 | * Verifies that installed the firmware version is 0.6 or higher |
2039 | * for SFI devices. All 82599 SFI devices should have version 0.6 or higher. | 2118 | * for SFI devices. All 82599 SFI devices should have version 0.6 or higher. |
2040 | * | 2119 | * |
2041 | * Returns IXGBE_ERR_EEPROM_VERSION if the FW is not present or | 2120 | * Returns IXGBE_ERR_EEPROM_VERSION if the FW is not present or |
2042 | * if the FW version is not supported. | 2121 | * if the FW version is not supported. |
2043 | **/ | 2122 | **/ |
2044 | static s32 ixgbe_verify_fw_version_82599(struct ixgbe_hw *hw) | 2123 | static s32 ixgbe_verify_fw_version_82599(struct ixgbe_hw *hw) |
2045 | { | 2124 | { |
2046 | s32 status = IXGBE_ERR_EEPROM_VERSION; | 2125 | s32 status = IXGBE_ERR_EEPROM_VERSION; |
2047 | u16 fw_offset, fw_ptp_cfg_offset; | 2126 | u16 fw_offset, fw_ptp_cfg_offset; |
2048 | u16 fw_version = 0; | 2127 | u16 fw_version = 0; |
2049 | 2128 | ||
2050 | /* firmware check is only necessary for SFI devices */ | 2129 | /* firmware check is only necessary for SFI devices */ |
2051 | if (hw->phy.media_type != ixgbe_media_type_fiber) { | 2130 | if (hw->phy.media_type != ixgbe_media_type_fiber) { |
2052 | status = 0; | 2131 | status = 0; |
2053 | goto fw_version_out; | 2132 | goto fw_version_out; |
2054 | } | 2133 | } |
2055 | 2134 | ||
2056 | /* get the offset to the Firmware Module block */ | 2135 | /* get the offset to the Firmware Module block */ |
2057 | hw->eeprom.ops.read(hw, IXGBE_FW_PTR, &fw_offset); | 2136 | hw->eeprom.ops.read(hw, IXGBE_FW_PTR, &fw_offset); |
2058 | 2137 | ||
2059 | if ((fw_offset == 0) || (fw_offset == 0xFFFF)) | 2138 | if ((fw_offset == 0) || (fw_offset == 0xFFFF)) |
2060 | goto fw_version_out; | 2139 | goto fw_version_out; |
2061 | 2140 | ||
2062 | /* get the offset to the Pass Through Patch Configuration block */ | 2141 | /* get the offset to the Pass Through Patch Configuration block */ |
2063 | hw->eeprom.ops.read(hw, (fw_offset + | 2142 | hw->eeprom.ops.read(hw, (fw_offset + |
2064 | IXGBE_FW_PASSTHROUGH_PATCH_CONFIG_PTR), | 2143 | IXGBE_FW_PASSTHROUGH_PATCH_CONFIG_PTR), |
2065 | &fw_ptp_cfg_offset); | 2144 | &fw_ptp_cfg_offset); |
2066 | 2145 | ||
2067 | if ((fw_ptp_cfg_offset == 0) || (fw_ptp_cfg_offset == 0xFFFF)) | 2146 | if ((fw_ptp_cfg_offset == 0) || (fw_ptp_cfg_offset == 0xFFFF)) |
2068 | goto fw_version_out; | 2147 | goto fw_version_out; |
2069 | 2148 | ||
2070 | /* get the firmware version */ | 2149 | /* get the firmware version */ |
2071 | hw->eeprom.ops.read(hw, (fw_ptp_cfg_offset + | 2150 | hw->eeprom.ops.read(hw, (fw_ptp_cfg_offset + |
2072 | IXGBE_FW_PATCH_VERSION_4), | 2151 | IXGBE_FW_PATCH_VERSION_4), |
2073 | &fw_version); | 2152 | &fw_version); |
2074 | 2153 | ||
2075 | if (fw_version > 0x5) | 2154 | if (fw_version > 0x5) |
2076 | status = 0; | 2155 | status = 0; |
2077 | 2156 | ||
2078 | fw_version_out: | 2157 | fw_version_out: |
2079 | return status; | 2158 | return status; |
2080 | } | 2159 | } |
2081 | 2160 | ||
2082 | /** | 2161 | /** |
2083 | * ixgbe_verify_lesm_fw_enabled_82599 - Checks LESM FW module state. | 2162 | * ixgbe_verify_lesm_fw_enabled_82599 - Checks LESM FW module state. |
2084 | * @hw: pointer to hardware structure | 2163 | * @hw: pointer to hardware structure |
2085 | * | 2164 | * |
2086 | * Returns true if the LESM FW module is present and enabled. Otherwise | 2165 | * Returns true if the LESM FW module is present and enabled. Otherwise |
2087 | * returns false. Smart Speed must be disabled if LESM FW module is enabled. | 2166 | * returns false. Smart Speed must be disabled if LESM FW module is enabled. |
2088 | **/ | 2167 | **/ |
2089 | bool ixgbe_verify_lesm_fw_enabled_82599(struct ixgbe_hw *hw) | 2168 | bool ixgbe_verify_lesm_fw_enabled_82599(struct ixgbe_hw *hw) |
2090 | { | 2169 | { |
2091 | bool lesm_enabled = false; | 2170 | bool lesm_enabled = false; |
2092 | u16 fw_offset, fw_lesm_param_offset, fw_lesm_state; | 2171 | u16 fw_offset, fw_lesm_param_offset, fw_lesm_state; |
2093 | s32 status; | 2172 | s32 status; |
2094 | 2173 | ||
2095 | /* get the offset to the Firmware Module block */ | 2174 | /* get the offset to the Firmware Module block */ |
2096 | status = hw->eeprom.ops.read(hw, IXGBE_FW_PTR, &fw_offset); | 2175 | status = hw->eeprom.ops.read(hw, IXGBE_FW_PTR, &fw_offset); |
2097 | 2176 | ||
2098 | if ((status != 0) || | 2177 | if ((status != 0) || |
2099 | (fw_offset == 0) || (fw_offset == 0xFFFF)) | 2178 | (fw_offset == 0) || (fw_offset == 0xFFFF)) |
2100 | goto out; | 2179 | goto out; |
2101 | 2180 | ||
2102 | /* get the offset to the LESM Parameters block */ | 2181 | /* get the offset to the LESM Parameters block */ |
2103 | status = hw->eeprom.ops.read(hw, (fw_offset + | 2182 | status = hw->eeprom.ops.read(hw, (fw_offset + |
2104 | IXGBE_FW_LESM_PARAMETERS_PTR), | 2183 | IXGBE_FW_LESM_PARAMETERS_PTR), |
2105 | &fw_lesm_param_offset); | 2184 | &fw_lesm_param_offset); |
2106 | 2185 | ||
2107 | if ((status != 0) || | 2186 | if ((status != 0) || |
2108 | (fw_lesm_param_offset == 0) || (fw_lesm_param_offset == 0xFFFF)) | 2187 | (fw_lesm_param_offset == 0) || (fw_lesm_param_offset == 0xFFFF)) |
2109 | goto out; | 2188 | goto out; |
2110 | 2189 | ||
2111 | /* get the lesm state word */ | 2190 | /* get the lesm state word */ |
2112 | status = hw->eeprom.ops.read(hw, (fw_lesm_param_offset + | 2191 | status = hw->eeprom.ops.read(hw, (fw_lesm_param_offset + |
2113 | IXGBE_FW_LESM_STATE_1), | 2192 | IXGBE_FW_LESM_STATE_1), |
2114 | &fw_lesm_state); | 2193 | &fw_lesm_state); |
2115 | 2194 | ||
2116 | if ((status == 0) && | 2195 | if ((status == 0) && |
2117 | (fw_lesm_state & IXGBE_FW_LESM_STATE_ENABLED)) | 2196 | (fw_lesm_state & IXGBE_FW_LESM_STATE_ENABLED)) |
2118 | lesm_enabled = true; | 2197 | lesm_enabled = true; |
2119 | 2198 | ||
2120 | out: | 2199 | out: |
2121 | return lesm_enabled; | 2200 | return lesm_enabled; |
2122 | } | 2201 | } |
2123 | 2202 | ||
2124 | /** | 2203 | /** |
2125 | * ixgbe_read_eeprom_buffer_82599 - Read EEPROM word(s) using | 2204 | * ixgbe_read_eeprom_buffer_82599 - Read EEPROM word(s) using |
2126 | * fastest available method | 2205 | * fastest available method |
2127 | * | 2206 | * |
2128 | * @hw: pointer to hardware structure | 2207 | * @hw: pointer to hardware structure |
2129 | * @offset: offset of word in EEPROM to read | 2208 | * @offset: offset of word in EEPROM to read |
2130 | * @words: number of words | 2209 | * @words: number of words |
2131 | * @data: word(s) read from the EEPROM | 2210 | * @data: word(s) read from the EEPROM |
2132 | * | 2211 | * |
2133 | * Retrieves 16 bit word(s) read from EEPROM | 2212 | * Retrieves 16 bit word(s) read from EEPROM |
2134 | **/ | 2213 | **/ |
2135 | static s32 ixgbe_read_eeprom_buffer_82599(struct ixgbe_hw *hw, u16 offset, | 2214 | static s32 ixgbe_read_eeprom_buffer_82599(struct ixgbe_hw *hw, u16 offset, |
2136 | u16 words, u16 *data) | 2215 | u16 words, u16 *data) |
2137 | { | 2216 | { |
2138 | struct ixgbe_eeprom_info *eeprom = &hw->eeprom; | 2217 | struct ixgbe_eeprom_info *eeprom = &hw->eeprom; |
2139 | s32 ret_val = IXGBE_ERR_CONFIG; | 2218 | s32 ret_val = IXGBE_ERR_CONFIG; |
2140 | 2219 | ||
2141 | /* | 2220 | /* |
2142 | * If EEPROM is detected and can be addressed using 14 bits, | 2221 | * If EEPROM is detected and can be addressed using 14 bits, |
2143 | * use EERD otherwise use bit bang | 2222 | * use EERD otherwise use bit bang |
2144 | */ | 2223 | */ |
2145 | if ((eeprom->type == ixgbe_eeprom_spi) && | 2224 | if ((eeprom->type == ixgbe_eeprom_spi) && |
2146 | (offset + (words - 1) <= IXGBE_EERD_MAX_ADDR)) | 2225 | (offset + (words - 1) <= IXGBE_EERD_MAX_ADDR)) |
2147 | ret_val = ixgbe_read_eerd_buffer_generic(hw, offset, words, | 2226 | ret_val = ixgbe_read_eerd_buffer_generic(hw, offset, words, |
2148 | data); | 2227 | data); |
2149 | else | 2228 | else |
2150 | ret_val = ixgbe_read_eeprom_buffer_bit_bang_generic(hw, offset, | 2229 | ret_val = ixgbe_read_eeprom_buffer_bit_bang_generic(hw, offset, |
2151 | words, | 2230 | words, |
2152 | data); | 2231 | data); |
2153 | 2232 | ||
2154 | return ret_val; | 2233 | return ret_val; |
2155 | } | 2234 | } |
2156 | 2235 | ||
2157 | /** | 2236 | /** |
2158 | * ixgbe_read_eeprom_82599 - Read EEPROM word using | 2237 | * ixgbe_read_eeprom_82599 - Read EEPROM word using |
2159 | * fastest available method | 2238 | * fastest available method |
2160 | * | 2239 | * |
2161 | * @hw: pointer to hardware structure | 2240 | * @hw: pointer to hardware structure |
2162 | * @offset: offset of word in the EEPROM to read | 2241 | * @offset: offset of word in the EEPROM to read |
2163 | * @data: word read from the EEPROM | 2242 | * @data: word read from the EEPROM |
2164 | * | 2243 | * |
2165 | * Reads a 16 bit word from the EEPROM | 2244 | * Reads a 16 bit word from the EEPROM |
2166 | **/ | 2245 | **/ |
2167 | static s32 ixgbe_read_eeprom_82599(struct ixgbe_hw *hw, | 2246 | static s32 ixgbe_read_eeprom_82599(struct ixgbe_hw *hw, |
2168 | u16 offset, u16 *data) | 2247 | u16 offset, u16 *data) |
2169 | { | 2248 | { |
2170 | struct ixgbe_eeprom_info *eeprom = &hw->eeprom; | 2249 | struct ixgbe_eeprom_info *eeprom = &hw->eeprom; |
2171 | s32 ret_val = IXGBE_ERR_CONFIG; | 2250 | s32 ret_val = IXGBE_ERR_CONFIG; |
2172 | 2251 | ||
2173 | /* | 2252 | /* |
2174 | * If EEPROM is detected and can be addressed using 14 bits, | 2253 | * If EEPROM is detected and can be addressed using 14 bits, |
2175 | * use EERD otherwise use bit bang | 2254 | * use EERD otherwise use bit bang |
2176 | */ | 2255 | */ |
2177 | if ((eeprom->type == ixgbe_eeprom_spi) && | 2256 | if ((eeprom->type == ixgbe_eeprom_spi) && |
2178 | (offset <= IXGBE_EERD_MAX_ADDR)) | 2257 | (offset <= IXGBE_EERD_MAX_ADDR)) |
2179 | ret_val = ixgbe_read_eerd_generic(hw, offset, data); | 2258 | ret_val = ixgbe_read_eerd_generic(hw, offset, data); |
2180 | else | 2259 | else |
2181 | ret_val = ixgbe_read_eeprom_bit_bang_generic(hw, offset, data); | 2260 | ret_val = ixgbe_read_eeprom_bit_bang_generic(hw, offset, data); |
2182 | 2261 | ||
2183 | return ret_val; | 2262 | return ret_val; |
2184 | } | 2263 | } |
2185 | 2264 | ||
2186 | /** | 2265 | /** |
2187 | * ixgbe_reset_pipeline_82599 - perform pipeline reset | 2266 | * ixgbe_reset_pipeline_82599 - perform pipeline reset |
2188 | * | 2267 | * |
2189 | * @hw: pointer to hardware structure | 2268 | * @hw: pointer to hardware structure |
2190 | * | 2269 | * |
2191 | * Reset pipeline by asserting Restart_AN together with LMS change to ensure | 2270 | * Reset pipeline by asserting Restart_AN together with LMS change to ensure |
2192 | * full pipeline reset. Note - We must hold the SW/FW semaphore before writing | 2271 | * full pipeline reset. Note - We must hold the SW/FW semaphore before writing |
2193 | * to AUTOC, so this function assumes the semaphore is held. | 2272 | * to AUTOC, so this function assumes the semaphore is held. |
2194 | **/ | 2273 | **/ |
2195 | s32 ixgbe_reset_pipeline_82599(struct ixgbe_hw *hw) | 2274 | s32 ixgbe_reset_pipeline_82599(struct ixgbe_hw *hw) |
2196 | { | 2275 | { |
2197 | s32 ret_val; | 2276 | s32 ret_val; |
2198 | u32 anlp1_reg = 0; | 2277 | u32 anlp1_reg = 0; |
2199 | u32 i, autoc_reg, autoc2_reg; | 2278 | u32 i, autoc_reg, autoc2_reg; |
2200 | 2279 | ||
2201 | /* Enable link if disabled in NVM */ | 2280 | /* Enable link if disabled in NVM */ |
2202 | autoc2_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC2); | 2281 | autoc2_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC2); |
2203 | if (autoc2_reg & IXGBE_AUTOC2_LINK_DISABLE_MASK) { | 2282 | if (autoc2_reg & IXGBE_AUTOC2_LINK_DISABLE_MASK) { |
2204 | autoc2_reg &= ~IXGBE_AUTOC2_LINK_DISABLE_MASK; | 2283 | autoc2_reg &= ~IXGBE_AUTOC2_LINK_DISABLE_MASK; |
2205 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC2, autoc2_reg); | 2284 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC2, autoc2_reg); |
2206 | IXGBE_WRITE_FLUSH(hw); | 2285 | IXGBE_WRITE_FLUSH(hw); |
2207 | } | 2286 | } |
2208 | 2287 | ||
2209 | autoc_reg = hw->mac.cached_autoc; | 2288 | autoc_reg = hw->mac.cached_autoc; |
2210 | autoc_reg |= IXGBE_AUTOC_AN_RESTART; | 2289 | autoc_reg |= IXGBE_AUTOC_AN_RESTART; |
2211 | 2290 | ||
2212 | /* Write AUTOC register with toggled LMS[2] bit and Restart_AN */ | 2291 | /* Write AUTOC register with toggled LMS[2] bit and Restart_AN */ |
2213 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg ^ IXGBE_AUTOC_LMS_1G_AN); | 2292 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg ^ IXGBE_AUTOC_LMS_1G_AN); |
2214 | 2293 | ||
2215 | /* Wait for AN to leave state 0 */ | 2294 | /* Wait for AN to leave state 0 */ |
2216 | for (i = 0; i < 10; i++) { | 2295 | for (i = 0; i < 10; i++) { |
2217 | usleep_range(4000, 8000); | 2296 | usleep_range(4000, 8000); |
2218 | anlp1_reg = IXGBE_READ_REG(hw, IXGBE_ANLP1); | 2297 | anlp1_reg = IXGBE_READ_REG(hw, IXGBE_ANLP1); |
2219 | if (anlp1_reg & IXGBE_ANLP1_AN_STATE_MASK) | 2298 | if (anlp1_reg & IXGBE_ANLP1_AN_STATE_MASK) |
2220 | break; | 2299 | break; |
2221 | } | 2300 | } |
2222 | 2301 | ||
2223 | if (!(anlp1_reg & IXGBE_ANLP1_AN_STATE_MASK)) { | 2302 | if (!(anlp1_reg & IXGBE_ANLP1_AN_STATE_MASK)) { |
2224 | hw_dbg(hw, "auto negotiation not completed\n"); | 2303 | hw_dbg(hw, "auto negotiation not completed\n"); |
2225 | ret_val = IXGBE_ERR_RESET_FAILED; | 2304 | ret_val = IXGBE_ERR_RESET_FAILED; |
2226 | goto reset_pipeline_out; | 2305 | goto reset_pipeline_out; |
2227 | } | 2306 | } |
2228 | 2307 | ||
2229 | ret_val = 0; | 2308 | ret_val = 0; |
2230 | 2309 | ||
2231 | reset_pipeline_out: | 2310 | reset_pipeline_out: |
2232 | /* Write AUTOC register with original LMS field and Restart_AN */ | 2311 | /* Write AUTOC register with original LMS field and Restart_AN */ |
2233 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg); | 2312 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg); |
2234 | IXGBE_WRITE_FLUSH(hw); | 2313 | IXGBE_WRITE_FLUSH(hw); |
2235 | 2314 | ||
2236 | return ret_val; | 2315 | return ret_val; |
2237 | } | 2316 | } |
2238 | 2317 | ||
2239 | static struct ixgbe_mac_operations mac_ops_82599 = { | 2318 | static struct ixgbe_mac_operations mac_ops_82599 = { |
2240 | .init_hw = &ixgbe_init_hw_generic, | 2319 | .init_hw = &ixgbe_init_hw_generic, |
2241 | .reset_hw = &ixgbe_reset_hw_82599, | 2320 | .reset_hw = &ixgbe_reset_hw_82599, |
2242 | .start_hw = &ixgbe_start_hw_82599, | 2321 | .start_hw = &ixgbe_start_hw_82599, |
2243 | .clear_hw_cntrs = &ixgbe_clear_hw_cntrs_generic, | 2322 | .clear_hw_cntrs = &ixgbe_clear_hw_cntrs_generic, |
2244 | .get_media_type = &ixgbe_get_media_type_82599, | 2323 | .get_media_type = &ixgbe_get_media_type_82599, |
2245 | .get_supported_physical_layer = &ixgbe_get_supported_physical_layer_82599, | 2324 | .get_supported_physical_layer = &ixgbe_get_supported_physical_layer_82599, |
2246 | .enable_rx_dma = &ixgbe_enable_rx_dma_82599, | 2325 | .enable_rx_dma = &ixgbe_enable_rx_dma_82599, |
2247 | .disable_rx_buff = &ixgbe_disable_rx_buff_generic, | 2326 | .disable_rx_buff = &ixgbe_disable_rx_buff_generic, |
2248 | .enable_rx_buff = &ixgbe_enable_rx_buff_generic, | 2327 | .enable_rx_buff = &ixgbe_enable_rx_buff_generic, |
2249 | .get_mac_addr = &ixgbe_get_mac_addr_generic, | 2328 | .get_mac_addr = &ixgbe_get_mac_addr_generic, |
2250 | .get_san_mac_addr = &ixgbe_get_san_mac_addr_generic, | 2329 | .get_san_mac_addr = &ixgbe_get_san_mac_addr_generic, |
2251 | .get_device_caps = &ixgbe_get_device_caps_generic, | 2330 | .get_device_caps = &ixgbe_get_device_caps_generic, |
2252 | .get_wwn_prefix = &ixgbe_get_wwn_prefix_generic, | 2331 | .get_wwn_prefix = &ixgbe_get_wwn_prefix_generic, |
2253 | .stop_adapter = &ixgbe_stop_adapter_generic, | 2332 | .stop_adapter = &ixgbe_stop_adapter_generic, |
2254 | .get_bus_info = &ixgbe_get_bus_info_generic, | 2333 | .get_bus_info = &ixgbe_get_bus_info_generic, |
2255 | .set_lan_id = &ixgbe_set_lan_id_multi_port_pcie, | 2334 | .set_lan_id = &ixgbe_set_lan_id_multi_port_pcie, |
2256 | .read_analog_reg8 = &ixgbe_read_analog_reg8_82599, | 2335 | .read_analog_reg8 = &ixgbe_read_analog_reg8_82599, |
2257 | .write_analog_reg8 = &ixgbe_write_analog_reg8_82599, | 2336 | .write_analog_reg8 = &ixgbe_write_analog_reg8_82599, |
2258 | .setup_link = &ixgbe_setup_mac_link_82599, | 2337 | .setup_link = &ixgbe_setup_mac_link_82599, |
2259 | .set_rxpba = &ixgbe_set_rxpba_generic, | 2338 | .set_rxpba = &ixgbe_set_rxpba_generic, |
2260 | .check_link = &ixgbe_check_mac_link_generic, | 2339 | .check_link = &ixgbe_check_mac_link_generic, |
2261 | .get_link_capabilities = &ixgbe_get_link_capabilities_82599, | 2340 | .get_link_capabilities = &ixgbe_get_link_capabilities_82599, |
2262 | .led_on = &ixgbe_led_on_generic, | 2341 | .led_on = &ixgbe_led_on_generic, |
2263 | .led_off = &ixgbe_led_off_generic, | 2342 | .led_off = &ixgbe_led_off_generic, |
2264 | .blink_led_start = &ixgbe_blink_led_start_generic, | 2343 | .blink_led_start = &ixgbe_blink_led_start_generic, |
2265 | .blink_led_stop = &ixgbe_blink_led_stop_generic, | 2344 | .blink_led_stop = &ixgbe_blink_led_stop_generic, |
2266 | .set_rar = &ixgbe_set_rar_generic, | 2345 | .set_rar = &ixgbe_set_rar_generic, |
2267 | .clear_rar = &ixgbe_clear_rar_generic, | 2346 | .clear_rar = &ixgbe_clear_rar_generic, |
2268 | .set_vmdq = &ixgbe_set_vmdq_generic, | 2347 | .set_vmdq = &ixgbe_set_vmdq_generic, |
2269 | .set_vmdq_san_mac = &ixgbe_set_vmdq_san_mac_generic, | 2348 | .set_vmdq_san_mac = &ixgbe_set_vmdq_san_mac_generic, |
2270 | .clear_vmdq = &ixgbe_clear_vmdq_generic, | 2349 | .clear_vmdq = &ixgbe_clear_vmdq_generic, |
2271 | .init_rx_addrs = &ixgbe_init_rx_addrs_generic, | 2350 | .init_rx_addrs = &ixgbe_init_rx_addrs_generic, |
2272 | .update_mc_addr_list = &ixgbe_update_mc_addr_list_generic, | 2351 | .update_mc_addr_list = &ixgbe_update_mc_addr_list_generic, |
2273 | .enable_mc = &ixgbe_enable_mc_generic, | 2352 | .enable_mc = &ixgbe_enable_mc_generic, |
2274 | .disable_mc = &ixgbe_disable_mc_generic, | 2353 | .disable_mc = &ixgbe_disable_mc_generic, |
2275 | .clear_vfta = &ixgbe_clear_vfta_generic, | 2354 | .clear_vfta = &ixgbe_clear_vfta_generic, |
2276 | .set_vfta = &ixgbe_set_vfta_generic, | 2355 | .set_vfta = &ixgbe_set_vfta_generic, |
2277 | .fc_enable = &ixgbe_fc_enable_generic, | 2356 | .fc_enable = &ixgbe_fc_enable_generic, |
2278 | .set_fw_drv_ver = &ixgbe_set_fw_drv_ver_generic, | 2357 | .set_fw_drv_ver = &ixgbe_set_fw_drv_ver_generic, |
2279 | .init_uta_tables = &ixgbe_init_uta_tables_generic, | 2358 | .init_uta_tables = &ixgbe_init_uta_tables_generic, |
2280 | .setup_sfp = &ixgbe_setup_sfp_modules_82599, | 2359 | .setup_sfp = &ixgbe_setup_sfp_modules_82599, |
2281 | .set_mac_anti_spoofing = &ixgbe_set_mac_anti_spoofing, | 2360 | .set_mac_anti_spoofing = &ixgbe_set_mac_anti_spoofing, |
2282 | .set_vlan_anti_spoofing = &ixgbe_set_vlan_anti_spoofing, | 2361 | .set_vlan_anti_spoofing = &ixgbe_set_vlan_anti_spoofing, |
2283 | .acquire_swfw_sync = &ixgbe_acquire_swfw_sync, | 2362 | .acquire_swfw_sync = &ixgbe_acquire_swfw_sync, |
2284 | .release_swfw_sync = &ixgbe_release_swfw_sync, | 2363 | .release_swfw_sync = &ixgbe_release_swfw_sync, |
2285 | .get_thermal_sensor_data = &ixgbe_get_thermal_sensor_data_generic, | 2364 | .get_thermal_sensor_data = &ixgbe_get_thermal_sensor_data_generic, |
2286 | .init_thermal_sensor_thresh = &ixgbe_init_thermal_sensor_thresh_generic, | 2365 | .init_thermal_sensor_thresh = &ixgbe_init_thermal_sensor_thresh_generic, |
2287 | .mng_fw_enabled = &ixgbe_mng_enabled, | 2366 | .mng_fw_enabled = &ixgbe_mng_enabled, |
2288 | }; | 2367 | }; |
2289 | 2368 | ||
2290 | static struct ixgbe_eeprom_operations eeprom_ops_82599 = { | 2369 | static struct ixgbe_eeprom_operations eeprom_ops_82599 = { |
2291 | .init_params = &ixgbe_init_eeprom_params_generic, | 2370 | .init_params = &ixgbe_init_eeprom_params_generic, |
2292 | .read = &ixgbe_read_eeprom_82599, | 2371 | .read = &ixgbe_read_eeprom_82599, |
2293 | .read_buffer = &ixgbe_read_eeprom_buffer_82599, | 2372 | .read_buffer = &ixgbe_read_eeprom_buffer_82599, |
2294 | .write = &ixgbe_write_eeprom_generic, | 2373 | .write = &ixgbe_write_eeprom_generic, |
2295 | .write_buffer = &ixgbe_write_eeprom_buffer_bit_bang_generic, | 2374 | .write_buffer = &ixgbe_write_eeprom_buffer_bit_bang_generic, |
2296 | .calc_checksum = &ixgbe_calc_eeprom_checksum_generic, | 2375 | .calc_checksum = &ixgbe_calc_eeprom_checksum_generic, |
2297 | .validate_checksum = &ixgbe_validate_eeprom_checksum_generic, | 2376 | .validate_checksum = &ixgbe_validate_eeprom_checksum_generic, |
2298 | .update_checksum = &ixgbe_update_eeprom_checksum_generic, | 2377 | .update_checksum = &ixgbe_update_eeprom_checksum_generic, |
2299 | }; | 2378 | }; |
2300 | 2379 | ||
2301 | static struct ixgbe_phy_operations phy_ops_82599 = { | 2380 | static struct ixgbe_phy_operations phy_ops_82599 = { |
2302 | .identify = &ixgbe_identify_phy_82599, | 2381 | .identify = &ixgbe_identify_phy_82599, |
2303 | .identify_sfp = &ixgbe_identify_sfp_module_generic, | 2382 | .identify_sfp = &ixgbe_identify_sfp_module_generic, |
2304 | .init = &ixgbe_init_phy_ops_82599, | 2383 | .init = &ixgbe_init_phy_ops_82599, |
2305 | .reset = &ixgbe_reset_phy_generic, | 2384 | .reset = &ixgbe_reset_phy_generic, |
2306 | .read_reg = &ixgbe_read_phy_reg_generic, | 2385 | .read_reg = &ixgbe_read_phy_reg_generic, |
2307 | .write_reg = &ixgbe_write_phy_reg_generic, | 2386 | .write_reg = &ixgbe_write_phy_reg_generic, |
2308 | .setup_link = &ixgbe_setup_phy_link_generic, | 2387 | .setup_link = &ixgbe_setup_phy_link_generic, |
2309 | .setup_link_speed = &ixgbe_setup_phy_link_speed_generic, | 2388 | .setup_link_speed = &ixgbe_setup_phy_link_speed_generic, |
2310 | .read_i2c_byte = &ixgbe_read_i2c_byte_generic, | 2389 | .read_i2c_byte = &ixgbe_read_i2c_byte_generic, |
2311 | .write_i2c_byte = &ixgbe_write_i2c_byte_generic, | 2390 | .write_i2c_byte = &ixgbe_write_i2c_byte_generic, |
2312 | .read_i2c_sff8472 = &ixgbe_read_i2c_sff8472_generic, | 2391 | .read_i2c_sff8472 = &ixgbe_read_i2c_sff8472_generic, |
2313 | .read_i2c_eeprom = &ixgbe_read_i2c_eeprom_generic, | 2392 | .read_i2c_eeprom = &ixgbe_read_i2c_eeprom_generic, |
2314 | .write_i2c_eeprom = &ixgbe_write_i2c_eeprom_generic, | 2393 | .write_i2c_eeprom = &ixgbe_write_i2c_eeprom_generic, |
2315 | .check_overtemp = &ixgbe_tn_check_overtemp, | 2394 | .check_overtemp = &ixgbe_tn_check_overtemp, |
2316 | }; | 2395 | }; |
2317 | 2396 | ||
2318 | struct ixgbe_info ixgbe_82599_info = { | 2397 | struct ixgbe_info ixgbe_82599_info = { |
2319 | .mac = ixgbe_mac_82599EB, | 2398 | .mac = ixgbe_mac_82599EB, |
2320 | .get_invariants = &ixgbe_get_invariants_82599, | 2399 | .get_invariants = &ixgbe_get_invariants_82599, |
2321 | .mac_ops = &mac_ops_82599, | 2400 | .mac_ops = &mac_ops_82599, |
2322 | .eeprom_ops = &eeprom_ops_82599, | 2401 | .eeprom_ops = &eeprom_ops_82599, |
2323 | .phy_ops = &phy_ops_82599, | 2402 | .phy_ops = &phy_ops_82599, |
2324 | .mbx_ops = &mbx_ops_generic, | 2403 | .mbx_ops = &mbx_ops_generic, |
2325 | }; | 2404 | }; |
2326 | 2405 |
drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel 10 Gigabit PCI Express Linux driver | 3 | Intel 10 Gigabit PCI Express Linux driver |
4 | Copyright(c) 1999 - 2013 Intel Corporation. | 4 | Copyright(c) 1999 - 2013 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
8 | version 2, as published by the Free Software Foundation. | 8 | version 2, as published by the Free Software Foundation. |
9 | 9 | ||
10 | This program is distributed in the hope it will be useful, but WITHOUT | 10 | This program is distributed in the hope it will be useful, but WITHOUT |
11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | 11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
12 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | 12 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
13 | more details. | 13 | more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License along with | 15 | You should have received a copy of the GNU General Public License along with |
16 | this program; if not, write to the Free Software Foundation, Inc., | 16 | this program; if not, write to the Free Software Foundation, Inc., |
17 | 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | 17 | 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. |
18 | 18 | ||
19 | The full GNU General Public License is included in this distribution in | 19 | The full GNU General Public License is included in this distribution in |
20 | the file called "COPYING". | 20 | the file called "COPYING". |
21 | 21 | ||
22 | Contact Information: | 22 | Contact Information: |
23 | e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> | 23 | e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> |
24 | Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 24 | Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
25 | 25 | ||
26 | *******************************************************************************/ | 26 | *******************************************************************************/ |
27 | 27 | ||
28 | #include <linux/pci.h> | 28 | #include <linux/pci.h> |
29 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
30 | #include <linux/sched.h> | 30 | #include <linux/sched.h> |
31 | #include <linux/netdevice.h> | 31 | #include <linux/netdevice.h> |
32 | 32 | ||
33 | #include "ixgbe.h" | 33 | #include "ixgbe.h" |
34 | #include "ixgbe_common.h" | 34 | #include "ixgbe_common.h" |
35 | #include "ixgbe_phy.h" | 35 | #include "ixgbe_phy.h" |
36 | 36 | ||
37 | static s32 ixgbe_acquire_eeprom(struct ixgbe_hw *hw); | 37 | static s32 ixgbe_acquire_eeprom(struct ixgbe_hw *hw); |
38 | static s32 ixgbe_get_eeprom_semaphore(struct ixgbe_hw *hw); | 38 | static s32 ixgbe_get_eeprom_semaphore(struct ixgbe_hw *hw); |
39 | static void ixgbe_release_eeprom_semaphore(struct ixgbe_hw *hw); | 39 | static void ixgbe_release_eeprom_semaphore(struct ixgbe_hw *hw); |
40 | static s32 ixgbe_ready_eeprom(struct ixgbe_hw *hw); | 40 | static s32 ixgbe_ready_eeprom(struct ixgbe_hw *hw); |
41 | static void ixgbe_standby_eeprom(struct ixgbe_hw *hw); | 41 | static void ixgbe_standby_eeprom(struct ixgbe_hw *hw); |
42 | static void ixgbe_shift_out_eeprom_bits(struct ixgbe_hw *hw, u16 data, | 42 | static void ixgbe_shift_out_eeprom_bits(struct ixgbe_hw *hw, u16 data, |
43 | u16 count); | 43 | u16 count); |
44 | static u16 ixgbe_shift_in_eeprom_bits(struct ixgbe_hw *hw, u16 count); | 44 | static u16 ixgbe_shift_in_eeprom_bits(struct ixgbe_hw *hw, u16 count); |
45 | static void ixgbe_raise_eeprom_clk(struct ixgbe_hw *hw, u32 *eec); | 45 | static void ixgbe_raise_eeprom_clk(struct ixgbe_hw *hw, u32 *eec); |
46 | static void ixgbe_lower_eeprom_clk(struct ixgbe_hw *hw, u32 *eec); | 46 | static void ixgbe_lower_eeprom_clk(struct ixgbe_hw *hw, u32 *eec); |
47 | static void ixgbe_release_eeprom(struct ixgbe_hw *hw); | 47 | static void ixgbe_release_eeprom(struct ixgbe_hw *hw); |
48 | 48 | ||
49 | static s32 ixgbe_mta_vector(struct ixgbe_hw *hw, u8 *mc_addr); | 49 | static s32 ixgbe_mta_vector(struct ixgbe_hw *hw, u8 *mc_addr); |
50 | static s32 ixgbe_poll_eerd_eewr_done(struct ixgbe_hw *hw, u32 ee_reg); | 50 | static s32 ixgbe_poll_eerd_eewr_done(struct ixgbe_hw *hw, u32 ee_reg); |
51 | static s32 ixgbe_read_eeprom_buffer_bit_bang(struct ixgbe_hw *hw, u16 offset, | 51 | static s32 ixgbe_read_eeprom_buffer_bit_bang(struct ixgbe_hw *hw, u16 offset, |
52 | u16 words, u16 *data); | 52 | u16 words, u16 *data); |
53 | static s32 ixgbe_write_eeprom_buffer_bit_bang(struct ixgbe_hw *hw, u16 offset, | 53 | static s32 ixgbe_write_eeprom_buffer_bit_bang(struct ixgbe_hw *hw, u16 offset, |
54 | u16 words, u16 *data); | 54 | u16 words, u16 *data); |
55 | static s32 ixgbe_detect_eeprom_page_size_generic(struct ixgbe_hw *hw, | 55 | static s32 ixgbe_detect_eeprom_page_size_generic(struct ixgbe_hw *hw, |
56 | u16 offset); | 56 | u16 offset); |
57 | static s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw); | 57 | static s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw); |
58 | 58 | ||
59 | /** | 59 | /** |
60 | * ixgbe_device_supports_autoneg_fc - Check if phy supports autoneg flow | 60 | * ixgbe_device_supports_autoneg_fc - Check if phy supports autoneg flow |
61 | * control | 61 | * control |
62 | * @hw: pointer to hardware structure | 62 | * @hw: pointer to hardware structure |
63 | * | 63 | * |
64 | * There are several phys that do not support autoneg flow control. This | 64 | * There are several phys that do not support autoneg flow control. This |
65 | * function check the device id to see if the associated phy supports | 65 | * function check the device id to see if the associated phy supports |
66 | * autoneg flow control. | 66 | * autoneg flow control. |
67 | **/ | 67 | **/ |
68 | bool ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw) | 68 | bool ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw) |
69 | { | 69 | { |
70 | bool supported = false; | 70 | bool supported = false; |
71 | ixgbe_link_speed speed; | 71 | ixgbe_link_speed speed; |
72 | bool link_up; | 72 | bool link_up; |
73 | 73 | ||
74 | switch (hw->phy.media_type) { | 74 | switch (hw->phy.media_type) { |
75 | case ixgbe_media_type_fiber_fixed: | ||
75 | case ixgbe_media_type_fiber: | 76 | case ixgbe_media_type_fiber: |
76 | hw->mac.ops.check_link(hw, &speed, &link_up, false); | 77 | hw->mac.ops.check_link(hw, &speed, &link_up, false); |
77 | /* if link is down, assume supported */ | 78 | /* if link is down, assume supported */ |
78 | if (link_up) | 79 | if (link_up) |
79 | supported = speed == IXGBE_LINK_SPEED_1GB_FULL ? | 80 | supported = speed == IXGBE_LINK_SPEED_1GB_FULL ? |
80 | true : false; | 81 | true : false; |
81 | else | 82 | else |
82 | supported = true; | 83 | supported = true; |
83 | break; | 84 | break; |
84 | case ixgbe_media_type_backplane: | 85 | case ixgbe_media_type_backplane: |
85 | supported = true; | 86 | supported = true; |
86 | break; | 87 | break; |
87 | case ixgbe_media_type_copper: | 88 | case ixgbe_media_type_copper: |
88 | /* only some copper devices support flow control autoneg */ | 89 | /* only some copper devices support flow control autoneg */ |
89 | switch (hw->device_id) { | 90 | switch (hw->device_id) { |
90 | case IXGBE_DEV_ID_82599_T3_LOM: | 91 | case IXGBE_DEV_ID_82599_T3_LOM: |
91 | case IXGBE_DEV_ID_X540T: | 92 | case IXGBE_DEV_ID_X540T: |
92 | case IXGBE_DEV_ID_X540T1: | 93 | case IXGBE_DEV_ID_X540T1: |
93 | supported = true; | 94 | supported = true; |
94 | break; | 95 | break; |
95 | default: | 96 | default: |
96 | break; | 97 | break; |
97 | } | 98 | } |
98 | default: | 99 | default: |
99 | break; | 100 | break; |
100 | } | 101 | } |
101 | 102 | ||
102 | return supported; | 103 | return supported; |
103 | } | 104 | } |
104 | 105 | ||
105 | /** | 106 | /** |
106 | * ixgbe_setup_fc - Set up flow control | 107 | * ixgbe_setup_fc - Set up flow control |
107 | * @hw: pointer to hardware structure | 108 | * @hw: pointer to hardware structure |
108 | * | 109 | * |
109 | * Called at init time to set up flow control. | 110 | * Called at init time to set up flow control. |
110 | **/ | 111 | **/ |
111 | static s32 ixgbe_setup_fc(struct ixgbe_hw *hw) | 112 | static s32 ixgbe_setup_fc(struct ixgbe_hw *hw) |
112 | { | 113 | { |
113 | s32 ret_val = 0; | 114 | s32 ret_val = 0; |
114 | u32 reg = 0, reg_bp = 0; | 115 | u32 reg = 0, reg_bp = 0; |
115 | u16 reg_cu = 0; | 116 | u16 reg_cu = 0; |
116 | bool got_lock = false; | 117 | bool got_lock = false; |
117 | 118 | ||
118 | /* | 119 | /* |
119 | * Validate the requested mode. Strict IEEE mode does not allow | 120 | * Validate the requested mode. Strict IEEE mode does not allow |
120 | * ixgbe_fc_rx_pause because it will cause us to fail at UNH. | 121 | * ixgbe_fc_rx_pause because it will cause us to fail at UNH. |
121 | */ | 122 | */ |
122 | if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) { | 123 | if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) { |
123 | hw_dbg(hw, "ixgbe_fc_rx_pause not valid in strict IEEE mode\n"); | 124 | hw_dbg(hw, "ixgbe_fc_rx_pause not valid in strict IEEE mode\n"); |
124 | ret_val = IXGBE_ERR_INVALID_LINK_SETTINGS; | 125 | ret_val = IXGBE_ERR_INVALID_LINK_SETTINGS; |
125 | goto out; | 126 | goto out; |
126 | } | 127 | } |
127 | 128 | ||
128 | /* | 129 | /* |
129 | * 10gig parts do not have a word in the EEPROM to determine the | 130 | * 10gig parts do not have a word in the EEPROM to determine the |
130 | * default flow control setting, so we explicitly set it to full. | 131 | * default flow control setting, so we explicitly set it to full. |
131 | */ | 132 | */ |
132 | if (hw->fc.requested_mode == ixgbe_fc_default) | 133 | if (hw->fc.requested_mode == ixgbe_fc_default) |
133 | hw->fc.requested_mode = ixgbe_fc_full; | 134 | hw->fc.requested_mode = ixgbe_fc_full; |
134 | 135 | ||
135 | /* | 136 | /* |
136 | * Set up the 1G and 10G flow control advertisement registers so the | 137 | * Set up the 1G and 10G flow control advertisement registers so the |
137 | * HW will be able to do fc autoneg once the cable is plugged in. If | 138 | * HW will be able to do fc autoneg once the cable is plugged in. If |
138 | * we link at 10G, the 1G advertisement is harmless and vice versa. | 139 | * we link at 10G, the 1G advertisement is harmless and vice versa. |
139 | */ | 140 | */ |
140 | switch (hw->phy.media_type) { | 141 | switch (hw->phy.media_type) { |
142 | case ixgbe_media_type_fiber_fixed: | ||
141 | case ixgbe_media_type_fiber: | 143 | case ixgbe_media_type_fiber: |
142 | case ixgbe_media_type_backplane: | 144 | case ixgbe_media_type_backplane: |
143 | reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANA); | 145 | reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANA); |
144 | reg_bp = IXGBE_READ_REG(hw, IXGBE_AUTOC); | 146 | reg_bp = IXGBE_READ_REG(hw, IXGBE_AUTOC); |
145 | break; | 147 | break; |
146 | case ixgbe_media_type_copper: | 148 | case ixgbe_media_type_copper: |
147 | hw->phy.ops.read_reg(hw, MDIO_AN_ADVERTISE, | 149 | hw->phy.ops.read_reg(hw, MDIO_AN_ADVERTISE, |
148 | MDIO_MMD_AN, ®_cu); | 150 | MDIO_MMD_AN, ®_cu); |
149 | break; | 151 | break; |
150 | default: | 152 | default: |
151 | break; | 153 | break; |
152 | } | 154 | } |
153 | 155 | ||
154 | /* | 156 | /* |
155 | * The possible values of fc.requested_mode are: | 157 | * The possible values of fc.requested_mode are: |
156 | * 0: Flow control is completely disabled | 158 | * 0: Flow control is completely disabled |
157 | * 1: Rx flow control is enabled (we can receive pause frames, | 159 | * 1: Rx flow control is enabled (we can receive pause frames, |
158 | * but not send pause frames). | 160 | * but not send pause frames). |
159 | * 2: Tx flow control is enabled (we can send pause frames but | 161 | * 2: Tx flow control is enabled (we can send pause frames but |
160 | * we do not support receiving pause frames). | 162 | * we do not support receiving pause frames). |
161 | * 3: Both Rx and Tx flow control (symmetric) are enabled. | 163 | * 3: Both Rx and Tx flow control (symmetric) are enabled. |
162 | * other: Invalid. | 164 | * other: Invalid. |
163 | */ | 165 | */ |
164 | switch (hw->fc.requested_mode) { | 166 | switch (hw->fc.requested_mode) { |
165 | case ixgbe_fc_none: | 167 | case ixgbe_fc_none: |
166 | /* Flow control completely disabled by software override. */ | 168 | /* Flow control completely disabled by software override. */ |
167 | reg &= ~(IXGBE_PCS1GANA_SYM_PAUSE | IXGBE_PCS1GANA_ASM_PAUSE); | 169 | reg &= ~(IXGBE_PCS1GANA_SYM_PAUSE | IXGBE_PCS1GANA_ASM_PAUSE); |
168 | if (hw->phy.media_type == ixgbe_media_type_backplane) | 170 | if (hw->phy.media_type == ixgbe_media_type_backplane) |
169 | reg_bp &= ~(IXGBE_AUTOC_SYM_PAUSE | | 171 | reg_bp &= ~(IXGBE_AUTOC_SYM_PAUSE | |
170 | IXGBE_AUTOC_ASM_PAUSE); | 172 | IXGBE_AUTOC_ASM_PAUSE); |
171 | else if (hw->phy.media_type == ixgbe_media_type_copper) | 173 | else if (hw->phy.media_type == ixgbe_media_type_copper) |
172 | reg_cu &= ~(IXGBE_TAF_SYM_PAUSE | IXGBE_TAF_ASM_PAUSE); | 174 | reg_cu &= ~(IXGBE_TAF_SYM_PAUSE | IXGBE_TAF_ASM_PAUSE); |
173 | break; | 175 | break; |
174 | case ixgbe_fc_tx_pause: | 176 | case ixgbe_fc_tx_pause: |
175 | /* | 177 | /* |
176 | * Tx Flow control is enabled, and Rx Flow control is | 178 | * Tx Flow control is enabled, and Rx Flow control is |
177 | * disabled by software override. | 179 | * disabled by software override. |
178 | */ | 180 | */ |
179 | reg |= IXGBE_PCS1GANA_ASM_PAUSE; | 181 | reg |= IXGBE_PCS1GANA_ASM_PAUSE; |
180 | reg &= ~IXGBE_PCS1GANA_SYM_PAUSE; | 182 | reg &= ~IXGBE_PCS1GANA_SYM_PAUSE; |
181 | if (hw->phy.media_type == ixgbe_media_type_backplane) { | 183 | if (hw->phy.media_type == ixgbe_media_type_backplane) { |
182 | reg_bp |= IXGBE_AUTOC_ASM_PAUSE; | 184 | reg_bp |= IXGBE_AUTOC_ASM_PAUSE; |
183 | reg_bp &= ~IXGBE_AUTOC_SYM_PAUSE; | 185 | reg_bp &= ~IXGBE_AUTOC_SYM_PAUSE; |
184 | } else if (hw->phy.media_type == ixgbe_media_type_copper) { | 186 | } else if (hw->phy.media_type == ixgbe_media_type_copper) { |
185 | reg_cu |= IXGBE_TAF_ASM_PAUSE; | 187 | reg_cu |= IXGBE_TAF_ASM_PAUSE; |
186 | reg_cu &= ~IXGBE_TAF_SYM_PAUSE; | 188 | reg_cu &= ~IXGBE_TAF_SYM_PAUSE; |
187 | } | 189 | } |
188 | break; | 190 | break; |
189 | case ixgbe_fc_rx_pause: | 191 | case ixgbe_fc_rx_pause: |
190 | /* | 192 | /* |
191 | * Rx Flow control is enabled and Tx Flow control is | 193 | * Rx Flow control is enabled and Tx Flow control is |
192 | * disabled by software override. Since there really | 194 | * disabled by software override. Since there really |
193 | * isn't a way to advertise that we are capable of RX | 195 | * isn't a way to advertise that we are capable of RX |
194 | * Pause ONLY, we will advertise that we support both | 196 | * Pause ONLY, we will advertise that we support both |
195 | * symmetric and asymmetric Rx PAUSE, as such we fall | 197 | * symmetric and asymmetric Rx PAUSE, as such we fall |
196 | * through to the fc_full statement. Later, we will | 198 | * through to the fc_full statement. Later, we will |
197 | * disable the adapter's ability to send PAUSE frames. | 199 | * disable the adapter's ability to send PAUSE frames. |
198 | */ | 200 | */ |
199 | case ixgbe_fc_full: | 201 | case ixgbe_fc_full: |
200 | /* Flow control (both Rx and Tx) is enabled by SW override. */ | 202 | /* Flow control (both Rx and Tx) is enabled by SW override. */ |
201 | reg |= IXGBE_PCS1GANA_SYM_PAUSE | IXGBE_PCS1GANA_ASM_PAUSE; | 203 | reg |= IXGBE_PCS1GANA_SYM_PAUSE | IXGBE_PCS1GANA_ASM_PAUSE; |
202 | if (hw->phy.media_type == ixgbe_media_type_backplane) | 204 | if (hw->phy.media_type == ixgbe_media_type_backplane) |
203 | reg_bp |= IXGBE_AUTOC_SYM_PAUSE | | 205 | reg_bp |= IXGBE_AUTOC_SYM_PAUSE | |
204 | IXGBE_AUTOC_ASM_PAUSE; | 206 | IXGBE_AUTOC_ASM_PAUSE; |
205 | else if (hw->phy.media_type == ixgbe_media_type_copper) | 207 | else if (hw->phy.media_type == ixgbe_media_type_copper) |
206 | reg_cu |= IXGBE_TAF_SYM_PAUSE | IXGBE_TAF_ASM_PAUSE; | 208 | reg_cu |= IXGBE_TAF_SYM_PAUSE | IXGBE_TAF_ASM_PAUSE; |
207 | break; | 209 | break; |
208 | default: | 210 | default: |
209 | hw_dbg(hw, "Flow control param set incorrectly\n"); | 211 | hw_dbg(hw, "Flow control param set incorrectly\n"); |
210 | ret_val = IXGBE_ERR_CONFIG; | 212 | ret_val = IXGBE_ERR_CONFIG; |
211 | goto out; | 213 | goto out; |
212 | break; | 214 | break; |
213 | } | 215 | } |
214 | 216 | ||
215 | if (hw->mac.type != ixgbe_mac_X540) { | 217 | if (hw->mac.type != ixgbe_mac_X540) { |
216 | /* | 218 | /* |
217 | * Enable auto-negotiation between the MAC & PHY; | 219 | * Enable auto-negotiation between the MAC & PHY; |
218 | * the MAC will advertise clause 37 flow control. | 220 | * the MAC will advertise clause 37 flow control. |
219 | */ | 221 | */ |
220 | IXGBE_WRITE_REG(hw, IXGBE_PCS1GANA, reg); | 222 | IXGBE_WRITE_REG(hw, IXGBE_PCS1GANA, reg); |
221 | reg = IXGBE_READ_REG(hw, IXGBE_PCS1GLCTL); | 223 | reg = IXGBE_READ_REG(hw, IXGBE_PCS1GLCTL); |
222 | 224 | ||
223 | /* Disable AN timeout */ | 225 | /* Disable AN timeout */ |
224 | if (hw->fc.strict_ieee) | 226 | if (hw->fc.strict_ieee) |
225 | reg &= ~IXGBE_PCS1GLCTL_AN_1G_TIMEOUT_EN; | 227 | reg &= ~IXGBE_PCS1GLCTL_AN_1G_TIMEOUT_EN; |
226 | 228 | ||
227 | IXGBE_WRITE_REG(hw, IXGBE_PCS1GLCTL, reg); | 229 | IXGBE_WRITE_REG(hw, IXGBE_PCS1GLCTL, reg); |
228 | hw_dbg(hw, "Set up FC; PCS1GLCTL = 0x%08X\n", reg); | 230 | hw_dbg(hw, "Set up FC; PCS1GLCTL = 0x%08X\n", reg); |
229 | } | 231 | } |
230 | 232 | ||
231 | /* | 233 | /* |
232 | * AUTOC restart handles negotiation of 1G and 10G on backplane | 234 | * AUTOC restart handles negotiation of 1G and 10G on backplane |
233 | * and copper. There is no need to set the PCS1GCTL register. | 235 | * and copper. There is no need to set the PCS1GCTL register. |
234 | * | 236 | * |
235 | */ | 237 | */ |
236 | if (hw->phy.media_type == ixgbe_media_type_backplane) { | 238 | if (hw->phy.media_type == ixgbe_media_type_backplane) { |
237 | /* Need the SW/FW semaphore around AUTOC writes if 82599 and | 239 | /* Need the SW/FW semaphore around AUTOC writes if 82599 and |
238 | * LESM is on, likewise reset_pipeline requries the lock as | 240 | * LESM is on, likewise reset_pipeline requries the lock as |
239 | * it also writes AUTOC. | 241 | * it also writes AUTOC. |
240 | */ | 242 | */ |
241 | if ((hw->mac.type == ixgbe_mac_82599EB) && | 243 | if ((hw->mac.type == ixgbe_mac_82599EB) && |
242 | ixgbe_verify_lesm_fw_enabled_82599(hw)) { | 244 | ixgbe_verify_lesm_fw_enabled_82599(hw)) { |
243 | ret_val = hw->mac.ops.acquire_swfw_sync(hw, | 245 | ret_val = hw->mac.ops.acquire_swfw_sync(hw, |
244 | IXGBE_GSSR_MAC_CSR_SM); | 246 | IXGBE_GSSR_MAC_CSR_SM); |
245 | if (ret_val) | 247 | if (ret_val) |
246 | goto out; | 248 | goto out; |
247 | 249 | ||
248 | got_lock = true; | 250 | got_lock = true; |
249 | } | 251 | } |
250 | 252 | ||
251 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC, reg_bp); | 253 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC, reg_bp); |
252 | 254 | ||
253 | if (hw->mac.type == ixgbe_mac_82599EB) | 255 | if (hw->mac.type == ixgbe_mac_82599EB) |
254 | ixgbe_reset_pipeline_82599(hw); | 256 | ixgbe_reset_pipeline_82599(hw); |
255 | 257 | ||
256 | if (got_lock) | 258 | if (got_lock) |
257 | hw->mac.ops.release_swfw_sync(hw, | 259 | hw->mac.ops.release_swfw_sync(hw, |
258 | IXGBE_GSSR_MAC_CSR_SM); | 260 | IXGBE_GSSR_MAC_CSR_SM); |
259 | 261 | ||
260 | } else if ((hw->phy.media_type == ixgbe_media_type_copper) && | 262 | } else if ((hw->phy.media_type == ixgbe_media_type_copper) && |
261 | ixgbe_device_supports_autoneg_fc(hw)) { | 263 | ixgbe_device_supports_autoneg_fc(hw)) { |
262 | hw->phy.ops.write_reg(hw, MDIO_AN_ADVERTISE, | 264 | hw->phy.ops.write_reg(hw, MDIO_AN_ADVERTISE, |
263 | MDIO_MMD_AN, reg_cu); | 265 | MDIO_MMD_AN, reg_cu); |
264 | } | 266 | } |
265 | 267 | ||
266 | hw_dbg(hw, "Set up FC; IXGBE_AUTOC = 0x%08X\n", reg); | 268 | hw_dbg(hw, "Set up FC; IXGBE_AUTOC = 0x%08X\n", reg); |
267 | out: | 269 | out: |
268 | return ret_val; | 270 | return ret_val; |
269 | } | 271 | } |
270 | 272 | ||
271 | /** | 273 | /** |
272 | * ixgbe_start_hw_generic - Prepare hardware for Tx/Rx | 274 | * ixgbe_start_hw_generic - Prepare hardware for Tx/Rx |
273 | * @hw: pointer to hardware structure | 275 | * @hw: pointer to hardware structure |
274 | * | 276 | * |
275 | * Starts the hardware by filling the bus info structure and media type, clears | 277 | * Starts the hardware by filling the bus info structure and media type, clears |
276 | * all on chip counters, initializes receive address registers, multicast | 278 | * all on chip counters, initializes receive address registers, multicast |
277 | * table, VLAN filter table, calls routine to set up link and flow control | 279 | * table, VLAN filter table, calls routine to set up link and flow control |
278 | * settings, and leaves transmit and receive units disabled and uninitialized | 280 | * settings, and leaves transmit and receive units disabled and uninitialized |
279 | **/ | 281 | **/ |
280 | s32 ixgbe_start_hw_generic(struct ixgbe_hw *hw) | 282 | s32 ixgbe_start_hw_generic(struct ixgbe_hw *hw) |
281 | { | 283 | { |
282 | u32 ctrl_ext; | 284 | u32 ctrl_ext; |
283 | 285 | ||
284 | /* Set the media type */ | 286 | /* Set the media type */ |
285 | hw->phy.media_type = hw->mac.ops.get_media_type(hw); | 287 | hw->phy.media_type = hw->mac.ops.get_media_type(hw); |
286 | 288 | ||
287 | /* Identify the PHY */ | 289 | /* Identify the PHY */ |
288 | hw->phy.ops.identify(hw); | 290 | hw->phy.ops.identify(hw); |
289 | 291 | ||
290 | /* Clear the VLAN filter table */ | 292 | /* Clear the VLAN filter table */ |
291 | hw->mac.ops.clear_vfta(hw); | 293 | hw->mac.ops.clear_vfta(hw); |
292 | 294 | ||
293 | /* Clear statistics registers */ | 295 | /* Clear statistics registers */ |
294 | hw->mac.ops.clear_hw_cntrs(hw); | 296 | hw->mac.ops.clear_hw_cntrs(hw); |
295 | 297 | ||
296 | /* Set No Snoop Disable */ | 298 | /* Set No Snoop Disable */ |
297 | ctrl_ext = IXGBE_READ_REG(hw, IXGBE_CTRL_EXT); | 299 | ctrl_ext = IXGBE_READ_REG(hw, IXGBE_CTRL_EXT); |
298 | ctrl_ext |= IXGBE_CTRL_EXT_NS_DIS; | 300 | ctrl_ext |= IXGBE_CTRL_EXT_NS_DIS; |
299 | IXGBE_WRITE_REG(hw, IXGBE_CTRL_EXT, ctrl_ext); | 301 | IXGBE_WRITE_REG(hw, IXGBE_CTRL_EXT, ctrl_ext); |
300 | IXGBE_WRITE_FLUSH(hw); | 302 | IXGBE_WRITE_FLUSH(hw); |
301 | 303 | ||
302 | /* Setup flow control */ | 304 | /* Setup flow control */ |
303 | ixgbe_setup_fc(hw); | 305 | ixgbe_setup_fc(hw); |
304 | 306 | ||
305 | /* Clear adapter stopped flag */ | 307 | /* Clear adapter stopped flag */ |
306 | hw->adapter_stopped = false; | 308 | hw->adapter_stopped = false; |
307 | 309 | ||
308 | return 0; | 310 | return 0; |
309 | } | 311 | } |
310 | 312 | ||
311 | /** | 313 | /** |
312 | * ixgbe_start_hw_gen2 - Init sequence for common device family | 314 | * ixgbe_start_hw_gen2 - Init sequence for common device family |
313 | * @hw: pointer to hw structure | 315 | * @hw: pointer to hw structure |
314 | * | 316 | * |
315 | * Performs the init sequence common to the second generation | 317 | * Performs the init sequence common to the second generation |
316 | * of 10 GbE devices. | 318 | * of 10 GbE devices. |
317 | * Devices in the second generation: | 319 | * Devices in the second generation: |
318 | * 82599 | 320 | * 82599 |
319 | * X540 | 321 | * X540 |
320 | **/ | 322 | **/ |
321 | s32 ixgbe_start_hw_gen2(struct ixgbe_hw *hw) | 323 | s32 ixgbe_start_hw_gen2(struct ixgbe_hw *hw) |
322 | { | 324 | { |
323 | u32 i; | 325 | u32 i; |
324 | u32 regval; | 326 | u32 regval; |
325 | 327 | ||
326 | /* Clear the rate limiters */ | 328 | /* Clear the rate limiters */ |
327 | for (i = 0; i < hw->mac.max_tx_queues; i++) { | 329 | for (i = 0; i < hw->mac.max_tx_queues; i++) { |
328 | IXGBE_WRITE_REG(hw, IXGBE_RTTDQSEL, i); | 330 | IXGBE_WRITE_REG(hw, IXGBE_RTTDQSEL, i); |
329 | IXGBE_WRITE_REG(hw, IXGBE_RTTBCNRC, 0); | 331 | IXGBE_WRITE_REG(hw, IXGBE_RTTBCNRC, 0); |
330 | } | 332 | } |
331 | IXGBE_WRITE_FLUSH(hw); | 333 | IXGBE_WRITE_FLUSH(hw); |
332 | 334 | ||
333 | /* Disable relaxed ordering */ | 335 | /* Disable relaxed ordering */ |
334 | for (i = 0; i < hw->mac.max_tx_queues; i++) { | 336 | for (i = 0; i < hw->mac.max_tx_queues; i++) { |
335 | regval = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL_82599(i)); | 337 | regval = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL_82599(i)); |
336 | regval &= ~IXGBE_DCA_TXCTRL_DESC_WRO_EN; | 338 | regval &= ~IXGBE_DCA_TXCTRL_DESC_WRO_EN; |
337 | IXGBE_WRITE_REG(hw, IXGBE_DCA_TXCTRL_82599(i), regval); | 339 | IXGBE_WRITE_REG(hw, IXGBE_DCA_TXCTRL_82599(i), regval); |
338 | } | 340 | } |
339 | 341 | ||
340 | for (i = 0; i < hw->mac.max_rx_queues; i++) { | 342 | for (i = 0; i < hw->mac.max_rx_queues; i++) { |
341 | regval = IXGBE_READ_REG(hw, IXGBE_DCA_RXCTRL(i)); | 343 | regval = IXGBE_READ_REG(hw, IXGBE_DCA_RXCTRL(i)); |
342 | regval &= ~(IXGBE_DCA_RXCTRL_DATA_WRO_EN | | 344 | regval &= ~(IXGBE_DCA_RXCTRL_DATA_WRO_EN | |
343 | IXGBE_DCA_RXCTRL_HEAD_WRO_EN); | 345 | IXGBE_DCA_RXCTRL_HEAD_WRO_EN); |
344 | IXGBE_WRITE_REG(hw, IXGBE_DCA_RXCTRL(i), regval); | 346 | IXGBE_WRITE_REG(hw, IXGBE_DCA_RXCTRL(i), regval); |
345 | } | 347 | } |
346 | 348 | ||
347 | return 0; | 349 | return 0; |
348 | } | 350 | } |
349 | 351 | ||
350 | /** | 352 | /** |
351 | * ixgbe_init_hw_generic - Generic hardware initialization | 353 | * ixgbe_init_hw_generic - Generic hardware initialization |
352 | * @hw: pointer to hardware structure | 354 | * @hw: pointer to hardware structure |
353 | * | 355 | * |
354 | * Initialize the hardware by resetting the hardware, filling the bus info | 356 | * Initialize the hardware by resetting the hardware, filling the bus info |
355 | * structure and media type, clears all on chip counters, initializes receive | 357 | * structure and media type, clears all on chip counters, initializes receive |
356 | * address registers, multicast table, VLAN filter table, calls routine to set | 358 | * address registers, multicast table, VLAN filter table, calls routine to set |
357 | * up link and flow control settings, and leaves transmit and receive units | 359 | * up link and flow control settings, and leaves transmit and receive units |
358 | * disabled and uninitialized | 360 | * disabled and uninitialized |
359 | **/ | 361 | **/ |
360 | s32 ixgbe_init_hw_generic(struct ixgbe_hw *hw) | 362 | s32 ixgbe_init_hw_generic(struct ixgbe_hw *hw) |
361 | { | 363 | { |
362 | s32 status; | 364 | s32 status; |
363 | 365 | ||
364 | /* Reset the hardware */ | 366 | /* Reset the hardware */ |
365 | status = hw->mac.ops.reset_hw(hw); | 367 | status = hw->mac.ops.reset_hw(hw); |
366 | 368 | ||
367 | if (status == 0) { | 369 | if (status == 0) { |
368 | /* Start the HW */ | 370 | /* Start the HW */ |
369 | status = hw->mac.ops.start_hw(hw); | 371 | status = hw->mac.ops.start_hw(hw); |
370 | } | 372 | } |
371 | 373 | ||
372 | return status; | 374 | return status; |
373 | } | 375 | } |
374 | 376 | ||
375 | /** | 377 | /** |
376 | * ixgbe_clear_hw_cntrs_generic - Generic clear hardware counters | 378 | * ixgbe_clear_hw_cntrs_generic - Generic clear hardware counters |
377 | * @hw: pointer to hardware structure | 379 | * @hw: pointer to hardware structure |
378 | * | 380 | * |
379 | * Clears all hardware statistics counters by reading them from the hardware | 381 | * Clears all hardware statistics counters by reading them from the hardware |
380 | * Statistics counters are clear on read. | 382 | * Statistics counters are clear on read. |
381 | **/ | 383 | **/ |
382 | s32 ixgbe_clear_hw_cntrs_generic(struct ixgbe_hw *hw) | 384 | s32 ixgbe_clear_hw_cntrs_generic(struct ixgbe_hw *hw) |
383 | { | 385 | { |
384 | u16 i = 0; | 386 | u16 i = 0; |
385 | 387 | ||
386 | IXGBE_READ_REG(hw, IXGBE_CRCERRS); | 388 | IXGBE_READ_REG(hw, IXGBE_CRCERRS); |
387 | IXGBE_READ_REG(hw, IXGBE_ILLERRC); | 389 | IXGBE_READ_REG(hw, IXGBE_ILLERRC); |
388 | IXGBE_READ_REG(hw, IXGBE_ERRBC); | 390 | IXGBE_READ_REG(hw, IXGBE_ERRBC); |
389 | IXGBE_READ_REG(hw, IXGBE_MSPDC); | 391 | IXGBE_READ_REG(hw, IXGBE_MSPDC); |
390 | for (i = 0; i < 8; i++) | 392 | for (i = 0; i < 8; i++) |
391 | IXGBE_READ_REG(hw, IXGBE_MPC(i)); | 393 | IXGBE_READ_REG(hw, IXGBE_MPC(i)); |
392 | 394 | ||
393 | IXGBE_READ_REG(hw, IXGBE_MLFC); | 395 | IXGBE_READ_REG(hw, IXGBE_MLFC); |
394 | IXGBE_READ_REG(hw, IXGBE_MRFC); | 396 | IXGBE_READ_REG(hw, IXGBE_MRFC); |
395 | IXGBE_READ_REG(hw, IXGBE_RLEC); | 397 | IXGBE_READ_REG(hw, IXGBE_RLEC); |
396 | IXGBE_READ_REG(hw, IXGBE_LXONTXC); | 398 | IXGBE_READ_REG(hw, IXGBE_LXONTXC); |
397 | IXGBE_READ_REG(hw, IXGBE_LXOFFTXC); | 399 | IXGBE_READ_REG(hw, IXGBE_LXOFFTXC); |
398 | if (hw->mac.type >= ixgbe_mac_82599EB) { | 400 | if (hw->mac.type >= ixgbe_mac_82599EB) { |
399 | IXGBE_READ_REG(hw, IXGBE_LXONRXCNT); | 401 | IXGBE_READ_REG(hw, IXGBE_LXONRXCNT); |
400 | IXGBE_READ_REG(hw, IXGBE_LXOFFRXCNT); | 402 | IXGBE_READ_REG(hw, IXGBE_LXOFFRXCNT); |
401 | } else { | 403 | } else { |
402 | IXGBE_READ_REG(hw, IXGBE_LXONRXC); | 404 | IXGBE_READ_REG(hw, IXGBE_LXONRXC); |
403 | IXGBE_READ_REG(hw, IXGBE_LXOFFRXC); | 405 | IXGBE_READ_REG(hw, IXGBE_LXOFFRXC); |
404 | } | 406 | } |
405 | 407 | ||
406 | for (i = 0; i < 8; i++) { | 408 | for (i = 0; i < 8; i++) { |
407 | IXGBE_READ_REG(hw, IXGBE_PXONTXC(i)); | 409 | IXGBE_READ_REG(hw, IXGBE_PXONTXC(i)); |
408 | IXGBE_READ_REG(hw, IXGBE_PXOFFTXC(i)); | 410 | IXGBE_READ_REG(hw, IXGBE_PXOFFTXC(i)); |
409 | if (hw->mac.type >= ixgbe_mac_82599EB) { | 411 | if (hw->mac.type >= ixgbe_mac_82599EB) { |
410 | IXGBE_READ_REG(hw, IXGBE_PXONRXCNT(i)); | 412 | IXGBE_READ_REG(hw, IXGBE_PXONRXCNT(i)); |
411 | IXGBE_READ_REG(hw, IXGBE_PXOFFRXCNT(i)); | 413 | IXGBE_READ_REG(hw, IXGBE_PXOFFRXCNT(i)); |
412 | } else { | 414 | } else { |
413 | IXGBE_READ_REG(hw, IXGBE_PXONRXC(i)); | 415 | IXGBE_READ_REG(hw, IXGBE_PXONRXC(i)); |
414 | IXGBE_READ_REG(hw, IXGBE_PXOFFRXC(i)); | 416 | IXGBE_READ_REG(hw, IXGBE_PXOFFRXC(i)); |
415 | } | 417 | } |
416 | } | 418 | } |
417 | if (hw->mac.type >= ixgbe_mac_82599EB) | 419 | if (hw->mac.type >= ixgbe_mac_82599EB) |
418 | for (i = 0; i < 8; i++) | 420 | for (i = 0; i < 8; i++) |
419 | IXGBE_READ_REG(hw, IXGBE_PXON2OFFCNT(i)); | 421 | IXGBE_READ_REG(hw, IXGBE_PXON2OFFCNT(i)); |
420 | IXGBE_READ_REG(hw, IXGBE_PRC64); | 422 | IXGBE_READ_REG(hw, IXGBE_PRC64); |
421 | IXGBE_READ_REG(hw, IXGBE_PRC127); | 423 | IXGBE_READ_REG(hw, IXGBE_PRC127); |
422 | IXGBE_READ_REG(hw, IXGBE_PRC255); | 424 | IXGBE_READ_REG(hw, IXGBE_PRC255); |
423 | IXGBE_READ_REG(hw, IXGBE_PRC511); | 425 | IXGBE_READ_REG(hw, IXGBE_PRC511); |
424 | IXGBE_READ_REG(hw, IXGBE_PRC1023); | 426 | IXGBE_READ_REG(hw, IXGBE_PRC1023); |
425 | IXGBE_READ_REG(hw, IXGBE_PRC1522); | 427 | IXGBE_READ_REG(hw, IXGBE_PRC1522); |
426 | IXGBE_READ_REG(hw, IXGBE_GPRC); | 428 | IXGBE_READ_REG(hw, IXGBE_GPRC); |
427 | IXGBE_READ_REG(hw, IXGBE_BPRC); | 429 | IXGBE_READ_REG(hw, IXGBE_BPRC); |
428 | IXGBE_READ_REG(hw, IXGBE_MPRC); | 430 | IXGBE_READ_REG(hw, IXGBE_MPRC); |
429 | IXGBE_READ_REG(hw, IXGBE_GPTC); | 431 | IXGBE_READ_REG(hw, IXGBE_GPTC); |
430 | IXGBE_READ_REG(hw, IXGBE_GORCL); | 432 | IXGBE_READ_REG(hw, IXGBE_GORCL); |
431 | IXGBE_READ_REG(hw, IXGBE_GORCH); | 433 | IXGBE_READ_REG(hw, IXGBE_GORCH); |
432 | IXGBE_READ_REG(hw, IXGBE_GOTCL); | 434 | IXGBE_READ_REG(hw, IXGBE_GOTCL); |
433 | IXGBE_READ_REG(hw, IXGBE_GOTCH); | 435 | IXGBE_READ_REG(hw, IXGBE_GOTCH); |
434 | if (hw->mac.type == ixgbe_mac_82598EB) | 436 | if (hw->mac.type == ixgbe_mac_82598EB) |
435 | for (i = 0; i < 8; i++) | 437 | for (i = 0; i < 8; i++) |
436 | IXGBE_READ_REG(hw, IXGBE_RNBC(i)); | 438 | IXGBE_READ_REG(hw, IXGBE_RNBC(i)); |
437 | IXGBE_READ_REG(hw, IXGBE_RUC); | 439 | IXGBE_READ_REG(hw, IXGBE_RUC); |
438 | IXGBE_READ_REG(hw, IXGBE_RFC); | 440 | IXGBE_READ_REG(hw, IXGBE_RFC); |
439 | IXGBE_READ_REG(hw, IXGBE_ROC); | 441 | IXGBE_READ_REG(hw, IXGBE_ROC); |
440 | IXGBE_READ_REG(hw, IXGBE_RJC); | 442 | IXGBE_READ_REG(hw, IXGBE_RJC); |
441 | IXGBE_READ_REG(hw, IXGBE_MNGPRC); | 443 | IXGBE_READ_REG(hw, IXGBE_MNGPRC); |
442 | IXGBE_READ_REG(hw, IXGBE_MNGPDC); | 444 | IXGBE_READ_REG(hw, IXGBE_MNGPDC); |
443 | IXGBE_READ_REG(hw, IXGBE_MNGPTC); | 445 | IXGBE_READ_REG(hw, IXGBE_MNGPTC); |
444 | IXGBE_READ_REG(hw, IXGBE_TORL); | 446 | IXGBE_READ_REG(hw, IXGBE_TORL); |
445 | IXGBE_READ_REG(hw, IXGBE_TORH); | 447 | IXGBE_READ_REG(hw, IXGBE_TORH); |
446 | IXGBE_READ_REG(hw, IXGBE_TPR); | 448 | IXGBE_READ_REG(hw, IXGBE_TPR); |
447 | IXGBE_READ_REG(hw, IXGBE_TPT); | 449 | IXGBE_READ_REG(hw, IXGBE_TPT); |
448 | IXGBE_READ_REG(hw, IXGBE_PTC64); | 450 | IXGBE_READ_REG(hw, IXGBE_PTC64); |
449 | IXGBE_READ_REG(hw, IXGBE_PTC127); | 451 | IXGBE_READ_REG(hw, IXGBE_PTC127); |
450 | IXGBE_READ_REG(hw, IXGBE_PTC255); | 452 | IXGBE_READ_REG(hw, IXGBE_PTC255); |
451 | IXGBE_READ_REG(hw, IXGBE_PTC511); | 453 | IXGBE_READ_REG(hw, IXGBE_PTC511); |
452 | IXGBE_READ_REG(hw, IXGBE_PTC1023); | 454 | IXGBE_READ_REG(hw, IXGBE_PTC1023); |
453 | IXGBE_READ_REG(hw, IXGBE_PTC1522); | 455 | IXGBE_READ_REG(hw, IXGBE_PTC1522); |
454 | IXGBE_READ_REG(hw, IXGBE_MPTC); | 456 | IXGBE_READ_REG(hw, IXGBE_MPTC); |
455 | IXGBE_READ_REG(hw, IXGBE_BPTC); | 457 | IXGBE_READ_REG(hw, IXGBE_BPTC); |
456 | for (i = 0; i < 16; i++) { | 458 | for (i = 0; i < 16; i++) { |
457 | IXGBE_READ_REG(hw, IXGBE_QPRC(i)); | 459 | IXGBE_READ_REG(hw, IXGBE_QPRC(i)); |
458 | IXGBE_READ_REG(hw, IXGBE_QPTC(i)); | 460 | IXGBE_READ_REG(hw, IXGBE_QPTC(i)); |
459 | if (hw->mac.type >= ixgbe_mac_82599EB) { | 461 | if (hw->mac.type >= ixgbe_mac_82599EB) { |
460 | IXGBE_READ_REG(hw, IXGBE_QBRC_L(i)); | 462 | IXGBE_READ_REG(hw, IXGBE_QBRC_L(i)); |
461 | IXGBE_READ_REG(hw, IXGBE_QBRC_H(i)); | 463 | IXGBE_READ_REG(hw, IXGBE_QBRC_H(i)); |
462 | IXGBE_READ_REG(hw, IXGBE_QBTC_L(i)); | 464 | IXGBE_READ_REG(hw, IXGBE_QBTC_L(i)); |
463 | IXGBE_READ_REG(hw, IXGBE_QBTC_H(i)); | 465 | IXGBE_READ_REG(hw, IXGBE_QBTC_H(i)); |
464 | IXGBE_READ_REG(hw, IXGBE_QPRDC(i)); | 466 | IXGBE_READ_REG(hw, IXGBE_QPRDC(i)); |
465 | } else { | 467 | } else { |
466 | IXGBE_READ_REG(hw, IXGBE_QBRC(i)); | 468 | IXGBE_READ_REG(hw, IXGBE_QBRC(i)); |
467 | IXGBE_READ_REG(hw, IXGBE_QBTC(i)); | 469 | IXGBE_READ_REG(hw, IXGBE_QBTC(i)); |
468 | } | 470 | } |
469 | } | 471 | } |
470 | 472 | ||
471 | if (hw->mac.type == ixgbe_mac_X540) { | 473 | if (hw->mac.type == ixgbe_mac_X540) { |
472 | if (hw->phy.id == 0) | 474 | if (hw->phy.id == 0) |
473 | hw->phy.ops.identify(hw); | 475 | hw->phy.ops.identify(hw); |
474 | hw->phy.ops.read_reg(hw, IXGBE_PCRC8ECL, MDIO_MMD_PCS, &i); | 476 | hw->phy.ops.read_reg(hw, IXGBE_PCRC8ECL, MDIO_MMD_PCS, &i); |
475 | hw->phy.ops.read_reg(hw, IXGBE_PCRC8ECH, MDIO_MMD_PCS, &i); | 477 | hw->phy.ops.read_reg(hw, IXGBE_PCRC8ECH, MDIO_MMD_PCS, &i); |
476 | hw->phy.ops.read_reg(hw, IXGBE_LDPCECL, MDIO_MMD_PCS, &i); | 478 | hw->phy.ops.read_reg(hw, IXGBE_LDPCECL, MDIO_MMD_PCS, &i); |
477 | hw->phy.ops.read_reg(hw, IXGBE_LDPCECH, MDIO_MMD_PCS, &i); | 479 | hw->phy.ops.read_reg(hw, IXGBE_LDPCECH, MDIO_MMD_PCS, &i); |
478 | } | 480 | } |
479 | 481 | ||
480 | return 0; | 482 | return 0; |
481 | } | 483 | } |
482 | 484 | ||
483 | /** | 485 | /** |
484 | * ixgbe_read_pba_string_generic - Reads part number string from EEPROM | 486 | * ixgbe_read_pba_string_generic - Reads part number string from EEPROM |
485 | * @hw: pointer to hardware structure | 487 | * @hw: pointer to hardware structure |
486 | * @pba_num: stores the part number string from the EEPROM | 488 | * @pba_num: stores the part number string from the EEPROM |
487 | * @pba_num_size: part number string buffer length | 489 | * @pba_num_size: part number string buffer length |
488 | * | 490 | * |
489 | * Reads the part number string from the EEPROM. | 491 | * Reads the part number string from the EEPROM. |
490 | **/ | 492 | **/ |
491 | s32 ixgbe_read_pba_string_generic(struct ixgbe_hw *hw, u8 *pba_num, | 493 | s32 ixgbe_read_pba_string_generic(struct ixgbe_hw *hw, u8 *pba_num, |
492 | u32 pba_num_size) | 494 | u32 pba_num_size) |
493 | { | 495 | { |
494 | s32 ret_val; | 496 | s32 ret_val; |
495 | u16 data; | 497 | u16 data; |
496 | u16 pba_ptr; | 498 | u16 pba_ptr; |
497 | u16 offset; | 499 | u16 offset; |
498 | u16 length; | 500 | u16 length; |
499 | 501 | ||
500 | if (pba_num == NULL) { | 502 | if (pba_num == NULL) { |
501 | hw_dbg(hw, "PBA string buffer was null\n"); | 503 | hw_dbg(hw, "PBA string buffer was null\n"); |
502 | return IXGBE_ERR_INVALID_ARGUMENT; | 504 | return IXGBE_ERR_INVALID_ARGUMENT; |
503 | } | 505 | } |
504 | 506 | ||
505 | ret_val = hw->eeprom.ops.read(hw, IXGBE_PBANUM0_PTR, &data); | 507 | ret_val = hw->eeprom.ops.read(hw, IXGBE_PBANUM0_PTR, &data); |
506 | if (ret_val) { | 508 | if (ret_val) { |
507 | hw_dbg(hw, "NVM Read Error\n"); | 509 | hw_dbg(hw, "NVM Read Error\n"); |
508 | return ret_val; | 510 | return ret_val; |
509 | } | 511 | } |
510 | 512 | ||
511 | ret_val = hw->eeprom.ops.read(hw, IXGBE_PBANUM1_PTR, &pba_ptr); | 513 | ret_val = hw->eeprom.ops.read(hw, IXGBE_PBANUM1_PTR, &pba_ptr); |
512 | if (ret_val) { | 514 | if (ret_val) { |
513 | hw_dbg(hw, "NVM Read Error\n"); | 515 | hw_dbg(hw, "NVM Read Error\n"); |
514 | return ret_val; | 516 | return ret_val; |
515 | } | 517 | } |
516 | 518 | ||
517 | /* | 519 | /* |
518 | * if data is not ptr guard the PBA must be in legacy format which | 520 | * if data is not ptr guard the PBA must be in legacy format which |
519 | * means pba_ptr is actually our second data word for the PBA number | 521 | * means pba_ptr is actually our second data word for the PBA number |
520 | * and we can decode it into an ascii string | 522 | * and we can decode it into an ascii string |
521 | */ | 523 | */ |
522 | if (data != IXGBE_PBANUM_PTR_GUARD) { | 524 | if (data != IXGBE_PBANUM_PTR_GUARD) { |
523 | hw_dbg(hw, "NVM PBA number is not stored as string\n"); | 525 | hw_dbg(hw, "NVM PBA number is not stored as string\n"); |
524 | 526 | ||
525 | /* we will need 11 characters to store the PBA */ | 527 | /* we will need 11 characters to store the PBA */ |
526 | if (pba_num_size < 11) { | 528 | if (pba_num_size < 11) { |
527 | hw_dbg(hw, "PBA string buffer too small\n"); | 529 | hw_dbg(hw, "PBA string buffer too small\n"); |
528 | return IXGBE_ERR_NO_SPACE; | 530 | return IXGBE_ERR_NO_SPACE; |
529 | } | 531 | } |
530 | 532 | ||
531 | /* extract hex string from data and pba_ptr */ | 533 | /* extract hex string from data and pba_ptr */ |
532 | pba_num[0] = (data >> 12) & 0xF; | 534 | pba_num[0] = (data >> 12) & 0xF; |
533 | pba_num[1] = (data >> 8) & 0xF; | 535 | pba_num[1] = (data >> 8) & 0xF; |
534 | pba_num[2] = (data >> 4) & 0xF; | 536 | pba_num[2] = (data >> 4) & 0xF; |
535 | pba_num[3] = data & 0xF; | 537 | pba_num[3] = data & 0xF; |
536 | pba_num[4] = (pba_ptr >> 12) & 0xF; | 538 | pba_num[4] = (pba_ptr >> 12) & 0xF; |
537 | pba_num[5] = (pba_ptr >> 8) & 0xF; | 539 | pba_num[5] = (pba_ptr >> 8) & 0xF; |
538 | pba_num[6] = '-'; | 540 | pba_num[6] = '-'; |
539 | pba_num[7] = 0; | 541 | pba_num[7] = 0; |
540 | pba_num[8] = (pba_ptr >> 4) & 0xF; | 542 | pba_num[8] = (pba_ptr >> 4) & 0xF; |
541 | pba_num[9] = pba_ptr & 0xF; | 543 | pba_num[9] = pba_ptr & 0xF; |
542 | 544 | ||
543 | /* put a null character on the end of our string */ | 545 | /* put a null character on the end of our string */ |
544 | pba_num[10] = '\0'; | 546 | pba_num[10] = '\0'; |
545 | 547 | ||
546 | /* switch all the data but the '-' to hex char */ | 548 | /* switch all the data but the '-' to hex char */ |
547 | for (offset = 0; offset < 10; offset++) { | 549 | for (offset = 0; offset < 10; offset++) { |
548 | if (pba_num[offset] < 0xA) | 550 | if (pba_num[offset] < 0xA) |
549 | pba_num[offset] += '0'; | 551 | pba_num[offset] += '0'; |
550 | else if (pba_num[offset] < 0x10) | 552 | else if (pba_num[offset] < 0x10) |
551 | pba_num[offset] += 'A' - 0xA; | 553 | pba_num[offset] += 'A' - 0xA; |
552 | } | 554 | } |
553 | 555 | ||
554 | return 0; | 556 | return 0; |
555 | } | 557 | } |
556 | 558 | ||
557 | ret_val = hw->eeprom.ops.read(hw, pba_ptr, &length); | 559 | ret_val = hw->eeprom.ops.read(hw, pba_ptr, &length); |
558 | if (ret_val) { | 560 | if (ret_val) { |
559 | hw_dbg(hw, "NVM Read Error\n"); | 561 | hw_dbg(hw, "NVM Read Error\n"); |
560 | return ret_val; | 562 | return ret_val; |
561 | } | 563 | } |
562 | 564 | ||
563 | if (length == 0xFFFF || length == 0) { | 565 | if (length == 0xFFFF || length == 0) { |
564 | hw_dbg(hw, "NVM PBA number section invalid length\n"); | 566 | hw_dbg(hw, "NVM PBA number section invalid length\n"); |
565 | return IXGBE_ERR_PBA_SECTION; | 567 | return IXGBE_ERR_PBA_SECTION; |
566 | } | 568 | } |
567 | 569 | ||
568 | /* check if pba_num buffer is big enough */ | 570 | /* check if pba_num buffer is big enough */ |
569 | if (pba_num_size < (((u32)length * 2) - 1)) { | 571 | if (pba_num_size < (((u32)length * 2) - 1)) { |
570 | hw_dbg(hw, "PBA string buffer too small\n"); | 572 | hw_dbg(hw, "PBA string buffer too small\n"); |
571 | return IXGBE_ERR_NO_SPACE; | 573 | return IXGBE_ERR_NO_SPACE; |
572 | } | 574 | } |
573 | 575 | ||
574 | /* trim pba length from start of string */ | 576 | /* trim pba length from start of string */ |
575 | pba_ptr++; | 577 | pba_ptr++; |
576 | length--; | 578 | length--; |
577 | 579 | ||
578 | for (offset = 0; offset < length; offset++) { | 580 | for (offset = 0; offset < length; offset++) { |
579 | ret_val = hw->eeprom.ops.read(hw, pba_ptr + offset, &data); | 581 | ret_val = hw->eeprom.ops.read(hw, pba_ptr + offset, &data); |
580 | if (ret_val) { | 582 | if (ret_val) { |
581 | hw_dbg(hw, "NVM Read Error\n"); | 583 | hw_dbg(hw, "NVM Read Error\n"); |
582 | return ret_val; | 584 | return ret_val; |
583 | } | 585 | } |
584 | pba_num[offset * 2] = (u8)(data >> 8); | 586 | pba_num[offset * 2] = (u8)(data >> 8); |
585 | pba_num[(offset * 2) + 1] = (u8)(data & 0xFF); | 587 | pba_num[(offset * 2) + 1] = (u8)(data & 0xFF); |
586 | } | 588 | } |
587 | pba_num[offset * 2] = '\0'; | 589 | pba_num[offset * 2] = '\0'; |
588 | 590 | ||
589 | return 0; | 591 | return 0; |
590 | } | 592 | } |
591 | 593 | ||
592 | /** | 594 | /** |
593 | * ixgbe_get_mac_addr_generic - Generic get MAC address | 595 | * ixgbe_get_mac_addr_generic - Generic get MAC address |
594 | * @hw: pointer to hardware structure | 596 | * @hw: pointer to hardware structure |
595 | * @mac_addr: Adapter MAC address | 597 | * @mac_addr: Adapter MAC address |
596 | * | 598 | * |
597 | * Reads the adapter's MAC address from first Receive Address Register (RAR0) | 599 | * Reads the adapter's MAC address from first Receive Address Register (RAR0) |
598 | * A reset of the adapter must be performed prior to calling this function | 600 | * A reset of the adapter must be performed prior to calling this function |
599 | * in order for the MAC address to have been loaded from the EEPROM into RAR0 | 601 | * in order for the MAC address to have been loaded from the EEPROM into RAR0 |
600 | **/ | 602 | **/ |
601 | s32 ixgbe_get_mac_addr_generic(struct ixgbe_hw *hw, u8 *mac_addr) | 603 | s32 ixgbe_get_mac_addr_generic(struct ixgbe_hw *hw, u8 *mac_addr) |
602 | { | 604 | { |
603 | u32 rar_high; | 605 | u32 rar_high; |
604 | u32 rar_low; | 606 | u32 rar_low; |
605 | u16 i; | 607 | u16 i; |
606 | 608 | ||
607 | rar_high = IXGBE_READ_REG(hw, IXGBE_RAH(0)); | 609 | rar_high = IXGBE_READ_REG(hw, IXGBE_RAH(0)); |
608 | rar_low = IXGBE_READ_REG(hw, IXGBE_RAL(0)); | 610 | rar_low = IXGBE_READ_REG(hw, IXGBE_RAL(0)); |
609 | 611 | ||
610 | for (i = 0; i < 4; i++) | 612 | for (i = 0; i < 4; i++) |
611 | mac_addr[i] = (u8)(rar_low >> (i*8)); | 613 | mac_addr[i] = (u8)(rar_low >> (i*8)); |
612 | 614 | ||
613 | for (i = 0; i < 2; i++) | 615 | for (i = 0; i < 2; i++) |
614 | mac_addr[i+4] = (u8)(rar_high >> (i*8)); | 616 | mac_addr[i+4] = (u8)(rar_high >> (i*8)); |
615 | 617 | ||
616 | return 0; | 618 | return 0; |
617 | } | 619 | } |
618 | 620 | ||
619 | enum ixgbe_bus_width ixgbe_convert_bus_width(u16 link_status) | 621 | enum ixgbe_bus_width ixgbe_convert_bus_width(u16 link_status) |
620 | { | 622 | { |
621 | switch (link_status & IXGBE_PCI_LINK_WIDTH) { | 623 | switch (link_status & IXGBE_PCI_LINK_WIDTH) { |
622 | case IXGBE_PCI_LINK_WIDTH_1: | 624 | case IXGBE_PCI_LINK_WIDTH_1: |
623 | return ixgbe_bus_width_pcie_x1; | 625 | return ixgbe_bus_width_pcie_x1; |
624 | case IXGBE_PCI_LINK_WIDTH_2: | 626 | case IXGBE_PCI_LINK_WIDTH_2: |
625 | return ixgbe_bus_width_pcie_x2; | 627 | return ixgbe_bus_width_pcie_x2; |
626 | case IXGBE_PCI_LINK_WIDTH_4: | 628 | case IXGBE_PCI_LINK_WIDTH_4: |
627 | return ixgbe_bus_width_pcie_x4; | 629 | return ixgbe_bus_width_pcie_x4; |
628 | case IXGBE_PCI_LINK_WIDTH_8: | 630 | case IXGBE_PCI_LINK_WIDTH_8: |
629 | return ixgbe_bus_width_pcie_x8; | 631 | return ixgbe_bus_width_pcie_x8; |
630 | default: | 632 | default: |
631 | return ixgbe_bus_width_unknown; | 633 | return ixgbe_bus_width_unknown; |
632 | } | 634 | } |
633 | } | 635 | } |
634 | 636 | ||
635 | enum ixgbe_bus_speed ixgbe_convert_bus_speed(u16 link_status) | 637 | enum ixgbe_bus_speed ixgbe_convert_bus_speed(u16 link_status) |
636 | { | 638 | { |
637 | switch (link_status & IXGBE_PCI_LINK_SPEED) { | 639 | switch (link_status & IXGBE_PCI_LINK_SPEED) { |
638 | case IXGBE_PCI_LINK_SPEED_2500: | 640 | case IXGBE_PCI_LINK_SPEED_2500: |
639 | return ixgbe_bus_speed_2500; | 641 | return ixgbe_bus_speed_2500; |
640 | case IXGBE_PCI_LINK_SPEED_5000: | 642 | case IXGBE_PCI_LINK_SPEED_5000: |
641 | return ixgbe_bus_speed_5000; | 643 | return ixgbe_bus_speed_5000; |
642 | case IXGBE_PCI_LINK_SPEED_8000: | 644 | case IXGBE_PCI_LINK_SPEED_8000: |
643 | return ixgbe_bus_speed_8000; | 645 | return ixgbe_bus_speed_8000; |
644 | default: | 646 | default: |
645 | return ixgbe_bus_speed_unknown; | 647 | return ixgbe_bus_speed_unknown; |
646 | } | 648 | } |
647 | } | 649 | } |
648 | 650 | ||
649 | /** | 651 | /** |
650 | * ixgbe_get_bus_info_generic - Generic set PCI bus info | 652 | * ixgbe_get_bus_info_generic - Generic set PCI bus info |
651 | * @hw: pointer to hardware structure | 653 | * @hw: pointer to hardware structure |
652 | * | 654 | * |
653 | * Sets the PCI bus info (speed, width, type) within the ixgbe_hw structure | 655 | * Sets the PCI bus info (speed, width, type) within the ixgbe_hw structure |
654 | **/ | 656 | **/ |
655 | s32 ixgbe_get_bus_info_generic(struct ixgbe_hw *hw) | 657 | s32 ixgbe_get_bus_info_generic(struct ixgbe_hw *hw) |
656 | { | 658 | { |
657 | struct ixgbe_adapter *adapter = hw->back; | 659 | struct ixgbe_adapter *adapter = hw->back; |
658 | struct ixgbe_mac_info *mac = &hw->mac; | 660 | struct ixgbe_mac_info *mac = &hw->mac; |
659 | u16 link_status; | 661 | u16 link_status; |
660 | 662 | ||
661 | hw->bus.type = ixgbe_bus_type_pci_express; | 663 | hw->bus.type = ixgbe_bus_type_pci_express; |
662 | 664 | ||
663 | /* Get the negotiated link width and speed from PCI config space */ | 665 | /* Get the negotiated link width and speed from PCI config space */ |
664 | pci_read_config_word(adapter->pdev, IXGBE_PCI_LINK_STATUS, | 666 | pci_read_config_word(adapter->pdev, IXGBE_PCI_LINK_STATUS, |
665 | &link_status); | 667 | &link_status); |
666 | 668 | ||
667 | hw->bus.width = ixgbe_convert_bus_width(link_status); | 669 | hw->bus.width = ixgbe_convert_bus_width(link_status); |
668 | hw->bus.speed = ixgbe_convert_bus_speed(link_status); | 670 | hw->bus.speed = ixgbe_convert_bus_speed(link_status); |
669 | 671 | ||
670 | mac->ops.set_lan_id(hw); | 672 | mac->ops.set_lan_id(hw); |
671 | 673 | ||
672 | return 0; | 674 | return 0; |
673 | } | 675 | } |
674 | 676 | ||
675 | /** | 677 | /** |
676 | * ixgbe_set_lan_id_multi_port_pcie - Set LAN id for PCIe multiple port devices | 678 | * ixgbe_set_lan_id_multi_port_pcie - Set LAN id for PCIe multiple port devices |
677 | * @hw: pointer to the HW structure | 679 | * @hw: pointer to the HW structure |
678 | * | 680 | * |
679 | * Determines the LAN function id by reading memory-mapped registers | 681 | * Determines the LAN function id by reading memory-mapped registers |
680 | * and swaps the port value if requested. | 682 | * and swaps the port value if requested. |
681 | **/ | 683 | **/ |
682 | void ixgbe_set_lan_id_multi_port_pcie(struct ixgbe_hw *hw) | 684 | void ixgbe_set_lan_id_multi_port_pcie(struct ixgbe_hw *hw) |
683 | { | 685 | { |
684 | struct ixgbe_bus_info *bus = &hw->bus; | 686 | struct ixgbe_bus_info *bus = &hw->bus; |
685 | u32 reg; | 687 | u32 reg; |
686 | 688 | ||
687 | reg = IXGBE_READ_REG(hw, IXGBE_STATUS); | 689 | reg = IXGBE_READ_REG(hw, IXGBE_STATUS); |
688 | bus->func = (reg & IXGBE_STATUS_LAN_ID) >> IXGBE_STATUS_LAN_ID_SHIFT; | 690 | bus->func = (reg & IXGBE_STATUS_LAN_ID) >> IXGBE_STATUS_LAN_ID_SHIFT; |
689 | bus->lan_id = bus->func; | 691 | bus->lan_id = bus->func; |
690 | 692 | ||
691 | /* check for a port swap */ | 693 | /* check for a port swap */ |
692 | reg = IXGBE_READ_REG(hw, IXGBE_FACTPS); | 694 | reg = IXGBE_READ_REG(hw, IXGBE_FACTPS); |
693 | if (reg & IXGBE_FACTPS_LFS) | 695 | if (reg & IXGBE_FACTPS_LFS) |
694 | bus->func ^= 0x1; | 696 | bus->func ^= 0x1; |
695 | } | 697 | } |
696 | 698 | ||
697 | /** | 699 | /** |
698 | * ixgbe_stop_adapter_generic - Generic stop Tx/Rx units | 700 | * ixgbe_stop_adapter_generic - Generic stop Tx/Rx units |
699 | * @hw: pointer to hardware structure | 701 | * @hw: pointer to hardware structure |
700 | * | 702 | * |
701 | * Sets the adapter_stopped flag within ixgbe_hw struct. Clears interrupts, | 703 | * Sets the adapter_stopped flag within ixgbe_hw struct. Clears interrupts, |
702 | * disables transmit and receive units. The adapter_stopped flag is used by | 704 | * disables transmit and receive units. The adapter_stopped flag is used by |
703 | * the shared code and drivers to determine if the adapter is in a stopped | 705 | * the shared code and drivers to determine if the adapter is in a stopped |
704 | * state and should not touch the hardware. | 706 | * state and should not touch the hardware. |
705 | **/ | 707 | **/ |
706 | s32 ixgbe_stop_adapter_generic(struct ixgbe_hw *hw) | 708 | s32 ixgbe_stop_adapter_generic(struct ixgbe_hw *hw) |
707 | { | 709 | { |
708 | u32 reg_val; | 710 | u32 reg_val; |
709 | u16 i; | 711 | u16 i; |
710 | 712 | ||
711 | /* | 713 | /* |
712 | * Set the adapter_stopped flag so other driver functions stop touching | 714 | * Set the adapter_stopped flag so other driver functions stop touching |
713 | * the hardware | 715 | * the hardware |
714 | */ | 716 | */ |
715 | hw->adapter_stopped = true; | 717 | hw->adapter_stopped = true; |
716 | 718 | ||
717 | /* Disable the receive unit */ | 719 | /* Disable the receive unit */ |
718 | IXGBE_WRITE_REG(hw, IXGBE_RXCTRL, 0); | 720 | IXGBE_WRITE_REG(hw, IXGBE_RXCTRL, 0); |
719 | 721 | ||
720 | /* Clear interrupt mask to stop interrupts from being generated */ | 722 | /* Clear interrupt mask to stop interrupts from being generated */ |
721 | IXGBE_WRITE_REG(hw, IXGBE_EIMC, IXGBE_IRQ_CLEAR_MASK); | 723 | IXGBE_WRITE_REG(hw, IXGBE_EIMC, IXGBE_IRQ_CLEAR_MASK); |
722 | 724 | ||
723 | /* Clear any pending interrupts, flush previous writes */ | 725 | /* Clear any pending interrupts, flush previous writes */ |
724 | IXGBE_READ_REG(hw, IXGBE_EICR); | 726 | IXGBE_READ_REG(hw, IXGBE_EICR); |
725 | 727 | ||
726 | /* Disable the transmit unit. Each queue must be disabled. */ | 728 | /* Disable the transmit unit. Each queue must be disabled. */ |
727 | for (i = 0; i < hw->mac.max_tx_queues; i++) | 729 | for (i = 0; i < hw->mac.max_tx_queues; i++) |
728 | IXGBE_WRITE_REG(hw, IXGBE_TXDCTL(i), IXGBE_TXDCTL_SWFLSH); | 730 | IXGBE_WRITE_REG(hw, IXGBE_TXDCTL(i), IXGBE_TXDCTL_SWFLSH); |
729 | 731 | ||
730 | /* Disable the receive unit by stopping each queue */ | 732 | /* Disable the receive unit by stopping each queue */ |
731 | for (i = 0; i < hw->mac.max_rx_queues; i++) { | 733 | for (i = 0; i < hw->mac.max_rx_queues; i++) { |
732 | reg_val = IXGBE_READ_REG(hw, IXGBE_RXDCTL(i)); | 734 | reg_val = IXGBE_READ_REG(hw, IXGBE_RXDCTL(i)); |
733 | reg_val &= ~IXGBE_RXDCTL_ENABLE; | 735 | reg_val &= ~IXGBE_RXDCTL_ENABLE; |
734 | reg_val |= IXGBE_RXDCTL_SWFLSH; | 736 | reg_val |= IXGBE_RXDCTL_SWFLSH; |
735 | IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(i), reg_val); | 737 | IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(i), reg_val); |
736 | } | 738 | } |
737 | 739 | ||
738 | /* flush all queues disables */ | 740 | /* flush all queues disables */ |
739 | IXGBE_WRITE_FLUSH(hw); | 741 | IXGBE_WRITE_FLUSH(hw); |
740 | usleep_range(1000, 2000); | 742 | usleep_range(1000, 2000); |
741 | 743 | ||
742 | /* | 744 | /* |
743 | * Prevent the PCI-E bus from from hanging by disabling PCI-E master | 745 | * Prevent the PCI-E bus from from hanging by disabling PCI-E master |
744 | * access and verify no pending requests | 746 | * access and verify no pending requests |
745 | */ | 747 | */ |
746 | return ixgbe_disable_pcie_master(hw); | 748 | return ixgbe_disable_pcie_master(hw); |
747 | } | 749 | } |
748 | 750 | ||
749 | /** | 751 | /** |
750 | * ixgbe_led_on_generic - Turns on the software controllable LEDs. | 752 | * ixgbe_led_on_generic - Turns on the software controllable LEDs. |
751 | * @hw: pointer to hardware structure | 753 | * @hw: pointer to hardware structure |
752 | * @index: led number to turn on | 754 | * @index: led number to turn on |
753 | **/ | 755 | **/ |
754 | s32 ixgbe_led_on_generic(struct ixgbe_hw *hw, u32 index) | 756 | s32 ixgbe_led_on_generic(struct ixgbe_hw *hw, u32 index) |
755 | { | 757 | { |
756 | u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL); | 758 | u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL); |
757 | 759 | ||
758 | /* To turn on the LED, set mode to ON. */ | 760 | /* To turn on the LED, set mode to ON. */ |
759 | led_reg &= ~IXGBE_LED_MODE_MASK(index); | 761 | led_reg &= ~IXGBE_LED_MODE_MASK(index); |
760 | led_reg |= IXGBE_LED_ON << IXGBE_LED_MODE_SHIFT(index); | 762 | led_reg |= IXGBE_LED_ON << IXGBE_LED_MODE_SHIFT(index); |
761 | IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg); | 763 | IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg); |
762 | IXGBE_WRITE_FLUSH(hw); | 764 | IXGBE_WRITE_FLUSH(hw); |
763 | 765 | ||
764 | return 0; | 766 | return 0; |
765 | } | 767 | } |
766 | 768 | ||
767 | /** | 769 | /** |
768 | * ixgbe_led_off_generic - Turns off the software controllable LEDs. | 770 | * ixgbe_led_off_generic - Turns off the software controllable LEDs. |
769 | * @hw: pointer to hardware structure | 771 | * @hw: pointer to hardware structure |
770 | * @index: led number to turn off | 772 | * @index: led number to turn off |
771 | **/ | 773 | **/ |
772 | s32 ixgbe_led_off_generic(struct ixgbe_hw *hw, u32 index) | 774 | s32 ixgbe_led_off_generic(struct ixgbe_hw *hw, u32 index) |
773 | { | 775 | { |
774 | u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL); | 776 | u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL); |
775 | 777 | ||
776 | /* To turn off the LED, set mode to OFF. */ | 778 | /* To turn off the LED, set mode to OFF. */ |
777 | led_reg &= ~IXGBE_LED_MODE_MASK(index); | 779 | led_reg &= ~IXGBE_LED_MODE_MASK(index); |
778 | led_reg |= IXGBE_LED_OFF << IXGBE_LED_MODE_SHIFT(index); | 780 | led_reg |= IXGBE_LED_OFF << IXGBE_LED_MODE_SHIFT(index); |
779 | IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg); | 781 | IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg); |
780 | IXGBE_WRITE_FLUSH(hw); | 782 | IXGBE_WRITE_FLUSH(hw); |
781 | 783 | ||
782 | return 0; | 784 | return 0; |
783 | } | 785 | } |
784 | 786 | ||
785 | /** | 787 | /** |
786 | * ixgbe_init_eeprom_params_generic - Initialize EEPROM params | 788 | * ixgbe_init_eeprom_params_generic - Initialize EEPROM params |
787 | * @hw: pointer to hardware structure | 789 | * @hw: pointer to hardware structure |
788 | * | 790 | * |
789 | * Initializes the EEPROM parameters ixgbe_eeprom_info within the | 791 | * Initializes the EEPROM parameters ixgbe_eeprom_info within the |
790 | * ixgbe_hw struct in order to set up EEPROM access. | 792 | * ixgbe_hw struct in order to set up EEPROM access. |
791 | **/ | 793 | **/ |
792 | s32 ixgbe_init_eeprom_params_generic(struct ixgbe_hw *hw) | 794 | s32 ixgbe_init_eeprom_params_generic(struct ixgbe_hw *hw) |
793 | { | 795 | { |
794 | struct ixgbe_eeprom_info *eeprom = &hw->eeprom; | 796 | struct ixgbe_eeprom_info *eeprom = &hw->eeprom; |
795 | u32 eec; | 797 | u32 eec; |
796 | u16 eeprom_size; | 798 | u16 eeprom_size; |
797 | 799 | ||
798 | if (eeprom->type == ixgbe_eeprom_uninitialized) { | 800 | if (eeprom->type == ixgbe_eeprom_uninitialized) { |
799 | eeprom->type = ixgbe_eeprom_none; | 801 | eeprom->type = ixgbe_eeprom_none; |
800 | /* Set default semaphore delay to 10ms which is a well | 802 | /* Set default semaphore delay to 10ms which is a well |
801 | * tested value */ | 803 | * tested value */ |
802 | eeprom->semaphore_delay = 10; | 804 | eeprom->semaphore_delay = 10; |
803 | /* Clear EEPROM page size, it will be initialized as needed */ | 805 | /* Clear EEPROM page size, it will be initialized as needed */ |
804 | eeprom->word_page_size = 0; | 806 | eeprom->word_page_size = 0; |
805 | 807 | ||
806 | /* | 808 | /* |
807 | * Check for EEPROM present first. | 809 | * Check for EEPROM present first. |
808 | * If not present leave as none | 810 | * If not present leave as none |
809 | */ | 811 | */ |
810 | eec = IXGBE_READ_REG(hw, IXGBE_EEC); | 812 | eec = IXGBE_READ_REG(hw, IXGBE_EEC); |
811 | if (eec & IXGBE_EEC_PRES) { | 813 | if (eec & IXGBE_EEC_PRES) { |
812 | eeprom->type = ixgbe_eeprom_spi; | 814 | eeprom->type = ixgbe_eeprom_spi; |
813 | 815 | ||
814 | /* | 816 | /* |
815 | * SPI EEPROM is assumed here. This code would need to | 817 | * SPI EEPROM is assumed here. This code would need to |
816 | * change if a future EEPROM is not SPI. | 818 | * change if a future EEPROM is not SPI. |
817 | */ | 819 | */ |
818 | eeprom_size = (u16)((eec & IXGBE_EEC_SIZE) >> | 820 | eeprom_size = (u16)((eec & IXGBE_EEC_SIZE) >> |
819 | IXGBE_EEC_SIZE_SHIFT); | 821 | IXGBE_EEC_SIZE_SHIFT); |
820 | eeprom->word_size = 1 << (eeprom_size + | 822 | eeprom->word_size = 1 << (eeprom_size + |
821 | IXGBE_EEPROM_WORD_SIZE_SHIFT); | 823 | IXGBE_EEPROM_WORD_SIZE_SHIFT); |
822 | } | 824 | } |
823 | 825 | ||
824 | if (eec & IXGBE_EEC_ADDR_SIZE) | 826 | if (eec & IXGBE_EEC_ADDR_SIZE) |
825 | eeprom->address_bits = 16; | 827 | eeprom->address_bits = 16; |
826 | else | 828 | else |
827 | eeprom->address_bits = 8; | 829 | eeprom->address_bits = 8; |
828 | hw_dbg(hw, "Eeprom params: type = %d, size = %d, address bits: " | 830 | hw_dbg(hw, "Eeprom params: type = %d, size = %d, address bits: " |
829 | "%d\n", eeprom->type, eeprom->word_size, | 831 | "%d\n", eeprom->type, eeprom->word_size, |
830 | eeprom->address_bits); | 832 | eeprom->address_bits); |
831 | } | 833 | } |
832 | 834 | ||
833 | return 0; | 835 | return 0; |
834 | } | 836 | } |
835 | 837 | ||
836 | /** | 838 | /** |
837 | * ixgbe_write_eeprom_buffer_bit_bang_generic - Write EEPROM using bit-bang | 839 | * ixgbe_write_eeprom_buffer_bit_bang_generic - Write EEPROM using bit-bang |
838 | * @hw: pointer to hardware structure | 840 | * @hw: pointer to hardware structure |
839 | * @offset: offset within the EEPROM to write | 841 | * @offset: offset within the EEPROM to write |
840 | * @words: number of words | 842 | * @words: number of words |
841 | * @data: 16 bit word(s) to write to EEPROM | 843 | * @data: 16 bit word(s) to write to EEPROM |
842 | * | 844 | * |
843 | * Reads 16 bit word(s) from EEPROM through bit-bang method | 845 | * Reads 16 bit word(s) from EEPROM through bit-bang method |
844 | **/ | 846 | **/ |
845 | s32 ixgbe_write_eeprom_buffer_bit_bang_generic(struct ixgbe_hw *hw, u16 offset, | 847 | s32 ixgbe_write_eeprom_buffer_bit_bang_generic(struct ixgbe_hw *hw, u16 offset, |
846 | u16 words, u16 *data) | 848 | u16 words, u16 *data) |
847 | { | 849 | { |
848 | s32 status = 0; | 850 | s32 status = 0; |
849 | u16 i, count; | 851 | u16 i, count; |
850 | 852 | ||
851 | hw->eeprom.ops.init_params(hw); | 853 | hw->eeprom.ops.init_params(hw); |
852 | 854 | ||
853 | if (words == 0) { | 855 | if (words == 0) { |
854 | status = IXGBE_ERR_INVALID_ARGUMENT; | 856 | status = IXGBE_ERR_INVALID_ARGUMENT; |
855 | goto out; | 857 | goto out; |
856 | } | 858 | } |
857 | 859 | ||
858 | if (offset + words > hw->eeprom.word_size) { | 860 | if (offset + words > hw->eeprom.word_size) { |
859 | status = IXGBE_ERR_EEPROM; | 861 | status = IXGBE_ERR_EEPROM; |
860 | goto out; | 862 | goto out; |
861 | } | 863 | } |
862 | 864 | ||
863 | /* | 865 | /* |
864 | * The EEPROM page size cannot be queried from the chip. We do lazy | 866 | * The EEPROM page size cannot be queried from the chip. We do lazy |
865 | * initialization. It is worth to do that when we write large buffer. | 867 | * initialization. It is worth to do that when we write large buffer. |
866 | */ | 868 | */ |
867 | if ((hw->eeprom.word_page_size == 0) && | 869 | if ((hw->eeprom.word_page_size == 0) && |
868 | (words > IXGBE_EEPROM_PAGE_SIZE_MAX)) | 870 | (words > IXGBE_EEPROM_PAGE_SIZE_MAX)) |
869 | ixgbe_detect_eeprom_page_size_generic(hw, offset); | 871 | ixgbe_detect_eeprom_page_size_generic(hw, offset); |
870 | 872 | ||
871 | /* | 873 | /* |
872 | * We cannot hold synchronization semaphores for too long | 874 | * We cannot hold synchronization semaphores for too long |
873 | * to avoid other entity starvation. However it is more efficient | 875 | * to avoid other entity starvation. However it is more efficient |
874 | * to read in bursts than synchronizing access for each word. | 876 | * to read in bursts than synchronizing access for each word. |
875 | */ | 877 | */ |
876 | for (i = 0; i < words; i += IXGBE_EEPROM_RD_BUFFER_MAX_COUNT) { | 878 | for (i = 0; i < words; i += IXGBE_EEPROM_RD_BUFFER_MAX_COUNT) { |
877 | count = (words - i) / IXGBE_EEPROM_RD_BUFFER_MAX_COUNT > 0 ? | 879 | count = (words - i) / IXGBE_EEPROM_RD_BUFFER_MAX_COUNT > 0 ? |
878 | IXGBE_EEPROM_RD_BUFFER_MAX_COUNT : (words - i); | 880 | IXGBE_EEPROM_RD_BUFFER_MAX_COUNT : (words - i); |
879 | status = ixgbe_write_eeprom_buffer_bit_bang(hw, offset + i, | 881 | status = ixgbe_write_eeprom_buffer_bit_bang(hw, offset + i, |
880 | count, &data[i]); | 882 | count, &data[i]); |
881 | 883 | ||
882 | if (status != 0) | 884 | if (status != 0) |
883 | break; | 885 | break; |
884 | } | 886 | } |
885 | 887 | ||
886 | out: | 888 | out: |
887 | return status; | 889 | return status; |
888 | } | 890 | } |
889 | 891 | ||
890 | /** | 892 | /** |
891 | * ixgbe_write_eeprom_buffer_bit_bang - Writes 16 bit word(s) to EEPROM | 893 | * ixgbe_write_eeprom_buffer_bit_bang - Writes 16 bit word(s) to EEPROM |
892 | * @hw: pointer to hardware structure | 894 | * @hw: pointer to hardware structure |
893 | * @offset: offset within the EEPROM to be written to | 895 | * @offset: offset within the EEPROM to be written to |
894 | * @words: number of word(s) | 896 | * @words: number of word(s) |
895 | * @data: 16 bit word(s) to be written to the EEPROM | 897 | * @data: 16 bit word(s) to be written to the EEPROM |
896 | * | 898 | * |
897 | * If ixgbe_eeprom_update_checksum is not called after this function, the | 899 | * If ixgbe_eeprom_update_checksum is not called after this function, the |
898 | * EEPROM will most likely contain an invalid checksum. | 900 | * EEPROM will most likely contain an invalid checksum. |
899 | **/ | 901 | **/ |
900 | static s32 ixgbe_write_eeprom_buffer_bit_bang(struct ixgbe_hw *hw, u16 offset, | 902 | static s32 ixgbe_write_eeprom_buffer_bit_bang(struct ixgbe_hw *hw, u16 offset, |
901 | u16 words, u16 *data) | 903 | u16 words, u16 *data) |
902 | { | 904 | { |
903 | s32 status; | 905 | s32 status; |
904 | u16 word; | 906 | u16 word; |
905 | u16 page_size; | 907 | u16 page_size; |
906 | u16 i; | 908 | u16 i; |
907 | u8 write_opcode = IXGBE_EEPROM_WRITE_OPCODE_SPI; | 909 | u8 write_opcode = IXGBE_EEPROM_WRITE_OPCODE_SPI; |
908 | 910 | ||
909 | /* Prepare the EEPROM for writing */ | 911 | /* Prepare the EEPROM for writing */ |
910 | status = ixgbe_acquire_eeprom(hw); | 912 | status = ixgbe_acquire_eeprom(hw); |
911 | 913 | ||
912 | if (status == 0) { | 914 | if (status == 0) { |
913 | if (ixgbe_ready_eeprom(hw) != 0) { | 915 | if (ixgbe_ready_eeprom(hw) != 0) { |
914 | ixgbe_release_eeprom(hw); | 916 | ixgbe_release_eeprom(hw); |
915 | status = IXGBE_ERR_EEPROM; | 917 | status = IXGBE_ERR_EEPROM; |
916 | } | 918 | } |
917 | } | 919 | } |
918 | 920 | ||
919 | if (status == 0) { | 921 | if (status == 0) { |
920 | for (i = 0; i < words; i++) { | 922 | for (i = 0; i < words; i++) { |
921 | ixgbe_standby_eeprom(hw); | 923 | ixgbe_standby_eeprom(hw); |
922 | 924 | ||
923 | /* Send the WRITE ENABLE command (8 bit opcode ) */ | 925 | /* Send the WRITE ENABLE command (8 bit opcode ) */ |
924 | ixgbe_shift_out_eeprom_bits(hw, | 926 | ixgbe_shift_out_eeprom_bits(hw, |
925 | IXGBE_EEPROM_WREN_OPCODE_SPI, | 927 | IXGBE_EEPROM_WREN_OPCODE_SPI, |
926 | IXGBE_EEPROM_OPCODE_BITS); | 928 | IXGBE_EEPROM_OPCODE_BITS); |
927 | 929 | ||
928 | ixgbe_standby_eeprom(hw); | 930 | ixgbe_standby_eeprom(hw); |
929 | 931 | ||
930 | /* | 932 | /* |
931 | * Some SPI eeproms use the 8th address bit embedded | 933 | * Some SPI eeproms use the 8th address bit embedded |
932 | * in the opcode | 934 | * in the opcode |
933 | */ | 935 | */ |
934 | if ((hw->eeprom.address_bits == 8) && | 936 | if ((hw->eeprom.address_bits == 8) && |
935 | ((offset + i) >= 128)) | 937 | ((offset + i) >= 128)) |
936 | write_opcode |= IXGBE_EEPROM_A8_OPCODE_SPI; | 938 | write_opcode |= IXGBE_EEPROM_A8_OPCODE_SPI; |
937 | 939 | ||
938 | /* Send the Write command (8-bit opcode + addr) */ | 940 | /* Send the Write command (8-bit opcode + addr) */ |
939 | ixgbe_shift_out_eeprom_bits(hw, write_opcode, | 941 | ixgbe_shift_out_eeprom_bits(hw, write_opcode, |
940 | IXGBE_EEPROM_OPCODE_BITS); | 942 | IXGBE_EEPROM_OPCODE_BITS); |
941 | ixgbe_shift_out_eeprom_bits(hw, (u16)((offset + i) * 2), | 943 | ixgbe_shift_out_eeprom_bits(hw, (u16)((offset + i) * 2), |
942 | hw->eeprom.address_bits); | 944 | hw->eeprom.address_bits); |
943 | 945 | ||
944 | page_size = hw->eeprom.word_page_size; | 946 | page_size = hw->eeprom.word_page_size; |
945 | 947 | ||
946 | /* Send the data in burst via SPI*/ | 948 | /* Send the data in burst via SPI*/ |
947 | do { | 949 | do { |
948 | word = data[i]; | 950 | word = data[i]; |
949 | word = (word >> 8) | (word << 8); | 951 | word = (word >> 8) | (word << 8); |
950 | ixgbe_shift_out_eeprom_bits(hw, word, 16); | 952 | ixgbe_shift_out_eeprom_bits(hw, word, 16); |
951 | 953 | ||
952 | if (page_size == 0) | 954 | if (page_size == 0) |
953 | break; | 955 | break; |
954 | 956 | ||
955 | /* do not wrap around page */ | 957 | /* do not wrap around page */ |
956 | if (((offset + i) & (page_size - 1)) == | 958 | if (((offset + i) & (page_size - 1)) == |
957 | (page_size - 1)) | 959 | (page_size - 1)) |
958 | break; | 960 | break; |
959 | } while (++i < words); | 961 | } while (++i < words); |
960 | 962 | ||
961 | ixgbe_standby_eeprom(hw); | 963 | ixgbe_standby_eeprom(hw); |
962 | usleep_range(10000, 20000); | 964 | usleep_range(10000, 20000); |
963 | } | 965 | } |
964 | /* Done with writing - release the EEPROM */ | 966 | /* Done with writing - release the EEPROM */ |
965 | ixgbe_release_eeprom(hw); | 967 | ixgbe_release_eeprom(hw); |
966 | } | 968 | } |
967 | 969 | ||
968 | return status; | 970 | return status; |
969 | } | 971 | } |
970 | 972 | ||
971 | /** | 973 | /** |
972 | * ixgbe_write_eeprom_generic - Writes 16 bit value to EEPROM | 974 | * ixgbe_write_eeprom_generic - Writes 16 bit value to EEPROM |
973 | * @hw: pointer to hardware structure | 975 | * @hw: pointer to hardware structure |
974 | * @offset: offset within the EEPROM to be written to | 976 | * @offset: offset within the EEPROM to be written to |
975 | * @data: 16 bit word to be written to the EEPROM | 977 | * @data: 16 bit word to be written to the EEPROM |
976 | * | 978 | * |
977 | * If ixgbe_eeprom_update_checksum is not called after this function, the | 979 | * If ixgbe_eeprom_update_checksum is not called after this function, the |
978 | * EEPROM will most likely contain an invalid checksum. | 980 | * EEPROM will most likely contain an invalid checksum. |
979 | **/ | 981 | **/ |
980 | s32 ixgbe_write_eeprom_generic(struct ixgbe_hw *hw, u16 offset, u16 data) | 982 | s32 ixgbe_write_eeprom_generic(struct ixgbe_hw *hw, u16 offset, u16 data) |
981 | { | 983 | { |
982 | s32 status; | 984 | s32 status; |
983 | 985 | ||
984 | hw->eeprom.ops.init_params(hw); | 986 | hw->eeprom.ops.init_params(hw); |
985 | 987 | ||
986 | if (offset >= hw->eeprom.word_size) { | 988 | if (offset >= hw->eeprom.word_size) { |
987 | status = IXGBE_ERR_EEPROM; | 989 | status = IXGBE_ERR_EEPROM; |
988 | goto out; | 990 | goto out; |
989 | } | 991 | } |
990 | 992 | ||
991 | status = ixgbe_write_eeprom_buffer_bit_bang(hw, offset, 1, &data); | 993 | status = ixgbe_write_eeprom_buffer_bit_bang(hw, offset, 1, &data); |
992 | 994 | ||
993 | out: | 995 | out: |
994 | return status; | 996 | return status; |
995 | } | 997 | } |
996 | 998 | ||
997 | /** | 999 | /** |
998 | * ixgbe_read_eeprom_buffer_bit_bang_generic - Read EEPROM using bit-bang | 1000 | * ixgbe_read_eeprom_buffer_bit_bang_generic - Read EEPROM using bit-bang |
999 | * @hw: pointer to hardware structure | 1001 | * @hw: pointer to hardware structure |
1000 | * @offset: offset within the EEPROM to be read | 1002 | * @offset: offset within the EEPROM to be read |
1001 | * @words: number of word(s) | 1003 | * @words: number of word(s) |
1002 | * @data: read 16 bit words(s) from EEPROM | 1004 | * @data: read 16 bit words(s) from EEPROM |
1003 | * | 1005 | * |
1004 | * Reads 16 bit word(s) from EEPROM through bit-bang method | 1006 | * Reads 16 bit word(s) from EEPROM through bit-bang method |
1005 | **/ | 1007 | **/ |
1006 | s32 ixgbe_read_eeprom_buffer_bit_bang_generic(struct ixgbe_hw *hw, u16 offset, | 1008 | s32 ixgbe_read_eeprom_buffer_bit_bang_generic(struct ixgbe_hw *hw, u16 offset, |
1007 | u16 words, u16 *data) | 1009 | u16 words, u16 *data) |
1008 | { | 1010 | { |
1009 | s32 status = 0; | 1011 | s32 status = 0; |
1010 | u16 i, count; | 1012 | u16 i, count; |
1011 | 1013 | ||
1012 | hw->eeprom.ops.init_params(hw); | 1014 | hw->eeprom.ops.init_params(hw); |
1013 | 1015 | ||
1014 | if (words == 0) { | 1016 | if (words == 0) { |
1015 | status = IXGBE_ERR_INVALID_ARGUMENT; | 1017 | status = IXGBE_ERR_INVALID_ARGUMENT; |
1016 | goto out; | 1018 | goto out; |
1017 | } | 1019 | } |
1018 | 1020 | ||
1019 | if (offset + words > hw->eeprom.word_size) { | 1021 | if (offset + words > hw->eeprom.word_size) { |
1020 | status = IXGBE_ERR_EEPROM; | 1022 | status = IXGBE_ERR_EEPROM; |
1021 | goto out; | 1023 | goto out; |
1022 | } | 1024 | } |
1023 | 1025 | ||
1024 | /* | 1026 | /* |
1025 | * We cannot hold synchronization semaphores for too long | 1027 | * We cannot hold synchronization semaphores for too long |
1026 | * to avoid other entity starvation. However it is more efficient | 1028 | * to avoid other entity starvation. However it is more efficient |
1027 | * to read in bursts than synchronizing access for each word. | 1029 | * to read in bursts than synchronizing access for each word. |
1028 | */ | 1030 | */ |
1029 | for (i = 0; i < words; i += IXGBE_EEPROM_RD_BUFFER_MAX_COUNT) { | 1031 | for (i = 0; i < words; i += IXGBE_EEPROM_RD_BUFFER_MAX_COUNT) { |
1030 | count = (words - i) / IXGBE_EEPROM_RD_BUFFER_MAX_COUNT > 0 ? | 1032 | count = (words - i) / IXGBE_EEPROM_RD_BUFFER_MAX_COUNT > 0 ? |
1031 | IXGBE_EEPROM_RD_BUFFER_MAX_COUNT : (words - i); | 1033 | IXGBE_EEPROM_RD_BUFFER_MAX_COUNT : (words - i); |
1032 | 1034 | ||
1033 | status = ixgbe_read_eeprom_buffer_bit_bang(hw, offset + i, | 1035 | status = ixgbe_read_eeprom_buffer_bit_bang(hw, offset + i, |
1034 | count, &data[i]); | 1036 | count, &data[i]); |
1035 | 1037 | ||
1036 | if (status != 0) | 1038 | if (status != 0) |
1037 | break; | 1039 | break; |
1038 | } | 1040 | } |
1039 | 1041 | ||
1040 | out: | 1042 | out: |
1041 | return status; | 1043 | return status; |
1042 | } | 1044 | } |
1043 | 1045 | ||
1044 | /** | 1046 | /** |
1045 | * ixgbe_read_eeprom_buffer_bit_bang - Read EEPROM using bit-bang | 1047 | * ixgbe_read_eeprom_buffer_bit_bang - Read EEPROM using bit-bang |
1046 | * @hw: pointer to hardware structure | 1048 | * @hw: pointer to hardware structure |
1047 | * @offset: offset within the EEPROM to be read | 1049 | * @offset: offset within the EEPROM to be read |
1048 | * @words: number of word(s) | 1050 | * @words: number of word(s) |
1049 | * @data: read 16 bit word(s) from EEPROM | 1051 | * @data: read 16 bit word(s) from EEPROM |
1050 | * | 1052 | * |
1051 | * Reads 16 bit word(s) from EEPROM through bit-bang method | 1053 | * Reads 16 bit word(s) from EEPROM through bit-bang method |
1052 | **/ | 1054 | **/ |
1053 | static s32 ixgbe_read_eeprom_buffer_bit_bang(struct ixgbe_hw *hw, u16 offset, | 1055 | static s32 ixgbe_read_eeprom_buffer_bit_bang(struct ixgbe_hw *hw, u16 offset, |
1054 | u16 words, u16 *data) | 1056 | u16 words, u16 *data) |
1055 | { | 1057 | { |
1056 | s32 status; | 1058 | s32 status; |
1057 | u16 word_in; | 1059 | u16 word_in; |
1058 | u8 read_opcode = IXGBE_EEPROM_READ_OPCODE_SPI; | 1060 | u8 read_opcode = IXGBE_EEPROM_READ_OPCODE_SPI; |
1059 | u16 i; | 1061 | u16 i; |
1060 | 1062 | ||
1061 | /* Prepare the EEPROM for reading */ | 1063 | /* Prepare the EEPROM for reading */ |
1062 | status = ixgbe_acquire_eeprom(hw); | 1064 | status = ixgbe_acquire_eeprom(hw); |
1063 | 1065 | ||
1064 | if (status == 0) { | 1066 | if (status == 0) { |
1065 | if (ixgbe_ready_eeprom(hw) != 0) { | 1067 | if (ixgbe_ready_eeprom(hw) != 0) { |
1066 | ixgbe_release_eeprom(hw); | 1068 | ixgbe_release_eeprom(hw); |
1067 | status = IXGBE_ERR_EEPROM; | 1069 | status = IXGBE_ERR_EEPROM; |
1068 | } | 1070 | } |
1069 | } | 1071 | } |
1070 | 1072 | ||
1071 | if (status == 0) { | 1073 | if (status == 0) { |
1072 | for (i = 0; i < words; i++) { | 1074 | for (i = 0; i < words; i++) { |
1073 | ixgbe_standby_eeprom(hw); | 1075 | ixgbe_standby_eeprom(hw); |
1074 | /* | 1076 | /* |
1075 | * Some SPI eeproms use the 8th address bit embedded | 1077 | * Some SPI eeproms use the 8th address bit embedded |
1076 | * in the opcode | 1078 | * in the opcode |
1077 | */ | 1079 | */ |
1078 | if ((hw->eeprom.address_bits == 8) && | 1080 | if ((hw->eeprom.address_bits == 8) && |
1079 | ((offset + i) >= 128)) | 1081 | ((offset + i) >= 128)) |
1080 | read_opcode |= IXGBE_EEPROM_A8_OPCODE_SPI; | 1082 | read_opcode |= IXGBE_EEPROM_A8_OPCODE_SPI; |
1081 | 1083 | ||
1082 | /* Send the READ command (opcode + addr) */ | 1084 | /* Send the READ command (opcode + addr) */ |
1083 | ixgbe_shift_out_eeprom_bits(hw, read_opcode, | 1085 | ixgbe_shift_out_eeprom_bits(hw, read_opcode, |
1084 | IXGBE_EEPROM_OPCODE_BITS); | 1086 | IXGBE_EEPROM_OPCODE_BITS); |
1085 | ixgbe_shift_out_eeprom_bits(hw, (u16)((offset + i) * 2), | 1087 | ixgbe_shift_out_eeprom_bits(hw, (u16)((offset + i) * 2), |
1086 | hw->eeprom.address_bits); | 1088 | hw->eeprom.address_bits); |
1087 | 1089 | ||
1088 | /* Read the data. */ | 1090 | /* Read the data. */ |
1089 | word_in = ixgbe_shift_in_eeprom_bits(hw, 16); | 1091 | word_in = ixgbe_shift_in_eeprom_bits(hw, 16); |
1090 | data[i] = (word_in >> 8) | (word_in << 8); | 1092 | data[i] = (word_in >> 8) | (word_in << 8); |
1091 | } | 1093 | } |
1092 | 1094 | ||
1093 | /* End this read operation */ | 1095 | /* End this read operation */ |
1094 | ixgbe_release_eeprom(hw); | 1096 | ixgbe_release_eeprom(hw); |
1095 | } | 1097 | } |
1096 | 1098 | ||
1097 | return status; | 1099 | return status; |
1098 | } | 1100 | } |
1099 | 1101 | ||
1100 | /** | 1102 | /** |
1101 | * ixgbe_read_eeprom_bit_bang_generic - Read EEPROM word using bit-bang | 1103 | * ixgbe_read_eeprom_bit_bang_generic - Read EEPROM word using bit-bang |
1102 | * @hw: pointer to hardware structure | 1104 | * @hw: pointer to hardware structure |
1103 | * @offset: offset within the EEPROM to be read | 1105 | * @offset: offset within the EEPROM to be read |
1104 | * @data: read 16 bit value from EEPROM | 1106 | * @data: read 16 bit value from EEPROM |
1105 | * | 1107 | * |
1106 | * Reads 16 bit value from EEPROM through bit-bang method | 1108 | * Reads 16 bit value from EEPROM through bit-bang method |
1107 | **/ | 1109 | **/ |
1108 | s32 ixgbe_read_eeprom_bit_bang_generic(struct ixgbe_hw *hw, u16 offset, | 1110 | s32 ixgbe_read_eeprom_bit_bang_generic(struct ixgbe_hw *hw, u16 offset, |
1109 | u16 *data) | 1111 | u16 *data) |
1110 | { | 1112 | { |
1111 | s32 status; | 1113 | s32 status; |
1112 | 1114 | ||
1113 | hw->eeprom.ops.init_params(hw); | 1115 | hw->eeprom.ops.init_params(hw); |
1114 | 1116 | ||
1115 | if (offset >= hw->eeprom.word_size) { | 1117 | if (offset >= hw->eeprom.word_size) { |
1116 | status = IXGBE_ERR_EEPROM; | 1118 | status = IXGBE_ERR_EEPROM; |
1117 | goto out; | 1119 | goto out; |
1118 | } | 1120 | } |
1119 | 1121 | ||
1120 | status = ixgbe_read_eeprom_buffer_bit_bang(hw, offset, 1, data); | 1122 | status = ixgbe_read_eeprom_buffer_bit_bang(hw, offset, 1, data); |
1121 | 1123 | ||
1122 | out: | 1124 | out: |
1123 | return status; | 1125 | return status; |
1124 | } | 1126 | } |
1125 | 1127 | ||
1126 | /** | 1128 | /** |
1127 | * ixgbe_read_eerd_buffer_generic - Read EEPROM word(s) using EERD | 1129 | * ixgbe_read_eerd_buffer_generic - Read EEPROM word(s) using EERD |
1128 | * @hw: pointer to hardware structure | 1130 | * @hw: pointer to hardware structure |
1129 | * @offset: offset of word in the EEPROM to read | 1131 | * @offset: offset of word in the EEPROM to read |
1130 | * @words: number of word(s) | 1132 | * @words: number of word(s) |
1131 | * @data: 16 bit word(s) from the EEPROM | 1133 | * @data: 16 bit word(s) from the EEPROM |
1132 | * | 1134 | * |
1133 | * Reads a 16 bit word(s) from the EEPROM using the EERD register. | 1135 | * Reads a 16 bit word(s) from the EEPROM using the EERD register. |
1134 | **/ | 1136 | **/ |
1135 | s32 ixgbe_read_eerd_buffer_generic(struct ixgbe_hw *hw, u16 offset, | 1137 | s32 ixgbe_read_eerd_buffer_generic(struct ixgbe_hw *hw, u16 offset, |
1136 | u16 words, u16 *data) | 1138 | u16 words, u16 *data) |
1137 | { | 1139 | { |
1138 | u32 eerd; | 1140 | u32 eerd; |
1139 | s32 status = 0; | 1141 | s32 status = 0; |
1140 | u32 i; | 1142 | u32 i; |
1141 | 1143 | ||
1142 | hw->eeprom.ops.init_params(hw); | 1144 | hw->eeprom.ops.init_params(hw); |
1143 | 1145 | ||
1144 | if (words == 0) { | 1146 | if (words == 0) { |
1145 | status = IXGBE_ERR_INVALID_ARGUMENT; | 1147 | status = IXGBE_ERR_INVALID_ARGUMENT; |
1146 | goto out; | 1148 | goto out; |
1147 | } | 1149 | } |
1148 | 1150 | ||
1149 | if (offset >= hw->eeprom.word_size) { | 1151 | if (offset >= hw->eeprom.word_size) { |
1150 | status = IXGBE_ERR_EEPROM; | 1152 | status = IXGBE_ERR_EEPROM; |
1151 | goto out; | 1153 | goto out; |
1152 | } | 1154 | } |
1153 | 1155 | ||
1154 | for (i = 0; i < words; i++) { | 1156 | for (i = 0; i < words; i++) { |
1155 | eerd = ((offset + i) << IXGBE_EEPROM_RW_ADDR_SHIFT) | | 1157 | eerd = ((offset + i) << IXGBE_EEPROM_RW_ADDR_SHIFT) | |
1156 | IXGBE_EEPROM_RW_REG_START; | 1158 | IXGBE_EEPROM_RW_REG_START; |
1157 | 1159 | ||
1158 | IXGBE_WRITE_REG(hw, IXGBE_EERD, eerd); | 1160 | IXGBE_WRITE_REG(hw, IXGBE_EERD, eerd); |
1159 | status = ixgbe_poll_eerd_eewr_done(hw, IXGBE_NVM_POLL_READ); | 1161 | status = ixgbe_poll_eerd_eewr_done(hw, IXGBE_NVM_POLL_READ); |
1160 | 1162 | ||
1161 | if (status == 0) { | 1163 | if (status == 0) { |
1162 | data[i] = (IXGBE_READ_REG(hw, IXGBE_EERD) >> | 1164 | data[i] = (IXGBE_READ_REG(hw, IXGBE_EERD) >> |
1163 | IXGBE_EEPROM_RW_REG_DATA); | 1165 | IXGBE_EEPROM_RW_REG_DATA); |
1164 | } else { | 1166 | } else { |
1165 | hw_dbg(hw, "Eeprom read timed out\n"); | 1167 | hw_dbg(hw, "Eeprom read timed out\n"); |
1166 | goto out; | 1168 | goto out; |
1167 | } | 1169 | } |
1168 | } | 1170 | } |
1169 | out: | 1171 | out: |
1170 | return status; | 1172 | return status; |
1171 | } | 1173 | } |
1172 | 1174 | ||
1173 | /** | 1175 | /** |
1174 | * ixgbe_detect_eeprom_page_size_generic - Detect EEPROM page size | 1176 | * ixgbe_detect_eeprom_page_size_generic - Detect EEPROM page size |
1175 | * @hw: pointer to hardware structure | 1177 | * @hw: pointer to hardware structure |
1176 | * @offset: offset within the EEPROM to be used as a scratch pad | 1178 | * @offset: offset within the EEPROM to be used as a scratch pad |
1177 | * | 1179 | * |
1178 | * Discover EEPROM page size by writing marching data at given offset. | 1180 | * Discover EEPROM page size by writing marching data at given offset. |
1179 | * This function is called only when we are writing a new large buffer | 1181 | * This function is called only when we are writing a new large buffer |
1180 | * at given offset so the data would be overwritten anyway. | 1182 | * at given offset so the data would be overwritten anyway. |
1181 | **/ | 1183 | **/ |
1182 | static s32 ixgbe_detect_eeprom_page_size_generic(struct ixgbe_hw *hw, | 1184 | static s32 ixgbe_detect_eeprom_page_size_generic(struct ixgbe_hw *hw, |
1183 | u16 offset) | 1185 | u16 offset) |
1184 | { | 1186 | { |
1185 | u16 data[IXGBE_EEPROM_PAGE_SIZE_MAX]; | 1187 | u16 data[IXGBE_EEPROM_PAGE_SIZE_MAX]; |
1186 | s32 status = 0; | 1188 | s32 status = 0; |
1187 | u16 i; | 1189 | u16 i; |
1188 | 1190 | ||
1189 | for (i = 0; i < IXGBE_EEPROM_PAGE_SIZE_MAX; i++) | 1191 | for (i = 0; i < IXGBE_EEPROM_PAGE_SIZE_MAX; i++) |
1190 | data[i] = i; | 1192 | data[i] = i; |
1191 | 1193 | ||
1192 | hw->eeprom.word_page_size = IXGBE_EEPROM_PAGE_SIZE_MAX; | 1194 | hw->eeprom.word_page_size = IXGBE_EEPROM_PAGE_SIZE_MAX; |
1193 | status = ixgbe_write_eeprom_buffer_bit_bang(hw, offset, | 1195 | status = ixgbe_write_eeprom_buffer_bit_bang(hw, offset, |
1194 | IXGBE_EEPROM_PAGE_SIZE_MAX, data); | 1196 | IXGBE_EEPROM_PAGE_SIZE_MAX, data); |
1195 | hw->eeprom.word_page_size = 0; | 1197 | hw->eeprom.word_page_size = 0; |
1196 | if (status != 0) | 1198 | if (status != 0) |
1197 | goto out; | 1199 | goto out; |
1198 | 1200 | ||
1199 | status = ixgbe_read_eeprom_buffer_bit_bang(hw, offset, 1, data); | 1201 | status = ixgbe_read_eeprom_buffer_bit_bang(hw, offset, 1, data); |
1200 | if (status != 0) | 1202 | if (status != 0) |
1201 | goto out; | 1203 | goto out; |
1202 | 1204 | ||
1203 | /* | 1205 | /* |
1204 | * When writing in burst more than the actual page size | 1206 | * When writing in burst more than the actual page size |
1205 | * EEPROM address wraps around current page. | 1207 | * EEPROM address wraps around current page. |
1206 | */ | 1208 | */ |
1207 | hw->eeprom.word_page_size = IXGBE_EEPROM_PAGE_SIZE_MAX - data[0]; | 1209 | hw->eeprom.word_page_size = IXGBE_EEPROM_PAGE_SIZE_MAX - data[0]; |
1208 | 1210 | ||
1209 | hw_dbg(hw, "Detected EEPROM page size = %d words.", | 1211 | hw_dbg(hw, "Detected EEPROM page size = %d words.", |
1210 | hw->eeprom.word_page_size); | 1212 | hw->eeprom.word_page_size); |
1211 | out: | 1213 | out: |
1212 | return status; | 1214 | return status; |
1213 | } | 1215 | } |
1214 | 1216 | ||
1215 | /** | 1217 | /** |
1216 | * ixgbe_read_eerd_generic - Read EEPROM word using EERD | 1218 | * ixgbe_read_eerd_generic - Read EEPROM word using EERD |
1217 | * @hw: pointer to hardware structure | 1219 | * @hw: pointer to hardware structure |
1218 | * @offset: offset of word in the EEPROM to read | 1220 | * @offset: offset of word in the EEPROM to read |
1219 | * @data: word read from the EEPROM | 1221 | * @data: word read from the EEPROM |
1220 | * | 1222 | * |
1221 | * Reads a 16 bit word from the EEPROM using the EERD register. | 1223 | * Reads a 16 bit word from the EEPROM using the EERD register. |
1222 | **/ | 1224 | **/ |
1223 | s32 ixgbe_read_eerd_generic(struct ixgbe_hw *hw, u16 offset, u16 *data) | 1225 | s32 ixgbe_read_eerd_generic(struct ixgbe_hw *hw, u16 offset, u16 *data) |
1224 | { | 1226 | { |
1225 | return ixgbe_read_eerd_buffer_generic(hw, offset, 1, data); | 1227 | return ixgbe_read_eerd_buffer_generic(hw, offset, 1, data); |
1226 | } | 1228 | } |
1227 | 1229 | ||
1228 | /** | 1230 | /** |
1229 | * ixgbe_write_eewr_buffer_generic - Write EEPROM word(s) using EEWR | 1231 | * ixgbe_write_eewr_buffer_generic - Write EEPROM word(s) using EEWR |
1230 | * @hw: pointer to hardware structure | 1232 | * @hw: pointer to hardware structure |
1231 | * @offset: offset of word in the EEPROM to write | 1233 | * @offset: offset of word in the EEPROM to write |
1232 | * @words: number of words | 1234 | * @words: number of words |
1233 | * @data: word(s) write to the EEPROM | 1235 | * @data: word(s) write to the EEPROM |
1234 | * | 1236 | * |
1235 | * Write a 16 bit word(s) to the EEPROM using the EEWR register. | 1237 | * Write a 16 bit word(s) to the EEPROM using the EEWR register. |
1236 | **/ | 1238 | **/ |
1237 | s32 ixgbe_write_eewr_buffer_generic(struct ixgbe_hw *hw, u16 offset, | 1239 | s32 ixgbe_write_eewr_buffer_generic(struct ixgbe_hw *hw, u16 offset, |
1238 | u16 words, u16 *data) | 1240 | u16 words, u16 *data) |
1239 | { | 1241 | { |
1240 | u32 eewr; | 1242 | u32 eewr; |
1241 | s32 status = 0; | 1243 | s32 status = 0; |
1242 | u16 i; | 1244 | u16 i; |
1243 | 1245 | ||
1244 | hw->eeprom.ops.init_params(hw); | 1246 | hw->eeprom.ops.init_params(hw); |
1245 | 1247 | ||
1246 | if (words == 0) { | 1248 | if (words == 0) { |
1247 | status = IXGBE_ERR_INVALID_ARGUMENT; | 1249 | status = IXGBE_ERR_INVALID_ARGUMENT; |
1248 | goto out; | 1250 | goto out; |
1249 | } | 1251 | } |
1250 | 1252 | ||
1251 | if (offset >= hw->eeprom.word_size) { | 1253 | if (offset >= hw->eeprom.word_size) { |
1252 | status = IXGBE_ERR_EEPROM; | 1254 | status = IXGBE_ERR_EEPROM; |
1253 | goto out; | 1255 | goto out; |
1254 | } | 1256 | } |
1255 | 1257 | ||
1256 | for (i = 0; i < words; i++) { | 1258 | for (i = 0; i < words; i++) { |
1257 | eewr = ((offset + i) << IXGBE_EEPROM_RW_ADDR_SHIFT) | | 1259 | eewr = ((offset + i) << IXGBE_EEPROM_RW_ADDR_SHIFT) | |
1258 | (data[i] << IXGBE_EEPROM_RW_REG_DATA) | | 1260 | (data[i] << IXGBE_EEPROM_RW_REG_DATA) | |
1259 | IXGBE_EEPROM_RW_REG_START; | 1261 | IXGBE_EEPROM_RW_REG_START; |
1260 | 1262 | ||
1261 | status = ixgbe_poll_eerd_eewr_done(hw, IXGBE_NVM_POLL_WRITE); | 1263 | status = ixgbe_poll_eerd_eewr_done(hw, IXGBE_NVM_POLL_WRITE); |
1262 | if (status != 0) { | 1264 | if (status != 0) { |
1263 | hw_dbg(hw, "Eeprom write EEWR timed out\n"); | 1265 | hw_dbg(hw, "Eeprom write EEWR timed out\n"); |
1264 | goto out; | 1266 | goto out; |
1265 | } | 1267 | } |
1266 | 1268 | ||
1267 | IXGBE_WRITE_REG(hw, IXGBE_EEWR, eewr); | 1269 | IXGBE_WRITE_REG(hw, IXGBE_EEWR, eewr); |
1268 | 1270 | ||
1269 | status = ixgbe_poll_eerd_eewr_done(hw, IXGBE_NVM_POLL_WRITE); | 1271 | status = ixgbe_poll_eerd_eewr_done(hw, IXGBE_NVM_POLL_WRITE); |
1270 | if (status != 0) { | 1272 | if (status != 0) { |
1271 | hw_dbg(hw, "Eeprom write EEWR timed out\n"); | 1273 | hw_dbg(hw, "Eeprom write EEWR timed out\n"); |
1272 | goto out; | 1274 | goto out; |
1273 | } | 1275 | } |
1274 | } | 1276 | } |
1275 | 1277 | ||
1276 | out: | 1278 | out: |
1277 | return status; | 1279 | return status; |
1278 | } | 1280 | } |
1279 | 1281 | ||
1280 | /** | 1282 | /** |
1281 | * ixgbe_write_eewr_generic - Write EEPROM word using EEWR | 1283 | * ixgbe_write_eewr_generic - Write EEPROM word using EEWR |
1282 | * @hw: pointer to hardware structure | 1284 | * @hw: pointer to hardware structure |
1283 | * @offset: offset of word in the EEPROM to write | 1285 | * @offset: offset of word in the EEPROM to write |
1284 | * @data: word write to the EEPROM | 1286 | * @data: word write to the EEPROM |
1285 | * | 1287 | * |
1286 | * Write a 16 bit word to the EEPROM using the EEWR register. | 1288 | * Write a 16 bit word to the EEPROM using the EEWR register. |
1287 | **/ | 1289 | **/ |
1288 | s32 ixgbe_write_eewr_generic(struct ixgbe_hw *hw, u16 offset, u16 data) | 1290 | s32 ixgbe_write_eewr_generic(struct ixgbe_hw *hw, u16 offset, u16 data) |
1289 | { | 1291 | { |
1290 | return ixgbe_write_eewr_buffer_generic(hw, offset, 1, &data); | 1292 | return ixgbe_write_eewr_buffer_generic(hw, offset, 1, &data); |
1291 | } | 1293 | } |
1292 | 1294 | ||
1293 | /** | 1295 | /** |
1294 | * ixgbe_poll_eerd_eewr_done - Poll EERD read or EEWR write status | 1296 | * ixgbe_poll_eerd_eewr_done - Poll EERD read or EEWR write status |
1295 | * @hw: pointer to hardware structure | 1297 | * @hw: pointer to hardware structure |
1296 | * @ee_reg: EEPROM flag for polling | 1298 | * @ee_reg: EEPROM flag for polling |
1297 | * | 1299 | * |
1298 | * Polls the status bit (bit 1) of the EERD or EEWR to determine when the | 1300 | * Polls the status bit (bit 1) of the EERD or EEWR to determine when the |
1299 | * read or write is done respectively. | 1301 | * read or write is done respectively. |
1300 | **/ | 1302 | **/ |
1301 | static s32 ixgbe_poll_eerd_eewr_done(struct ixgbe_hw *hw, u32 ee_reg) | 1303 | static s32 ixgbe_poll_eerd_eewr_done(struct ixgbe_hw *hw, u32 ee_reg) |
1302 | { | 1304 | { |
1303 | u32 i; | 1305 | u32 i; |
1304 | u32 reg; | 1306 | u32 reg; |
1305 | s32 status = IXGBE_ERR_EEPROM; | 1307 | s32 status = IXGBE_ERR_EEPROM; |
1306 | 1308 | ||
1307 | for (i = 0; i < IXGBE_EERD_EEWR_ATTEMPTS; i++) { | 1309 | for (i = 0; i < IXGBE_EERD_EEWR_ATTEMPTS; i++) { |
1308 | if (ee_reg == IXGBE_NVM_POLL_READ) | 1310 | if (ee_reg == IXGBE_NVM_POLL_READ) |
1309 | reg = IXGBE_READ_REG(hw, IXGBE_EERD); | 1311 | reg = IXGBE_READ_REG(hw, IXGBE_EERD); |
1310 | else | 1312 | else |
1311 | reg = IXGBE_READ_REG(hw, IXGBE_EEWR); | 1313 | reg = IXGBE_READ_REG(hw, IXGBE_EEWR); |
1312 | 1314 | ||
1313 | if (reg & IXGBE_EEPROM_RW_REG_DONE) { | 1315 | if (reg & IXGBE_EEPROM_RW_REG_DONE) { |
1314 | status = 0; | 1316 | status = 0; |
1315 | break; | 1317 | break; |
1316 | } | 1318 | } |
1317 | udelay(5); | 1319 | udelay(5); |
1318 | } | 1320 | } |
1319 | return status; | 1321 | return status; |
1320 | } | 1322 | } |
1321 | 1323 | ||
1322 | /** | 1324 | /** |
1323 | * ixgbe_acquire_eeprom - Acquire EEPROM using bit-bang | 1325 | * ixgbe_acquire_eeprom - Acquire EEPROM using bit-bang |
1324 | * @hw: pointer to hardware structure | 1326 | * @hw: pointer to hardware structure |
1325 | * | 1327 | * |
1326 | * Prepares EEPROM for access using bit-bang method. This function should | 1328 | * Prepares EEPROM for access using bit-bang method. This function should |
1327 | * be called before issuing a command to the EEPROM. | 1329 | * be called before issuing a command to the EEPROM. |
1328 | **/ | 1330 | **/ |
1329 | static s32 ixgbe_acquire_eeprom(struct ixgbe_hw *hw) | 1331 | static s32 ixgbe_acquire_eeprom(struct ixgbe_hw *hw) |
1330 | { | 1332 | { |
1331 | s32 status = 0; | 1333 | s32 status = 0; |
1332 | u32 eec; | 1334 | u32 eec; |
1333 | u32 i; | 1335 | u32 i; |
1334 | 1336 | ||
1335 | if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM) != 0) | 1337 | if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM) != 0) |
1336 | status = IXGBE_ERR_SWFW_SYNC; | 1338 | status = IXGBE_ERR_SWFW_SYNC; |
1337 | 1339 | ||
1338 | if (status == 0) { | 1340 | if (status == 0) { |
1339 | eec = IXGBE_READ_REG(hw, IXGBE_EEC); | 1341 | eec = IXGBE_READ_REG(hw, IXGBE_EEC); |
1340 | 1342 | ||
1341 | /* Request EEPROM Access */ | 1343 | /* Request EEPROM Access */ |
1342 | eec |= IXGBE_EEC_REQ; | 1344 | eec |= IXGBE_EEC_REQ; |
1343 | IXGBE_WRITE_REG(hw, IXGBE_EEC, eec); | 1345 | IXGBE_WRITE_REG(hw, IXGBE_EEC, eec); |
1344 | 1346 | ||
1345 | for (i = 0; i < IXGBE_EEPROM_GRANT_ATTEMPTS; i++) { | 1347 | for (i = 0; i < IXGBE_EEPROM_GRANT_ATTEMPTS; i++) { |
1346 | eec = IXGBE_READ_REG(hw, IXGBE_EEC); | 1348 | eec = IXGBE_READ_REG(hw, IXGBE_EEC); |
1347 | if (eec & IXGBE_EEC_GNT) | 1349 | if (eec & IXGBE_EEC_GNT) |
1348 | break; | 1350 | break; |
1349 | udelay(5); | 1351 | udelay(5); |
1350 | } | 1352 | } |
1351 | 1353 | ||
1352 | /* Release if grant not acquired */ | 1354 | /* Release if grant not acquired */ |
1353 | if (!(eec & IXGBE_EEC_GNT)) { | 1355 | if (!(eec & IXGBE_EEC_GNT)) { |
1354 | eec &= ~IXGBE_EEC_REQ; | 1356 | eec &= ~IXGBE_EEC_REQ; |
1355 | IXGBE_WRITE_REG(hw, IXGBE_EEC, eec); | 1357 | IXGBE_WRITE_REG(hw, IXGBE_EEC, eec); |
1356 | hw_dbg(hw, "Could not acquire EEPROM grant\n"); | 1358 | hw_dbg(hw, "Could not acquire EEPROM grant\n"); |
1357 | 1359 | ||
1358 | hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM); | 1360 | hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM); |
1359 | status = IXGBE_ERR_EEPROM; | 1361 | status = IXGBE_ERR_EEPROM; |
1360 | } | 1362 | } |
1361 | 1363 | ||
1362 | /* Setup EEPROM for Read/Write */ | 1364 | /* Setup EEPROM for Read/Write */ |
1363 | if (status == 0) { | 1365 | if (status == 0) { |
1364 | /* Clear CS and SK */ | 1366 | /* Clear CS and SK */ |
1365 | eec &= ~(IXGBE_EEC_CS | IXGBE_EEC_SK); | 1367 | eec &= ~(IXGBE_EEC_CS | IXGBE_EEC_SK); |
1366 | IXGBE_WRITE_REG(hw, IXGBE_EEC, eec); | 1368 | IXGBE_WRITE_REG(hw, IXGBE_EEC, eec); |
1367 | IXGBE_WRITE_FLUSH(hw); | 1369 | IXGBE_WRITE_FLUSH(hw); |
1368 | udelay(1); | 1370 | udelay(1); |
1369 | } | 1371 | } |
1370 | } | 1372 | } |
1371 | return status; | 1373 | return status; |
1372 | } | 1374 | } |
1373 | 1375 | ||
1374 | /** | 1376 | /** |
1375 | * ixgbe_get_eeprom_semaphore - Get hardware semaphore | 1377 | * ixgbe_get_eeprom_semaphore - Get hardware semaphore |
1376 | * @hw: pointer to hardware structure | 1378 | * @hw: pointer to hardware structure |
1377 | * | 1379 | * |
1378 | * Sets the hardware semaphores so EEPROM access can occur for bit-bang method | 1380 | * Sets the hardware semaphores so EEPROM access can occur for bit-bang method |
1379 | **/ | 1381 | **/ |
1380 | static s32 ixgbe_get_eeprom_semaphore(struct ixgbe_hw *hw) | 1382 | static s32 ixgbe_get_eeprom_semaphore(struct ixgbe_hw *hw) |
1381 | { | 1383 | { |
1382 | s32 status = IXGBE_ERR_EEPROM; | 1384 | s32 status = IXGBE_ERR_EEPROM; |
1383 | u32 timeout = 2000; | 1385 | u32 timeout = 2000; |
1384 | u32 i; | 1386 | u32 i; |
1385 | u32 swsm; | 1387 | u32 swsm; |
1386 | 1388 | ||
1387 | /* Get SMBI software semaphore between device drivers first */ | 1389 | /* Get SMBI software semaphore between device drivers first */ |
1388 | for (i = 0; i < timeout; i++) { | 1390 | for (i = 0; i < timeout; i++) { |
1389 | /* | 1391 | /* |
1390 | * If the SMBI bit is 0 when we read it, then the bit will be | 1392 | * If the SMBI bit is 0 when we read it, then the bit will be |
1391 | * set and we have the semaphore | 1393 | * set and we have the semaphore |
1392 | */ | 1394 | */ |
1393 | swsm = IXGBE_READ_REG(hw, IXGBE_SWSM); | 1395 | swsm = IXGBE_READ_REG(hw, IXGBE_SWSM); |
1394 | if (!(swsm & IXGBE_SWSM_SMBI)) { | 1396 | if (!(swsm & IXGBE_SWSM_SMBI)) { |
1395 | status = 0; | 1397 | status = 0; |
1396 | break; | 1398 | break; |
1397 | } | 1399 | } |
1398 | udelay(50); | 1400 | udelay(50); |
1399 | } | 1401 | } |
1400 | 1402 | ||
1401 | if (i == timeout) { | 1403 | if (i == timeout) { |
1402 | hw_dbg(hw, "Driver can't access the Eeprom - SMBI Semaphore " | 1404 | hw_dbg(hw, "Driver can't access the Eeprom - SMBI Semaphore " |
1403 | "not granted.\n"); | 1405 | "not granted.\n"); |
1404 | /* | 1406 | /* |
1405 | * this release is particularly important because our attempts | 1407 | * this release is particularly important because our attempts |
1406 | * above to get the semaphore may have succeeded, and if there | 1408 | * above to get the semaphore may have succeeded, and if there |
1407 | * was a timeout, we should unconditionally clear the semaphore | 1409 | * was a timeout, we should unconditionally clear the semaphore |
1408 | * bits to free the driver to make progress | 1410 | * bits to free the driver to make progress |
1409 | */ | 1411 | */ |
1410 | ixgbe_release_eeprom_semaphore(hw); | 1412 | ixgbe_release_eeprom_semaphore(hw); |
1411 | 1413 | ||
1412 | udelay(50); | 1414 | udelay(50); |
1413 | /* | 1415 | /* |
1414 | * one last try | 1416 | * one last try |
1415 | * If the SMBI bit is 0 when we read it, then the bit will be | 1417 | * If the SMBI bit is 0 when we read it, then the bit will be |
1416 | * set and we have the semaphore | 1418 | * set and we have the semaphore |
1417 | */ | 1419 | */ |
1418 | swsm = IXGBE_READ_REG(hw, IXGBE_SWSM); | 1420 | swsm = IXGBE_READ_REG(hw, IXGBE_SWSM); |
1419 | if (!(swsm & IXGBE_SWSM_SMBI)) | 1421 | if (!(swsm & IXGBE_SWSM_SMBI)) |
1420 | status = 0; | 1422 | status = 0; |
1421 | } | 1423 | } |
1422 | 1424 | ||
1423 | /* Now get the semaphore between SW/FW through the SWESMBI bit */ | 1425 | /* Now get the semaphore between SW/FW through the SWESMBI bit */ |
1424 | if (status == 0) { | 1426 | if (status == 0) { |
1425 | for (i = 0; i < timeout; i++) { | 1427 | for (i = 0; i < timeout; i++) { |
1426 | swsm = IXGBE_READ_REG(hw, IXGBE_SWSM); | 1428 | swsm = IXGBE_READ_REG(hw, IXGBE_SWSM); |
1427 | 1429 | ||
1428 | /* Set the SW EEPROM semaphore bit to request access */ | 1430 | /* Set the SW EEPROM semaphore bit to request access */ |
1429 | swsm |= IXGBE_SWSM_SWESMBI; | 1431 | swsm |= IXGBE_SWSM_SWESMBI; |
1430 | IXGBE_WRITE_REG(hw, IXGBE_SWSM, swsm); | 1432 | IXGBE_WRITE_REG(hw, IXGBE_SWSM, swsm); |
1431 | 1433 | ||
1432 | /* | 1434 | /* |
1433 | * If we set the bit successfully then we got the | 1435 | * If we set the bit successfully then we got the |
1434 | * semaphore. | 1436 | * semaphore. |
1435 | */ | 1437 | */ |
1436 | swsm = IXGBE_READ_REG(hw, IXGBE_SWSM); | 1438 | swsm = IXGBE_READ_REG(hw, IXGBE_SWSM); |
1437 | if (swsm & IXGBE_SWSM_SWESMBI) | 1439 | if (swsm & IXGBE_SWSM_SWESMBI) |
1438 | break; | 1440 | break; |
1439 | 1441 | ||
1440 | udelay(50); | 1442 | udelay(50); |
1441 | } | 1443 | } |
1442 | 1444 | ||
1443 | /* | 1445 | /* |
1444 | * Release semaphores and return error if SW EEPROM semaphore | 1446 | * Release semaphores and return error if SW EEPROM semaphore |
1445 | * was not granted because we don't have access to the EEPROM | 1447 | * was not granted because we don't have access to the EEPROM |
1446 | */ | 1448 | */ |
1447 | if (i >= timeout) { | 1449 | if (i >= timeout) { |
1448 | hw_dbg(hw, "SWESMBI Software EEPROM semaphore " | 1450 | hw_dbg(hw, "SWESMBI Software EEPROM semaphore " |
1449 | "not granted.\n"); | 1451 | "not granted.\n"); |
1450 | ixgbe_release_eeprom_semaphore(hw); | 1452 | ixgbe_release_eeprom_semaphore(hw); |
1451 | status = IXGBE_ERR_EEPROM; | 1453 | status = IXGBE_ERR_EEPROM; |
1452 | } | 1454 | } |
1453 | } else { | 1455 | } else { |
1454 | hw_dbg(hw, "Software semaphore SMBI between device drivers " | 1456 | hw_dbg(hw, "Software semaphore SMBI between device drivers " |
1455 | "not granted.\n"); | 1457 | "not granted.\n"); |
1456 | } | 1458 | } |
1457 | 1459 | ||
1458 | return status; | 1460 | return status; |
1459 | } | 1461 | } |
1460 | 1462 | ||
1461 | /** | 1463 | /** |
1462 | * ixgbe_release_eeprom_semaphore - Release hardware semaphore | 1464 | * ixgbe_release_eeprom_semaphore - Release hardware semaphore |
1463 | * @hw: pointer to hardware structure | 1465 | * @hw: pointer to hardware structure |
1464 | * | 1466 | * |
1465 | * This function clears hardware semaphore bits. | 1467 | * This function clears hardware semaphore bits. |
1466 | **/ | 1468 | **/ |
1467 | static void ixgbe_release_eeprom_semaphore(struct ixgbe_hw *hw) | 1469 | static void ixgbe_release_eeprom_semaphore(struct ixgbe_hw *hw) |
1468 | { | 1470 | { |
1469 | u32 swsm; | 1471 | u32 swsm; |
1470 | 1472 | ||
1471 | swsm = IXGBE_READ_REG(hw, IXGBE_SWSM); | 1473 | swsm = IXGBE_READ_REG(hw, IXGBE_SWSM); |
1472 | 1474 | ||
1473 | /* Release both semaphores by writing 0 to the bits SWESMBI and SMBI */ | 1475 | /* Release both semaphores by writing 0 to the bits SWESMBI and SMBI */ |
1474 | swsm &= ~(IXGBE_SWSM_SWESMBI | IXGBE_SWSM_SMBI); | 1476 | swsm &= ~(IXGBE_SWSM_SWESMBI | IXGBE_SWSM_SMBI); |
1475 | IXGBE_WRITE_REG(hw, IXGBE_SWSM, swsm); | 1477 | IXGBE_WRITE_REG(hw, IXGBE_SWSM, swsm); |
1476 | IXGBE_WRITE_FLUSH(hw); | 1478 | IXGBE_WRITE_FLUSH(hw); |
1477 | } | 1479 | } |
1478 | 1480 | ||
1479 | /** | 1481 | /** |
1480 | * ixgbe_ready_eeprom - Polls for EEPROM ready | 1482 | * ixgbe_ready_eeprom - Polls for EEPROM ready |
1481 | * @hw: pointer to hardware structure | 1483 | * @hw: pointer to hardware structure |
1482 | **/ | 1484 | **/ |
1483 | static s32 ixgbe_ready_eeprom(struct ixgbe_hw *hw) | 1485 | static s32 ixgbe_ready_eeprom(struct ixgbe_hw *hw) |
1484 | { | 1486 | { |
1485 | s32 status = 0; | 1487 | s32 status = 0; |
1486 | u16 i; | 1488 | u16 i; |
1487 | u8 spi_stat_reg; | 1489 | u8 spi_stat_reg; |
1488 | 1490 | ||
1489 | /* | 1491 | /* |
1490 | * Read "Status Register" repeatedly until the LSB is cleared. The | 1492 | * Read "Status Register" repeatedly until the LSB is cleared. The |
1491 | * EEPROM will signal that the command has been completed by clearing | 1493 | * EEPROM will signal that the command has been completed by clearing |
1492 | * bit 0 of the internal status register. If it's not cleared within | 1494 | * bit 0 of the internal status register. If it's not cleared within |
1493 | * 5 milliseconds, then error out. | 1495 | * 5 milliseconds, then error out. |
1494 | */ | 1496 | */ |
1495 | for (i = 0; i < IXGBE_EEPROM_MAX_RETRY_SPI; i += 5) { | 1497 | for (i = 0; i < IXGBE_EEPROM_MAX_RETRY_SPI; i += 5) { |
1496 | ixgbe_shift_out_eeprom_bits(hw, IXGBE_EEPROM_RDSR_OPCODE_SPI, | 1498 | ixgbe_shift_out_eeprom_bits(hw, IXGBE_EEPROM_RDSR_OPCODE_SPI, |
1497 | IXGBE_EEPROM_OPCODE_BITS); | 1499 | IXGBE_EEPROM_OPCODE_BITS); |
1498 | spi_stat_reg = (u8)ixgbe_shift_in_eeprom_bits(hw, 8); | 1500 | spi_stat_reg = (u8)ixgbe_shift_in_eeprom_bits(hw, 8); |
1499 | if (!(spi_stat_reg & IXGBE_EEPROM_STATUS_RDY_SPI)) | 1501 | if (!(spi_stat_reg & IXGBE_EEPROM_STATUS_RDY_SPI)) |
1500 | break; | 1502 | break; |
1501 | 1503 | ||
1502 | udelay(5); | 1504 | udelay(5); |
1503 | ixgbe_standby_eeprom(hw); | 1505 | ixgbe_standby_eeprom(hw); |
1504 | } | 1506 | } |
1505 | 1507 | ||
1506 | /* | 1508 | /* |
1507 | * On some parts, SPI write time could vary from 0-20mSec on 3.3V | 1509 | * On some parts, SPI write time could vary from 0-20mSec on 3.3V |
1508 | * devices (and only 0-5mSec on 5V devices) | 1510 | * devices (and only 0-5mSec on 5V devices) |
1509 | */ | 1511 | */ |
1510 | if (i >= IXGBE_EEPROM_MAX_RETRY_SPI) { | 1512 | if (i >= IXGBE_EEPROM_MAX_RETRY_SPI) { |
1511 | hw_dbg(hw, "SPI EEPROM Status error\n"); | 1513 | hw_dbg(hw, "SPI EEPROM Status error\n"); |
1512 | status = IXGBE_ERR_EEPROM; | 1514 | status = IXGBE_ERR_EEPROM; |
1513 | } | 1515 | } |
1514 | 1516 | ||
1515 | return status; | 1517 | return status; |
1516 | } | 1518 | } |
1517 | 1519 | ||
1518 | /** | 1520 | /** |
1519 | * ixgbe_standby_eeprom - Returns EEPROM to a "standby" state | 1521 | * ixgbe_standby_eeprom - Returns EEPROM to a "standby" state |
1520 | * @hw: pointer to hardware structure | 1522 | * @hw: pointer to hardware structure |
1521 | **/ | 1523 | **/ |
1522 | static void ixgbe_standby_eeprom(struct ixgbe_hw *hw) | 1524 | static void ixgbe_standby_eeprom(struct ixgbe_hw *hw) |
1523 | { | 1525 | { |
1524 | u32 eec; | 1526 | u32 eec; |
1525 | 1527 | ||
1526 | eec = IXGBE_READ_REG(hw, IXGBE_EEC); | 1528 | eec = IXGBE_READ_REG(hw, IXGBE_EEC); |
1527 | 1529 | ||
1528 | /* Toggle CS to flush commands */ | 1530 | /* Toggle CS to flush commands */ |
1529 | eec |= IXGBE_EEC_CS; | 1531 | eec |= IXGBE_EEC_CS; |
1530 | IXGBE_WRITE_REG(hw, IXGBE_EEC, eec); | 1532 | IXGBE_WRITE_REG(hw, IXGBE_EEC, eec); |
1531 | IXGBE_WRITE_FLUSH(hw); | 1533 | IXGBE_WRITE_FLUSH(hw); |
1532 | udelay(1); | 1534 | udelay(1); |
1533 | eec &= ~IXGBE_EEC_CS; | 1535 | eec &= ~IXGBE_EEC_CS; |
1534 | IXGBE_WRITE_REG(hw, IXGBE_EEC, eec); | 1536 | IXGBE_WRITE_REG(hw, IXGBE_EEC, eec); |
1535 | IXGBE_WRITE_FLUSH(hw); | 1537 | IXGBE_WRITE_FLUSH(hw); |
1536 | udelay(1); | 1538 | udelay(1); |
1537 | } | 1539 | } |
1538 | 1540 | ||
1539 | /** | 1541 | /** |
1540 | * ixgbe_shift_out_eeprom_bits - Shift data bits out to the EEPROM. | 1542 | * ixgbe_shift_out_eeprom_bits - Shift data bits out to the EEPROM. |
1541 | * @hw: pointer to hardware structure | 1543 | * @hw: pointer to hardware structure |
1542 | * @data: data to send to the EEPROM | 1544 | * @data: data to send to the EEPROM |
1543 | * @count: number of bits to shift out | 1545 | * @count: number of bits to shift out |
1544 | **/ | 1546 | **/ |
1545 | static void ixgbe_shift_out_eeprom_bits(struct ixgbe_hw *hw, u16 data, | 1547 | static void ixgbe_shift_out_eeprom_bits(struct ixgbe_hw *hw, u16 data, |
1546 | u16 count) | 1548 | u16 count) |
1547 | { | 1549 | { |
1548 | u32 eec; | 1550 | u32 eec; |
1549 | u32 mask; | 1551 | u32 mask; |
1550 | u32 i; | 1552 | u32 i; |
1551 | 1553 | ||
1552 | eec = IXGBE_READ_REG(hw, IXGBE_EEC); | 1554 | eec = IXGBE_READ_REG(hw, IXGBE_EEC); |
1553 | 1555 | ||
1554 | /* | 1556 | /* |
1555 | * Mask is used to shift "count" bits of "data" out to the EEPROM | 1557 | * Mask is used to shift "count" bits of "data" out to the EEPROM |
1556 | * one bit at a time. Determine the starting bit based on count | 1558 | * one bit at a time. Determine the starting bit based on count |
1557 | */ | 1559 | */ |
1558 | mask = 0x01 << (count - 1); | 1560 | mask = 0x01 << (count - 1); |
1559 | 1561 | ||
1560 | for (i = 0; i < count; i++) { | 1562 | for (i = 0; i < count; i++) { |
1561 | /* | 1563 | /* |
1562 | * A "1" is shifted out to the EEPROM by setting bit "DI" to a | 1564 | * A "1" is shifted out to the EEPROM by setting bit "DI" to a |
1563 | * "1", and then raising and then lowering the clock (the SK | 1565 | * "1", and then raising and then lowering the clock (the SK |
1564 | * bit controls the clock input to the EEPROM). A "0" is | 1566 | * bit controls the clock input to the EEPROM). A "0" is |
1565 | * shifted out to the EEPROM by setting "DI" to "0" and then | 1567 | * shifted out to the EEPROM by setting "DI" to "0" and then |
1566 | * raising and then lowering the clock. | 1568 | * raising and then lowering the clock. |
1567 | */ | 1569 | */ |
1568 | if (data & mask) | 1570 | if (data & mask) |
1569 | eec |= IXGBE_EEC_DI; | 1571 | eec |= IXGBE_EEC_DI; |
1570 | else | 1572 | else |
1571 | eec &= ~IXGBE_EEC_DI; | 1573 | eec &= ~IXGBE_EEC_DI; |
1572 | 1574 | ||
1573 | IXGBE_WRITE_REG(hw, IXGBE_EEC, eec); | 1575 | IXGBE_WRITE_REG(hw, IXGBE_EEC, eec); |
1574 | IXGBE_WRITE_FLUSH(hw); | 1576 | IXGBE_WRITE_FLUSH(hw); |
1575 | 1577 | ||
1576 | udelay(1); | 1578 | udelay(1); |
1577 | 1579 | ||
1578 | ixgbe_raise_eeprom_clk(hw, &eec); | 1580 | ixgbe_raise_eeprom_clk(hw, &eec); |
1579 | ixgbe_lower_eeprom_clk(hw, &eec); | 1581 | ixgbe_lower_eeprom_clk(hw, &eec); |
1580 | 1582 | ||
1581 | /* | 1583 | /* |
1582 | * Shift mask to signify next bit of data to shift in to the | 1584 | * Shift mask to signify next bit of data to shift in to the |
1583 | * EEPROM | 1585 | * EEPROM |
1584 | */ | 1586 | */ |
1585 | mask = mask >> 1; | 1587 | mask = mask >> 1; |
1586 | } | 1588 | } |
1587 | 1589 | ||
1588 | /* We leave the "DI" bit set to "0" when we leave this routine. */ | 1590 | /* We leave the "DI" bit set to "0" when we leave this routine. */ |
1589 | eec &= ~IXGBE_EEC_DI; | 1591 | eec &= ~IXGBE_EEC_DI; |
1590 | IXGBE_WRITE_REG(hw, IXGBE_EEC, eec); | 1592 | IXGBE_WRITE_REG(hw, IXGBE_EEC, eec); |
1591 | IXGBE_WRITE_FLUSH(hw); | 1593 | IXGBE_WRITE_FLUSH(hw); |
1592 | } | 1594 | } |
1593 | 1595 | ||
1594 | /** | 1596 | /** |
1595 | * ixgbe_shift_in_eeprom_bits - Shift data bits in from the EEPROM | 1597 | * ixgbe_shift_in_eeprom_bits - Shift data bits in from the EEPROM |
1596 | * @hw: pointer to hardware structure | 1598 | * @hw: pointer to hardware structure |
1597 | **/ | 1599 | **/ |
1598 | static u16 ixgbe_shift_in_eeprom_bits(struct ixgbe_hw *hw, u16 count) | 1600 | static u16 ixgbe_shift_in_eeprom_bits(struct ixgbe_hw *hw, u16 count) |
1599 | { | 1601 | { |
1600 | u32 eec; | 1602 | u32 eec; |
1601 | u32 i; | 1603 | u32 i; |
1602 | u16 data = 0; | 1604 | u16 data = 0; |
1603 | 1605 | ||
1604 | /* | 1606 | /* |
1605 | * In order to read a register from the EEPROM, we need to shift | 1607 | * In order to read a register from the EEPROM, we need to shift |
1606 | * 'count' bits in from the EEPROM. Bits are "shifted in" by raising | 1608 | * 'count' bits in from the EEPROM. Bits are "shifted in" by raising |
1607 | * the clock input to the EEPROM (setting the SK bit), and then reading | 1609 | * the clock input to the EEPROM (setting the SK bit), and then reading |
1608 | * the value of the "DO" bit. During this "shifting in" process the | 1610 | * the value of the "DO" bit. During this "shifting in" process the |
1609 | * "DI" bit should always be clear. | 1611 | * "DI" bit should always be clear. |
1610 | */ | 1612 | */ |
1611 | eec = IXGBE_READ_REG(hw, IXGBE_EEC); | 1613 | eec = IXGBE_READ_REG(hw, IXGBE_EEC); |
1612 | 1614 | ||
1613 | eec &= ~(IXGBE_EEC_DO | IXGBE_EEC_DI); | 1615 | eec &= ~(IXGBE_EEC_DO | IXGBE_EEC_DI); |
1614 | 1616 | ||
1615 | for (i = 0; i < count; i++) { | 1617 | for (i = 0; i < count; i++) { |
1616 | data = data << 1; | 1618 | data = data << 1; |
1617 | ixgbe_raise_eeprom_clk(hw, &eec); | 1619 | ixgbe_raise_eeprom_clk(hw, &eec); |
1618 | 1620 | ||
1619 | eec = IXGBE_READ_REG(hw, IXGBE_EEC); | 1621 | eec = IXGBE_READ_REG(hw, IXGBE_EEC); |
1620 | 1622 | ||
1621 | eec &= ~(IXGBE_EEC_DI); | 1623 | eec &= ~(IXGBE_EEC_DI); |
1622 | if (eec & IXGBE_EEC_DO) | 1624 | if (eec & IXGBE_EEC_DO) |
1623 | data |= 1; | 1625 | data |= 1; |
1624 | 1626 | ||
1625 | ixgbe_lower_eeprom_clk(hw, &eec); | 1627 | ixgbe_lower_eeprom_clk(hw, &eec); |
1626 | } | 1628 | } |
1627 | 1629 | ||
1628 | return data; | 1630 | return data; |
1629 | } | 1631 | } |
1630 | 1632 | ||
1631 | /** | 1633 | /** |
1632 | * ixgbe_raise_eeprom_clk - Raises the EEPROM's clock input. | 1634 | * ixgbe_raise_eeprom_clk - Raises the EEPROM's clock input. |
1633 | * @hw: pointer to hardware structure | 1635 | * @hw: pointer to hardware structure |
1634 | * @eec: EEC register's current value | 1636 | * @eec: EEC register's current value |
1635 | **/ | 1637 | **/ |
1636 | static void ixgbe_raise_eeprom_clk(struct ixgbe_hw *hw, u32 *eec) | 1638 | static void ixgbe_raise_eeprom_clk(struct ixgbe_hw *hw, u32 *eec) |
1637 | { | 1639 | { |
1638 | /* | 1640 | /* |
1639 | * Raise the clock input to the EEPROM | 1641 | * Raise the clock input to the EEPROM |
1640 | * (setting the SK bit), then delay | 1642 | * (setting the SK bit), then delay |
1641 | */ | 1643 | */ |
1642 | *eec = *eec | IXGBE_EEC_SK; | 1644 | *eec = *eec | IXGBE_EEC_SK; |
1643 | IXGBE_WRITE_REG(hw, IXGBE_EEC, *eec); | 1645 | IXGBE_WRITE_REG(hw, IXGBE_EEC, *eec); |
1644 | IXGBE_WRITE_FLUSH(hw); | 1646 | IXGBE_WRITE_FLUSH(hw); |
1645 | udelay(1); | 1647 | udelay(1); |
1646 | } | 1648 | } |
1647 | 1649 | ||
1648 | /** | 1650 | /** |
1649 | * ixgbe_lower_eeprom_clk - Lowers the EEPROM's clock input. | 1651 | * ixgbe_lower_eeprom_clk - Lowers the EEPROM's clock input. |
1650 | * @hw: pointer to hardware structure | 1652 | * @hw: pointer to hardware structure |
1651 | * @eecd: EECD's current value | 1653 | * @eecd: EECD's current value |
1652 | **/ | 1654 | **/ |
1653 | static void ixgbe_lower_eeprom_clk(struct ixgbe_hw *hw, u32 *eec) | 1655 | static void ixgbe_lower_eeprom_clk(struct ixgbe_hw *hw, u32 *eec) |
1654 | { | 1656 | { |
1655 | /* | 1657 | /* |
1656 | * Lower the clock input to the EEPROM (clearing the SK bit), then | 1658 | * Lower the clock input to the EEPROM (clearing the SK bit), then |
1657 | * delay | 1659 | * delay |
1658 | */ | 1660 | */ |
1659 | *eec = *eec & ~IXGBE_EEC_SK; | 1661 | *eec = *eec & ~IXGBE_EEC_SK; |
1660 | IXGBE_WRITE_REG(hw, IXGBE_EEC, *eec); | 1662 | IXGBE_WRITE_REG(hw, IXGBE_EEC, *eec); |
1661 | IXGBE_WRITE_FLUSH(hw); | 1663 | IXGBE_WRITE_FLUSH(hw); |
1662 | udelay(1); | 1664 | udelay(1); |
1663 | } | 1665 | } |
1664 | 1666 | ||
1665 | /** | 1667 | /** |
1666 | * ixgbe_release_eeprom - Release EEPROM, release semaphores | 1668 | * ixgbe_release_eeprom - Release EEPROM, release semaphores |
1667 | * @hw: pointer to hardware structure | 1669 | * @hw: pointer to hardware structure |
1668 | **/ | 1670 | **/ |
1669 | static void ixgbe_release_eeprom(struct ixgbe_hw *hw) | 1671 | static void ixgbe_release_eeprom(struct ixgbe_hw *hw) |
1670 | { | 1672 | { |
1671 | u32 eec; | 1673 | u32 eec; |
1672 | 1674 | ||
1673 | eec = IXGBE_READ_REG(hw, IXGBE_EEC); | 1675 | eec = IXGBE_READ_REG(hw, IXGBE_EEC); |
1674 | 1676 | ||
1675 | eec |= IXGBE_EEC_CS; /* Pull CS high */ | 1677 | eec |= IXGBE_EEC_CS; /* Pull CS high */ |
1676 | eec &= ~IXGBE_EEC_SK; /* Lower SCK */ | 1678 | eec &= ~IXGBE_EEC_SK; /* Lower SCK */ |
1677 | 1679 | ||
1678 | IXGBE_WRITE_REG(hw, IXGBE_EEC, eec); | 1680 | IXGBE_WRITE_REG(hw, IXGBE_EEC, eec); |
1679 | IXGBE_WRITE_FLUSH(hw); | 1681 | IXGBE_WRITE_FLUSH(hw); |
1680 | 1682 | ||
1681 | udelay(1); | 1683 | udelay(1); |
1682 | 1684 | ||
1683 | /* Stop requesting EEPROM access */ | 1685 | /* Stop requesting EEPROM access */ |
1684 | eec &= ~IXGBE_EEC_REQ; | 1686 | eec &= ~IXGBE_EEC_REQ; |
1685 | IXGBE_WRITE_REG(hw, IXGBE_EEC, eec); | 1687 | IXGBE_WRITE_REG(hw, IXGBE_EEC, eec); |
1686 | 1688 | ||
1687 | hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM); | 1689 | hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM); |
1688 | 1690 | ||
1689 | /* | 1691 | /* |
1690 | * Delay before attempt to obtain semaphore again to allow FW | 1692 | * Delay before attempt to obtain semaphore again to allow FW |
1691 | * access. semaphore_delay is in ms we need us for usleep_range | 1693 | * access. semaphore_delay is in ms we need us for usleep_range |
1692 | */ | 1694 | */ |
1693 | usleep_range(hw->eeprom.semaphore_delay * 1000, | 1695 | usleep_range(hw->eeprom.semaphore_delay * 1000, |
1694 | hw->eeprom.semaphore_delay * 2000); | 1696 | hw->eeprom.semaphore_delay * 2000); |
1695 | } | 1697 | } |
1696 | 1698 | ||
1697 | /** | 1699 | /** |
1698 | * ixgbe_calc_eeprom_checksum_generic - Calculates and returns the checksum | 1700 | * ixgbe_calc_eeprom_checksum_generic - Calculates and returns the checksum |
1699 | * @hw: pointer to hardware structure | 1701 | * @hw: pointer to hardware structure |
1700 | **/ | 1702 | **/ |
1701 | u16 ixgbe_calc_eeprom_checksum_generic(struct ixgbe_hw *hw) | 1703 | u16 ixgbe_calc_eeprom_checksum_generic(struct ixgbe_hw *hw) |
1702 | { | 1704 | { |
1703 | u16 i; | 1705 | u16 i; |
1704 | u16 j; | 1706 | u16 j; |
1705 | u16 checksum = 0; | 1707 | u16 checksum = 0; |
1706 | u16 length = 0; | 1708 | u16 length = 0; |
1707 | u16 pointer = 0; | 1709 | u16 pointer = 0; |
1708 | u16 word = 0; | 1710 | u16 word = 0; |
1709 | 1711 | ||
1710 | /* Include 0x0-0x3F in the checksum */ | 1712 | /* Include 0x0-0x3F in the checksum */ |
1711 | for (i = 0; i < IXGBE_EEPROM_CHECKSUM; i++) { | 1713 | for (i = 0; i < IXGBE_EEPROM_CHECKSUM; i++) { |
1712 | if (hw->eeprom.ops.read(hw, i, &word) != 0) { | 1714 | if (hw->eeprom.ops.read(hw, i, &word) != 0) { |
1713 | hw_dbg(hw, "EEPROM read failed\n"); | 1715 | hw_dbg(hw, "EEPROM read failed\n"); |
1714 | break; | 1716 | break; |
1715 | } | 1717 | } |
1716 | checksum += word; | 1718 | checksum += word; |
1717 | } | 1719 | } |
1718 | 1720 | ||
1719 | /* Include all data from pointers except for the fw pointer */ | 1721 | /* Include all data from pointers except for the fw pointer */ |
1720 | for (i = IXGBE_PCIE_ANALOG_PTR; i < IXGBE_FW_PTR; i++) { | 1722 | for (i = IXGBE_PCIE_ANALOG_PTR; i < IXGBE_FW_PTR; i++) { |
1721 | hw->eeprom.ops.read(hw, i, &pointer); | 1723 | hw->eeprom.ops.read(hw, i, &pointer); |
1722 | 1724 | ||
1723 | /* Make sure the pointer seems valid */ | 1725 | /* Make sure the pointer seems valid */ |
1724 | if (pointer != 0xFFFF && pointer != 0) { | 1726 | if (pointer != 0xFFFF && pointer != 0) { |
1725 | hw->eeprom.ops.read(hw, pointer, &length); | 1727 | hw->eeprom.ops.read(hw, pointer, &length); |
1726 | 1728 | ||
1727 | if (length != 0xFFFF && length != 0) { | 1729 | if (length != 0xFFFF && length != 0) { |
1728 | for (j = pointer+1; j <= pointer+length; j++) { | 1730 | for (j = pointer+1; j <= pointer+length; j++) { |
1729 | hw->eeprom.ops.read(hw, j, &word); | 1731 | hw->eeprom.ops.read(hw, j, &word); |
1730 | checksum += word; | 1732 | checksum += word; |
1731 | } | 1733 | } |
1732 | } | 1734 | } |
1733 | } | 1735 | } |
1734 | } | 1736 | } |
1735 | 1737 | ||
1736 | checksum = (u16)IXGBE_EEPROM_SUM - checksum; | 1738 | checksum = (u16)IXGBE_EEPROM_SUM - checksum; |
1737 | 1739 | ||
1738 | return checksum; | 1740 | return checksum; |
1739 | } | 1741 | } |
1740 | 1742 | ||
1741 | /** | 1743 | /** |
1742 | * ixgbe_validate_eeprom_checksum_generic - Validate EEPROM checksum | 1744 | * ixgbe_validate_eeprom_checksum_generic - Validate EEPROM checksum |
1743 | * @hw: pointer to hardware structure | 1745 | * @hw: pointer to hardware structure |
1744 | * @checksum_val: calculated checksum | 1746 | * @checksum_val: calculated checksum |
1745 | * | 1747 | * |
1746 | * Performs checksum calculation and validates the EEPROM checksum. If the | 1748 | * Performs checksum calculation and validates the EEPROM checksum. If the |
1747 | * caller does not need checksum_val, the value can be NULL. | 1749 | * caller does not need checksum_val, the value can be NULL. |
1748 | **/ | 1750 | **/ |
1749 | s32 ixgbe_validate_eeprom_checksum_generic(struct ixgbe_hw *hw, | 1751 | s32 ixgbe_validate_eeprom_checksum_generic(struct ixgbe_hw *hw, |
1750 | u16 *checksum_val) | 1752 | u16 *checksum_val) |
1751 | { | 1753 | { |
1752 | s32 status; | 1754 | s32 status; |
1753 | u16 checksum; | 1755 | u16 checksum; |
1754 | u16 read_checksum = 0; | 1756 | u16 read_checksum = 0; |
1755 | 1757 | ||
1756 | /* | 1758 | /* |
1757 | * Read the first word from the EEPROM. If this times out or fails, do | 1759 | * Read the first word from the EEPROM. If this times out or fails, do |
1758 | * not continue or we could be in for a very long wait while every | 1760 | * not continue or we could be in for a very long wait while every |
1759 | * EEPROM read fails | 1761 | * EEPROM read fails |
1760 | */ | 1762 | */ |
1761 | status = hw->eeprom.ops.read(hw, 0, &checksum); | 1763 | status = hw->eeprom.ops.read(hw, 0, &checksum); |
1762 | 1764 | ||
1763 | if (status == 0) { | 1765 | if (status == 0) { |
1764 | checksum = hw->eeprom.ops.calc_checksum(hw); | 1766 | checksum = hw->eeprom.ops.calc_checksum(hw); |
1765 | 1767 | ||
1766 | hw->eeprom.ops.read(hw, IXGBE_EEPROM_CHECKSUM, &read_checksum); | 1768 | hw->eeprom.ops.read(hw, IXGBE_EEPROM_CHECKSUM, &read_checksum); |
1767 | 1769 | ||
1768 | /* | 1770 | /* |
1769 | * Verify read checksum from EEPROM is the same as | 1771 | * Verify read checksum from EEPROM is the same as |
1770 | * calculated checksum | 1772 | * calculated checksum |
1771 | */ | 1773 | */ |
1772 | if (read_checksum != checksum) | 1774 | if (read_checksum != checksum) |
1773 | status = IXGBE_ERR_EEPROM_CHECKSUM; | 1775 | status = IXGBE_ERR_EEPROM_CHECKSUM; |
1774 | 1776 | ||
1775 | /* If the user cares, return the calculated checksum */ | 1777 | /* If the user cares, return the calculated checksum */ |
1776 | if (checksum_val) | 1778 | if (checksum_val) |
1777 | *checksum_val = checksum; | 1779 | *checksum_val = checksum; |
1778 | } else { | 1780 | } else { |
1779 | hw_dbg(hw, "EEPROM read failed\n"); | 1781 | hw_dbg(hw, "EEPROM read failed\n"); |
1780 | } | 1782 | } |
1781 | 1783 | ||
1782 | return status; | 1784 | return status; |
1783 | } | 1785 | } |
1784 | 1786 | ||
1785 | /** | 1787 | /** |
1786 | * ixgbe_update_eeprom_checksum_generic - Updates the EEPROM checksum | 1788 | * ixgbe_update_eeprom_checksum_generic - Updates the EEPROM checksum |
1787 | * @hw: pointer to hardware structure | 1789 | * @hw: pointer to hardware structure |
1788 | **/ | 1790 | **/ |
1789 | s32 ixgbe_update_eeprom_checksum_generic(struct ixgbe_hw *hw) | 1791 | s32 ixgbe_update_eeprom_checksum_generic(struct ixgbe_hw *hw) |
1790 | { | 1792 | { |
1791 | s32 status; | 1793 | s32 status; |
1792 | u16 checksum; | 1794 | u16 checksum; |
1793 | 1795 | ||
1794 | /* | 1796 | /* |
1795 | * Read the first word from the EEPROM. If this times out or fails, do | 1797 | * Read the first word from the EEPROM. If this times out or fails, do |
1796 | * not continue or we could be in for a very long wait while every | 1798 | * not continue or we could be in for a very long wait while every |
1797 | * EEPROM read fails | 1799 | * EEPROM read fails |
1798 | */ | 1800 | */ |
1799 | status = hw->eeprom.ops.read(hw, 0, &checksum); | 1801 | status = hw->eeprom.ops.read(hw, 0, &checksum); |
1800 | 1802 | ||
1801 | if (status == 0) { | 1803 | if (status == 0) { |
1802 | checksum = hw->eeprom.ops.calc_checksum(hw); | 1804 | checksum = hw->eeprom.ops.calc_checksum(hw); |
1803 | status = hw->eeprom.ops.write(hw, IXGBE_EEPROM_CHECKSUM, | 1805 | status = hw->eeprom.ops.write(hw, IXGBE_EEPROM_CHECKSUM, |
1804 | checksum); | 1806 | checksum); |
1805 | } else { | 1807 | } else { |
1806 | hw_dbg(hw, "EEPROM read failed\n"); | 1808 | hw_dbg(hw, "EEPROM read failed\n"); |
1807 | } | 1809 | } |
1808 | 1810 | ||
1809 | return status; | 1811 | return status; |
1810 | } | 1812 | } |
1811 | 1813 | ||
1812 | /** | 1814 | /** |
1813 | * ixgbe_set_rar_generic - Set Rx address register | 1815 | * ixgbe_set_rar_generic - Set Rx address register |
1814 | * @hw: pointer to hardware structure | 1816 | * @hw: pointer to hardware structure |
1815 | * @index: Receive address register to write | 1817 | * @index: Receive address register to write |
1816 | * @addr: Address to put into receive address register | 1818 | * @addr: Address to put into receive address register |
1817 | * @vmdq: VMDq "set" or "pool" index | 1819 | * @vmdq: VMDq "set" or "pool" index |
1818 | * @enable_addr: set flag that address is active | 1820 | * @enable_addr: set flag that address is active |
1819 | * | 1821 | * |
1820 | * Puts an ethernet address into a receive address register. | 1822 | * Puts an ethernet address into a receive address register. |
1821 | **/ | 1823 | **/ |
1822 | s32 ixgbe_set_rar_generic(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq, | 1824 | s32 ixgbe_set_rar_generic(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq, |
1823 | u32 enable_addr) | 1825 | u32 enable_addr) |
1824 | { | 1826 | { |
1825 | u32 rar_low, rar_high; | 1827 | u32 rar_low, rar_high; |
1826 | u32 rar_entries = hw->mac.num_rar_entries; | 1828 | u32 rar_entries = hw->mac.num_rar_entries; |
1827 | 1829 | ||
1828 | /* Make sure we are using a valid rar index range */ | 1830 | /* Make sure we are using a valid rar index range */ |
1829 | if (index >= rar_entries) { | 1831 | if (index >= rar_entries) { |
1830 | hw_dbg(hw, "RAR index %d is out of range.\n", index); | 1832 | hw_dbg(hw, "RAR index %d is out of range.\n", index); |
1831 | return IXGBE_ERR_INVALID_ARGUMENT; | 1833 | return IXGBE_ERR_INVALID_ARGUMENT; |
1832 | } | 1834 | } |
1833 | 1835 | ||
1834 | /* setup VMDq pool selection before this RAR gets enabled */ | 1836 | /* setup VMDq pool selection before this RAR gets enabled */ |
1835 | hw->mac.ops.set_vmdq(hw, index, vmdq); | 1837 | hw->mac.ops.set_vmdq(hw, index, vmdq); |
1836 | 1838 | ||
1837 | /* | 1839 | /* |
1838 | * HW expects these in little endian so we reverse the byte | 1840 | * HW expects these in little endian so we reverse the byte |
1839 | * order from network order (big endian) to little endian | 1841 | * order from network order (big endian) to little endian |
1840 | */ | 1842 | */ |
1841 | rar_low = ((u32)addr[0] | | 1843 | rar_low = ((u32)addr[0] | |
1842 | ((u32)addr[1] << 8) | | 1844 | ((u32)addr[1] << 8) | |
1843 | ((u32)addr[2] << 16) | | 1845 | ((u32)addr[2] << 16) | |
1844 | ((u32)addr[3] << 24)); | 1846 | ((u32)addr[3] << 24)); |
1845 | /* | 1847 | /* |
1846 | * Some parts put the VMDq setting in the extra RAH bits, | 1848 | * Some parts put the VMDq setting in the extra RAH bits, |
1847 | * so save everything except the lower 16 bits that hold part | 1849 | * so save everything except the lower 16 bits that hold part |
1848 | * of the address and the address valid bit. | 1850 | * of the address and the address valid bit. |
1849 | */ | 1851 | */ |
1850 | rar_high = IXGBE_READ_REG(hw, IXGBE_RAH(index)); | 1852 | rar_high = IXGBE_READ_REG(hw, IXGBE_RAH(index)); |
1851 | rar_high &= ~(0x0000FFFF | IXGBE_RAH_AV); | 1853 | rar_high &= ~(0x0000FFFF | IXGBE_RAH_AV); |
1852 | rar_high |= ((u32)addr[4] | ((u32)addr[5] << 8)); | 1854 | rar_high |= ((u32)addr[4] | ((u32)addr[5] << 8)); |
1853 | 1855 | ||
1854 | if (enable_addr != 0) | 1856 | if (enable_addr != 0) |
1855 | rar_high |= IXGBE_RAH_AV; | 1857 | rar_high |= IXGBE_RAH_AV; |
1856 | 1858 | ||
1857 | IXGBE_WRITE_REG(hw, IXGBE_RAL(index), rar_low); | 1859 | IXGBE_WRITE_REG(hw, IXGBE_RAL(index), rar_low); |
1858 | IXGBE_WRITE_REG(hw, IXGBE_RAH(index), rar_high); | 1860 | IXGBE_WRITE_REG(hw, IXGBE_RAH(index), rar_high); |
1859 | 1861 | ||
1860 | return 0; | 1862 | return 0; |
1861 | } | 1863 | } |
1862 | 1864 | ||
1863 | /** | 1865 | /** |
1864 | * ixgbe_clear_rar_generic - Remove Rx address register | 1866 | * ixgbe_clear_rar_generic - Remove Rx address register |
1865 | * @hw: pointer to hardware structure | 1867 | * @hw: pointer to hardware structure |
1866 | * @index: Receive address register to write | 1868 | * @index: Receive address register to write |
1867 | * | 1869 | * |
1868 | * Clears an ethernet address from a receive address register. | 1870 | * Clears an ethernet address from a receive address register. |
1869 | **/ | 1871 | **/ |
1870 | s32 ixgbe_clear_rar_generic(struct ixgbe_hw *hw, u32 index) | 1872 | s32 ixgbe_clear_rar_generic(struct ixgbe_hw *hw, u32 index) |
1871 | { | 1873 | { |
1872 | u32 rar_high; | 1874 | u32 rar_high; |
1873 | u32 rar_entries = hw->mac.num_rar_entries; | 1875 | u32 rar_entries = hw->mac.num_rar_entries; |
1874 | 1876 | ||
1875 | /* Make sure we are using a valid rar index range */ | 1877 | /* Make sure we are using a valid rar index range */ |
1876 | if (index >= rar_entries) { | 1878 | if (index >= rar_entries) { |
1877 | hw_dbg(hw, "RAR index %d is out of range.\n", index); | 1879 | hw_dbg(hw, "RAR index %d is out of range.\n", index); |
1878 | return IXGBE_ERR_INVALID_ARGUMENT; | 1880 | return IXGBE_ERR_INVALID_ARGUMENT; |
1879 | } | 1881 | } |
1880 | 1882 | ||
1881 | /* | 1883 | /* |
1882 | * Some parts put the VMDq setting in the extra RAH bits, | 1884 | * Some parts put the VMDq setting in the extra RAH bits, |
1883 | * so save everything except the lower 16 bits that hold part | 1885 | * so save everything except the lower 16 bits that hold part |
1884 | * of the address and the address valid bit. | 1886 | * of the address and the address valid bit. |
1885 | */ | 1887 | */ |
1886 | rar_high = IXGBE_READ_REG(hw, IXGBE_RAH(index)); | 1888 | rar_high = IXGBE_READ_REG(hw, IXGBE_RAH(index)); |
1887 | rar_high &= ~(0x0000FFFF | IXGBE_RAH_AV); | 1889 | rar_high &= ~(0x0000FFFF | IXGBE_RAH_AV); |
1888 | 1890 | ||
1889 | IXGBE_WRITE_REG(hw, IXGBE_RAL(index), 0); | 1891 | IXGBE_WRITE_REG(hw, IXGBE_RAL(index), 0); |
1890 | IXGBE_WRITE_REG(hw, IXGBE_RAH(index), rar_high); | 1892 | IXGBE_WRITE_REG(hw, IXGBE_RAH(index), rar_high); |
1891 | 1893 | ||
1892 | /* clear VMDq pool/queue selection for this RAR */ | 1894 | /* clear VMDq pool/queue selection for this RAR */ |
1893 | hw->mac.ops.clear_vmdq(hw, index, IXGBE_CLEAR_VMDQ_ALL); | 1895 | hw->mac.ops.clear_vmdq(hw, index, IXGBE_CLEAR_VMDQ_ALL); |
1894 | 1896 | ||
1895 | return 0; | 1897 | return 0; |
1896 | } | 1898 | } |
1897 | 1899 | ||
1898 | /** | 1900 | /** |
1899 | * ixgbe_init_rx_addrs_generic - Initializes receive address filters. | 1901 | * ixgbe_init_rx_addrs_generic - Initializes receive address filters. |
1900 | * @hw: pointer to hardware structure | 1902 | * @hw: pointer to hardware structure |
1901 | * | 1903 | * |
1902 | * Places the MAC address in receive address register 0 and clears the rest | 1904 | * Places the MAC address in receive address register 0 and clears the rest |
1903 | * of the receive address registers. Clears the multicast table. Assumes | 1905 | * of the receive address registers. Clears the multicast table. Assumes |
1904 | * the receiver is in reset when the routine is called. | 1906 | * the receiver is in reset when the routine is called. |
1905 | **/ | 1907 | **/ |
1906 | s32 ixgbe_init_rx_addrs_generic(struct ixgbe_hw *hw) | 1908 | s32 ixgbe_init_rx_addrs_generic(struct ixgbe_hw *hw) |
1907 | { | 1909 | { |
1908 | u32 i; | 1910 | u32 i; |
1909 | u32 rar_entries = hw->mac.num_rar_entries; | 1911 | u32 rar_entries = hw->mac.num_rar_entries; |
1910 | 1912 | ||
1911 | /* | 1913 | /* |
1912 | * If the current mac address is valid, assume it is a software override | 1914 | * If the current mac address is valid, assume it is a software override |
1913 | * to the permanent address. | 1915 | * to the permanent address. |
1914 | * Otherwise, use the permanent address from the eeprom. | 1916 | * Otherwise, use the permanent address from the eeprom. |
1915 | */ | 1917 | */ |
1916 | if (!is_valid_ether_addr(hw->mac.addr)) { | 1918 | if (!is_valid_ether_addr(hw->mac.addr)) { |
1917 | /* Get the MAC address from the RAR0 for later reference */ | 1919 | /* Get the MAC address from the RAR0 for later reference */ |
1918 | hw->mac.ops.get_mac_addr(hw, hw->mac.addr); | 1920 | hw->mac.ops.get_mac_addr(hw, hw->mac.addr); |
1919 | 1921 | ||
1920 | hw_dbg(hw, " Keeping Current RAR0 Addr =%pM\n", hw->mac.addr); | 1922 | hw_dbg(hw, " Keeping Current RAR0 Addr =%pM\n", hw->mac.addr); |
1921 | } else { | 1923 | } else { |
1922 | /* Setup the receive address. */ | 1924 | /* Setup the receive address. */ |
1923 | hw_dbg(hw, "Overriding MAC Address in RAR[0]\n"); | 1925 | hw_dbg(hw, "Overriding MAC Address in RAR[0]\n"); |
1924 | hw_dbg(hw, " New MAC Addr =%pM\n", hw->mac.addr); | 1926 | hw_dbg(hw, " New MAC Addr =%pM\n", hw->mac.addr); |
1925 | 1927 | ||
1926 | hw->mac.ops.set_rar(hw, 0, hw->mac.addr, 0, IXGBE_RAH_AV); | 1928 | hw->mac.ops.set_rar(hw, 0, hw->mac.addr, 0, IXGBE_RAH_AV); |
1927 | 1929 | ||
1928 | /* clear VMDq pool/queue selection for RAR 0 */ | 1930 | /* clear VMDq pool/queue selection for RAR 0 */ |
1929 | hw->mac.ops.clear_vmdq(hw, 0, IXGBE_CLEAR_VMDQ_ALL); | 1931 | hw->mac.ops.clear_vmdq(hw, 0, IXGBE_CLEAR_VMDQ_ALL); |
1930 | } | 1932 | } |
1931 | hw->addr_ctrl.overflow_promisc = 0; | 1933 | hw->addr_ctrl.overflow_promisc = 0; |
1932 | 1934 | ||
1933 | hw->addr_ctrl.rar_used_count = 1; | 1935 | hw->addr_ctrl.rar_used_count = 1; |
1934 | 1936 | ||
1935 | /* Zero out the other receive addresses. */ | 1937 | /* Zero out the other receive addresses. */ |
1936 | hw_dbg(hw, "Clearing RAR[1-%d]\n", rar_entries - 1); | 1938 | hw_dbg(hw, "Clearing RAR[1-%d]\n", rar_entries - 1); |
1937 | for (i = 1; i < rar_entries; i++) { | 1939 | for (i = 1; i < rar_entries; i++) { |
1938 | IXGBE_WRITE_REG(hw, IXGBE_RAL(i), 0); | 1940 | IXGBE_WRITE_REG(hw, IXGBE_RAL(i), 0); |
1939 | IXGBE_WRITE_REG(hw, IXGBE_RAH(i), 0); | 1941 | IXGBE_WRITE_REG(hw, IXGBE_RAH(i), 0); |
1940 | } | 1942 | } |
1941 | 1943 | ||
1942 | /* Clear the MTA */ | 1944 | /* Clear the MTA */ |
1943 | hw->addr_ctrl.mta_in_use = 0; | 1945 | hw->addr_ctrl.mta_in_use = 0; |
1944 | IXGBE_WRITE_REG(hw, IXGBE_MCSTCTRL, hw->mac.mc_filter_type); | 1946 | IXGBE_WRITE_REG(hw, IXGBE_MCSTCTRL, hw->mac.mc_filter_type); |
1945 | 1947 | ||
1946 | hw_dbg(hw, " Clearing MTA\n"); | 1948 | hw_dbg(hw, " Clearing MTA\n"); |
1947 | for (i = 0; i < hw->mac.mcft_size; i++) | 1949 | for (i = 0; i < hw->mac.mcft_size; i++) |
1948 | IXGBE_WRITE_REG(hw, IXGBE_MTA(i), 0); | 1950 | IXGBE_WRITE_REG(hw, IXGBE_MTA(i), 0); |
1949 | 1951 | ||
1950 | if (hw->mac.ops.init_uta_tables) | 1952 | if (hw->mac.ops.init_uta_tables) |
1951 | hw->mac.ops.init_uta_tables(hw); | 1953 | hw->mac.ops.init_uta_tables(hw); |
1952 | 1954 | ||
1953 | return 0; | 1955 | return 0; |
1954 | } | 1956 | } |
1955 | 1957 | ||
1956 | /** | 1958 | /** |
1957 | * ixgbe_mta_vector - Determines bit-vector in multicast table to set | 1959 | * ixgbe_mta_vector - Determines bit-vector in multicast table to set |
1958 | * @hw: pointer to hardware structure | 1960 | * @hw: pointer to hardware structure |
1959 | * @mc_addr: the multicast address | 1961 | * @mc_addr: the multicast address |
1960 | * | 1962 | * |
1961 | * Extracts the 12 bits, from a multicast address, to determine which | 1963 | * Extracts the 12 bits, from a multicast address, to determine which |
1962 | * bit-vector to set in the multicast table. The hardware uses 12 bits, from | 1964 | * bit-vector to set in the multicast table. The hardware uses 12 bits, from |
1963 | * incoming rx multicast addresses, to determine the bit-vector to check in | 1965 | * incoming rx multicast addresses, to determine the bit-vector to check in |
1964 | * the MTA. Which of the 4 combination, of 12-bits, the hardware uses is set | 1966 | * the MTA. Which of the 4 combination, of 12-bits, the hardware uses is set |
1965 | * by the MO field of the MCSTCTRL. The MO field is set during initialization | 1967 | * by the MO field of the MCSTCTRL. The MO field is set during initialization |
1966 | * to mc_filter_type. | 1968 | * to mc_filter_type. |
1967 | **/ | 1969 | **/ |
1968 | static s32 ixgbe_mta_vector(struct ixgbe_hw *hw, u8 *mc_addr) | 1970 | static s32 ixgbe_mta_vector(struct ixgbe_hw *hw, u8 *mc_addr) |
1969 | { | 1971 | { |
1970 | u32 vector = 0; | 1972 | u32 vector = 0; |
1971 | 1973 | ||
1972 | switch (hw->mac.mc_filter_type) { | 1974 | switch (hw->mac.mc_filter_type) { |
1973 | case 0: /* use bits [47:36] of the address */ | 1975 | case 0: /* use bits [47:36] of the address */ |
1974 | vector = ((mc_addr[4] >> 4) | (((u16)mc_addr[5]) << 4)); | 1976 | vector = ((mc_addr[4] >> 4) | (((u16)mc_addr[5]) << 4)); |
1975 | break; | 1977 | break; |
1976 | case 1: /* use bits [46:35] of the address */ | 1978 | case 1: /* use bits [46:35] of the address */ |
1977 | vector = ((mc_addr[4] >> 3) | (((u16)mc_addr[5]) << 5)); | 1979 | vector = ((mc_addr[4] >> 3) | (((u16)mc_addr[5]) << 5)); |
1978 | break; | 1980 | break; |
1979 | case 2: /* use bits [45:34] of the address */ | 1981 | case 2: /* use bits [45:34] of the address */ |
1980 | vector = ((mc_addr[4] >> 2) | (((u16)mc_addr[5]) << 6)); | 1982 | vector = ((mc_addr[4] >> 2) | (((u16)mc_addr[5]) << 6)); |
1981 | break; | 1983 | break; |
1982 | case 3: /* use bits [43:32] of the address */ | 1984 | case 3: /* use bits [43:32] of the address */ |
1983 | vector = ((mc_addr[4]) | (((u16)mc_addr[5]) << 8)); | 1985 | vector = ((mc_addr[4]) | (((u16)mc_addr[5]) << 8)); |
1984 | break; | 1986 | break; |
1985 | default: /* Invalid mc_filter_type */ | 1987 | default: /* Invalid mc_filter_type */ |
1986 | hw_dbg(hw, "MC filter type param set incorrectly\n"); | 1988 | hw_dbg(hw, "MC filter type param set incorrectly\n"); |
1987 | break; | 1989 | break; |
1988 | } | 1990 | } |
1989 | 1991 | ||
1990 | /* vector can only be 12-bits or boundary will be exceeded */ | 1992 | /* vector can only be 12-bits or boundary will be exceeded */ |
1991 | vector &= 0xFFF; | 1993 | vector &= 0xFFF; |
1992 | return vector; | 1994 | return vector; |
1993 | } | 1995 | } |
1994 | 1996 | ||
1995 | /** | 1997 | /** |
1996 | * ixgbe_set_mta - Set bit-vector in multicast table | 1998 | * ixgbe_set_mta - Set bit-vector in multicast table |
1997 | * @hw: pointer to hardware structure | 1999 | * @hw: pointer to hardware structure |
1998 | * @hash_value: Multicast address hash value | 2000 | * @hash_value: Multicast address hash value |
1999 | * | 2001 | * |
2000 | * Sets the bit-vector in the multicast table. | 2002 | * Sets the bit-vector in the multicast table. |
2001 | **/ | 2003 | **/ |
2002 | static void ixgbe_set_mta(struct ixgbe_hw *hw, u8 *mc_addr) | 2004 | static void ixgbe_set_mta(struct ixgbe_hw *hw, u8 *mc_addr) |
2003 | { | 2005 | { |
2004 | u32 vector; | 2006 | u32 vector; |
2005 | u32 vector_bit; | 2007 | u32 vector_bit; |
2006 | u32 vector_reg; | 2008 | u32 vector_reg; |
2007 | 2009 | ||
2008 | hw->addr_ctrl.mta_in_use++; | 2010 | hw->addr_ctrl.mta_in_use++; |
2009 | 2011 | ||
2010 | vector = ixgbe_mta_vector(hw, mc_addr); | 2012 | vector = ixgbe_mta_vector(hw, mc_addr); |
2011 | hw_dbg(hw, " bit-vector = 0x%03X\n", vector); | 2013 | hw_dbg(hw, " bit-vector = 0x%03X\n", vector); |
2012 | 2014 | ||
2013 | /* | 2015 | /* |
2014 | * The MTA is a register array of 128 32-bit registers. It is treated | 2016 | * The MTA is a register array of 128 32-bit registers. It is treated |
2015 | * like an array of 4096 bits. We want to set bit | 2017 | * like an array of 4096 bits. We want to set bit |
2016 | * BitArray[vector_value]. So we figure out what register the bit is | 2018 | * BitArray[vector_value]. So we figure out what register the bit is |
2017 | * in, read it, OR in the new bit, then write back the new value. The | 2019 | * in, read it, OR in the new bit, then write back the new value. The |
2018 | * register is determined by the upper 7 bits of the vector value and | 2020 | * register is determined by the upper 7 bits of the vector value and |
2019 | * the bit within that register are determined by the lower 5 bits of | 2021 | * the bit within that register are determined by the lower 5 bits of |
2020 | * the value. | 2022 | * the value. |
2021 | */ | 2023 | */ |
2022 | vector_reg = (vector >> 5) & 0x7F; | 2024 | vector_reg = (vector >> 5) & 0x7F; |
2023 | vector_bit = vector & 0x1F; | 2025 | vector_bit = vector & 0x1F; |
2024 | hw->mac.mta_shadow[vector_reg] |= (1 << vector_bit); | 2026 | hw->mac.mta_shadow[vector_reg] |= (1 << vector_bit); |
2025 | } | 2027 | } |
2026 | 2028 | ||
2027 | /** | 2029 | /** |
2028 | * ixgbe_update_mc_addr_list_generic - Updates MAC list of multicast addresses | 2030 | * ixgbe_update_mc_addr_list_generic - Updates MAC list of multicast addresses |
2029 | * @hw: pointer to hardware structure | 2031 | * @hw: pointer to hardware structure |
2030 | * @netdev: pointer to net device structure | 2032 | * @netdev: pointer to net device structure |
2031 | * | 2033 | * |
2032 | * The given list replaces any existing list. Clears the MC addrs from receive | 2034 | * The given list replaces any existing list. Clears the MC addrs from receive |
2033 | * address registers and the multicast table. Uses unused receive address | 2035 | * address registers and the multicast table. Uses unused receive address |
2034 | * registers for the first multicast addresses, and hashes the rest into the | 2036 | * registers for the first multicast addresses, and hashes the rest into the |
2035 | * multicast table. | 2037 | * multicast table. |
2036 | **/ | 2038 | **/ |
2037 | s32 ixgbe_update_mc_addr_list_generic(struct ixgbe_hw *hw, | 2039 | s32 ixgbe_update_mc_addr_list_generic(struct ixgbe_hw *hw, |
2038 | struct net_device *netdev) | 2040 | struct net_device *netdev) |
2039 | { | 2041 | { |
2040 | struct netdev_hw_addr *ha; | 2042 | struct netdev_hw_addr *ha; |
2041 | u32 i; | 2043 | u32 i; |
2042 | 2044 | ||
2043 | /* | 2045 | /* |
2044 | * Set the new number of MC addresses that we are being requested to | 2046 | * Set the new number of MC addresses that we are being requested to |
2045 | * use. | 2047 | * use. |
2046 | */ | 2048 | */ |
2047 | hw->addr_ctrl.num_mc_addrs = netdev_mc_count(netdev); | 2049 | hw->addr_ctrl.num_mc_addrs = netdev_mc_count(netdev); |
2048 | hw->addr_ctrl.mta_in_use = 0; | 2050 | hw->addr_ctrl.mta_in_use = 0; |
2049 | 2051 | ||
2050 | /* Clear mta_shadow */ | 2052 | /* Clear mta_shadow */ |
2051 | hw_dbg(hw, " Clearing MTA\n"); | 2053 | hw_dbg(hw, " Clearing MTA\n"); |
2052 | memset(&hw->mac.mta_shadow, 0, sizeof(hw->mac.mta_shadow)); | 2054 | memset(&hw->mac.mta_shadow, 0, sizeof(hw->mac.mta_shadow)); |
2053 | 2055 | ||
2054 | /* Update mta shadow */ | 2056 | /* Update mta shadow */ |
2055 | netdev_for_each_mc_addr(ha, netdev) { | 2057 | netdev_for_each_mc_addr(ha, netdev) { |
2056 | hw_dbg(hw, " Adding the multicast addresses:\n"); | 2058 | hw_dbg(hw, " Adding the multicast addresses:\n"); |
2057 | ixgbe_set_mta(hw, ha->addr); | 2059 | ixgbe_set_mta(hw, ha->addr); |
2058 | } | 2060 | } |
2059 | 2061 | ||
2060 | /* Enable mta */ | 2062 | /* Enable mta */ |
2061 | for (i = 0; i < hw->mac.mcft_size; i++) | 2063 | for (i = 0; i < hw->mac.mcft_size; i++) |
2062 | IXGBE_WRITE_REG_ARRAY(hw, IXGBE_MTA(0), i, | 2064 | IXGBE_WRITE_REG_ARRAY(hw, IXGBE_MTA(0), i, |
2063 | hw->mac.mta_shadow[i]); | 2065 | hw->mac.mta_shadow[i]); |
2064 | 2066 | ||
2065 | if (hw->addr_ctrl.mta_in_use > 0) | 2067 | if (hw->addr_ctrl.mta_in_use > 0) |
2066 | IXGBE_WRITE_REG(hw, IXGBE_MCSTCTRL, | 2068 | IXGBE_WRITE_REG(hw, IXGBE_MCSTCTRL, |
2067 | IXGBE_MCSTCTRL_MFE | hw->mac.mc_filter_type); | 2069 | IXGBE_MCSTCTRL_MFE | hw->mac.mc_filter_type); |
2068 | 2070 | ||
2069 | hw_dbg(hw, "ixgbe_update_mc_addr_list_generic Complete\n"); | 2071 | hw_dbg(hw, "ixgbe_update_mc_addr_list_generic Complete\n"); |
2070 | return 0; | 2072 | return 0; |
2071 | } | 2073 | } |
2072 | 2074 | ||
2073 | /** | 2075 | /** |
2074 | * ixgbe_enable_mc_generic - Enable multicast address in RAR | 2076 | * ixgbe_enable_mc_generic - Enable multicast address in RAR |
2075 | * @hw: pointer to hardware structure | 2077 | * @hw: pointer to hardware structure |
2076 | * | 2078 | * |
2077 | * Enables multicast address in RAR and the use of the multicast hash table. | 2079 | * Enables multicast address in RAR and the use of the multicast hash table. |
2078 | **/ | 2080 | **/ |
2079 | s32 ixgbe_enable_mc_generic(struct ixgbe_hw *hw) | 2081 | s32 ixgbe_enable_mc_generic(struct ixgbe_hw *hw) |
2080 | { | 2082 | { |
2081 | struct ixgbe_addr_filter_info *a = &hw->addr_ctrl; | 2083 | struct ixgbe_addr_filter_info *a = &hw->addr_ctrl; |
2082 | 2084 | ||
2083 | if (a->mta_in_use > 0) | 2085 | if (a->mta_in_use > 0) |
2084 | IXGBE_WRITE_REG(hw, IXGBE_MCSTCTRL, IXGBE_MCSTCTRL_MFE | | 2086 | IXGBE_WRITE_REG(hw, IXGBE_MCSTCTRL, IXGBE_MCSTCTRL_MFE | |
2085 | hw->mac.mc_filter_type); | 2087 | hw->mac.mc_filter_type); |
2086 | 2088 | ||
2087 | return 0; | 2089 | return 0; |
2088 | } | 2090 | } |
2089 | 2091 | ||
2090 | /** | 2092 | /** |
2091 | * ixgbe_disable_mc_generic - Disable multicast address in RAR | 2093 | * ixgbe_disable_mc_generic - Disable multicast address in RAR |
2092 | * @hw: pointer to hardware structure | 2094 | * @hw: pointer to hardware structure |
2093 | * | 2095 | * |
2094 | * Disables multicast address in RAR and the use of the multicast hash table. | 2096 | * Disables multicast address in RAR and the use of the multicast hash table. |
2095 | **/ | 2097 | **/ |
2096 | s32 ixgbe_disable_mc_generic(struct ixgbe_hw *hw) | 2098 | s32 ixgbe_disable_mc_generic(struct ixgbe_hw *hw) |
2097 | { | 2099 | { |
2098 | struct ixgbe_addr_filter_info *a = &hw->addr_ctrl; | 2100 | struct ixgbe_addr_filter_info *a = &hw->addr_ctrl; |
2099 | 2101 | ||
2100 | if (a->mta_in_use > 0) | 2102 | if (a->mta_in_use > 0) |
2101 | IXGBE_WRITE_REG(hw, IXGBE_MCSTCTRL, hw->mac.mc_filter_type); | 2103 | IXGBE_WRITE_REG(hw, IXGBE_MCSTCTRL, hw->mac.mc_filter_type); |
2102 | 2104 | ||
2103 | return 0; | 2105 | return 0; |
2104 | } | 2106 | } |
2105 | 2107 | ||
2106 | /** | 2108 | /** |
2107 | * ixgbe_fc_enable_generic - Enable flow control | 2109 | * ixgbe_fc_enable_generic - Enable flow control |
2108 | * @hw: pointer to hardware structure | 2110 | * @hw: pointer to hardware structure |
2109 | * | 2111 | * |
2110 | * Enable flow control according to the current settings. | 2112 | * Enable flow control according to the current settings. |
2111 | **/ | 2113 | **/ |
2112 | s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw) | 2114 | s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw) |
2113 | { | 2115 | { |
2114 | s32 ret_val = 0; | 2116 | s32 ret_val = 0; |
2115 | u32 mflcn_reg, fccfg_reg; | 2117 | u32 mflcn_reg, fccfg_reg; |
2116 | u32 reg; | 2118 | u32 reg; |
2117 | u32 fcrtl, fcrth; | 2119 | u32 fcrtl, fcrth; |
2118 | int i; | 2120 | int i; |
2119 | 2121 | ||
2120 | /* | 2122 | /* |
2121 | * Validate the water mark configuration for packet buffer 0. Zero | 2123 | * Validate the water mark configuration for packet buffer 0. Zero |
2122 | * water marks indicate that the packet buffer was not configured | 2124 | * water marks indicate that the packet buffer was not configured |
2123 | * and the watermarks for packet buffer 0 should always be configured. | 2125 | * and the watermarks for packet buffer 0 should always be configured. |
2124 | */ | 2126 | */ |
2125 | if (!hw->fc.low_water || | 2127 | if (!hw->fc.low_water || |
2126 | !hw->fc.high_water[0] || | 2128 | !hw->fc.high_water[0] || |
2127 | !hw->fc.pause_time) { | 2129 | !hw->fc.pause_time) { |
2128 | hw_dbg(hw, "Invalid water mark configuration\n"); | 2130 | hw_dbg(hw, "Invalid water mark configuration\n"); |
2129 | ret_val = IXGBE_ERR_INVALID_LINK_SETTINGS; | 2131 | ret_val = IXGBE_ERR_INVALID_LINK_SETTINGS; |
2130 | goto out; | 2132 | goto out; |
2131 | } | 2133 | } |
2132 | 2134 | ||
2133 | /* Negotiate the fc mode to use */ | 2135 | /* Negotiate the fc mode to use */ |
2134 | ixgbe_fc_autoneg(hw); | 2136 | ixgbe_fc_autoneg(hw); |
2135 | 2137 | ||
2136 | /* Disable any previous flow control settings */ | 2138 | /* Disable any previous flow control settings */ |
2137 | mflcn_reg = IXGBE_READ_REG(hw, IXGBE_MFLCN); | 2139 | mflcn_reg = IXGBE_READ_REG(hw, IXGBE_MFLCN); |
2138 | mflcn_reg &= ~(IXGBE_MFLCN_RPFCE_MASK | IXGBE_MFLCN_RFCE); | 2140 | mflcn_reg &= ~(IXGBE_MFLCN_RPFCE_MASK | IXGBE_MFLCN_RFCE); |
2139 | 2141 | ||
2140 | fccfg_reg = IXGBE_READ_REG(hw, IXGBE_FCCFG); | 2142 | fccfg_reg = IXGBE_READ_REG(hw, IXGBE_FCCFG); |
2141 | fccfg_reg &= ~(IXGBE_FCCFG_TFCE_802_3X | IXGBE_FCCFG_TFCE_PRIORITY); | 2143 | fccfg_reg &= ~(IXGBE_FCCFG_TFCE_802_3X | IXGBE_FCCFG_TFCE_PRIORITY); |
2142 | 2144 | ||
2143 | /* | 2145 | /* |
2144 | * The possible values of fc.current_mode are: | 2146 | * The possible values of fc.current_mode are: |
2145 | * 0: Flow control is completely disabled | 2147 | * 0: Flow control is completely disabled |
2146 | * 1: Rx flow control is enabled (we can receive pause frames, | 2148 | * 1: Rx flow control is enabled (we can receive pause frames, |
2147 | * but not send pause frames). | 2149 | * but not send pause frames). |
2148 | * 2: Tx flow control is enabled (we can send pause frames but | 2150 | * 2: Tx flow control is enabled (we can send pause frames but |
2149 | * we do not support receiving pause frames). | 2151 | * we do not support receiving pause frames). |
2150 | * 3: Both Rx and Tx flow control (symmetric) are enabled. | 2152 | * 3: Both Rx and Tx flow control (symmetric) are enabled. |
2151 | * other: Invalid. | 2153 | * other: Invalid. |
2152 | */ | 2154 | */ |
2153 | switch (hw->fc.current_mode) { | 2155 | switch (hw->fc.current_mode) { |
2154 | case ixgbe_fc_none: | 2156 | case ixgbe_fc_none: |
2155 | /* | 2157 | /* |
2156 | * Flow control is disabled by software override or autoneg. | 2158 | * Flow control is disabled by software override or autoneg. |
2157 | * The code below will actually disable it in the HW. | 2159 | * The code below will actually disable it in the HW. |
2158 | */ | 2160 | */ |
2159 | break; | 2161 | break; |
2160 | case ixgbe_fc_rx_pause: | 2162 | case ixgbe_fc_rx_pause: |
2161 | /* | 2163 | /* |
2162 | * Rx Flow control is enabled and Tx Flow control is | 2164 | * Rx Flow control is enabled and Tx Flow control is |
2163 | * disabled by software override. Since there really | 2165 | * disabled by software override. Since there really |
2164 | * isn't a way to advertise that we are capable of RX | 2166 | * isn't a way to advertise that we are capable of RX |
2165 | * Pause ONLY, we will advertise that we support both | 2167 | * Pause ONLY, we will advertise that we support both |
2166 | * symmetric and asymmetric Rx PAUSE. Later, we will | 2168 | * symmetric and asymmetric Rx PAUSE. Later, we will |
2167 | * disable the adapter's ability to send PAUSE frames. | 2169 | * disable the adapter's ability to send PAUSE frames. |
2168 | */ | 2170 | */ |
2169 | mflcn_reg |= IXGBE_MFLCN_RFCE; | 2171 | mflcn_reg |= IXGBE_MFLCN_RFCE; |
2170 | break; | 2172 | break; |
2171 | case ixgbe_fc_tx_pause: | 2173 | case ixgbe_fc_tx_pause: |
2172 | /* | 2174 | /* |
2173 | * Tx Flow control is enabled, and Rx Flow control is | 2175 | * Tx Flow control is enabled, and Rx Flow control is |
2174 | * disabled by software override. | 2176 | * disabled by software override. |
2175 | */ | 2177 | */ |
2176 | fccfg_reg |= IXGBE_FCCFG_TFCE_802_3X; | 2178 | fccfg_reg |= IXGBE_FCCFG_TFCE_802_3X; |
2177 | break; | 2179 | break; |
2178 | case ixgbe_fc_full: | 2180 | case ixgbe_fc_full: |
2179 | /* Flow control (both Rx and Tx) is enabled by SW override. */ | 2181 | /* Flow control (both Rx and Tx) is enabled by SW override. */ |
2180 | mflcn_reg |= IXGBE_MFLCN_RFCE; | 2182 | mflcn_reg |= IXGBE_MFLCN_RFCE; |
2181 | fccfg_reg |= IXGBE_FCCFG_TFCE_802_3X; | 2183 | fccfg_reg |= IXGBE_FCCFG_TFCE_802_3X; |
2182 | break; | 2184 | break; |
2183 | default: | 2185 | default: |
2184 | hw_dbg(hw, "Flow control param set incorrectly\n"); | 2186 | hw_dbg(hw, "Flow control param set incorrectly\n"); |
2185 | ret_val = IXGBE_ERR_CONFIG; | 2187 | ret_val = IXGBE_ERR_CONFIG; |
2186 | goto out; | 2188 | goto out; |
2187 | break; | 2189 | break; |
2188 | } | 2190 | } |
2189 | 2191 | ||
2190 | /* Set 802.3x based flow control settings. */ | 2192 | /* Set 802.3x based flow control settings. */ |
2191 | mflcn_reg |= IXGBE_MFLCN_DPF; | 2193 | mflcn_reg |= IXGBE_MFLCN_DPF; |
2192 | IXGBE_WRITE_REG(hw, IXGBE_MFLCN, mflcn_reg); | 2194 | IXGBE_WRITE_REG(hw, IXGBE_MFLCN, mflcn_reg); |
2193 | IXGBE_WRITE_REG(hw, IXGBE_FCCFG, fccfg_reg); | 2195 | IXGBE_WRITE_REG(hw, IXGBE_FCCFG, fccfg_reg); |
2194 | 2196 | ||
2195 | fcrtl = (hw->fc.low_water << 10) | IXGBE_FCRTL_XONE; | 2197 | fcrtl = (hw->fc.low_water << 10) | IXGBE_FCRTL_XONE; |
2196 | 2198 | ||
2197 | /* Set up and enable Rx high/low water mark thresholds, enable XON. */ | 2199 | /* Set up and enable Rx high/low water mark thresholds, enable XON. */ |
2198 | for (i = 0; i < MAX_TRAFFIC_CLASS; i++) { | 2200 | for (i = 0; i < MAX_TRAFFIC_CLASS; i++) { |
2199 | if ((hw->fc.current_mode & ixgbe_fc_tx_pause) && | 2201 | if ((hw->fc.current_mode & ixgbe_fc_tx_pause) && |
2200 | hw->fc.high_water[i]) { | 2202 | hw->fc.high_water[i]) { |
2201 | IXGBE_WRITE_REG(hw, IXGBE_FCRTL_82599(i), fcrtl); | 2203 | IXGBE_WRITE_REG(hw, IXGBE_FCRTL_82599(i), fcrtl); |
2202 | fcrth = (hw->fc.high_water[i] << 10) | IXGBE_FCRTH_FCEN; | 2204 | fcrth = (hw->fc.high_water[i] << 10) | IXGBE_FCRTH_FCEN; |
2203 | } else { | 2205 | } else { |
2204 | IXGBE_WRITE_REG(hw, IXGBE_FCRTL_82599(i), 0); | 2206 | IXGBE_WRITE_REG(hw, IXGBE_FCRTL_82599(i), 0); |
2205 | /* | 2207 | /* |
2206 | * In order to prevent Tx hangs when the internal Tx | 2208 | * In order to prevent Tx hangs when the internal Tx |
2207 | * switch is enabled we must set the high water mark | 2209 | * switch is enabled we must set the high water mark |
2208 | * to the maximum FCRTH value. This allows the Tx | 2210 | * to the maximum FCRTH value. This allows the Tx |
2209 | * switch to function even under heavy Rx workloads. | 2211 | * switch to function even under heavy Rx workloads. |
2210 | */ | 2212 | */ |
2211 | fcrth = IXGBE_READ_REG(hw, IXGBE_RXPBSIZE(i)) - 32; | 2213 | fcrth = IXGBE_READ_REG(hw, IXGBE_RXPBSIZE(i)) - 32; |
2212 | } | 2214 | } |
2213 | 2215 | ||
2214 | IXGBE_WRITE_REG(hw, IXGBE_FCRTH_82599(i), fcrth); | 2216 | IXGBE_WRITE_REG(hw, IXGBE_FCRTH_82599(i), fcrth); |
2215 | } | 2217 | } |
2216 | 2218 | ||
2217 | /* Configure pause time (2 TCs per register) */ | 2219 | /* Configure pause time (2 TCs per register) */ |
2218 | reg = hw->fc.pause_time * 0x00010001; | 2220 | reg = hw->fc.pause_time * 0x00010001; |
2219 | for (i = 0; i < (MAX_TRAFFIC_CLASS / 2); i++) | 2221 | for (i = 0; i < (MAX_TRAFFIC_CLASS / 2); i++) |
2220 | IXGBE_WRITE_REG(hw, IXGBE_FCTTV(i), reg); | 2222 | IXGBE_WRITE_REG(hw, IXGBE_FCTTV(i), reg); |
2221 | 2223 | ||
2222 | IXGBE_WRITE_REG(hw, IXGBE_FCRTV, hw->fc.pause_time / 2); | 2224 | IXGBE_WRITE_REG(hw, IXGBE_FCRTV, hw->fc.pause_time / 2); |
2223 | 2225 | ||
2224 | out: | 2226 | out: |
2225 | return ret_val; | 2227 | return ret_val; |
2226 | } | 2228 | } |
2227 | 2229 | ||
2228 | /** | 2230 | /** |
2229 | * ixgbe_negotiate_fc - Negotiate flow control | 2231 | * ixgbe_negotiate_fc - Negotiate flow control |
2230 | * @hw: pointer to hardware structure | 2232 | * @hw: pointer to hardware structure |
2231 | * @adv_reg: flow control advertised settings | 2233 | * @adv_reg: flow control advertised settings |
2232 | * @lp_reg: link partner's flow control settings | 2234 | * @lp_reg: link partner's flow control settings |
2233 | * @adv_sym: symmetric pause bit in advertisement | 2235 | * @adv_sym: symmetric pause bit in advertisement |
2234 | * @adv_asm: asymmetric pause bit in advertisement | 2236 | * @adv_asm: asymmetric pause bit in advertisement |
2235 | * @lp_sym: symmetric pause bit in link partner advertisement | 2237 | * @lp_sym: symmetric pause bit in link partner advertisement |
2236 | * @lp_asm: asymmetric pause bit in link partner advertisement | 2238 | * @lp_asm: asymmetric pause bit in link partner advertisement |
2237 | * | 2239 | * |
2238 | * Find the intersection between advertised settings and link partner's | 2240 | * Find the intersection between advertised settings and link partner's |
2239 | * advertised settings | 2241 | * advertised settings |
2240 | **/ | 2242 | **/ |
2241 | static s32 ixgbe_negotiate_fc(struct ixgbe_hw *hw, u32 adv_reg, u32 lp_reg, | 2243 | static s32 ixgbe_negotiate_fc(struct ixgbe_hw *hw, u32 adv_reg, u32 lp_reg, |
2242 | u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm) | 2244 | u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm) |
2243 | { | 2245 | { |
2244 | if ((!(adv_reg)) || (!(lp_reg))) | 2246 | if ((!(adv_reg)) || (!(lp_reg))) |
2245 | return IXGBE_ERR_FC_NOT_NEGOTIATED; | 2247 | return IXGBE_ERR_FC_NOT_NEGOTIATED; |
2246 | 2248 | ||
2247 | if ((adv_reg & adv_sym) && (lp_reg & lp_sym)) { | 2249 | if ((adv_reg & adv_sym) && (lp_reg & lp_sym)) { |
2248 | /* | 2250 | /* |
2249 | * Now we need to check if the user selected Rx ONLY | 2251 | * Now we need to check if the user selected Rx ONLY |
2250 | * of pause frames. In this case, we had to advertise | 2252 | * of pause frames. In this case, we had to advertise |
2251 | * FULL flow control because we could not advertise RX | 2253 | * FULL flow control because we could not advertise RX |
2252 | * ONLY. Hence, we must now check to see if we need to | 2254 | * ONLY. Hence, we must now check to see if we need to |
2253 | * turn OFF the TRANSMISSION of PAUSE frames. | 2255 | * turn OFF the TRANSMISSION of PAUSE frames. |
2254 | */ | 2256 | */ |
2255 | if (hw->fc.requested_mode == ixgbe_fc_full) { | 2257 | if (hw->fc.requested_mode == ixgbe_fc_full) { |
2256 | hw->fc.current_mode = ixgbe_fc_full; | 2258 | hw->fc.current_mode = ixgbe_fc_full; |
2257 | hw_dbg(hw, "Flow Control = FULL.\n"); | 2259 | hw_dbg(hw, "Flow Control = FULL.\n"); |
2258 | } else { | 2260 | } else { |
2259 | hw->fc.current_mode = ixgbe_fc_rx_pause; | 2261 | hw->fc.current_mode = ixgbe_fc_rx_pause; |
2260 | hw_dbg(hw, "Flow Control=RX PAUSE frames only\n"); | 2262 | hw_dbg(hw, "Flow Control=RX PAUSE frames only\n"); |
2261 | } | 2263 | } |
2262 | } else if (!(adv_reg & adv_sym) && (adv_reg & adv_asm) && | 2264 | } else if (!(adv_reg & adv_sym) && (adv_reg & adv_asm) && |
2263 | (lp_reg & lp_sym) && (lp_reg & lp_asm)) { | 2265 | (lp_reg & lp_sym) && (lp_reg & lp_asm)) { |
2264 | hw->fc.current_mode = ixgbe_fc_tx_pause; | 2266 | hw->fc.current_mode = ixgbe_fc_tx_pause; |
2265 | hw_dbg(hw, "Flow Control = TX PAUSE frames only.\n"); | 2267 | hw_dbg(hw, "Flow Control = TX PAUSE frames only.\n"); |
2266 | } else if ((adv_reg & adv_sym) && (adv_reg & adv_asm) && | 2268 | } else if ((adv_reg & adv_sym) && (adv_reg & adv_asm) && |
2267 | !(lp_reg & lp_sym) && (lp_reg & lp_asm)) { | 2269 | !(lp_reg & lp_sym) && (lp_reg & lp_asm)) { |
2268 | hw->fc.current_mode = ixgbe_fc_rx_pause; | 2270 | hw->fc.current_mode = ixgbe_fc_rx_pause; |
2269 | hw_dbg(hw, "Flow Control = RX PAUSE frames only.\n"); | 2271 | hw_dbg(hw, "Flow Control = RX PAUSE frames only.\n"); |
2270 | } else { | 2272 | } else { |
2271 | hw->fc.current_mode = ixgbe_fc_none; | 2273 | hw->fc.current_mode = ixgbe_fc_none; |
2272 | hw_dbg(hw, "Flow Control = NONE.\n"); | 2274 | hw_dbg(hw, "Flow Control = NONE.\n"); |
2273 | } | 2275 | } |
2274 | return 0; | 2276 | return 0; |
2275 | } | 2277 | } |
2276 | 2278 | ||
2277 | /** | 2279 | /** |
2278 | * ixgbe_fc_autoneg_fiber - Enable flow control on 1 gig fiber | 2280 | * ixgbe_fc_autoneg_fiber - Enable flow control on 1 gig fiber |
2279 | * @hw: pointer to hardware structure | 2281 | * @hw: pointer to hardware structure |
2280 | * | 2282 | * |
2281 | * Enable flow control according on 1 gig fiber. | 2283 | * Enable flow control according on 1 gig fiber. |
2282 | **/ | 2284 | **/ |
2283 | static s32 ixgbe_fc_autoneg_fiber(struct ixgbe_hw *hw) | 2285 | static s32 ixgbe_fc_autoneg_fiber(struct ixgbe_hw *hw) |
2284 | { | 2286 | { |
2285 | u32 pcs_anadv_reg, pcs_lpab_reg, linkstat; | 2287 | u32 pcs_anadv_reg, pcs_lpab_reg, linkstat; |
2286 | s32 ret_val = IXGBE_ERR_FC_NOT_NEGOTIATED; | 2288 | s32 ret_val = IXGBE_ERR_FC_NOT_NEGOTIATED; |
2287 | 2289 | ||
2288 | /* | 2290 | /* |
2289 | * On multispeed fiber at 1g, bail out if | 2291 | * On multispeed fiber at 1g, bail out if |
2290 | * - link is up but AN did not complete, or if | 2292 | * - link is up but AN did not complete, or if |
2291 | * - link is up and AN completed but timed out | 2293 | * - link is up and AN completed but timed out |
2292 | */ | 2294 | */ |
2293 | 2295 | ||
2294 | linkstat = IXGBE_READ_REG(hw, IXGBE_PCS1GLSTA); | 2296 | linkstat = IXGBE_READ_REG(hw, IXGBE_PCS1GLSTA); |
2295 | if ((!!(linkstat & IXGBE_PCS1GLSTA_AN_COMPLETE) == 0) || | 2297 | if ((!!(linkstat & IXGBE_PCS1GLSTA_AN_COMPLETE) == 0) || |
2296 | (!!(linkstat & IXGBE_PCS1GLSTA_AN_TIMED_OUT) == 1)) | 2298 | (!!(linkstat & IXGBE_PCS1GLSTA_AN_TIMED_OUT) == 1)) |
2297 | goto out; | 2299 | goto out; |
2298 | 2300 | ||
2299 | pcs_anadv_reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANA); | 2301 | pcs_anadv_reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANA); |
2300 | pcs_lpab_reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANLP); | 2302 | pcs_lpab_reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANLP); |
2301 | 2303 | ||
2302 | ret_val = ixgbe_negotiate_fc(hw, pcs_anadv_reg, | 2304 | ret_val = ixgbe_negotiate_fc(hw, pcs_anadv_reg, |
2303 | pcs_lpab_reg, IXGBE_PCS1GANA_SYM_PAUSE, | 2305 | pcs_lpab_reg, IXGBE_PCS1GANA_SYM_PAUSE, |
2304 | IXGBE_PCS1GANA_ASM_PAUSE, | 2306 | IXGBE_PCS1GANA_ASM_PAUSE, |
2305 | IXGBE_PCS1GANA_SYM_PAUSE, | 2307 | IXGBE_PCS1GANA_SYM_PAUSE, |
2306 | IXGBE_PCS1GANA_ASM_PAUSE); | 2308 | IXGBE_PCS1GANA_ASM_PAUSE); |
2307 | 2309 | ||
2308 | out: | 2310 | out: |
2309 | return ret_val; | 2311 | return ret_val; |
2310 | } | 2312 | } |
2311 | 2313 | ||
2312 | /** | 2314 | /** |
2313 | * ixgbe_fc_autoneg_backplane - Enable flow control IEEE clause 37 | 2315 | * ixgbe_fc_autoneg_backplane - Enable flow control IEEE clause 37 |
2314 | * @hw: pointer to hardware structure | 2316 | * @hw: pointer to hardware structure |
2315 | * | 2317 | * |
2316 | * Enable flow control according to IEEE clause 37. | 2318 | * Enable flow control according to IEEE clause 37. |
2317 | **/ | 2319 | **/ |
2318 | static s32 ixgbe_fc_autoneg_backplane(struct ixgbe_hw *hw) | 2320 | static s32 ixgbe_fc_autoneg_backplane(struct ixgbe_hw *hw) |
2319 | { | 2321 | { |
2320 | u32 links2, anlp1_reg, autoc_reg, links; | 2322 | u32 links2, anlp1_reg, autoc_reg, links; |
2321 | s32 ret_val = IXGBE_ERR_FC_NOT_NEGOTIATED; | 2323 | s32 ret_val = IXGBE_ERR_FC_NOT_NEGOTIATED; |
2322 | 2324 | ||
2323 | /* | 2325 | /* |
2324 | * On backplane, bail out if | 2326 | * On backplane, bail out if |
2325 | * - backplane autoneg was not completed, or if | 2327 | * - backplane autoneg was not completed, or if |
2326 | * - we are 82599 and link partner is not AN enabled | 2328 | * - we are 82599 and link partner is not AN enabled |
2327 | */ | 2329 | */ |
2328 | links = IXGBE_READ_REG(hw, IXGBE_LINKS); | 2330 | links = IXGBE_READ_REG(hw, IXGBE_LINKS); |
2329 | if ((links & IXGBE_LINKS_KX_AN_COMP) == 0) | 2331 | if ((links & IXGBE_LINKS_KX_AN_COMP) == 0) |
2330 | goto out; | 2332 | goto out; |
2331 | 2333 | ||
2332 | if (hw->mac.type == ixgbe_mac_82599EB) { | 2334 | if (hw->mac.type == ixgbe_mac_82599EB) { |
2333 | links2 = IXGBE_READ_REG(hw, IXGBE_LINKS2); | 2335 | links2 = IXGBE_READ_REG(hw, IXGBE_LINKS2); |
2334 | if ((links2 & IXGBE_LINKS2_AN_SUPPORTED) == 0) | 2336 | if ((links2 & IXGBE_LINKS2_AN_SUPPORTED) == 0) |
2335 | goto out; | 2337 | goto out; |
2336 | } | 2338 | } |
2337 | /* | 2339 | /* |
2338 | * Read the 10g AN autoc and LP ability registers and resolve | 2340 | * Read the 10g AN autoc and LP ability registers and resolve |
2339 | * local flow control settings accordingly | 2341 | * local flow control settings accordingly |
2340 | */ | 2342 | */ |
2341 | autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC); | 2343 | autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC); |
2342 | anlp1_reg = IXGBE_READ_REG(hw, IXGBE_ANLP1); | 2344 | anlp1_reg = IXGBE_READ_REG(hw, IXGBE_ANLP1); |
2343 | 2345 | ||
2344 | ret_val = ixgbe_negotiate_fc(hw, autoc_reg, | 2346 | ret_val = ixgbe_negotiate_fc(hw, autoc_reg, |
2345 | anlp1_reg, IXGBE_AUTOC_SYM_PAUSE, IXGBE_AUTOC_ASM_PAUSE, | 2347 | anlp1_reg, IXGBE_AUTOC_SYM_PAUSE, IXGBE_AUTOC_ASM_PAUSE, |
2346 | IXGBE_ANLP1_SYM_PAUSE, IXGBE_ANLP1_ASM_PAUSE); | 2348 | IXGBE_ANLP1_SYM_PAUSE, IXGBE_ANLP1_ASM_PAUSE); |
2347 | 2349 | ||
2348 | out: | 2350 | out: |
2349 | return ret_val; | 2351 | return ret_val; |
2350 | } | 2352 | } |
2351 | 2353 | ||
2352 | /** | 2354 | /** |
2353 | * ixgbe_fc_autoneg_copper - Enable flow control IEEE clause 37 | 2355 | * ixgbe_fc_autoneg_copper - Enable flow control IEEE clause 37 |
2354 | * @hw: pointer to hardware structure | 2356 | * @hw: pointer to hardware structure |
2355 | * | 2357 | * |
2356 | * Enable flow control according to IEEE clause 37. | 2358 | * Enable flow control according to IEEE clause 37. |
2357 | **/ | 2359 | **/ |
2358 | static s32 ixgbe_fc_autoneg_copper(struct ixgbe_hw *hw) | 2360 | static s32 ixgbe_fc_autoneg_copper(struct ixgbe_hw *hw) |
2359 | { | 2361 | { |
2360 | u16 technology_ability_reg = 0; | 2362 | u16 technology_ability_reg = 0; |
2361 | u16 lp_technology_ability_reg = 0; | 2363 | u16 lp_technology_ability_reg = 0; |
2362 | 2364 | ||
2363 | hw->phy.ops.read_reg(hw, MDIO_AN_ADVERTISE, | 2365 | hw->phy.ops.read_reg(hw, MDIO_AN_ADVERTISE, |
2364 | MDIO_MMD_AN, | 2366 | MDIO_MMD_AN, |
2365 | &technology_ability_reg); | 2367 | &technology_ability_reg); |
2366 | hw->phy.ops.read_reg(hw, MDIO_AN_LPA, | 2368 | hw->phy.ops.read_reg(hw, MDIO_AN_LPA, |
2367 | MDIO_MMD_AN, | 2369 | MDIO_MMD_AN, |
2368 | &lp_technology_ability_reg); | 2370 | &lp_technology_ability_reg); |
2369 | 2371 | ||
2370 | return ixgbe_negotiate_fc(hw, (u32)technology_ability_reg, | 2372 | return ixgbe_negotiate_fc(hw, (u32)technology_ability_reg, |
2371 | (u32)lp_technology_ability_reg, | 2373 | (u32)lp_technology_ability_reg, |
2372 | IXGBE_TAF_SYM_PAUSE, IXGBE_TAF_ASM_PAUSE, | 2374 | IXGBE_TAF_SYM_PAUSE, IXGBE_TAF_ASM_PAUSE, |
2373 | IXGBE_TAF_SYM_PAUSE, IXGBE_TAF_ASM_PAUSE); | 2375 | IXGBE_TAF_SYM_PAUSE, IXGBE_TAF_ASM_PAUSE); |
2374 | } | 2376 | } |
2375 | 2377 | ||
2376 | /** | 2378 | /** |
2377 | * ixgbe_fc_autoneg - Configure flow control | 2379 | * ixgbe_fc_autoneg - Configure flow control |
2378 | * @hw: pointer to hardware structure | 2380 | * @hw: pointer to hardware structure |
2379 | * | 2381 | * |
2380 | * Compares our advertised flow control capabilities to those advertised by | 2382 | * Compares our advertised flow control capabilities to those advertised by |
2381 | * our link partner, and determines the proper flow control mode to use. | 2383 | * our link partner, and determines the proper flow control mode to use. |
2382 | **/ | 2384 | **/ |
2383 | void ixgbe_fc_autoneg(struct ixgbe_hw *hw) | 2385 | void ixgbe_fc_autoneg(struct ixgbe_hw *hw) |
2384 | { | 2386 | { |
2385 | s32 ret_val = IXGBE_ERR_FC_NOT_NEGOTIATED; | 2387 | s32 ret_val = IXGBE_ERR_FC_NOT_NEGOTIATED; |
2386 | ixgbe_link_speed speed; | 2388 | ixgbe_link_speed speed; |
2387 | bool link_up; | 2389 | bool link_up; |
2388 | 2390 | ||
2389 | /* | 2391 | /* |
2390 | * AN should have completed when the cable was plugged in. | 2392 | * AN should have completed when the cable was plugged in. |
2391 | * Look for reasons to bail out. Bail out if: | 2393 | * Look for reasons to bail out. Bail out if: |
2392 | * - FC autoneg is disabled, or if | 2394 | * - FC autoneg is disabled, or if |
2393 | * - link is not up. | 2395 | * - link is not up. |
2394 | * | 2396 | * |
2395 | * Since we're being called from an LSC, link is already known to be up. | 2397 | * Since we're being called from an LSC, link is already known to be up. |
2396 | * So use link_up_wait_to_complete=false. | 2398 | * So use link_up_wait_to_complete=false. |
2397 | */ | 2399 | */ |
2398 | if (hw->fc.disable_fc_autoneg) | 2400 | if (hw->fc.disable_fc_autoneg) |
2399 | goto out; | 2401 | goto out; |
2400 | 2402 | ||
2401 | hw->mac.ops.check_link(hw, &speed, &link_up, false); | 2403 | hw->mac.ops.check_link(hw, &speed, &link_up, false); |
2402 | if (!link_up) | 2404 | if (!link_up) |
2403 | goto out; | 2405 | goto out; |
2404 | 2406 | ||
2405 | switch (hw->phy.media_type) { | 2407 | switch (hw->phy.media_type) { |
2406 | /* Autoneg flow control on fiber adapters */ | 2408 | /* Autoneg flow control on fiber adapters */ |
2409 | case ixgbe_media_type_fiber_fixed: | ||
2407 | case ixgbe_media_type_fiber: | 2410 | case ixgbe_media_type_fiber: |
2408 | if (speed == IXGBE_LINK_SPEED_1GB_FULL) | 2411 | if (speed == IXGBE_LINK_SPEED_1GB_FULL) |
2409 | ret_val = ixgbe_fc_autoneg_fiber(hw); | 2412 | ret_val = ixgbe_fc_autoneg_fiber(hw); |
2410 | break; | 2413 | break; |
2411 | 2414 | ||
2412 | /* Autoneg flow control on backplane adapters */ | 2415 | /* Autoneg flow control on backplane adapters */ |
2413 | case ixgbe_media_type_backplane: | 2416 | case ixgbe_media_type_backplane: |
2414 | ret_val = ixgbe_fc_autoneg_backplane(hw); | 2417 | ret_val = ixgbe_fc_autoneg_backplane(hw); |
2415 | break; | 2418 | break; |
2416 | 2419 | ||
2417 | /* Autoneg flow control on copper adapters */ | 2420 | /* Autoneg flow control on copper adapters */ |
2418 | case ixgbe_media_type_copper: | 2421 | case ixgbe_media_type_copper: |
2419 | if (ixgbe_device_supports_autoneg_fc(hw)) | 2422 | if (ixgbe_device_supports_autoneg_fc(hw)) |
2420 | ret_val = ixgbe_fc_autoneg_copper(hw); | 2423 | ret_val = ixgbe_fc_autoneg_copper(hw); |
2421 | break; | 2424 | break; |
2422 | 2425 | ||
2423 | default: | 2426 | default: |
2424 | break; | 2427 | break; |
2425 | } | 2428 | } |
2426 | 2429 | ||
2427 | out: | 2430 | out: |
2428 | if (ret_val == 0) { | 2431 | if (ret_val == 0) { |
2429 | hw->fc.fc_was_autonegged = true; | 2432 | hw->fc.fc_was_autonegged = true; |
2430 | } else { | 2433 | } else { |
2431 | hw->fc.fc_was_autonegged = false; | 2434 | hw->fc.fc_was_autonegged = false; |
2432 | hw->fc.current_mode = hw->fc.requested_mode; | 2435 | hw->fc.current_mode = hw->fc.requested_mode; |
2433 | } | 2436 | } |
2434 | } | 2437 | } |
2435 | 2438 | ||
2436 | /** | 2439 | /** |
2437 | * ixgbe_disable_pcie_master - Disable PCI-express master access | 2440 | * ixgbe_disable_pcie_master - Disable PCI-express master access |
2438 | * @hw: pointer to hardware structure | 2441 | * @hw: pointer to hardware structure |
2439 | * | 2442 | * |
2440 | * Disables PCI-Express master access and verifies there are no pending | 2443 | * Disables PCI-Express master access and verifies there are no pending |
2441 | * requests. IXGBE_ERR_MASTER_REQUESTS_PENDING is returned if master disable | 2444 | * requests. IXGBE_ERR_MASTER_REQUESTS_PENDING is returned if master disable |
2442 | * bit hasn't caused the master requests to be disabled, else 0 | 2445 | * bit hasn't caused the master requests to be disabled, else 0 |
2443 | * is returned signifying master requests disabled. | 2446 | * is returned signifying master requests disabled. |
2444 | **/ | 2447 | **/ |
2445 | static s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw) | 2448 | static s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw) |
2446 | { | 2449 | { |
2447 | struct ixgbe_adapter *adapter = hw->back; | 2450 | struct ixgbe_adapter *adapter = hw->back; |
2448 | s32 status = 0; | 2451 | s32 status = 0; |
2449 | u32 i; | 2452 | u32 i; |
2450 | u16 value; | 2453 | u16 value; |
2451 | 2454 | ||
2452 | /* Always set this bit to ensure any future transactions are blocked */ | 2455 | /* Always set this bit to ensure any future transactions are blocked */ |
2453 | IXGBE_WRITE_REG(hw, IXGBE_CTRL, IXGBE_CTRL_GIO_DIS); | 2456 | IXGBE_WRITE_REG(hw, IXGBE_CTRL, IXGBE_CTRL_GIO_DIS); |
2454 | 2457 | ||
2455 | /* Exit if master requests are blocked */ | 2458 | /* Exit if master requests are blocked */ |
2456 | if (!(IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_GIO)) | 2459 | if (!(IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_GIO)) |
2457 | goto out; | 2460 | goto out; |
2458 | 2461 | ||
2459 | /* Poll for master request bit to clear */ | 2462 | /* Poll for master request bit to clear */ |
2460 | for (i = 0; i < IXGBE_PCI_MASTER_DISABLE_TIMEOUT; i++) { | 2463 | for (i = 0; i < IXGBE_PCI_MASTER_DISABLE_TIMEOUT; i++) { |
2461 | udelay(100); | 2464 | udelay(100); |
2462 | if (!(IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_GIO)) | 2465 | if (!(IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_GIO)) |
2463 | goto out; | 2466 | goto out; |
2464 | } | 2467 | } |
2465 | 2468 | ||
2466 | /* | 2469 | /* |
2467 | * Two consecutive resets are required via CTRL.RST per datasheet | 2470 | * Two consecutive resets are required via CTRL.RST per datasheet |
2468 | * 5.2.5.3.2 Master Disable. We set a flag to inform the reset routine | 2471 | * 5.2.5.3.2 Master Disable. We set a flag to inform the reset routine |
2469 | * of this need. The first reset prevents new master requests from | 2472 | * of this need. The first reset prevents new master requests from |
2470 | * being issued by our device. We then must wait 1usec or more for any | 2473 | * being issued by our device. We then must wait 1usec or more for any |
2471 | * remaining completions from the PCIe bus to trickle in, and then reset | 2474 | * remaining completions from the PCIe bus to trickle in, and then reset |
2472 | * again to clear out any effects they may have had on our device. | 2475 | * again to clear out any effects they may have had on our device. |
2473 | */ | 2476 | */ |
2474 | hw_dbg(hw, "GIO Master Disable bit didn't clear - requesting resets\n"); | 2477 | hw_dbg(hw, "GIO Master Disable bit didn't clear - requesting resets\n"); |
2475 | hw->mac.flags |= IXGBE_FLAGS_DOUBLE_RESET_REQUIRED; | 2478 | hw->mac.flags |= IXGBE_FLAGS_DOUBLE_RESET_REQUIRED; |
2476 | 2479 | ||
2477 | /* | 2480 | /* |
2478 | * Before proceeding, make sure that the PCIe block does not have | 2481 | * Before proceeding, make sure that the PCIe block does not have |
2479 | * transactions pending. | 2482 | * transactions pending. |
2480 | */ | 2483 | */ |
2481 | for (i = 0; i < IXGBE_PCI_MASTER_DISABLE_TIMEOUT; i++) { | 2484 | for (i = 0; i < IXGBE_PCI_MASTER_DISABLE_TIMEOUT; i++) { |
2482 | udelay(100); | 2485 | udelay(100); |
2483 | pci_read_config_word(adapter->pdev, IXGBE_PCI_DEVICE_STATUS, | 2486 | pci_read_config_word(adapter->pdev, IXGBE_PCI_DEVICE_STATUS, |
2484 | &value); | 2487 | &value); |
2485 | if (!(value & IXGBE_PCI_DEVICE_STATUS_TRANSACTION_PENDING)) | 2488 | if (!(value & IXGBE_PCI_DEVICE_STATUS_TRANSACTION_PENDING)) |
2486 | goto out; | 2489 | goto out; |
2487 | } | 2490 | } |
2488 | 2491 | ||
2489 | hw_dbg(hw, "PCIe transaction pending bit also did not clear.\n"); | 2492 | hw_dbg(hw, "PCIe transaction pending bit also did not clear.\n"); |
2490 | status = IXGBE_ERR_MASTER_REQUESTS_PENDING; | 2493 | status = IXGBE_ERR_MASTER_REQUESTS_PENDING; |
2491 | 2494 | ||
2492 | out: | 2495 | out: |
2493 | return status; | 2496 | return status; |
2494 | } | 2497 | } |
2495 | 2498 | ||
2496 | /** | 2499 | /** |
2497 | * ixgbe_acquire_swfw_sync - Acquire SWFW semaphore | 2500 | * ixgbe_acquire_swfw_sync - Acquire SWFW semaphore |
2498 | * @hw: pointer to hardware structure | 2501 | * @hw: pointer to hardware structure |
2499 | * @mask: Mask to specify which semaphore to acquire | 2502 | * @mask: Mask to specify which semaphore to acquire |
2500 | * | 2503 | * |
2501 | * Acquires the SWFW semaphore through the GSSR register for the specified | 2504 | * Acquires the SWFW semaphore through the GSSR register for the specified |
2502 | * function (CSR, PHY0, PHY1, EEPROM, Flash) | 2505 | * function (CSR, PHY0, PHY1, EEPROM, Flash) |
2503 | **/ | 2506 | **/ |
2504 | s32 ixgbe_acquire_swfw_sync(struct ixgbe_hw *hw, u16 mask) | 2507 | s32 ixgbe_acquire_swfw_sync(struct ixgbe_hw *hw, u16 mask) |
2505 | { | 2508 | { |
2506 | u32 gssr; | 2509 | u32 gssr; |
2507 | u32 swmask = mask; | 2510 | u32 swmask = mask; |
2508 | u32 fwmask = mask << 5; | 2511 | u32 fwmask = mask << 5; |
2509 | s32 timeout = 200; | 2512 | s32 timeout = 200; |
2510 | 2513 | ||
2511 | while (timeout) { | 2514 | while (timeout) { |
2512 | /* | 2515 | /* |
2513 | * SW EEPROM semaphore bit is used for access to all | 2516 | * SW EEPROM semaphore bit is used for access to all |
2514 | * SW_FW_SYNC/GSSR bits (not just EEPROM) | 2517 | * SW_FW_SYNC/GSSR bits (not just EEPROM) |
2515 | */ | 2518 | */ |
2516 | if (ixgbe_get_eeprom_semaphore(hw)) | 2519 | if (ixgbe_get_eeprom_semaphore(hw)) |
2517 | return IXGBE_ERR_SWFW_SYNC; | 2520 | return IXGBE_ERR_SWFW_SYNC; |
2518 | 2521 | ||
2519 | gssr = IXGBE_READ_REG(hw, IXGBE_GSSR); | 2522 | gssr = IXGBE_READ_REG(hw, IXGBE_GSSR); |
2520 | if (!(gssr & (fwmask | swmask))) | 2523 | if (!(gssr & (fwmask | swmask))) |
2521 | break; | 2524 | break; |
2522 | 2525 | ||
2523 | /* | 2526 | /* |
2524 | * Firmware currently using resource (fwmask) or other software | 2527 | * Firmware currently using resource (fwmask) or other software |
2525 | * thread currently using resource (swmask) | 2528 | * thread currently using resource (swmask) |
2526 | */ | 2529 | */ |
2527 | ixgbe_release_eeprom_semaphore(hw); | 2530 | ixgbe_release_eeprom_semaphore(hw); |
2528 | usleep_range(5000, 10000); | 2531 | usleep_range(5000, 10000); |
2529 | timeout--; | 2532 | timeout--; |
2530 | } | 2533 | } |
2531 | 2534 | ||
2532 | if (!timeout) { | 2535 | if (!timeout) { |
2533 | hw_dbg(hw, "Driver can't access resource, SW_FW_SYNC timeout.\n"); | 2536 | hw_dbg(hw, "Driver can't access resource, SW_FW_SYNC timeout.\n"); |
2534 | return IXGBE_ERR_SWFW_SYNC; | 2537 | return IXGBE_ERR_SWFW_SYNC; |
2535 | } | 2538 | } |
2536 | 2539 | ||
2537 | gssr |= swmask; | 2540 | gssr |= swmask; |
2538 | IXGBE_WRITE_REG(hw, IXGBE_GSSR, gssr); | 2541 | IXGBE_WRITE_REG(hw, IXGBE_GSSR, gssr); |
2539 | 2542 | ||
2540 | ixgbe_release_eeprom_semaphore(hw); | 2543 | ixgbe_release_eeprom_semaphore(hw); |
2541 | return 0; | 2544 | return 0; |
2542 | } | 2545 | } |
2543 | 2546 | ||
2544 | /** | 2547 | /** |
2545 | * ixgbe_release_swfw_sync - Release SWFW semaphore | 2548 | * ixgbe_release_swfw_sync - Release SWFW semaphore |
2546 | * @hw: pointer to hardware structure | 2549 | * @hw: pointer to hardware structure |
2547 | * @mask: Mask to specify which semaphore to release | 2550 | * @mask: Mask to specify which semaphore to release |
2548 | * | 2551 | * |
2549 | * Releases the SWFW semaphore through the GSSR register for the specified | 2552 | * Releases the SWFW semaphore through the GSSR register for the specified |
2550 | * function (CSR, PHY0, PHY1, EEPROM, Flash) | 2553 | * function (CSR, PHY0, PHY1, EEPROM, Flash) |
2551 | **/ | 2554 | **/ |
2552 | void ixgbe_release_swfw_sync(struct ixgbe_hw *hw, u16 mask) | 2555 | void ixgbe_release_swfw_sync(struct ixgbe_hw *hw, u16 mask) |
2553 | { | 2556 | { |
2554 | u32 gssr; | 2557 | u32 gssr; |
2555 | u32 swmask = mask; | 2558 | u32 swmask = mask; |
2556 | 2559 | ||
2557 | ixgbe_get_eeprom_semaphore(hw); | 2560 | ixgbe_get_eeprom_semaphore(hw); |
2558 | 2561 | ||
2559 | gssr = IXGBE_READ_REG(hw, IXGBE_GSSR); | 2562 | gssr = IXGBE_READ_REG(hw, IXGBE_GSSR); |
2560 | gssr &= ~swmask; | 2563 | gssr &= ~swmask; |
2561 | IXGBE_WRITE_REG(hw, IXGBE_GSSR, gssr); | 2564 | IXGBE_WRITE_REG(hw, IXGBE_GSSR, gssr); |
2562 | 2565 | ||
2563 | ixgbe_release_eeprom_semaphore(hw); | 2566 | ixgbe_release_eeprom_semaphore(hw); |
2564 | } | 2567 | } |
2565 | 2568 | ||
2566 | /** | 2569 | /** |
2567 | * ixgbe_disable_rx_buff_generic - Stops the receive data path | 2570 | * ixgbe_disable_rx_buff_generic - Stops the receive data path |
2568 | * @hw: pointer to hardware structure | 2571 | * @hw: pointer to hardware structure |
2569 | * | 2572 | * |
2570 | * Stops the receive data path and waits for the HW to internally | 2573 | * Stops the receive data path and waits for the HW to internally |
2571 | * empty the Rx security block. | 2574 | * empty the Rx security block. |
2572 | **/ | 2575 | **/ |
2573 | s32 ixgbe_disable_rx_buff_generic(struct ixgbe_hw *hw) | 2576 | s32 ixgbe_disable_rx_buff_generic(struct ixgbe_hw *hw) |
2574 | { | 2577 | { |
2575 | #define IXGBE_MAX_SECRX_POLL 40 | 2578 | #define IXGBE_MAX_SECRX_POLL 40 |
2576 | int i; | 2579 | int i; |
2577 | int secrxreg; | 2580 | int secrxreg; |
2578 | 2581 | ||
2579 | secrxreg = IXGBE_READ_REG(hw, IXGBE_SECRXCTRL); | 2582 | secrxreg = IXGBE_READ_REG(hw, IXGBE_SECRXCTRL); |
2580 | secrxreg |= IXGBE_SECRXCTRL_RX_DIS; | 2583 | secrxreg |= IXGBE_SECRXCTRL_RX_DIS; |
2581 | IXGBE_WRITE_REG(hw, IXGBE_SECRXCTRL, secrxreg); | 2584 | IXGBE_WRITE_REG(hw, IXGBE_SECRXCTRL, secrxreg); |
2582 | for (i = 0; i < IXGBE_MAX_SECRX_POLL; i++) { | 2585 | for (i = 0; i < IXGBE_MAX_SECRX_POLL; i++) { |
2583 | secrxreg = IXGBE_READ_REG(hw, IXGBE_SECRXSTAT); | 2586 | secrxreg = IXGBE_READ_REG(hw, IXGBE_SECRXSTAT); |
2584 | if (secrxreg & IXGBE_SECRXSTAT_SECRX_RDY) | 2587 | if (secrxreg & IXGBE_SECRXSTAT_SECRX_RDY) |
2585 | break; | 2588 | break; |
2586 | else | 2589 | else |
2587 | /* Use interrupt-safe sleep just in case */ | 2590 | /* Use interrupt-safe sleep just in case */ |
2588 | udelay(1000); | 2591 | udelay(1000); |
2589 | } | 2592 | } |
2590 | 2593 | ||
2591 | /* For informational purposes only */ | 2594 | /* For informational purposes only */ |
2592 | if (i >= IXGBE_MAX_SECRX_POLL) | 2595 | if (i >= IXGBE_MAX_SECRX_POLL) |
2593 | hw_dbg(hw, "Rx unit being enabled before security " | 2596 | hw_dbg(hw, "Rx unit being enabled before security " |
2594 | "path fully disabled. Continuing with init.\n"); | 2597 | "path fully disabled. Continuing with init.\n"); |
2595 | 2598 | ||
2596 | return 0; | 2599 | return 0; |
2597 | 2600 | ||
2598 | } | 2601 | } |
2599 | 2602 | ||
2600 | /** | 2603 | /** |
2601 | * ixgbe_enable_rx_buff - Enables the receive data path | 2604 | * ixgbe_enable_rx_buff - Enables the receive data path |
2602 | * @hw: pointer to hardware structure | 2605 | * @hw: pointer to hardware structure |
2603 | * | 2606 | * |
2604 | * Enables the receive data path | 2607 | * Enables the receive data path |
2605 | **/ | 2608 | **/ |
2606 | s32 ixgbe_enable_rx_buff_generic(struct ixgbe_hw *hw) | 2609 | s32 ixgbe_enable_rx_buff_generic(struct ixgbe_hw *hw) |
2607 | { | 2610 | { |
2608 | int secrxreg; | 2611 | int secrxreg; |
2609 | 2612 | ||
2610 | secrxreg = IXGBE_READ_REG(hw, IXGBE_SECRXCTRL); | 2613 | secrxreg = IXGBE_READ_REG(hw, IXGBE_SECRXCTRL); |
2611 | secrxreg &= ~IXGBE_SECRXCTRL_RX_DIS; | 2614 | secrxreg &= ~IXGBE_SECRXCTRL_RX_DIS; |
2612 | IXGBE_WRITE_REG(hw, IXGBE_SECRXCTRL, secrxreg); | 2615 | IXGBE_WRITE_REG(hw, IXGBE_SECRXCTRL, secrxreg); |
2613 | IXGBE_WRITE_FLUSH(hw); | 2616 | IXGBE_WRITE_FLUSH(hw); |
2614 | 2617 | ||
2615 | return 0; | 2618 | return 0; |
2616 | } | 2619 | } |
2617 | 2620 | ||
2618 | /** | 2621 | /** |
2619 | * ixgbe_enable_rx_dma_generic - Enable the Rx DMA unit | 2622 | * ixgbe_enable_rx_dma_generic - Enable the Rx DMA unit |
2620 | * @hw: pointer to hardware structure | 2623 | * @hw: pointer to hardware structure |
2621 | * @regval: register value to write to RXCTRL | 2624 | * @regval: register value to write to RXCTRL |
2622 | * | 2625 | * |
2623 | * Enables the Rx DMA unit | 2626 | * Enables the Rx DMA unit |
2624 | **/ | 2627 | **/ |
2625 | s32 ixgbe_enable_rx_dma_generic(struct ixgbe_hw *hw, u32 regval) | 2628 | s32 ixgbe_enable_rx_dma_generic(struct ixgbe_hw *hw, u32 regval) |
2626 | { | 2629 | { |
2627 | IXGBE_WRITE_REG(hw, IXGBE_RXCTRL, regval); | 2630 | IXGBE_WRITE_REG(hw, IXGBE_RXCTRL, regval); |
2628 | 2631 | ||
2629 | return 0; | 2632 | return 0; |
2630 | } | 2633 | } |
2631 | 2634 | ||
2632 | /** | 2635 | /** |
2633 | * ixgbe_blink_led_start_generic - Blink LED based on index. | 2636 | * ixgbe_blink_led_start_generic - Blink LED based on index. |
2634 | * @hw: pointer to hardware structure | 2637 | * @hw: pointer to hardware structure |
2635 | * @index: led number to blink | 2638 | * @index: led number to blink |
2636 | **/ | 2639 | **/ |
2637 | s32 ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, u32 index) | 2640 | s32 ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, u32 index) |
2638 | { | 2641 | { |
2639 | ixgbe_link_speed speed = 0; | 2642 | ixgbe_link_speed speed = 0; |
2640 | bool link_up = false; | 2643 | bool link_up = false; |
2641 | u32 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC); | 2644 | u32 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC); |
2642 | u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL); | 2645 | u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL); |
2643 | s32 ret_val = 0; | 2646 | s32 ret_val = 0; |
2644 | 2647 | ||
2645 | /* | 2648 | /* |
2646 | * Link must be up to auto-blink the LEDs; | 2649 | * Link must be up to auto-blink the LEDs; |
2647 | * Force it if link is down. | 2650 | * Force it if link is down. |
2648 | */ | 2651 | */ |
2649 | hw->mac.ops.check_link(hw, &speed, &link_up, false); | 2652 | hw->mac.ops.check_link(hw, &speed, &link_up, false); |
2650 | 2653 | ||
2651 | if (!link_up) { | 2654 | if (!link_up) { |
2652 | /* Need the SW/FW semaphore around AUTOC writes if 82599 and | 2655 | /* Need the SW/FW semaphore around AUTOC writes if 82599 and |
2653 | * LESM is on. | 2656 | * LESM is on. |
2654 | */ | 2657 | */ |
2655 | bool got_lock = false; | 2658 | bool got_lock = false; |
2656 | 2659 | ||
2657 | if ((hw->mac.type == ixgbe_mac_82599EB) && | 2660 | if ((hw->mac.type == ixgbe_mac_82599EB) && |
2658 | ixgbe_verify_lesm_fw_enabled_82599(hw)) { | 2661 | ixgbe_verify_lesm_fw_enabled_82599(hw)) { |
2659 | ret_val = hw->mac.ops.acquire_swfw_sync(hw, | 2662 | ret_val = hw->mac.ops.acquire_swfw_sync(hw, |
2660 | IXGBE_GSSR_MAC_CSR_SM); | 2663 | IXGBE_GSSR_MAC_CSR_SM); |
2661 | if (ret_val) | 2664 | if (ret_val) |
2662 | goto out; | 2665 | goto out; |
2663 | 2666 | ||
2664 | got_lock = true; | 2667 | got_lock = true; |
2665 | } | 2668 | } |
2666 | autoc_reg |= IXGBE_AUTOC_AN_RESTART; | 2669 | autoc_reg |= IXGBE_AUTOC_AN_RESTART; |
2667 | autoc_reg |= IXGBE_AUTOC_FLU; | 2670 | autoc_reg |= IXGBE_AUTOC_FLU; |
2668 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg); | 2671 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg); |
2669 | IXGBE_WRITE_FLUSH(hw); | 2672 | IXGBE_WRITE_FLUSH(hw); |
2670 | 2673 | ||
2671 | if (got_lock) | 2674 | if (got_lock) |
2672 | hw->mac.ops.release_swfw_sync(hw, | 2675 | hw->mac.ops.release_swfw_sync(hw, |
2673 | IXGBE_GSSR_MAC_CSR_SM); | 2676 | IXGBE_GSSR_MAC_CSR_SM); |
2674 | usleep_range(10000, 20000); | 2677 | usleep_range(10000, 20000); |
2675 | } | 2678 | } |
2676 | 2679 | ||
2677 | led_reg &= ~IXGBE_LED_MODE_MASK(index); | 2680 | led_reg &= ~IXGBE_LED_MODE_MASK(index); |
2678 | led_reg |= IXGBE_LED_BLINK(index); | 2681 | led_reg |= IXGBE_LED_BLINK(index); |
2679 | IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg); | 2682 | IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg); |
2680 | IXGBE_WRITE_FLUSH(hw); | 2683 | IXGBE_WRITE_FLUSH(hw); |
2681 | 2684 | ||
2682 | out: | 2685 | out: |
2683 | return ret_val; | 2686 | return ret_val; |
2684 | } | 2687 | } |
2685 | 2688 | ||
2686 | /** | 2689 | /** |
2687 | * ixgbe_blink_led_stop_generic - Stop blinking LED based on index. | 2690 | * ixgbe_blink_led_stop_generic - Stop blinking LED based on index. |
2688 | * @hw: pointer to hardware structure | 2691 | * @hw: pointer to hardware structure |
2689 | * @index: led number to stop blinking | 2692 | * @index: led number to stop blinking |
2690 | **/ | 2693 | **/ |
2691 | s32 ixgbe_blink_led_stop_generic(struct ixgbe_hw *hw, u32 index) | 2694 | s32 ixgbe_blink_led_stop_generic(struct ixgbe_hw *hw, u32 index) |
2692 | { | 2695 | { |
2693 | u32 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC); | 2696 | u32 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC); |
2694 | u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL); | 2697 | u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL); |
2695 | s32 ret_val = 0; | 2698 | s32 ret_val = 0; |
2696 | bool got_lock = false; | 2699 | bool got_lock = false; |
2697 | 2700 | ||
2698 | /* Need the SW/FW semaphore around AUTOC writes if 82599 and | 2701 | /* Need the SW/FW semaphore around AUTOC writes if 82599 and |
2699 | * LESM is on. | 2702 | * LESM is on. |
2700 | */ | 2703 | */ |
2701 | if ((hw->mac.type == ixgbe_mac_82599EB) && | 2704 | if ((hw->mac.type == ixgbe_mac_82599EB) && |
2702 | ixgbe_verify_lesm_fw_enabled_82599(hw)) { | 2705 | ixgbe_verify_lesm_fw_enabled_82599(hw)) { |
2703 | ret_val = hw->mac.ops.acquire_swfw_sync(hw, | 2706 | ret_val = hw->mac.ops.acquire_swfw_sync(hw, |
2704 | IXGBE_GSSR_MAC_CSR_SM); | 2707 | IXGBE_GSSR_MAC_CSR_SM); |
2705 | if (ret_val) | 2708 | if (ret_val) |
2706 | goto out; | 2709 | goto out; |
2707 | 2710 | ||
2708 | got_lock = true; | 2711 | got_lock = true; |
2709 | } | 2712 | } |
2710 | 2713 | ||
2711 | autoc_reg &= ~IXGBE_AUTOC_FLU; | 2714 | autoc_reg &= ~IXGBE_AUTOC_FLU; |
2712 | autoc_reg |= IXGBE_AUTOC_AN_RESTART; | 2715 | autoc_reg |= IXGBE_AUTOC_AN_RESTART; |
2713 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg); | 2716 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg); |
2714 | 2717 | ||
2715 | if (hw->mac.type == ixgbe_mac_82599EB) | 2718 | if (hw->mac.type == ixgbe_mac_82599EB) |
2716 | ixgbe_reset_pipeline_82599(hw); | 2719 | ixgbe_reset_pipeline_82599(hw); |
2717 | 2720 | ||
2718 | if (got_lock) | 2721 | if (got_lock) |
2719 | hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_MAC_CSR_SM); | 2722 | hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_MAC_CSR_SM); |
2720 | 2723 | ||
2721 | led_reg &= ~IXGBE_LED_MODE_MASK(index); | 2724 | led_reg &= ~IXGBE_LED_MODE_MASK(index); |
2722 | led_reg &= ~IXGBE_LED_BLINK(index); | 2725 | led_reg &= ~IXGBE_LED_BLINK(index); |
2723 | led_reg |= IXGBE_LED_LINK_ACTIVE << IXGBE_LED_MODE_SHIFT(index); | 2726 | led_reg |= IXGBE_LED_LINK_ACTIVE << IXGBE_LED_MODE_SHIFT(index); |
2724 | IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg); | 2727 | IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg); |
2725 | IXGBE_WRITE_FLUSH(hw); | 2728 | IXGBE_WRITE_FLUSH(hw); |
2726 | 2729 | ||
2727 | out: | 2730 | out: |
2728 | return ret_val; | 2731 | return ret_val; |
2729 | } | 2732 | } |
2730 | 2733 | ||
2731 | /** | 2734 | /** |
2732 | * ixgbe_get_san_mac_addr_offset - Get SAN MAC address offset from the EEPROM | 2735 | * ixgbe_get_san_mac_addr_offset - Get SAN MAC address offset from the EEPROM |
2733 | * @hw: pointer to hardware structure | 2736 | * @hw: pointer to hardware structure |
2734 | * @san_mac_offset: SAN MAC address offset | 2737 | * @san_mac_offset: SAN MAC address offset |
2735 | * | 2738 | * |
2736 | * This function will read the EEPROM location for the SAN MAC address | 2739 | * This function will read the EEPROM location for the SAN MAC address |
2737 | * pointer, and returns the value at that location. This is used in both | 2740 | * pointer, and returns the value at that location. This is used in both |
2738 | * get and set mac_addr routines. | 2741 | * get and set mac_addr routines. |
2739 | **/ | 2742 | **/ |
2740 | static s32 ixgbe_get_san_mac_addr_offset(struct ixgbe_hw *hw, | 2743 | static s32 ixgbe_get_san_mac_addr_offset(struct ixgbe_hw *hw, |
2741 | u16 *san_mac_offset) | 2744 | u16 *san_mac_offset) |
2742 | { | 2745 | { |
2743 | /* | 2746 | /* |
2744 | * First read the EEPROM pointer to see if the MAC addresses are | 2747 | * First read the EEPROM pointer to see if the MAC addresses are |
2745 | * available. | 2748 | * available. |
2746 | */ | 2749 | */ |
2747 | hw->eeprom.ops.read(hw, IXGBE_SAN_MAC_ADDR_PTR, san_mac_offset); | 2750 | hw->eeprom.ops.read(hw, IXGBE_SAN_MAC_ADDR_PTR, san_mac_offset); |
2748 | 2751 | ||
2749 | return 0; | 2752 | return 0; |
2750 | } | 2753 | } |
2751 | 2754 | ||
2752 | /** | 2755 | /** |
2753 | * ixgbe_get_san_mac_addr_generic - SAN MAC address retrieval from the EEPROM | 2756 | * ixgbe_get_san_mac_addr_generic - SAN MAC address retrieval from the EEPROM |
2754 | * @hw: pointer to hardware structure | 2757 | * @hw: pointer to hardware structure |
2755 | * @san_mac_addr: SAN MAC address | 2758 | * @san_mac_addr: SAN MAC address |
2756 | * | 2759 | * |
2757 | * Reads the SAN MAC address from the EEPROM, if it's available. This is | 2760 | * Reads the SAN MAC address from the EEPROM, if it's available. This is |
2758 | * per-port, so set_lan_id() must be called before reading the addresses. | 2761 | * per-port, so set_lan_id() must be called before reading the addresses. |
2759 | * set_lan_id() is called by identify_sfp(), but this cannot be relied | 2762 | * set_lan_id() is called by identify_sfp(), but this cannot be relied |
2760 | * upon for non-SFP connections, so we must call it here. | 2763 | * upon for non-SFP connections, so we must call it here. |
2761 | **/ | 2764 | **/ |
2762 | s32 ixgbe_get_san_mac_addr_generic(struct ixgbe_hw *hw, u8 *san_mac_addr) | 2765 | s32 ixgbe_get_san_mac_addr_generic(struct ixgbe_hw *hw, u8 *san_mac_addr) |
2763 | { | 2766 | { |
2764 | u16 san_mac_data, san_mac_offset; | 2767 | u16 san_mac_data, san_mac_offset; |
2765 | u8 i; | 2768 | u8 i; |
2766 | 2769 | ||
2767 | /* | 2770 | /* |
2768 | * First read the EEPROM pointer to see if the MAC addresses are | 2771 | * First read the EEPROM pointer to see if the MAC addresses are |
2769 | * available. If they're not, no point in calling set_lan_id() here. | 2772 | * available. If they're not, no point in calling set_lan_id() here. |
2770 | */ | 2773 | */ |
2771 | ixgbe_get_san_mac_addr_offset(hw, &san_mac_offset); | 2774 | ixgbe_get_san_mac_addr_offset(hw, &san_mac_offset); |
2772 | 2775 | ||
2773 | if ((san_mac_offset == 0) || (san_mac_offset == 0xFFFF)) { | 2776 | if ((san_mac_offset == 0) || (san_mac_offset == 0xFFFF)) { |
2774 | /* | 2777 | /* |
2775 | * No addresses available in this EEPROM. It's not an | 2778 | * No addresses available in this EEPROM. It's not an |
2776 | * error though, so just wipe the local address and return. | 2779 | * error though, so just wipe the local address and return. |
2777 | */ | 2780 | */ |
2778 | for (i = 0; i < 6; i++) | 2781 | for (i = 0; i < 6; i++) |
2779 | san_mac_addr[i] = 0xFF; | 2782 | san_mac_addr[i] = 0xFF; |
2780 | 2783 | ||
2781 | goto san_mac_addr_out; | 2784 | goto san_mac_addr_out; |
2782 | } | 2785 | } |
2783 | 2786 | ||
2784 | /* make sure we know which port we need to program */ | 2787 | /* make sure we know which port we need to program */ |
2785 | hw->mac.ops.set_lan_id(hw); | 2788 | hw->mac.ops.set_lan_id(hw); |
2786 | /* apply the port offset to the address offset */ | 2789 | /* apply the port offset to the address offset */ |
2787 | (hw->bus.func) ? (san_mac_offset += IXGBE_SAN_MAC_ADDR_PORT1_OFFSET) : | 2790 | (hw->bus.func) ? (san_mac_offset += IXGBE_SAN_MAC_ADDR_PORT1_OFFSET) : |
2788 | (san_mac_offset += IXGBE_SAN_MAC_ADDR_PORT0_OFFSET); | 2791 | (san_mac_offset += IXGBE_SAN_MAC_ADDR_PORT0_OFFSET); |
2789 | for (i = 0; i < 3; i++) { | 2792 | for (i = 0; i < 3; i++) { |
2790 | hw->eeprom.ops.read(hw, san_mac_offset, &san_mac_data); | 2793 | hw->eeprom.ops.read(hw, san_mac_offset, &san_mac_data); |
2791 | san_mac_addr[i * 2] = (u8)(san_mac_data); | 2794 | san_mac_addr[i * 2] = (u8)(san_mac_data); |
2792 | san_mac_addr[i * 2 + 1] = (u8)(san_mac_data >> 8); | 2795 | san_mac_addr[i * 2 + 1] = (u8)(san_mac_data >> 8); |
2793 | san_mac_offset++; | 2796 | san_mac_offset++; |
2794 | } | 2797 | } |
2795 | 2798 | ||
2796 | san_mac_addr_out: | 2799 | san_mac_addr_out: |
2797 | return 0; | 2800 | return 0; |
2798 | } | 2801 | } |
2799 | 2802 | ||
2800 | /** | 2803 | /** |
2801 | * ixgbe_get_pcie_msix_count_generic - Gets MSI-X vector count | 2804 | * ixgbe_get_pcie_msix_count_generic - Gets MSI-X vector count |
2802 | * @hw: pointer to hardware structure | 2805 | * @hw: pointer to hardware structure |
2803 | * | 2806 | * |
2804 | * Read PCIe configuration space, and get the MSI-X vector count from | 2807 | * Read PCIe configuration space, and get the MSI-X vector count from |
2805 | * the capabilities table. | 2808 | * the capabilities table. |
2806 | **/ | 2809 | **/ |
2807 | u16 ixgbe_get_pcie_msix_count_generic(struct ixgbe_hw *hw) | 2810 | u16 ixgbe_get_pcie_msix_count_generic(struct ixgbe_hw *hw) |
2808 | { | 2811 | { |
2809 | struct ixgbe_adapter *adapter = hw->back; | 2812 | struct ixgbe_adapter *adapter = hw->back; |
2810 | u16 msix_count = 1; | 2813 | u16 msix_count = 1; |
2811 | u16 max_msix_count; | 2814 | u16 max_msix_count; |
2812 | u16 pcie_offset; | 2815 | u16 pcie_offset; |
2813 | 2816 | ||
2814 | switch (hw->mac.type) { | 2817 | switch (hw->mac.type) { |
2815 | case ixgbe_mac_82598EB: | 2818 | case ixgbe_mac_82598EB: |
2816 | pcie_offset = IXGBE_PCIE_MSIX_82598_CAPS; | 2819 | pcie_offset = IXGBE_PCIE_MSIX_82598_CAPS; |
2817 | max_msix_count = IXGBE_MAX_MSIX_VECTORS_82598; | 2820 | max_msix_count = IXGBE_MAX_MSIX_VECTORS_82598; |
2818 | break; | 2821 | break; |
2819 | case ixgbe_mac_82599EB: | 2822 | case ixgbe_mac_82599EB: |
2820 | case ixgbe_mac_X540: | 2823 | case ixgbe_mac_X540: |
2821 | pcie_offset = IXGBE_PCIE_MSIX_82599_CAPS; | 2824 | pcie_offset = IXGBE_PCIE_MSIX_82599_CAPS; |
2822 | max_msix_count = IXGBE_MAX_MSIX_VECTORS_82599; | 2825 | max_msix_count = IXGBE_MAX_MSIX_VECTORS_82599; |
2823 | break; | 2826 | break; |
2824 | default: | 2827 | default: |
2825 | return msix_count; | 2828 | return msix_count; |
2826 | } | 2829 | } |
2827 | 2830 | ||
2828 | pci_read_config_word(adapter->pdev, pcie_offset, &msix_count); | 2831 | pci_read_config_word(adapter->pdev, pcie_offset, &msix_count); |
2829 | msix_count &= IXGBE_PCIE_MSIX_TBL_SZ_MASK; | 2832 | msix_count &= IXGBE_PCIE_MSIX_TBL_SZ_MASK; |
2830 | 2833 | ||
2831 | /* MSI-X count is zero-based in HW */ | 2834 | /* MSI-X count is zero-based in HW */ |
2832 | msix_count++; | 2835 | msix_count++; |
2833 | 2836 | ||
2834 | if (msix_count > max_msix_count) | 2837 | if (msix_count > max_msix_count) |
2835 | msix_count = max_msix_count; | 2838 | msix_count = max_msix_count; |
2836 | 2839 | ||
2837 | return msix_count; | 2840 | return msix_count; |
2838 | } | 2841 | } |
2839 | 2842 | ||
2840 | /** | 2843 | /** |
2841 | * ixgbe_clear_vmdq_generic - Disassociate a VMDq pool index from a rx address | 2844 | * ixgbe_clear_vmdq_generic - Disassociate a VMDq pool index from a rx address |
2842 | * @hw: pointer to hardware struct | 2845 | * @hw: pointer to hardware struct |
2843 | * @rar: receive address register index to disassociate | 2846 | * @rar: receive address register index to disassociate |
2844 | * @vmdq: VMDq pool index to remove from the rar | 2847 | * @vmdq: VMDq pool index to remove from the rar |
2845 | **/ | 2848 | **/ |
2846 | s32 ixgbe_clear_vmdq_generic(struct ixgbe_hw *hw, u32 rar, u32 vmdq) | 2849 | s32 ixgbe_clear_vmdq_generic(struct ixgbe_hw *hw, u32 rar, u32 vmdq) |
2847 | { | 2850 | { |
2848 | u32 mpsar_lo, mpsar_hi; | 2851 | u32 mpsar_lo, mpsar_hi; |
2849 | u32 rar_entries = hw->mac.num_rar_entries; | 2852 | u32 rar_entries = hw->mac.num_rar_entries; |
2850 | 2853 | ||
2851 | /* Make sure we are using a valid rar index range */ | 2854 | /* Make sure we are using a valid rar index range */ |
2852 | if (rar >= rar_entries) { | 2855 | if (rar >= rar_entries) { |
2853 | hw_dbg(hw, "RAR index %d is out of range.\n", rar); | 2856 | hw_dbg(hw, "RAR index %d is out of range.\n", rar); |
2854 | return IXGBE_ERR_INVALID_ARGUMENT; | 2857 | return IXGBE_ERR_INVALID_ARGUMENT; |
2855 | } | 2858 | } |
2856 | 2859 | ||
2857 | mpsar_lo = IXGBE_READ_REG(hw, IXGBE_MPSAR_LO(rar)); | 2860 | mpsar_lo = IXGBE_READ_REG(hw, IXGBE_MPSAR_LO(rar)); |
2858 | mpsar_hi = IXGBE_READ_REG(hw, IXGBE_MPSAR_HI(rar)); | 2861 | mpsar_hi = IXGBE_READ_REG(hw, IXGBE_MPSAR_HI(rar)); |
2859 | 2862 | ||
2860 | if (!mpsar_lo && !mpsar_hi) | 2863 | if (!mpsar_lo && !mpsar_hi) |
2861 | goto done; | 2864 | goto done; |
2862 | 2865 | ||
2863 | if (vmdq == IXGBE_CLEAR_VMDQ_ALL) { | 2866 | if (vmdq == IXGBE_CLEAR_VMDQ_ALL) { |
2864 | if (mpsar_lo) { | 2867 | if (mpsar_lo) { |
2865 | IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), 0); | 2868 | IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), 0); |
2866 | mpsar_lo = 0; | 2869 | mpsar_lo = 0; |
2867 | } | 2870 | } |
2868 | if (mpsar_hi) { | 2871 | if (mpsar_hi) { |
2869 | IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), 0); | 2872 | IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), 0); |
2870 | mpsar_hi = 0; | 2873 | mpsar_hi = 0; |
2871 | } | 2874 | } |
2872 | } else if (vmdq < 32) { | 2875 | } else if (vmdq < 32) { |
2873 | mpsar_lo &= ~(1 << vmdq); | 2876 | mpsar_lo &= ~(1 << vmdq); |
2874 | IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), mpsar_lo); | 2877 | IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), mpsar_lo); |
2875 | } else { | 2878 | } else { |
2876 | mpsar_hi &= ~(1 << (vmdq - 32)); | 2879 | mpsar_hi &= ~(1 << (vmdq - 32)); |
2877 | IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), mpsar_hi); | 2880 | IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), mpsar_hi); |
2878 | } | 2881 | } |
2879 | 2882 | ||
2880 | /* was that the last pool using this rar? */ | 2883 | /* was that the last pool using this rar? */ |
2881 | if (mpsar_lo == 0 && mpsar_hi == 0 && rar != 0) | 2884 | if (mpsar_lo == 0 && mpsar_hi == 0 && rar != 0) |
2882 | hw->mac.ops.clear_rar(hw, rar); | 2885 | hw->mac.ops.clear_rar(hw, rar); |
2883 | done: | 2886 | done: |
2884 | return 0; | 2887 | return 0; |
2885 | } | 2888 | } |
2886 | 2889 | ||
2887 | /** | 2890 | /** |
2888 | * ixgbe_set_vmdq_generic - Associate a VMDq pool index with a rx address | 2891 | * ixgbe_set_vmdq_generic - Associate a VMDq pool index with a rx address |
2889 | * @hw: pointer to hardware struct | 2892 | * @hw: pointer to hardware struct |
2890 | * @rar: receive address register index to associate with a VMDq index | 2893 | * @rar: receive address register index to associate with a VMDq index |
2891 | * @vmdq: VMDq pool index | 2894 | * @vmdq: VMDq pool index |
2892 | **/ | 2895 | **/ |
2893 | s32 ixgbe_set_vmdq_generic(struct ixgbe_hw *hw, u32 rar, u32 vmdq) | 2896 | s32 ixgbe_set_vmdq_generic(struct ixgbe_hw *hw, u32 rar, u32 vmdq) |
2894 | { | 2897 | { |
2895 | u32 mpsar; | 2898 | u32 mpsar; |
2896 | u32 rar_entries = hw->mac.num_rar_entries; | 2899 | u32 rar_entries = hw->mac.num_rar_entries; |
2897 | 2900 | ||
2898 | /* Make sure we are using a valid rar index range */ | 2901 | /* Make sure we are using a valid rar index range */ |
2899 | if (rar >= rar_entries) { | 2902 | if (rar >= rar_entries) { |
2900 | hw_dbg(hw, "RAR index %d is out of range.\n", rar); | 2903 | hw_dbg(hw, "RAR index %d is out of range.\n", rar); |
2901 | return IXGBE_ERR_INVALID_ARGUMENT; | 2904 | return IXGBE_ERR_INVALID_ARGUMENT; |
2902 | } | 2905 | } |
2903 | 2906 | ||
2904 | if (vmdq < 32) { | 2907 | if (vmdq < 32) { |
2905 | mpsar = IXGBE_READ_REG(hw, IXGBE_MPSAR_LO(rar)); | 2908 | mpsar = IXGBE_READ_REG(hw, IXGBE_MPSAR_LO(rar)); |
2906 | mpsar |= 1 << vmdq; | 2909 | mpsar |= 1 << vmdq; |
2907 | IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), mpsar); | 2910 | IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), mpsar); |
2908 | } else { | 2911 | } else { |
2909 | mpsar = IXGBE_READ_REG(hw, IXGBE_MPSAR_HI(rar)); | 2912 | mpsar = IXGBE_READ_REG(hw, IXGBE_MPSAR_HI(rar)); |
2910 | mpsar |= 1 << (vmdq - 32); | 2913 | mpsar |= 1 << (vmdq - 32); |
2911 | IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), mpsar); | 2914 | IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), mpsar); |
2912 | } | 2915 | } |
2913 | return 0; | 2916 | return 0; |
2914 | } | 2917 | } |
2915 | 2918 | ||
2916 | /** | 2919 | /** |
2917 | * This function should only be involved in the IOV mode. | 2920 | * This function should only be involved in the IOV mode. |
2918 | * In IOV mode, Default pool is next pool after the number of | 2921 | * In IOV mode, Default pool is next pool after the number of |
2919 | * VFs advertized and not 0. | 2922 | * VFs advertized and not 0. |
2920 | * MPSAR table needs to be updated for SAN_MAC RAR [hw->mac.san_mac_rar_index] | 2923 | * MPSAR table needs to be updated for SAN_MAC RAR [hw->mac.san_mac_rar_index] |
2921 | * | 2924 | * |
2922 | * ixgbe_set_vmdq_san_mac - Associate default VMDq pool index with a rx address | 2925 | * ixgbe_set_vmdq_san_mac - Associate default VMDq pool index with a rx address |
2923 | * @hw: pointer to hardware struct | 2926 | * @hw: pointer to hardware struct |
2924 | * @vmdq: VMDq pool index | 2927 | * @vmdq: VMDq pool index |
2925 | **/ | 2928 | **/ |
2926 | s32 ixgbe_set_vmdq_san_mac_generic(struct ixgbe_hw *hw, u32 vmdq) | 2929 | s32 ixgbe_set_vmdq_san_mac_generic(struct ixgbe_hw *hw, u32 vmdq) |
2927 | { | 2930 | { |
2928 | u32 rar = hw->mac.san_mac_rar_index; | 2931 | u32 rar = hw->mac.san_mac_rar_index; |
2929 | 2932 | ||
2930 | if (vmdq < 32) { | 2933 | if (vmdq < 32) { |
2931 | IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), 1 << vmdq); | 2934 | IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), 1 << vmdq); |
2932 | IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), 0); | 2935 | IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), 0); |
2933 | } else { | 2936 | } else { |
2934 | IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), 0); | 2937 | IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), 0); |
2935 | IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), 1 << (vmdq - 32)); | 2938 | IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), 1 << (vmdq - 32)); |
2936 | } | 2939 | } |
2937 | 2940 | ||
2938 | return 0; | 2941 | return 0; |
2939 | } | 2942 | } |
2940 | 2943 | ||
2941 | /** | 2944 | /** |
2942 | * ixgbe_init_uta_tables_generic - Initialize the Unicast Table Array | 2945 | * ixgbe_init_uta_tables_generic - Initialize the Unicast Table Array |
2943 | * @hw: pointer to hardware structure | 2946 | * @hw: pointer to hardware structure |
2944 | **/ | 2947 | **/ |
2945 | s32 ixgbe_init_uta_tables_generic(struct ixgbe_hw *hw) | 2948 | s32 ixgbe_init_uta_tables_generic(struct ixgbe_hw *hw) |
2946 | { | 2949 | { |
2947 | int i; | 2950 | int i; |
2948 | 2951 | ||
2949 | for (i = 0; i < 128; i++) | 2952 | for (i = 0; i < 128; i++) |
2950 | IXGBE_WRITE_REG(hw, IXGBE_UTA(i), 0); | 2953 | IXGBE_WRITE_REG(hw, IXGBE_UTA(i), 0); |
2951 | 2954 | ||
2952 | return 0; | 2955 | return 0; |
2953 | } | 2956 | } |
2954 | 2957 | ||
2955 | /** | 2958 | /** |
2956 | * ixgbe_find_vlvf_slot - find the vlanid or the first empty slot | 2959 | * ixgbe_find_vlvf_slot - find the vlanid or the first empty slot |
2957 | * @hw: pointer to hardware structure | 2960 | * @hw: pointer to hardware structure |
2958 | * @vlan: VLAN id to write to VLAN filter | 2961 | * @vlan: VLAN id to write to VLAN filter |
2959 | * | 2962 | * |
2960 | * return the VLVF index where this VLAN id should be placed | 2963 | * return the VLVF index where this VLAN id should be placed |
2961 | * | 2964 | * |
2962 | **/ | 2965 | **/ |
2963 | static s32 ixgbe_find_vlvf_slot(struct ixgbe_hw *hw, u32 vlan) | 2966 | static s32 ixgbe_find_vlvf_slot(struct ixgbe_hw *hw, u32 vlan) |
2964 | { | 2967 | { |
2965 | u32 bits = 0; | 2968 | u32 bits = 0; |
2966 | u32 first_empty_slot = 0; | 2969 | u32 first_empty_slot = 0; |
2967 | s32 regindex; | 2970 | s32 regindex; |
2968 | 2971 | ||
2969 | /* short cut the special case */ | 2972 | /* short cut the special case */ |
2970 | if (vlan == 0) | 2973 | if (vlan == 0) |
2971 | return 0; | 2974 | return 0; |
2972 | 2975 | ||
2973 | /* | 2976 | /* |
2974 | * Search for the vlan id in the VLVF entries. Save off the first empty | 2977 | * Search for the vlan id in the VLVF entries. Save off the first empty |
2975 | * slot found along the way | 2978 | * slot found along the way |
2976 | */ | 2979 | */ |
2977 | for (regindex = 1; regindex < IXGBE_VLVF_ENTRIES; regindex++) { | 2980 | for (regindex = 1; regindex < IXGBE_VLVF_ENTRIES; regindex++) { |
2978 | bits = IXGBE_READ_REG(hw, IXGBE_VLVF(regindex)); | 2981 | bits = IXGBE_READ_REG(hw, IXGBE_VLVF(regindex)); |
2979 | if (!bits && !(first_empty_slot)) | 2982 | if (!bits && !(first_empty_slot)) |
2980 | first_empty_slot = regindex; | 2983 | first_empty_slot = regindex; |
2981 | else if ((bits & 0x0FFF) == vlan) | 2984 | else if ((bits & 0x0FFF) == vlan) |
2982 | break; | 2985 | break; |
2983 | } | 2986 | } |
2984 | 2987 | ||
2985 | /* | 2988 | /* |
2986 | * If regindex is less than IXGBE_VLVF_ENTRIES, then we found the vlan | 2989 | * If regindex is less than IXGBE_VLVF_ENTRIES, then we found the vlan |
2987 | * in the VLVF. Else use the first empty VLVF register for this | 2990 | * in the VLVF. Else use the first empty VLVF register for this |
2988 | * vlan id. | 2991 | * vlan id. |
2989 | */ | 2992 | */ |
2990 | if (regindex >= IXGBE_VLVF_ENTRIES) { | 2993 | if (regindex >= IXGBE_VLVF_ENTRIES) { |
2991 | if (first_empty_slot) | 2994 | if (first_empty_slot) |
2992 | regindex = first_empty_slot; | 2995 | regindex = first_empty_slot; |
2993 | else { | 2996 | else { |
2994 | hw_dbg(hw, "No space in VLVF.\n"); | 2997 | hw_dbg(hw, "No space in VLVF.\n"); |
2995 | regindex = IXGBE_ERR_NO_SPACE; | 2998 | regindex = IXGBE_ERR_NO_SPACE; |
2996 | } | 2999 | } |
2997 | } | 3000 | } |
2998 | 3001 | ||
2999 | return regindex; | 3002 | return regindex; |
3000 | } | 3003 | } |
3001 | 3004 | ||
3002 | /** | 3005 | /** |
3003 | * ixgbe_set_vfta_generic - Set VLAN filter table | 3006 | * ixgbe_set_vfta_generic - Set VLAN filter table |
3004 | * @hw: pointer to hardware structure | 3007 | * @hw: pointer to hardware structure |
3005 | * @vlan: VLAN id to write to VLAN filter | 3008 | * @vlan: VLAN id to write to VLAN filter |
3006 | * @vind: VMDq output index that maps queue to VLAN id in VFVFB | 3009 | * @vind: VMDq output index that maps queue to VLAN id in VFVFB |
3007 | * @vlan_on: boolean flag to turn on/off VLAN in VFVF | 3010 | * @vlan_on: boolean flag to turn on/off VLAN in VFVF |
3008 | * | 3011 | * |
3009 | * Turn on/off specified VLAN in the VLAN filter table. | 3012 | * Turn on/off specified VLAN in the VLAN filter table. |
3010 | **/ | 3013 | **/ |
3011 | s32 ixgbe_set_vfta_generic(struct ixgbe_hw *hw, u32 vlan, u32 vind, | 3014 | s32 ixgbe_set_vfta_generic(struct ixgbe_hw *hw, u32 vlan, u32 vind, |
3012 | bool vlan_on) | 3015 | bool vlan_on) |
3013 | { | 3016 | { |
3014 | s32 regindex; | 3017 | s32 regindex; |
3015 | u32 bitindex; | 3018 | u32 bitindex; |
3016 | u32 vfta; | 3019 | u32 vfta; |
3017 | u32 bits; | 3020 | u32 bits; |
3018 | u32 vt; | 3021 | u32 vt; |
3019 | u32 targetbit; | 3022 | u32 targetbit; |
3020 | bool vfta_changed = false; | 3023 | bool vfta_changed = false; |
3021 | 3024 | ||
3022 | if (vlan > 4095) | 3025 | if (vlan > 4095) |
3023 | return IXGBE_ERR_PARAM; | 3026 | return IXGBE_ERR_PARAM; |
3024 | 3027 | ||
3025 | /* | 3028 | /* |
3026 | * this is a 2 part operation - first the VFTA, then the | 3029 | * this is a 2 part operation - first the VFTA, then the |
3027 | * VLVF and VLVFB if VT Mode is set | 3030 | * VLVF and VLVFB if VT Mode is set |
3028 | * We don't write the VFTA until we know the VLVF part succeeded. | 3031 | * We don't write the VFTA until we know the VLVF part succeeded. |
3029 | */ | 3032 | */ |
3030 | 3033 | ||
3031 | /* Part 1 | 3034 | /* Part 1 |
3032 | * The VFTA is a bitstring made up of 128 32-bit registers | 3035 | * The VFTA is a bitstring made up of 128 32-bit registers |
3033 | * that enable the particular VLAN id, much like the MTA: | 3036 | * that enable the particular VLAN id, much like the MTA: |
3034 | * bits[11-5]: which register | 3037 | * bits[11-5]: which register |
3035 | * bits[4-0]: which bit in the register | 3038 | * bits[4-0]: which bit in the register |
3036 | */ | 3039 | */ |
3037 | regindex = (vlan >> 5) & 0x7F; | 3040 | regindex = (vlan >> 5) & 0x7F; |
3038 | bitindex = vlan & 0x1F; | 3041 | bitindex = vlan & 0x1F; |
3039 | targetbit = (1 << bitindex); | 3042 | targetbit = (1 << bitindex); |
3040 | vfta = IXGBE_READ_REG(hw, IXGBE_VFTA(regindex)); | 3043 | vfta = IXGBE_READ_REG(hw, IXGBE_VFTA(regindex)); |
3041 | 3044 | ||
3042 | if (vlan_on) { | 3045 | if (vlan_on) { |
3043 | if (!(vfta & targetbit)) { | 3046 | if (!(vfta & targetbit)) { |
3044 | vfta |= targetbit; | 3047 | vfta |= targetbit; |
3045 | vfta_changed = true; | 3048 | vfta_changed = true; |
3046 | } | 3049 | } |
3047 | } else { | 3050 | } else { |
3048 | if ((vfta & targetbit)) { | 3051 | if ((vfta & targetbit)) { |
3049 | vfta &= ~targetbit; | 3052 | vfta &= ~targetbit; |
3050 | vfta_changed = true; | 3053 | vfta_changed = true; |
3051 | } | 3054 | } |
3052 | } | 3055 | } |
3053 | 3056 | ||
3054 | /* Part 2 | 3057 | /* Part 2 |
3055 | * If VT Mode is set | 3058 | * If VT Mode is set |
3056 | * Either vlan_on | 3059 | * Either vlan_on |
3057 | * make sure the vlan is in VLVF | 3060 | * make sure the vlan is in VLVF |
3058 | * set the vind bit in the matching VLVFB | 3061 | * set the vind bit in the matching VLVFB |
3059 | * Or !vlan_on | 3062 | * Or !vlan_on |
3060 | * clear the pool bit and possibly the vind | 3063 | * clear the pool bit and possibly the vind |
3061 | */ | 3064 | */ |
3062 | vt = IXGBE_READ_REG(hw, IXGBE_VT_CTL); | 3065 | vt = IXGBE_READ_REG(hw, IXGBE_VT_CTL); |
3063 | if (vt & IXGBE_VT_CTL_VT_ENABLE) { | 3066 | if (vt & IXGBE_VT_CTL_VT_ENABLE) { |
3064 | s32 vlvf_index; | 3067 | s32 vlvf_index; |
3065 | 3068 | ||
3066 | vlvf_index = ixgbe_find_vlvf_slot(hw, vlan); | 3069 | vlvf_index = ixgbe_find_vlvf_slot(hw, vlan); |
3067 | if (vlvf_index < 0) | 3070 | if (vlvf_index < 0) |
3068 | return vlvf_index; | 3071 | return vlvf_index; |
3069 | 3072 | ||
3070 | if (vlan_on) { | 3073 | if (vlan_on) { |
3071 | /* set the pool bit */ | 3074 | /* set the pool bit */ |
3072 | if (vind < 32) { | 3075 | if (vind < 32) { |
3073 | bits = IXGBE_READ_REG(hw, | 3076 | bits = IXGBE_READ_REG(hw, |
3074 | IXGBE_VLVFB(vlvf_index*2)); | 3077 | IXGBE_VLVFB(vlvf_index*2)); |
3075 | bits |= (1 << vind); | 3078 | bits |= (1 << vind); |
3076 | IXGBE_WRITE_REG(hw, | 3079 | IXGBE_WRITE_REG(hw, |
3077 | IXGBE_VLVFB(vlvf_index*2), | 3080 | IXGBE_VLVFB(vlvf_index*2), |
3078 | bits); | 3081 | bits); |
3079 | } else { | 3082 | } else { |
3080 | bits = IXGBE_READ_REG(hw, | 3083 | bits = IXGBE_READ_REG(hw, |
3081 | IXGBE_VLVFB((vlvf_index*2)+1)); | 3084 | IXGBE_VLVFB((vlvf_index*2)+1)); |
3082 | bits |= (1 << (vind-32)); | 3085 | bits |= (1 << (vind-32)); |
3083 | IXGBE_WRITE_REG(hw, | 3086 | IXGBE_WRITE_REG(hw, |
3084 | IXGBE_VLVFB((vlvf_index*2)+1), | 3087 | IXGBE_VLVFB((vlvf_index*2)+1), |
3085 | bits); | 3088 | bits); |
3086 | } | 3089 | } |
3087 | } else { | 3090 | } else { |
3088 | /* clear the pool bit */ | 3091 | /* clear the pool bit */ |
3089 | if (vind < 32) { | 3092 | if (vind < 32) { |
3090 | bits = IXGBE_READ_REG(hw, | 3093 | bits = IXGBE_READ_REG(hw, |
3091 | IXGBE_VLVFB(vlvf_index*2)); | 3094 | IXGBE_VLVFB(vlvf_index*2)); |
3092 | bits &= ~(1 << vind); | 3095 | bits &= ~(1 << vind); |
3093 | IXGBE_WRITE_REG(hw, | 3096 | IXGBE_WRITE_REG(hw, |
3094 | IXGBE_VLVFB(vlvf_index*2), | 3097 | IXGBE_VLVFB(vlvf_index*2), |
3095 | bits); | 3098 | bits); |
3096 | bits |= IXGBE_READ_REG(hw, | 3099 | bits |= IXGBE_READ_REG(hw, |
3097 | IXGBE_VLVFB((vlvf_index*2)+1)); | 3100 | IXGBE_VLVFB((vlvf_index*2)+1)); |
3098 | } else { | 3101 | } else { |
3099 | bits = IXGBE_READ_REG(hw, | 3102 | bits = IXGBE_READ_REG(hw, |
3100 | IXGBE_VLVFB((vlvf_index*2)+1)); | 3103 | IXGBE_VLVFB((vlvf_index*2)+1)); |
3101 | bits &= ~(1 << (vind-32)); | 3104 | bits &= ~(1 << (vind-32)); |
3102 | IXGBE_WRITE_REG(hw, | 3105 | IXGBE_WRITE_REG(hw, |
3103 | IXGBE_VLVFB((vlvf_index*2)+1), | 3106 | IXGBE_VLVFB((vlvf_index*2)+1), |
3104 | bits); | 3107 | bits); |
3105 | bits |= IXGBE_READ_REG(hw, | 3108 | bits |= IXGBE_READ_REG(hw, |
3106 | IXGBE_VLVFB(vlvf_index*2)); | 3109 | IXGBE_VLVFB(vlvf_index*2)); |
3107 | } | 3110 | } |
3108 | } | 3111 | } |
3109 | 3112 | ||
3110 | /* | 3113 | /* |
3111 | * If there are still bits set in the VLVFB registers | 3114 | * If there are still bits set in the VLVFB registers |
3112 | * for the VLAN ID indicated we need to see if the | 3115 | * for the VLAN ID indicated we need to see if the |
3113 | * caller is requesting that we clear the VFTA entry bit. | 3116 | * caller is requesting that we clear the VFTA entry bit. |
3114 | * If the caller has requested that we clear the VFTA | 3117 | * If the caller has requested that we clear the VFTA |
3115 | * entry bit but there are still pools/VFs using this VLAN | 3118 | * entry bit but there are still pools/VFs using this VLAN |
3116 | * ID entry then ignore the request. We're not worried | 3119 | * ID entry then ignore the request. We're not worried |
3117 | * about the case where we're turning the VFTA VLAN ID | 3120 | * about the case where we're turning the VFTA VLAN ID |
3118 | * entry bit on, only when requested to turn it off as | 3121 | * entry bit on, only when requested to turn it off as |
3119 | * there may be multiple pools and/or VFs using the | 3122 | * there may be multiple pools and/or VFs using the |
3120 | * VLAN ID entry. In that case we cannot clear the | 3123 | * VLAN ID entry. In that case we cannot clear the |
3121 | * VFTA bit until all pools/VFs using that VLAN ID have also | 3124 | * VFTA bit until all pools/VFs using that VLAN ID have also |
3122 | * been cleared. This will be indicated by "bits" being | 3125 | * been cleared. This will be indicated by "bits" being |
3123 | * zero. | 3126 | * zero. |
3124 | */ | 3127 | */ |
3125 | if (bits) { | 3128 | if (bits) { |
3126 | IXGBE_WRITE_REG(hw, IXGBE_VLVF(vlvf_index), | 3129 | IXGBE_WRITE_REG(hw, IXGBE_VLVF(vlvf_index), |
3127 | (IXGBE_VLVF_VIEN | vlan)); | 3130 | (IXGBE_VLVF_VIEN | vlan)); |
3128 | if (!vlan_on) { | 3131 | if (!vlan_on) { |
3129 | /* someone wants to clear the vfta entry | 3132 | /* someone wants to clear the vfta entry |
3130 | * but some pools/VFs are still using it. | 3133 | * but some pools/VFs are still using it. |
3131 | * Ignore it. */ | 3134 | * Ignore it. */ |
3132 | vfta_changed = false; | 3135 | vfta_changed = false; |
3133 | } | 3136 | } |
3134 | } | 3137 | } |
3135 | else | 3138 | else |
3136 | IXGBE_WRITE_REG(hw, IXGBE_VLVF(vlvf_index), 0); | 3139 | IXGBE_WRITE_REG(hw, IXGBE_VLVF(vlvf_index), 0); |
3137 | } | 3140 | } |
3138 | 3141 | ||
3139 | if (vfta_changed) | 3142 | if (vfta_changed) |
3140 | IXGBE_WRITE_REG(hw, IXGBE_VFTA(regindex), vfta); | 3143 | IXGBE_WRITE_REG(hw, IXGBE_VFTA(regindex), vfta); |
3141 | 3144 | ||
3142 | return 0; | 3145 | return 0; |
3143 | } | 3146 | } |
3144 | 3147 | ||
3145 | /** | 3148 | /** |
3146 | * ixgbe_clear_vfta_generic - Clear VLAN filter table | 3149 | * ixgbe_clear_vfta_generic - Clear VLAN filter table |
3147 | * @hw: pointer to hardware structure | 3150 | * @hw: pointer to hardware structure |
3148 | * | 3151 | * |
3149 | * Clears the VLAN filer table, and the VMDq index associated with the filter | 3152 | * Clears the VLAN filer table, and the VMDq index associated with the filter |
3150 | **/ | 3153 | **/ |
3151 | s32 ixgbe_clear_vfta_generic(struct ixgbe_hw *hw) | 3154 | s32 ixgbe_clear_vfta_generic(struct ixgbe_hw *hw) |
3152 | { | 3155 | { |
3153 | u32 offset; | 3156 | u32 offset; |
3154 | 3157 | ||
3155 | for (offset = 0; offset < hw->mac.vft_size; offset++) | 3158 | for (offset = 0; offset < hw->mac.vft_size; offset++) |
3156 | IXGBE_WRITE_REG(hw, IXGBE_VFTA(offset), 0); | 3159 | IXGBE_WRITE_REG(hw, IXGBE_VFTA(offset), 0); |
3157 | 3160 | ||
3158 | for (offset = 0; offset < IXGBE_VLVF_ENTRIES; offset++) { | 3161 | for (offset = 0; offset < IXGBE_VLVF_ENTRIES; offset++) { |
3159 | IXGBE_WRITE_REG(hw, IXGBE_VLVF(offset), 0); | 3162 | IXGBE_WRITE_REG(hw, IXGBE_VLVF(offset), 0); |
3160 | IXGBE_WRITE_REG(hw, IXGBE_VLVFB(offset*2), 0); | 3163 | IXGBE_WRITE_REG(hw, IXGBE_VLVFB(offset*2), 0); |
3161 | IXGBE_WRITE_REG(hw, IXGBE_VLVFB((offset*2)+1), 0); | 3164 | IXGBE_WRITE_REG(hw, IXGBE_VLVFB((offset*2)+1), 0); |
3162 | } | 3165 | } |
3163 | 3166 | ||
3164 | return 0; | 3167 | return 0; |
3165 | } | 3168 | } |
3166 | 3169 | ||
3167 | /** | 3170 | /** |
3168 | * ixgbe_check_mac_link_generic - Determine link and speed status | 3171 | * ixgbe_check_mac_link_generic - Determine link and speed status |
3169 | * @hw: pointer to hardware structure | 3172 | * @hw: pointer to hardware structure |
3170 | * @speed: pointer to link speed | 3173 | * @speed: pointer to link speed |
3171 | * @link_up: true when link is up | 3174 | * @link_up: true when link is up |
3172 | * @link_up_wait_to_complete: bool used to wait for link up or not | 3175 | * @link_up_wait_to_complete: bool used to wait for link up or not |
3173 | * | 3176 | * |
3174 | * Reads the links register to determine if link is up and the current speed | 3177 | * Reads the links register to determine if link is up and the current speed |
3175 | **/ | 3178 | **/ |
3176 | s32 ixgbe_check_mac_link_generic(struct ixgbe_hw *hw, ixgbe_link_speed *speed, | 3179 | s32 ixgbe_check_mac_link_generic(struct ixgbe_hw *hw, ixgbe_link_speed *speed, |
3177 | bool *link_up, bool link_up_wait_to_complete) | 3180 | bool *link_up, bool link_up_wait_to_complete) |
3178 | { | 3181 | { |
3179 | u32 links_reg, links_orig; | 3182 | u32 links_reg, links_orig; |
3180 | u32 i; | 3183 | u32 i; |
3181 | 3184 | ||
3182 | /* clear the old state */ | 3185 | /* clear the old state */ |
3183 | links_orig = IXGBE_READ_REG(hw, IXGBE_LINKS); | 3186 | links_orig = IXGBE_READ_REG(hw, IXGBE_LINKS); |
3184 | 3187 | ||
3185 | links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS); | 3188 | links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS); |
3186 | 3189 | ||
3187 | if (links_orig != links_reg) { | 3190 | if (links_orig != links_reg) { |
3188 | hw_dbg(hw, "LINKS changed from %08X to %08X\n", | 3191 | hw_dbg(hw, "LINKS changed from %08X to %08X\n", |
3189 | links_orig, links_reg); | 3192 | links_orig, links_reg); |
3190 | } | 3193 | } |
3191 | 3194 | ||
3192 | if (link_up_wait_to_complete) { | 3195 | if (link_up_wait_to_complete) { |
3193 | for (i = 0; i < IXGBE_LINK_UP_TIME; i++) { | 3196 | for (i = 0; i < IXGBE_LINK_UP_TIME; i++) { |
3194 | if (links_reg & IXGBE_LINKS_UP) { | 3197 | if (links_reg & IXGBE_LINKS_UP) { |
3195 | *link_up = true; | 3198 | *link_up = true; |
3196 | break; | 3199 | break; |
3197 | } else { | 3200 | } else { |
3198 | *link_up = false; | 3201 | *link_up = false; |
3199 | } | 3202 | } |
3200 | msleep(100); | 3203 | msleep(100); |
3201 | links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS); | 3204 | links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS); |
3202 | } | 3205 | } |
3203 | } else { | 3206 | } else { |
3204 | if (links_reg & IXGBE_LINKS_UP) | 3207 | if (links_reg & IXGBE_LINKS_UP) |
3205 | *link_up = true; | 3208 | *link_up = true; |
3206 | else | 3209 | else |
3207 | *link_up = false; | 3210 | *link_up = false; |
3208 | } | 3211 | } |
3209 | 3212 | ||
3210 | if ((links_reg & IXGBE_LINKS_SPEED_82599) == | 3213 | if ((links_reg & IXGBE_LINKS_SPEED_82599) == |
3211 | IXGBE_LINKS_SPEED_10G_82599) | 3214 | IXGBE_LINKS_SPEED_10G_82599) |
3212 | *speed = IXGBE_LINK_SPEED_10GB_FULL; | 3215 | *speed = IXGBE_LINK_SPEED_10GB_FULL; |
3213 | else if ((links_reg & IXGBE_LINKS_SPEED_82599) == | 3216 | else if ((links_reg & IXGBE_LINKS_SPEED_82599) == |
3214 | IXGBE_LINKS_SPEED_1G_82599) | 3217 | IXGBE_LINKS_SPEED_1G_82599) |
3215 | *speed = IXGBE_LINK_SPEED_1GB_FULL; | 3218 | *speed = IXGBE_LINK_SPEED_1GB_FULL; |
3216 | else if ((links_reg & IXGBE_LINKS_SPEED_82599) == | 3219 | else if ((links_reg & IXGBE_LINKS_SPEED_82599) == |
3217 | IXGBE_LINKS_SPEED_100_82599) | 3220 | IXGBE_LINKS_SPEED_100_82599) |
3218 | *speed = IXGBE_LINK_SPEED_100_FULL; | 3221 | *speed = IXGBE_LINK_SPEED_100_FULL; |
3219 | else | 3222 | else |
3220 | *speed = IXGBE_LINK_SPEED_UNKNOWN; | 3223 | *speed = IXGBE_LINK_SPEED_UNKNOWN; |
3221 | 3224 | ||
3222 | return 0; | 3225 | return 0; |
3223 | } | 3226 | } |
3224 | 3227 | ||
3225 | /** | 3228 | /** |
3226 | * ixgbe_get_wwn_prefix_generic - Get alternative WWNN/WWPN prefix from | 3229 | * ixgbe_get_wwn_prefix_generic - Get alternative WWNN/WWPN prefix from |
3227 | * the EEPROM | 3230 | * the EEPROM |
3228 | * @hw: pointer to hardware structure | 3231 | * @hw: pointer to hardware structure |
3229 | * @wwnn_prefix: the alternative WWNN prefix | 3232 | * @wwnn_prefix: the alternative WWNN prefix |
3230 | * @wwpn_prefix: the alternative WWPN prefix | 3233 | * @wwpn_prefix: the alternative WWPN prefix |
3231 | * | 3234 | * |
3232 | * This function will read the EEPROM from the alternative SAN MAC address | 3235 | * This function will read the EEPROM from the alternative SAN MAC address |
3233 | * block to check the support for the alternative WWNN/WWPN prefix support. | 3236 | * block to check the support for the alternative WWNN/WWPN prefix support. |
3234 | **/ | 3237 | **/ |
3235 | s32 ixgbe_get_wwn_prefix_generic(struct ixgbe_hw *hw, u16 *wwnn_prefix, | 3238 | s32 ixgbe_get_wwn_prefix_generic(struct ixgbe_hw *hw, u16 *wwnn_prefix, |
3236 | u16 *wwpn_prefix) | 3239 | u16 *wwpn_prefix) |
3237 | { | 3240 | { |
3238 | u16 offset, caps; | 3241 | u16 offset, caps; |
3239 | u16 alt_san_mac_blk_offset; | 3242 | u16 alt_san_mac_blk_offset; |
3240 | 3243 | ||
3241 | /* clear output first */ | 3244 | /* clear output first */ |
3242 | *wwnn_prefix = 0xFFFF; | 3245 | *wwnn_prefix = 0xFFFF; |
3243 | *wwpn_prefix = 0xFFFF; | 3246 | *wwpn_prefix = 0xFFFF; |
3244 | 3247 | ||
3245 | /* check if alternative SAN MAC is supported */ | 3248 | /* check if alternative SAN MAC is supported */ |
3246 | hw->eeprom.ops.read(hw, IXGBE_ALT_SAN_MAC_ADDR_BLK_PTR, | 3249 | hw->eeprom.ops.read(hw, IXGBE_ALT_SAN_MAC_ADDR_BLK_PTR, |
3247 | &alt_san_mac_blk_offset); | 3250 | &alt_san_mac_blk_offset); |
3248 | 3251 | ||
3249 | if ((alt_san_mac_blk_offset == 0) || | 3252 | if ((alt_san_mac_blk_offset == 0) || |
3250 | (alt_san_mac_blk_offset == 0xFFFF)) | 3253 | (alt_san_mac_blk_offset == 0xFFFF)) |
3251 | goto wwn_prefix_out; | 3254 | goto wwn_prefix_out; |
3252 | 3255 | ||
3253 | /* check capability in alternative san mac address block */ | 3256 | /* check capability in alternative san mac address block */ |
3254 | offset = alt_san_mac_blk_offset + IXGBE_ALT_SAN_MAC_ADDR_CAPS_OFFSET; | 3257 | offset = alt_san_mac_blk_offset + IXGBE_ALT_SAN_MAC_ADDR_CAPS_OFFSET; |
3255 | hw->eeprom.ops.read(hw, offset, &caps); | 3258 | hw->eeprom.ops.read(hw, offset, &caps); |
3256 | if (!(caps & IXGBE_ALT_SAN_MAC_ADDR_CAPS_ALTWWN)) | 3259 | if (!(caps & IXGBE_ALT_SAN_MAC_ADDR_CAPS_ALTWWN)) |
3257 | goto wwn_prefix_out; | 3260 | goto wwn_prefix_out; |
3258 | 3261 | ||
3259 | /* get the corresponding prefix for WWNN/WWPN */ | 3262 | /* get the corresponding prefix for WWNN/WWPN */ |
3260 | offset = alt_san_mac_blk_offset + IXGBE_ALT_SAN_MAC_ADDR_WWNN_OFFSET; | 3263 | offset = alt_san_mac_blk_offset + IXGBE_ALT_SAN_MAC_ADDR_WWNN_OFFSET; |
3261 | hw->eeprom.ops.read(hw, offset, wwnn_prefix); | 3264 | hw->eeprom.ops.read(hw, offset, wwnn_prefix); |
3262 | 3265 | ||
3263 | offset = alt_san_mac_blk_offset + IXGBE_ALT_SAN_MAC_ADDR_WWPN_OFFSET; | 3266 | offset = alt_san_mac_blk_offset + IXGBE_ALT_SAN_MAC_ADDR_WWPN_OFFSET; |
3264 | hw->eeprom.ops.read(hw, offset, wwpn_prefix); | 3267 | hw->eeprom.ops.read(hw, offset, wwpn_prefix); |
3265 | 3268 | ||
3266 | wwn_prefix_out: | 3269 | wwn_prefix_out: |
3267 | return 0; | 3270 | return 0; |
3268 | } | 3271 | } |
3269 | 3272 | ||
3270 | /** | 3273 | /** |
3271 | * ixgbe_set_mac_anti_spoofing - Enable/Disable MAC anti-spoofing | 3274 | * ixgbe_set_mac_anti_spoofing - Enable/Disable MAC anti-spoofing |
3272 | * @hw: pointer to hardware structure | 3275 | * @hw: pointer to hardware structure |
3273 | * @enable: enable or disable switch for anti-spoofing | 3276 | * @enable: enable or disable switch for anti-spoofing |
3274 | * @pf: Physical Function pool - do not enable anti-spoofing for the PF | 3277 | * @pf: Physical Function pool - do not enable anti-spoofing for the PF |
3275 | * | 3278 | * |
3276 | **/ | 3279 | **/ |
3277 | void ixgbe_set_mac_anti_spoofing(struct ixgbe_hw *hw, bool enable, int pf) | 3280 | void ixgbe_set_mac_anti_spoofing(struct ixgbe_hw *hw, bool enable, int pf) |
3278 | { | 3281 | { |
3279 | int j; | 3282 | int j; |
3280 | int pf_target_reg = pf >> 3; | 3283 | int pf_target_reg = pf >> 3; |
3281 | int pf_target_shift = pf % 8; | 3284 | int pf_target_shift = pf % 8; |
3282 | u32 pfvfspoof = 0; | 3285 | u32 pfvfspoof = 0; |
3283 | 3286 | ||
3284 | if (hw->mac.type == ixgbe_mac_82598EB) | 3287 | if (hw->mac.type == ixgbe_mac_82598EB) |
3285 | return; | 3288 | return; |
3286 | 3289 | ||
3287 | if (enable) | 3290 | if (enable) |
3288 | pfvfspoof = IXGBE_SPOOF_MACAS_MASK; | 3291 | pfvfspoof = IXGBE_SPOOF_MACAS_MASK; |
3289 | 3292 | ||
3290 | /* | 3293 | /* |
3291 | * PFVFSPOOF register array is size 8 with 8 bits assigned to | 3294 | * PFVFSPOOF register array is size 8 with 8 bits assigned to |
3292 | * MAC anti-spoof enables in each register array element. | 3295 | * MAC anti-spoof enables in each register array element. |
3293 | */ | 3296 | */ |
3294 | for (j = 0; j < pf_target_reg; j++) | 3297 | for (j = 0; j < pf_target_reg; j++) |
3295 | IXGBE_WRITE_REG(hw, IXGBE_PFVFSPOOF(j), pfvfspoof); | 3298 | IXGBE_WRITE_REG(hw, IXGBE_PFVFSPOOF(j), pfvfspoof); |
3296 | 3299 | ||
3297 | /* | 3300 | /* |
3298 | * The PF should be allowed to spoof so that it can support | 3301 | * The PF should be allowed to spoof so that it can support |
3299 | * emulation mode NICs. Do not set the bits assigned to the PF | 3302 | * emulation mode NICs. Do not set the bits assigned to the PF |
3300 | */ | 3303 | */ |
3301 | pfvfspoof &= (1 << pf_target_shift) - 1; | 3304 | pfvfspoof &= (1 << pf_target_shift) - 1; |
3302 | IXGBE_WRITE_REG(hw, IXGBE_PFVFSPOOF(j), pfvfspoof); | 3305 | IXGBE_WRITE_REG(hw, IXGBE_PFVFSPOOF(j), pfvfspoof); |
3303 | 3306 | ||
3304 | /* | 3307 | /* |
3305 | * Remaining pools belong to the PF so they do not need to have | 3308 | * Remaining pools belong to the PF so they do not need to have |
3306 | * anti-spoofing enabled. | 3309 | * anti-spoofing enabled. |
3307 | */ | 3310 | */ |
3308 | for (j++; j < IXGBE_PFVFSPOOF_REG_COUNT; j++) | 3311 | for (j++; j < IXGBE_PFVFSPOOF_REG_COUNT; j++) |
3309 | IXGBE_WRITE_REG(hw, IXGBE_PFVFSPOOF(j), 0); | 3312 | IXGBE_WRITE_REG(hw, IXGBE_PFVFSPOOF(j), 0); |
3310 | } | 3313 | } |
3311 | 3314 | ||
3312 | /** | 3315 | /** |
3313 | * ixgbe_set_vlan_anti_spoofing - Enable/Disable VLAN anti-spoofing | 3316 | * ixgbe_set_vlan_anti_spoofing - Enable/Disable VLAN anti-spoofing |
3314 | * @hw: pointer to hardware structure | 3317 | * @hw: pointer to hardware structure |
3315 | * @enable: enable or disable switch for VLAN anti-spoofing | 3318 | * @enable: enable or disable switch for VLAN anti-spoofing |
3316 | * @pf: Virtual Function pool - VF Pool to set for VLAN anti-spoofing | 3319 | * @pf: Virtual Function pool - VF Pool to set for VLAN anti-spoofing |
3317 | * | 3320 | * |
3318 | **/ | 3321 | **/ |
3319 | void ixgbe_set_vlan_anti_spoofing(struct ixgbe_hw *hw, bool enable, int vf) | 3322 | void ixgbe_set_vlan_anti_spoofing(struct ixgbe_hw *hw, bool enable, int vf) |
3320 | { | 3323 | { |
3321 | int vf_target_reg = vf >> 3; | 3324 | int vf_target_reg = vf >> 3; |
3322 | int vf_target_shift = vf % 8 + IXGBE_SPOOF_VLANAS_SHIFT; | 3325 | int vf_target_shift = vf % 8 + IXGBE_SPOOF_VLANAS_SHIFT; |
3323 | u32 pfvfspoof; | 3326 | u32 pfvfspoof; |
3324 | 3327 | ||
3325 | if (hw->mac.type == ixgbe_mac_82598EB) | 3328 | if (hw->mac.type == ixgbe_mac_82598EB) |
3326 | return; | 3329 | return; |
3327 | 3330 | ||
3328 | pfvfspoof = IXGBE_READ_REG(hw, IXGBE_PFVFSPOOF(vf_target_reg)); | 3331 | pfvfspoof = IXGBE_READ_REG(hw, IXGBE_PFVFSPOOF(vf_target_reg)); |
3329 | if (enable) | 3332 | if (enable) |
3330 | pfvfspoof |= (1 << vf_target_shift); | 3333 | pfvfspoof |= (1 << vf_target_shift); |
3331 | else | 3334 | else |
3332 | pfvfspoof &= ~(1 << vf_target_shift); | 3335 | pfvfspoof &= ~(1 << vf_target_shift); |
3333 | IXGBE_WRITE_REG(hw, IXGBE_PFVFSPOOF(vf_target_reg), pfvfspoof); | 3336 | IXGBE_WRITE_REG(hw, IXGBE_PFVFSPOOF(vf_target_reg), pfvfspoof); |
3334 | } | 3337 | } |
3335 | 3338 | ||
3336 | /** | 3339 | /** |
3337 | * ixgbe_get_device_caps_generic - Get additional device capabilities | 3340 | * ixgbe_get_device_caps_generic - Get additional device capabilities |
3338 | * @hw: pointer to hardware structure | 3341 | * @hw: pointer to hardware structure |
3339 | * @device_caps: the EEPROM word with the extra device capabilities | 3342 | * @device_caps: the EEPROM word with the extra device capabilities |
3340 | * | 3343 | * |
3341 | * This function will read the EEPROM location for the device capabilities, | 3344 | * This function will read the EEPROM location for the device capabilities, |
3342 | * and return the word through device_caps. | 3345 | * and return the word through device_caps. |
3343 | **/ | 3346 | **/ |
3344 | s32 ixgbe_get_device_caps_generic(struct ixgbe_hw *hw, u16 *device_caps) | 3347 | s32 ixgbe_get_device_caps_generic(struct ixgbe_hw *hw, u16 *device_caps) |
3345 | { | 3348 | { |
3346 | hw->eeprom.ops.read(hw, IXGBE_DEVICE_CAPS, device_caps); | 3349 | hw->eeprom.ops.read(hw, IXGBE_DEVICE_CAPS, device_caps); |
3347 | 3350 | ||
3348 | return 0; | 3351 | return 0; |
3349 | } | 3352 | } |
3350 | 3353 | ||
3351 | /** | 3354 | /** |
3352 | * ixgbe_set_rxpba_generic - Initialize RX packet buffer | 3355 | * ixgbe_set_rxpba_generic - Initialize RX packet buffer |
3353 | * @hw: pointer to hardware structure | 3356 | * @hw: pointer to hardware structure |
3354 | * @num_pb: number of packet buffers to allocate | 3357 | * @num_pb: number of packet buffers to allocate |
3355 | * @headroom: reserve n KB of headroom | 3358 | * @headroom: reserve n KB of headroom |
3356 | * @strategy: packet buffer allocation strategy | 3359 | * @strategy: packet buffer allocation strategy |
3357 | **/ | 3360 | **/ |
3358 | void ixgbe_set_rxpba_generic(struct ixgbe_hw *hw, | 3361 | void ixgbe_set_rxpba_generic(struct ixgbe_hw *hw, |
3359 | int num_pb, | 3362 | int num_pb, |
3360 | u32 headroom, | 3363 | u32 headroom, |
3361 | int strategy) | 3364 | int strategy) |
3362 | { | 3365 | { |
3363 | u32 pbsize = hw->mac.rx_pb_size; | 3366 | u32 pbsize = hw->mac.rx_pb_size; |
3364 | int i = 0; | 3367 | int i = 0; |
3365 | u32 rxpktsize, txpktsize, txpbthresh; | 3368 | u32 rxpktsize, txpktsize, txpbthresh; |
3366 | 3369 | ||
3367 | /* Reserve headroom */ | 3370 | /* Reserve headroom */ |
3368 | pbsize -= headroom; | 3371 | pbsize -= headroom; |
3369 | 3372 | ||
3370 | if (!num_pb) | 3373 | if (!num_pb) |
3371 | num_pb = 1; | 3374 | num_pb = 1; |
3372 | 3375 | ||
3373 | /* Divide remaining packet buffer space amongst the number | 3376 | /* Divide remaining packet buffer space amongst the number |
3374 | * of packet buffers requested using supplied strategy. | 3377 | * of packet buffers requested using supplied strategy. |
3375 | */ | 3378 | */ |
3376 | switch (strategy) { | 3379 | switch (strategy) { |
3377 | case (PBA_STRATEGY_WEIGHTED): | 3380 | case (PBA_STRATEGY_WEIGHTED): |
3378 | /* pba_80_48 strategy weight first half of packet buffer with | 3381 | /* pba_80_48 strategy weight first half of packet buffer with |
3379 | * 5/8 of the packet buffer space. | 3382 | * 5/8 of the packet buffer space. |
3380 | */ | 3383 | */ |
3381 | rxpktsize = ((pbsize * 5 * 2) / (num_pb * 8)); | 3384 | rxpktsize = ((pbsize * 5 * 2) / (num_pb * 8)); |
3382 | pbsize -= rxpktsize * (num_pb / 2); | 3385 | pbsize -= rxpktsize * (num_pb / 2); |
3383 | rxpktsize <<= IXGBE_RXPBSIZE_SHIFT; | 3386 | rxpktsize <<= IXGBE_RXPBSIZE_SHIFT; |
3384 | for (; i < (num_pb / 2); i++) | 3387 | for (; i < (num_pb / 2); i++) |
3385 | IXGBE_WRITE_REG(hw, IXGBE_RXPBSIZE(i), rxpktsize); | 3388 | IXGBE_WRITE_REG(hw, IXGBE_RXPBSIZE(i), rxpktsize); |
3386 | /* Fall through to configure remaining packet buffers */ | 3389 | /* Fall through to configure remaining packet buffers */ |
3387 | case (PBA_STRATEGY_EQUAL): | 3390 | case (PBA_STRATEGY_EQUAL): |
3388 | /* Divide the remaining Rx packet buffer evenly among the TCs */ | 3391 | /* Divide the remaining Rx packet buffer evenly among the TCs */ |
3389 | rxpktsize = (pbsize / (num_pb - i)) << IXGBE_RXPBSIZE_SHIFT; | 3392 | rxpktsize = (pbsize / (num_pb - i)) << IXGBE_RXPBSIZE_SHIFT; |
3390 | for (; i < num_pb; i++) | 3393 | for (; i < num_pb; i++) |
3391 | IXGBE_WRITE_REG(hw, IXGBE_RXPBSIZE(i), rxpktsize); | 3394 | IXGBE_WRITE_REG(hw, IXGBE_RXPBSIZE(i), rxpktsize); |
3392 | break; | 3395 | break; |
3393 | default: | 3396 | default: |
3394 | break; | 3397 | break; |
3395 | } | 3398 | } |
3396 | 3399 | ||
3397 | /* | 3400 | /* |
3398 | * Setup Tx packet buffer and threshold equally for all TCs | 3401 | * Setup Tx packet buffer and threshold equally for all TCs |
3399 | * TXPBTHRESH register is set in K so divide by 1024 and subtract | 3402 | * TXPBTHRESH register is set in K so divide by 1024 and subtract |
3400 | * 10 since the largest packet we support is just over 9K. | 3403 | * 10 since the largest packet we support is just over 9K. |
3401 | */ | 3404 | */ |
3402 | txpktsize = IXGBE_TXPBSIZE_MAX / num_pb; | 3405 | txpktsize = IXGBE_TXPBSIZE_MAX / num_pb; |
3403 | txpbthresh = (txpktsize / 1024) - IXGBE_TXPKT_SIZE_MAX; | 3406 | txpbthresh = (txpktsize / 1024) - IXGBE_TXPKT_SIZE_MAX; |
3404 | for (i = 0; i < num_pb; i++) { | 3407 | for (i = 0; i < num_pb; i++) { |
3405 | IXGBE_WRITE_REG(hw, IXGBE_TXPBSIZE(i), txpktsize); | 3408 | IXGBE_WRITE_REG(hw, IXGBE_TXPBSIZE(i), txpktsize); |
3406 | IXGBE_WRITE_REG(hw, IXGBE_TXPBTHRESH(i), txpbthresh); | 3409 | IXGBE_WRITE_REG(hw, IXGBE_TXPBTHRESH(i), txpbthresh); |
3407 | } | 3410 | } |
3408 | 3411 | ||
3409 | /* Clear unused TCs, if any, to zero buffer size*/ | 3412 | /* Clear unused TCs, if any, to zero buffer size*/ |
3410 | for (; i < IXGBE_MAX_PB; i++) { | 3413 | for (; i < IXGBE_MAX_PB; i++) { |
3411 | IXGBE_WRITE_REG(hw, IXGBE_RXPBSIZE(i), 0); | 3414 | IXGBE_WRITE_REG(hw, IXGBE_RXPBSIZE(i), 0); |
3412 | IXGBE_WRITE_REG(hw, IXGBE_TXPBSIZE(i), 0); | 3415 | IXGBE_WRITE_REG(hw, IXGBE_TXPBSIZE(i), 0); |
3413 | IXGBE_WRITE_REG(hw, IXGBE_TXPBTHRESH(i), 0); | 3416 | IXGBE_WRITE_REG(hw, IXGBE_TXPBTHRESH(i), 0); |
3414 | } | 3417 | } |
3415 | } | 3418 | } |
3416 | 3419 | ||
3417 | /** | 3420 | /** |
3418 | * ixgbe_calculate_checksum - Calculate checksum for buffer | 3421 | * ixgbe_calculate_checksum - Calculate checksum for buffer |
3419 | * @buffer: pointer to EEPROM | 3422 | * @buffer: pointer to EEPROM |
3420 | * @length: size of EEPROM to calculate a checksum for | 3423 | * @length: size of EEPROM to calculate a checksum for |
3421 | * | 3424 | * |
3422 | * Calculates the checksum for some buffer on a specified length. The | 3425 | * Calculates the checksum for some buffer on a specified length. The |
3423 | * checksum calculated is returned. | 3426 | * checksum calculated is returned. |
3424 | **/ | 3427 | **/ |
3425 | static u8 ixgbe_calculate_checksum(u8 *buffer, u32 length) | 3428 | static u8 ixgbe_calculate_checksum(u8 *buffer, u32 length) |
3426 | { | 3429 | { |
3427 | u32 i; | 3430 | u32 i; |
3428 | u8 sum = 0; | 3431 | u8 sum = 0; |
3429 | 3432 | ||
3430 | if (!buffer) | 3433 | if (!buffer) |
3431 | return 0; | 3434 | return 0; |
3432 | 3435 | ||
3433 | for (i = 0; i < length; i++) | 3436 | for (i = 0; i < length; i++) |
3434 | sum += buffer[i]; | 3437 | sum += buffer[i]; |
3435 | 3438 | ||
3436 | return (u8) (0 - sum); | 3439 | return (u8) (0 - sum); |
3437 | } | 3440 | } |
3438 | 3441 | ||
3439 | /** | 3442 | /** |
3440 | * ixgbe_host_interface_command - Issue command to manageability block | 3443 | * ixgbe_host_interface_command - Issue command to manageability block |
3441 | * @hw: pointer to the HW structure | 3444 | * @hw: pointer to the HW structure |
3442 | * @buffer: contains the command to write and where the return status will | 3445 | * @buffer: contains the command to write and where the return status will |
3443 | * be placed | 3446 | * be placed |
3444 | * @length: length of buffer, must be multiple of 4 bytes | 3447 | * @length: length of buffer, must be multiple of 4 bytes |
3445 | * | 3448 | * |
3446 | * Communicates with the manageability block. On success return 0 | 3449 | * Communicates with the manageability block. On success return 0 |
3447 | * else return IXGBE_ERR_HOST_INTERFACE_COMMAND. | 3450 | * else return IXGBE_ERR_HOST_INTERFACE_COMMAND. |
3448 | **/ | 3451 | **/ |
3449 | static s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer, | 3452 | static s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer, |
3450 | u32 length) | 3453 | u32 length) |
3451 | { | 3454 | { |
3452 | u32 hicr, i, bi; | 3455 | u32 hicr, i, bi; |
3453 | u32 hdr_size = sizeof(struct ixgbe_hic_hdr); | 3456 | u32 hdr_size = sizeof(struct ixgbe_hic_hdr); |
3454 | u8 buf_len, dword_len; | 3457 | u8 buf_len, dword_len; |
3455 | 3458 | ||
3456 | s32 ret_val = 0; | 3459 | s32 ret_val = 0; |
3457 | 3460 | ||
3458 | if (length == 0 || length & 0x3 || | 3461 | if (length == 0 || length & 0x3 || |
3459 | length > IXGBE_HI_MAX_BLOCK_BYTE_LENGTH) { | 3462 | length > IXGBE_HI_MAX_BLOCK_BYTE_LENGTH) { |
3460 | hw_dbg(hw, "Buffer length failure.\n"); | 3463 | hw_dbg(hw, "Buffer length failure.\n"); |
3461 | ret_val = IXGBE_ERR_HOST_INTERFACE_COMMAND; | 3464 | ret_val = IXGBE_ERR_HOST_INTERFACE_COMMAND; |
3462 | goto out; | 3465 | goto out; |
3463 | } | 3466 | } |
3464 | 3467 | ||
3465 | /* Check that the host interface is enabled. */ | 3468 | /* Check that the host interface is enabled. */ |
3466 | hicr = IXGBE_READ_REG(hw, IXGBE_HICR); | 3469 | hicr = IXGBE_READ_REG(hw, IXGBE_HICR); |
3467 | if ((hicr & IXGBE_HICR_EN) == 0) { | 3470 | if ((hicr & IXGBE_HICR_EN) == 0) { |
3468 | hw_dbg(hw, "IXGBE_HOST_EN bit disabled.\n"); | 3471 | hw_dbg(hw, "IXGBE_HOST_EN bit disabled.\n"); |
3469 | ret_val = IXGBE_ERR_HOST_INTERFACE_COMMAND; | 3472 | ret_val = IXGBE_ERR_HOST_INTERFACE_COMMAND; |
3470 | goto out; | 3473 | goto out; |
3471 | } | 3474 | } |
3472 | 3475 | ||
3473 | /* Calculate length in DWORDs */ | 3476 | /* Calculate length in DWORDs */ |
3474 | dword_len = length >> 2; | 3477 | dword_len = length >> 2; |
3475 | 3478 | ||
3476 | /* | 3479 | /* |
3477 | * The device driver writes the relevant command block | 3480 | * The device driver writes the relevant command block |
3478 | * into the ram area. | 3481 | * into the ram area. |
3479 | */ | 3482 | */ |
3480 | for (i = 0; i < dword_len; i++) | 3483 | for (i = 0; i < dword_len; i++) |
3481 | IXGBE_WRITE_REG_ARRAY(hw, IXGBE_FLEX_MNG, | 3484 | IXGBE_WRITE_REG_ARRAY(hw, IXGBE_FLEX_MNG, |
3482 | i, cpu_to_le32(buffer[i])); | 3485 | i, cpu_to_le32(buffer[i])); |
3483 | 3486 | ||
3484 | /* Setting this bit tells the ARC that a new command is pending. */ | 3487 | /* Setting this bit tells the ARC that a new command is pending. */ |
3485 | IXGBE_WRITE_REG(hw, IXGBE_HICR, hicr | IXGBE_HICR_C); | 3488 | IXGBE_WRITE_REG(hw, IXGBE_HICR, hicr | IXGBE_HICR_C); |
3486 | 3489 | ||
3487 | for (i = 0; i < IXGBE_HI_COMMAND_TIMEOUT; i++) { | 3490 | for (i = 0; i < IXGBE_HI_COMMAND_TIMEOUT; i++) { |
3488 | hicr = IXGBE_READ_REG(hw, IXGBE_HICR); | 3491 | hicr = IXGBE_READ_REG(hw, IXGBE_HICR); |
3489 | if (!(hicr & IXGBE_HICR_C)) | 3492 | if (!(hicr & IXGBE_HICR_C)) |
3490 | break; | 3493 | break; |
3491 | usleep_range(1000, 2000); | 3494 | usleep_range(1000, 2000); |
3492 | } | 3495 | } |
3493 | 3496 | ||
3494 | /* Check command successful completion. */ | 3497 | /* Check command successful completion. */ |
3495 | if (i == IXGBE_HI_COMMAND_TIMEOUT || | 3498 | if (i == IXGBE_HI_COMMAND_TIMEOUT || |
3496 | (!(IXGBE_READ_REG(hw, IXGBE_HICR) & IXGBE_HICR_SV))) { | 3499 | (!(IXGBE_READ_REG(hw, IXGBE_HICR) & IXGBE_HICR_SV))) { |
3497 | hw_dbg(hw, "Command has failed with no status valid.\n"); | 3500 | hw_dbg(hw, "Command has failed with no status valid.\n"); |
3498 | ret_val = IXGBE_ERR_HOST_INTERFACE_COMMAND; | 3501 | ret_val = IXGBE_ERR_HOST_INTERFACE_COMMAND; |
3499 | goto out; | 3502 | goto out; |
3500 | } | 3503 | } |
3501 | 3504 | ||
3502 | /* Calculate length in DWORDs */ | 3505 | /* Calculate length in DWORDs */ |
3503 | dword_len = hdr_size >> 2; | 3506 | dword_len = hdr_size >> 2; |
3504 | 3507 | ||
3505 | /* first pull in the header so we know the buffer length */ | 3508 | /* first pull in the header so we know the buffer length */ |
3506 | for (bi = 0; bi < dword_len; bi++) { | 3509 | for (bi = 0; bi < dword_len; bi++) { |
3507 | buffer[bi] = IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG, bi); | 3510 | buffer[bi] = IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG, bi); |
3508 | le32_to_cpus(&buffer[bi]); | 3511 | le32_to_cpus(&buffer[bi]); |
3509 | } | 3512 | } |
3510 | 3513 | ||
3511 | /* If there is any thing in data position pull it in */ | 3514 | /* If there is any thing in data position pull it in */ |
3512 | buf_len = ((struct ixgbe_hic_hdr *)buffer)->buf_len; | 3515 | buf_len = ((struct ixgbe_hic_hdr *)buffer)->buf_len; |
3513 | if (buf_len == 0) | 3516 | if (buf_len == 0) |
3514 | goto out; | 3517 | goto out; |
3515 | 3518 | ||
3516 | if (length < (buf_len + hdr_size)) { | 3519 | if (length < (buf_len + hdr_size)) { |
3517 | hw_dbg(hw, "Buffer not large enough for reply message.\n"); | 3520 | hw_dbg(hw, "Buffer not large enough for reply message.\n"); |
3518 | ret_val = IXGBE_ERR_HOST_INTERFACE_COMMAND; | 3521 | ret_val = IXGBE_ERR_HOST_INTERFACE_COMMAND; |
3519 | goto out; | 3522 | goto out; |
3520 | } | 3523 | } |
3521 | 3524 | ||
3522 | /* Calculate length in DWORDs, add 3 for odd lengths */ | 3525 | /* Calculate length in DWORDs, add 3 for odd lengths */ |
3523 | dword_len = (buf_len + 3) >> 2; | 3526 | dword_len = (buf_len + 3) >> 2; |
3524 | 3527 | ||
3525 | /* Pull in the rest of the buffer (bi is where we left off)*/ | 3528 | /* Pull in the rest of the buffer (bi is where we left off)*/ |
3526 | for (; bi <= dword_len; bi++) { | 3529 | for (; bi <= dword_len; bi++) { |
3527 | buffer[bi] = IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG, bi); | 3530 | buffer[bi] = IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG, bi); |
3528 | le32_to_cpus(&buffer[bi]); | 3531 | le32_to_cpus(&buffer[bi]); |
3529 | } | 3532 | } |
3530 | 3533 | ||
3531 | out: | 3534 | out: |
3532 | return ret_val; | 3535 | return ret_val; |
3533 | } | 3536 | } |
3534 | 3537 | ||
3535 | /** | 3538 | /** |
3536 | * ixgbe_set_fw_drv_ver_generic - Sends driver version to firmware | 3539 | * ixgbe_set_fw_drv_ver_generic - Sends driver version to firmware |
3537 | * @hw: pointer to the HW structure | 3540 | * @hw: pointer to the HW structure |
3538 | * @maj: driver version major number | 3541 | * @maj: driver version major number |
3539 | * @min: driver version minor number | 3542 | * @min: driver version minor number |
3540 | * @build: driver version build number | 3543 | * @build: driver version build number |
3541 | * @sub: driver version sub build number | 3544 | * @sub: driver version sub build number |
3542 | * | 3545 | * |
3543 | * Sends driver version number to firmware through the manageability | 3546 | * Sends driver version number to firmware through the manageability |
3544 | * block. On success return 0 | 3547 | * block. On success return 0 |
3545 | * else returns IXGBE_ERR_SWFW_SYNC when encountering an error acquiring | 3548 | * else returns IXGBE_ERR_SWFW_SYNC when encountering an error acquiring |
3546 | * semaphore or IXGBE_ERR_HOST_INTERFACE_COMMAND when command fails. | 3549 | * semaphore or IXGBE_ERR_HOST_INTERFACE_COMMAND when command fails. |
3547 | **/ | 3550 | **/ |
3548 | s32 ixgbe_set_fw_drv_ver_generic(struct ixgbe_hw *hw, u8 maj, u8 min, | 3551 | s32 ixgbe_set_fw_drv_ver_generic(struct ixgbe_hw *hw, u8 maj, u8 min, |
3549 | u8 build, u8 sub) | 3552 | u8 build, u8 sub) |
3550 | { | 3553 | { |
3551 | struct ixgbe_hic_drv_info fw_cmd; | 3554 | struct ixgbe_hic_drv_info fw_cmd; |
3552 | int i; | 3555 | int i; |
3553 | s32 ret_val = 0; | 3556 | s32 ret_val = 0; |
3554 | 3557 | ||
3555 | if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_SW_MNG_SM) != 0) { | 3558 | if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_SW_MNG_SM) != 0) { |
3556 | ret_val = IXGBE_ERR_SWFW_SYNC; | 3559 | ret_val = IXGBE_ERR_SWFW_SYNC; |
3557 | goto out; | 3560 | goto out; |
3558 | } | 3561 | } |
3559 | 3562 | ||
3560 | fw_cmd.hdr.cmd = FW_CEM_CMD_DRIVER_INFO; | 3563 | fw_cmd.hdr.cmd = FW_CEM_CMD_DRIVER_INFO; |
3561 | fw_cmd.hdr.buf_len = FW_CEM_CMD_DRIVER_INFO_LEN; | 3564 | fw_cmd.hdr.buf_len = FW_CEM_CMD_DRIVER_INFO_LEN; |
3562 | fw_cmd.hdr.cmd_or_resp.cmd_resv = FW_CEM_CMD_RESERVED; | 3565 | fw_cmd.hdr.cmd_or_resp.cmd_resv = FW_CEM_CMD_RESERVED; |
3563 | fw_cmd.port_num = (u8)hw->bus.func; | 3566 | fw_cmd.port_num = (u8)hw->bus.func; |
3564 | fw_cmd.ver_maj = maj; | 3567 | fw_cmd.ver_maj = maj; |
3565 | fw_cmd.ver_min = min; | 3568 | fw_cmd.ver_min = min; |
3566 | fw_cmd.ver_build = build; | 3569 | fw_cmd.ver_build = build; |
3567 | fw_cmd.ver_sub = sub; | 3570 | fw_cmd.ver_sub = sub; |
3568 | fw_cmd.hdr.checksum = 0; | 3571 | fw_cmd.hdr.checksum = 0; |
3569 | fw_cmd.hdr.checksum = ixgbe_calculate_checksum((u8 *)&fw_cmd, | 3572 | fw_cmd.hdr.checksum = ixgbe_calculate_checksum((u8 *)&fw_cmd, |
3570 | (FW_CEM_HDR_LEN + fw_cmd.hdr.buf_len)); | 3573 | (FW_CEM_HDR_LEN + fw_cmd.hdr.buf_len)); |
3571 | fw_cmd.pad = 0; | 3574 | fw_cmd.pad = 0; |
3572 | fw_cmd.pad2 = 0; | 3575 | fw_cmd.pad2 = 0; |
3573 | 3576 | ||
3574 | for (i = 0; i <= FW_CEM_MAX_RETRIES; i++) { | 3577 | for (i = 0; i <= FW_CEM_MAX_RETRIES; i++) { |
3575 | ret_val = ixgbe_host_interface_command(hw, (u32 *)&fw_cmd, | 3578 | ret_val = ixgbe_host_interface_command(hw, (u32 *)&fw_cmd, |
3576 | sizeof(fw_cmd)); | 3579 | sizeof(fw_cmd)); |
3577 | if (ret_val != 0) | 3580 | if (ret_val != 0) |
3578 | continue; | 3581 | continue; |
3579 | 3582 | ||
3580 | if (fw_cmd.hdr.cmd_or_resp.ret_status == | 3583 | if (fw_cmd.hdr.cmd_or_resp.ret_status == |
3581 | FW_CEM_RESP_STATUS_SUCCESS) | 3584 | FW_CEM_RESP_STATUS_SUCCESS) |
3582 | ret_val = 0; | 3585 | ret_val = 0; |
3583 | else | 3586 | else |
3584 | ret_val = IXGBE_ERR_HOST_INTERFACE_COMMAND; | 3587 | ret_val = IXGBE_ERR_HOST_INTERFACE_COMMAND; |
3585 | 3588 | ||
3586 | break; | 3589 | break; |
3587 | } | 3590 | } |
3588 | 3591 | ||
3589 | hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_SW_MNG_SM); | 3592 | hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_SW_MNG_SM); |
3590 | out: | 3593 | out: |
3591 | return ret_val; | 3594 | return ret_val; |
3592 | } | 3595 | } |
3593 | 3596 | ||
3594 | /** | 3597 | /** |
3595 | * ixgbe_clear_tx_pending - Clear pending TX work from the PCIe fifo | 3598 | * ixgbe_clear_tx_pending - Clear pending TX work from the PCIe fifo |
3596 | * @hw: pointer to the hardware structure | 3599 | * @hw: pointer to the hardware structure |
3597 | * | 3600 | * |
3598 | * The 82599 and x540 MACs can experience issues if TX work is still pending | 3601 | * The 82599 and x540 MACs can experience issues if TX work is still pending |
3599 | * when a reset occurs. This function prevents this by flushing the PCIe | 3602 | * when a reset occurs. This function prevents this by flushing the PCIe |
3600 | * buffers on the system. | 3603 | * buffers on the system. |
3601 | **/ | 3604 | **/ |
3602 | void ixgbe_clear_tx_pending(struct ixgbe_hw *hw) | 3605 | void ixgbe_clear_tx_pending(struct ixgbe_hw *hw) |
3603 | { | 3606 | { |
3604 | u32 gcr_ext, hlreg0; | 3607 | u32 gcr_ext, hlreg0; |
3605 | 3608 | ||
3606 | /* | 3609 | /* |
3607 | * If double reset is not requested then all transactions should | 3610 | * If double reset is not requested then all transactions should |
3608 | * already be clear and as such there is no work to do | 3611 | * already be clear and as such there is no work to do |
3609 | */ | 3612 | */ |
3610 | if (!(hw->mac.flags & IXGBE_FLAGS_DOUBLE_RESET_REQUIRED)) | 3613 | if (!(hw->mac.flags & IXGBE_FLAGS_DOUBLE_RESET_REQUIRED)) |
3611 | return; | 3614 | return; |
3612 | 3615 | ||
3613 | /* | 3616 | /* |
3614 | * Set loopback enable to prevent any transmits from being sent | 3617 | * Set loopback enable to prevent any transmits from being sent |
3615 | * should the link come up. This assumes that the RXCTRL.RXEN bit | 3618 | * should the link come up. This assumes that the RXCTRL.RXEN bit |
3616 | * has already been cleared. | 3619 | * has already been cleared. |
3617 | */ | 3620 | */ |
3618 | hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0); | 3621 | hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0); |
3619 | IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg0 | IXGBE_HLREG0_LPBK); | 3622 | IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg0 | IXGBE_HLREG0_LPBK); |
3620 | 3623 | ||
3621 | /* initiate cleaning flow for buffers in the PCIe transaction layer */ | 3624 | /* initiate cleaning flow for buffers in the PCIe transaction layer */ |
3622 | gcr_ext = IXGBE_READ_REG(hw, IXGBE_GCR_EXT); | 3625 | gcr_ext = IXGBE_READ_REG(hw, IXGBE_GCR_EXT); |
3623 | IXGBE_WRITE_REG(hw, IXGBE_GCR_EXT, | 3626 | IXGBE_WRITE_REG(hw, IXGBE_GCR_EXT, |
3624 | gcr_ext | IXGBE_GCR_EXT_BUFFERS_CLEAR); | 3627 | gcr_ext | IXGBE_GCR_EXT_BUFFERS_CLEAR); |
3625 | 3628 | ||
3626 | /* Flush all writes and allow 20usec for all transactions to clear */ | 3629 | /* Flush all writes and allow 20usec for all transactions to clear */ |
3627 | IXGBE_WRITE_FLUSH(hw); | 3630 | IXGBE_WRITE_FLUSH(hw); |
3628 | udelay(20); | 3631 | udelay(20); |
3629 | 3632 | ||
3630 | /* restore previous register values */ | 3633 | /* restore previous register values */ |
3631 | IXGBE_WRITE_REG(hw, IXGBE_GCR_EXT, gcr_ext); | 3634 | IXGBE_WRITE_REG(hw, IXGBE_GCR_EXT, gcr_ext); |
3632 | IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg0); | 3635 | IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg0); |
3633 | } | 3636 | } |
3634 | 3637 | ||
3635 | static const u8 ixgbe_emc_temp_data[4] = { | 3638 | static const u8 ixgbe_emc_temp_data[4] = { |
3636 | IXGBE_EMC_INTERNAL_DATA, | 3639 | IXGBE_EMC_INTERNAL_DATA, |
3637 | IXGBE_EMC_DIODE1_DATA, | 3640 | IXGBE_EMC_DIODE1_DATA, |
3638 | IXGBE_EMC_DIODE2_DATA, | 3641 | IXGBE_EMC_DIODE2_DATA, |
3639 | IXGBE_EMC_DIODE3_DATA | 3642 | IXGBE_EMC_DIODE3_DATA |
3640 | }; | 3643 | }; |
3641 | static const u8 ixgbe_emc_therm_limit[4] = { | 3644 | static const u8 ixgbe_emc_therm_limit[4] = { |
3642 | IXGBE_EMC_INTERNAL_THERM_LIMIT, | 3645 | IXGBE_EMC_INTERNAL_THERM_LIMIT, |
3643 | IXGBE_EMC_DIODE1_THERM_LIMIT, | 3646 | IXGBE_EMC_DIODE1_THERM_LIMIT, |
3644 | IXGBE_EMC_DIODE2_THERM_LIMIT, | 3647 | IXGBE_EMC_DIODE2_THERM_LIMIT, |
3645 | IXGBE_EMC_DIODE3_THERM_LIMIT | 3648 | IXGBE_EMC_DIODE3_THERM_LIMIT |
3646 | }; | 3649 | }; |
3647 | 3650 | ||
3648 | /** | 3651 | /** |
3649 | * ixgbe_get_ets_data - Extracts the ETS bit data | 3652 | * ixgbe_get_ets_data - Extracts the ETS bit data |
3650 | * @hw: pointer to hardware structure | 3653 | * @hw: pointer to hardware structure |
3651 | * @ets_cfg: extected ETS data | 3654 | * @ets_cfg: extected ETS data |
3652 | * @ets_offset: offset of ETS data | 3655 | * @ets_offset: offset of ETS data |
3653 | * | 3656 | * |
3654 | * Returns error code. | 3657 | * Returns error code. |
3655 | **/ | 3658 | **/ |
3656 | static s32 ixgbe_get_ets_data(struct ixgbe_hw *hw, u16 *ets_cfg, | 3659 | static s32 ixgbe_get_ets_data(struct ixgbe_hw *hw, u16 *ets_cfg, |
3657 | u16 *ets_offset) | 3660 | u16 *ets_offset) |
3658 | { | 3661 | { |
3659 | s32 status = 0; | 3662 | s32 status = 0; |
3660 | 3663 | ||
3661 | status = hw->eeprom.ops.read(hw, IXGBE_ETS_CFG, ets_offset); | 3664 | status = hw->eeprom.ops.read(hw, IXGBE_ETS_CFG, ets_offset); |
3662 | if (status) | 3665 | if (status) |
3663 | goto out; | 3666 | goto out; |
3664 | 3667 | ||
3665 | if ((*ets_offset == 0x0000) || (*ets_offset == 0xFFFF)) { | 3668 | if ((*ets_offset == 0x0000) || (*ets_offset == 0xFFFF)) { |
3666 | status = IXGBE_NOT_IMPLEMENTED; | 3669 | status = IXGBE_NOT_IMPLEMENTED; |
3667 | goto out; | 3670 | goto out; |
3668 | } | 3671 | } |
3669 | 3672 | ||
3670 | status = hw->eeprom.ops.read(hw, *ets_offset, ets_cfg); | 3673 | status = hw->eeprom.ops.read(hw, *ets_offset, ets_cfg); |
3671 | if (status) | 3674 | if (status) |
3672 | goto out; | 3675 | goto out; |
3673 | 3676 | ||
3674 | if ((*ets_cfg & IXGBE_ETS_TYPE_MASK) != IXGBE_ETS_TYPE_EMC_SHIFTED) { | 3677 | if ((*ets_cfg & IXGBE_ETS_TYPE_MASK) != IXGBE_ETS_TYPE_EMC_SHIFTED) { |
3675 | status = IXGBE_NOT_IMPLEMENTED; | 3678 | status = IXGBE_NOT_IMPLEMENTED; |
3676 | goto out; | 3679 | goto out; |
3677 | } | 3680 | } |
3678 | 3681 | ||
3679 | out: | 3682 | out: |
3680 | return status; | 3683 | return status; |
3681 | } | 3684 | } |
3682 | 3685 | ||
3683 | /** | 3686 | /** |
3684 | * ixgbe_get_thermal_sensor_data - Gathers thermal sensor data | 3687 | * ixgbe_get_thermal_sensor_data - Gathers thermal sensor data |
3685 | * @hw: pointer to hardware structure | 3688 | * @hw: pointer to hardware structure |
3686 | * | 3689 | * |
3687 | * Returns the thermal sensor data structure | 3690 | * Returns the thermal sensor data structure |
3688 | **/ | 3691 | **/ |
3689 | s32 ixgbe_get_thermal_sensor_data_generic(struct ixgbe_hw *hw) | 3692 | s32 ixgbe_get_thermal_sensor_data_generic(struct ixgbe_hw *hw) |
3690 | { | 3693 | { |
3691 | s32 status = 0; | 3694 | s32 status = 0; |
3692 | u16 ets_offset; | 3695 | u16 ets_offset; |
3693 | u16 ets_cfg; | 3696 | u16 ets_cfg; |
3694 | u16 ets_sensor; | 3697 | u16 ets_sensor; |
3695 | u8 num_sensors; | 3698 | u8 num_sensors; |
3696 | u8 i; | 3699 | u8 i; |
3697 | struct ixgbe_thermal_sensor_data *data = &hw->mac.thermal_sensor_data; | 3700 | struct ixgbe_thermal_sensor_data *data = &hw->mac.thermal_sensor_data; |
3698 | 3701 | ||
3699 | /* Only support thermal sensors attached to physical port 0 */ | 3702 | /* Only support thermal sensors attached to physical port 0 */ |
3700 | if ((IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_LAN_ID_1)) { | 3703 | if ((IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_LAN_ID_1)) { |
3701 | status = IXGBE_NOT_IMPLEMENTED; | 3704 | status = IXGBE_NOT_IMPLEMENTED; |
3702 | goto out; | 3705 | goto out; |
3703 | } | 3706 | } |
3704 | 3707 | ||
3705 | status = ixgbe_get_ets_data(hw, &ets_cfg, &ets_offset); | 3708 | status = ixgbe_get_ets_data(hw, &ets_cfg, &ets_offset); |
3706 | if (status) | 3709 | if (status) |
3707 | goto out; | 3710 | goto out; |
3708 | 3711 | ||
3709 | num_sensors = (ets_cfg & IXGBE_ETS_NUM_SENSORS_MASK); | 3712 | num_sensors = (ets_cfg & IXGBE_ETS_NUM_SENSORS_MASK); |
3710 | if (num_sensors > IXGBE_MAX_SENSORS) | 3713 | if (num_sensors > IXGBE_MAX_SENSORS) |
3711 | num_sensors = IXGBE_MAX_SENSORS; | 3714 | num_sensors = IXGBE_MAX_SENSORS; |
3712 | 3715 | ||
3713 | for (i = 0; i < num_sensors; i++) { | 3716 | for (i = 0; i < num_sensors; i++) { |
3714 | u8 sensor_index; | 3717 | u8 sensor_index; |
3715 | u8 sensor_location; | 3718 | u8 sensor_location; |
3716 | 3719 | ||
3717 | status = hw->eeprom.ops.read(hw, (ets_offset + 1 + i), | 3720 | status = hw->eeprom.ops.read(hw, (ets_offset + 1 + i), |
3718 | &ets_sensor); | 3721 | &ets_sensor); |
3719 | if (status) | 3722 | if (status) |
3720 | goto out; | 3723 | goto out; |
3721 | 3724 | ||
3722 | sensor_index = ((ets_sensor & IXGBE_ETS_DATA_INDEX_MASK) >> | 3725 | sensor_index = ((ets_sensor & IXGBE_ETS_DATA_INDEX_MASK) >> |
3723 | IXGBE_ETS_DATA_INDEX_SHIFT); | 3726 | IXGBE_ETS_DATA_INDEX_SHIFT); |
3724 | sensor_location = ((ets_sensor & IXGBE_ETS_DATA_LOC_MASK) >> | 3727 | sensor_location = ((ets_sensor & IXGBE_ETS_DATA_LOC_MASK) >> |
3725 | IXGBE_ETS_DATA_LOC_SHIFT); | 3728 | IXGBE_ETS_DATA_LOC_SHIFT); |
3726 | 3729 | ||
3727 | if (sensor_location != 0) { | 3730 | if (sensor_location != 0) { |
3728 | status = hw->phy.ops.read_i2c_byte(hw, | 3731 | status = hw->phy.ops.read_i2c_byte(hw, |
3729 | ixgbe_emc_temp_data[sensor_index], | 3732 | ixgbe_emc_temp_data[sensor_index], |
3730 | IXGBE_I2C_THERMAL_SENSOR_ADDR, | 3733 | IXGBE_I2C_THERMAL_SENSOR_ADDR, |
3731 | &data->sensor[i].temp); | 3734 | &data->sensor[i].temp); |
3732 | if (status) | 3735 | if (status) |
3733 | goto out; | 3736 | goto out; |
3734 | } | 3737 | } |
3735 | } | 3738 | } |
3736 | out: | 3739 | out: |
3737 | return status; | 3740 | return status; |
3738 | } | 3741 | } |
3739 | 3742 | ||
3740 | /** | 3743 | /** |
3741 | * ixgbe_init_thermal_sensor_thresh_generic - Inits thermal sensor thresholds | 3744 | * ixgbe_init_thermal_sensor_thresh_generic - Inits thermal sensor thresholds |
3742 | * @hw: pointer to hardware structure | 3745 | * @hw: pointer to hardware structure |
3743 | * | 3746 | * |
3744 | * Inits the thermal sensor thresholds according to the NVM map | 3747 | * Inits the thermal sensor thresholds according to the NVM map |
3745 | * and save off the threshold and location values into mac.thermal_sensor_data | 3748 | * and save off the threshold and location values into mac.thermal_sensor_data |
3746 | **/ | 3749 | **/ |
3747 | s32 ixgbe_init_thermal_sensor_thresh_generic(struct ixgbe_hw *hw) | 3750 | s32 ixgbe_init_thermal_sensor_thresh_generic(struct ixgbe_hw *hw) |
3748 | { | 3751 | { |
3749 | s32 status = 0; | 3752 | s32 status = 0; |
3750 | u16 ets_offset; | 3753 | u16 ets_offset; |
3751 | u16 ets_cfg; | 3754 | u16 ets_cfg; |
3752 | u16 ets_sensor; | 3755 | u16 ets_sensor; |
3753 | u8 low_thresh_delta; | 3756 | u8 low_thresh_delta; |
3754 | u8 num_sensors; | 3757 | u8 num_sensors; |
3755 | u8 therm_limit; | 3758 | u8 therm_limit; |
3756 | u8 i; | 3759 | u8 i; |
3757 | struct ixgbe_thermal_sensor_data *data = &hw->mac.thermal_sensor_data; | 3760 | struct ixgbe_thermal_sensor_data *data = &hw->mac.thermal_sensor_data; |
3758 | 3761 | ||
3759 | memset(data, 0, sizeof(struct ixgbe_thermal_sensor_data)); | 3762 | memset(data, 0, sizeof(struct ixgbe_thermal_sensor_data)); |
3760 | 3763 | ||
3761 | /* Only support thermal sensors attached to physical port 0 */ | 3764 | /* Only support thermal sensors attached to physical port 0 */ |
3762 | if ((IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_LAN_ID_1)) { | 3765 | if ((IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_LAN_ID_1)) { |
3763 | status = IXGBE_NOT_IMPLEMENTED; | 3766 | status = IXGBE_NOT_IMPLEMENTED; |
3764 | goto out; | 3767 | goto out; |
3765 | } | 3768 | } |
3766 | 3769 | ||
3767 | status = ixgbe_get_ets_data(hw, &ets_cfg, &ets_offset); | 3770 | status = ixgbe_get_ets_data(hw, &ets_cfg, &ets_offset); |
3768 | if (status) | 3771 | if (status) |
3769 | goto out; | 3772 | goto out; |
3770 | 3773 | ||
3771 | low_thresh_delta = ((ets_cfg & IXGBE_ETS_LTHRES_DELTA_MASK) >> | 3774 | low_thresh_delta = ((ets_cfg & IXGBE_ETS_LTHRES_DELTA_MASK) >> |
3772 | IXGBE_ETS_LTHRES_DELTA_SHIFT); | 3775 | IXGBE_ETS_LTHRES_DELTA_SHIFT); |
3773 | num_sensors = (ets_cfg & IXGBE_ETS_NUM_SENSORS_MASK); | 3776 | num_sensors = (ets_cfg & IXGBE_ETS_NUM_SENSORS_MASK); |
3774 | if (num_sensors > IXGBE_MAX_SENSORS) | 3777 | if (num_sensors > IXGBE_MAX_SENSORS) |
3775 | num_sensors = IXGBE_MAX_SENSORS; | 3778 | num_sensors = IXGBE_MAX_SENSORS; |
3776 | 3779 | ||
3777 | for (i = 0; i < num_sensors; i++) { | 3780 | for (i = 0; i < num_sensors; i++) { |
3778 | u8 sensor_index; | 3781 | u8 sensor_index; |
3779 | u8 sensor_location; | 3782 | u8 sensor_location; |
3780 | 3783 | ||
3781 | hw->eeprom.ops.read(hw, (ets_offset + 1 + i), &ets_sensor); | 3784 | hw->eeprom.ops.read(hw, (ets_offset + 1 + i), &ets_sensor); |
3782 | sensor_index = ((ets_sensor & IXGBE_ETS_DATA_INDEX_MASK) >> | 3785 | sensor_index = ((ets_sensor & IXGBE_ETS_DATA_INDEX_MASK) >> |
3783 | IXGBE_ETS_DATA_INDEX_SHIFT); | 3786 | IXGBE_ETS_DATA_INDEX_SHIFT); |
3784 | sensor_location = ((ets_sensor & IXGBE_ETS_DATA_LOC_MASK) >> | 3787 | sensor_location = ((ets_sensor & IXGBE_ETS_DATA_LOC_MASK) >> |
3785 | IXGBE_ETS_DATA_LOC_SHIFT); | 3788 | IXGBE_ETS_DATA_LOC_SHIFT); |
3786 | therm_limit = ets_sensor & IXGBE_ETS_DATA_HTHRESH_MASK; | 3789 | therm_limit = ets_sensor & IXGBE_ETS_DATA_HTHRESH_MASK; |
3787 | 3790 | ||
3788 | hw->phy.ops.write_i2c_byte(hw, | 3791 | hw->phy.ops.write_i2c_byte(hw, |
3789 | ixgbe_emc_therm_limit[sensor_index], | 3792 | ixgbe_emc_therm_limit[sensor_index], |
3790 | IXGBE_I2C_THERMAL_SENSOR_ADDR, therm_limit); | 3793 | IXGBE_I2C_THERMAL_SENSOR_ADDR, therm_limit); |
3791 | 3794 | ||
3792 | if (sensor_location == 0) | 3795 | if (sensor_location == 0) |
3793 | continue; | 3796 | continue; |
3794 | 3797 | ||
3795 | data->sensor[i].location = sensor_location; | 3798 | data->sensor[i].location = sensor_location; |
3796 | data->sensor[i].caution_thresh = therm_limit; | 3799 | data->sensor[i].caution_thresh = therm_limit; |
3797 | data->sensor[i].max_op_thresh = therm_limit - low_thresh_delta; | 3800 | data->sensor[i].max_op_thresh = therm_limit - low_thresh_delta; |
3798 | } | 3801 | } |
3799 | out: | 3802 | out: |
3800 | return status; | 3803 | return status; |
3801 | } | 3804 | } |
3802 | 3805 | ||
3803 | 3806 |
drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel 10 Gigabit PCI Express Linux driver | 3 | Intel 10 Gigabit PCI Express Linux driver |
4 | Copyright(c) 1999 - 2013 Intel Corporation. | 4 | Copyright(c) 1999 - 2013 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
8 | version 2, as published by the Free Software Foundation. | 8 | version 2, as published by the Free Software Foundation. |
9 | 9 | ||
10 | This program is distributed in the hope it will be useful, but WITHOUT | 10 | This program is distributed in the hope it will be useful, but WITHOUT |
11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | 11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
12 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | 12 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
13 | more details. | 13 | more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License along with | 15 | You should have received a copy of the GNU General Public License along with |
16 | this program; if not, write to the Free Software Foundation, Inc., | 16 | this program; if not, write to the Free Software Foundation, Inc., |
17 | 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | 17 | 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. |
18 | 18 | ||
19 | The full GNU General Public License is included in this distribution in | 19 | The full GNU General Public License is included in this distribution in |
20 | the file called "COPYING". | 20 | the file called "COPYING". |
21 | 21 | ||
22 | Contact Information: | 22 | Contact Information: |
23 | e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> | 23 | e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> |
24 | Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 24 | Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
25 | 25 | ||
26 | *******************************************************************************/ | 26 | *******************************************************************************/ |
27 | 27 | ||
28 | #ifndef _IXGBE_PHY_H_ | 28 | #ifndef _IXGBE_PHY_H_ |
29 | #define _IXGBE_PHY_H_ | 29 | #define _IXGBE_PHY_H_ |
30 | 30 | ||
31 | #include "ixgbe_type.h" | 31 | #include "ixgbe_type.h" |
32 | #define IXGBE_I2C_EEPROM_DEV_ADDR 0xA0 | 32 | #define IXGBE_I2C_EEPROM_DEV_ADDR 0xA0 |
33 | #define IXGBE_I2C_EEPROM_DEV_ADDR2 0xA2 | 33 | #define IXGBE_I2C_EEPROM_DEV_ADDR2 0xA2 |
34 | 34 | ||
35 | /* EEPROM byte offsets */ | 35 | /* EEPROM byte offsets */ |
36 | #define IXGBE_SFF_IDENTIFIER 0x0 | 36 | #define IXGBE_SFF_IDENTIFIER 0x0 |
37 | #define IXGBE_SFF_IDENTIFIER_SFP 0x3 | 37 | #define IXGBE_SFF_IDENTIFIER_SFP 0x3 |
38 | #define IXGBE_SFF_VENDOR_OUI_BYTE0 0x25 | 38 | #define IXGBE_SFF_VENDOR_OUI_BYTE0 0x25 |
39 | #define IXGBE_SFF_VENDOR_OUI_BYTE1 0x26 | 39 | #define IXGBE_SFF_VENDOR_OUI_BYTE1 0x26 |
40 | #define IXGBE_SFF_VENDOR_OUI_BYTE2 0x27 | 40 | #define IXGBE_SFF_VENDOR_OUI_BYTE2 0x27 |
41 | #define IXGBE_SFF_1GBE_COMP_CODES 0x6 | 41 | #define IXGBE_SFF_1GBE_COMP_CODES 0x6 |
42 | #define IXGBE_SFF_10GBE_COMP_CODES 0x3 | 42 | #define IXGBE_SFF_10GBE_COMP_CODES 0x3 |
43 | #define IXGBE_SFF_CABLE_TECHNOLOGY 0x8 | 43 | #define IXGBE_SFF_CABLE_TECHNOLOGY 0x8 |
44 | #define IXGBE_SFF_CABLE_SPEC_COMP 0x3C | 44 | #define IXGBE_SFF_CABLE_SPEC_COMP 0x3C |
45 | #define IXGBE_SFF_SFF_8472_SWAP 0x5C | 45 | #define IXGBE_SFF_SFF_8472_SWAP 0x5C |
46 | #define IXGBE_SFF_SFF_8472_COMP 0x5E | 46 | #define IXGBE_SFF_SFF_8472_COMP 0x5E |
47 | #define IXGBE_SFF_SFF_8472_OSCB 0x6E | ||
48 | #define IXGBE_SFF_SFF_8472_ESCB 0x76 | ||
47 | 49 | ||
48 | /* Bitmasks */ | 50 | /* Bitmasks */ |
49 | #define IXGBE_SFF_DA_PASSIVE_CABLE 0x4 | 51 | #define IXGBE_SFF_DA_PASSIVE_CABLE 0x4 |
50 | #define IXGBE_SFF_DA_ACTIVE_CABLE 0x8 | 52 | #define IXGBE_SFF_DA_ACTIVE_CABLE 0x8 |
51 | #define IXGBE_SFF_DA_SPEC_ACTIVE_LIMITING 0x4 | 53 | #define IXGBE_SFF_DA_SPEC_ACTIVE_LIMITING 0x4 |
52 | #define IXGBE_SFF_1GBASESX_CAPABLE 0x1 | 54 | #define IXGBE_SFF_1GBASESX_CAPABLE 0x1 |
53 | #define IXGBE_SFF_1GBASELX_CAPABLE 0x2 | 55 | #define IXGBE_SFF_1GBASELX_CAPABLE 0x2 |
54 | #define IXGBE_SFF_1GBASET_CAPABLE 0x8 | 56 | #define IXGBE_SFF_1GBASET_CAPABLE 0x8 |
55 | #define IXGBE_SFF_10GBASESR_CAPABLE 0x10 | 57 | #define IXGBE_SFF_10GBASESR_CAPABLE 0x10 |
56 | #define IXGBE_SFF_10GBASELR_CAPABLE 0x20 | 58 | #define IXGBE_SFF_10GBASELR_CAPABLE 0x20 |
59 | #define IXGBE_SFF_SOFT_RS_SELECT_MASK 0x8 | ||
60 | #define IXGBE_SFF_SOFT_RS_SELECT_10G 0x8 | ||
61 | #define IXGBE_SFF_SOFT_RS_SELECT_1G 0x0 | ||
57 | #define IXGBE_SFF_ADDRESSING_MODE 0x4 | 62 | #define IXGBE_SFF_ADDRESSING_MODE 0x4 |
58 | #define IXGBE_I2C_EEPROM_READ_MASK 0x100 | 63 | #define IXGBE_I2C_EEPROM_READ_MASK 0x100 |
59 | #define IXGBE_I2C_EEPROM_STATUS_MASK 0x3 | 64 | #define IXGBE_I2C_EEPROM_STATUS_MASK 0x3 |
60 | #define IXGBE_I2C_EEPROM_STATUS_NO_OPERATION 0x0 | 65 | #define IXGBE_I2C_EEPROM_STATUS_NO_OPERATION 0x0 |
61 | #define IXGBE_I2C_EEPROM_STATUS_PASS 0x1 | 66 | #define IXGBE_I2C_EEPROM_STATUS_PASS 0x1 |
62 | #define IXGBE_I2C_EEPROM_STATUS_FAIL 0x2 | 67 | #define IXGBE_I2C_EEPROM_STATUS_FAIL 0x2 |
63 | #define IXGBE_I2C_EEPROM_STATUS_IN_PROGRESS 0x3 | 68 | #define IXGBE_I2C_EEPROM_STATUS_IN_PROGRESS 0x3 |
64 | 69 | ||
65 | /* Flow control defines */ | 70 | /* Flow control defines */ |
66 | #define IXGBE_TAF_SYM_PAUSE 0x400 | 71 | #define IXGBE_TAF_SYM_PAUSE 0x400 |
67 | #define IXGBE_TAF_ASM_PAUSE 0x800 | 72 | #define IXGBE_TAF_ASM_PAUSE 0x800 |
68 | 73 | ||
69 | /* Bit-shift macros */ | 74 | /* Bit-shift macros */ |
70 | #define IXGBE_SFF_VENDOR_OUI_BYTE0_SHIFT 24 | 75 | #define IXGBE_SFF_VENDOR_OUI_BYTE0_SHIFT 24 |
71 | #define IXGBE_SFF_VENDOR_OUI_BYTE1_SHIFT 16 | 76 | #define IXGBE_SFF_VENDOR_OUI_BYTE1_SHIFT 16 |
72 | #define IXGBE_SFF_VENDOR_OUI_BYTE2_SHIFT 8 | 77 | #define IXGBE_SFF_VENDOR_OUI_BYTE2_SHIFT 8 |
73 | 78 | ||
74 | /* Vendor OUIs: format of OUI is 0x[byte0][byte1][byte2][00] */ | 79 | /* Vendor OUIs: format of OUI is 0x[byte0][byte1][byte2][00] */ |
75 | #define IXGBE_SFF_VENDOR_OUI_TYCO 0x00407600 | 80 | #define IXGBE_SFF_VENDOR_OUI_TYCO 0x00407600 |
76 | #define IXGBE_SFF_VENDOR_OUI_FTL 0x00906500 | 81 | #define IXGBE_SFF_VENDOR_OUI_FTL 0x00906500 |
77 | #define IXGBE_SFF_VENDOR_OUI_AVAGO 0x00176A00 | 82 | #define IXGBE_SFF_VENDOR_OUI_AVAGO 0x00176A00 |
78 | #define IXGBE_SFF_VENDOR_OUI_INTEL 0x001B2100 | 83 | #define IXGBE_SFF_VENDOR_OUI_INTEL 0x001B2100 |
79 | 84 | ||
80 | /* I2C SDA and SCL timing parameters for standard mode */ | 85 | /* I2C SDA and SCL timing parameters for standard mode */ |
81 | #define IXGBE_I2C_T_HD_STA 4 | 86 | #define IXGBE_I2C_T_HD_STA 4 |
82 | #define IXGBE_I2C_T_LOW 5 | 87 | #define IXGBE_I2C_T_LOW 5 |
83 | #define IXGBE_I2C_T_HIGH 4 | 88 | #define IXGBE_I2C_T_HIGH 4 |
84 | #define IXGBE_I2C_T_SU_STA 5 | 89 | #define IXGBE_I2C_T_SU_STA 5 |
85 | #define IXGBE_I2C_T_HD_DATA 5 | 90 | #define IXGBE_I2C_T_HD_DATA 5 |
86 | #define IXGBE_I2C_T_SU_DATA 1 | 91 | #define IXGBE_I2C_T_SU_DATA 1 |
87 | #define IXGBE_I2C_T_RISE 1 | 92 | #define IXGBE_I2C_T_RISE 1 |
88 | #define IXGBE_I2C_T_FALL 1 | 93 | #define IXGBE_I2C_T_FALL 1 |
89 | #define IXGBE_I2C_T_SU_STO 4 | 94 | #define IXGBE_I2C_T_SU_STO 4 |
90 | #define IXGBE_I2C_T_BUF 5 | 95 | #define IXGBE_I2C_T_BUF 5 |
91 | 96 | ||
92 | #define IXGBE_TN_LASI_STATUS_REG 0x9005 | 97 | #define IXGBE_TN_LASI_STATUS_REG 0x9005 |
93 | #define IXGBE_TN_LASI_STATUS_TEMP_ALARM 0x0008 | 98 | #define IXGBE_TN_LASI_STATUS_TEMP_ALARM 0x0008 |
94 | 99 | ||
95 | /* SFP+ SFF-8472 Compliance code */ | 100 | /* SFP+ SFF-8472 Compliance code */ |
96 | #define IXGBE_SFF_SFF_8472_UNSUP 0x00 | 101 | #define IXGBE_SFF_SFF_8472_UNSUP 0x00 |
97 | 102 | ||
98 | s32 ixgbe_init_phy_ops_generic(struct ixgbe_hw *hw); | 103 | s32 ixgbe_init_phy_ops_generic(struct ixgbe_hw *hw); |
99 | s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw); | 104 | s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw); |
100 | s32 ixgbe_reset_phy_generic(struct ixgbe_hw *hw); | 105 | s32 ixgbe_reset_phy_generic(struct ixgbe_hw *hw); |
101 | s32 ixgbe_read_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr, | 106 | s32 ixgbe_read_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr, |
102 | u32 device_type, u16 *phy_data); | 107 | u32 device_type, u16 *phy_data); |
103 | s32 ixgbe_write_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr, | 108 | s32 ixgbe_write_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr, |
104 | u32 device_type, u16 phy_data); | 109 | u32 device_type, u16 phy_data); |
105 | s32 ixgbe_setup_phy_link_generic(struct ixgbe_hw *hw); | 110 | s32 ixgbe_setup_phy_link_generic(struct ixgbe_hw *hw); |
106 | s32 ixgbe_setup_phy_link_speed_generic(struct ixgbe_hw *hw, | 111 | s32 ixgbe_setup_phy_link_speed_generic(struct ixgbe_hw *hw, |
107 | ixgbe_link_speed speed, | 112 | ixgbe_link_speed speed, |
108 | bool autoneg_wait_to_complete); | 113 | bool autoneg_wait_to_complete); |
109 | s32 ixgbe_get_copper_link_capabilities_generic(struct ixgbe_hw *hw, | 114 | s32 ixgbe_get_copper_link_capabilities_generic(struct ixgbe_hw *hw, |
110 | ixgbe_link_speed *speed, | 115 | ixgbe_link_speed *speed, |
111 | bool *autoneg); | 116 | bool *autoneg); |
112 | 117 | ||
113 | /* PHY specific */ | 118 | /* PHY specific */ |
114 | s32 ixgbe_check_phy_link_tnx(struct ixgbe_hw *hw, | 119 | s32 ixgbe_check_phy_link_tnx(struct ixgbe_hw *hw, |
115 | ixgbe_link_speed *speed, | 120 | ixgbe_link_speed *speed, |
116 | bool *link_up); | 121 | bool *link_up); |
117 | s32 ixgbe_setup_phy_link_tnx(struct ixgbe_hw *hw); | 122 | s32 ixgbe_setup_phy_link_tnx(struct ixgbe_hw *hw); |
118 | s32 ixgbe_get_phy_firmware_version_tnx(struct ixgbe_hw *hw, | 123 | s32 ixgbe_get_phy_firmware_version_tnx(struct ixgbe_hw *hw, |
119 | u16 *firmware_version); | 124 | u16 *firmware_version); |
120 | s32 ixgbe_get_phy_firmware_version_generic(struct ixgbe_hw *hw, | 125 | s32 ixgbe_get_phy_firmware_version_generic(struct ixgbe_hw *hw, |
121 | u16 *firmware_version); | 126 | u16 *firmware_version); |
122 | 127 | ||
123 | s32 ixgbe_reset_phy_nl(struct ixgbe_hw *hw); | 128 | s32 ixgbe_reset_phy_nl(struct ixgbe_hw *hw); |
124 | s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw); | 129 | s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw); |
125 | s32 ixgbe_get_sfp_init_sequence_offsets(struct ixgbe_hw *hw, | 130 | s32 ixgbe_get_sfp_init_sequence_offsets(struct ixgbe_hw *hw, |
126 | u16 *list_offset, | 131 | u16 *list_offset, |
127 | u16 *data_offset); | 132 | u16 *data_offset); |
128 | s32 ixgbe_tn_check_overtemp(struct ixgbe_hw *hw); | 133 | s32 ixgbe_tn_check_overtemp(struct ixgbe_hw *hw); |
129 | s32 ixgbe_read_i2c_byte_generic(struct ixgbe_hw *hw, u8 byte_offset, | 134 | s32 ixgbe_read_i2c_byte_generic(struct ixgbe_hw *hw, u8 byte_offset, |
130 | u8 dev_addr, u8 *data); | 135 | u8 dev_addr, u8 *data); |
131 | s32 ixgbe_write_i2c_byte_generic(struct ixgbe_hw *hw, u8 byte_offset, | 136 | s32 ixgbe_write_i2c_byte_generic(struct ixgbe_hw *hw, u8 byte_offset, |
132 | u8 dev_addr, u8 data); | 137 | u8 dev_addr, u8 data); |
133 | s32 ixgbe_read_i2c_eeprom_generic(struct ixgbe_hw *hw, u8 byte_offset, | 138 | s32 ixgbe_read_i2c_eeprom_generic(struct ixgbe_hw *hw, u8 byte_offset, |
134 | u8 *eeprom_data); | 139 | u8 *eeprom_data); |
135 | s32 ixgbe_read_i2c_sff8472_generic(struct ixgbe_hw *hw, u8 byte_offset, | 140 | s32 ixgbe_read_i2c_sff8472_generic(struct ixgbe_hw *hw, u8 byte_offset, |
136 | u8 *sff8472_data); | 141 | u8 *sff8472_data); |
137 | s32 ixgbe_write_i2c_eeprom_generic(struct ixgbe_hw *hw, u8 byte_offset, | 142 | s32 ixgbe_write_i2c_eeprom_generic(struct ixgbe_hw *hw, u8 byte_offset, |
138 | u8 eeprom_data); | 143 | u8 eeprom_data); |
139 | #endif /* _IXGBE_PHY_H_ */ | 144 | #endif /* _IXGBE_PHY_H_ */ |
140 | 145 |
drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | Intel 10 Gigabit PCI Express Linux driver | 3 | Intel 10 Gigabit PCI Express Linux driver |
4 | Copyright(c) 1999 - 2013 Intel Corporation. | 4 | Copyright(c) 1999 - 2013 Intel Corporation. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
7 | under the terms and conditions of the GNU General Public License, | 7 | under the terms and conditions of the GNU General Public License, |
8 | version 2, as published by the Free Software Foundation. | 8 | version 2, as published by the Free Software Foundation. |
9 | 9 | ||
10 | This program is distributed in the hope it will be useful, but WITHOUT | 10 | This program is distributed in the hope it will be useful, but WITHOUT |
11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | 11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
12 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | 12 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
13 | more details. | 13 | more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License along with | 15 | You should have received a copy of the GNU General Public License along with |
16 | this program; if not, write to the Free Software Foundation, Inc., | 16 | this program; if not, write to the Free Software Foundation, Inc., |
17 | 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | 17 | 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. |
18 | 18 | ||
19 | The full GNU General Public License is included in this distribution in | 19 | The full GNU General Public License is included in this distribution in |
20 | the file called "COPYING". | 20 | the file called "COPYING". |
21 | 21 | ||
22 | Contact Information: | 22 | Contact Information: |
23 | e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> | 23 | e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> |
24 | Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 24 | Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
25 | 25 | ||
26 | *******************************************************************************/ | 26 | *******************************************************************************/ |
27 | 27 | ||
28 | #ifndef _IXGBE_TYPE_H_ | 28 | #ifndef _IXGBE_TYPE_H_ |
29 | #define _IXGBE_TYPE_H_ | 29 | #define _IXGBE_TYPE_H_ |
30 | 30 | ||
31 | #include <linux/types.h> | 31 | #include <linux/types.h> |
32 | #include <linux/mdio.h> | 32 | #include <linux/mdio.h> |
33 | #include <linux/netdevice.h> | 33 | #include <linux/netdevice.h> |
34 | 34 | ||
35 | /* Device IDs */ | 35 | /* Device IDs */ |
36 | #define IXGBE_DEV_ID_82598 0x10B6 | 36 | #define IXGBE_DEV_ID_82598 0x10B6 |
37 | #define IXGBE_DEV_ID_82598_BX 0x1508 | 37 | #define IXGBE_DEV_ID_82598_BX 0x1508 |
38 | #define IXGBE_DEV_ID_82598AF_DUAL_PORT 0x10C6 | 38 | #define IXGBE_DEV_ID_82598AF_DUAL_PORT 0x10C6 |
39 | #define IXGBE_DEV_ID_82598AF_SINGLE_PORT 0x10C7 | 39 | #define IXGBE_DEV_ID_82598AF_SINGLE_PORT 0x10C7 |
40 | #define IXGBE_DEV_ID_82598EB_SFP_LOM 0x10DB | 40 | #define IXGBE_DEV_ID_82598EB_SFP_LOM 0x10DB |
41 | #define IXGBE_DEV_ID_82598AT 0x10C8 | 41 | #define IXGBE_DEV_ID_82598AT 0x10C8 |
42 | #define IXGBE_DEV_ID_82598AT2 0x150B | 42 | #define IXGBE_DEV_ID_82598AT2 0x150B |
43 | #define IXGBE_DEV_ID_82598EB_CX4 0x10DD | 43 | #define IXGBE_DEV_ID_82598EB_CX4 0x10DD |
44 | #define IXGBE_DEV_ID_82598_CX4_DUAL_PORT 0x10EC | 44 | #define IXGBE_DEV_ID_82598_CX4_DUAL_PORT 0x10EC |
45 | #define IXGBE_DEV_ID_82598_DA_DUAL_PORT 0x10F1 | 45 | #define IXGBE_DEV_ID_82598_DA_DUAL_PORT 0x10F1 |
46 | #define IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM 0x10E1 | 46 | #define IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM 0x10E1 |
47 | #define IXGBE_DEV_ID_82598EB_XF_LR 0x10F4 | 47 | #define IXGBE_DEV_ID_82598EB_XF_LR 0x10F4 |
48 | #define IXGBE_DEV_ID_82599_KX4 0x10F7 | 48 | #define IXGBE_DEV_ID_82599_KX4 0x10F7 |
49 | #define IXGBE_DEV_ID_82599_KX4_MEZZ 0x1514 | 49 | #define IXGBE_DEV_ID_82599_KX4_MEZZ 0x1514 |
50 | #define IXGBE_DEV_ID_82599_KR 0x1517 | 50 | #define IXGBE_DEV_ID_82599_KR 0x1517 |
51 | #define IXGBE_DEV_ID_82599_T3_LOM 0x151C | 51 | #define IXGBE_DEV_ID_82599_T3_LOM 0x151C |
52 | #define IXGBE_DEV_ID_82599_CX4 0x10F9 | 52 | #define IXGBE_DEV_ID_82599_CX4 0x10F9 |
53 | #define IXGBE_DEV_ID_82599_SFP 0x10FB | 53 | #define IXGBE_DEV_ID_82599_SFP 0x10FB |
54 | #define IXGBE_DEV_ID_82599_BACKPLANE_FCOE 0x152a | 54 | #define IXGBE_DEV_ID_82599_BACKPLANE_FCOE 0x152a |
55 | #define IXGBE_DEV_ID_82599_SFP_FCOE 0x1529 | 55 | #define IXGBE_DEV_ID_82599_SFP_FCOE 0x1529 |
56 | #define IXGBE_SUBDEV_ID_82599_SFP 0x11A9 | 56 | #define IXGBE_SUBDEV_ID_82599_SFP 0x11A9 |
57 | #define IXGBE_SUBDEV_ID_82599_RNDC 0x1F72 | 57 | #define IXGBE_SUBDEV_ID_82599_RNDC 0x1F72 |
58 | #define IXGBE_SUBDEV_ID_82599_560FLR 0x17D0 | 58 | #define IXGBE_SUBDEV_ID_82599_560FLR 0x17D0 |
59 | #define IXGBE_SUBDEV_ID_82599_SP_560FLR 0x211B | 59 | #define IXGBE_SUBDEV_ID_82599_SP_560FLR 0x211B |
60 | #define IXGBE_SUBDEV_ID_82599_ECNA_DP 0x0470 | 60 | #define IXGBE_SUBDEV_ID_82599_ECNA_DP 0x0470 |
61 | #define IXGBE_SUBDEV_ID_82599_LOM_SFP 0x8976 | 61 | #define IXGBE_SUBDEV_ID_82599_LOM_SFP 0x8976 |
62 | #define IXGBE_DEV_ID_82599_SFP_EM 0x1507 | 62 | #define IXGBE_DEV_ID_82599_SFP_EM 0x1507 |
63 | #define IXGBE_DEV_ID_82599_SFP_SF2 0x154D | 63 | #define IXGBE_DEV_ID_82599_SFP_SF2 0x154D |
64 | #define IXGBE_DEV_ID_82599EN_SFP 0x1557 | 64 | #define IXGBE_DEV_ID_82599EN_SFP 0x1557 |
65 | #define IXGBE_SUBDEV_ID_82599EN_SFP_OCP1 0x0001 | 65 | #define IXGBE_SUBDEV_ID_82599EN_SFP_OCP1 0x0001 |
66 | #define IXGBE_DEV_ID_82599_XAUI_LOM 0x10FC | 66 | #define IXGBE_DEV_ID_82599_XAUI_LOM 0x10FC |
67 | #define IXGBE_DEV_ID_82599_COMBO_BACKPLANE 0x10F8 | 67 | #define IXGBE_DEV_ID_82599_COMBO_BACKPLANE 0x10F8 |
68 | #define IXGBE_SUBDEV_ID_82599_KX4_KR_MEZZ 0x000C | 68 | #define IXGBE_SUBDEV_ID_82599_KX4_KR_MEZZ 0x000C |
69 | #define IXGBE_DEV_ID_82599_LS 0x154F | 69 | #define IXGBE_DEV_ID_82599_LS 0x154F |
70 | #define IXGBE_DEV_ID_X540T 0x1528 | 70 | #define IXGBE_DEV_ID_X540T 0x1528 |
71 | #define IXGBE_DEV_ID_82599_SFP_SF_QP 0x154A | 71 | #define IXGBE_DEV_ID_82599_SFP_SF_QP 0x154A |
72 | #define IXGBE_DEV_ID_X540T1 0x1560 | 72 | #define IXGBE_DEV_ID_X540T1 0x1560 |
73 | 73 | ||
74 | /* VF Device IDs */ | 74 | /* VF Device IDs */ |
75 | #define IXGBE_DEV_ID_82599_VF 0x10ED | 75 | #define IXGBE_DEV_ID_82599_VF 0x10ED |
76 | #define IXGBE_DEV_ID_X540_VF 0x1515 | 76 | #define IXGBE_DEV_ID_X540_VF 0x1515 |
77 | 77 | ||
78 | /* General Registers */ | 78 | /* General Registers */ |
79 | #define IXGBE_CTRL 0x00000 | 79 | #define IXGBE_CTRL 0x00000 |
80 | #define IXGBE_STATUS 0x00008 | 80 | #define IXGBE_STATUS 0x00008 |
81 | #define IXGBE_CTRL_EXT 0x00018 | 81 | #define IXGBE_CTRL_EXT 0x00018 |
82 | #define IXGBE_ESDP 0x00020 | 82 | #define IXGBE_ESDP 0x00020 |
83 | #define IXGBE_EODSDP 0x00028 | 83 | #define IXGBE_EODSDP 0x00028 |
84 | #define IXGBE_I2CCTL 0x00028 | 84 | #define IXGBE_I2CCTL 0x00028 |
85 | #define IXGBE_LEDCTL 0x00200 | 85 | #define IXGBE_LEDCTL 0x00200 |
86 | #define IXGBE_FRTIMER 0x00048 | 86 | #define IXGBE_FRTIMER 0x00048 |
87 | #define IXGBE_TCPTIMER 0x0004C | 87 | #define IXGBE_TCPTIMER 0x0004C |
88 | #define IXGBE_CORESPARE 0x00600 | 88 | #define IXGBE_CORESPARE 0x00600 |
89 | #define IXGBE_EXVET 0x05078 | 89 | #define IXGBE_EXVET 0x05078 |
90 | 90 | ||
91 | /* NVM Registers */ | 91 | /* NVM Registers */ |
92 | #define IXGBE_EEC 0x10010 | 92 | #define IXGBE_EEC 0x10010 |
93 | #define IXGBE_EERD 0x10014 | 93 | #define IXGBE_EERD 0x10014 |
94 | #define IXGBE_EEWR 0x10018 | 94 | #define IXGBE_EEWR 0x10018 |
95 | #define IXGBE_FLA 0x1001C | 95 | #define IXGBE_FLA 0x1001C |
96 | #define IXGBE_EEMNGCTL 0x10110 | 96 | #define IXGBE_EEMNGCTL 0x10110 |
97 | #define IXGBE_EEMNGDATA 0x10114 | 97 | #define IXGBE_EEMNGDATA 0x10114 |
98 | #define IXGBE_FLMNGCTL 0x10118 | 98 | #define IXGBE_FLMNGCTL 0x10118 |
99 | #define IXGBE_FLMNGDATA 0x1011C | 99 | #define IXGBE_FLMNGDATA 0x1011C |
100 | #define IXGBE_FLMNGCNT 0x10120 | 100 | #define IXGBE_FLMNGCNT 0x10120 |
101 | #define IXGBE_FLOP 0x1013C | 101 | #define IXGBE_FLOP 0x1013C |
102 | #define IXGBE_GRC 0x10200 | 102 | #define IXGBE_GRC 0x10200 |
103 | 103 | ||
104 | /* General Receive Control */ | 104 | /* General Receive Control */ |
105 | #define IXGBE_GRC_MNG 0x00000001 /* Manageability Enable */ | 105 | #define IXGBE_GRC_MNG 0x00000001 /* Manageability Enable */ |
106 | #define IXGBE_GRC_APME 0x00000002 /* APM enabled in EEPROM */ | 106 | #define IXGBE_GRC_APME 0x00000002 /* APM enabled in EEPROM */ |
107 | 107 | ||
108 | #define IXGBE_VPDDIAG0 0x10204 | 108 | #define IXGBE_VPDDIAG0 0x10204 |
109 | #define IXGBE_VPDDIAG1 0x10208 | 109 | #define IXGBE_VPDDIAG1 0x10208 |
110 | 110 | ||
111 | /* I2CCTL Bit Masks */ | 111 | /* I2CCTL Bit Masks */ |
112 | #define IXGBE_I2C_CLK_IN 0x00000001 | 112 | #define IXGBE_I2C_CLK_IN 0x00000001 |
113 | #define IXGBE_I2C_CLK_OUT 0x00000002 | 113 | #define IXGBE_I2C_CLK_OUT 0x00000002 |
114 | #define IXGBE_I2C_DATA_IN 0x00000004 | 114 | #define IXGBE_I2C_DATA_IN 0x00000004 |
115 | #define IXGBE_I2C_DATA_OUT 0x00000008 | 115 | #define IXGBE_I2C_DATA_OUT 0x00000008 |
116 | #define IXGBE_I2C_CLOCK_STRETCHING_TIMEOUT 500 | 116 | #define IXGBE_I2C_CLOCK_STRETCHING_TIMEOUT 500 |
117 | 117 | ||
118 | #define IXGBE_I2C_THERMAL_SENSOR_ADDR 0xF8 | 118 | #define IXGBE_I2C_THERMAL_SENSOR_ADDR 0xF8 |
119 | #define IXGBE_EMC_INTERNAL_DATA 0x00 | 119 | #define IXGBE_EMC_INTERNAL_DATA 0x00 |
120 | #define IXGBE_EMC_INTERNAL_THERM_LIMIT 0x20 | 120 | #define IXGBE_EMC_INTERNAL_THERM_LIMIT 0x20 |
121 | #define IXGBE_EMC_DIODE1_DATA 0x01 | 121 | #define IXGBE_EMC_DIODE1_DATA 0x01 |
122 | #define IXGBE_EMC_DIODE1_THERM_LIMIT 0x19 | 122 | #define IXGBE_EMC_DIODE1_THERM_LIMIT 0x19 |
123 | #define IXGBE_EMC_DIODE2_DATA 0x23 | 123 | #define IXGBE_EMC_DIODE2_DATA 0x23 |
124 | #define IXGBE_EMC_DIODE2_THERM_LIMIT 0x1A | 124 | #define IXGBE_EMC_DIODE2_THERM_LIMIT 0x1A |
125 | 125 | ||
126 | #define IXGBE_MAX_SENSORS 3 | 126 | #define IXGBE_MAX_SENSORS 3 |
127 | 127 | ||
128 | struct ixgbe_thermal_diode_data { | 128 | struct ixgbe_thermal_diode_data { |
129 | u8 location; | 129 | u8 location; |
130 | u8 temp; | 130 | u8 temp; |
131 | u8 caution_thresh; | 131 | u8 caution_thresh; |
132 | u8 max_op_thresh; | 132 | u8 max_op_thresh; |
133 | }; | 133 | }; |
134 | 134 | ||
135 | struct ixgbe_thermal_sensor_data { | 135 | struct ixgbe_thermal_sensor_data { |
136 | struct ixgbe_thermal_diode_data sensor[IXGBE_MAX_SENSORS]; | 136 | struct ixgbe_thermal_diode_data sensor[IXGBE_MAX_SENSORS]; |
137 | }; | 137 | }; |
138 | 138 | ||
139 | /* Interrupt Registers */ | 139 | /* Interrupt Registers */ |
140 | #define IXGBE_EICR 0x00800 | 140 | #define IXGBE_EICR 0x00800 |
141 | #define IXGBE_EICS 0x00808 | 141 | #define IXGBE_EICS 0x00808 |
142 | #define IXGBE_EIMS 0x00880 | 142 | #define IXGBE_EIMS 0x00880 |
143 | #define IXGBE_EIMC 0x00888 | 143 | #define IXGBE_EIMC 0x00888 |
144 | #define IXGBE_EIAC 0x00810 | 144 | #define IXGBE_EIAC 0x00810 |
145 | #define IXGBE_EIAM 0x00890 | 145 | #define IXGBE_EIAM 0x00890 |
146 | #define IXGBE_EICS_EX(_i) (0x00A90 + (_i) * 4) | 146 | #define IXGBE_EICS_EX(_i) (0x00A90 + (_i) * 4) |
147 | #define IXGBE_EIMS_EX(_i) (0x00AA0 + (_i) * 4) | 147 | #define IXGBE_EIMS_EX(_i) (0x00AA0 + (_i) * 4) |
148 | #define IXGBE_EIMC_EX(_i) (0x00AB0 + (_i) * 4) | 148 | #define IXGBE_EIMC_EX(_i) (0x00AB0 + (_i) * 4) |
149 | #define IXGBE_EIAM_EX(_i) (0x00AD0 + (_i) * 4) | 149 | #define IXGBE_EIAM_EX(_i) (0x00AD0 + (_i) * 4) |
150 | /* | 150 | /* |
151 | * 82598 EITR is 16 bits but set the limits based on the max | 151 | * 82598 EITR is 16 bits but set the limits based on the max |
152 | * supported by all ixgbe hardware. 82599 EITR is only 12 bits, | 152 | * supported by all ixgbe hardware. 82599 EITR is only 12 bits, |
153 | * with the lower 3 always zero. | 153 | * with the lower 3 always zero. |
154 | */ | 154 | */ |
155 | #define IXGBE_MAX_INT_RATE 488281 | 155 | #define IXGBE_MAX_INT_RATE 488281 |
156 | #define IXGBE_MIN_INT_RATE 956 | 156 | #define IXGBE_MIN_INT_RATE 956 |
157 | #define IXGBE_MAX_EITR 0x00000FF8 | 157 | #define IXGBE_MAX_EITR 0x00000FF8 |
158 | #define IXGBE_MIN_EITR 8 | 158 | #define IXGBE_MIN_EITR 8 |
159 | #define IXGBE_EITR(_i) (((_i) <= 23) ? (0x00820 + ((_i) * 4)) : \ | 159 | #define IXGBE_EITR(_i) (((_i) <= 23) ? (0x00820 + ((_i) * 4)) : \ |
160 | (0x012300 + (((_i) - 24) * 4))) | 160 | (0x012300 + (((_i) - 24) * 4))) |
161 | #define IXGBE_EITR_ITR_INT_MASK 0x00000FF8 | 161 | #define IXGBE_EITR_ITR_INT_MASK 0x00000FF8 |
162 | #define IXGBE_EITR_LLI_MOD 0x00008000 | 162 | #define IXGBE_EITR_LLI_MOD 0x00008000 |
163 | #define IXGBE_EITR_CNT_WDIS 0x80000000 | 163 | #define IXGBE_EITR_CNT_WDIS 0x80000000 |
164 | #define IXGBE_IVAR(_i) (0x00900 + ((_i) * 4)) /* 24 at 0x900-0x960 */ | 164 | #define IXGBE_IVAR(_i) (0x00900 + ((_i) * 4)) /* 24 at 0x900-0x960 */ |
165 | #define IXGBE_IVAR_MISC 0x00A00 /* misc MSI-X interrupt causes */ | 165 | #define IXGBE_IVAR_MISC 0x00A00 /* misc MSI-X interrupt causes */ |
166 | #define IXGBE_EITRSEL 0x00894 | 166 | #define IXGBE_EITRSEL 0x00894 |
167 | #define IXGBE_MSIXT 0x00000 /* MSI-X Table. 0x0000 - 0x01C */ | 167 | #define IXGBE_MSIXT 0x00000 /* MSI-X Table. 0x0000 - 0x01C */ |
168 | #define IXGBE_MSIXPBA 0x02000 /* MSI-X Pending bit array */ | 168 | #define IXGBE_MSIXPBA 0x02000 /* MSI-X Pending bit array */ |
169 | #define IXGBE_PBACL(_i) (((_i) == 0) ? (0x11068) : (0x110C0 + ((_i) * 4))) | 169 | #define IXGBE_PBACL(_i) (((_i) == 0) ? (0x11068) : (0x110C0 + ((_i) * 4))) |
170 | #define IXGBE_GPIE 0x00898 | 170 | #define IXGBE_GPIE 0x00898 |
171 | 171 | ||
172 | /* Flow Control Registers */ | 172 | /* Flow Control Registers */ |
173 | #define IXGBE_FCADBUL 0x03210 | 173 | #define IXGBE_FCADBUL 0x03210 |
174 | #define IXGBE_FCADBUH 0x03214 | 174 | #define IXGBE_FCADBUH 0x03214 |
175 | #define IXGBE_FCAMACL 0x04328 | 175 | #define IXGBE_FCAMACL 0x04328 |
176 | #define IXGBE_FCAMACH 0x0432C | 176 | #define IXGBE_FCAMACH 0x0432C |
177 | #define IXGBE_FCRTH_82599(_i) (0x03260 + ((_i) * 4)) /* 8 of these (0-7) */ | 177 | #define IXGBE_FCRTH_82599(_i) (0x03260 + ((_i) * 4)) /* 8 of these (0-7) */ |
178 | #define IXGBE_FCRTL_82599(_i) (0x03220 + ((_i) * 4)) /* 8 of these (0-7) */ | 178 | #define IXGBE_FCRTL_82599(_i) (0x03220 + ((_i) * 4)) /* 8 of these (0-7) */ |
179 | #define IXGBE_PFCTOP 0x03008 | 179 | #define IXGBE_PFCTOP 0x03008 |
180 | #define IXGBE_FCTTV(_i) (0x03200 + ((_i) * 4)) /* 4 of these (0-3) */ | 180 | #define IXGBE_FCTTV(_i) (0x03200 + ((_i) * 4)) /* 4 of these (0-3) */ |
181 | #define IXGBE_FCRTL(_i) (0x03220 + ((_i) * 8)) /* 8 of these (0-7) */ | 181 | #define IXGBE_FCRTL(_i) (0x03220 + ((_i) * 8)) /* 8 of these (0-7) */ |
182 | #define IXGBE_FCRTH(_i) (0x03260 + ((_i) * 8)) /* 8 of these (0-7) */ | 182 | #define IXGBE_FCRTH(_i) (0x03260 + ((_i) * 8)) /* 8 of these (0-7) */ |
183 | #define IXGBE_FCRTV 0x032A0 | 183 | #define IXGBE_FCRTV 0x032A0 |
184 | #define IXGBE_FCCFG 0x03D00 | 184 | #define IXGBE_FCCFG 0x03D00 |
185 | #define IXGBE_TFCS 0x0CE00 | 185 | #define IXGBE_TFCS 0x0CE00 |
186 | 186 | ||
187 | /* Receive DMA Registers */ | 187 | /* Receive DMA Registers */ |
188 | #define IXGBE_RDBAL(_i) (((_i) < 64) ? (0x01000 + ((_i) * 0x40)) : \ | 188 | #define IXGBE_RDBAL(_i) (((_i) < 64) ? (0x01000 + ((_i) * 0x40)) : \ |
189 | (0x0D000 + (((_i) - 64) * 0x40))) | 189 | (0x0D000 + (((_i) - 64) * 0x40))) |
190 | #define IXGBE_RDBAH(_i) (((_i) < 64) ? (0x01004 + ((_i) * 0x40)) : \ | 190 | #define IXGBE_RDBAH(_i) (((_i) < 64) ? (0x01004 + ((_i) * 0x40)) : \ |
191 | (0x0D004 + (((_i) - 64) * 0x40))) | 191 | (0x0D004 + (((_i) - 64) * 0x40))) |
192 | #define IXGBE_RDLEN(_i) (((_i) < 64) ? (0x01008 + ((_i) * 0x40)) : \ | 192 | #define IXGBE_RDLEN(_i) (((_i) < 64) ? (0x01008 + ((_i) * 0x40)) : \ |
193 | (0x0D008 + (((_i) - 64) * 0x40))) | 193 | (0x0D008 + (((_i) - 64) * 0x40))) |
194 | #define IXGBE_RDH(_i) (((_i) < 64) ? (0x01010 + ((_i) * 0x40)) : \ | 194 | #define IXGBE_RDH(_i) (((_i) < 64) ? (0x01010 + ((_i) * 0x40)) : \ |
195 | (0x0D010 + (((_i) - 64) * 0x40))) | 195 | (0x0D010 + (((_i) - 64) * 0x40))) |
196 | #define IXGBE_RDT(_i) (((_i) < 64) ? (0x01018 + ((_i) * 0x40)) : \ | 196 | #define IXGBE_RDT(_i) (((_i) < 64) ? (0x01018 + ((_i) * 0x40)) : \ |
197 | (0x0D018 + (((_i) - 64) * 0x40))) | 197 | (0x0D018 + (((_i) - 64) * 0x40))) |
198 | #define IXGBE_RXDCTL(_i) (((_i) < 64) ? (0x01028 + ((_i) * 0x40)) : \ | 198 | #define IXGBE_RXDCTL(_i) (((_i) < 64) ? (0x01028 + ((_i) * 0x40)) : \ |
199 | (0x0D028 + (((_i) - 64) * 0x40))) | 199 | (0x0D028 + (((_i) - 64) * 0x40))) |
200 | #define IXGBE_RSCCTL(_i) (((_i) < 64) ? (0x0102C + ((_i) * 0x40)) : \ | 200 | #define IXGBE_RSCCTL(_i) (((_i) < 64) ? (0x0102C + ((_i) * 0x40)) : \ |
201 | (0x0D02C + (((_i) - 64) * 0x40))) | 201 | (0x0D02C + (((_i) - 64) * 0x40))) |
202 | #define IXGBE_RSCDBU 0x03028 | 202 | #define IXGBE_RSCDBU 0x03028 |
203 | #define IXGBE_RDDCC 0x02F20 | 203 | #define IXGBE_RDDCC 0x02F20 |
204 | #define IXGBE_RXMEMWRAP 0x03190 | 204 | #define IXGBE_RXMEMWRAP 0x03190 |
205 | #define IXGBE_STARCTRL 0x03024 | 205 | #define IXGBE_STARCTRL 0x03024 |
206 | /* | 206 | /* |
207 | * Split and Replication Receive Control Registers | 207 | * Split and Replication Receive Control Registers |
208 | * 00-15 : 0x02100 + n*4 | 208 | * 00-15 : 0x02100 + n*4 |
209 | * 16-64 : 0x01014 + n*0x40 | 209 | * 16-64 : 0x01014 + n*0x40 |
210 | * 64-127: 0x0D014 + (n-64)*0x40 | 210 | * 64-127: 0x0D014 + (n-64)*0x40 |
211 | */ | 211 | */ |
212 | #define IXGBE_SRRCTL(_i) (((_i) <= 15) ? (0x02100 + ((_i) * 4)) : \ | 212 | #define IXGBE_SRRCTL(_i) (((_i) <= 15) ? (0x02100 + ((_i) * 4)) : \ |
213 | (((_i) < 64) ? (0x01014 + ((_i) * 0x40)) : \ | 213 | (((_i) < 64) ? (0x01014 + ((_i) * 0x40)) : \ |
214 | (0x0D014 + (((_i) - 64) * 0x40)))) | 214 | (0x0D014 + (((_i) - 64) * 0x40)))) |
215 | /* | 215 | /* |
216 | * Rx DCA Control Register: | 216 | * Rx DCA Control Register: |
217 | * 00-15 : 0x02200 + n*4 | 217 | * 00-15 : 0x02200 + n*4 |
218 | * 16-64 : 0x0100C + n*0x40 | 218 | * 16-64 : 0x0100C + n*0x40 |
219 | * 64-127: 0x0D00C + (n-64)*0x40 | 219 | * 64-127: 0x0D00C + (n-64)*0x40 |
220 | */ | 220 | */ |
221 | #define IXGBE_DCA_RXCTRL(_i) (((_i) <= 15) ? (0x02200 + ((_i) * 4)) : \ | 221 | #define IXGBE_DCA_RXCTRL(_i) (((_i) <= 15) ? (0x02200 + ((_i) * 4)) : \ |
222 | (((_i) < 64) ? (0x0100C + ((_i) * 0x40)) : \ | 222 | (((_i) < 64) ? (0x0100C + ((_i) * 0x40)) : \ |
223 | (0x0D00C + (((_i) - 64) * 0x40)))) | 223 | (0x0D00C + (((_i) - 64) * 0x40)))) |
224 | #define IXGBE_RDRXCTL 0x02F00 | 224 | #define IXGBE_RDRXCTL 0x02F00 |
225 | #define IXGBE_RXPBSIZE(_i) (0x03C00 + ((_i) * 4)) | 225 | #define IXGBE_RXPBSIZE(_i) (0x03C00 + ((_i) * 4)) |
226 | /* 8 of these 0x03C00 - 0x03C1C */ | 226 | /* 8 of these 0x03C00 - 0x03C1C */ |
227 | #define IXGBE_RXCTRL 0x03000 | 227 | #define IXGBE_RXCTRL 0x03000 |
228 | #define IXGBE_DROPEN 0x03D04 | 228 | #define IXGBE_DROPEN 0x03D04 |
229 | #define IXGBE_RXPBSIZE_SHIFT 10 | 229 | #define IXGBE_RXPBSIZE_SHIFT 10 |
230 | 230 | ||
231 | /* Receive Registers */ | 231 | /* Receive Registers */ |
232 | #define IXGBE_RXCSUM 0x05000 | 232 | #define IXGBE_RXCSUM 0x05000 |
233 | #define IXGBE_RFCTL 0x05008 | 233 | #define IXGBE_RFCTL 0x05008 |
234 | #define IXGBE_DRECCCTL 0x02F08 | 234 | #define IXGBE_DRECCCTL 0x02F08 |
235 | #define IXGBE_DRECCCTL_DISABLE 0 | 235 | #define IXGBE_DRECCCTL_DISABLE 0 |
236 | /* Multicast Table Array - 128 entries */ | 236 | /* Multicast Table Array - 128 entries */ |
237 | #define IXGBE_MTA(_i) (0x05200 + ((_i) * 4)) | 237 | #define IXGBE_MTA(_i) (0x05200 + ((_i) * 4)) |
238 | #define IXGBE_RAL(_i) (((_i) <= 15) ? (0x05400 + ((_i) * 8)) : \ | 238 | #define IXGBE_RAL(_i) (((_i) <= 15) ? (0x05400 + ((_i) * 8)) : \ |
239 | (0x0A200 + ((_i) * 8))) | 239 | (0x0A200 + ((_i) * 8))) |
240 | #define IXGBE_RAH(_i) (((_i) <= 15) ? (0x05404 + ((_i) * 8)) : \ | 240 | #define IXGBE_RAH(_i) (((_i) <= 15) ? (0x05404 + ((_i) * 8)) : \ |
241 | (0x0A204 + ((_i) * 8))) | 241 | (0x0A204 + ((_i) * 8))) |
242 | #define IXGBE_MPSAR_LO(_i) (0x0A600 + ((_i) * 8)) | 242 | #define IXGBE_MPSAR_LO(_i) (0x0A600 + ((_i) * 8)) |
243 | #define IXGBE_MPSAR_HI(_i) (0x0A604 + ((_i) * 8)) | 243 | #define IXGBE_MPSAR_HI(_i) (0x0A604 + ((_i) * 8)) |
244 | /* Packet split receive type */ | 244 | /* Packet split receive type */ |
245 | #define IXGBE_PSRTYPE(_i) (((_i) <= 15) ? (0x05480 + ((_i) * 4)) : \ | 245 | #define IXGBE_PSRTYPE(_i) (((_i) <= 15) ? (0x05480 + ((_i) * 4)) : \ |
246 | (0x0EA00 + ((_i) * 4))) | 246 | (0x0EA00 + ((_i) * 4))) |
247 | /* array of 4096 1-bit vlan filters */ | 247 | /* array of 4096 1-bit vlan filters */ |
248 | #define IXGBE_VFTA(_i) (0x0A000 + ((_i) * 4)) | 248 | #define IXGBE_VFTA(_i) (0x0A000 + ((_i) * 4)) |
249 | /*array of 4096 4-bit vlan vmdq indices */ | 249 | /*array of 4096 4-bit vlan vmdq indices */ |
250 | #define IXGBE_VFTAVIND(_j, _i) (0x0A200 + ((_j) * 0x200) + ((_i) * 4)) | 250 | #define IXGBE_VFTAVIND(_j, _i) (0x0A200 + ((_j) * 0x200) + ((_i) * 4)) |
251 | #define IXGBE_FCTRL 0x05080 | 251 | #define IXGBE_FCTRL 0x05080 |
252 | #define IXGBE_VLNCTRL 0x05088 | 252 | #define IXGBE_VLNCTRL 0x05088 |
253 | #define IXGBE_MCSTCTRL 0x05090 | 253 | #define IXGBE_MCSTCTRL 0x05090 |
254 | #define IXGBE_MRQC 0x05818 | 254 | #define IXGBE_MRQC 0x05818 |
255 | #define IXGBE_SAQF(_i) (0x0E000 + ((_i) * 4)) /* Source Address Queue Filter */ | 255 | #define IXGBE_SAQF(_i) (0x0E000 + ((_i) * 4)) /* Source Address Queue Filter */ |
256 | #define IXGBE_DAQF(_i) (0x0E200 + ((_i) * 4)) /* Dest. Address Queue Filter */ | 256 | #define IXGBE_DAQF(_i) (0x0E200 + ((_i) * 4)) /* Dest. Address Queue Filter */ |
257 | #define IXGBE_SDPQF(_i) (0x0E400 + ((_i) * 4)) /* Src Dest. Addr Queue Filter */ | 257 | #define IXGBE_SDPQF(_i) (0x0E400 + ((_i) * 4)) /* Src Dest. Addr Queue Filter */ |
258 | #define IXGBE_FTQF(_i) (0x0E600 + ((_i) * 4)) /* Five Tuple Queue Filter */ | 258 | #define IXGBE_FTQF(_i) (0x0E600 + ((_i) * 4)) /* Five Tuple Queue Filter */ |
259 | #define IXGBE_ETQF(_i) (0x05128 + ((_i) * 4)) /* EType Queue Filter */ | 259 | #define IXGBE_ETQF(_i) (0x05128 + ((_i) * 4)) /* EType Queue Filter */ |
260 | #define IXGBE_ETQS(_i) (0x0EC00 + ((_i) * 4)) /* EType Queue Select */ | 260 | #define IXGBE_ETQS(_i) (0x0EC00 + ((_i) * 4)) /* EType Queue Select */ |
261 | #define IXGBE_SYNQF 0x0EC30 /* SYN Packet Queue Filter */ | 261 | #define IXGBE_SYNQF 0x0EC30 /* SYN Packet Queue Filter */ |
262 | #define IXGBE_RQTC 0x0EC70 | 262 | #define IXGBE_RQTC 0x0EC70 |
263 | #define IXGBE_MTQC 0x08120 | 263 | #define IXGBE_MTQC 0x08120 |
264 | #define IXGBE_VLVF(_i) (0x0F100 + ((_i) * 4)) /* 64 of these (0-63) */ | 264 | #define IXGBE_VLVF(_i) (0x0F100 + ((_i) * 4)) /* 64 of these (0-63) */ |
265 | #define IXGBE_VLVFB(_i) (0x0F200 + ((_i) * 4)) /* 128 of these (0-127) */ | 265 | #define IXGBE_VLVFB(_i) (0x0F200 + ((_i) * 4)) /* 128 of these (0-127) */ |
266 | #define IXGBE_VMVIR(_i) (0x08000 + ((_i) * 4)) /* 64 of these (0-63) */ | 266 | #define IXGBE_VMVIR(_i) (0x08000 + ((_i) * 4)) /* 64 of these (0-63) */ |
267 | #define IXGBE_VT_CTL 0x051B0 | 267 | #define IXGBE_VT_CTL 0x051B0 |
268 | #define IXGBE_PFMAILBOX(_i) (0x04B00 + (4 * (_i))) /* 64 total */ | 268 | #define IXGBE_PFMAILBOX(_i) (0x04B00 + (4 * (_i))) /* 64 total */ |
269 | #define IXGBE_PFMBMEM(_i) (0x13000 + (64 * (_i))) /* 64 Mailboxes, 16 DW each */ | 269 | #define IXGBE_PFMBMEM(_i) (0x13000 + (64 * (_i))) /* 64 Mailboxes, 16 DW each */ |
270 | #define IXGBE_PFMBICR(_i) (0x00710 + (4 * (_i))) /* 4 total */ | 270 | #define IXGBE_PFMBICR(_i) (0x00710 + (4 * (_i))) /* 4 total */ |
271 | #define IXGBE_PFMBIMR(_i) (0x00720 + (4 * (_i))) /* 4 total */ | 271 | #define IXGBE_PFMBIMR(_i) (0x00720 + (4 * (_i))) /* 4 total */ |
272 | #define IXGBE_VFRE(_i) (0x051E0 + ((_i) * 4)) | 272 | #define IXGBE_VFRE(_i) (0x051E0 + ((_i) * 4)) |
273 | #define IXGBE_VFTE(_i) (0x08110 + ((_i) * 4)) | 273 | #define IXGBE_VFTE(_i) (0x08110 + ((_i) * 4)) |
274 | #define IXGBE_VMECM(_i) (0x08790 + ((_i) * 4)) | 274 | #define IXGBE_VMECM(_i) (0x08790 + ((_i) * 4)) |
275 | #define IXGBE_QDE 0x2F04 | 275 | #define IXGBE_QDE 0x2F04 |
276 | #define IXGBE_VMTXSW(_i) (0x05180 + ((_i) * 4)) /* 2 total */ | 276 | #define IXGBE_VMTXSW(_i) (0x05180 + ((_i) * 4)) /* 2 total */ |
277 | #define IXGBE_VMOLR(_i) (0x0F000 + ((_i) * 4)) /* 64 total */ | 277 | #define IXGBE_VMOLR(_i) (0x0F000 + ((_i) * 4)) /* 64 total */ |
278 | #define IXGBE_UTA(_i) (0x0F400 + ((_i) * 4)) | 278 | #define IXGBE_UTA(_i) (0x0F400 + ((_i) * 4)) |
279 | #define IXGBE_MRCTL(_i) (0x0F600 + ((_i) * 4)) | 279 | #define IXGBE_MRCTL(_i) (0x0F600 + ((_i) * 4)) |
280 | #define IXGBE_VMRVLAN(_i) (0x0F610 + ((_i) * 4)) | 280 | #define IXGBE_VMRVLAN(_i) (0x0F610 + ((_i) * 4)) |
281 | #define IXGBE_VMRVM(_i) (0x0F630 + ((_i) * 4)) | 281 | #define IXGBE_VMRVM(_i) (0x0F630 + ((_i) * 4)) |
282 | #define IXGBE_L34T_IMIR(_i) (0x0E800 + ((_i) * 4)) /*128 of these (0-127)*/ | 282 | #define IXGBE_L34T_IMIR(_i) (0x0E800 + ((_i) * 4)) /*128 of these (0-127)*/ |
283 | #define IXGBE_RXFECCERR0 0x051B8 | 283 | #define IXGBE_RXFECCERR0 0x051B8 |
284 | #define IXGBE_LLITHRESH 0x0EC90 | 284 | #define IXGBE_LLITHRESH 0x0EC90 |
285 | #define IXGBE_IMIR(_i) (0x05A80 + ((_i) * 4)) /* 8 of these (0-7) */ | 285 | #define IXGBE_IMIR(_i) (0x05A80 + ((_i) * 4)) /* 8 of these (0-7) */ |
286 | #define IXGBE_IMIREXT(_i) (0x05AA0 + ((_i) * 4)) /* 8 of these (0-7) */ | 286 | #define IXGBE_IMIREXT(_i) (0x05AA0 + ((_i) * 4)) /* 8 of these (0-7) */ |
287 | #define IXGBE_IMIRVP 0x05AC0 | 287 | #define IXGBE_IMIRVP 0x05AC0 |
288 | #define IXGBE_VMD_CTL 0x0581C | 288 | #define IXGBE_VMD_CTL 0x0581C |
289 | #define IXGBE_RETA(_i) (0x05C00 + ((_i) * 4)) /* 32 of these (0-31) */ | 289 | #define IXGBE_RETA(_i) (0x05C00 + ((_i) * 4)) /* 32 of these (0-31) */ |
290 | #define IXGBE_RSSRK(_i) (0x05C80 + ((_i) * 4)) /* 10 of these (0-9) */ | 290 | #define IXGBE_RSSRK(_i) (0x05C80 + ((_i) * 4)) /* 10 of these (0-9) */ |
291 | 291 | ||
292 | /* Flow Director registers */ | 292 | /* Flow Director registers */ |
293 | #define IXGBE_FDIRCTRL 0x0EE00 | 293 | #define IXGBE_FDIRCTRL 0x0EE00 |
294 | #define IXGBE_FDIRHKEY 0x0EE68 | 294 | #define IXGBE_FDIRHKEY 0x0EE68 |
295 | #define IXGBE_FDIRSKEY 0x0EE6C | 295 | #define IXGBE_FDIRSKEY 0x0EE6C |
296 | #define IXGBE_FDIRDIP4M 0x0EE3C | 296 | #define IXGBE_FDIRDIP4M 0x0EE3C |
297 | #define IXGBE_FDIRSIP4M 0x0EE40 | 297 | #define IXGBE_FDIRSIP4M 0x0EE40 |
298 | #define IXGBE_FDIRTCPM 0x0EE44 | 298 | #define IXGBE_FDIRTCPM 0x0EE44 |
299 | #define IXGBE_FDIRUDPM 0x0EE48 | 299 | #define IXGBE_FDIRUDPM 0x0EE48 |
300 | #define IXGBE_FDIRIP6M 0x0EE74 | 300 | #define IXGBE_FDIRIP6M 0x0EE74 |
301 | #define IXGBE_FDIRM 0x0EE70 | 301 | #define IXGBE_FDIRM 0x0EE70 |
302 | 302 | ||
303 | /* Flow Director Stats registers */ | 303 | /* Flow Director Stats registers */ |
304 | #define IXGBE_FDIRFREE 0x0EE38 | 304 | #define IXGBE_FDIRFREE 0x0EE38 |
305 | #define IXGBE_FDIRLEN 0x0EE4C | 305 | #define IXGBE_FDIRLEN 0x0EE4C |
306 | #define IXGBE_FDIRUSTAT 0x0EE50 | 306 | #define IXGBE_FDIRUSTAT 0x0EE50 |
307 | #define IXGBE_FDIRFSTAT 0x0EE54 | 307 | #define IXGBE_FDIRFSTAT 0x0EE54 |
308 | #define IXGBE_FDIRMATCH 0x0EE58 | 308 | #define IXGBE_FDIRMATCH 0x0EE58 |
309 | #define IXGBE_FDIRMISS 0x0EE5C | 309 | #define IXGBE_FDIRMISS 0x0EE5C |
310 | 310 | ||
311 | /* Flow Director Programming registers */ | 311 | /* Flow Director Programming registers */ |
312 | #define IXGBE_FDIRSIPv6(_i) (0x0EE0C + ((_i) * 4)) /* 3 of these (0-2) */ | 312 | #define IXGBE_FDIRSIPv6(_i) (0x0EE0C + ((_i) * 4)) /* 3 of these (0-2) */ |
313 | #define IXGBE_FDIRIPSA 0x0EE18 | 313 | #define IXGBE_FDIRIPSA 0x0EE18 |
314 | #define IXGBE_FDIRIPDA 0x0EE1C | 314 | #define IXGBE_FDIRIPDA 0x0EE1C |
315 | #define IXGBE_FDIRPORT 0x0EE20 | 315 | #define IXGBE_FDIRPORT 0x0EE20 |
316 | #define IXGBE_FDIRVLAN 0x0EE24 | 316 | #define IXGBE_FDIRVLAN 0x0EE24 |
317 | #define IXGBE_FDIRHASH 0x0EE28 | 317 | #define IXGBE_FDIRHASH 0x0EE28 |
318 | #define IXGBE_FDIRCMD 0x0EE2C | 318 | #define IXGBE_FDIRCMD 0x0EE2C |
319 | 319 | ||
320 | /* Transmit DMA registers */ | 320 | /* Transmit DMA registers */ |
321 | #define IXGBE_TDBAL(_i) (0x06000 + ((_i) * 0x40)) /* 32 of these (0-31)*/ | 321 | #define IXGBE_TDBAL(_i) (0x06000 + ((_i) * 0x40)) /* 32 of these (0-31)*/ |
322 | #define IXGBE_TDBAH(_i) (0x06004 + ((_i) * 0x40)) | 322 | #define IXGBE_TDBAH(_i) (0x06004 + ((_i) * 0x40)) |
323 | #define IXGBE_TDLEN(_i) (0x06008 + ((_i) * 0x40)) | 323 | #define IXGBE_TDLEN(_i) (0x06008 + ((_i) * 0x40)) |
324 | #define IXGBE_TDH(_i) (0x06010 + ((_i) * 0x40)) | 324 | #define IXGBE_TDH(_i) (0x06010 + ((_i) * 0x40)) |
325 | #define IXGBE_TDT(_i) (0x06018 + ((_i) * 0x40)) | 325 | #define IXGBE_TDT(_i) (0x06018 + ((_i) * 0x40)) |
326 | #define IXGBE_TXDCTL(_i) (0x06028 + ((_i) * 0x40)) | 326 | #define IXGBE_TXDCTL(_i) (0x06028 + ((_i) * 0x40)) |
327 | #define IXGBE_TDWBAL(_i) (0x06038 + ((_i) * 0x40)) | 327 | #define IXGBE_TDWBAL(_i) (0x06038 + ((_i) * 0x40)) |
328 | #define IXGBE_TDWBAH(_i) (0x0603C + ((_i) * 0x40)) | 328 | #define IXGBE_TDWBAH(_i) (0x0603C + ((_i) * 0x40)) |
329 | #define IXGBE_DTXCTL 0x07E00 | 329 | #define IXGBE_DTXCTL 0x07E00 |
330 | 330 | ||
331 | #define IXGBE_DMATXCTL 0x04A80 | 331 | #define IXGBE_DMATXCTL 0x04A80 |
332 | #define IXGBE_PFVFSPOOF(_i) (0x08200 + ((_i) * 4)) /* 8 of these 0 - 7 */ | 332 | #define IXGBE_PFVFSPOOF(_i) (0x08200 + ((_i) * 4)) /* 8 of these 0 - 7 */ |
333 | #define IXGBE_PFDTXGSWC 0x08220 | 333 | #define IXGBE_PFDTXGSWC 0x08220 |
334 | #define IXGBE_DTXMXSZRQ 0x08100 | 334 | #define IXGBE_DTXMXSZRQ 0x08100 |
335 | #define IXGBE_DTXTCPFLGL 0x04A88 | 335 | #define IXGBE_DTXTCPFLGL 0x04A88 |
336 | #define IXGBE_DTXTCPFLGH 0x04A8C | 336 | #define IXGBE_DTXTCPFLGH 0x04A8C |
337 | #define IXGBE_LBDRPEN 0x0CA00 | 337 | #define IXGBE_LBDRPEN 0x0CA00 |
338 | #define IXGBE_TXPBTHRESH(_i) (0x04950 + ((_i) * 4)) /* 8 of these 0 - 7 */ | 338 | #define IXGBE_TXPBTHRESH(_i) (0x04950 + ((_i) * 4)) /* 8 of these 0 - 7 */ |
339 | 339 | ||
340 | #define IXGBE_DMATXCTL_TE 0x1 /* Transmit Enable */ | 340 | #define IXGBE_DMATXCTL_TE 0x1 /* Transmit Enable */ |
341 | #define IXGBE_DMATXCTL_NS 0x2 /* No Snoop LSO hdr buffer */ | 341 | #define IXGBE_DMATXCTL_NS 0x2 /* No Snoop LSO hdr buffer */ |
342 | #define IXGBE_DMATXCTL_GDV 0x8 /* Global Double VLAN */ | 342 | #define IXGBE_DMATXCTL_GDV 0x8 /* Global Double VLAN */ |
343 | #define IXGBE_DMATXCTL_VT_SHIFT 16 /* VLAN EtherType */ | 343 | #define IXGBE_DMATXCTL_VT_SHIFT 16 /* VLAN EtherType */ |
344 | 344 | ||
345 | #define IXGBE_PFDTXGSWC_VT_LBEN 0x1 /* Local L2 VT switch enable */ | 345 | #define IXGBE_PFDTXGSWC_VT_LBEN 0x1 /* Local L2 VT switch enable */ |
346 | 346 | ||
347 | /* Anti-spoofing defines */ | 347 | /* Anti-spoofing defines */ |
348 | #define IXGBE_SPOOF_MACAS_MASK 0xFF | 348 | #define IXGBE_SPOOF_MACAS_MASK 0xFF |
349 | #define IXGBE_SPOOF_VLANAS_MASK 0xFF00 | 349 | #define IXGBE_SPOOF_VLANAS_MASK 0xFF00 |
350 | #define IXGBE_SPOOF_VLANAS_SHIFT 8 | 350 | #define IXGBE_SPOOF_VLANAS_SHIFT 8 |
351 | #define IXGBE_PFVFSPOOF_REG_COUNT 8 | 351 | #define IXGBE_PFVFSPOOF_REG_COUNT 8 |
352 | 352 | ||
353 | #define IXGBE_DCA_TXCTRL(_i) (0x07200 + ((_i) * 4)) /* 16 of these (0-15) */ | 353 | #define IXGBE_DCA_TXCTRL(_i) (0x07200 + ((_i) * 4)) /* 16 of these (0-15) */ |
354 | /* Tx DCA Control register : 128 of these (0-127) */ | 354 | /* Tx DCA Control register : 128 of these (0-127) */ |
355 | #define IXGBE_DCA_TXCTRL_82599(_i) (0x0600C + ((_i) * 0x40)) | 355 | #define IXGBE_DCA_TXCTRL_82599(_i) (0x0600C + ((_i) * 0x40)) |
356 | #define IXGBE_TIPG 0x0CB00 | 356 | #define IXGBE_TIPG 0x0CB00 |
357 | #define IXGBE_TXPBSIZE(_i) (0x0CC00 + ((_i) * 4)) /* 8 of these */ | 357 | #define IXGBE_TXPBSIZE(_i) (0x0CC00 + ((_i) * 4)) /* 8 of these */ |
358 | #define IXGBE_MNGTXMAP 0x0CD10 | 358 | #define IXGBE_MNGTXMAP 0x0CD10 |
359 | #define IXGBE_TIPG_FIBER_DEFAULT 3 | 359 | #define IXGBE_TIPG_FIBER_DEFAULT 3 |
360 | #define IXGBE_TXPBSIZE_SHIFT 10 | 360 | #define IXGBE_TXPBSIZE_SHIFT 10 |
361 | 361 | ||
362 | /* Wake up registers */ | 362 | /* Wake up registers */ |
363 | #define IXGBE_WUC 0x05800 | 363 | #define IXGBE_WUC 0x05800 |
364 | #define IXGBE_WUFC 0x05808 | 364 | #define IXGBE_WUFC 0x05808 |
365 | #define IXGBE_WUS 0x05810 | 365 | #define IXGBE_WUS 0x05810 |
366 | #define IXGBE_IPAV 0x05838 | 366 | #define IXGBE_IPAV 0x05838 |
367 | #define IXGBE_IP4AT 0x05840 /* IPv4 table 0x5840-0x5858 */ | 367 | #define IXGBE_IP4AT 0x05840 /* IPv4 table 0x5840-0x5858 */ |
368 | #define IXGBE_IP6AT 0x05880 /* IPv6 table 0x5880-0x588F */ | 368 | #define IXGBE_IP6AT 0x05880 /* IPv6 table 0x5880-0x588F */ |
369 | 369 | ||
370 | #define IXGBE_WUPL 0x05900 | 370 | #define IXGBE_WUPL 0x05900 |
371 | #define IXGBE_WUPM 0x05A00 /* wake up pkt memory 0x5A00-0x5A7C */ | 371 | #define IXGBE_WUPM 0x05A00 /* wake up pkt memory 0x5A00-0x5A7C */ |
372 | #define IXGBE_FHFT(_n) (0x09000 + ((_n) * 0x100)) /* Flex host filter table */ | 372 | #define IXGBE_FHFT(_n) (0x09000 + ((_n) * 0x100)) /* Flex host filter table */ |
373 | #define IXGBE_FHFT_EXT(_n) (0x09800 + ((_n) * 0x100)) /* Ext Flexible Host | 373 | #define IXGBE_FHFT_EXT(_n) (0x09800 + ((_n) * 0x100)) /* Ext Flexible Host |
374 | * Filter Table */ | 374 | * Filter Table */ |
375 | 375 | ||
376 | #define IXGBE_FLEXIBLE_FILTER_COUNT_MAX 4 | 376 | #define IXGBE_FLEXIBLE_FILTER_COUNT_MAX 4 |
377 | #define IXGBE_EXT_FLEXIBLE_FILTER_COUNT_MAX 2 | 377 | #define IXGBE_EXT_FLEXIBLE_FILTER_COUNT_MAX 2 |
378 | 378 | ||
379 | /* Each Flexible Filter is at most 128 (0x80) bytes in length */ | 379 | /* Each Flexible Filter is at most 128 (0x80) bytes in length */ |
380 | #define IXGBE_FLEXIBLE_FILTER_SIZE_MAX 128 | 380 | #define IXGBE_FLEXIBLE_FILTER_SIZE_MAX 128 |
381 | #define IXGBE_FHFT_LENGTH_OFFSET 0xFC /* Length byte in FHFT */ | 381 | #define IXGBE_FHFT_LENGTH_OFFSET 0xFC /* Length byte in FHFT */ |
382 | #define IXGBE_FHFT_LENGTH_MASK 0x0FF /* Length in lower byte */ | 382 | #define IXGBE_FHFT_LENGTH_MASK 0x0FF /* Length in lower byte */ |
383 | 383 | ||
384 | /* Definitions for power management and wakeup registers */ | 384 | /* Definitions for power management and wakeup registers */ |
385 | /* Wake Up Control */ | 385 | /* Wake Up Control */ |
386 | #define IXGBE_WUC_PME_EN 0x00000002 /* PME Enable */ | 386 | #define IXGBE_WUC_PME_EN 0x00000002 /* PME Enable */ |
387 | #define IXGBE_WUC_PME_STATUS 0x00000004 /* PME Status */ | 387 | #define IXGBE_WUC_PME_STATUS 0x00000004 /* PME Status */ |
388 | #define IXGBE_WUC_WKEN 0x00000010 /* Enable PE_WAKE_N pin assertion */ | 388 | #define IXGBE_WUC_WKEN 0x00000010 /* Enable PE_WAKE_N pin assertion */ |
389 | 389 | ||
390 | /* Wake Up Filter Control */ | 390 | /* Wake Up Filter Control */ |
391 | #define IXGBE_WUFC_LNKC 0x00000001 /* Link Status Change Wakeup Enable */ | 391 | #define IXGBE_WUFC_LNKC 0x00000001 /* Link Status Change Wakeup Enable */ |
392 | #define IXGBE_WUFC_MAG 0x00000002 /* Magic Packet Wakeup Enable */ | 392 | #define IXGBE_WUFC_MAG 0x00000002 /* Magic Packet Wakeup Enable */ |
393 | #define IXGBE_WUFC_EX 0x00000004 /* Directed Exact Wakeup Enable */ | 393 | #define IXGBE_WUFC_EX 0x00000004 /* Directed Exact Wakeup Enable */ |
394 | #define IXGBE_WUFC_MC 0x00000008 /* Directed Multicast Wakeup Enable */ | 394 | #define IXGBE_WUFC_MC 0x00000008 /* Directed Multicast Wakeup Enable */ |
395 | #define IXGBE_WUFC_BC 0x00000010 /* Broadcast Wakeup Enable */ | 395 | #define IXGBE_WUFC_BC 0x00000010 /* Broadcast Wakeup Enable */ |
396 | #define IXGBE_WUFC_ARP 0x00000020 /* ARP Request Packet Wakeup Enable */ | 396 | #define IXGBE_WUFC_ARP 0x00000020 /* ARP Request Packet Wakeup Enable */ |
397 | #define IXGBE_WUFC_IPV4 0x00000040 /* Directed IPv4 Packet Wakeup Enable */ | 397 | #define IXGBE_WUFC_IPV4 0x00000040 /* Directed IPv4 Packet Wakeup Enable */ |
398 | #define IXGBE_WUFC_IPV6 0x00000080 /* Directed IPv6 Packet Wakeup Enable */ | 398 | #define IXGBE_WUFC_IPV6 0x00000080 /* Directed IPv6 Packet Wakeup Enable */ |
399 | #define IXGBE_WUFC_MNG 0x00000100 /* Directed Mgmt Packet Wakeup Enable */ | 399 | #define IXGBE_WUFC_MNG 0x00000100 /* Directed Mgmt Packet Wakeup Enable */ |
400 | 400 | ||
401 | #define IXGBE_WUFC_IGNORE_TCO 0x00008000 /* Ignore WakeOn TCO packets */ | 401 | #define IXGBE_WUFC_IGNORE_TCO 0x00008000 /* Ignore WakeOn TCO packets */ |
402 | #define IXGBE_WUFC_FLX0 0x00010000 /* Flexible Filter 0 Enable */ | 402 | #define IXGBE_WUFC_FLX0 0x00010000 /* Flexible Filter 0 Enable */ |
403 | #define IXGBE_WUFC_FLX1 0x00020000 /* Flexible Filter 1 Enable */ | 403 | #define IXGBE_WUFC_FLX1 0x00020000 /* Flexible Filter 1 Enable */ |
404 | #define IXGBE_WUFC_FLX2 0x00040000 /* Flexible Filter 2 Enable */ | 404 | #define IXGBE_WUFC_FLX2 0x00040000 /* Flexible Filter 2 Enable */ |
405 | #define IXGBE_WUFC_FLX3 0x00080000 /* Flexible Filter 3 Enable */ | 405 | #define IXGBE_WUFC_FLX3 0x00080000 /* Flexible Filter 3 Enable */ |
406 | #define IXGBE_WUFC_FLX4 0x00100000 /* Flexible Filter 4 Enable */ | 406 | #define IXGBE_WUFC_FLX4 0x00100000 /* Flexible Filter 4 Enable */ |
407 | #define IXGBE_WUFC_FLX5 0x00200000 /* Flexible Filter 5 Enable */ | 407 | #define IXGBE_WUFC_FLX5 0x00200000 /* Flexible Filter 5 Enable */ |
408 | #define IXGBE_WUFC_FLX_FILTERS 0x000F0000 /* Mask for 4 flex filters */ | 408 | #define IXGBE_WUFC_FLX_FILTERS 0x000F0000 /* Mask for 4 flex filters */ |
409 | #define IXGBE_WUFC_EXT_FLX_FILTERS 0x00300000 /* Mask for Ext. flex filters */ | 409 | #define IXGBE_WUFC_EXT_FLX_FILTERS 0x00300000 /* Mask for Ext. flex filters */ |
410 | #define IXGBE_WUFC_ALL_FILTERS 0x003F00FF /* Mask for all wakeup filters */ | 410 | #define IXGBE_WUFC_ALL_FILTERS 0x003F00FF /* Mask for all wakeup filters */ |
411 | #define IXGBE_WUFC_FLX_OFFSET 16 /* Offset to the Flexible Filters bits */ | 411 | #define IXGBE_WUFC_FLX_OFFSET 16 /* Offset to the Flexible Filters bits */ |
412 | 412 | ||
413 | /* Wake Up Status */ | 413 | /* Wake Up Status */ |
414 | #define IXGBE_WUS_LNKC IXGBE_WUFC_LNKC | 414 | #define IXGBE_WUS_LNKC IXGBE_WUFC_LNKC |
415 | #define IXGBE_WUS_MAG IXGBE_WUFC_MAG | 415 | #define IXGBE_WUS_MAG IXGBE_WUFC_MAG |
416 | #define IXGBE_WUS_EX IXGBE_WUFC_EX | 416 | #define IXGBE_WUS_EX IXGBE_WUFC_EX |
417 | #define IXGBE_WUS_MC IXGBE_WUFC_MC | 417 | #define IXGBE_WUS_MC IXGBE_WUFC_MC |
418 | #define IXGBE_WUS_BC IXGBE_WUFC_BC | 418 | #define IXGBE_WUS_BC IXGBE_WUFC_BC |
419 | #define IXGBE_WUS_ARP IXGBE_WUFC_ARP | 419 | #define IXGBE_WUS_ARP IXGBE_WUFC_ARP |
420 | #define IXGBE_WUS_IPV4 IXGBE_WUFC_IPV4 | 420 | #define IXGBE_WUS_IPV4 IXGBE_WUFC_IPV4 |
421 | #define IXGBE_WUS_IPV6 IXGBE_WUFC_IPV6 | 421 | #define IXGBE_WUS_IPV6 IXGBE_WUFC_IPV6 |
422 | #define IXGBE_WUS_MNG IXGBE_WUFC_MNG | 422 | #define IXGBE_WUS_MNG IXGBE_WUFC_MNG |
423 | #define IXGBE_WUS_FLX0 IXGBE_WUFC_FLX0 | 423 | #define IXGBE_WUS_FLX0 IXGBE_WUFC_FLX0 |
424 | #define IXGBE_WUS_FLX1 IXGBE_WUFC_FLX1 | 424 | #define IXGBE_WUS_FLX1 IXGBE_WUFC_FLX1 |
425 | #define IXGBE_WUS_FLX2 IXGBE_WUFC_FLX2 | 425 | #define IXGBE_WUS_FLX2 IXGBE_WUFC_FLX2 |
426 | #define IXGBE_WUS_FLX3 IXGBE_WUFC_FLX3 | 426 | #define IXGBE_WUS_FLX3 IXGBE_WUFC_FLX3 |
427 | #define IXGBE_WUS_FLX4 IXGBE_WUFC_FLX4 | 427 | #define IXGBE_WUS_FLX4 IXGBE_WUFC_FLX4 |
428 | #define IXGBE_WUS_FLX5 IXGBE_WUFC_FLX5 | 428 | #define IXGBE_WUS_FLX5 IXGBE_WUFC_FLX5 |
429 | #define IXGBE_WUS_FLX_FILTERS IXGBE_WUFC_FLX_FILTERS | 429 | #define IXGBE_WUS_FLX_FILTERS IXGBE_WUFC_FLX_FILTERS |
430 | 430 | ||
431 | /* Wake Up Packet Length */ | 431 | /* Wake Up Packet Length */ |
432 | #define IXGBE_WUPL_LENGTH_MASK 0xFFFF | 432 | #define IXGBE_WUPL_LENGTH_MASK 0xFFFF |
433 | 433 | ||
434 | /* DCB registers */ | 434 | /* DCB registers */ |
435 | #define MAX_TRAFFIC_CLASS 8 | 435 | #define MAX_TRAFFIC_CLASS 8 |
436 | #define X540_TRAFFIC_CLASS 4 | 436 | #define X540_TRAFFIC_CLASS 4 |
437 | #define IXGBE_RMCS 0x03D00 | 437 | #define IXGBE_RMCS 0x03D00 |
438 | #define IXGBE_DPMCS 0x07F40 | 438 | #define IXGBE_DPMCS 0x07F40 |
439 | #define IXGBE_PDPMCS 0x0CD00 | 439 | #define IXGBE_PDPMCS 0x0CD00 |
440 | #define IXGBE_RUPPBMR 0x050A0 | 440 | #define IXGBE_RUPPBMR 0x050A0 |
441 | #define IXGBE_RT2CR(_i) (0x03C20 + ((_i) * 4)) /* 8 of these (0-7) */ | 441 | #define IXGBE_RT2CR(_i) (0x03C20 + ((_i) * 4)) /* 8 of these (0-7) */ |
442 | #define IXGBE_RT2SR(_i) (0x03C40 + ((_i) * 4)) /* 8 of these (0-7) */ | 442 | #define IXGBE_RT2SR(_i) (0x03C40 + ((_i) * 4)) /* 8 of these (0-7) */ |
443 | #define IXGBE_TDTQ2TCCR(_i) (0x0602C + ((_i) * 0x40)) /* 8 of these (0-7) */ | 443 | #define IXGBE_TDTQ2TCCR(_i) (0x0602C + ((_i) * 0x40)) /* 8 of these (0-7) */ |
444 | #define IXGBE_TDTQ2TCSR(_i) (0x0622C + ((_i) * 0x40)) /* 8 of these (0-7) */ | 444 | #define IXGBE_TDTQ2TCSR(_i) (0x0622C + ((_i) * 0x40)) /* 8 of these (0-7) */ |
445 | #define IXGBE_TDPT2TCCR(_i) (0x0CD20 + ((_i) * 4)) /* 8 of these (0-7) */ | 445 | #define IXGBE_TDPT2TCCR(_i) (0x0CD20 + ((_i) * 4)) /* 8 of these (0-7) */ |
446 | #define IXGBE_TDPT2TCSR(_i) (0x0CD40 + ((_i) * 4)) /* 8 of these (0-7) */ | 446 | #define IXGBE_TDPT2TCSR(_i) (0x0CD40 + ((_i) * 4)) /* 8 of these (0-7) */ |
447 | 447 | ||
448 | 448 | ||
449 | /* Security Control Registers */ | 449 | /* Security Control Registers */ |
450 | #define IXGBE_SECTXCTRL 0x08800 | 450 | #define IXGBE_SECTXCTRL 0x08800 |
451 | #define IXGBE_SECTXSTAT 0x08804 | 451 | #define IXGBE_SECTXSTAT 0x08804 |
452 | #define IXGBE_SECTXBUFFAF 0x08808 | 452 | #define IXGBE_SECTXBUFFAF 0x08808 |
453 | #define IXGBE_SECTXMINIFG 0x08810 | 453 | #define IXGBE_SECTXMINIFG 0x08810 |
454 | #define IXGBE_SECRXCTRL 0x08D00 | 454 | #define IXGBE_SECRXCTRL 0x08D00 |
455 | #define IXGBE_SECRXSTAT 0x08D04 | 455 | #define IXGBE_SECRXSTAT 0x08D04 |
456 | 456 | ||
457 | /* Security Bit Fields and Masks */ | 457 | /* Security Bit Fields and Masks */ |
458 | #define IXGBE_SECTXCTRL_SECTX_DIS 0x00000001 | 458 | #define IXGBE_SECTXCTRL_SECTX_DIS 0x00000001 |
459 | #define IXGBE_SECTXCTRL_TX_DIS 0x00000002 | 459 | #define IXGBE_SECTXCTRL_TX_DIS 0x00000002 |
460 | #define IXGBE_SECTXCTRL_STORE_FORWARD 0x00000004 | 460 | #define IXGBE_SECTXCTRL_STORE_FORWARD 0x00000004 |
461 | 461 | ||
462 | #define IXGBE_SECTXSTAT_SECTX_RDY 0x00000001 | 462 | #define IXGBE_SECTXSTAT_SECTX_RDY 0x00000001 |
463 | #define IXGBE_SECTXSTAT_ECC_TXERR 0x00000002 | 463 | #define IXGBE_SECTXSTAT_ECC_TXERR 0x00000002 |
464 | 464 | ||
465 | #define IXGBE_SECRXCTRL_SECRX_DIS 0x00000001 | 465 | #define IXGBE_SECRXCTRL_SECRX_DIS 0x00000001 |
466 | #define IXGBE_SECRXCTRL_RX_DIS 0x00000002 | 466 | #define IXGBE_SECRXCTRL_RX_DIS 0x00000002 |
467 | 467 | ||
468 | #define IXGBE_SECRXSTAT_SECRX_RDY 0x00000001 | 468 | #define IXGBE_SECRXSTAT_SECRX_RDY 0x00000001 |
469 | #define IXGBE_SECRXSTAT_ECC_RXERR 0x00000002 | 469 | #define IXGBE_SECRXSTAT_ECC_RXERR 0x00000002 |
470 | 470 | ||
471 | /* LinkSec (MacSec) Registers */ | 471 | /* LinkSec (MacSec) Registers */ |
472 | #define IXGBE_LSECTXCAP 0x08A00 | 472 | #define IXGBE_LSECTXCAP 0x08A00 |
473 | #define IXGBE_LSECRXCAP 0x08F00 | 473 | #define IXGBE_LSECRXCAP 0x08F00 |
474 | #define IXGBE_LSECTXCTRL 0x08A04 | 474 | #define IXGBE_LSECTXCTRL 0x08A04 |
475 | #define IXGBE_LSECTXSCL 0x08A08 /* SCI Low */ | 475 | #define IXGBE_LSECTXSCL 0x08A08 /* SCI Low */ |
476 | #define IXGBE_LSECTXSCH 0x08A0C /* SCI High */ | 476 | #define IXGBE_LSECTXSCH 0x08A0C /* SCI High */ |
477 | #define IXGBE_LSECTXSA 0x08A10 | 477 | #define IXGBE_LSECTXSA 0x08A10 |
478 | #define IXGBE_LSECTXPN0 0x08A14 | 478 | #define IXGBE_LSECTXPN0 0x08A14 |
479 | #define IXGBE_LSECTXPN1 0x08A18 | 479 | #define IXGBE_LSECTXPN1 0x08A18 |
480 | #define IXGBE_LSECTXKEY0(_n) (0x08A1C + (4 * (_n))) /* 4 of these (0-3) */ | 480 | #define IXGBE_LSECTXKEY0(_n) (0x08A1C + (4 * (_n))) /* 4 of these (0-3) */ |
481 | #define IXGBE_LSECTXKEY1(_n) (0x08A2C + (4 * (_n))) /* 4 of these (0-3) */ | 481 | #define IXGBE_LSECTXKEY1(_n) (0x08A2C + (4 * (_n))) /* 4 of these (0-3) */ |
482 | #define IXGBE_LSECRXCTRL 0x08F04 | 482 | #define IXGBE_LSECRXCTRL 0x08F04 |
483 | #define IXGBE_LSECRXSCL 0x08F08 | 483 | #define IXGBE_LSECRXSCL 0x08F08 |
484 | #define IXGBE_LSECRXSCH 0x08F0C | 484 | #define IXGBE_LSECRXSCH 0x08F0C |
485 | #define IXGBE_LSECRXSA(_i) (0x08F10 + (4 * (_i))) /* 2 of these (0-1) */ | 485 | #define IXGBE_LSECRXSA(_i) (0x08F10 + (4 * (_i))) /* 2 of these (0-1) */ |
486 | #define IXGBE_LSECRXPN(_i) (0x08F18 + (4 * (_i))) /* 2 of these (0-1) */ | 486 | #define IXGBE_LSECRXPN(_i) (0x08F18 + (4 * (_i))) /* 2 of these (0-1) */ |
487 | #define IXGBE_LSECRXKEY(_n, _m) (0x08F20 + ((0x10 * (_n)) + (4 * (_m)))) | 487 | #define IXGBE_LSECRXKEY(_n, _m) (0x08F20 + ((0x10 * (_n)) + (4 * (_m)))) |
488 | #define IXGBE_LSECTXUT 0x08A3C /* OutPktsUntagged */ | 488 | #define IXGBE_LSECTXUT 0x08A3C /* OutPktsUntagged */ |
489 | #define IXGBE_LSECTXPKTE 0x08A40 /* OutPktsEncrypted */ | 489 | #define IXGBE_LSECTXPKTE 0x08A40 /* OutPktsEncrypted */ |
490 | #define IXGBE_LSECTXPKTP 0x08A44 /* OutPktsProtected */ | 490 | #define IXGBE_LSECTXPKTP 0x08A44 /* OutPktsProtected */ |
491 | #define IXGBE_LSECTXOCTE 0x08A48 /* OutOctetsEncrypted */ | 491 | #define IXGBE_LSECTXOCTE 0x08A48 /* OutOctetsEncrypted */ |
492 | #define IXGBE_LSECTXOCTP 0x08A4C /* OutOctetsProtected */ | 492 | #define IXGBE_LSECTXOCTP 0x08A4C /* OutOctetsProtected */ |
493 | #define IXGBE_LSECRXUT 0x08F40 /* InPktsUntagged/InPktsNoTag */ | 493 | #define IXGBE_LSECRXUT 0x08F40 /* InPktsUntagged/InPktsNoTag */ |
494 | #define IXGBE_LSECRXOCTD 0x08F44 /* InOctetsDecrypted */ | 494 | #define IXGBE_LSECRXOCTD 0x08F44 /* InOctetsDecrypted */ |
495 | #define IXGBE_LSECRXOCTV 0x08F48 /* InOctetsValidated */ | 495 | #define IXGBE_LSECRXOCTV 0x08F48 /* InOctetsValidated */ |
496 | #define IXGBE_LSECRXBAD 0x08F4C /* InPktsBadTag */ | 496 | #define IXGBE_LSECRXBAD 0x08F4C /* InPktsBadTag */ |
497 | #define IXGBE_LSECRXNOSCI 0x08F50 /* InPktsNoSci */ | 497 | #define IXGBE_LSECRXNOSCI 0x08F50 /* InPktsNoSci */ |
498 | #define IXGBE_LSECRXUNSCI 0x08F54 /* InPktsUnknownSci */ | 498 | #define IXGBE_LSECRXUNSCI 0x08F54 /* InPktsUnknownSci */ |
499 | #define IXGBE_LSECRXUNCH 0x08F58 /* InPktsUnchecked */ | 499 | #define IXGBE_LSECRXUNCH 0x08F58 /* InPktsUnchecked */ |
500 | #define IXGBE_LSECRXDELAY 0x08F5C /* InPktsDelayed */ | 500 | #define IXGBE_LSECRXDELAY 0x08F5C /* InPktsDelayed */ |
501 | #define IXGBE_LSECRXLATE 0x08F60 /* InPktsLate */ | 501 | #define IXGBE_LSECRXLATE 0x08F60 /* InPktsLate */ |
502 | #define IXGBE_LSECRXOK(_n) (0x08F64 + (0x04 * (_n))) /* InPktsOk */ | 502 | #define IXGBE_LSECRXOK(_n) (0x08F64 + (0x04 * (_n))) /* InPktsOk */ |
503 | #define IXGBE_LSECRXINV(_n) (0x08F6C + (0x04 * (_n))) /* InPktsInvalid */ | 503 | #define IXGBE_LSECRXINV(_n) (0x08F6C + (0x04 * (_n))) /* InPktsInvalid */ |
504 | #define IXGBE_LSECRXNV(_n) (0x08F74 + (0x04 * (_n))) /* InPktsNotValid */ | 504 | #define IXGBE_LSECRXNV(_n) (0x08F74 + (0x04 * (_n))) /* InPktsNotValid */ |
505 | #define IXGBE_LSECRXUNSA 0x08F7C /* InPktsUnusedSa */ | 505 | #define IXGBE_LSECRXUNSA 0x08F7C /* InPktsUnusedSa */ |
506 | #define IXGBE_LSECRXNUSA 0x08F80 /* InPktsNotUsingSa */ | 506 | #define IXGBE_LSECRXNUSA 0x08F80 /* InPktsNotUsingSa */ |
507 | 507 | ||
508 | /* LinkSec (MacSec) Bit Fields and Masks */ | 508 | /* LinkSec (MacSec) Bit Fields and Masks */ |
509 | #define IXGBE_LSECTXCAP_SUM_MASK 0x00FF0000 | 509 | #define IXGBE_LSECTXCAP_SUM_MASK 0x00FF0000 |
510 | #define IXGBE_LSECTXCAP_SUM_SHIFT 16 | 510 | #define IXGBE_LSECTXCAP_SUM_SHIFT 16 |
511 | #define IXGBE_LSECRXCAP_SUM_MASK 0x00FF0000 | 511 | #define IXGBE_LSECRXCAP_SUM_MASK 0x00FF0000 |
512 | #define IXGBE_LSECRXCAP_SUM_SHIFT 16 | 512 | #define IXGBE_LSECRXCAP_SUM_SHIFT 16 |
513 | 513 | ||
514 | #define IXGBE_LSECTXCTRL_EN_MASK 0x00000003 | 514 | #define IXGBE_LSECTXCTRL_EN_MASK 0x00000003 |
515 | #define IXGBE_LSECTXCTRL_DISABLE 0x0 | 515 | #define IXGBE_LSECTXCTRL_DISABLE 0x0 |
516 | #define IXGBE_LSECTXCTRL_AUTH 0x1 | 516 | #define IXGBE_LSECTXCTRL_AUTH 0x1 |
517 | #define IXGBE_LSECTXCTRL_AUTH_ENCRYPT 0x2 | 517 | #define IXGBE_LSECTXCTRL_AUTH_ENCRYPT 0x2 |
518 | #define IXGBE_LSECTXCTRL_AISCI 0x00000020 | 518 | #define IXGBE_LSECTXCTRL_AISCI 0x00000020 |
519 | #define IXGBE_LSECTXCTRL_PNTHRSH_MASK 0xFFFFFF00 | 519 | #define IXGBE_LSECTXCTRL_PNTHRSH_MASK 0xFFFFFF00 |
520 | #define IXGBE_LSECTXCTRL_RSV_MASK 0x000000D8 | 520 | #define IXGBE_LSECTXCTRL_RSV_MASK 0x000000D8 |
521 | 521 | ||
522 | #define IXGBE_LSECRXCTRL_EN_MASK 0x0000000C | 522 | #define IXGBE_LSECRXCTRL_EN_MASK 0x0000000C |
523 | #define IXGBE_LSECRXCTRL_EN_SHIFT 2 | 523 | #define IXGBE_LSECRXCTRL_EN_SHIFT 2 |
524 | #define IXGBE_LSECRXCTRL_DISABLE 0x0 | 524 | #define IXGBE_LSECRXCTRL_DISABLE 0x0 |
525 | #define IXGBE_LSECRXCTRL_CHECK 0x1 | 525 | #define IXGBE_LSECRXCTRL_CHECK 0x1 |
526 | #define IXGBE_LSECRXCTRL_STRICT 0x2 | 526 | #define IXGBE_LSECRXCTRL_STRICT 0x2 |
527 | #define IXGBE_LSECRXCTRL_DROP 0x3 | 527 | #define IXGBE_LSECRXCTRL_DROP 0x3 |
528 | #define IXGBE_LSECRXCTRL_PLSH 0x00000040 | 528 | #define IXGBE_LSECRXCTRL_PLSH 0x00000040 |
529 | #define IXGBE_LSECRXCTRL_RP 0x00000080 | 529 | #define IXGBE_LSECRXCTRL_RP 0x00000080 |
530 | #define IXGBE_LSECRXCTRL_RSV_MASK 0xFFFFFF33 | 530 | #define IXGBE_LSECRXCTRL_RSV_MASK 0xFFFFFF33 |
531 | 531 | ||
532 | /* IpSec Registers */ | 532 | /* IpSec Registers */ |
533 | #define IXGBE_IPSTXIDX 0x08900 | 533 | #define IXGBE_IPSTXIDX 0x08900 |
534 | #define IXGBE_IPSTXSALT 0x08904 | 534 | #define IXGBE_IPSTXSALT 0x08904 |
535 | #define IXGBE_IPSTXKEY(_i) (0x08908 + (4 * (_i))) /* 4 of these (0-3) */ | 535 | #define IXGBE_IPSTXKEY(_i) (0x08908 + (4 * (_i))) /* 4 of these (0-3) */ |
536 | #define IXGBE_IPSRXIDX 0x08E00 | 536 | #define IXGBE_IPSRXIDX 0x08E00 |
537 | #define IXGBE_IPSRXIPADDR(_i) (0x08E04 + (4 * (_i))) /* 4 of these (0-3) */ | 537 | #define IXGBE_IPSRXIPADDR(_i) (0x08E04 + (4 * (_i))) /* 4 of these (0-3) */ |
538 | #define IXGBE_IPSRXSPI 0x08E14 | 538 | #define IXGBE_IPSRXSPI 0x08E14 |
539 | #define IXGBE_IPSRXIPIDX 0x08E18 | 539 | #define IXGBE_IPSRXIPIDX 0x08E18 |
540 | #define IXGBE_IPSRXKEY(_i) (0x08E1C + (4 * (_i))) /* 4 of these (0-3) */ | 540 | #define IXGBE_IPSRXKEY(_i) (0x08E1C + (4 * (_i))) /* 4 of these (0-3) */ |
541 | #define IXGBE_IPSRXSALT 0x08E2C | 541 | #define IXGBE_IPSRXSALT 0x08E2C |
542 | #define IXGBE_IPSRXMOD 0x08E30 | 542 | #define IXGBE_IPSRXMOD 0x08E30 |
543 | 543 | ||
544 | #define IXGBE_SECTXCTRL_STORE_FORWARD_ENABLE 0x4 | 544 | #define IXGBE_SECTXCTRL_STORE_FORWARD_ENABLE 0x4 |
545 | 545 | ||
546 | /* DCB registers */ | 546 | /* DCB registers */ |
547 | #define IXGBE_RTRPCS 0x02430 | 547 | #define IXGBE_RTRPCS 0x02430 |
548 | #define IXGBE_RTTDCS 0x04900 | 548 | #define IXGBE_RTTDCS 0x04900 |
549 | #define IXGBE_RTTDCS_ARBDIS 0x00000040 /* DCB arbiter disable */ | 549 | #define IXGBE_RTTDCS_ARBDIS 0x00000040 /* DCB arbiter disable */ |
550 | #define IXGBE_RTTPCS 0x0CD00 | 550 | #define IXGBE_RTTPCS 0x0CD00 |
551 | #define IXGBE_RTRUP2TC 0x03020 | 551 | #define IXGBE_RTRUP2TC 0x03020 |
552 | #define IXGBE_RTTUP2TC 0x0C800 | 552 | #define IXGBE_RTTUP2TC 0x0C800 |
553 | #define IXGBE_RTRPT4C(_i) (0x02140 + ((_i) * 4)) /* 8 of these (0-7) */ | 553 | #define IXGBE_RTRPT4C(_i) (0x02140 + ((_i) * 4)) /* 8 of these (0-7) */ |
554 | #define IXGBE_TXLLQ(_i) (0x082E0 + ((_i) * 4)) /* 4 of these (0-3) */ | 554 | #define IXGBE_TXLLQ(_i) (0x082E0 + ((_i) * 4)) /* 4 of these (0-3) */ |
555 | #define IXGBE_RTRPT4S(_i) (0x02160 + ((_i) * 4)) /* 8 of these (0-7) */ | 555 | #define IXGBE_RTRPT4S(_i) (0x02160 + ((_i) * 4)) /* 8 of these (0-7) */ |
556 | #define IXGBE_RTTDT2C(_i) (0x04910 + ((_i) * 4)) /* 8 of these (0-7) */ | 556 | #define IXGBE_RTTDT2C(_i) (0x04910 + ((_i) * 4)) /* 8 of these (0-7) */ |
557 | #define IXGBE_RTTDT2S(_i) (0x04930 + ((_i) * 4)) /* 8 of these (0-7) */ | 557 | #define IXGBE_RTTDT2S(_i) (0x04930 + ((_i) * 4)) /* 8 of these (0-7) */ |
558 | #define IXGBE_RTTPT2C(_i) (0x0CD20 + ((_i) * 4)) /* 8 of these (0-7) */ | 558 | #define IXGBE_RTTPT2C(_i) (0x0CD20 + ((_i) * 4)) /* 8 of these (0-7) */ |
559 | #define IXGBE_RTTPT2S(_i) (0x0CD40 + ((_i) * 4)) /* 8 of these (0-7) */ | 559 | #define IXGBE_RTTPT2S(_i) (0x0CD40 + ((_i) * 4)) /* 8 of these (0-7) */ |
560 | #define IXGBE_RTTDQSEL 0x04904 | 560 | #define IXGBE_RTTDQSEL 0x04904 |
561 | #define IXGBE_RTTDT1C 0x04908 | 561 | #define IXGBE_RTTDT1C 0x04908 |
562 | #define IXGBE_RTTDT1S 0x0490C | 562 | #define IXGBE_RTTDT1S 0x0490C |
563 | #define IXGBE_RTTDTECC 0x04990 | 563 | #define IXGBE_RTTDTECC 0x04990 |
564 | #define IXGBE_RTTDTECC_NO_BCN 0x00000100 | 564 | #define IXGBE_RTTDTECC_NO_BCN 0x00000100 |
565 | #define IXGBE_RTTBCNRC 0x04984 | 565 | #define IXGBE_RTTBCNRC 0x04984 |
566 | #define IXGBE_RTTBCNRC_RS_ENA 0x80000000 | 566 | #define IXGBE_RTTBCNRC_RS_ENA 0x80000000 |
567 | #define IXGBE_RTTBCNRC_RF_DEC_MASK 0x00003FFF | 567 | #define IXGBE_RTTBCNRC_RF_DEC_MASK 0x00003FFF |
568 | #define IXGBE_RTTBCNRC_RF_INT_SHIFT 14 | 568 | #define IXGBE_RTTBCNRC_RF_INT_SHIFT 14 |
569 | #define IXGBE_RTTBCNRC_RF_INT_MASK \ | 569 | #define IXGBE_RTTBCNRC_RF_INT_MASK \ |
570 | (IXGBE_RTTBCNRC_RF_DEC_MASK << IXGBE_RTTBCNRC_RF_INT_SHIFT) | 570 | (IXGBE_RTTBCNRC_RF_DEC_MASK << IXGBE_RTTBCNRC_RF_INT_SHIFT) |
571 | #define IXGBE_RTTBCNRM 0x04980 | 571 | #define IXGBE_RTTBCNRM 0x04980 |
572 | 572 | ||
573 | /* FCoE DMA Context Registers */ | 573 | /* FCoE DMA Context Registers */ |
574 | #define IXGBE_FCPTRL 0x02410 /* FC User Desc. PTR Low */ | 574 | #define IXGBE_FCPTRL 0x02410 /* FC User Desc. PTR Low */ |
575 | #define IXGBE_FCPTRH 0x02414 /* FC USer Desc. PTR High */ | 575 | #define IXGBE_FCPTRH 0x02414 /* FC USer Desc. PTR High */ |
576 | #define IXGBE_FCBUFF 0x02418 /* FC Buffer Control */ | 576 | #define IXGBE_FCBUFF 0x02418 /* FC Buffer Control */ |
577 | #define IXGBE_FCDMARW 0x02420 /* FC Receive DMA RW */ | 577 | #define IXGBE_FCDMARW 0x02420 /* FC Receive DMA RW */ |
578 | #define IXGBE_FCINVST0 0x03FC0 /* FC Invalid DMA Context Status Reg 0 */ | 578 | #define IXGBE_FCINVST0 0x03FC0 /* FC Invalid DMA Context Status Reg 0 */ |
579 | #define IXGBE_FCINVST(_i) (IXGBE_FCINVST0 + ((_i) * 4)) | 579 | #define IXGBE_FCINVST(_i) (IXGBE_FCINVST0 + ((_i) * 4)) |
580 | #define IXGBE_FCBUFF_VALID (1 << 0) /* DMA Context Valid */ | 580 | #define IXGBE_FCBUFF_VALID (1 << 0) /* DMA Context Valid */ |
581 | #define IXGBE_FCBUFF_BUFFSIZE (3 << 3) /* User Buffer Size */ | 581 | #define IXGBE_FCBUFF_BUFFSIZE (3 << 3) /* User Buffer Size */ |
582 | #define IXGBE_FCBUFF_WRCONTX (1 << 7) /* 0: Initiator, 1: Target */ | 582 | #define IXGBE_FCBUFF_WRCONTX (1 << 7) /* 0: Initiator, 1: Target */ |
583 | #define IXGBE_FCBUFF_BUFFCNT 0x0000ff00 /* Number of User Buffers */ | 583 | #define IXGBE_FCBUFF_BUFFCNT 0x0000ff00 /* Number of User Buffers */ |
584 | #define IXGBE_FCBUFF_OFFSET 0xffff0000 /* User Buffer Offset */ | 584 | #define IXGBE_FCBUFF_OFFSET 0xffff0000 /* User Buffer Offset */ |
585 | #define IXGBE_FCBUFF_BUFFSIZE_SHIFT 3 | 585 | #define IXGBE_FCBUFF_BUFFSIZE_SHIFT 3 |
586 | #define IXGBE_FCBUFF_BUFFCNT_SHIFT 8 | 586 | #define IXGBE_FCBUFF_BUFFCNT_SHIFT 8 |
587 | #define IXGBE_FCBUFF_OFFSET_SHIFT 16 | 587 | #define IXGBE_FCBUFF_OFFSET_SHIFT 16 |
588 | #define IXGBE_FCDMARW_WE (1 << 14) /* Write enable */ | 588 | #define IXGBE_FCDMARW_WE (1 << 14) /* Write enable */ |
589 | #define IXGBE_FCDMARW_RE (1 << 15) /* Read enable */ | 589 | #define IXGBE_FCDMARW_RE (1 << 15) /* Read enable */ |
590 | #define IXGBE_FCDMARW_FCOESEL 0x000001ff /* FC X_ID: 11 bits */ | 590 | #define IXGBE_FCDMARW_FCOESEL 0x000001ff /* FC X_ID: 11 bits */ |
591 | #define IXGBE_FCDMARW_LASTSIZE 0xffff0000 /* Last User Buffer Size */ | 591 | #define IXGBE_FCDMARW_LASTSIZE 0xffff0000 /* Last User Buffer Size */ |
592 | #define IXGBE_FCDMARW_LASTSIZE_SHIFT 16 | 592 | #define IXGBE_FCDMARW_LASTSIZE_SHIFT 16 |
593 | 593 | ||
594 | /* FCoE SOF/EOF */ | 594 | /* FCoE SOF/EOF */ |
595 | #define IXGBE_TEOFF 0x04A94 /* Tx FC EOF */ | 595 | #define IXGBE_TEOFF 0x04A94 /* Tx FC EOF */ |
596 | #define IXGBE_TSOFF 0x04A98 /* Tx FC SOF */ | 596 | #define IXGBE_TSOFF 0x04A98 /* Tx FC SOF */ |
597 | #define IXGBE_REOFF 0x05158 /* Rx FC EOF */ | 597 | #define IXGBE_REOFF 0x05158 /* Rx FC EOF */ |
598 | #define IXGBE_RSOFF 0x051F8 /* Rx FC SOF */ | 598 | #define IXGBE_RSOFF 0x051F8 /* Rx FC SOF */ |
599 | /* FCoE Filter Context Registers */ | 599 | /* FCoE Filter Context Registers */ |
600 | #define IXGBE_FCFLT 0x05108 /* FC FLT Context */ | 600 | #define IXGBE_FCFLT 0x05108 /* FC FLT Context */ |
601 | #define IXGBE_FCFLTRW 0x05110 /* FC Filter RW Control */ | 601 | #define IXGBE_FCFLTRW 0x05110 /* FC Filter RW Control */ |
602 | #define IXGBE_FCPARAM 0x051d8 /* FC Offset Parameter */ | 602 | #define IXGBE_FCPARAM 0x051d8 /* FC Offset Parameter */ |
603 | #define IXGBE_FCFLT_VALID (1 << 0) /* Filter Context Valid */ | 603 | #define IXGBE_FCFLT_VALID (1 << 0) /* Filter Context Valid */ |
604 | #define IXGBE_FCFLT_FIRST (1 << 1) /* Filter First */ | 604 | #define IXGBE_FCFLT_FIRST (1 << 1) /* Filter First */ |
605 | #define IXGBE_FCFLT_SEQID 0x00ff0000 /* Sequence ID */ | 605 | #define IXGBE_FCFLT_SEQID 0x00ff0000 /* Sequence ID */ |
606 | #define IXGBE_FCFLT_SEQCNT 0xff000000 /* Sequence Count */ | 606 | #define IXGBE_FCFLT_SEQCNT 0xff000000 /* Sequence Count */ |
607 | #define IXGBE_FCFLTRW_RVALDT (1 << 13) /* Fast Re-Validation */ | 607 | #define IXGBE_FCFLTRW_RVALDT (1 << 13) /* Fast Re-Validation */ |
608 | #define IXGBE_FCFLTRW_WE (1 << 14) /* Write Enable */ | 608 | #define IXGBE_FCFLTRW_WE (1 << 14) /* Write Enable */ |
609 | #define IXGBE_FCFLTRW_RE (1 << 15) /* Read Enable */ | 609 | #define IXGBE_FCFLTRW_RE (1 << 15) /* Read Enable */ |
610 | /* FCoE Receive Control */ | 610 | /* FCoE Receive Control */ |
611 | #define IXGBE_FCRXCTRL 0x05100 /* FC Receive Control */ | 611 | #define IXGBE_FCRXCTRL 0x05100 /* FC Receive Control */ |
612 | #define IXGBE_FCRXCTRL_FCOELLI (1 << 0) /* Low latency interrupt */ | 612 | #define IXGBE_FCRXCTRL_FCOELLI (1 << 0) /* Low latency interrupt */ |
613 | #define IXGBE_FCRXCTRL_SAVBAD (1 << 1) /* Save Bad Frames */ | 613 | #define IXGBE_FCRXCTRL_SAVBAD (1 << 1) /* Save Bad Frames */ |
614 | #define IXGBE_FCRXCTRL_FRSTRDH (1 << 2) /* EN 1st Read Header */ | 614 | #define IXGBE_FCRXCTRL_FRSTRDH (1 << 2) /* EN 1st Read Header */ |
615 | #define IXGBE_FCRXCTRL_LASTSEQH (1 << 3) /* EN Last Header in Seq */ | 615 | #define IXGBE_FCRXCTRL_LASTSEQH (1 << 3) /* EN Last Header in Seq */ |
616 | #define IXGBE_FCRXCTRL_ALLH (1 << 4) /* EN All Headers */ | 616 | #define IXGBE_FCRXCTRL_ALLH (1 << 4) /* EN All Headers */ |
617 | #define IXGBE_FCRXCTRL_FRSTSEQH (1 << 5) /* EN 1st Seq. Header */ | 617 | #define IXGBE_FCRXCTRL_FRSTSEQH (1 << 5) /* EN 1st Seq. Header */ |
618 | #define IXGBE_FCRXCTRL_ICRC (1 << 6) /* Ignore Bad FC CRC */ | 618 | #define IXGBE_FCRXCTRL_ICRC (1 << 6) /* Ignore Bad FC CRC */ |
619 | #define IXGBE_FCRXCTRL_FCCRCBO (1 << 7) /* FC CRC Byte Ordering */ | 619 | #define IXGBE_FCRXCTRL_FCCRCBO (1 << 7) /* FC CRC Byte Ordering */ |
620 | #define IXGBE_FCRXCTRL_FCOEVER 0x00000f00 /* FCoE Version: 4 bits */ | 620 | #define IXGBE_FCRXCTRL_FCOEVER 0x00000f00 /* FCoE Version: 4 bits */ |
621 | #define IXGBE_FCRXCTRL_FCOEVER_SHIFT 8 | 621 | #define IXGBE_FCRXCTRL_FCOEVER_SHIFT 8 |
622 | /* FCoE Redirection */ | 622 | /* FCoE Redirection */ |
623 | #define IXGBE_FCRECTL 0x0ED00 /* FC Redirection Control */ | 623 | #define IXGBE_FCRECTL 0x0ED00 /* FC Redirection Control */ |
624 | #define IXGBE_FCRETA0 0x0ED10 /* FC Redirection Table 0 */ | 624 | #define IXGBE_FCRETA0 0x0ED10 /* FC Redirection Table 0 */ |
625 | #define IXGBE_FCRETA(_i) (IXGBE_FCRETA0 + ((_i) * 4)) /* FCoE Redir */ | 625 | #define IXGBE_FCRETA(_i) (IXGBE_FCRETA0 + ((_i) * 4)) /* FCoE Redir */ |
626 | #define IXGBE_FCRECTL_ENA 0x1 /* FCoE Redir Table Enable */ | 626 | #define IXGBE_FCRECTL_ENA 0x1 /* FCoE Redir Table Enable */ |
627 | #define IXGBE_FCRETA_SIZE 8 /* Max entries in FCRETA */ | 627 | #define IXGBE_FCRETA_SIZE 8 /* Max entries in FCRETA */ |
628 | #define IXGBE_FCRETA_ENTRY_MASK 0x0000007f /* 7 bits for the queue index */ | 628 | #define IXGBE_FCRETA_ENTRY_MASK 0x0000007f /* 7 bits for the queue index */ |
629 | 629 | ||
630 | /* Stats registers */ | 630 | /* Stats registers */ |
631 | #define IXGBE_CRCERRS 0x04000 | 631 | #define IXGBE_CRCERRS 0x04000 |
632 | #define IXGBE_ILLERRC 0x04004 | 632 | #define IXGBE_ILLERRC 0x04004 |
633 | #define IXGBE_ERRBC 0x04008 | 633 | #define IXGBE_ERRBC 0x04008 |
634 | #define IXGBE_MSPDC 0x04010 | 634 | #define IXGBE_MSPDC 0x04010 |
635 | #define IXGBE_MPC(_i) (0x03FA0 + ((_i) * 4)) /* 8 of these 3FA0-3FBC*/ | 635 | #define IXGBE_MPC(_i) (0x03FA0 + ((_i) * 4)) /* 8 of these 3FA0-3FBC*/ |
636 | #define IXGBE_MLFC 0x04034 | 636 | #define IXGBE_MLFC 0x04034 |
637 | #define IXGBE_MRFC 0x04038 | 637 | #define IXGBE_MRFC 0x04038 |
638 | #define IXGBE_RLEC 0x04040 | 638 | #define IXGBE_RLEC 0x04040 |
639 | #define IXGBE_LXONTXC 0x03F60 | 639 | #define IXGBE_LXONTXC 0x03F60 |
640 | #define IXGBE_LXONRXC 0x0CF60 | 640 | #define IXGBE_LXONRXC 0x0CF60 |
641 | #define IXGBE_LXOFFTXC 0x03F68 | 641 | #define IXGBE_LXOFFTXC 0x03F68 |
642 | #define IXGBE_LXOFFRXC 0x0CF68 | 642 | #define IXGBE_LXOFFRXC 0x0CF68 |
643 | #define IXGBE_LXONRXCNT 0x041A4 | 643 | #define IXGBE_LXONRXCNT 0x041A4 |
644 | #define IXGBE_LXOFFRXCNT 0x041A8 | 644 | #define IXGBE_LXOFFRXCNT 0x041A8 |
645 | #define IXGBE_PXONRXCNT(_i) (0x04140 + ((_i) * 4)) /* 8 of these */ | 645 | #define IXGBE_PXONRXCNT(_i) (0x04140 + ((_i) * 4)) /* 8 of these */ |
646 | #define IXGBE_PXOFFRXCNT(_i) (0x04160 + ((_i) * 4)) /* 8 of these */ | 646 | #define IXGBE_PXOFFRXCNT(_i) (0x04160 + ((_i) * 4)) /* 8 of these */ |
647 | #define IXGBE_PXON2OFFCNT(_i) (0x03240 + ((_i) * 4)) /* 8 of these */ | 647 | #define IXGBE_PXON2OFFCNT(_i) (0x03240 + ((_i) * 4)) /* 8 of these */ |
648 | #define IXGBE_PXONTXC(_i) (0x03F00 + ((_i) * 4)) /* 8 of these 3F00-3F1C*/ | 648 | #define IXGBE_PXONTXC(_i) (0x03F00 + ((_i) * 4)) /* 8 of these 3F00-3F1C*/ |
649 | #define IXGBE_PXONRXC(_i) (0x0CF00 + ((_i) * 4)) /* 8 of these CF00-CF1C*/ | 649 | #define IXGBE_PXONRXC(_i) (0x0CF00 + ((_i) * 4)) /* 8 of these CF00-CF1C*/ |
650 | #define IXGBE_PXOFFTXC(_i) (0x03F20 + ((_i) * 4)) /* 8 of these 3F20-3F3C*/ | 650 | #define IXGBE_PXOFFTXC(_i) (0x03F20 + ((_i) * 4)) /* 8 of these 3F20-3F3C*/ |
651 | #define IXGBE_PXOFFRXC(_i) (0x0CF20 + ((_i) * 4)) /* 8 of these CF20-CF3C*/ | 651 | #define IXGBE_PXOFFRXC(_i) (0x0CF20 + ((_i) * 4)) /* 8 of these CF20-CF3C*/ |
652 | #define IXGBE_PRC64 0x0405C | 652 | #define IXGBE_PRC64 0x0405C |
653 | #define IXGBE_PRC127 0x04060 | 653 | #define IXGBE_PRC127 0x04060 |
654 | #define IXGBE_PRC255 0x04064 | 654 | #define IXGBE_PRC255 0x04064 |
655 | #define IXGBE_PRC511 0x04068 | 655 | #define IXGBE_PRC511 0x04068 |
656 | #define IXGBE_PRC1023 0x0406C | 656 | #define IXGBE_PRC1023 0x0406C |
657 | #define IXGBE_PRC1522 0x04070 | 657 | #define IXGBE_PRC1522 0x04070 |
658 | #define IXGBE_GPRC 0x04074 | 658 | #define IXGBE_GPRC 0x04074 |
659 | #define IXGBE_BPRC 0x04078 | 659 | #define IXGBE_BPRC 0x04078 |
660 | #define IXGBE_MPRC 0x0407C | 660 | #define IXGBE_MPRC 0x0407C |
661 | #define IXGBE_GPTC 0x04080 | 661 | #define IXGBE_GPTC 0x04080 |
662 | #define IXGBE_GORCL 0x04088 | 662 | #define IXGBE_GORCL 0x04088 |
663 | #define IXGBE_GORCH 0x0408C | 663 | #define IXGBE_GORCH 0x0408C |
664 | #define IXGBE_GOTCL 0x04090 | 664 | #define IXGBE_GOTCL 0x04090 |
665 | #define IXGBE_GOTCH 0x04094 | 665 | #define IXGBE_GOTCH 0x04094 |
666 | #define IXGBE_RNBC(_i) (0x03FC0 + ((_i) * 4)) /* 8 of these 3FC0-3FDC*/ | 666 | #define IXGBE_RNBC(_i) (0x03FC0 + ((_i) * 4)) /* 8 of these 3FC0-3FDC*/ |
667 | #define IXGBE_RUC 0x040A4 | 667 | #define IXGBE_RUC 0x040A4 |
668 | #define IXGBE_RFC 0x040A8 | 668 | #define IXGBE_RFC 0x040A8 |
669 | #define IXGBE_ROC 0x040AC | 669 | #define IXGBE_ROC 0x040AC |
670 | #define IXGBE_RJC 0x040B0 | 670 | #define IXGBE_RJC 0x040B0 |
671 | #define IXGBE_MNGPRC 0x040B4 | 671 | #define IXGBE_MNGPRC 0x040B4 |
672 | #define IXGBE_MNGPDC 0x040B8 | 672 | #define IXGBE_MNGPDC 0x040B8 |
673 | #define IXGBE_MNGPTC 0x0CF90 | 673 | #define IXGBE_MNGPTC 0x0CF90 |
674 | #define IXGBE_TORL 0x040C0 | 674 | #define IXGBE_TORL 0x040C0 |
675 | #define IXGBE_TORH 0x040C4 | 675 | #define IXGBE_TORH 0x040C4 |
676 | #define IXGBE_TPR 0x040D0 | 676 | #define IXGBE_TPR 0x040D0 |
677 | #define IXGBE_TPT 0x040D4 | 677 | #define IXGBE_TPT 0x040D4 |
678 | #define IXGBE_PTC64 0x040D8 | 678 | #define IXGBE_PTC64 0x040D8 |
679 | #define IXGBE_PTC127 0x040DC | 679 | #define IXGBE_PTC127 0x040DC |
680 | #define IXGBE_PTC255 0x040E0 | 680 | #define IXGBE_PTC255 0x040E0 |
681 | #define IXGBE_PTC511 0x040E4 | 681 | #define IXGBE_PTC511 0x040E4 |
682 | #define IXGBE_PTC1023 0x040E8 | 682 | #define IXGBE_PTC1023 0x040E8 |
683 | #define IXGBE_PTC1522 0x040EC | 683 | #define IXGBE_PTC1522 0x040EC |
684 | #define IXGBE_MPTC 0x040F0 | 684 | #define IXGBE_MPTC 0x040F0 |
685 | #define IXGBE_BPTC 0x040F4 | 685 | #define IXGBE_BPTC 0x040F4 |
686 | #define IXGBE_XEC 0x04120 | 686 | #define IXGBE_XEC 0x04120 |
687 | #define IXGBE_SSVPC 0x08780 | 687 | #define IXGBE_SSVPC 0x08780 |
688 | 688 | ||
689 | #define IXGBE_RQSMR(_i) (0x02300 + ((_i) * 4)) | 689 | #define IXGBE_RQSMR(_i) (0x02300 + ((_i) * 4)) |
690 | #define IXGBE_TQSMR(_i) (((_i) <= 7) ? (0x07300 + ((_i) * 4)) : \ | 690 | #define IXGBE_TQSMR(_i) (((_i) <= 7) ? (0x07300 + ((_i) * 4)) : \ |
691 | (0x08600 + ((_i) * 4))) | 691 | (0x08600 + ((_i) * 4))) |
692 | #define IXGBE_TQSM(_i) (0x08600 + ((_i) * 4)) | 692 | #define IXGBE_TQSM(_i) (0x08600 + ((_i) * 4)) |
693 | 693 | ||
694 | #define IXGBE_QPRC(_i) (0x01030 + ((_i) * 0x40)) /* 16 of these */ | 694 | #define IXGBE_QPRC(_i) (0x01030 + ((_i) * 0x40)) /* 16 of these */ |
695 | #define IXGBE_QPTC(_i) (0x06030 + ((_i) * 0x40)) /* 16 of these */ | 695 | #define IXGBE_QPTC(_i) (0x06030 + ((_i) * 0x40)) /* 16 of these */ |
696 | #define IXGBE_QBRC(_i) (0x01034 + ((_i) * 0x40)) /* 16 of these */ | 696 | #define IXGBE_QBRC(_i) (0x01034 + ((_i) * 0x40)) /* 16 of these */ |
697 | #define IXGBE_QBTC(_i) (0x06034 + ((_i) * 0x40)) /* 16 of these */ | 697 | #define IXGBE_QBTC(_i) (0x06034 + ((_i) * 0x40)) /* 16 of these */ |
698 | #define IXGBE_QBRC_L(_i) (0x01034 + ((_i) * 0x40)) /* 16 of these */ | 698 | #define IXGBE_QBRC_L(_i) (0x01034 + ((_i) * 0x40)) /* 16 of these */ |
699 | #define IXGBE_QBRC_H(_i) (0x01038 + ((_i) * 0x40)) /* 16 of these */ | 699 | #define IXGBE_QBRC_H(_i) (0x01038 + ((_i) * 0x40)) /* 16 of these */ |
700 | #define IXGBE_QPRDC(_i) (0x01430 + ((_i) * 0x40)) /* 16 of these */ | 700 | #define IXGBE_QPRDC(_i) (0x01430 + ((_i) * 0x40)) /* 16 of these */ |
701 | #define IXGBE_QBTC_L(_i) (0x08700 + ((_i) * 0x8)) /* 16 of these */ | 701 | #define IXGBE_QBTC_L(_i) (0x08700 + ((_i) * 0x8)) /* 16 of these */ |
702 | #define IXGBE_QBTC_H(_i) (0x08704 + ((_i) * 0x8)) /* 16 of these */ | 702 | #define IXGBE_QBTC_H(_i) (0x08704 + ((_i) * 0x8)) /* 16 of these */ |
703 | #define IXGBE_FCCRC 0x05118 /* Count of Good Eth CRC w/ Bad FC CRC */ | 703 | #define IXGBE_FCCRC 0x05118 /* Count of Good Eth CRC w/ Bad FC CRC */ |
704 | #define IXGBE_FCOERPDC 0x0241C /* FCoE Rx Packets Dropped Count */ | 704 | #define IXGBE_FCOERPDC 0x0241C /* FCoE Rx Packets Dropped Count */ |
705 | #define IXGBE_FCLAST 0x02424 /* FCoE Last Error Count */ | 705 | #define IXGBE_FCLAST 0x02424 /* FCoE Last Error Count */ |
706 | #define IXGBE_FCOEPRC 0x02428 /* Number of FCoE Packets Received */ | 706 | #define IXGBE_FCOEPRC 0x02428 /* Number of FCoE Packets Received */ |
707 | #define IXGBE_FCOEDWRC 0x0242C /* Number of FCoE DWords Received */ | 707 | #define IXGBE_FCOEDWRC 0x0242C /* Number of FCoE DWords Received */ |
708 | #define IXGBE_FCOEPTC 0x08784 /* Number of FCoE Packets Transmitted */ | 708 | #define IXGBE_FCOEPTC 0x08784 /* Number of FCoE Packets Transmitted */ |
709 | #define IXGBE_FCOEDWTC 0x08788 /* Number of FCoE DWords Transmitted */ | 709 | #define IXGBE_FCOEDWTC 0x08788 /* Number of FCoE DWords Transmitted */ |
710 | #define IXGBE_O2BGPTC 0x041C4 | 710 | #define IXGBE_O2BGPTC 0x041C4 |
711 | #define IXGBE_O2BSPC 0x087B0 | 711 | #define IXGBE_O2BSPC 0x087B0 |
712 | #define IXGBE_B2OSPC 0x041C0 | 712 | #define IXGBE_B2OSPC 0x041C0 |
713 | #define IXGBE_B2OGPRC 0x02F90 | 713 | #define IXGBE_B2OGPRC 0x02F90 |
714 | #define IXGBE_PCRC8ECL 0x0E810 | 714 | #define IXGBE_PCRC8ECL 0x0E810 |
715 | #define IXGBE_PCRC8ECH 0x0E811 | 715 | #define IXGBE_PCRC8ECH 0x0E811 |
716 | #define IXGBE_PCRC8ECH_MASK 0x1F | 716 | #define IXGBE_PCRC8ECH_MASK 0x1F |
717 | #define IXGBE_LDPCECL 0x0E820 | 717 | #define IXGBE_LDPCECL 0x0E820 |
718 | #define IXGBE_LDPCECH 0x0E821 | 718 | #define IXGBE_LDPCECH 0x0E821 |
719 | 719 | ||
720 | /* Management */ | 720 | /* Management */ |
721 | #define IXGBE_MAVTV(_i) (0x05010 + ((_i) * 4)) /* 8 of these (0-7) */ | 721 | #define IXGBE_MAVTV(_i) (0x05010 + ((_i) * 4)) /* 8 of these (0-7) */ |
722 | #define IXGBE_MFUTP(_i) (0x05030 + ((_i) * 4)) /* 8 of these (0-7) */ | 722 | #define IXGBE_MFUTP(_i) (0x05030 + ((_i) * 4)) /* 8 of these (0-7) */ |
723 | #define IXGBE_MANC 0x05820 | 723 | #define IXGBE_MANC 0x05820 |
724 | #define IXGBE_MFVAL 0x05824 | 724 | #define IXGBE_MFVAL 0x05824 |
725 | #define IXGBE_MANC2H 0x05860 | 725 | #define IXGBE_MANC2H 0x05860 |
726 | #define IXGBE_MDEF(_i) (0x05890 + ((_i) * 4)) /* 8 of these (0-7) */ | 726 | #define IXGBE_MDEF(_i) (0x05890 + ((_i) * 4)) /* 8 of these (0-7) */ |
727 | #define IXGBE_MIPAF 0x058B0 | 727 | #define IXGBE_MIPAF 0x058B0 |
728 | #define IXGBE_MMAL(_i) (0x05910 + ((_i) * 8)) /* 4 of these (0-3) */ | 728 | #define IXGBE_MMAL(_i) (0x05910 + ((_i) * 8)) /* 4 of these (0-3) */ |
729 | #define IXGBE_MMAH(_i) (0x05914 + ((_i) * 8)) /* 4 of these (0-3) */ | 729 | #define IXGBE_MMAH(_i) (0x05914 + ((_i) * 8)) /* 4 of these (0-3) */ |
730 | #define IXGBE_FTFT 0x09400 /* 0x9400-0x97FC */ | 730 | #define IXGBE_FTFT 0x09400 /* 0x9400-0x97FC */ |
731 | #define IXGBE_METF(_i) (0x05190 + ((_i) * 4)) /* 4 of these (0-3) */ | 731 | #define IXGBE_METF(_i) (0x05190 + ((_i) * 4)) /* 4 of these (0-3) */ |
732 | #define IXGBE_MDEF_EXT(_i) (0x05160 + ((_i) * 4)) /* 8 of these (0-7) */ | 732 | #define IXGBE_MDEF_EXT(_i) (0x05160 + ((_i) * 4)) /* 8 of these (0-7) */ |
733 | #define IXGBE_LSWFW 0x15014 | 733 | #define IXGBE_LSWFW 0x15014 |
734 | 734 | ||
735 | /* Management Bit Fields and Masks */ | 735 | /* Management Bit Fields and Masks */ |
736 | #define IXGBE_MANC_RCV_TCO_EN 0x00020000 /* Rcv TCO packet enable */ | 736 | #define IXGBE_MANC_RCV_TCO_EN 0x00020000 /* Rcv TCO packet enable */ |
737 | 737 | ||
738 | /* Firmware Semaphore Register */ | 738 | /* Firmware Semaphore Register */ |
739 | #define IXGBE_FWSM_MODE_MASK 0xE | 739 | #define IXGBE_FWSM_MODE_MASK 0xE |
740 | #define IXGBE_FWSM_FW_MODE_PT 0x4 | 740 | #define IXGBE_FWSM_FW_MODE_PT 0x4 |
741 | 741 | ||
742 | /* ARC Subsystem registers */ | 742 | /* ARC Subsystem registers */ |
743 | #define IXGBE_HICR 0x15F00 | 743 | #define IXGBE_HICR 0x15F00 |
744 | #define IXGBE_FWSTS 0x15F0C | 744 | #define IXGBE_FWSTS 0x15F0C |
745 | #define IXGBE_HSMC0R 0x15F04 | 745 | #define IXGBE_HSMC0R 0x15F04 |
746 | #define IXGBE_HSMC1R 0x15F08 | 746 | #define IXGBE_HSMC1R 0x15F08 |
747 | #define IXGBE_SWSR 0x15F10 | 747 | #define IXGBE_SWSR 0x15F10 |
748 | #define IXGBE_HFDR 0x15FE8 | 748 | #define IXGBE_HFDR 0x15FE8 |
749 | #define IXGBE_FLEX_MNG 0x15800 /* 0x15800 - 0x15EFC */ | 749 | #define IXGBE_FLEX_MNG 0x15800 /* 0x15800 - 0x15EFC */ |
750 | 750 | ||
751 | #define IXGBE_HICR_EN 0x01 /* Enable bit - RO */ | 751 | #define IXGBE_HICR_EN 0x01 /* Enable bit - RO */ |
752 | /* Driver sets this bit when done to put command in RAM */ | 752 | /* Driver sets this bit when done to put command in RAM */ |
753 | #define IXGBE_HICR_C 0x02 | 753 | #define IXGBE_HICR_C 0x02 |
754 | #define IXGBE_HICR_SV 0x04 /* Status Validity */ | 754 | #define IXGBE_HICR_SV 0x04 /* Status Validity */ |
755 | #define IXGBE_HICR_FW_RESET_ENABLE 0x40 | 755 | #define IXGBE_HICR_FW_RESET_ENABLE 0x40 |
756 | #define IXGBE_HICR_FW_RESET 0x80 | 756 | #define IXGBE_HICR_FW_RESET 0x80 |
757 | 757 | ||
758 | /* PCI-E registers */ | 758 | /* PCI-E registers */ |
759 | #define IXGBE_GCR 0x11000 | 759 | #define IXGBE_GCR 0x11000 |
760 | #define IXGBE_GTV 0x11004 | 760 | #define IXGBE_GTV 0x11004 |
761 | #define IXGBE_FUNCTAG 0x11008 | 761 | #define IXGBE_FUNCTAG 0x11008 |
762 | #define IXGBE_GLT 0x1100C | 762 | #define IXGBE_GLT 0x1100C |
763 | #define IXGBE_GSCL_1 0x11010 | 763 | #define IXGBE_GSCL_1 0x11010 |
764 | #define IXGBE_GSCL_2 0x11014 | 764 | #define IXGBE_GSCL_2 0x11014 |
765 | #define IXGBE_GSCL_3 0x11018 | 765 | #define IXGBE_GSCL_3 0x11018 |
766 | #define IXGBE_GSCL_4 0x1101C | 766 | #define IXGBE_GSCL_4 0x1101C |
767 | #define IXGBE_GSCN_0 0x11020 | 767 | #define IXGBE_GSCN_0 0x11020 |
768 | #define IXGBE_GSCN_1 0x11024 | 768 | #define IXGBE_GSCN_1 0x11024 |
769 | #define IXGBE_GSCN_2 0x11028 | 769 | #define IXGBE_GSCN_2 0x11028 |
770 | #define IXGBE_GSCN_3 0x1102C | 770 | #define IXGBE_GSCN_3 0x1102C |
771 | #define IXGBE_FACTPS 0x10150 | 771 | #define IXGBE_FACTPS 0x10150 |
772 | #define IXGBE_PCIEANACTL 0x11040 | 772 | #define IXGBE_PCIEANACTL 0x11040 |
773 | #define IXGBE_SWSM 0x10140 | 773 | #define IXGBE_SWSM 0x10140 |
774 | #define IXGBE_FWSM 0x10148 | 774 | #define IXGBE_FWSM 0x10148 |
775 | #define IXGBE_GSSR 0x10160 | 775 | #define IXGBE_GSSR 0x10160 |
776 | #define IXGBE_MREVID 0x11064 | 776 | #define IXGBE_MREVID 0x11064 |
777 | #define IXGBE_DCA_ID 0x11070 | 777 | #define IXGBE_DCA_ID 0x11070 |
778 | #define IXGBE_DCA_CTRL 0x11074 | 778 | #define IXGBE_DCA_CTRL 0x11074 |
779 | #define IXGBE_SWFW_SYNC IXGBE_GSSR | 779 | #define IXGBE_SWFW_SYNC IXGBE_GSSR |
780 | 780 | ||
781 | /* PCIe registers 82599-specific */ | 781 | /* PCIe registers 82599-specific */ |
782 | #define IXGBE_GCR_EXT 0x11050 | 782 | #define IXGBE_GCR_EXT 0x11050 |
783 | #define IXGBE_GSCL_5_82599 0x11030 | 783 | #define IXGBE_GSCL_5_82599 0x11030 |
784 | #define IXGBE_GSCL_6_82599 0x11034 | 784 | #define IXGBE_GSCL_6_82599 0x11034 |
785 | #define IXGBE_GSCL_7_82599 0x11038 | 785 | #define IXGBE_GSCL_7_82599 0x11038 |
786 | #define IXGBE_GSCL_8_82599 0x1103C | 786 | #define IXGBE_GSCL_8_82599 0x1103C |
787 | #define IXGBE_PHYADR_82599 0x11040 | 787 | #define IXGBE_PHYADR_82599 0x11040 |
788 | #define IXGBE_PHYDAT_82599 0x11044 | 788 | #define IXGBE_PHYDAT_82599 0x11044 |
789 | #define IXGBE_PHYCTL_82599 0x11048 | 789 | #define IXGBE_PHYCTL_82599 0x11048 |
790 | #define IXGBE_PBACLR_82599 0x11068 | 790 | #define IXGBE_PBACLR_82599 0x11068 |
791 | #define IXGBE_CIAA_82599 0x11088 | 791 | #define IXGBE_CIAA_82599 0x11088 |
792 | #define IXGBE_CIAD_82599 0x1108C | 792 | #define IXGBE_CIAD_82599 0x1108C |
793 | #define IXGBE_PICAUSE 0x110B0 | 793 | #define IXGBE_PICAUSE 0x110B0 |
794 | #define IXGBE_PIENA 0x110B8 | 794 | #define IXGBE_PIENA 0x110B8 |
795 | #define IXGBE_CDQ_MBR_82599 0x110B4 | 795 | #define IXGBE_CDQ_MBR_82599 0x110B4 |
796 | #define IXGBE_PCIESPARE 0x110BC | 796 | #define IXGBE_PCIESPARE 0x110BC |
797 | #define IXGBE_MISC_REG_82599 0x110F0 | 797 | #define IXGBE_MISC_REG_82599 0x110F0 |
798 | #define IXGBE_ECC_CTRL_0_82599 0x11100 | 798 | #define IXGBE_ECC_CTRL_0_82599 0x11100 |
799 | #define IXGBE_ECC_CTRL_1_82599 0x11104 | 799 | #define IXGBE_ECC_CTRL_1_82599 0x11104 |
800 | #define IXGBE_ECC_STATUS_82599 0x110E0 | 800 | #define IXGBE_ECC_STATUS_82599 0x110E0 |
801 | #define IXGBE_BAR_CTRL_82599 0x110F4 | 801 | #define IXGBE_BAR_CTRL_82599 0x110F4 |
802 | 802 | ||
803 | /* PCI Express Control */ | 803 | /* PCI Express Control */ |
804 | #define IXGBE_GCR_CMPL_TMOUT_MASK 0x0000F000 | 804 | #define IXGBE_GCR_CMPL_TMOUT_MASK 0x0000F000 |
805 | #define IXGBE_GCR_CMPL_TMOUT_10ms 0x00001000 | 805 | #define IXGBE_GCR_CMPL_TMOUT_10ms 0x00001000 |
806 | #define IXGBE_GCR_CMPL_TMOUT_RESEND 0x00010000 | 806 | #define IXGBE_GCR_CMPL_TMOUT_RESEND 0x00010000 |
807 | #define IXGBE_GCR_CAP_VER2 0x00040000 | 807 | #define IXGBE_GCR_CAP_VER2 0x00040000 |
808 | 808 | ||
809 | #define IXGBE_GCR_EXT_MSIX_EN 0x80000000 | 809 | #define IXGBE_GCR_EXT_MSIX_EN 0x80000000 |
810 | #define IXGBE_GCR_EXT_BUFFERS_CLEAR 0x40000000 | 810 | #define IXGBE_GCR_EXT_BUFFERS_CLEAR 0x40000000 |
811 | #define IXGBE_GCR_EXT_VT_MODE_16 0x00000001 | 811 | #define IXGBE_GCR_EXT_VT_MODE_16 0x00000001 |
812 | #define IXGBE_GCR_EXT_VT_MODE_32 0x00000002 | 812 | #define IXGBE_GCR_EXT_VT_MODE_32 0x00000002 |
813 | #define IXGBE_GCR_EXT_VT_MODE_64 0x00000003 | 813 | #define IXGBE_GCR_EXT_VT_MODE_64 0x00000003 |
814 | #define IXGBE_GCR_EXT_SRIOV (IXGBE_GCR_EXT_MSIX_EN | \ | 814 | #define IXGBE_GCR_EXT_SRIOV (IXGBE_GCR_EXT_MSIX_EN | \ |
815 | IXGBE_GCR_EXT_VT_MODE_64) | 815 | IXGBE_GCR_EXT_VT_MODE_64) |
816 | 816 | ||
817 | /* Time Sync Registers */ | 817 | /* Time Sync Registers */ |
818 | #define IXGBE_TSYNCRXCTL 0x05188 /* Rx Time Sync Control register - RW */ | 818 | #define IXGBE_TSYNCRXCTL 0x05188 /* Rx Time Sync Control register - RW */ |
819 | #define IXGBE_TSYNCTXCTL 0x08C00 /* Tx Time Sync Control register - RW */ | 819 | #define IXGBE_TSYNCTXCTL 0x08C00 /* Tx Time Sync Control register - RW */ |
820 | #define IXGBE_RXSTMPL 0x051E8 /* Rx timestamp Low - RO */ | 820 | #define IXGBE_RXSTMPL 0x051E8 /* Rx timestamp Low - RO */ |
821 | #define IXGBE_RXSTMPH 0x051A4 /* Rx timestamp High - RO */ | 821 | #define IXGBE_RXSTMPH 0x051A4 /* Rx timestamp High - RO */ |
822 | #define IXGBE_RXSATRL 0x051A0 /* Rx timestamp attribute low - RO */ | 822 | #define IXGBE_RXSATRL 0x051A0 /* Rx timestamp attribute low - RO */ |
823 | #define IXGBE_RXSATRH 0x051A8 /* Rx timestamp attribute high - RO */ | 823 | #define IXGBE_RXSATRH 0x051A8 /* Rx timestamp attribute high - RO */ |
824 | #define IXGBE_RXMTRL 0x05120 /* RX message type register low - RW */ | 824 | #define IXGBE_RXMTRL 0x05120 /* RX message type register low - RW */ |
825 | #define IXGBE_TXSTMPL 0x08C04 /* Tx timestamp value Low - RO */ | 825 | #define IXGBE_TXSTMPL 0x08C04 /* Tx timestamp value Low - RO */ |
826 | #define IXGBE_TXSTMPH 0x08C08 /* Tx timestamp value High - RO */ | 826 | #define IXGBE_TXSTMPH 0x08C08 /* Tx timestamp value High - RO */ |
827 | #define IXGBE_SYSTIML 0x08C0C /* System time register Low - RO */ | 827 | #define IXGBE_SYSTIML 0x08C0C /* System time register Low - RO */ |
828 | #define IXGBE_SYSTIMH 0x08C10 /* System time register High - RO */ | 828 | #define IXGBE_SYSTIMH 0x08C10 /* System time register High - RO */ |
829 | #define IXGBE_TIMINCA 0x08C14 /* Increment attributes register - RW */ | 829 | #define IXGBE_TIMINCA 0x08C14 /* Increment attributes register - RW */ |
830 | #define IXGBE_TIMADJL 0x08C18 /* Time Adjustment Offset register Low - RW */ | 830 | #define IXGBE_TIMADJL 0x08C18 /* Time Adjustment Offset register Low - RW */ |
831 | #define IXGBE_TIMADJH 0x08C1C /* Time Adjustment Offset register High - RW */ | 831 | #define IXGBE_TIMADJH 0x08C1C /* Time Adjustment Offset register High - RW */ |
832 | #define IXGBE_TSAUXC 0x08C20 /* TimeSync Auxiliary Control register - RW */ | 832 | #define IXGBE_TSAUXC 0x08C20 /* TimeSync Auxiliary Control register - RW */ |
833 | #define IXGBE_TRGTTIML0 0x08C24 /* Target Time Register 0 Low - RW */ | 833 | #define IXGBE_TRGTTIML0 0x08C24 /* Target Time Register 0 Low - RW */ |
834 | #define IXGBE_TRGTTIMH0 0x08C28 /* Target Time Register 0 High - RW */ | 834 | #define IXGBE_TRGTTIMH0 0x08C28 /* Target Time Register 0 High - RW */ |
835 | #define IXGBE_TRGTTIML1 0x08C2C /* Target Time Register 1 Low - RW */ | 835 | #define IXGBE_TRGTTIML1 0x08C2C /* Target Time Register 1 Low - RW */ |
836 | #define IXGBE_TRGTTIMH1 0x08C30 /* Target Time Register 1 High - RW */ | 836 | #define IXGBE_TRGTTIMH1 0x08C30 /* Target Time Register 1 High - RW */ |
837 | #define IXGBE_CLKTIML 0x08C34 /* Clock Out Time Register Low - RW */ | 837 | #define IXGBE_CLKTIML 0x08C34 /* Clock Out Time Register Low - RW */ |
838 | #define IXGBE_CLKTIMH 0x08C38 /* Clock Out Time Register High - RW */ | 838 | #define IXGBE_CLKTIMH 0x08C38 /* Clock Out Time Register High - RW */ |
839 | #define IXGBE_FREQOUT0 0x08C34 /* Frequency Out 0 Control register - RW */ | 839 | #define IXGBE_FREQOUT0 0x08C34 /* Frequency Out 0 Control register - RW */ |
840 | #define IXGBE_FREQOUT1 0x08C38 /* Frequency Out 1 Control register - RW */ | 840 | #define IXGBE_FREQOUT1 0x08C38 /* Frequency Out 1 Control register - RW */ |
841 | #define IXGBE_AUXSTMPL0 0x08C3C /* Auxiliary Time Stamp 0 register Low - RO */ | 841 | #define IXGBE_AUXSTMPL0 0x08C3C /* Auxiliary Time Stamp 0 register Low - RO */ |
842 | #define IXGBE_AUXSTMPH0 0x08C40 /* Auxiliary Time Stamp 0 register High - RO */ | 842 | #define IXGBE_AUXSTMPH0 0x08C40 /* Auxiliary Time Stamp 0 register High - RO */ |
843 | #define IXGBE_AUXSTMPL1 0x08C44 /* Auxiliary Time Stamp 1 register Low - RO */ | 843 | #define IXGBE_AUXSTMPL1 0x08C44 /* Auxiliary Time Stamp 1 register Low - RO */ |
844 | #define IXGBE_AUXSTMPH1 0x08C48 /* Auxiliary Time Stamp 1 register High - RO */ | 844 | #define IXGBE_AUXSTMPH1 0x08C48 /* Auxiliary Time Stamp 1 register High - RO */ |
845 | 845 | ||
846 | /* Diagnostic Registers */ | 846 | /* Diagnostic Registers */ |
847 | #define IXGBE_RDSTATCTL 0x02C20 | 847 | #define IXGBE_RDSTATCTL 0x02C20 |
848 | #define IXGBE_RDSTAT(_i) (0x02C00 + ((_i) * 4)) /* 0x02C00-0x02C1C */ | 848 | #define IXGBE_RDSTAT(_i) (0x02C00 + ((_i) * 4)) /* 0x02C00-0x02C1C */ |
849 | #define IXGBE_RDHMPN 0x02F08 | 849 | #define IXGBE_RDHMPN 0x02F08 |
850 | #define IXGBE_RIC_DW(_i) (0x02F10 + ((_i) * 4)) | 850 | #define IXGBE_RIC_DW(_i) (0x02F10 + ((_i) * 4)) |
851 | #define IXGBE_RDPROBE 0x02F20 | 851 | #define IXGBE_RDPROBE 0x02F20 |
852 | #define IXGBE_RDMAM 0x02F30 | 852 | #define IXGBE_RDMAM 0x02F30 |
853 | #define IXGBE_RDMAD 0x02F34 | 853 | #define IXGBE_RDMAD 0x02F34 |
854 | #define IXGBE_TDSTATCTL 0x07C20 | 854 | #define IXGBE_TDSTATCTL 0x07C20 |
855 | #define IXGBE_TDSTAT(_i) (0x07C00 + ((_i) * 4)) /* 0x07C00 - 0x07C1C */ | 855 | #define IXGBE_TDSTAT(_i) (0x07C00 + ((_i) * 4)) /* 0x07C00 - 0x07C1C */ |
856 | #define IXGBE_TDHMPN 0x07F08 | 856 | #define IXGBE_TDHMPN 0x07F08 |
857 | #define IXGBE_TDHMPN2 0x082FC | 857 | #define IXGBE_TDHMPN2 0x082FC |
858 | #define IXGBE_TXDESCIC 0x082CC | 858 | #define IXGBE_TXDESCIC 0x082CC |
859 | #define IXGBE_TIC_DW(_i) (0x07F10 + ((_i) * 4)) | 859 | #define IXGBE_TIC_DW(_i) (0x07F10 + ((_i) * 4)) |
860 | #define IXGBE_TIC_DW2(_i) (0x082B0 + ((_i) * 4)) | 860 | #define IXGBE_TIC_DW2(_i) (0x082B0 + ((_i) * 4)) |
861 | #define IXGBE_TDPROBE 0x07F20 | 861 | #define IXGBE_TDPROBE 0x07F20 |
862 | #define IXGBE_TXBUFCTRL 0x0C600 | 862 | #define IXGBE_TXBUFCTRL 0x0C600 |
863 | #define IXGBE_TXBUFDATA0 0x0C610 | 863 | #define IXGBE_TXBUFDATA0 0x0C610 |
864 | #define IXGBE_TXBUFDATA1 0x0C614 | 864 | #define IXGBE_TXBUFDATA1 0x0C614 |
865 | #define IXGBE_TXBUFDATA2 0x0C618 | 865 | #define IXGBE_TXBUFDATA2 0x0C618 |
866 | #define IXGBE_TXBUFDATA3 0x0C61C | 866 | #define IXGBE_TXBUFDATA3 0x0C61C |
867 | #define IXGBE_RXBUFCTRL 0x03600 | 867 | #define IXGBE_RXBUFCTRL 0x03600 |
868 | #define IXGBE_RXBUFDATA0 0x03610 | 868 | #define IXGBE_RXBUFDATA0 0x03610 |
869 | #define IXGBE_RXBUFDATA1 0x03614 | 869 | #define IXGBE_RXBUFDATA1 0x03614 |
870 | #define IXGBE_RXBUFDATA2 0x03618 | 870 | #define IXGBE_RXBUFDATA2 0x03618 |
871 | #define IXGBE_RXBUFDATA3 0x0361C | 871 | #define IXGBE_RXBUFDATA3 0x0361C |
872 | #define IXGBE_PCIE_DIAG(_i) (0x11090 + ((_i) * 4)) /* 8 of these */ | 872 | #define IXGBE_PCIE_DIAG(_i) (0x11090 + ((_i) * 4)) /* 8 of these */ |
873 | #define IXGBE_RFVAL 0x050A4 | 873 | #define IXGBE_RFVAL 0x050A4 |
874 | #define IXGBE_MDFTC1 0x042B8 | 874 | #define IXGBE_MDFTC1 0x042B8 |
875 | #define IXGBE_MDFTC2 0x042C0 | 875 | #define IXGBE_MDFTC2 0x042C0 |
876 | #define IXGBE_MDFTFIFO1 0x042C4 | 876 | #define IXGBE_MDFTFIFO1 0x042C4 |
877 | #define IXGBE_MDFTFIFO2 0x042C8 | 877 | #define IXGBE_MDFTFIFO2 0x042C8 |
878 | #define IXGBE_MDFTS 0x042CC | 878 | #define IXGBE_MDFTS 0x042CC |
879 | #define IXGBE_RXDATAWRPTR(_i) (0x03700 + ((_i) * 4)) /* 8 of these 3700-370C*/ | 879 | #define IXGBE_RXDATAWRPTR(_i) (0x03700 + ((_i) * 4)) /* 8 of these 3700-370C*/ |
880 | #define IXGBE_RXDESCWRPTR(_i) (0x03710 + ((_i) * 4)) /* 8 of these 3710-371C*/ | 880 | #define IXGBE_RXDESCWRPTR(_i) (0x03710 + ((_i) * 4)) /* 8 of these 3710-371C*/ |
881 | #define IXGBE_RXDATARDPTR(_i) (0x03720 + ((_i) * 4)) /* 8 of these 3720-372C*/ | 881 | #define IXGBE_RXDATARDPTR(_i) (0x03720 + ((_i) * 4)) /* 8 of these 3720-372C*/ |
882 | #define IXGBE_RXDESCRDPTR(_i) (0x03730 + ((_i) * 4)) /* 8 of these 3730-373C*/ | 882 | #define IXGBE_RXDESCRDPTR(_i) (0x03730 + ((_i) * 4)) /* 8 of these 3730-373C*/ |
883 | #define IXGBE_TXDATAWRPTR(_i) (0x0C700 + ((_i) * 4)) /* 8 of these C700-C70C*/ | 883 | #define IXGBE_TXDATAWRPTR(_i) (0x0C700 + ((_i) * 4)) /* 8 of these C700-C70C*/ |
884 | #define IXGBE_TXDESCWRPTR(_i) (0x0C710 + ((_i) * 4)) /* 8 of these C710-C71C*/ | 884 | #define IXGBE_TXDESCWRPTR(_i) (0x0C710 + ((_i) * 4)) /* 8 of these C710-C71C*/ |
885 | #define IXGBE_TXDATARDPTR(_i) (0x0C720 + ((_i) * 4)) /* 8 of these C720-C72C*/ | 885 | #define IXGBE_TXDATARDPTR(_i) (0x0C720 + ((_i) * 4)) /* 8 of these C720-C72C*/ |
886 | #define IXGBE_TXDESCRDPTR(_i) (0x0C730 + ((_i) * 4)) /* 8 of these C730-C73C*/ | 886 | #define IXGBE_TXDESCRDPTR(_i) (0x0C730 + ((_i) * 4)) /* 8 of these C730-C73C*/ |
887 | #define IXGBE_PCIEECCCTL 0x1106C | 887 | #define IXGBE_PCIEECCCTL 0x1106C |
888 | #define IXGBE_RXWRPTR(_i) (0x03100 + ((_i) * 4)) /* 8 of these 3100-310C*/ | 888 | #define IXGBE_RXWRPTR(_i) (0x03100 + ((_i) * 4)) /* 8 of these 3100-310C*/ |
889 | #define IXGBE_RXUSED(_i) (0x03120 + ((_i) * 4)) /* 8 of these 3120-312C*/ | 889 | #define IXGBE_RXUSED(_i) (0x03120 + ((_i) * 4)) /* 8 of these 3120-312C*/ |
890 | #define IXGBE_RXRDPTR(_i) (0x03140 + ((_i) * 4)) /* 8 of these 3140-314C*/ | 890 | #define IXGBE_RXRDPTR(_i) (0x03140 + ((_i) * 4)) /* 8 of these 3140-314C*/ |
891 | #define IXGBE_RXRDWRPTR(_i) (0x03160 + ((_i) * 4)) /* 8 of these 3160-310C*/ | 891 | #define IXGBE_RXRDWRPTR(_i) (0x03160 + ((_i) * 4)) /* 8 of these 3160-310C*/ |
892 | #define IXGBE_TXWRPTR(_i) (0x0C100 + ((_i) * 4)) /* 8 of these C100-C10C*/ | 892 | #define IXGBE_TXWRPTR(_i) (0x0C100 + ((_i) * 4)) /* 8 of these C100-C10C*/ |
893 | #define IXGBE_TXUSED(_i) (0x0C120 + ((_i) * 4)) /* 8 of these C120-C12C*/ | 893 | #define IXGBE_TXUSED(_i) (0x0C120 + ((_i) * 4)) /* 8 of these C120-C12C*/ |
894 | #define IXGBE_TXRDPTR(_i) (0x0C140 + ((_i) * 4)) /* 8 of these C140-C14C*/ | 894 | #define IXGBE_TXRDPTR(_i) (0x0C140 + ((_i) * 4)) /* 8 of these C140-C14C*/ |
895 | #define IXGBE_TXRDWRPTR(_i) (0x0C160 + ((_i) * 4)) /* 8 of these C160-C10C*/ | 895 | #define IXGBE_TXRDWRPTR(_i) (0x0C160 + ((_i) * 4)) /* 8 of these C160-C10C*/ |
896 | #define IXGBE_PCIEECCCTL0 0x11100 | 896 | #define IXGBE_PCIEECCCTL0 0x11100 |
897 | #define IXGBE_PCIEECCCTL1 0x11104 | 897 | #define IXGBE_PCIEECCCTL1 0x11104 |
898 | #define IXGBE_RXDBUECC 0x03F70 | 898 | #define IXGBE_RXDBUECC 0x03F70 |
899 | #define IXGBE_TXDBUECC 0x0CF70 | 899 | #define IXGBE_TXDBUECC 0x0CF70 |
900 | #define IXGBE_RXDBUEST 0x03F74 | 900 | #define IXGBE_RXDBUEST 0x03F74 |
901 | #define IXGBE_TXDBUEST 0x0CF74 | 901 | #define IXGBE_TXDBUEST 0x0CF74 |
902 | #define IXGBE_PBTXECC 0x0C300 | 902 | #define IXGBE_PBTXECC 0x0C300 |
903 | #define IXGBE_PBRXECC 0x03300 | 903 | #define IXGBE_PBRXECC 0x03300 |
904 | #define IXGBE_GHECCR 0x110B0 | 904 | #define IXGBE_GHECCR 0x110B0 |
905 | 905 | ||
906 | /* MAC Registers */ | 906 | /* MAC Registers */ |
907 | #define IXGBE_PCS1GCFIG 0x04200 | 907 | #define IXGBE_PCS1GCFIG 0x04200 |
908 | #define IXGBE_PCS1GLCTL 0x04208 | 908 | #define IXGBE_PCS1GLCTL 0x04208 |
909 | #define IXGBE_PCS1GLSTA 0x0420C | 909 | #define IXGBE_PCS1GLSTA 0x0420C |
910 | #define IXGBE_PCS1GDBG0 0x04210 | 910 | #define IXGBE_PCS1GDBG0 0x04210 |
911 | #define IXGBE_PCS1GDBG1 0x04214 | 911 | #define IXGBE_PCS1GDBG1 0x04214 |
912 | #define IXGBE_PCS1GANA 0x04218 | 912 | #define IXGBE_PCS1GANA 0x04218 |
913 | #define IXGBE_PCS1GANLP 0x0421C | 913 | #define IXGBE_PCS1GANLP 0x0421C |
914 | #define IXGBE_PCS1GANNP 0x04220 | 914 | #define IXGBE_PCS1GANNP 0x04220 |
915 | #define IXGBE_PCS1GANLPNP 0x04224 | 915 | #define IXGBE_PCS1GANLPNP 0x04224 |
916 | #define IXGBE_HLREG0 0x04240 | 916 | #define IXGBE_HLREG0 0x04240 |
917 | #define IXGBE_HLREG1 0x04244 | 917 | #define IXGBE_HLREG1 0x04244 |
918 | #define IXGBE_PAP 0x04248 | 918 | #define IXGBE_PAP 0x04248 |
919 | #define IXGBE_MACA 0x0424C | 919 | #define IXGBE_MACA 0x0424C |
920 | #define IXGBE_APAE 0x04250 | 920 | #define IXGBE_APAE 0x04250 |
921 | #define IXGBE_ARD 0x04254 | 921 | #define IXGBE_ARD 0x04254 |
922 | #define IXGBE_AIS 0x04258 | 922 | #define IXGBE_AIS 0x04258 |
923 | #define IXGBE_MSCA 0x0425C | 923 | #define IXGBE_MSCA 0x0425C |
924 | #define IXGBE_MSRWD 0x04260 | 924 | #define IXGBE_MSRWD 0x04260 |
925 | #define IXGBE_MLADD 0x04264 | 925 | #define IXGBE_MLADD 0x04264 |
926 | #define IXGBE_MHADD 0x04268 | 926 | #define IXGBE_MHADD 0x04268 |
927 | #define IXGBE_MAXFRS 0x04268 | 927 | #define IXGBE_MAXFRS 0x04268 |
928 | #define IXGBE_TREG 0x0426C | 928 | #define IXGBE_TREG 0x0426C |
929 | #define IXGBE_PCSS1 0x04288 | 929 | #define IXGBE_PCSS1 0x04288 |
930 | #define IXGBE_PCSS2 0x0428C | 930 | #define IXGBE_PCSS2 0x0428C |
931 | #define IXGBE_XPCSS 0x04290 | 931 | #define IXGBE_XPCSS 0x04290 |
932 | #define IXGBE_MFLCN 0x04294 | 932 | #define IXGBE_MFLCN 0x04294 |
933 | #define IXGBE_SERDESC 0x04298 | 933 | #define IXGBE_SERDESC 0x04298 |
934 | #define IXGBE_MACS 0x0429C | 934 | #define IXGBE_MACS 0x0429C |
935 | #define IXGBE_AUTOC 0x042A0 | 935 | #define IXGBE_AUTOC 0x042A0 |
936 | #define IXGBE_LINKS 0x042A4 | 936 | #define IXGBE_LINKS 0x042A4 |
937 | #define IXGBE_LINKS2 0x04324 | 937 | #define IXGBE_LINKS2 0x04324 |
938 | #define IXGBE_AUTOC2 0x042A8 | 938 | #define IXGBE_AUTOC2 0x042A8 |
939 | #define IXGBE_AUTOC3 0x042AC | 939 | #define IXGBE_AUTOC3 0x042AC |
940 | #define IXGBE_ANLP1 0x042B0 | 940 | #define IXGBE_ANLP1 0x042B0 |
941 | #define IXGBE_ANLP2 0x042B4 | 941 | #define IXGBE_ANLP2 0x042B4 |
942 | #define IXGBE_MACC 0x04330 | 942 | #define IXGBE_MACC 0x04330 |
943 | #define IXGBE_ATLASCTL 0x04800 | 943 | #define IXGBE_ATLASCTL 0x04800 |
944 | #define IXGBE_MMNGC 0x042D0 | 944 | #define IXGBE_MMNGC 0x042D0 |
945 | #define IXGBE_ANLPNP1 0x042D4 | 945 | #define IXGBE_ANLPNP1 0x042D4 |
946 | #define IXGBE_ANLPNP2 0x042D8 | 946 | #define IXGBE_ANLPNP2 0x042D8 |
947 | #define IXGBE_KRPCSFC 0x042E0 | 947 | #define IXGBE_KRPCSFC 0x042E0 |
948 | #define IXGBE_KRPCSS 0x042E4 | 948 | #define IXGBE_KRPCSS 0x042E4 |
949 | #define IXGBE_FECS1 0x042E8 | 949 | #define IXGBE_FECS1 0x042E8 |
950 | #define IXGBE_FECS2 0x042EC | 950 | #define IXGBE_FECS2 0x042EC |
951 | #define IXGBE_SMADARCTL 0x14F10 | 951 | #define IXGBE_SMADARCTL 0x14F10 |
952 | #define IXGBE_MPVC 0x04318 | 952 | #define IXGBE_MPVC 0x04318 |
953 | #define IXGBE_SGMIIC 0x04314 | 953 | #define IXGBE_SGMIIC 0x04314 |
954 | 954 | ||
955 | /* Statistics Registers */ | 955 | /* Statistics Registers */ |
956 | #define IXGBE_RXNFGPC 0x041B0 | 956 | #define IXGBE_RXNFGPC 0x041B0 |
957 | #define IXGBE_RXNFGBCL 0x041B4 | 957 | #define IXGBE_RXNFGBCL 0x041B4 |
958 | #define IXGBE_RXNFGBCH 0x041B8 | 958 | #define IXGBE_RXNFGBCH 0x041B8 |
959 | #define IXGBE_RXDGPC 0x02F50 | 959 | #define IXGBE_RXDGPC 0x02F50 |
960 | #define IXGBE_RXDGBCL 0x02F54 | 960 | #define IXGBE_RXDGBCL 0x02F54 |
961 | #define IXGBE_RXDGBCH 0x02F58 | 961 | #define IXGBE_RXDGBCH 0x02F58 |
962 | #define IXGBE_RXDDGPC 0x02F5C | 962 | #define IXGBE_RXDDGPC 0x02F5C |
963 | #define IXGBE_RXDDGBCL 0x02F60 | 963 | #define IXGBE_RXDDGBCL 0x02F60 |
964 | #define IXGBE_RXDDGBCH 0x02F64 | 964 | #define IXGBE_RXDDGBCH 0x02F64 |
965 | #define IXGBE_RXLPBKGPC 0x02F68 | 965 | #define IXGBE_RXLPBKGPC 0x02F68 |
966 | #define IXGBE_RXLPBKGBCL 0x02F6C | 966 | #define IXGBE_RXLPBKGBCL 0x02F6C |
967 | #define IXGBE_RXLPBKGBCH 0x02F70 | 967 | #define IXGBE_RXLPBKGBCH 0x02F70 |
968 | #define IXGBE_RXDLPBKGPC 0x02F74 | 968 | #define IXGBE_RXDLPBKGPC 0x02F74 |
969 | #define IXGBE_RXDLPBKGBCL 0x02F78 | 969 | #define IXGBE_RXDLPBKGBCL 0x02F78 |
970 | #define IXGBE_RXDLPBKGBCH 0x02F7C | 970 | #define IXGBE_RXDLPBKGBCH 0x02F7C |
971 | #define IXGBE_TXDGPC 0x087A0 | 971 | #define IXGBE_TXDGPC 0x087A0 |
972 | #define IXGBE_TXDGBCL 0x087A4 | 972 | #define IXGBE_TXDGBCL 0x087A4 |
973 | #define IXGBE_TXDGBCH 0x087A8 | 973 | #define IXGBE_TXDGBCH 0x087A8 |
974 | 974 | ||
975 | #define IXGBE_RXDSTATCTRL 0x02F40 | 975 | #define IXGBE_RXDSTATCTRL 0x02F40 |
976 | 976 | ||
977 | /* Copper Pond 2 link timeout */ | 977 | /* Copper Pond 2 link timeout */ |
978 | #define IXGBE_VALIDATE_LINK_READY_TIMEOUT 50 | 978 | #define IXGBE_VALIDATE_LINK_READY_TIMEOUT 50 |
979 | 979 | ||
980 | /* Omer CORECTL */ | 980 | /* Omer CORECTL */ |
981 | #define IXGBE_CORECTL 0x014F00 | 981 | #define IXGBE_CORECTL 0x014F00 |
982 | /* BARCTRL */ | 982 | /* BARCTRL */ |
983 | #define IXGBE_BARCTRL 0x110F4 | 983 | #define IXGBE_BARCTRL 0x110F4 |
984 | #define IXGBE_BARCTRL_FLSIZE 0x0700 | 984 | #define IXGBE_BARCTRL_FLSIZE 0x0700 |
985 | #define IXGBE_BARCTRL_FLSIZE_SHIFT 8 | 985 | #define IXGBE_BARCTRL_FLSIZE_SHIFT 8 |
986 | #define IXGBE_BARCTRL_CSRSIZE 0x2000 | 986 | #define IXGBE_BARCTRL_CSRSIZE 0x2000 |
987 | 987 | ||
988 | /* RSCCTL Bit Masks */ | 988 | /* RSCCTL Bit Masks */ |
989 | #define IXGBE_RSCCTL_RSCEN 0x01 | 989 | #define IXGBE_RSCCTL_RSCEN 0x01 |
990 | #define IXGBE_RSCCTL_MAXDESC_1 0x00 | 990 | #define IXGBE_RSCCTL_MAXDESC_1 0x00 |
991 | #define IXGBE_RSCCTL_MAXDESC_4 0x04 | 991 | #define IXGBE_RSCCTL_MAXDESC_4 0x04 |
992 | #define IXGBE_RSCCTL_MAXDESC_8 0x08 | 992 | #define IXGBE_RSCCTL_MAXDESC_8 0x08 |
993 | #define IXGBE_RSCCTL_MAXDESC_16 0x0C | 993 | #define IXGBE_RSCCTL_MAXDESC_16 0x0C |
994 | 994 | ||
995 | /* RSCDBU Bit Masks */ | 995 | /* RSCDBU Bit Masks */ |
996 | #define IXGBE_RSCDBU_RSCSMALDIS_MASK 0x0000007F | 996 | #define IXGBE_RSCDBU_RSCSMALDIS_MASK 0x0000007F |
997 | #define IXGBE_RSCDBU_RSCACKDIS 0x00000080 | 997 | #define IXGBE_RSCDBU_RSCACKDIS 0x00000080 |
998 | 998 | ||
999 | /* RDRXCTL Bit Masks */ | 999 | /* RDRXCTL Bit Masks */ |
1000 | #define IXGBE_RDRXCTL_RDMTS_1_2 0x00000000 /* Rx Desc Min Threshold Size */ | 1000 | #define IXGBE_RDRXCTL_RDMTS_1_2 0x00000000 /* Rx Desc Min Threshold Size */ |
1001 | #define IXGBE_RDRXCTL_CRCSTRIP 0x00000002 /* CRC Strip */ | 1001 | #define IXGBE_RDRXCTL_CRCSTRIP 0x00000002 /* CRC Strip */ |
1002 | #define IXGBE_RDRXCTL_MVMEN 0x00000020 | 1002 | #define IXGBE_RDRXCTL_MVMEN 0x00000020 |
1003 | #define IXGBE_RDRXCTL_DMAIDONE 0x00000008 /* DMA init cycle done */ | 1003 | #define IXGBE_RDRXCTL_DMAIDONE 0x00000008 /* DMA init cycle done */ |
1004 | #define IXGBE_RDRXCTL_AGGDIS 0x00010000 /* Aggregation disable */ | 1004 | #define IXGBE_RDRXCTL_AGGDIS 0x00010000 /* Aggregation disable */ |
1005 | #define IXGBE_RDRXCTL_RSCFRSTSIZE 0x003E0000 /* RSC First packet size */ | 1005 | #define IXGBE_RDRXCTL_RSCFRSTSIZE 0x003E0000 /* RSC First packet size */ |
1006 | #define IXGBE_RDRXCTL_RSCLLIDIS 0x00800000 /* Disable RSC compl on LLI */ | 1006 | #define IXGBE_RDRXCTL_RSCLLIDIS 0x00800000 /* Disable RSC compl on LLI */ |
1007 | #define IXGBE_RDRXCTL_RSCACKC 0x02000000 /* must set 1 when RSC enabled */ | 1007 | #define IXGBE_RDRXCTL_RSCACKC 0x02000000 /* must set 1 when RSC enabled */ |
1008 | #define IXGBE_RDRXCTL_FCOE_WRFIX 0x04000000 /* must set 1 when RSC enabled */ | 1008 | #define IXGBE_RDRXCTL_FCOE_WRFIX 0x04000000 /* must set 1 when RSC enabled */ |
1009 | 1009 | ||
1010 | /* RQTC Bit Masks and Shifts */ | 1010 | /* RQTC Bit Masks and Shifts */ |
1011 | #define IXGBE_RQTC_SHIFT_TC(_i) ((_i) * 4) | 1011 | #define IXGBE_RQTC_SHIFT_TC(_i) ((_i) * 4) |
1012 | #define IXGBE_RQTC_TC0_MASK (0x7 << 0) | 1012 | #define IXGBE_RQTC_TC0_MASK (0x7 << 0) |
1013 | #define IXGBE_RQTC_TC1_MASK (0x7 << 4) | 1013 | #define IXGBE_RQTC_TC1_MASK (0x7 << 4) |
1014 | #define IXGBE_RQTC_TC2_MASK (0x7 << 8) | 1014 | #define IXGBE_RQTC_TC2_MASK (0x7 << 8) |
1015 | #define IXGBE_RQTC_TC3_MASK (0x7 << 12) | 1015 | #define IXGBE_RQTC_TC3_MASK (0x7 << 12) |
1016 | #define IXGBE_RQTC_TC4_MASK (0x7 << 16) | 1016 | #define IXGBE_RQTC_TC4_MASK (0x7 << 16) |
1017 | #define IXGBE_RQTC_TC5_MASK (0x7 << 20) | 1017 | #define IXGBE_RQTC_TC5_MASK (0x7 << 20) |
1018 | #define IXGBE_RQTC_TC6_MASK (0x7 << 24) | 1018 | #define IXGBE_RQTC_TC6_MASK (0x7 << 24) |
1019 | #define IXGBE_RQTC_TC7_MASK (0x7 << 28) | 1019 | #define IXGBE_RQTC_TC7_MASK (0x7 << 28) |
1020 | 1020 | ||
1021 | /* PSRTYPE.RQPL Bit masks and shift */ | 1021 | /* PSRTYPE.RQPL Bit masks and shift */ |
1022 | #define IXGBE_PSRTYPE_RQPL_MASK 0x7 | 1022 | #define IXGBE_PSRTYPE_RQPL_MASK 0x7 |
1023 | #define IXGBE_PSRTYPE_RQPL_SHIFT 29 | 1023 | #define IXGBE_PSRTYPE_RQPL_SHIFT 29 |
1024 | 1024 | ||
1025 | /* CTRL Bit Masks */ | 1025 | /* CTRL Bit Masks */ |
1026 | #define IXGBE_CTRL_GIO_DIS 0x00000004 /* Global IO Master Disable bit */ | 1026 | #define IXGBE_CTRL_GIO_DIS 0x00000004 /* Global IO Master Disable bit */ |
1027 | #define IXGBE_CTRL_LNK_RST 0x00000008 /* Link Reset. Resets everything. */ | 1027 | #define IXGBE_CTRL_LNK_RST 0x00000008 /* Link Reset. Resets everything. */ |
1028 | #define IXGBE_CTRL_RST 0x04000000 /* Reset (SW) */ | 1028 | #define IXGBE_CTRL_RST 0x04000000 /* Reset (SW) */ |
1029 | #define IXGBE_CTRL_RST_MASK (IXGBE_CTRL_LNK_RST | IXGBE_CTRL_RST) | 1029 | #define IXGBE_CTRL_RST_MASK (IXGBE_CTRL_LNK_RST | IXGBE_CTRL_RST) |
1030 | 1030 | ||
1031 | /* FACTPS */ | 1031 | /* FACTPS */ |
1032 | #define IXGBE_FACTPS_MNGCG 0x20000000 /* Manageblility Clock Gated */ | 1032 | #define IXGBE_FACTPS_MNGCG 0x20000000 /* Manageblility Clock Gated */ |
1033 | #define IXGBE_FACTPS_LFS 0x40000000 /* LAN Function Select */ | 1033 | #define IXGBE_FACTPS_LFS 0x40000000 /* LAN Function Select */ |
1034 | 1034 | ||
1035 | /* MHADD Bit Masks */ | 1035 | /* MHADD Bit Masks */ |
1036 | #define IXGBE_MHADD_MFS_MASK 0xFFFF0000 | 1036 | #define IXGBE_MHADD_MFS_MASK 0xFFFF0000 |
1037 | #define IXGBE_MHADD_MFS_SHIFT 16 | 1037 | #define IXGBE_MHADD_MFS_SHIFT 16 |
1038 | 1038 | ||
1039 | /* Extended Device Control */ | 1039 | /* Extended Device Control */ |
1040 | #define IXGBE_CTRL_EXT_PFRSTD 0x00004000 /* Physical Function Reset Done */ | 1040 | #define IXGBE_CTRL_EXT_PFRSTD 0x00004000 /* Physical Function Reset Done */ |
1041 | #define IXGBE_CTRL_EXT_NS_DIS 0x00010000 /* No Snoop disable */ | 1041 | #define IXGBE_CTRL_EXT_NS_DIS 0x00010000 /* No Snoop disable */ |
1042 | #define IXGBE_CTRL_EXT_RO_DIS 0x00020000 /* Relaxed Ordering disable */ | 1042 | #define IXGBE_CTRL_EXT_RO_DIS 0x00020000 /* Relaxed Ordering disable */ |
1043 | #define IXGBE_CTRL_EXT_DRV_LOAD 0x10000000 /* Driver loaded bit for FW */ | 1043 | #define IXGBE_CTRL_EXT_DRV_LOAD 0x10000000 /* Driver loaded bit for FW */ |
1044 | 1044 | ||
1045 | /* Direct Cache Access (DCA) definitions */ | 1045 | /* Direct Cache Access (DCA) definitions */ |
1046 | #define IXGBE_DCA_CTRL_DCA_ENABLE 0x00000000 /* DCA Enable */ | 1046 | #define IXGBE_DCA_CTRL_DCA_ENABLE 0x00000000 /* DCA Enable */ |
1047 | #define IXGBE_DCA_CTRL_DCA_DISABLE 0x00000001 /* DCA Disable */ | 1047 | #define IXGBE_DCA_CTRL_DCA_DISABLE 0x00000001 /* DCA Disable */ |
1048 | 1048 | ||
1049 | #define IXGBE_DCA_CTRL_DCA_MODE_CB1 0x00 /* DCA Mode CB1 */ | 1049 | #define IXGBE_DCA_CTRL_DCA_MODE_CB1 0x00 /* DCA Mode CB1 */ |
1050 | #define IXGBE_DCA_CTRL_DCA_MODE_CB2 0x02 /* DCA Mode CB2 */ | 1050 | #define IXGBE_DCA_CTRL_DCA_MODE_CB2 0x02 /* DCA Mode CB2 */ |
1051 | 1051 | ||
1052 | #define IXGBE_DCA_RXCTRL_CPUID_MASK 0x0000001F /* Rx CPUID Mask */ | 1052 | #define IXGBE_DCA_RXCTRL_CPUID_MASK 0x0000001F /* Rx CPUID Mask */ |
1053 | #define IXGBE_DCA_RXCTRL_CPUID_MASK_82599 0xFF000000 /* Rx CPUID Mask */ | 1053 | #define IXGBE_DCA_RXCTRL_CPUID_MASK_82599 0xFF000000 /* Rx CPUID Mask */ |
1054 | #define IXGBE_DCA_RXCTRL_CPUID_SHIFT_82599 24 /* Rx CPUID Shift */ | 1054 | #define IXGBE_DCA_RXCTRL_CPUID_SHIFT_82599 24 /* Rx CPUID Shift */ |
1055 | #define IXGBE_DCA_RXCTRL_DESC_DCA_EN (1 << 5) /* DCA Rx Desc enable */ | 1055 | #define IXGBE_DCA_RXCTRL_DESC_DCA_EN (1 << 5) /* DCA Rx Desc enable */ |
1056 | #define IXGBE_DCA_RXCTRL_HEAD_DCA_EN (1 << 6) /* DCA Rx Desc header enable */ | 1056 | #define IXGBE_DCA_RXCTRL_HEAD_DCA_EN (1 << 6) /* DCA Rx Desc header enable */ |
1057 | #define IXGBE_DCA_RXCTRL_DATA_DCA_EN (1 << 7) /* DCA Rx Desc payload enable */ | 1057 | #define IXGBE_DCA_RXCTRL_DATA_DCA_EN (1 << 7) /* DCA Rx Desc payload enable */ |
1058 | #define IXGBE_DCA_RXCTRL_DESC_RRO_EN (1 << 9) /* DCA Rx rd Desc Relax Order */ | 1058 | #define IXGBE_DCA_RXCTRL_DESC_RRO_EN (1 << 9) /* DCA Rx rd Desc Relax Order */ |
1059 | #define IXGBE_DCA_RXCTRL_DATA_WRO_EN (1 << 13) /* Rx wr data Relax Order */ | 1059 | #define IXGBE_DCA_RXCTRL_DATA_WRO_EN (1 << 13) /* Rx wr data Relax Order */ |
1060 | #define IXGBE_DCA_RXCTRL_HEAD_WRO_EN (1 << 15) /* Rx wr header RO */ | 1060 | #define IXGBE_DCA_RXCTRL_HEAD_WRO_EN (1 << 15) /* Rx wr header RO */ |
1061 | 1061 | ||
1062 | #define IXGBE_DCA_TXCTRL_CPUID_MASK 0x0000001F /* Tx CPUID Mask */ | 1062 | #define IXGBE_DCA_TXCTRL_CPUID_MASK 0x0000001F /* Tx CPUID Mask */ |
1063 | #define IXGBE_DCA_TXCTRL_CPUID_MASK_82599 0xFF000000 /* Tx CPUID Mask */ | 1063 | #define IXGBE_DCA_TXCTRL_CPUID_MASK_82599 0xFF000000 /* Tx CPUID Mask */ |
1064 | #define IXGBE_DCA_TXCTRL_CPUID_SHIFT_82599 24 /* Tx CPUID Shift */ | 1064 | #define IXGBE_DCA_TXCTRL_CPUID_SHIFT_82599 24 /* Tx CPUID Shift */ |
1065 | #define IXGBE_DCA_TXCTRL_DESC_DCA_EN (1 << 5) /* DCA Tx Desc enable */ | 1065 | #define IXGBE_DCA_TXCTRL_DESC_DCA_EN (1 << 5) /* DCA Tx Desc enable */ |
1066 | #define IXGBE_DCA_TXCTRL_DESC_RRO_EN (1 << 9) /* Tx rd Desc Relax Order */ | 1066 | #define IXGBE_DCA_TXCTRL_DESC_RRO_EN (1 << 9) /* Tx rd Desc Relax Order */ |
1067 | #define IXGBE_DCA_TXCTRL_DESC_WRO_EN (1 << 11) /* Tx Desc writeback RO bit */ | 1067 | #define IXGBE_DCA_TXCTRL_DESC_WRO_EN (1 << 11) /* Tx Desc writeback RO bit */ |
1068 | #define IXGBE_DCA_TXCTRL_DATA_RRO_EN (1 << 13) /* Tx rd data Relax Order */ | 1068 | #define IXGBE_DCA_TXCTRL_DATA_RRO_EN (1 << 13) /* Tx rd data Relax Order */ |
1069 | #define IXGBE_DCA_MAX_QUEUES_82598 16 /* DCA regs only on 16 queues */ | 1069 | #define IXGBE_DCA_MAX_QUEUES_82598 16 /* DCA regs only on 16 queues */ |
1070 | 1070 | ||
1071 | /* MSCA Bit Masks */ | 1071 | /* MSCA Bit Masks */ |
1072 | #define IXGBE_MSCA_NP_ADDR_MASK 0x0000FFFF /* MDI Address (new protocol) */ | 1072 | #define IXGBE_MSCA_NP_ADDR_MASK 0x0000FFFF /* MDI Address (new protocol) */ |
1073 | #define IXGBE_MSCA_NP_ADDR_SHIFT 0 | 1073 | #define IXGBE_MSCA_NP_ADDR_SHIFT 0 |
1074 | #define IXGBE_MSCA_DEV_TYPE_MASK 0x001F0000 /* Device Type (new protocol) */ | 1074 | #define IXGBE_MSCA_DEV_TYPE_MASK 0x001F0000 /* Device Type (new protocol) */ |
1075 | #define IXGBE_MSCA_DEV_TYPE_SHIFT 16 /* Register Address (old protocol */ | 1075 | #define IXGBE_MSCA_DEV_TYPE_SHIFT 16 /* Register Address (old protocol */ |
1076 | #define IXGBE_MSCA_PHY_ADDR_MASK 0x03E00000 /* PHY Address mask */ | 1076 | #define IXGBE_MSCA_PHY_ADDR_MASK 0x03E00000 /* PHY Address mask */ |
1077 | #define IXGBE_MSCA_PHY_ADDR_SHIFT 21 /* PHY Address shift*/ | 1077 | #define IXGBE_MSCA_PHY_ADDR_SHIFT 21 /* PHY Address shift*/ |
1078 | #define IXGBE_MSCA_OP_CODE_MASK 0x0C000000 /* OP CODE mask */ | 1078 | #define IXGBE_MSCA_OP_CODE_MASK 0x0C000000 /* OP CODE mask */ |
1079 | #define IXGBE_MSCA_OP_CODE_SHIFT 26 /* OP CODE shift */ | 1079 | #define IXGBE_MSCA_OP_CODE_SHIFT 26 /* OP CODE shift */ |
1080 | #define IXGBE_MSCA_ADDR_CYCLE 0x00000000 /* OP CODE 00 (addr cycle) */ | 1080 | #define IXGBE_MSCA_ADDR_CYCLE 0x00000000 /* OP CODE 00 (addr cycle) */ |
1081 | #define IXGBE_MSCA_WRITE 0x04000000 /* OP CODE 01 (write) */ | 1081 | #define IXGBE_MSCA_WRITE 0x04000000 /* OP CODE 01 (write) */ |
1082 | #define IXGBE_MSCA_READ 0x0C000000 /* OP CODE 11 (read) */ | 1082 | #define IXGBE_MSCA_READ 0x0C000000 /* OP CODE 11 (read) */ |
1083 | #define IXGBE_MSCA_READ_AUTOINC 0x08000000 /* OP CODE 10 (read, auto inc)*/ | 1083 | #define IXGBE_MSCA_READ_AUTOINC 0x08000000 /* OP CODE 10 (read, auto inc)*/ |
1084 | #define IXGBE_MSCA_ST_CODE_MASK 0x30000000 /* ST Code mask */ | 1084 | #define IXGBE_MSCA_ST_CODE_MASK 0x30000000 /* ST Code mask */ |
1085 | #define IXGBE_MSCA_ST_CODE_SHIFT 28 /* ST Code shift */ | 1085 | #define IXGBE_MSCA_ST_CODE_SHIFT 28 /* ST Code shift */ |
1086 | #define IXGBE_MSCA_NEW_PROTOCOL 0x00000000 /* ST CODE 00 (new protocol) */ | 1086 | #define IXGBE_MSCA_NEW_PROTOCOL 0x00000000 /* ST CODE 00 (new protocol) */ |
1087 | #define IXGBE_MSCA_OLD_PROTOCOL 0x10000000 /* ST CODE 01 (old protocol) */ | 1087 | #define IXGBE_MSCA_OLD_PROTOCOL 0x10000000 /* ST CODE 01 (old protocol) */ |
1088 | #define IXGBE_MSCA_MDI_COMMAND 0x40000000 /* Initiate MDI command */ | 1088 | #define IXGBE_MSCA_MDI_COMMAND 0x40000000 /* Initiate MDI command */ |
1089 | #define IXGBE_MSCA_MDI_IN_PROG_EN 0x80000000 /* MDI in progress enable */ | 1089 | #define IXGBE_MSCA_MDI_IN_PROG_EN 0x80000000 /* MDI in progress enable */ |
1090 | 1090 | ||
1091 | /* MSRWD bit masks */ | 1091 | /* MSRWD bit masks */ |
1092 | #define IXGBE_MSRWD_WRITE_DATA_MASK 0x0000FFFF | 1092 | #define IXGBE_MSRWD_WRITE_DATA_MASK 0x0000FFFF |
1093 | #define IXGBE_MSRWD_WRITE_DATA_SHIFT 0 | 1093 | #define IXGBE_MSRWD_WRITE_DATA_SHIFT 0 |
1094 | #define IXGBE_MSRWD_READ_DATA_MASK 0xFFFF0000 | 1094 | #define IXGBE_MSRWD_READ_DATA_MASK 0xFFFF0000 |
1095 | #define IXGBE_MSRWD_READ_DATA_SHIFT 16 | 1095 | #define IXGBE_MSRWD_READ_DATA_SHIFT 16 |
1096 | 1096 | ||
1097 | /* Atlas registers */ | 1097 | /* Atlas registers */ |
1098 | #define IXGBE_ATLAS_PDN_LPBK 0x24 | 1098 | #define IXGBE_ATLAS_PDN_LPBK 0x24 |
1099 | #define IXGBE_ATLAS_PDN_10G 0xB | 1099 | #define IXGBE_ATLAS_PDN_10G 0xB |
1100 | #define IXGBE_ATLAS_PDN_1G 0xC | 1100 | #define IXGBE_ATLAS_PDN_1G 0xC |
1101 | #define IXGBE_ATLAS_PDN_AN 0xD | 1101 | #define IXGBE_ATLAS_PDN_AN 0xD |
1102 | 1102 | ||
1103 | /* Atlas bit masks */ | 1103 | /* Atlas bit masks */ |
1104 | #define IXGBE_ATLASCTL_WRITE_CMD 0x00010000 | 1104 | #define IXGBE_ATLASCTL_WRITE_CMD 0x00010000 |
1105 | #define IXGBE_ATLAS_PDN_TX_REG_EN 0x10 | 1105 | #define IXGBE_ATLAS_PDN_TX_REG_EN 0x10 |
1106 | #define IXGBE_ATLAS_PDN_TX_10G_QL_ALL 0xF0 | 1106 | #define IXGBE_ATLAS_PDN_TX_10G_QL_ALL 0xF0 |
1107 | #define IXGBE_ATLAS_PDN_TX_1G_QL_ALL 0xF0 | 1107 | #define IXGBE_ATLAS_PDN_TX_1G_QL_ALL 0xF0 |
1108 | #define IXGBE_ATLAS_PDN_TX_AN_QL_ALL 0xF0 | 1108 | #define IXGBE_ATLAS_PDN_TX_AN_QL_ALL 0xF0 |
1109 | 1109 | ||
1110 | /* Omer bit masks */ | 1110 | /* Omer bit masks */ |
1111 | #define IXGBE_CORECTL_WRITE_CMD 0x00010000 | 1111 | #define IXGBE_CORECTL_WRITE_CMD 0x00010000 |
1112 | 1112 | ||
1113 | /* MDIO definitions */ | 1113 | /* MDIO definitions */ |
1114 | 1114 | ||
1115 | #define IXGBE_MDIO_COMMAND_TIMEOUT 100 /* PHY Timeout for 1 GB mode */ | 1115 | #define IXGBE_MDIO_COMMAND_TIMEOUT 100 /* PHY Timeout for 1 GB mode */ |
1116 | 1116 | ||
1117 | #define IXGBE_MDIO_VENDOR_SPECIFIC_1_CONTROL 0x0 /* VS1 Control Reg */ | 1117 | #define IXGBE_MDIO_VENDOR_SPECIFIC_1_CONTROL 0x0 /* VS1 Control Reg */ |
1118 | #define IXGBE_MDIO_VENDOR_SPECIFIC_1_STATUS 0x1 /* VS1 Status Reg */ | 1118 | #define IXGBE_MDIO_VENDOR_SPECIFIC_1_STATUS 0x1 /* VS1 Status Reg */ |
1119 | #define IXGBE_MDIO_VENDOR_SPECIFIC_1_LINK_STATUS 0x0008 /* 1 = Link Up */ | 1119 | #define IXGBE_MDIO_VENDOR_SPECIFIC_1_LINK_STATUS 0x0008 /* 1 = Link Up */ |
1120 | #define IXGBE_MDIO_VENDOR_SPECIFIC_1_SPEED_STATUS 0x0010 /* 0 - 10G, 1 - 1G */ | 1120 | #define IXGBE_MDIO_VENDOR_SPECIFIC_1_SPEED_STATUS 0x0010 /* 0 - 10G, 1 - 1G */ |
1121 | #define IXGBE_MDIO_VENDOR_SPECIFIC_1_10G_SPEED 0x0018 | 1121 | #define IXGBE_MDIO_VENDOR_SPECIFIC_1_10G_SPEED 0x0018 |
1122 | #define IXGBE_MDIO_VENDOR_SPECIFIC_1_1G_SPEED 0x0010 | 1122 | #define IXGBE_MDIO_VENDOR_SPECIFIC_1_1G_SPEED 0x0010 |
1123 | 1123 | ||
1124 | #define IXGBE_MDIO_PMA_PMD_SDA_SCL_ADDR 0xC30A /* PHY_XS SDA/SCL Addr Reg */ | 1124 | #define IXGBE_MDIO_PMA_PMD_SDA_SCL_ADDR 0xC30A /* PHY_XS SDA/SCL Addr Reg */ |
1125 | #define IXGBE_MDIO_PMA_PMD_SDA_SCL_DATA 0xC30B /* PHY_XS SDA/SCL Data Reg */ | 1125 | #define IXGBE_MDIO_PMA_PMD_SDA_SCL_DATA 0xC30B /* PHY_XS SDA/SCL Data Reg */ |
1126 | #define IXGBE_MDIO_PMA_PMD_SDA_SCL_STAT 0xC30C /* PHY_XS SDA/SCL Status Reg */ | 1126 | #define IXGBE_MDIO_PMA_PMD_SDA_SCL_STAT 0xC30C /* PHY_XS SDA/SCL Status Reg */ |
1127 | 1127 | ||
1128 | /* MII clause 22/28 definitions */ | 1128 | /* MII clause 22/28 definitions */ |
1129 | #define IXGBE_MII_AUTONEG_VENDOR_PROVISION_1_REG 0xC400 /* 1G Provisioning 1 */ | 1129 | #define IXGBE_MII_AUTONEG_VENDOR_PROVISION_1_REG 0xC400 /* 1G Provisioning 1 */ |
1130 | #define IXGBE_MII_AUTONEG_XNP_TX_REG 0x17 /* 1G XNP Transmit */ | 1130 | #define IXGBE_MII_AUTONEG_XNP_TX_REG 0x17 /* 1G XNP Transmit */ |
1131 | #define IXGBE_MII_1GBASE_T_ADVERTISE_XNP_TX 0x4000 /* full duplex, bit:14*/ | 1131 | #define IXGBE_MII_1GBASE_T_ADVERTISE_XNP_TX 0x4000 /* full duplex, bit:14*/ |
1132 | #define IXGBE_MII_1GBASE_T_ADVERTISE 0x8000 /* full duplex, bit:15*/ | 1132 | #define IXGBE_MII_1GBASE_T_ADVERTISE 0x8000 /* full duplex, bit:15*/ |
1133 | #define IXGBE_MII_AUTONEG_REG 0x0 | 1133 | #define IXGBE_MII_AUTONEG_REG 0x0 |
1134 | 1134 | ||
1135 | #define IXGBE_PHY_REVISION_MASK 0xFFFFFFF0 | 1135 | #define IXGBE_PHY_REVISION_MASK 0xFFFFFFF0 |
1136 | #define IXGBE_MAX_PHY_ADDR 32 | 1136 | #define IXGBE_MAX_PHY_ADDR 32 |
1137 | 1137 | ||
1138 | /* PHY IDs*/ | 1138 | /* PHY IDs*/ |
1139 | #define TN1010_PHY_ID 0x00A19410 | 1139 | #define TN1010_PHY_ID 0x00A19410 |
1140 | #define TNX_FW_REV 0xB | 1140 | #define TNX_FW_REV 0xB |
1141 | #define X540_PHY_ID 0x01540200 | 1141 | #define X540_PHY_ID 0x01540200 |
1142 | #define QT2022_PHY_ID 0x0043A400 | 1142 | #define QT2022_PHY_ID 0x0043A400 |
1143 | #define ATH_PHY_ID 0x03429050 | 1143 | #define ATH_PHY_ID 0x03429050 |
1144 | #define AQ_FW_REV 0x20 | 1144 | #define AQ_FW_REV 0x20 |
1145 | 1145 | ||
1146 | /* PHY Types */ | 1146 | /* PHY Types */ |
1147 | #define IXGBE_M88E1145_E_PHY_ID 0x01410CD0 | 1147 | #define IXGBE_M88E1145_E_PHY_ID 0x01410CD0 |
1148 | 1148 | ||
1149 | /* Special PHY Init Routine */ | 1149 | /* Special PHY Init Routine */ |
1150 | #define IXGBE_PHY_INIT_OFFSET_NL 0x002B | 1150 | #define IXGBE_PHY_INIT_OFFSET_NL 0x002B |
1151 | #define IXGBE_PHY_INIT_END_NL 0xFFFF | 1151 | #define IXGBE_PHY_INIT_END_NL 0xFFFF |
1152 | #define IXGBE_CONTROL_MASK_NL 0xF000 | 1152 | #define IXGBE_CONTROL_MASK_NL 0xF000 |
1153 | #define IXGBE_DATA_MASK_NL 0x0FFF | 1153 | #define IXGBE_DATA_MASK_NL 0x0FFF |
1154 | #define IXGBE_CONTROL_SHIFT_NL 12 | 1154 | #define IXGBE_CONTROL_SHIFT_NL 12 |
1155 | #define IXGBE_DELAY_NL 0 | 1155 | #define IXGBE_DELAY_NL 0 |
1156 | #define IXGBE_DATA_NL 1 | 1156 | #define IXGBE_DATA_NL 1 |
1157 | #define IXGBE_CONTROL_NL 0x000F | 1157 | #define IXGBE_CONTROL_NL 0x000F |
1158 | #define IXGBE_CONTROL_EOL_NL 0x0FFF | 1158 | #define IXGBE_CONTROL_EOL_NL 0x0FFF |
1159 | #define IXGBE_CONTROL_SOL_NL 0x0000 | 1159 | #define IXGBE_CONTROL_SOL_NL 0x0000 |
1160 | 1160 | ||
1161 | /* General purpose Interrupt Enable */ | 1161 | /* General purpose Interrupt Enable */ |
1162 | #define IXGBE_SDP0_GPIEN 0x00000001 /* SDP0 */ | 1162 | #define IXGBE_SDP0_GPIEN 0x00000001 /* SDP0 */ |
1163 | #define IXGBE_SDP1_GPIEN 0x00000002 /* SDP1 */ | 1163 | #define IXGBE_SDP1_GPIEN 0x00000002 /* SDP1 */ |
1164 | #define IXGBE_SDP2_GPIEN 0x00000004 /* SDP2 */ | 1164 | #define IXGBE_SDP2_GPIEN 0x00000004 /* SDP2 */ |
1165 | #define IXGBE_GPIE_MSIX_MODE 0x00000010 /* MSI-X mode */ | 1165 | #define IXGBE_GPIE_MSIX_MODE 0x00000010 /* MSI-X mode */ |
1166 | #define IXGBE_GPIE_OCD 0x00000020 /* Other Clear Disable */ | 1166 | #define IXGBE_GPIE_OCD 0x00000020 /* Other Clear Disable */ |
1167 | #define IXGBE_GPIE_EIMEN 0x00000040 /* Immediate Interrupt Enable */ | 1167 | #define IXGBE_GPIE_EIMEN 0x00000040 /* Immediate Interrupt Enable */ |
1168 | #define IXGBE_GPIE_EIAME 0x40000000 | 1168 | #define IXGBE_GPIE_EIAME 0x40000000 |
1169 | #define IXGBE_GPIE_PBA_SUPPORT 0x80000000 | 1169 | #define IXGBE_GPIE_PBA_SUPPORT 0x80000000 |
1170 | #define IXGBE_GPIE_RSC_DELAY_SHIFT 11 | 1170 | #define IXGBE_GPIE_RSC_DELAY_SHIFT 11 |
1171 | #define IXGBE_GPIE_VTMODE_MASK 0x0000C000 /* VT Mode Mask */ | 1171 | #define IXGBE_GPIE_VTMODE_MASK 0x0000C000 /* VT Mode Mask */ |
1172 | #define IXGBE_GPIE_VTMODE_16 0x00004000 /* 16 VFs 8 queues per VF */ | 1172 | #define IXGBE_GPIE_VTMODE_16 0x00004000 /* 16 VFs 8 queues per VF */ |
1173 | #define IXGBE_GPIE_VTMODE_32 0x00008000 /* 32 VFs 4 queues per VF */ | 1173 | #define IXGBE_GPIE_VTMODE_32 0x00008000 /* 32 VFs 4 queues per VF */ |
1174 | #define IXGBE_GPIE_VTMODE_64 0x0000C000 /* 64 VFs 2 queues per VF */ | 1174 | #define IXGBE_GPIE_VTMODE_64 0x0000C000 /* 64 VFs 2 queues per VF */ |
1175 | 1175 | ||
1176 | /* Packet Buffer Initialization */ | 1176 | /* Packet Buffer Initialization */ |
1177 | #define IXGBE_TXPBSIZE_20KB 0x00005000 /* 20KB Packet Buffer */ | 1177 | #define IXGBE_TXPBSIZE_20KB 0x00005000 /* 20KB Packet Buffer */ |
1178 | #define IXGBE_TXPBSIZE_40KB 0x0000A000 /* 40KB Packet Buffer */ | 1178 | #define IXGBE_TXPBSIZE_40KB 0x0000A000 /* 40KB Packet Buffer */ |
1179 | #define IXGBE_RXPBSIZE_48KB 0x0000C000 /* 48KB Packet Buffer */ | 1179 | #define IXGBE_RXPBSIZE_48KB 0x0000C000 /* 48KB Packet Buffer */ |
1180 | #define IXGBE_RXPBSIZE_64KB 0x00010000 /* 64KB Packet Buffer */ | 1180 | #define IXGBE_RXPBSIZE_64KB 0x00010000 /* 64KB Packet Buffer */ |
1181 | #define IXGBE_RXPBSIZE_80KB 0x00014000 /* 80KB Packet Buffer */ | 1181 | #define IXGBE_RXPBSIZE_80KB 0x00014000 /* 80KB Packet Buffer */ |
1182 | #define IXGBE_RXPBSIZE_128KB 0x00020000 /* 128KB Packet Buffer */ | 1182 | #define IXGBE_RXPBSIZE_128KB 0x00020000 /* 128KB Packet Buffer */ |
1183 | #define IXGBE_RXPBSIZE_MAX 0x00080000 /* 512KB Packet Buffer*/ | 1183 | #define IXGBE_RXPBSIZE_MAX 0x00080000 /* 512KB Packet Buffer*/ |
1184 | #define IXGBE_TXPBSIZE_MAX 0x00028000 /* 160KB Packet Buffer*/ | 1184 | #define IXGBE_TXPBSIZE_MAX 0x00028000 /* 160KB Packet Buffer*/ |
1185 | 1185 | ||
1186 | #define IXGBE_TXPKT_SIZE_MAX 0xA /* Max Tx Packet size */ | 1186 | #define IXGBE_TXPKT_SIZE_MAX 0xA /* Max Tx Packet size */ |
1187 | #define IXGBE_MAX_PB 8 | 1187 | #define IXGBE_MAX_PB 8 |
1188 | 1188 | ||
1189 | /* Packet buffer allocation strategies */ | 1189 | /* Packet buffer allocation strategies */ |
1190 | enum { | 1190 | enum { |
1191 | PBA_STRATEGY_EQUAL = 0, /* Distribute PB space equally */ | 1191 | PBA_STRATEGY_EQUAL = 0, /* Distribute PB space equally */ |
1192 | #define PBA_STRATEGY_EQUAL PBA_STRATEGY_EQUAL | 1192 | #define PBA_STRATEGY_EQUAL PBA_STRATEGY_EQUAL |
1193 | PBA_STRATEGY_WEIGHTED = 1, /* Weight front half of TCs */ | 1193 | PBA_STRATEGY_WEIGHTED = 1, /* Weight front half of TCs */ |
1194 | #define PBA_STRATEGY_WEIGHTED PBA_STRATEGY_WEIGHTED | 1194 | #define PBA_STRATEGY_WEIGHTED PBA_STRATEGY_WEIGHTED |
1195 | }; | 1195 | }; |
1196 | 1196 | ||
1197 | /* Transmit Flow Control status */ | 1197 | /* Transmit Flow Control status */ |
1198 | #define IXGBE_TFCS_TXOFF 0x00000001 | 1198 | #define IXGBE_TFCS_TXOFF 0x00000001 |
1199 | #define IXGBE_TFCS_TXOFF0 0x00000100 | 1199 | #define IXGBE_TFCS_TXOFF0 0x00000100 |
1200 | #define IXGBE_TFCS_TXOFF1 0x00000200 | 1200 | #define IXGBE_TFCS_TXOFF1 0x00000200 |
1201 | #define IXGBE_TFCS_TXOFF2 0x00000400 | 1201 | #define IXGBE_TFCS_TXOFF2 0x00000400 |
1202 | #define IXGBE_TFCS_TXOFF3 0x00000800 | 1202 | #define IXGBE_TFCS_TXOFF3 0x00000800 |
1203 | #define IXGBE_TFCS_TXOFF4 0x00001000 | 1203 | #define IXGBE_TFCS_TXOFF4 0x00001000 |
1204 | #define IXGBE_TFCS_TXOFF5 0x00002000 | 1204 | #define IXGBE_TFCS_TXOFF5 0x00002000 |
1205 | #define IXGBE_TFCS_TXOFF6 0x00004000 | 1205 | #define IXGBE_TFCS_TXOFF6 0x00004000 |
1206 | #define IXGBE_TFCS_TXOFF7 0x00008000 | 1206 | #define IXGBE_TFCS_TXOFF7 0x00008000 |
1207 | 1207 | ||
1208 | /* TCP Timer */ | 1208 | /* TCP Timer */ |
1209 | #define IXGBE_TCPTIMER_KS 0x00000100 | 1209 | #define IXGBE_TCPTIMER_KS 0x00000100 |
1210 | #define IXGBE_TCPTIMER_COUNT_ENABLE 0x00000200 | 1210 | #define IXGBE_TCPTIMER_COUNT_ENABLE 0x00000200 |
1211 | #define IXGBE_TCPTIMER_COUNT_FINISH 0x00000400 | 1211 | #define IXGBE_TCPTIMER_COUNT_FINISH 0x00000400 |
1212 | #define IXGBE_TCPTIMER_LOOP 0x00000800 | 1212 | #define IXGBE_TCPTIMER_LOOP 0x00000800 |
1213 | #define IXGBE_TCPTIMER_DURATION_MASK 0x000000FF | 1213 | #define IXGBE_TCPTIMER_DURATION_MASK 0x000000FF |
1214 | 1214 | ||
1215 | /* HLREG0 Bit Masks */ | 1215 | /* HLREG0 Bit Masks */ |
1216 | #define IXGBE_HLREG0_TXCRCEN 0x00000001 /* bit 0 */ | 1216 | #define IXGBE_HLREG0_TXCRCEN 0x00000001 /* bit 0 */ |
1217 | #define IXGBE_HLREG0_RXCRCSTRP 0x00000002 /* bit 1 */ | 1217 | #define IXGBE_HLREG0_RXCRCSTRP 0x00000002 /* bit 1 */ |
1218 | #define IXGBE_HLREG0_JUMBOEN 0x00000004 /* bit 2 */ | 1218 | #define IXGBE_HLREG0_JUMBOEN 0x00000004 /* bit 2 */ |
1219 | #define IXGBE_HLREG0_TXPADEN 0x00000400 /* bit 10 */ | 1219 | #define IXGBE_HLREG0_TXPADEN 0x00000400 /* bit 10 */ |
1220 | #define IXGBE_HLREG0_TXPAUSEEN 0x00001000 /* bit 12 */ | 1220 | #define IXGBE_HLREG0_TXPAUSEEN 0x00001000 /* bit 12 */ |
1221 | #define IXGBE_HLREG0_RXPAUSEEN 0x00004000 /* bit 14 */ | 1221 | #define IXGBE_HLREG0_RXPAUSEEN 0x00004000 /* bit 14 */ |
1222 | #define IXGBE_HLREG0_LPBK 0x00008000 /* bit 15 */ | 1222 | #define IXGBE_HLREG0_LPBK 0x00008000 /* bit 15 */ |
1223 | #define IXGBE_HLREG0_MDCSPD 0x00010000 /* bit 16 */ | 1223 | #define IXGBE_HLREG0_MDCSPD 0x00010000 /* bit 16 */ |
1224 | #define IXGBE_HLREG0_CONTMDC 0x00020000 /* bit 17 */ | 1224 | #define IXGBE_HLREG0_CONTMDC 0x00020000 /* bit 17 */ |
1225 | #define IXGBE_HLREG0_CTRLFLTR 0x00040000 /* bit 18 */ | 1225 | #define IXGBE_HLREG0_CTRLFLTR 0x00040000 /* bit 18 */ |
1226 | #define IXGBE_HLREG0_PREPEND 0x00F00000 /* bits 20-23 */ | 1226 | #define IXGBE_HLREG0_PREPEND 0x00F00000 /* bits 20-23 */ |
1227 | #define IXGBE_HLREG0_PRIPAUSEEN 0x01000000 /* bit 24 */ | 1227 | #define IXGBE_HLREG0_PRIPAUSEEN 0x01000000 /* bit 24 */ |
1228 | #define IXGBE_HLREG0_RXPAUSERECDA 0x06000000 /* bits 25-26 */ | 1228 | #define IXGBE_HLREG0_RXPAUSERECDA 0x06000000 /* bits 25-26 */ |
1229 | #define IXGBE_HLREG0_RXLNGTHERREN 0x08000000 /* bit 27 */ | 1229 | #define IXGBE_HLREG0_RXLNGTHERREN 0x08000000 /* bit 27 */ |
1230 | #define IXGBE_HLREG0_RXPADSTRIPEN 0x10000000 /* bit 28 */ | 1230 | #define IXGBE_HLREG0_RXPADSTRIPEN 0x10000000 /* bit 28 */ |
1231 | 1231 | ||
1232 | /* VMD_CTL bitmasks */ | 1232 | /* VMD_CTL bitmasks */ |
1233 | #define IXGBE_VMD_CTL_VMDQ_EN 0x00000001 | 1233 | #define IXGBE_VMD_CTL_VMDQ_EN 0x00000001 |
1234 | #define IXGBE_VMD_CTL_VMDQ_FILTER 0x00000002 | 1234 | #define IXGBE_VMD_CTL_VMDQ_FILTER 0x00000002 |
1235 | 1235 | ||
1236 | /* VT_CTL bitmasks */ | 1236 | /* VT_CTL bitmasks */ |
1237 | #define IXGBE_VT_CTL_DIS_DEFPL 0x20000000 /* disable default pool */ | 1237 | #define IXGBE_VT_CTL_DIS_DEFPL 0x20000000 /* disable default pool */ |
1238 | #define IXGBE_VT_CTL_REPLEN 0x40000000 /* replication enabled */ | 1238 | #define IXGBE_VT_CTL_REPLEN 0x40000000 /* replication enabled */ |
1239 | #define IXGBE_VT_CTL_VT_ENABLE 0x00000001 /* Enable VT Mode */ | 1239 | #define IXGBE_VT_CTL_VT_ENABLE 0x00000001 /* Enable VT Mode */ |
1240 | #define IXGBE_VT_CTL_POOL_SHIFT 7 | 1240 | #define IXGBE_VT_CTL_POOL_SHIFT 7 |
1241 | #define IXGBE_VT_CTL_POOL_MASK (0x3F << IXGBE_VT_CTL_POOL_SHIFT) | 1241 | #define IXGBE_VT_CTL_POOL_MASK (0x3F << IXGBE_VT_CTL_POOL_SHIFT) |
1242 | 1242 | ||
1243 | /* VMOLR bitmasks */ | 1243 | /* VMOLR bitmasks */ |
1244 | #define IXGBE_VMOLR_AUPE 0x01000000 /* accept untagged packets */ | 1244 | #define IXGBE_VMOLR_AUPE 0x01000000 /* accept untagged packets */ |
1245 | #define IXGBE_VMOLR_ROMPE 0x02000000 /* accept packets in MTA tbl */ | 1245 | #define IXGBE_VMOLR_ROMPE 0x02000000 /* accept packets in MTA tbl */ |
1246 | #define IXGBE_VMOLR_ROPE 0x04000000 /* accept packets in UC tbl */ | 1246 | #define IXGBE_VMOLR_ROPE 0x04000000 /* accept packets in UC tbl */ |
1247 | #define IXGBE_VMOLR_BAM 0x08000000 /* accept broadcast packets */ | 1247 | #define IXGBE_VMOLR_BAM 0x08000000 /* accept broadcast packets */ |
1248 | #define IXGBE_VMOLR_MPE 0x10000000 /* multicast promiscuous */ | 1248 | #define IXGBE_VMOLR_MPE 0x10000000 /* multicast promiscuous */ |
1249 | 1249 | ||
1250 | /* VFRE bitmask */ | 1250 | /* VFRE bitmask */ |
1251 | #define IXGBE_VFRE_ENABLE_ALL 0xFFFFFFFF | 1251 | #define IXGBE_VFRE_ENABLE_ALL 0xFFFFFFFF |
1252 | 1252 | ||
1253 | #define IXGBE_VF_INIT_TIMEOUT 200 /* Number of retries to clear RSTI */ | 1253 | #define IXGBE_VF_INIT_TIMEOUT 200 /* Number of retries to clear RSTI */ |
1254 | 1254 | ||
1255 | /* RDHMPN and TDHMPN bitmasks */ | 1255 | /* RDHMPN and TDHMPN bitmasks */ |
1256 | #define IXGBE_RDHMPN_RDICADDR 0x007FF800 | 1256 | #define IXGBE_RDHMPN_RDICADDR 0x007FF800 |
1257 | #define IXGBE_RDHMPN_RDICRDREQ 0x00800000 | 1257 | #define IXGBE_RDHMPN_RDICRDREQ 0x00800000 |
1258 | #define IXGBE_RDHMPN_RDICADDR_SHIFT 11 | 1258 | #define IXGBE_RDHMPN_RDICADDR_SHIFT 11 |
1259 | #define IXGBE_TDHMPN_TDICADDR 0x003FF800 | 1259 | #define IXGBE_TDHMPN_TDICADDR 0x003FF800 |
1260 | #define IXGBE_TDHMPN_TDICRDREQ 0x00800000 | 1260 | #define IXGBE_TDHMPN_TDICRDREQ 0x00800000 |
1261 | #define IXGBE_TDHMPN_TDICADDR_SHIFT 11 | 1261 | #define IXGBE_TDHMPN_TDICADDR_SHIFT 11 |
1262 | 1262 | ||
1263 | #define IXGBE_RDMAM_MEM_SEL_SHIFT 13 | 1263 | #define IXGBE_RDMAM_MEM_SEL_SHIFT 13 |
1264 | #define IXGBE_RDMAM_DWORD_SHIFT 9 | 1264 | #define IXGBE_RDMAM_DWORD_SHIFT 9 |
1265 | #define IXGBE_RDMAM_DESC_COMP_FIFO 1 | 1265 | #define IXGBE_RDMAM_DESC_COMP_FIFO 1 |
1266 | #define IXGBE_RDMAM_DFC_CMD_FIFO 2 | 1266 | #define IXGBE_RDMAM_DFC_CMD_FIFO 2 |
1267 | #define IXGBE_RDMAM_TCN_STATUS_RAM 4 | 1267 | #define IXGBE_RDMAM_TCN_STATUS_RAM 4 |
1268 | #define IXGBE_RDMAM_WB_COLL_FIFO 5 | 1268 | #define IXGBE_RDMAM_WB_COLL_FIFO 5 |
1269 | #define IXGBE_RDMAM_QSC_CNT_RAM 6 | 1269 | #define IXGBE_RDMAM_QSC_CNT_RAM 6 |
1270 | #define IXGBE_RDMAM_QSC_QUEUE_CNT 8 | 1270 | #define IXGBE_RDMAM_QSC_QUEUE_CNT 8 |
1271 | #define IXGBE_RDMAM_QSC_QUEUE_RAM 0xA | 1271 | #define IXGBE_RDMAM_QSC_QUEUE_RAM 0xA |
1272 | #define IXGBE_RDMAM_DESC_COM_FIFO_RANGE 135 | 1272 | #define IXGBE_RDMAM_DESC_COM_FIFO_RANGE 135 |
1273 | #define IXGBE_RDMAM_DESC_COM_FIFO_COUNT 4 | 1273 | #define IXGBE_RDMAM_DESC_COM_FIFO_COUNT 4 |
1274 | #define IXGBE_RDMAM_DFC_CMD_FIFO_RANGE 48 | 1274 | #define IXGBE_RDMAM_DFC_CMD_FIFO_RANGE 48 |
1275 | #define IXGBE_RDMAM_DFC_CMD_FIFO_COUNT 7 | 1275 | #define IXGBE_RDMAM_DFC_CMD_FIFO_COUNT 7 |
1276 | #define IXGBE_RDMAM_TCN_STATUS_RAM_RANGE 256 | 1276 | #define IXGBE_RDMAM_TCN_STATUS_RAM_RANGE 256 |
1277 | #define IXGBE_RDMAM_TCN_STATUS_RAM_COUNT 9 | 1277 | #define IXGBE_RDMAM_TCN_STATUS_RAM_COUNT 9 |
1278 | #define IXGBE_RDMAM_WB_COLL_FIFO_RANGE 8 | 1278 | #define IXGBE_RDMAM_WB_COLL_FIFO_RANGE 8 |
1279 | #define IXGBE_RDMAM_WB_COLL_FIFO_COUNT 4 | 1279 | #define IXGBE_RDMAM_WB_COLL_FIFO_COUNT 4 |
1280 | #define IXGBE_RDMAM_QSC_CNT_RAM_RANGE 64 | 1280 | #define IXGBE_RDMAM_QSC_CNT_RAM_RANGE 64 |
1281 | #define IXGBE_RDMAM_QSC_CNT_RAM_COUNT 4 | 1281 | #define IXGBE_RDMAM_QSC_CNT_RAM_COUNT 4 |
1282 | #define IXGBE_RDMAM_QSC_QUEUE_CNT_RANGE 32 | 1282 | #define IXGBE_RDMAM_QSC_QUEUE_CNT_RANGE 32 |
1283 | #define IXGBE_RDMAM_QSC_QUEUE_CNT_COUNT 4 | 1283 | #define IXGBE_RDMAM_QSC_QUEUE_CNT_COUNT 4 |
1284 | #define IXGBE_RDMAM_QSC_QUEUE_RAM_RANGE 128 | 1284 | #define IXGBE_RDMAM_QSC_QUEUE_RAM_RANGE 128 |
1285 | #define IXGBE_RDMAM_QSC_QUEUE_RAM_COUNT 8 | 1285 | #define IXGBE_RDMAM_QSC_QUEUE_RAM_COUNT 8 |
1286 | 1286 | ||
1287 | #define IXGBE_TXDESCIC_READY 0x80000000 | 1287 | #define IXGBE_TXDESCIC_READY 0x80000000 |
1288 | 1288 | ||
1289 | /* Receive Checksum Control */ | 1289 | /* Receive Checksum Control */ |
1290 | #define IXGBE_RXCSUM_IPPCSE 0x00001000 /* IP payload checksum enable */ | 1290 | #define IXGBE_RXCSUM_IPPCSE 0x00001000 /* IP payload checksum enable */ |
1291 | #define IXGBE_RXCSUM_PCSD 0x00002000 /* packet checksum disabled */ | 1291 | #define IXGBE_RXCSUM_PCSD 0x00002000 /* packet checksum disabled */ |
1292 | 1292 | ||
1293 | /* FCRTL Bit Masks */ | 1293 | /* FCRTL Bit Masks */ |
1294 | #define IXGBE_FCRTL_XONE 0x80000000 /* XON enable */ | 1294 | #define IXGBE_FCRTL_XONE 0x80000000 /* XON enable */ |
1295 | #define IXGBE_FCRTH_FCEN 0x80000000 /* Packet buffer fc enable */ | 1295 | #define IXGBE_FCRTH_FCEN 0x80000000 /* Packet buffer fc enable */ |
1296 | 1296 | ||
1297 | /* PAP bit masks*/ | 1297 | /* PAP bit masks*/ |
1298 | #define IXGBE_PAP_TXPAUSECNT_MASK 0x0000FFFF /* Pause counter mask */ | 1298 | #define IXGBE_PAP_TXPAUSECNT_MASK 0x0000FFFF /* Pause counter mask */ |
1299 | 1299 | ||
1300 | /* RMCS Bit Masks */ | 1300 | /* RMCS Bit Masks */ |
1301 | #define IXGBE_RMCS_RRM 0x00000002 /* Receive Recycle Mode enable */ | 1301 | #define IXGBE_RMCS_RRM 0x00000002 /* Receive Recycle Mode enable */ |
1302 | /* Receive Arbitration Control: 0 Round Robin, 1 DFP */ | 1302 | /* Receive Arbitration Control: 0 Round Robin, 1 DFP */ |
1303 | #define IXGBE_RMCS_RAC 0x00000004 | 1303 | #define IXGBE_RMCS_RAC 0x00000004 |
1304 | #define IXGBE_RMCS_DFP IXGBE_RMCS_RAC /* Deficit Fixed Priority ena */ | 1304 | #define IXGBE_RMCS_DFP IXGBE_RMCS_RAC /* Deficit Fixed Priority ena */ |
1305 | #define IXGBE_RMCS_TFCE_802_3X 0x00000008 /* Tx Priority FC ena */ | 1305 | #define IXGBE_RMCS_TFCE_802_3X 0x00000008 /* Tx Priority FC ena */ |
1306 | #define IXGBE_RMCS_TFCE_PRIORITY 0x00000010 /* Tx Priority FC ena */ | 1306 | #define IXGBE_RMCS_TFCE_PRIORITY 0x00000010 /* Tx Priority FC ena */ |
1307 | #define IXGBE_RMCS_ARBDIS 0x00000040 /* Arbitration disable bit */ | 1307 | #define IXGBE_RMCS_ARBDIS 0x00000040 /* Arbitration disable bit */ |
1308 | 1308 | ||
1309 | /* FCCFG Bit Masks */ | 1309 | /* FCCFG Bit Masks */ |
1310 | #define IXGBE_FCCFG_TFCE_802_3X 0x00000008 /* Tx link FC enable */ | 1310 | #define IXGBE_FCCFG_TFCE_802_3X 0x00000008 /* Tx link FC enable */ |
1311 | #define IXGBE_FCCFG_TFCE_PRIORITY 0x00000010 /* Tx priority FC enable */ | 1311 | #define IXGBE_FCCFG_TFCE_PRIORITY 0x00000010 /* Tx priority FC enable */ |
1312 | 1312 | ||
1313 | /* Interrupt register bitmasks */ | 1313 | /* Interrupt register bitmasks */ |
1314 | 1314 | ||
1315 | /* Extended Interrupt Cause Read */ | 1315 | /* Extended Interrupt Cause Read */ |
1316 | #define IXGBE_EICR_RTX_QUEUE 0x0000FFFF /* RTx Queue Interrupt */ | 1316 | #define IXGBE_EICR_RTX_QUEUE 0x0000FFFF /* RTx Queue Interrupt */ |
1317 | #define IXGBE_EICR_FLOW_DIR 0x00010000 /* FDir Exception */ | 1317 | #define IXGBE_EICR_FLOW_DIR 0x00010000 /* FDir Exception */ |
1318 | #define IXGBE_EICR_RX_MISS 0x00020000 /* Packet Buffer Overrun */ | 1318 | #define IXGBE_EICR_RX_MISS 0x00020000 /* Packet Buffer Overrun */ |
1319 | #define IXGBE_EICR_PCI 0x00040000 /* PCI Exception */ | 1319 | #define IXGBE_EICR_PCI 0x00040000 /* PCI Exception */ |
1320 | #define IXGBE_EICR_MAILBOX 0x00080000 /* VF to PF Mailbox Interrupt */ | 1320 | #define IXGBE_EICR_MAILBOX 0x00080000 /* VF to PF Mailbox Interrupt */ |
1321 | #define IXGBE_EICR_LSC 0x00100000 /* Link Status Change */ | 1321 | #define IXGBE_EICR_LSC 0x00100000 /* Link Status Change */ |
1322 | #define IXGBE_EICR_LINKSEC 0x00200000 /* PN Threshold */ | 1322 | #define IXGBE_EICR_LINKSEC 0x00200000 /* PN Threshold */ |
1323 | #define IXGBE_EICR_MNG 0x00400000 /* Manageability Event Interrupt */ | 1323 | #define IXGBE_EICR_MNG 0x00400000 /* Manageability Event Interrupt */ |
1324 | #define IXGBE_EICR_TS 0x00800000 /* Thermal Sensor Event */ | 1324 | #define IXGBE_EICR_TS 0x00800000 /* Thermal Sensor Event */ |
1325 | #define IXGBE_EICR_TIMESYNC 0x01000000 /* Timesync Event */ | 1325 | #define IXGBE_EICR_TIMESYNC 0x01000000 /* Timesync Event */ |
1326 | #define IXGBE_EICR_GPI_SDP0 0x01000000 /* Gen Purpose Interrupt on SDP0 */ | 1326 | #define IXGBE_EICR_GPI_SDP0 0x01000000 /* Gen Purpose Interrupt on SDP0 */ |
1327 | #define IXGBE_EICR_GPI_SDP1 0x02000000 /* Gen Purpose Interrupt on SDP1 */ | 1327 | #define IXGBE_EICR_GPI_SDP1 0x02000000 /* Gen Purpose Interrupt on SDP1 */ |
1328 | #define IXGBE_EICR_GPI_SDP2 0x04000000 /* Gen Purpose Interrupt on SDP2 */ | 1328 | #define IXGBE_EICR_GPI_SDP2 0x04000000 /* Gen Purpose Interrupt on SDP2 */ |
1329 | #define IXGBE_EICR_ECC 0x10000000 /* ECC Error */ | 1329 | #define IXGBE_EICR_ECC 0x10000000 /* ECC Error */ |
1330 | #define IXGBE_EICR_PBUR 0x10000000 /* Packet Buffer Handler Error */ | 1330 | #define IXGBE_EICR_PBUR 0x10000000 /* Packet Buffer Handler Error */ |
1331 | #define IXGBE_EICR_DHER 0x20000000 /* Descriptor Handler Error */ | 1331 | #define IXGBE_EICR_DHER 0x20000000 /* Descriptor Handler Error */ |
1332 | #define IXGBE_EICR_TCP_TIMER 0x40000000 /* TCP Timer */ | 1332 | #define IXGBE_EICR_TCP_TIMER 0x40000000 /* TCP Timer */ |
1333 | #define IXGBE_EICR_OTHER 0x80000000 /* Interrupt Cause Active */ | 1333 | #define IXGBE_EICR_OTHER 0x80000000 /* Interrupt Cause Active */ |
1334 | 1334 | ||
1335 | /* Extended Interrupt Cause Set */ | 1335 | /* Extended Interrupt Cause Set */ |
1336 | #define IXGBE_EICS_RTX_QUEUE IXGBE_EICR_RTX_QUEUE /* RTx Queue Interrupt */ | 1336 | #define IXGBE_EICS_RTX_QUEUE IXGBE_EICR_RTX_QUEUE /* RTx Queue Interrupt */ |
1337 | #define IXGBE_EICS_FLOW_DIR IXGBE_EICR_FLOW_DIR /* FDir Exception */ | 1337 | #define IXGBE_EICS_FLOW_DIR IXGBE_EICR_FLOW_DIR /* FDir Exception */ |
1338 | #define IXGBE_EICS_RX_MISS IXGBE_EICR_RX_MISS /* Pkt Buffer Overrun */ | 1338 | #define IXGBE_EICS_RX_MISS IXGBE_EICR_RX_MISS /* Pkt Buffer Overrun */ |
1339 | #define IXGBE_EICS_PCI IXGBE_EICR_PCI /* PCI Exception */ | 1339 | #define IXGBE_EICS_PCI IXGBE_EICR_PCI /* PCI Exception */ |
1340 | #define IXGBE_EICS_MAILBOX IXGBE_EICR_MAILBOX /* VF to PF Mailbox Int */ | 1340 | #define IXGBE_EICS_MAILBOX IXGBE_EICR_MAILBOX /* VF to PF Mailbox Int */ |
1341 | #define IXGBE_EICS_LSC IXGBE_EICR_LSC /* Link Status Change */ | 1341 | #define IXGBE_EICS_LSC IXGBE_EICR_LSC /* Link Status Change */ |
1342 | #define IXGBE_EICS_MNG IXGBE_EICR_MNG /* MNG Event Interrupt */ | 1342 | #define IXGBE_EICS_MNG IXGBE_EICR_MNG /* MNG Event Interrupt */ |
1343 | #define IXGBE_EICS_TIMESYNC IXGBE_EICR_TIMESYNC /* Timesync Event */ | 1343 | #define IXGBE_EICS_TIMESYNC IXGBE_EICR_TIMESYNC /* Timesync Event */ |
1344 | #define IXGBE_EICS_GPI_SDP0 IXGBE_EICR_GPI_SDP0 /* SDP0 Gen Purpose Int */ | 1344 | #define IXGBE_EICS_GPI_SDP0 IXGBE_EICR_GPI_SDP0 /* SDP0 Gen Purpose Int */ |
1345 | #define IXGBE_EICS_GPI_SDP1 IXGBE_EICR_GPI_SDP1 /* SDP1 Gen Purpose Int */ | 1345 | #define IXGBE_EICS_GPI_SDP1 IXGBE_EICR_GPI_SDP1 /* SDP1 Gen Purpose Int */ |
1346 | #define IXGBE_EICS_GPI_SDP2 IXGBE_EICR_GPI_SDP2 /* SDP2 Gen Purpose Int */ | 1346 | #define IXGBE_EICS_GPI_SDP2 IXGBE_EICR_GPI_SDP2 /* SDP2 Gen Purpose Int */ |
1347 | #define IXGBE_EICS_ECC IXGBE_EICR_ECC /* ECC Error */ | 1347 | #define IXGBE_EICS_ECC IXGBE_EICR_ECC /* ECC Error */ |
1348 | #define IXGBE_EICS_PBUR IXGBE_EICR_PBUR /* Pkt Buf Handler Err */ | 1348 | #define IXGBE_EICS_PBUR IXGBE_EICR_PBUR /* Pkt Buf Handler Err */ |
1349 | #define IXGBE_EICS_DHER IXGBE_EICR_DHER /* Desc Handler Error */ | 1349 | #define IXGBE_EICS_DHER IXGBE_EICR_DHER /* Desc Handler Error */ |
1350 | #define IXGBE_EICS_TCP_TIMER IXGBE_EICR_TCP_TIMER /* TCP Timer */ | 1350 | #define IXGBE_EICS_TCP_TIMER IXGBE_EICR_TCP_TIMER /* TCP Timer */ |
1351 | #define IXGBE_EICS_OTHER IXGBE_EICR_OTHER /* INT Cause Active */ | 1351 | #define IXGBE_EICS_OTHER IXGBE_EICR_OTHER /* INT Cause Active */ |
1352 | 1352 | ||
1353 | /* Extended Interrupt Mask Set */ | 1353 | /* Extended Interrupt Mask Set */ |
1354 | #define IXGBE_EIMS_RTX_QUEUE IXGBE_EICR_RTX_QUEUE /* RTx Queue Interrupt */ | 1354 | #define IXGBE_EIMS_RTX_QUEUE IXGBE_EICR_RTX_QUEUE /* RTx Queue Interrupt */ |
1355 | #define IXGBE_EIMS_FLOW_DIR IXGBE_EICR_FLOW_DIR /* FDir Exception */ | 1355 | #define IXGBE_EIMS_FLOW_DIR IXGBE_EICR_FLOW_DIR /* FDir Exception */ |
1356 | #define IXGBE_EIMS_RX_MISS IXGBE_EICR_RX_MISS /* Packet Buffer Overrun */ | 1356 | #define IXGBE_EIMS_RX_MISS IXGBE_EICR_RX_MISS /* Packet Buffer Overrun */ |
1357 | #define IXGBE_EIMS_PCI IXGBE_EICR_PCI /* PCI Exception */ | 1357 | #define IXGBE_EIMS_PCI IXGBE_EICR_PCI /* PCI Exception */ |
1358 | #define IXGBE_EIMS_MAILBOX IXGBE_EICR_MAILBOX /* VF to PF Mailbox Int */ | 1358 | #define IXGBE_EIMS_MAILBOX IXGBE_EICR_MAILBOX /* VF to PF Mailbox Int */ |
1359 | #define IXGBE_EIMS_LSC IXGBE_EICR_LSC /* Link Status Change */ | 1359 | #define IXGBE_EIMS_LSC IXGBE_EICR_LSC /* Link Status Change */ |
1360 | #define IXGBE_EIMS_MNG IXGBE_EICR_MNG /* MNG Event Interrupt */ | 1360 | #define IXGBE_EIMS_MNG IXGBE_EICR_MNG /* MNG Event Interrupt */ |
1361 | #define IXGBE_EIMS_TS IXGBE_EICR_TS /* Thermel Sensor Event */ | 1361 | #define IXGBE_EIMS_TS IXGBE_EICR_TS /* Thermel Sensor Event */ |
1362 | #define IXGBE_EIMS_TIMESYNC IXGBE_EICR_TIMESYNC /* Timesync Event */ | 1362 | #define IXGBE_EIMS_TIMESYNC IXGBE_EICR_TIMESYNC /* Timesync Event */ |
1363 | #define IXGBE_EIMS_GPI_SDP0 IXGBE_EICR_GPI_SDP0 /* SDP0 Gen Purpose Int */ | 1363 | #define IXGBE_EIMS_GPI_SDP0 IXGBE_EICR_GPI_SDP0 /* SDP0 Gen Purpose Int */ |
1364 | #define IXGBE_EIMS_GPI_SDP1 IXGBE_EICR_GPI_SDP1 /* SDP1 Gen Purpose Int */ | 1364 | #define IXGBE_EIMS_GPI_SDP1 IXGBE_EICR_GPI_SDP1 /* SDP1 Gen Purpose Int */ |
1365 | #define IXGBE_EIMS_GPI_SDP2 IXGBE_EICR_GPI_SDP2 /* SDP2 Gen Purpose Int */ | 1365 | #define IXGBE_EIMS_GPI_SDP2 IXGBE_EICR_GPI_SDP2 /* SDP2 Gen Purpose Int */ |
1366 | #define IXGBE_EIMS_ECC IXGBE_EICR_ECC /* ECC Error */ | 1366 | #define IXGBE_EIMS_ECC IXGBE_EICR_ECC /* ECC Error */ |
1367 | #define IXGBE_EIMS_PBUR IXGBE_EICR_PBUR /* Pkt Buf Handler Err */ | 1367 | #define IXGBE_EIMS_PBUR IXGBE_EICR_PBUR /* Pkt Buf Handler Err */ |
1368 | #define IXGBE_EIMS_DHER IXGBE_EICR_DHER /* Descr Handler Error */ | 1368 | #define IXGBE_EIMS_DHER IXGBE_EICR_DHER /* Descr Handler Error */ |
1369 | #define IXGBE_EIMS_TCP_TIMER IXGBE_EICR_TCP_TIMER /* TCP Timer */ | 1369 | #define IXGBE_EIMS_TCP_TIMER IXGBE_EICR_TCP_TIMER /* TCP Timer */ |
1370 | #define IXGBE_EIMS_OTHER IXGBE_EICR_OTHER /* INT Cause Active */ | 1370 | #define IXGBE_EIMS_OTHER IXGBE_EICR_OTHER /* INT Cause Active */ |
1371 | 1371 | ||
1372 | /* Extended Interrupt Mask Clear */ | 1372 | /* Extended Interrupt Mask Clear */ |
1373 | #define IXGBE_EIMC_RTX_QUEUE IXGBE_EICR_RTX_QUEUE /* RTx Queue Interrupt */ | 1373 | #define IXGBE_EIMC_RTX_QUEUE IXGBE_EICR_RTX_QUEUE /* RTx Queue Interrupt */ |
1374 | #define IXGBE_EIMC_FLOW_DIR IXGBE_EICR_FLOW_DIR /* FDir Exception */ | 1374 | #define IXGBE_EIMC_FLOW_DIR IXGBE_EICR_FLOW_DIR /* FDir Exception */ |
1375 | #define IXGBE_EIMC_RX_MISS IXGBE_EICR_RX_MISS /* Packet Buffer Overrun */ | 1375 | #define IXGBE_EIMC_RX_MISS IXGBE_EICR_RX_MISS /* Packet Buffer Overrun */ |
1376 | #define IXGBE_EIMC_PCI IXGBE_EICR_PCI /* PCI Exception */ | 1376 | #define IXGBE_EIMC_PCI IXGBE_EICR_PCI /* PCI Exception */ |
1377 | #define IXGBE_EIMC_MAILBOX IXGBE_EICR_MAILBOX /* VF to PF Mailbox Int */ | 1377 | #define IXGBE_EIMC_MAILBOX IXGBE_EICR_MAILBOX /* VF to PF Mailbox Int */ |
1378 | #define IXGBE_EIMC_LSC IXGBE_EICR_LSC /* Link Status Change */ | 1378 | #define IXGBE_EIMC_LSC IXGBE_EICR_LSC /* Link Status Change */ |
1379 | #define IXGBE_EIMC_MNG IXGBE_EICR_MNG /* MNG Event Interrupt */ | 1379 | #define IXGBE_EIMC_MNG IXGBE_EICR_MNG /* MNG Event Interrupt */ |
1380 | #define IXGBE_EIMC_TIMESYNC IXGBE_EICR_TIMESYNC /* Timesync Event */ | 1380 | #define IXGBE_EIMC_TIMESYNC IXGBE_EICR_TIMESYNC /* Timesync Event */ |
1381 | #define IXGBE_EIMC_GPI_SDP0 IXGBE_EICR_GPI_SDP0 /* SDP0 Gen Purpose Int */ | 1381 | #define IXGBE_EIMC_GPI_SDP0 IXGBE_EICR_GPI_SDP0 /* SDP0 Gen Purpose Int */ |
1382 | #define IXGBE_EIMC_GPI_SDP1 IXGBE_EICR_GPI_SDP1 /* SDP1 Gen Purpose Int */ | 1382 | #define IXGBE_EIMC_GPI_SDP1 IXGBE_EICR_GPI_SDP1 /* SDP1 Gen Purpose Int */ |
1383 | #define IXGBE_EIMC_GPI_SDP2 IXGBE_EICR_GPI_SDP2 /* SDP2 Gen Purpose Int */ | 1383 | #define IXGBE_EIMC_GPI_SDP2 IXGBE_EICR_GPI_SDP2 /* SDP2 Gen Purpose Int */ |
1384 | #define IXGBE_EIMC_ECC IXGBE_EICR_ECC /* ECC Error */ | 1384 | #define IXGBE_EIMC_ECC IXGBE_EICR_ECC /* ECC Error */ |
1385 | #define IXGBE_EIMC_PBUR IXGBE_EICR_PBUR /* Pkt Buf Handler Err */ | 1385 | #define IXGBE_EIMC_PBUR IXGBE_EICR_PBUR /* Pkt Buf Handler Err */ |
1386 | #define IXGBE_EIMC_DHER IXGBE_EICR_DHER /* Desc Handler Err */ | 1386 | #define IXGBE_EIMC_DHER IXGBE_EICR_DHER /* Desc Handler Err */ |
1387 | #define IXGBE_EIMC_TCP_TIMER IXGBE_EICR_TCP_TIMER /* TCP Timer */ | 1387 | #define IXGBE_EIMC_TCP_TIMER IXGBE_EICR_TCP_TIMER /* TCP Timer */ |
1388 | #define IXGBE_EIMC_OTHER IXGBE_EICR_OTHER /* INT Cause Active */ | 1388 | #define IXGBE_EIMC_OTHER IXGBE_EICR_OTHER /* INT Cause Active */ |
1389 | 1389 | ||
1390 | #define IXGBE_EIMS_ENABLE_MASK ( \ | 1390 | #define IXGBE_EIMS_ENABLE_MASK ( \ |
1391 | IXGBE_EIMS_RTX_QUEUE | \ | 1391 | IXGBE_EIMS_RTX_QUEUE | \ |
1392 | IXGBE_EIMS_LSC | \ | 1392 | IXGBE_EIMS_LSC | \ |
1393 | IXGBE_EIMS_TCP_TIMER | \ | 1393 | IXGBE_EIMS_TCP_TIMER | \ |
1394 | IXGBE_EIMS_OTHER) | 1394 | IXGBE_EIMS_OTHER) |
1395 | 1395 | ||
1396 | /* Immediate Interrupt Rx (A.K.A. Low Latency Interrupt) */ | 1396 | /* Immediate Interrupt Rx (A.K.A. Low Latency Interrupt) */ |
1397 | #define IXGBE_IMIR_PORT_IM_EN 0x00010000 /* TCP port enable */ | 1397 | #define IXGBE_IMIR_PORT_IM_EN 0x00010000 /* TCP port enable */ |
1398 | #define IXGBE_IMIR_PORT_BP 0x00020000 /* TCP port check bypass */ | 1398 | #define IXGBE_IMIR_PORT_BP 0x00020000 /* TCP port check bypass */ |
1399 | #define IXGBE_IMIREXT_SIZE_BP 0x00001000 /* Packet size bypass */ | 1399 | #define IXGBE_IMIREXT_SIZE_BP 0x00001000 /* Packet size bypass */ |
1400 | #define IXGBE_IMIREXT_CTRL_URG 0x00002000 /* Check URG bit in header */ | 1400 | #define IXGBE_IMIREXT_CTRL_URG 0x00002000 /* Check URG bit in header */ |
1401 | #define IXGBE_IMIREXT_CTRL_ACK 0x00004000 /* Check ACK bit in header */ | 1401 | #define IXGBE_IMIREXT_CTRL_ACK 0x00004000 /* Check ACK bit in header */ |
1402 | #define IXGBE_IMIREXT_CTRL_PSH 0x00008000 /* Check PSH bit in header */ | 1402 | #define IXGBE_IMIREXT_CTRL_PSH 0x00008000 /* Check PSH bit in header */ |
1403 | #define IXGBE_IMIREXT_CTRL_RST 0x00010000 /* Check RST bit in header */ | 1403 | #define IXGBE_IMIREXT_CTRL_RST 0x00010000 /* Check RST bit in header */ |
1404 | #define IXGBE_IMIREXT_CTRL_SYN 0x00020000 /* Check SYN bit in header */ | 1404 | #define IXGBE_IMIREXT_CTRL_SYN 0x00020000 /* Check SYN bit in header */ |
1405 | #define IXGBE_IMIREXT_CTRL_FIN 0x00040000 /* Check FIN bit in header */ | 1405 | #define IXGBE_IMIREXT_CTRL_FIN 0x00040000 /* Check FIN bit in header */ |
1406 | #define IXGBE_IMIREXT_CTRL_BP 0x00080000 /* Bypass check of control bits */ | 1406 | #define IXGBE_IMIREXT_CTRL_BP 0x00080000 /* Bypass check of control bits */ |
1407 | #define IXGBE_IMIR_SIZE_BP_82599 0x00001000 /* Packet size bypass */ | 1407 | #define IXGBE_IMIR_SIZE_BP_82599 0x00001000 /* Packet size bypass */ |
1408 | #define IXGBE_IMIR_CTRL_URG_82599 0x00002000 /* Check URG bit in header */ | 1408 | #define IXGBE_IMIR_CTRL_URG_82599 0x00002000 /* Check URG bit in header */ |
1409 | #define IXGBE_IMIR_CTRL_ACK_82599 0x00004000 /* Check ACK bit in header */ | 1409 | #define IXGBE_IMIR_CTRL_ACK_82599 0x00004000 /* Check ACK bit in header */ |
1410 | #define IXGBE_IMIR_CTRL_PSH_82599 0x00008000 /* Check PSH bit in header */ | 1410 | #define IXGBE_IMIR_CTRL_PSH_82599 0x00008000 /* Check PSH bit in header */ |
1411 | #define IXGBE_IMIR_CTRL_RST_82599 0x00010000 /* Check RST bit in header */ | 1411 | #define IXGBE_IMIR_CTRL_RST_82599 0x00010000 /* Check RST bit in header */ |
1412 | #define IXGBE_IMIR_CTRL_SYN_82599 0x00020000 /* Check SYN bit in header */ | 1412 | #define IXGBE_IMIR_CTRL_SYN_82599 0x00020000 /* Check SYN bit in header */ |
1413 | #define IXGBE_IMIR_CTRL_FIN_82599 0x00040000 /* Check FIN bit in header */ | 1413 | #define IXGBE_IMIR_CTRL_FIN_82599 0x00040000 /* Check FIN bit in header */ |
1414 | #define IXGBE_IMIR_CTRL_BP_82599 0x00080000 /* Bypass check of control bits */ | 1414 | #define IXGBE_IMIR_CTRL_BP_82599 0x00080000 /* Bypass check of control bits */ |
1415 | #define IXGBE_IMIR_LLI_EN_82599 0x00100000 /* Enables low latency Int */ | 1415 | #define IXGBE_IMIR_LLI_EN_82599 0x00100000 /* Enables low latency Int */ |
1416 | #define IXGBE_IMIR_RX_QUEUE_MASK_82599 0x0000007F /* Rx Queue Mask */ | 1416 | #define IXGBE_IMIR_RX_QUEUE_MASK_82599 0x0000007F /* Rx Queue Mask */ |
1417 | #define IXGBE_IMIR_RX_QUEUE_SHIFT_82599 21 /* Rx Queue Shift */ | 1417 | #define IXGBE_IMIR_RX_QUEUE_SHIFT_82599 21 /* Rx Queue Shift */ |
1418 | #define IXGBE_IMIRVP_PRIORITY_MASK 0x00000007 /* VLAN priority mask */ | 1418 | #define IXGBE_IMIRVP_PRIORITY_MASK 0x00000007 /* VLAN priority mask */ |
1419 | #define IXGBE_IMIRVP_PRIORITY_EN 0x00000008 /* VLAN priority enable */ | 1419 | #define IXGBE_IMIRVP_PRIORITY_EN 0x00000008 /* VLAN priority enable */ |
1420 | 1420 | ||
1421 | #define IXGBE_MAX_FTQF_FILTERS 128 | 1421 | #define IXGBE_MAX_FTQF_FILTERS 128 |
1422 | #define IXGBE_FTQF_PROTOCOL_MASK 0x00000003 | 1422 | #define IXGBE_FTQF_PROTOCOL_MASK 0x00000003 |
1423 | #define IXGBE_FTQF_PROTOCOL_TCP 0x00000000 | 1423 | #define IXGBE_FTQF_PROTOCOL_TCP 0x00000000 |
1424 | #define IXGBE_FTQF_PROTOCOL_UDP 0x00000001 | 1424 | #define IXGBE_FTQF_PROTOCOL_UDP 0x00000001 |
1425 | #define IXGBE_FTQF_PROTOCOL_SCTP 2 | 1425 | #define IXGBE_FTQF_PROTOCOL_SCTP 2 |
1426 | #define IXGBE_FTQF_PRIORITY_MASK 0x00000007 | 1426 | #define IXGBE_FTQF_PRIORITY_MASK 0x00000007 |
1427 | #define IXGBE_FTQF_PRIORITY_SHIFT 2 | 1427 | #define IXGBE_FTQF_PRIORITY_SHIFT 2 |
1428 | #define IXGBE_FTQF_POOL_MASK 0x0000003F | 1428 | #define IXGBE_FTQF_POOL_MASK 0x0000003F |
1429 | #define IXGBE_FTQF_POOL_SHIFT 8 | 1429 | #define IXGBE_FTQF_POOL_SHIFT 8 |
1430 | #define IXGBE_FTQF_5TUPLE_MASK_MASK 0x0000001F | 1430 | #define IXGBE_FTQF_5TUPLE_MASK_MASK 0x0000001F |
1431 | #define IXGBE_FTQF_5TUPLE_MASK_SHIFT 25 | 1431 | #define IXGBE_FTQF_5TUPLE_MASK_SHIFT 25 |
1432 | #define IXGBE_FTQF_SOURCE_ADDR_MASK 0x1E | 1432 | #define IXGBE_FTQF_SOURCE_ADDR_MASK 0x1E |
1433 | #define IXGBE_FTQF_DEST_ADDR_MASK 0x1D | 1433 | #define IXGBE_FTQF_DEST_ADDR_MASK 0x1D |
1434 | #define IXGBE_FTQF_SOURCE_PORT_MASK 0x1B | 1434 | #define IXGBE_FTQF_SOURCE_PORT_MASK 0x1B |
1435 | #define IXGBE_FTQF_DEST_PORT_MASK 0x17 | 1435 | #define IXGBE_FTQF_DEST_PORT_MASK 0x17 |
1436 | #define IXGBE_FTQF_PROTOCOL_COMP_MASK 0x0F | 1436 | #define IXGBE_FTQF_PROTOCOL_COMP_MASK 0x0F |
1437 | #define IXGBE_FTQF_POOL_MASK_EN 0x40000000 | 1437 | #define IXGBE_FTQF_POOL_MASK_EN 0x40000000 |
1438 | #define IXGBE_FTQF_QUEUE_ENABLE 0x80000000 | 1438 | #define IXGBE_FTQF_QUEUE_ENABLE 0x80000000 |
1439 | 1439 | ||
1440 | /* Interrupt clear mask */ | 1440 | /* Interrupt clear mask */ |
1441 | #define IXGBE_IRQ_CLEAR_MASK 0xFFFFFFFF | 1441 | #define IXGBE_IRQ_CLEAR_MASK 0xFFFFFFFF |
1442 | 1442 | ||
1443 | /* Interrupt Vector Allocation Registers */ | 1443 | /* Interrupt Vector Allocation Registers */ |
1444 | #define IXGBE_IVAR_REG_NUM 25 | 1444 | #define IXGBE_IVAR_REG_NUM 25 |
1445 | #define IXGBE_IVAR_REG_NUM_82599 64 | 1445 | #define IXGBE_IVAR_REG_NUM_82599 64 |
1446 | #define IXGBE_IVAR_TXRX_ENTRY 96 | 1446 | #define IXGBE_IVAR_TXRX_ENTRY 96 |
1447 | #define IXGBE_IVAR_RX_ENTRY 64 | 1447 | #define IXGBE_IVAR_RX_ENTRY 64 |
1448 | #define IXGBE_IVAR_RX_QUEUE(_i) (0 + (_i)) | 1448 | #define IXGBE_IVAR_RX_QUEUE(_i) (0 + (_i)) |
1449 | #define IXGBE_IVAR_TX_QUEUE(_i) (64 + (_i)) | 1449 | #define IXGBE_IVAR_TX_QUEUE(_i) (64 + (_i)) |
1450 | #define IXGBE_IVAR_TX_ENTRY 32 | 1450 | #define IXGBE_IVAR_TX_ENTRY 32 |
1451 | 1451 | ||
1452 | #define IXGBE_IVAR_TCP_TIMER_INDEX 96 /* 0 based index */ | 1452 | #define IXGBE_IVAR_TCP_TIMER_INDEX 96 /* 0 based index */ |
1453 | #define IXGBE_IVAR_OTHER_CAUSES_INDEX 97 /* 0 based index */ | 1453 | #define IXGBE_IVAR_OTHER_CAUSES_INDEX 97 /* 0 based index */ |
1454 | 1454 | ||
1455 | #define IXGBE_MSIX_VECTOR(_i) (0 + (_i)) | 1455 | #define IXGBE_MSIX_VECTOR(_i) (0 + (_i)) |
1456 | 1456 | ||
1457 | #define IXGBE_IVAR_ALLOC_VAL 0x80 /* Interrupt Allocation valid */ | 1457 | #define IXGBE_IVAR_ALLOC_VAL 0x80 /* Interrupt Allocation valid */ |
1458 | 1458 | ||
1459 | /* ETYPE Queue Filter/Select Bit Masks */ | 1459 | /* ETYPE Queue Filter/Select Bit Masks */ |
1460 | #define IXGBE_MAX_ETQF_FILTERS 8 | 1460 | #define IXGBE_MAX_ETQF_FILTERS 8 |
1461 | #define IXGBE_ETQF_FCOE 0x08000000 /* bit 27 */ | 1461 | #define IXGBE_ETQF_FCOE 0x08000000 /* bit 27 */ |
1462 | #define IXGBE_ETQF_BCN 0x10000000 /* bit 28 */ | 1462 | #define IXGBE_ETQF_BCN 0x10000000 /* bit 28 */ |
1463 | #define IXGBE_ETQF_1588 0x40000000 /* bit 30 */ | 1463 | #define IXGBE_ETQF_1588 0x40000000 /* bit 30 */ |
1464 | #define IXGBE_ETQF_FILTER_EN 0x80000000 /* bit 31 */ | 1464 | #define IXGBE_ETQF_FILTER_EN 0x80000000 /* bit 31 */ |
1465 | #define IXGBE_ETQF_POOL_ENABLE (1 << 26) /* bit 26 */ | 1465 | #define IXGBE_ETQF_POOL_ENABLE (1 << 26) /* bit 26 */ |
1466 | #define IXGBE_ETQF_POOL_SHIFT 20 | 1466 | #define IXGBE_ETQF_POOL_SHIFT 20 |
1467 | 1467 | ||
1468 | #define IXGBE_ETQS_RX_QUEUE 0x007F0000 /* bits 22:16 */ | 1468 | #define IXGBE_ETQS_RX_QUEUE 0x007F0000 /* bits 22:16 */ |
1469 | #define IXGBE_ETQS_RX_QUEUE_SHIFT 16 | 1469 | #define IXGBE_ETQS_RX_QUEUE_SHIFT 16 |
1470 | #define IXGBE_ETQS_LLI 0x20000000 /* bit 29 */ | 1470 | #define IXGBE_ETQS_LLI 0x20000000 /* bit 29 */ |
1471 | #define IXGBE_ETQS_QUEUE_EN 0x80000000 /* bit 31 */ | 1471 | #define IXGBE_ETQS_QUEUE_EN 0x80000000 /* bit 31 */ |
1472 | 1472 | ||
1473 | /* | 1473 | /* |
1474 | * ETQF filter list: one static filter per filter consumer. This is | 1474 | * ETQF filter list: one static filter per filter consumer. This is |
1475 | * to avoid filter collisions later. Add new filters | 1475 | * to avoid filter collisions later. Add new filters |
1476 | * here!! | 1476 | * here!! |
1477 | * | 1477 | * |
1478 | * Current filters: | 1478 | * Current filters: |
1479 | * EAPOL 802.1x (0x888e): Filter 0 | 1479 | * EAPOL 802.1x (0x888e): Filter 0 |
1480 | * FCoE (0x8906): Filter 2 | 1480 | * FCoE (0x8906): Filter 2 |
1481 | * 1588 (0x88f7): Filter 3 | 1481 | * 1588 (0x88f7): Filter 3 |
1482 | * FIP (0x8914): Filter 4 | 1482 | * FIP (0x8914): Filter 4 |
1483 | */ | 1483 | */ |
1484 | #define IXGBE_ETQF_FILTER_EAPOL 0 | 1484 | #define IXGBE_ETQF_FILTER_EAPOL 0 |
1485 | #define IXGBE_ETQF_FILTER_FCOE 2 | 1485 | #define IXGBE_ETQF_FILTER_FCOE 2 |
1486 | #define IXGBE_ETQF_FILTER_1588 3 | 1486 | #define IXGBE_ETQF_FILTER_1588 3 |
1487 | #define IXGBE_ETQF_FILTER_FIP 4 | 1487 | #define IXGBE_ETQF_FILTER_FIP 4 |
1488 | /* VLAN Control Bit Masks */ | 1488 | /* VLAN Control Bit Masks */ |
1489 | #define IXGBE_VLNCTRL_VET 0x0000FFFF /* bits 0-15 */ | 1489 | #define IXGBE_VLNCTRL_VET 0x0000FFFF /* bits 0-15 */ |
1490 | #define IXGBE_VLNCTRL_CFI 0x10000000 /* bit 28 */ | 1490 | #define IXGBE_VLNCTRL_CFI 0x10000000 /* bit 28 */ |
1491 | #define IXGBE_VLNCTRL_CFIEN 0x20000000 /* bit 29 */ | 1491 | #define IXGBE_VLNCTRL_CFIEN 0x20000000 /* bit 29 */ |
1492 | #define IXGBE_VLNCTRL_VFE 0x40000000 /* bit 30 */ | 1492 | #define IXGBE_VLNCTRL_VFE 0x40000000 /* bit 30 */ |
1493 | #define IXGBE_VLNCTRL_VME 0x80000000 /* bit 31 */ | 1493 | #define IXGBE_VLNCTRL_VME 0x80000000 /* bit 31 */ |
1494 | 1494 | ||
1495 | /* VLAN pool filtering masks */ | 1495 | /* VLAN pool filtering masks */ |
1496 | #define IXGBE_VLVF_VIEN 0x80000000 /* filter is valid */ | 1496 | #define IXGBE_VLVF_VIEN 0x80000000 /* filter is valid */ |
1497 | #define IXGBE_VLVF_ENTRIES 64 | 1497 | #define IXGBE_VLVF_ENTRIES 64 |
1498 | #define IXGBE_VLVF_VLANID_MASK 0x00000FFF | 1498 | #define IXGBE_VLVF_VLANID_MASK 0x00000FFF |
1499 | 1499 | ||
1500 | /* Per VF Port VLAN insertion rules */ | 1500 | /* Per VF Port VLAN insertion rules */ |
1501 | #define IXGBE_VMVIR_VLANA_DEFAULT 0x40000000 /* Always use default VLAN */ | 1501 | #define IXGBE_VMVIR_VLANA_DEFAULT 0x40000000 /* Always use default VLAN */ |
1502 | #define IXGBE_VMVIR_VLANA_NEVER 0x80000000 /* Never insert VLAN tag */ | 1502 | #define IXGBE_VMVIR_VLANA_NEVER 0x80000000 /* Never insert VLAN tag */ |
1503 | 1503 | ||
1504 | #define IXGBE_ETHERNET_IEEE_VLAN_TYPE 0x8100 /* 802.1q protocol */ | 1504 | #define IXGBE_ETHERNET_IEEE_VLAN_TYPE 0x8100 /* 802.1q protocol */ |
1505 | 1505 | ||
1506 | /* STATUS Bit Masks */ | 1506 | /* STATUS Bit Masks */ |
1507 | #define IXGBE_STATUS_LAN_ID 0x0000000C /* LAN ID */ | 1507 | #define IXGBE_STATUS_LAN_ID 0x0000000C /* LAN ID */ |
1508 | #define IXGBE_STATUS_LAN_ID_SHIFT 2 /* LAN ID Shift*/ | 1508 | #define IXGBE_STATUS_LAN_ID_SHIFT 2 /* LAN ID Shift*/ |
1509 | #define IXGBE_STATUS_GIO 0x00080000 /* GIO Master Enable Status */ | 1509 | #define IXGBE_STATUS_GIO 0x00080000 /* GIO Master Enable Status */ |
1510 | 1510 | ||
1511 | #define IXGBE_STATUS_LAN_ID_0 0x00000000 /* LAN ID 0 */ | 1511 | #define IXGBE_STATUS_LAN_ID_0 0x00000000 /* LAN ID 0 */ |
1512 | #define IXGBE_STATUS_LAN_ID_1 0x00000004 /* LAN ID 1 */ | 1512 | #define IXGBE_STATUS_LAN_ID_1 0x00000004 /* LAN ID 1 */ |
1513 | 1513 | ||
1514 | /* ESDP Bit Masks */ | 1514 | /* ESDP Bit Masks */ |
1515 | #define IXGBE_ESDP_SDP0 0x00000001 /* SDP0 Data Value */ | 1515 | #define IXGBE_ESDP_SDP0 0x00000001 /* SDP0 Data Value */ |
1516 | #define IXGBE_ESDP_SDP1 0x00000002 /* SDP1 Data Value */ | 1516 | #define IXGBE_ESDP_SDP1 0x00000002 /* SDP1 Data Value */ |
1517 | #define IXGBE_ESDP_SDP2 0x00000004 /* SDP2 Data Value */ | 1517 | #define IXGBE_ESDP_SDP2 0x00000004 /* SDP2 Data Value */ |
1518 | #define IXGBE_ESDP_SDP3 0x00000008 /* SDP3 Data Value */ | 1518 | #define IXGBE_ESDP_SDP3 0x00000008 /* SDP3 Data Value */ |
1519 | #define IXGBE_ESDP_SDP4 0x00000010 /* SDP4 Data Value */ | 1519 | #define IXGBE_ESDP_SDP4 0x00000010 /* SDP4 Data Value */ |
1520 | #define IXGBE_ESDP_SDP5 0x00000020 /* SDP5 Data Value */ | 1520 | #define IXGBE_ESDP_SDP5 0x00000020 /* SDP5 Data Value */ |
1521 | #define IXGBE_ESDP_SDP6 0x00000040 /* SDP6 Data Value */ | 1521 | #define IXGBE_ESDP_SDP6 0x00000040 /* SDP6 Data Value */ |
1522 | #define IXGBE_ESDP_SDP0_DIR 0x00000100 /* SDP0 IO direction */ | 1522 | #define IXGBE_ESDP_SDP0_DIR 0x00000100 /* SDP0 IO direction */ |
1523 | #define IXGBE_ESDP_SDP4_DIR 0x00000004 /* SDP4 IO direction */ | 1523 | #define IXGBE_ESDP_SDP4_DIR 0x00000004 /* SDP4 IO direction */ |
1524 | #define IXGBE_ESDP_SDP5_DIR 0x00002000 /* SDP5 IO direction */ | 1524 | #define IXGBE_ESDP_SDP5_DIR 0x00002000 /* SDP5 IO direction */ |
1525 | #define IXGBE_ESDP_SDP0_NATIVE 0x00010000 /* SDP0 Native Function */ | 1525 | #define IXGBE_ESDP_SDP0_NATIVE 0x00010000 /* SDP0 Native Function */ |
1526 | 1526 | ||
1527 | /* LEDCTL Bit Masks */ | 1527 | /* LEDCTL Bit Masks */ |
1528 | #define IXGBE_LED_IVRT_BASE 0x00000040 | 1528 | #define IXGBE_LED_IVRT_BASE 0x00000040 |
1529 | #define IXGBE_LED_BLINK_BASE 0x00000080 | 1529 | #define IXGBE_LED_BLINK_BASE 0x00000080 |
1530 | #define IXGBE_LED_MODE_MASK_BASE 0x0000000F | 1530 | #define IXGBE_LED_MODE_MASK_BASE 0x0000000F |
1531 | #define IXGBE_LED_OFFSET(_base, _i) (_base << (8 * (_i))) | 1531 | #define IXGBE_LED_OFFSET(_base, _i) (_base << (8 * (_i))) |
1532 | #define IXGBE_LED_MODE_SHIFT(_i) (8 * (_i)) | 1532 | #define IXGBE_LED_MODE_SHIFT(_i) (8 * (_i)) |
1533 | #define IXGBE_LED_IVRT(_i) IXGBE_LED_OFFSET(IXGBE_LED_IVRT_BASE, _i) | 1533 | #define IXGBE_LED_IVRT(_i) IXGBE_LED_OFFSET(IXGBE_LED_IVRT_BASE, _i) |
1534 | #define IXGBE_LED_BLINK(_i) IXGBE_LED_OFFSET(IXGBE_LED_BLINK_BASE, _i) | 1534 | #define IXGBE_LED_BLINK(_i) IXGBE_LED_OFFSET(IXGBE_LED_BLINK_BASE, _i) |
1535 | #define IXGBE_LED_MODE_MASK(_i) IXGBE_LED_OFFSET(IXGBE_LED_MODE_MASK_BASE, _i) | 1535 | #define IXGBE_LED_MODE_MASK(_i) IXGBE_LED_OFFSET(IXGBE_LED_MODE_MASK_BASE, _i) |
1536 | 1536 | ||
1537 | /* LED modes */ | 1537 | /* LED modes */ |
1538 | #define IXGBE_LED_LINK_UP 0x0 | 1538 | #define IXGBE_LED_LINK_UP 0x0 |
1539 | #define IXGBE_LED_LINK_10G 0x1 | 1539 | #define IXGBE_LED_LINK_10G 0x1 |
1540 | #define IXGBE_LED_MAC 0x2 | 1540 | #define IXGBE_LED_MAC 0x2 |
1541 | #define IXGBE_LED_FILTER 0x3 | 1541 | #define IXGBE_LED_FILTER 0x3 |
1542 | #define IXGBE_LED_LINK_ACTIVE 0x4 | 1542 | #define IXGBE_LED_LINK_ACTIVE 0x4 |
1543 | #define IXGBE_LED_LINK_1G 0x5 | 1543 | #define IXGBE_LED_LINK_1G 0x5 |
1544 | #define IXGBE_LED_ON 0xE | 1544 | #define IXGBE_LED_ON 0xE |
1545 | #define IXGBE_LED_OFF 0xF | 1545 | #define IXGBE_LED_OFF 0xF |
1546 | 1546 | ||
1547 | /* AUTOC Bit Masks */ | 1547 | /* AUTOC Bit Masks */ |
1548 | #define IXGBE_AUTOC_KX4_KX_SUPP_MASK 0xC0000000 | 1548 | #define IXGBE_AUTOC_KX4_KX_SUPP_MASK 0xC0000000 |
1549 | #define IXGBE_AUTOC_KX4_SUPP 0x80000000 | 1549 | #define IXGBE_AUTOC_KX4_SUPP 0x80000000 |
1550 | #define IXGBE_AUTOC_KX_SUPP 0x40000000 | 1550 | #define IXGBE_AUTOC_KX_SUPP 0x40000000 |
1551 | #define IXGBE_AUTOC_PAUSE 0x30000000 | 1551 | #define IXGBE_AUTOC_PAUSE 0x30000000 |
1552 | #define IXGBE_AUTOC_ASM_PAUSE 0x20000000 | 1552 | #define IXGBE_AUTOC_ASM_PAUSE 0x20000000 |
1553 | #define IXGBE_AUTOC_SYM_PAUSE 0x10000000 | 1553 | #define IXGBE_AUTOC_SYM_PAUSE 0x10000000 |
1554 | #define IXGBE_AUTOC_RF 0x08000000 | 1554 | #define IXGBE_AUTOC_RF 0x08000000 |
1555 | #define IXGBE_AUTOC_PD_TMR 0x06000000 | 1555 | #define IXGBE_AUTOC_PD_TMR 0x06000000 |
1556 | #define IXGBE_AUTOC_AN_RX_LOOSE 0x01000000 | 1556 | #define IXGBE_AUTOC_AN_RX_LOOSE 0x01000000 |
1557 | #define IXGBE_AUTOC_AN_RX_DRIFT 0x00800000 | 1557 | #define IXGBE_AUTOC_AN_RX_DRIFT 0x00800000 |
1558 | #define IXGBE_AUTOC_AN_RX_ALIGN 0x007C0000 | 1558 | #define IXGBE_AUTOC_AN_RX_ALIGN 0x007C0000 |
1559 | #define IXGBE_AUTOC_FECA 0x00040000 | 1559 | #define IXGBE_AUTOC_FECA 0x00040000 |
1560 | #define IXGBE_AUTOC_FECR 0x00020000 | 1560 | #define IXGBE_AUTOC_FECR 0x00020000 |
1561 | #define IXGBE_AUTOC_KR_SUPP 0x00010000 | 1561 | #define IXGBE_AUTOC_KR_SUPP 0x00010000 |
1562 | #define IXGBE_AUTOC_AN_RESTART 0x00001000 | 1562 | #define IXGBE_AUTOC_AN_RESTART 0x00001000 |
1563 | #define IXGBE_AUTOC_FLU 0x00000001 | 1563 | #define IXGBE_AUTOC_FLU 0x00000001 |
1564 | #define IXGBE_AUTOC_LMS_SHIFT 13 | 1564 | #define IXGBE_AUTOC_LMS_SHIFT 13 |
1565 | #define IXGBE_AUTOC_LMS_10G_SERIAL (0x3 << IXGBE_AUTOC_LMS_SHIFT) | 1565 | #define IXGBE_AUTOC_LMS_10G_SERIAL (0x3 << IXGBE_AUTOC_LMS_SHIFT) |
1566 | #define IXGBE_AUTOC_LMS_KX4_KX_KR (0x4 << IXGBE_AUTOC_LMS_SHIFT) | 1566 | #define IXGBE_AUTOC_LMS_KX4_KX_KR (0x4 << IXGBE_AUTOC_LMS_SHIFT) |
1567 | #define IXGBE_AUTOC_LMS_SGMII_1G_100M (0x5 << IXGBE_AUTOC_LMS_SHIFT) | 1567 | #define IXGBE_AUTOC_LMS_SGMII_1G_100M (0x5 << IXGBE_AUTOC_LMS_SHIFT) |
1568 | #define IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN (0x6 << IXGBE_AUTOC_LMS_SHIFT) | 1568 | #define IXGBE_AUTOC_LMS_KX4_KX_KR_1G_AN (0x6 << IXGBE_AUTOC_LMS_SHIFT) |
1569 | #define IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII (0x7 << IXGBE_AUTOC_LMS_SHIFT) | 1569 | #define IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII (0x7 << IXGBE_AUTOC_LMS_SHIFT) |
1570 | #define IXGBE_AUTOC_LMS_MASK (0x7 << IXGBE_AUTOC_LMS_SHIFT) | 1570 | #define IXGBE_AUTOC_LMS_MASK (0x7 << IXGBE_AUTOC_LMS_SHIFT) |
1571 | #define IXGBE_AUTOC_LMS_1G_LINK_NO_AN (0x0 << IXGBE_AUTOC_LMS_SHIFT) | 1571 | #define IXGBE_AUTOC_LMS_1G_LINK_NO_AN (0x0 << IXGBE_AUTOC_LMS_SHIFT) |
1572 | #define IXGBE_AUTOC_LMS_10G_LINK_NO_AN (0x1 << IXGBE_AUTOC_LMS_SHIFT) | 1572 | #define IXGBE_AUTOC_LMS_10G_LINK_NO_AN (0x1 << IXGBE_AUTOC_LMS_SHIFT) |
1573 | #define IXGBE_AUTOC_LMS_1G_AN (0x2 << IXGBE_AUTOC_LMS_SHIFT) | 1573 | #define IXGBE_AUTOC_LMS_1G_AN (0x2 << IXGBE_AUTOC_LMS_SHIFT) |
1574 | #define IXGBE_AUTOC_LMS_KX4_AN (0x4 << IXGBE_AUTOC_LMS_SHIFT) | 1574 | #define IXGBE_AUTOC_LMS_KX4_AN (0x4 << IXGBE_AUTOC_LMS_SHIFT) |
1575 | #define IXGBE_AUTOC_LMS_KX4_AN_1G_AN (0x6 << IXGBE_AUTOC_LMS_SHIFT) | 1575 | #define IXGBE_AUTOC_LMS_KX4_AN_1G_AN (0x6 << IXGBE_AUTOC_LMS_SHIFT) |
1576 | #define IXGBE_AUTOC_LMS_ATTACH_TYPE (0x7 << IXGBE_AUTOC_10G_PMA_PMD_SHIFT) | 1576 | #define IXGBE_AUTOC_LMS_ATTACH_TYPE (0x7 << IXGBE_AUTOC_10G_PMA_PMD_SHIFT) |
1577 | 1577 | ||
1578 | #define IXGBE_AUTOC_1G_PMA_PMD_MASK 0x00000200 | 1578 | #define IXGBE_AUTOC_1G_PMA_PMD_MASK 0x00000200 |
1579 | #define IXGBE_AUTOC_1G_PMA_PMD_SHIFT 9 | 1579 | #define IXGBE_AUTOC_1G_PMA_PMD_SHIFT 9 |
1580 | #define IXGBE_AUTOC_10G_PMA_PMD_MASK 0x00000180 | 1580 | #define IXGBE_AUTOC_10G_PMA_PMD_MASK 0x00000180 |
1581 | #define IXGBE_AUTOC_10G_PMA_PMD_SHIFT 7 | 1581 | #define IXGBE_AUTOC_10G_PMA_PMD_SHIFT 7 |
1582 | #define IXGBE_AUTOC_10G_XAUI (0x0 << IXGBE_AUTOC_10G_PMA_PMD_SHIFT) | 1582 | #define IXGBE_AUTOC_10G_XAUI (0x0 << IXGBE_AUTOC_10G_PMA_PMD_SHIFT) |
1583 | #define IXGBE_AUTOC_10G_KX4 (0x1 << IXGBE_AUTOC_10G_PMA_PMD_SHIFT) | 1583 | #define IXGBE_AUTOC_10G_KX4 (0x1 << IXGBE_AUTOC_10G_PMA_PMD_SHIFT) |
1584 | #define IXGBE_AUTOC_10G_CX4 (0x2 << IXGBE_AUTOC_10G_PMA_PMD_SHIFT) | 1584 | #define IXGBE_AUTOC_10G_CX4 (0x2 << IXGBE_AUTOC_10G_PMA_PMD_SHIFT) |
1585 | #define IXGBE_AUTOC_1G_BX (0x0 << IXGBE_AUTOC_1G_PMA_PMD_SHIFT) | 1585 | #define IXGBE_AUTOC_1G_BX (0x0 << IXGBE_AUTOC_1G_PMA_PMD_SHIFT) |
1586 | #define IXGBE_AUTOC_1G_KX (0x1 << IXGBE_AUTOC_1G_PMA_PMD_SHIFT) | 1586 | #define IXGBE_AUTOC_1G_KX (0x1 << IXGBE_AUTOC_1G_PMA_PMD_SHIFT) |
1587 | #define IXGBE_AUTOC_1G_SFI (0x0 << IXGBE_AUTOC_1G_PMA_PMD_SHIFT) | 1587 | #define IXGBE_AUTOC_1G_SFI (0x0 << IXGBE_AUTOC_1G_PMA_PMD_SHIFT) |
1588 | #define IXGBE_AUTOC_1G_KX_BX (0x1 << IXGBE_AUTOC_1G_PMA_PMD_SHIFT) | 1588 | #define IXGBE_AUTOC_1G_KX_BX (0x1 << IXGBE_AUTOC_1G_PMA_PMD_SHIFT) |
1589 | 1589 | ||
1590 | #define IXGBE_AUTOC2_UPPER_MASK 0xFFFF0000 | 1590 | #define IXGBE_AUTOC2_UPPER_MASK 0xFFFF0000 |
1591 | #define IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_MASK 0x00030000 | 1591 | #define IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_MASK 0x00030000 |
1592 | #define IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_SHIFT 16 | 1592 | #define IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_SHIFT 16 |
1593 | #define IXGBE_AUTOC2_10G_KR (0x0 << IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_SHIFT) | 1593 | #define IXGBE_AUTOC2_10G_KR (0x0 << IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_SHIFT) |
1594 | #define IXGBE_AUTOC2_10G_XFI (0x1 << IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_SHIFT) | 1594 | #define IXGBE_AUTOC2_10G_XFI (0x1 << IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_SHIFT) |
1595 | #define IXGBE_AUTOC2_10G_SFI (0x2 << IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_SHIFT) | 1595 | #define IXGBE_AUTOC2_10G_SFI (0x2 << IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_SHIFT) |
1596 | #define IXGBE_AUTOC2_LINK_DISABLE_MASK 0x70000000 | 1596 | #define IXGBE_AUTOC2_LINK_DISABLE_MASK 0x70000000 |
1597 | 1597 | ||
1598 | #define IXGBE_MACC_FLU 0x00000001 | 1598 | #define IXGBE_MACC_FLU 0x00000001 |
1599 | #define IXGBE_MACC_FSV_10G 0x00030000 | 1599 | #define IXGBE_MACC_FSV_10G 0x00030000 |
1600 | #define IXGBE_MACC_FS 0x00040000 | 1600 | #define IXGBE_MACC_FS 0x00040000 |
1601 | #define IXGBE_MAC_RX2TX_LPBK 0x00000002 | 1601 | #define IXGBE_MAC_RX2TX_LPBK 0x00000002 |
1602 | 1602 | ||
1603 | /* LINKS Bit Masks */ | 1603 | /* LINKS Bit Masks */ |
1604 | #define IXGBE_LINKS_KX_AN_COMP 0x80000000 | 1604 | #define IXGBE_LINKS_KX_AN_COMP 0x80000000 |
1605 | #define IXGBE_LINKS_UP 0x40000000 | 1605 | #define IXGBE_LINKS_UP 0x40000000 |
1606 | #define IXGBE_LINKS_SPEED 0x20000000 | 1606 | #define IXGBE_LINKS_SPEED 0x20000000 |
1607 | #define IXGBE_LINKS_MODE 0x18000000 | 1607 | #define IXGBE_LINKS_MODE 0x18000000 |
1608 | #define IXGBE_LINKS_RX_MODE 0x06000000 | 1608 | #define IXGBE_LINKS_RX_MODE 0x06000000 |
1609 | #define IXGBE_LINKS_TX_MODE 0x01800000 | 1609 | #define IXGBE_LINKS_TX_MODE 0x01800000 |
1610 | #define IXGBE_LINKS_XGXS_EN 0x00400000 | 1610 | #define IXGBE_LINKS_XGXS_EN 0x00400000 |
1611 | #define IXGBE_LINKS_SGMII_EN 0x02000000 | 1611 | #define IXGBE_LINKS_SGMII_EN 0x02000000 |
1612 | #define IXGBE_LINKS_PCS_1G_EN 0x00200000 | 1612 | #define IXGBE_LINKS_PCS_1G_EN 0x00200000 |
1613 | #define IXGBE_LINKS_1G_AN_EN 0x00100000 | 1613 | #define IXGBE_LINKS_1G_AN_EN 0x00100000 |
1614 | #define IXGBE_LINKS_KX_AN_IDLE 0x00080000 | 1614 | #define IXGBE_LINKS_KX_AN_IDLE 0x00080000 |
1615 | #define IXGBE_LINKS_1G_SYNC 0x00040000 | 1615 | #define IXGBE_LINKS_1G_SYNC 0x00040000 |
1616 | #define IXGBE_LINKS_10G_ALIGN 0x00020000 | 1616 | #define IXGBE_LINKS_10G_ALIGN 0x00020000 |
1617 | #define IXGBE_LINKS_10G_LANE_SYNC 0x00017000 | 1617 | #define IXGBE_LINKS_10G_LANE_SYNC 0x00017000 |
1618 | #define IXGBE_LINKS_TL_FAULT 0x00001000 | 1618 | #define IXGBE_LINKS_TL_FAULT 0x00001000 |
1619 | #define IXGBE_LINKS_SIGNAL 0x00000F00 | 1619 | #define IXGBE_LINKS_SIGNAL 0x00000F00 |
1620 | 1620 | ||
1621 | #define IXGBE_LINKS_SPEED_82599 0x30000000 | 1621 | #define IXGBE_LINKS_SPEED_82599 0x30000000 |
1622 | #define IXGBE_LINKS_SPEED_10G_82599 0x30000000 | 1622 | #define IXGBE_LINKS_SPEED_10G_82599 0x30000000 |
1623 | #define IXGBE_LINKS_SPEED_1G_82599 0x20000000 | 1623 | #define IXGBE_LINKS_SPEED_1G_82599 0x20000000 |
1624 | #define IXGBE_LINKS_SPEED_100_82599 0x10000000 | 1624 | #define IXGBE_LINKS_SPEED_100_82599 0x10000000 |
1625 | #define IXGBE_LINK_UP_TIME 90 /* 9.0 Seconds */ | 1625 | #define IXGBE_LINK_UP_TIME 90 /* 9.0 Seconds */ |
1626 | #define IXGBE_AUTO_NEG_TIME 45 /* 4.5 Seconds */ | 1626 | #define IXGBE_AUTO_NEG_TIME 45 /* 4.5 Seconds */ |
1627 | 1627 | ||
1628 | #define IXGBE_LINKS2_AN_SUPPORTED 0x00000040 | 1628 | #define IXGBE_LINKS2_AN_SUPPORTED 0x00000040 |
1629 | 1629 | ||
1630 | /* PCS1GLSTA Bit Masks */ | 1630 | /* PCS1GLSTA Bit Masks */ |
1631 | #define IXGBE_PCS1GLSTA_LINK_OK 1 | 1631 | #define IXGBE_PCS1GLSTA_LINK_OK 1 |
1632 | #define IXGBE_PCS1GLSTA_SYNK_OK 0x10 | 1632 | #define IXGBE_PCS1GLSTA_SYNK_OK 0x10 |
1633 | #define IXGBE_PCS1GLSTA_AN_COMPLETE 0x10000 | 1633 | #define IXGBE_PCS1GLSTA_AN_COMPLETE 0x10000 |
1634 | #define IXGBE_PCS1GLSTA_AN_PAGE_RX 0x20000 | 1634 | #define IXGBE_PCS1GLSTA_AN_PAGE_RX 0x20000 |
1635 | #define IXGBE_PCS1GLSTA_AN_TIMED_OUT 0x40000 | 1635 | #define IXGBE_PCS1GLSTA_AN_TIMED_OUT 0x40000 |
1636 | #define IXGBE_PCS1GLSTA_AN_REMOTE_FAULT 0x80000 | 1636 | #define IXGBE_PCS1GLSTA_AN_REMOTE_FAULT 0x80000 |
1637 | #define IXGBE_PCS1GLSTA_AN_ERROR_RWS 0x100000 | 1637 | #define IXGBE_PCS1GLSTA_AN_ERROR_RWS 0x100000 |
1638 | 1638 | ||
1639 | #define IXGBE_PCS1GANA_SYM_PAUSE 0x80 | 1639 | #define IXGBE_PCS1GANA_SYM_PAUSE 0x80 |
1640 | #define IXGBE_PCS1GANA_ASM_PAUSE 0x100 | 1640 | #define IXGBE_PCS1GANA_ASM_PAUSE 0x100 |
1641 | 1641 | ||
1642 | /* PCS1GLCTL Bit Masks */ | 1642 | /* PCS1GLCTL Bit Masks */ |
1643 | #define IXGBE_PCS1GLCTL_AN_1G_TIMEOUT_EN 0x00040000 /* PCS 1G autoneg to en */ | 1643 | #define IXGBE_PCS1GLCTL_AN_1G_TIMEOUT_EN 0x00040000 /* PCS 1G autoneg to en */ |
1644 | #define IXGBE_PCS1GLCTL_FLV_LINK_UP 1 | 1644 | #define IXGBE_PCS1GLCTL_FLV_LINK_UP 1 |
1645 | #define IXGBE_PCS1GLCTL_FORCE_LINK 0x20 | 1645 | #define IXGBE_PCS1GLCTL_FORCE_LINK 0x20 |
1646 | #define IXGBE_PCS1GLCTL_LOW_LINK_LATCH 0x40 | 1646 | #define IXGBE_PCS1GLCTL_LOW_LINK_LATCH 0x40 |
1647 | #define IXGBE_PCS1GLCTL_AN_ENABLE 0x10000 | 1647 | #define IXGBE_PCS1GLCTL_AN_ENABLE 0x10000 |
1648 | #define IXGBE_PCS1GLCTL_AN_RESTART 0x20000 | 1648 | #define IXGBE_PCS1GLCTL_AN_RESTART 0x20000 |
1649 | 1649 | ||
1650 | /* ANLP1 Bit Masks */ | 1650 | /* ANLP1 Bit Masks */ |
1651 | #define IXGBE_ANLP1_PAUSE 0x0C00 | 1651 | #define IXGBE_ANLP1_PAUSE 0x0C00 |
1652 | #define IXGBE_ANLP1_SYM_PAUSE 0x0400 | 1652 | #define IXGBE_ANLP1_SYM_PAUSE 0x0400 |
1653 | #define IXGBE_ANLP1_ASM_PAUSE 0x0800 | 1653 | #define IXGBE_ANLP1_ASM_PAUSE 0x0800 |
1654 | #define IXGBE_ANLP1_AN_STATE_MASK 0x000f0000 | 1654 | #define IXGBE_ANLP1_AN_STATE_MASK 0x000f0000 |
1655 | 1655 | ||
1656 | /* SW Semaphore Register bitmasks */ | 1656 | /* SW Semaphore Register bitmasks */ |
1657 | #define IXGBE_SWSM_SMBI 0x00000001 /* Driver Semaphore bit */ | 1657 | #define IXGBE_SWSM_SMBI 0x00000001 /* Driver Semaphore bit */ |
1658 | #define IXGBE_SWSM_SWESMBI 0x00000002 /* FW Semaphore bit */ | 1658 | #define IXGBE_SWSM_SWESMBI 0x00000002 /* FW Semaphore bit */ |
1659 | #define IXGBE_SWSM_WMNG 0x00000004 /* Wake MNG Clock */ | 1659 | #define IXGBE_SWSM_WMNG 0x00000004 /* Wake MNG Clock */ |
1660 | #define IXGBE_SWFW_REGSMP 0x80000000 /* Register Semaphore bit 31 */ | 1660 | #define IXGBE_SWFW_REGSMP 0x80000000 /* Register Semaphore bit 31 */ |
1661 | 1661 | ||
1662 | /* SW_FW_SYNC/GSSR definitions */ | 1662 | /* SW_FW_SYNC/GSSR definitions */ |
1663 | #define IXGBE_GSSR_EEP_SM 0x0001 | 1663 | #define IXGBE_GSSR_EEP_SM 0x0001 |
1664 | #define IXGBE_GSSR_PHY0_SM 0x0002 | 1664 | #define IXGBE_GSSR_PHY0_SM 0x0002 |
1665 | #define IXGBE_GSSR_PHY1_SM 0x0004 | 1665 | #define IXGBE_GSSR_PHY1_SM 0x0004 |
1666 | #define IXGBE_GSSR_MAC_CSR_SM 0x0008 | 1666 | #define IXGBE_GSSR_MAC_CSR_SM 0x0008 |
1667 | #define IXGBE_GSSR_FLASH_SM 0x0010 | 1667 | #define IXGBE_GSSR_FLASH_SM 0x0010 |
1668 | #define IXGBE_GSSR_SW_MNG_SM 0x0400 | 1668 | #define IXGBE_GSSR_SW_MNG_SM 0x0400 |
1669 | 1669 | ||
1670 | /* FW Status register bitmask */ | 1670 | /* FW Status register bitmask */ |
1671 | #define IXGBE_FWSTS_FWRI 0x00000200 /* Firmware Reset Indication */ | 1671 | #define IXGBE_FWSTS_FWRI 0x00000200 /* Firmware Reset Indication */ |
1672 | 1672 | ||
1673 | /* EEC Register */ | 1673 | /* EEC Register */ |
1674 | #define IXGBE_EEC_SK 0x00000001 /* EEPROM Clock */ | 1674 | #define IXGBE_EEC_SK 0x00000001 /* EEPROM Clock */ |
1675 | #define IXGBE_EEC_CS 0x00000002 /* EEPROM Chip Select */ | 1675 | #define IXGBE_EEC_CS 0x00000002 /* EEPROM Chip Select */ |
1676 | #define IXGBE_EEC_DI 0x00000004 /* EEPROM Data In */ | 1676 | #define IXGBE_EEC_DI 0x00000004 /* EEPROM Data In */ |
1677 | #define IXGBE_EEC_DO 0x00000008 /* EEPROM Data Out */ | 1677 | #define IXGBE_EEC_DO 0x00000008 /* EEPROM Data Out */ |
1678 | #define IXGBE_EEC_FWE_MASK 0x00000030 /* FLASH Write Enable */ | 1678 | #define IXGBE_EEC_FWE_MASK 0x00000030 /* FLASH Write Enable */ |
1679 | #define IXGBE_EEC_FWE_DIS 0x00000010 /* Disable FLASH writes */ | 1679 | #define IXGBE_EEC_FWE_DIS 0x00000010 /* Disable FLASH writes */ |
1680 | #define IXGBE_EEC_FWE_EN 0x00000020 /* Enable FLASH writes */ | 1680 | #define IXGBE_EEC_FWE_EN 0x00000020 /* Enable FLASH writes */ |
1681 | #define IXGBE_EEC_FWE_SHIFT 4 | 1681 | #define IXGBE_EEC_FWE_SHIFT 4 |
1682 | #define IXGBE_EEC_REQ 0x00000040 /* EEPROM Access Request */ | 1682 | #define IXGBE_EEC_REQ 0x00000040 /* EEPROM Access Request */ |
1683 | #define IXGBE_EEC_GNT 0x00000080 /* EEPROM Access Grant */ | 1683 | #define IXGBE_EEC_GNT 0x00000080 /* EEPROM Access Grant */ |
1684 | #define IXGBE_EEC_PRES 0x00000100 /* EEPROM Present */ | 1684 | #define IXGBE_EEC_PRES 0x00000100 /* EEPROM Present */ |
1685 | #define IXGBE_EEC_ARD 0x00000200 /* EEPROM Auto Read Done */ | 1685 | #define IXGBE_EEC_ARD 0x00000200 /* EEPROM Auto Read Done */ |
1686 | #define IXGBE_EEC_FLUP 0x00800000 /* Flash update command */ | 1686 | #define IXGBE_EEC_FLUP 0x00800000 /* Flash update command */ |
1687 | #define IXGBE_EEC_SEC1VAL 0x02000000 /* Sector 1 Valid */ | 1687 | #define IXGBE_EEC_SEC1VAL 0x02000000 /* Sector 1 Valid */ |
1688 | #define IXGBE_EEC_FLUDONE 0x04000000 /* Flash update done */ | 1688 | #define IXGBE_EEC_FLUDONE 0x04000000 /* Flash update done */ |
1689 | /* EEPROM Addressing bits based on type (0-small, 1-large) */ | 1689 | /* EEPROM Addressing bits based on type (0-small, 1-large) */ |
1690 | #define IXGBE_EEC_ADDR_SIZE 0x00000400 | 1690 | #define IXGBE_EEC_ADDR_SIZE 0x00000400 |
1691 | #define IXGBE_EEC_SIZE 0x00007800 /* EEPROM Size */ | 1691 | #define IXGBE_EEC_SIZE 0x00007800 /* EEPROM Size */ |
1692 | #define IXGBE_EERD_MAX_ADDR 0x00003FFF /* EERD alows 14 bits for addr. */ | 1692 | #define IXGBE_EERD_MAX_ADDR 0x00003FFF /* EERD alows 14 bits for addr. */ |
1693 | 1693 | ||
1694 | #define IXGBE_EEC_SIZE_SHIFT 11 | 1694 | #define IXGBE_EEC_SIZE_SHIFT 11 |
1695 | #define IXGBE_EEPROM_WORD_SIZE_SHIFT 6 | 1695 | #define IXGBE_EEPROM_WORD_SIZE_SHIFT 6 |
1696 | #define IXGBE_EEPROM_OPCODE_BITS 8 | 1696 | #define IXGBE_EEPROM_OPCODE_BITS 8 |
1697 | 1697 | ||
1698 | /* Part Number String Length */ | 1698 | /* Part Number String Length */ |
1699 | #define IXGBE_PBANUM_LENGTH 11 | 1699 | #define IXGBE_PBANUM_LENGTH 11 |
1700 | 1700 | ||
1701 | /* Checksum and EEPROM pointers */ | 1701 | /* Checksum and EEPROM pointers */ |
1702 | #define IXGBE_PBANUM_PTR_GUARD 0xFAFA | 1702 | #define IXGBE_PBANUM_PTR_GUARD 0xFAFA |
1703 | #define IXGBE_EEPROM_CHECKSUM 0x3F | 1703 | #define IXGBE_EEPROM_CHECKSUM 0x3F |
1704 | #define IXGBE_EEPROM_SUM 0xBABA | 1704 | #define IXGBE_EEPROM_SUM 0xBABA |
1705 | #define IXGBE_PCIE_ANALOG_PTR 0x03 | 1705 | #define IXGBE_PCIE_ANALOG_PTR 0x03 |
1706 | #define IXGBE_ATLAS0_CONFIG_PTR 0x04 | 1706 | #define IXGBE_ATLAS0_CONFIG_PTR 0x04 |
1707 | #define IXGBE_PHY_PTR 0x04 | 1707 | #define IXGBE_PHY_PTR 0x04 |
1708 | #define IXGBE_ATLAS1_CONFIG_PTR 0x05 | 1708 | #define IXGBE_ATLAS1_CONFIG_PTR 0x05 |
1709 | #define IXGBE_OPTION_ROM_PTR 0x05 | 1709 | #define IXGBE_OPTION_ROM_PTR 0x05 |
1710 | #define IXGBE_PCIE_GENERAL_PTR 0x06 | 1710 | #define IXGBE_PCIE_GENERAL_PTR 0x06 |
1711 | #define IXGBE_PCIE_CONFIG0_PTR 0x07 | 1711 | #define IXGBE_PCIE_CONFIG0_PTR 0x07 |
1712 | #define IXGBE_PCIE_CONFIG1_PTR 0x08 | 1712 | #define IXGBE_PCIE_CONFIG1_PTR 0x08 |
1713 | #define IXGBE_CORE0_PTR 0x09 | 1713 | #define IXGBE_CORE0_PTR 0x09 |
1714 | #define IXGBE_CORE1_PTR 0x0A | 1714 | #define IXGBE_CORE1_PTR 0x0A |
1715 | #define IXGBE_MAC0_PTR 0x0B | 1715 | #define IXGBE_MAC0_PTR 0x0B |
1716 | #define IXGBE_MAC1_PTR 0x0C | 1716 | #define IXGBE_MAC1_PTR 0x0C |
1717 | #define IXGBE_CSR0_CONFIG_PTR 0x0D | 1717 | #define IXGBE_CSR0_CONFIG_PTR 0x0D |
1718 | #define IXGBE_CSR1_CONFIG_PTR 0x0E | 1718 | #define IXGBE_CSR1_CONFIG_PTR 0x0E |
1719 | #define IXGBE_FW_PTR 0x0F | 1719 | #define IXGBE_FW_PTR 0x0F |
1720 | #define IXGBE_PBANUM0_PTR 0x15 | 1720 | #define IXGBE_PBANUM0_PTR 0x15 |
1721 | #define IXGBE_PBANUM1_PTR 0x16 | 1721 | #define IXGBE_PBANUM1_PTR 0x16 |
1722 | #define IXGBE_FREE_SPACE_PTR 0X3E | 1722 | #define IXGBE_FREE_SPACE_PTR 0X3E |
1723 | 1723 | ||
1724 | /* External Thermal Sensor Config */ | 1724 | /* External Thermal Sensor Config */ |
1725 | #define IXGBE_ETS_CFG 0x26 | 1725 | #define IXGBE_ETS_CFG 0x26 |
1726 | #define IXGBE_ETS_LTHRES_DELTA_MASK 0x07C0 | 1726 | #define IXGBE_ETS_LTHRES_DELTA_MASK 0x07C0 |
1727 | #define IXGBE_ETS_LTHRES_DELTA_SHIFT 6 | 1727 | #define IXGBE_ETS_LTHRES_DELTA_SHIFT 6 |
1728 | #define IXGBE_ETS_TYPE_MASK 0x0038 | 1728 | #define IXGBE_ETS_TYPE_MASK 0x0038 |
1729 | #define IXGBE_ETS_TYPE_SHIFT 3 | 1729 | #define IXGBE_ETS_TYPE_SHIFT 3 |
1730 | #define IXGBE_ETS_TYPE_EMC 0x000 | 1730 | #define IXGBE_ETS_TYPE_EMC 0x000 |
1731 | #define IXGBE_ETS_TYPE_EMC_SHIFTED 0x000 | 1731 | #define IXGBE_ETS_TYPE_EMC_SHIFTED 0x000 |
1732 | #define IXGBE_ETS_NUM_SENSORS_MASK 0x0007 | 1732 | #define IXGBE_ETS_NUM_SENSORS_MASK 0x0007 |
1733 | #define IXGBE_ETS_DATA_LOC_MASK 0x3C00 | 1733 | #define IXGBE_ETS_DATA_LOC_MASK 0x3C00 |
1734 | #define IXGBE_ETS_DATA_LOC_SHIFT 10 | 1734 | #define IXGBE_ETS_DATA_LOC_SHIFT 10 |
1735 | #define IXGBE_ETS_DATA_INDEX_MASK 0x0300 | 1735 | #define IXGBE_ETS_DATA_INDEX_MASK 0x0300 |
1736 | #define IXGBE_ETS_DATA_INDEX_SHIFT 8 | 1736 | #define IXGBE_ETS_DATA_INDEX_SHIFT 8 |
1737 | #define IXGBE_ETS_DATA_HTHRESH_MASK 0x00FF | 1737 | #define IXGBE_ETS_DATA_HTHRESH_MASK 0x00FF |
1738 | 1738 | ||
1739 | #define IXGBE_SAN_MAC_ADDR_PTR 0x28 | 1739 | #define IXGBE_SAN_MAC_ADDR_PTR 0x28 |
1740 | #define IXGBE_DEVICE_CAPS 0x2C | 1740 | #define IXGBE_DEVICE_CAPS 0x2C |
1741 | #define IXGBE_SERIAL_NUMBER_MAC_ADDR 0x11 | 1741 | #define IXGBE_SERIAL_NUMBER_MAC_ADDR 0x11 |
1742 | #define IXGBE_PCIE_MSIX_82599_CAPS 0x72 | 1742 | #define IXGBE_PCIE_MSIX_82599_CAPS 0x72 |
1743 | #define IXGBE_MAX_MSIX_VECTORS_82599 0x40 | 1743 | #define IXGBE_MAX_MSIX_VECTORS_82599 0x40 |
1744 | #define IXGBE_PCIE_MSIX_82598_CAPS 0x62 | 1744 | #define IXGBE_PCIE_MSIX_82598_CAPS 0x62 |
1745 | #define IXGBE_MAX_MSIX_VECTORS_82598 0x13 | 1745 | #define IXGBE_MAX_MSIX_VECTORS_82598 0x13 |
1746 | 1746 | ||
1747 | /* MSI-X capability fields masks */ | 1747 | /* MSI-X capability fields masks */ |
1748 | #define IXGBE_PCIE_MSIX_TBL_SZ_MASK 0x7FF | 1748 | #define IXGBE_PCIE_MSIX_TBL_SZ_MASK 0x7FF |
1749 | 1749 | ||
1750 | /* Legacy EEPROM word offsets */ | 1750 | /* Legacy EEPROM word offsets */ |
1751 | #define IXGBE_ISCSI_BOOT_CAPS 0x0033 | 1751 | #define IXGBE_ISCSI_BOOT_CAPS 0x0033 |
1752 | #define IXGBE_ISCSI_SETUP_PORT_0 0x0030 | 1752 | #define IXGBE_ISCSI_SETUP_PORT_0 0x0030 |
1753 | #define IXGBE_ISCSI_SETUP_PORT_1 0x0034 | 1753 | #define IXGBE_ISCSI_SETUP_PORT_1 0x0034 |
1754 | 1754 | ||
1755 | /* EEPROM Commands - SPI */ | 1755 | /* EEPROM Commands - SPI */ |
1756 | #define IXGBE_EEPROM_MAX_RETRY_SPI 5000 /* Max wait 5ms for RDY signal */ | 1756 | #define IXGBE_EEPROM_MAX_RETRY_SPI 5000 /* Max wait 5ms for RDY signal */ |
1757 | #define IXGBE_EEPROM_STATUS_RDY_SPI 0x01 | 1757 | #define IXGBE_EEPROM_STATUS_RDY_SPI 0x01 |
1758 | #define IXGBE_EEPROM_READ_OPCODE_SPI 0x03 /* EEPROM read opcode */ | 1758 | #define IXGBE_EEPROM_READ_OPCODE_SPI 0x03 /* EEPROM read opcode */ |
1759 | #define IXGBE_EEPROM_WRITE_OPCODE_SPI 0x02 /* EEPROM write opcode */ | 1759 | #define IXGBE_EEPROM_WRITE_OPCODE_SPI 0x02 /* EEPROM write opcode */ |
1760 | #define IXGBE_EEPROM_A8_OPCODE_SPI 0x08 /* opcode bit-3 = addr bit-8 */ | 1760 | #define IXGBE_EEPROM_A8_OPCODE_SPI 0x08 /* opcode bit-3 = addr bit-8 */ |
1761 | #define IXGBE_EEPROM_WREN_OPCODE_SPI 0x06 /* EEPROM set Write Ena latch */ | 1761 | #define IXGBE_EEPROM_WREN_OPCODE_SPI 0x06 /* EEPROM set Write Ena latch */ |
1762 | /* EEPROM reset Write Enable latch */ | 1762 | /* EEPROM reset Write Enable latch */ |
1763 | #define IXGBE_EEPROM_WRDI_OPCODE_SPI 0x04 | 1763 | #define IXGBE_EEPROM_WRDI_OPCODE_SPI 0x04 |
1764 | #define IXGBE_EEPROM_RDSR_OPCODE_SPI 0x05 /* EEPROM read Status reg */ | 1764 | #define IXGBE_EEPROM_RDSR_OPCODE_SPI 0x05 /* EEPROM read Status reg */ |
1765 | #define IXGBE_EEPROM_WRSR_OPCODE_SPI 0x01 /* EEPROM write Status reg */ | 1765 | #define IXGBE_EEPROM_WRSR_OPCODE_SPI 0x01 /* EEPROM write Status reg */ |
1766 | #define IXGBE_EEPROM_ERASE4K_OPCODE_SPI 0x20 /* EEPROM ERASE 4KB */ | 1766 | #define IXGBE_EEPROM_ERASE4K_OPCODE_SPI 0x20 /* EEPROM ERASE 4KB */ |
1767 | #define IXGBE_EEPROM_ERASE64K_OPCODE_SPI 0xD8 /* EEPROM ERASE 64KB */ | 1767 | #define IXGBE_EEPROM_ERASE64K_OPCODE_SPI 0xD8 /* EEPROM ERASE 64KB */ |
1768 | #define IXGBE_EEPROM_ERASE256_OPCODE_SPI 0xDB /* EEPROM ERASE 256B */ | 1768 | #define IXGBE_EEPROM_ERASE256_OPCODE_SPI 0xDB /* EEPROM ERASE 256B */ |
1769 | 1769 | ||
1770 | /* EEPROM Read Register */ | 1770 | /* EEPROM Read Register */ |
1771 | #define IXGBE_EEPROM_RW_REG_DATA 16 /* data offset in EEPROM read reg */ | 1771 | #define IXGBE_EEPROM_RW_REG_DATA 16 /* data offset in EEPROM read reg */ |
1772 | #define IXGBE_EEPROM_RW_REG_DONE 2 /* Offset to READ done bit */ | 1772 | #define IXGBE_EEPROM_RW_REG_DONE 2 /* Offset to READ done bit */ |
1773 | #define IXGBE_EEPROM_RW_REG_START 1 /* First bit to start operation */ | 1773 | #define IXGBE_EEPROM_RW_REG_START 1 /* First bit to start operation */ |
1774 | #define IXGBE_EEPROM_RW_ADDR_SHIFT 2 /* Shift to the address bits */ | 1774 | #define IXGBE_EEPROM_RW_ADDR_SHIFT 2 /* Shift to the address bits */ |
1775 | #define IXGBE_NVM_POLL_WRITE 1 /* Flag for polling for write complete */ | 1775 | #define IXGBE_NVM_POLL_WRITE 1 /* Flag for polling for write complete */ |
1776 | #define IXGBE_NVM_POLL_READ 0 /* Flag for polling for read complete */ | 1776 | #define IXGBE_NVM_POLL_READ 0 /* Flag for polling for read complete */ |
1777 | 1777 | ||
1778 | #define IXGBE_EEPROM_PAGE_SIZE_MAX 128 | 1778 | #define IXGBE_EEPROM_PAGE_SIZE_MAX 128 |
1779 | #define IXGBE_EEPROM_RD_BUFFER_MAX_COUNT 512 /* EEPROM words # read in burst */ | 1779 | #define IXGBE_EEPROM_RD_BUFFER_MAX_COUNT 512 /* EEPROM words # read in burst */ |
1780 | #define IXGBE_EEPROM_WR_BUFFER_MAX_COUNT 256 /* EEPROM words # wr in burst */ | 1780 | #define IXGBE_EEPROM_WR_BUFFER_MAX_COUNT 256 /* EEPROM words # wr in burst */ |
1781 | 1781 | ||
1782 | #ifndef IXGBE_EEPROM_GRANT_ATTEMPTS | 1782 | #ifndef IXGBE_EEPROM_GRANT_ATTEMPTS |
1783 | #define IXGBE_EEPROM_GRANT_ATTEMPTS 1000 /* EEPROM # attempts to gain grant */ | 1783 | #define IXGBE_EEPROM_GRANT_ATTEMPTS 1000 /* EEPROM # attempts to gain grant */ |
1784 | #endif | 1784 | #endif |
1785 | 1785 | ||
1786 | #ifndef IXGBE_EERD_EEWR_ATTEMPTS | 1786 | #ifndef IXGBE_EERD_EEWR_ATTEMPTS |
1787 | /* Number of 5 microseconds we wait for EERD read and | 1787 | /* Number of 5 microseconds we wait for EERD read and |
1788 | * EERW write to complete */ | 1788 | * EERW write to complete */ |
1789 | #define IXGBE_EERD_EEWR_ATTEMPTS 100000 | 1789 | #define IXGBE_EERD_EEWR_ATTEMPTS 100000 |
1790 | #endif | 1790 | #endif |
1791 | 1791 | ||
1792 | #ifndef IXGBE_FLUDONE_ATTEMPTS | 1792 | #ifndef IXGBE_FLUDONE_ATTEMPTS |
1793 | /* # attempts we wait for flush update to complete */ | 1793 | /* # attempts we wait for flush update to complete */ |
1794 | #define IXGBE_FLUDONE_ATTEMPTS 20000 | 1794 | #define IXGBE_FLUDONE_ATTEMPTS 20000 |
1795 | #endif | 1795 | #endif |
1796 | 1796 | ||
1797 | #define IXGBE_PCIE_CTRL2 0x5 /* PCIe Control 2 Offset */ | 1797 | #define IXGBE_PCIE_CTRL2 0x5 /* PCIe Control 2 Offset */ |
1798 | #define IXGBE_PCIE_CTRL2_DUMMY_ENABLE 0x8 /* Dummy Function Enable */ | 1798 | #define IXGBE_PCIE_CTRL2_DUMMY_ENABLE 0x8 /* Dummy Function Enable */ |
1799 | #define IXGBE_PCIE_CTRL2_LAN_DISABLE 0x2 /* LAN PCI Disable */ | 1799 | #define IXGBE_PCIE_CTRL2_LAN_DISABLE 0x2 /* LAN PCI Disable */ |
1800 | #define IXGBE_PCIE_CTRL2_DISABLE_SELECT 0x1 /* LAN Disable Select */ | 1800 | #define IXGBE_PCIE_CTRL2_DISABLE_SELECT 0x1 /* LAN Disable Select */ |
1801 | 1801 | ||
1802 | #define IXGBE_SAN_MAC_ADDR_PORT0_OFFSET 0x0 | 1802 | #define IXGBE_SAN_MAC_ADDR_PORT0_OFFSET 0x0 |
1803 | #define IXGBE_SAN_MAC_ADDR_PORT1_OFFSET 0x3 | 1803 | #define IXGBE_SAN_MAC_ADDR_PORT1_OFFSET 0x3 |
1804 | #define IXGBE_DEVICE_CAPS_ALLOW_ANY_SFP 0x1 | 1804 | #define IXGBE_DEVICE_CAPS_ALLOW_ANY_SFP 0x1 |
1805 | #define IXGBE_DEVICE_CAPS_FCOE_OFFLOADS 0x2 | 1805 | #define IXGBE_DEVICE_CAPS_FCOE_OFFLOADS 0x2 |
1806 | #define IXGBE_FW_LESM_PARAMETERS_PTR 0x2 | 1806 | #define IXGBE_FW_LESM_PARAMETERS_PTR 0x2 |
1807 | #define IXGBE_FW_LESM_STATE_1 0x1 | 1807 | #define IXGBE_FW_LESM_STATE_1 0x1 |
1808 | #define IXGBE_FW_LESM_STATE_ENABLED 0x8000 /* LESM Enable bit */ | 1808 | #define IXGBE_FW_LESM_STATE_ENABLED 0x8000 /* LESM Enable bit */ |
1809 | #define IXGBE_FW_PASSTHROUGH_PATCH_CONFIG_PTR 0x4 | 1809 | #define IXGBE_FW_PASSTHROUGH_PATCH_CONFIG_PTR 0x4 |
1810 | #define IXGBE_FW_PATCH_VERSION_4 0x7 | 1810 | #define IXGBE_FW_PATCH_VERSION_4 0x7 |
1811 | #define IXGBE_FCOE_IBA_CAPS_BLK_PTR 0x33 /* iSCSI/FCOE block */ | 1811 | #define IXGBE_FCOE_IBA_CAPS_BLK_PTR 0x33 /* iSCSI/FCOE block */ |
1812 | #define IXGBE_FCOE_IBA_CAPS_FCOE 0x20 /* FCOE flags */ | 1812 | #define IXGBE_FCOE_IBA_CAPS_FCOE 0x20 /* FCOE flags */ |
1813 | #define IXGBE_ISCSI_FCOE_BLK_PTR 0x17 /* iSCSI/FCOE block */ | 1813 | #define IXGBE_ISCSI_FCOE_BLK_PTR 0x17 /* iSCSI/FCOE block */ |
1814 | #define IXGBE_ISCSI_FCOE_FLAGS_OFFSET 0x0 /* FCOE flags */ | 1814 | #define IXGBE_ISCSI_FCOE_FLAGS_OFFSET 0x0 /* FCOE flags */ |
1815 | #define IXGBE_ISCSI_FCOE_FLAGS_ENABLE 0x1 /* FCOE flags enable bit */ | 1815 | #define IXGBE_ISCSI_FCOE_FLAGS_ENABLE 0x1 /* FCOE flags enable bit */ |
1816 | #define IXGBE_ALT_SAN_MAC_ADDR_BLK_PTR 0x27 /* Alt. SAN MAC block */ | 1816 | #define IXGBE_ALT_SAN_MAC_ADDR_BLK_PTR 0x27 /* Alt. SAN MAC block */ |
1817 | #define IXGBE_ALT_SAN_MAC_ADDR_CAPS_OFFSET 0x0 /* Alt. SAN MAC capability */ | 1817 | #define IXGBE_ALT_SAN_MAC_ADDR_CAPS_OFFSET 0x0 /* Alt. SAN MAC capability */ |
1818 | #define IXGBE_ALT_SAN_MAC_ADDR_PORT0_OFFSET 0x1 /* Alt. SAN MAC 0 offset */ | 1818 | #define IXGBE_ALT_SAN_MAC_ADDR_PORT0_OFFSET 0x1 /* Alt. SAN MAC 0 offset */ |
1819 | #define IXGBE_ALT_SAN_MAC_ADDR_PORT1_OFFSET 0x4 /* Alt. SAN MAC 1 offset */ | 1819 | #define IXGBE_ALT_SAN_MAC_ADDR_PORT1_OFFSET 0x4 /* Alt. SAN MAC 1 offset */ |
1820 | #define IXGBE_ALT_SAN_MAC_ADDR_WWNN_OFFSET 0x7 /* Alt. WWNN prefix offset */ | 1820 | #define IXGBE_ALT_SAN_MAC_ADDR_WWNN_OFFSET 0x7 /* Alt. WWNN prefix offset */ |
1821 | #define IXGBE_ALT_SAN_MAC_ADDR_WWPN_OFFSET 0x8 /* Alt. WWPN prefix offset */ | 1821 | #define IXGBE_ALT_SAN_MAC_ADDR_WWPN_OFFSET 0x8 /* Alt. WWPN prefix offset */ |
1822 | #define IXGBE_ALT_SAN_MAC_ADDR_CAPS_SANMAC 0x0 /* Alt. SAN MAC exists */ | 1822 | #define IXGBE_ALT_SAN_MAC_ADDR_CAPS_SANMAC 0x0 /* Alt. SAN MAC exists */ |
1823 | #define IXGBE_ALT_SAN_MAC_ADDR_CAPS_ALTWWN 0x1 /* Alt. WWN base exists */ | 1823 | #define IXGBE_ALT_SAN_MAC_ADDR_CAPS_ALTWWN 0x1 /* Alt. WWN base exists */ |
1824 | 1824 | ||
1825 | #define IXGBE_DEVICE_CAPS_WOL_PORT0_1 0x4 /* WoL supported on ports 0 & 1 */ | 1825 | #define IXGBE_DEVICE_CAPS_WOL_PORT0_1 0x4 /* WoL supported on ports 0 & 1 */ |
1826 | #define IXGBE_DEVICE_CAPS_WOL_PORT0 0x8 /* WoL supported on port 0 */ | 1826 | #define IXGBE_DEVICE_CAPS_WOL_PORT0 0x8 /* WoL supported on port 0 */ |
1827 | #define IXGBE_DEVICE_CAPS_WOL_MASK 0xC /* Mask for WoL capabilities */ | 1827 | #define IXGBE_DEVICE_CAPS_WOL_MASK 0xC /* Mask for WoL capabilities */ |
1828 | 1828 | ||
1829 | /* PCI Bus Info */ | 1829 | /* PCI Bus Info */ |
1830 | #define IXGBE_PCI_DEVICE_STATUS 0xAA | 1830 | #define IXGBE_PCI_DEVICE_STATUS 0xAA |
1831 | #define IXGBE_PCI_DEVICE_STATUS_TRANSACTION_PENDING 0x0020 | 1831 | #define IXGBE_PCI_DEVICE_STATUS_TRANSACTION_PENDING 0x0020 |
1832 | #define IXGBE_PCI_LINK_STATUS 0xB2 | 1832 | #define IXGBE_PCI_LINK_STATUS 0xB2 |
1833 | #define IXGBE_PCI_DEVICE_CONTROL2 0xC8 | 1833 | #define IXGBE_PCI_DEVICE_CONTROL2 0xC8 |
1834 | #define IXGBE_PCI_LINK_WIDTH 0x3F0 | 1834 | #define IXGBE_PCI_LINK_WIDTH 0x3F0 |
1835 | #define IXGBE_PCI_LINK_WIDTH_1 0x10 | 1835 | #define IXGBE_PCI_LINK_WIDTH_1 0x10 |
1836 | #define IXGBE_PCI_LINK_WIDTH_2 0x20 | 1836 | #define IXGBE_PCI_LINK_WIDTH_2 0x20 |
1837 | #define IXGBE_PCI_LINK_WIDTH_4 0x40 | 1837 | #define IXGBE_PCI_LINK_WIDTH_4 0x40 |
1838 | #define IXGBE_PCI_LINK_WIDTH_8 0x80 | 1838 | #define IXGBE_PCI_LINK_WIDTH_8 0x80 |
1839 | #define IXGBE_PCI_LINK_SPEED 0xF | 1839 | #define IXGBE_PCI_LINK_SPEED 0xF |
1840 | #define IXGBE_PCI_LINK_SPEED_2500 0x1 | 1840 | #define IXGBE_PCI_LINK_SPEED_2500 0x1 |
1841 | #define IXGBE_PCI_LINK_SPEED_5000 0x2 | 1841 | #define IXGBE_PCI_LINK_SPEED_5000 0x2 |
1842 | #define IXGBE_PCI_LINK_SPEED_8000 0x3 | 1842 | #define IXGBE_PCI_LINK_SPEED_8000 0x3 |
1843 | #define IXGBE_PCI_HEADER_TYPE_REGISTER 0x0E | 1843 | #define IXGBE_PCI_HEADER_TYPE_REGISTER 0x0E |
1844 | #define IXGBE_PCI_HEADER_TYPE_MULTIFUNC 0x80 | 1844 | #define IXGBE_PCI_HEADER_TYPE_MULTIFUNC 0x80 |
1845 | #define IXGBE_PCI_DEVICE_CONTROL2_16ms 0x0005 | 1845 | #define IXGBE_PCI_DEVICE_CONTROL2_16ms 0x0005 |
1846 | 1846 | ||
1847 | /* Number of 100 microseconds we wait for PCI Express master disable */ | 1847 | /* Number of 100 microseconds we wait for PCI Express master disable */ |
1848 | #define IXGBE_PCI_MASTER_DISABLE_TIMEOUT 800 | 1848 | #define IXGBE_PCI_MASTER_DISABLE_TIMEOUT 800 |
1849 | 1849 | ||
1850 | /* RAH */ | 1850 | /* RAH */ |
1851 | #define IXGBE_RAH_VIND_MASK 0x003C0000 | 1851 | #define IXGBE_RAH_VIND_MASK 0x003C0000 |
1852 | #define IXGBE_RAH_VIND_SHIFT 18 | 1852 | #define IXGBE_RAH_VIND_SHIFT 18 |
1853 | #define IXGBE_RAH_AV 0x80000000 | 1853 | #define IXGBE_RAH_AV 0x80000000 |
1854 | #define IXGBE_CLEAR_VMDQ_ALL 0xFFFFFFFF | 1854 | #define IXGBE_CLEAR_VMDQ_ALL 0xFFFFFFFF |
1855 | 1855 | ||
1856 | /* Header split receive */ | 1856 | /* Header split receive */ |
1857 | #define IXGBE_RFCTL_ISCSI_DIS 0x00000001 | 1857 | #define IXGBE_RFCTL_ISCSI_DIS 0x00000001 |
1858 | #define IXGBE_RFCTL_ISCSI_DWC_MASK 0x0000003E | 1858 | #define IXGBE_RFCTL_ISCSI_DWC_MASK 0x0000003E |
1859 | #define IXGBE_RFCTL_ISCSI_DWC_SHIFT 1 | 1859 | #define IXGBE_RFCTL_ISCSI_DWC_SHIFT 1 |
1860 | #define IXGBE_RFCTL_NFSW_DIS 0x00000040 | 1860 | #define IXGBE_RFCTL_NFSW_DIS 0x00000040 |
1861 | #define IXGBE_RFCTL_NFSR_DIS 0x00000080 | 1861 | #define IXGBE_RFCTL_NFSR_DIS 0x00000080 |
1862 | #define IXGBE_RFCTL_NFS_VER_MASK 0x00000300 | 1862 | #define IXGBE_RFCTL_NFS_VER_MASK 0x00000300 |
1863 | #define IXGBE_RFCTL_NFS_VER_SHIFT 8 | 1863 | #define IXGBE_RFCTL_NFS_VER_SHIFT 8 |
1864 | #define IXGBE_RFCTL_NFS_VER_2 0 | 1864 | #define IXGBE_RFCTL_NFS_VER_2 0 |
1865 | #define IXGBE_RFCTL_NFS_VER_3 1 | 1865 | #define IXGBE_RFCTL_NFS_VER_3 1 |
1866 | #define IXGBE_RFCTL_NFS_VER_4 2 | 1866 | #define IXGBE_RFCTL_NFS_VER_4 2 |
1867 | #define IXGBE_RFCTL_IPV6_DIS 0x00000400 | 1867 | #define IXGBE_RFCTL_IPV6_DIS 0x00000400 |
1868 | #define IXGBE_RFCTL_IPV6_XSUM_DIS 0x00000800 | 1868 | #define IXGBE_RFCTL_IPV6_XSUM_DIS 0x00000800 |
1869 | #define IXGBE_RFCTL_IPFRSP_DIS 0x00004000 | 1869 | #define IXGBE_RFCTL_IPFRSP_DIS 0x00004000 |
1870 | #define IXGBE_RFCTL_IPV6_EX_DIS 0x00010000 | 1870 | #define IXGBE_RFCTL_IPV6_EX_DIS 0x00010000 |
1871 | #define IXGBE_RFCTL_NEW_IPV6_EXT_DIS 0x00020000 | 1871 | #define IXGBE_RFCTL_NEW_IPV6_EXT_DIS 0x00020000 |
1872 | 1872 | ||
1873 | /* Transmit Config masks */ | 1873 | /* Transmit Config masks */ |
1874 | #define IXGBE_TXDCTL_ENABLE 0x02000000 /* Enable specific Tx Queue */ | 1874 | #define IXGBE_TXDCTL_ENABLE 0x02000000 /* Enable specific Tx Queue */ |
1875 | #define IXGBE_TXDCTL_SWFLSH 0x04000000 /* Tx Desc. write-back flushing */ | 1875 | #define IXGBE_TXDCTL_SWFLSH 0x04000000 /* Tx Desc. write-back flushing */ |
1876 | #define IXGBE_TXDCTL_WTHRESH_SHIFT 16 /* shift to WTHRESH bits */ | 1876 | #define IXGBE_TXDCTL_WTHRESH_SHIFT 16 /* shift to WTHRESH bits */ |
1877 | /* Enable short packet padding to 64 bytes */ | 1877 | /* Enable short packet padding to 64 bytes */ |
1878 | #define IXGBE_TX_PAD_ENABLE 0x00000400 | 1878 | #define IXGBE_TX_PAD_ENABLE 0x00000400 |
1879 | #define IXGBE_JUMBO_FRAME_ENABLE 0x00000004 /* Allow jumbo frames */ | 1879 | #define IXGBE_JUMBO_FRAME_ENABLE 0x00000004 /* Allow jumbo frames */ |
1880 | /* This allows for 16K packets + 4k for vlan */ | 1880 | /* This allows for 16K packets + 4k for vlan */ |
1881 | #define IXGBE_MAX_FRAME_SZ 0x40040000 | 1881 | #define IXGBE_MAX_FRAME_SZ 0x40040000 |
1882 | 1882 | ||
1883 | #define IXGBE_TDWBAL_HEAD_WB_ENABLE 0x1 /* Tx head write-back enable */ | 1883 | #define IXGBE_TDWBAL_HEAD_WB_ENABLE 0x1 /* Tx head write-back enable */ |
1884 | #define IXGBE_TDWBAL_SEQNUM_WB_ENABLE 0x2 /* Tx seq# write-back enable */ | 1884 | #define IXGBE_TDWBAL_SEQNUM_WB_ENABLE 0x2 /* Tx seq# write-back enable */ |
1885 | 1885 | ||
1886 | /* Receive Config masks */ | 1886 | /* Receive Config masks */ |
1887 | #define IXGBE_RXCTRL_RXEN 0x00000001 /* Enable Receiver */ | 1887 | #define IXGBE_RXCTRL_RXEN 0x00000001 /* Enable Receiver */ |
1888 | #define IXGBE_RXCTRL_DMBYPS 0x00000002 /* Descriptor Monitor Bypass */ | 1888 | #define IXGBE_RXCTRL_DMBYPS 0x00000002 /* Descriptor Monitor Bypass */ |
1889 | #define IXGBE_RXDCTL_ENABLE 0x02000000 /* Enable specific Rx Queue */ | 1889 | #define IXGBE_RXDCTL_ENABLE 0x02000000 /* Enable specific Rx Queue */ |
1890 | #define IXGBE_RXDCTL_SWFLSH 0x04000000 /* Rx Desc. write-back flushing */ | 1890 | #define IXGBE_RXDCTL_SWFLSH 0x04000000 /* Rx Desc. write-back flushing */ |
1891 | #define IXGBE_RXDCTL_RLPMLMASK 0x00003FFF /* Only supported on the X540 */ | 1891 | #define IXGBE_RXDCTL_RLPMLMASK 0x00003FFF /* Only supported on the X540 */ |
1892 | #define IXGBE_RXDCTL_RLPML_EN 0x00008000 | 1892 | #define IXGBE_RXDCTL_RLPML_EN 0x00008000 |
1893 | #define IXGBE_RXDCTL_VME 0x40000000 /* VLAN mode enable */ | 1893 | #define IXGBE_RXDCTL_VME 0x40000000 /* VLAN mode enable */ |
1894 | 1894 | ||
1895 | #define IXGBE_TSAUXC_EN_CLK 0x00000004 | 1895 | #define IXGBE_TSAUXC_EN_CLK 0x00000004 |
1896 | #define IXGBE_TSAUXC_SYNCLK 0x00000008 | 1896 | #define IXGBE_TSAUXC_SYNCLK 0x00000008 |
1897 | #define IXGBE_TSAUXC_SDP0_INT 0x00000040 | 1897 | #define IXGBE_TSAUXC_SDP0_INT 0x00000040 |
1898 | 1898 | ||
1899 | #define IXGBE_TSYNCTXCTL_VALID 0x00000001 /* Tx timestamp valid */ | 1899 | #define IXGBE_TSYNCTXCTL_VALID 0x00000001 /* Tx timestamp valid */ |
1900 | #define IXGBE_TSYNCTXCTL_ENABLED 0x00000010 /* Tx timestamping enabled */ | 1900 | #define IXGBE_TSYNCTXCTL_ENABLED 0x00000010 /* Tx timestamping enabled */ |
1901 | 1901 | ||
1902 | #define IXGBE_TSYNCRXCTL_VALID 0x00000001 /* Rx timestamp valid */ | 1902 | #define IXGBE_TSYNCRXCTL_VALID 0x00000001 /* Rx timestamp valid */ |
1903 | #define IXGBE_TSYNCRXCTL_TYPE_MASK 0x0000000E /* Rx type mask */ | 1903 | #define IXGBE_TSYNCRXCTL_TYPE_MASK 0x0000000E /* Rx type mask */ |
1904 | #define IXGBE_TSYNCRXCTL_TYPE_L2_V2 0x00 | 1904 | #define IXGBE_TSYNCRXCTL_TYPE_L2_V2 0x00 |
1905 | #define IXGBE_TSYNCRXCTL_TYPE_L4_V1 0x02 | 1905 | #define IXGBE_TSYNCRXCTL_TYPE_L4_V1 0x02 |
1906 | #define IXGBE_TSYNCRXCTL_TYPE_L2_L4_V2 0x04 | 1906 | #define IXGBE_TSYNCRXCTL_TYPE_L2_L4_V2 0x04 |
1907 | #define IXGBE_TSYNCRXCTL_TYPE_EVENT_V2 0x0A | 1907 | #define IXGBE_TSYNCRXCTL_TYPE_EVENT_V2 0x0A |
1908 | #define IXGBE_TSYNCRXCTL_ENABLED 0x00000010 /* Rx Timestamping enabled */ | 1908 | #define IXGBE_TSYNCRXCTL_ENABLED 0x00000010 /* Rx Timestamping enabled */ |
1909 | 1909 | ||
1910 | #define IXGBE_RXMTRL_V1_CTRLT_MASK 0x000000FF | 1910 | #define IXGBE_RXMTRL_V1_CTRLT_MASK 0x000000FF |
1911 | #define IXGBE_RXMTRL_V1_SYNC_MSG 0x00 | 1911 | #define IXGBE_RXMTRL_V1_SYNC_MSG 0x00 |
1912 | #define IXGBE_RXMTRL_V1_DELAY_REQ_MSG 0x01 | 1912 | #define IXGBE_RXMTRL_V1_DELAY_REQ_MSG 0x01 |
1913 | #define IXGBE_RXMTRL_V1_FOLLOWUP_MSG 0x02 | 1913 | #define IXGBE_RXMTRL_V1_FOLLOWUP_MSG 0x02 |
1914 | #define IXGBE_RXMTRL_V1_DELAY_RESP_MSG 0x03 | 1914 | #define IXGBE_RXMTRL_V1_DELAY_RESP_MSG 0x03 |
1915 | #define IXGBE_RXMTRL_V1_MGMT_MSG 0x04 | 1915 | #define IXGBE_RXMTRL_V1_MGMT_MSG 0x04 |
1916 | 1916 | ||
1917 | #define IXGBE_RXMTRL_V2_MSGID_MASK 0x0000FF00 | 1917 | #define IXGBE_RXMTRL_V2_MSGID_MASK 0x0000FF00 |
1918 | #define IXGBE_RXMTRL_V2_SYNC_MSG 0x0000 | 1918 | #define IXGBE_RXMTRL_V2_SYNC_MSG 0x0000 |
1919 | #define IXGBE_RXMTRL_V2_DELAY_REQ_MSG 0x0100 | 1919 | #define IXGBE_RXMTRL_V2_DELAY_REQ_MSG 0x0100 |
1920 | #define IXGBE_RXMTRL_V2_PDELAY_REQ_MSG 0x0200 | 1920 | #define IXGBE_RXMTRL_V2_PDELAY_REQ_MSG 0x0200 |
1921 | #define IXGBE_RXMTRL_V2_PDELAY_RESP_MSG 0x0300 | 1921 | #define IXGBE_RXMTRL_V2_PDELAY_RESP_MSG 0x0300 |
1922 | #define IXGBE_RXMTRL_V2_FOLLOWUP_MSG 0x0800 | 1922 | #define IXGBE_RXMTRL_V2_FOLLOWUP_MSG 0x0800 |
1923 | #define IXGBE_RXMTRL_V2_DELAY_RESP_MSG 0x0900 | 1923 | #define IXGBE_RXMTRL_V2_DELAY_RESP_MSG 0x0900 |
1924 | #define IXGBE_RXMTRL_V2_PDELAY_FOLLOWUP_MSG 0x0A00 | 1924 | #define IXGBE_RXMTRL_V2_PDELAY_FOLLOWUP_MSG 0x0A00 |
1925 | #define IXGBE_RXMTRL_V2_ANNOUNCE_MSG 0x0B00 | 1925 | #define IXGBE_RXMTRL_V2_ANNOUNCE_MSG 0x0B00 |
1926 | #define IXGBE_RXMTRL_V2_SIGNALING_MSG 0x0C00 | 1926 | #define IXGBE_RXMTRL_V2_SIGNALING_MSG 0x0C00 |
1927 | #define IXGBE_RXMTRL_V2_MGMT_MSG 0x0D00 | 1927 | #define IXGBE_RXMTRL_V2_MGMT_MSG 0x0D00 |
1928 | 1928 | ||
1929 | #define IXGBE_FCTRL_SBP 0x00000002 /* Store Bad Packet */ | 1929 | #define IXGBE_FCTRL_SBP 0x00000002 /* Store Bad Packet */ |
1930 | #define IXGBE_FCTRL_MPE 0x00000100 /* Multicast Promiscuous Ena*/ | 1930 | #define IXGBE_FCTRL_MPE 0x00000100 /* Multicast Promiscuous Ena*/ |
1931 | #define IXGBE_FCTRL_UPE 0x00000200 /* Unicast Promiscuous Ena */ | 1931 | #define IXGBE_FCTRL_UPE 0x00000200 /* Unicast Promiscuous Ena */ |
1932 | #define IXGBE_FCTRL_BAM 0x00000400 /* Broadcast Accept Mode */ | 1932 | #define IXGBE_FCTRL_BAM 0x00000400 /* Broadcast Accept Mode */ |
1933 | #define IXGBE_FCTRL_PMCF 0x00001000 /* Pass MAC Control Frames */ | 1933 | #define IXGBE_FCTRL_PMCF 0x00001000 /* Pass MAC Control Frames */ |
1934 | #define IXGBE_FCTRL_DPF 0x00002000 /* Discard Pause Frame */ | 1934 | #define IXGBE_FCTRL_DPF 0x00002000 /* Discard Pause Frame */ |
1935 | /* Receive Priority Flow Control Enable */ | 1935 | /* Receive Priority Flow Control Enable */ |
1936 | #define IXGBE_FCTRL_RPFCE 0x00004000 | 1936 | #define IXGBE_FCTRL_RPFCE 0x00004000 |
1937 | #define IXGBE_FCTRL_RFCE 0x00008000 /* Receive Flow Control Ena */ | 1937 | #define IXGBE_FCTRL_RFCE 0x00008000 /* Receive Flow Control Ena */ |
1938 | #define IXGBE_MFLCN_PMCF 0x00000001 /* Pass MAC Control Frames */ | 1938 | #define IXGBE_MFLCN_PMCF 0x00000001 /* Pass MAC Control Frames */ |
1939 | #define IXGBE_MFLCN_DPF 0x00000002 /* Discard Pause Frame */ | 1939 | #define IXGBE_MFLCN_DPF 0x00000002 /* Discard Pause Frame */ |
1940 | #define IXGBE_MFLCN_RPFCE 0x00000004 /* Receive Priority FC Enable */ | 1940 | #define IXGBE_MFLCN_RPFCE 0x00000004 /* Receive Priority FC Enable */ |
1941 | #define IXGBE_MFLCN_RFCE 0x00000008 /* Receive FC Enable */ | 1941 | #define IXGBE_MFLCN_RFCE 0x00000008 /* Receive FC Enable */ |
1942 | #define IXGBE_MFLCN_RPFCE_MASK 0x00000FF4 /* Receive FC Mask */ | 1942 | #define IXGBE_MFLCN_RPFCE_MASK 0x00000FF4 /* Receive FC Mask */ |
1943 | 1943 | ||
1944 | #define IXGBE_MFLCN_RPFCE_SHIFT 4 | 1944 | #define IXGBE_MFLCN_RPFCE_SHIFT 4 |
1945 | 1945 | ||
1946 | /* Multiple Receive Queue Control */ | 1946 | /* Multiple Receive Queue Control */ |
1947 | #define IXGBE_MRQC_RSSEN 0x00000001 /* RSS Enable */ | 1947 | #define IXGBE_MRQC_RSSEN 0x00000001 /* RSS Enable */ |
1948 | #define IXGBE_MRQC_MRQE_MASK 0xF /* Bits 3:0 */ | 1948 | #define IXGBE_MRQC_MRQE_MASK 0xF /* Bits 3:0 */ |
1949 | #define IXGBE_MRQC_RT8TCEN 0x00000002 /* 8 TC no RSS */ | 1949 | #define IXGBE_MRQC_RT8TCEN 0x00000002 /* 8 TC no RSS */ |
1950 | #define IXGBE_MRQC_RT4TCEN 0x00000003 /* 4 TC no RSS */ | 1950 | #define IXGBE_MRQC_RT4TCEN 0x00000003 /* 4 TC no RSS */ |
1951 | #define IXGBE_MRQC_RTRSS8TCEN 0x00000004 /* 8 TC w/ RSS */ | 1951 | #define IXGBE_MRQC_RTRSS8TCEN 0x00000004 /* 8 TC w/ RSS */ |
1952 | #define IXGBE_MRQC_RTRSS4TCEN 0x00000005 /* 4 TC w/ RSS */ | 1952 | #define IXGBE_MRQC_RTRSS4TCEN 0x00000005 /* 4 TC w/ RSS */ |
1953 | #define IXGBE_MRQC_VMDQEN 0x00000008 /* VMDq2 64 pools no RSS */ | 1953 | #define IXGBE_MRQC_VMDQEN 0x00000008 /* VMDq2 64 pools no RSS */ |
1954 | #define IXGBE_MRQC_VMDQRSS32EN 0x0000000A /* VMDq2 32 pools w/ RSS */ | 1954 | #define IXGBE_MRQC_VMDQRSS32EN 0x0000000A /* VMDq2 32 pools w/ RSS */ |
1955 | #define IXGBE_MRQC_VMDQRSS64EN 0x0000000B /* VMDq2 64 pools w/ RSS */ | 1955 | #define IXGBE_MRQC_VMDQRSS64EN 0x0000000B /* VMDq2 64 pools w/ RSS */ |
1956 | #define IXGBE_MRQC_VMDQRT8TCEN 0x0000000C /* VMDq2/RT 16 pool 8 TC */ | 1956 | #define IXGBE_MRQC_VMDQRT8TCEN 0x0000000C /* VMDq2/RT 16 pool 8 TC */ |
1957 | #define IXGBE_MRQC_VMDQRT4TCEN 0x0000000D /* VMDq2/RT 32 pool 4 TC */ | 1957 | #define IXGBE_MRQC_VMDQRT4TCEN 0x0000000D /* VMDq2/RT 32 pool 4 TC */ |
1958 | #define IXGBE_MRQC_RSS_FIELD_MASK 0xFFFF0000 | 1958 | #define IXGBE_MRQC_RSS_FIELD_MASK 0xFFFF0000 |
1959 | #define IXGBE_MRQC_RSS_FIELD_IPV4_TCP 0x00010000 | 1959 | #define IXGBE_MRQC_RSS_FIELD_IPV4_TCP 0x00010000 |
1960 | #define IXGBE_MRQC_RSS_FIELD_IPV4 0x00020000 | 1960 | #define IXGBE_MRQC_RSS_FIELD_IPV4 0x00020000 |
1961 | #define IXGBE_MRQC_RSS_FIELD_IPV6_EX_TCP 0x00040000 | 1961 | #define IXGBE_MRQC_RSS_FIELD_IPV6_EX_TCP 0x00040000 |
1962 | #define IXGBE_MRQC_RSS_FIELD_IPV6_EX 0x00080000 | 1962 | #define IXGBE_MRQC_RSS_FIELD_IPV6_EX 0x00080000 |
1963 | #define IXGBE_MRQC_RSS_FIELD_IPV6 0x00100000 | 1963 | #define IXGBE_MRQC_RSS_FIELD_IPV6 0x00100000 |
1964 | #define IXGBE_MRQC_RSS_FIELD_IPV6_TCP 0x00200000 | 1964 | #define IXGBE_MRQC_RSS_FIELD_IPV6_TCP 0x00200000 |
1965 | #define IXGBE_MRQC_RSS_FIELD_IPV4_UDP 0x00400000 | 1965 | #define IXGBE_MRQC_RSS_FIELD_IPV4_UDP 0x00400000 |
1966 | #define IXGBE_MRQC_RSS_FIELD_IPV6_UDP 0x00800000 | 1966 | #define IXGBE_MRQC_RSS_FIELD_IPV6_UDP 0x00800000 |
1967 | #define IXGBE_MRQC_RSS_FIELD_IPV6_EX_UDP 0x01000000 | 1967 | #define IXGBE_MRQC_RSS_FIELD_IPV6_EX_UDP 0x01000000 |
1968 | #define IXGBE_MRQC_L3L4TXSWEN 0x00008000 | 1968 | #define IXGBE_MRQC_L3L4TXSWEN 0x00008000 |
1969 | 1969 | ||
1970 | #define IXGBE_FWSM_TS_ENABLED 0x1 | 1970 | #define IXGBE_FWSM_TS_ENABLED 0x1 |
1971 | 1971 | ||
1972 | /* Queue Drop Enable */ | 1972 | /* Queue Drop Enable */ |
1973 | #define IXGBE_QDE_ENABLE 0x00000001 | 1973 | #define IXGBE_QDE_ENABLE 0x00000001 |
1974 | #define IXGBE_QDE_IDX_MASK 0x00007F00 | 1974 | #define IXGBE_QDE_IDX_MASK 0x00007F00 |
1975 | #define IXGBE_QDE_IDX_SHIFT 8 | 1975 | #define IXGBE_QDE_IDX_SHIFT 8 |
1976 | 1976 | ||
1977 | #define IXGBE_TXD_POPTS_IXSM 0x01 /* Insert IP checksum */ | 1977 | #define IXGBE_TXD_POPTS_IXSM 0x01 /* Insert IP checksum */ |
1978 | #define IXGBE_TXD_POPTS_TXSM 0x02 /* Insert TCP/UDP checksum */ | 1978 | #define IXGBE_TXD_POPTS_TXSM 0x02 /* Insert TCP/UDP checksum */ |
1979 | #define IXGBE_TXD_CMD_EOP 0x01000000 /* End of Packet */ | 1979 | #define IXGBE_TXD_CMD_EOP 0x01000000 /* End of Packet */ |
1980 | #define IXGBE_TXD_CMD_IFCS 0x02000000 /* Insert FCS (Ethernet CRC) */ | 1980 | #define IXGBE_TXD_CMD_IFCS 0x02000000 /* Insert FCS (Ethernet CRC) */ |
1981 | #define IXGBE_TXD_CMD_IC 0x04000000 /* Insert Checksum */ | 1981 | #define IXGBE_TXD_CMD_IC 0x04000000 /* Insert Checksum */ |
1982 | #define IXGBE_TXD_CMD_RS 0x08000000 /* Report Status */ | 1982 | #define IXGBE_TXD_CMD_RS 0x08000000 /* Report Status */ |
1983 | #define IXGBE_TXD_CMD_DEXT 0x20000000 /* Descriptor extension (0 = legacy) */ | 1983 | #define IXGBE_TXD_CMD_DEXT 0x20000000 /* Descriptor extension (0 = legacy) */ |
1984 | #define IXGBE_TXD_CMD_VLE 0x40000000 /* Add VLAN tag */ | 1984 | #define IXGBE_TXD_CMD_VLE 0x40000000 /* Add VLAN tag */ |
1985 | #define IXGBE_TXD_STAT_DD 0x00000001 /* Descriptor Done */ | 1985 | #define IXGBE_TXD_STAT_DD 0x00000001 /* Descriptor Done */ |
1986 | 1986 | ||
1987 | #define IXGBE_RXDADV_IPSEC_STATUS_SECP 0x00020000 | 1987 | #define IXGBE_RXDADV_IPSEC_STATUS_SECP 0x00020000 |
1988 | #define IXGBE_RXDADV_IPSEC_ERROR_INVALID_PROTOCOL 0x08000000 | 1988 | #define IXGBE_RXDADV_IPSEC_ERROR_INVALID_PROTOCOL 0x08000000 |
1989 | #define IXGBE_RXDADV_IPSEC_ERROR_INVALID_LENGTH 0x10000000 | 1989 | #define IXGBE_RXDADV_IPSEC_ERROR_INVALID_LENGTH 0x10000000 |
1990 | #define IXGBE_RXDADV_IPSEC_ERROR_AUTH_FAILED 0x18000000 | 1990 | #define IXGBE_RXDADV_IPSEC_ERROR_AUTH_FAILED 0x18000000 |
1991 | #define IXGBE_RXDADV_IPSEC_ERROR_BIT_MASK 0x18000000 | 1991 | #define IXGBE_RXDADV_IPSEC_ERROR_BIT_MASK 0x18000000 |
1992 | /* Multiple Transmit Queue Command Register */ | 1992 | /* Multiple Transmit Queue Command Register */ |
1993 | #define IXGBE_MTQC_RT_ENA 0x1 /* DCB Enable */ | 1993 | #define IXGBE_MTQC_RT_ENA 0x1 /* DCB Enable */ |
1994 | #define IXGBE_MTQC_VT_ENA 0x2 /* VMDQ2 Enable */ | 1994 | #define IXGBE_MTQC_VT_ENA 0x2 /* VMDQ2 Enable */ |
1995 | #define IXGBE_MTQC_64Q_1PB 0x0 /* 64 queues 1 pack buffer */ | 1995 | #define IXGBE_MTQC_64Q_1PB 0x0 /* 64 queues 1 pack buffer */ |
1996 | #define IXGBE_MTQC_32VF 0x8 /* 4 TX Queues per pool w/32VF's */ | 1996 | #define IXGBE_MTQC_32VF 0x8 /* 4 TX Queues per pool w/32VF's */ |
1997 | #define IXGBE_MTQC_64VF 0x4 /* 2 TX Queues per pool w/64VF's */ | 1997 | #define IXGBE_MTQC_64VF 0x4 /* 2 TX Queues per pool w/64VF's */ |
1998 | #define IXGBE_MTQC_8TC_8TQ 0xC /* 8 TC if RT_ENA or 8 TQ if VT_ENA */ | 1998 | #define IXGBE_MTQC_8TC_8TQ 0xC /* 8 TC if RT_ENA or 8 TQ if VT_ENA */ |
1999 | #define IXGBE_MTQC_4TC_4TQ 0x8 /* 4 TC if RT_ENA or 4 TQ if VT_ENA */ | 1999 | #define IXGBE_MTQC_4TC_4TQ 0x8 /* 4 TC if RT_ENA or 4 TQ if VT_ENA */ |
2000 | 2000 | ||
2001 | /* Receive Descriptor bit definitions */ | 2001 | /* Receive Descriptor bit definitions */ |
2002 | #define IXGBE_RXD_STAT_DD 0x01 /* Descriptor Done */ | 2002 | #define IXGBE_RXD_STAT_DD 0x01 /* Descriptor Done */ |
2003 | #define IXGBE_RXD_STAT_EOP 0x02 /* End of Packet */ | 2003 | #define IXGBE_RXD_STAT_EOP 0x02 /* End of Packet */ |
2004 | #define IXGBE_RXD_STAT_FLM 0x04 /* FDir Match */ | 2004 | #define IXGBE_RXD_STAT_FLM 0x04 /* FDir Match */ |
2005 | #define IXGBE_RXD_STAT_VP 0x08 /* IEEE VLAN Packet */ | 2005 | #define IXGBE_RXD_STAT_VP 0x08 /* IEEE VLAN Packet */ |
2006 | #define IXGBE_RXDADV_NEXTP_MASK 0x000FFFF0 /* Next Descriptor Index */ | 2006 | #define IXGBE_RXDADV_NEXTP_MASK 0x000FFFF0 /* Next Descriptor Index */ |
2007 | #define IXGBE_RXDADV_NEXTP_SHIFT 0x00000004 | 2007 | #define IXGBE_RXDADV_NEXTP_SHIFT 0x00000004 |
2008 | #define IXGBE_RXD_STAT_UDPCS 0x10 /* UDP xsum calculated */ | 2008 | #define IXGBE_RXD_STAT_UDPCS 0x10 /* UDP xsum calculated */ |
2009 | #define IXGBE_RXD_STAT_L4CS 0x20 /* L4 xsum calculated */ | 2009 | #define IXGBE_RXD_STAT_L4CS 0x20 /* L4 xsum calculated */ |
2010 | #define IXGBE_RXD_STAT_IPCS 0x40 /* IP xsum calculated */ | 2010 | #define IXGBE_RXD_STAT_IPCS 0x40 /* IP xsum calculated */ |
2011 | #define IXGBE_RXD_STAT_PIF 0x80 /* passed in-exact filter */ | 2011 | #define IXGBE_RXD_STAT_PIF 0x80 /* passed in-exact filter */ |
2012 | #define IXGBE_RXD_STAT_CRCV 0x100 /* Speculative CRC Valid */ | 2012 | #define IXGBE_RXD_STAT_CRCV 0x100 /* Speculative CRC Valid */ |
2013 | #define IXGBE_RXD_STAT_VEXT 0x200 /* 1st VLAN found */ | 2013 | #define IXGBE_RXD_STAT_VEXT 0x200 /* 1st VLAN found */ |
2014 | #define IXGBE_RXD_STAT_UDPV 0x400 /* Valid UDP checksum */ | 2014 | #define IXGBE_RXD_STAT_UDPV 0x400 /* Valid UDP checksum */ |
2015 | #define IXGBE_RXD_STAT_DYNINT 0x800 /* Pkt caused INT via DYNINT */ | 2015 | #define IXGBE_RXD_STAT_DYNINT 0x800 /* Pkt caused INT via DYNINT */ |
2016 | #define IXGBE_RXD_STAT_LLINT 0x800 /* Pkt caused Low Latency Interrupt */ | 2016 | #define IXGBE_RXD_STAT_LLINT 0x800 /* Pkt caused Low Latency Interrupt */ |
2017 | #define IXGBE_RXD_STAT_TS 0x10000 /* Time Stamp */ | 2017 | #define IXGBE_RXD_STAT_TS 0x10000 /* Time Stamp */ |
2018 | #define IXGBE_RXD_STAT_SECP 0x20000 /* Security Processing */ | 2018 | #define IXGBE_RXD_STAT_SECP 0x20000 /* Security Processing */ |
2019 | #define IXGBE_RXD_STAT_LB 0x40000 /* Loopback Status */ | 2019 | #define IXGBE_RXD_STAT_LB 0x40000 /* Loopback Status */ |
2020 | #define IXGBE_RXD_STAT_ACK 0x8000 /* ACK Packet indication */ | 2020 | #define IXGBE_RXD_STAT_ACK 0x8000 /* ACK Packet indication */ |
2021 | #define IXGBE_RXD_ERR_CE 0x01 /* CRC Error */ | 2021 | #define IXGBE_RXD_ERR_CE 0x01 /* CRC Error */ |
2022 | #define IXGBE_RXD_ERR_LE 0x02 /* Length Error */ | 2022 | #define IXGBE_RXD_ERR_LE 0x02 /* Length Error */ |
2023 | #define IXGBE_RXD_ERR_PE 0x08 /* Packet Error */ | 2023 | #define IXGBE_RXD_ERR_PE 0x08 /* Packet Error */ |
2024 | #define IXGBE_RXD_ERR_OSE 0x10 /* Oversize Error */ | 2024 | #define IXGBE_RXD_ERR_OSE 0x10 /* Oversize Error */ |
2025 | #define IXGBE_RXD_ERR_USE 0x20 /* Undersize Error */ | 2025 | #define IXGBE_RXD_ERR_USE 0x20 /* Undersize Error */ |
2026 | #define IXGBE_RXD_ERR_TCPE 0x40 /* TCP/UDP Checksum Error */ | 2026 | #define IXGBE_RXD_ERR_TCPE 0x40 /* TCP/UDP Checksum Error */ |
2027 | #define IXGBE_RXD_ERR_IPE 0x80 /* IP Checksum Error */ | 2027 | #define IXGBE_RXD_ERR_IPE 0x80 /* IP Checksum Error */ |
2028 | #define IXGBE_RXDADV_ERR_MASK 0xfff00000 /* RDESC.ERRORS mask */ | 2028 | #define IXGBE_RXDADV_ERR_MASK 0xfff00000 /* RDESC.ERRORS mask */ |
2029 | #define IXGBE_RXDADV_ERR_SHIFT 20 /* RDESC.ERRORS shift */ | 2029 | #define IXGBE_RXDADV_ERR_SHIFT 20 /* RDESC.ERRORS shift */ |
2030 | #define IXGBE_RXDADV_ERR_FCEOFE 0x80000000 /* FCoEFe/IPE */ | 2030 | #define IXGBE_RXDADV_ERR_FCEOFE 0x80000000 /* FCoEFe/IPE */ |
2031 | #define IXGBE_RXDADV_ERR_FCERR 0x00700000 /* FCERR/FDIRERR */ | 2031 | #define IXGBE_RXDADV_ERR_FCERR 0x00700000 /* FCERR/FDIRERR */ |
2032 | #define IXGBE_RXDADV_ERR_FDIR_LEN 0x00100000 /* FDIR Length error */ | 2032 | #define IXGBE_RXDADV_ERR_FDIR_LEN 0x00100000 /* FDIR Length error */ |
2033 | #define IXGBE_RXDADV_ERR_FDIR_DROP 0x00200000 /* FDIR Drop error */ | 2033 | #define IXGBE_RXDADV_ERR_FDIR_DROP 0x00200000 /* FDIR Drop error */ |
2034 | #define IXGBE_RXDADV_ERR_FDIR_COLL 0x00400000 /* FDIR Collision error */ | 2034 | #define IXGBE_RXDADV_ERR_FDIR_COLL 0x00400000 /* FDIR Collision error */ |
2035 | #define IXGBE_RXDADV_ERR_HBO 0x00800000 /*Header Buffer Overflow */ | 2035 | #define IXGBE_RXDADV_ERR_HBO 0x00800000 /*Header Buffer Overflow */ |
2036 | #define IXGBE_RXDADV_ERR_CE 0x01000000 /* CRC Error */ | 2036 | #define IXGBE_RXDADV_ERR_CE 0x01000000 /* CRC Error */ |
2037 | #define IXGBE_RXDADV_ERR_LE 0x02000000 /* Length Error */ | 2037 | #define IXGBE_RXDADV_ERR_LE 0x02000000 /* Length Error */ |
2038 | #define IXGBE_RXDADV_ERR_PE 0x08000000 /* Packet Error */ | 2038 | #define IXGBE_RXDADV_ERR_PE 0x08000000 /* Packet Error */ |
2039 | #define IXGBE_RXDADV_ERR_OSE 0x10000000 /* Oversize Error */ | 2039 | #define IXGBE_RXDADV_ERR_OSE 0x10000000 /* Oversize Error */ |
2040 | #define IXGBE_RXDADV_ERR_USE 0x20000000 /* Undersize Error */ | 2040 | #define IXGBE_RXDADV_ERR_USE 0x20000000 /* Undersize Error */ |
2041 | #define IXGBE_RXDADV_ERR_TCPE 0x40000000 /* TCP/UDP Checksum Error */ | 2041 | #define IXGBE_RXDADV_ERR_TCPE 0x40000000 /* TCP/UDP Checksum Error */ |
2042 | #define IXGBE_RXDADV_ERR_IPE 0x80000000 /* IP Checksum Error */ | 2042 | #define IXGBE_RXDADV_ERR_IPE 0x80000000 /* IP Checksum Error */ |
2043 | #define IXGBE_RXD_VLAN_ID_MASK 0x0FFF /* VLAN ID is in lower 12 bits */ | 2043 | #define IXGBE_RXD_VLAN_ID_MASK 0x0FFF /* VLAN ID is in lower 12 bits */ |
2044 | #define IXGBE_RXD_PRI_MASK 0xE000 /* Priority is in upper 3 bits */ | 2044 | #define IXGBE_RXD_PRI_MASK 0xE000 /* Priority is in upper 3 bits */ |
2045 | #define IXGBE_RXD_PRI_SHIFT 13 | 2045 | #define IXGBE_RXD_PRI_SHIFT 13 |
2046 | #define IXGBE_RXD_CFI_MASK 0x1000 /* CFI is bit 12 */ | 2046 | #define IXGBE_RXD_CFI_MASK 0x1000 /* CFI is bit 12 */ |
2047 | #define IXGBE_RXD_CFI_SHIFT 12 | 2047 | #define IXGBE_RXD_CFI_SHIFT 12 |
2048 | 2048 | ||
2049 | #define IXGBE_RXDADV_STAT_DD IXGBE_RXD_STAT_DD /* Done */ | 2049 | #define IXGBE_RXDADV_STAT_DD IXGBE_RXD_STAT_DD /* Done */ |
2050 | #define IXGBE_RXDADV_STAT_EOP IXGBE_RXD_STAT_EOP /* End of Packet */ | 2050 | #define IXGBE_RXDADV_STAT_EOP IXGBE_RXD_STAT_EOP /* End of Packet */ |
2051 | #define IXGBE_RXDADV_STAT_FLM IXGBE_RXD_STAT_FLM /* FDir Match */ | 2051 | #define IXGBE_RXDADV_STAT_FLM IXGBE_RXD_STAT_FLM /* FDir Match */ |
2052 | #define IXGBE_RXDADV_STAT_VP IXGBE_RXD_STAT_VP /* IEEE VLAN Pkt */ | 2052 | #define IXGBE_RXDADV_STAT_VP IXGBE_RXD_STAT_VP /* IEEE VLAN Pkt */ |
2053 | #define IXGBE_RXDADV_STAT_MASK 0x000fffff /* Stat/NEXTP: bit 0-19 */ | 2053 | #define IXGBE_RXDADV_STAT_MASK 0x000fffff /* Stat/NEXTP: bit 0-19 */ |
2054 | #define IXGBE_RXDADV_STAT_FCEOFS 0x00000040 /* FCoE EOF/SOF Stat */ | 2054 | #define IXGBE_RXDADV_STAT_FCEOFS 0x00000040 /* FCoE EOF/SOF Stat */ |
2055 | #define IXGBE_RXDADV_STAT_FCSTAT 0x00000030 /* FCoE Pkt Stat */ | 2055 | #define IXGBE_RXDADV_STAT_FCSTAT 0x00000030 /* FCoE Pkt Stat */ |
2056 | #define IXGBE_RXDADV_STAT_FCSTAT_NOMTCH 0x00000000 /* 00: No Ctxt Match */ | 2056 | #define IXGBE_RXDADV_STAT_FCSTAT_NOMTCH 0x00000000 /* 00: No Ctxt Match */ |
2057 | #define IXGBE_RXDADV_STAT_FCSTAT_NODDP 0x00000010 /* 01: Ctxt w/o DDP */ | 2057 | #define IXGBE_RXDADV_STAT_FCSTAT_NODDP 0x00000010 /* 01: Ctxt w/o DDP */ |
2058 | #define IXGBE_RXDADV_STAT_FCSTAT_FCPRSP 0x00000020 /* 10: Recv. FCP_RSP */ | 2058 | #define IXGBE_RXDADV_STAT_FCSTAT_FCPRSP 0x00000020 /* 10: Recv. FCP_RSP */ |
2059 | #define IXGBE_RXDADV_STAT_FCSTAT_DDP 0x00000030 /* 11: Ctxt w/ DDP */ | 2059 | #define IXGBE_RXDADV_STAT_FCSTAT_DDP 0x00000030 /* 11: Ctxt w/ DDP */ |
2060 | #define IXGBE_RXDADV_STAT_TS 0x00010000 /* IEEE 1588 Time Stamp */ | 2060 | #define IXGBE_RXDADV_STAT_TS 0x00010000 /* IEEE 1588 Time Stamp */ |
2061 | 2061 | ||
2062 | /* PSRTYPE bit definitions */ | 2062 | /* PSRTYPE bit definitions */ |
2063 | #define IXGBE_PSRTYPE_TCPHDR 0x00000010 | 2063 | #define IXGBE_PSRTYPE_TCPHDR 0x00000010 |
2064 | #define IXGBE_PSRTYPE_UDPHDR 0x00000020 | 2064 | #define IXGBE_PSRTYPE_UDPHDR 0x00000020 |
2065 | #define IXGBE_PSRTYPE_IPV4HDR 0x00000100 | 2065 | #define IXGBE_PSRTYPE_IPV4HDR 0x00000100 |
2066 | #define IXGBE_PSRTYPE_IPV6HDR 0x00000200 | 2066 | #define IXGBE_PSRTYPE_IPV6HDR 0x00000200 |
2067 | #define IXGBE_PSRTYPE_L2HDR 0x00001000 | 2067 | #define IXGBE_PSRTYPE_L2HDR 0x00001000 |
2068 | 2068 | ||
2069 | /* SRRCTL bit definitions */ | 2069 | /* SRRCTL bit definitions */ |
2070 | #define IXGBE_SRRCTL_BSIZEPKT_SHIFT 10 /* so many KBs */ | 2070 | #define IXGBE_SRRCTL_BSIZEPKT_SHIFT 10 /* so many KBs */ |
2071 | #define IXGBE_SRRCTL_RDMTS_SHIFT 22 | 2071 | #define IXGBE_SRRCTL_RDMTS_SHIFT 22 |
2072 | #define IXGBE_SRRCTL_RDMTS_MASK 0x01C00000 | 2072 | #define IXGBE_SRRCTL_RDMTS_MASK 0x01C00000 |
2073 | #define IXGBE_SRRCTL_DROP_EN 0x10000000 | 2073 | #define IXGBE_SRRCTL_DROP_EN 0x10000000 |
2074 | #define IXGBE_SRRCTL_BSIZEPKT_MASK 0x0000007F | 2074 | #define IXGBE_SRRCTL_BSIZEPKT_MASK 0x0000007F |
2075 | #define IXGBE_SRRCTL_BSIZEHDR_MASK 0x00003F00 | 2075 | #define IXGBE_SRRCTL_BSIZEHDR_MASK 0x00003F00 |
2076 | #define IXGBE_SRRCTL_DESCTYPE_LEGACY 0x00000000 | 2076 | #define IXGBE_SRRCTL_DESCTYPE_LEGACY 0x00000000 |
2077 | #define IXGBE_SRRCTL_DESCTYPE_ADV_ONEBUF 0x02000000 | 2077 | #define IXGBE_SRRCTL_DESCTYPE_ADV_ONEBUF 0x02000000 |
2078 | #define IXGBE_SRRCTL_DESCTYPE_HDR_SPLIT 0x04000000 | 2078 | #define IXGBE_SRRCTL_DESCTYPE_HDR_SPLIT 0x04000000 |
2079 | #define IXGBE_SRRCTL_DESCTYPE_HDR_REPLICATION_LARGE_PKT 0x08000000 | 2079 | #define IXGBE_SRRCTL_DESCTYPE_HDR_REPLICATION_LARGE_PKT 0x08000000 |
2080 | #define IXGBE_SRRCTL_DESCTYPE_HDR_SPLIT_ALWAYS 0x0A000000 | 2080 | #define IXGBE_SRRCTL_DESCTYPE_HDR_SPLIT_ALWAYS 0x0A000000 |
2081 | #define IXGBE_SRRCTL_DESCTYPE_MASK 0x0E000000 | 2081 | #define IXGBE_SRRCTL_DESCTYPE_MASK 0x0E000000 |
2082 | 2082 | ||
2083 | #define IXGBE_RXDPS_HDRSTAT_HDRSP 0x00008000 | 2083 | #define IXGBE_RXDPS_HDRSTAT_HDRSP 0x00008000 |
2084 | #define IXGBE_RXDPS_HDRSTAT_HDRLEN_MASK 0x000003FF | 2084 | #define IXGBE_RXDPS_HDRSTAT_HDRLEN_MASK 0x000003FF |
2085 | 2085 | ||
2086 | #define IXGBE_RXDADV_RSSTYPE_MASK 0x0000000F | 2086 | #define IXGBE_RXDADV_RSSTYPE_MASK 0x0000000F |
2087 | #define IXGBE_RXDADV_PKTTYPE_MASK 0x0000FFF0 | 2087 | #define IXGBE_RXDADV_PKTTYPE_MASK 0x0000FFF0 |
2088 | #define IXGBE_RXDADV_PKTTYPE_MASK_EX 0x0001FFF0 | 2088 | #define IXGBE_RXDADV_PKTTYPE_MASK_EX 0x0001FFF0 |
2089 | #define IXGBE_RXDADV_HDRBUFLEN_MASK 0x00007FE0 | 2089 | #define IXGBE_RXDADV_HDRBUFLEN_MASK 0x00007FE0 |
2090 | #define IXGBE_RXDADV_RSCCNT_MASK 0x001E0000 | 2090 | #define IXGBE_RXDADV_RSCCNT_MASK 0x001E0000 |
2091 | #define IXGBE_RXDADV_RSCCNT_SHIFT 17 | 2091 | #define IXGBE_RXDADV_RSCCNT_SHIFT 17 |
2092 | #define IXGBE_RXDADV_HDRBUFLEN_SHIFT 5 | 2092 | #define IXGBE_RXDADV_HDRBUFLEN_SHIFT 5 |
2093 | #define IXGBE_RXDADV_SPLITHEADER_EN 0x00001000 | 2093 | #define IXGBE_RXDADV_SPLITHEADER_EN 0x00001000 |
2094 | #define IXGBE_RXDADV_SPH 0x8000 | 2094 | #define IXGBE_RXDADV_SPH 0x8000 |
2095 | 2095 | ||
2096 | /* RSS Hash results */ | 2096 | /* RSS Hash results */ |
2097 | #define IXGBE_RXDADV_RSSTYPE_NONE 0x00000000 | 2097 | #define IXGBE_RXDADV_RSSTYPE_NONE 0x00000000 |
2098 | #define IXGBE_RXDADV_RSSTYPE_IPV4_TCP 0x00000001 | 2098 | #define IXGBE_RXDADV_RSSTYPE_IPV4_TCP 0x00000001 |
2099 | #define IXGBE_RXDADV_RSSTYPE_IPV4 0x00000002 | 2099 | #define IXGBE_RXDADV_RSSTYPE_IPV4 0x00000002 |
2100 | #define IXGBE_RXDADV_RSSTYPE_IPV6_TCP 0x00000003 | 2100 | #define IXGBE_RXDADV_RSSTYPE_IPV6_TCP 0x00000003 |
2101 | #define IXGBE_RXDADV_RSSTYPE_IPV6_EX 0x00000004 | 2101 | #define IXGBE_RXDADV_RSSTYPE_IPV6_EX 0x00000004 |
2102 | #define IXGBE_RXDADV_RSSTYPE_IPV6 0x00000005 | 2102 | #define IXGBE_RXDADV_RSSTYPE_IPV6 0x00000005 |
2103 | #define IXGBE_RXDADV_RSSTYPE_IPV6_TCP_EX 0x00000006 | 2103 | #define IXGBE_RXDADV_RSSTYPE_IPV6_TCP_EX 0x00000006 |
2104 | #define IXGBE_RXDADV_RSSTYPE_IPV4_UDP 0x00000007 | 2104 | #define IXGBE_RXDADV_RSSTYPE_IPV4_UDP 0x00000007 |
2105 | #define IXGBE_RXDADV_RSSTYPE_IPV6_UDP 0x00000008 | 2105 | #define IXGBE_RXDADV_RSSTYPE_IPV6_UDP 0x00000008 |
2106 | #define IXGBE_RXDADV_RSSTYPE_IPV6_UDP_EX 0x00000009 | 2106 | #define IXGBE_RXDADV_RSSTYPE_IPV6_UDP_EX 0x00000009 |
2107 | 2107 | ||
2108 | /* RSS Packet Types as indicated in the receive descriptor. */ | 2108 | /* RSS Packet Types as indicated in the receive descriptor. */ |
2109 | #define IXGBE_RXDADV_PKTTYPE_NONE 0x00000000 | 2109 | #define IXGBE_RXDADV_PKTTYPE_NONE 0x00000000 |
2110 | #define IXGBE_RXDADV_PKTTYPE_IPV4 0x00000010 /* IPv4 hdr present */ | 2110 | #define IXGBE_RXDADV_PKTTYPE_IPV4 0x00000010 /* IPv4 hdr present */ |
2111 | #define IXGBE_RXDADV_PKTTYPE_IPV4_EX 0x00000020 /* IPv4 hdr + extensions */ | 2111 | #define IXGBE_RXDADV_PKTTYPE_IPV4_EX 0x00000020 /* IPv4 hdr + extensions */ |
2112 | #define IXGBE_RXDADV_PKTTYPE_IPV6 0x00000040 /* IPv6 hdr present */ | 2112 | #define IXGBE_RXDADV_PKTTYPE_IPV6 0x00000040 /* IPv6 hdr present */ |
2113 | #define IXGBE_RXDADV_PKTTYPE_IPV6_EX 0x00000080 /* IPv6 hdr + extensions */ | 2113 | #define IXGBE_RXDADV_PKTTYPE_IPV6_EX 0x00000080 /* IPv6 hdr + extensions */ |
2114 | #define IXGBE_RXDADV_PKTTYPE_TCP 0x00000100 /* TCP hdr present */ | 2114 | #define IXGBE_RXDADV_PKTTYPE_TCP 0x00000100 /* TCP hdr present */ |
2115 | #define IXGBE_RXDADV_PKTTYPE_UDP 0x00000200 /* UDP hdr present */ | 2115 | #define IXGBE_RXDADV_PKTTYPE_UDP 0x00000200 /* UDP hdr present */ |
2116 | #define IXGBE_RXDADV_PKTTYPE_SCTP 0x00000400 /* SCTP hdr present */ | 2116 | #define IXGBE_RXDADV_PKTTYPE_SCTP 0x00000400 /* SCTP hdr present */ |
2117 | #define IXGBE_RXDADV_PKTTYPE_NFS 0x00000800 /* NFS hdr present */ | 2117 | #define IXGBE_RXDADV_PKTTYPE_NFS 0x00000800 /* NFS hdr present */ |
2118 | #define IXGBE_RXDADV_PKTTYPE_IPSEC_ESP 0x00001000 /* IPSec ESP */ | 2118 | #define IXGBE_RXDADV_PKTTYPE_IPSEC_ESP 0x00001000 /* IPSec ESP */ |
2119 | #define IXGBE_RXDADV_PKTTYPE_IPSEC_AH 0x00002000 /* IPSec AH */ | 2119 | #define IXGBE_RXDADV_PKTTYPE_IPSEC_AH 0x00002000 /* IPSec AH */ |
2120 | #define IXGBE_RXDADV_PKTTYPE_LINKSEC 0x00004000 /* LinkSec Encap */ | 2120 | #define IXGBE_RXDADV_PKTTYPE_LINKSEC 0x00004000 /* LinkSec Encap */ |
2121 | #define IXGBE_RXDADV_PKTTYPE_ETQF 0x00008000 /* PKTTYPE is ETQF index */ | 2121 | #define IXGBE_RXDADV_PKTTYPE_ETQF 0x00008000 /* PKTTYPE is ETQF index */ |
2122 | #define IXGBE_RXDADV_PKTTYPE_ETQF_MASK 0x00000070 /* ETQF has 8 indices */ | 2122 | #define IXGBE_RXDADV_PKTTYPE_ETQF_MASK 0x00000070 /* ETQF has 8 indices */ |
2123 | #define IXGBE_RXDADV_PKTTYPE_ETQF_SHIFT 4 /* Right-shift 4 bits */ | 2123 | #define IXGBE_RXDADV_PKTTYPE_ETQF_SHIFT 4 /* Right-shift 4 bits */ |
2124 | 2124 | ||
2125 | /* Security Processing bit Indication */ | 2125 | /* Security Processing bit Indication */ |
2126 | #define IXGBE_RXDADV_LNKSEC_STATUS_SECP 0x00020000 | 2126 | #define IXGBE_RXDADV_LNKSEC_STATUS_SECP 0x00020000 |
2127 | #define IXGBE_RXDADV_LNKSEC_ERROR_NO_SA_MATCH 0x08000000 | 2127 | #define IXGBE_RXDADV_LNKSEC_ERROR_NO_SA_MATCH 0x08000000 |
2128 | #define IXGBE_RXDADV_LNKSEC_ERROR_REPLAY_ERROR 0x10000000 | 2128 | #define IXGBE_RXDADV_LNKSEC_ERROR_REPLAY_ERROR 0x10000000 |
2129 | #define IXGBE_RXDADV_LNKSEC_ERROR_BIT_MASK 0x18000000 | 2129 | #define IXGBE_RXDADV_LNKSEC_ERROR_BIT_MASK 0x18000000 |
2130 | #define IXGBE_RXDADV_LNKSEC_ERROR_BAD_SIG 0x18000000 | 2130 | #define IXGBE_RXDADV_LNKSEC_ERROR_BAD_SIG 0x18000000 |
2131 | 2131 | ||
2132 | /* Masks to determine if packets should be dropped due to frame errors */ | 2132 | /* Masks to determine if packets should be dropped due to frame errors */ |
2133 | #define IXGBE_RXD_ERR_FRAME_ERR_MASK ( \ | 2133 | #define IXGBE_RXD_ERR_FRAME_ERR_MASK ( \ |
2134 | IXGBE_RXD_ERR_CE | \ | 2134 | IXGBE_RXD_ERR_CE | \ |
2135 | IXGBE_RXD_ERR_LE | \ | 2135 | IXGBE_RXD_ERR_LE | \ |
2136 | IXGBE_RXD_ERR_PE | \ | 2136 | IXGBE_RXD_ERR_PE | \ |
2137 | IXGBE_RXD_ERR_OSE | \ | 2137 | IXGBE_RXD_ERR_OSE | \ |
2138 | IXGBE_RXD_ERR_USE) | 2138 | IXGBE_RXD_ERR_USE) |
2139 | 2139 | ||
2140 | #define IXGBE_RXDADV_ERR_FRAME_ERR_MASK ( \ | 2140 | #define IXGBE_RXDADV_ERR_FRAME_ERR_MASK ( \ |
2141 | IXGBE_RXDADV_ERR_CE | \ | 2141 | IXGBE_RXDADV_ERR_CE | \ |
2142 | IXGBE_RXDADV_ERR_LE | \ | 2142 | IXGBE_RXDADV_ERR_LE | \ |
2143 | IXGBE_RXDADV_ERR_PE | \ | 2143 | IXGBE_RXDADV_ERR_PE | \ |
2144 | IXGBE_RXDADV_ERR_OSE | \ | 2144 | IXGBE_RXDADV_ERR_OSE | \ |
2145 | IXGBE_RXDADV_ERR_USE) | 2145 | IXGBE_RXDADV_ERR_USE) |
2146 | 2146 | ||
2147 | /* Multicast bit mask */ | 2147 | /* Multicast bit mask */ |
2148 | #define IXGBE_MCSTCTRL_MFE 0x4 | 2148 | #define IXGBE_MCSTCTRL_MFE 0x4 |
2149 | 2149 | ||
2150 | /* Number of Transmit and Receive Descriptors must be a multiple of 8 */ | 2150 | /* Number of Transmit and Receive Descriptors must be a multiple of 8 */ |
2151 | #define IXGBE_REQ_TX_DESCRIPTOR_MULTIPLE 8 | 2151 | #define IXGBE_REQ_TX_DESCRIPTOR_MULTIPLE 8 |
2152 | #define IXGBE_REQ_RX_DESCRIPTOR_MULTIPLE 8 | 2152 | #define IXGBE_REQ_RX_DESCRIPTOR_MULTIPLE 8 |
2153 | #define IXGBE_REQ_TX_BUFFER_GRANULARITY 1024 | 2153 | #define IXGBE_REQ_TX_BUFFER_GRANULARITY 1024 |
2154 | 2154 | ||
2155 | /* Vlan-specific macros */ | 2155 | /* Vlan-specific macros */ |
2156 | #define IXGBE_RX_DESC_SPECIAL_VLAN_MASK 0x0FFF /* VLAN ID in lower 12 bits */ | 2156 | #define IXGBE_RX_DESC_SPECIAL_VLAN_MASK 0x0FFF /* VLAN ID in lower 12 bits */ |
2157 | #define IXGBE_RX_DESC_SPECIAL_PRI_MASK 0xE000 /* Priority in upper 3 bits */ | 2157 | #define IXGBE_RX_DESC_SPECIAL_PRI_MASK 0xE000 /* Priority in upper 3 bits */ |
2158 | #define IXGBE_RX_DESC_SPECIAL_PRI_SHIFT 0x000D /* Priority in upper 3 of 16 */ | 2158 | #define IXGBE_RX_DESC_SPECIAL_PRI_SHIFT 0x000D /* Priority in upper 3 of 16 */ |
2159 | #define IXGBE_TX_DESC_SPECIAL_PRI_SHIFT IXGBE_RX_DESC_SPECIAL_PRI_SHIFT | 2159 | #define IXGBE_TX_DESC_SPECIAL_PRI_SHIFT IXGBE_RX_DESC_SPECIAL_PRI_SHIFT |
2160 | 2160 | ||
2161 | /* SR-IOV specific macros */ | 2161 | /* SR-IOV specific macros */ |
2162 | #define IXGBE_MBVFICR_INDEX(vf_number) (vf_number >> 4) | 2162 | #define IXGBE_MBVFICR_INDEX(vf_number) (vf_number >> 4) |
2163 | #define IXGBE_MBVFICR(_i) (0x00710 + ((_i) * 4)) | 2163 | #define IXGBE_MBVFICR(_i) (0x00710 + ((_i) * 4)) |
2164 | #define IXGBE_VFLRE(_i) ((((_i) & 1) ? 0x001C0 : 0x00600)) | 2164 | #define IXGBE_VFLRE(_i) ((((_i) & 1) ? 0x001C0 : 0x00600)) |
2165 | #define IXGBE_VFLREC(_i) (0x00700 + ((_i) * 4)) | 2165 | #define IXGBE_VFLREC(_i) (0x00700 + ((_i) * 4)) |
2166 | 2166 | ||
2167 | enum ixgbe_fdir_pballoc_type { | 2167 | enum ixgbe_fdir_pballoc_type { |
2168 | IXGBE_FDIR_PBALLOC_NONE = 0, | 2168 | IXGBE_FDIR_PBALLOC_NONE = 0, |
2169 | IXGBE_FDIR_PBALLOC_64K = 1, | 2169 | IXGBE_FDIR_PBALLOC_64K = 1, |
2170 | IXGBE_FDIR_PBALLOC_128K = 2, | 2170 | IXGBE_FDIR_PBALLOC_128K = 2, |
2171 | IXGBE_FDIR_PBALLOC_256K = 3, | 2171 | IXGBE_FDIR_PBALLOC_256K = 3, |
2172 | }; | 2172 | }; |
2173 | #define IXGBE_FDIR_PBALLOC_SIZE_SHIFT 16 | 2173 | #define IXGBE_FDIR_PBALLOC_SIZE_SHIFT 16 |
2174 | 2174 | ||
2175 | /* Flow Director register values */ | 2175 | /* Flow Director register values */ |
2176 | #define IXGBE_FDIRCTRL_PBALLOC_64K 0x00000001 | 2176 | #define IXGBE_FDIRCTRL_PBALLOC_64K 0x00000001 |
2177 | #define IXGBE_FDIRCTRL_PBALLOC_128K 0x00000002 | 2177 | #define IXGBE_FDIRCTRL_PBALLOC_128K 0x00000002 |
2178 | #define IXGBE_FDIRCTRL_PBALLOC_256K 0x00000003 | 2178 | #define IXGBE_FDIRCTRL_PBALLOC_256K 0x00000003 |
2179 | #define IXGBE_FDIRCTRL_INIT_DONE 0x00000008 | 2179 | #define IXGBE_FDIRCTRL_INIT_DONE 0x00000008 |
2180 | #define IXGBE_FDIRCTRL_PERFECT_MATCH 0x00000010 | 2180 | #define IXGBE_FDIRCTRL_PERFECT_MATCH 0x00000010 |
2181 | #define IXGBE_FDIRCTRL_REPORT_STATUS 0x00000020 | 2181 | #define IXGBE_FDIRCTRL_REPORT_STATUS 0x00000020 |
2182 | #define IXGBE_FDIRCTRL_REPORT_STATUS_ALWAYS 0x00000080 | 2182 | #define IXGBE_FDIRCTRL_REPORT_STATUS_ALWAYS 0x00000080 |
2183 | #define IXGBE_FDIRCTRL_DROP_Q_SHIFT 8 | 2183 | #define IXGBE_FDIRCTRL_DROP_Q_SHIFT 8 |
2184 | #define IXGBE_FDIRCTRL_FLEX_SHIFT 16 | 2184 | #define IXGBE_FDIRCTRL_FLEX_SHIFT 16 |
2185 | #define IXGBE_FDIRCTRL_SEARCHLIM 0x00800000 | 2185 | #define IXGBE_FDIRCTRL_SEARCHLIM 0x00800000 |
2186 | #define IXGBE_FDIRCTRL_MAX_LENGTH_SHIFT 24 | 2186 | #define IXGBE_FDIRCTRL_MAX_LENGTH_SHIFT 24 |
2187 | #define IXGBE_FDIRCTRL_FULL_THRESH_MASK 0xF0000000 | 2187 | #define IXGBE_FDIRCTRL_FULL_THRESH_MASK 0xF0000000 |
2188 | #define IXGBE_FDIRCTRL_FULL_THRESH_SHIFT 28 | 2188 | #define IXGBE_FDIRCTRL_FULL_THRESH_SHIFT 28 |
2189 | 2189 | ||
2190 | #define IXGBE_FDIRTCPM_DPORTM_SHIFT 16 | 2190 | #define IXGBE_FDIRTCPM_DPORTM_SHIFT 16 |
2191 | #define IXGBE_FDIRUDPM_DPORTM_SHIFT 16 | 2191 | #define IXGBE_FDIRUDPM_DPORTM_SHIFT 16 |
2192 | #define IXGBE_FDIRIP6M_DIPM_SHIFT 16 | 2192 | #define IXGBE_FDIRIP6M_DIPM_SHIFT 16 |
2193 | #define IXGBE_FDIRM_VLANID 0x00000001 | 2193 | #define IXGBE_FDIRM_VLANID 0x00000001 |
2194 | #define IXGBE_FDIRM_VLANP 0x00000002 | 2194 | #define IXGBE_FDIRM_VLANP 0x00000002 |
2195 | #define IXGBE_FDIRM_POOL 0x00000004 | 2195 | #define IXGBE_FDIRM_POOL 0x00000004 |
2196 | #define IXGBE_FDIRM_L4P 0x00000008 | 2196 | #define IXGBE_FDIRM_L4P 0x00000008 |
2197 | #define IXGBE_FDIRM_FLEX 0x00000010 | 2197 | #define IXGBE_FDIRM_FLEX 0x00000010 |
2198 | #define IXGBE_FDIRM_DIPv6 0x00000020 | 2198 | #define IXGBE_FDIRM_DIPv6 0x00000020 |
2199 | 2199 | ||
2200 | #define IXGBE_FDIRFREE_FREE_MASK 0xFFFF | 2200 | #define IXGBE_FDIRFREE_FREE_MASK 0xFFFF |
2201 | #define IXGBE_FDIRFREE_FREE_SHIFT 0 | 2201 | #define IXGBE_FDIRFREE_FREE_SHIFT 0 |
2202 | #define IXGBE_FDIRFREE_COLL_MASK 0x7FFF0000 | 2202 | #define IXGBE_FDIRFREE_COLL_MASK 0x7FFF0000 |
2203 | #define IXGBE_FDIRFREE_COLL_SHIFT 16 | 2203 | #define IXGBE_FDIRFREE_COLL_SHIFT 16 |
2204 | #define IXGBE_FDIRLEN_MAXLEN_MASK 0x3F | 2204 | #define IXGBE_FDIRLEN_MAXLEN_MASK 0x3F |
2205 | #define IXGBE_FDIRLEN_MAXLEN_SHIFT 0 | 2205 | #define IXGBE_FDIRLEN_MAXLEN_SHIFT 0 |
2206 | #define IXGBE_FDIRLEN_MAXHASH_MASK 0x7FFF0000 | 2206 | #define IXGBE_FDIRLEN_MAXHASH_MASK 0x7FFF0000 |
2207 | #define IXGBE_FDIRLEN_MAXHASH_SHIFT 16 | 2207 | #define IXGBE_FDIRLEN_MAXHASH_SHIFT 16 |
2208 | #define IXGBE_FDIRUSTAT_ADD_MASK 0xFFFF | 2208 | #define IXGBE_FDIRUSTAT_ADD_MASK 0xFFFF |
2209 | #define IXGBE_FDIRUSTAT_ADD_SHIFT 0 | 2209 | #define IXGBE_FDIRUSTAT_ADD_SHIFT 0 |
2210 | #define IXGBE_FDIRUSTAT_REMOVE_MASK 0xFFFF0000 | 2210 | #define IXGBE_FDIRUSTAT_REMOVE_MASK 0xFFFF0000 |
2211 | #define IXGBE_FDIRUSTAT_REMOVE_SHIFT 16 | 2211 | #define IXGBE_FDIRUSTAT_REMOVE_SHIFT 16 |
2212 | #define IXGBE_FDIRFSTAT_FADD_MASK 0x00FF | 2212 | #define IXGBE_FDIRFSTAT_FADD_MASK 0x00FF |
2213 | #define IXGBE_FDIRFSTAT_FADD_SHIFT 0 | 2213 | #define IXGBE_FDIRFSTAT_FADD_SHIFT 0 |
2214 | #define IXGBE_FDIRFSTAT_FREMOVE_MASK 0xFF00 | 2214 | #define IXGBE_FDIRFSTAT_FREMOVE_MASK 0xFF00 |
2215 | #define IXGBE_FDIRFSTAT_FREMOVE_SHIFT 8 | 2215 | #define IXGBE_FDIRFSTAT_FREMOVE_SHIFT 8 |
2216 | #define IXGBE_FDIRPORT_DESTINATION_SHIFT 16 | 2216 | #define IXGBE_FDIRPORT_DESTINATION_SHIFT 16 |
2217 | #define IXGBE_FDIRVLAN_FLEX_SHIFT 16 | 2217 | #define IXGBE_FDIRVLAN_FLEX_SHIFT 16 |
2218 | #define IXGBE_FDIRHASH_BUCKET_VALID_SHIFT 15 | 2218 | #define IXGBE_FDIRHASH_BUCKET_VALID_SHIFT 15 |
2219 | #define IXGBE_FDIRHASH_SIG_SW_INDEX_SHIFT 16 | 2219 | #define IXGBE_FDIRHASH_SIG_SW_INDEX_SHIFT 16 |
2220 | 2220 | ||
2221 | #define IXGBE_FDIRCMD_CMD_MASK 0x00000003 | 2221 | #define IXGBE_FDIRCMD_CMD_MASK 0x00000003 |
2222 | #define IXGBE_FDIRCMD_CMD_ADD_FLOW 0x00000001 | 2222 | #define IXGBE_FDIRCMD_CMD_ADD_FLOW 0x00000001 |
2223 | #define IXGBE_FDIRCMD_CMD_REMOVE_FLOW 0x00000002 | 2223 | #define IXGBE_FDIRCMD_CMD_REMOVE_FLOW 0x00000002 |
2224 | #define IXGBE_FDIRCMD_CMD_QUERY_REM_FILT 0x00000003 | 2224 | #define IXGBE_FDIRCMD_CMD_QUERY_REM_FILT 0x00000003 |
2225 | #define IXGBE_FDIRCMD_FILTER_VALID 0x00000004 | 2225 | #define IXGBE_FDIRCMD_FILTER_VALID 0x00000004 |
2226 | #define IXGBE_FDIRCMD_FILTER_UPDATE 0x00000008 | 2226 | #define IXGBE_FDIRCMD_FILTER_UPDATE 0x00000008 |
2227 | #define IXGBE_FDIRCMD_IPv6DMATCH 0x00000010 | 2227 | #define IXGBE_FDIRCMD_IPv6DMATCH 0x00000010 |
2228 | #define IXGBE_FDIRCMD_L4TYPE_UDP 0x00000020 | 2228 | #define IXGBE_FDIRCMD_L4TYPE_UDP 0x00000020 |
2229 | #define IXGBE_FDIRCMD_L4TYPE_TCP 0x00000040 | 2229 | #define IXGBE_FDIRCMD_L4TYPE_TCP 0x00000040 |
2230 | #define IXGBE_FDIRCMD_L4TYPE_SCTP 0x00000060 | 2230 | #define IXGBE_FDIRCMD_L4TYPE_SCTP 0x00000060 |
2231 | #define IXGBE_FDIRCMD_IPV6 0x00000080 | 2231 | #define IXGBE_FDIRCMD_IPV6 0x00000080 |
2232 | #define IXGBE_FDIRCMD_CLEARHT 0x00000100 | 2232 | #define IXGBE_FDIRCMD_CLEARHT 0x00000100 |
2233 | #define IXGBE_FDIRCMD_DROP 0x00000200 | 2233 | #define IXGBE_FDIRCMD_DROP 0x00000200 |
2234 | #define IXGBE_FDIRCMD_INT 0x00000400 | 2234 | #define IXGBE_FDIRCMD_INT 0x00000400 |
2235 | #define IXGBE_FDIRCMD_LAST 0x00000800 | 2235 | #define IXGBE_FDIRCMD_LAST 0x00000800 |
2236 | #define IXGBE_FDIRCMD_COLLISION 0x00001000 | 2236 | #define IXGBE_FDIRCMD_COLLISION 0x00001000 |
2237 | #define IXGBE_FDIRCMD_QUEUE_EN 0x00008000 | 2237 | #define IXGBE_FDIRCMD_QUEUE_EN 0x00008000 |
2238 | #define IXGBE_FDIRCMD_FLOW_TYPE_SHIFT 5 | 2238 | #define IXGBE_FDIRCMD_FLOW_TYPE_SHIFT 5 |
2239 | #define IXGBE_FDIRCMD_RX_QUEUE_SHIFT 16 | 2239 | #define IXGBE_FDIRCMD_RX_QUEUE_SHIFT 16 |
2240 | #define IXGBE_FDIRCMD_VT_POOL_SHIFT 24 | 2240 | #define IXGBE_FDIRCMD_VT_POOL_SHIFT 24 |
2241 | #define IXGBE_FDIR_INIT_DONE_POLL 10 | 2241 | #define IXGBE_FDIR_INIT_DONE_POLL 10 |
2242 | #define IXGBE_FDIRCMD_CMD_POLL 10 | 2242 | #define IXGBE_FDIRCMD_CMD_POLL 10 |
2243 | 2243 | ||
2244 | #define IXGBE_FDIR_DROP_QUEUE 127 | 2244 | #define IXGBE_FDIR_DROP_QUEUE 127 |
2245 | 2245 | ||
2246 | /* Manageablility Host Interface defines */ | 2246 | /* Manageablility Host Interface defines */ |
2247 | #define IXGBE_HI_MAX_BLOCK_BYTE_LENGTH 1792 /* Num of bytes in range */ | 2247 | #define IXGBE_HI_MAX_BLOCK_BYTE_LENGTH 1792 /* Num of bytes in range */ |
2248 | #define IXGBE_HI_MAX_BLOCK_DWORD_LENGTH 448 /* Num of dwords in range */ | 2248 | #define IXGBE_HI_MAX_BLOCK_DWORD_LENGTH 448 /* Num of dwords in range */ |
2249 | #define IXGBE_HI_COMMAND_TIMEOUT 500 /* Process HI command limit */ | 2249 | #define IXGBE_HI_COMMAND_TIMEOUT 500 /* Process HI command limit */ |
2250 | 2250 | ||
2251 | /* CEM Support */ | 2251 | /* CEM Support */ |
2252 | #define FW_CEM_HDR_LEN 0x4 | 2252 | #define FW_CEM_HDR_LEN 0x4 |
2253 | #define FW_CEM_CMD_DRIVER_INFO 0xDD | 2253 | #define FW_CEM_CMD_DRIVER_INFO 0xDD |
2254 | #define FW_CEM_CMD_DRIVER_INFO_LEN 0x5 | 2254 | #define FW_CEM_CMD_DRIVER_INFO_LEN 0x5 |
2255 | #define FW_CEM_CMD_RESERVED 0x0 | 2255 | #define FW_CEM_CMD_RESERVED 0x0 |
2256 | #define FW_CEM_UNUSED_VER 0x0 | 2256 | #define FW_CEM_UNUSED_VER 0x0 |
2257 | #define FW_CEM_MAX_RETRIES 3 | 2257 | #define FW_CEM_MAX_RETRIES 3 |
2258 | #define FW_CEM_RESP_STATUS_SUCCESS 0x1 | 2258 | #define FW_CEM_RESP_STATUS_SUCCESS 0x1 |
2259 | 2259 | ||
2260 | /* Host Interface Command Structures */ | 2260 | /* Host Interface Command Structures */ |
2261 | struct ixgbe_hic_hdr { | 2261 | struct ixgbe_hic_hdr { |
2262 | u8 cmd; | 2262 | u8 cmd; |
2263 | u8 buf_len; | 2263 | u8 buf_len; |
2264 | union { | 2264 | union { |
2265 | u8 cmd_resv; | 2265 | u8 cmd_resv; |
2266 | u8 ret_status; | 2266 | u8 ret_status; |
2267 | } cmd_or_resp; | 2267 | } cmd_or_resp; |
2268 | u8 checksum; | 2268 | u8 checksum; |
2269 | }; | 2269 | }; |
2270 | 2270 | ||
2271 | struct ixgbe_hic_drv_info { | 2271 | struct ixgbe_hic_drv_info { |
2272 | struct ixgbe_hic_hdr hdr; | 2272 | struct ixgbe_hic_hdr hdr; |
2273 | u8 port_num; | 2273 | u8 port_num; |
2274 | u8 ver_sub; | 2274 | u8 ver_sub; |
2275 | u8 ver_build; | 2275 | u8 ver_build; |
2276 | u8 ver_min; | 2276 | u8 ver_min; |
2277 | u8 ver_maj; | 2277 | u8 ver_maj; |
2278 | u8 pad; /* end spacing to ensure length is mult. of dword */ | 2278 | u8 pad; /* end spacing to ensure length is mult. of dword */ |
2279 | u16 pad2; /* end spacing to ensure length is mult. of dword2 */ | 2279 | u16 pad2; /* end spacing to ensure length is mult. of dword2 */ |
2280 | }; | 2280 | }; |
2281 | 2281 | ||
2282 | /* Transmit Descriptor - Advanced */ | 2282 | /* Transmit Descriptor - Advanced */ |
2283 | union ixgbe_adv_tx_desc { | 2283 | union ixgbe_adv_tx_desc { |
2284 | struct { | 2284 | struct { |
2285 | __le64 buffer_addr; /* Address of descriptor's data buf */ | 2285 | __le64 buffer_addr; /* Address of descriptor's data buf */ |
2286 | __le32 cmd_type_len; | 2286 | __le32 cmd_type_len; |
2287 | __le32 olinfo_status; | 2287 | __le32 olinfo_status; |
2288 | } read; | 2288 | } read; |
2289 | struct { | 2289 | struct { |
2290 | __le64 rsvd; /* Reserved */ | 2290 | __le64 rsvd; /* Reserved */ |
2291 | __le32 nxtseq_seed; | 2291 | __le32 nxtseq_seed; |
2292 | __le32 status; | 2292 | __le32 status; |
2293 | } wb; | 2293 | } wb; |
2294 | }; | 2294 | }; |
2295 | 2295 | ||
2296 | /* Receive Descriptor - Advanced */ | 2296 | /* Receive Descriptor - Advanced */ |
2297 | union ixgbe_adv_rx_desc { | 2297 | union ixgbe_adv_rx_desc { |
2298 | struct { | 2298 | struct { |
2299 | __le64 pkt_addr; /* Packet buffer address */ | 2299 | __le64 pkt_addr; /* Packet buffer address */ |
2300 | __le64 hdr_addr; /* Header buffer address */ | 2300 | __le64 hdr_addr; /* Header buffer address */ |
2301 | } read; | 2301 | } read; |
2302 | struct { | 2302 | struct { |
2303 | struct { | 2303 | struct { |
2304 | union { | 2304 | union { |
2305 | __le32 data; | 2305 | __le32 data; |
2306 | struct { | 2306 | struct { |
2307 | __le16 pkt_info; /* RSS, Pkt type */ | 2307 | __le16 pkt_info; /* RSS, Pkt type */ |
2308 | __le16 hdr_info; /* Splithdr, hdrlen */ | 2308 | __le16 hdr_info; /* Splithdr, hdrlen */ |
2309 | } hs_rss; | 2309 | } hs_rss; |
2310 | } lo_dword; | 2310 | } lo_dword; |
2311 | union { | 2311 | union { |
2312 | __le32 rss; /* RSS Hash */ | 2312 | __le32 rss; /* RSS Hash */ |
2313 | struct { | 2313 | struct { |
2314 | __le16 ip_id; /* IP id */ | 2314 | __le16 ip_id; /* IP id */ |
2315 | __le16 csum; /* Packet Checksum */ | 2315 | __le16 csum; /* Packet Checksum */ |
2316 | } csum_ip; | 2316 | } csum_ip; |
2317 | } hi_dword; | 2317 | } hi_dword; |
2318 | } lower; | 2318 | } lower; |
2319 | struct { | 2319 | struct { |
2320 | __le32 status_error; /* ext status/error */ | 2320 | __le32 status_error; /* ext status/error */ |
2321 | __le16 length; /* Packet length */ | 2321 | __le16 length; /* Packet length */ |
2322 | __le16 vlan; /* VLAN tag */ | 2322 | __le16 vlan; /* VLAN tag */ |
2323 | } upper; | 2323 | } upper; |
2324 | } wb; /* writeback */ | 2324 | } wb; /* writeback */ |
2325 | }; | 2325 | }; |
2326 | 2326 | ||
2327 | /* Context descriptors */ | 2327 | /* Context descriptors */ |
2328 | struct ixgbe_adv_tx_context_desc { | 2328 | struct ixgbe_adv_tx_context_desc { |
2329 | __le32 vlan_macip_lens; | 2329 | __le32 vlan_macip_lens; |
2330 | __le32 seqnum_seed; | 2330 | __le32 seqnum_seed; |
2331 | __le32 type_tucmd_mlhl; | 2331 | __le32 type_tucmd_mlhl; |
2332 | __le32 mss_l4len_idx; | 2332 | __le32 mss_l4len_idx; |
2333 | }; | 2333 | }; |
2334 | 2334 | ||
2335 | /* Adv Transmit Descriptor Config Masks */ | 2335 | /* Adv Transmit Descriptor Config Masks */ |
2336 | #define IXGBE_ADVTXD_DTALEN_MASK 0x0000FFFF /* Data buf length(bytes) */ | 2336 | #define IXGBE_ADVTXD_DTALEN_MASK 0x0000FFFF /* Data buf length(bytes) */ |
2337 | #define IXGBE_ADVTXD_MAC_LINKSEC 0x00040000 /* Insert LinkSec */ | 2337 | #define IXGBE_ADVTXD_MAC_LINKSEC 0x00040000 /* Insert LinkSec */ |
2338 | #define IXGBE_ADVTXD_MAC_TSTAMP 0x00080000 /* IEEE 1588 Time Stamp */ | 2338 | #define IXGBE_ADVTXD_MAC_TSTAMP 0x00080000 /* IEEE 1588 Time Stamp */ |
2339 | #define IXGBE_ADVTXD_IPSEC_SA_INDEX_MASK 0x000003FF /* IPSec SA index */ | 2339 | #define IXGBE_ADVTXD_IPSEC_SA_INDEX_MASK 0x000003FF /* IPSec SA index */ |
2340 | #define IXGBE_ADVTXD_IPSEC_ESP_LEN_MASK 0x000001FF /* IPSec ESP length */ | 2340 | #define IXGBE_ADVTXD_IPSEC_ESP_LEN_MASK 0x000001FF /* IPSec ESP length */ |
2341 | #define IXGBE_ADVTXD_DTYP_MASK 0x00F00000 /* DTYP mask */ | 2341 | #define IXGBE_ADVTXD_DTYP_MASK 0x00F00000 /* DTYP mask */ |
2342 | #define IXGBE_ADVTXD_DTYP_CTXT 0x00200000 /* Advanced Context Desc */ | 2342 | #define IXGBE_ADVTXD_DTYP_CTXT 0x00200000 /* Advanced Context Desc */ |
2343 | #define IXGBE_ADVTXD_DTYP_DATA 0x00300000 /* Advanced Data Descriptor */ | 2343 | #define IXGBE_ADVTXD_DTYP_DATA 0x00300000 /* Advanced Data Descriptor */ |
2344 | #define IXGBE_ADVTXD_DCMD_EOP IXGBE_TXD_CMD_EOP /* End of Packet */ | 2344 | #define IXGBE_ADVTXD_DCMD_EOP IXGBE_TXD_CMD_EOP /* End of Packet */ |
2345 | #define IXGBE_ADVTXD_DCMD_IFCS IXGBE_TXD_CMD_IFCS /* Insert FCS */ | 2345 | #define IXGBE_ADVTXD_DCMD_IFCS IXGBE_TXD_CMD_IFCS /* Insert FCS */ |
2346 | #define IXGBE_ADVTXD_DCMD_RS IXGBE_TXD_CMD_RS /* Report Status */ | 2346 | #define IXGBE_ADVTXD_DCMD_RS IXGBE_TXD_CMD_RS /* Report Status */ |
2347 | #define IXGBE_ADVTXD_DCMD_DDTYP_ISCSI 0x10000000 /* DDP hdr type or iSCSI */ | 2347 | #define IXGBE_ADVTXD_DCMD_DDTYP_ISCSI 0x10000000 /* DDP hdr type or iSCSI */ |
2348 | #define IXGBE_ADVTXD_DCMD_DEXT IXGBE_TXD_CMD_DEXT /* Desc ext (1=Adv) */ | 2348 | #define IXGBE_ADVTXD_DCMD_DEXT IXGBE_TXD_CMD_DEXT /* Desc ext (1=Adv) */ |
2349 | #define IXGBE_ADVTXD_DCMD_VLE IXGBE_TXD_CMD_VLE /* VLAN pkt enable */ | 2349 | #define IXGBE_ADVTXD_DCMD_VLE IXGBE_TXD_CMD_VLE /* VLAN pkt enable */ |
2350 | #define IXGBE_ADVTXD_DCMD_TSE 0x80000000 /* TCP Seg enable */ | 2350 | #define IXGBE_ADVTXD_DCMD_TSE 0x80000000 /* TCP Seg enable */ |
2351 | #define IXGBE_ADVTXD_STAT_DD IXGBE_TXD_STAT_DD /* Descriptor Done */ | 2351 | #define IXGBE_ADVTXD_STAT_DD IXGBE_TXD_STAT_DD /* Descriptor Done */ |
2352 | #define IXGBE_ADVTXD_STAT_SN_CRC 0x00000002 /* NXTSEQ/SEED pres in WB */ | 2352 | #define IXGBE_ADVTXD_STAT_SN_CRC 0x00000002 /* NXTSEQ/SEED pres in WB */ |
2353 | #define IXGBE_ADVTXD_STAT_RSV 0x0000000C /* STA Reserved */ | 2353 | #define IXGBE_ADVTXD_STAT_RSV 0x0000000C /* STA Reserved */ |
2354 | #define IXGBE_ADVTXD_IDX_SHIFT 4 /* Adv desc Index shift */ | 2354 | #define IXGBE_ADVTXD_IDX_SHIFT 4 /* Adv desc Index shift */ |
2355 | #define IXGBE_ADVTXD_CC 0x00000080 /* Check Context */ | 2355 | #define IXGBE_ADVTXD_CC 0x00000080 /* Check Context */ |
2356 | #define IXGBE_ADVTXD_POPTS_SHIFT 8 /* Adv desc POPTS shift */ | 2356 | #define IXGBE_ADVTXD_POPTS_SHIFT 8 /* Adv desc POPTS shift */ |
2357 | #define IXGBE_ADVTXD_POPTS_IXSM (IXGBE_TXD_POPTS_IXSM << \ | 2357 | #define IXGBE_ADVTXD_POPTS_IXSM (IXGBE_TXD_POPTS_IXSM << \ |
2358 | IXGBE_ADVTXD_POPTS_SHIFT) | 2358 | IXGBE_ADVTXD_POPTS_SHIFT) |
2359 | #define IXGBE_ADVTXD_POPTS_TXSM (IXGBE_TXD_POPTS_TXSM << \ | 2359 | #define IXGBE_ADVTXD_POPTS_TXSM (IXGBE_TXD_POPTS_TXSM << \ |
2360 | IXGBE_ADVTXD_POPTS_SHIFT) | 2360 | IXGBE_ADVTXD_POPTS_SHIFT) |
2361 | #define IXGBE_ADVTXD_POPTS_ISCO_1ST 0x00000000 /* 1st TSO of iSCSI PDU */ | 2361 | #define IXGBE_ADVTXD_POPTS_ISCO_1ST 0x00000000 /* 1st TSO of iSCSI PDU */ |
2362 | #define IXGBE_ADVTXD_POPTS_ISCO_MDL 0x00000800 /* Middle TSO of iSCSI PDU */ | 2362 | #define IXGBE_ADVTXD_POPTS_ISCO_MDL 0x00000800 /* Middle TSO of iSCSI PDU */ |
2363 | #define IXGBE_ADVTXD_POPTS_ISCO_LAST 0x00001000 /* Last TSO of iSCSI PDU */ | 2363 | #define IXGBE_ADVTXD_POPTS_ISCO_LAST 0x00001000 /* Last TSO of iSCSI PDU */ |
2364 | #define IXGBE_ADVTXD_POPTS_ISCO_FULL 0x00001800 /* 1st&Last TSO-full iSCSI PDU */ | 2364 | #define IXGBE_ADVTXD_POPTS_ISCO_FULL 0x00001800 /* 1st&Last TSO-full iSCSI PDU */ |
2365 | #define IXGBE_ADVTXD_POPTS_RSV 0x00002000 /* POPTS Reserved */ | 2365 | #define IXGBE_ADVTXD_POPTS_RSV 0x00002000 /* POPTS Reserved */ |
2366 | #define IXGBE_ADVTXD_PAYLEN_SHIFT 14 /* Adv desc PAYLEN shift */ | 2366 | #define IXGBE_ADVTXD_PAYLEN_SHIFT 14 /* Adv desc PAYLEN shift */ |
2367 | #define IXGBE_ADVTXD_MACLEN_SHIFT 9 /* Adv ctxt desc mac len shift */ | 2367 | #define IXGBE_ADVTXD_MACLEN_SHIFT 9 /* Adv ctxt desc mac len shift */ |
2368 | #define IXGBE_ADVTXD_VLAN_SHIFT 16 /* Adv ctxt vlan tag shift */ | 2368 | #define IXGBE_ADVTXD_VLAN_SHIFT 16 /* Adv ctxt vlan tag shift */ |
2369 | #define IXGBE_ADVTXD_TUCMD_IPV4 0x00000400 /* IP Packet Type: 1=IPv4 */ | 2369 | #define IXGBE_ADVTXD_TUCMD_IPV4 0x00000400 /* IP Packet Type: 1=IPv4 */ |
2370 | #define IXGBE_ADVTXD_TUCMD_IPV6 0x00000000 /* IP Packet Type: 0=IPv6 */ | 2370 | #define IXGBE_ADVTXD_TUCMD_IPV6 0x00000000 /* IP Packet Type: 0=IPv6 */ |
2371 | #define IXGBE_ADVTXD_TUCMD_L4T_UDP 0x00000000 /* L4 Packet TYPE of UDP */ | 2371 | #define IXGBE_ADVTXD_TUCMD_L4T_UDP 0x00000000 /* L4 Packet TYPE of UDP */ |
2372 | #define IXGBE_ADVTXD_TUCMD_L4T_TCP 0x00000800 /* L4 Packet TYPE of TCP */ | 2372 | #define IXGBE_ADVTXD_TUCMD_L4T_TCP 0x00000800 /* L4 Packet TYPE of TCP */ |
2373 | #define IXGBE_ADVTXD_TUCMD_L4T_SCTP 0x00001000 /* L4 Packet TYPE of SCTP */ | 2373 | #define IXGBE_ADVTXD_TUCMD_L4T_SCTP 0x00001000 /* L4 Packet TYPE of SCTP */ |
2374 | #define IXGBE_ADVTXD_TUCMD_MKRREQ 0x00002000 /*Req requires Markers and CRC*/ | 2374 | #define IXGBE_ADVTXD_TUCMD_MKRREQ 0x00002000 /*Req requires Markers and CRC*/ |
2375 | #define IXGBE_ADVTXD_POPTS_IPSEC 0x00000400 /* IPSec offload request */ | 2375 | #define IXGBE_ADVTXD_POPTS_IPSEC 0x00000400 /* IPSec offload request */ |
2376 | #define IXGBE_ADVTXD_TUCMD_IPSEC_TYPE_ESP 0x00002000 /* IPSec Type ESP */ | 2376 | #define IXGBE_ADVTXD_TUCMD_IPSEC_TYPE_ESP 0x00002000 /* IPSec Type ESP */ |
2377 | #define IXGBE_ADVTXD_TUCMD_IPSEC_ENCRYPT_EN 0x00004000/* ESP Encrypt Enable */ | 2377 | #define IXGBE_ADVTXD_TUCMD_IPSEC_ENCRYPT_EN 0x00004000/* ESP Encrypt Enable */ |
2378 | #define IXGBE_ADVTXT_TUCMD_FCOE 0x00008000 /* FCoE Frame Type */ | 2378 | #define IXGBE_ADVTXT_TUCMD_FCOE 0x00008000 /* FCoE Frame Type */ |
2379 | #define IXGBE_ADVTXD_FCOEF_EOF_MASK (0x3 << 10) /* FC EOF index */ | 2379 | #define IXGBE_ADVTXD_FCOEF_EOF_MASK (0x3 << 10) /* FC EOF index */ |
2380 | #define IXGBE_ADVTXD_FCOEF_SOF ((1 << 2) << 10) /* FC SOF index */ | 2380 | #define IXGBE_ADVTXD_FCOEF_SOF ((1 << 2) << 10) /* FC SOF index */ |
2381 | #define IXGBE_ADVTXD_FCOEF_PARINC ((1 << 3) << 10) /* Rel_Off in F_CTL */ | 2381 | #define IXGBE_ADVTXD_FCOEF_PARINC ((1 << 3) << 10) /* Rel_Off in F_CTL */ |
2382 | #define IXGBE_ADVTXD_FCOEF_ORIE ((1 << 4) << 10) /* Orientation: End */ | 2382 | #define IXGBE_ADVTXD_FCOEF_ORIE ((1 << 4) << 10) /* Orientation: End */ |
2383 | #define IXGBE_ADVTXD_FCOEF_ORIS ((1 << 5) << 10) /* Orientation: Start */ | 2383 | #define IXGBE_ADVTXD_FCOEF_ORIS ((1 << 5) << 10) /* Orientation: Start */ |
2384 | #define IXGBE_ADVTXD_FCOEF_EOF_N (0x0 << 10) /* 00: EOFn */ | 2384 | #define IXGBE_ADVTXD_FCOEF_EOF_N (0x0 << 10) /* 00: EOFn */ |
2385 | #define IXGBE_ADVTXD_FCOEF_EOF_T (0x1 << 10) /* 01: EOFt */ | 2385 | #define IXGBE_ADVTXD_FCOEF_EOF_T (0x1 << 10) /* 01: EOFt */ |
2386 | #define IXGBE_ADVTXD_FCOEF_EOF_NI (0x2 << 10) /* 10: EOFni */ | 2386 | #define IXGBE_ADVTXD_FCOEF_EOF_NI (0x2 << 10) /* 10: EOFni */ |
2387 | #define IXGBE_ADVTXD_FCOEF_EOF_A (0x3 << 10) /* 11: EOFa */ | 2387 | #define IXGBE_ADVTXD_FCOEF_EOF_A (0x3 << 10) /* 11: EOFa */ |
2388 | #define IXGBE_ADVTXD_L4LEN_SHIFT 8 /* Adv ctxt L4LEN shift */ | 2388 | #define IXGBE_ADVTXD_L4LEN_SHIFT 8 /* Adv ctxt L4LEN shift */ |
2389 | #define IXGBE_ADVTXD_MSS_SHIFT 16 /* Adv ctxt MSS shift */ | 2389 | #define IXGBE_ADVTXD_MSS_SHIFT 16 /* Adv ctxt MSS shift */ |
2390 | 2390 | ||
2391 | /* Autonegotiation advertised speeds */ | 2391 | /* Autonegotiation advertised speeds */ |
2392 | typedef u32 ixgbe_autoneg_advertised; | 2392 | typedef u32 ixgbe_autoneg_advertised; |
2393 | /* Link speed */ | 2393 | /* Link speed */ |
2394 | typedef u32 ixgbe_link_speed; | 2394 | typedef u32 ixgbe_link_speed; |
2395 | #define IXGBE_LINK_SPEED_UNKNOWN 0 | 2395 | #define IXGBE_LINK_SPEED_UNKNOWN 0 |
2396 | #define IXGBE_LINK_SPEED_100_FULL 0x0008 | 2396 | #define IXGBE_LINK_SPEED_100_FULL 0x0008 |
2397 | #define IXGBE_LINK_SPEED_1GB_FULL 0x0020 | 2397 | #define IXGBE_LINK_SPEED_1GB_FULL 0x0020 |
2398 | #define IXGBE_LINK_SPEED_10GB_FULL 0x0080 | 2398 | #define IXGBE_LINK_SPEED_10GB_FULL 0x0080 |
2399 | #define IXGBE_LINK_SPEED_82598_AUTONEG (IXGBE_LINK_SPEED_1GB_FULL | \ | 2399 | #define IXGBE_LINK_SPEED_82598_AUTONEG (IXGBE_LINK_SPEED_1GB_FULL | \ |
2400 | IXGBE_LINK_SPEED_10GB_FULL) | 2400 | IXGBE_LINK_SPEED_10GB_FULL) |
2401 | #define IXGBE_LINK_SPEED_82599_AUTONEG (IXGBE_LINK_SPEED_100_FULL | \ | 2401 | #define IXGBE_LINK_SPEED_82599_AUTONEG (IXGBE_LINK_SPEED_100_FULL | \ |
2402 | IXGBE_LINK_SPEED_1GB_FULL | \ | 2402 | IXGBE_LINK_SPEED_1GB_FULL | \ |
2403 | IXGBE_LINK_SPEED_10GB_FULL) | 2403 | IXGBE_LINK_SPEED_10GB_FULL) |
2404 | 2404 | ||
2405 | 2405 | ||
2406 | /* Physical layer type */ | 2406 | /* Physical layer type */ |
2407 | typedef u32 ixgbe_physical_layer; | 2407 | typedef u32 ixgbe_physical_layer; |
2408 | #define IXGBE_PHYSICAL_LAYER_UNKNOWN 0 | 2408 | #define IXGBE_PHYSICAL_LAYER_UNKNOWN 0 |
2409 | #define IXGBE_PHYSICAL_LAYER_10GBASE_T 0x0001 | 2409 | #define IXGBE_PHYSICAL_LAYER_10GBASE_T 0x0001 |
2410 | #define IXGBE_PHYSICAL_LAYER_1000BASE_T 0x0002 | 2410 | #define IXGBE_PHYSICAL_LAYER_1000BASE_T 0x0002 |
2411 | #define IXGBE_PHYSICAL_LAYER_100BASE_TX 0x0004 | 2411 | #define IXGBE_PHYSICAL_LAYER_100BASE_TX 0x0004 |
2412 | #define IXGBE_PHYSICAL_LAYER_SFP_PLUS_CU 0x0008 | 2412 | #define IXGBE_PHYSICAL_LAYER_SFP_PLUS_CU 0x0008 |
2413 | #define IXGBE_PHYSICAL_LAYER_10GBASE_LR 0x0010 | 2413 | #define IXGBE_PHYSICAL_LAYER_10GBASE_LR 0x0010 |
2414 | #define IXGBE_PHYSICAL_LAYER_10GBASE_LRM 0x0020 | 2414 | #define IXGBE_PHYSICAL_LAYER_10GBASE_LRM 0x0020 |
2415 | #define IXGBE_PHYSICAL_LAYER_10GBASE_SR 0x0040 | 2415 | #define IXGBE_PHYSICAL_LAYER_10GBASE_SR 0x0040 |
2416 | #define IXGBE_PHYSICAL_LAYER_10GBASE_KX4 0x0080 | 2416 | #define IXGBE_PHYSICAL_LAYER_10GBASE_KX4 0x0080 |
2417 | #define IXGBE_PHYSICAL_LAYER_10GBASE_CX4 0x0100 | 2417 | #define IXGBE_PHYSICAL_LAYER_10GBASE_CX4 0x0100 |
2418 | #define IXGBE_PHYSICAL_LAYER_1000BASE_KX 0x0200 | 2418 | #define IXGBE_PHYSICAL_LAYER_1000BASE_KX 0x0200 |
2419 | #define IXGBE_PHYSICAL_LAYER_1000BASE_BX 0x0400 | 2419 | #define IXGBE_PHYSICAL_LAYER_1000BASE_BX 0x0400 |
2420 | #define IXGBE_PHYSICAL_LAYER_10GBASE_KR 0x0800 | 2420 | #define IXGBE_PHYSICAL_LAYER_10GBASE_KR 0x0800 |
2421 | #define IXGBE_PHYSICAL_LAYER_10GBASE_XAUI 0x1000 | 2421 | #define IXGBE_PHYSICAL_LAYER_10GBASE_XAUI 0x1000 |
2422 | #define IXGBE_PHYSICAL_LAYER_SFP_ACTIVE_DA 0x2000 | 2422 | #define IXGBE_PHYSICAL_LAYER_SFP_ACTIVE_DA 0x2000 |
2423 | 2423 | ||
2424 | /* Flow Control Data Sheet defined values | 2424 | /* Flow Control Data Sheet defined values |
2425 | * Calculation and defines taken from 802.1bb Annex O | 2425 | * Calculation and defines taken from 802.1bb Annex O |
2426 | */ | 2426 | */ |
2427 | 2427 | ||
2428 | /* BitTimes (BT) conversion */ | 2428 | /* BitTimes (BT) conversion */ |
2429 | #define IXGBE_BT2KB(BT) ((BT + (8 * 1024 - 1)) / (8 * 1024)) | 2429 | #define IXGBE_BT2KB(BT) ((BT + (8 * 1024 - 1)) / (8 * 1024)) |
2430 | #define IXGBE_B2BT(BT) (BT * 8) | 2430 | #define IXGBE_B2BT(BT) (BT * 8) |
2431 | 2431 | ||
2432 | /* Calculate Delay to respond to PFC */ | 2432 | /* Calculate Delay to respond to PFC */ |
2433 | #define IXGBE_PFC_D 672 | 2433 | #define IXGBE_PFC_D 672 |
2434 | 2434 | ||
2435 | /* Calculate Cable Delay */ | 2435 | /* Calculate Cable Delay */ |
2436 | #define IXGBE_CABLE_DC 5556 /* Delay Copper */ | 2436 | #define IXGBE_CABLE_DC 5556 /* Delay Copper */ |
2437 | #define IXGBE_CABLE_DO 5000 /* Delay Optical */ | 2437 | #define IXGBE_CABLE_DO 5000 /* Delay Optical */ |
2438 | 2438 | ||
2439 | /* Calculate Interface Delay X540 */ | 2439 | /* Calculate Interface Delay X540 */ |
2440 | #define IXGBE_PHY_DC 25600 /* Delay 10G BASET */ | 2440 | #define IXGBE_PHY_DC 25600 /* Delay 10G BASET */ |
2441 | #define IXGBE_MAC_DC 8192 /* Delay Copper XAUI interface */ | 2441 | #define IXGBE_MAC_DC 8192 /* Delay Copper XAUI interface */ |
2442 | #define IXGBE_XAUI_DC (2 * 2048) /* Delay Copper Phy */ | 2442 | #define IXGBE_XAUI_DC (2 * 2048) /* Delay Copper Phy */ |
2443 | 2443 | ||
2444 | #define IXGBE_ID_X540 (IXGBE_MAC_DC + IXGBE_XAUI_DC + IXGBE_PHY_DC) | 2444 | #define IXGBE_ID_X540 (IXGBE_MAC_DC + IXGBE_XAUI_DC + IXGBE_PHY_DC) |
2445 | 2445 | ||
2446 | /* Calculate Interface Delay 82598, 82599 */ | 2446 | /* Calculate Interface Delay 82598, 82599 */ |
2447 | #define IXGBE_PHY_D 12800 | 2447 | #define IXGBE_PHY_D 12800 |
2448 | #define IXGBE_MAC_D 4096 | 2448 | #define IXGBE_MAC_D 4096 |
2449 | #define IXGBE_XAUI_D (2 * 1024) | 2449 | #define IXGBE_XAUI_D (2 * 1024) |
2450 | 2450 | ||
2451 | #define IXGBE_ID (IXGBE_MAC_D + IXGBE_XAUI_D + IXGBE_PHY_D) | 2451 | #define IXGBE_ID (IXGBE_MAC_D + IXGBE_XAUI_D + IXGBE_PHY_D) |
2452 | 2452 | ||
2453 | /* Calculate Delay incurred from higher layer */ | 2453 | /* Calculate Delay incurred from higher layer */ |
2454 | #define IXGBE_HD 6144 | 2454 | #define IXGBE_HD 6144 |
2455 | 2455 | ||
2456 | /* Calculate PCI Bus delay for low thresholds */ | 2456 | /* Calculate PCI Bus delay for low thresholds */ |
2457 | #define IXGBE_PCI_DELAY 10000 | 2457 | #define IXGBE_PCI_DELAY 10000 |
2458 | 2458 | ||
2459 | /* Calculate X540 delay value in bit times */ | 2459 | /* Calculate X540 delay value in bit times */ |
2460 | #define IXGBE_DV_X540(_max_frame_link, _max_frame_tc) \ | 2460 | #define IXGBE_DV_X540(_max_frame_link, _max_frame_tc) \ |
2461 | ((36 * \ | 2461 | ((36 * \ |
2462 | (IXGBE_B2BT(_max_frame_link) + \ | 2462 | (IXGBE_B2BT(_max_frame_link) + \ |
2463 | IXGBE_PFC_D + \ | 2463 | IXGBE_PFC_D + \ |
2464 | (2 * IXGBE_CABLE_DC) + \ | 2464 | (2 * IXGBE_CABLE_DC) + \ |
2465 | (2 * IXGBE_ID_X540) + \ | 2465 | (2 * IXGBE_ID_X540) + \ |
2466 | IXGBE_HD) / 25 + 1) + \ | 2466 | IXGBE_HD) / 25 + 1) + \ |
2467 | 2 * IXGBE_B2BT(_max_frame_tc)) | 2467 | 2 * IXGBE_B2BT(_max_frame_tc)) |
2468 | 2468 | ||
2469 | /* Calculate 82599, 82598 delay value in bit times */ | 2469 | /* Calculate 82599, 82598 delay value in bit times */ |
2470 | #define IXGBE_DV(_max_frame_link, _max_frame_tc) \ | 2470 | #define IXGBE_DV(_max_frame_link, _max_frame_tc) \ |
2471 | ((36 * \ | 2471 | ((36 * \ |
2472 | (IXGBE_B2BT(_max_frame_link) + \ | 2472 | (IXGBE_B2BT(_max_frame_link) + \ |
2473 | IXGBE_PFC_D + \ | 2473 | IXGBE_PFC_D + \ |
2474 | (2 * IXGBE_CABLE_DC) + \ | 2474 | (2 * IXGBE_CABLE_DC) + \ |
2475 | (2 * IXGBE_ID) + \ | 2475 | (2 * IXGBE_ID) + \ |
2476 | IXGBE_HD) / 25 + 1) + \ | 2476 | IXGBE_HD) / 25 + 1) + \ |
2477 | 2 * IXGBE_B2BT(_max_frame_tc)) | 2477 | 2 * IXGBE_B2BT(_max_frame_tc)) |
2478 | 2478 | ||
2479 | /* Calculate low threshold delay values */ | 2479 | /* Calculate low threshold delay values */ |
2480 | #define IXGBE_LOW_DV_X540(_max_frame_tc) \ | 2480 | #define IXGBE_LOW_DV_X540(_max_frame_tc) \ |
2481 | (2 * IXGBE_B2BT(_max_frame_tc) + \ | 2481 | (2 * IXGBE_B2BT(_max_frame_tc) + \ |
2482 | (36 * IXGBE_PCI_DELAY / 25) + 1) | 2482 | (36 * IXGBE_PCI_DELAY / 25) + 1) |
2483 | #define IXGBE_LOW_DV(_max_frame_tc) \ | 2483 | #define IXGBE_LOW_DV(_max_frame_tc) \ |
2484 | (2 * IXGBE_LOW_DV_X540(_max_frame_tc)) | 2484 | (2 * IXGBE_LOW_DV_X540(_max_frame_tc)) |
2485 | 2485 | ||
2486 | /* Software ATR hash keys */ | 2486 | /* Software ATR hash keys */ |
2487 | #define IXGBE_ATR_BUCKET_HASH_KEY 0x3DAD14E2 | 2487 | #define IXGBE_ATR_BUCKET_HASH_KEY 0x3DAD14E2 |
2488 | #define IXGBE_ATR_SIGNATURE_HASH_KEY 0x174D3614 | 2488 | #define IXGBE_ATR_SIGNATURE_HASH_KEY 0x174D3614 |
2489 | 2489 | ||
2490 | /* Software ATR input stream values and masks */ | 2490 | /* Software ATR input stream values and masks */ |
2491 | #define IXGBE_ATR_HASH_MASK 0x7fff | 2491 | #define IXGBE_ATR_HASH_MASK 0x7fff |
2492 | #define IXGBE_ATR_L4TYPE_MASK 0x3 | 2492 | #define IXGBE_ATR_L4TYPE_MASK 0x3 |
2493 | #define IXGBE_ATR_L4TYPE_UDP 0x1 | 2493 | #define IXGBE_ATR_L4TYPE_UDP 0x1 |
2494 | #define IXGBE_ATR_L4TYPE_TCP 0x2 | 2494 | #define IXGBE_ATR_L4TYPE_TCP 0x2 |
2495 | #define IXGBE_ATR_L4TYPE_SCTP 0x3 | 2495 | #define IXGBE_ATR_L4TYPE_SCTP 0x3 |
2496 | #define IXGBE_ATR_L4TYPE_IPV6_MASK 0x4 | 2496 | #define IXGBE_ATR_L4TYPE_IPV6_MASK 0x4 |
2497 | enum ixgbe_atr_flow_type { | 2497 | enum ixgbe_atr_flow_type { |
2498 | IXGBE_ATR_FLOW_TYPE_IPV4 = 0x0, | 2498 | IXGBE_ATR_FLOW_TYPE_IPV4 = 0x0, |
2499 | IXGBE_ATR_FLOW_TYPE_UDPV4 = 0x1, | 2499 | IXGBE_ATR_FLOW_TYPE_UDPV4 = 0x1, |
2500 | IXGBE_ATR_FLOW_TYPE_TCPV4 = 0x2, | 2500 | IXGBE_ATR_FLOW_TYPE_TCPV4 = 0x2, |
2501 | IXGBE_ATR_FLOW_TYPE_SCTPV4 = 0x3, | 2501 | IXGBE_ATR_FLOW_TYPE_SCTPV4 = 0x3, |
2502 | IXGBE_ATR_FLOW_TYPE_IPV6 = 0x4, | 2502 | IXGBE_ATR_FLOW_TYPE_IPV6 = 0x4, |
2503 | IXGBE_ATR_FLOW_TYPE_UDPV6 = 0x5, | 2503 | IXGBE_ATR_FLOW_TYPE_UDPV6 = 0x5, |
2504 | IXGBE_ATR_FLOW_TYPE_TCPV6 = 0x6, | 2504 | IXGBE_ATR_FLOW_TYPE_TCPV6 = 0x6, |
2505 | IXGBE_ATR_FLOW_TYPE_SCTPV6 = 0x7, | 2505 | IXGBE_ATR_FLOW_TYPE_SCTPV6 = 0x7, |
2506 | }; | 2506 | }; |
2507 | 2507 | ||
2508 | /* Flow Director ATR input struct. */ | 2508 | /* Flow Director ATR input struct. */ |
2509 | union ixgbe_atr_input { | 2509 | union ixgbe_atr_input { |
2510 | /* | 2510 | /* |
2511 | * Byte layout in order, all values with MSB first: | 2511 | * Byte layout in order, all values with MSB first: |
2512 | * | 2512 | * |
2513 | * vm_pool - 1 byte | 2513 | * vm_pool - 1 byte |
2514 | * flow_type - 1 byte | 2514 | * flow_type - 1 byte |
2515 | * vlan_id - 2 bytes | 2515 | * vlan_id - 2 bytes |
2516 | * src_ip - 16 bytes | 2516 | * src_ip - 16 bytes |
2517 | * dst_ip - 16 bytes | 2517 | * dst_ip - 16 bytes |
2518 | * src_port - 2 bytes | 2518 | * src_port - 2 bytes |
2519 | * dst_port - 2 bytes | 2519 | * dst_port - 2 bytes |
2520 | * flex_bytes - 2 bytes | 2520 | * flex_bytes - 2 bytes |
2521 | * bkt_hash - 2 bytes | 2521 | * bkt_hash - 2 bytes |
2522 | */ | 2522 | */ |
2523 | struct { | 2523 | struct { |
2524 | u8 vm_pool; | 2524 | u8 vm_pool; |
2525 | u8 flow_type; | 2525 | u8 flow_type; |
2526 | __be16 vlan_id; | 2526 | __be16 vlan_id; |
2527 | __be32 dst_ip[4]; | 2527 | __be32 dst_ip[4]; |
2528 | __be32 src_ip[4]; | 2528 | __be32 src_ip[4]; |
2529 | __be16 src_port; | 2529 | __be16 src_port; |
2530 | __be16 dst_port; | 2530 | __be16 dst_port; |
2531 | __be16 flex_bytes; | 2531 | __be16 flex_bytes; |
2532 | __be16 bkt_hash; | 2532 | __be16 bkt_hash; |
2533 | } formatted; | 2533 | } formatted; |
2534 | __be32 dword_stream[11]; | 2534 | __be32 dword_stream[11]; |
2535 | }; | 2535 | }; |
2536 | 2536 | ||
2537 | /* Flow Director compressed ATR hash input struct */ | 2537 | /* Flow Director compressed ATR hash input struct */ |
2538 | union ixgbe_atr_hash_dword { | 2538 | union ixgbe_atr_hash_dword { |
2539 | struct { | 2539 | struct { |
2540 | u8 vm_pool; | 2540 | u8 vm_pool; |
2541 | u8 flow_type; | 2541 | u8 flow_type; |
2542 | __be16 vlan_id; | 2542 | __be16 vlan_id; |
2543 | } formatted; | 2543 | } formatted; |
2544 | __be32 ip; | 2544 | __be32 ip; |
2545 | struct { | 2545 | struct { |
2546 | __be16 src; | 2546 | __be16 src; |
2547 | __be16 dst; | 2547 | __be16 dst; |
2548 | } port; | 2548 | } port; |
2549 | __be16 flex_bytes; | 2549 | __be16 flex_bytes; |
2550 | __be32 dword; | 2550 | __be32 dword; |
2551 | }; | 2551 | }; |
2552 | 2552 | ||
2553 | enum ixgbe_eeprom_type { | 2553 | enum ixgbe_eeprom_type { |
2554 | ixgbe_eeprom_uninitialized = 0, | 2554 | ixgbe_eeprom_uninitialized = 0, |
2555 | ixgbe_eeprom_spi, | 2555 | ixgbe_eeprom_spi, |
2556 | ixgbe_flash, | 2556 | ixgbe_flash, |
2557 | ixgbe_eeprom_none /* No NVM support */ | 2557 | ixgbe_eeprom_none /* No NVM support */ |
2558 | }; | 2558 | }; |
2559 | 2559 | ||
2560 | enum ixgbe_mac_type { | 2560 | enum ixgbe_mac_type { |
2561 | ixgbe_mac_unknown = 0, | 2561 | ixgbe_mac_unknown = 0, |
2562 | ixgbe_mac_82598EB, | 2562 | ixgbe_mac_82598EB, |
2563 | ixgbe_mac_82599EB, | 2563 | ixgbe_mac_82599EB, |
2564 | ixgbe_mac_X540, | 2564 | ixgbe_mac_X540, |
2565 | ixgbe_num_macs | 2565 | ixgbe_num_macs |
2566 | }; | 2566 | }; |
2567 | 2567 | ||
2568 | enum ixgbe_phy_type { | 2568 | enum ixgbe_phy_type { |
2569 | ixgbe_phy_unknown = 0, | 2569 | ixgbe_phy_unknown = 0, |
2570 | ixgbe_phy_none, | 2570 | ixgbe_phy_none, |
2571 | ixgbe_phy_tn, | 2571 | ixgbe_phy_tn, |
2572 | ixgbe_phy_aq, | 2572 | ixgbe_phy_aq, |
2573 | ixgbe_phy_cu_unknown, | 2573 | ixgbe_phy_cu_unknown, |
2574 | ixgbe_phy_qt, | 2574 | ixgbe_phy_qt, |
2575 | ixgbe_phy_xaui, | 2575 | ixgbe_phy_xaui, |
2576 | ixgbe_phy_nl, | 2576 | ixgbe_phy_nl, |
2577 | ixgbe_phy_sfp_passive_tyco, | 2577 | ixgbe_phy_sfp_passive_tyco, |
2578 | ixgbe_phy_sfp_passive_unknown, | 2578 | ixgbe_phy_sfp_passive_unknown, |
2579 | ixgbe_phy_sfp_active_unknown, | 2579 | ixgbe_phy_sfp_active_unknown, |
2580 | ixgbe_phy_sfp_avago, | 2580 | ixgbe_phy_sfp_avago, |
2581 | ixgbe_phy_sfp_ftl, | 2581 | ixgbe_phy_sfp_ftl, |
2582 | ixgbe_phy_sfp_ftl_active, | 2582 | ixgbe_phy_sfp_ftl_active, |
2583 | ixgbe_phy_sfp_unknown, | 2583 | ixgbe_phy_sfp_unknown, |
2584 | ixgbe_phy_sfp_intel, | 2584 | ixgbe_phy_sfp_intel, |
2585 | ixgbe_phy_sfp_unsupported, | 2585 | ixgbe_phy_sfp_unsupported, |
2586 | ixgbe_phy_generic | 2586 | ixgbe_phy_generic |
2587 | }; | 2587 | }; |
2588 | 2588 | ||
2589 | /* | 2589 | /* |
2590 | * SFP+ module type IDs: | 2590 | * SFP+ module type IDs: |
2591 | * | 2591 | * |
2592 | * ID Module Type | 2592 | * ID Module Type |
2593 | * ============= | 2593 | * ============= |
2594 | * 0 SFP_DA_CU | 2594 | * 0 SFP_DA_CU |
2595 | * 1 SFP_SR | 2595 | * 1 SFP_SR |
2596 | * 2 SFP_LR | 2596 | * 2 SFP_LR |
2597 | * 3 SFP_DA_CU_CORE0 - 82599-specific | 2597 | * 3 SFP_DA_CU_CORE0 - 82599-specific |
2598 | * 4 SFP_DA_CU_CORE1 - 82599-specific | 2598 | * 4 SFP_DA_CU_CORE1 - 82599-specific |
2599 | * 5 SFP_SR/LR_CORE0 - 82599-specific | 2599 | * 5 SFP_SR/LR_CORE0 - 82599-specific |
2600 | * 6 SFP_SR/LR_CORE1 - 82599-specific | 2600 | * 6 SFP_SR/LR_CORE1 - 82599-specific |
2601 | */ | 2601 | */ |
2602 | enum ixgbe_sfp_type { | 2602 | enum ixgbe_sfp_type { |
2603 | ixgbe_sfp_type_da_cu = 0, | 2603 | ixgbe_sfp_type_da_cu = 0, |
2604 | ixgbe_sfp_type_sr = 1, | 2604 | ixgbe_sfp_type_sr = 1, |
2605 | ixgbe_sfp_type_lr = 2, | 2605 | ixgbe_sfp_type_lr = 2, |
2606 | ixgbe_sfp_type_da_cu_core0 = 3, | 2606 | ixgbe_sfp_type_da_cu_core0 = 3, |
2607 | ixgbe_sfp_type_da_cu_core1 = 4, | 2607 | ixgbe_sfp_type_da_cu_core1 = 4, |
2608 | ixgbe_sfp_type_srlr_core0 = 5, | 2608 | ixgbe_sfp_type_srlr_core0 = 5, |
2609 | ixgbe_sfp_type_srlr_core1 = 6, | 2609 | ixgbe_sfp_type_srlr_core1 = 6, |
2610 | ixgbe_sfp_type_da_act_lmt_core0 = 7, | 2610 | ixgbe_sfp_type_da_act_lmt_core0 = 7, |
2611 | ixgbe_sfp_type_da_act_lmt_core1 = 8, | 2611 | ixgbe_sfp_type_da_act_lmt_core1 = 8, |
2612 | ixgbe_sfp_type_1g_cu_core0 = 9, | 2612 | ixgbe_sfp_type_1g_cu_core0 = 9, |
2613 | ixgbe_sfp_type_1g_cu_core1 = 10, | 2613 | ixgbe_sfp_type_1g_cu_core1 = 10, |
2614 | ixgbe_sfp_type_1g_sx_core0 = 11, | 2614 | ixgbe_sfp_type_1g_sx_core0 = 11, |
2615 | ixgbe_sfp_type_1g_sx_core1 = 12, | 2615 | ixgbe_sfp_type_1g_sx_core1 = 12, |
2616 | ixgbe_sfp_type_1g_lx_core0 = 13, | 2616 | ixgbe_sfp_type_1g_lx_core0 = 13, |
2617 | ixgbe_sfp_type_1g_lx_core1 = 14, | 2617 | ixgbe_sfp_type_1g_lx_core1 = 14, |
2618 | ixgbe_sfp_type_not_present = 0xFFFE, | 2618 | ixgbe_sfp_type_not_present = 0xFFFE, |
2619 | ixgbe_sfp_type_unknown = 0xFFFF | 2619 | ixgbe_sfp_type_unknown = 0xFFFF |
2620 | }; | 2620 | }; |
2621 | 2621 | ||
2622 | enum ixgbe_media_type { | 2622 | enum ixgbe_media_type { |
2623 | ixgbe_media_type_unknown = 0, | 2623 | ixgbe_media_type_unknown = 0, |
2624 | ixgbe_media_type_fiber, | 2624 | ixgbe_media_type_fiber, |
2625 | ixgbe_media_type_fiber_fixed, | ||
2625 | ixgbe_media_type_fiber_lco, | 2626 | ixgbe_media_type_fiber_lco, |
2626 | ixgbe_media_type_copper, | 2627 | ixgbe_media_type_copper, |
2627 | ixgbe_media_type_backplane, | 2628 | ixgbe_media_type_backplane, |
2628 | ixgbe_media_type_cx4, | 2629 | ixgbe_media_type_cx4, |
2629 | ixgbe_media_type_virtual | 2630 | ixgbe_media_type_virtual |
2630 | }; | 2631 | }; |
2631 | 2632 | ||
2632 | /* Flow Control Settings */ | 2633 | /* Flow Control Settings */ |
2633 | enum ixgbe_fc_mode { | 2634 | enum ixgbe_fc_mode { |
2634 | ixgbe_fc_none = 0, | 2635 | ixgbe_fc_none = 0, |
2635 | ixgbe_fc_rx_pause, | 2636 | ixgbe_fc_rx_pause, |
2636 | ixgbe_fc_tx_pause, | 2637 | ixgbe_fc_tx_pause, |
2637 | ixgbe_fc_full, | 2638 | ixgbe_fc_full, |
2638 | ixgbe_fc_default | 2639 | ixgbe_fc_default |
2639 | }; | 2640 | }; |
2640 | 2641 | ||
2641 | /* Smart Speed Settings */ | 2642 | /* Smart Speed Settings */ |
2642 | #define IXGBE_SMARTSPEED_MAX_RETRIES 3 | 2643 | #define IXGBE_SMARTSPEED_MAX_RETRIES 3 |
2643 | enum ixgbe_smart_speed { | 2644 | enum ixgbe_smart_speed { |
2644 | ixgbe_smart_speed_auto = 0, | 2645 | ixgbe_smart_speed_auto = 0, |
2645 | ixgbe_smart_speed_on, | 2646 | ixgbe_smart_speed_on, |
2646 | ixgbe_smart_speed_off | 2647 | ixgbe_smart_speed_off |
2647 | }; | 2648 | }; |
2648 | 2649 | ||
2649 | /* PCI bus types */ | 2650 | /* PCI bus types */ |
2650 | enum ixgbe_bus_type { | 2651 | enum ixgbe_bus_type { |
2651 | ixgbe_bus_type_unknown = 0, | 2652 | ixgbe_bus_type_unknown = 0, |
2652 | ixgbe_bus_type_pci, | 2653 | ixgbe_bus_type_pci, |
2653 | ixgbe_bus_type_pcix, | 2654 | ixgbe_bus_type_pcix, |
2654 | ixgbe_bus_type_pci_express, | 2655 | ixgbe_bus_type_pci_express, |
2655 | ixgbe_bus_type_reserved | 2656 | ixgbe_bus_type_reserved |
2656 | }; | 2657 | }; |
2657 | 2658 | ||
2658 | /* PCI bus speeds */ | 2659 | /* PCI bus speeds */ |
2659 | enum ixgbe_bus_speed { | 2660 | enum ixgbe_bus_speed { |
2660 | ixgbe_bus_speed_unknown = 0, | 2661 | ixgbe_bus_speed_unknown = 0, |
2661 | ixgbe_bus_speed_33 = 33, | 2662 | ixgbe_bus_speed_33 = 33, |
2662 | ixgbe_bus_speed_66 = 66, | 2663 | ixgbe_bus_speed_66 = 66, |
2663 | ixgbe_bus_speed_100 = 100, | 2664 | ixgbe_bus_speed_100 = 100, |
2664 | ixgbe_bus_speed_120 = 120, | 2665 | ixgbe_bus_speed_120 = 120, |
2665 | ixgbe_bus_speed_133 = 133, | 2666 | ixgbe_bus_speed_133 = 133, |
2666 | ixgbe_bus_speed_2500 = 2500, | 2667 | ixgbe_bus_speed_2500 = 2500, |
2667 | ixgbe_bus_speed_5000 = 5000, | 2668 | ixgbe_bus_speed_5000 = 5000, |
2668 | ixgbe_bus_speed_8000 = 8000, | 2669 | ixgbe_bus_speed_8000 = 8000, |
2669 | ixgbe_bus_speed_reserved | 2670 | ixgbe_bus_speed_reserved |
2670 | }; | 2671 | }; |
2671 | 2672 | ||
2672 | /* PCI bus widths */ | 2673 | /* PCI bus widths */ |
2673 | enum ixgbe_bus_width { | 2674 | enum ixgbe_bus_width { |
2674 | ixgbe_bus_width_unknown = 0, | 2675 | ixgbe_bus_width_unknown = 0, |
2675 | ixgbe_bus_width_pcie_x1 = 1, | 2676 | ixgbe_bus_width_pcie_x1 = 1, |
2676 | ixgbe_bus_width_pcie_x2 = 2, | 2677 | ixgbe_bus_width_pcie_x2 = 2, |
2677 | ixgbe_bus_width_pcie_x4 = 4, | 2678 | ixgbe_bus_width_pcie_x4 = 4, |
2678 | ixgbe_bus_width_pcie_x8 = 8, | 2679 | ixgbe_bus_width_pcie_x8 = 8, |
2679 | ixgbe_bus_width_32 = 32, | 2680 | ixgbe_bus_width_32 = 32, |
2680 | ixgbe_bus_width_64 = 64, | 2681 | ixgbe_bus_width_64 = 64, |
2681 | ixgbe_bus_width_reserved | 2682 | ixgbe_bus_width_reserved |
2682 | }; | 2683 | }; |
2683 | 2684 | ||
2684 | struct ixgbe_addr_filter_info { | 2685 | struct ixgbe_addr_filter_info { |
2685 | u32 num_mc_addrs; | 2686 | u32 num_mc_addrs; |
2686 | u32 rar_used_count; | 2687 | u32 rar_used_count; |
2687 | u32 mta_in_use; | 2688 | u32 mta_in_use; |
2688 | u32 overflow_promisc; | 2689 | u32 overflow_promisc; |
2689 | bool uc_set_promisc; | 2690 | bool uc_set_promisc; |
2690 | bool user_set_promisc; | 2691 | bool user_set_promisc; |
2691 | }; | 2692 | }; |
2692 | 2693 | ||
2693 | /* Bus parameters */ | 2694 | /* Bus parameters */ |
2694 | struct ixgbe_bus_info { | 2695 | struct ixgbe_bus_info { |
2695 | enum ixgbe_bus_speed speed; | 2696 | enum ixgbe_bus_speed speed; |
2696 | enum ixgbe_bus_width width; | 2697 | enum ixgbe_bus_width width; |
2697 | enum ixgbe_bus_type type; | 2698 | enum ixgbe_bus_type type; |
2698 | 2699 | ||
2699 | u16 func; | 2700 | u16 func; |
2700 | u16 lan_id; | 2701 | u16 lan_id; |
2701 | }; | 2702 | }; |
2702 | 2703 | ||
2703 | /* Flow control parameters */ | 2704 | /* Flow control parameters */ |
2704 | struct ixgbe_fc_info { | 2705 | struct ixgbe_fc_info { |
2705 | u32 high_water[MAX_TRAFFIC_CLASS]; /* Flow Control High-water */ | 2706 | u32 high_water[MAX_TRAFFIC_CLASS]; /* Flow Control High-water */ |
2706 | u32 low_water; /* Flow Control Low-water */ | 2707 | u32 low_water; /* Flow Control Low-water */ |
2707 | u16 pause_time; /* Flow Control Pause timer */ | 2708 | u16 pause_time; /* Flow Control Pause timer */ |
2708 | bool send_xon; /* Flow control send XON */ | 2709 | bool send_xon; /* Flow control send XON */ |
2709 | bool strict_ieee; /* Strict IEEE mode */ | 2710 | bool strict_ieee; /* Strict IEEE mode */ |
2710 | bool disable_fc_autoneg; /* Do not autonegotiate FC */ | 2711 | bool disable_fc_autoneg; /* Do not autonegotiate FC */ |
2711 | bool fc_was_autonegged; /* Is current_mode the result of autonegging? */ | 2712 | bool fc_was_autonegged; /* Is current_mode the result of autonegging? */ |
2712 | enum ixgbe_fc_mode current_mode; /* FC mode in effect */ | 2713 | enum ixgbe_fc_mode current_mode; /* FC mode in effect */ |
2713 | enum ixgbe_fc_mode requested_mode; /* FC mode requested by caller */ | 2714 | enum ixgbe_fc_mode requested_mode; /* FC mode requested by caller */ |
2714 | }; | 2715 | }; |
2715 | 2716 | ||
2716 | /* Statistics counters collected by the MAC */ | 2717 | /* Statistics counters collected by the MAC */ |
2717 | struct ixgbe_hw_stats { | 2718 | struct ixgbe_hw_stats { |
2718 | u64 crcerrs; | 2719 | u64 crcerrs; |
2719 | u64 illerrc; | 2720 | u64 illerrc; |
2720 | u64 errbc; | 2721 | u64 errbc; |
2721 | u64 mspdc; | 2722 | u64 mspdc; |
2722 | u64 mpctotal; | 2723 | u64 mpctotal; |
2723 | u64 mpc[8]; | 2724 | u64 mpc[8]; |
2724 | u64 mlfc; | 2725 | u64 mlfc; |
2725 | u64 mrfc; | 2726 | u64 mrfc; |
2726 | u64 rlec; | 2727 | u64 rlec; |
2727 | u64 lxontxc; | 2728 | u64 lxontxc; |
2728 | u64 lxonrxc; | 2729 | u64 lxonrxc; |
2729 | u64 lxofftxc; | 2730 | u64 lxofftxc; |
2730 | u64 lxoffrxc; | 2731 | u64 lxoffrxc; |
2731 | u64 pxontxc[8]; | 2732 | u64 pxontxc[8]; |
2732 | u64 pxonrxc[8]; | 2733 | u64 pxonrxc[8]; |
2733 | u64 pxofftxc[8]; | 2734 | u64 pxofftxc[8]; |
2734 | u64 pxoffrxc[8]; | 2735 | u64 pxoffrxc[8]; |
2735 | u64 prc64; | 2736 | u64 prc64; |
2736 | u64 prc127; | 2737 | u64 prc127; |
2737 | u64 prc255; | 2738 | u64 prc255; |
2738 | u64 prc511; | 2739 | u64 prc511; |
2739 | u64 prc1023; | 2740 | u64 prc1023; |
2740 | u64 prc1522; | 2741 | u64 prc1522; |
2741 | u64 gprc; | 2742 | u64 gprc; |
2742 | u64 bprc; | 2743 | u64 bprc; |
2743 | u64 mprc; | 2744 | u64 mprc; |
2744 | u64 gptc; | 2745 | u64 gptc; |
2745 | u64 gorc; | 2746 | u64 gorc; |
2746 | u64 gotc; | 2747 | u64 gotc; |
2747 | u64 rnbc[8]; | 2748 | u64 rnbc[8]; |
2748 | u64 ruc; | 2749 | u64 ruc; |
2749 | u64 rfc; | 2750 | u64 rfc; |
2750 | u64 roc; | 2751 | u64 roc; |
2751 | u64 rjc; | 2752 | u64 rjc; |
2752 | u64 mngprc; | 2753 | u64 mngprc; |
2753 | u64 mngpdc; | 2754 | u64 mngpdc; |
2754 | u64 mngptc; | 2755 | u64 mngptc; |
2755 | u64 tor; | 2756 | u64 tor; |
2756 | u64 tpr; | 2757 | u64 tpr; |
2757 | u64 tpt; | 2758 | u64 tpt; |
2758 | u64 ptc64; | 2759 | u64 ptc64; |
2759 | u64 ptc127; | 2760 | u64 ptc127; |
2760 | u64 ptc255; | 2761 | u64 ptc255; |
2761 | u64 ptc511; | 2762 | u64 ptc511; |
2762 | u64 ptc1023; | 2763 | u64 ptc1023; |
2763 | u64 ptc1522; | 2764 | u64 ptc1522; |
2764 | u64 mptc; | 2765 | u64 mptc; |
2765 | u64 bptc; | 2766 | u64 bptc; |
2766 | u64 xec; | 2767 | u64 xec; |
2767 | u64 rqsmr[16]; | 2768 | u64 rqsmr[16]; |
2768 | u64 tqsmr[8]; | 2769 | u64 tqsmr[8]; |
2769 | u64 qprc[16]; | 2770 | u64 qprc[16]; |
2770 | u64 qptc[16]; | 2771 | u64 qptc[16]; |
2771 | u64 qbrc[16]; | 2772 | u64 qbrc[16]; |
2772 | u64 qbtc[16]; | 2773 | u64 qbtc[16]; |
2773 | u64 qprdc[16]; | 2774 | u64 qprdc[16]; |
2774 | u64 pxon2offc[8]; | 2775 | u64 pxon2offc[8]; |
2775 | u64 fdirustat_add; | 2776 | u64 fdirustat_add; |
2776 | u64 fdirustat_remove; | 2777 | u64 fdirustat_remove; |
2777 | u64 fdirfstat_fadd; | 2778 | u64 fdirfstat_fadd; |
2778 | u64 fdirfstat_fremove; | 2779 | u64 fdirfstat_fremove; |
2779 | u64 fdirmatch; | 2780 | u64 fdirmatch; |
2780 | u64 fdirmiss; | 2781 | u64 fdirmiss; |
2781 | u64 fccrc; | 2782 | u64 fccrc; |
2782 | u64 fcoerpdc; | 2783 | u64 fcoerpdc; |
2783 | u64 fcoeprc; | 2784 | u64 fcoeprc; |
2784 | u64 fcoeptc; | 2785 | u64 fcoeptc; |
2785 | u64 fcoedwrc; | 2786 | u64 fcoedwrc; |
2786 | u64 fcoedwtc; | 2787 | u64 fcoedwtc; |
2787 | u64 fcoe_noddp; | 2788 | u64 fcoe_noddp; |
2788 | u64 fcoe_noddp_ext_buff; | 2789 | u64 fcoe_noddp_ext_buff; |
2789 | u64 b2ospc; | 2790 | u64 b2ospc; |
2790 | u64 b2ogprc; | 2791 | u64 b2ogprc; |
2791 | u64 o2bgptc; | 2792 | u64 o2bgptc; |
2792 | u64 o2bspc; | 2793 | u64 o2bspc; |
2793 | }; | 2794 | }; |
2794 | 2795 | ||
2795 | /* forward declaration */ | 2796 | /* forward declaration */ |
2796 | struct ixgbe_hw; | 2797 | struct ixgbe_hw; |
2797 | 2798 | ||
2798 | /* iterator type for walking multicast address lists */ | 2799 | /* iterator type for walking multicast address lists */ |
2799 | typedef u8* (*ixgbe_mc_addr_itr) (struct ixgbe_hw *hw, u8 **mc_addr_ptr, | 2800 | typedef u8* (*ixgbe_mc_addr_itr) (struct ixgbe_hw *hw, u8 **mc_addr_ptr, |
2800 | u32 *vmdq); | 2801 | u32 *vmdq); |
2801 | 2802 | ||
2802 | /* Function pointer table */ | 2803 | /* Function pointer table */ |
2803 | struct ixgbe_eeprom_operations { | 2804 | struct ixgbe_eeprom_operations { |
2804 | s32 (*init_params)(struct ixgbe_hw *); | 2805 | s32 (*init_params)(struct ixgbe_hw *); |
2805 | s32 (*read)(struct ixgbe_hw *, u16, u16 *); | 2806 | s32 (*read)(struct ixgbe_hw *, u16, u16 *); |
2806 | s32 (*read_buffer)(struct ixgbe_hw *, u16, u16, u16 *); | 2807 | s32 (*read_buffer)(struct ixgbe_hw *, u16, u16, u16 *); |
2807 | s32 (*write)(struct ixgbe_hw *, u16, u16); | 2808 | s32 (*write)(struct ixgbe_hw *, u16, u16); |
2808 | s32 (*write_buffer)(struct ixgbe_hw *, u16, u16, u16 *); | 2809 | s32 (*write_buffer)(struct ixgbe_hw *, u16, u16, u16 *); |
2809 | s32 (*validate_checksum)(struct ixgbe_hw *, u16 *); | 2810 | s32 (*validate_checksum)(struct ixgbe_hw *, u16 *); |
2810 | s32 (*update_checksum)(struct ixgbe_hw *); | 2811 | s32 (*update_checksum)(struct ixgbe_hw *); |
2811 | u16 (*calc_checksum)(struct ixgbe_hw *); | 2812 | u16 (*calc_checksum)(struct ixgbe_hw *); |
2812 | }; | 2813 | }; |
2813 | 2814 | ||
2814 | struct ixgbe_mac_operations { | 2815 | struct ixgbe_mac_operations { |
2815 | s32 (*init_hw)(struct ixgbe_hw *); | 2816 | s32 (*init_hw)(struct ixgbe_hw *); |
2816 | s32 (*reset_hw)(struct ixgbe_hw *); | 2817 | s32 (*reset_hw)(struct ixgbe_hw *); |
2817 | s32 (*start_hw)(struct ixgbe_hw *); | 2818 | s32 (*start_hw)(struct ixgbe_hw *); |
2818 | s32 (*clear_hw_cntrs)(struct ixgbe_hw *); | 2819 | s32 (*clear_hw_cntrs)(struct ixgbe_hw *); |
2819 | enum ixgbe_media_type (*get_media_type)(struct ixgbe_hw *); | 2820 | enum ixgbe_media_type (*get_media_type)(struct ixgbe_hw *); |
2820 | u32 (*get_supported_physical_layer)(struct ixgbe_hw *); | 2821 | u32 (*get_supported_physical_layer)(struct ixgbe_hw *); |
2821 | s32 (*get_mac_addr)(struct ixgbe_hw *, u8 *); | 2822 | s32 (*get_mac_addr)(struct ixgbe_hw *, u8 *); |
2822 | s32 (*get_san_mac_addr)(struct ixgbe_hw *, u8 *); | 2823 | s32 (*get_san_mac_addr)(struct ixgbe_hw *, u8 *); |
2823 | s32 (*get_device_caps)(struct ixgbe_hw *, u16 *); | 2824 | s32 (*get_device_caps)(struct ixgbe_hw *, u16 *); |
2824 | s32 (*get_wwn_prefix)(struct ixgbe_hw *, u16 *, u16 *); | 2825 | s32 (*get_wwn_prefix)(struct ixgbe_hw *, u16 *, u16 *); |
2825 | s32 (*stop_adapter)(struct ixgbe_hw *); | 2826 | s32 (*stop_adapter)(struct ixgbe_hw *); |
2826 | s32 (*get_bus_info)(struct ixgbe_hw *); | 2827 | s32 (*get_bus_info)(struct ixgbe_hw *); |
2827 | void (*set_lan_id)(struct ixgbe_hw *); | 2828 | void (*set_lan_id)(struct ixgbe_hw *); |
2828 | s32 (*read_analog_reg8)(struct ixgbe_hw*, u32, u8*); | 2829 | s32 (*read_analog_reg8)(struct ixgbe_hw*, u32, u8*); |
2829 | s32 (*write_analog_reg8)(struct ixgbe_hw*, u32, u8); | 2830 | s32 (*write_analog_reg8)(struct ixgbe_hw*, u32, u8); |
2830 | s32 (*setup_sfp)(struct ixgbe_hw *); | 2831 | s32 (*setup_sfp)(struct ixgbe_hw *); |
2831 | s32 (*disable_rx_buff)(struct ixgbe_hw *); | 2832 | s32 (*disable_rx_buff)(struct ixgbe_hw *); |
2832 | s32 (*enable_rx_buff)(struct ixgbe_hw *); | 2833 | s32 (*enable_rx_buff)(struct ixgbe_hw *); |
2833 | s32 (*enable_rx_dma)(struct ixgbe_hw *, u32); | 2834 | s32 (*enable_rx_dma)(struct ixgbe_hw *, u32); |
2834 | s32 (*acquire_swfw_sync)(struct ixgbe_hw *, u16); | 2835 | s32 (*acquire_swfw_sync)(struct ixgbe_hw *, u16); |
2835 | void (*release_swfw_sync)(struct ixgbe_hw *, u16); | 2836 | void (*release_swfw_sync)(struct ixgbe_hw *, u16); |
2836 | 2837 | ||
2837 | /* Link */ | 2838 | /* Link */ |
2838 | void (*disable_tx_laser)(struct ixgbe_hw *); | 2839 | void (*disable_tx_laser)(struct ixgbe_hw *); |
2839 | void (*enable_tx_laser)(struct ixgbe_hw *); | 2840 | void (*enable_tx_laser)(struct ixgbe_hw *); |
2840 | void (*flap_tx_laser)(struct ixgbe_hw *); | 2841 | void (*flap_tx_laser)(struct ixgbe_hw *); |
2841 | s32 (*setup_link)(struct ixgbe_hw *, ixgbe_link_speed, bool); | 2842 | s32 (*setup_link)(struct ixgbe_hw *, ixgbe_link_speed, bool); |
2842 | s32 (*check_link)(struct ixgbe_hw *, ixgbe_link_speed *, bool *, bool); | 2843 | s32 (*check_link)(struct ixgbe_hw *, ixgbe_link_speed *, bool *, bool); |
2843 | s32 (*get_link_capabilities)(struct ixgbe_hw *, ixgbe_link_speed *, | 2844 | s32 (*get_link_capabilities)(struct ixgbe_hw *, ixgbe_link_speed *, |
2844 | bool *); | 2845 | bool *); |
2845 | 2846 | ||
2846 | /* Packet Buffer Manipulation */ | 2847 | /* Packet Buffer Manipulation */ |
2847 | void (*set_rxpba)(struct ixgbe_hw *, int, u32, int); | 2848 | void (*set_rxpba)(struct ixgbe_hw *, int, u32, int); |
2848 | 2849 | ||
2849 | /* LED */ | 2850 | /* LED */ |
2850 | s32 (*led_on)(struct ixgbe_hw *, u32); | 2851 | s32 (*led_on)(struct ixgbe_hw *, u32); |
2851 | s32 (*led_off)(struct ixgbe_hw *, u32); | 2852 | s32 (*led_off)(struct ixgbe_hw *, u32); |
2852 | s32 (*blink_led_start)(struct ixgbe_hw *, u32); | 2853 | s32 (*blink_led_start)(struct ixgbe_hw *, u32); |
2853 | s32 (*blink_led_stop)(struct ixgbe_hw *, u32); | 2854 | s32 (*blink_led_stop)(struct ixgbe_hw *, u32); |
2854 | 2855 | ||
2855 | /* RAR, Multicast, VLAN */ | 2856 | /* RAR, Multicast, VLAN */ |
2856 | s32 (*set_rar)(struct ixgbe_hw *, u32, u8 *, u32, u32); | 2857 | s32 (*set_rar)(struct ixgbe_hw *, u32, u8 *, u32, u32); |
2857 | s32 (*clear_rar)(struct ixgbe_hw *, u32); | 2858 | s32 (*clear_rar)(struct ixgbe_hw *, u32); |
2858 | s32 (*set_vmdq)(struct ixgbe_hw *, u32, u32); | 2859 | s32 (*set_vmdq)(struct ixgbe_hw *, u32, u32); |
2859 | s32 (*set_vmdq_san_mac)(struct ixgbe_hw *, u32); | 2860 | s32 (*set_vmdq_san_mac)(struct ixgbe_hw *, u32); |
2860 | s32 (*clear_vmdq)(struct ixgbe_hw *, u32, u32); | 2861 | s32 (*clear_vmdq)(struct ixgbe_hw *, u32, u32); |
2861 | s32 (*init_rx_addrs)(struct ixgbe_hw *); | 2862 | s32 (*init_rx_addrs)(struct ixgbe_hw *); |
2862 | s32 (*update_mc_addr_list)(struct ixgbe_hw *, struct net_device *); | 2863 | s32 (*update_mc_addr_list)(struct ixgbe_hw *, struct net_device *); |
2863 | s32 (*enable_mc)(struct ixgbe_hw *); | 2864 | s32 (*enable_mc)(struct ixgbe_hw *); |
2864 | s32 (*disable_mc)(struct ixgbe_hw *); | 2865 | s32 (*disable_mc)(struct ixgbe_hw *); |
2865 | s32 (*clear_vfta)(struct ixgbe_hw *); | 2866 | s32 (*clear_vfta)(struct ixgbe_hw *); |
2866 | s32 (*set_vfta)(struct ixgbe_hw *, u32, u32, bool); | 2867 | s32 (*set_vfta)(struct ixgbe_hw *, u32, u32, bool); |
2867 | s32 (*init_uta_tables)(struct ixgbe_hw *); | 2868 | s32 (*init_uta_tables)(struct ixgbe_hw *); |
2868 | void (*set_mac_anti_spoofing)(struct ixgbe_hw *, bool, int); | 2869 | void (*set_mac_anti_spoofing)(struct ixgbe_hw *, bool, int); |
2869 | void (*set_vlan_anti_spoofing)(struct ixgbe_hw *, bool, int); | 2870 | void (*set_vlan_anti_spoofing)(struct ixgbe_hw *, bool, int); |
2870 | 2871 | ||
2871 | /* Flow Control */ | 2872 | /* Flow Control */ |
2872 | s32 (*fc_enable)(struct ixgbe_hw *); | 2873 | s32 (*fc_enable)(struct ixgbe_hw *); |
2873 | 2874 | ||
2874 | /* Manageability interface */ | 2875 | /* Manageability interface */ |
2875 | s32 (*set_fw_drv_ver)(struct ixgbe_hw *, u8, u8, u8, u8); | 2876 | s32 (*set_fw_drv_ver)(struct ixgbe_hw *, u8, u8, u8, u8); |
2876 | s32 (*get_thermal_sensor_data)(struct ixgbe_hw *); | 2877 | s32 (*get_thermal_sensor_data)(struct ixgbe_hw *); |
2877 | s32 (*init_thermal_sensor_thresh)(struct ixgbe_hw *hw); | 2878 | s32 (*init_thermal_sensor_thresh)(struct ixgbe_hw *hw); |
2878 | bool (*mng_fw_enabled)(struct ixgbe_hw *hw); | 2879 | bool (*mng_fw_enabled)(struct ixgbe_hw *hw); |
2879 | }; | 2880 | }; |
2880 | 2881 | ||
2881 | struct ixgbe_phy_operations { | 2882 | struct ixgbe_phy_operations { |
2882 | s32 (*identify)(struct ixgbe_hw *); | 2883 | s32 (*identify)(struct ixgbe_hw *); |
2883 | s32 (*identify_sfp)(struct ixgbe_hw *); | 2884 | s32 (*identify_sfp)(struct ixgbe_hw *); |
2884 | s32 (*init)(struct ixgbe_hw *); | 2885 | s32 (*init)(struct ixgbe_hw *); |
2885 | s32 (*reset)(struct ixgbe_hw *); | 2886 | s32 (*reset)(struct ixgbe_hw *); |
2886 | s32 (*read_reg)(struct ixgbe_hw *, u32, u32, u16 *); | 2887 | s32 (*read_reg)(struct ixgbe_hw *, u32, u32, u16 *); |
2887 | s32 (*write_reg)(struct ixgbe_hw *, u32, u32, u16); | 2888 | s32 (*write_reg)(struct ixgbe_hw *, u32, u32, u16); |
2888 | s32 (*setup_link)(struct ixgbe_hw *); | 2889 | s32 (*setup_link)(struct ixgbe_hw *); |
2889 | s32 (*setup_link_speed)(struct ixgbe_hw *, ixgbe_link_speed, bool); | 2890 | s32 (*setup_link_speed)(struct ixgbe_hw *, ixgbe_link_speed, bool); |
2890 | s32 (*check_link)(struct ixgbe_hw *, ixgbe_link_speed *, bool *); | 2891 | s32 (*check_link)(struct ixgbe_hw *, ixgbe_link_speed *, bool *); |
2891 | s32 (*get_firmware_version)(struct ixgbe_hw *, u16 *); | 2892 | s32 (*get_firmware_version)(struct ixgbe_hw *, u16 *); |
2892 | s32 (*read_i2c_byte)(struct ixgbe_hw *, u8, u8, u8 *); | 2893 | s32 (*read_i2c_byte)(struct ixgbe_hw *, u8, u8, u8 *); |
2893 | s32 (*write_i2c_byte)(struct ixgbe_hw *, u8, u8, u8); | 2894 | s32 (*write_i2c_byte)(struct ixgbe_hw *, u8, u8, u8); |
2894 | s32 (*read_i2c_sff8472)(struct ixgbe_hw *, u8 , u8 *); | 2895 | s32 (*read_i2c_sff8472)(struct ixgbe_hw *, u8 , u8 *); |
2895 | s32 (*read_i2c_eeprom)(struct ixgbe_hw *, u8 , u8 *); | 2896 | s32 (*read_i2c_eeprom)(struct ixgbe_hw *, u8 , u8 *); |
2896 | s32 (*write_i2c_eeprom)(struct ixgbe_hw *, u8, u8); | 2897 | s32 (*write_i2c_eeprom)(struct ixgbe_hw *, u8, u8); |
2897 | s32 (*check_overtemp)(struct ixgbe_hw *); | 2898 | s32 (*check_overtemp)(struct ixgbe_hw *); |
2898 | }; | 2899 | }; |
2899 | 2900 | ||
2900 | struct ixgbe_eeprom_info { | 2901 | struct ixgbe_eeprom_info { |
2901 | struct ixgbe_eeprom_operations ops; | 2902 | struct ixgbe_eeprom_operations ops; |
2902 | enum ixgbe_eeprom_type type; | 2903 | enum ixgbe_eeprom_type type; |
2903 | u32 semaphore_delay; | 2904 | u32 semaphore_delay; |
2904 | u16 word_size; | 2905 | u16 word_size; |
2905 | u16 address_bits; | 2906 | u16 address_bits; |
2906 | u16 word_page_size; | 2907 | u16 word_page_size; |
2907 | }; | 2908 | }; |
2908 | 2909 | ||
2909 | #define IXGBE_FLAGS_DOUBLE_RESET_REQUIRED 0x01 | 2910 | #define IXGBE_FLAGS_DOUBLE_RESET_REQUIRED 0x01 |
2910 | struct ixgbe_mac_info { | 2911 | struct ixgbe_mac_info { |
2911 | struct ixgbe_mac_operations ops; | 2912 | struct ixgbe_mac_operations ops; |
2912 | enum ixgbe_mac_type type; | 2913 | enum ixgbe_mac_type type; |
2913 | u8 addr[ETH_ALEN]; | 2914 | u8 addr[ETH_ALEN]; |
2914 | u8 perm_addr[ETH_ALEN]; | 2915 | u8 perm_addr[ETH_ALEN]; |
2915 | u8 san_addr[ETH_ALEN]; | 2916 | u8 san_addr[ETH_ALEN]; |
2916 | /* prefix for World Wide Node Name (WWNN) */ | 2917 | /* prefix for World Wide Node Name (WWNN) */ |
2917 | u16 wwnn_prefix; | 2918 | u16 wwnn_prefix; |
2918 | /* prefix for World Wide Port Name (WWPN) */ | 2919 | /* prefix for World Wide Port Name (WWPN) */ |
2919 | u16 wwpn_prefix; | 2920 | u16 wwpn_prefix; |
2920 | u16 max_msix_vectors; | 2921 | u16 max_msix_vectors; |
2921 | #define IXGBE_MAX_MTA 128 | 2922 | #define IXGBE_MAX_MTA 128 |
2922 | u32 mta_shadow[IXGBE_MAX_MTA]; | 2923 | u32 mta_shadow[IXGBE_MAX_MTA]; |
2923 | s32 mc_filter_type; | 2924 | s32 mc_filter_type; |
2924 | u32 mcft_size; | 2925 | u32 mcft_size; |
2925 | u32 vft_size; | 2926 | u32 vft_size; |
2926 | u32 num_rar_entries; | 2927 | u32 num_rar_entries; |
2927 | u32 rar_highwater; | 2928 | u32 rar_highwater; |
2928 | u32 rx_pb_size; | 2929 | u32 rx_pb_size; |
2929 | u32 max_tx_queues; | 2930 | u32 max_tx_queues; |
2930 | u32 max_rx_queues; | 2931 | u32 max_rx_queues; |
2931 | u32 orig_autoc; | 2932 | u32 orig_autoc; |
2932 | u32 cached_autoc; | 2933 | u32 cached_autoc; |
2933 | u32 orig_autoc2; | 2934 | u32 orig_autoc2; |
2934 | bool orig_link_settings_stored; | 2935 | bool orig_link_settings_stored; |
2935 | bool autotry_restart; | 2936 | bool autotry_restart; |
2936 | u8 flags; | 2937 | u8 flags; |
2937 | u8 san_mac_rar_index; | 2938 | u8 san_mac_rar_index; |
2938 | struct ixgbe_thermal_sensor_data thermal_sensor_data; | 2939 | struct ixgbe_thermal_sensor_data thermal_sensor_data; |
2939 | }; | 2940 | }; |
2940 | 2941 | ||
2941 | struct ixgbe_phy_info { | 2942 | struct ixgbe_phy_info { |
2942 | struct ixgbe_phy_operations ops; | 2943 | struct ixgbe_phy_operations ops; |
2943 | struct mdio_if_info mdio; | 2944 | struct mdio_if_info mdio; |
2944 | enum ixgbe_phy_type type; | 2945 | enum ixgbe_phy_type type; |
2945 | u32 id; | 2946 | u32 id; |
2946 | enum ixgbe_sfp_type sfp_type; | 2947 | enum ixgbe_sfp_type sfp_type; |
2947 | bool sfp_setup_needed; | 2948 | bool sfp_setup_needed; |
2948 | u32 revision; | 2949 | u32 revision; |
2949 | enum ixgbe_media_type media_type; | 2950 | enum ixgbe_media_type media_type; |
2950 | bool reset_disable; | 2951 | bool reset_disable; |
2951 | ixgbe_autoneg_advertised autoneg_advertised; | 2952 | ixgbe_autoneg_advertised autoneg_advertised; |
2952 | enum ixgbe_smart_speed smart_speed; | 2953 | enum ixgbe_smart_speed smart_speed; |
2953 | bool smart_speed_active; | 2954 | bool smart_speed_active; |
2954 | bool multispeed_fiber; | 2955 | bool multispeed_fiber; |
2955 | bool reset_if_overtemp; | 2956 | bool reset_if_overtemp; |
2956 | }; | 2957 | }; |
2957 | 2958 | ||
2958 | #include "ixgbe_mbx.h" | 2959 | #include "ixgbe_mbx.h" |
2959 | 2960 | ||
2960 | struct ixgbe_mbx_operations { | 2961 | struct ixgbe_mbx_operations { |
2961 | s32 (*init_params)(struct ixgbe_hw *hw); | 2962 | s32 (*init_params)(struct ixgbe_hw *hw); |
2962 | s32 (*read)(struct ixgbe_hw *, u32 *, u16, u16); | 2963 | s32 (*read)(struct ixgbe_hw *, u32 *, u16, u16); |
2963 | s32 (*write)(struct ixgbe_hw *, u32 *, u16, u16); | 2964 | s32 (*write)(struct ixgbe_hw *, u32 *, u16, u16); |
2964 | s32 (*read_posted)(struct ixgbe_hw *, u32 *, u16, u16); | 2965 | s32 (*read_posted)(struct ixgbe_hw *, u32 *, u16, u16); |
2965 | s32 (*write_posted)(struct ixgbe_hw *, u32 *, u16, u16); | 2966 | s32 (*write_posted)(struct ixgbe_hw *, u32 *, u16, u16); |
2966 | s32 (*check_for_msg)(struct ixgbe_hw *, u16); | 2967 | s32 (*check_for_msg)(struct ixgbe_hw *, u16); |
2967 | s32 (*check_for_ack)(struct ixgbe_hw *, u16); | 2968 | s32 (*check_for_ack)(struct ixgbe_hw *, u16); |
2968 | s32 (*check_for_rst)(struct ixgbe_hw *, u16); | 2969 | s32 (*check_for_rst)(struct ixgbe_hw *, u16); |
2969 | }; | 2970 | }; |
2970 | 2971 | ||
2971 | struct ixgbe_mbx_stats { | 2972 | struct ixgbe_mbx_stats { |
2972 | u32 msgs_tx; | 2973 | u32 msgs_tx; |
2973 | u32 msgs_rx; | 2974 | u32 msgs_rx; |
2974 | 2975 | ||
2975 | u32 acks; | 2976 | u32 acks; |
2976 | u32 reqs; | 2977 | u32 reqs; |
2977 | u32 rsts; | 2978 | u32 rsts; |
2978 | }; | 2979 | }; |
2979 | 2980 | ||
2980 | struct ixgbe_mbx_info { | 2981 | struct ixgbe_mbx_info { |
2981 | struct ixgbe_mbx_operations ops; | 2982 | struct ixgbe_mbx_operations ops; |
2982 | struct ixgbe_mbx_stats stats; | 2983 | struct ixgbe_mbx_stats stats; |
2983 | u32 timeout; | 2984 | u32 timeout; |
2984 | u32 usec_delay; | 2985 | u32 usec_delay; |
2985 | u32 v2p_mailbox; | 2986 | u32 v2p_mailbox; |
2986 | u16 size; | 2987 | u16 size; |
2987 | }; | 2988 | }; |
2988 | 2989 | ||
2989 | struct ixgbe_hw { | 2990 | struct ixgbe_hw { |
2990 | u8 __iomem *hw_addr; | 2991 | u8 __iomem *hw_addr; |
2991 | void *back; | 2992 | void *back; |
2992 | struct ixgbe_mac_info mac; | 2993 | struct ixgbe_mac_info mac; |
2993 | struct ixgbe_addr_filter_info addr_ctrl; | 2994 | struct ixgbe_addr_filter_info addr_ctrl; |
2994 | struct ixgbe_fc_info fc; | 2995 | struct ixgbe_fc_info fc; |
2995 | struct ixgbe_phy_info phy; | 2996 | struct ixgbe_phy_info phy; |
2996 | struct ixgbe_eeprom_info eeprom; | 2997 | struct ixgbe_eeprom_info eeprom; |
2997 | struct ixgbe_bus_info bus; | 2998 | struct ixgbe_bus_info bus; |
2998 | struct ixgbe_mbx_info mbx; | 2999 | struct ixgbe_mbx_info mbx; |
2999 | u16 device_id; | 3000 | u16 device_id; |
3000 | u16 vendor_id; | 3001 | u16 vendor_id; |
3001 | u16 subsystem_device_id; | 3002 | u16 subsystem_device_id; |
3002 | u16 subsystem_vendor_id; | 3003 | u16 subsystem_vendor_id; |
3003 | u8 revision_id; | 3004 | u8 revision_id; |
3004 | bool adapter_stopped; | 3005 | bool adapter_stopped; |
3005 | bool force_full_reset; | 3006 | bool force_full_reset; |
3006 | bool allow_unsupported_sfp; | 3007 | bool allow_unsupported_sfp; |
3007 | bool mng_fw_enabled; | 3008 | bool mng_fw_enabled; |
3008 | bool wol_enabled; | 3009 | bool wol_enabled; |
3009 | }; | 3010 | }; |
3010 | 3011 | ||
3011 | struct ixgbe_info { | 3012 | struct ixgbe_info { |
3012 | enum ixgbe_mac_type mac; | 3013 | enum ixgbe_mac_type mac; |
3013 | s32 (*get_invariants)(struct ixgbe_hw *); | 3014 | s32 (*get_invariants)(struct ixgbe_hw *); |
3014 | struct ixgbe_mac_operations *mac_ops; | 3015 | struct ixgbe_mac_operations *mac_ops; |
3015 | struct ixgbe_eeprom_operations *eeprom_ops; | 3016 | struct ixgbe_eeprom_operations *eeprom_ops; |
3016 | struct ixgbe_phy_operations *phy_ops; | 3017 | struct ixgbe_phy_operations *phy_ops; |
3017 | struct ixgbe_mbx_operations *mbx_ops; | 3018 | struct ixgbe_mbx_operations *mbx_ops; |
3018 | }; | 3019 | }; |
3019 | 3020 | ||
3020 | 3021 | ||
3021 | /* Error Codes */ | 3022 | /* Error Codes */ |
3022 | #define IXGBE_ERR_EEPROM -1 | 3023 | #define IXGBE_ERR_EEPROM -1 |
3023 | #define IXGBE_ERR_EEPROM_CHECKSUM -2 | 3024 | #define IXGBE_ERR_EEPROM_CHECKSUM -2 |
3024 | #define IXGBE_ERR_PHY -3 | 3025 | #define IXGBE_ERR_PHY -3 |
3025 | #define IXGBE_ERR_CONFIG -4 | 3026 | #define IXGBE_ERR_CONFIG -4 |
3026 | #define IXGBE_ERR_PARAM -5 | 3027 | #define IXGBE_ERR_PARAM -5 |
3027 | #define IXGBE_ERR_MAC_TYPE -6 | 3028 | #define IXGBE_ERR_MAC_TYPE -6 |
3028 | #define IXGBE_ERR_UNKNOWN_PHY -7 | 3029 | #define IXGBE_ERR_UNKNOWN_PHY -7 |
3029 | #define IXGBE_ERR_LINK_SETUP -8 | 3030 | #define IXGBE_ERR_LINK_SETUP -8 |
3030 | #define IXGBE_ERR_ADAPTER_STOPPED -9 | 3031 | #define IXGBE_ERR_ADAPTER_STOPPED -9 |
3031 | #define IXGBE_ERR_INVALID_MAC_ADDR -10 | 3032 | #define IXGBE_ERR_INVALID_MAC_ADDR -10 |
3032 | #define IXGBE_ERR_DEVICE_NOT_SUPPORTED -11 | 3033 | #define IXGBE_ERR_DEVICE_NOT_SUPPORTED -11 |
3033 | #define IXGBE_ERR_MASTER_REQUESTS_PENDING -12 | 3034 | #define IXGBE_ERR_MASTER_REQUESTS_PENDING -12 |
3034 | #define IXGBE_ERR_INVALID_LINK_SETTINGS -13 | 3035 | #define IXGBE_ERR_INVALID_LINK_SETTINGS -13 |
3035 | #define IXGBE_ERR_AUTONEG_NOT_COMPLETE -14 | 3036 | #define IXGBE_ERR_AUTONEG_NOT_COMPLETE -14 |
3036 | #define IXGBE_ERR_RESET_FAILED -15 | 3037 | #define IXGBE_ERR_RESET_FAILED -15 |
3037 | #define IXGBE_ERR_SWFW_SYNC -16 | 3038 | #define IXGBE_ERR_SWFW_SYNC -16 |
3038 | #define IXGBE_ERR_PHY_ADDR_INVALID -17 | 3039 | #define IXGBE_ERR_PHY_ADDR_INVALID -17 |
3039 | #define IXGBE_ERR_I2C -18 | 3040 | #define IXGBE_ERR_I2C -18 |
3040 | #define IXGBE_ERR_SFP_NOT_SUPPORTED -19 | 3041 | #define IXGBE_ERR_SFP_NOT_SUPPORTED -19 |
3041 | #define IXGBE_ERR_SFP_NOT_PRESENT -20 | 3042 | #define IXGBE_ERR_SFP_NOT_PRESENT -20 |
3042 | #define IXGBE_ERR_SFP_NO_INIT_SEQ_PRESENT -21 | 3043 | #define IXGBE_ERR_SFP_NO_INIT_SEQ_PRESENT -21 |
3043 | #define IXGBE_ERR_NO_SAN_ADDR_PTR -22 | 3044 | #define IXGBE_ERR_NO_SAN_ADDR_PTR -22 |
3044 | #define IXGBE_ERR_FDIR_REINIT_FAILED -23 | 3045 | #define IXGBE_ERR_FDIR_REINIT_FAILED -23 |
3045 | #define IXGBE_ERR_EEPROM_VERSION -24 | 3046 | #define IXGBE_ERR_EEPROM_VERSION -24 |
3046 | #define IXGBE_ERR_NO_SPACE -25 | 3047 | #define IXGBE_ERR_NO_SPACE -25 |
3047 | #define IXGBE_ERR_OVERTEMP -26 | 3048 | #define IXGBE_ERR_OVERTEMP -26 |
3048 | #define IXGBE_ERR_FC_NOT_NEGOTIATED -27 | 3049 | #define IXGBE_ERR_FC_NOT_NEGOTIATED -27 |
3049 | #define IXGBE_ERR_FC_NOT_SUPPORTED -28 | 3050 | #define IXGBE_ERR_FC_NOT_SUPPORTED -28 |
3050 | #define IXGBE_ERR_SFP_SETUP_NOT_COMPLETE -30 | 3051 | #define IXGBE_ERR_SFP_SETUP_NOT_COMPLETE -30 |
3051 | #define IXGBE_ERR_PBA_SECTION -31 | 3052 | #define IXGBE_ERR_PBA_SECTION -31 |
3052 | #define IXGBE_ERR_INVALID_ARGUMENT -32 | 3053 | #define IXGBE_ERR_INVALID_ARGUMENT -32 |
3053 | #define IXGBE_ERR_HOST_INTERFACE_COMMAND -33 | 3054 | #define IXGBE_ERR_HOST_INTERFACE_COMMAND -33 |
3054 | #define IXGBE_NOT_IMPLEMENTED 0x7FFFFFFF | 3055 | #define IXGBE_NOT_IMPLEMENTED 0x7FFFFFFF |
3055 | 3056 | ||
3056 | #endif /* _IXGBE_TYPE_H_ */ | 3057 | #endif /* _IXGBE_TYPE_H_ */ |
3057 | 3058 |