msec_delay(20); 
msec_delay_irq(20); 
e1000_config_dsp_after_link_change(struct e1000_hw *hw,                                   boolean_t link_up){    int32_t ret_val;    uint16_t phy_data, phy_saved_data, speed, duplex, i;    uint16_t dsp_reg_array[IGP01E1000_PHY_CHANNEL_NUM] =                                        {IGP01E1000_PHY_AGC_PARAM_A,                                        IGP01E1000_PHY_AGC_PARAM_B,                                        IGP01E1000_PHY_AGC_PARAM_C,                                        IGP01E1000_PHY_AGC_PARAM_D};    uint16_t min_length, max_length;    DEBUGFUNC("e1000_config_dsp_after_link_change");    if(hw->phy_type != e1000_phy_igp)        return E1000_SUCCESS;    if(link_up) {        ret_val = e1000_get_speed_and_duplex(hw, &speed, &duplex);        if(ret_val) {            DEBUGOUT("Error getting link speed and duplex\n");            return ret_val;        }        if(speed == SPEED_1000) {            e1000_get_cable_length(hw, &min_length, &max_length);            if((hw->dsp_config_state == e1000_dsp_config_enabled) &&                min_length >= e1000_igp_cable_length_50) {                for(i = 0; i < IGP01E1000_PHY_CHANNEL_NUM; i++) {                    ret_val = e1000_read_phy_reg(hw, dsp_reg_array[i],                                                 &phy_data);                    if(ret_val)                        return ret_val;                    phy_data &= ~IGP01E1000_PHY_EDAC_MU_INDEX;                    ret_val = e1000_write_phy_reg(hw, dsp_reg_array[i],                                                  phy_data);                    if(ret_val)                        return ret_val;                }                hw->dsp_config_state = e1000_dsp_config_activated;            }            if((hw->ffe_config_state == e1000_ffe_config_enabled) &&               (min_length < e1000_igp_cable_length_50)) {                uint16_t ffe_idle_err_timeout = FFE_IDLE_ERR_COUNT_TIMEOUT_20;                uint32_t idle_errs = 0;                /* clear previous idle error counts */                ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS,                                             &phy_data);                if(ret_val)                    return ret_val;                for(i = 0; i < ffe_idle_err_timeout; i++) {                    udelay(1000);                    ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS,                                                 &phy_data);                    if(ret_val)                        return ret_val;                    idle_errs += (phy_data & SR_1000T_IDLE_ERROR_CNT);                    if(idle_errs > SR_1000T_PHY_EXCESSIVE_IDLE_ERR_COUNT) {                        hw->ffe_config_state = e1000_ffe_config_active;                        ret_val = e1000_write_phy_reg(hw,                                    IGP01E1000_PHY_DSP_FFE,                                    IGP01E1000_PHY_DSP_FFE_CM_CP);                        if(ret_val)                            return ret_val;                        break;                    }                    if(idle_errs)                        ffe_idle_err_timeout = FFE_IDLE_ERR_COUNT_TIMEOUT_100;                }            }        }    } else {        if(hw->dsp_config_state == e1000_dsp_config_activated) {            /* Save off the current value of register 0x2F5B to be restored at             * the end of the routines. */            ret_val = e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data);            if(ret_val)                return ret_val;            /* Disable the PHY transmitter */            ret_val = e1000_write_phy_reg(hw, 0x2F5B, 0x0003);            if(ret_val)                return ret_val;            msec_delay(20);            ret_val = e1000_write_phy_reg(hw, 0x0000,                                          IGP01E1000_IEEE_FORCE_GIGA);            if(ret_val)                return ret_val;            for(i = 0; i < IGP01E1000_PHY_CHANNEL_NUM; i++) {                ret_val = e1000_read_phy_reg(hw, dsp_reg_array[i], &phy_data);                if(ret_val)                    return ret_val;                phy_data &= ~IGP01E1000_PHY_EDAC_MU_INDEX;                phy_data |=  IGP01E1000_PHY_EDAC_SIGN_EXT_9_BITS;                ret_val = e1000_write_phy_reg(hw,dsp_reg_array[i], phy_data);                if(ret_val)                    return ret_val;            }            ret_val = e1000_write_phy_reg(hw, 0x0000,                                          IGP01E1000_IEEE_RESTART_AUTONEG);            if(ret_val)                return ret_val;            msec_delay(20);            /* Now enable the transmitter */            ret_val = e1000_write_phy_reg(hw, 0x2F5B, phy_saved_data);            if(ret_val)                return ret_val;            hw->dsp_config_state = e1000_dsp_config_enabled;        }        if(hw->ffe_config_state == e1000_ffe_config_active) {            /* Save off the current value of register 0x2F5B to be restored at             * the end of the routines. */            ret_val = e1000_read_phy_reg(hw, 0x2F5B, &phy_saved_data);            if(ret_val)                return ret_val;            /* Disable the PHY transmitter */            ret_val = e1000_write_phy_reg(hw, 0x2F5B, 0x0003);            if(ret_val)                return ret_val;            msec_delay(20);            ret_val = e1000_write_phy_reg(hw, 0x0000,                                          IGP01E1000_IEEE_FORCE_GIGA);            if(ret_val)                return ret_val;            ret_val = e1000_write_phy_reg(hw, IGP01E1000_PHY_DSP_FFE,                                          IGP01E1000_PHY_DSP_FFE_DEFAULT);            if(ret_val)                return ret_val;            ret_val = e1000_write_phy_reg(hw, 0x0000,                                          IGP01E1000_IEEE_RESTART_AUTONEG);            if(ret_val)                return ret_val;            msec_delay(20);            /* Now enable the transmitter */            ret_val = e1000_write_phy_reg(hw, 0x2F5B, phy_saved_data);            if(ret_val)                return ret_val;            hw->ffe_config_state = e1000_ffe_config_enabled;        }    }    return E1000_SUCCESS;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/2d7edb923a823660b081bd4c660300ee19adca8d/e1000_hw.c/buggy/drivers/net/e1000/e1000_hw.c