if(e1000_read_eeprom(hw, EEPROM_INIT_CONTROL2_REG, 1, &eeprom_data) < 0) { 
if(e1000_read_eeprom(hw, EEPROM_INIT_CONTROL2_REG, 1, &eeprom_data)) { 
e1000_setup_link(struct e1000_hw *hw){    uint32_t ctrl_ext;    int32_t ret_val;    uint16_t eeprom_data;    DEBUGFUNC("e1000_setup_link");    /* Read and store word 0x0F of the EEPROM. This word contains bits     * that determine the hardware's default PAUSE (flow control) mode,     * a bit that determines whether the HW defaults to enabling or     * disabling auto-negotiation, and the direction of the     * SW defined pins. If there is no SW over-ride of the flow     * control setting, then the variable hw->fc will     * be initialized based on a value in the EEPROM.     */    if(e1000_read_eeprom(hw, EEPROM_INIT_CONTROL2_REG, 1, &eeprom_data) < 0) {        DEBUGOUT("EEPROM Read Error\n");        return -E1000_ERR_EEPROM;    }    if(hw->fc == e1000_fc_default) {        if((eeprom_data & EEPROM_WORD0F_PAUSE_MASK) == 0)            hw->fc = e1000_fc_none;        else if((eeprom_data & EEPROM_WORD0F_PAUSE_MASK) ==                EEPROM_WORD0F_ASM_DIR)            hw->fc = e1000_fc_tx_pause;        else            hw->fc = e1000_fc_full;    }    /* We want to save off the original Flow Control configuration just     * in case we get disconnected and then reconnected into a different     * hub or switch with different Flow Control capabilities.     */    if(hw->mac_type == e1000_82542_rev2_0)        hw->fc &= (~e1000_fc_tx_pause);    if((hw->mac_type < e1000_82543) && (hw->report_tx_early == 1))        hw->fc &= (~e1000_fc_rx_pause);    hw->original_fc = hw->fc;    DEBUGOUT1("After fix-ups FlowControl is now = %x\n", hw->fc);    /* Take the 4 bits from EEPROM word 0x0F that determine the initial     * polarity value for the SW controlled pins, and setup the     * Extended Device Control reg with that info.     * This is needed because one of the SW controlled pins is used for     * signal detection.  So this should be done before e1000_setup_pcs_link()     * or e1000_phy_setup() is called.     */    if(hw->mac_type == e1000_82543) {        ctrl_ext = ((eeprom_data & EEPROM_WORD0F_SWPDIO_EXT) <<                    SWDPIO__EXT_SHIFT);        E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext);    }    /* Call the necessary subroutine to configure the link. */    ret_val = (hw->media_type == e1000_media_type_copper) ?              e1000_setup_copper_link(hw) :              e1000_setup_fiber_serdes_link(hw);    /* Initialize the flow control address, type, and PAUSE timer     * registers to their default values.  This is done even if flow     * control is disabled, because it does not hurt anything to     * initialize these registers.     */    DEBUGOUT("Initializing the Flow Control address, type and timer regs\n");    E1000_WRITE_REG(hw, FCAL, FLOW_CONTROL_ADDRESS_LOW);    E1000_WRITE_REG(hw, FCAH, FLOW_CONTROL_ADDRESS_HIGH);    E1000_WRITE_REG(hw, FCT, FLOW_CONTROL_TYPE);    E1000_WRITE_REG(hw, FCTTV, hw->fc_pause_time);    /* Set the flow control receive threshold registers.  Normally,     * these registers will be set to a default threshold that may be     * adjusted later by the driver's runtime code.  However, if the     * ability to transmit pause frames in not enabled, then these     * registers will be set to 0.     */    if(!(hw->fc & e1000_fc_tx_pause)) {        E1000_WRITE_REG(hw, FCRTL, 0);        E1000_WRITE_REG(hw, FCRTH, 0);    } else {        /* We need to set up the Receive Threshold high and low water marks         * as well as (optionally) enabling the transmission of XON frames.         */        if(hw->fc_send_xon) {            E1000_WRITE_REG(hw, FCRTL, (hw->fc_low_water | E1000_FCRTL_XONE));            E1000_WRITE_REG(hw, FCRTH, hw->fc_high_water);        } else {            E1000_WRITE_REG(hw, FCRTL, hw->fc_low_water);            E1000_WRITE_REG(hw, FCRTH, hw->fc_high_water);        }    }    return ret_val;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/2d7edb923a823660b081bd4c660300ee19adca8d/e1000_hw.c/clean/drivers/net/e1000/e1000_hw.c