Changeset 68903 in vbox
- Timestamp:
- Sep 28, 2017 9:56:21 AM (7 years ago)
- File:
-
- 1 edited
-
trunk/src/VBox/Devices/Audio/DevIchAc97.cpp (modified) (22 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
r68719 r68903 304 304 /** Criticial section for this stream. */ 305 305 RTCRITSECT CritSect; 306 /** The stream's current configuration. */ 307 PDMAUDIOSTREAMCFG Cfg; 308 uint32_t Padding; 306 309 #ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO 307 310 /** Asynchronous I/O state members. */ … … 572 575 static void ichac97DoTransfers(PAC97STATE pThis); 573 576 577 static int ichac97MixerAddDrvStream(PAC97STATE pThis, PAUDMIXSINK pMixSink, PPDMAUDIOSTREAMCFG pCfg, PAC97DRIVER pDrv); 574 578 static int ichac97MixerAddDrvStreams(PAC97STATE pThis, PAUDMIXSINK pMixSink, PPDMAUDIOSTREAMCFG pCfg); 579 static void ichac97MixerRemoveDrvStream(PAC97STATE pThis, PAUDMIXSINK pMixSink, PDMAUDIODIR enmDir, PDMAUDIODESTSOURCE dstSrc, PAC97DRIVER pDrv); 575 580 static void ichac97MixerRemoveDrvStreams(PAC97STATE pThis, PAUDMIXSINK pMixSink, PDMAUDIODIR enmDir, PDMAUDIODESTSOURCE dstSrc); 576 581 … … 1493 1498 1494 1499 /** 1495 * Adds audio streams for all drivers to a specific mixer sink. 1500 * Adds a driver stream to a specific mixer sink. 1501 * 1502 * @returns IPRT status code. 1503 * @param pThis AC'97 state. 1504 * @param pMixSink Mixer sink to add driver stream to. 1505 * @param pCfg Stream configuration to use. 1506 * @param pDrv Driver stream to add. 1507 */ 1508 static int ichac97MixerAddDrvStream(PAC97STATE pThis, PAUDMIXSINK pMixSink, PPDMAUDIOSTREAMCFG pCfg, PAC97DRIVER pDrv) 1509 { 1510 AssertPtrReturn(pThis, VERR_INVALID_POINTER); 1511 AssertPtrReturn(pMixSink, VERR_INVALID_POINTER); 1512 AssertPtrReturn(pCfg, VERR_INVALID_POINTER); 1513 1514 PPDMAUDIOSTREAMCFG pStreamCfg = DrvAudioHlpStreamCfgDup(pCfg); 1515 if (!pStreamCfg) 1516 return VERR_NO_MEMORY; 1517 1518 if (!RTStrPrintf(pStreamCfg->szName, sizeof(pStreamCfg->szName), "%s", pCfg->szName)) 1519 { 1520 RTMemFree(pStreamCfg); 1521 return VERR_BUFFER_OVERFLOW; 1522 } 1523 1524 LogFunc(("[LUN#%RU8] %s\n", pDrv->uLUN, pStreamCfg->szName)); 1525 1526 int rc; 1527 1528 PAC97DRIVERSTREAM pDrvStream = ichac97MixerGetDrvStream(pThis, pDrv, pStreamCfg->enmDir, pStreamCfg->DestSource); 1529 if (pDrvStream) 1530 { 1531 AssertMsg(pDrvStream->pMixStrm == NULL, ("[LUN#%RU8] Driver stream already present when it must not\n", pDrv->uLUN)); 1532 1533 PAUDMIXSTREAM pMixStrm; 1534 rc = AudioMixerSinkCreateStream(pMixSink, pDrv->pConnector, pStreamCfg, 0 /* fFlags */, &pMixStrm); 1535 if (RT_SUCCESS(rc)) 1536 { 1537 rc = AudioMixerSinkAddStream(pMixSink, pMixStrm); 1538 LogFlowFunc(("LUN#%RU8: Created stream \"%s\", rc=%Rrc\n", pDrv->uLUN, pCfg->szName, rc)); 1539 } 1540 1541 if (RT_SUCCESS(rc)) 1542 pDrvStream->pMixStrm = pMixStrm; 1543 } 1544 else 1545 rc = VERR_INVALID_PARAMETER; 1546 1547 if (pStreamCfg) 1548 { 1549 RTMemFree(pStreamCfg); 1550 pStreamCfg = NULL; 1551 } 1552 1553 LogFlowFuncLeaveRC(rc); 1554 return rc; 1555 } 1556 1557 /** 1558 * Adds all current driver streams to a specific mixer sink. 1496 1559 * 1497 1560 * @returns IPRT status code. … … 1516 1579 RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node) 1517 1580 { 1518 PPDMAUDIOSTREAMCFG pStreamCfg = DrvAudioHlpStreamCfgDup(pCfg); 1519 if (!pStreamCfg) 1520 { 1521 rc = VERR_NO_MEMORY; 1522 break; 1523 } 1524 1525 if (!RTStrPrintf(pStreamCfg->szName, sizeof(pStreamCfg->szName), "%s", pCfg->szName)) 1526 { 1527 RTMemFree(pStreamCfg); 1528 1529 rc = VERR_BUFFER_OVERFLOW; 1530 break; 1531 } 1532 1533 LogFunc(("[LUN#%RU8] %s\n", pDrv->uLUN, pStreamCfg->szName)); 1534 1535 int rc2 = VINF_SUCCESS; 1536 1537 PAC97DRIVERSTREAM pDrvStream = ichac97MixerGetDrvStream(pThis, pDrv, pStreamCfg->enmDir, pStreamCfg->DestSource); 1538 if (pDrvStream) 1539 { 1540 AssertMsg(pDrvStream->pMixStrm == NULL, ("[LUN#%RU8] Driver stream already present when it must not\n", pDrv->uLUN)); 1541 1542 PAUDMIXSTREAM pMixStrm; 1543 rc2 = AudioMixerSinkCreateStream(pMixSink, pDrv->pConnector, pStreamCfg, 0 /* fFlags */, &pMixStrm); 1544 if (RT_SUCCESS(rc2)) 1545 { 1546 rc2 = AudioMixerSinkAddStream(pMixSink, pMixStrm); 1547 LogFlowFunc(("LUN#%RU8: Created stream \"%s\", rc=%Rrc\n", pDrv->uLUN, pCfg->szName, rc2)); 1548 } 1549 1550 if (RT_SUCCESS(rc2)) 1551 pDrvStream->pMixStrm = pMixStrm; 1552 1553 /* If creating a stream fails, be forgiving and continue -- don't pass rc2 to rc here. */ 1554 } 1555 1556 if (pStreamCfg) 1557 { 1558 RTMemFree(pStreamCfg); 1559 pStreamCfg = NULL; 1560 } 1581 int rc2 = ichac97MixerAddDrvStream(pThis, pMixSink, pCfg, pDrv); 1582 if (RT_SUCCESS(rc)) 1583 rc = rc2; 1561 1584 } 1562 1585 … … 1566 1589 1567 1590 /** 1568 * Removes specific audio streams for all drivers.1591 * Removes a driver stream from a specific mixer sink. 1569 1592 * 1570 1593 * @param pThis AC'97 state. … … 1572 1595 * @param enmDir Stream direction to remove. 1573 1596 * @param dstSrc Stream destination / source to remove. 1597 * @param pDrv Driver stream to remove. 1598 */ 1599 static void ichac97MixerRemoveDrvStream(PAC97STATE pThis, PAUDMIXSINK pMixSink, 1600 PDMAUDIODIR enmDir, PDMAUDIODESTSOURCE dstSrc, PAC97DRIVER pDrv) 1601 { 1602 AssertPtrReturnVoid(pThis); 1603 AssertPtrReturnVoid(pMixSink); 1604 1605 PAC97DRIVERSTREAM pDrvStream = ichac97MixerGetDrvStream(pThis, pDrv, enmDir, dstSrc); 1606 if (pDrvStream) 1607 { 1608 if (pDrvStream->pMixStrm) 1609 { 1610 AudioMixerSinkRemoveStream(pMixSink, pDrvStream->pMixStrm); 1611 1612 AudioMixerStreamDestroy(pDrvStream->pMixStrm); 1613 pDrvStream->pMixStrm = NULL; 1614 } 1615 } 1616 } 1617 1618 /** 1619 * Removes all driver streams from a specific mixer sink. 1620 * 1621 * @param pThis AC'97 state. 1622 * @param pMixSink Mixer sink to remove audio streams from. 1623 * @param enmDir Stream direction to remove. 1624 * @param dstSrc Stream destination / source to remove. 1574 1625 */ 1575 1626 static void ichac97MixerRemoveDrvStreams(PAC97STATE pThis, PAUDMIXSINK pMixSink, … … 1581 1632 PAC97DRIVER pDrv; 1582 1633 RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node) 1583 { 1584 PAC97DRIVERSTREAM pDrvStream = ichac97MixerGetDrvStream(pThis, pDrv, enmDir, dstSrc); 1585 if (pDrvStream) 1586 { 1587 if (pDrvStream->pMixStrm) 1588 { 1589 AudioMixerSinkRemoveStream(pMixSink, pDrvStream->pMixStrm); 1590 1591 AudioMixerStreamDestroy(pDrvStream->pMixStrm); 1592 pDrvStream->pMixStrm = NULL; 1593 } 1594 } 1595 } 1634 ichac97MixerRemoveDrvStream(pThis, pMixSink, enmDir, dstSrc, pDrv); 1596 1635 } 1597 1636 … … 1612 1651 LogFunc(("[SD%RU8]\n", pStream->u8SD)); 1613 1652 1614 PDMAUDIOSTREAMCFG streamCfg;1615 RT_ZERO(streamCfg); 1616 1617 PAUDMIXSINK pMixSink = NULL;1653 RT_ZERO(pStream->State.Cfg); 1654 1655 PPDMAUDIOSTREAMCFG pCfg = &pStream->State.Cfg; 1656 PAUDMIXSINK pMixSink = NULL; 1618 1657 1619 1658 switch (pStream->u8SD) … … 1621 1660 case AC97SOUNDSOURCE_PI_INDEX: 1622 1661 { 1623 streamCfg.Props.uHz = ichac97MixerGet(pThis, AC97_PCM_LR_ADC_Rate);1624 streamCfg.enmDir = PDMAUDIODIR_IN;1625 streamCfg.DestSource.Source = PDMAUDIORECSOURCE_LINE;1626 streamCfg.enmLayout = PDMAUDIOSTREAMLAYOUT_NON_INTERLEAVED;1627 1628 RTStrPrintf2( streamCfg.szName, sizeof(streamCfg.szName), "Line-In");1629 1630 pMixSink = pThis->pSinkLineIn;1662 pCfg->Props.uHz = ichac97MixerGet(pThis, AC97_PCM_LR_ADC_Rate); 1663 pCfg->enmDir = PDMAUDIODIR_IN; 1664 pCfg->DestSource.Source = PDMAUDIORECSOURCE_LINE; 1665 pCfg->enmLayout = PDMAUDIOSTREAMLAYOUT_NON_INTERLEAVED; 1666 1667 RTStrPrintf2(pCfg->szName, sizeof(pCfg->szName), "Line-In"); 1668 1669 pMixSink = pThis->pSinkLineIn; 1631 1670 break; 1632 1671 } … … 1634 1673 case AC97SOUNDSOURCE_MC_INDEX: 1635 1674 { 1636 streamCfg.Props.uHz = ichac97MixerGet(pThis, AC97_MIC_ADC_Rate);1637 streamCfg.enmDir = PDMAUDIODIR_IN;1638 streamCfg.DestSource.Source = PDMAUDIORECSOURCE_MIC;1639 streamCfg.enmLayout = PDMAUDIOSTREAMLAYOUT_NON_INTERLEAVED;1640 1641 RTStrPrintf2( streamCfg.szName, sizeof(streamCfg.szName), "Mic-In");1642 1643 pMixSink = pThis->pSinkMicIn;1675 pCfg->Props.uHz = ichac97MixerGet(pThis, AC97_MIC_ADC_Rate); 1676 pCfg->enmDir = PDMAUDIODIR_IN; 1677 pCfg->DestSource.Source = PDMAUDIORECSOURCE_MIC; 1678 pCfg->enmLayout = PDMAUDIOSTREAMLAYOUT_NON_INTERLEAVED; 1679 1680 RTStrPrintf2(pCfg->szName, sizeof(pCfg->szName), "Mic-In"); 1681 1682 pMixSink = pThis->pSinkMicIn; 1644 1683 break; 1645 1684 } … … 1647 1686 case AC97SOUNDSOURCE_PO_INDEX: 1648 1687 { 1649 streamCfg.Props.uHz = ichac97MixerGet(pThis, AC97_PCM_Front_DAC_Rate);1650 streamCfg.enmDir = PDMAUDIODIR_OUT;1651 streamCfg.DestSource.Dest = PDMAUDIOPLAYBACKDEST_FRONT;1652 streamCfg.enmLayout = PDMAUDIOSTREAMLAYOUT_NON_INTERLEAVED;1653 1654 RTStrPrintf2( streamCfg.szName, sizeof(streamCfg.szName), "Output");1655 1656 pMixSink = pThis->pSinkOut;1688 pCfg->Props.uHz = ichac97MixerGet(pThis, AC97_PCM_Front_DAC_Rate); 1689 pCfg->enmDir = PDMAUDIODIR_OUT; 1690 pCfg->DestSource.Dest = PDMAUDIOPLAYBACKDEST_FRONT; 1691 pCfg->enmLayout = PDMAUDIOSTREAMLAYOUT_NON_INTERLEAVED; 1692 1693 RTStrPrintf2(pCfg->szName, sizeof(pCfg->szName), "Output"); 1694 1695 pMixSink = pThis->pSinkOut; 1657 1696 break; 1658 1697 } … … 1665 1704 if (RT_SUCCESS(rc)) 1666 1705 { 1667 ichac97MixerRemoveDrvStreams(pThis, pMixSink, streamCfg.enmDir, streamCfg.DestSource);1668 1669 if ( streamCfg.Props.uHz)1670 { 1671 Assert( streamCfg.enmDir != PDMAUDIODIR_UNKNOWN);1672 1673 streamCfg.Props.cChannels = 2;1674 streamCfg.Props.cBits = 16;1675 streamCfg.Props.fSigned = true;1676 streamCfg.Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(streamCfg.Props.cBits, streamCfg.Props.cChannels);1677 1678 rc = ichac97MixerAddDrvStreams(pThis, pMixSink, &streamCfg);1706 ichac97MixerRemoveDrvStreams(pThis, pMixSink, pCfg->enmDir, pCfg->DestSource); 1707 1708 if (pCfg->Props.uHz) 1709 { 1710 Assert(pCfg->enmDir != PDMAUDIODIR_UNKNOWN); 1711 1712 pCfg->Props.cChannels = 2; 1713 pCfg->Props.cBits = 16; 1714 pCfg->Props.fSigned = true; 1715 pCfg->Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfg->Props.cBits, pCfg->Props.cChannels); 1716 1717 rc = ichac97MixerAddDrvStreams(pThis, pMixSink, pCfg); 1679 1718 } 1680 1719 } … … 3392 3431 * 3393 3432 * @returns VBox status code. 3394 * @param pDevIns The device instance. 3395 * @param pDrv Driver to (re-)use for (re-)attaching to. 3396 * If NULL is specified, a new driver will be created and appended 3397 * to the driver list. 3433 * @param pThis AC'97 state. 3398 3434 * @param uLUN The logical unit which is being detached. 3399 3435 * @param fFlags Flags, combination of the PDMDEVATT_FLAGS_* \#defines. 3400 */ 3401 static DECLCALLBACK(int) ichac97AttachInternal(PPDMDEVINS pDevIns, PAC97DRIVER pDrv, unsigned uLUN, uint32_t fFlags) 3436 * @param ppDrv Attached driver instance on success. Optional. 3437 */ 3438 static int ichac97AttachInternal(PAC97STATE pThis, unsigned uLUN, uint32_t fFlags, PAC97DRIVER *ppDrv) 3402 3439 { 3403 3440 RT_NOREF(fFlags); 3404 PAC97STATE pThis = PDMINS_2_DATA(pDevIns, PAC97STATE);3405 3441 3406 3442 /* … … 3412 3448 3413 3449 PPDMIBASE pDrvBase; 3414 int rc = PDMDevHlpDriverAttach(p DevIns, uLUN,3450 int rc = PDMDevHlpDriverAttach(pThis->pDevInsR3, uLUN, 3415 3451 &pThis->IBase, &pDrvBase, pszDesc); 3416 3452 if (RT_SUCCESS(rc)) 3417 3453 { 3418 if (pDrv == NULL) 3419 pDrv = (PAC97DRIVER)RTMemAllocZ(sizeof(AC97DRIVER)); 3454 PAC97DRIVER pDrv = (PAC97DRIVER)RTMemAllocZ(sizeof(AC97DRIVER)); 3420 3455 if (pDrv) 3421 3456 { … … 3441 3476 pDrv->fAttached = true; 3442 3477 } 3478 3479 if (ppDrv) 3480 *ppDrv = pDrv; 3443 3481 } 3444 3482 else … … 3455 3493 } 3456 3494 3457 LogFunc((" iLUN=%u, fFlags=0x%x, rc=%Rrc\n", uLUN, fFlags, rc));3495 LogFunc(("uLUN=%u, fFlags=0x%x, rc=%Rrc\n", uLUN, fFlags, rc)); 3458 3496 return rc; 3459 3497 } 3460 3498 3461 3462 /** 3463 * Attach command. 3464 * 3465 * This is called to let the device attach to a driver for a specified LUN 3466 * during runtime. This is not called during VM construction, the device 3467 * constructor has to attach to all the available drivers. 3499 /** 3500 * Detach command, internal version. 3501 * 3502 * This is called to let the device detach from a driver for a specified LUN 3503 * during runtime. 3468 3504 * 3469 3505 * @returns VBox status code. 3470 * @param p DevIns The device instance.3471 * @param uLUN The logical unit which is being detached.3506 * @param pThis AC'97 state. 3507 * @param pDrv Driver to detach device from. 3472 3508 * @param fFlags Flags, combination of the PDMDEVATT_FLAGS_* \#defines. 3473 3509 */ 3510 static int ichac97DetachInternal(PAC97STATE pThis, PAC97DRIVER pDrv, uint32_t fFlags) 3511 { 3512 AudioMixerSinkRemoveStream(pThis->pSinkMicIn, pDrv->MicIn.pMixStrm); 3513 AudioMixerStreamDestroy(pDrv->MicIn.pMixStrm); 3514 pDrv->MicIn.pMixStrm = NULL; 3515 3516 AudioMixerSinkRemoveStream(pThis->pSinkLineIn, pDrv->LineIn.pMixStrm); 3517 AudioMixerStreamDestroy(pDrv->LineIn.pMixStrm); 3518 pDrv->LineIn.pMixStrm = NULL; 3519 3520 AudioMixerSinkRemoveStream(pThis->pSinkOut, pDrv->Out.pMixStrm); 3521 AudioMixerStreamDestroy(pDrv->Out.pMixStrm); 3522 pDrv->Out.pMixStrm = NULL; 3523 3524 RTListNodeRemove(&pDrv->Node); 3525 3526 LogFunc(("uLUN=%u, fFlags=0x%x\n", pDrv->uLUN, fFlags)); 3527 return VINF_SUCCESS; 3528 } 3529 3530 /** 3531 * @interface_method_impl{PDMDEVREG,pfnAttach} 3532 */ 3474 3533 static DECLCALLBACK(int) ichac97Attach(PPDMDEVINS pDevIns, unsigned uLUN, uint32_t fFlags) 3475 3534 { 3476 return ichac97AttachInternal(pDevIns, NULL /* pDrv */, uLUN, fFlags); 3477 } 3478 3535 PAC97STATE pThis = PDMINS_2_DATA(pDevIns, PAC97STATE); 3536 3537 LogFunc(("uLUN=%u, fFlags=0x%x\n", uLUN, fFlags)); 3538 3539 DEVAC97_LOCK(pThis); 3540 3541 PAC97DRIVER pDrv; 3542 int rc2 = ichac97AttachInternal(pThis, uLUN, fFlags, &pDrv); 3543 if (RT_SUCCESS(rc2)) 3544 { 3545 PPDMIAUDIOCONNECTOR pCon = pDrv->pConnector; 3546 AssertPtr(pCon); 3547 3548 if (DrvAudioHlpStreamCfgIsValid(&pThis->StreamLineIn.State.Cfg)) 3549 { 3550 rc2 = ichac97MixerAddDrvStream(pThis, pThis->pSinkLineIn, &pThis->StreamLineIn.State.Cfg, pDrv); 3551 AssertRC(rc2); 3552 } 3553 3554 if (DrvAudioHlpStreamCfgIsValid(&pThis->StreamMicIn.State.Cfg)) 3555 { 3556 rc2 = ichac97MixerAddDrvStream(pThis, pThis->pSinkMicIn, &pThis->StreamMicIn.State.Cfg, pDrv); 3557 AssertRC(rc2); 3558 } 3559 3560 if (DrvAudioHlpStreamCfgIsValid(&pThis->StreamOut.State.Cfg)) 3561 { 3562 rc2 = ichac97MixerAddDrvStream(pThis, pThis->pSinkOut, &pThis->StreamOut.State.Cfg, pDrv); 3563 AssertRC(rc2); 3564 } 3565 } 3566 3567 DEVAC97_UNLOCK(pThis); 3568 3569 return VINF_SUCCESS; 3570 } 3571 3572 /** 3573 * @interface_method_impl{PDMDEVREG,pfnDetach} 3574 */ 3479 3575 static DECLCALLBACK(void) ichac97Detach(PPDMDEVINS pDevIns, unsigned uLUN, uint32_t fFlags) 3480 3576 { 3481 RT_NOREF(pDevIns, uLUN, fFlags); 3482 LogFunc(("iLUN=%u, fFlags=0x%x\n", uLUN, fFlags)); 3483 } 3484 3485 /** 3486 * Re-attach. 3577 PAC97STATE pThis = PDMINS_2_DATA(pDevIns, PAC97STATE); 3578 3579 LogFunc(("uLUN=%u, fFlags=0x%x\n", uLUN, fFlags)); 3580 3581 DEVAC97_LOCK(pThis); 3582 3583 PAC97DRIVER pDrv, pDrvNext; 3584 RTListForEachSafe(&pThis->lstDrv, pDrv, pDrvNext, AC97DRIVER, Node) 3585 { 3586 if (pDrv->uLUN == uLUN) 3587 { 3588 int rc2 = ichac97DetachInternal(pThis, pDrv, fFlags); 3589 if (RT_SUCCESS(rc2)) 3590 { 3591 RTMemFree(pDrv); 3592 pDrv = NULL; 3593 } 3594 3595 break; 3596 } 3597 } 3598 3599 DEVAC97_UNLOCK(pThis); 3600 } 3601 3602 /** 3603 * Re-attaches (replaces) a driver with a new driver. 3487 3604 * 3488 3605 * @returns VBox status code. … … 3492 3609 * to the driver list. 3493 3610 * @param uLUN The logical unit which is being re-detached. 3494 * @param pszDriver Driver name.3495 */ 3496 static int ichac97Reattach (PAC97STATE pThis, PAC97DRIVER pDrv, uint8_t uLUN, const char *pszDriver)3611 * @param pszDriver New driver name to attach. 3612 */ 3613 static int ichac97ReattachInternal(PAC97STATE pThis, PAC97DRIVER pDrv, uint8_t uLUN, const char *pszDriver) 3497 3614 { 3498 3615 AssertPtrReturn(pThis, VERR_INVALID_POINTER); 3499 3616 AssertPtrReturn(pszDriver, VERR_INVALID_POINTER); 3617 3618 int rc; 3619 3620 if (pDrv) 3621 { 3622 rc = ichac97DetachInternal(pThis, pDrv, 0 /* fFlags */); 3623 if (RT_SUCCESS(rc)) 3624 rc = PDMDevHlpDriverDetach(pThis->pDevInsR3, PDMIBASE_2_PDMDRV(pDrv->pDrvBase), 0 /* fFlags */); 3625 3626 if (RT_FAILURE(rc)) 3627 return rc; 3628 3629 pDrv = NULL; 3630 } 3500 3631 3501 3632 PVM pVM = PDMDevHlpGetVM(pThis->pDevInsR3); … … 3506 3637 CFGMR3RemoveNode(CFGMR3GetChildF(pDev0, "LUN#%u/", uLUN)); 3507 3638 3508 if (pDrv)3509 {3510 /* Re-use a driver instance => detach the driver before. */3511 int rc = PDMDevHlpDriverDetach(pThis->pDevInsR3, PDMIBASE_2_PDMDRV(pDrv->pDrvBase), 0 /* fFlags */);3512 if (RT_FAILURE(rc))3513 return rc;3514 }3515 3516 3639 #define RC_CHECK() if (RT_FAILURE(rc)) { AssertReleaseRC(rc); break; } 3517 3640 3518 int rc;3519 3641 do 3520 3642 { … … 3534 3656 3535 3657 if (RT_SUCCESS(rc)) 3536 rc = ichac97AttachInternal(pThis ->pDevInsR3, pDrv, uLUN, 0 /* fFlags*/);3658 rc = ichac97AttachInternal(pThis, uLUN, 0 /* fFlags */, NULL /* ppDrv */); 3537 3659 3538 3660 LogFunc(("pThis=%p, uLUN=%u, pszDriver=%s, rc=%Rrc\n", pThis, uLUN, pszDriver, rc)); … … 3683 3805 { 3684 3806 LogFunc(("Trying to attach driver for LUN #%RU8 ...\n", uLUN)); 3685 rc = ichac97AttachInternal(p DevIns, NULL /* pDrv */, uLUN, 0 /* fFlags*/);3807 rc = ichac97AttachInternal(pThis, uLUN, 0 /* fFlags */, NULL /* ppDrv */); 3686 3808 if (RT_FAILURE(rc)) 3687 3809 { … … 3690 3812 else if (rc == VERR_AUDIO_BACKEND_INIT_FAILED) 3691 3813 { 3692 ichac97Reattach (pThis, NULL /* pDrv */, uLUN, "NullAudio");3814 ichac97ReattachInternal(pThis, NULL /* pDrv */, uLUN, "NullAudio"); 3693 3815 PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "HostAudioNotResponding", 3694 3816 N_("Host audio backend initialization has failed. Selecting the NULL audio backend " … … 3755 3877 3756 3878 ichac97Reset(pDevIns); 3757 ichac97Reattach (pThis, pDrv, pDrv->uLUN, "NullAudio");3879 ichac97ReattachInternal(pThis, pDrv, pDrv->uLUN, "NullAudio"); 3758 3880 3759 3881 PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "HostAudioNotResponding",
Note:
See TracChangeset
for help on using the changeset viewer.

