VirtualBox

Changeset 48190 in vbox for trunk/src


Ignore:
Timestamp:
Aug 30, 2013 1:37:42 PM (11 years ago)
Author:
vboxsync
Message:

BusLogic: Allow larger parameters, handle dummy mailbox abort.

File:
1 edited

Legend:

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

    r46601 r48190  
    5252
    5353/** Size of the command buffer. */
    54 #define BUSLOGIC_COMMAND_SIZE_MAX 5
     54#define BUSLOGIC_COMMAND_SIZE_MAX 64
    5555
    5656/** Size of the reply buffer. */
     
    6565
    6666/** State saved version. */
    67 #define BUSLOGIC_SAVED_STATE_MINOR_VERSION 3
     67#define BUSLOGIC_SAVED_STATE_MINOR_VERSION 4
    6868
    6969/** Saved state version before the suspend on error feature was implemented. */
     
    7171/** Saved state version before 24-bit mailbox support was implemented. */
    7272#define BUSLOGIC_SAVED_STATE_MINOR_PRE_24BIT_MBOX     2
     73/** Saved state version before command buffer size was raised. */
     74#define BUSLOGIC_SAVED_STATE_MINOR_PRE_CMDBUF_RESIZE  3
     75
     76/** Command buffer size in old saved states. */
     77#define BUSLOGIC_COMMAND_SIZE_OLD 5
    7378
    7479/** The duration of software-initiated reset (in nano seconds).
     
    11801185    int rc = PDMCritSectEnter(&pBusLogic->CritSectIntr, VINF_SUCCESS);
    11811186    AssertRC(rc);
    1182     RTGCPHYS GCPhysAddrCCB = pTaskState->MailboxGuest.u32PhysAddrCCB;
     1187
    11831188    RTGCPHYS GCPhysAddrMailboxIncoming = pBusLogic->GCPhysAddrMailboxIncomingBase
    11841189                                       + (   pBusLogic->uMailboxIncomingPositionCurrent
    11851190                                          * (pTaskState->fIs24Bit ? sizeof(Mailbox24) : sizeof(Mailbox32)) );
    1186     LogFlowFunc(("Completing CCB %RGp hstat=%u, dstat=%u, outgoing mailbox at %RGp\n", GCPhysAddrCCB,
    1187                  uHostAdapterStatus, uDeviceStatus, GCPhysAddrMailboxIncoming));
    1188 
    1189     /* Update CCB. */
    1190     pTaskState->CommandControlBlockGuest.c.uHostAdapterStatus = uHostAdapterStatus;
    1191     pTaskState->CommandControlBlockGuest.c.uDeviceStatus      = uDeviceStatus;
    1192     /* Rewrite CCB up to the CDB; perhaps more than necessary. */
    1193     PDMDevHlpPCIPhysWrite(pBusLogic->CTX_SUFF(pDevIns), GCPhysAddrCCB,
    1194                           &pTaskState->CommandControlBlockGuest, RT_OFFSETOF(CCBC, abCDB));
     1191
     1192    if (uMailboxCompletionCode != BUSLOGIC_MAILBOX_INCOMING_COMPLETION_ABORTED_NOT_FOUND)
     1193    {
     1194        RTGCPHYS GCPhysAddrCCB = pTaskState->MailboxGuest.u32PhysAddrCCB;
     1195        LogFlowFunc(("Completing CCB %RGp hstat=%u, dstat=%u, outgoing mailbox at %RGp\n", GCPhysAddrCCB,
     1196                     uHostAdapterStatus, uDeviceStatus, GCPhysAddrMailboxIncoming));
     1197
     1198        /* Update CCB. */
     1199        pTaskState->CommandControlBlockGuest.c.uHostAdapterStatus = uHostAdapterStatus;
     1200        pTaskState->CommandControlBlockGuest.c.uDeviceStatus      = uDeviceStatus;
     1201        /* Rewrite CCB up to the CDB; perhaps more than necessary. */
     1202        PDMDevHlpPCIPhysWrite(pBusLogic->CTX_SUFF(pDevIns), GCPhysAddrCCB,
     1203                              &pTaskState->CommandControlBlockGuest, RT_OFFSETOF(CCBC, abCDB));
     1204    }
    11951205
    11961206# ifdef RT_STRICT
     
    29262936}
    29272937
     2938static int buslogicR3DeviceSCSIRequestAbort(PBUSLOGIC pBusLogic, PBUSLOGICTASKSTATE pTaskState)
     2939{
     2940    int             rc = VINF_SUCCESS;
     2941    uint8_t         uTargetIdCCB;
     2942    PBUSLOGICDEVICE pTargetDevice;
     2943    RTGCPHYS        GCPhysAddrCCB = (RTGCPHYS)pTaskState->MailboxGuest.u32PhysAddrCCB;
     2944
     2945    PDMDevHlpPhysRead(pBusLogic->CTX_SUFF(pDevIns), GCPhysAddrCCB,
     2946                      &pTaskState->CommandControlBlockGuest, sizeof(CCB32));
     2947
     2948    uTargetIdCCB = pTaskState->fIs24Bit ? pTaskState->CommandControlBlockGuest.o.uTargetId : pTaskState->CommandControlBlockGuest.n.uTargetId;
     2949    pTargetDevice = &pBusLogic->aDeviceStates[uTargetIdCCB];
     2950    pTaskState->CTX_SUFF(pTargetDevice) = pTargetDevice;
     2951
     2952    buslogicR3SendIncomingMailbox(pBusLogic, pTaskState,
     2953                                  BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_ABORT_QUEUE_GENERATED,
     2954                                  BUSLOGIC_MAILBOX_INCOMING_DEVICE_STATUS_OPERATION_GOOD,
     2955                                  BUSLOGIC_MAILBOX_INCOMING_COMPLETION_ABORTED_NOT_FOUND);
     2956
     2957    RTMemCacheFree(pBusLogic->hTaskCache, pTaskState);
     2958
     2959    return rc;
     2960}
     2961
    29282962/**
    29292963 * Read a mailbox from guest memory. Convert 24-bit mailboxes to
     
    30233057    else if (pTaskState->MailboxGuest.u.out.uActionCode == BUSLOGIC_MAILBOX_OUTGOING_ACTION_ABORT_COMMAND)
    30243058    {
    3025         AssertMsgFailed(("Not implemented yet\n"));
     3059        LogFlow(("Aborting mailbox\n"));
     3060        rc = buslogicR3DeviceSCSIRequestAbort(pBusLogic, pTaskState);
    30263061    }
    30273062    else
     
    32473282    SSMR3GetMem   (pSSM, &pBusLogic->LocalRam, sizeof(pBusLogic->LocalRam));
    32483283    SSMR3GetU8    (pSSM, &pBusLogic->uOperationCode);
    3249     SSMR3GetMem   (pSSM, &pBusLogic->aCommandBuffer, sizeof(pBusLogic->aCommandBuffer));
     3284    if (uVersion > BUSLOGIC_SAVED_STATE_MINOR_PRE_CMDBUF_RESIZE)
     3285        SSMR3GetMem   (pSSM, &pBusLogic->aCommandBuffer, sizeof(pBusLogic->aCommandBuffer));
     3286    else
     3287        SSMR3GetMem   (pSSM, &pBusLogic->aCommandBuffer, BUSLOGIC_COMMAND_SIZE_OLD);
    32503288    SSMR3GetU8    (pSSM, &pBusLogic->iParameter);
    32513289    SSMR3GetU8    (pSSM, &pBusLogic->cbCommandParametersLeft);
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