VirtualBox

Changeset 64966 in vbox for trunk/src/VBox/Devices/Network


Ignore:
Timestamp:
Dec 20, 2016 11:38:55 AM (8 years ago)
Author:
vboxsync
Message:

Dev/E1000: (bugref:8624) Bring the link up in 2 seconds, PHY soft reset triggers delayed link-up event.

Location:
trunk/src/VBox/Devices/Network
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/DevE1000.cpp

    r64925 r64966  
    26432643
    26442644/**
     2645 * A callback used by PHY to indicate that the link needs to be updated due to
     2646 * reset of PHY.
     2647 *
     2648 * @param   pPhy        A pointer to phy member of the device state structure.
     2649 * @thread  any
     2650 */
     2651void e1kPhyLinkResetCallback(PPHY pPhy)
     2652{
     2653    /* PHY is aggregated into e1000, get pThis from pPhy. */
     2654    PE1KSTATE pThis = RT_FROM_MEMBER(pPhy, E1KSTATE, phy);
     2655    /* Make sure we have cable connected and MAC can talk to PHY */
     2656    if (pThis->fCableConnected && (CTRL & CTRL_SLU))
     2657        e1kArmTimer(pThis, pThis->CTX_SUFF(pLUTimer), E1K_INIT_LINKUP_DELAY_US);
     2658}
     2659
     2660/**
    26452661 * Write handler for Device Control register.
    26462662 *
     
    76497665    /* Initialize internal PHY. */
    76507666    Phy::init(&pThis->phy, iInstance, pThis->eChip == E1K_CHIP_82543GC ? PHY_EPID_M881000 : PHY_EPID_M881011);
    7651     Phy::setLinkStatus(&pThis->phy, pThis->fCableConnected);
    76527667
    76537668    /* Initialize critical sections. We do our own locking. */
  • trunk/src/VBox/Devices/Network/DevE1000Phy.cpp

    r64925 r64966  
    4747
    4848#define REG(x) pPhy->au16Regs[x##_IDX]
     49
     50
     51/* External callback declaration */
     52void e1kPhyLinkResetCallback(PPHY pPhy);
    4953
    5054
     
    300304{
    301305    pPhy->iInstance = iNICInstance;
    302     /* Make sure the link is down */
    303     REG(PSTATUS)  = 0;
    304306    /* The PHY identifier composed of bits 3 through 18 of the OUI */
    305307    /* (Organizationally Unique Identifier). OUI is 0x05043.       */
     
    352354{
    353355    PhyLog(("PHY#%d Soft reset\n", pPhy->iInstance));
     356
     357    REG(PCTRL)    = REG(PCTRL) & (PCTRL_SPDSELM | PCTRL_DUPMOD | PCTRL_ANEG | PCTRL_SPDSELL);
    354358    /*
    355359     * 100 and 10 FD/HD, Extended Status, MF Preamble Suppression,
     
    357361     */
    358362    REG(PSTATUS)  = 0x7949;
    359     REG(PSSTAT)   = 0x0000;
     363    REG(PSSTAT)  &= 0xe001;
    360364    PhyLog(("PHY#%d PSTATUS=%04x PSSTAT=%04x\n", pPhy->iInstance, REG(PSTATUS), REG(PSSTAT)));
    361     PhyLog(("PHY#%d Soft reset is not yet fully implemented!\n", pPhy->iInstance));
     365
     366    e1kPhyLinkResetCallback(pPhy);
    362367}
    363368
     
    384389    if (fLinkIsUp)
    385390    {
    386         REG(PSSTAT)  |= PSSTAT_LINK;
    387         REG(PSTATUS) |= PSTATUS_NEGCOMP;
     391        REG(PSSTAT)  |= PSSTAT_LINK_ALL;
     392        REG(PSTATUS) |= PSTATUS_NEGCOMP; /* PSTATUS_LNKSTAT is latched low */
    388393    }
    389394    else
    390395    {
    391         REG(PSSTAT)  &= ~PSSTAT_LINK;
    392         REG(PSTATUS) &= ~PSTATUS_LNKSTAT;
     396        REG(PSSTAT)  &= ~PSSTAT_LINK_ALL;
     397        REG(PSTATUS) &= ~(PSTATUS_LNKSTAT | PSTATUS_NEGCOMP);
    393398    }
    394399    PhyLog(("PHY#%d setLinkStatus: PSTATUS=%04x PSSTAT=%04x\n", pPhy->iInstance, REG(PSTATUS), REG(PSSTAT)));
  • trunk/src/VBox/Devices/Network/DevE1000Phy.h

    r64925 r64966  
    3838 * Receive Pause Enable
    3939 */
    40 #define PSSTAT_LINK     0xBC08
     40#define PSSTAT_LINK_ALL 0xBC08
     41#define PSSTAT_LINK     0x0400
    4142
    4243namespace Phy
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette