VirtualBox

source: vbox/trunk/src/VBox/Devices/Storage/ATAPIPassthrough.cpp@ 65620

Last change on this file since 65620 was 65108, checked in by vboxsync, 8 years ago

Storage/Devices/ATAPIPassthrough: Make use of the new SCSI inline helpers and remove the the local inlines

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 19.4 KB
Line 
1/* $Id: ATAPIPassthrough.cpp 65108 2017-01-04 14:07:09Z vboxsync $ */
2/** @file
3 * VBox storage devices: ATAPI emulation (common code for DevATA and DevAHCI).
4 */
5
6/*
7 * Copyright (C) 2012-2016 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17#define LOG_GROUP LOG_GROUP_DEV_IDE
18#include <iprt/log.h>
19#include <iprt/assert.h>
20#include <iprt/mem.h>
21
22#include <VBox/log.h>
23#include <VBox/err.h>
24#include <VBox/cdefs.h>
25#include <VBox/scsi.h>
26#include <VBox/scsiinline.h>
27
28#include "ATAPIPassthrough.h"
29
30/** The track was not detected yet. */
31#define TRACK_FLAGS_UNDETECTED RT_BIT_32(0)
32/** The track is the lead in track of the medium. */
33#define TRACK_FLAGS_LEAD_IN RT_BIT_32(1)
34/** The track is the lead out track of the medium. */
35#define TRACK_FLAGS_LEAD_OUT RT_BIT_32(2)
36
37/** Don't clear already detected tracks on the medium. */
38#define ATAPI_TRACK_LIST_REALLOCATE_FLAGS_DONT_CLEAR RT_BIT_32(0)
39
40/**
41 * Track main data form.
42 */
43typedef enum TRACKDATAFORM
44{
45 /** Invalid data form. */
46 TRACKDATAFORM_INVALID = 0,
47 /** 2352 bytes of data. */
48 TRACKDATAFORM_CDDA,
49 /** CDDA data is pause. */
50 TRACKDATAFORM_CDDA_PAUSE,
51 /** Mode 1 with 2048 bytes sector size. */
52 TRACKDATAFORM_MODE1_2048,
53 /** Mode 1 with 2352 bytes sector size. */
54 TRACKDATAFORM_MODE1_2352,
55 /** Mode 1 with 0 bytes sector size (generated by the drive). */
56 TRACKDATAFORM_MODE1_0,
57 /** XA Mode with 2336 bytes sector size. */
58 TRACKDATAFORM_XA_2336,
59 /** XA Mode with 2352 bytes sector size. */
60 TRACKDATAFORM_XA_2352,
61 /** XA Mode with 0 bytes sector size (generated by the drive). */
62 TRACKDATAFORM_XA_0,
63 /** Mode 2 with 2336 bytes sector size. */
64 TRACKDATAFORM_MODE2_2336,
65 /** Mode 2 with 2352 bytes sector size. */
66 TRACKDATAFORM_MODE2_2352,
67 /** Mode 2 with 0 bytes sector size (generated by the drive). */
68 TRACKDATAFORM_MODE2_0
69} TRACKDATAFORM;
70
71/**
72 * Subchannel data form.
73 */
74typedef enum SUBCHNDATAFORM
75{
76 /** Invalid subchannel data form. */
77 SUBCHNDATAFORM_INVALID = 0,
78 /** 0 bytes for the subchannel (generated by the drive). */
79 SUBCHNDATAFORM_0,
80 /** 96 bytes of data for the subchannel. */
81 SUBCHNDATAFORM_96
82} SUBCHNDATAFORM;
83
84/**
85 * Track entry.
86 */
87typedef struct TRACK
88{
89 /** Start LBA of the track. */
90 int64_t iLbaStart;
91 /** Number of sectors in the track. */
92 uint32_t cSectors;
93 /** Data form of main data. */
94 TRACKDATAFORM enmMainDataForm;
95 /** Data form of sub channel. */
96 SUBCHNDATAFORM enmSubChnDataForm;
97 /** Flags for the track. */
98 uint32_t fFlags;
99} TRACK, *PTRACK;
100
101/**
102 * Media track list.
103 */
104typedef struct TRACKLIST
105{
106 /** Number of detected tracks of the current medium. */
107 unsigned cTracksCurrent;
108 /** Maximum number of tracks the list can contain. */
109 unsigned cTracksMax;
110 /** Variable list of tracks. */
111 PTRACK paTracks;
112} TRACKLIST, *PTRACKLIST;
113
114
115/**
116 * Reallocate the given track list to be able to hold the given number of tracks.
117 *
118 * @returns VBox status code.
119 * @param pTrackList The track list to reallocate.
120 * @param cTracks Number of tracks the list must be able to hold.
121 * @param fFlags Flags for the reallocation.
122 */
123static int atapiTrackListReallocate(PTRACKLIST pTrackList, unsigned cTracks, uint32_t fFlags)
124{
125 int rc = VINF_SUCCESS;
126
127 if (!(fFlags & ATAPI_TRACK_LIST_REALLOCATE_FLAGS_DONT_CLEAR))
128 ATAPIPassthroughTrackListClear(pTrackList);
129
130 if (pTrackList->cTracksMax < cTracks)
131 {
132 PTRACK paTracksNew = (PTRACK)RTMemRealloc(pTrackList->paTracks, cTracks * sizeof(TRACK));
133 if (paTracksNew)
134 {
135 pTrackList->paTracks = paTracksNew;
136
137 /* Mark new tracks as undetected. */
138 for (unsigned i = pTrackList->cTracksMax; i < cTracks; i++)
139 pTrackList->paTracks[i].fFlags |= TRACK_FLAGS_UNDETECTED;
140
141 pTrackList->cTracksMax = cTracks;
142 }
143 else
144 rc = VERR_NO_MEMORY;
145 }
146
147 if (RT_SUCCESS(rc))
148 pTrackList->cTracksCurrent = cTracks;
149
150 return rc;
151}
152
153/**
154 * Initilizes the given track from the given CUE sheet entry.
155 *
156 * @returns nothing.
157 * @param pTrack The track to initialize.
158 * @param pbCueSheetEntry CUE sheet entry to use.
159 */
160static void atapiTrackListEntryCreateFromCueSheetEntry(PTRACK pTrack, const uint8_t *pbCueSheetEntry)
161{
162 TRACKDATAFORM enmTrackDataForm = TRACKDATAFORM_INVALID;
163 SUBCHNDATAFORM enmSubChnDataForm = SUBCHNDATAFORM_INVALID;
164
165 /* Determine size of main data based on the data form field. */
166 switch (pbCueSheetEntry[3] & 0x3f)
167 {
168 case 0x00: /* CD-DA with data. */
169 enmTrackDataForm = TRACKDATAFORM_CDDA;
170 break;
171 case 0x01: /* CD-DA without data (used for pauses between tracks). */
172 enmTrackDataForm = TRACKDATAFORM_CDDA_PAUSE;
173 break;
174 case 0x10: /* CD-ROM mode 1 */
175 case 0x12:
176 enmTrackDataForm = TRACKDATAFORM_MODE1_2048;
177 break;
178 case 0x11:
179 case 0x13:
180 enmTrackDataForm = TRACKDATAFORM_MODE1_2352;
181 break;
182 case 0x14:
183 enmTrackDataForm = TRACKDATAFORM_MODE1_0;
184 break;
185 case 0x20: /* CD-ROM XA, CD-I */
186 case 0x22:
187 enmTrackDataForm = TRACKDATAFORM_XA_2336;
188 break;
189 case 0x21:
190 case 0x23:
191 enmTrackDataForm = TRACKDATAFORM_XA_2352;
192 break;
193 case 0x24:
194 enmTrackDataForm = TRACKDATAFORM_XA_0;
195 break;
196 case 0x31: /* CD-ROM Mode 2 */
197 case 0x33:
198 enmTrackDataForm = TRACKDATAFORM_MODE2_2352;
199 break;
200 case 0x30:
201 case 0x32:
202 enmTrackDataForm = TRACKDATAFORM_MODE2_2336;
203 break;
204 case 0x34:
205 enmTrackDataForm = TRACKDATAFORM_MODE2_0;
206 break;
207 default: /* Reserved, invalid mode. Log and leave default sector size. */
208 LogRel(("ATA: Invalid data form mode %d for current CUE sheet\n",
209 pbCueSheetEntry[3] & 0x3f));
210 }
211
212 /* Determine size of sub channel data based on data form field. */
213 switch ((pbCueSheetEntry[3] & 0xc0) >> 6)
214 {
215 case 0x00: /* Sub channel all zeroes, autogenerated by the drive. */
216 enmSubChnDataForm = SUBCHNDATAFORM_0;
217 break;
218 case 0x01:
219 case 0x03:
220 enmSubChnDataForm = SUBCHNDATAFORM_96;
221 break;
222 default:
223 LogRel(("ATA: Invalid sub-channel data form mode %u for current CUE sheet\n",
224 pbCueSheetEntry[3] & 0xc0));
225 }
226
227 pTrack->enmMainDataForm = enmTrackDataForm;
228 pTrack->enmSubChnDataForm = enmSubChnDataForm;
229 pTrack->iLbaStart = scsiMSF2LBA(&pbCueSheetEntry[5]);
230 if (pbCueSheetEntry[1] != 0xaa)
231 {
232 /* Calculate number of sectors from the next entry. */
233 int64_t iLbaNext = scsiMSF2LBA(&pbCueSheetEntry[5+8]);
234 pTrack->cSectors = iLbaNext - pTrack->iLbaStart;
235 }
236 else
237 {
238 pTrack->fFlags |= TRACK_FLAGS_LEAD_OUT;
239 pTrack->cSectors = 0;
240 }
241 pTrack->fFlags &= ~TRACK_FLAGS_UNDETECTED;
242}
243
244/**
245 * Update the track list from a SEND CUE SHEET request.
246 *
247 * @returns VBox status code.
248 * @param pTrackList Track list to update.
249 * @param pbCDB CDB of the SEND CUE SHEET request.
250 * @param pvBuf The CUE sheet.
251 */
252static int atapiTrackListUpdateFromSendCueSheet(PTRACKLIST pTrackList, const uint8_t *pbCDB, const void *pvBuf)
253{
254 int rc = VINF_SUCCESS;
255 unsigned cbCueSheet = scsiBE2H_U24(pbCDB + 6);
256 unsigned cTracks = cbCueSheet / 8;
257
258 AssertReturn(cbCueSheet % 8 == 0 && cTracks, VERR_INVALID_PARAMETER);
259
260 rc = atapiTrackListReallocate(pTrackList, cTracks, 0);
261 if (RT_SUCCESS(rc))
262 {
263 const uint8_t *pbCueSheet = (uint8_t *)pvBuf;
264 PTRACK pTrack = pTrackList->paTracks;
265
266 for (unsigned i = 0; i < cTracks; i++)
267 {
268 atapiTrackListEntryCreateFromCueSheetEntry(pTrack, pbCueSheet);
269 if (i == 0)
270 pTrack->fFlags |= TRACK_FLAGS_LEAD_IN;
271 pTrack++;
272 pbCueSheet += 8;
273 }
274 }
275
276 return rc;
277}
278
279static int atapiTrackListUpdateFromSendDvdStructure(PTRACKLIST pTrackList, const uint8_t *pbCDB, const void *pvBuf)
280{
281 RT_NOREF(pTrackList, pbCDB, pvBuf);
282 return VERR_NOT_IMPLEMENTED;
283}
284
285/**
286 * Update track list from formatted TOC data.
287 *
288 * @returns VBox status code.
289 * @param pTrackList The track list to update.
290 * @param iTrack The first track the TOC has data for.
291 * @param fMSF Flag whether block addresses are in MSF or LBA format.
292 * @param pbBuf Buffer holding the formatted TOC.
293 * @param cbBuffer Size of the buffer.
294 */
295static int atapiTrackListUpdateFromFormattedToc(PTRACKLIST pTrackList, uint8_t iTrack,
296 bool fMSF, const uint8_t *pbBuf, uint32_t cbBuffer)
297{
298 RT_NOREF(iTrack, cbBuffer); /** @todo unused parameters */
299 int rc = VINF_SUCCESS;
300 unsigned cbToc = scsiBE2H_U16(pbBuf);
301 uint8_t iTrackFirst = pbBuf[2];
302 unsigned cTracks;
303
304 cbToc -= 2;
305 pbBuf += 4;
306 AssertReturn(cbToc % 8 == 0, VERR_INVALID_PARAMETER);
307
308 cTracks = cbToc / 8 + iTrackFirst;
309
310 rc = atapiTrackListReallocate(pTrackList, iTrackFirst + cTracks, ATAPI_TRACK_LIST_REALLOCATE_FLAGS_DONT_CLEAR);
311 if (RT_SUCCESS(rc))
312 {
313 PTRACK pTrack = &pTrackList->paTracks[iTrackFirst];
314
315 for (unsigned i = iTrackFirst; i < cTracks; i++)
316 {
317 if (pbBuf[1] & 0x4)
318 pTrack->enmMainDataForm = TRACKDATAFORM_MODE1_2048;
319 else
320 pTrack->enmMainDataForm = TRACKDATAFORM_CDDA;
321
322 pTrack->enmSubChnDataForm = SUBCHNDATAFORM_0;
323 if (fMSF)
324 pTrack->iLbaStart = scsiMSF2LBA(&pbBuf[4]);
325 else
326 pTrack->iLbaStart = scsiBE2H_U32(&pbBuf[4]);
327
328 if (pbBuf[2] != 0xaa)
329 {
330 /* Calculate number of sectors from the next entry. */
331 int64_t iLbaNext;
332
333 if (fMSF)
334 iLbaNext = scsiMSF2LBA(&pbBuf[4+8]);
335 else
336 iLbaNext = scsiBE2H_U32(&pbBuf[4+8]);
337
338 pTrack->cSectors = iLbaNext - pTrack->iLbaStart;
339 }
340 else
341 pTrack->cSectors = 0;
342
343 pTrack->fFlags &= ~TRACK_FLAGS_UNDETECTED;
344 pbBuf += 8;
345 pTrack++;
346 }
347 }
348
349 return rc;
350}
351
352static int atapiTrackListUpdateFromReadTocPmaAtip(PTRACKLIST pTrackList, const uint8_t *pbCDB, const void *pvBuf)
353{
354 int rc = VINF_SUCCESS;
355 uint16_t cbBuffer = scsiBE2H_U16(&pbCDB[7]);
356 bool fMSF = (pbCDB[1] & 0x2) != 0;
357 uint8_t uFmt = pbCDB[2] & 0xf;
358 uint8_t iTrack = pbCDB[6];
359
360 switch (uFmt)
361 {
362 case 0x00:
363 rc = atapiTrackListUpdateFromFormattedToc(pTrackList, iTrack, fMSF, (uint8_t *)pvBuf, cbBuffer);
364 break;
365 case 0x01:
366 case 0x02:
367 case 0x03:
368 case 0x04:
369 rc = VERR_NOT_IMPLEMENTED;
370 break;
371 case 0x05:
372 rc = VINF_SUCCESS; /* Does not give information about the tracklist. */
373 break;
374 default:
375 rc = VERR_INVALID_PARAMETER;
376 }
377
378 return rc;
379}
380
381static int atapiTrackListUpdateFromReadTrackInformation(PTRACKLIST pTrackList, const uint8_t *pbCDB, const void *pvBuf)
382{
383 RT_NOREF(pTrackList, pbCDB, pvBuf);
384 return VERR_NOT_IMPLEMENTED;
385}
386
387static int atapiTrackListUpdateFromReadDvdStructure(PTRACKLIST pTrackList, const uint8_t *pbCDB, const void *pvBuf)
388{
389 RT_NOREF(pTrackList, pbCDB, pvBuf);
390 return VERR_NOT_IMPLEMENTED;
391}
392
393static int atapiTrackListUpdateFromReadDiscInformation(PTRACKLIST pTrackList, const uint8_t *pbCDB, const void *pvBuf)
394{
395 RT_NOREF(pTrackList, pbCDB, pvBuf);
396 return VERR_NOT_IMPLEMENTED;
397}
398
399#ifdef LOG_ENABLED
400
401/**
402 * Converts the given track data form to a string.
403 *
404 * @returns Track data form as a string.
405 * @param enmTrackDataForm The track main data form.
406 */
407static const char *atapiTrackListMainDataFormToString(TRACKDATAFORM enmTrackDataForm)
408{
409 switch (enmTrackDataForm)
410 {
411 case TRACKDATAFORM_CDDA:
412 return "CD-DA";
413 case TRACKDATAFORM_CDDA_PAUSE:
414 return "CD-DA Pause";
415 case TRACKDATAFORM_MODE1_2048:
416 return "Mode 1 (2048 bytes)";
417 case TRACKDATAFORM_MODE1_2352:
418 return "Mode 1 (2352 bytes)";
419 case TRACKDATAFORM_MODE1_0:
420 return "Mode 1 (0 bytes)";
421 case TRACKDATAFORM_XA_2336:
422 return "XA (2336 bytes)";
423 case TRACKDATAFORM_XA_2352:
424 return "XA (2352 bytes)";
425 case TRACKDATAFORM_XA_0:
426 return "XA (0 bytes)";
427 case TRACKDATAFORM_MODE2_2336:
428 return "Mode 2 (2336 bytes)";
429 case TRACKDATAFORM_MODE2_2352:
430 return "Mode 2 (2352 bytes)";
431 case TRACKDATAFORM_MODE2_0:
432 return "Mode 2 (0 bytes)";
433 case TRACKDATAFORM_INVALID:
434 default:
435 return "Invalid";
436 }
437}
438
439/**
440 * Converts the given subchannel data form to a string.
441 *
442 * @returns Subchannel data form as a string.
443 * @param enmSubChnDataForm The subchannel main data form.
444 */
445static const char *atapiTrackListSubChnDataFormToString(SUBCHNDATAFORM enmSubChnDataForm)
446{
447 switch (enmSubChnDataForm)
448 {
449 case SUBCHNDATAFORM_0:
450 return "0";
451 case SUBCHNDATAFORM_96:
452 return "96";
453 case SUBCHNDATAFORM_INVALID:
454 default:
455 return "Invalid";
456 }
457}
458
459/**
460 * Dump the complete track list to the release log.
461 *
462 * @returns nothing.
463 * @param pTrackList The track list to dump.
464 */
465static void atapiTrackListDump(PTRACKLIST pTrackList)
466{
467 LogRel(("Track List: cTracks=%u\n", pTrackList->cTracksCurrent));
468 for (unsigned i = 0; i < pTrackList->cTracksCurrent; i++)
469 {
470 PTRACK pTrack = &pTrackList->paTracks[i];
471
472 LogRel((" Track %u: LBAStart=%lld cSectors=%u enmMainDataForm=%s enmSubChnDataForm=%s fFlags=[%s%s%s]\n",
473 i, pTrack->iLbaStart, pTrack->cSectors, atapiTrackListMainDataFormToString(pTrack->enmMainDataForm),
474 atapiTrackListSubChnDataFormToString(pTrack->enmSubChnDataForm),
475 pTrack->fFlags & TRACK_FLAGS_UNDETECTED ? "UNDETECTED " : "",
476 pTrack->fFlags & TRACK_FLAGS_LEAD_IN ? "Lead-In " : "",
477 pTrack->fFlags & TRACK_FLAGS_LEAD_OUT ? "Lead-Out" : ""));
478 }
479}
480
481#endif /* LOG_ENABLED */
482
483DECLHIDDEN(int) ATAPIPassthroughTrackListCreateEmpty(PTRACKLIST *ppTrackList)
484{
485 int rc = VERR_NO_MEMORY;
486 PTRACKLIST pTrackList = (PTRACKLIST)RTMemAllocZ(sizeof(TRACKLIST));
487
488 if (pTrackList)
489 {
490 rc = VINF_SUCCESS;
491 *ppTrackList = pTrackList;
492 }
493
494 return rc;
495}
496
497DECLHIDDEN(void) ATAPIPassthroughTrackListDestroy(PTRACKLIST pTrackList)
498{
499 if (pTrackList->paTracks)
500 RTMemFree(pTrackList->paTracks);
501 RTMemFree(pTrackList);
502}
503
504DECLHIDDEN(void) ATAPIPassthroughTrackListClear(PTRACKLIST pTrackList)
505{
506 AssertPtrReturnVoid(pTrackList);
507
508 pTrackList->cTracksCurrent = 0;
509
510 /* Mark all tracks as undetected. */
511 for (unsigned i = 0; i < pTrackList->cTracksMax; i++)
512 pTrackList->paTracks[i].fFlags |= TRACK_FLAGS_UNDETECTED;
513}
514
515DECLHIDDEN(int) ATAPIPassthroughTrackListUpdate(PTRACKLIST pTrackList, const uint8_t *pbCDB, const void *pvBuf)
516{
517 int rc = VINF_SUCCESS;
518
519 switch (pbCDB[0])
520 {
521 case SCSI_SEND_CUE_SHEET:
522 rc = atapiTrackListUpdateFromSendCueSheet(pTrackList, pbCDB, pvBuf);
523 break;
524 case SCSI_SEND_DVD_STRUCTURE:
525 rc = atapiTrackListUpdateFromSendDvdStructure(pTrackList, pbCDB, pvBuf);
526 break;
527 case SCSI_READ_TOC_PMA_ATIP:
528 rc = atapiTrackListUpdateFromReadTocPmaAtip(pTrackList, pbCDB, pvBuf);
529 break;
530 case SCSI_READ_TRACK_INFORMATION:
531 rc = atapiTrackListUpdateFromReadTrackInformation(pTrackList, pbCDB, pvBuf);
532 break;
533 case SCSI_READ_DVD_STRUCTURE:
534 rc = atapiTrackListUpdateFromReadDvdStructure(pTrackList, pbCDB, pvBuf);
535 break;
536 case SCSI_READ_DISC_INFORMATION:
537 rc = atapiTrackListUpdateFromReadDiscInformation(pTrackList, pbCDB, pvBuf);
538 break;
539 default:
540 LogRel(("ATAPI: Invalid opcode %#x while determining media layout\n", pbCDB[0]));
541 rc = VERR_INVALID_PARAMETER;
542 }
543
544#ifdef LOG_ENABLED
545 atapiTrackListDump(pTrackList);
546#endif
547
548 return rc;
549}
550
551DECLHIDDEN(uint32_t) ATAPIPassthroughTrackListGetSectorSizeFromLba(PTRACKLIST pTrackList, uint32_t iAtapiLba)
552{
553 PTRACK pTrack = NULL;
554 uint32_t cbAtapiSector = 2048;
555
556 if (pTrackList->cTracksCurrent)
557 {
558 if ( iAtapiLba > UINT32_C(0xffff4fa1)
559 && (int32_t)iAtapiLba < -150)
560 {
561 /* Lead-In area, this is always the first entry in the cue sheet. */
562 pTrack = pTrackList->paTracks;
563 Assert(pTrack->fFlags & TRACK_FLAGS_LEAD_IN);
564 LogFlowFunc(("Selected Lead-In area\n"));
565 }
566 else
567 {
568 int64_t iAtapiLba64 = (int32_t)iAtapiLba;
569 pTrack = &pTrackList->paTracks[1];
570
571 /* Go through the track list and find the correct entry. */
572 for (unsigned i = 1; i < pTrackList->cTracksCurrent - 1; i++)
573 {
574 if (pTrack->fFlags & TRACK_FLAGS_UNDETECTED)
575 continue;
576
577 if ( pTrack->iLbaStart <= iAtapiLba64
578 && iAtapiLba64 < pTrack->iLbaStart + pTrack->cSectors)
579 break;
580
581 pTrack++;
582 }
583 }
584
585 if (pTrack)
586 {
587 switch (pTrack->enmMainDataForm)
588 {
589 case TRACKDATAFORM_CDDA:
590 case TRACKDATAFORM_MODE1_2352:
591 case TRACKDATAFORM_XA_2352:
592 case TRACKDATAFORM_MODE2_2352:
593 cbAtapiSector = 2352;
594 break;
595 case TRACKDATAFORM_MODE1_2048:
596 cbAtapiSector = 2048;
597 break;
598 case TRACKDATAFORM_CDDA_PAUSE:
599 case TRACKDATAFORM_MODE1_0:
600 case TRACKDATAFORM_XA_0:
601 case TRACKDATAFORM_MODE2_0:
602 cbAtapiSector = 0;
603 break;
604 case TRACKDATAFORM_XA_2336:
605 case TRACKDATAFORM_MODE2_2336:
606 cbAtapiSector = 2336;
607 break;
608 case TRACKDATAFORM_INVALID:
609 default:
610 AssertMsgFailed(("Invalid track data form %d\n", pTrack->enmMainDataForm));
611 }
612
613 switch (pTrack->enmSubChnDataForm)
614 {
615 case SUBCHNDATAFORM_0:
616 break;
617 case SUBCHNDATAFORM_96:
618 cbAtapiSector += 96;
619 break;
620 case SUBCHNDATAFORM_INVALID:
621 default:
622 AssertMsgFailed(("Invalid subchannel data form %d\n", pTrack->enmSubChnDataForm));
623 }
624 }
625 }
626
627 return cbAtapiSector;
628}
629
Note: See TracBrowser for help on using the repository browser.

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