VirtualBox

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


Ignore:
Timestamp:
Oct 16, 2012 4:25:26 PM (12 years ago)
Author:
vboxsync
Message:

VBoxSCSI: Slightly extended interface to allow error reporting.

Location:
trunk/src/VBox/Devices/Storage
Files:
4 edited

Legend:

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

    r43646 r43659  
    20632063        memcpy(pBusLogic->VBoxSCSI.pBuf, &ScsiInquiryData, 5);
    20642064
    2065         rc = vboxscsiRequestFinished(&pBusLogic->VBoxSCSI, &pTaskState->PDMScsiRequest);
     2065        rc = vboxscsiRequestFinished(&pBusLogic->VBoxSCSI, &pTaskState->PDMScsiRequest, SCSI_STATUS_OK);
    20662066        AssertMsgRCReturn(rc, ("Finishing BIOS SCSI request failed rc=%Rrc\n", rc), rc);
    20672067
     
    24022402        if (pTaskState->fBIOS)
    24032403        {
    2404             rc = vboxscsiRequestFinished(&pBusLogic->VBoxSCSI, pSCSIRequest);
     2404            rc = vboxscsiRequestFinished(&pBusLogic->VBoxSCSI, pSCSIRequest, rcCompletion);
    24052405            AssertMsgRC(rc, ("Finishing BIOS SCSI request failed rc=%Rrc\n", rc));
    24062406        }
     
    33673367    {
    33683368        /* Register I/O port space for BIOS access. */
    3369         rc = PDMDevHlpIOPortRegister(pDevIns, BUSLOGIC_BIOS_IO_PORT, 3, NULL,
     3369        rc = PDMDevHlpIOPortRegister(pDevIns, BUSLOGIC_BIOS_IO_PORT, 4, NULL,
    33703370                                     buslogicBIOSIOPortWrite, buslogicBIOSIOPortRead,
    33713371                                     buslogicBIOSIOPortWriteStr, buslogicBIOSIOPortReadStr,
  • trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp

    r43472 r43659  
    21102110        if (RT_UNLIKELY(pTaskState->fBIOS))
    21112111        {
    2112             int rc = vboxscsiRequestFinished(&pLsiLogic->VBoxSCSI, pSCSIRequest);
     2112            int rc = vboxscsiRequestFinished(&pLsiLogic->VBoxSCSI, pSCSIRequest, rcCompletion);
    21132113            AssertMsgRC(rc, ("Finishing BIOS SCSI request failed rc=%Rrc\n", rc));
    21142114        }
     
    37283728    memcpy(pLsiLogic->VBoxSCSI.pBuf, &ScsiInquiryData, 5);
    37293729
    3730     rc = vboxscsiRequestFinished(&pLsiLogic->VBoxSCSI, &pTaskState->PDMScsiRequest);
     3730    rc = vboxscsiRequestFinished(&pLsiLogic->VBoxSCSI, &pTaskState->PDMScsiRequest, SCSI_STATUS_OK);
    37313731    AssertMsgRCReturn(rc, ("Finishing BIOS SCSI request failed rc=%Rrc\n", rc), rc);
    37323732
     
    52305230    {
    52315231        if (pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI)
    5232             rc = PDMDevHlpIOPortRegister(pDevIns, LSILOGIC_BIOS_IO_PORT, 3, NULL,
     5232            rc = PDMDevHlpIOPortRegister(pDevIns, LSILOGIC_BIOS_IO_PORT, 4, NULL,
    52335233                                         lsilogicIsaIOPortWrite, lsilogicIsaIOPortRead,
    52345234                                         lsilogicIsaIOPortWriteStr, lsilogicIsaIOPortReadStr,
  • trunk/src/VBox/Devices/Storage/VBoxSCSI.cpp

    r43474 r43659  
    3939static void vboxscsiReset(PVBOXSCSI pVBoxSCSI)
    4040{
    41     pVBoxSCSI->regIdentify = 0;
    42     pVBoxSCSI->cbCDB       = 0;
     41    pVBoxSCSI->regIdentify   = 0;
     42    pVBoxSCSI->cbCDB         = 0;
    4343    memset(pVBoxSCSI->aCDB, 0, sizeof(pVBoxSCSI->aCDB));
    44     pVBoxSCSI->iCDB        = 0;
    45     pVBoxSCSI->fBusy       = false;
    46     pVBoxSCSI->cbBuf       = 0;
    47     pVBoxSCSI->iBuf        = 0;
     44    pVBoxSCSI->iCDB          = 0;
     45    pVBoxSCSI->fBusy         = false;
     46    pVBoxSCSI->rcCompletion  = 0;
     47    pVBoxSCSI->uTargetDevice = 0;
     48    pVBoxSCSI->cbBuf         = 0;
     49    pVBoxSCSI->iBuf          = 0;
    4850    if (pVBoxSCSI->pBuf)
    4951        RTMemFree(pVBoxSCSI->pBuf);
    5052
    51     pVBoxSCSI->pBuf        = NULL;
    52     pVBoxSCSI->enmState    = VBOXSCSISTATE_NO_COMMAND;
    53 
     53    pVBoxSCSI->pBuf          = NULL;
     54    pVBoxSCSI->enmState      = VBOXSCSISTATE_NO_COMMAND;
    5455}
    5556
     
    9293                RTThreadYield();
    9394            }
    94             else
    95                 uVal &= ~VBOX_SCSI_BUSY;
     95            if (pVBoxSCSI->rcCompletion)
     96                uVal |= VBOX_SCSI_ERROR;
    9697            break;
    9798        }
     
    117118                    pVBoxSCSI->iCDB  = 0;
    118119                    pVBoxSCSI->iBuf  = 0;
     120                    pVBoxSCSI->rcCompletion = 0;
    119121                    pVBoxSCSI->uTargetDevice = 0;
    120122                    pVBoxSCSI->enmState = VBOXSCSISTATE_NO_COMMAND;
     
    127129        {
    128130            uVal = pVBoxSCSI->regIdentify;
     131            break;
     132        }
     133        case 3:
     134        {
     135            uVal = pVBoxSCSI->rcCompletion;
    129136            break;
    130137        }
     
    275282    AssertMsg(pVBoxSCSI->enmState == VBOXSCSISTATE_COMMAND_READY, ("Invalid state %u\n", pVBoxSCSI->enmState));
    276283
     284    /* Clear any errors from a previous request. */
     285    pVBoxSCSI->rcCompletion = 0;
     286
    277287    if (pVBoxSCSI->uTxDir == VBOXSCSI_TXDIR_FROM_DEVICE)
    278288    {
     
    316326 * is ready at the incoming data port.
    317327 */
    318 int vboxscsiRequestFinished(PVBOXSCSI pVBoxSCSI, PPDMSCSIREQUEST pScsiRequest)
     328int vboxscsiRequestFinished(PVBOXSCSI pVBoxSCSI, PPDMSCSIREQUEST pScsiRequest, int rcCompletion)
    319329{
    320330    LogFlowFunc(("pVBoxSCSI=%#p pScsiRequest=%#p\n", pVBoxSCSI, pScsiRequest));
     
    335345        memset(pVBoxSCSI->aCDB, 0, sizeof(pVBoxSCSI->aCDB));
    336346    }
     347
     348    pVBoxSCSI->rcCompletion = rcCompletion;
    337349
    338350    ASMAtomicXchgBool(&pVBoxSCSI->fBusy, false);
  • trunk/src/VBox/Devices/Storage/VBoxSCSI.h

    r43474 r43659  
    2424 *
    2525 * The BusLogic interface if available will be starting at port 0x330
    26  * and the LsiLogic starts at 0x340 and each will have a size of 3 ports.
     26 * and the LsiLogic starts at 0x340 and each will have a size of 4 ports.
    2727 * The ports are used as described below:
    2828 *
     
    3939 * +--------+--------+----------+
    4040 * |   2    |  R/W   | Detect   |
     41 * +--------+--------+----------+
     42 * |   3    |  Read  | SCSI rc  |
    4143 * +--------+--------+----------+
    4244 * |   3    |  Write | Reset    |
     
    5557 * again the adapter is available.
    5658 *
     59 * Any write to the register at offset 3 causes the interface to be reset. A read returns
     60 * the SCSI status code of the last operation.
     61 *
    5762 * This part has no R0 or GC components.
    5863 */
     
    6671//#define DEBUG
    6772#include <VBox/vmm/pdmdev.h>
     73#include <VBox/scsi.h>
    6874
    6975typedef enum VBOXSCSISTATE
     
    109115    /** Current position in the buffer. */
    110116    uint32_t             iBuf;
     117    /** The result code of last operation. */
     118    int                  rcCompletion;
    111119    /** Flag whether a request is pending. */
    112120    volatile bool        fBusy;
     
    115123} VBOXSCSI, *PVBOXSCSI;
    116124
    117 #define VBOX_SCSI_BUSY RT_BIT(0)
     125#define VBOX_SCSI_BUSY  RT_BIT(0)
     126#define VBOX_SCSI_ERROR RT_BIT(1)
    118127
    119128#ifdef IN_RING3
     
    123132int vboxscsiWriteRegister(PVBOXSCSI pVBoxSCSI, uint8_t iRegister, uint8_t uVal);
    124133int vboxscsiSetupRequest(PVBOXSCSI pVBoxSCSI, PPDMSCSIREQUEST pScsiRequest, uint32_t *puTargetDevice);
    125 int vboxscsiRequestFinished(PVBOXSCSI pVBoxSCSI, PPDMSCSIREQUEST pScsiRequest);
     134int vboxscsiRequestFinished(PVBOXSCSI pVBoxSCSI, PPDMSCSIREQUEST pScsiRequest, int rcCompletion);
    126135void vboxscsiSetRequestRedo(PVBOXSCSI pVBoxSCSI, PPDMSCSIREQUEST pScsiRequest);
    127136int vboxscsiWriteString(PPDMDEVINS pDevIns, PVBOXSCSI pVBoxSCSI, uint8_t iRegister,
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