VirtualBox

Changeset 88037 in vbox for trunk/src/VBox/Devices/Storage


Ignore:
Timestamp:
Mar 9, 2021 9:10:52 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
143166
Message:

DevBusLogic: Track last completed command, properly clear mailbox setup on reset, validate PCI ISA I/O arguments (see bugref:5112).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/DevBusLogic.cpp

    r87166 r88037  
    399399    /** Whether the extended LUN CCB format is enabled for 32 possible logical units. */
    400400    bool                            fExtendedLunCCBFormat;
    401     bool                            fAlignment2;
     401    /** Last completed command, for debugging. */
     402    uint8_t                         uPrevCmd;
    402403
    403404    /** Current incoming mailbox position. */
     
    11771178    pThis->regGeometry = BL_GEOM_XLATEN;
    11781179    pThis->uOperationCode = 0xff; /* No command executing. */
     1180    pThis->uPrevCmd = 0xff;
    11791181    pThis->iParameter = 0;
    11801182    pThis->cbCommandParametersLeft = 0;
     
    11851187    pThis->uMailboxIncomingPositionCurrent = 0;
    11861188    pThis->uAhaSigIdx = 0;
     1189    pThis->cMailbox = 0;
     1190    pThis->GCPhysAddrMailboxIncomingBase = 0;
     1191    pThis->GCPhysAddrMailboxOutgoingBase = 0;
    11871192
    11881193    /* Clear any active/pending interrupts. */
     
    12281233    }
    12291234
     1235    pThis->uPrevCmd = pThis->uOperationCode;
    12301236    pThis->uOperationCode = 0xff;
    12311237    pThis->iParameter = 0;
     
    19071913            pReply->JP1 = 1;    /* Closed; "Factory configured - do not alter" */
    19081914            pReply->InformationIsValid = 1;
    1909             pReply->IsaIOPort = pThis->uISABaseCode;
     1915            pReply->IsaIOPort = pThis->uISABaseCode < 6 ? pThis->uISABaseCode : 0xff;
    19101916            pReply->IRQ = PCIDevGetInterruptLine(pDevIns->apPciDevs[0]);
    19111917            pThis->cbReplyParametersLeft = sizeof(ReplyInquirePCIHostAdapterInformation);
     
    19201926        case BUSLOGICCOMMAND_MODIFY_IO_ADDRESS:
    19211927        {
     1928
    19221929            /* Modify the ISA-compatible I/O port base. Note that this technically
    19231930             * violates the PCI spec, as this address is not reported through PCI.
     
    19251932             */
    19261933#ifdef IN_RING3 /* We can do this from ring-0 now, but we'd like to see the LogRel, so we keep going back to ring-3 anyway. */
    1927             Log(("ISA I/O for PCI (code %x)\n", pThis->aCommandBuffer[0]));
    1928             buslogicR3RegisterISARange(pDevIns, pThis, pThis->aCommandBuffer[0]);
     1934            uint8_t baseCode = pThis->aCommandBuffer[0];
     1935
     1936            Log(("ISA I/O for PCI (code %x)\n", baseCode));
    19291937            pThis->cbReplyParametersLeft = 0;
    1930             fSuppressIrq = true;
    1931             fSuppressCMDC = true;
     1938            if (baseCode < 8) {
     1939                buslogicR3RegisterISARange(pDevIns, pThis, baseCode);
     1940                fSuppressIrq = true;
     1941                fSuppressCMDC = true;
     1942            }
     1943            else
     1944            {
     1945                Log(("ISA base %#x not valid for this adapter\n", baseCode));
     1946                pThis->regStatus |= BL_STAT_CMDINV;
     1947            }
    19321948            break;
    19331949#else
     
    38733889        pHlp->pfnPrintf(pHlp, "Current command: %02X\n", pThis->uOperationCode);
    38743890
     3891    /* Print the previous command, if any. */
     3892    if (pThis->uPrevCmd != 0xff )
     3893        pHlp->pfnPrintf(pHlp, "Last completed command: %02X\n", pThis->uPrevCmd);
     3894
    38753895    if (fVerbose && (pThis->regStatus & BL_STAT_INREQ) == 0)
    38763896    {
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