Lines Matching defs:pRequest

76  * @param   pRequest    Pointer to the request to dump.
78 static void drvscsihostDumpScsiRequest(PPDMSCSIREQUEST pRequest)
80 Log(("Dump for pRequest=%#p Command: %s\n", pRequest, SCSICmdText(pRequest->pbCDB[0])));
81 Log(("cbCDB=%u\n", pRequest->cbCDB));
82 for (uint32_t i = 0; i < pRequest->cbCDB; i++)
83 Log(("pbCDB[%u]=%#x\n", i, pRequest->pbCDB[i]));
84 Log(("cbScatterGather=%u\n", pRequest->cbScatterGather));
85 Log(("cScatterGatherEntries=%u\n", pRequest->cScatterGatherEntries));
87 for (uint32_t i = 0; i < pRequest->cScatterGatherEntries; i++)
89 Log(("ScatterGatherEntry[%u].cbSeg=%u\n", i, pRequest->paScatterGatherHead[i].cbSeg));
90 Log(("ScatterGatherEntry[%u].pvSeg=%#p\n", i, pRequest->paScatterGatherHead[i].pvSeg));
92 Log(("pvUser=%#p\n", pRequest->pvUser));
102 * @param pRequest Pointer to the request which contains the S/G list entries.
106 static int drvscsihostScatterGatherListCopyFromBuffer(PPDMSCSIREQUEST pRequest, void *pvBuf, size_t cbBuf)
109 PRTSGSEG pSGEntry = &pRequest->paScatterGatherHead[cSGEntry];
112 while (cSGEntry < pRequest->cScatterGatherEntries)
138 * @param pRequest Pointer to the request which contains the sense buffer.
142 DECLINLINE(void) drvscsiCmdError(PPDMSCSIREQUEST pRequest, uint8_t uSCSISenseKey, uint8_t uSCSIASC)
144 AssertMsg(pRequest->cbSenseBuffer >= 2, ("Sense buffer is not big enough\n"));
145 AssertMsg(pRequest->pbSenseBuffer, ("Sense buffer pointer is NULL\n"));
146 pRequest->pbSenseBuffer[0] = uSCSISenseKey;
147 pRequest->pbSenseBuffer[1] = uSCSIASC;
154 * @param pRequest Pointer to the request which contains the sense buffer.
156 DECLINLINE(void) drvscsihostCmdOk(PPDMSCSIREQUEST pRequest)
158 AssertMsg(pRequest->cbSenseBuffer >= 2, ("Sense buffer is not big enough\n"));
159 AssertMsg(pRequest->pbSenseBuffer, ("Sense buffer pointer is NULL\n"));
160 pRequest->pbSenseBuffer[0] = SCSI_SENSE_NONE;
161 pRequest->pbSenseBuffer[1] = SCSI_ASC_NONE;
215 static int drvscsihostProcessRequestOne(PDRVSCSIHOST pThis, PPDMSCSIREQUEST pRequest)
223 drvscsihostDumpScsiRequest(pRequest);
227 if (pRequest->uLogicalUnit != 0)
229 switch (pRequest->pbCDB[0])
239 drvscsihostScatterGatherListCopyFromBuffer(pRequest, &ScsiInquiryReply, sizeof(SCSIINQUIRYDATA));
240 drvscsihostCmdOk(pRequest);
245 drvscsiCmdError(pRequest, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_NONE);
258 if (pRequest->uDataDirection == PDMSCSIREQUESTTXDIR_UNKNOWN)
259 uTxDir = drvscsihostGetTransferDirectionFromCommand(pRequest->pbCDB[0]);
261 uTxDir = pRequest->uDataDirection;
272 ScsiIoReq.cmd_len = pRequest->cbCDB;
273 ScsiIoReq.mx_sb_len = pRequest->cbSenseBuffer;
274 ScsiIoReq.dxfer_len = pRequest->cbScatterGather;
276 if (pRequest->cScatterGatherEntries > 0)
278 if (pRequest->cScatterGatherEntries == 1)
281 ScsiIoReq.dxferp = pRequest->paScatterGatherHead[0].pvSeg;
285 ScsiIoReq.iovec_count = pRequest->cScatterGatherEntries;
287 paSG = (sg_iovec_t *)RTMemAllocZ(pRequest->cScatterGatherEntries * sizeof(sg_iovec_t));
290 for (unsigned i = 0; i < pRequest->cScatterGatherEntries; i++)
292 paSG[i].iov_base = pRequest->paScatterGatherHead[i].pvSeg;
293 paSG[i].iov_len = pRequest->paScatterGatherHead[i].cbSeg;
299 ScsiIoReq.cmdp = pRequest->pbCDB;
300 ScsiIoReq.sbp = pRequest->pbSenseBuffer;
318 rc = pThis->pDevScsiPort->pfnSCSIRequestCompleted(pThis->pDevScsiPort, pRequest, SCSI_STATUS_OK, false, VINF_SUCCESS);