VirtualBox

Changeset 33881 in vbox for trunk/src/VBox/Devices/Audio


Ignore:
Timestamp:
Nov 9, 2010 8:08:18 AM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
67529
Message:

Audio/HDA: clean up of Immediate Command processing.

File:
1 edited

Legend:

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

    r33880 r33881  
    433433DECLCALLBACK(int)hdaRegWriteRIRBSTS(INTELHDLinkState* pState, uint32_t offset, uint32_t index, uint32_t u32Value);
    434434DECLCALLBACK(int)hdaRegWriteIRS(INTELHDLinkState* pState, uint32_t offset, uint32_t index, uint32_t u32Value);
     435DECLCALLBACK(int)hdaRegReadIRS(INTELHDLinkState* pState, uint32_t offset, uint32_t index, uint32_t *pu32Value);
    435436DECLCALLBACK(int)hdaRegWriteSDCTL(INTELHDLinkState* pState, uint32_t offset, uint32_t index, uint32_t u32Value);
    436437DECLCALLBACK(int)hdaRegReadSDCTL(INTELHDLinkState* pState, uint32_t offset, uint32_t index, uint32_t *pu32Value);
     
    506507    { 0x00060, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteU32          , "IC"        , "Immediate Command" },
    507508    { 0x00064, 0x00004, 0x00000000, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteUnimplemented, "IR"        , "Immediate Response" },
    508     { 0x00068, 0x00004, 0x00000002, 0x00000002, hdaRegReadU16          , hdaRegWriteIRS          , "IRS"       , "Immediate Command Status" },
     509    { 0x00068, 0x00004, 0x00000002, 0x00000002, hdaRegReadIRS          , hdaRegWriteIRS          , "IRS"       , "Immediate Command Status" },
    509510    { 0x00070, 0x00004, 0xFFFFFFFF, 0xFFFFFF81, hdaRegReadU32          , hdaRegWriteBase         , "DPLBASE"   , "DMA Position Lower Base" },
    510511    { 0x00074, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteBase         , "DPUBASE"   , "DMA Position Upper Base" },
     
    10571058}
    10581059
     1060DECLCALLBACK(int)hdaRegReadIRS(INTELHDLinkState* pState, uint32_t offset, uint32_t index, uint32_t *pu32Value)
     1061{
     1062    int rc = VINF_SUCCESS;
     1063    /* regarding 3.4.3 we should mark IRS as busy in case CORB is active */
     1064    if (   CORBWP(pState) != CORBRP(pState)
     1065        || HDA_REG_FLAG_VALUE(pState, CORBCTL, DMA))
     1066        IRS(pState) = HDA_REG_FIELD_FLAG_MASK(IRS, ICB);  /* busy */
     1067
     1068    rc = hdaRegReadU32(pState, offset, index, pu32Value);
     1069    return rc;
     1070}
     1071
    10591072DECLCALLBACK(int)hdaRegWriteIRS(INTELHDLinkState* pState, uint32_t offset, uint32_t index, uint32_t u32Value)
    10601073{
     
    10621075    uint64_t resp;
    10631076    PFNCODECVERBPROCESSOR pfn = (PFNCODECVERBPROCESSOR)NULL;
     1077    /*
     1078     * if guest set ICB bit of IRS register HDA should process verb in IC register and
     1079     * writes response in IR register and set IRV (valid in case of success) bit of IRS register.
     1080     */
    10641081    if (   u32Value & HDA_REG_FIELD_FLAG_MASK(IRS, ICB)
    10651082        && !IRS_ICB(pState))
    10661083    {
    10671084        uint32_t cmd = IC(pState);
     1085        if (CORBWP(pState) != CORBRP(pState))
     1086        {
     1087            /*
     1088             * 3.4.3 defines behaviour of immediate Command status register.
     1089             */
     1090            LogRel(("hda: guest has tried process immediate verb (%x) with active CORB\n", cmd));
     1091            return rc;
     1092        }
    10681093        IRS(pState) = HDA_REG_FIELD_FLAG_MASK(IRS, ICB);  /* busy */
    10691094        Log(("hda: IC:%x\n", cmd));
     
    10761101        IR(pState) = (uint32_t)resp;
    10771102        Log(("hda: IR:%x\n", IR(pState)));
    1078         IRS(pState) = HDA_REG_FIELD_FLAG_MASK(IRS, IRV);  /* clear busy, result is ready  */
     1103        IRS(pState) = HDA_REG_FIELD_FLAG_MASK(IRS, IRV);  /* result is ready  */
     1104        IRS(pState) &= ~HDA_REG_FIELD_FLAG_MASK(IRS, ICB); /* busy is clear */
    10791105        return rc;
    10801106    }
     1107    /*
     1108     * when guest's read the response it should clean the IRV bit of the IRS register.
     1109     */
    10811110    if (   u32Value & HDA_REG_FIELD_FLAG_MASK(IRS, IRV)
    10821111        && IRS_IRV(pState))
    1083         IRS(pState) ^= HDA_REG_FIELD_FLAG_MASK(IRS, IRV);
     1112        IRS(pState) &= ~HDA_REG_FIELD_FLAG_MASK(IRS, IRV);
    10841113    return rc;
    10851114}
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