blob: dfbfa7fd98c36f6ccacd82cfe9b083f2a7ab4baf [file] [log] [blame]
Auke Kokbc7f75f2007-09-17 12:30:59 -07001/*******************************************************************************
2
3 Intel PRO/1000 Linux driver
Bruce Allanf5e261e2012-01-01 16:00:03 +00004 Copyright(c) 1999 - 2012 Intel Corporation.
Auke Kokbc7f75f2007-09-17 12:30:59 -07005
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>
Paul Gortmaker9d9779e2011-07-03 15:21:01 -040030#include <linux/module.h>
Jeff Kirsher44defeb2008-08-04 17:20:41 -070031#include <linux/pci.h>
Auke Kokbc7f75f2007-09-17 12:30:59 -070032
33#include "e1000.h"
34
Bruce Allanad680762008-03-28 09:15:03 -070035/*
36 * This is the only thing that needs to be changed to adjust the
Auke Kokbc7f75f2007-09-17 12:30:59 -070037 * maximum number of ports that the driver can manage.
38 */
39
40#define E1000_MAX_NIC 32
41
42#define OPTION_UNSET -1
43#define OPTION_DISABLED 0
44#define OPTION_ENABLED 1
45
46#define COPYBREAK_DEFAULT 256
47unsigned int copybreak = COPYBREAK_DEFAULT;
48module_param(copybreak, uint, 0644);
49MODULE_PARM_DESC(copybreak,
50 "Maximum size of packet that is copied to a new buffer on receive");
51
Bruce Allanad680762008-03-28 09:15:03 -070052/*
53 * All parameters are treated the same, as an integer array of values.
Auke Kokbc7f75f2007-09-17 12:30:59 -070054 * This macro just reduces the need to repeat the same declaration code
55 * over and over (plus this helps to avoid typo bugs).
56 */
57
58#define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET }
Stephen Hemminger5a9147b2007-10-29 10:46:05 -070059#define E1000_PARAM(X, desc) \
60 static int __devinitdata X[E1000_MAX_NIC+1] \
61 = E1000_PARAM_INIT; \
62 static unsigned int num_##X; \
63 module_param_array_named(X, X, int, &num_##X, 0); \
Auke Kokbc7f75f2007-09-17 12:30:59 -070064 MODULE_PARM_DESC(X, desc);
65
Bruce Allanad680762008-03-28 09:15:03 -070066/*
67 * Transmit Interrupt Delay in units of 1.024 microseconds
Bruce Allanaf667a22010-12-31 06:10:01 +000068 * Tx interrupt delay needs to typically be set to something non-zero
Auke Kokbc7f75f2007-09-17 12:30:59 -070069 *
70 * Valid Range: 0-65535
71 */
72E1000_PARAM(TxIntDelay, "Transmit Interrupt Delay");
73#define DEFAULT_TIDV 8
74#define MAX_TXDELAY 0xFFFF
75#define MIN_TXDELAY 0
76
Bruce Allanad680762008-03-28 09:15:03 -070077/*
78 * Transmit Absolute Interrupt Delay in units of 1.024 microseconds
Auke Kokbc7f75f2007-09-17 12:30:59 -070079 *
80 * Valid Range: 0-65535
81 */
82E1000_PARAM(TxAbsIntDelay, "Transmit Absolute Interrupt Delay");
83#define DEFAULT_TADV 32
84#define MAX_TXABSDELAY 0xFFFF
85#define MIN_TXABSDELAY 0
86
Bruce Allanad680762008-03-28 09:15:03 -070087/*
88 * Receive Interrupt Delay in units of 1.024 microseconds
89 * hardware will likely hang if you set this to anything but zero.
Auke Kokbc7f75f2007-09-17 12:30:59 -070090 *
91 * Valid Range: 0-65535
92 */
93E1000_PARAM(RxIntDelay, "Receive Interrupt Delay");
Auke Kokbc7f75f2007-09-17 12:30:59 -070094#define MAX_RXDELAY 0xFFFF
95#define MIN_RXDELAY 0
96
Bruce Allanad680762008-03-28 09:15:03 -070097/*
98 * Receive Absolute Interrupt Delay in units of 1.024 microseconds
Auke Kokbc7f75f2007-09-17 12:30:59 -070099 *
100 * Valid Range: 0-65535
101 */
102E1000_PARAM(RxAbsIntDelay, "Receive Absolute Interrupt Delay");
Auke Kokbc7f75f2007-09-17 12:30:59 -0700103#define MAX_RXABSDELAY 0xFFFF
104#define MIN_RXABSDELAY 0
105
Bruce Allanad680762008-03-28 09:15:03 -0700106/*
107 * Interrupt Throttle Rate (interrupts/sec)
Auke Kokbc7f75f2007-09-17 12:30:59 -0700108 *
Jeff Kirsher727c3562012-04-20 08:51:45 +0000109 * Valid Range: 100-100000 or one of: 0=off, 1=dynamic, 3=dynamic conservative
Auke Kokbc7f75f2007-09-17 12:30:59 -0700110 */
111E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate");
112#define DEFAULT_ITR 3
113#define MAX_ITR 100000
114#define MIN_ITR 100
Bruce Allanaf667a22010-12-31 06:10:01 +0000115
Bruce Allanb6fbca22011-12-16 00:45:56 +0000116/*
117 * IntMode (Interrupt Mode)
Bruce Allan4662e822008-08-26 18:37:06 -0700118 *
Bruce Allanb6fbca22011-12-16 00:45:56 +0000119 * Valid Range: varies depending on kernel configuration & hardware support
Bruce Allan4662e822008-08-26 18:37:06 -0700120 *
Bruce Allanb6fbca22011-12-16 00:45:56 +0000121 * legacy=0, MSI=1, MSI-X=2
122 *
123 * When MSI/MSI-X support is enabled in kernel-
124 * Default Value: 2 (MSI-X) when supported by hardware, 1 (MSI) otherwise
125 * When MSI/MSI-X support is not enabled in kernel-
126 * Default Value: 0 (legacy)
127 *
128 * When a mode is specified that is not allowed/supported, it will be
129 * demoted to the most advanced interrupt mode available.
Bruce Allan4662e822008-08-26 18:37:06 -0700130 */
131E1000_PARAM(IntMode, "Interrupt Mode");
132#define MAX_INTMODE 2
133#define MIN_INTMODE 0
Auke Kokbc7f75f2007-09-17 12:30:59 -0700134
Bruce Allanad680762008-03-28 09:15:03 -0700135/*
136 * Enable Smart Power Down of the PHY
Auke Kokbc7f75f2007-09-17 12:30:59 -0700137 *
138 * Valid Range: 0, 1
139 *
140 * Default Value: 0 (disabled)
141 */
142E1000_PARAM(SmartPowerDownEnable, "Enable PHY smart power down");
143
Bruce Allanad680762008-03-28 09:15:03 -0700144/*
145 * Enable Kumeran Lock Loss workaround
Auke Kokbc7f75f2007-09-17 12:30:59 -0700146 *
147 * Valid Range: 0, 1
148 *
149 * Default Value: 1 (enabled)
150 */
151E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround");
152
Bruce Allan4a770352008-10-01 17:18:35 -0700153/*
154 * Write Protect NVM
155 *
156 * Valid Range: 0, 1
157 *
158 * Default Value: 1 (enabled)
159 */
160E1000_PARAM(WriteProtectNVM, "Write-protect NVM [WARNING: disabling this can lead to corrupted NVM]");
161
Jeff Kirshereb7c3ad2008-11-14 06:45:23 +0000162/*
163 * Enable CRC Stripping
164 *
165 * Valid Range: 0, 1
166 *
167 * Default Value: 1 (enabled)
168 */
Bruce Allan6ad65142012-04-12 05:47:09 +0000169E1000_PARAM(CrcStripping,
170 "Enable CRC Stripping, disable if your BMC needs the CRC");
Jeff Kirshereb7c3ad2008-11-14 06:45:23 +0000171
Auke Kokbc7f75f2007-09-17 12:30:59 -0700172struct e1000_option {
173 enum { enable_option, range_option, list_option } type;
Stephen Hemminger5a9147b2007-10-29 10:46:05 -0700174 const char *name;
175 const char *err;
176 int def;
Auke Kokbc7f75f2007-09-17 12:30:59 -0700177 union {
178 struct { /* range_option info */
179 int min;
180 int max;
181 } r;
182 struct { /* list_option info */
183 int nr;
184 struct e1000_opt_list { int i; char *str; } *p;
185 } l;
186 } arg;
187};
188
Stephen Hemminger5a9147b2007-10-29 10:46:05 -0700189static int __devinit e1000_validate_option(unsigned int *value,
190 const struct e1000_option *opt,
Auke Kokbc7f75f2007-09-17 12:30:59 -0700191 struct e1000_adapter *adapter)
192{
193 if (*value == OPTION_UNSET) {
194 *value = opt->def;
195 return 0;
196 }
197
198 switch (opt->type) {
199 case enable_option:
200 switch (*value) {
201 case OPTION_ENABLED:
Bruce Allan185095f2012-06-07 02:23:37 +0000202 dev_info(&adapter->pdev->dev, "%s Enabled\n",
203 opt->name);
Auke Kokbc7f75f2007-09-17 12:30:59 -0700204 return 0;
205 case OPTION_DISABLED:
Bruce Allan185095f2012-06-07 02:23:37 +0000206 dev_info(&adapter->pdev->dev, "%s Disabled\n",
207 opt->name);
Auke Kokbc7f75f2007-09-17 12:30:59 -0700208 return 0;
209 }
210 break;
211 case range_option:
212 if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) {
Bruce Allan185095f2012-06-07 02:23:37 +0000213 dev_info(&adapter->pdev->dev, "%s set to %i\n",
214 opt->name, *value);
Auke Kokbc7f75f2007-09-17 12:30:59 -0700215 return 0;
216 }
217 break;
218 case list_option: {
219 int i;
220 struct e1000_opt_list *ent;
221
222 for (i = 0; i < opt->arg.l.nr; i++) {
223 ent = &opt->arg.l.p[i];
224 if (*value == ent->i) {
225 if (ent->str[0] != '\0')
Bruce Allan185095f2012-06-07 02:23:37 +0000226 dev_info(&adapter->pdev->dev, "%s\n",
227 ent->str);
Auke Kokbc7f75f2007-09-17 12:30:59 -0700228 return 0;
229 }
230 }
231 }
232 break;
233 default:
234 BUG();
235 }
236
Bruce Allan185095f2012-06-07 02:23:37 +0000237 dev_info(&adapter->pdev->dev, "Invalid %s value specified (%i) %s\n",
238 opt->name, *value, opt->err);
Auke Kokbc7f75f2007-09-17 12:30:59 -0700239 *value = opt->def;
240 return -1;
241}
242
243/**
244 * e1000e_check_options - Range Checking for Command Line Parameters
245 * @adapter: board private structure
246 *
247 * This routine checks all command line parameters for valid user
248 * input. If an invalid value is given, or if no user specified
249 * value exists, a default value is used. The final value is stored
250 * in a variable in the adapter structure.
251 **/
252void __devinit e1000e_check_options(struct e1000_adapter *adapter)
253{
254 struct e1000_hw *hw = &adapter->hw;
Auke Kokbc7f75f2007-09-17 12:30:59 -0700255 int bd = adapter->bd_number;
256
257 if (bd >= E1000_MAX_NIC) {
Bruce Allan185095f2012-06-07 02:23:37 +0000258 dev_notice(&adapter->pdev->dev,
259 "Warning: no configuration for board #%i\n", bd);
260 dev_notice(&adapter->pdev->dev,
261 "Using defaults for all values\n");
Auke Kokbc7f75f2007-09-17 12:30:59 -0700262 }
263
264 { /* Transmit Interrupt Delay */
Jesse Brandeburg6f59d662010-04-09 10:51:09 +0000265 static const struct e1000_option opt = {
Auke Kokbc7f75f2007-09-17 12:30:59 -0700266 .type = range_option,
267 .name = "Transmit Interrupt Delay",
268 .err = "using default of "
269 __MODULE_STRING(DEFAULT_TIDV),
270 .def = DEFAULT_TIDV,
271 .arg = { .r = { .min = MIN_TXDELAY,
272 .max = MAX_TXDELAY } }
273 };
274
275 if (num_TxIntDelay > bd) {
276 adapter->tx_int_delay = TxIntDelay[bd];
277 e1000_validate_option(&adapter->tx_int_delay, &opt,
278 adapter);
279 } else {
280 adapter->tx_int_delay = opt.def;
281 }
282 }
283 { /* Transmit Absolute Interrupt Delay */
Jesse Brandeburg6f59d662010-04-09 10:51:09 +0000284 static const struct e1000_option opt = {
Auke Kokbc7f75f2007-09-17 12:30:59 -0700285 .type = range_option,
286 .name = "Transmit Absolute Interrupt Delay",
287 .err = "using default of "
288 __MODULE_STRING(DEFAULT_TADV),
289 .def = DEFAULT_TADV,
290 .arg = { .r = { .min = MIN_TXABSDELAY,
291 .max = MAX_TXABSDELAY } }
292 };
293
294 if (num_TxAbsIntDelay > bd) {
295 adapter->tx_abs_int_delay = TxAbsIntDelay[bd];
296 e1000_validate_option(&adapter->tx_abs_int_delay, &opt,
297 adapter);
298 } else {
299 adapter->tx_abs_int_delay = opt.def;
300 }
301 }
302 { /* Receive Interrupt Delay */
Bruce Allan4fe44912010-05-10 14:59:10 +0000303 static struct e1000_option opt = {
Auke Kokbc7f75f2007-09-17 12:30:59 -0700304 .type = range_option,
305 .name = "Receive Interrupt Delay",
306 .err = "using default of "
307 __MODULE_STRING(DEFAULT_RDTR),
308 .def = DEFAULT_RDTR,
309 .arg = { .r = { .min = MIN_RXDELAY,
310 .max = MAX_RXDELAY } }
311 };
312
Auke Kokbc7f75f2007-09-17 12:30:59 -0700313 if (num_RxIntDelay > bd) {
314 adapter->rx_int_delay = RxIntDelay[bd];
315 e1000_validate_option(&adapter->rx_int_delay, &opt,
316 adapter);
317 } else {
318 adapter->rx_int_delay = opt.def;
319 }
320 }
321 { /* Receive Absolute Interrupt Delay */
Jesse Brandeburg6f59d662010-04-09 10:51:09 +0000322 static const struct e1000_option opt = {
Auke Kokbc7f75f2007-09-17 12:30:59 -0700323 .type = range_option,
324 .name = "Receive Absolute Interrupt Delay",
325 .err = "using default of "
326 __MODULE_STRING(DEFAULT_RADV),
327 .def = DEFAULT_RADV,
328 .arg = { .r = { .min = MIN_RXABSDELAY,
329 .max = MAX_RXABSDELAY } }
330 };
331
332 if (num_RxAbsIntDelay > bd) {
333 adapter->rx_abs_int_delay = RxAbsIntDelay[bd];
334 e1000_validate_option(&adapter->rx_abs_int_delay, &opt,
335 adapter);
336 } else {
337 adapter->rx_abs_int_delay = opt.def;
338 }
339 }
340 { /* Interrupt Throttling Rate */
Jesse Brandeburg6f59d662010-04-09 10:51:09 +0000341 static const struct e1000_option opt = {
Auke Kokbc7f75f2007-09-17 12:30:59 -0700342 .type = range_option,
343 .name = "Interrupt Throttling Rate (ints/sec)",
344 .err = "using default of "
345 __MODULE_STRING(DEFAULT_ITR),
346 .def = DEFAULT_ITR,
347 .arg = { .r = { .min = MIN_ITR,
348 .max = MAX_ITR } }
349 };
350
351 if (num_InterruptThrottleRate > bd) {
352 adapter->itr = InterruptThrottleRate[bd];
Jeff Kirsher2e7d21c2012-05-09 02:23:46 -0700353
354 /*
355 * Make sure a message is printed for non-special
356 * values. And in case of an invalid option, display
357 * warning, use default and go through itr/itr_setting
358 * adjustment logic below
359 */
360 if ((adapter->itr > 4) &&
361 e1000_validate_option(&adapter->itr, &opt, adapter))
362 adapter->itr = opt.def;
Auke Kokbc7f75f2007-09-17 12:30:59 -0700363 } else {
Jeff Kirsher727c3562012-04-20 08:51:45 +0000364 /*
365 * If no option specified, use default value and go
366 * through the logic below to adjust itr/itr_setting
367 */
368 adapter->itr = opt.def;
369
370 /*
371 * Make sure a message is printed for non-special
372 * default values
373 */
Jeff Kirsher2e7d21c2012-05-09 02:23:46 -0700374 if (adapter->itr > 4)
Bruce Allan185095f2012-06-07 02:23:37 +0000375 dev_info(&adapter->pdev->dev,
376 "%s set to default %d\n", opt.name,
377 adapter->itr);
Jeff Kirsher727c3562012-04-20 08:51:45 +0000378 }
379
380 adapter->itr_setting = adapter->itr;
381 switch (adapter->itr) {
382 case 0:
Bruce Allan185095f2012-06-07 02:23:37 +0000383 dev_info(&adapter->pdev->dev, "%s turned off\n",
384 opt.name);
Jeff Kirsher727c3562012-04-20 08:51:45 +0000385 break;
386 case 1:
Bruce Allan185095f2012-06-07 02:23:37 +0000387 dev_info(&adapter->pdev->dev,
388 "%s set to dynamic mode\n", opt.name);
Auke Kokbc7f75f2007-09-17 12:30:59 -0700389 adapter->itr = 20000;
Jeff Kirsher727c3562012-04-20 08:51:45 +0000390 break;
391 case 3:
Bruce Allan185095f2012-06-07 02:23:37 +0000392 dev_info(&adapter->pdev->dev,
393 "%s set to dynamic conservative mode\n",
394 opt.name);
Jeff Kirsher727c3562012-04-20 08:51:45 +0000395 adapter->itr = 20000;
396 break;
397 case 4:
Bruce Allan185095f2012-06-07 02:23:37 +0000398 dev_info(&adapter->pdev->dev,
399 "%s set to simplified (2000-8000 ints) mode\n",
400 opt.name);
Jeff Kirsher727c3562012-04-20 08:51:45 +0000401 break;
402 default:
403 /*
404 * Save the setting, because the dynamic bits
405 * change itr.
406 *
407 * Clear the lower two bits because
408 * they are used as control.
409 */
410 adapter->itr_setting &= ~3;
411 break;
Auke Kokbc7f75f2007-09-17 12:30:59 -0700412 }
413 }
Bruce Allan4662e822008-08-26 18:37:06 -0700414 { /* Interrupt Mode */
Bruce Allan4fe44912010-05-10 14:59:10 +0000415 static struct e1000_option opt = {
Bruce Allan4662e822008-08-26 18:37:06 -0700416 .type = range_option,
417 .name = "Interrupt Mode",
Bruce Allanb6fbca22011-12-16 00:45:56 +0000418#ifndef CONFIG_PCI_MSI
419 .err = "defaulting to 0 (legacy)",
420 .def = E1000E_INT_MODE_LEGACY,
421 .arg = { .r = { .min = 0,
422 .max = 0 } }
423#endif
Bruce Allan4662e822008-08-26 18:37:06 -0700424 };
425
Bruce Allanb6fbca22011-12-16 00:45:56 +0000426#ifdef CONFIG_PCI_MSI
427 if (adapter->flags & FLAG_HAS_MSIX) {
428 opt.err = kstrdup("defaulting to 2 (MSI-X)",
429 GFP_KERNEL);
430 opt.def = E1000E_INT_MODE_MSIX;
431 opt.arg.r.max = E1000E_INT_MODE_MSIX;
432 } else {
433 opt.err = kstrdup("defaulting to 1 (MSI)", GFP_KERNEL);
434 opt.def = E1000E_INT_MODE_MSI;
435 opt.arg.r.max = E1000E_INT_MODE_MSI;
436 }
437
438 if (!opt.err) {
439 dev_err(&adapter->pdev->dev,
440 "Failed to allocate memory\n");
441 return;
442 }
443#endif
444
Bruce Allan4662e822008-08-26 18:37:06 -0700445 if (num_IntMode > bd) {
446 unsigned int int_mode = IntMode[bd];
447 e1000_validate_option(&int_mode, &opt, adapter);
448 adapter->int_mode = int_mode;
449 } else {
450 adapter->int_mode = opt.def;
451 }
Bruce Allanb6fbca22011-12-16 00:45:56 +0000452
453#ifdef CONFIG_PCI_MSI
454 kfree(opt.err);
455#endif
Bruce Allan4662e822008-08-26 18:37:06 -0700456 }
Auke Kokbc7f75f2007-09-17 12:30:59 -0700457 { /* Smart Power Down */
Jesse Brandeburg6f59d662010-04-09 10:51:09 +0000458 static const struct e1000_option opt = {
Auke Kokbc7f75f2007-09-17 12:30:59 -0700459 .type = enable_option,
460 .name = "PHY Smart Power Down",
461 .err = "defaulting to Disabled",
462 .def = OPTION_DISABLED
463 };
464
465 if (num_SmartPowerDownEnable > bd) {
Stephen Hemminger5a9147b2007-10-29 10:46:05 -0700466 unsigned int spd = SmartPowerDownEnable[bd];
Auke Kokbc7f75f2007-09-17 12:30:59 -0700467 e1000_validate_option(&spd, &opt, adapter);
468 if ((adapter->flags & FLAG_HAS_SMART_POWER_DOWN)
469 && spd)
470 adapter->flags |= FLAG_SMART_POWER_DOWN;
471 }
472 }
Jeff Kirshereb7c3ad2008-11-14 06:45:23 +0000473 { /* CRC Stripping */
Jesse Brandeburg6f59d662010-04-09 10:51:09 +0000474 static const struct e1000_option opt = {
Jeff Kirshereb7c3ad2008-11-14 06:45:23 +0000475 .type = enable_option,
476 .name = "CRC Stripping",
Bruce Allane9262442010-11-24 06:02:06 +0000477 .err = "defaulting to Enabled",
Jeff Kirshereb7c3ad2008-11-14 06:45:23 +0000478 .def = OPTION_ENABLED
479 };
480
481 if (num_CrcStripping > bd) {
482 unsigned int crc_stripping = CrcStripping[bd];
483 e1000_validate_option(&crc_stripping, &opt, adapter);
Ben Greear01840392012-02-11 15:39:25 +0000484 if (crc_stripping == OPTION_ENABLED) {
Jeff Kirshereb7c3ad2008-11-14 06:45:23 +0000485 adapter->flags2 |= FLAG2_CRC_STRIPPING;
Ben Greear01840392012-02-11 15:39:25 +0000486 adapter->flags2 |= FLAG2_DFLT_CRC_STRIPPING;
487 }
Bruce Allan6e50912a2009-06-02 11:28:01 +0000488 } else {
489 adapter->flags2 |= FLAG2_CRC_STRIPPING;
Ben Greear01840392012-02-11 15:39:25 +0000490 adapter->flags2 |= FLAG2_DFLT_CRC_STRIPPING;
Jeff Kirshereb7c3ad2008-11-14 06:45:23 +0000491 }
492 }
Auke Kokbc7f75f2007-09-17 12:30:59 -0700493 { /* Kumeran Lock Loss Workaround */
Jesse Brandeburg6f59d662010-04-09 10:51:09 +0000494 static const struct e1000_option opt = {
Auke Kokbc7f75f2007-09-17 12:30:59 -0700495 .type = enable_option,
496 .name = "Kumeran Lock Loss Workaround",
497 .err = "defaulting to Enabled",
498 .def = OPTION_ENABLED
499 };
500
501 if (num_KumeranLockLoss > bd) {
Stephen Hemminger5a9147b2007-10-29 10:46:05 -0700502 unsigned int kmrn_lock_loss = KumeranLockLoss[bd];
Auke Kokbc7f75f2007-09-17 12:30:59 -0700503 e1000_validate_option(&kmrn_lock_loss, &opt, adapter);
504 if (hw->mac.type == e1000_ich8lan)
505 e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw,
506 kmrn_lock_loss);
507 } else {
508 if (hw->mac.type == e1000_ich8lan)
509 e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw,
510 opt.def);
511 }
512 }
Bruce Allan4a770352008-10-01 17:18:35 -0700513 { /* Write-protect NVM */
Jesse Brandeburg6f59d662010-04-09 10:51:09 +0000514 static const struct e1000_option opt = {
Bruce Allan4a770352008-10-01 17:18:35 -0700515 .type = enable_option,
516 .name = "Write-protect NVM",
517 .err = "defaulting to Enabled",
518 .def = OPTION_ENABLED
519 };
520
521 if (adapter->flags & FLAG_IS_ICH) {
522 if (num_WriteProtectNVM > bd) {
523 unsigned int write_protect_nvm = WriteProtectNVM[bd];
524 e1000_validate_option(&write_protect_nvm, &opt,
525 adapter);
526 if (write_protect_nvm)
527 adapter->flags |= FLAG_READ_ONLY_NVM;
528 } else {
529 if (opt.def)
530 adapter->flags |= FLAG_READ_ONLY_NVM;
531 }
532 }
533 }
Auke Kokbc7f75f2007-09-17 12:30:59 -0700534}