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