fp@1744: /******************************************************************************* fp@1744: fp@1744: fp@1744: Copyright(c) 1999 - 2006 Intel Corporation. All rights reserved. fp@1744: fp@1744: This program is free software; you can redistribute it and/or modify it fp@1744: under the terms of the GNU General Public License as published by the Free fp@1744: Software Foundation; either version 2 of the License, or (at your option) fp@1744: any later version. fp@1744: fp@1744: This program is distributed in the hope that it will be useful, but WITHOUT fp@1744: ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or fp@1744: FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for fp@1744: more details. fp@1744: fp@1744: You should have received a copy of the GNU General Public License along with fp@1744: this program; if not, write to the Free Software Foundation, Inc., 59 fp@1744: Temple Place - Suite 330, Boston, MA 02111-1307, USA. fp@1744: fp@1744: The full GNU General Public License is included in this distribution in the fp@1744: file called LICENSE. fp@1744: fp@1744: Contact Information: fp@1744: Linux NICS fp@1744: e1000-devel Mailing List fp@1744: Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 fp@1744: fp@1744: *******************************************************************************/ fp@1744: fp@1744: #include "e1000-2.6.18-ethercat.h" fp@1744: fp@1744: /* This is the only thing that needs to be changed to adjust the fp@1744: * maximum number of ports that the driver can manage. fp@1744: */ fp@1744: fp@1744: #define E1000_MAX_NIC 32 fp@1744: fp@1744: #define OPTION_UNSET -1 fp@1744: #define OPTION_DISABLED 0 fp@1744: #define OPTION_ENABLED 1 fp@1744: fp@1744: /* All parameters are treated the same, as an integer array of values. fp@1744: * This macro just reduces the need to repeat the same declaration code fp@1744: * over and over (plus this helps to avoid typo bugs). fp@1744: */ fp@1744: fp@1744: #define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET } fp@1744: /* Module Parameters are always initialized to -1, so that the driver fp@1744: * can tell the difference between no user specified value or the fp@1744: * user asking for the default value. fp@1744: * The true default values are loaded in when e1000_check_options is called. fp@1744: * fp@1744: * This is a GCC extension to ANSI C. fp@1744: * See the item "Labeled Elements in Initializers" in the section fp@1744: * "Extensions to the C Language Family" of the GCC documentation. fp@1744: */ fp@1744: fp@1744: #define E1000_PARAM(X, desc) \ fp@1744: static int __devinitdata X[E1000_MAX_NIC+1] = E1000_PARAM_INIT; \ fp@1744: static int num_##X = 0; \ fp@1744: module_param_array_named(X, X, int, &num_##X, 0); \ fp@1744: MODULE_PARM_DESC(X, desc); fp@1744: fp@1744: /* Transmit Descriptor Count fp@1744: * fp@1744: * Valid Range: 80-256 for 82542 and 82543 gigabit ethernet controllers fp@1744: * Valid Range: 80-4096 for 82544 and newer fp@1744: * fp@1744: * Default Value: 256 fp@1744: */ fp@1744: fp@1744: E1000_PARAM(TxDescriptors, "Number of transmit descriptors"); fp@1744: fp@1744: /* Receive Descriptor Count fp@1744: * fp@1744: * Valid Range: 80-256 for 82542 and 82543 gigabit ethernet controllers fp@1744: * Valid Range: 80-4096 for 82544 and newer fp@1744: * fp@1744: * Default Value: 256 fp@1744: */ fp@1744: fp@1744: E1000_PARAM(RxDescriptors, "Number of receive descriptors"); fp@1744: fp@1744: /* User Specified Speed Override fp@1744: * fp@1744: * Valid Range: 0, 10, 100, 1000 fp@1744: * - 0 - auto-negotiate at all supported speeds fp@1744: * - 10 - only link at 10 Mbps fp@1744: * - 100 - only link at 100 Mbps fp@1744: * - 1000 - only link at 1000 Mbps fp@1744: * fp@1744: * Default Value: 0 fp@1744: */ fp@1744: fp@1744: E1000_PARAM(Speed, "Speed setting"); fp@1744: fp@1744: /* User Specified Duplex Override fp@1744: * fp@1744: * Valid Range: 0-2 fp@1744: * - 0 - auto-negotiate for duplex fp@1744: * - 1 - only link at half duplex fp@1744: * - 2 - only link at full duplex fp@1744: * fp@1744: * Default Value: 0 fp@1744: */ fp@1744: fp@1744: E1000_PARAM(Duplex, "Duplex setting"); fp@1744: fp@1744: /* Auto-negotiation Advertisement Override fp@1744: * fp@1744: * Valid Range: 0x01-0x0F, 0x20-0x2F (copper); 0x20 (fiber) fp@1744: * fp@1744: * The AutoNeg value is a bit mask describing which speed and duplex fp@1744: * combinations should be advertised during auto-negotiation. fp@1744: * The supported speed and duplex modes are listed below fp@1744: * fp@1744: * Bit 7 6 5 4 3 2 1 0 fp@1744: * Speed (Mbps) N/A N/A 1000 N/A 100 100 10 10 fp@1744: * Duplex Full Full Half Full Half fp@1744: * fp@1744: * Default Value: 0x2F (copper); 0x20 (fiber) fp@1744: */ fp@1744: fp@1744: E1000_PARAM(AutoNeg, "Advertised auto-negotiation setting"); fp@1744: fp@1744: /* User Specified Flow Control Override fp@1744: * fp@1744: * Valid Range: 0-3 fp@1744: * - 0 - No Flow Control fp@1744: * - 1 - Rx only, respond to PAUSE frames but do not generate them fp@1744: * - 2 - Tx only, generate PAUSE frames but ignore them on receive fp@1744: * - 3 - Full Flow Control Support fp@1744: * fp@1744: * Default Value: Read flow control settings from the EEPROM fp@1744: */ fp@1744: fp@1744: E1000_PARAM(FlowControl, "Flow Control setting"); fp@1744: fp@1744: /* XsumRX - Receive Checksum Offload Enable/Disable fp@1744: * fp@1744: * Valid Range: 0, 1 fp@1744: * - 0 - disables all checksum offload fp@1744: * - 1 - enables receive IP/TCP/UDP checksum offload fp@1744: * on 82543 and newer -based NICs fp@1744: * fp@1744: * Default Value: 1 fp@1744: */ fp@1744: fp@1744: E1000_PARAM(XsumRX, "Disable or enable Receive Checksum offload"); fp@1744: fp@1744: /* Transmit Interrupt Delay in units of 1.024 microseconds fp@1744: * fp@1744: * Valid Range: 0-65535 fp@1744: * fp@1744: * Default Value: 64 fp@1744: */ fp@1744: fp@1744: E1000_PARAM(TxIntDelay, "Transmit Interrupt Delay"); fp@1744: fp@1744: /* Transmit Absolute Interrupt Delay in units of 1.024 microseconds fp@1744: * fp@1744: * Valid Range: 0-65535 fp@1744: * fp@1744: * Default Value: 0 fp@1744: */ fp@1744: fp@1744: E1000_PARAM(TxAbsIntDelay, "Transmit Absolute Interrupt Delay"); fp@1744: fp@1744: /* Receive Interrupt Delay in units of 1.024 microseconds fp@1744: * fp@1744: * Valid Range: 0-65535 fp@1744: * fp@1744: * Default Value: 0 fp@1744: */ fp@1744: fp@1744: E1000_PARAM(RxIntDelay, "Receive Interrupt Delay"); fp@1744: fp@1744: /* Receive Absolute Interrupt Delay in units of 1.024 microseconds fp@1744: * fp@1744: * Valid Range: 0-65535 fp@1744: * fp@1744: * Default Value: 128 fp@1744: */ fp@1744: fp@1744: E1000_PARAM(RxAbsIntDelay, "Receive Absolute Interrupt Delay"); fp@1744: fp@1744: /* Interrupt Throttle Rate (interrupts/sec) fp@1744: * fp@1744: * Valid Range: 100-100000 (0=off, 1=dynamic) fp@1744: * fp@1744: * Default Value: 8000 fp@1744: */ fp@1744: fp@1744: E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate"); fp@1744: fp@1744: /* Enable Smart Power Down of the PHY fp@1744: * fp@1744: * Valid Range: 0, 1 fp@1744: * fp@1744: * Default Value: 0 (disabled) fp@1744: */ fp@1744: fp@1744: E1000_PARAM(SmartPowerDownEnable, "Enable PHY smart power down"); fp@1744: fp@1744: /* Enable Kumeran Lock Loss workaround fp@1744: * fp@1744: * Valid Range: 0, 1 fp@1744: * fp@1744: * Default Value: 1 (enabled) fp@1744: */ fp@1744: fp@1744: E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround"); fp@1744: fp@1744: #define AUTONEG_ADV_DEFAULT 0x2F fp@1744: #define AUTONEG_ADV_MASK 0x2F fp@1744: #define FLOW_CONTROL_DEFAULT FLOW_CONTROL_FULL fp@1744: fp@1744: #define DEFAULT_RDTR 0 fp@1744: #define MAX_RXDELAY 0xFFFF fp@1744: #define MIN_RXDELAY 0 fp@1744: fp@1744: #define DEFAULT_RADV 128 fp@1744: #define MAX_RXABSDELAY 0xFFFF fp@1744: #define MIN_RXABSDELAY 0 fp@1744: fp@1744: #define DEFAULT_TIDV 64 fp@1744: #define MAX_TXDELAY 0xFFFF fp@1744: #define MIN_TXDELAY 0 fp@1744: fp@1744: #define DEFAULT_TADV 64 fp@1744: #define MAX_TXABSDELAY 0xFFFF fp@1744: #define MIN_TXABSDELAY 0 fp@1744: fp@1744: #define DEFAULT_ITR 8000 fp@1744: #define MAX_ITR 100000 fp@1744: #define MIN_ITR 100 fp@1744: fp@1744: struct e1000_option { fp@1744: enum { enable_option, range_option, list_option } type; fp@1744: char *name; fp@1744: char *err; fp@1744: int def; fp@1744: union { fp@1744: struct { /* range_option info */ fp@1744: int min; fp@1744: int max; fp@1744: } r; fp@1744: struct { /* list_option info */ fp@1744: int nr; fp@1744: struct e1000_opt_list { int i; char *str; } *p; fp@1744: } l; fp@1744: } arg; fp@1744: }; fp@1744: fp@1744: static int __devinit fp@1744: e1000_validate_option(int *value, struct e1000_option *opt, fp@1744: struct e1000_adapter *adapter) fp@1744: { fp@1744: if (*value == OPTION_UNSET) { fp@1744: *value = opt->def; fp@1744: return 0; fp@1744: } fp@1744: fp@1744: switch (opt->type) { fp@1744: case enable_option: fp@1744: switch (*value) { fp@1744: case OPTION_ENABLED: fp@1744: DPRINTK(PROBE, INFO, "%s Enabled\n", opt->name); fp@1744: return 0; fp@1744: case OPTION_DISABLED: fp@1744: DPRINTK(PROBE, INFO, "%s Disabled\n", opt->name); fp@1744: return 0; fp@1744: } fp@1744: break; fp@1744: case range_option: fp@1744: if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) { fp@1744: DPRINTK(PROBE, INFO, fp@1744: "%s set to %i\n", opt->name, *value); fp@1744: return 0; fp@1744: } fp@1744: break; fp@1744: case list_option: { fp@1744: int i; fp@1744: struct e1000_opt_list *ent; fp@1744: fp@1744: for (i = 0; i < opt->arg.l.nr; i++) { fp@1744: ent = &opt->arg.l.p[i]; fp@1744: if (*value == ent->i) { fp@1744: if (ent->str[0] != '\0') fp@1744: DPRINTK(PROBE, INFO, "%s\n", ent->str); fp@1744: return 0; fp@1744: } fp@1744: } fp@1744: } fp@1744: break; fp@1744: default: fp@1744: BUG(); fp@1744: } fp@1744: fp@1744: DPRINTK(PROBE, INFO, "Invalid %s value specified (%i) %s\n", fp@1744: opt->name, *value, opt->err); fp@1744: *value = opt->def; fp@1744: return -1; fp@1744: } fp@1744: fp@1744: static void e1000_check_fiber_options(struct e1000_adapter *adapter); fp@1744: static void e1000_check_copper_options(struct e1000_adapter *adapter); fp@1744: fp@1744: /** fp@1744: * e1000_check_options - Range Checking for Command Line Parameters fp@1744: * @adapter: board private structure fp@1744: * fp@1744: * This routine checks all command line parameters for valid user fp@1744: * input. If an invalid value is given, or if no user specified fp@1744: * value exists, a default value is used. The final value is stored fp@1744: * in a variable in the adapter structure. fp@1744: **/ fp@1744: fp@1744: void __devinit fp@1744: e1000_check_options(struct e1000_adapter *adapter) fp@1744: { fp@1744: int bd = adapter->bd_number; fp@1744: if (bd >= E1000_MAX_NIC) { fp@1744: DPRINTK(PROBE, NOTICE, fp@1744: "Warning: no configuration for board #%i\n", bd); fp@1744: DPRINTK(PROBE, NOTICE, "Using defaults for all values\n"); fp@1744: bd = E1000_MAX_NIC; fp@1744: } fp@1744: fp@1744: { /* Transmit Descriptor Count */ fp@1744: struct e1000_option opt = { fp@1744: .type = range_option, fp@1744: .name = "Transmit Descriptors", fp@1744: .err = "using default of " fp@1744: __MODULE_STRING(E1000_DEFAULT_TXD), fp@1744: .def = E1000_DEFAULT_TXD, fp@1744: .arg = { .r = { .min = E1000_MIN_TXD }} fp@1744: }; fp@1744: struct e1000_tx_ring *tx_ring = adapter->tx_ring; fp@1744: int i; fp@1744: e1000_mac_type mac_type = adapter->hw.mac_type; fp@1744: opt.arg.r.max = mac_type < e1000_82544 ? fp@1744: E1000_MAX_TXD : E1000_MAX_82544_TXD; fp@1744: fp@1744: tx_ring->count = TxDescriptors[bd]; fp@1744: e1000_validate_option(&tx_ring->count, &opt, adapter); fp@1744: E1000_ROUNDUP(tx_ring->count, REQ_TX_DESCRIPTOR_MULTIPLE); fp@1744: for (i = 0; i < adapter->num_tx_queues; i++) fp@1744: tx_ring[i].count = tx_ring->count; fp@1744: } fp@1744: { /* Receive Descriptor Count */ fp@1744: struct e1000_option opt = { fp@1744: .type = range_option, fp@1744: .name = "Receive Descriptors", fp@1744: .err = "using default of " fp@1744: __MODULE_STRING(E1000_DEFAULT_RXD), fp@1744: .def = E1000_DEFAULT_RXD, fp@1744: .arg = { .r = { .min = E1000_MIN_RXD }} fp@1744: }; fp@1744: struct e1000_rx_ring *rx_ring = adapter->rx_ring; fp@1744: int i; fp@1744: e1000_mac_type mac_type = adapter->hw.mac_type; fp@1744: opt.arg.r.max = mac_type < e1000_82544 ? E1000_MAX_RXD : fp@1744: E1000_MAX_82544_RXD; fp@1744: fp@1744: rx_ring->count = RxDescriptors[bd]; fp@1744: e1000_validate_option(&rx_ring->count, &opt, adapter); fp@1744: E1000_ROUNDUP(rx_ring->count, REQ_RX_DESCRIPTOR_MULTIPLE); fp@1744: for (i = 0; i < adapter->num_rx_queues; i++) fp@1744: rx_ring[i].count = rx_ring->count; fp@1744: } fp@1744: { /* Checksum Offload Enable/Disable */ fp@1744: struct e1000_option opt = { fp@1744: .type = enable_option, fp@1744: .name = "Checksum Offload", fp@1744: .err = "defaulting to Enabled", fp@1744: .def = OPTION_ENABLED fp@1744: }; fp@1744: fp@1744: int rx_csum = XsumRX[bd]; fp@1744: e1000_validate_option(&rx_csum, &opt, adapter); fp@1744: adapter->rx_csum = rx_csum; fp@1744: } fp@1744: { /* Flow Control */ fp@1744: fp@1744: struct e1000_opt_list fc_list[] = fp@1744: {{ e1000_fc_none, "Flow Control Disabled" }, fp@1744: { e1000_fc_rx_pause,"Flow Control Receive Only" }, fp@1744: { e1000_fc_tx_pause,"Flow Control Transmit Only" }, fp@1744: { e1000_fc_full, "Flow Control Enabled" }, fp@1744: { e1000_fc_default, "Flow Control Hardware Default" }}; fp@1744: fp@1744: struct e1000_option opt = { fp@1744: .type = list_option, fp@1744: .name = "Flow Control", fp@1744: .err = "reading default settings from EEPROM", fp@1744: .def = e1000_fc_default, fp@1744: .arg = { .l = { .nr = ARRAY_SIZE(fc_list), fp@1744: .p = fc_list }} fp@1744: }; fp@1744: fp@1744: int fc = FlowControl[bd]; fp@1744: e1000_validate_option(&fc, &opt, adapter); fp@1744: adapter->hw.fc = adapter->hw.original_fc = fc; fp@1744: } fp@1744: { /* Transmit Interrupt Delay */ fp@1744: struct e1000_option opt = { fp@1744: .type = range_option, fp@1744: .name = "Transmit Interrupt Delay", fp@1744: .err = "using default of " __MODULE_STRING(DEFAULT_TIDV), fp@1744: .def = DEFAULT_TIDV, fp@1744: .arg = { .r = { .min = MIN_TXDELAY, fp@1744: .max = MAX_TXDELAY }} fp@1744: }; fp@1744: fp@1744: adapter->tx_int_delay = TxIntDelay[bd]; fp@1744: e1000_validate_option(&adapter->tx_int_delay, &opt, adapter); fp@1744: } fp@1744: { /* Transmit Absolute Interrupt Delay */ fp@1744: struct e1000_option opt = { fp@1744: .type = range_option, fp@1744: .name = "Transmit Absolute Interrupt Delay", fp@1744: .err = "using default of " __MODULE_STRING(DEFAULT_TADV), fp@1744: .def = DEFAULT_TADV, fp@1744: .arg = { .r = { .min = MIN_TXABSDELAY, fp@1744: .max = MAX_TXABSDELAY }} fp@1744: }; fp@1744: fp@1744: adapter->tx_abs_int_delay = TxAbsIntDelay[bd]; fp@1744: e1000_validate_option(&adapter->tx_abs_int_delay, &opt, fp@1744: adapter); fp@1744: } fp@1744: { /* Receive Interrupt Delay */ fp@1744: struct e1000_option opt = { fp@1744: .type = range_option, fp@1744: .name = "Receive Interrupt Delay", fp@1744: .err = "using default of " __MODULE_STRING(DEFAULT_RDTR), fp@1744: .def = DEFAULT_RDTR, fp@1744: .arg = { .r = { .min = MIN_RXDELAY, fp@1744: .max = MAX_RXDELAY }} fp@1744: }; fp@1744: fp@1744: adapter->rx_int_delay = RxIntDelay[bd]; fp@1744: e1000_validate_option(&adapter->rx_int_delay, &opt, adapter); fp@1744: } fp@1744: { /* Receive Absolute Interrupt Delay */ fp@1744: struct e1000_option opt = { fp@1744: .type = range_option, fp@1744: .name = "Receive Absolute Interrupt Delay", fp@1744: .err = "using default of " __MODULE_STRING(DEFAULT_RADV), fp@1744: .def = DEFAULT_RADV, fp@1744: .arg = { .r = { .min = MIN_RXABSDELAY, fp@1744: .max = MAX_RXABSDELAY }} fp@1744: }; fp@1744: fp@1744: adapter->rx_abs_int_delay = RxAbsIntDelay[bd]; fp@1744: e1000_validate_option(&adapter->rx_abs_int_delay, &opt, fp@1744: adapter); fp@1744: } fp@1744: { /* Interrupt Throttling Rate */ fp@1744: struct e1000_option opt = { fp@1744: .type = range_option, fp@1744: .name = "Interrupt Throttling Rate (ints/sec)", fp@1744: .err = "using default of " __MODULE_STRING(DEFAULT_ITR), fp@1744: .def = DEFAULT_ITR, fp@1744: .arg = { .r = { .min = MIN_ITR, fp@1744: .max = MAX_ITR }} fp@1744: }; fp@1744: fp@1744: adapter->itr = InterruptThrottleRate[bd]; fp@1744: switch (adapter->itr) { fp@1744: case 0: fp@1744: DPRINTK(PROBE, INFO, "%s turned off\n", opt.name); fp@1744: break; fp@1744: case 1: fp@1744: DPRINTK(PROBE, INFO, "%s set to dynamic mode\n", fp@1744: opt.name); fp@1744: break; fp@1744: default: fp@1744: e1000_validate_option(&adapter->itr, &opt, adapter); fp@1744: break; fp@1744: } fp@1744: } fp@1744: { /* Smart Power Down */ fp@1744: struct e1000_option opt = { fp@1744: .type = enable_option, fp@1744: .name = "PHY Smart Power Down", fp@1744: .err = "defaulting to Disabled", fp@1744: .def = OPTION_DISABLED fp@1744: }; fp@1744: fp@1744: int spd = SmartPowerDownEnable[bd]; fp@1744: e1000_validate_option(&spd, &opt, adapter); fp@1744: adapter->smart_power_down = spd; fp@1744: } fp@1744: { /* Kumeran Lock Loss Workaround */ fp@1744: struct e1000_option opt = { fp@1744: .type = enable_option, fp@1744: .name = "Kumeran Lock Loss Workaround", fp@1744: .err = "defaulting to Enabled", fp@1744: .def = OPTION_ENABLED fp@1744: }; fp@1744: fp@1744: int kmrn_lock_loss = KumeranLockLoss[bd]; fp@1744: e1000_validate_option(&kmrn_lock_loss, &opt, adapter); fp@1744: adapter->hw.kmrn_lock_loss_workaround_disabled = !kmrn_lock_loss; fp@1744: } fp@1744: fp@1744: switch (adapter->hw.media_type) { fp@1744: case e1000_media_type_fiber: fp@1744: case e1000_media_type_internal_serdes: fp@1744: e1000_check_fiber_options(adapter); fp@1744: break; fp@1744: case e1000_media_type_copper: fp@1744: e1000_check_copper_options(adapter); fp@1744: break; fp@1744: default: fp@1744: BUG(); fp@1744: } fp@1744: } fp@1744: fp@1744: /** fp@1744: * e1000_check_fiber_options - Range Checking for Link Options, Fiber Version fp@1744: * @adapter: board private structure fp@1744: * fp@1744: * Handles speed and duplex options on fiber adapters fp@1744: **/ fp@1744: fp@1744: static void __devinit fp@1744: e1000_check_fiber_options(struct e1000_adapter *adapter) fp@1744: { fp@1744: int bd = adapter->bd_number; fp@1744: bd = bd > E1000_MAX_NIC ? E1000_MAX_NIC : bd; fp@1744: if ((Speed[bd] != OPTION_UNSET)) { fp@1744: DPRINTK(PROBE, INFO, "Speed not valid for fiber adapters, " fp@1744: "parameter ignored\n"); fp@1744: } fp@1744: fp@1744: if ((Duplex[bd] != OPTION_UNSET)) { fp@1744: DPRINTK(PROBE, INFO, "Duplex not valid for fiber adapters, " fp@1744: "parameter ignored\n"); fp@1744: } fp@1744: fp@1744: if ((AutoNeg[bd] != OPTION_UNSET) && (AutoNeg[bd] != 0x20)) { fp@1744: DPRINTK(PROBE, INFO, "AutoNeg other than 1000/Full is " fp@1744: "not valid for fiber adapters, " fp@1744: "parameter ignored\n"); fp@1744: } fp@1744: } fp@1744: fp@1744: /** fp@1744: * e1000_check_copper_options - Range Checking for Link Options, Copper Version fp@1744: * @adapter: board private structure fp@1744: * fp@1744: * Handles speed and duplex options on copper adapters fp@1744: **/ fp@1744: fp@1744: static void __devinit fp@1744: e1000_check_copper_options(struct e1000_adapter *adapter) fp@1744: { fp@1744: int speed, dplx, an; fp@1744: int bd = adapter->bd_number; fp@1744: bd = bd > E1000_MAX_NIC ? E1000_MAX_NIC : bd; fp@1744: fp@1744: { /* Speed */ fp@1744: struct e1000_opt_list speed_list[] = {{ 0, "" }, fp@1744: { SPEED_10, "" }, fp@1744: { SPEED_100, "" }, fp@1744: { SPEED_1000, "" }}; fp@1744: fp@1744: struct e1000_option opt = { fp@1744: .type = list_option, fp@1744: .name = "Speed", fp@1744: .err = "parameter ignored", fp@1744: .def = 0, fp@1744: .arg = { .l = { .nr = ARRAY_SIZE(speed_list), fp@1744: .p = speed_list }} fp@1744: }; fp@1744: fp@1744: speed = Speed[bd]; fp@1744: e1000_validate_option(&speed, &opt, adapter); fp@1744: } fp@1744: { /* Duplex */ fp@1744: struct e1000_opt_list dplx_list[] = {{ 0, "" }, fp@1744: { HALF_DUPLEX, "" }, fp@1744: { FULL_DUPLEX, "" }}; fp@1744: fp@1744: struct e1000_option opt = { fp@1744: .type = list_option, fp@1744: .name = "Duplex", fp@1744: .err = "parameter ignored", fp@1744: .def = 0, fp@1744: .arg = { .l = { .nr = ARRAY_SIZE(dplx_list), fp@1744: .p = dplx_list }} fp@1744: }; fp@1744: fp@1744: if (e1000_check_phy_reset_block(&adapter->hw)) { fp@1744: DPRINTK(PROBE, INFO, fp@1744: "Link active due to SoL/IDER Session. " fp@1744: "Speed/Duplex/AutoNeg parameter ignored.\n"); fp@1744: return; fp@1744: } fp@1744: dplx = Duplex[bd]; fp@1744: e1000_validate_option(&dplx, &opt, adapter); fp@1744: } fp@1744: fp@1744: if (AutoNeg[bd] != OPTION_UNSET && (speed != 0 || dplx != 0)) { fp@1744: DPRINTK(PROBE, INFO, fp@1744: "AutoNeg specified along with Speed or Duplex, " fp@1744: "parameter ignored\n"); fp@1744: adapter->hw.autoneg_advertised = AUTONEG_ADV_DEFAULT; fp@1744: } else { /* Autoneg */ fp@1744: struct e1000_opt_list an_list[] = fp@1744: #define AA "AutoNeg advertising " fp@1744: {{ 0x01, AA "10/HD" }, fp@1744: { 0x02, AA "10/FD" }, fp@1744: { 0x03, AA "10/FD, 10/HD" }, fp@1744: { 0x04, AA "100/HD" }, fp@1744: { 0x05, AA "100/HD, 10/HD" }, fp@1744: { 0x06, AA "100/HD, 10/FD" }, fp@1744: { 0x07, AA "100/HD, 10/FD, 10/HD" }, fp@1744: { 0x08, AA "100/FD" }, fp@1744: { 0x09, AA "100/FD, 10/HD" }, fp@1744: { 0x0a, AA "100/FD, 10/FD" }, fp@1744: { 0x0b, AA "100/FD, 10/FD, 10/HD" }, fp@1744: { 0x0c, AA "100/FD, 100/HD" }, fp@1744: { 0x0d, AA "100/FD, 100/HD, 10/HD" }, fp@1744: { 0x0e, AA "100/FD, 100/HD, 10/FD" }, fp@1744: { 0x0f, AA "100/FD, 100/HD, 10/FD, 10/HD" }, fp@1744: { 0x20, AA "1000/FD" }, fp@1744: { 0x21, AA "1000/FD, 10/HD" }, fp@1744: { 0x22, AA "1000/FD, 10/FD" }, fp@1744: { 0x23, AA "1000/FD, 10/FD, 10/HD" }, fp@1744: { 0x24, AA "1000/FD, 100/HD" }, fp@1744: { 0x25, AA "1000/FD, 100/HD, 10/HD" }, fp@1744: { 0x26, AA "1000/FD, 100/HD, 10/FD" }, fp@1744: { 0x27, AA "1000/FD, 100/HD, 10/FD, 10/HD" }, fp@1744: { 0x28, AA "1000/FD, 100/FD" }, fp@1744: { 0x29, AA "1000/FD, 100/FD, 10/HD" }, fp@1744: { 0x2a, AA "1000/FD, 100/FD, 10/FD" }, fp@1744: { 0x2b, AA "1000/FD, 100/FD, 10/FD, 10/HD" }, fp@1744: { 0x2c, AA "1000/FD, 100/FD, 100/HD" }, fp@1744: { 0x2d, AA "1000/FD, 100/FD, 100/HD, 10/HD" }, fp@1744: { 0x2e, AA "1000/FD, 100/FD, 100/HD, 10/FD" }, fp@1744: { 0x2f, AA "1000/FD, 100/FD, 100/HD, 10/FD, 10/HD" }}; fp@1744: fp@1744: struct e1000_option opt = { fp@1744: .type = list_option, fp@1744: .name = "AutoNeg", fp@1744: .err = "parameter ignored", fp@1744: .def = AUTONEG_ADV_DEFAULT, fp@1744: .arg = { .l = { .nr = ARRAY_SIZE(an_list), fp@1744: .p = an_list }} fp@1744: }; fp@1744: fp@1744: an = AutoNeg[bd]; fp@1744: e1000_validate_option(&an, &opt, adapter); fp@1744: adapter->hw.autoneg_advertised = an; fp@1744: } fp@1744: fp@1744: switch (speed + dplx) { fp@1744: case 0: fp@1744: adapter->hw.autoneg = adapter->fc_autoneg = 1; fp@1744: if (Speed[bd] != OPTION_UNSET || Duplex[bd] != OPTION_UNSET) fp@1744: DPRINTK(PROBE, INFO, fp@1744: "Speed and duplex autonegotiation enabled\n"); fp@1744: break; fp@1744: case HALF_DUPLEX: fp@1744: DPRINTK(PROBE, INFO, "Half Duplex specified without Speed\n"); fp@1744: DPRINTK(PROBE, INFO, "Using Autonegotiation at " fp@1744: "Half Duplex only\n"); fp@1744: adapter->hw.autoneg = adapter->fc_autoneg = 1; fp@1744: adapter->hw.autoneg_advertised = ADVERTISE_10_HALF | fp@1744: ADVERTISE_100_HALF; fp@1744: break; fp@1744: case FULL_DUPLEX: fp@1744: DPRINTK(PROBE, INFO, "Full Duplex specified without Speed\n"); fp@1744: DPRINTK(PROBE, INFO, "Using Autonegotiation at " fp@1744: "Full Duplex only\n"); fp@1744: adapter->hw.autoneg = adapter->fc_autoneg = 1; fp@1744: adapter->hw.autoneg_advertised = ADVERTISE_10_FULL | fp@1744: ADVERTISE_100_FULL | fp@1744: ADVERTISE_1000_FULL; fp@1744: break; fp@1744: case SPEED_10: fp@1744: DPRINTK(PROBE, INFO, "10 Mbps Speed specified " fp@1744: "without Duplex\n"); fp@1744: DPRINTK(PROBE, INFO, "Using Autonegotiation at 10 Mbps only\n"); fp@1744: adapter->hw.autoneg = adapter->fc_autoneg = 1; fp@1744: adapter->hw.autoneg_advertised = ADVERTISE_10_HALF | fp@1744: ADVERTISE_10_FULL; fp@1744: break; fp@1744: case SPEED_10 + HALF_DUPLEX: fp@1744: DPRINTK(PROBE, INFO, "Forcing to 10 Mbps Half Duplex\n"); fp@1744: adapter->hw.autoneg = adapter->fc_autoneg = 0; fp@1744: adapter->hw.forced_speed_duplex = e1000_10_half; fp@1744: adapter->hw.autoneg_advertised = 0; fp@1744: break; fp@1744: case SPEED_10 + FULL_DUPLEX: fp@1744: DPRINTK(PROBE, INFO, "Forcing to 10 Mbps Full Duplex\n"); fp@1744: adapter->hw.autoneg = adapter->fc_autoneg = 0; fp@1744: adapter->hw.forced_speed_duplex = e1000_10_full; fp@1744: adapter->hw.autoneg_advertised = 0; fp@1744: break; fp@1744: case SPEED_100: fp@1744: DPRINTK(PROBE, INFO, "100 Mbps Speed specified " fp@1744: "without Duplex\n"); fp@1744: DPRINTK(PROBE, INFO, "Using Autonegotiation at " fp@1744: "100 Mbps only\n"); fp@1744: adapter->hw.autoneg = adapter->fc_autoneg = 1; fp@1744: adapter->hw.autoneg_advertised = ADVERTISE_100_HALF | fp@1744: ADVERTISE_100_FULL; fp@1744: break; fp@1744: case SPEED_100 + HALF_DUPLEX: fp@1744: DPRINTK(PROBE, INFO, "Forcing to 100 Mbps Half Duplex\n"); fp@1744: adapter->hw.autoneg = adapter->fc_autoneg = 0; fp@1744: adapter->hw.forced_speed_duplex = e1000_100_half; fp@1744: adapter->hw.autoneg_advertised = 0; fp@1744: break; fp@1744: case SPEED_100 + FULL_DUPLEX: fp@1744: DPRINTK(PROBE, INFO, "Forcing to 100 Mbps Full Duplex\n"); fp@1744: adapter->hw.autoneg = adapter->fc_autoneg = 0; fp@1744: adapter->hw.forced_speed_duplex = e1000_100_full; fp@1744: adapter->hw.autoneg_advertised = 0; fp@1744: break; fp@1744: case SPEED_1000: fp@1744: DPRINTK(PROBE, INFO, "1000 Mbps Speed specified without " fp@1744: "Duplex\n"); fp@1744: DPRINTK(PROBE, INFO, fp@1744: "Using Autonegotiation at 1000 Mbps " fp@1744: "Full Duplex only\n"); fp@1744: adapter->hw.autoneg = adapter->fc_autoneg = 1; fp@1744: adapter->hw.autoneg_advertised = ADVERTISE_1000_FULL; fp@1744: break; fp@1744: case SPEED_1000 + HALF_DUPLEX: fp@1744: DPRINTK(PROBE, INFO, fp@1744: "Half Duplex is not supported at 1000 Mbps\n"); fp@1744: DPRINTK(PROBE, INFO, fp@1744: "Using Autonegotiation at 1000 Mbps " fp@1744: "Full Duplex only\n"); fp@1744: adapter->hw.autoneg = adapter->fc_autoneg = 1; fp@1744: adapter->hw.autoneg_advertised = ADVERTISE_1000_FULL; fp@1744: break; fp@1744: case SPEED_1000 + FULL_DUPLEX: fp@1744: DPRINTK(PROBE, INFO, fp@1744: "Using Autonegotiation at 1000 Mbps Full Duplex only\n"); fp@1744: adapter->hw.autoneg = adapter->fc_autoneg = 1; fp@1744: adapter->hw.autoneg_advertised = ADVERTISE_1000_FULL; fp@1744: break; fp@1744: default: fp@1744: BUG(); fp@1744: } fp@1744: fp@1744: /* Speed, AutoNeg and MDI/MDI-X must all play nice */ fp@1744: if (e1000_validate_mdi_setting(&(adapter->hw)) < 0) { fp@1744: DPRINTK(PROBE, INFO, fp@1744: "Speed, AutoNeg and MDI-X specifications are " fp@1744: "incompatible. Setting MDI-X to a compatible value.\n"); fp@1744: } fp@1744: } fp@1744: