third_party/virtualbox/src/VBox/Devices/Network/DevE1000.cpp
/**
 * Raise interrupt if not masked.
 *
 * @param   pThis       The device state structure.
 */
Raise interrupt if not masked.
@param   pThis       The device state structure.
Raise interrupt if not masked . @param pThis The device state structure .
static int e1kRaiseInterrupt(PE1KSTATE pThis, int rcBusy, uint32_t u32IntCause = 0)
{
    int rc = e1kCsEnter(pThis, rcBusy);
    if (RT_UNLIKELY(rc != VINF_SUCCESS))
        return rc;
    E1K_INC_ISTAT_CNT(pThis->uStatIntTry);
    ICR |= u32IntCause;
    if (ICR & IMS)
    {
        if (pThis->fIntRaised)
        {
            E1K_INC_ISTAT_CNT(pThis->uStatIntSkip);
            E1kLog2(("%s e1kRaiseInterrupt: Already raised, skipped. ICR&IMS=%08x\n",
                    pThis->szPrf, ICR & IMS));
        }
        else
        {
            uint64_t tsNow = TMTimerGet(pThis->CTX_SUFF(pIntTimer));
            if (!!ITR && tsNow - pThis->u64AckedAt < ITR * 256
                     && pThis->fItrEnabled && (pThis->fItrRxEnabled || !(ICR & ICR_RXT0)))
            {
                E1K_INC_ISTAT_CNT(pThis->uStatIntEarly);
                E1kLog2(("%s e1kRaiseInterrupt: Too early to raise again: %d ns < %d ns.\n",
                        pThis->szPrf, (uint32_t)(tsNow - pThis->u64AckedAt), ITR * 256));
                e1kPostponeInterrupt(pThis, ITR * 256);
            }
            else
            {
                TMTimerStop(pThis->CTX_SUFF(pIntTimer));
                E1K_INC_ISTAT_CNT(pThis->uStatInt);
                STAM_COUNTER_INC(&pThis->StatIntsRaised);
                pThis->fIntRaised = true;
                E1kLogRel(("E1000: irq RAISED icr&mask=0x%x, icr=0x%x\n", ICR & IMS, ICR));
                PDMDevHlpPCISetIrq(pThis->CTX_SUFF(pDevIns), 0, 1);
                E1kLog(("%s e1kRaiseInterrupt: Raised. ICR&IMS=%08x\n",
                        pThis->szPrf, ICR & IMS));
            }
        }
    }
    else
    {
        E1K_INC_ISTAT_CNT(pThis->uStatIntMasked);
        E1kLog2(("%s e1kRaiseInterrupt: Not raising, ICR=%08x, IMS=%08x\n",
                pThis->szPrf, ICR, IMS));
    }
    e1kCsLeave(pThis);
    return VINF_SUCCESS;
}
static int e1kRaiseInterrupt ( PE1KSTATE pThis , int rcBusy , uint32_t u32IntCause = 0 ) { int rc = e1kCsEnter ( pThis , rcBusy ) ; if ( RT_UNLIKELY ( rc != VINF_SUCCESS ) ) return rc ; E1K_INC_ISTAT_CNT ( pThis -> uStatIntTry ) ; ICR |= u32IntCause ; if ( ICR & IMS ) { if ( pThis -> fIntRaised ) { E1K_INC_ISTAT_CNT ( pThis -> uStatIntSkip ) ; E1kLog2 ( ( " \n " , pThis -> szPrf , ICR & IMS ) ) ; } else { uint64_t tsNow = TMTimerGet ( pThis -> CTX_SUFF ( pIntTimer ) ) ; if ( ! ! ITR && tsNow - pThis -> u64AckedAt < ITR * 256 && pThis -> fItrEnabled && ( pThis -> fItrRxEnabled || ! ( ICR & ICR_RXT0 ) ) ) { E1K_INC_ISTAT_CNT ( pThis -> uStatIntEarly ) ; E1kLog2 ( ( " \n " , pThis -> szPrf , ( uint32_t ) ( tsNow - pThis -> u64AckedAt ) , ITR * 256 ) ) ; e1kPostponeInterrupt ( pThis , ITR * 256 ) ; } else { TMTimerStop ( pThis -> CTX_SUFF ( pIntTimer ) ) ; E1K_INC_ISTAT_CNT ( pThis -> uStatInt ) ; STAM_COUNTER_INC ( & pThis -> StatIntsRaised ) ; pThis -> fIntRaised = true ; E1kLogRel ( ( " \n " , ICR & IMS , ICR ) ) ; PDMDevHlpPCISetIrq ( pThis -> CTX_SUFF ( pDevIns ) , 0 , 1 ) ; E1kLog ( ( " \n " , pThis -> szPrf , ICR & IMS ) ) ; } } } else { E1K_INC_ISTAT_CNT ( pThis -> uStatIntMasked ) ; E1kLog2 ( ( " \n " , pThis -> szPrf , ICR , IMS ) ) ; } e1kCsLeave ( pThis ) ; return VINF_SUCCESS ; }
Raise interrupt if not masked.
Raise interrupt if not masked .
/* Since we are delivering the interrupt now
                 * there is no need to do it later -- stop the timer.
                 */ /* Got at least one unmasked interrupt cause */ /* Raise(1) INTA(0) */