VirtualBox

Changeset 90149 in vbox


Ignore:
Timestamp:
Jul 10, 2021 1:18:11 AM (4 years ago)
Author:
vboxsync
Message:

DevHda: Added config value 'DeviceName' to allow specifying other device/vendor IDs than the default. bugref:9890

File:
1 edited

Legend:

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

    r90147 r90149  
    47464746                                  "|BufSizeOutMs"
    47474747                                  "|DebugEnabled"
    4748                                   "|DebugPathOut",
     4748                                  "|DebugPathOut"
     4749                                  "|DeviceName",
    47494750                                  "");
    47504751
     
    47814782        LogRel2(("HDA: Debug output will be saved to '%s'\n", pThisCC->Dbg.pszOutPath));
    47824783
     4784    /** @devcfgm{hda,DeviceName,string}
     4785     * Override the default device/vendor IDs for the emulated device:
     4786     *      - "" - default
     4787     *      - "Intel ICH6"
     4788     *      - "Intel Sunrise Point" - great for macOS 10.15
     4789     */
     4790    char szDeviceName[32];
     4791    rc = pHlp->pfnCFGMQueryStringDef(pCfg, "DeviceName", szDeviceName, sizeof(szDeviceName), "");
     4792    if (RT_FAILURE(rc))
     4793        return PDMDEV_SET_ERROR(pDevIns, rc, N_("HDA configuration error: failed to read 'DeviceName' name string"));
     4794    enum
     4795    {
     4796        kDevice_Default,
     4797        kDevice_IntelIch6,
     4798        kDevice_IntelSunrisePoint /*skylake timeframe*/
     4799    } enmDevice;
     4800    if (strcmp(szDeviceName, "") == 0)
     4801        enmDevice = kDevice_Default;
     4802    else if (strcmp(szDeviceName, "Intel ICH6") == 0)
     4803        enmDevice = kDevice_IntelIch6;
     4804    else if (strcmp(szDeviceName, "Intel Sunrise Point") == 0)
     4805        enmDevice = kDevice_IntelSunrisePoint;
     4806    else
     4807        return  PDMDevHlpVMSetError(pDevIns, VERR_INVALID_PARAMETER, RT_SRC_POS,
     4808                                    N_("HDA configuration error: Unknown 'DeviceName' name '%s'"), szDeviceName);
     4809
    47834810    /*
    47844811     * Use our own critical section for the device instead of the default
     
    48034830    PDMPCIDEV_ASSERT_VALID(pDevIns, pPciDev);
    48044831
    4805     PDMPciDevSetVendorId(      pPciDev, HDA_PCI_VENDOR_ID); /* nVidia */
    4806     PDMPciDevSetDeviceId(      pPciDev, HDA_PCI_DEVICE_ID); /* HDA */
     4832    switch (enmDevice)
     4833    {
     4834        case kDevice_Default:
     4835            PDMPciDevSetVendorId(pPciDev, HDA_PCI_VENDOR_ID);
     4836            PDMPciDevSetDeviceId(pPciDev, HDA_PCI_DEVICE_ID);
     4837            break;
     4838        case kDevice_IntelIch6: /* Our default intel device. */
     4839            PDMPciDevSetVendorId(pPciDev, 0x8086);
     4840            PDMPciDevSetDeviceId(pPciDev, 0x2668);
     4841            break;
     4842        case kDevice_IntelSunrisePoint: /* this is supported by more recent macOS version, at least 10.15 */
     4843            PDMPciDevSetVendorId(pPciDev, 0x8086);
     4844            PDMPciDevSetDeviceId(pPciDev, 0x9d70);
     4845            break;
     4846    }
    48074847
    48084848    PDMPciDevSetCommand(       pPciDev, 0x0000); /* 04 rw,ro - pcicmd. */
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