VirtualBox

Changeset 88168 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Mar 17, 2021 6:58:41 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
143318
Message:

DevHDA: Fixes and improvements to the 'info hdabdl' output. bugref:9890

File:
1 edited

Legend:

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

    r88164 r88168  
    41774177
    41784178/** Worker for hdaR3DbgInfoBDL. */
    4179 static void hdaR3DbgPrintBDL(PPDMDEVINS pDevIns, PHDASTATE pThis, PCDBGFINFOHLP pHlp, int idxStream)
    4180 {
    4181     const PHDASTREAM pStream = &pThis->aStreams[idxStream];
     4179static void hdaR3DbgPrintBDL(PPDMDEVINS pDevIns, PHDASTATE pThis, PHDASTATER3 pThisCC, PCDBGFINFOHLP pHlp, int idxStream)
     4180{
     4181    const PHDASTREAM   pStream     = &pThis->aStreams[idxStream];
     4182    const PHDASTREAMR3 pStreamR3   = &pThisCC->aStreams[idxStream];
     4183    PCPDMAUDIOPCMPROPS pGuestProps = &pStreamR3->State.Mapping.GuestProps;
    41824184
    41834185    uint64_t const u64BaseDMA = RT_MAKE_U64(HDA_STREAM_REG(pThis, BDPL, idxStream),
     
    42104212        if (bd.fFlags & ~HDA_BDLE_F_IOC)
    42114213            RTStrPrintf(szFlags, sizeof(szFlags), " !!fFlags=%#x!!\n", bd.fFlags);
    4212         pHlp->pfnPrintf(pHlp, "    %sBDLE%03u: %s%#011RX64 LB %#06x %s%s\n", idxCurBdle == i ? "=>" : "  ", i, "%%", bd.u64BufAddr,
    4213                         bd.u32BufSize, bd.fFlags & HDA_BDLE_F_IOC ? " IOC=1" : "", szFlags);
     4214        pHlp->pfnPrintf(pHlp, "    %sBDLE%03u: %s%#011RX64 LB %#06x (%RU64 us) %s%s\n", idxCurBdle == i ? "=>" : "  ", i, "%%",
     4215                        bd.u64BufAddr, bd.u32BufSize, PDMAudioPropsBytesToMicro(pGuestProps, bd.u32BufSize),
     4216                        bd.fFlags & HDA_BDLE_F_IOC ? " IOC=1" : "", szFlags);
    42144217
    42154218        if (memcmp(&bd, &pStream->State.aBdl[i], sizeof(bd)) != 0)
     
    42244227        cbTotal += bd.u32BufSize;
    42254228    }
    4226     pHlp->pfnPrintf(pHlp, "  Total: %#RX64 bytes (%RU64)\n", cbTotal, cbTotal);
     4229    pHlp->pfnPrintf(pHlp, "  Total: %#RX64 bytes (%RU64), %u ms\n", cbTotal, cbTotal,
     4230                    PDMAudioPropsBytesToMilli(&pStreamR3->State.Mapping.GuestProps, (uint32_t)cbTotal));
    42274231    if (cbTotal != u32CBL)
    42284232        pHlp->pfnPrintf(pHlp, "  Warning: %#RX64 bytes does not match CBL (%#RX64)!\n", cbTotal, u32CBL);
     
    42414245                        pStream->State.aSchedule[i].cPeriodTicks, pStream->State.aSchedule[i].idxFirst,
    42424246                        pStream->State.aSchedule[i].idxFirst + pStream->State.aSchedule[i].cEntries - 1);
    4243 
    4244     /*
    4245      * DMA counters:
    4246      */
    4247     uint64_t const uDPBase = pThis->u64DPBase & DPBASE_ADDR_MASK;
    4248     pHlp->pfnPrintf(pHlp, "  DMA counters %#011RX64 LB %#x, %s:\n", uDPBase, u16LVI * 2 * sizeof(uint32_t),
    4249                     pThis->fDMAPosition ? "enabled" : "disabled");
    4250     if (uDPBase)
    4251         for (uint16_t i = 0; i < u16LVI + 1; i++)
    4252         {
    4253             struct
    4254             {
    4255                 uint32_t uPos;
    4256                 uint32_t uReserved;
    4257             } Buf = { 0 , 0 };
    4258             PDMDevHlpPCIPhysRead(pDevIns, uDPBase + i * sizeof(Buf), &Buf, sizeof(Buf));
    4259 
    4260             char szReserved[64];
    4261             szReserved[0] = '\0';
    4262             if (Buf.uReserved != 0)
    4263                 RTStrPrintf(szReserved, sizeof(szReserved), " reserved=%#x", Buf.uReserved);
    4264             pHlp->pfnPrintf(pHlp, "    #%03d DMA @ %#x%s\n", i, Buf.uPos, szReserved);
    4265         }
    4266     else
    4267         pHlp->pfnPrintf(pHlp, "    No counters.\n");
    42684247}
    42694248
     
    43024281{
    43034282    PHDASTATE   pThis     = PDMDEVINS_2_DATA(pDevIns, PHDASTATE);
     4283    PHDASTATER3 pThisCC   = PDMDEVINS_2_DATA_CC(pDevIns, PHDASTATER3);
    43044284    int         idxStream = hdaR3DbgLookupStrmIdx(pHlp, pszArgs);
    43054285    if (idxStream != -1)
    4306         hdaR3DbgPrintBDL(pDevIns, pThis, pHlp, idxStream);
     4286        hdaR3DbgPrintBDL(pDevIns, pThis, pThisCC, pHlp, idxStream);
    43074287    else
     4288    {
    43084289        for (idxStream = 0; idxStream < HDA_MAX_STREAMS; ++idxStream)
    4309             hdaR3DbgPrintBDL(pDevIns, pThis, pHlp, idxStream);
     4290            hdaR3DbgPrintBDL(pDevIns, pThis, pThisCC, pHlp, idxStream);
     4291        idxStream = -1;
     4292    }
     4293
     4294    /*
     4295     * DMA stream positions:
     4296     */
     4297    uint64_t const uDPBase = pThis->u64DPBase & DPBASE_ADDR_MASK;
     4298    pHlp->pfnPrintf(pHlp, "DMA counters %#011RX64 LB %#x, %s:\n", uDPBase, HDA_MAX_STREAMS * 2 * sizeof(uint32_t),
     4299                    pThis->fDMAPosition ? "enabled" : "disabled");
     4300    if (uDPBase)
     4301    {
     4302        struct
     4303        {
     4304            uint32_t off, uReserved;
     4305        } aPositions[HDA_MAX_STREAMS];
     4306        RT_ZERO(aPositions);
     4307        PDMDevHlpPCIPhysRead(pDevIns, uDPBase , &aPositions[0], sizeof(aPositions));
     4308
     4309        for (unsigned i = 0; i < RT_ELEMENTS(aPositions); i++)
     4310            if (idxStream == -1 || i == (unsigned)idxStream) /* lazy bird */
     4311            {
     4312                char szReserved[64];
     4313                szReserved[0] = '\0';
     4314                if (aPositions[i].uReserved != 0)
     4315                    RTStrPrintf(szReserved, sizeof(szReserved), " reserved=%#x", aPositions[i].uReserved);
     4316                pHlp->pfnPrintf(pHlp, "  Stream #%u DMA @ %#x%s\n", i, aPositions[i].off, szReserved);
     4317            }
     4318    }
    43104319}
    43114320
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette