VirtualBox

Changeset 43569 in vbox


Ignore:
Timestamp:
Oct 8, 2012 5:15:49 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
81213
Message:

Storage/DevATA: Use the new common code for ATAPI passthrough track list handling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/DevATA.cpp

    r43568 r43569  
    102102/* Media track type */
    103103#define ATA_MEDIA_TYPE_UNKNOWN                  0    /**< unknown CD type */
    104 #define ATA_MEDIA_TYPE_DATA                     1    /**< Data CD */
    105 #define ATA_MEDIA_TYPE_CDDA                     2    /**< CD-DA  (audio) CD type */
    106104#define ATA_MEDIA_NO_DISC                    0x70    /**< Door closed, no medium */
    107105
     
    21282126        {
    21292127            case SCSI_SEND_CUE_SHEET:
     2128            case SCSI_READ_TOC_PMA_ATIP:
    21302129            {
    21312130                if (!s->pTrackList)
     
    21692168                ataSCSIPadStr(s->CTX_SUFF(pbIOBuffer) + 32, "1.0", 4);
    21702169            }
    2171             else if (   s->aATAPICmd[0] == SCSI_READ_TOC_PMA_ATIP
    2172                      && (s->aATAPICmd[2] & 0xf) != 0x05
    2173                      && s->aATAPICmd[6] != 0xaa)
    2174             {
    2175                 /* Set the media type if we can detect it. */
    2176                 uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
    2177 
    2178                 /** @todo: Implemented only for formatted TOC now. */
    2179                 if (   (s->aATAPICmd[2] & 0xf) == 0
    2180                     && cbTransfer >= 6)
    2181                 {
    2182                     uint32_t NewMediaType;
    2183                     uint32_t OldMediaType;
    2184 
    2185                     if (pbBuf[5] & 0x4)
    2186                         NewMediaType = ATA_MEDIA_TYPE_DATA;
    2187                     else
    2188                         NewMediaType = ATA_MEDIA_TYPE_CDDA;
    2189 
    2190                     OldMediaType = ataMediumTypeSet(s, NewMediaType);
    2191 
    2192                     if (OldMediaType != NewMediaType)
    2193                         LogRel(("PIIX3 ATA: LUN#%d: CD-ROM passthrough, detected %s CD\n",
    2194                                 s->iLUN,
    2195                                 NewMediaType == ATA_MEDIA_TYPE_DATA
    2196                                 ? "data"
    2197                                 : "audio"));
    2198                 }
    2199                 else /* Play safe and set to unknown. */
    2200                     ataMediumTypeSet(s, ATA_MEDIA_TYPE_UNKNOWN);
    2201             }
     2170
    22022171            if (cbTransfer)
    22032172                Log3(("ATAPI PT data read (%d): %.*Rhxs\n", cbTransfer, cbTransfer, s->CTX_SUFF(pbIOBuffer)));
     
    35243493            {
    35253494                case 0x0: /* All types. */
    3526                     if (ASMAtomicReadU32(&s->MediaTrackType) == ATA_MEDIA_TYPE_CDDA)
    3527                         s->cbATAPISector = 2352;
     3495                {
     3496                    uint32_t iLbaStart;
     3497
     3498                    if (pbPacket[0] == SCSI_READ_CD)
     3499                        iLbaStart = atapiBE2H_U32(&pbPacket[2]);
     3500                    else
     3501                        iLbaStart = ataMSF2LBA(&pbPacket[3])
     3502
     3503                    if (s->pTrackList)
     3504                        s->cbATAPISector = ATAPIPassthroughTrackListGetSectorSizeFromLba(pTrackList, iLbaStart);
    35283505                    else
    35293506                        s->cbATAPISector = 2048; /* Might be incorrect if we couldn't determine the type. */
    35303507                    break;
     3508                }
    35313509                case 0x1: /* CD-DA */
    35323510                    s->cbATAPISector = 2352;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette