Changeset 96645 in vbox
- Timestamp:
- Sep 7, 2022 9:25:36 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DevATA.cpp
r96407 r96645 2044 2044 if (cbBlockRegion == cbATAPISector) 2045 2045 rc = pDevR3->pDrvMedia->pfnRead(pDevR3->pDrvMedia, (uint64_t)iATAPILBA * cbATAPISector, 2046 s->abIOBuffer, cbATAPISector * cSectors);2046 s->abIOBuffer, cbATAPISector * cSectors); 2047 2047 else 2048 2048 { … … 2305 2305 AssertLogRelReturn((uintptr_t)(pbBuf - &s->abIOBuffer[0]) + cbCurrTX <= sizeof(s->abIOBuffer), false); 2306 2306 rc = pDevR3->pDrvMedia->pfnSendCmd(pDevR3->pDrvMedia, abATAPICmd, ATAPI_PACKET_SIZE, (PDMMEDIATXDIR)s->uTxDir, 2307 pbBuf, &cbCurrTX, abATAPISense, sizeof(abATAPISense), 30000 /**< @todo timeout */);2307 pbBuf, &cbCurrTX, abATAPISense, sizeof(abATAPISense), 30000 /**< @todo timeout */); 2308 2308 if (rc != VINF_SUCCESS) 2309 2309 break; … … 2349 2349 AssertLogRelReturn(cbTransfer <= sizeof(s->abIOBuffer), false); 2350 2350 rc = pDevR3->pDrvMedia->pfnSendCmd(pDevR3->pDrvMedia, s->abATAPICmd, ATAPI_PACKET_SIZE, (PDMMEDIATXDIR)s->uTxDir, 2351 s->abIOBuffer, &cbTransfer, abATAPISense, sizeof(abATAPISense), 30000 /**< @todo timeout */);2351 s->abIOBuffer, &cbTransfer, abATAPISense, sizeof(abATAPISense), 30000 /**< @todo timeout */); 2352 2352 } 2353 2353 if (pProf) { STAM_PROFILE_ADV_STOP(pProf, b); } … … 3182 3182 pbBuf[13] = 0x00; /* no subchannel reads supported */ 3183 3183 pbBuf[14] = (1 << 0) | (1 << 3) | (1 << 5); /* lock supported, eject supported, tray type loading mechanism */ 3184 if (pDevR3->pDrvMount ->pfnIsLocked(pDevR3->pDrvMount))3184 if (pDevR3->pDrvMount && pDevR3->pDrvMount->pfnIsLocked(pDevR3->pDrvMount)) 3185 3185 pbBuf[14] |= 1 << 1; /* report lock state */ 3186 3186 pbBuf[15] = 0; /* no subchannel reads supported, no separate audio volume control, no changer etc. */ … … 3495 3495 atapiR3CmdErrorSimple(pCtl, s, SCSI_SENSE_UNIT_ATTENTION, SCSI_ASC_MEDIUM_MAY_HAVE_CHANGED); /* media changed */ 3496 3496 } 3497 else if (pDevR3->pDrvMount->pfnIsMounted(pDevR3->pDrvMount))3498 atapiR3CmdOK(pCtl, s);3499 3497 else 3500 atapiR3CmdErrorSimple(pCtl, s, SCSI_SENSE_NOT_READY, SCSI_ASC_MEDIUM_NOT_PRESENT); 3498 { 3499 PPDMIMOUNT const pDrvMount = pDevR3->pDrvMount; 3500 if (pDrvMount && pDrvMount->pfnIsMounted(pDrvMount)) 3501 atapiR3CmdOK(pCtl, s); 3502 else 3503 atapiR3CmdErrorSimple(pCtl, s, SCSI_SENSE_NOT_READY, SCSI_ASC_MEDIUM_NOT_PRESENT); 3504 } 3501 3505 break; 3502 3506 case SCSI_GET_EVENT_STATUS_NOTIFICATION: … … 3541 3545 break; 3542 3546 case SCSI_PREVENT_ALLOW_MEDIUM_REMOVAL: 3543 if (pDevR3->pDrvMount->pfnIsMounted(pDevR3->pDrvMount)) 3547 { 3548 PPDMIMOUNT const pDrvMount = pDevR3->pDrvMount; 3549 if (pDrvMount && pDrvMount->pfnIsMounted(pDrvMount)) 3544 3550 { 3545 3551 if (pbPacket[4] & 1) 3546 pD evR3->pDrvMount->pfnLock(pDevR3->pDrvMount);3552 pDrvMount->pfnLock(pDrvMount); 3547 3553 else 3548 pD evR3->pDrvMount->pfnUnlock(pDevR3->pDrvMount);3554 pDrvMount->pfnUnlock(pDrvMount); 3549 3555 atapiR3CmdOK(pCtl, s); 3550 3556 } … … 3552 3558 atapiR3CmdErrorSimple(pCtl, s, SCSI_SENSE_NOT_READY, SCSI_ASC_MEDIUM_NOT_PRESENT); 3553 3559 break; 3560 } 3554 3561 case SCSI_READ_10: 3555 3562 case SCSI_READ_12: … … 3561 3568 break; 3562 3569 } 3563 else if (!pDevR3->pDrvMount->pfnIsMounted(pDevR3->pDrvMount))3570 if (!pDevR3->pDrvMount || !pDevR3->pDrvMount->pfnIsMounted(pDevR3->pDrvMount)) 3564 3571 { 3565 3572 atapiR3CmdErrorSimple(pCtl, s, SCSI_SENSE_NOT_READY, SCSI_ASC_MEDIUM_NOT_PRESENT); … … 3581 3588 VDREGIONDATAFORM enmDataForm = VDREGIONDATAFORM_INVALID; 3582 3589 int rc = pDevR3->pDrvMedia->pfnQueryRegionPropertiesForLba(pDevR3->pDrvMedia, iATAPILBA, 3583 NULL, NULL, NULL, &enmDataForm);3590 NULL, NULL, NULL, &enmDataForm); 3584 3591 if (RT_UNLIKELY( rc == VERR_NOT_FOUND 3585 3592 || ((uint64_t)iATAPILBA + cSectors > s->cTotalSectors))) … … 3627 3634 break; 3628 3635 } 3629 else if (!pDevR3->pDrvMount->pfnIsMounted(pDevR3->pDrvMount))3636 if (!pDevR3->pDrvMount || !pDevR3->pDrvMount->pfnIsMounted(pDevR3->pDrvMount)) 3630 3637 { 3631 3638 atapiR3CmdErrorSimple(pCtl, s, SCSI_SENSE_NOT_READY, SCSI_ASC_MEDIUM_NOT_PRESENT); … … 3731 3738 break; 3732 3739 } 3733 else if (!pDevR3->pDrvMount->pfnIsMounted(pDevR3->pDrvMount))3740 if (!pDevR3->pDrvMount || !pDevR3->pDrvMount->pfnIsMounted(pDevR3->pDrvMount)) 3734 3741 { 3735 3742 atapiR3CmdErrorSimple(pCtl, s, SCSI_SENSE_NOT_READY, SCSI_ASC_MEDIUM_NOT_PRESENT); … … 3768 3775 /* This must be done from EMT. */ 3769 3776 PATASTATER3 pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PATASTATER3); 3770 3771 ataR3LockLeave(pDevIns, pCtl); 3772 rc = PDMDevHlpVMReqPriorityCallWait(pDevIns, VMCPUID_ANY, 3773 (PFNRT)pDevR3->pDrvMount->pfnUnmount, 3, 3774 pDevR3->pDrvMount, false /*=fForce*/, true /*=fEject*/); 3775 Assert(RT_SUCCESS(rc) || rc == VERR_PDM_MEDIA_LOCKED || rc == VERR_PDM_MEDIA_NOT_MOUNTED); 3776 if (RT_SUCCESS(rc) && pThisCC->pMediaNotify) 3777 PPDMIMOUNT pDrvMount = pDevR3->pDrvMount; 3778 if (pDrvMount) 3777 3779 { 3778 rc = PDMDevHlpVMReqCallNoWait(pDevIns, VMCPUID_ANY, 3779 (PFNRT)pThisCC->pMediaNotify->pfnEjected, 2, 3780 pThisCC->pMediaNotify, s->iLUN); 3781 AssertRC(rc); 3780 ataR3LockLeave(pDevIns, pCtl); 3781 3782 rc = PDMDevHlpVMReqPriorityCallWait(pDevIns, VMCPUID_ANY, 3783 (PFNRT)pDrvMount->pfnUnmount, 3, 3784 pDrvMount, false /*=fForce*/, true /*=fEject*/); 3785 Assert(RT_SUCCESS(rc) || rc == VERR_PDM_MEDIA_LOCKED || rc == VERR_PDM_MEDIA_NOT_MOUNTED); 3786 if (RT_SUCCESS(rc) && pThisCC->pMediaNotify) 3787 { 3788 rc = PDMDevHlpVMReqCallNoWait(pDevIns, VMCPUID_ANY, 3789 (PFNRT)pThisCC->pMediaNotify->pfnEjected, 2, 3790 pThisCC->pMediaNotify, s->iLUN); 3791 AssertRC(rc); 3792 } 3793 3794 ataR3LockEnter(pDevIns, pCtl); 3782 3795 } 3783 3784 ataR3LockEnter(pDevIns, pCtl);3796 else 3797 rc = VINF_SUCCESS; 3785 3798 break; 3786 3799 } … … 3814 3827 break; 3815 3828 } 3816 else if (!pDevR3->pDrvMount->pfnIsMounted(pDevR3->pDrvMount))3829 if (!pDevR3->pDrvMount || !pDevR3->pDrvMount->pfnIsMounted(pDevR3->pDrvMount)) 3817 3830 { 3818 3831 atapiR3CmdErrorSimple(pCtl, s, SCSI_SENSE_NOT_READY, SCSI_ASC_MEDIUM_NOT_PRESENT); … … 3849 3862 break; 3850 3863 } 3851 else if (!pDevR3->pDrvMount->pfnIsMounted(pDevR3->pDrvMount))3864 if (!pDevR3->pDrvMount && !pDevR3->pDrvMount->pfnIsMounted(pDevR3->pDrvMount)) 3852 3865 { 3853 3866 atapiR3CmdErrorSimple(pCtl, s, SCSI_SENSE_NOT_READY, SCSI_ASC_MEDIUM_NOT_PRESENT); … … 3863 3876 break; 3864 3877 } 3865 else if (!pDevR3->pDrvMount->pfnIsMounted(pDevR3->pDrvMount))3878 if (!pDevR3->pDrvMount || !pDevR3->pDrvMount->pfnIsMounted(pDevR3->pDrvMount)) 3866 3879 { 3867 3880 atapiR3CmdErrorSimple(pCtl, s, SCSI_SENSE_NOT_READY, SCSI_ASC_MEDIUM_NOT_PRESENT); … … 3878 3891 break; 3879 3892 } 3880 else if (!pDevR3->pDrvMount->pfnIsMounted(pDevR3->pDrvMount))3893 if (!pDevR3->pDrvMount || !pDevR3->pDrvMount->pfnIsMounted(pDevR3->pDrvMount)) 3881 3894 { 3882 3895 atapiR3CmdErrorSimple(pCtl, s, SCSI_SENSE_NOT_READY, SCSI_ASC_MEDIUM_NOT_PRESENT); … … 3896 3909 break; 3897 3910 case SCSI_READ_DVD_STRUCTURE: 3898 {3899 3911 cbMax = scsiBE2H_U16(pbPacket + 8); 3900 3912 ataR3StartTransfer(pDevIns, pCtl, s, RT_MIN(cbMax, 4), PDMMEDIATXDIR_FROM_DEVICE, ATAFN_BT_ATAPI_CMD, ATAFN_SS_ATAPI_READ_DVD_STRUCTURE, true); 3901 3913 break; 3902 }3903 3914 default: 3904 3915 atapiR3CmdErrorSimple(pCtl, s, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_ILLEGAL_OPCODE); … … 4068 4079 { 4069 4080 uint64_t cBlocks = 0; 4070 int rc = pIfR3->pDrvMedia->pfnQueryRegionProperties(pIfR3->pDrvMedia, i, NULL, &cBlocks, 4071 NULL, NULL); 4081 int rc = pIfR3->pDrvMedia->pfnQueryRegionProperties(pIfR3->pDrvMedia, i, NULL, &cBlocks, NULL, NULL); 4072 4082 AssertRC(rc); 4073 4083 pIf->cTotalSectors += cBlocks;
Note:
See TracChangeset
for help on using the changeset viewer.