Changeset 104221 in vbox for trunk/src/VBox/Devices/Storage/VSCSI/VSCSILunSbc.cpp
- Timestamp:
- Apr 8, 2024 10:18:11 AM (10 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/VSCSI/VSCSILunSbc.cpp
r103882 r104221 231 231 else 232 232 { 233 SCSIINQUIRYDATA ScsiInquiryReply; 234 235 vscsiReqSetXferSize(pVScsiReq, RT_MIN(sizeof(SCSIINQUIRYDATA), scsiBE2H_U16(&pVScsiReq->pbCDB[3]))); 236 memset(&ScsiInquiryReply, 0, sizeof(ScsiInquiryReply)); 237 238 ScsiInquiryReply.cbAdditional = 31; 239 ScsiInquiryReply.u5PeripheralDeviceType = SCSI_INQUIRY_DATA_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS; 240 ScsiInquiryReply.u3PeripheralQualifier = SCSI_INQUIRY_DATA_PERIPHERAL_QUALIFIER_CONNECTED; 241 ScsiInquiryReply.u3AnsiVersion = 0x05; /* SPC-4 compliant */ 242 ScsiInquiryReply.fCmdQue = 1; /* Command queuing supported. */ 243 ScsiInquiryReply.fWBus16 = 1; 244 245 const char *pszVendorId = "VBOX"; 246 const char *pszProductId = "HARDDISK"; 247 const char *pszProductLevel = "1.0"; 248 int rcTmp = vscsiLunQueryInqStrings(pVScsiLun, &pszVendorId, &pszProductId, &pszProductLevel); 249 Assert(RT_SUCCESS(rcTmp) || rcTmp == VERR_NOT_FOUND); RT_NOREF(rcTmp); 250 251 scsiPadStrS(ScsiInquiryReply.achVendorId, pszVendorId, 8); 252 scsiPadStrS(ScsiInquiryReply.achProductId, pszProductId, 16); 253 scsiPadStrS(ScsiInquiryReply.achProductLevel, pszProductLevel, 4); 254 255 RTSgBufCopyFromBuf(&pVScsiReq->SgBuf, (uint8_t *)&ScsiInquiryReply, sizeof(SCSIINQUIRYDATA)); 256 rcReq = vscsiLunReqSenseOkSet(pVScsiLun, pVScsiReq); 233 if (pVScsiReq->cbCDB >= 5) 234 { 235 SCSIINQUIRYDATA ScsiInquiryReply; 236 237 vscsiReqSetXferSize(pVScsiReq, RT_MIN(sizeof(SCSIINQUIRYDATA), scsiBE2H_U16(&pVScsiReq->pbCDB[3]))); 238 memset(&ScsiInquiryReply, 0, sizeof(ScsiInquiryReply)); 239 240 ScsiInquiryReply.cbAdditional = 31; 241 ScsiInquiryReply.u5PeripheralDeviceType = SCSI_INQUIRY_DATA_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS; 242 ScsiInquiryReply.u3PeripheralQualifier = SCSI_INQUIRY_DATA_PERIPHERAL_QUALIFIER_CONNECTED; 243 ScsiInquiryReply.u3AnsiVersion = 0x05; /* SPC-4 compliant */ 244 ScsiInquiryReply.fCmdQue = 1; /* Command queuing supported. */ 245 ScsiInquiryReply.fWBus16 = 1; 246 247 const char *pszVendorId = "VBOX"; 248 const char *pszProductId = "HARDDISK"; 249 const char *pszProductLevel = "1.0"; 250 int rcTmp = vscsiLunQueryInqStrings(pVScsiLun, &pszVendorId, &pszProductId, &pszProductLevel); 251 Assert(RT_SUCCESS(rcTmp) || rcTmp == VERR_NOT_FOUND); RT_NOREF(rcTmp); 252 253 scsiPadStrS(ScsiInquiryReply.achVendorId, pszVendorId, 8); 254 scsiPadStrS(ScsiInquiryReply.achProductId, pszProductId, 16); 255 scsiPadStrS(ScsiInquiryReply.achProductLevel, pszProductLevel, 4); 256 257 RTSgBufCopyFromBuf(&pVScsiReq->SgBuf, (uint8_t *)&ScsiInquiryReply, sizeof(SCSIINQUIRYDATA)); 258 rcReq = vscsiLunReqSenseOkSet(pVScsiLun, pVScsiReq); 259 } 260 else 261 rcReq = vscsiLunReqSenseErrorSet(pVScsiLun, pVScsiReq, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_INVALID_MESSAGE, 0x00); 257 262 } 258 263 break; … … 422 427 423 428 vscsiReqSetXferDir(pVScsiReq, VSCSIXFERDIR_T2I); 424 vscsiReqSetXferSize(pVScsiReq, scsiBE2H_U 16(&pVScsiReq->pbCDB[6]));429 vscsiReqSetXferSize(pVScsiReq, scsiBE2H_U24(&pVScsiReq->pbCDB[6])); 425 430 426 431 switch (uDataMode) … … 630 635 } 631 636 637 638 /** 639 * The supported operation codes for the SBC LUN type. 640 * 641 * @note This gives the minimum size required by our implementation 642 * which may be smaller than what the spec defines (for example 643 * we do not access the control byte at the end). 644 */ 645 static uint8_t s_acbCdbOpc[] = 646 { 647 VSCSI_LUN_CDB_SZ_INVALID_X8, /**< 0x00 - 0x07 Invalid */ 648 5, /**< 0x08 READ (6) */ 649 VSCSI_LUN_CDB_SZ_INVALID, /**< 0x09 Invalid */ 650 5, /**< 0x0a WRITE (6) */ 651 VSCSI_LUN_CDB_SZ_INVALID, /**< 0x0b Invalid */ 652 VSCSI_LUN_CDB_SZ_INVALID_X4, /**< 0x0c - 0x0f Invalid */ 653 654 VSCSI_LUN_CDB_SZ_INVALID_X2, /**< 0x10 - 0x11 Invalid */ 655 3, /**< 0x12 INQUIRY (at least 3) */ 656 VSCSI_LUN_CDB_SZ_INVALID_X2, /**< 0x13 - 0x14 Invalid */ 657 5, /**< 0x15 MODE SELECT (6) */ 658 VSCSI_LUN_CDB_SZ_INVALID_X4, /**< 0x16 - 0x19 Invalid */ 659 5, /**< 0x1a MODE SENSE (6) */ 660 1, /**< 0x1b START STOP UNIT */ 661 VSCSI_LUN_CDB_SZ_INVALID_X4, /**< 0x1c - 0x1f Invalid */ 662 663 VSCSI_LUN_CDB_SZ_INVALID_X4, /**< 0x20 - 0x23 Invalid */ 664 VSCSI_LUN_CDB_SZ_INVALID, /**< 0x24 Invalid */ 665 1, /**< 0x25 READ CAPACITY */ 666 VSCSI_LUN_CDB_SZ_INVALID_X2, /**< 0x26 - 0x27 Invalid */ 667 9, /**< 0x28 READ (10) */ 668 VSCSI_LUN_CDB_SZ_INVALID, /**< 0x29 Invalid */ 669 9, /**< 0x2a WRITE (10) */ 670 VSCSI_LUN_CDB_SZ_INVALID_X4, /**< 0x2b - 0x2e Invalid */ 671 1, /**< 0x2f VERIFY (10) */ 672 673 VSCSI_LUN_CDB_SZ_INVALID_X4, /**< 0x30 - 0x33 Invalid */ 674 VSCSI_LUN_CDB_SZ_INVALID, /**< 0x34 Invalid */ 675 1, /**< 0x35 SYNCHRONIZE CACHE */ 676 VSCSI_LUN_CDB_SZ_INVALID_X4, /**< 0x36 - 0x39 Invalid */ 677 VSCSI_LUN_CDB_SZ_INVALID_X2, /**< 0x3a - 0x3b Invalid */ 678 8, /**< 0x3c READ BUFFER */ 679 VSCSI_LUN_CDB_SZ_INVALID, /**< 0x3d Invalid */ 680 VSCSI_LUN_CDB_SZ_INVALID_X2, /**< 0x3e - 0x3f Invalid */ 681 682 VSCSI_LUN_CDB_SZ_INVALID_X2, /**< 0x40 - 0x41 Invalid */ 683 9, /**< 0x42 UNMAP */ 684 VSCSI_LUN_CDB_SZ_INVALID, /**< 0x43 Invalid */ 685 VSCSI_LUN_CDB_SZ_INVALID_X8, /**< 0x44 - 0x4b Invalid */ 686 VSCSI_LUN_CDB_SZ_INVALID, /**< 0x4c Invalid */ 687 9, /**< 0x4d LOG SENSE */ 688 VSCSI_LUN_CDB_SZ_INVALID_X2, /**< 0x4e - 0x4f Invalid */ 689 690 VSCSI_LUN_CDB_SZ_INVALID_X16, /**< 0x50 - 0x5f Invalid */ 691 VSCSI_LUN_CDB_SZ_INVALID_X16, /**< 0x60 - 0x6f Invalid */ 692 VSCSI_LUN_CDB_SZ_INVALID_X16, /**< 0x70 - 0x7f Invalid */ 693 694 VSCSI_LUN_CDB_SZ_INVALID_X8, /**< 0x80 - 0x87 Invalid */ 695 14, /**< 0x88 READ (16) */ 696 VSCSI_LUN_CDB_SZ_INVALID, /**< 0x89 Invalid */ 697 14, /**< 0x8a WRITE (16) */ 698 VSCSI_LUN_CDB_SZ_INVALID, /**< 0x8b Invalid */ 699 VSCSI_LUN_CDB_SZ_INVALID_X4, /**< 0x8c - 0x8f Invalid */ 700 701 VSCSI_LUN_CDB_SZ_INVALID_X8, /**< 0x90 - 0x97 Invalid */ 702 VSCSI_LUN_CDB_SZ_INVALID_X4, /**< 0x98 - 0x9b Invalid */ 703 VSCSI_LUN_CDB_SZ_INVALID_X2, /**< 0x9c - 0x9d Invalid */ 704 2, /**< 0x9e SERVICE ACTION IN (16) (at least 2). */ 705 VSCSI_LUN_CDB_SZ_INVALID, /**< 0x9f Invalid */ 706 707 VSCSI_LUN_CDB_SZ_INVALID_X8, /**< 0xa0 - 0xa7 Invalid */ 708 10, /**< 0xa8 READ (12) */ 709 VSCSI_LUN_CDB_SZ_INVALID, /**< 0xa9 Invalid */ 710 10, /**< 0xaa WRITE (12) */ 711 VSCSI_LUN_CDB_SZ_INVALID, /**< 0xab Invalid */ 712 VSCSI_LUN_CDB_SZ_INVALID_X4, /**< 0xac - 0xaf Invalid */ 713 714 VSCSI_LUN_CDB_SZ_INVALID_X16, /**< 0xb0 - 0xbf Invalid */ 715 VSCSI_LUN_CDB_SZ_INVALID_X16, /**< 0xc0 - 0xcf Invalid */ 716 VSCSI_LUN_CDB_SZ_INVALID_X16, /**< 0xd0 - 0xdf Invalid */ 717 VSCSI_LUN_CDB_SZ_INVALID_X16, /**< 0xe0 - 0xef Invalid */ 718 VSCSI_LUN_CDB_SZ_INVALID_X16 /**< 0xf0 - 0xff Invalid */ 719 }; 720 AssertCompileSize(s_acbCdbOpc, 256 * sizeof(uint8_t)); 721 722 632 723 VSCSILUNDESC g_VScsiLunTypeSbc = 633 724 { … … 638 729 /** cbLun */ 639 730 sizeof(VSCSILUNSBC), 731 /** pacbCdbOpc */ 732 &s_acbCdbOpc[0], 640 733 /** cSupOpcInfo */ 641 734 0,
Note:
See TracChangeset
for help on using the changeset viewer.