VirtualBox

Changeset 62612 in vbox for trunk


Ignore:
Timestamp:
Jul 27, 2016 8:11:53 PM (8 years ago)
Author:
vboxsync
Message:

DevIchHda: Need to call hdaRegWriteSDUnlock in hdaRegWriteSDFMT when hdaRegWriteSDLock succeeds, it's not cool to skip it if any of the operations mysteriously fails.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DevIchHda.cpp

    r62605 r62612  
    883883static FNPDMDEVRESET hdaReset;
    884884
    885 /*
    886  * Stubs.
     885/** @name Register read/write stubs.
     886 * @{
    887887 */
    888888static int hdaRegReadUnimpl(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value);
    889889static int hdaRegWriteUnimpl(PHDASTATE pThis, uint32_t iReg, uint32_t pu32Value);
    890 
    891 /*
    892  * Global register set read/write functions.
     890/** @} */
     891
     892/** @name Global register set read/write functions.
     893 * @{
    893894 */
    894895static int hdaRegWriteGCTL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
     
    909910static int hdaRegReadIRS(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value);
    910911static int hdaRegWriteBase(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
    911 
    912 /*
    913  * {IOB}SDn read/write functions.
     912/** @} */
     913
     914/** @name {IOB}SDn write functions.
     915 * @{
    914916 */
    915917static int       hdaRegWriteSDCBL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
     
    922924static int       hdaRegWriteSDBDPL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
    923925static int       hdaRegWriteSDBDPU(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
     926/** @} */
     927
     928/* Locking + logging. */
    924929DECLINLINE(int)  hdaRegWriteSDLock(PHDASTATE pThis, PHDASTREAM pStream, uint32_t iReg, uint32_t u32Value);
    925930DECLINLINE(void) hdaRegWriteSDUnlock(PHDASTREAM pStream);
    926931
    927 /*
    928  * Generic register read/write functions.
     932/** @name Generic register read/write functions.
     933 * @{
    929934 */
    930935static int hdaRegReadU32(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value);
     
    936941static int hdaRegReadU8(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value);
    937942static int hdaRegWriteU8(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
     943/** @} */
    938944
    939945#ifdef IN_RING3
     
    13971403 *
    13981404 * @returns Register index on success, -1 if not found.
    1399  * @param   pThis               The HDA device state.
    14001405 * @param   offReg              The register offset.
    14011406 */
    1402 static int hdaRegLookup(PHDASTATE pThis, uint32_t offReg)
     1407static int hdaRegLookup(uint32_t offReg)
    14031408{
    14041409    /*
     
    14491454 *
    14501455 * @returns Register index on success, -1 if not found.
    1451  * @param   pThis               The HDA device state.
    14521456 * @param   offReg              The register offset.
    14531457 */
    1454 static int hdaRegLookupWithin(PHDASTATE pThis, uint32_t offReg)
     1458static int hdaRegLookupWithin(uint32_t offReg)
    14551459{
    14561460    /*
     
    27902794    }
    27912795
    2792     rc = hdaRegWriteSDLock(pThis, pStream, iReg, u32Value);
    2793     AssertRC(rc);
     2796    int rcSem = hdaRegWriteSDLock(pThis, pStream, iReg, u32Value);
     2797    AssertRC(rcSem);
    27942798
    27952799    LogFunc(("[SD%RU8]: Hz=%RU32, Channels=%RU8, enmFmt=%RU32\n",
     
    28012805    {
    28022806        case PDMAUDIODIR_IN:
    2803 #ifdef VBOX_WITH_HDA_MIC_IN
    2804 # error "Implement me!"
    2805 #else
     2807# ifdef VBOX_WITH_HDA_MIC_IN
     2808#  error "Implement me!"
     2809# else
    28062810            strmCfg.DestSource.Source = PDMAUDIORECSOURCE_LINE;
    28072811            RTStrPrintf(strmCfg.szName, RT_ELEMENTS(strmCfg.szName), "Line In");
    2808 #endif
     2812# endif
    28092813            break;
    28102814
     
    28352839    if (RT_SUCCESS(rc))
    28362840    {
    2837         int rc2;
    28382841        PHDADRIVER pDrv;
    28392842        RTListForEach(&pThis->lstDrv, pDrv, HDADRIVER, Node)
    28402843        {
     2844            int rc2;
    28412845            switch (strmCfg.enmDir)
    28422846            {
     
    28732877        else
    28742878            LogFunc(("[SD%RU8]: (Re-)Opening stream failed with rc=%Rrc\n", pStream->u8SD, rc));
    2875 
     2879    }
     2880
     2881    if (RT_SUCCESS(rcSem))
    28762882        hdaRegWriteSDUnlock(pStream);
    2877     }
    28782883
    28792884    return VINF_SUCCESS; /* Never return failure. */
     
    29332938 * XXX
    29342939 *
    2935  * @return  bool                Returns @true if write is allowed, @false if not.
     2940 * @return  VBox status code.  ALL THE CALLERS IGNORES THIS. DUH.
     2941 *
    29362942 * @param   pThis               Pointer to HDA state.
    2937  * @param   iReg                Register to write.
    2938  * @param   u32Value            Value to write.
     2943 * @param   iReg                Register to write (logging only).
     2944 * @param   u32Value            Value to write (logging only).
    29392945 */
    29402946DECLINLINE(int) hdaRegWriteSDLock(PHDASTATE pThis, PHDASTREAM pStream, uint32_t iReg, uint32_t u32Value)
    29412947{
    2942     AssertPtrReturn(pThis,   VERR_INVALID_POINTER);
    2943     AssertPtrReturn(pStream, VERR_INVALID_POINTER);
     2948    AssertPtr(pThis);   /* don't bother returning errors */
     2949    AssertPtr(pStream);
    29442950
    29452951#ifdef VBOX_STRICT
     
    29582964#endif
    29592965
     2966    /** @todo r=bird: Why on EARTH are we using mutexes?  USE CRITICAL SECTIONS!! */
    29602967    return RTSemMutexRequest(pStream->State.hMtx, RT_INDEFINITE_WAIT);
    29612968}
     
    44724479     */
    44734480    uint32_t        offReg = GCPhysAddr - pThis->MMIOBaseAddr;
    4474     int             idxRegDsc = hdaRegLookup(pThis, offReg);    /* Register descriptor index. */
     4481    int             idxRegDsc = hdaRegLookup(offReg);    /* Register descriptor index. */
    44754482#ifdef LOG_ENABLED
    44764483    unsigned const  cbLog     = cb;
     
    45894596     */
    45904597    uint32_t    offReg = GCPhysAddr - pThis->MMIOBaseAddr;
    4591     int         idxRegDsc = hdaRegLookup(pThis, offReg);
     4598    int         idxRegDsc = hdaRegLookup(offReg);
    45924599    uint32_t    idxRegMem = idxRegDsc != -1 ? g_aHdaRegMap[idxRegDsc].mem_idx : UINT32_MAX;
    45934600    uint64_t    u64Value;
     
    46364643         * shifting out input values.
    46374644         */
    4638         if (idxRegDsc == -1 && (idxRegDsc = hdaRegLookupWithin(pThis, offReg)) != -1)
     4645        if (idxRegDsc == -1 && (idxRegDsc = hdaRegLookupWithin(offReg)) != -1)
    46394646        {
    46404647            uint32_t const cbBefore = offReg - g_aHdaRegMap[idxRegDsc].offset; Assert(cbBefore > 0 && cbBefore < 4);
     
    46834690            u64Value >>= cbReg * 8;
    46844691            if (idxRegDsc == -1)
    4685                 idxRegDsc = hdaRegLookup(pThis, offReg);
     4692                idxRegDsc = hdaRegLookup(offReg);
    46864693            else
    46874694            {
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