VirtualBox

Changeset 81877 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Nov 15, 2019 3:09:00 PM (5 years ago)
Author:
vboxsync
Message:

DevAHCI: Use the device helpers for critical sections and thread destruction. bugref:9218

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/DevAHCI.cpp

    r81875 r81877  
    891891    Log(("P%u: %s: Setting interrupt\n", iPort, __FUNCTION__));
    892892
    893     int rc = PDMCritSectEnter(&pAhci->lock, rcBusy);
     893    int rc = PDMDevHlpCritSectEnter(pAhci->CTX_SUFF(pDevIns), &pAhci->lock, rcBusy);
    894894    if (rc != VINF_SUCCESS)
    895895        return rc;
     
    930930    }
    931931
    932     PDMCritSectLeave(&pAhci->lock);
     932    PDMDevHlpCritSectLeave(pAhci->CTX_SUFF(pDevIns), &pAhci->lock);
    933933    return VINF_SUCCESS;
    934934}
     
    16121612    Log(("%s: write u32Value=%#010x\n", __FUNCTION__, u32Value));
    16131613
    1614     int rc = PDMCritSectEnter(&pAhci->lock, VINF_IOM_R3_MMIO_WRITE);
     1614    int rc = PDMDevHlpCritSectEnter(pAhci->CTX_SUFF(pDevIns), &pAhci->lock, VINF_IOM_R3_MMIO_WRITE);
    16151615    if (rc != VINF_SUCCESS)
    16161616        return rc;
     
    16641664    }
    16651665
    1666     PDMCritSectLeave(&pAhci->lock);
     1666    PDMDevHlpCritSectLeave(pAhci->CTX_SUFF(pDevIns), &pAhci->lock);
    16671667    return VINF_SUCCESS;
    16681668}
     
    16751675    RT_NOREF1(iReg);
    16761676
    1677     int rc = PDMCritSectEnter(&pAhci->lock, VINF_IOM_R3_MMIO_READ);
     1677    int rc = PDMDevHlpCritSectEnter(pAhci->CTX_SUFF(pDevIns), &pAhci->lock, VINF_IOM_R3_MMIO_READ);
    16781678    if (rc != VINF_SUCCESS)
    16791679        return rc;
     
    16811681    uint32_t u32PortsInterrupted = ASMAtomicXchgU32(&pAhci->u32PortsInterrupted, 0);
    16821682
    1683     PDMCritSectLeave(&pAhci->lock);
     1683    PDMDevHlpCritSectLeave(pAhci->CTX_SUFF(pDevIns), &pAhci->lock);
    16841684    Log(("%s: read regHbaIs=%#010x u32PortsInterrupted=%#010x\n", __FUNCTION__, pAhci->regHbaIs, u32PortsInterrupted));
    16851685
     
    45534553}
    45544554
    4555 /* The async IO thread for one port. */
     4555/**
     4556 * @callback_method_impl{FNPDMTHREADDEV, The async IO thread for one port.}
     4557 */
    45564558static DECLCALLBACK(int) ahciAsyncIOLoop(PPDMDEVINS pDevIns, PPDMTHREAD pThread)
    45574559{
     
    46904692
    46914693/**
    4692  * Unblock the async I/O thread so it can respond to a state change.
    4693  *
    4694  * @returns VBox status code.
    4695  * @param   pDevIns     The device instance.
    4696  * @param   pThread     The send thread.
     4694 * @callback_method_impl{FNPDMTHREADWAKEUPDEV}
    46974695 */
    46984696static DECLCALLBACK(int) ahciAsyncIOLoopWakeUp(PPDMDEVINS pDevIns, PPDMTHREAD pThread)
     
    55565554        int rcThread;
    55575555        /* Destroy the thread. */
    5558         rc = PDMR3ThreadDestroy(pAhciPort->pAsyncIOThread, &rcThread);
     5556        rc = PDMDevHlpThreadDestroy(pDevIns, pAhciPort->pAsyncIOThread, &rcThread);
    55595557        if (RT_FAILURE(rc) || RT_FAILURE(rcThread))
    55605558            AssertMsgFailed(("%s Failed to destroy async IO thread rc=%Rrc rcThread=%Rrc\n", __FUNCTION__, rc, rcThread));
     
    57645762static DECLCALLBACK(int) ahciR3Destruct(PPDMDEVINS pDevIns)
    57655763{
     5764    PDMDEV_CHECK_VERSIONS_RETURN_QUIET(pDevIns);
    57665765    PAHCI       pThis = PDMDEVINS_2_DATA(pDevIns, PAHCI);
    57675766    int         rc    = VINF_SUCCESS;
    5768     PDMDEV_CHECK_VERSIONS_RETURN_QUIET(pDevIns);
    57695767
    57705768    /*
     
    57735771     * will take care of terminating and cleaning up the thread.
    57745772     */
    5775     if (PDMCritSectIsInitialized(&pThis->lock))
     5773    if (PDMDevHlpCritSectIsInitialized(pDevIns, &pThis->lock))
    57765774    {
    57775775        TMR3TimerDestroy(pThis->CTX_SUFF(pHbaCccTimer));
     
    57935791        }
    57945792
    5795         PDMR3CritSectDelete(&pThis->lock);
     5793        PDMDevHlpCritSectDelete(pDevIns, &pThis->lock);
    57965794    }
    57975795
     
    58045802static DECLCALLBACK(int) ahciR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg)
    58055803{
     5804    PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
    58065805    PAHCI           pThis = PDMDEVINS_2_DATA(pDevIns, PAHCI);
    58075806    PCPDMDEVHLPR3   pHlp  = pDevIns->pHlpR3;
     
    58105809    unsigned        i = 0;
    58115810    uint32_t        cbTotalBufferSize = 0;
    5812     PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
    58135811
    58145812    LogFlowFunc(("pThis=%#p\n", pThis));
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