Chameleon

Chameleon Svn Source Tree

Root/trunk/i386/include/IOKit/scsi/IOSCSIMultimediaCommandsDevice.h

1/*
2 * Copyright (c) 1998-2009 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24
25#ifndef _IOKIT_IO_SCSI_MULTIMEDIA_COMMANDS_DEVICE_H_
26#define _IOKIT_IO_SCSI_MULTIMEDIA_COMMANDS_DEVICE_H_
27
28#if KERNEL
29#include <IOKit/IOTypes.h>
30#else
31#include <CoreFoundation/CoreFoundation.h>
32#endif
33
34#include <IOKit/storage/IOStorageDeviceCharacteristics.h>
35
36
37//-----------------------------------------------------------------------------
38//Constants
39//-----------------------------------------------------------------------------
40
41
42// Message constants
43#define kIOMessageTrayStateChange0x69000035
44#define kIOMessageTrayStateHasChangedkIOMessageTrayStateChange // DEPRECATED, use kIOMessageTrayStateChange instead
45
46// Message values for kIOMessageTrayStateChange
47enum
48{
49kMessageTrayStateChangeRequestAccepted= 0,
50kMessageTrayStateChangeRequestRejected= 1
51};
52
53#define kIOMessageMediaAccessChange0x69000036
54
55// Message values for kIOMessageMediaAccessChange
56enum
57{
58kMessageDeterminingMediaPresence= 0,
59kMessageFoundMedia= 1,
60kMessageMediaTypeDetermined= 2
61};
62
63// IOKit property keys and constants
64#definekIOPropertySupportedCDFeatureskIOPropertySupportedCDFeaturesKey
65#definekIOPropertySupportedDVDFeatureskIOPropertySupportedDVDFeaturesKey
66#definekIOPropertySupportedBDFeatureskIOPropertySupportedBDFeaturesKey
67#define kIOPropertyLowPowerPolling"Low Power Polling"
68
69typedef UInt32 CDFeatures;
70enum
71{
72kCDFeaturesAnalogAudioBit= 0,// Analog Audio playback
73kCDFeaturesReadStructuresBit= 1,// CD-ROM
74kCDFeaturesWriteOnceBit= 2,// CD-R
75kCDFeaturesReWriteableBit= 3,// CD-R/W
76kCDFeaturesCDDAStreamAccurateBit= 4,// CD-DA stream accurate
77kCDFeaturesPacketWriteBit= 5,// Packet Writing
78kCDFeaturesTAOWriteBit= 6,// CD Track At Once
79kCDFeaturesSAOWriteBit= 7,// CD Mastering - Session At Once
80kCDFeaturesRawWriteBit= 8,// CD Mastering - Raw
81kCDFeaturesTestWriteBit= 9,// CD Mastering/TAO - Test Write
82kCDFeaturesBUFWriteBit= 10// CD Mastering/TAO - Buffer Underrun Free
83};
84
85enum
86{
87kCDFeaturesAnalogAudioMask = (1 << kCDFeaturesAnalogAudioBit),
88kCDFeaturesReadStructuresMask= (1 << kCDFeaturesReadStructuresBit),
89kCDFeaturesWriteOnceMask= (1 << kCDFeaturesWriteOnceBit),
90kCDFeaturesReWriteableMask= (1 << kCDFeaturesReWriteableBit),
91kCDFeaturesCDDAStreamAccurateMask= (1 << kCDFeaturesCDDAStreamAccurateBit),
92kCDFeaturesPacketWriteMask= (1 << kCDFeaturesPacketWriteBit),
93kCDFeaturesTAOWriteMask= (1 << kCDFeaturesTAOWriteBit),
94kCDFeaturesSAOWriteMask= (1 << kCDFeaturesSAOWriteBit),
95kCDFeaturesRawWriteMask= (1 << kCDFeaturesRawWriteBit),
96kCDFeaturesTestWriteMask= (1 << kCDFeaturesTestWriteBit),
97kCDFeaturesBUFWriteMask= (1 << kCDFeaturesBUFWriteBit)
98};
99
100typedefUInt32 DVDFeatures;
101enum
102{
103kDVDFeaturesCSSBit = 0,// DVD-CSS
104kDVDFeaturesReadStructuresBit = 1,// DVD-ROM
105kDVDFeaturesWriteOnceBit= 2,// DVD-R
106kDVDFeaturesRandomWriteableBit= 3,// DVD-RAM
107kDVDFeaturesReWriteableBit= 4,// DVD-RW
108kDVDFeaturesTestWriteBit= 5,// DVD-R Write - Test Write
109kDVDFeaturesBUFWriteBit= 6,// DVD-R Write - Buffer Underrun Free
110kDVDFeaturesPlusRBit= 7,// DVD+R
111kDVDFeaturesPlusRWBit= 8,// DVD+RW (implies backgound format support)
112kDVDFeaturesHDReadBit= 9,// HD DVD-ROM
113kDVDFeaturesHDRBit= 10,// HD DVD-R
114kDVDFeaturesHDRAMBit= 11,// HD DVD-RAM
115kDVDFeaturesHDRWBit= 12// HD DVD-RW
116};
117
118enum
119{
120kDVDFeaturesCSSMask = (1 << kDVDFeaturesCSSBit),
121kDVDFeaturesReadStructuresMask = (1 << kDVDFeaturesReadStructuresBit),
122kDVDFeaturesWriteOnceMask= (1 << kDVDFeaturesWriteOnceBit),
123kDVDFeaturesRandomWriteableMask= (1 << kDVDFeaturesRandomWriteableBit),
124kDVDFeaturesReWriteableMask= (1 << kDVDFeaturesReWriteableBit),
125kDVDFeaturesTestWriteMask= (1 << kDVDFeaturesTestWriteBit),
126kDVDFeaturesBUFWriteMask= (1 << kDVDFeaturesBUFWriteBit),
127kDVDFeaturesPlusRMask= (1 << kDVDFeaturesPlusRBit),
128kDVDFeaturesPlusRWMask= (1 << kDVDFeaturesPlusRWBit),
129kDVDFeaturesHDReadMask= (1 << kDVDFeaturesHDReadBit),
130kDVDFeaturesHDRMask= (1 << kDVDFeaturesHDRBit),
131kDVDFeaturesHDRAMMask= (1 << kDVDFeaturesHDRAMBit),
132kDVDFeaturesHDRWMask= (1 << kDVDFeaturesHDRWBit)
133};
134
135typedefUInt32 BDFeatures;
136enum
137{
138kBDFeaturesReadBit= 0,// BD-ROM
139kBDFeaturesWriteBit= 1// BD-R / BD-RE
140};
141
142enum
143{
144kBDFeaturesReadMask= (1 << kBDFeaturesReadBit),
145kBDFeaturesWriteMask= (1 << kBDFeaturesWriteBit)
146};
147
148enum
149{
150kDiscStatusEmpty = 0,
151kDiscStatusIncomplete= 1,
152kDiscStatusComplete= 2,
153kDiscStatusOther= 3,
154kDiscStatusMask= 0x03,
155kDiscStatusErasableMask= 0x10
156};
157
158
159#if defined(KERNEL) && defined(__cplusplus)
160
161// MMC power states as defined in T10:1228D SCSI Multimedia Commands - 2 (MMC-2)
162// Revision 11a, August 30, 1999, page 312 (Annex F).
163enum
164{
165kMMCPowerStateSystemSleep= 0,
166kMMCPowerStateSleep = 1,
167kMMCPowerStateStandby = 2,
168kMMCPowerStateIdle= 3,
169kMMCPowerStateActive= 4,
170kMMCNumPowerStates= 5
171};
172
173enum
174{
175kMediaStateUnlocked= 0,
176kMediaStateLocked = 1
177};
178
179
180//-----------------------------------------------------------------------------
181//Includes
182//-----------------------------------------------------------------------------
183
184// General IOKit headers
185#include <IOKit/IOLib.h>
186#include <IOKit/IOMemoryDescriptor.h>
187
188// Generic IOKit storage related headers
189#include <IOKit/storage/IOStorage.h>
190#include <IOKit/storage/IOCDTypes.h>
191#include <IOKit/storage/IODVDTypes.h>
192
193// SCSI Architecture Model Family includes
194#include <IOKit/scsi/IOSCSIPrimaryCommandsDevice.h>
195
196// Forward definitions for internal use only classes
197class SCSIMultimediaCommands;
198class SCSIBlockCommands;
199
200
201//-----------------------------------------------------------------------------
202//Class Declaration
203//-----------------------------------------------------------------------------
204
205class IOSCSIMultimediaCommandsDevice : public IOSCSIPrimaryCommandsDevice
206{
207
208OSDeclareAbstractStructors ( IOSCSIMultimediaCommandsDevice )
209
210private:
211
212#ifndef __LP64__
213
214 SCSIMultimediaCommands *fSCSIMultimediaCommandObject;
215 SCSIMultimediaCommands *GetSCSIMultimediaCommandObject ( void );
216
217 SCSIBlockCommands *fSCSIBlockCommandObject;/* OBSOLETE */
218 SCSIBlockCommands *GetSCSIBlockCommandObject ( void );/* OBSOLETE */
219
220#endif/* !__LP64__ */
221
222static voidAsyncReadWriteComplete ( SCSITaskIdentifier completedTask );
223
224protected:
225
226 // Reserve space for future expansion.
227 struct IOSCSIMultimediaCommandsDeviceExpansionData
228{
229IONotifier *fPowerDownNotifier;
230boolfDeviceSupportsPowerOff;
231BDFeaturesfSupportedBDFeatures;
232boolfDeviceSupportsAsyncNotification;
233boolfDeviceSupportsFastSpindown;
234UInt8fCDLoadingMechanism;
235};
236 IOSCSIMultimediaCommandsDeviceExpansionData * fIOSCSIMultimediaCommandsDeviceReserved;
237
238#define fPowerDownNotifier fIOSCSIMultimediaCommandsDeviceReserved->fPowerDownNotifier
239#define fDeviceSupportsPowerOff fIOSCSIMultimediaCommandsDeviceReserved->fDeviceSupportsPowerOff
240#define fSupportedBDFeaturesfIOSCSIMultimediaCommandsDeviceReserved->fSupportedBDFeatures
241#define fDeviceSupportsAsyncNotificationfIOSCSIMultimediaCommandsDeviceReserved->fDeviceSupportsAsyncNotification
242#define fDeviceSupportsFastSpindownfIOSCSIMultimediaCommandsDeviceReserved->fDeviceSupportsFastSpindown
243#define fCDLoadingMechanismfIOSCSIMultimediaCommandsDeviceReserved->fCDLoadingMechanism
244
245#ifndef __LP64__
246
247// This method will retreive the SCSI Primary Command Set object for
248// the class. For subclasses, this will be overridden using a
249// dynamic cast on the subclasses base command set object.
250virtual SCSIPrimaryCommands *GetSCSIPrimaryCommandObject ( void );
251
252#endif/* !__LP64__ */
253
254CDFeaturesfSupportedCDFeatures;
255DVDFeaturesfSupportedDVDFeatures;
256
257UInt16fCurrentDiscSpeed;
258boolfMediaChanged;
259boolfMediaPresent;
260
261// The byte count of each physical block on the media.
262UInt32fMediaBlockSize;
263
264// The total number of blocks of fMediaBlockSize on the media.
265UInt32fMediaBlockCount;
266
267// Flags used to indicate device feature
268boolfMediaIsRemovable;
269boolfMediaIsWriteProtected;
270UInt32fMediaType;
271
272thread_call_tfPollingThread;
273boolfDeviceSupportsLowPowerPolling;
274boolfLowPowerPollingEnabled;
275UInt32fPollingMode;
276
277enum
278{
279kPollingMode_Suspended= 0,
280kPollingMode_NewMedia = 1,
281kPollingMode_MediaRemoval= 2
282};
283
284virtual IOReturnsetProperties ( OSObject * properties );
285
286virtual void CreateStorageServiceNub ( void );
287virtual boolDetermineDeviceCharacteristics ( void );
288virtual IOReturnDetermineIfMediaIsRemovable ( void );
289virtual IOReturnDetermineDeviceFeatures ( void );
290virtual voidDetermineMediaType ( void );
291virtual boolCheckForDVDMediaType ( void );
292virtual boolCheckForCDMediaType ( void );
293virtual voidPollForMedia ( void );
294virtual voidEnablePolling ( void );
295virtual voidDisablePolling ( void );
296virtual voidCheckWriteProtection ( void );
297virtual boolClearNotReadyStatus ( void );
298
299virtual IOReturnGetDeviceConfiguration ( void );
300virtual IOReturnGetDeviceConfigurationSize ( UInt32 * size );
301virtual IOReturnParseFeatureList ( UInt32 numProfiles, UInt8 * firstFeaturePtr );
302
303virtual IOReturnGetMechanicalCapabilities ( void );
304virtual IOReturnGetMechanicalCapabilitiesSize ( UInt32 * size );
305virtual IOReturnParseMechanicalCapabilities ( UInt8 * mechanicalCapabilitiesPtr );
306
307virtual IOReturnCheckForLowPowerPollingSupport ( void );
308virtual IOReturnGetCurrentPowerStateOfDrive ( UInt32 * powerState );
309
310virtual IOReturnIssueRead ( IOMemoryDescriptor *buffer,
311UInt64startBlock,
312UInt64blockCount );
313
314virtual IOReturnIssueRead ( IOMemoryDescriptor *buffer,
315void *clientData,
316UInt64startBlock,
317UInt64blockCount );
318
319virtual IOReturnIssueWrite ( IOMemoryDescriptor *buffer,
320UInt64startBlock,
321UInt64blockCount );
322
323virtual IOReturnIssueWrite ( IOMemoryDescriptor *buffer,
324void *clientData,
325UInt64startBlock,
326UInt64blockCount );
327
328 virtual voidSetMediaCharacteristics ( UInt32 blockSize, UInt32 blockCount );
329 virtual voidResetMediaCharacteristics ( void );
330
331UInt8ConvertBCDToHex ( UInt8 binaryCodedDigit );
332
333// ------ User Client Support ------
334
335virtual IOReturn HandleSetUserClientExclusivityState ( IOService * userClient, bool state );
336
337// ----- Power Management Support ------
338
339// We override this method to set our power states and register ourselves
340// as a power policy maker.
341virtual void InitializePowerManagement ( IOService * provider );
342
343// We override this method so that when we register for power management,
344// we go to our active power state (which the drive is definitely in
345// at startup time).
346virtual UInt32GetInitialPowerState ( void );
347
348// We override this method in order to provide the number of transitions
349// from Fully active to Sleep state so that the idle timer can be adjusted
350// to the appropriate time period based on the disk spindown time set in
351// the Energy Saver prefs panel.
352virtual UInt32GetNumberOfPowerStateTransitions ( void );
353
354// The TicklePowerManager method is called to tell the power manager that the
355// device needs to be in a certain power state to handle requests.
356virtual voidTicklePowerManager ( void );
357
358// The HandlePowerChange method is the state machine for power management.
359// It is guaranteed to be on its own thread of execution (different from
360// the power manager thread AND the workloop thread. This routine can
361// send sync or async calls to the drive without worrying about threading
362// issues.
363virtual voidHandlePowerChange ( void );
364
365// The HandleCheckPowerState (void) method is on the serialized side of the command
366// gate and can change member variables safely without multi-threading issues.
367// It's main purpose is to call the superclass' HandleCheckPowerState ( UInt32 maxPowerState )
368// with the max power state the class registered with.
369virtual voidHandleCheckPowerState ( void );
370
371// The CheckMediaPresence method is called to see if the media which we
372// anticipated being there is still there.
373virtual boolCheckMediaPresence ( void );
374
375virtual boolInitializeDeviceSupport ( void );
376virtual voidStartDeviceSupport ( void );
377virtual voidSuspendDeviceSupport ( void );
378virtual voidResumeDeviceSupport ( void );
379virtual voidStopDeviceSupport ( void );
380virtual voidTerminateDeviceSupport ( void );
381
382virtual voidfree ( void );
383
384#ifndef __LP64__
385
386virtual bool CreateCommandSetObjects ( void );
387virtual void FreeCommandSetObjects ( void );
388
389#endif/* !__LP64__ */
390
391virtual IOReturnVerifyDeviceState ( void );
392
393
394public:
395
396virtual IOReturn setAggressiveness ( unsigned long type, unsigned long minutes );
397
398virtual IOReturnSyncReadWrite ( IOMemoryDescriptor *buffer,
399UInt64startBlock,
400UInt64blockCount );
401
402virtual IOReturnAsyncReadWrite (IOMemoryDescriptor *buffer,
403UInt64block,
404UInt64nblks,
405void *clientData );
406
407virtual IOReturnEjectTheMedia ( void );
408virtual IOReturnGetTrayState ( UInt8 * trayState );
409virtual IOReturnSetTrayState ( UInt8 trayState );
410virtual IOReturnFormatMedia ( UInt64 byteCapacity );
411virtual UInt32GetFormatCapacities ( UInt64 * capacities,
412UInt32 capacitiesMaxCount ) const;
413virtual IOReturnLockUnlockMedia ( bool doLock );
414virtual IOReturnSynchronizeCache ( void );
415virtual IOReturnReportBlockSize ( UInt64 * blockSize );
416virtual IOReturnReportEjectability ( bool * isEjectable );
417virtual IOReturnReportLockability ( bool * isLockable );
418virtual IOReturnReportPollRequirements ( bool * pollIsRequired,
419 bool * pollIsExpensive );
420virtual IOReturnReportMaxReadTransfer ( UInt64 blockSize,
421 UInt64 * max );
422virtual IOReturnReportMaxValidBlock ( UInt64 * maxBlock );
423virtual IOReturnReportMaxWriteTransfer ( UInt64blockSize,
424UInt64 * max );
425virtual IOReturnReportMediaState ( bool * mediaPresent,
426bool * changed );
427virtual IOReturnReportRemovability ( bool * isRemovable );
428virtual IOReturnReportWriteProtection ( bool * isWriteProtected );
429
430static voidsPollForMedia ( void * pdtDriver, void * refCon );
431
432/* CD Specific */
433virtual IOReturnSetMediaAccessSpeed ( UInt16 kilobytesPerSecond );
434
435virtual IOReturnGetMediaAccessSpeed ( UInt16 * kilobytesPerSecond );
436
437virtual IOReturnAsyncReadCD ( IOMemoryDescriptor * buffer,
438UInt32 block,
439UInt32 nblks,
440CDSectorArea sectorArea,
441CDSectorType sectorType,
442void *clientData );
443
444virtual IOReturnReadISRC ( UInt8 track, CDISRC isrc );
445
446virtual IOReturnReadMCN ( CDMCN mcn);
447
448virtual IOReturnReadTOC ( IOMemoryDescriptor * buffer );
449
450#ifndef __LP64__
451
452virtual IOReturnAudioPause ( bool pause );
453
454virtual IOReturnAudioPlay ( CDMSF timeStart, CDMSF timeStop );
455
456virtual IOReturnAudioScan ( CDMSF timeStart, bool reverse );
457
458virtual IOReturnAudioStop ( void );
459
460virtual IOReturnGetAudioStatus ( CDAudioStatus * status );
461
462virtual IOReturnGetAudioVolume ( UInt8 * leftVolume, UInt8 * rightVolume );
463
464virtual IOReturnSetAudioVolume ( UInt8 leftVolume, UInt8 rightVolume );
465
466#endif/* !__LP64__ */
467
468/* DVD Specific */
469virtual UInt32GetMediaType( void );
470
471virtual IOReturnReportKey( IOMemoryDescriptor * buffer,
472 const DVDKeyClass keyClass,
473 const UInt32 lba,
474 const UInt8 agid,
475 const DVDKeyFormat keyFormat );
476
477virtual IOReturnSendKey( IOMemoryDescriptor * buffer,
478 const DVDKeyClass keyClass,
479 const UInt8 agid,
480 const DVDKeyFormat keyFormat );
481
482virtual IOReturnReadDVDStructure ( IOMemoryDescriptor * buffer,
483const UInt32 length,
484const UInt8structureFormat,
485const UInt32logicalBlockAddress,
486const UInt8layer,
487const UInt8 agid );
488
489// The block size decoding for Read CD and Read CD MSF as defined in table 255
490 boolGetBlockSize (
491UInt32 *requestedByteCount,
492SCSICmdField3Bit EXPECTED_SECTOR_TYPE,
493SCSICmdField1Bit SYNC,
494SCSICmdField2Bit HEADER_CODES,
495SCSICmdField1Bit USER_DATA,
496SCSICmdField1Bit EDC_ECC,
497SCSICmdField2Bit ERROR_FIELD,
498SCSICmdField3Bit SUBCHANNEL_SELECTION_BITS );
499
500SCSICmdField4Byte ConvertMSFToLBA ( SCSICmdField3Byte MSF );
501
502#ifndef __LP64__
503
504// Command methods to access all commands available to MMC based devices.
505// The BLANK command as defined in section 6.1.1
506virtual bool BLANK (
507SCSITaskIdentifierrequest,
508 SCSICmdField1Bit IMMED,
509SCSICmdField3Bit BLANKING_TYPE,
510SCSICmdField4Byte START_ADDRESS_TRACK_NUMBER,
511SCSICmdField1Byte CONTROL );
512
513// The CLOSE TRACK/SESSION command as defined in section 6.1.2
514 virtual bool CLOSE_TRACK_SESSION (
515SCSITaskIdentifierrequest,
516SCSICmdField1Bit IMMED,
517SCSICmdField1Bit SESSION,
518SCSICmdField1Bit TRACK,
519SCSICmdField2Byte TRACK_NUMBER,
520SCSICmdField1Byte CONTROL );
521
522// The FORMAT UNIT command as defined in section 6.1.3
523 virtual bool FORMAT_UNIT (
524SCSITaskIdentifierrequest,
525 IOMemoryDescriptor *dataBuffer,
526 IOByteCountparameterListSize,
527SCSICmdField1Bit FMT_DATA,
528SCSICmdField1Bit CMP_LIST,
529SCSICmdField3Bit FORMAT_CODE,
530SCSICmdField2Byte INTERLEAVE_VALUE,
531SCSICmdField1Byte CONTROL );
532
533#endif/* !__LP64__ */
534
535
536// The GET CONFIGURATION command as defined in section 6.1.4
537 virtual bool GET_CONFIGURATION (
538SCSITaskIdentifierrequest,
539 IOMemoryDescriptor *dataBuffer,
540SCSICmdField2Bit RT,
541SCSICmdField2Byte STARTING_FEATURE_NUMBER,
542SCSICmdField2Byte ALLOCATION_LENGTH,
543SCSICmdField1Byte CONTROL );
544
545// The GET EVENT/STATUS NOTIFICATION command as defined in section 6.1.5
546 virtual bool GET_EVENT_STATUS_NOTIFICATION (
547SCSITaskIdentifierrequest,
548 IOMemoryDescriptor *dataBuffer,
549SCSICmdField1Bit IMMED,
550SCSICmdField1Byte NOTIFICATION_CLASS_REQUEST,
551SCSICmdField2Byte ALLOCATION_LENGTH,
552SCSICmdField1Byte CONTROL );
553
554// The GET PERFORMANCE command as defined in section 6.1.6
555 virtual bool GET_PERFORMANCE (
556SCSITaskIdentifierrequest,
557 IOMemoryDescriptor *dataBuffer,
558SCSICmdField2Bit TOLERANCE,
559SCSICmdField1Bit WRITE,
560SCSICmdField2Bit EXCEPT,
561SCSICmdField4Byte STARTING_LBA,
562SCSICmdField2Byte MAXIMUM_NUMBER_OF_DESCRIPTORS,
563SCSICmdField1Byte CONTROL );
564
565// The LOAD/UNLOAD MEDIUM command as defined in section 6.1.7
566 virtual bool LOAD_UNLOAD_MEDIUM (
567SCSITaskIdentifierrequest,
568SCSICmdField1Bit IMMED,
569SCSICmdField1Bit LO_UNLO,
570SCSICmdField1Bit START,
571SCSICmdField1Byte SLOT,
572SCSICmdField1Byte CONTROL );
573
574// The MECHANISM STATUS command as defined in section 6.1.8
575 virtual bool MECHANISM_STATUS (
576SCSITaskIdentifierrequest,
577 IOMemoryDescriptor *dataBuffer,
578SCSICmdField2Byte ALLOCATION_LENGTH,
579SCSICmdField1Byte CONTROL );
580
581#ifndef __LP64__
582
583// The PAUSE/RESUME command as defined in section 6.1.9
584 virtual bool PAUSE_RESUME (
585SCSITaskIdentifierrequest,
586SCSICmdField1Bit RESUME,
587SCSICmdField1Byte CONTROL );
588
589// The PLAY AUDIO (10) command as defined in section 6.1.10
590 virtual bool PLAY_AUDIO_10 (
591SCSITaskIdentifierrequest,
592SCSICmdField1Bit RELADR,
593SCSICmdField4Byte STARTING_LOGICAL_BLOCK_ADDRESS,
594SCSICmdField2Byte PLAY_LENGTH,
595SCSICmdField1Byte CONTROL );
596
597// The PLAY AUDIO (12) command as defined in section 6.1.11
598 virtual bool PLAY_AUDIO_12 (
599SCSITaskIdentifierrequest,
600SCSICmdField1Bit RELADR,
601SCSICmdField4Byte STARTING_LOGICAL_BLOCK_ADDRESS,
602SCSICmdField4Byte PLAY_LENGTH,
603SCSICmdField1Byte CONTROL );
604
605// The PLAY AUDIO MSF command as defined in section 6.1.12
606 virtual bool PLAY_AUDIO_MSF (
607SCSITaskIdentifierrequest,
608SCSICmdField3Byte STARTING_MSF,
609SCSICmdField3Byte ENDING_MSF,
610SCSICmdField1Byte CONTROL );
611
612/*********************** LEGACY COMMAND SUPPORT ***********************/
613// The PLAY CD command as defined in section 6.1.13
614 virtual bool PLAY_CD (
615SCSITaskIdentifierrequest,
616SCSICmdField3Bit EXPECTED_SECTOR_TYPE,
617SCSICmdField1Bit CMSF,
618SCSICmdField4Byte STARTING_LOGICAL_BLOCK_ADDRESS,
619SCSICmdField4Byte PLAY_LENGTH_IN_BLOCKS,
620SCSICmdField1Bit SPEED,
621SCSICmdField1Bit PORT2,
622SCSICmdField1Bit PORT1,
623SCSICmdField1Bit COMPOSITE,
624SCSICmdField1Bit AUDIO,
625SCSICmdField1Byte CONTROL );
626/*********************** END LEGACY COMMAND SUPPORT *******************/
627
628#endif/* !__LP64__ */
629
630virtual bool READ_10 (
631SCSITaskIdentifierrequest,
632 IOMemoryDescriptor *dataBuffer,
633 UInt32blockSize,
634 SCSICmdField1Bit DPO,
635 SCSICmdField1Bit FUA,
636SCSICmdField1Bit RELADR,
637SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
638SCSICmdField2Byte TRANSFER_LENGTH,
639SCSICmdField1Byte CONTROL );
640
641#ifndef __LP64__
642
643/*********************** LEGACY COMMAND SUPPORT ***********************/
644// The READ BUFFER CAPACITY command as defined in section 6.1.14
645 virtual bool READ_BUFFER_CAPACITY (
646SCSITaskIdentifierrequest,
647 IOMemoryDescriptor *dataBuffer,
648SCSICmdField2Byte ALLOCATION_LENGTH,
649SCSICmdField1Byte CONTROL );
650/*********************** END LEGACY COMMAND SUPPORT *******************/
651
652#endif/* !__LP64__ */
653
654// The READ CD command as defined in section 6.1.15
655 virtual bool READ_CD (
656SCSITaskIdentifierrequest,
657IOMemoryDescriptor *dataBuffer,
658SCSICmdField3Bit EXPECTED_SECTOR_TYPE,
659SCSICmdField1Bit RELADR,
660SCSICmdField4Byte STARTING_LOGICAL_BLOCK_ADDRESS,
661SCSICmdField3Byte TRANSFER_LENGTH,
662SCSICmdField1Bit SYNC,
663SCSICmdField2Bit HEADER_CODES,
664SCSICmdField1Bit USER_DATA,
665SCSICmdField1Bit EDC_ECC,
666SCSICmdField2Bit ERROR_FIELD,
667SCSICmdField3Bit SUBCHANNEL_SELECTION_BITS,
668SCSICmdField1Byte CONTROL );
669
670// The READ CD MSF command as defined in section 6.1.16
671 virtual bool READ_CD_MSF (
672SCSITaskIdentifierrequest,
673IOMemoryDescriptor *dataBuffer,
674SCSICmdField3Bit EXPECTED_SECTOR_TYPE,
675SCSICmdField3Byte STARTING_MSF,
676SCSICmdField3Byte ENDING_MSF,
677SCSICmdField1Bit SYNC,
678SCSICmdField2Bit HEADER_CODES,
679SCSICmdField1Bit USER_DATA,
680SCSICmdField1Bit EDC_ECC,
681SCSICmdField2Bit ERROR_FIELD,
682SCSICmdField3Bit SUBCHANNEL_SELECTION_BITS,
683SCSICmdField1Byte CONTROL );
684
685// The READ CAPACITY command as defined in section 6.1.17
686 virtual bool READ_CAPACITY (
687SCSITaskIdentifierrequest,
688IOMemoryDescriptor *dataBuffer,
689SCSICmdField1Bit RELADR,
690SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
691SCSICmdField1Bit PMI,
692SCSICmdField1Byte CONTROL );
693
694// The READ DISC INFORMATION command as defined in section 6.1.18
695 virtual bool READ_DISC_INFORMATION (
696SCSITaskIdentifierrequest,
697IOMemoryDescriptor *dataBuffer,
698SCSICmdField2Byte ALLOCATION_LENGTH,
699SCSICmdField1Byte CONTROL );
700
701// The READ DVD STRUCTURE command as defined in section 6.1.19
702 virtual bool READ_DVD_STRUCTURE (
703SCSITaskIdentifierrequest,
704IOMemoryDescriptor *dataBuffer,
705SCSICmdField4Byte ADDRESS,
706SCSICmdField1Byte LAYER_NUMBER,
707SCSICmdField1Byte FORMAT,
708SCSICmdField2Byte ALLOCATION_LENGTH,
709SCSICmdField2Bit AGID,
710SCSICmdField1Byte CONTROL );
711
712// The READ FORMAT CAPACITIES command as defined in section 6.1.20
713 virtual bool READ_FORMAT_CAPACITIES (
714SCSITaskIdentifierrequest,
715IOMemoryDescriptor *dataBuffer,
716SCSICmdField2Byte ALLOCATION_LENGTH,
717SCSICmdField1Byte CONTROL );
718
719#ifndef __LP64__
720
721/*********************** LEGACY COMMAND SUPPORT ***********************/
722// The READ HEADER command as defined in section 6.1.21
723 virtual bool READ_HEADER (
724SCSITaskIdentifierrequest,
725 IOMemoryDescriptor *dataBuffer,
726SCSICmdField1Bit MSF,
727SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
728SCSICmdField2Byte ALLOCATION_LENGTH,
729SCSICmdField1Byte CONTROL );
730/*********************** END LEGACY COMMAND SUPPORT ***********************/
731
732/*********************** LEGACY COMMAND SUPPORT ***********************/
733// The READ MASTER CUE command as defined in section 6.1.22
734 virtual bool READ_MASTER_CUE (
735SCSITaskIdentifierrequest,
736 IOMemoryDescriptor *dataBuffer,
737SCSICmdField1Byte SHEET_NUMBER,
738SCSICmdField3Byte ALLOCATION_LENGTH,
739SCSICmdField1Byte CONTROL );
740/*********************** END LEGACY COMMAND SUPPORT ***********************/
741
742#endif/* !__LP64__ */
743
744// The READ SUB-CHANNEL command as defined in section 6.1.23
745 virtual bool READ_SUB_CHANNEL (
746SCSITaskIdentifierrequest,
747IOMemoryDescriptor *dataBuffer,
748SCSICmdField1Bit MSF,
749SCSICmdField1Bit SUBQ,
750SCSICmdField1Byte SUB_CHANNEL_PARAMETER_LIST,
751SCSICmdField1Byte TRACK_NUMBER,
752SCSICmdField2Byte ALLOCATION_LENGTH,
753SCSICmdField1Byte CONTROL );
754
755// The READ TOC/PMA/ATIP command as defined in section 6.1.24/25
756 virtual bool READ_TOC_PMA_ATIP (
757SCSITaskIdentifierrequest,
758IOMemoryDescriptor *dataBuffer,
759SCSICmdField1Bit MSF,
760SCSICmdField4Bit FORMAT,
761SCSICmdField1ByteTRACK_SESSION_NUMBER,
762SCSICmdField2Byte ALLOCATION_LENGTH,
763SCSICmdField1Byte CONTROL );
764
765// The READ TRACK INFORMATION command as defined in section 6.1.26
766 virtual bool READ_TRACK_INFORMATION (
767SCSITaskIdentifierrequest,
768IOMemoryDescriptor *dataBuffer,
769SCSICmdField2Bit ADDRESS_NUMBER_TYPE,
770SCSICmdField4ByteLOGICAL_BLOCK_ADDRESS_TRACK_SESSION_NUMBER,
771SCSICmdField2Byte ALLOCATION_LENGTH,
772SCSICmdField1Byte CONTROL );
773
774#ifndef __LP64__
775/*********************** LEGACY COMMAND SUPPORT ***********************/
776// The REPAIR TRACK command as defined in section 6.1.27
777 virtual bool REPAIR_TRACK (
778SCSITaskIdentifierrequest,
779SCSICmdField2Byte TRACK_NUMBER,
780SCSICmdField1Byte CONTROL );
781/*********************** END LEGACY COMMAND SUPPORT ***********************/
782
783// The REPORT KEY command as defined in section 6.1.28
784 virtual bool REPORT_KEY (
785SCSITaskIdentifierrequest,
786IOMemoryDescriptor *dataBuffer,
787SCSICmdField4ByteLOGICAL_BLOCK_ADDRESS,
788SCSICmdField2Byte ALLOCATION_LENGTH,
789SCSICmdField2Bit AGID,
790SCSICmdField6Bit KEY_FORMAT,
791SCSICmdField1Byte CONTROL );
792
793// The RESERVE TRACK command as defined in section 6.1.29
794 virtual bool RESERVE_TRACK (
795SCSITaskIdentifierrequest,
796SCSICmdField4ByteRESERVATION_SIZE,
797SCSICmdField1Byte CONTROL );
798
799// The SCAN command as defined in section 6.1.30
800 virtual bool SCAN (
801SCSITaskIdentifierrequest,
802SCSICmdField1Bit DIRECT,
803SCSICmdField1Bit RELADR,
804SCSICmdField4ByteSCAN_STARTING_ADDRESS_FIELD,
805SCSICmdField2Bit TYPE,
806SCSICmdField1Byte CONTROL );
807
808// The SEND CUE SHEET command as defined in section 6.1.31
809 virtual bool SEND_CUE_SHEET (
810SCSITaskIdentifierrequest,
811 IOMemoryDescriptor *dataBuffer,
812SCSICmdField3ByteCUE_SHEET_SIZE,
813SCSICmdField1Byte CONTROL );
814
815// The SEND DVD STRUCTURE command as defined in section 6.1.32
816 virtual bool SEND_DVD_STRUCTURE (
817SCSITaskIdentifierrequest,
818 IOMemoryDescriptor *dataBuffer,
819SCSICmdField1ByteFORMAT,
820SCSICmdField2Byte STRUCTURE_DATA_LENGTH,
821SCSICmdField1Byte CONTROL );
822
823// The SEND EVENT command as defined in section 6.1.33
824 virtual bool SEND_EVENT (
825SCSITaskIdentifierrequest,
826 IOMemoryDescriptor *dataBuffer,
827SCSICmdField1Bit IMMED,
828SCSICmdField2Byte PARAMETER_LIST_LENGTH,
829SCSICmdField1Byte CONTROL );
830
831// The SEND KEY command as defined in section 6.1.34
832 virtual bool SEND_KEY (
833SCSITaskIdentifierrequest,
834IOMemoryDescriptor *dataBuffer,
835SCSICmdField2Byte PARAMETER_LIST_LENGTH,
836SCSICmdField2Bit AGID,
837SCSICmdField6Bit KEY_FORMAT,
838SCSICmdField1Byte CONTROL );
839
840// The SEND OPC INFORMATION command as defined in section 6.1.35
841 virtual bool SEND_OPC_INFORMATION (
842SCSITaskIdentifierrequest,
843 IOMemoryDescriptor *dataBuffer,
844SCSICmdField1Bit DO_OPC,
845SCSICmdField2Byte PARAMETER_LIST_LENGTH,
846SCSICmdField1Byte CONTROL );
847#endif/* !__LP64__ */
848
849/*********************** LEGACY COMMAND SUPPORT ***********************/
850// The SET CD SPEED command as defined in section 6.1.36
851 virtual bool SET_CD_SPEED (
852SCSITaskIdentifierrequest,
853SCSICmdField2Byte LOGICAL_UNIT_READ_SPEED,
854SCSICmdField2Byte LOGICAL_UNIT_WRITE_SPEED,
855SCSICmdField1Byte CONTROL );
856/*********************** END LEGACY COMMAND SUPPORT ***********************/
857
858// The SET READ AHEAD command as defined in section 6.1.37
859 virtual bool SET_READ_AHEAD (
860SCSITaskIdentifierrequest,
861SCSICmdField4Byte TRIGGER_LOGICAL_BLOCK_ADDRESS,
862SCSICmdField4Byte READ_AHEAD_LOGICAL_BLOCK_ADDRESS,
863SCSICmdField1Byte CONTROL );
864
865// The SET STREAMING command as defined in section 6.1.38
866 virtual bool SET_STREAMING (
867SCSITaskIdentifierrequest,
868 IOMemoryDescriptor *dataBuffer,
869SCSICmdField2Byte PARAMETER_LIST_LENGTH,
870SCSICmdField1Byte CONTROL );
871
872virtual bool START_STOP_UNIT (
873SCSITaskIdentifierrequest,
874SCSICmdField1Bit IMMED,
875SCSICmdField4Bit POWER_CONDITIONS,
876SCSICmdField1Bit LOEJ,
877SCSICmdField1Bit START,
878SCSICmdField1Byte CONTROL );
879
880#ifndef __LP64__
881
882// The STOP PLAY/SCAN command as defined in section 6.1.39
883 virtual bool STOP_PLAY_SCAN (
884SCSITaskIdentifierrequest,
885SCSICmdField1Byte CONTROL );
886
887#endif/* !__LP64__ */
888
889// The SYNCHRONIZE CACHE command as defined in section 6.1.40
890 virtual bool SYNCHRONIZE_CACHE (
891SCSITaskIdentifierrequest,
892SCSICmdField1Bit IMMED,
893SCSICmdField1Bit RELADR,
894SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
895SCSICmdField2Byte NUMBER_OF_BLOCKS,
896SCSICmdField1Byte CONTROL );
897
898// The WRITE (10) command as defined in section 6.1.41
899 virtual bool WRITE_10 (
900SCSITaskIdentifierrequest,
901 IOMemoryDescriptor *dataBuffer,
902 UInt32blockSize,
903SCSICmdField1Bit DPO,
904SCSICmdField1Bit FUA,
905SCSICmdField1Bit RELADR,
906SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
907SCSICmdField2Byte TRANSFER_LENGTH,
908SCSICmdField1Byte CONTROL );
909
910// The WRITE AND VERIFY (10) command as defined in section 6.1.42
911 virtual bool WRITE_AND_VERIFY_10 (
912SCSITaskIdentifierrequest,
913IOMemoryDescriptor *dataBuffer,
914 UInt32blockSize,
915SCSICmdField1Bit DPO,
916SCSICmdField1Bit BYT_CHK,
917SCSICmdField1Bit RELADR,
918SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
919SCSICmdField4Byte TRANSFER_LENGTH,
920SCSICmdField1Byte CONTROL );
921
922/* Added with 10.1.3 */
923OSMetaClassDeclareReservedUsed ( IOSCSIMultimediaCommandsDevice, 1 );
924
925virtual IOReturnReadTOC (IOMemoryDescriptor *buffer,
926CDTOCFormatformat,
927UInt8msf,
928UInt32trackSessionNumber,
929UInt16 *actualByteCount );
930
931/* Added with 10.1.3 */
932OSMetaClassDeclareReservedUsed ( IOSCSIMultimediaCommandsDevice, 2 );
933
934virtual IOReturnReadDiscInfo (IOMemoryDescriptor *buffer,
935UInt16 *actualByteCount );
936
937/* Added with 10.1.3 */
938OSMetaClassDeclareReservedUsed ( IOSCSIMultimediaCommandsDevice, 3 );
939
940virtual IOReturnReadTrackInfo (IOMemoryDescriptor *buffer,
941UInt32address,
942CDTrackInfoAddressTypeaddressType,
943UInt16 *actualByteCount );
944
945/* Added with 10.2 */
946OSMetaClassDeclareReservedUsed ( IOSCSIMultimediaCommandsDevice, 4 );
947
948virtual IOReturnPowerDownHandler ( void * refCon,
949 UInt32 messageType,
950 IOService * provider,
951 void * messageArgument,
952 vm_size_t argSize );
953
954/* Added with 10.3.3 */
955OSMetaClassDeclareReservedUsed ( IOSCSIMultimediaCommandsDevice, 5 );
956
957
958protected:
959
960
961virtual void AsyncReadWriteCompletion ( SCSITaskIdentifier completedTask );
962
963
964public:
965
966
967/* Added with 10.5 */
968 OSMetaClassDeclareReservedUsed ( IOSCSIMultimediaCommandsDevice, 6 );
969
970virtualIOReturnReadDiscStructure (IOMemoryDescriptor * buffer,
971const UInt32 length,
972const UInt8structureFormat,
973const UInt32logicalBlockAddress,
974const UInt8layer,
975const UInt8 agid,
976const UInt8mediaType );
977
978
979boolCheckForBDMediaType ( void );
980
981
982 boolREAD_DISC_STRUCTURE (
983SCSITaskIdentifierrequest,
984IOMemoryDescriptor *dataBuffer,
985SCSICmdField4Bit MEDIA_TYPE,
986SCSICmdField4Byte ADDRESS,
987SCSICmdField1Byte LAYER_NUMBER,
988SCSICmdField1Byte FORMAT,
989SCSICmdField2Byte ALLOCATION_LENGTH,
990SCSICmdField2Bit AGID,
991SCSICmdField1Byte CONTROL );
992
993
994 OSMetaClassDeclareReservedUsed ( IOSCSIMultimediaCommandsDevice, 7 );
995
996virtualIOReturnReserveTrack (UInt8reservationType,
997UInt8reservationFormat,
998UInt64ReservationParameter );
999
1000
1001boolRESERVE_TRACK_V2 (SCSITaskIdentifierrequest,
1002SCSICmdField1BitRMZ,
1003SCSICmdField1BitARSV,
1004SCSICmdField7ByteRESERVATION_PARAMETER,
1005SCSICmdField1Byte CONTROL);
1006
1007
1008boolREPORT_KEY_V2 (SCSITaskIdentifierrequest,
1009IOMemoryDescriptor *dataBuffer,
1010SCSICmdField4ByteLOGICAL_BLOCK_ADDRESS,
1011SCSICmdField1ByteKEY_CLASS,
1012SCSICmdField2Byte ALLOCATION_LENGTH,
1013SCSICmdField2Bit AGID,
1014SCSICmdField6Bit KEY_FORMAT,
1015SCSICmdField1Byte CONTROL);
1016
1017
1018boolSEND_KEY_V2 (SCSITaskIdentifierrequest,
1019IOMemoryDescriptor *dataBuffer,
1020SCSICmdField1ByteKEY_CLASS,
1021SCSICmdField2Byte PARAMETER_LIST_LENGTH,
1022SCSICmdField2Bit AGID,
1023SCSICmdField6Bit KEY_FORMAT,
1024SCSICmdField1Byte CONTROL);
1025
1026
1027protected:
1028
1029
1030voidSetPollingMode ( UInt32 newPollingMode );
1031
1032
1033public:
1034
1035
1036/* 10.6.0 */
1037
1038IOReturnRequestIdle ( void );
1039
1040private:
1041
1042// Space reserved for future expansion.
1043 OSMetaClassDeclareReservedUnused ( IOSCSIMultimediaCommandsDevice, 8 );
1044 OSMetaClassDeclareReservedUnused ( IOSCSIMultimediaCommandsDevice, 9 );
1045 OSMetaClassDeclareReservedUnused ( IOSCSIMultimediaCommandsDevice, 10 );
1046 OSMetaClassDeclareReservedUnused ( IOSCSIMultimediaCommandsDevice, 11 );
1047 OSMetaClassDeclareReservedUnused ( IOSCSIMultimediaCommandsDevice, 12 );
1048 OSMetaClassDeclareReservedUnused ( IOSCSIMultimediaCommandsDevice, 13 );
1049 OSMetaClassDeclareReservedUnused ( IOSCSIMultimediaCommandsDevice, 14 );
1050 OSMetaClassDeclareReservedUnused ( IOSCSIMultimediaCommandsDevice, 15 );
1051 OSMetaClassDeclareReservedUnused ( IOSCSIMultimediaCommandsDevice, 16 );
1052
1053};
1054
1055#endif /* defined(KERNEL) && defined(__cplusplus) */
1056
1057#endif /* _IOKIT_IO_SCSI_MULTIMEDIA_COMMANDS_DEVICE_H_ */
1058

Archive Download this file

Revision: 881