VirtualBox

Ignore:
Timestamp:
Dec 8, 2010 8:27:14 PM (14 years ago)
Author:
vboxsync
Message:

Audio/HDA: cosmetic.

File:
1 edited

Legend:

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

    r34828 r34847  
    3535#include "DevCodec.h"
    3636
    37 #undef LOG_VOICES
    38 #ifndef VBOX
    39 //#define USE_MIXER
     37#define VBOX_WITH_INTEL_HDA
     38
     39#if defined(VBOX_WITH_HP_HDA)
     40/* HP Pavilion dv4t-1300 */
     41# define HDA_PCI_VENDOR_ID 0x103c
     42# define HDA_PCI_DEICE_ID 0x30f7
     43#elif defined(VBOX_WITH_INTEL_HDA)
     44/* Intel HDA controller */
     45# define HDA_PCI_VENDOR_ID 0x8086
     46# define HDA_PCI_DEICE_ID 0x2668
     47#elif defined(VBOX_WITH_NVIDIA_HDA)
     48/* nVidia HDA controller */
     49# define HDA_PCI_VENDOR_ID 0x10de
     50# define HDA_PCI_DEICE_ID 0x0ac0
    4051#else
    41 #define USE_MIXER
     52# error "Please specify your HDA device vendor/device IDs"
    4253#endif
    43 #define VBOX_WITH_INTEL_HDA
    4454
    4555#define HDA_SSM_VERSION 1
     
    6272#define ICH6_HDA_REG_GCAP 0 /* range 0x00-0x01*/
    6373#define GCAP(pState) (HDA_REG((pState), GCAP))
    64 
     74/* GCAP HDASpec 3.3.2 This macro compact following information about HDA
     75 * oss (15:12) - number of output streams supported
     76 * iss (11:8) - number of input streams supported
     77 * bss (7:3) - number of bidirection streams suppoted
     78 * bds (2:1) - number of serial data out signals supported
     79 * b64sup (0) - 64 bit addressing supported.
     80 */
     81#define HDA_MAKE_GCAP(oss, iss, bss, bds, b64sup) \
     82    (  (((oss) & 0xF) << 12)    \
     83     | (((iss) & 0xF) << 8)     \
     84     | (((bss) & 0x1F) << 3)    \
     85     | (((bds) & 0x3) << 2)     \
     86     | ((b64sup) & 1))
    6587#define ICH6_HDA_REG_VMIN 1 /* range 0x02 */
    6688#define VMIN(pState) (HDA_REG((pState), VMIN))
     
    13791401{
    13801402    uint32_t cb2Copy;
    1381 #if 0
    1382     if (u32SoundBackendBufferBytesAvail <= u32Fifos + 1)
    1383     {
    1384         /* Some platform offers buffer not multiplied on SDnFIFOS+1 value
    1385          * so to avoid situation when the rest of the backend buffer is less
    1386          * of SDnFIFOW value, we'll wait for next iteration with fresh buffer.
    1387          */
    1388         return 0;
    1389     }
    1390 #endif
    13911403    /*
    13921404     * Amounts of bytes depends on current position in buffer (u32BdleCviLen-u32BdleCviPos)
     
    14671479    bool fOnBufferEdge = (   *pStreamDesc->pu32Lpib == pStreamDesc->u32Cbl
    14681480                          || pBdle->u32BdleCviPos == pBdle->u32BdleCviLen);
     1481
    14691482    Assert((*pStreamDesc->pu32Lpib <= pStreamDesc->u32Cbl));
     1483
    14701484    if (*pStreamDesc->pu32Lpib == pStreamDesc->u32Cbl)
    14711485        *pStreamDesc->pu32Lpib -= pStreamDesc->u32Cbl;
     
    15171531             */
    15181532            *pStreamDesc->pu32Sts |= HDA_REG_FIELD_FLAG_MASK(SDSTS, BCIS);
     1533
    15191534            /*
    15201535             * we should generate the interrupt if ICE bit of SDCTL register is set.
     
    16611676    HDASTREAMTRANSFERDESC stStreamDesc;
    16621677    uint32_t nBytes;
     1678    switch (src)
     1679    {
     1680        case PO_INDEX:
     1681        {
     1682            u8Strm = 4;
     1683            pBdle = &pState->stOutBdle;
     1684            break;
     1685        }
     1686        case PI_INDEX:
     1687        {
     1688            u8Strm = 0;
     1689            pBdle = &pState->stInBdle;
     1690            break;
     1691        }
     1692        default:
     1693            return;
     1694    }
     1695    hdaInitTransferDescriptor(pState, pBdle, u8Strm, &stStreamDesc);
    16631696    while( avail && !fStop)
    16641697    {
    1665         switch (src)
    1666         {
    1667             case PO_INDEX:
    1668             {
    1669                 u8Strm = 4;
    1670                 pBdle = &pState->stOutBdle;
    1671                 break;
    1672             }
    1673             case PI_INDEX:
    1674             {
    1675                 u8Strm = 0;
    1676                 pBdle = &pState->stInBdle;
    1677                 break;
    1678             }
    1679             default:
    1680                 return;
    1681         }
    1682         hdaInitTransferDescriptor(pState, pBdle, u8Strm, &stStreamDesc);
    16831698        Assert (   (stStreamDesc.u32Ctl & HDA_REG_FIELD_FLAG_MASK(SDCTL, RUN))
    16841699                && avail
     
    17391754    int index = hdaLookup(&pThis->hda, u32Offset);
    17401755    if (pThis->hda.fInReset && index != ICH6_HDA_REG_GCTL)
    1741     {
    17421756        Log(("hda: access to registers except GCTL is blocked while reset\n"));
    1743     }
     1757
    17441758    if (   index == -1
    17451759           || cb > 4)
    1746     {
    17471760        LogRel(("hda: Invalid read access @0x%x(of bytes:%d)\n", u32Offset, cb));
    1748     }
     1761
    17491762    if (index != -1)
    17501763    {
     
    17891802    uint32_t  u32Offset = GCPhysAddr - pThis->hda.addrMMReg;
    17901803    int index = hdaLookup(&pThis->hda, u32Offset);
     1804
    17911805    if (pThis->hda.fInReset && index != ICH6_HDA_REG_GCTL)
    1792     {
    17931806        Log(("hda: access to registers except GCTL is blocked while reset\n"));
    1794     }
     1807
    17951808    if (   index == -1
    17961809           || cb > 4)
    1797     {
    17981810        LogRel(("hda: Invalid write access @0x%x(of bytes:%d)\n", u32Offset, cb));
    1799     }
     1811
    18001812    if (index != -1)
    18011813    {
     
    19241936{
    19251937    PCIINTELHDLinkState *pThis = PDMINS_2_DATA(pDevIns, PCIINTELHDLinkState *);
    1926     GCAP(&pThis->hda) = 0x4401; /* see 6.2.1 */
     1938    GCAP(&pThis->hda) = HDA_MAKE_GCAP(4,4,0,0,1); /* see 6.2.1 */
    19271939    VMIN(&pThis->hda) = 0x00;       /* see 6.2.2 */
    19281940    VMAJ(&pThis->hda) = 0x01;       /* see 6.2.3 */
     
    19511963    pThis->hda.u64BaseTS = PDMDevHlpTMTimeVirtGetNano(pDevIns);
    19521964
    1953 #if 0
    1954     /* According to ICH6 datasheet, 0x40000 is default value for stream descriptor register 23:20
    1955      * bits are reserved for stream number 18.2.33 */
    1956     SDCTL(&pThis->hda, 0) = 0x40000;
    1957     SDCTL(&pThis->hda, 1) = 0x40000;
    1958     SDCTL(&pThis->hda, 2) = 0x40000;
    1959     SDCTL(&pThis->hda, 3) = 0x40000;
    1960     SDCTL(&pThis->hda, 4) = 0x40000;
    1961     SDCTL(&pThis->hda, 5) = 0x40000;
    1962     SDCTL(&pThis->hda, 6) = 0x40000;
    1963     SDCTL(&pThis->hda, 7) = 0x40000;
    1964 
    1965     /* ICH6 defines default values (0x77 for input and 0xBF for output descriptors) of FIFO size. 18.2.39 */
    1966     SDFIFOS(&pThis->hda, 0) = HDA_SDINFIFO_120B;
    1967     SDFIFOS(&pThis->hda, 1) = HDA_SDINFIFO_120B;
    1968     SDFIFOS(&pThis->hda, 2) = HDA_SDINFIFO_120B;
    1969     SDFIFOS(&pThis->hda, 3) = HDA_SDINFIFO_120B;
    1970 
    1971     SDFIFOS(&pThis->hda, 4) = HDA_SDONFIFO_192B;
    1972     SDFIFOS(&pThis->hda, 5) = HDA_SDONFIFO_192B;
    1973     SDFIFOS(&pThis->hda, 6) = HDA_SDONFIFO_192B;
    1974     SDFIFOS(&pThis->hda, 7) = HDA_SDONFIFO_192B;
    1975 
    1976     SDFIFOW(&pThis->hda, 0) = HDA_SDFIFOW_8B;
    1977     SDFIFOW(&pThis->hda, 4) = HDA_SDFIFOW_32B;
    1978 #endif
    19791965    HDABDLEDESC stEmptyBdle;
    19801966    for(uint8_t u8Strm = 0; u8Strm < 8; ++u8Strm)
     
    20492035
    20502036    /* PCI Device (the assertions will be removed later) */
    2051 #if defined(VBOX_WITH_HP_HDA)
    2052     /* Linux kernel has whitelist for MSI-enabled HDA, this card seems to be there. */
    2053     PCIDevSetVendorId           (&pThis->dev, 0x103c); /* HP. */
    2054     PCIDevSetDeviceId           (&pThis->dev, 0x30f7); /* HP Pavilion dv4t-1300 */
    2055 #elif defined(VBOX_WITH_INTEL_HDA)
    2056     PCIDevSetVendorId           (&pThis->dev, 0x8086); /* 00 ro - intel. */
    2057     PCIDevSetDeviceId           (&pThis->dev, 0x2668); /* 02 ro - 82801 / 82801aa(?). */
    2058 #elif defined(VBOX_WITH_NVIDIA_HDA)
    2059     PCIDevSetVendorId           (&pThis->dev, 0x10de); /* nVidia */
    2060     PCIDevSetDeviceId           (&pThis->dev, 0x0ac0); /* HDA */
    2061 #else
    2062 # error "Please specify your HDA device vendor/device IDs"
    2063 #endif
     2037    PCIDevSetVendorId           (&pThis->dev, HDA_PCI_VENDOR_ID); /* nVidia */
     2038    PCIDevSetDeviceId           (&pThis->dev, HDA_PCI_DEICE_ID); /* HDA */
     2039
    20642040    PCIDevSetCommand            (&pThis->dev, 0x0000); /* 04 rw,ro - pcicmd. */
    20652041    PCIDevSetStatus             (&pThis->dev, VBOX_PCI_STATUS_CAP_LIST); /* 06 rwc?,ro? - pcists. */
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