diff options
-rw-r--r-- | sys/dev/pci/if_em.c | 31 | ||||
-rw-r--r-- | sys/dev/pci/if_em_hw.c | 68 | ||||
-rw-r--r-- | sys/dev/pci/if_em_hw.h | 3 |
3 files changed, 58 insertions, 44 deletions
diff --git a/sys/dev/pci/if_em.c b/sys/dev/pci/if_em.c index 887b291e206..1c3f2bc55bb 100644 --- a/sys/dev/pci/if_em.c +++ b/sys/dev/pci/if_em.c @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ -/* $OpenBSD: if_em.c,v 1.142 2006/08/09 03:48:25 brad Exp $ */ +/* $OpenBSD: if_em.c,v 1.143 2006/08/09 04:44:06 brad Exp $ */ /* $FreeBSD: if_em.c,v 1.46 2004/09/29 18:28:28 mlaier Exp $ */ #include <dev/pci/if_em.h> @@ -45,7 +45,7 @@ int em_display_debug_stats = 0; * Driver version *********************************************************************/ -char em_driver_version[] = "6.0.5"; +char em_driver_version[] = "6.1.4"; /********************************************************************* * PCI Device ID Table @@ -96,6 +96,7 @@ const struct pci_matchid em_devices[] = { { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82571EB_AT }, { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82571EB_COPPER }, { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82571EB_FIBER }, + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82571EB_QUAD_CPR }, { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82571EB_SERDES }, { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82572EI_COPPER }, { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82572EI_FIBER }, @@ -789,6 +790,7 @@ void em_media_status(struct ifnet *ifp, struct ifmediareq *ifmr) { struct em_softc *sc= ifp->if_softc; + u_char fiber_type = IFM_1000_SX; INIT_DEBUGOUT("em_media_status: begin"); @@ -805,8 +807,11 @@ em_media_status(struct ifnet *ifp, struct ifmediareq *ifmr) ifmr->ifm_status |= IFM_ACTIVE; - if (sc->hw.media_type == em_media_type_fiber) { - ifmr->ifm_active |= IFM_1000_SX | IFM_FDX; + if (sc->hw.media_type == em_media_type_fiber || + sc->hw.media_type == em_media_type_internal_serdes) { + if (sc->hw.mac_type == em_82545) + fiber_type = IFM_1000_LX; + ifmr->ifm_active |= fiber_type | IFM_FDX; } else { switch (sc->link_speed) { case 10: @@ -850,8 +855,9 @@ em_media_change(struct ifnet *ifp) sc->hw.autoneg = DO_AUTO_NEG; sc->hw.autoneg_advertised = AUTONEG_ADV_DEFAULT; break; + case IFM_1000_LX: case IFM_1000_SX: - case IFM_1000_T: + case IFM_1000_T: sc->hw.autoneg = DO_AUTO_NEG; sc->hw.autoneg_advertised = ADVERTISE_1000_FULL; break; @@ -1563,6 +1569,7 @@ void em_setup_interface(struct em_softc *sc) { struct ifnet *ifp; + u_char fiber_type = IFM_1000_SX; INIT_DEBUGOUT("em_setup_interface: begin"); ifp = &sc->interface_data.ac_if; @@ -1585,10 +1592,13 @@ em_setup_interface(struct em_softc *sc) */ ifmedia_init(&sc->media, IFM_IMASK, em_media_change, em_media_status); - if (sc->hw.media_type == em_media_type_fiber) { - ifmedia_add(&sc->media, IFM_ETHER | IFM_1000_SX | IFM_FDX, + if (sc->hw.media_type == em_media_type_fiber || + sc->hw.media_type == em_media_type_internal_serdes) { + if (sc->hw.mac_type == em_82545) + fiber_type = IFM_1000_LX; + ifmedia_add(&sc->media, IFM_ETHER | fiber_type | IFM_FDX, 0, NULL); - ifmedia_add(&sc->media, IFM_ETHER | IFM_1000_SX, + ifmedia_add(&sc->media, IFM_ETHER | fiber_type, 0, NULL); } else { ifmedia_add(&sc->media, IFM_ETHER | IFM_10_T, 0, NULL); @@ -1845,7 +1855,8 @@ em_initialize_transmit_unit(struct em_softc *sc) reg_tipg |= DEFAULT_80003ES2LAN_TIPG_IPGR2 << E1000_TIPG_IPGR2_SHIFT; break; default: - if (sc->hw.media_type == em_media_type_fiber) + if (sc->hw.media_type == em_media_type_fiber || + sc->hw.media_type == em_media_type_internal_serdes) reg_tipg = DEFAULT_82543_TIPG_IPGT_FIBER; else reg_tipg = DEFAULT_82543_TIPG_IPGT_COPPER; @@ -1870,8 +1881,6 @@ em_initialize_transmit_unit(struct em_softc *sc) } else if (sc->hw.mac_type == em_80003es2lan) { reg_tarc = E1000_READ_REG(&sc->hw, TARC0); reg_tarc |= 1; - if (sc->hw.media_type == em_media_type_internal_serdes) - reg_tarc |= (1 << 20); E1000_WRITE_REG(&sc->hw, TARC0, reg_tarc); reg_tarc = E1000_READ_REG(&sc->hw, TARC1); reg_tarc |= 1; diff --git a/sys/dev/pci/if_em_hw.c b/sys/dev/pci/if_em_hw.c index d0e382b0738..dffc002dfdd 100644 --- a/sys/dev/pci/if_em_hw.c +++ b/sys/dev/pci/if_em_hw.c @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ -/* $OpenBSD: if_em_hw.c,v 1.21 2006/07/07 02:56:18 brad Exp $ */ +/* $OpenBSD: if_em_hw.c,v 1.22 2006/08/09 04:44:06 brad Exp $ */ /* if_em_hw.c * Shared functions for accessing and configuring the MAC @@ -368,6 +368,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: @@ -731,6 +732,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) { @@ -899,7 +910,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); @@ -1335,11 +1346,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 */ @@ -1763,19 +1777,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 @@ -1889,10 +1890,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) { @@ -3747,14 +3744,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; } @@ -3881,8 +3877,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); @@ -9077,6 +9073,14 @@ em_init_lcd_from_nvm_config_region(struct em_hw *hw, return ret_val; } +/****************************************************************************** + * 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/pci/if_em_hw.h b/sys/dev/pci/if_em_hw.h index 9843e3fe95b..eb4346675f2 100644 --- a/sys/dev/pci/if_em_hw.h +++ b/sys/dev/pci/if_em_hw.h @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ -/* $OpenBSD: if_em_hw.h,v 1.17 2006/07/07 02:56:18 brad Exp $ */ +/* $OpenBSD: if_em_hw.h,v 1.18 2006/08/09 04:44:06 brad Exp $ */ /* $FreeBSD: if_em_hw.h,v 1.15 2005/05/26 23:32:02 tackerman Exp $ */ /* if_em_hw.h @@ -538,6 +538,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 |