DrvSCSI.cpp revision 93f91841f87620d1cb6d0238b3d0d5e52cd3b9a4
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * VBox storage drivers: Generic SCSI command parser and execution driver
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * Copyright (C) 2006-2010 Sun Microsystems, Inc.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * available from http://www.virtualbox.org. This file is free software;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * you can redistribute it and/or modify it under the terms of the GNU
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * General Public License (GPL) as published by the Free Software
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * additional information or have any questions.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync/*******************************************************************************
a299266cddc1ae14d76d725a660bb278816bc151vboxsync* Header Files *
a299266cddc1ae14d76d725a660bb278816bc151vboxsync*******************************************************************************/
a299266cddc1ae14d76d725a660bb278816bc151vboxsync//#define DEBUG
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * SCSI driver instance data.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @implements PDMISCSICONNECTOR
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @implements PDMIBLOCKASYNCPORT
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @implements PDMIMOUNTNOTIFY
a299266cddc1ae14d76d725a660bb278816bc151vboxsynctypedef struct DRVSCSI
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /** Pointer driver instance. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /** Pointer to the attached driver's base interface. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /** Pointer to the attached driver's block interface. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /** Pointer to the attached driver's async block interface. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /** Pointer to the attached driver's block bios interface. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /** Pointer to the attached driver's mount interface. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /** Pointer to the SCSI port interface of the device above. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /** pointer to the Led port interface of the dveice above. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /** The scsi connector interface .*/
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /** The block port interface. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync#if 0 /* these interfaces aren't implemented */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /** The optional block async port interface. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /** The mount notify interface. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /** Fallback status LED state for this drive.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * This is used in case the device doesn't has a LED interface. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /** Pointer to the status LED for this drive. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /** Device type. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /** BIOS PCHS Geometry. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /** BIOS LCHS Geometry. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /** Number of sectors this device has. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /** The dedicated I/O thread for the non async approach. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /** Queue for passing the requests to the thread. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /** Request that we've left pending on wakeup or reset. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /** Indicates whether PDMDrvHlpAsyncNotificationCompleted should be called by
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * any of the dummy functions. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync bool volatile fDummySignal;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /** Release statistics: number of bytes written. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /** Release statistics: number of bytes read. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync/** Converts a pointer to DRVSCSI::ISCSIConnecotr to a PDRVSCSI. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync#define PDMISCSICONNECTOR_2_DRVSCSI(pInterface) ( (PDRVSCSI)((uintptr_t)pInterface - RT_OFFSETOF(DRVSCSI, ISCSIConnector)) )
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * Dumps a SCSI request structure for debugging purposes.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @returns nothing.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @param pRequest Pointer to the request to dump.
a299266cddc1ae14d76d725a660bb278816bc151vboxsyncstatic void drvscsiDumpScsiRequest(PPDMSCSIREQUEST pRequest)
a299266cddc1ae14d76d725a660bb278816bc151vboxsync Log(("Dump for pRequest=%#p Command: %s\n", pRequest, SCSICmdText(pRequest->pbCDB[0])));
a299266cddc1ae14d76d725a660bb278816bc151vboxsync Log(("cbScatterGather=%u\n", pRequest->cbScatterGather));
a299266cddc1ae14d76d725a660bb278816bc151vboxsync Log(("cScatterGatherEntries=%u\n", pRequest->cScatterGatherEntries));
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* Print all scatter gather entries. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync for (uint32_t i = 0; i < pRequest->cScatterGatherEntries; i++)
a299266cddc1ae14d76d725a660bb278816bc151vboxsync Log(("ScatterGatherEntry[%u].cbSeg=%u\n", i, pRequest->paScatterGatherHead[i].cbSeg));
a299266cddc1ae14d76d725a660bb278816bc151vboxsync Log(("ScatterGatherEntry[%u].pvSeg=%#p\n", i, pRequest->paScatterGatherHead[i].pvSeg));
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * Copy the content of a buffer to a scatter gather list only
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * copying only the amount of data which fits into the
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * scatter gather list.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @returns VBox status code.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @param pRequest Pointer to the request which contains the S/G list entries.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @param pvBuf Pointer to the buffer which should be copied.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @param cbBuf Size of the buffer.
a299266cddc1ae14d76d725a660bb278816bc151vboxsyncstatic int drvscsiScatterGatherListCopyFromBuffer(PPDMSCSIREQUEST pRequest, void *pvBuf, size_t cbBuf)
a299266cddc1ae14d76d725a660bb278816bc151vboxsync unsigned cSGEntry = 0;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync PPDMDATASEG pSGEntry = &pRequest->paScatterGatherHead[cSGEntry];
a299266cddc1ae14d76d725a660bb278816bc151vboxsync LogFlowFunc(("pRequest=%#p pvBuf=%#p cbBuf=%u\n", pRequest, pvBuf, cbBuf));
a299266cddc1ae14d76d725a660bb278816bc151vboxsync for (unsigned i = 0; i < cbBuf; i++)
a299266cddc1ae14d76d725a660bb278816bc151vboxsync Log(("%s: pvBuf[%u]=%#x\n", __FUNCTION__, i, pu8Buf[i]));
a299266cddc1ae14d76d725a660bb278816bc151vboxsync size_t cbToCopy = (cbBuf < pSGEntry->cbSeg) ? cbBuf : pSGEntry->cbSeg;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* We finished. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* Advance the buffer. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* Go to the next entry in the list. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsyncstatic void drvscsiPadStr(int8_t *pbDst, const char *pbSrc, uint32_t cbSize)
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * Set the sense and advanced sense key in the buffer for error conditions.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @returns SCSI status code.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @param pRequest Pointer to the request which contains the sense buffer.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @param uSCSISenseKey The sense key to set.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @param uSCSIASC The advanced sense key to set.
a299266cddc1ae14d76d725a660bb278816bc151vboxsyncDECLINLINE(int) drvscsiCmdError(PPDMSCSIREQUEST pRequest, uint8_t uSCSISenseKey, uint8_t uSCSIASC)
a299266cddc1ae14d76d725a660bb278816bc151vboxsync AssertMsgReturn(pRequest->cbSenseBuffer >= 18, ("Sense buffer is not big enough\n"), SCSI_STATUS_OK);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync AssertMsgReturn(pRequest->pbSenseBuffer, ("Sense buffer pointer is NULL\n"), SCSI_STATUS_OK);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync memset(pRequest->pbSenseBuffer, 0, pRequest->cbSenseBuffer);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync pRequest->pbSenseBuffer[0] = (1 << 7) | SCSI_SENSE_RESPONSE_CODE_CURR_FIXED; /* Fixed format */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync pRequest->pbSenseBuffer[13] = 0x00; /** @todo: Provide more info. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * Sets the sense key for a status good condition.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @returns SCSI status code.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @param pRequest Pointer to the request which contains the sense buffer.
a299266cddc1ae14d76d725a660bb278816bc151vboxsyncDECLINLINE(int) drvscsiCmdOk(PPDMSCSIREQUEST pRequest)
a299266cddc1ae14d76d725a660bb278816bc151vboxsync AssertMsgReturn(pRequest->pbSenseBuffer, ("Sense buffer pointer is NULL\n"), SCSI_STATUS_OK);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync memset(pRequest->pbSenseBuffer, 0, pRequest->cbSenseBuffer);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * Setting this breaks Linux guests on the BusLogic controller.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * According to the SCSI SPC spec sense data is returned after a
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * CHECK CONDITION status or a REQUEST SENSE command.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * Both SCSI controllers have a feature called Auto Sense which
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * fetches the sense data automatically from the device
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * with REQUEST SENSE. So the SCSI subsystem in Linux should
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * find this sense data even if the command finishes successfully
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * but if it finds valid sense data it will let the command fail
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * and it doesn't detect attached disks anymore.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * Disabling makes it work again and no other guest shows errors
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * so I will leave it disabled for now.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * On the other hand it is possible that the devices fetch the sense data
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * only after a command failed so the content is really invalid if
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * the command succeeds.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync pRequest->pbSenseBuffer[0] = (1 << 7) | SCSI_SENSE_RESPONSE_CODE_CURR_FIXED; /* Fixed format */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync pRequest->pbSenseBuffer[13] = SCSI_ASC_NONE; /* Should be ASCQ but it has the same value for success. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsyncDECLINLINE(void) drvscsiH2BE_U16(uint8_t *pbBuf, uint16_t val)
a299266cddc1ae14d76d725a660bb278816bc151vboxsyncDECLINLINE(void) drvscsiH2BE_U24(uint8_t *pbBuf, uint32_t val)
a299266cddc1ae14d76d725a660bb278816bc151vboxsyncDECLINLINE(void) drvscsiH2BE_U32(uint8_t *pbBuf, uint32_t val)
a299266cddc1ae14d76d725a660bb278816bc151vboxsyncDECLINLINE(void) drvscsiH2BE_U64(uint8_t *pbBuf, uint64_t val)
a299266cddc1ae14d76d725a660bb278816bc151vboxsyncDECLINLINE(uint16_t) drvscsiBE2H_U16(const uint8_t *pbBuf)
a299266cddc1ae14d76d725a660bb278816bc151vboxsyncDECLINLINE(uint32_t) drvscsiBE2H_U24(const uint8_t *pbBuf)
a299266cddc1ae14d76d725a660bb278816bc151vboxsync return (pbBuf[0] << 16) | (pbBuf[1] << 8) | pbBuf[2];
a299266cddc1ae14d76d725a660bb278816bc151vboxsyncDECLINLINE(uint32_t) drvscsiBE2H_U32(const uint8_t *pbBuf)
a299266cddc1ae14d76d725a660bb278816bc151vboxsync return (pbBuf[0] << 24) | (pbBuf[1] << 16) | (pbBuf[2] << 8) | pbBuf[3];
a299266cddc1ae14d76d725a660bb278816bc151vboxsyncDECLINLINE(uint64_t) drvscsiBE2H_U64(const uint8_t *pbBuf)
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * Parses the CDB of a request and acts accordingly.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @returns transfer direction type.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @param pThis Pointer to the SCSI driver instance data.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @param pRequest Pointer to the request to process.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @param puOffset Where to store the start offset to start data transfer from.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @param pcbToTransfer Where to store the number of bytes to transfer.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @param piTxDir Where to store the data transfer direction.
a299266cddc1ae14d76d725a660bb278816bc151vboxsyncstatic int drvscsiProcessCDB(PDRVSCSI pThis, PPDMSCSIREQUEST pRequest, uint64_t *puOffset, uint32_t *pcbToTransfer, int *piTxDir)
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* We check for a command which needs to be handled even for non existant LUNs. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync memset(&ScsiInquiryReply, 0, sizeof(ScsiInquiryReply));
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* We support only one attached device at LUN0 at the moment. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync ScsiInquiryReply.u5PeripheralDeviceType = SCSI_INQUIRY_DATA_PERIPHERAL_DEVICE_TYPE_UNKNOWN;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync ScsiInquiryReply.u3PeripheralQualifier = SCSI_INQUIRY_DATA_PERIPHERAL_QUALIFIER_NOT_CONNECTED_NOT_SUPPORTED;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync ScsiInquiryReply.u5PeripheralDeviceType = SCSI_INQUIRY_DATA_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync AssertMsgFailed(("Device type %u not supported\n", pThis->enmType));
a299266cddc1ae14d76d725a660bb278816bc151vboxsync ScsiInquiryReply.u3PeripheralQualifier = SCSI_INQUIRY_DATA_PERIPHERAL_QUALIFIER_CONNECTED;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync ScsiInquiryReply.u3AnsiVersion = 0x05; /* SPC-4 compliant */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync drvscsiPadStr(ScsiInquiryReply.achVendorId, "VBOX", 8);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync drvscsiPadStr(ScsiInquiryReply.achProductId, "HARDDISK", 16);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync drvscsiPadStr(ScsiInquiryReply.achProductLevel, "1.0", 4);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync drvscsiScatterGatherListCopyFromBuffer(pRequest, &ScsiInquiryReply, sizeof(SCSIINQUIRYDATA));
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * If allocation length is less than 16 bytes SPC compliant devices have
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * to return an error.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync rc = drvscsiCmdError(pRequest, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_INV_FIELD_IN_CMD_PACKET);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync drvscsiH2BE_U32(&aReply[0], 8); /* List length starts at position 0. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync drvscsiScatterGatherListCopyFromBuffer(pRequest, aReply, sizeof(aReply));
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* Now for commands which are only implemented for existant LUNs. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * If sector size exceeds the maximum value that is
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * able to be stored in 4 bytes return 0xffffffff in this field
a299266cddc1ae14d76d725a660bb278816bc151vboxsync drvscsiScatterGatherListCopyFromBuffer(pRequest, aReply, sizeof(aReply));
a299266cddc1ae14d76d725a660bb278816bc151vboxsync drvscsiScatterGatherListCopyFromBuffer(pRequest, aReply, sizeof(aReply));
a299266cddc1ae14d76d725a660bb278816bc151vboxsync *pcbToTransfer = ((uint32_t)pRequest->pbCDB[4]) * 512;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync *puOffset = ((uint64_t)drvscsiBE2H_U32(&pRequest->pbCDB[2])) * 512;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync *pcbToTransfer = ((uint32_t)drvscsiBE2H_U16(&pRequest->pbCDB[7])) * 512;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync *puOffset = ((uint64_t)drvscsiBE2H_U32(&pRequest->pbCDB[2])) * 512;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync *pcbToTransfer = ((uint32_t)drvscsiBE2H_U32(&pRequest->pbCDB[6])) * 512;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync *puOffset = drvscsiBE2H_U64(&pRequest->pbCDB[2]) * 512;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync *pcbToTransfer = ((uint32_t)drvscsiBE2H_U32(&pRequest->pbCDB[10])) * 512;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync *pcbToTransfer = ((uint32_t)pRequest->pbCDB[4]) * 512;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync *puOffset = ((uint64_t)drvscsiBE2H_U32(&pRequest->pbCDB[2])) * 512;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync *pcbToTransfer = ((uint32_t)drvscsiBE2H_U16(&pRequest->pbCDB[7])) * 512;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync *puOffset = ((uint64_t)drvscsiBE2H_U32(&pRequest->pbCDB[2])) * 512;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync *pcbToTransfer = ((uint32_t)drvscsiBE2H_U32(&pRequest->pbCDB[6])) * 512;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync *puOffset = drvscsiBE2H_U64(&pRequest->pbCDB[2]) * 512;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync *pcbToTransfer = ((uint32_t)drvscsiBE2H_U32(&pRequest->pbCDB[10])) * 512;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* @todo When async mode implemented we have to move this out here. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync int rc2 = pThis->pDrvBlock->pfnFlush(pThis->pDrvBlock);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync AssertMsgRC(rc2, ("Flushing data failed rc=%Rrc\n", rc2));
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* We do not implement an echo buffer. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync drvscsiScatterGatherListCopyFromBuffer(pRequest, aReply, sizeof(aReply));
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* Nothing to do. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync uint16_t cbMax = drvscsiBE2H_U16(&pRequest->pbCDB[7]);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync drvscsiScatterGatherListCopyFromBuffer(pRequest, aReply, sizeof(aReply));
a299266cddc1ae14d76d725a660bb278816bc151vboxsync rc = drvscsiCmdError(pRequest, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_INV_FIELD_IN_CMD_PACKET);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* Leave the rest 0 */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync drvscsiScatterGatherListCopyFromBuffer(pRequest, aReply, sizeof(aReply));
a299266cddc1ae14d76d725a660bb278816bc151vboxsync rc = drvscsiCmdError(pRequest, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_INV_FIELD_IN_CMD_PACKET); /* Don't know if this is correct */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync //AssertMsgFailed(("Command %#x [%s] not implemented\n", pRequest->pbCDB[0], SCSICmdText(pRequest->pbCDB[0])));
a299266cddc1ae14d76d725a660bb278816bc151vboxsync rc = drvscsiCmdError(pRequest, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_ILLEGAL_OPCODE);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* Report an error. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync rc = drvscsiCmdError(pRequest, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_LOGICAL_UNIT_DOES_NOT_RESPOND_TO_SELECTION);
a299266cddc1ae14d76d725a660bb278816bc151vboxsyncstatic int drvscsiProcessRequestOne(PDRVSCSI pThis, PPDMSCSIREQUEST pRequest)
a299266cddc1ae14d76d725a660bb278816bc151vboxsync uint64_t uOffset = UINT64_MAX; /* initialized to shut up gcc warnings. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync rcCompletion = drvscsiProcessCDB(pThis, pRequest, &uOffset, &cbToTransfer, &iTxDir);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync if ((rcCompletion == SCSI_STATUS_OK) && (iTxDir != PDMBLOCKTXDIR_NONE))
a299266cddc1ae14d76d725a660bb278816bc151vboxsync uint32_t cbProcess = (cbToTransfer < pSegActual->cbSeg) ? cbToTransfer : (uint32_t)pSegActual->cbSeg;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync Log(("%s: uOffset=%llu cbToTransfer=%u\n", __FUNCTION__, uOffset, cbToTransfer));
a299266cddc1ae14d76d725a660bb278816bc151vboxsync pThis->pLed->Asserted.s.fReading = pThis->pLed->Actual.s.fReading = 1;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync rc = pThis->pDrvBlock->pfnRead(pThis->pDrvBlock, uOffset,
a299266cddc1ae14d76d725a660bb278816bc151vboxsync AssertMsgFailed(("%s: Failed to read data %Rrc\n", __FUNCTION__, rc));
a299266cddc1ae14d76d725a660bb278816bc151vboxsync STAM_REL_COUNTER_ADD(&pThis->StatBytesRead, cbProcess);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync pThis->pLed->Asserted.s.fWriting = pThis->pLed->Actual.s.fWriting = 1;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync rc = pThis->pDrvBlock->pfnWrite(pThis->pDrvBlock, uOffset,
a299266cddc1ae14d76d725a660bb278816bc151vboxsync AssertMsgFailed(("%s: Failed to write data %Rrc\n", __FUNCTION__, rc));
a299266cddc1ae14d76d725a660bb278816bc151vboxsync STAM_REL_COUNTER_ADD(&pThis->StatBytesWritten, cbProcess);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* Go to the next entry. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync ("Transfer incomplete cbToTransfer=%u cSegmentsLeft=%u\n", cbToTransfer, cSegmentsLeft));
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* Notify device. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync rc = pThis->pDevScsiPort->pfnSCSIRequestCompleted(pThis->pDevScsiPort, pRequest, rcCompletion);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync AssertMsgRC(rc, ("Error while notifying device rc=%Rrc\n", rc));
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * Dummy request function used by drvscsiReset to wait for all pending requests
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * to complete prior to the device reset.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @param pThis Pointer to the instace data.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @returns VINF_SUCCESS.
a299266cddc1ae14d76d725a660bb278816bc151vboxsyncstatic int drvscsiAsyncIOLoopSyncCallback(PDRVSCSI pThis)
a299266cddc1ae14d76d725a660bb278816bc151vboxsync PDMDrvHlpAsyncNotificationCompleted(pThis->pDrvIns);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * Request function to wakeup the thread.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @param pThis Pointer to the instace data.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @returns VWRN_STATE_CHANGED.
a299266cddc1ae14d76d725a660bb278816bc151vboxsyncstatic int drvscsiAsyncIOLoopWakeupFunc(PDRVSCSI pThis)
a299266cddc1ae14d76d725a660bb278816bc151vboxsync PDMDrvHlpAsyncNotificationCompleted(pThis->pDrvIns);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * The thread function which processes the requests asynchronously.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @returns VBox status code.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @param pDrvIns Pointer to the driver instance data.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @param pThread Pointer to the thread instance data.
a299266cddc1ae14d76d725a660bb278816bc151vboxsyncstatic int drvscsiAsyncIOLoop(PPDMDRVINS pDrvIns, PPDMTHREAD pThread)
a299266cddc1ae14d76d725a660bb278816bc151vboxsync if (pThread->enmState == PDMTHREADSTATE_INITIALIZING)
a299266cddc1ae14d76d725a660bb278816bc151vboxsync while (pThread->enmState == PDMTHREADSTATE_RUNNING)
a299266cddc1ae14d76d725a660bb278816bc151vboxsync rc = RTReqProcess(pThis->pQueueRequests, RT_INDEFINITE_WAIT);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync AssertMsg(rc == VWRN_STATE_CHANGED, ("Left RTReqProcess and error code is not VWRN_STATE_CHANGED rc=%Rrc\n", rc));
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * Deals with any pending dummy request
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @returns true if no pending dummy request, false if still pending.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @param pThis The instance data.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @param cMillies The number of milliseconds to wait for any
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * pending request to finish.
a299266cddc1ae14d76d725a660bb278816bc151vboxsyncstatic bool drvscsiAsyncIOLoopNoPendingDummy(PDRVSCSI pThis, uint32_t cMillies)
a299266cddc1ae14d76d725a660bb278816bc151vboxsync return true;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync int rc = RTReqWait(pThis->pPendingDummyReq, cMillies);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync return false;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync return true;
a299266cddc1ae14d76d725a660bb278816bc151vboxsyncstatic int drvscsiAsyncIOLoopWakeup(PPDMDRVINS pDrvIns, PPDMTHREAD pThread)
a299266cddc1ae14d76d725a660bb278816bc151vboxsync AssertMsgReturn(pThis->pQueueRequests, ("pQueueRequests is NULL\n"), VERR_INVALID_STATE);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync if (!drvscsiAsyncIOLoopNoPendingDummy(pThis, 10000 /* 10 sec */))
a299266cddc1ae14d76d725a660bb278816bc151vboxsync LogRel(("drvscsiAsyncIOLoopWakeup#%u: previous dummy request is still pending\n", pDrvIns->iInstance));
a299266cddc1ae14d76d725a660bb278816bc151vboxsync rc = RTReqCall(pThis->pQueueRequests, &pReq, 10000 /* 10 sec. */, (PFNRT)drvscsiAsyncIOLoopWakeupFunc, 1, pThis);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync LogRel(("drvscsiAsyncIOLoopWakeup#%u: %Rrc pReq=%p\n", pDrvIns->iInstance, rc, pReq));
a299266cddc1ae14d76d725a660bb278816bc151vboxsync/* -=-=-=-=- ISCSIConnector -=-=-=-=- */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync/** @copydoc PDMISCSICONNECTOR::pfnSCSIRequestSend. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsyncstatic DECLCALLBACK(int) drvscsiRequestSend(PPDMISCSICONNECTOR pInterface, PPDMSCSIREQUEST pSCSIRequest)
a299266cddc1ae14d76d725a660bb278816bc151vboxsync PDRVSCSI pThis = PDMISCSICONNECTOR_2_DRVSCSI(pInterface);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync AssertMsgReturn(pThis->pQueueRequests, ("pQueueRequests is NULL\n"), VERR_INVALID_STATE);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync rc = RTReqCallEx(pThis->pQueueRequests, &pReq, 0, RTREQFLAGS_NO_WAIT, (PFNRT)drvscsiProcessRequestOne, 2, pThis, pSCSIRequest);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync AssertMsgReturn(RT_SUCCESS(rc), ("Inserting request into queue failed rc=%Rrc\n", rc), rc);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync/* -=-=-=-=- IBase -=-=-=-=- */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @interface_method_impl{PDMIBASE,pfnQueryInterface}
a299266cddc1ae14d76d725a660bb278816bc151vboxsyncstatic DECLCALLBACK(void *) drvscsiQueryInterface(PPDMIBASE pInterface, const char *pszIID)
a299266cddc1ae14d76d725a660bb278816bc151vboxsync PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync PDMIBASE_RETURN_INTERFACE(pszIID, PDMISCSICONNECTOR, &pThis->ISCSIConnector);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBLOCKPORT, &pThis->IPort);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * Worker for drvscsiReset, drvscsiSuspend and drvscsiPowerOff.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @param pDrvIns The driver instance.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @param pfnAsyncNotify The async callback.
a299266cddc1ae14d76d725a660bb278816bc151vboxsyncstatic void drvscsiR3ResetOrSuspendOrPowerOff(PPDMDRVINS pDrvIns, PFNPDMDRVASYNCNOTIFY pfnAsyncNotify)
a299266cddc1ae14d76d725a660bb278816bc151vboxsync if (drvscsiAsyncIOLoopNoPendingDummy(pThis, 0 /*ms*/))
a299266cddc1ae14d76d725a660bb278816bc151vboxsync int rc = RTReqCall(pThis->pQueueRequests, &pReq, 0 /*ms*/, (PFNRT)drvscsiAsyncIOLoopSyncCallback, 1, pThis);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync PDMDrvHlpSetAsyncNotification(pDrvIns, pfnAsyncNotify);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * Callback employed by drvscsiSuspend and drvscsiPowerOff.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @returns true if we've quiesced, false if we're still working.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @param pDrvIns The driver instance.
a299266cddc1ae14d76d725a660bb278816bc151vboxsyncstatic DECLCALLBACK(bool) drvscsiIsAsyncSuspendOrPowerOffDone(PPDMDRVINS pDrvIns)
a299266cddc1ae14d76d725a660bb278816bc151vboxsync if (!drvscsiAsyncIOLoopNoPendingDummy(pThis, 0 /*ms*/))
a299266cddc1ae14d76d725a660bb278816bc151vboxsync return false;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync return true;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @copydoc FNPDMDRVPOWEROFF
a299266cddc1ae14d76d725a660bb278816bc151vboxsyncstatic DECLCALLBACK(void) drvscsiPowerOff(PPDMDRVINS pDrvIns)
a299266cddc1ae14d76d725a660bb278816bc151vboxsync drvscsiR3ResetOrSuspendOrPowerOff(pDrvIns, drvscsiIsAsyncSuspendOrPowerOffDone);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @copydoc FNPDMDRVSUSPEND
a299266cddc1ae14d76d725a660bb278816bc151vboxsyncstatic DECLCALLBACK(void) drvscsiSuspend(PPDMDRVINS pDrvIns)
a299266cddc1ae14d76d725a660bb278816bc151vboxsync drvscsiR3ResetOrSuspendOrPowerOff(pDrvIns, drvscsiIsAsyncSuspendOrPowerOffDone);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * Callback employed by drvscsiReset.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @returns true if we've quiesced, false if we're still working.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @param pDrvIns The driver instance.
a299266cddc1ae14d76d725a660bb278816bc151vboxsyncstatic DECLCALLBACK(bool) drvscsiIsAsyncResetDone(PPDMDRVINS pDrvIns)
a299266cddc1ae14d76d725a660bb278816bc151vboxsync if (!drvscsiAsyncIOLoopNoPendingDummy(pThis, 0 /*ms*/))
a299266cddc1ae14d76d725a660bb278816bc151vboxsync return false;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync return true;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @copydoc FNPDMDRVRESET
a299266cddc1ae14d76d725a660bb278816bc151vboxsyncstatic DECLCALLBACK(void) drvscsiReset(PPDMDRVINS pDrvIns)
a299266cddc1ae14d76d725a660bb278816bc151vboxsync drvscsiR3ResetOrSuspendOrPowerOff(pDrvIns, drvscsiIsAsyncResetDone);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * Destruct a driver instance.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * Most VM resources are freed by the VM. This callback is provided so that any non-VM
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * resources can be freed correctly.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @param pDrvIns The driver instance data.
a299266cddc1ae14d76d725a660bb278816bc151vboxsyncstatic DECLCALLBACK(void) drvscsiDestruct(PPDMDRVINS pDrvIns)
a299266cddc1ae14d76d725a660bb278816bc151vboxsync if (!drvscsiAsyncIOLoopNoPendingDummy(pThis, 100 /*ms*/))
a299266cddc1ae14d76d725a660bb278816bc151vboxsync LogRel(("drvscsiDestruct#%u: previous dummy request is still pending\n", pDrvIns->iInstance));
a299266cddc1ae14d76d725a660bb278816bc151vboxsync AssertMsgRC(rc, ("Failed to destroy queue rc=%Rrc\n", rc));
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * Construct a block driver instance.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * @copydoc FNPDMDRVCONSTRUCT
a299266cddc1ae14d76d725a660bb278816bc151vboxsyncstatic DECLCALLBACK(int) drvscsiConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
a299266cddc1ae14d76d725a660bb278816bc151vboxsync LogFlowFunc(("pDrvIns=%#p pCfg=%#p\n", pDrvIns, pCfg));
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * Initialize the instance data.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync pThis->ISCSIConnector.pfnSCSIRequestSend = drvscsiRequestSend;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync pDrvIns->IBase.pfnQueryInterface = drvscsiQueryInterface;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * Try attach driver below and query it's block interface.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync int rc = PDMDrvHlpAttach(pDrvIns, fFlags, &pThis->pDrvBase);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync AssertMsgReturn(RT_SUCCESS(rc), ("Attaching driver below failed rc=%Rrc\n", rc), rc);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * Query the block and blockbios interfaces.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync pThis->pDrvBlock = PDMIBASE_QUERY_INTERFACE(pThis->pDrvBase, PDMIBLOCK);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync AssertMsgFailed(("Configuration error: No block interface!\n"));
a299266cddc1ae14d76d725a660bb278816bc151vboxsync pThis->pDrvBlockBios = PDMIBASE_QUERY_INTERFACE(pThis->pDrvBase, PDMIBLOCKBIOS);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync AssertMsgFailed(("Configuration error: No block BIOS interface!\n"));
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* Query the SCSI port interface above. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync pThis->pDevScsiPort = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMISCSIPORT);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync AssertMsgReturn(pThis->pDevScsiPort, ("Missing SCSI port interface above\n"), VERR_PDM_MISSING_INTERFACE);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync pThis->pDrvMount = PDMIBASE_QUERY_INTERFACE(pThis->pDrvBase, PDMIMOUNT);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* Query the optional LED interface above. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync pThis->pLedPort = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMILEDPORTS);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* Get The Led. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync rc = pThis->pLedPort->pfnQueryStatusLed(pThis->pLedPort, 0, &pThis->pLed);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* Try to get the optional async block interface. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync pThis->pDrvBlockAsync = PDMIBASE_QUERY_INTERFACE(pThis->pDrvBase, PDMIBLOCKASYNC);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync PDMBLOCKTYPE enmType = pThis->pDrvBlock->pfnGetType(pThis->pDrvBlock);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync return PDMDrvHlpVMSetError(pDrvIns, VERR_PDM_UNSUPPORTED_BLOCK_TYPE, RT_SRC_POS,
a299266cddc1ae14d76d725a660bb278816bc151vboxsync N_("Only hard disks are currently supported as SCSI devices (enmType=%d)"),
a299266cddc1ae14d76d725a660bb278816bc151vboxsync pThis->cSectors = pThis->pDrvBlock->pfnGetSize(pThis->pDrvBlock) / 512;
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* Create request queue. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync AssertMsgReturn(RT_SUCCESS(rc), ("Failed to create request queue rc=%Rrc\n"), rc);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* Register statistics counter. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /** @todo aeichner: Find a way to put the instance number of the attached
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * controller device when we support more than one controller of the same type.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * At the moment we have the 0 hardcoded. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatBytesRead, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES,
a299266cddc1ae14d76d725a660bb278816bc151vboxsync "Amount of data read.", "/Devices/SCSI0/%d/ReadBytes", pDrvIns->iInstance);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatBytesWritten, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES,
a299266cddc1ae14d76d725a660bb278816bc151vboxsync "Amount of data written.", "/Devices/SCSI0/%d/WrittenBytes", pDrvIns->iInstance);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* Create I/O thread. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync rc = PDMDrvHlpPDMThreadCreate(pDrvIns, &pThis->pAsyncIOThread, pThis, drvscsiAsyncIOLoop,
a299266cddc1ae14d76d725a660bb278816bc151vboxsync drvscsiAsyncIOLoopWakeup, 0, RTTHREADTYPE_IO, "SCSI async IO");
a299266cddc1ae14d76d725a660bb278816bc151vboxsync AssertMsgReturn(RT_SUCCESS(rc), ("Failed to create async I/O thread rc=%Rrc\n"), rc);
a299266cddc1ae14d76d725a660bb278816bc151vboxsync * SCSI driver registration record.
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* u32Version */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* szName */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* szRCMod */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* szR0Mod */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* pszDescription */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync "Generic SCSI driver.",
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* fFlags */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* fClass. */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* cMaxInstances */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* cbInstance */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* pfnConstruct */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* pfnDestruct */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* pfnRelocate */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* pfnIOCtl */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* pfnPowerOn */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* pfnReset */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* pfnSuspend */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* pfnResume */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* pfnAttach */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* pfnDetach */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* pfnPowerOff */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* pfnSoftReset */
a299266cddc1ae14d76d725a660bb278816bc151vboxsync /* u32EndVersion */