VirtualBox

Changeset 64412 in vbox


Ignore:
Timestamp:
Oct 25, 2016 11:57:44 AM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
111526
Message:

VSCSI: Start on support for SCSI_MAINTENANCE_IN_REPORT_SUPP_OPC, work in progress not enabled

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

Legend:

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

    r62885 r64412  
    120120            break;
    121121        }
     122#if 0
     123        case SCSI_MAINTENANCE_IN:
     124        {
     125            if (pVScsiReq->pbCDB[1] == SCSI_MAINTENANCE_IN_REPORT_SUPP_OPC)
     126            {
     127                /*
     128                 * If the LUN is present and has the CDB info set we will execute the command, otherwise
     129                 * just fail with an illegal request error.
     130                 */
     131                if (vscsiDeviceLunIsPresent(pVScsiDevice, pVScsiReq->iLun))
     132                {
     133                    PVSCSILUNINT pVScsiLun = pVScsiDevice->papVScsiLun[pVScsiReq->iLun];
     134                    if (pVScsiLun->pVScsiLunDesc->paSupOpcInfo)
     135                    {
     136                        bool fTimeoutDesc = RT_BOOL(pVScsiReq->pbCDB[2] & 0x80);
     137                        uint8_t u8ReportMode = pVScsiReq->pbCDB[2] & 0x7;
     138                        uint8_t u8Opc = pVScsiReq->pbCDB[3];
     139                        uint16_t u16SvcAction = vscsiBE2HU16(&pVScsiReq->pbCDB[4]);
     140                        uint16_t cbData = vscsiBE2HU16(&pVScsiReq->pbCDB[6]);
     141
     142                        switch (u8ReportMode)
     143                        {
     144                            case 0:
     145                                *prcReq = vscsiDeviceReportAllSupportedOpc(pVScsiLun, pVScsiReq, fTimeoutDesc, cbData);
     146                                break;
     147                            case 1:
     148                                *prcReq = vscsiDeviceReportOpc(pVScsiLun, pVScsiReq, u8Opc, fTimeoutDesc, cbData);
     149                                break;
     150                            case 2:
     151                                *prcReq = vscsiDeviceReportOpc(pVScsiLun, pVScsiReq, u8Opc, fTimeoutDesc, cbData);
     152                                break;
     153                            default:
     154                                *prcReq = vscsiReqSenseErrorSet(&pVScsiDevice->VScsiSense, pVScsiReq,
     155                                                                SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_INV_FIELD_IN_CMD_PACKET, 0x00);
     156                        }
     157                    }
     158                    else
     159                        *prcReq = vscsiLunReqSenseErrorSet(pVScsiLun, pVScsiReq, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_ILLEGAL_OPCODE, 0x00);
     160                }
     161                else
     162                    *prcReq = vscsiLunReqSenseErrorSet(pVScsiLun, pVScsiReq, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_ILLEGAL_OPCODE, 0x00);
     163            }
     164            else
     165                fProcessed = false; /* Might also be the SEND KEY MMC command. */
     166        }
     167#endif
    122168        default:
    123169            fProcessed = false;
  • trunk/src/VBox/Devices/Storage/VSCSI/VSCSIInternal.h

    r64132 r64412  
    172172
    173173/**
     174 * Supported operation code information entry.
     175 */
     176typedef struct VSCSILUNSUPOPC
     177{
     178    /** The operation code. */
     179    uint8_t                 u8Opc;
     180    /** Service action code if required as indicated by
     181     * VSCSI_LUN_SUP_OPC_SVC_ACTION_REQUIRED */
     182    uint16_t                u16SvcAction;
     183    /** Flags. */
     184    uint32_t                fFlags;
     185    /** Readable description for the op code. */
     186    const char              *pszOpc;
     187    /** The length of the CDB for this operation code. */
     188    uint8_t                 cbCdb;
     189    /** Pointer to the CDB usage data. */
     190    uint8_t                 *pbCdbUsage;
     191    /* The operation specific valuefor the timeout descriptor. */
     192    uint8_t                 u8OpcTimeoutSpec;
     193    /** The nominal processing timeout in seconds. */
     194    uint16_t                cNominalProcessingTimeout;
     195    /** The recommend timeout in seconds. */
     196    uint16_t                cRecommendTimeout;
     197} VSCSILUNSUPOPC;
     198/** Pointer to a operation code information entry. */
     199typedef VSCSILUNSUPOPC *PVSCSILUNSUPOPC;
     200/** Pointer to a const operation code information entry. */
     201typedef const VSCSILUNSUPOPC *PCVSCSILUNSUPOPC;
     202
     203/** @name Flags for the supported operation code infromation entries.
     204 * @{ */
     205/** Flag indicating wheter the service action member is valid and should be
     206 * evaluated to find the desired opcode information. */
     207#define VSCSI_LUN_SUP_OPC_SVC_ACTION_REQUIRED      RT_BIT_32(0)
     208/** Flag whether the values for the timeout descriptor are valid. */
     209#define VSCSI_LUN_SUP_OPC_TIMEOUT_DESC_VALID       RT_BIT_32(1)
     210/** @} */
     211
     212/** @name Support macros to create supported operation code information entries.
     213 * @{ */
     214#define VSCSI_LUN_SUP_OPC(a_u8Opc, a_pszOpc, a_cbCdb, a_pbCdbUsage) \
     215    { a_u8Opc, 0, 0, a_pszOpc, a_cbCdb, a_pbCdbUsage, 0, 0, 0}
     216#define VSCSI_LUN_SUP_OPC_SVC(a_u8Opc, a_u16SvcAction, a_pszOpc, a_cbCdb, a_pbCdbUsage) \
     217    { a_u8Opc, a_u16SvcAction, VSCSI_LUN_SUP_OPC_SVC_ACTION_REQUIRED, a_pszOpc, a_cbCdb, a_pbCdbUsage, 0, 0, 0}
     218/** @} */
     219
     220/**
    174221 * Virtual SCSI LUN descriptor.
    175222 */
     
    182229    /** LUN type size */
    183230    size_t               cbLun;
     231    /** Number of entries in the supported operation codes array. */
     232    uint32_t             cSupOpcInfo;
     233    /** Pointer to the array of supported operation codes for the
     234     * REPORT RUPPORTED OPERATION CODES command handled by the generic
     235     * device driver - optional.
     236     */
     237    PCVSCSILUNSUPOPC     paSupOpcInfo;
    184238
    185239    /**
  • trunk/src/VBox/Devices/Storage/VSCSI/VSCSILunMmc.cpp

    r64152 r64412  
    13221322    /** cbLun */
    13231323    sizeof(VSCSILUNMMC),
     1324    /** cSupOpcInfo */
     1325    0,
     1326    /** paSupOpcInfo */
     1327    NULL,
    13241328    /** pfnVScsiLunInit */
    13251329    vscsiLunMmcInit,
  • trunk/src/VBox/Devices/Storage/VSCSI/VSCSILunSbc.cpp

    r64064 r64412  
    588588    /** cbLun */
    589589    sizeof(VSCSILUNSBC),
     590    /** cSupOpcInfo */
     591    0,
     592    /** paSupOpcInfo */
     593    NULL,
    590594    /** pfnVScsiLunInit */
    591595    vscsiLunSbcInit,
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette