VirtualBox

Changeset 88906 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 6, 2021 2:24:47 PM (4 years ago)
Author:
vboxsync
Message:

Audio/Dev*: Overhauled the attach/detach code a little, making attach fail if the configured driver doesn't have a PDMIADUIOCONNECTOR interface among other things. [more] bugref:9890

Location:
trunk/src/VBox/Devices/Audio
Files:
2 edited

Legend:

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

    r88905 r88906  
    39213921
    39223922/**
    3923  * Attach command, internal version.
    3924  *
    3925  * This is called to let the device attach to a driver for a specified LUN
    3926  * during runtime. This is not called during VM construction, the device
    3927  * constructor has to attach to all the available drivers.
     3923 * Worker for ichac97R3Construct() and ichac97R3Attach().
    39283924 *
    39293925 * @returns VBox status code.
     
    39313927 * @param   pThisCC     The ring-3 AC'97 device state.
    39323928 * @param   iLun        The logical unit which is being attached.
    3933  * @param   fFlags      Flags, combination of the PDMDEVATT_FLAGS_* \#defines.
    39343929 * @param   ppDrv       Attached driver instance on success. Optional.
    39353930 */
    3936 static int ichac97R3AttachInternal(PPDMDEVINS pDevIns, PAC97STATER3 pThisCC, unsigned iLun, uint32_t fFlags, PAC97DRIVER *ppDrv)
    3937 {
    3938     RT_NOREF(fFlags);
    3939 
     3931static int ichac97R3AttachInternal(PPDMDEVINS pDevIns, PAC97STATER3 pThisCC, unsigned iLun, PAC97DRIVER *ppDrv)
     3932{
    39403933    /*
    39413934     * Attach driver.
     
    39773970                if (ppDrv)
    39783971                    *ppDrv = pDrv;
    3979                 LogFunc(("iLun=%u, fFlags=0x%x: VINF_SUCCESS\n", iLun, fFlags));
     3972                LogFunc(("LUN#%u: VINF_SUCCESS\n", iLun));
    39803973                return VINF_SUCCESS;
    39813974            }
     
    39923985
    39933986    RTStrFree(pszDesc);
    3994     LogFunc(("iLun=%u, fFlags=0x%x: rc=%Rrc\n", iLun, fFlags, rc));
     3987    LogFunc(("LUN#%u: rc=%Rrc\n", iLun, rc));
    39953988    return rc;
    39963989}
     
    40033996    PAC97STATE   pThis   = PDMDEVINS_2_DATA(pDevIns, PAC97STATE);
    40043997    PAC97STATER3 pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PAC97STATER3);
    4005 
    4006     LogFunc(("iLUN=%u, fFlags=0x%x\n", iLUN, fFlags));
     3998    RT_NOREF(fFlags);
     3999    LogFunc(("iLUN=%u, fFlags=%#x\n", iLUN, fFlags));
    40074000
    40084001    DEVAC97_LOCK(pDevIns, pThis);
    40094002
    40104003    PAC97DRIVER pDrv;
    4011     int rc = ichac97R3AttachInternal(pDevIns, pThisCC, iLUN, fFlags, &pDrv);
     4004    int rc = ichac97R3AttachInternal(pDevIns, pThisCC, iLUN, &pDrv);
    40124005    if (RT_SUCCESS(rc))
    40134006    {
     
    42824275        AssertBreak(iLun < UINT8_MAX);
    42834276        LogFunc(("Trying to attach driver for LUN#%u ...\n", iLun));
    4284         rc = ichac97R3AttachInternal(pDevIns, pThisCC, iLun, 0 /* fFlags */, NULL /* ppDrv */);
     4277        rc = ichac97R3AttachInternal(pDevIns, pThisCC, iLun, NULL /* ppDrv */);
    42854278        if (rc == VERR_PDM_NO_ATTACHED_DRIVER)
    42864279        {
  • trunk/src/VBox/Devices/Audio/DevSB16.cpp

    r88905 r88906  
    28502850
    28512851/**
    2852  * Attach command, internal version.
    2853  *
    2854  * This is called to let the device attach to a driver for a specified LUN
    2855  * during runtime. This is not called during VM construction, the device
    2856  * constructor has to attach to all the available drivers.
     2852 * Worker for sb16Construct() and sb16Attach().
    28572853 *
    28582854 * @returns VBox status code.
    28592855 * @param   pThis       SB16 state.
    28602856 * @param   uLUN        The logical unit which is being detached.
    2861  * @param   fFlags      Flags, combination of the PDMDEVATT_FLAGS_* \#defines.
    28622857 * @param   ppDrv       Attached driver instance on success. Optional.
    28632858 */
    2864 static int sb16AttachInternal(PSB16STATE pThis, unsigned uLUN, uint32_t fFlags, PSB16DRIVER *ppDrv)
    2865 {
    2866     RT_NOREF(fFlags);
    2867 
     2859static int sb16AttachInternal(PSB16STATE pThis, unsigned uLUN, PSB16DRIVER *ppDrv)
     2860{
    28682861    /*
    28692862     * Allocate a new driver structure and try attach the driver.
     
    29032896            if (ppDrv)
    29042897                *ppDrv = pDrv;
    2905             LogFunc(("iLUN=%u, fFlags=0x%x: VINF_SUCCESS\n", uLUN, fFlags));
     2898            LogFunc(("LUN#%u: VINF_SUCCESS\n", uLUN));
    29062899            return VINF_SUCCESS;
    29072900        }
     
    29142907    RTMemFree(pDrv);
    29152908
    2916     LogFunc(("iLUN=%u, fFlags=0x%x: rc=%Rrc\n", uLUN, fFlags, rc));
     2909    LogFunc(("LUN#%u: rc=%Rrc\n", uLUN, rc));
    29172910    return rc;
    29182911}
     
    29242917{
    29252918    PSB16STATE pThis = PDMDEVINS_2_DATA(pDevIns, PSB16STATE);
    2926 
    2927     LogFunc(("iLUN=%u, fFlags=0x%x\n", iLUN, fFlags));
     2919    RT_NOREF(fFlags);
     2920    LogFunc(("iLUN=%u, fFlags=%#x\n", iLUN, fFlags));
    29282921
    29292922    /** @todo r=andy Any locking required here? */
    29302923
    29312924    PSB16DRIVER pDrv;
    2932     int rc = sb16AttachInternal(pThis, iLUN, fFlags, &pDrv);
     2925    int rc = sb16AttachInternal(pThis, iLUN, &pDrv);
    29332926    if (RT_SUCCESS(rc))
    29342927    {
     
    32633256        AssertBreak(iLun < UINT8_MAX);
    32643257        LogFunc(("Trying to attach driver for LUN#%u ...\n", iLun));
    3265         rc = sb16AttachInternal(pThis, iLun, 0 /* fFlags */, NULL /* ppDrv */);
     3258        rc = sb16AttachInternal(pThis, iLun, NULL /* ppDrv */);
    32663259        if (rc == VERR_PDM_NO_ATTACHED_DRIVER)
    32673260        {
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