Changeset 43596 in vbox
- Timestamp:
- Oct 10, 2012 2:11:05 PM (12 years ago)
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 2 edited
-
Storage/DevAHCI.cpp (modified) (11 diffs)
-
testcase/tstDeviceStructSizeRC.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DevAHCI.cpp
r43472 r43596 56 56 #include "PIIX3ATABmDma.h" 57 57 #include "ide.h" 58 #include "ATAPIPassthrough.h" 58 59 #include "VBoxDD.h" 59 60 … … 125 126 /* Media track type */ 126 127 #define ATA_MEDIA_TYPE_UNKNOWN 0 /**< unknown CD type */ 127 #define ATA_MEDIA_TYPE_DATA 1 /**< Data CD */128 #define ATA_MEDIA_TYPE_CDDA 2 /**< CD-DA (audio) CD type */129 128 130 129 /** ATAPI sense info size. */ … … 516 515 /** First task throwing an error. */ 517 516 R3PTRTYPE(volatile PAHCIREQ) pTaskErr; 518 519 #if HC_ARCH_BITS == 32 520 uint32_t u32Alignment4; 521 #endif 517 /** The current tracklist of the loaded medium if passthrough is used. */ 518 R3PTRTYPE(PTRACKLIST) pTrackList; 522 519 523 520 /** Release statistics: number of DMA commands. */ … … 3015 3012 p[102] = RT_H2LE_U16(pAhciPort->cTotalSectors >> 32); 3016 3013 p[103] = RT_H2LE_U16(pAhciPort->cTotalSectors >> 48); 3014 3017 3015 if (pAhciPort->fNonRotational) 3018 3016 p[217] = RT_H2LE_U16(1); /* Non-rotational medium */ … … 3970 3968 if (RT_SUCCESS(rc)) 3971 3969 { 3972 Assert(cbTransfer <= pAhciReq->cbTransfer); 3970 /* Do post processing for certain commands. */ 3971 switch (pAhciReq->aATAPICmd[0]) 3972 { 3973 case SCSI_SEND_CUE_SHEET: 3974 case SCSI_READ_TOC_PMA_ATIP: 3975 { 3976 if (!pAhciPort->pTrackList) 3977 rc = ATAPIPassthroughTrackListCreateEmpty(&pAhciPort->pTrackList); 3978 3979 if (RT_SUCCESS(rc)) 3980 rc = ATAPIPassthroughTrackListUpdate(pAhciPort->pTrackList, pAhciReq->aATAPICmd, pvBuf); 3981 3982 if ( RT_FAILURE(rc) 3983 && pAhciPort->cErrors++ < MAX_LOG_REL_ERRORS) 3984 LogRel(("AHCI: Error (%Rrc) while updating the tracklist during %s, burning the disc might fail\n", 3985 rc, pAhciReq->aATAPICmd[0] == SCSI_SEND_CUE_SHEET ? "SEND CUE SHEET" : "READ TOC/PMA/ATIP")); 3986 break; 3987 } 3988 case SCSI_SYNCHRONIZE_CACHE: 3989 { 3990 ATAPIPassthroughTrackListClear(pAhciPort->pTrackList); 3991 break; 3992 } 3993 } 3973 3994 3974 3995 if (pAhciReq->enmTxDir == AHCITXDIR_READ) 3975 3996 { 3997 Assert(cbTransfer <= pAhciReq->cbTransfer); 3998 3976 3999 if (pAhciReq->aATAPICmd[0] == SCSI_INQUIRY) 3977 4000 { … … 3985 4008 if (cbTransfer >= 32 + 4) 3986 4009 ataSCSIPadStr((uint8_t *)pvBuf + 32, "1.0", 4); 3987 }3988 else if ( pAhciReq->aATAPICmd[0] == SCSI_READ_TOC_PMA_ATIP3989 && (pAhciReq->aATAPICmd[2] & 0xf) != 0x053990 && pAhciReq->aATAPICmd[6] != 0xaa)3991 {3992 /* Set the media type if we can detect it. */3993 uint8_t *pbBuf = (uint8_t *)pvBuf;3994 3995 /** @todo: Implemented only for formatted TOC now. */3996 if ( (pAhciReq->aATAPICmd[1] & 0xf) == 03997 && cbTransfer >= 6)3998 {3999 uint32_t NewMediaType;4000 uint32_t OldMediaType;4001 4002 if (pbBuf[5] & 0x4)4003 NewMediaType = ATA_MEDIA_TYPE_DATA;4004 else4005 NewMediaType = ATA_MEDIA_TYPE_CDDA;4006 4007 OldMediaType = ataMediumTypeSet(pAhciPort, NewMediaType);4008 4009 if (OldMediaType != NewMediaType)4010 LogRel(("AHCI: LUN#%d: CD-ROM passthrough, detected %s CD\n",4011 pAhciPort->iLUN,4012 NewMediaType == ATA_MEDIA_TYPE_DATA4013 ? "data"4014 : "audio"));4015 }4016 else /* Play safe and set to unknown. */4017 ataMediumTypeSet(pAhciPort, ATA_MEDIA_TYPE_UNKNOWN);4018 4010 } 4019 4011 … … 4606 4598 goto sendcmd; 4607 4599 case SCSI_READ_CD: 4600 case SCSI_READ_CD_MSF: 4608 4601 { 4609 4602 /* Get sector size based on the expected sector type field. */ … … 4611 4604 { 4612 4605 case 0x0: /* All types. */ 4613 if (ASMAtomicReadU32(&pAhciPort->MediaTrackType) == ATA_MEDIA_TYPE_CDDA) 4614 pAhciReq->cbATAPISector = 2352; 4606 { 4607 uint32_t iLbaStart; 4608 4609 if (pbPacket[0] == SCSI_READ_CD) 4610 iLbaStart = ataBE2H_U32(&pbPacket[2]); 4611 else 4612 iLbaStart = ataMSF2LBA(&pbPacket[3]); 4613 4614 if (pAhciPort->pTrackList) 4615 pAhciReq->cbATAPISector = ATAPIPassthroughTrackListGetSectorSizeFromLba(pAhciPort->pTrackList, iLbaStart); 4615 4616 else 4616 4617 pAhciReq->cbATAPISector = 2048; /* Might be incorrect if we couldn't determine the type. */ 4617 4618 break; 4619 } 4618 4620 case 0x1: /* CD-DA */ 4619 4621 pAhciReq->cbATAPISector = 2352; … … 4636 4638 } 4637 4639 4638 cbTransfer = ataBE2H_U24(pbPacket + 6) * pAhciReq->cbATAPISector; 4640 if (pbPacket[0] == SCSI_READ_CD) 4641 cbTransfer = ataBE2H_U24(pbPacket + 6) * pAhciReq->cbATAPISector; 4642 else /* SCSI_READ_MSF */ 4643 { 4644 cSectors = ataMSF2LBA(pbPacket + 6) - ataMSF2LBA(pbPacket + 3); 4645 if (cSectors > 32) 4646 cSectors = 32; /* Limit transfer size to 64~74K. Safety first. In any case this can only harm software doing CDDA extraction. */ 4647 cbTransfer = cSectors * pAhciReq->cbATAPISector; 4648 } 4639 4649 enmTxDir = AHCITXDIR_READ; 4640 4650 goto sendcmd; 4641 4651 } 4642 case SCSI_READ_CD_MSF:4643 cSectors = ataMSF2LBA(pbPacket + 6) - ataMSF2LBA(pbPacket + 3);4644 if (cSectors > 32)4645 cSectors = 32; /* Limit transfer size to 64~74K. Safety first. In any case this can only harm software doing CDDA extraction. */4646 pAhciReq->cbATAPISector = 2048; /**< @todo this size is not always correct */4647 cbTransfer = cSectors * pAhciReq->cbATAPISector;4648 enmTxDir = AHCITXDIR_READ;4649 goto sendcmd;4650 4652 case SCSI_READ_DISC_INFORMATION: 4651 4653 cbTransfer = ataBE2H_U16(pbPacket + 7); … … 4734 4736 goto sendcmd; 4735 4737 case SCSI_WRITE_10: 4738 case SCSI_WRITE_AND_VERIFY_10: 4736 4739 iATAPILBA = ataBE2H_U32(pbPacket + 2); 4737 4740 cSectors = ataBE2H_U16(pbPacket + 7); 4738 4741 Log2(("ATAPI PT: lba %d sectors %d\n", iATAPILBA, cSectors)); 4739 pAhciReq->cbATAPISector = 2048; /**< @todo this size is not always correct */ 4742 if (pAhciPort->pTrackList) 4743 pAhciReq->cbATAPISector = ATAPIPassthroughTrackListGetSectorSizeFromLba(pAhciPort->pTrackList, iATAPILBA); 4744 else 4745 pAhciReq->cbATAPISector = 2048; 4740 4746 cbTransfer = cSectors * pAhciReq->cbATAPISector; 4741 4747 enmTxDir = AHCITXDIR_WRITE; … … 4745 4751 cSectors = ataBE2H_U32(pbPacket + 6); 4746 4752 Log2(("ATAPI PT: lba %d sectors %d\n", iATAPILBA, cSectors)); 4747 pAhciReq->cbATAPISector = 2048; /**< @todo this size is not always correct */ 4753 if (pAhciPort->pTrackList) 4754 pAhciReq->cbATAPISector = ATAPIPassthroughTrackListGetSectorSizeFromLba(pAhciPort->pTrackList, iATAPILBA); 4755 else 4756 pAhciReq->cbATAPISector = 2048; 4748 4757 cbTransfer = cSectors * pAhciReq->cbATAPISector; 4749 enmTxDir = AHCITXDIR_WRITE;4750 goto sendcmd;4751 case SCSI_WRITE_AND_VERIFY_10:4752 iATAPILBA = ataBE2H_U32(pbPacket + 2);4753 cSectors = ataBE2H_U16(pbPacket + 7);4754 Log2(("ATAPI PT: lba %d sectors %d\n", iATAPILBA, cSectors));4755 /* The sector size is determined by the async I/O thread. */4756 pAhciReq->cbATAPISector = 0;4757 /* Preliminary, will be corrected once the sector size is known. */4758 cbTransfer = cSectors;4759 4758 enmTxDir = AHCITXDIR_WRITE; 4760 4759 goto sendcmd; -
trunk/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp
r43568 r43596 1178 1178 GEN_CHECK_OFF(AHCIPort, aCachedTasks); 1179 1179 GEN_CHECK_OFF(AHCIPort, pTaskErr); 1180 GEN_CHECK_OFF(AHCIPort, pTrackList); 1180 1181 GEN_CHECK_OFF(AHCIPort, StatDMA); 1181 1182 GEN_CHECK_OFF(AHCIPort, StatBytesWritten);
Note:
See TracChangeset
for help on using the changeset viewer.

