VirtualBox

Changeset 67919 in vbox


Ignore:
Timestamp:
Jul 12, 2017 9:34:17 AM (7 years ago)
Author:
vboxsync
Message:

BusLogic: Cleaned up command handling, implemented a few todos.

File:
1 edited

Legend:

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

    r67917 r67919  
    383383    /** Flag whether IRQs are enabled. */
    384384    bool                            fIRQEnabled;
    385     /** Flag whether the ISA I/O port range is disabled
    386      * to prevent the BIOS to access the device. */
    387     bool                            fISAEnabled;    /**< @todo unused, to be removed */
    388385    /** Flag whether 24-bit mailboxes are in use (default is 32-bit). */
    389386    bool                            fMbxIs24Bit;
    390387    /** ISA I/O port base (encoded in FW-compatible format). */
    391388    uint8_t                         uISABaseCode;
     389    uint8_t                         Alignment00;
    392390
    393391    /** ISA I/O port base (disabled if zero). */
     
    18721870        {
    18731871            /* The reply length is set by the guest and is found in the first byte of the command buffer. */
     1872            if (pBusLogic->aCommandBuffer[0] > sizeof(pBusLogic->aReplyBuffer))
     1873            {
     1874                Log(("Requested too much adapter model number data (%u)!\n", pBusLogic->aCommandBuffer[0]));
     1875                pBusLogic->regStatus |= BL_STAT_CMDINV;
     1876                break;
     1877            }
    18741878            pBusLogic->cbReplyParametersLeft = pBusLogic->aCommandBuffer[0];
    1875             memset(pBusLogic->aReplyBuffer, 0, pBusLogic->cbReplyParametersLeft);
     1879            memset(pBusLogic->aReplyBuffer, 0, sizeof(pBusLogic->aReplyBuffer));
    18761880            const char aModelName[] = "958D ";  /* Trailing \0 is fine, that's the filler anyway. */
    18771881            int cCharsToTransfer =   pBusLogic->cbReplyParametersLeft <= sizeof(aModelName)
     
    19711975            PRequestInitMbx pRequest = (PRequestInitMbx)pBusLogic->aCommandBuffer;
    19721976
    1973             ///@todo: Command should fail if requested no. of mailbox entries is zero
     1977            pBusLogic->cbReplyParametersLeft = 0;
     1978            if (!pRequest->cMailbox)
     1979            {
     1980                Log(("cMailboxes=%u (24-bit mode), fail!\n", pBusLogic->cMailbox));
     1981                pBusLogic->regStatus |= BL_STAT_CMDINV;
     1982                break;
     1983            }
    19741984            pBusLogic->fMbxIs24Bit = true;
    19751985            pBusLogic->cMailbox = pRequest->cMailbox;
     
    19841994
    19851995            pBusLogic->regStatus &= ~BL_STAT_INREQ;
     1996            break;
     1997        }
     1998        case BUSLOGICCOMMAND_INITIALIZE_EXTENDED_MAILBOX:
     1999        {
     2000            PRequestInitializeExtendedMailbox pRequest = (PRequestInitializeExtendedMailbox)pBusLogic->aCommandBuffer;
     2001
    19862002            pBusLogic->cbReplyParametersLeft = 0;
    1987             break;
    1988         }
    1989         case BUSLOGICCOMMAND_INITIALIZE_EXTENDED_MAILBOX:
    1990         {
    1991             PRequestInitializeExtendedMailbox pRequest = (PRequestInitializeExtendedMailbox)pBusLogic->aCommandBuffer;
    1992 
    1993             ///@todo: Command should fail if requested no. of mailbox entries is zero
     2003            if (!pRequest->cMailbox)
     2004            {
     2005                Log(("cMailboxes=%u (32-bit mode), fail!\n", pBusLogic->cMailbox));
     2006                pBusLogic->regStatus |= BL_STAT_CMDINV;
     2007                break;
     2008            }
    19942009            pBusLogic->fMbxIs24Bit = false;
    19952010            pBusLogic->cMailbox = pRequest->cMailbox;
     
    20042019
    20052020            pBusLogic->regStatus &= ~BL_STAT_INREQ;
    2006             pBusLogic->cbReplyParametersLeft = 0;
    20072021            break;
    20082022        }
     
    20712085        case BUSLOGICCOMMAND_INQUIRE_SYNCHRONOUS_PERIOD:
    20722086        {
     2087            if (pBusLogic->aCommandBuffer[0] > sizeof(pBusLogic->aReplyBuffer))
     2088            {
     2089                Log(("Requested too much synch period inquiry (%u)!\n", pBusLogic->aCommandBuffer[0]));
     2090                pBusLogic->regStatus |= BL_STAT_CMDINV;
     2091                break;
     2092            }
    20732093            pBusLogic->cbReplyParametersLeft = pBusLogic->aCommandBuffer[0];
    2074 
    20752094            for (uint8_t i = 0; i < pBusLogic->cbReplyParametersLeft; i++)
    20762095                pBusLogic->aReplyBuffer[i] = 0; /** @todo Figure if we need something other here. It's not needed for the linux driver */
     
    20802099        case BUSLOGICCOMMAND_DISABLE_HOST_ADAPTER_INTERRUPT:
    20812100        {
     2101            pBusLogic->cbReplyParametersLeft = 0;
    20822102            if (pBusLogic->aCommandBuffer[0] == 0)
    20832103                pBusLogic->fIRQEnabled = false;
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