Chameleon

Chameleon Svn Source Tree

Root/branches/Chimera/i386/include/IOKit/scsi/IOSCSIBlockCommandsDevice.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_BLOCK_COMMANDS_DEVICE_H_
26#define _IOKIT_IO_SCSI_BLOCK_COMMANDS_DEVICE_H_
27
28#if defined(KERNEL) && defined(__cplusplus)
29
30//-----------------------------------------------------------------------------
31//Constants
32//-----------------------------------------------------------------------------
33
34// SBC power states as defined in T10:996D SCSI Block Commands - 3 (SBC-3)
35// Revision 8c, November 13, 1997, pages 10-11.
36enum
37{
38kSBCPowerStateSystemSleep = 0,
39kSBCPowerStateSleep = 1,
40kSBCPowerStateStandby = 2,
41kSBCPowerStateIdle= 3,
42kSBCPowerStateActive= 4,
43kSBCNumPowerStates= 5
44};
45
46enum
47{
48kMediaStateUnlocked= 0,
49kMediaStateLocked = 1
50};
51
52
53//-----------------------------------------------------------------------------
54//Includes
55//-----------------------------------------------------------------------------
56
57// General IOKit headers
58#include <IOKit/IOLib.h>
59#include <IOKit/IOMemoryDescriptor.h>
60#include <IOKit/IOService.h>
61#include <IOKit/IOUserClient.h>
62
63// Generic IOKit storage related headers
64#include <IOKit/storage/IOStorage.h>
65
66// SCSI Architecture Model Family includes
67#include <IOKit/scsi/IOSCSIPrimaryCommandsDevice.h>
68
69
70// Forward declaration for the SCSIBlockCommands that is used internally by the
71// IOSCSIBlockCommandsDevice class.
72class SCSIBlockCommands;
73
74//-----------------------------------------------------------------------------
75//Class Declaration
76//-----------------------------------------------------------------------------
77
78class IOSCSIBlockCommandsDevice : public IOSCSIPrimaryCommandsDevice
79{
80
81OSDeclareAbstractStructors ( IOSCSIBlockCommandsDevice )
82
83private:
84
85
86#ifndef __LP64__
87
88SCSIBlockCommands *fSCSIBlockCommandObject;
89SCSIBlockCommands *GetSCSIBlockCommandObject ( void );
90
91#endif/* !__LP64__ */
92
93IOReturnGetWriteCacheState ( IOMemoryDescriptor * buffer,
94 UInt8modePageControlValue );
95
96static voidAsyncReadWriteComplete ( SCSITaskIdentifiercompletedTask );
97
98protected:
99
100// Reserve space for future expansion.
101 struct IOSCSIBlockCommandsDeviceExpansionData
102{
103IONotifier *fPowerDownNotifier;
104boolfWriteCacheEnabled;
105boolfDeviceIsShared;
106UInt64fMediumBlockCount64;
107boolfDeviceHasSATTranslation;
108boolfProtocolSpecificPowerControl;
109boolfRequiresEjectWithStartStopUnit;
110};
111 IOSCSIBlockCommandsDeviceExpansionData * fIOSCSIBlockCommandsDeviceReserved;
112
113#define fPowerDownNotifierfIOSCSIBlockCommandsDeviceReserved->fPowerDownNotifier
114#define fWriteCacheEnabledfIOSCSIBlockCommandsDeviceReserved->fWriteCacheEnabled
115
116// The fDeviceIsShared is used to indicate whether this device exists on a Physical
117// Interconnect that allows multiple initiators to access it. This is used mainly
118// by the power management code to not send power state related START_STOP_UNIT
119// commands to the device.
120// The fDeviceIsShared value is also used to prevent power state commands from being
121// sent to manual eject device since these devices behave better when allowed to
122// manage their own power.
123#define fDeviceIsSharedfIOSCSIBlockCommandsDeviceReserved->fDeviceIsShared
124
125// The fMediumBlockCount64 provides support for 64 bit LBAs and
126// replaces fMediumBlockCount which only supports 32 bits.
127// This value should not be directly accessed and instead the member routine
128// ReportMediumTotalBlockCount() should be used to retrieve it and the member routine
129// SetMediumCharacteristics() should be used to set it.
130#define fMediumBlockCount64fIOSCSIBlockCommandsDeviceReserved->fMediumBlockCount64
131
132#define fDeviceHasSATTranslation fIOSCSIBlockCommandsDeviceReserved->fDeviceHasSATTranslation
133
134// Device support protocol specific power off
135#define fProtocolSpecificPowerControl fIOSCSIBlockCommandsDeviceReserved->fProtocolSpecificPowerControl
136
137// Device requires START_STOP_UNIT for ejects, regardless if PREVENT_ALLOW_MEIDUMREMOVAL
138// failed.
139#define fRequiresEjectWithStartStopUnit fIOSCSIBlockCommandsDeviceReserved->fRequiresEjectWithStartStopUnit
140
141private:
142/* OBSOLETE. Use IOSCSIPrimaryCommandsDevice::Get/SetANSIVersion */
143UInt8fANSIVersion;
144
145protected:
146// ---- Device Characteristics ----
147boolfMediaIsRemovable;
148
149// ---- Medium Characteristics ----
150boolfMediumPresent;
151
152private:
153// The byte count of each physical block on the medium.
154// This value should not be directly accessed and instead the member routine
155// ReportMediumBlockSize() should be used to retrieve it and the member routine
156// SetMediumCharacteristics() should be used to set it.
157UInt32fMediumBlockSize;
158
159// The total number of blocks of fMediumBlockSize on the medium.
160// OBSOLETE. Use fMediumBlockCount64 instead which allows for support of
161// devices that have 33 through 64 bit LBA values.
162UInt32fMediumBlockCount;
163
164protected:
165// Whether the installed medium is protected from writes
166boolfMediumIsWriteProtected;
167
168// Whether user removal of medium has been prevented
169boolfMediumRemovalPrevented;
170
171// Indicates whether this is a known manual eject device
172boolfKnownManualEject;
173
174// Polling thread variables
175thread_call_tfPollingThread;
176UInt32fPollingMode;
177enum
178{
179kPollingMode_Suspended= 0,
180kPollingMode_NewMedia = 1,
181kPollingMode_MediaRemoval= 2
182};
183
184// ---- Methods for controlling the current state of device support ----
185virtual boolInitializeDeviceSupport ( void );
186virtual voidStartDeviceSupport ( void );
187virtual voidSuspendDeviceSupport ( void );
188virtual voidResumeDeviceSupport ( void );
189virtual voidStopDeviceSupport ( void );
190virtual voidTerminateDeviceSupport ( void );
191
192virtual void free ( void );
193
194#ifndef __LP64__
195
196// This method will retrieve the SCSI Primary Command Set object for
197// the class. For subclasses, this will be overridden using a
198// dynamic cast on the subclasses base command set object.
199virtual SCSIPrimaryCommands *GetSCSIPrimaryCommandObject ( void );
200
201virtual boolCreateCommandSetObjects ( void );
202virtual voidFreeCommandSetObjects ( void );
203
204#endif/* !__LP64__ */
205
206virtual boolClearNotReadyStatus ( void );
207virtual void CreateStorageServiceNub ( void );
208virtual boolDetermineDeviceCharacteristics ( void );
209
210// ---- Methods used for controlling the polling thread ----
211virtual voidProcessPoll ( void );
212virtual voidEnablePolling ( void );
213virtual voidDisablePolling ( void );
214
215// Main and support methods for polling for new Media
216virtual voidPollForNewMedia ( void );
217virtual boolDetermineMediaPresence ( void );
218virtual boolPreventMediumRemoval ( void );
219virtual boolDetermineMediumCapacity (
220UInt64 * blockSize,
221UInt64 * blockCount );
222virtual boolDetermineMediumWriteProtectState ( void );
223
224// Main and support methods for polling for Media removal
225virtual voidPollForMediaRemoval ( void );
226
227// ---- Methods used for handling medium characteristics ----
228
229// OBSOLETE - Use the version compatible with 64 bit LBAs instead.
230virtual voidSetMediumCharacteristics (
231UInt32 blockSize,
232UInt32 blockCount );
233
234voidSetMediumCharacteristics (
235UInt64 blockSize,
236UInt64 blockCount );
237
238virtual voidResetMediumCharacteristics ( void );
239
240virtual IOReturnIssueRead (
241IOMemoryDescriptor *buffer,
242 UInt64startBlock,
243 UInt64blockCount );
244
245virtual IOReturnIssueRead (
246IOMemoryDescriptor *buffer,
247 UInt64startBlock,
248 UInt64blockCount,
249 void * clientData );
250
251virtual IOReturnIssueWrite (
252IOMemoryDescriptor *buffer,
253UInt64startBlock,
254 UInt64blockCount );
255
256virtual IOReturnIssueWrite (
257IOMemoryDescriptor *buffer,
258 UInt64startBlock,
259 UInt64blockCount,
260void * clientData );
261
262// ----- Power Management Support ------
263
264// We override this method to set our power states and register ourselves
265// as a power policy maker.
266virtual void InitializePowerManagement ( IOService * provider );
267
268// We override this method so that when we register for power management,
269// we go to our active power state (which the drive is definitely in
270// at startup time).
271virtual UInt32GetInitialPowerState ( void );
272
273// We override this method in order to provide the number of transitions
274// from Fully active to Sleep state so that the idle timer can be adjusted
275// to the appropriate time period based on the disk spindown time set in
276// the Energy Saver prefs panel.
277virtual UInt32GetNumberOfPowerStateTransitions ( void );
278
279// The TicklePowerManager method is called to tell the power manager that
280// the device needs to be in a certain power state to handle requests.
281virtual voidTicklePowerManager ( void );
282
283// The HandlePowerChange method is the state machine for power management.
284// It is guaranteed to be on its own thread of execution (different from
285// the power manager thread AND the workloop thread. This routine can
286// send sync or async calls to the drive without worrying about threading
287// issues.
288virtual voidHandlePowerChange ( void );
289
290// The HandleCheckPowerState (void) method is on the serialized side of the
291// command gate and can change member variables safely without
292// multi-threading issues. It's main purpose is to call the superclass'
293// HandleCheckPowerState ( UInt32 maxPowerState ) with the max power state
294// the class registered with.
295virtual voidHandleCheckPowerState ( void );
296
297// The VerifyMediumPresence method is called to see if the medium which we
298// anticipated being there is still there.
299virtual boolVerifyMediumPresence ( void );
300
301public:
302
303static voidsProcessPoll ( void * pdtDriver, void * refCon );
304
305// ---- Methods for controlling the device ----
306virtual IOReturnSyncReadWrite (
307IOMemoryDescriptor *buffer,
308UInt64startBlock,
309UInt64blockCount,
310UInt64blockSize );
311
312virtual IOReturnAsyncReadWrite (
313IOMemoryDescriptor *buffer,
314UInt64startBlock,
315UInt64blockCount,
316UInt64blockSize,
317void * clientData );
318
319IOReturnGetWriteCacheState ( bool * enabled );
320IOReturnSetWriteCacheState ( bool enabled );
321voidDetermineMediumGeometry ( void );
322
323// ---- Methods for controlling medium state ----
324virtual IOReturnEjectTheMedium ( void );
325virtual IOReturnLockUnlockMedium ( bool doLock );
326virtual IOReturnSynchronizeCache ( void );
327
328// ---- Methods for controlling media format ----
329virtual IOReturnFormatMedium (
330UInt64 blockCount,
331UInt64 blockSize );
332virtual UInt32GetFormatCapacities (
333UInt64 * capacities,
334 UInt32 capacitiesMaxCount ) const;
335
336// ---- Query methods to report device characteristics ----
337
338// Report the maximum number of blocks that the device can handle per
339// read or write. A value of 0 (zero) indicates there is no limit aside
340// from the size of the method's return parameter.
341virtual UInt64ReportDeviceMaxBlocksReadTransfer ( void );
342virtual UInt64ReportDeviceMaxBlocksWriteTransfer ( void );
343
344// Report whether the device supports removal of the media.
345virtual boolReportDeviceMediaRemovability ( void );
346
347// ---- Query methods to report installed medium characteristics ----
348virtual UInt64ReportMediumBlockSize ( void );
349virtual UInt64ReportMediumTotalBlockCount ( void );
350virtual boolReportMediumWriteProtection ( void );
351
352
353protected:
354
355
356#ifndef __LP64__
357
358// Command methods to access all commands available to SBC based devices.
359virtual bool ERASE_10 (
360SCSITaskIdentifierrequest,
361SCSICmdField1Bit ERA,
362SCSICmdField1Bit RELADR,
363SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
364SCSICmdField2Byte TRANSFER_LENGTH,
365SCSICmdField1Byte CONTROL );
366
367virtual bool ERASE_12 (
368SCSITaskIdentifierrequest,
369SCSICmdField1Bit ERA,
370SCSICmdField1Bit RELADR,
371SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
372SCSICmdField4Byte TRANSFER_LENGTH,
373SCSICmdField1Byte CONTROL );
374
375virtual bool FORMAT_UNIT (
376SCSITaskIdentifierrequest,
377IOMemoryDescriptor *dataBuffer,
378IOByteCountdefectListSize,
379SCSICmdField1Bit FMTDATA,
380SCSICmdField1Bit CMPLST,
381SCSICmdField3Bit DEFECT_LIST_FORMAT,
382SCSICmdField1Byte VENDOR_SPECIFIC,
383SCSICmdField2Byte INTERLEAVE,
384SCSICmdField1Byte CONTROL );
385
386// Defined in SBC-2 Section 5.41
387bool FORMAT_UNIT (
388SCSITaskIdentifierrequest,
389IOMemoryDescriptor *dataBuffer,
390IOByteCountdefectListSize,
391SCSICmdField1BitFMTPINFO,
392SCSICmdField1BitRTO_REQ,
393SCSICmdField1BitLONGLIST,
394SCSICmdField1Bit FMTDATA,
395SCSICmdField1Bit CMPLST,
396SCSICmdField3Bit DEFECT_LIST_FORMAT,
397SCSICmdField1Byte VENDOR_SPECIFIC,
398SCSICmdField1Byte CONTROL );
399
400virtual bool LOCK_UNLOCK_CACHE (
401SCSITaskIdentifierrequest,
402SCSICmdField1Bit LOCK,
403SCSICmdField1Bit RELADR,
404SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
405SCSICmdField2Byte NUMBER_OF_BLOCKS,
406SCSICmdField1Byte CONTROL );
407
408// Defined in SBC-2 section 5.5
409bool LOCK_UNLOCK_CACHE (
410SCSITaskIdentifierrequest,
411SCSICmdField1Bit LOCK,
412SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
413SCSICmdField2Byte NUMBER_OF_BLOCKS,
414SCSICmdField1Byte CONTROL );
415
416bool LOCK_UNLOCK_CACHE_16 (
417SCSITaskIdentifierrequest,
418SCSICmdField1BitLOCK,
419SCSICmdField8ByteLOGICAL_BLOCK_ADDRESS,
420SCSICmdField4ByteNUMBER_OF_BLOCKS,
421SCSICmdField1ByteCONTROL );
422
423virtual bool MEDIUM_SCAN (
424SCSITaskIdentifierrequest,
425 IOMemoryDescriptor *dataBuffer,
426 SCSICmdField1Bit WBS,
427 SCSICmdField1Bit ASA,
428 SCSICmdField1Bit PSD,
429 SCSICmdField1Bit PRA,
430SCSICmdField1Bit RELADR,
431SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
432SCSICmdField2Byte PARAMETER_LIST_LENGTH,
433SCSICmdField1Byte CONTROL );
434
435virtual bool PREFETCH (
436SCSITaskIdentifierrequest,
437SCSICmdField1Bit IMMED,
438SCSICmdField1Bit RELADR,
439SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
440SCSICmdField2Byte TRANSFER_LENGTH,
441SCSICmdField1Byte CONTROL );
442
443// Defined in SBC-2 section 5.7
444bool PREFETCH (
445SCSITaskIdentifierrequest,
446SCSICmdField1Bit IMMED,
447SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
448SCSICmdField5BitGROUP_NUMBER,
449SCSICmdField2Byte TRANSFER_LENGTH,
450SCSICmdField1Byte CONTROL );
451
452bool PREFETCH_16 (
453SCSITaskIdentifierrequest,
454SCSICmdField1BitIMMED,
455SCSICmdField8ByteLOGICAL_BLOCK_ADDRESS,
456SCSICmdField4ByteTRANSFER_LENGTH,
457SCSICmdField5BitGROUP_NUMBER,
458SCSICmdField1ByteCONTROL );
459
460virtual bool READ_6 (
461SCSITaskIdentifierrequest,
462IOMemoryDescriptor *dataBuffer,
463UInt32blockSize,
464SCSICmdField21Bit LOGICAL_BLOCK_ADDRESS,
465SCSICmdField1Byte TRANSFER_LENGTH,
466SCSICmdField1Byte CONTROL );
467
468#endif/* __LP64__ */
469
470virtual bool READ_10 (
471SCSITaskIdentifierrequest,
472IOMemoryDescriptor *dataBuffer,
473UInt32blockSize,
474SCSICmdField1Bit DPO,
475SCSICmdField1Bit FUA,
476SCSICmdField1Bit RELADR,
477SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
478SCSICmdField2Byte TRANSFER_LENGTH,
479SCSICmdField1Byte CONTROL );
480
481// Defined in SBC-2 section 5.10
482bool READ_10 (
483SCSITaskIdentifierrequest,
484IOMemoryDescriptor *dataBuffer,
485UInt32blockSize,
486SCSICmdField3Bit RDPROTECT,
487SCSICmdField1Bit DPO,
488SCSICmdField1Bit FUA,
489SCSICmdField1Bit FUA_NV,
490SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
491SCSICmdField5BitGROUP_NUMBER,
492SCSICmdField2Byte TRANSFER_LENGTH,
493SCSICmdField1Byte CONTROL );
494
495virtual bool READ_12 (
496SCSITaskIdentifierrequest,
497IOMemoryDescriptor *dataBuffer,
498UInt32blockSize,
499SCSICmdField1Bit DPO,
500SCSICmdField1Bit FUA,
501SCSICmdField1Bit RELADR,
502SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
503SCSICmdField4Byte TRANSFER_LENGTH,
504SCSICmdField1Byte CONTROL );
505
506// Defined in SBC-2 section 5.11
507bool READ_12 (
508SCSITaskIdentifierrequest,
509IOMemoryDescriptor *dataBuffer,
510UInt32blockSize,
511SCSICmdField3BitRDPROTECT,
512SCSICmdField1Bit DPO,
513SCSICmdField1Bit FUA,
514SCSICmdField1Bit FUA_NV,
515SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
516SCSICmdField4Byte TRANSFER_LENGTH,
517SCSICmdField5BitGROUP_NUMBER,
518SCSICmdField1Byte CONTROL );
519
520bool READ_16 (
521SCSITaskIdentifierrequest,
522IOMemoryDescriptor *dataBuffer,
523UInt32blockSize,
524SCSICmdField3BitRDPROTECT,
525SCSICmdField1BitDPO,
526SCSICmdField1BitFUA,
527SCSICmdField1BitFUA_NV,
528SCSICmdField8ByteLOGICAL_BLOCK_ADDRESS,
529SCSICmdField4ByteTRANSFER_LENGTH,
530SCSICmdField5BitGROUP_NUMBER,
531SCSICmdField1ByteCONTROL );
532
533virtual bool READ_CAPACITY (
534SCSITaskIdentifierrequest,
535IOMemoryDescriptor *dataBuffer,
536SCSICmdField1Bit RELADR,
537SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
538SCSICmdField1Bit PMI,
539SCSICmdField1Byte CONTROL );
540
541bool READ_CAPACITY_16 (
542SCSITaskIdentifierrequest,
543IOMemoryDescriptor *dataBuffer,
544SCSICmdField8Byte LOGICAL_BLOCK_ADDRESS,
545SCSICmdField4ByteALLOCATION_LENGTH,
546SCSICmdField1Bit PMI,
547SCSICmdField1Byte CONTROL );
548
549#ifndef __LP64__
550
551virtual bool READ_DEFECT_DATA_10 (
552SCSITaskIdentifierrequest,
553IOMemoryDescriptor *dataBuffer,
554SCSICmdField1Bit PLIST,
555SCSICmdField1Bit GLIST,
556SCSICmdField3Bit DEFECT_LIST_FORMAT,
557SCSICmdField2Byte ALLOCATION_LENGTH,
558SCSICmdField1Byte CONTROL );
559
560virtual bool READ_DEFECT_DATA_12 (
561SCSITaskIdentifierrequest,
562IOMemoryDescriptor *dataBuffer,
563SCSICmdField1Bit PLIST,
564SCSICmdField1Bit GLIST,
565SCSICmdField3Bit DEFECT_LIST_FORMAT,
566SCSICmdField4Byte ALLOCATION_LENGTH,
567SCSICmdField1Byte CONTROL );
568
569virtual bool READ_GENERATION (
570SCSITaskIdentifierrequest,
571IOMemoryDescriptor *dataBuffer,
572SCSICmdField1Bit RELADR,
573SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
574SCSICmdField1Byte ALLOCATION_LENGTH,
575SCSICmdField1Byte CONTROL );
576
577virtual bool READ_LONG (
578SCSITaskIdentifierrequest,
579IOMemoryDescriptor *dataBuffer,
580SCSICmdField1Bit CORRCT,
581SCSICmdField1Bit RELADR,
582SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
583SCSICmdField2Byte BYTE_TRANSFER_LENGTH,
584SCSICmdField1Byte CONTROL );
585
586bool READ_LONG_16 (
587SCSITaskIdentifierrequest,
588IOMemoryDescriptor *dataBuffer,
589SCSICmdField8ByteLOGICAL_BLOCK_ADDRESS,
590SCSICmdField2ByteBYTE_TRANSFER_LENGTH,
591SCSICmdField1BitCORRCT,
592SCSICmdField1ByteCONTROL );
593
594virtual bool READ_UPDATED_BLOCK_10 (
595SCSITaskIdentifierrequest,
596IOMemoryDescriptor *dataBuffer,
597SCSICmdField1Bit DPO,
598SCSICmdField1Bit FUA,
599 SCSICmdField1Bit RELADR,
600SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
601SCSICmdField1Bit LATEST,
602 SCSICmdField15Bit GENERATION_ADDRESS,
603SCSICmdField1Byte CONTROL );
604
605virtual bool REASSIGN_BLOCKS (
606SCSITaskIdentifierrequest,
607IOMemoryDescriptor *dataBuffer,
608SCSICmdField1Byte CONTROL );
609
610// Defined in SBC-2 section 5.20
611bool REASSIGN_BLOCKS (
612SCSITaskIdentifierrequest,
613IOMemoryDescriptor *dataBuffer,
614SCSICmdField1BitLONGLBA,
615SCSICmdField1BitLONGLIST,
616SCSICmdField1Byte CONTROL );
617
618virtual bool REBUILD (
619SCSITaskIdentifierrequest,
620IOMemoryDescriptor *dataBuffer,
621SCSICmdField1Bit DPO,
622SCSICmdField1Bit FUA,
623 SCSICmdField1Bit INTDATA,
624SCSICmdField2Bit PORT_CONTROL,
625 SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
626SCSICmdField4Byte REBUILD_LENGTH,
627SCSICmdField4Byte PARAMETER_LIST_LENGTH,
628SCSICmdField1Byte CONTROL );
629
630virtual bool REGENERATE (
631SCSITaskIdentifierrequest,
632IOMemoryDescriptor *dataBuffer,
633SCSICmdField1BitDPO,
634SCSICmdField1Bit FUA,
635 SCSICmdField1Bit INTDATA,
636 SCSICmdField2Bit PORT_CONTROL,
637SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
638SCSICmdField4Byte REBUILD_LENGTH,
639SCSICmdField4Byte PARAMETER_LIST_LENGTH,
640SCSICmdField1Byte CONTROL );
641
642virtual bool REZERO_UNIT (
643SCSITaskIdentifierrequest,
644SCSICmdField1Byte CONTROL );
645
646virtual bool SEARCH_DATA_EQUAL_10 (
647SCSITaskIdentifierrequest,
648IOMemoryDescriptor *dataBuffer,
649SCSICmdField1Bit INVERT,
650SCSICmdField1Bit SPNDAT,
651SCSICmdField1Bit RELADR,
652SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
653SCSICmdField2Byte NUMBER_OF_BLOCKS_TO_SEARCH,
654SCSICmdField1Byte CONTROL );
655
656virtual bool SEARCH_DATA_HIGH_10 (
657SCSITaskIdentifierrequest,
658IOMemoryDescriptor *dataBuffer,
659SCSICmdField1Bit INVERT,
660SCSICmdField1Bit SPNDAT,
661SCSICmdField1Bit RELADR,
662SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
663SCSICmdField2Byte NUMBER_OF_BLOCKS_TO_SEARCH,
664SCSICmdField1Byte CONTROL );
665
666virtual bool SEARCH_DATA_LOW_10 (
667SCSITaskIdentifierrequest,
668IOMemoryDescriptor *dataBuffer,
669SCSICmdField1Bit INVERT,
670SCSICmdField1Bit SPNDAT,
671SCSICmdField1Bit RELADR,
672SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
673SCSICmdField2Byte NUMBER_OF_BLOCKS_TO_SEARCH,
674SCSICmdField1Byte CONTROL );
675
676virtual bool SEEK_6 (
677SCSITaskIdentifierrequest,
678SCSICmdField21Bit LOGICAL_BLOCK_ADDRESS,
679SCSICmdField1Byte CONTROL );
680
681virtual bool SEEK_10 (
682SCSITaskIdentifierrequest,
683SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
684SCSICmdField1Byte CONTROL );
685
686virtual bool SET_LIMITS_10 (
687SCSITaskIdentifierrequest,
688SCSICmdField1Bit RDINH,
689SCSICmdField1Bit WRINH,
690SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
691SCSICmdField2Byte NUMBER_OF_BLOCKS,
692SCSICmdField1Byte CONTROL );
693
694virtual bool SET_LIMITS_12 (
695SCSITaskIdentifierrequest,
696SCSICmdField1Bit RDINH,
697SCSICmdField1Bit WRINH,
698SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
699SCSICmdField4Byte NUMBER_OF_BLOCKS,
700SCSICmdField1Byte CONTROL );
701
702#endif/* __LP64__ */
703
704virtual bool START_STOP_UNIT (
705SCSITaskIdentifierrequest,
706SCSICmdField1Bit IMMED,
707SCSICmdField4Bit POWER_CONDITIONS,
708SCSICmdField1Bit LOEJ,
709SCSICmdField1Bit START,
710SCSICmdField1Byte CONTROL );
711
712virtual bool SYNCHRONIZE_CACHE (
713SCSITaskIdentifierrequest,
714SCSICmdField1Bit IMMED,
715SCSICmdField1Bit RELADR,
716SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
717SCSICmdField2Byte NUMBER_OF_BLOCKS,
718SCSICmdField1Byte CONTROL );
719
720// Defined in SBC-2 section 5.22
721bool SYNCHRONIZE_CACHE (
722SCSITaskIdentifierrequest,
723SCSICmdField1Bit IMMED,
724SCSICmdField1Bit SYNC_NV,
725SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
726SCSICmdField5BitGROUP_NUMBER,
727SCSICmdField2Byte NUMBER_OF_BLOCKS,
728SCSICmdField1Byte CONTROL );
729
730bool SYNCRONIZE_CACHE_16 (
731SCSITaskIdentifierrequest,
732SCSICmdField1BitSYNC_NV,
733SCSICmdField1BitIMMED,
734SCSICmdField8ByteLOGICAL_BLOCK_ADDRESS,
735SCSICmdField4ByteNUMBER_OF_BLOCKS,
736SCSICmdField5BitGROUP_NUMBER,
737SCSICmdField1ByteCONTROL );
738
739#ifndef __LP64__
740
741virtual bool UPDATE_BLOCK (
742SCSITaskIdentifierrequest,
743IOMemoryDescriptor *dataBuffer,
744SCSICmdField1Bit RELADR,
745SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
746SCSICmdField1Byte CONTROL );
747
748virtual bool VERIFY_10 (
749SCSITaskIdentifierrequest,
750SCSICmdField1Bit DPO,
751SCSICmdField1Bit BLKVFY,
752SCSICmdField1Bit BYTCHK,
753SCSICmdField1Bit RELADR,
754SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
755SCSICmdField2Byte VERIFICATION_LENGTH,
756SCSICmdField1Byte CONTROL );
757
758// Defined in SBC-2 section 5.24
759bool VERIFY_10 (
760SCSITaskIdentifierrequest,
761SCSICmdField3Bit VRPROTECT,
762SCSICmdField1Bit DPO,
763SCSICmdField1Bit BYTCHK,
764SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
765SCSICmdField5BitGROUP_NUMBER,
766SCSICmdField2Byte VERIFICATION_LENGTH,
767SCSICmdField1Byte CONTROL );
768
769virtual bool VERIFY_12 (
770SCSITaskIdentifierrequest,
771SCSICmdField1Bit DPO,
772SCSICmdField1Bit BLKVFY,
773SCSICmdField1Bit BYTCHK,
774SCSICmdField1Bit RELADR,
775SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
776SCSICmdField4Byte VERIFICATION_LENGTH,
777SCSICmdField1Byte CONTROL );
778
779// Defined in SBC-2 section 5.25
780bool VERIFY_12 (
781SCSITaskIdentifierrequest,
782SCSICmdField3Bit VRPROTECT,
783SCSICmdField1Bit DPO,
784SCSICmdField1Bit BYTCHK,
785SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
786SCSICmdField5BitGROUP_NUMBER,
787SCSICmdField4Byte VERIFICATION_LENGTH,
788SCSICmdField1Byte CONTROL );
789
790bool VERIFY_16 (
791SCSITaskIdentifierrequest,
792SCSICmdField3BitVRPROTECT,
793SCSICmdField1BitDPO,
794SCSICmdField1BitBYTCHK,
795SCSICmdField8ByteLOGICAL_BLOCK_ADDRESS,
796SCSICmdField4ByteVERIFICATION_LENGTH,
797SCSICmdField5BitGROUP_NUMBER,
798SCSICmdField1ByteCONTROL );
799
800virtual bool WRITE_6 (
801SCSITaskIdentifierrequest,
802IOMemoryDescriptor *dataBuffer,
803UInt32blockSize,
804SCSICmdField2Byte LOGICAL_BLOCK_ADDRESS,
805SCSICmdField1Byte TRANSFER_LENGTH,
806SCSICmdField1Byte CONTROL );
807
808#endif/* __LP64__ */
809
810virtual bool WRITE_10 (
811SCSITaskIdentifierrequest,
812IOMemoryDescriptor *dataBuffer,
813UInt32blockSize,
814SCSICmdField1Bit DPO,
815SCSICmdField1Bit FUA,
816SCSICmdField1Bit EBP,
817SCSICmdField1Bit RELADR,
818SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
819SCSICmdField2Byte TRANSFER_LENGTH,
820SCSICmdField1Byte CONTROL );
821
822// Defined in SBC-2 section 5.29
823bool WRITE_10 (
824SCSITaskIdentifierrequest,
825IOMemoryDescriptor *dataBuffer,
826UInt32blockSize,
827SCSICmdField3BitWRPROTECT,
828SCSICmdField1Bit DPO,
829SCSICmdField1Bit FUA,
830SCSICmdField1Bit FUA_NV,
831SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
832SCSICmdField5BitGROUP_NUMBER,
833SCSICmdField2Byte TRANSFER_LENGTH,
834SCSICmdField1Byte CONTROL );
835
836virtual bool WRITE_12 (
837SCSITaskIdentifierrequest,
838IOMemoryDescriptor *dataBuffer,
839UInt32blockSize,
840SCSICmdField1Bit DPO,
841SCSICmdField1Bit FUA,
842SCSICmdField1Bit EBP,
843SCSICmdField1Bit RELADR,
844SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
845SCSICmdField4Byte TRANSFER_LENGTH,
846SCSICmdField1Byte CONTROL );
847
848// Defined in SBC-2 section 5.30
849bool WRITE_12 (
850SCSITaskIdentifierrequest,
851IOMemoryDescriptor *dataBuffer,
852UInt32blockSize,
853SCSICmdField3BitWRPROTECT,
854SCSICmdField1Bit DPO,
855SCSICmdField1Bit FUA,
856SCSICmdField1Bit FUA_NV,
857SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
858SCSICmdField5BitGROUP_NUMBER,
859SCSICmdField4Byte TRANSFER_LENGTH,
860SCSICmdField1Byte CONTROL );
861
862bool WRITE_16 (
863SCSITaskIdentifierrequest,
864IOMemoryDescriptor *dataBuffer,
865UInt32blockSize,
866SCSICmdField3BitWRPROTECT,
867SCSICmdField1BitDPO,
868SCSICmdField1BitFUA,
869SCSICmdField1BitFUA_NV,
870SCSICmdField8ByteLOGICAL_BLOCK_ADDRESS,
871SCSICmdField4ByteTRANSFER_LENGTH,
872SCSICmdField5BitGROUP_NUMBER,
873SCSICmdField1ByteCONTROL );
874
875#ifndef __LP64__
876
877virtual bool WRITE_AND_VERIFY_10 (
878SCSITaskIdentifierrequest,
879IOMemoryDescriptor *dataBuffer,
880UInt32blockSize,
881SCSICmdField1Bit DPO,
882SCSICmdField1Bit EBP,
883SCSICmdField1Bit BYTCHK,
884SCSICmdField1Bit RELADR,
885SCSICmdField4ByteLOGICAL_BLOCK_ADDRESS,
886SCSICmdField2Byte TRANSFER_LENGTH,
887SCSICmdField1Byte CONTROL );
888
889// Defined in SBC-2 section 5.33
890bool WRITE_AND_VERIFY_10 (
891SCSITaskIdentifierrequest,
892IOMemoryDescriptor *dataBuffer,
893UInt32blockSize,
894SCSICmdField3BitWRPROTECT,
895SCSICmdField1Bit DPO,
896SCSICmdField1Bit BYTCHK,
897SCSICmdField4ByteLOGICAL_BLOCK_ADDRESS,
898SCSICmdField5BitGROUP_NUMBER,
899SCSICmdField2Byte TRANSFER_LENGTH,
900SCSICmdField1Byte CONTROL );
901
902virtual bool WRITE_AND_VERIFY_12 (
903SCSITaskIdentifierrequest,
904IOMemoryDescriptor *dataBuffer,
905UInt32blockSize,
906SCSICmdField1Bit DPO,
907SCSICmdField1Bit EBP,
908SCSICmdField1Bit BYTCHK,
909SCSICmdField1Bit RELADR,
910SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
911SCSICmdField4Byte TRANSFER_LENGTH,
912SCSICmdField1Byte CONTROL );
913
914// Defined in SBC-2 section 5.34
915bool WRITE_AND_VERIFY_12 (
916SCSITaskIdentifierrequest,
917IOMemoryDescriptor *dataBuffer,
918UInt32blockSize,
919SCSICmdField3BitWRPROTECT,
920SCSICmdField1Bit DPO,
921SCSICmdField1Bit BYTCHK,
922SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
923SCSICmdField4Byte TRANSFER_LENGTH,
924SCSICmdField5BitGROUP_NUMBER,
925SCSICmdField1Byte CONTROL );
926
927bool WRITE_AND_VERIFY_16 (
928SCSITaskIdentifierrequest,
929IOMemoryDescriptor *dataBuffer,
930UInt32blockSize,
931SCSICmdField3BitWRPROTECT,
932SCSICmdField1Bit DPO,
933SCSICmdField1Bit BYTCHK,
934SCSICmdField8Byte LOGICAL_BLOCK_ADDRESS,
935SCSICmdField4Byte TRANSFER_LENGTH,
936SCSICmdField5BitGROUP_NUMBER,
937SCSICmdField1Byte CONTROL );
938
939
940virtual bool WRITE_LONG (
941SCSITaskIdentifierrequest,
942IOMemoryDescriptor *dataBuffer,
943SCSICmdField1Bit RELADR,
944SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
945SCSICmdField2Byte TRANSFER_LENGTH,
946SCSICmdField1Byte CONTROL );
947
948bool WRITE_LONG_16 (
949SCSITaskIdentifierrequest,
950IOMemoryDescriptor *dataBuffer,
951SCSICmdField8Byte LOGICAL_BLOCK_ADDRESS,
952SCSICmdField2Byte TRANSFER_LENGTH,
953SCSICmdField1BitCORRCT,
954SCSICmdField1Byte CONTROL );
955
956virtual bool WRITE_SAME (
957SCSITaskIdentifierrequest,
958IOMemoryDescriptor *dataBuffer,
959SCSICmdField1Bit PBDATA,
960SCSICmdField1Bit LBDATA,
961SCSICmdField1Bit RELADR,
962SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
963SCSICmdField2Byte TRANSFER_LENGTH,
964SCSICmdField1Byte CONTROL );
965
966// Defined in SBC-2 section 5.39
967bool WRITE_SAME (
968SCSITaskIdentifierrequest,
969IOMemoryDescriptor *dataBuffer,
970SCSICmdField3BitWRPROTECT,
971SCSICmdField1Bit PBDATA,
972SCSICmdField1Bit LBDATA,
973SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
974SCSICmdField5BitGROUP_NUMBER,
975SCSICmdField2Byte TRANSFER_LENGTH,
976SCSICmdField1Byte CONTROL );
977
978bool WRITE_SAME_16 (
979SCSITaskIdentifierrequest,
980IOMemoryDescriptor *dataBuffer,
981SCSICmdField3BitWRPROTECT,
982SCSICmdField1BitPBDATA,
983SCSICmdField1BitLBDATA,
984SCSICmdField8ByteLOGICAL_BLOCK_ADDRESS,
985SCSICmdField4ByteTRANSFER_LENGTH,
986SCSICmdField5BitGROUP_NUMBER,
987SCSICmdField1ByteCONTROL );
988
989virtual bool XDREAD (
990SCSITaskIdentifierrequest,
991IOMemoryDescriptor *dataBuffer,
992SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
993SCSICmdField2Byte TRANSFER_LENGTH,
994SCSICmdField1Byte CONTROL );
995
996// Defined in SBC-2 section 5.42
997bool XDREAD (
998SCSITaskIdentifierrequest,
999IOMemoryDescriptor *dataBuffer,
1000SCSICmdField1BitXORPINFO,
1001SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
1002SCSICmdField5BitGROUP_NUMBER,
1003SCSICmdField2Byte TRANSFER_LENGTH,
1004SCSICmdField1Byte CONTROL );
1005
1006virtual bool XDWRITE (
1007SCSITaskIdentifierrequest,
1008IOMemoryDescriptor *dataBuffer,
1009SCSICmdField1Bit DPO,
1010SCSICmdField1Bit FUA,
1011SCSICmdField1Bit DISABLE_WRITE,
1012SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
1013SCSICmdField2Byte TRANSFER_LENGTH,
1014SCSICmdField1Byte CONTROL );
1015
1016// Defined in SBC-2 section 5.43
1017bool XDWRITE (
1018SCSITaskIdentifierrequest,
1019IOMemoryDescriptor *dataBuffer,
1020SCSICmdField3BitWRPROTECT,
1021SCSICmdField1Bit DPO,
1022SCSICmdField1Bit FUA,
1023SCSICmdField1Bit DISABLE_WRITE,
1024SCSICmdField1BitFUA_NV,
1025SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
1026SCSICmdField5BitGROUP_NUMBER,
1027SCSICmdField2Byte TRANSFER_LENGTH,
1028SCSICmdField1Byte CONTROL );
1029
1030virtual bool XDWRITE_EXTENDED (
1031SCSITaskIdentifierrequest,
1032IOMemoryDescriptor *dataBuffer,
1033SCSICmdField1Bit TABLE_ADDRESS,
1034SCSICmdField1Bit DPO,
1035SCSICmdField1Bit FUA,
1036SCSICmdField1Bit DISABLE_WRITE,
1037SCSICmdField2Bit PORT_CONTROL,
1038SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
1039SCSICmdField4Byte SECONDARY_BLOCK_ADDRESS,
1040SCSICmdField4Byte TRANSFER_LENGTH,
1041SCSICmdField1Byte SECONDARY_ADDRESS,
1042SCSICmdField1Byte CONTROL );
1043
1044// Defined in SBC-2 section 5.46
1045bool XDWRITEREAD_10 (
1046SCSITaskIdentifierrequest,
1047IOMemoryDescriptor *dataBuffer,
1048SCSICmdField3BitWRPROTECT,
1049SCSICmdField1Bit DPO,
1050SCSICmdField1Bit FUA,
1051SCSICmdField1Bit DISABLE_WRITE,
1052SCSICmdField1Bit FUA_NV,
1053SCSICmdField1Bit XORPINFO,
1054SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
1055SCSICmdField5BitGROUP_NUMBER,
1056SCSICmdField2Byte TRANSFER_LENGTH,
1057SCSICmdField1Byte CONTROL );
1058
1059virtual bool XPWRITE (
1060SCSITaskIdentifierrequest,
1061IOMemoryDescriptor *dataBuffer,
1062SCSICmdField1Bit DPO,
1063SCSICmdField1Bit FUA,
1064SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
1065SCSICmdField2Byte TRANSFER_LENGTH,
1066SCSICmdField1Byte CONTROL );
1067
1068// Defined in SBC-2 section 5.48
1069bool XPWRITE (
1070SCSITaskIdentifierrequest,
1071IOMemoryDescriptor *dataBuffer,
1072SCSICmdField1Bit DPO,
1073SCSICmdField1Bit FUA,
1074SCSICmdField1Bit FUA_NV,
1075SCSICmdField1Bit XORPINFO,
1076SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
1077SCSICmdField5BitGROUP_NUMBER,
1078SCSICmdField2Byte TRANSFER_LENGTH,
1079SCSICmdField1Byte CONTROL );
1080
1081#endif/* __LP64__ */
1082
1083
1084/* Added with 10.2 */
1085OSMetaClassDeclareReservedUsed ( IOSCSIBlockCommandsDevice, 1 );
1086
1087public:
1088
1089virtual IOReturnPowerDownHandler (void * refCon,
1090UInt32 messageType,
1091IOService * provider,
1092void * messageArgument,
1093vm_size_t argSize );
1094
1095
1096/* Added with 10.2 */
1097OSMetaClassDeclareReservedUsed ( IOSCSIBlockCommandsDevice, 2 );
1098
1099protected:
1100
1101virtualvoidSetMediumIcon ( void );
1102
1103
1104/* Added with 10.3.3 */
1105OSMetaClassDeclareReservedUsed ( IOSCSIBlockCommandsDevice, 3 );
1106
1107protected:
1108
1109virtualvoid AsyncReadWriteCompletion ( SCSITaskIdentifier completedTask );
1110
1111
1112/* Added with 10.6.0 */
1113OSMetaClassDeclareReservedUsed ( IOSCSIBlockCommandsDevice, 4 );
1114
1115public:
1116
1117virtualIOReturn AsyncReadWrite (
1118IOMemoryDescriptor *buffer,
1119UInt64startBlock,
1120UInt64blockCount,
1121UInt64blockSize,
1122IOStorageAttributes *attributes,
1123void * clientData );
1124
1125
1126private:
1127
1128// Space reserved for future expansion.
1129OSMetaClassDeclareReservedUnused ( IOSCSIBlockCommandsDevice, 5 );
1130OSMetaClassDeclareReservedUnused ( IOSCSIBlockCommandsDevice, 6 );
1131OSMetaClassDeclareReservedUnused ( IOSCSIBlockCommandsDevice, 7 );
1132OSMetaClassDeclareReservedUnused ( IOSCSIBlockCommandsDevice, 8 );
1133OSMetaClassDeclareReservedUnused ( IOSCSIBlockCommandsDevice, 9 );
1134OSMetaClassDeclareReservedUnused ( IOSCSIBlockCommandsDevice, 10 );
1135OSMetaClassDeclareReservedUnused ( IOSCSIBlockCommandsDevice, 11 );
1136OSMetaClassDeclareReservedUnused ( IOSCSIBlockCommandsDevice, 12 );
1137OSMetaClassDeclareReservedUnused ( IOSCSIBlockCommandsDevice, 13 );
1138OSMetaClassDeclareReservedUnused ( IOSCSIBlockCommandsDevice, 14 );
1139OSMetaClassDeclareReservedUnused ( IOSCSIBlockCommandsDevice, 15 );
1140OSMetaClassDeclareReservedUnused ( IOSCSIBlockCommandsDevice, 16 );
1141
1142};
1143
1144#endif/* defined(KERNEL) && defined(__cplusplus) */
1145
1146#endif /* _IOKIT_IO_SCSI_BLOCK_COMMANDS_DEVICE_H_ */
1147

Archive Download this file

Revision: 1340