Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 1 | /******************************************************************************* |
| 2 | |
| 3 | Intel PRO/1000 Linux driver |
Bruce Allan | 451152d | 2010-06-16 13:28:11 +0000 | [diff] [blame] | 4 | Copyright(c) 1999 - 2010 Intel Corporation. |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 5 | |
| 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, |
| 8 | version 2, as published by the Free Software Foundation. |
| 9 | |
| 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 |
| 12 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 13 | more details. |
| 14 | |
| 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., |
| 17 | 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 | |
| 19 | The full GNU General Public License is included in this distribution in |
| 20 | the file called "COPYING". |
| 21 | |
| 22 | Contact Information: |
| 23 | Linux NICS <linux.nics@intel.com> |
| 24 | e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> |
| 25 | Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
| 26 | |
| 27 | *******************************************************************************/ |
| 28 | |
| 29 | #include <linux/netdevice.h> |
Jeff Kirsher | 44defeb | 2008-08-04 17:20:41 -0700 | [diff] [blame] | 30 | #include <linux/pci.h> |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 31 | |
| 32 | #include "e1000.h" |
| 33 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 34 | /* |
| 35 | * This is the only thing that needs to be changed to adjust the |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 36 | * maximum number of ports that the driver can manage. |
| 37 | */ |
| 38 | |
| 39 | #define E1000_MAX_NIC 32 |
| 40 | |
| 41 | #define OPTION_UNSET -1 |
| 42 | #define OPTION_DISABLED 0 |
| 43 | #define OPTION_ENABLED 1 |
| 44 | |
| 45 | #define COPYBREAK_DEFAULT 256 |
| 46 | unsigned int copybreak = COPYBREAK_DEFAULT; |
| 47 | module_param(copybreak, uint, 0644); |
| 48 | MODULE_PARM_DESC(copybreak, |
| 49 | "Maximum size of packet that is copied to a new buffer on receive"); |
| 50 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 51 | /* |
| 52 | * All parameters are treated the same, as an integer array of values. |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 53 | * This macro just reduces the need to repeat the same declaration code |
| 54 | * over and over (plus this helps to avoid typo bugs). |
| 55 | */ |
| 56 | |
| 57 | #define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET } |
Stephen Hemminger | 5a9147b | 2007-10-29 10:46:05 -0700 | [diff] [blame] | 58 | #define E1000_PARAM(X, desc) \ |
| 59 | static int __devinitdata X[E1000_MAX_NIC+1] \ |
| 60 | = E1000_PARAM_INIT; \ |
| 61 | static unsigned int num_##X; \ |
| 62 | module_param_array_named(X, X, int, &num_##X, 0); \ |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 63 | MODULE_PARM_DESC(X, desc); |
| 64 | |
| 65 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 66 | /* |
| 67 | * Transmit Interrupt Delay in units of 1.024 microseconds |
| 68 | * Tx interrupt delay needs to typically be set to something non zero |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 69 | * |
| 70 | * Valid Range: 0-65535 |
| 71 | */ |
| 72 | E1000_PARAM(TxIntDelay, "Transmit Interrupt Delay"); |
| 73 | #define DEFAULT_TIDV 8 |
| 74 | #define MAX_TXDELAY 0xFFFF |
| 75 | #define MIN_TXDELAY 0 |
| 76 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 77 | /* |
| 78 | * Transmit Absolute Interrupt Delay in units of 1.024 microseconds |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 79 | * |
| 80 | * Valid Range: 0-65535 |
| 81 | */ |
| 82 | E1000_PARAM(TxAbsIntDelay, "Transmit Absolute Interrupt Delay"); |
| 83 | #define DEFAULT_TADV 32 |
| 84 | #define MAX_TXABSDELAY 0xFFFF |
| 85 | #define MIN_TXABSDELAY 0 |
| 86 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 87 | /* |
| 88 | * Receive Interrupt Delay in units of 1.024 microseconds |
| 89 | * hardware will likely hang if you set this to anything but zero. |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 90 | * |
| 91 | * Valid Range: 0-65535 |
| 92 | */ |
| 93 | E1000_PARAM(RxIntDelay, "Receive Interrupt Delay"); |
| 94 | #define DEFAULT_RDTR 0 |
| 95 | #define MAX_RXDELAY 0xFFFF |
| 96 | #define MIN_RXDELAY 0 |
| 97 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 98 | /* |
| 99 | * Receive Absolute Interrupt Delay in units of 1.024 microseconds |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 100 | * |
| 101 | * Valid Range: 0-65535 |
| 102 | */ |
| 103 | E1000_PARAM(RxAbsIntDelay, "Receive Absolute Interrupt Delay"); |
| 104 | #define DEFAULT_RADV 8 |
| 105 | #define MAX_RXABSDELAY 0xFFFF |
| 106 | #define MIN_RXABSDELAY 0 |
| 107 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 108 | /* |
| 109 | * Interrupt Throttle Rate (interrupts/sec) |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 110 | * |
| 111 | * Valid Range: 100-100000 (0=off, 1=dynamic, 3=dynamic conservative) |
| 112 | */ |
| 113 | E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate"); |
| 114 | #define DEFAULT_ITR 3 |
| 115 | #define MAX_ITR 100000 |
| 116 | #define MIN_ITR 100 |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 117 | /* IntMode (Interrupt Mode) |
| 118 | * |
| 119 | * Valid Range: 0 - 2 |
| 120 | * |
| 121 | * Default Value: 2 (MSI-X) |
| 122 | */ |
| 123 | E1000_PARAM(IntMode, "Interrupt Mode"); |
| 124 | #define MAX_INTMODE 2 |
| 125 | #define MIN_INTMODE 0 |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 126 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 127 | /* |
| 128 | * Enable Smart Power Down of the PHY |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 129 | * |
| 130 | * Valid Range: 0, 1 |
| 131 | * |
| 132 | * Default Value: 0 (disabled) |
| 133 | */ |
| 134 | E1000_PARAM(SmartPowerDownEnable, "Enable PHY smart power down"); |
| 135 | |
Bruce Allan | ad68076 | 2008-03-28 09:15:03 -0700 | [diff] [blame] | 136 | /* |
| 137 | * Enable Kumeran Lock Loss workaround |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 138 | * |
| 139 | * Valid Range: 0, 1 |
| 140 | * |
| 141 | * Default Value: 1 (enabled) |
| 142 | */ |
| 143 | E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround"); |
| 144 | |
Bruce Allan | 4a77035 | 2008-10-01 17:18:35 -0700 | [diff] [blame] | 145 | /* |
| 146 | * Write Protect NVM |
| 147 | * |
| 148 | * Valid Range: 0, 1 |
| 149 | * |
| 150 | * Default Value: 1 (enabled) |
| 151 | */ |
| 152 | E1000_PARAM(WriteProtectNVM, "Write-protect NVM [WARNING: disabling this can lead to corrupted NVM]"); |
| 153 | |
Jeff Kirsher | eb7c3ad | 2008-11-14 06:45:23 +0000 | [diff] [blame] | 154 | /* |
| 155 | * Enable CRC Stripping |
| 156 | * |
| 157 | * Valid Range: 0, 1 |
| 158 | * |
| 159 | * Default Value: 1 (enabled) |
| 160 | */ |
| 161 | E1000_PARAM(CrcStripping, "Enable CRC Stripping, disable if your BMC needs " \ |
| 162 | "the CRC"); |
| 163 | |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 164 | struct e1000_option { |
| 165 | enum { enable_option, range_option, list_option } type; |
Stephen Hemminger | 5a9147b | 2007-10-29 10:46:05 -0700 | [diff] [blame] | 166 | const char *name; |
| 167 | const char *err; |
| 168 | int def; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 169 | union { |
| 170 | struct { /* range_option info */ |
| 171 | int min; |
| 172 | int max; |
| 173 | } r; |
| 174 | struct { /* list_option info */ |
| 175 | int nr; |
| 176 | struct e1000_opt_list { int i; char *str; } *p; |
| 177 | } l; |
| 178 | } arg; |
| 179 | }; |
| 180 | |
Stephen Hemminger | 5a9147b | 2007-10-29 10:46:05 -0700 | [diff] [blame] | 181 | static int __devinit e1000_validate_option(unsigned int *value, |
| 182 | const struct e1000_option *opt, |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 183 | struct e1000_adapter *adapter) |
| 184 | { |
| 185 | if (*value == OPTION_UNSET) { |
| 186 | *value = opt->def; |
| 187 | return 0; |
| 188 | } |
| 189 | |
| 190 | switch (opt->type) { |
| 191 | case enable_option: |
| 192 | switch (*value) { |
| 193 | case OPTION_ENABLED: |
Jeff Kirsher | 44defeb | 2008-08-04 17:20:41 -0700 | [diff] [blame] | 194 | e_info("%s Enabled\n", opt->name); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 195 | return 0; |
| 196 | case OPTION_DISABLED: |
Jeff Kirsher | 44defeb | 2008-08-04 17:20:41 -0700 | [diff] [blame] | 197 | e_info("%s Disabled\n", opt->name); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 198 | return 0; |
| 199 | } |
| 200 | break; |
| 201 | case range_option: |
| 202 | if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) { |
Jeff Kirsher | 44defeb | 2008-08-04 17:20:41 -0700 | [diff] [blame] | 203 | e_info("%s set to %i\n", opt->name, *value); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 204 | return 0; |
| 205 | } |
| 206 | break; |
| 207 | case list_option: { |
| 208 | int i; |
| 209 | struct e1000_opt_list *ent; |
| 210 | |
| 211 | for (i = 0; i < opt->arg.l.nr; i++) { |
| 212 | ent = &opt->arg.l.p[i]; |
| 213 | if (*value == ent->i) { |
| 214 | if (ent->str[0] != '\0') |
Jeff Kirsher | 44defeb | 2008-08-04 17:20:41 -0700 | [diff] [blame] | 215 | e_info("%s\n", ent->str); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 216 | return 0; |
| 217 | } |
| 218 | } |
| 219 | } |
| 220 | break; |
| 221 | default: |
| 222 | BUG(); |
| 223 | } |
| 224 | |
Jeff Kirsher | 44defeb | 2008-08-04 17:20:41 -0700 | [diff] [blame] | 225 | e_info("Invalid %s value specified (%i) %s\n", opt->name, *value, |
| 226 | opt->err); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 227 | *value = opt->def; |
| 228 | return -1; |
| 229 | } |
| 230 | |
| 231 | /** |
| 232 | * e1000e_check_options - Range Checking for Command Line Parameters |
| 233 | * @adapter: board private structure |
| 234 | * |
| 235 | * This routine checks all command line parameters for valid user |
| 236 | * input. If an invalid value is given, or if no user specified |
| 237 | * value exists, a default value is used. The final value is stored |
| 238 | * in a variable in the adapter structure. |
| 239 | **/ |
| 240 | void __devinit e1000e_check_options(struct e1000_adapter *adapter) |
| 241 | { |
| 242 | struct e1000_hw *hw = &adapter->hw; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 243 | int bd = adapter->bd_number; |
| 244 | |
| 245 | if (bd >= E1000_MAX_NIC) { |
Jeff Kirsher | 44defeb | 2008-08-04 17:20:41 -0700 | [diff] [blame] | 246 | e_notice("Warning: no configuration for board #%i\n", bd); |
| 247 | e_notice("Using defaults for all values\n"); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 248 | } |
| 249 | |
| 250 | { /* Transmit Interrupt Delay */ |
Jesse Brandeburg | 6f59d66 | 2010-04-09 10:51:09 +0000 | [diff] [blame] | 251 | static const struct e1000_option opt = { |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 252 | .type = range_option, |
| 253 | .name = "Transmit Interrupt Delay", |
| 254 | .err = "using default of " |
| 255 | __MODULE_STRING(DEFAULT_TIDV), |
| 256 | .def = DEFAULT_TIDV, |
| 257 | .arg = { .r = { .min = MIN_TXDELAY, |
| 258 | .max = MAX_TXDELAY } } |
| 259 | }; |
| 260 | |
| 261 | if (num_TxIntDelay > bd) { |
| 262 | adapter->tx_int_delay = TxIntDelay[bd]; |
| 263 | e1000_validate_option(&adapter->tx_int_delay, &opt, |
| 264 | adapter); |
| 265 | } else { |
| 266 | adapter->tx_int_delay = opt.def; |
| 267 | } |
| 268 | } |
| 269 | { /* Transmit Absolute Interrupt Delay */ |
Jesse Brandeburg | 6f59d66 | 2010-04-09 10:51:09 +0000 | [diff] [blame] | 270 | static const struct e1000_option opt = { |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 271 | .type = range_option, |
| 272 | .name = "Transmit Absolute Interrupt Delay", |
| 273 | .err = "using default of " |
| 274 | __MODULE_STRING(DEFAULT_TADV), |
| 275 | .def = DEFAULT_TADV, |
| 276 | .arg = { .r = { .min = MIN_TXABSDELAY, |
| 277 | .max = MAX_TXABSDELAY } } |
| 278 | }; |
| 279 | |
| 280 | if (num_TxAbsIntDelay > bd) { |
| 281 | adapter->tx_abs_int_delay = TxAbsIntDelay[bd]; |
| 282 | e1000_validate_option(&adapter->tx_abs_int_delay, &opt, |
| 283 | adapter); |
| 284 | } else { |
| 285 | adapter->tx_abs_int_delay = opt.def; |
| 286 | } |
| 287 | } |
| 288 | { /* Receive Interrupt Delay */ |
Bruce Allan | 4fe4491 | 2010-05-10 14:59:10 +0000 | [diff] [blame] | 289 | static struct e1000_option opt = { |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 290 | .type = range_option, |
| 291 | .name = "Receive Interrupt Delay", |
| 292 | .err = "using default of " |
| 293 | __MODULE_STRING(DEFAULT_RDTR), |
| 294 | .def = DEFAULT_RDTR, |
| 295 | .arg = { .r = { .min = MIN_RXDELAY, |
| 296 | .max = MAX_RXDELAY } } |
| 297 | }; |
| 298 | |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 299 | if (num_RxIntDelay > bd) { |
| 300 | adapter->rx_int_delay = RxIntDelay[bd]; |
| 301 | e1000_validate_option(&adapter->rx_int_delay, &opt, |
| 302 | adapter); |
| 303 | } else { |
| 304 | adapter->rx_int_delay = opt.def; |
| 305 | } |
| 306 | } |
| 307 | { /* Receive Absolute Interrupt Delay */ |
Jesse Brandeburg | 6f59d66 | 2010-04-09 10:51:09 +0000 | [diff] [blame] | 308 | static const struct e1000_option opt = { |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 309 | .type = range_option, |
| 310 | .name = "Receive Absolute Interrupt Delay", |
| 311 | .err = "using default of " |
| 312 | __MODULE_STRING(DEFAULT_RADV), |
| 313 | .def = DEFAULT_RADV, |
| 314 | .arg = { .r = { .min = MIN_RXABSDELAY, |
| 315 | .max = MAX_RXABSDELAY } } |
| 316 | }; |
| 317 | |
| 318 | if (num_RxAbsIntDelay > bd) { |
| 319 | adapter->rx_abs_int_delay = RxAbsIntDelay[bd]; |
| 320 | e1000_validate_option(&adapter->rx_abs_int_delay, &opt, |
| 321 | adapter); |
| 322 | } else { |
| 323 | adapter->rx_abs_int_delay = opt.def; |
| 324 | } |
| 325 | } |
| 326 | { /* Interrupt Throttling Rate */ |
Jesse Brandeburg | 6f59d66 | 2010-04-09 10:51:09 +0000 | [diff] [blame] | 327 | static const struct e1000_option opt = { |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 328 | .type = range_option, |
| 329 | .name = "Interrupt Throttling Rate (ints/sec)", |
| 330 | .err = "using default of " |
| 331 | __MODULE_STRING(DEFAULT_ITR), |
| 332 | .def = DEFAULT_ITR, |
| 333 | .arg = { .r = { .min = MIN_ITR, |
| 334 | .max = MAX_ITR } } |
| 335 | }; |
| 336 | |
| 337 | if (num_InterruptThrottleRate > bd) { |
| 338 | adapter->itr = InterruptThrottleRate[bd]; |
| 339 | switch (adapter->itr) { |
| 340 | case 0: |
Jeff Kirsher | 44defeb | 2008-08-04 17:20:41 -0700 | [diff] [blame] | 341 | e_info("%s turned off\n", opt.name); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 342 | break; |
| 343 | case 1: |
Jeff Kirsher | 44defeb | 2008-08-04 17:20:41 -0700 | [diff] [blame] | 344 | e_info("%s set to dynamic mode\n", opt.name); |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 345 | adapter->itr_setting = adapter->itr; |
| 346 | adapter->itr = 20000; |
| 347 | break; |
| 348 | case 3: |
Jeff Kirsher | 44defeb | 2008-08-04 17:20:41 -0700 | [diff] [blame] | 349 | e_info("%s set to dynamic conservative mode\n", |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 350 | opt.name); |
| 351 | adapter->itr_setting = adapter->itr; |
| 352 | adapter->itr = 20000; |
| 353 | break; |
Jesse Brandeburg | eab2abf | 2010-05-04 22:26:03 +0000 | [diff] [blame] | 354 | case 4: |
| 355 | e_info("%s set to simplified (2000-8000 ints) " |
| 356 | "mode\n", opt.name); |
| 357 | adapter->itr_setting = 4; |
| 358 | break; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 359 | default: |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 360 | /* |
Bruce Allan | 2d06cad | 2008-08-08 18:35:51 -0700 | [diff] [blame] | 361 | * Save the setting, because the dynamic bits |
| 362 | * change itr. |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 363 | */ |
Bruce Allan | 2d06cad | 2008-08-08 18:35:51 -0700 | [diff] [blame] | 364 | if (e1000_validate_option(&adapter->itr, &opt, |
| 365 | adapter) && |
| 366 | (adapter->itr == 3)) { |
| 367 | /* |
| 368 | * In case of invalid user value, |
| 369 | * default to conservative mode. |
| 370 | */ |
| 371 | adapter->itr_setting = adapter->itr; |
| 372 | adapter->itr = 20000; |
| 373 | } else { |
| 374 | /* |
| 375 | * Clear the lower two bits because |
| 376 | * they are used as control. |
| 377 | */ |
| 378 | adapter->itr_setting = |
| 379 | adapter->itr & ~3; |
| 380 | } |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 381 | break; |
| 382 | } |
| 383 | } else { |
| 384 | adapter->itr_setting = opt.def; |
| 385 | adapter->itr = 20000; |
| 386 | } |
| 387 | } |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 388 | { /* Interrupt Mode */ |
Bruce Allan | 4fe4491 | 2010-05-10 14:59:10 +0000 | [diff] [blame] | 389 | static struct e1000_option opt = { |
Bruce Allan | 4662e82 | 2008-08-26 18:37:06 -0700 | [diff] [blame] | 390 | .type = range_option, |
| 391 | .name = "Interrupt Mode", |
| 392 | .err = "defaulting to 2 (MSI-X)", |
| 393 | .def = E1000E_INT_MODE_MSIX, |
| 394 | .arg = { .r = { .min = MIN_INTMODE, |
| 395 | .max = MAX_INTMODE } } |
| 396 | }; |
| 397 | |
| 398 | if (num_IntMode > bd) { |
| 399 | unsigned int int_mode = IntMode[bd]; |
| 400 | e1000_validate_option(&int_mode, &opt, adapter); |
| 401 | adapter->int_mode = int_mode; |
| 402 | } else { |
| 403 | adapter->int_mode = opt.def; |
| 404 | } |
| 405 | } |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 406 | { /* Smart Power Down */ |
Jesse Brandeburg | 6f59d66 | 2010-04-09 10:51:09 +0000 | [diff] [blame] | 407 | static const struct e1000_option opt = { |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 408 | .type = enable_option, |
| 409 | .name = "PHY Smart Power Down", |
| 410 | .err = "defaulting to Disabled", |
| 411 | .def = OPTION_DISABLED |
| 412 | }; |
| 413 | |
| 414 | if (num_SmartPowerDownEnable > bd) { |
Stephen Hemminger | 5a9147b | 2007-10-29 10:46:05 -0700 | [diff] [blame] | 415 | unsigned int spd = SmartPowerDownEnable[bd]; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 416 | e1000_validate_option(&spd, &opt, adapter); |
| 417 | if ((adapter->flags & FLAG_HAS_SMART_POWER_DOWN) |
| 418 | && spd) |
| 419 | adapter->flags |= FLAG_SMART_POWER_DOWN; |
| 420 | } |
| 421 | } |
Jeff Kirsher | eb7c3ad | 2008-11-14 06:45:23 +0000 | [diff] [blame] | 422 | { /* CRC Stripping */ |
Jesse Brandeburg | 6f59d66 | 2010-04-09 10:51:09 +0000 | [diff] [blame] | 423 | static const struct e1000_option opt = { |
Jeff Kirsher | eb7c3ad | 2008-11-14 06:45:23 +0000 | [diff] [blame] | 424 | .type = enable_option, |
| 425 | .name = "CRC Stripping", |
| 426 | .err = "defaulting to enabled", |
| 427 | .def = OPTION_ENABLED |
| 428 | }; |
| 429 | |
| 430 | if (num_CrcStripping > bd) { |
| 431 | unsigned int crc_stripping = CrcStripping[bd]; |
| 432 | e1000_validate_option(&crc_stripping, &opt, adapter); |
| 433 | if (crc_stripping == OPTION_ENABLED) |
| 434 | adapter->flags2 |= FLAG2_CRC_STRIPPING; |
Bruce Allan | 6e50912a | 2009-06-02 11:28:01 +0000 | [diff] [blame] | 435 | } else { |
| 436 | adapter->flags2 |= FLAG2_CRC_STRIPPING; |
Jeff Kirsher | eb7c3ad | 2008-11-14 06:45:23 +0000 | [diff] [blame] | 437 | } |
| 438 | } |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 439 | { /* Kumeran Lock Loss Workaround */ |
Jesse Brandeburg | 6f59d66 | 2010-04-09 10:51:09 +0000 | [diff] [blame] | 440 | static const struct e1000_option opt = { |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 441 | .type = enable_option, |
| 442 | .name = "Kumeran Lock Loss Workaround", |
| 443 | .err = "defaulting to Enabled", |
| 444 | .def = OPTION_ENABLED |
| 445 | }; |
| 446 | |
| 447 | if (num_KumeranLockLoss > bd) { |
Stephen Hemminger | 5a9147b | 2007-10-29 10:46:05 -0700 | [diff] [blame] | 448 | unsigned int kmrn_lock_loss = KumeranLockLoss[bd]; |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 449 | e1000_validate_option(&kmrn_lock_loss, &opt, adapter); |
| 450 | if (hw->mac.type == e1000_ich8lan) |
| 451 | e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw, |
| 452 | kmrn_lock_loss); |
| 453 | } else { |
| 454 | if (hw->mac.type == e1000_ich8lan) |
| 455 | e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw, |
| 456 | opt.def); |
| 457 | } |
| 458 | } |
Bruce Allan | 4a77035 | 2008-10-01 17:18:35 -0700 | [diff] [blame] | 459 | { /* Write-protect NVM */ |
Jesse Brandeburg | 6f59d66 | 2010-04-09 10:51:09 +0000 | [diff] [blame] | 460 | static const struct e1000_option opt = { |
Bruce Allan | 4a77035 | 2008-10-01 17:18:35 -0700 | [diff] [blame] | 461 | .type = enable_option, |
| 462 | .name = "Write-protect NVM", |
| 463 | .err = "defaulting to Enabled", |
| 464 | .def = OPTION_ENABLED |
| 465 | }; |
| 466 | |
| 467 | if (adapter->flags & FLAG_IS_ICH) { |
| 468 | if (num_WriteProtectNVM > bd) { |
| 469 | unsigned int write_protect_nvm = WriteProtectNVM[bd]; |
| 470 | e1000_validate_option(&write_protect_nvm, &opt, |
| 471 | adapter); |
| 472 | if (write_protect_nvm) |
| 473 | adapter->flags |= FLAG_READ_ONLY_NVM; |
| 474 | } else { |
| 475 | if (opt.def) |
| 476 | adapter->flags |= FLAG_READ_ONLY_NVM; |
| 477 | } |
| 478 | } |
| 479 | } |
Auke Kok | bc7f75f | 2007-09-17 12:30:59 -0700 | [diff] [blame] | 480 | } |