Changeset 80528 in vbox
- Timestamp:
- Sep 1, 2019 10:28:39 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/scsi.h
r80527 r80528 219 219 #define SCSI_ASC_MEDIUM_NOT_PRESENT 0x3a 220 220 #define SCSI_ASC_SAVING_PARAMETERS_NOT_SUPPORTED 0x39 221 #define SCSI_ASC_INTERNAL_TARGET_FAILURE 0x44 221 222 #define SCSI_ASC_INVALID_MESSAGE 0x49 222 223 #define SCSI_ASC_MEDIA_LOAD_OR_EJECT_FAILED 0x53 … … 224 225 #define SCSI_ASC_SYSTEM_RESOURCE_FAILURE 0x55 225 226 #define SCSI_ASC_ILLEGAL_MODE_FOR_THIS_TRACK 0x64 227 #define SCSI_ASC_COMMAND_TO_LOGICAL_UNIT_FAILED 0x6E 226 228 227 229 /** Additional sense code qualifiers (ASCQ). */ -
trunk/src/VBox/Devices/Storage/DevVirtioSCSI.cpp
r80527 r80528 513 513 } 514 514 for (int j = 0; j < 16; j++ ) { 515 515 if (i * 16 + j >= cb) 516 516 Log2((" ")); 517 518 519 517 else 518 { 519 uint8_t u8 = pv[i * 16 + j]; 520 520 Log2(("%c", u8 >= 0x20 && u8 <= 0x7e ? u8 : '.')); 521 521 } 522 522 } 523 523 Log2(("\n")); 524 }525 Log2(("\n"));524 } 525 Log2(("\n")); 526 526 } 527 527 DECLINLINE(const char *) virtioGetTMFTypeText(uint32_t uSubType) … … 590 590 switch (uScsiStatusCode) 591 591 { 592 case 0x00: return "G ood";593 case 0x02: return "C heck Condition";594 case 0x04: return "C ondition Met";595 case 0x08: return "B usy";596 case 0x10: return "I ntermediate (obsolete)";597 case 0x14: return "C ondition Met (obsolete)";598 case 0x18: return "R eservation Conflict";599 case 0x22: return "C ommand Terminated";600 case 0x28: return "T ask Set Full";601 case 0x30: return "ACA A ctive";602 case 0x40: return "T ask Aborted";603 default: return "< unknown>";592 case 0x00: return "GOOD"; 593 case 0x02: return "CHECK CONDITION"; 594 case 0x04: return "CONDITION MET"; 595 case 0x08: return "BUSY"; 596 case 0x10: return "INTERMEDIATE"; 597 case 0x14: return "CONDITION MET"; 598 case 0x18: return "RESERVATION CONFLICT"; 599 case 0x22: return "COMMAND TERMINATED"; 600 case 0x28: return "TASK SET FULL"; 601 case 0x30: return "ACA ACTIVE"; 602 case 0x40: return "TASK ABORTED"; 603 default: return "<UNKNOWN CODE>"; 604 604 } 605 605 } … … 732 732 733 733 /** DrvSCSI.cpp, that issues this callback, just sticks one segment in the buffer */ 734 // memset(pReq->pbDataIn + offDst, 0, cbCopy); 735 LogFunc(("*** pSgBuf->cbSegLeft=%d\n", pSgBuf->cbSegLeft)); 734 736 memcpy(pReq->pbDataIn + offDst, pSgBuf->paSegs[0].pvSeg, cbCopy); 735 737 return VINF_SUCCESS; … … 749 751 PVIRTIOSCSIREQ pReq = (PVIRTIOSCSIREQ)pvIoReqAlloc; 750 752 /** DrvSCSI.cpp, that issues this callback, just sticks one segment in the buffer */ 753 751 754 memcpy(pSgBuf->paSegs[0].pvSeg, pReq->pbDataOut + offSrc, cbCopy); 752 755 … … 828 831 ASMAtomicDecU32(&pTarget->cReqsInProgress); 829 832 830 size_t cbResidual = 0 ;833 size_t cbResidual = 0, cbXfer = 0; 831 834 int rc = pIMediaEx->pfnIoReqQueryResidual(pIMediaEx, pReq->hIoReq, &cbResidual); 832 AssertRC(rc); Assert(cbResidual == (uint32_t)cbResidual); 835 AssertRC(rc); 836 837 rc = pIMediaEx->pfnIoReqQueryXferSize(pIMediaEx, pReq->hIoReq, &cbXfer); 838 AssertRC(rc); 833 839 834 840 /** … … 845 851 respHdr.uStatusQualifier = 0; 846 852 847 LogFunc(("Status: %s (0x%x%x) Response: %s (0x%x%x)\n", 848 virtioGetScsiStatusText(pReq->uStatus), pReq->uStatus >> 4 & 0xf, pReq->uStatus & 0xf, 849 virtioGetReqRespText(respHdr.uResponse), respHdr.uResponse >> 4 & 0xf, respHdr.uResponse & 0xf)); 853 LogFunc(("status: %s response: %s 0x%x%x/0x%x%x cbXfer=%d, cbResidual: %u\n", 854 virtioGetScsiStatusText(pReq->uStatus), virtioGetReqRespText(respHdr.uResponse), 855 pReq->uStatus >> 4 & 0xf, pReq->uStatus & 0xf, 856 respHdr.uResponse >> 4 & 0xf, respHdr.uResponse & 0xf, 857 cbXfer, cbResidual)); 850 858 851 859 if (pReq->cbSense) 852 860 { 853 pReq->pbSense[12] = 0x25;854 pReq->pbSense[13] = 0x00;855 861 Log2Func(("Sense: %s\n", SCSISenseText(pReq->pbSense[2]))); 856 862 Log2Func(("Sense Ext3: %s\n", SCSISenseExtText(pReq->pbSense[12], pReq->pbSense[13]))); … … 986 992 uint32_t uLUN = (pVirtqReq->cmdHdr.uLUN[2] << 8 | pVirtqReq->cmdHdr.uLUN[3]) & 0x3fff; 987 993 988 LogFunc(("[%s] %*s(Target: %d LUN: %d) CDB: %.*Rhxs\n",994 LogFunc(("[%s] (Target: %d LUN: %d) CDB: %.*Rhxs\n", 989 995 SCSICmdText(pbCdb[0]), uTarget, uLUN, 990 996 virtioScsiEstimateCdbLen(pbCdb[0], pThis->virtioScsiConfig.uCdbSize), pbCdb)); … … 992 998 Log3Func((" id: %RX64, attr: %x, prio: %d, crn: %x\n", 993 999 pVirtqReq->cmdHdr.uId, pVirtqReq->cmdHdr.uTaskAttr, pVirtqReq->cmdHdr.uPrio, pVirtqReq->cmdHdr.uCrn)); 994 995 1000 996 1001 off_t uPiOutOff = 0; … … 1080 1085 pReq->pbDataOut = pbDataOut; 1081 1086 pReq->cbPiIn = cbPiIn; 1087 1082 1088 if (cbPiIn) 1083 1089 { … … 1109 1115 if (rc != VINF_PDM_MEDIAEX_IOREQ_IN_PROGRESS) 1110 1116 { 1117 /** 1118 * This rc value from DrvSCSI/send SCSI cmd means the request failed early 1119 * (no mem, buf copy callback, request buffer creation, or req enqueue), 1120 * and not submitted to lower layers, error it out. 1121 */ 1122 LogRel(("Error submitting request!\n")); 1111 1123 size_t cbResidual; 1112 1124 pIMediaEx->pfnIoReqQueryResidual(pIMediaEx, pReq->hIoReq, &cbResidual); 1113 respHdr.cbSense = 0; 1114 respHdr.uResidual = (uint32_t)cbResidual; 1115 respHdr.uStatus = SCSI_STATUS_OK; 1116 respHdr.uResponse = VIRTIOSCSI_S_OK; 1125 uint8_t uASC, uASCQ = 0; 1126 switch (rc) 1127 { 1128 case VERR_NO_MEMORY: 1129 uASC = SCSI_ASC_SYSTEM_RESOURCE_FAILURE; 1130 break; 1131 default: 1132 uASC = SCSI_ASC_INTERNAL_TARGET_FAILURE; 1133 break; 1134 } 1135 uint8_t pbSense[] = { RT_BIT(7) | SCSI_SENSE_RESPONSE_CODE_CURR_FIXED, 0, SCSI_SENSE_VENDOR_SPECIFIC, 1136 0, 0, 0, 0, 10, uASC, uASCQ, 0 }; 1137 respHdr.cbSense = sizeof(pbSense); 1138 respHdr.uResidual = cbDataIn + cbDataOut; 1139 respHdr.uStatus = SCSI_STATUS_CHECK_CONDITION; 1140 respHdr.uResponse = VIRTIOSCSI_S_FAILURE; 1117 1141 respHdr.uStatusQualifier = 0; 1118 1142 virtioScsiReqFinish(pThis, qIdx, &respHdr, NULL /* pbSense */); … … 1120 1144 } 1121 1145 } else { 1122 respHdr.cbSense = 0; 1123 respHdr.uResidual = cbDataOut + cbDataIn; 1124 respHdr.uStatus = SCSI_STATUS_OK; 1146 LogRel(("Error submitting request, target not present!!\n")); 1147 uint8_t pbSense[] = { RT_BIT(7) | SCSI_SENSE_RESPONSE_CODE_CURR_FIXED, 0, SCSI_SENSE_NOT_READY, 1148 0, 0, 0, 0, 10, 0, 0, 0 }; 1149 respHdr.cbSense = sizeof(pbSense); 1150 respHdr.uResidual = cbDataIn + cbDataOut; 1151 respHdr.uStatus = SCSI_STATUS_CHECK_CONDITION; 1125 1152 respHdr.uResponse = VIRTIOSCSI_S_TARGET_FAILURE; 1126 1153 respHdr.uStatusQualifier = 0; 1127 virtioScsiReqFinish(pThis, qIdx, &respHdr, NULL /* pbSense */);1154 virtioScsiReqFinish(pThis, qIdx, &respHdr, NULL /* pbSense */); 1128 1155 return VINF_SUCCESS; 1129 1130 1156 } 1131 1157 -
trunk/src/VBox/Devices/VirtIO/Virtio_1_0.cpp
r80527 r80528 826 826 { 827 827 pVirtio->uISR = *(uint8_t *)pv; 828 Log 2Func(("Setting uISR = 0x%02x (virtq interrupt: %d, dev confg interrupt: %d)\n",828 Log3Func(("Setting uISR = 0x%02x (virtq interrupt: %d, dev confg interrupt: %d)\n", 829 829 pVirtio->uISR & 0xff, 830 830 pVirtio->uISR & VIRTIO_ISR_VIRTQ_INTERRUPT,
Note:
See TracChangeset
for help on using the changeset viewer.