Changeset 89687 in vbox for trunk/src/VBox/Devices/Audio
- Timestamp:
- Jun 14, 2021 4:11:37 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 145135
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
r89681 r89687 1885 1885 * up to and we cannot really make much of a plan out of it. 1886 1886 */ 1887 /** @todo This is wrong! The valid range is CVI thru LVI. However, CVI is 1888 * typically reset to zero, I guess... */ 1887 1889 AC97BDLE aBdl[AC97_MAX_BDLE]; 1888 1890 RT_ZERO(aBdl); … … 2869 2871 * Last Valid Index Register + 2870 2872 * Status Register */ 2871 *pu32 = pRegs->civ | ( pRegs->lvi << 8) | (pRegs->sr << 16); /** @todo r=andy Use RT_MAKE_U32_FROM_U8. */2873 *pu32 = pRegs->civ | ((uint32_t)pRegs->lvi << 8) | ((uint32_t)pRegs->sr << 16); 2872 2874 Log3Func(("CIV LVI SR[%d] -> %#x, %#x, %#x\n", 2873 2875 AC97_PORT2IDX(offPort), pRegs->civ, pRegs->lvi, pRegs->sr)); … … 2877 2879 * Prefetched Index Value Register + 2878 2880 * Control Register */ 2879 *pu32 = pRegs->picb | ( pRegs->piv << 16) | (pRegs->cr << 24); /** @todo r=andy Use RT_MAKE_U32_FROM_U8. */2881 *pu32 = pRegs->picb | ((uint32_t)pRegs->piv << 16) | ((uint32_t)pRegs->cr << 24); 2880 2882 Log3Func(("PICB PIV CR[%d] -> %#x %#x %#x %#x\n", 2881 2883 AC97_PORT2IDX(offPort), *pu32, pRegs->picb, pRegs->piv, pRegs->cr)); … … 2990 2992 && (pRegs->sr & AC97_SR_DCH)) 2991 2993 { 2992 #ifdef IN_RING3 2994 #ifdef IN_RING3 /** @todo r=bird: What kind of unexplained non-sense is this ifdef?!? */ 2993 2995 pRegs->sr &= ~(AC97_SR_DCH | AC97_SR_CELV); 2994 2996 pRegs->civ = pRegs->piv; … … 3088 3090 case AC97_NABM_OFF_BDBAR: 3089 3091 /* Buffer Descriptor list Base Address Register */ 3090 pRegs->bdbar = u32 & ~ 3;3092 pRegs->bdbar = u32 & ~(uint32_t)3; 3091 3093 Log3Func(("[SD%RU8] BDBAR <- %#x (bdbar %#x)\n", AC97_PORT2IDX(offPort), u32, pRegs->bdbar)); 3092 3094 break; … … 3637 3639 PCDBGFINFOHLP pHlp, const char *pszPrefix) 3638 3640 { 3639 unsigned const cEntries = pStream->Regs.lvi + 1; 3640 pHlp->pfnPrintf(pHlp, "%sBDL for stream #%u: @ %#RX32 L %#x:\n", pszPrefix, pStream->u8SD, pStream->Regs.bdbar, cEntries); 3641 uint8_t const bLvi = pStream->Regs.lvi; 3642 uint8_t const bCiv = pStream->Regs.civ; 3643 pHlp->pfnPrintf(pHlp, "%sBDL for stream #%u: @ %#RX32 LB 0x100; CIV=%#04x LVI=%#04x:\n", 3644 pszPrefix, pStream->u8SD, pStream->Regs.bdbar, bCiv, bLvi); 3641 3645 if (pStream->Regs.bdbar != 0) 3642 3646 { 3643 3647 /* Read all in one go. */ 3644 AssertCompile(sizeof(pStream->Regs.lvi) == sizeof(uint8_t)); 3645 AC97BDLE aBdl[256]; 3648 AC97BDLE aBdl[AC97_MAX_BDLE]; 3646 3649 RT_ZERO(aBdl); 3647 PDMDevHlpPCIPhysRead(pDevIns, pStream->Regs.bdbar, aBdl, sizeof(aBdl [0]) * cEntries);3650 PDMDevHlpPCIPhysRead(pDevIns, pStream->Regs.bdbar, aBdl, sizeof(aBdl)); 3648 3651 3649 3652 /* Get the audio props for the stream so we can translate the sizes correctly. */ … … 3653 3656 /* Dump them. */ 3654 3657 uint64_t cbTotal = 0; 3655 for (unsigned i = 0; i < cEntries; i++) 3658 uint64_t cbValid = 0; 3659 for (unsigned i = 0; i < RT_ELEMENTS(aBdl); i++) 3656 3660 { 3657 3661 aBdl[i].addr = RT_LE2H_U32(aBdl[i].addr); 3658 3662 aBdl[i].ctl_len = RT_LE2H_U32(aBdl[i].ctl_len); 3659 3663 3664 bool const fValid = bCiv <= bLvi 3665 ? i >= bCiv && i <= bLvi 3666 : (i >= bCiv && i < RT_ELEMENTS(aBdl)) || i <= bLvi; 3667 3660 3668 uint32_t const cb = (aBdl[i].ctl_len & AC97_BD_LEN_MASK) * PDMAudioPropsSampleSize(&Props); /** @todo or frame size? OSDev says frame... */ 3661 3669 cbTotal += cb; 3670 if (fValid) 3671 cbValid += cb; 3662 3672 3663 3673 char szFlags[64]; … … 3666 3676 RTStrPrintf(szFlags, sizeof(szFlags), " !!fFlags=%#x!!\n", aBdl[i].ctl_len & ~AC97_BD_LEN_MASK); 3667 3677 3668 pHlp->pfnPrintf(pHlp, "%s BDLE%02u: %#010RX32 L %#06x / LB %#RX32 / %RU64ms%s%s%s%s\n", pszPrefix, i, aBdl[i].addr, 3678 pHlp->pfnPrintf(pHlp, "%s %cBDLE%02u: %#010RX32 L %#06x / LB %#RX32 / %RU64ms%s%s%s%s\n", 3679 pszPrefix, fValid ? ' ' : '?', i, aBdl[i].addr, 3669 3680 aBdl[i].ctl_len & AC97_BD_LEN_MASK, cb, PDMAudioPropsBytesToMilli(&Props, cb), 3670 3681 aBdl[i].ctl_len & AC97_BD_IOC ? " ioc" : "", … … 3673 3684 } 3674 3685 3675 pHlp->pfnPrintf(pHlp, "%sTotal: %#RX64 bytes (%RU64), %RU64 ms\n", pszPrefix, cbTotal, cbTotal, 3676 PDMAudioPropsBytesToMilli(&Props, cbTotal)); 3686 pHlp->pfnPrintf(pHlp, "%sTotal: %#RX64 bytes (%RU64), %RU64 ms; Valid: %#RX64 bytes (%RU64), %RU64 ms\n", pszPrefix, 3687 cbTotal, cbTotal, PDMAudioPropsBytesToMilli(&Props, cbTotal), 3688 cbValid, cbValid, PDMAudioPropsBytesToMilli(&Props, cbValid) ); 3677 3689 } 3678 3690 }
Note:
See TracChangeset
for help on using the changeset viewer.