rem: DEBUGOUT("Looking for Link\n");
add: HW_DEBUGOUT("Looking for Link");
context: em_setup_fiber_serdes_link(struct em_hw *hw){    uint32_t ctrl;    uint32_t status;    uint32_t txcw = 0;    uint32_t i;    uint32_t signal = 0;    int32_t ret_val;    DEBUGFUNC("em_setup_fiber_serdes_link");    /* On adapters with a MAC newer than 82544, SW Defineable pin 1 will be     * set when the optics detect a signal. On older adapters, it will be     * cleared when there is a signal.  This applies to fiber media only.     * If we're on serdes media, adjust the output amplitude to value set in     * the EEPROM.     */    ctrl = E1000_READ_REG(hw, CTRL);    if(hw->media_type == em_media_type_fiber)        signal = (hw->mac_type > em_82544) ? E1000_CTRL_SWDPIN1 : 0;    if((ret_val = em_adjust_serdes_amplitude(hw)))        return ret_val;    /* Take the link out of reset */    ctrl &= ~(E1000_CTRL_LRST);    /* Adjust VCO speed to improve BER performance */    if((ret_val = em_set_vco_speed(hw)))        return ret_val;    em_config_collision_dist(hw);    /* Check for a software override of the flow control settings, and setup     * the device accordingly.  If auto-negotiation is enabled, then software     * will have to set the "PAUSE" bits to the correct value in the Tranmsit     * Config Word Register (TXCW) and re-start auto-negotiation.  However, if     * auto-negotiation is disabled, then software will have to manually     * configure the two flow control enable bits in the CTRL register.     *     * The possible values of the "fc" parameter are:     *      0:  Flow control is completely disabled     *      1:  Rx flow control is enabled (we can receive pause frames, but     *          not send pause frames).     *      2:  Tx flow control is enabled (we can send pause frames but we do     *          not support receiving pause frames).     *      3:  Both Rx and TX flow control (symmetric) are enabled.     */    switch (hw->fc) {    case em_fc_none:        /* Flow control is completely disabled by a software over-ride. */        txcw = (E1000_TXCW_ANE | E1000_TXCW_FD);        break;    case em_fc_rx_pause:        /* RX Flow control is enabled and TX Flow control is disabled by a         * software over-ride. Since there really isn't a way to advertise         * that we are capable of RX Pause ONLY, we will advertise that we         * support both symmetric and asymmetric RX PAUSE. Later, we will         *  disable the adapter's ability to send PAUSE frames.         */        txcw = (E1000_TXCW_ANE | E1000_TXCW_FD | E1000_TXCW_PAUSE_MASK);        break;    case em_fc_tx_pause:        /* TX Flow control is enabled, and RX Flow control is disabled, by a         * software over-ride.         */        txcw = (E1000_TXCW_ANE | E1000_TXCW_FD | E1000_TXCW_ASM_DIR);        break;    case em_fc_full:        /* Flow control (both RX and TX) is enabled by a software over-ride. */        txcw = (E1000_TXCW_ANE | E1000_TXCW_FD | E1000_TXCW_PAUSE_MASK);        break;    default:        DEBUGOUT("Flow control param set incorrectly\n");        return -E1000_ERR_CONFIG;        break;    }    /* Since auto-negotiation is enabled, take the link out of reset (the link     * will be in reset, because we previously reset the chip). This will     * restart auto-negotiation.  If auto-neogtiation is successful then the     * link-up status bit will be set and the flow control enable bits (RFCE     * and TFCE) will be set according to their negotiated value.     */    DEBUGOUT("Auto-negotiation enabled\n");    E1000_WRITE_REG(hw, TXCW, txcw);    E1000_WRITE_REG(hw, CTRL, ctrl);    E1000_WRITE_FLUSH(hw);    hw->txcw = txcw;    msec_delay(1);    /* If we have a signal (the cable is plugged in) then poll for a "Link-Up"     * indication in the Device Status Register.  Time-out if a link isn't     * seen in 500 milliseconds seconds (Auto-negotiation should complete in     * less than 500 milliseconds even if the other end is doing it in SW).     * For internal serdes, we just assume a signal is present, then poll.     */    if(hw->media_type == em_media_type_internal_serdes ||       (E1000_READ_REG(hw, CTRL) & E1000_CTRL_SWDPIN1) == signal) {        DEBUGOUT("Looking for Link\n");        for(i = 0; i < (LINK_UP_TIMEOUT / 10); i++) {            msec_delay(10);            status = E1000_READ_REG(hw, STATUS);            if(status & E1000_STATUS_LU) break;        }        if(i == (LINK_UP_TIMEOUT / 10)) {            DEBUGOUT("Never got a valid link from auto-neg!!!\n");            hw->autoneg_failed = 1;            /* AutoNeg failed to achieve a link, so we'll call             * em_check_for_link. This routine will force the link up if             * we detect a signal. This will allow us to communicate with             * non-autonegotiating link partners.             */            if((ret_val = em_check_for_link(hw))) {                DEBUGOUT("Error while checking for link\n");                return ret_val;            }            hw->autoneg_failed = 0;        } else {            hw->autoneg_failed = 0;            DEBUGOUT("Valid Link Found\n");        }    } else {        DEBUGOUT("No Signal Detected\n");    }    return E1000_SUCCESS;}