Changeset 34847 in vbox for trunk/src/VBox/Devices/Audio/DevIchIntelHDA.cpp
- Timestamp:
- Dec 8, 2010 8:27:14 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevIchIntelHDA.cpp
r34828 r34847 35 35 #include "DevCodec.h" 36 36 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 40 51 #else 41 # define USE_MIXER52 # error "Please specify your HDA device vendor/device IDs" 42 53 #endif 43 #define VBOX_WITH_INTEL_HDA44 54 45 55 #define HDA_SSM_VERSION 1 … … 62 72 #define ICH6_HDA_REG_GCAP 0 /* range 0x00-0x01*/ 63 73 #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)) 65 87 #define ICH6_HDA_REG_VMIN 1 /* range 0x02 */ 66 88 #define VMIN(pState) (HDA_REG((pState), VMIN)) … … 1379 1401 { 1380 1402 uint32_t cb2Copy; 1381 #if 01382 if (u32SoundBackendBufferBytesAvail <= u32Fifos + 1)1383 {1384 /* Some platform offers buffer not multiplied on SDnFIFOS+1 value1385 * so to avoid situation when the rest of the backend buffer is less1386 * of SDnFIFOW value, we'll wait for next iteration with fresh buffer.1387 */1388 return 0;1389 }1390 #endif1391 1403 /* 1392 1404 * Amounts of bytes depends on current position in buffer (u32BdleCviLen-u32BdleCviPos) … … 1467 1479 bool fOnBufferEdge = ( *pStreamDesc->pu32Lpib == pStreamDesc->u32Cbl 1468 1480 || pBdle->u32BdleCviPos == pBdle->u32BdleCviLen); 1481 1469 1482 Assert((*pStreamDesc->pu32Lpib <= pStreamDesc->u32Cbl)); 1483 1470 1484 if (*pStreamDesc->pu32Lpib == pStreamDesc->u32Cbl) 1471 1485 *pStreamDesc->pu32Lpib -= pStreamDesc->u32Cbl; … … 1517 1531 */ 1518 1532 *pStreamDesc->pu32Sts |= HDA_REG_FIELD_FLAG_MASK(SDSTS, BCIS); 1533 1519 1534 /* 1520 1535 * we should generate the interrupt if ICE bit of SDCTL register is set. … … 1661 1676 HDASTREAMTRANSFERDESC stStreamDesc; 1662 1677 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); 1663 1696 while( avail && !fStop) 1664 1697 { 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);1683 1698 Assert ( (stStreamDesc.u32Ctl & HDA_REG_FIELD_FLAG_MASK(SDCTL, RUN)) 1684 1699 && avail … … 1739 1754 int index = hdaLookup(&pThis->hda, u32Offset); 1740 1755 if (pThis->hda.fInReset && index != ICH6_HDA_REG_GCTL) 1741 {1742 1756 Log(("hda: access to registers except GCTL is blocked while reset\n")); 1743 } 1757 1744 1758 if ( index == -1 1745 1759 || cb > 4) 1746 {1747 1760 LogRel(("hda: Invalid read access @0x%x(of bytes:%d)\n", u32Offset, cb)); 1748 } 1761 1749 1762 if (index != -1) 1750 1763 { … … 1789 1802 uint32_t u32Offset = GCPhysAddr - pThis->hda.addrMMReg; 1790 1803 int index = hdaLookup(&pThis->hda, u32Offset); 1804 1791 1805 if (pThis->hda.fInReset && index != ICH6_HDA_REG_GCTL) 1792 {1793 1806 Log(("hda: access to registers except GCTL is blocked while reset\n")); 1794 } 1807 1795 1808 if ( index == -1 1796 1809 || cb > 4) 1797 {1798 1810 LogRel(("hda: Invalid write access @0x%x(of bytes:%d)\n", u32Offset, cb)); 1799 } 1811 1800 1812 if (index != -1) 1801 1813 { … … 1924 1936 { 1925 1937 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 */ 1927 1939 VMIN(&pThis->hda) = 0x00; /* see 6.2.2 */ 1928 1940 VMAJ(&pThis->hda) = 0x01; /* see 6.2.3 */ … … 1951 1963 pThis->hda.u64BaseTS = PDMDevHlpTMTimeVirtGetNano(pDevIns); 1952 1964 1953 #if 01954 /* According to ICH6 datasheet, 0x40000 is default value for stream descriptor register 23:201955 * 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 #endif1979 1965 HDABDLEDESC stEmptyBdle; 1980 1966 for(uint8_t u8Strm = 0; u8Strm < 8; ++u8Strm) … … 2049 2035 2050 2036 /* 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 2064 2040 PCIDevSetCommand (&pThis->dev, 0x0000); /* 04 rw,ro - pcicmd. */ 2065 2041 PCIDevSetStatus (&pThis->dev, VBOX_PCI_STATUS_CAP_LIST); /* 06 rwc?,ro? - pcists. */
Note:
See TracChangeset
for help on using the changeset viewer.