Commit beba7ab7 authored by Scott Feldman's avatar Scott Feldman Committed by Jeff Garzik

e1000 net driver update 4/6:

o Bug fix: ethtool SSET and NWAY we're broken when !netif_running.
o Cleanup: removed PPC code optimization - not needed.
o Bug fix: workaround for Dell Avalon system: change descriptor
  write-back policy to write back 16 bytes rather than 8 bytes.
o Bug fix: added mwb() to force memory transaction ordering on ia-64.
o Cleanup: misc. whitespace cleanup.
parent 61a5978a
...@@ -85,11 +85,7 @@ struct e1000_adapter; ...@@ -85,11 +85,7 @@ struct e1000_adapter;
#define E1000_ERR(args...) printk(KERN_ERR "e1000: " args) #define E1000_ERR(args...) printk(KERN_ERR "e1000: " args)
#ifdef CONFIG_PPC
#define E1000_MAX_INTR 1
#else
#define E1000_MAX_INTR 10 #define E1000_MAX_INTR 10
#endif
/* Supported Rx Buffer Sizes */ /* Supported Rx Buffer Sizes */
#define E1000_RXBUFFER_2048 2048 #define E1000_RXBUFFER_2048 2048
......
...@@ -37,6 +37,7 @@ extern char e1000_driver_version[]; ...@@ -37,6 +37,7 @@ extern char e1000_driver_version[];
extern int e1000_up(struct e1000_adapter *adapter); extern int e1000_up(struct e1000_adapter *adapter);
extern void e1000_down(struct e1000_adapter *adapter); extern void e1000_down(struct e1000_adapter *adapter);
extern void e1000_reset(struct e1000_adapter *adapter);
static void static void
e1000_ethtool_gset(struct e1000_adapter *adapter, struct ethtool_cmd *ecmd) e1000_ethtool_gset(struct e1000_adapter *adapter, struct ethtool_cmd *ecmd)
...@@ -144,8 +145,11 @@ e1000_ethtool_sset(struct e1000_adapter *adapter, struct ethtool_cmd *ecmd) ...@@ -144,8 +145,11 @@ e1000_ethtool_sset(struct e1000_adapter *adapter, struct ethtool_cmd *ecmd)
/* reset the link */ /* reset the link */
if(netif_running(adapter->netdev)) {
e1000_down(adapter); e1000_down(adapter);
e1000_up(adapter); e1000_up(adapter);
} else
e1000_reset(adapter);
return 0; return 0;
} }
...@@ -166,7 +170,7 @@ e1000_ethtool_gdrvinfo(struct e1000_adapter *adapter, ...@@ -166,7 +170,7 @@ e1000_ethtool_gdrvinfo(struct e1000_adapter *adapter,
{ {
strncpy(drvinfo->driver, e1000_driver_name, 32); strncpy(drvinfo->driver, e1000_driver_name, 32);
strncpy(drvinfo->version, e1000_driver_version, 32); strncpy(drvinfo->version, e1000_driver_version, 32);
strncpy(drvinfo->fw_version, "", 32); strncpy(drvinfo->fw_version, "N/A", 32);
strncpy(drvinfo->bus_info, adapter->pdev->slot_name, 32); strncpy(drvinfo->bus_info, adapter->pdev->slot_name, 32);
#define E1000_REGS_LEN 32 #define E1000_REGS_LEN 32
drvinfo->regdump_len = E1000_REGS_LEN * sizeof(uint32_t); drvinfo->regdump_len = E1000_REGS_LEN * sizeof(uint32_t);
...@@ -206,7 +210,8 @@ e1000_ethtool_geeprom(struct e1000_adapter *adapter, ...@@ -206,7 +210,8 @@ e1000_ethtool_geeprom(struct e1000_adapter *adapter,
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
int i, max_len, first_word, last_word; int i, max_len, first_word, last_word;
if(eeprom->len == 0) return; if(eeprom->len == 0)
return -EINVAL;
eeprom->magic = hw->vendor_id | (hw->device_id << 16); eeprom->magic = hw->vendor_id | (hw->device_id << 16);
...@@ -469,8 +474,10 @@ e1000_ethtool_ioctl(struct net_device *netdev, struct ifreq *ifr) ...@@ -469,8 +474,10 @@ e1000_ethtool_ioctl(struct net_device *netdev, struct ifreq *ifr)
case ETHTOOL_NWAY_RST: { case ETHTOOL_NWAY_RST: {
if(!capable(CAP_NET_ADMIN)) if(!capable(CAP_NET_ADMIN))
return -EPERM; return -EPERM;
if(netif_running(netdev)) {
e1000_down(adapter); e1000_down(adapter);
e1000_up(adapter); e1000_up(adapter);
}
return 0; return 0;
} }
case ETHTOOL_PHYS_ID: { case ETHTOOL_PHYS_ID: {
......
...@@ -48,8 +48,62 @@ static void e1000_shift_out_ee_bits(struct e1000_hw *hw, uint16_t data, uint16_t ...@@ -48,8 +48,62 @@ static void e1000_shift_out_ee_bits(struct e1000_hw *hw, uint16_t data, uint16_t
static uint16_t e1000_shift_in_ee_bits(struct e1000_hw *hw); static uint16_t e1000_shift_in_ee_bits(struct e1000_hw *hw);
static void e1000_setup_eeprom(struct e1000_hw *hw); static void e1000_setup_eeprom(struct e1000_hw *hw);
static void e1000_standby_eeprom(struct e1000_hw *hw); static void e1000_standby_eeprom(struct e1000_hw *hw);
static void e1000_clock_eeprom(struct e1000_hw *hw);
static void e1000_cleanup_eeprom(struct e1000_hw *hw);
static int32_t e1000_id_led_init(struct e1000_hw * hw); static int32_t e1000_id_led_init(struct e1000_hw * hw);
/******************************************************************************
* Set the mac type member in the hw struct.
*
* hw - Struct containing variables accessed by shared code
*****************************************************************************/
int32_t
e1000_set_mac_type(struct e1000_hw *hw)
{
DEBUGFUNC("e1000_set_mac_type");
switch (hw->device_id) {
case E1000_DEV_ID_82542:
switch (hw->revision_id) {
case E1000_82542_2_0_REV_ID:
hw->mac_type = e1000_82542_rev2_0;
break;
case E1000_82542_2_1_REV_ID:
hw->mac_type = e1000_82542_rev2_1;
break;
default:
/* Invalid 82542 revision ID */
return -E1000_ERR_MAC_TYPE;
}
break;
case E1000_DEV_ID_82543GC_FIBER:
case E1000_DEV_ID_82543GC_COPPER:
hw->mac_type = e1000_82543;
break;
case E1000_DEV_ID_82544EI_COPPER:
case E1000_DEV_ID_82544EI_FIBER:
case E1000_DEV_ID_82544GC_COPPER:
case E1000_DEV_ID_82544GC_LOM:
hw->mac_type = e1000_82544;
break;
case E1000_DEV_ID_82540EM:
case E1000_DEV_ID_82540EM_LOM:
hw->mac_type = e1000_82540;
break;
case E1000_DEV_ID_82545EM_COPPER:
case E1000_DEV_ID_82545EM_FIBER:
hw->mac_type = e1000_82545;
break;
case E1000_DEV_ID_82546EB_COPPER:
case E1000_DEV_ID_82546EB_FIBER:
hw->mac_type = e1000_82546;
break;
default:
/* Should never have loaded on this device */
return -E1000_ERR_MAC_TYPE;
}
return E1000_SUCCESS;
}
/****************************************************************************** /******************************************************************************
* Reset the transmit and receive units; mask and clear all interrupts. * Reset the transmit and receive units; mask and clear all interrupts.
* *
...@@ -239,6 +293,8 @@ e1000_init_hw(struct e1000_hw *hw) ...@@ -239,6 +293,8 @@ e1000_init_hw(struct e1000_hw *hw)
PCIX_COMMAND_MMRBC_SHIFT; PCIX_COMMAND_MMRBC_SHIFT;
stat_mmrbc = (pcix_stat_hi_word & PCIX_STATUS_HI_MMRBC_MASK) >> stat_mmrbc = (pcix_stat_hi_word & PCIX_STATUS_HI_MMRBC_MASK) >>
PCIX_STATUS_HI_MMRBC_SHIFT; PCIX_STATUS_HI_MMRBC_SHIFT;
if(stat_mmrbc == PCIX_STATUS_HI_MMRBC_4K)
stat_mmrbc = PCIX_STATUS_HI_MMRBC_2K;
if(cmd_mmrbc > stat_mmrbc) { if(cmd_mmrbc > stat_mmrbc) {
pcix_cmd_word &= ~PCIX_COMMAND_MMRBC_MASK; pcix_cmd_word &= ~PCIX_COMMAND_MMRBC_MASK;
pcix_cmd_word |= stat_mmrbc << PCIX_COMMAND_MMRBC_SHIFT; pcix_cmd_word |= stat_mmrbc << PCIX_COMMAND_MMRBC_SHIFT;
...@@ -249,6 +305,13 @@ e1000_init_hw(struct e1000_hw *hw) ...@@ -249,6 +305,13 @@ e1000_init_hw(struct e1000_hw *hw)
/* Call a subroutine to configure the link and setup flow control. */ /* Call a subroutine to configure the link and setup flow control. */
ret_val = e1000_setup_link(hw); ret_val = e1000_setup_link(hw);
/* Set the transmit descriptor write-back policy */
if(hw->mac_type > e1000_82544) {
ctrl = E1000_READ_REG(hw, TXDCTL);
ctrl = (ctrl & ~E1000_TXDCTL_WTHRESH) | E1000_TXDCTL_FULL_TX_DESC_WB;
E1000_WRITE_REG(hw, TXDCTL, ctrl);
}
/* Clear all of the statistics registers (clear on read). It is /* Clear all of the statistics registers (clear on read). It is
* important that we do this after we have tried to establish link * important that we do this after we have tried to establish link
* because the symbol error count will increment wildly if there * because the symbol error count will increment wildly if there
...@@ -374,7 +437,6 @@ e1000_setup_link(struct e1000_hw *hw) ...@@ -374,7 +437,6 @@ e1000_setup_link(struct e1000_hw *hw)
* Sets up link for a fiber based adapter * Sets up link for a fiber based adapter
* *
* hw - Struct containing variables accessed by shared code * hw - Struct containing variables accessed by shared code
* ctrl - Current value of the device control register
* *
* Manipulates Physical Coding Sublayer functions in order to configure * Manipulates Physical Coding Sublayer functions in order to configure
* link. Assumes the hardware has been previously reset and the transmitter * link. Assumes the hardware has been previously reset and the transmitter
...@@ -505,7 +567,6 @@ e1000_setup_fiber_link(struct e1000_hw *hw) ...@@ -505,7 +567,6 @@ e1000_setup_fiber_link(struct e1000_hw *hw)
* Detects which PHY is present and the speed and duplex * Detects which PHY is present and the speed and duplex
* *
* hw - Struct containing variables accessed by shared code * hw - Struct containing variables accessed by shared code
* ctrl - current value of the device control register
******************************************************************************/ ******************************************************************************/
static int32_t static int32_t
e1000_setup_copper_link(struct e1000_hw *hw) e1000_setup_copper_link(struct e1000_hw *hw)
......
...@@ -42,7 +42,8 @@ struct e1000_hw_stats; ...@@ -42,7 +42,8 @@ struct e1000_hw_stats;
/* Enumerated types specific to the e1000 hardware */ /* Enumerated types specific to the e1000 hardware */
/* Media Access Controlers */ /* Media Access Controlers */
typedef enum { typedef enum {
e1000_82542_rev2_0 = 0, e1000_undefined = 0,
e1000_82542_rev2_0,
e1000_82542_rev2_1, e1000_82542_rev2_1,
e1000_82543, e1000_82543,
e1000_82544, e1000_82544,
...@@ -164,11 +165,13 @@ struct e1000_phy_stats { ...@@ -164,11 +165,13 @@ struct e1000_phy_stats {
#define E1000_ERR_PHY 2 #define E1000_ERR_PHY 2
#define E1000_ERR_CONFIG 3 #define E1000_ERR_CONFIG 3
#define E1000_ERR_PARAM 4 #define E1000_ERR_PARAM 4
#define E1000_ERR_MAC_TYPE 5
/* Function prototypes */ /* Function prototypes */
/* Initialization */ /* Initialization */
void e1000_reset_hw(struct e1000_hw *hw); void e1000_reset_hw(struct e1000_hw *hw);
int32_t e1000_init_hw(struct e1000_hw *hw); int32_t e1000_init_hw(struct e1000_hw *hw);
int32_t e1000_set_mac_type(struct e1000_hw *hw);
/* Link Configuration */ /* Link Configuration */
int32_t e1000_setup_link(struct e1000_hw *hw); int32_t e1000_setup_link(struct e1000_hw *hw);
...@@ -1185,6 +1188,7 @@ struct e1000_hw { ...@@ -1185,6 +1188,7 @@ struct e1000_hw {
#define E1000_TXDCTL_WTHRESH 0x00FF0000 /* TXDCTL Writeback Threshold */ #define E1000_TXDCTL_WTHRESH 0x00FF0000 /* TXDCTL Writeback Threshold */
#define E1000_TXDCTL_GRAN 0x01000000 /* TXDCTL Granularity */ #define E1000_TXDCTL_GRAN 0x01000000 /* TXDCTL Granularity */
#define E1000_TXDCTL_LWTHRESH 0xFE000000 /* TXDCTL Low Threshold */ #define E1000_TXDCTL_LWTHRESH 0xFE000000 /* TXDCTL Low Threshold */
#define E1000_TXDCTL_FULL_TX_DESC_WB 0x01010000 /* GRAN=1, WTHRESH=1 */
/* Transmit Configuration Word */ /* Transmit Configuration Word */
#define E1000_TXCW_FD 0x00000020 /* TXCW full duplex */ #define E1000_TXCW_FD 0x00000020 /* TXCW full duplex */
...@@ -1424,6 +1428,8 @@ struct e1000_hw { ...@@ -1424,6 +1428,8 @@ struct e1000_hw {
#define PCIX_COMMAND_MMRBC_SHIFT 0x2 #define PCIX_COMMAND_MMRBC_SHIFT 0x2
#define PCIX_STATUS_HI_MMRBC_MASK 0x0060 #define PCIX_STATUS_HI_MMRBC_MASK 0x0060
#define PCIX_STATUS_HI_MMRBC_SHIFT 0x5 #define PCIX_STATUS_HI_MMRBC_SHIFT 0x5
#define PCIX_STATUS_HI_MMRBC_4K 0x3
#define PCIX_STATUS_HI_MMRBC_2K 0x2
/* The number of bits that we need to shift right to move the "pause" /* The number of bits that we need to shift right to move the "pause"
......
...@@ -30,6 +30,20 @@ ...@@ -30,6 +30,20 @@
#include "e1000.h" #include "e1000.h"
/* Change Log /* Change Log
*
* 4.3.15 8/9/02
* o Converted from Dual BSD/GPL license to GPL license.
* o Clean up: use pci_[clear|set]_mwi rather than direct calls to
* pci_write_config_word.
* o Bug fix: added read-behind-write calls to post writes before delays.
* o Bug fix: removed mdelay busy-waits in interrupt context.
* o Clean up: direct clear of descriptor bits rather than using memset.
* o Bug fix: added wmb() for ia-64 between descritor writes and advancing
* descriptor tail.
* o Feature: added locking mechanism for asf functionality.
* o Feature: exposed two Tx and one Rx interrupt delay knobs for finer
* control over interurpt rate tuning.
* o Misc ethtool bug fixes.
* *
* 4.3.2 7/5/02 * 4.3.2 7/5/02
* o Bug fix: perform controller reset using I/O rather than mmio because * o Bug fix: perform controller reset using I/O rather than mmio because
...@@ -54,7 +68,7 @@ ...@@ -54,7 +68,7 @@
char e1000_driver_name[] = "e1000"; char e1000_driver_name[] = "e1000";
char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver";
char e1000_driver_version[] = "4.3.2-k1"; char e1000_driver_version[] = "4.3.15-k1";
char e1000_copyright[] = "Copyright (c) 1999-2002 Intel Corporation."; char e1000_copyright[] = "Copyright (c) 1999-2002 Intel Corporation.";
/* e1000_pci_tbl - PCI Device ID Table /* e1000_pci_tbl - PCI Device ID Table
...@@ -545,43 +559,8 @@ e1000_sw_init(struct e1000_adapter *adapter) ...@@ -545,43 +559,8 @@ e1000_sw_init(struct e1000_adapter *adapter)
/* identify the MAC */ /* identify the MAC */
switch (hw->device_id) { if (e1000_set_mac_type(hw)) {
case E1000_DEV_ID_82542: E1000_ERR("Unknown MAC Type\n");
switch (hw->revision_id) {
case E1000_82542_2_0_REV_ID:
hw->mac_type = e1000_82542_rev2_0;
break;
case E1000_82542_2_1_REV_ID:
hw->mac_type = e1000_82542_rev2_1;
break;
default:
hw->mac_type = e1000_82542_rev2_0;
E1000_ERR("Could not identify 82542 revision\n");
}
break;
case E1000_DEV_ID_82543GC_FIBER:
case E1000_DEV_ID_82543GC_COPPER:
hw->mac_type = e1000_82543;
break;
case E1000_DEV_ID_82544EI_COPPER:
case E1000_DEV_ID_82544EI_FIBER:
case E1000_DEV_ID_82544GC_COPPER:
case E1000_DEV_ID_82544GC_LOM:
hw->mac_type = e1000_82544;
break;
case E1000_DEV_ID_82540EM:
hw->mac_type = e1000_82540;
break;
case E1000_DEV_ID_82545EM_COPPER:
case E1000_DEV_ID_82545EM_FIBER:
hw->mac_type = e1000_82545;
break;
case E1000_DEV_ID_82546EB_COPPER:
case E1000_DEV_ID_82546EB_FIBER:
hw->mac_type = e1000_82546;
break;
default:
E1000_ERR("Should never have loaded on this device\n");
BUG(); BUG();
} }
...@@ -1415,9 +1394,14 @@ e1000_tx_queue(struct e1000_adapter *adapter, int count, int tx_flags) ...@@ -1415,9 +1394,14 @@ e1000_tx_queue(struct e1000_adapter *adapter, int count, int tx_flags)
tx_desc->lower.data |= cpu_to_le32(E1000_TXD_CMD_EOP); tx_desc->lower.data |= cpu_to_le32(E1000_TXD_CMD_EOP);
/* Force memory writes to complete before letting h/w
* know there are new descriptors to fetch. (Only
* applicable for weak-ordered memory model archs,
* such as IA-64). */
wmb();
tx_ring->next_to_use = i; tx_ring->next_to_use = i;
E1000_WRITE_REG(&adapter->hw, TDT, i); E1000_WRITE_REG(&adapter->hw, TDT, i);
E1000_WRITE_FLUSH(&adapter->hw);
} }
#define TXD_USE_COUNT(S, X) (((S) / (X)) + (((S) % (X)) ? 1 : 0)) #define TXD_USE_COUNT(S, X) (((S) / (X)) + (((S) % (X)) ? 1 : 0))
...@@ -1937,8 +1921,15 @@ e1000_alloc_rx_buffers(struct e1000_adapter *adapter) ...@@ -1937,8 +1921,15 @@ e1000_alloc_rx_buffers(struct e1000_adapter *adapter)
rx_desc->buffer_addr = cpu_to_le64(rx_ring->buffer_info[i].dma); rx_desc->buffer_addr = cpu_to_le64(rx_ring->buffer_info[i].dma);
if(!(i % E1000_RX_BUFFER_WRITE)) if(!(i % E1000_RX_BUFFER_WRITE)) {
/* Force memory writes to complete before letting h/w
* know there are new descriptors to fetch. (Only
* applicable for weak-ordered memory model archs,
* such as IA-64). */
wmb();
E1000_WRITE_REG(&adapter->hw, RDT, i); E1000_WRITE_REG(&adapter->hw, RDT, i);
}
i = (i + 1) % rx_ring->count; i = (i + 1) % rx_ring->count;
} }
......
...@@ -96,6 +96,6 @@ typedef enum { ...@@ -96,6 +96,6 @@ typedef enum {
readl((a)->hw_addr + E1000_##reg + ((offset) << 2)) : \ readl((a)->hw_addr + E1000_##reg + ((offset) << 2)) : \
readl((a)->hw_addr + E1000_82542_##reg + ((offset) << 2))) readl((a)->hw_addr + E1000_82542_##reg + ((offset) << 2)))
#define E1000_WRITE_FLUSH(a) E1000_READ_REG(a, STATUS); #define E1000_WRITE_FLUSH(a) ((void)E1000_READ_REG(a, STATUS))
#endif /* _E1000_OSDEP_H_ */ #endif /* _E1000_OSDEP_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment