third_party/virtualbox/src/VBox/Devices/Network/DevE1000.cpp
/**
 * Write handler for MDI Control register.
 *
 * Handles PHY read/write requests; forwards requests to internal PHY device.
 *
 * @param   pThis       The device state structure.
 * @param   offset      Register offset in memory-mapped frame.
 * @param   index       Register index in register array.
 * @param   value       The value to store.
 * @param   mask        Used to implement partial writes (8 and 16-bit).
 * @thread  EMT
 */
Write handler for MDI Control register.
Handles PHY read/write requests; forwards requests to internal PHY device.

@param   pThis       The device state structure.
@param   offset      Register offset in memory-mapped frame.
@param   index       Register index in register array.
@param   value       The value to store.
@param   mask        Used to implement partial writes (8 and 16-bit).
@thread  EMT
Write handler for MDI Control register . Handles PHY read / write requests ; forwards requests to internal PHY device . @param pThis The device state structure . @param offset Register offset in memory - mapped frame . @param index Register index in register array . @param value The value to store . @param mask Used to implement partial writes ( 8 and 16 - bit ) . @thread EMT
static int e1kRegWriteMDIC(PE1KSTATE pThis, uint32_t offset, uint32_t index, uint32_t value)
{
    if (value & MDIC_INT_EN)
    {
        E1kLog(("%s ERROR! Interrupt at the end of an MDI cycle is not supported yet.\n",
                pThis->szPrf));
    }
    else if (value & MDIC_READY)
    {
        E1kLog(("%s ERROR! Ready bit is not reset by software during write operation.\n",
                pThis->szPrf));
    }
    else if (GET_BITS_V(value, MDIC, PHY) != 1)
    {
        E1kLog(("%s WARNING! Access to invalid PHY detected, phy=%d.\n",
                pThis->szPrf, GET_BITS_V(value, MDIC, PHY)));
        MDIC = MDIC_READY | MDIC_ERROR;
    }
    else
    {
        e1kRegWriteDefault(pThis, offset, index, value);
        STAM_COUNTER_INC(&pThis->StatPHYAccesses);
        if (value & MDIC_OP_READ)
            SET_BITS(MDIC, DATA, Phy::readRegister(&pThis->phy, GET_BITS_V(value, MDIC, REG)));
        else
            Phy::writeRegister(&pThis->phy, GET_BITS_V(value, MDIC, REG), value & MDIC_DATA_MASK);
        MDIC |= MDIC_READY;
    }
    return VINF_SUCCESS;
}
static int e1kRegWriteMDIC ( PE1KSTATE pThis , uint32_t offset , uint32_t index , uint32_t value ) { if ( value & MDIC_INT_EN ) { E1kLog ( ( " \n " , pThis -> szPrf ) ) ; } else if ( value & MDIC_READY ) { E1kLog ( ( " \n " , pThis -> szPrf ) ) ; } else if ( GET_BITS_V ( value , MDIC , PHY ) != 1 ) { E1kLog ( ( " \n " , pThis -> szPrf , GET_BITS_V ( value , MDIC , PHY ) ) ) ; MDIC = MDIC_READY | MDIC_ERROR ; } else { e1kRegWriteDefault ( pThis , offset , index , value ) ; STAM_COUNTER_INC ( & pThis -> StatPHYAccesses ) ; if ( value & MDIC_OP_READ ) SET_BITS ( MDIC , DATA , Phy :: readRegister ( & pThis -> phy , GET_BITS_V ( value , MDIC , REG ) ) ) ; else Phy :: writeRegister ( & pThis -> phy , GET_BITS_V ( value , MDIC , REG ) , value & MDIC_DATA_MASK ) ; MDIC |= MDIC_READY ; } return VINF_SUCCESS ; }
Write handler for MDI Control register.
Write handler for MDI Control register .
/*
         * Some drivers scan the MDIO bus for a PHY. We can work with these
         * drivers if we set MDIC_READY and MDIC_ERROR when there isn't a PHY
         * at the requested address, see @bugref{7346}.
         */ /* Store the value */ /* Forward op to PHY */ /* Let software know that we are done */