summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2006-08-11 10:58:24 +0000
committerglebius <glebius@FreeBSD.org>2006-08-11 10:58:24 +0000
commit8946cbf76bdb4c2901e6de4e97056baa6f190ddb (patch)
treea88bc7da8f37ec695623e2415c888da6e3043c63
parent1f1a93f2abba1f67117aa64624bb67a1f2a7451f (diff)
downloadFreeBSD-src-8946cbf76bdb4c2901e6de4e97056baa6f190ddb.zip
FreeBSD-src-8946cbf76bdb4c2901e6de4e97056baa6f190ddb.tar.gz
Merge in new driver from Intel, version 6.1.4. It adds support for
82571EB quad port copper NIC and has few minor fixes. Details: - if_em.c. Merged manually, viewing diff between new vendor driver and previous one. - if_em_hw.c. Dropped in from vendor, and then restored revision 1.15.
-rw-r--r--sys/dev/em/if_em.c45
-rw-r--r--sys/dev/em/if_em_hw.c67
-rw-r--r--sys/dev/em/if_em_hw.h1
3 files changed, 64 insertions, 49 deletions
diff --git a/sys/dev/em/if_em.c b/sys/dev/em/if_em.c
index bc18e52..a5c7567 100644
--- a/sys/dev/em/if_em.c
+++ b/sys/dev/em/if_em.c
@@ -86,7 +86,7 @@ int em_display_debug_stats = 0;
* Driver version
*********************************************************************/
-char em_driver_version[] = "Version - 6.0.5";
+char em_driver_version[] = "Version - 6.1.4";
/*********************************************************************
@@ -150,6 +150,8 @@ static em_vendor_info_t em_vendor_info_array[] =
{ 0x8086, E1000_DEV_ID_82571EB_COPPER, PCI_ANY_ID, PCI_ANY_ID, 0},
{ 0x8086, E1000_DEV_ID_82571EB_FIBER, PCI_ANY_ID, PCI_ANY_ID, 0},
{ 0x8086, E1000_DEV_ID_82571EB_SERDES, PCI_ANY_ID, PCI_ANY_ID, 0},
+ { 0x8086, E1000_DEV_ID_82571EB_QUAD_COPPER,
+ PCI_ANY_ID, PCI_ANY_ID, 0},
{ 0x8086, E1000_DEV_ID_82572EI_COPPER, PCI_ANY_ID, PCI_ANY_ID, 0},
{ 0x8086, E1000_DEV_ID_82572EI_FIBER, PCI_ANY_ID, PCI_ANY_ID, 0},
@@ -1099,7 +1101,7 @@ em_init(void *arg)
#ifdef DEVICE_POLLING
/*********************************************************************
*
- * Legacy polling routine
+ * Legacy polling routine
*
*********************************************************************/
static void
@@ -1134,7 +1136,7 @@ em_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
/*********************************************************************
*
- * Legacy Interrupt Service routine
+ * Legacy Interrupt Service routine
*
*********************************************************************/
static void
@@ -1245,7 +1247,7 @@ em_handle_rxtx(void *context, int pending)
/*********************************************************************
*
- * Fast Interrupt Service routine
+ * Fast Interrupt Service routine
*
*********************************************************************/
static void
@@ -1318,8 +1320,12 @@ em_media_status(struct ifnet *ifp, struct ifmediareq *ifmr)
ifmr->ifm_status |= IFM_ACTIVE;
- if (adapter->hw.media_type == em_media_type_fiber) {
- ifmr->ifm_active |= IFM_1000_SX | IFM_FDX;
+ if ((adapter->hw.media_type == em_media_type_fiber) ||
+ (adapter->hw.media_type == em_media_type_internal_serdes)) {
+ if (adapter->hw.mac_type == em_82545)
+ ifmr->ifm_active |= IFM_1000_LX | IFM_FDX;
+ else
+ ifmr->ifm_active |= IFM_1000_SX | IFM_FDX;
} else {
switch (adapter->link_speed) {
case 10:
@@ -1363,6 +1369,7 @@ em_media_change(struct ifnet *ifp)
adapter->hw.autoneg = DO_AUTO_NEG;
adapter->hw.autoneg_advertised = AUTONEG_ADV_DEFAULT;
break;
+ case IFM_1000_LX:
case IFM_1000_SX:
case IFM_1000_T:
adapter->hw.autoneg = DO_AUTO_NEG;
@@ -2241,12 +2248,17 @@ em_setup_interface(device_t dev, struct adapter *adapter)
* Specify the media types supported by this adapter and register
* callbacks to update media and link information
*/
- ifmedia_init(&adapter->media, IFM_IMASK, em_media_change, em_media_status);
- if (adapter->hw.media_type == em_media_type_fiber) {
- ifmedia_add(&adapter->media, IFM_ETHER | IFM_1000_SX | IFM_FDX,
- 0, NULL);
- ifmedia_add(&adapter->media, IFM_ETHER | IFM_1000_SX,
- 0, NULL);
+ ifmedia_init(&adapter->media, IFM_IMASK, em_media_change,
+ em_media_status);
+ if ((adapter->hw.media_type == em_media_type_fiber) ||
+ (adapter->hw.media_type == em_media_type_internal_serdes)) {
+ u_char fiber_type = IFM_1000_SX; // default type;
+
+ if (adapter->hw.mac_type == em_82545)
+ fiber_type = IFM_1000_LX;
+ ifmedia_add(&adapter->media, IFM_ETHER | fiber_type | IFM_FDX,
+ 0, NULL);
+ ifmedia_add(&adapter->media, IFM_ETHER | fiber_type, 0, NULL);
} else {
ifmedia_add(&adapter->media, IFM_ETHER | IFM_10_T, 0, NULL);
ifmedia_add(&adapter->media, IFM_ETHER | IFM_10_T | IFM_FDX,
@@ -2256,9 +2268,9 @@ em_setup_interface(device_t dev, struct adapter *adapter)
ifmedia_add(&adapter->media, IFM_ETHER | IFM_100_TX | IFM_FDX,
0, NULL);
if (adapter->hw.phy_type != em_phy_ife) {
- ifmedia_add(&adapter->media,
+ ifmedia_add(&adapter->media,
IFM_ETHER | IFM_1000_T | IFM_FDX, 0, NULL);
- ifmedia_add(&adapter->media,
+ ifmedia_add(&adapter->media,
IFM_ETHER | IFM_1000_T, 0, NULL);
}
}
@@ -2538,7 +2550,8 @@ em_initialize_transmit_unit(struct adapter *adapter)
E1000_TIPG_IPGR2_SHIFT;
break;
default:
- if (adapter->hw.media_type == em_media_type_fiber)
+ if ((adapter->hw.media_type == em_media_type_fiber) ||
+ (adapter->hw.media_type == em_media_type_internal_serdes))
reg_tipg = DEFAULT_82543_TIPG_IPGT_FIBER;
else
reg_tipg = DEFAULT_82543_TIPG_IPGT_COPPER;
@@ -2563,8 +2576,6 @@ em_initialize_transmit_unit(struct adapter *adapter)
} else if (adapter->hw.mac_type == em_80003es2lan) {
reg_tarc = E1000_READ_REG(&adapter->hw, TARC0);
reg_tarc |= 1;
- if (adapter->hw.media_type == em_media_type_internal_serdes)
- reg_tarc |= (1 << 20);
E1000_WRITE_REG(&adapter->hw, TARC0, reg_tarc);
reg_tarc = E1000_READ_REG(&adapter->hw, TARC1);
reg_tarc |= 1;
diff --git a/sys/dev/em/if_em_hw.c b/sys/dev/em/if_em_hw.c
index 6a79c4e..58716c5 100644
--- a/sys/dev/em/if_em_hw.c
+++ b/sys/dev/em/if_em_hw.c
@@ -339,6 +339,7 @@ em_set_mac_type(struct em_hw *hw)
case E1000_DEV_ID_82571EB_COPPER:
case E1000_DEV_ID_82571EB_FIBER:
case E1000_DEV_ID_82571EB_SERDES:
+ case E1000_DEV_ID_82571EB_QUAD_COPPER:
hw->mac_type = em_82571;
break;
case E1000_DEV_ID_82572EI_COPPER:
@@ -699,6 +700,16 @@ em_init_hw(struct em_hw *hw)
DEBUGFUNC("em_init_hw");
+ if (hw->mac_type == em_ich8lan) {
+ reg_data = E1000_READ_REG(hw, TARC0);
+ reg_data |= 0x30000000;
+ E1000_WRITE_REG(hw, TARC0, reg_data);
+
+ reg_data = E1000_READ_REG(hw, STATUS);
+ reg_data &= ~0x80000000;
+ E1000_WRITE_REG(hw, STATUS, reg_data);
+ }
+
/* Initialize Identification LED */
ret_val = em_id_led_init(hw);
if (ret_val) {
@@ -855,7 +866,6 @@ em_init_hw(struct em_hw *hw)
}
-
if (hw->mac_type == em_82573) {
uint32_t gcr = E1000_READ_REG(hw, GCR);
gcr |= E1000_GCR_L1_ACT_WITHOUT_L0S_RX;
@@ -869,7 +879,7 @@ em_init_hw(struct em_hw *hw)
*/
em_clear_hw_cntrs(hw);
- /* ICH8/Nahum No-snoop bits are opposite polarity.
+ /* ICH8 No-snoop bits are opposite polarity.
* Set to snoop by default after reset. */
if (hw->mac_type == em_ich8lan)
em_set_pci_ex_no_snoop(hw, PCI_EX_82566_SNOOP_ALL);
@@ -1305,11 +1315,14 @@ em_copper_link_igp_setup(struct em_hw *hw)
E1000_WRITE_REG(hw, LEDCTL, led_ctrl);
}
- /* disable lplu d3 during driver init */
- ret_val = em_set_d3_lplu_state(hw, FALSE);
- if (ret_val) {
- DEBUGOUT("Error Disabling LPLU D3\n");
- return ret_val;
+ /* The NVM settings will configure LPLU in D3 for IGP2 and IGP3 PHYs */
+ if (hw->phy_type == em_phy_igp) {
+ /* disable lplu d3 during driver init */
+ ret_val = em_set_d3_lplu_state(hw, FALSE);
+ if (ret_val) {
+ DEBUGOUT("Error Disabling LPLU D3\n");
+ return ret_val;
+ }
}
/* disable lplu d0 during driver init */
@@ -1732,19 +1745,6 @@ em_copper_link_autoneg(struct em_hw *hw)
return E1000_SUCCESS;
}
-/********************************************************************
-* Copper link setup for em_phy_ife (Fast Ethernet PHY) series.
-*
-* hw - Struct containing variables accessed by shared code
-*********************************************************************/
-static int32_t
-em_copper_link_ife_setup(struct em_hw *hw)
-{
- if (hw->phy_reset_disable)
- return E1000_SUCCESS;
- return E1000_SUCCESS;
-}
-
/******************************************************************************
* Config the MAC and the PHY after link is up.
* 1) Set up the MAC to the current PHY speed/duplex
@@ -1858,10 +1858,6 @@ em_setup_copper_link(struct em_hw *hw)
ret_val = em_copper_link_ggp_setup(hw);
if (ret_val)
return ret_val;
- } else if (hw->phy_type == em_phy_ife) {
- ret_val = em_copper_link_ife_setup(hw);
- if (ret_val)
- return ret_val;
}
if (hw->autoneg) {
@@ -3716,14 +3712,13 @@ em_phy_hw_reset(struct em_hw *hw)
/* Wait for FW to finish PHY configuration. */
ret_val = em_get_phy_cfg_done(hw);
+ if (ret_val != E1000_SUCCESS)
+ return ret_val;
em_release_software_semaphore(hw);
- if ((hw->mac_type == em_ich8lan) &&
- (hw->phy_type == em_phy_igp_3)) {
- ret_val = em_init_lcd_from_nvm(hw);
- if (ret_val)
- return ret_val;
- }
+ if ((hw->mac_type == em_ich8lan) && (hw->phy_type == em_phy_igp_3))
+ ret_val = em_init_lcd_from_nvm(hw);
+
return ret_val;
}
@@ -3850,8 +3845,8 @@ em_kumeran_lock_loss_workaround(struct em_hw *hw)
if (hw->kmrn_lock_loss_workaround_disabled)
return E1000_SUCCESS;
- /* Make sure link is up before proceeding. If not just return.
- * Attempting this while link is negotiating fouls up link
+ /* Make sure link is up before proceeding. If not just return.
+ * Attempting this while link is negotiating fouled up link
* stability */
ret_val = em_read_phy_reg(hw, PHY_STATUS, &phy_data);
ret_val = em_read_phy_reg(hw, PHY_STATUS, &phy_data);
@@ -9047,6 +9042,14 @@ em_init_lcd_from_nvm_config_region(struct em_hw *hw,
}
+/******************************************************************************
+ * This function initializes the PHY from the NVM on ICH8 platforms. This
+ * is needed due to an issue where the NVM configuration is not properly
+ * autoloaded after power transitions. Therefore, after each PHY reset, we
+ * will load the configuration data out of the NVM manually.
+ *
+ * hw: Struct containing variables accessed by shared code
+ *****************************************************************************/
int32_t
em_init_lcd_from_nvm(struct em_hw *hw)
{
diff --git a/sys/dev/em/if_em_hw.h b/sys/dev/em/if_em_hw.h
index c9a1746..7c0a74f 100644
--- a/sys/dev/em/if_em_hw.h
+++ b/sys/dev/em/if_em_hw.h
@@ -549,6 +549,7 @@ int32_t em_ife_enable_dynamic_power_down(struct em_hw *hw);
#define E1000_DEV_ID_82571EB_COPPER 0x105E
#define E1000_DEV_ID_82571EB_FIBER 0x105F
#define E1000_DEV_ID_82571EB_SERDES 0x1060
+#define E1000_DEV_ID_82571EB_QUAD_COPPER 0x10A4
#define E1000_DEV_ID_82572EI_COPPER 0x107D
#define E1000_DEV_ID_82572EI_FIBER 0x107E
#define E1000_DEV_ID_82572EI_SERDES 0x107F
OpenPOWER on IntegriCloud