Root/
Source at commit 1166 created 13 years 10 days ago. By meklort, Fixed recent Makefile changes. Please do not use /Users/evan/SourceCode/tmp/chameleon/trunk or VPATH. the *only* time you should use /Users/evan/SourceCode/tmp/chameleon/trunk is when setting the SRCROOT variable. Also note that very soon make pkg is going to be removed. The pkg build script in trunk is very out of date. Instead please use the package maker at http://forge.voodooprojects.org/p/chameleonApplications/. Once this is ready for trunk it will be merged. | |
---|---|
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_IOUSBMASSSTORAGECLASS_H␊ |
26 | #define _IOKIT_IOUSBMASSSTORAGECLASS_H␊ |
27 | ␊ |
28 | // Headers for general IOKit definitions␊ |
29 | #include <IOKit/IOLib.h>␊ |
30 | #include <IOKit/IOService.h>␊ |
31 | #include <IOKit/IOMemoryDescriptor.h>␊ |
32 | #include <IOKit/IOMessage.h>␊ |
33 | ␊ |
34 | // Headers for USB specific definitions␊ |
35 | #include <IOKit/usb/IOUSBInterface.h>␊ |
36 | #include <IOKit/usb/IOUSBPipe.h>␊ |
37 | #include <IOKit/usb/USBSpec.h>␊ |
38 | #include <IOKit/usb/USB.h>␊ |
39 | ␊ |
40 | // Headers for SCSI Protocol support definitions␊ |
41 | #include <IOKit/scsi/IOSCSIProtocolServices.h>␊ |
42 | ␊ |
43 | // BSD includes␊ |
44 | #include <sys/sysctl.h>␊ |
45 | ␊ |
46 | #define UNUSED(x) ((void)x)␊ |
47 | ␊ |
48 | ␊ |
49 | #pragma mark -␊ |
50 | #pragma mark Vendor Specific Device Support␊ |
51 | #define kIOUSBMassStorageCharacteristics␉␉"USB Mass Storage Characteristics"␊ |
52 | #define kIOUSBMassStoragePreferredSubclass␉␉"Preferred Subclass"␊ |
53 | #define kIOUSBMassStoragePreferredProtocol␉␉"Preferred Protocol"␊ |
54 | #define kIOUSBMassStorageResetOnResume␉␉␉"Reset On Resume"␊ |
55 | #define kIOUSBMassStorageUseStandardUSBReset␉"Use Standard USB Reset"␊ |
56 | #define kIOUSBKnownCSWTagIssues␉␉␉␉␉"Known CSW Tag Issues"␊ |
57 | #define kIOUSBMassStorageMaxLogicalUnitNumber␉"Max Logical Unit Number"␊ |
58 | #define kIOPropertyIOUnitKey␉␉␉␉␉"IOUnit"␊ |
59 | #define kIOUSBMassStorageDoNotMatch␉␉␉␉"Do Not Match MSC"␊ |
60 | #define kIOUSBMassStorageDoNotOperate␉␉␉"Do Not Operate"␊ |
61 | #define kIOUSBMassStorageEnableSuspendResumePM␉"Enable Port Suspend-Resume PM"␊ |
62 | ␊ |
63 | enum ␊ |
64 | {␊ |
65 | ␉kUSBDAddressLength = 10␊ |
66 | };␊ |
67 | ␊ |
68 | #pragma mark -␊ |
69 | #pragma mark CBI Protocol Strutures␊ |
70 | // Structure for the global PB's␊ |
71 | struct CBIRequestBlock␊ |
72 | {␊ |
73 | ␉SCSITaskIdentifier␉␉␉request;␊ |
74 | ␉IOUSBDevRequest␉␉␉␉cbiDevRequest;␊ |
75 | ␉SCSICommandDescriptorBlock␉cbiCDB;␊ |
76 | ␉IOUSBCompletion␉␉␉␉cbiCompletion;␊ |
77 | ␉UInt32␉␉␉␉␉␉currentState;␊ |
78 | ␉IOMemoryDescriptor *␉␉cbiPhaseDesc;␊ |
79 | ␉UInt8␉␉␉␉␉␉cbiGetStatusBuffer[2];␉// 2 bytes as specified in the USB spec␊ |
80 | };␊ |
81 | ␊ |
82 | typedef struct CBIRequestBlock␉CBIRequestBlock;␊ |
83 | ␊ |
84 | #pragma mark -␊ |
85 | #pragma mark Bulk Only Protocol Structures␊ |
86 | ␊ |
87 | struct StorageBulkOnlyCBW␊ |
88 | {␊ |
89 | ␉UInt32␉␉cbwSignature;␊ |
90 | ␉UInt32␉␉cbwTag;␊ |
91 | ␉UInt32␉␉cbwTransferLength;␊ |
92 | ␉UInt8␉␉cbwFlags;␊ |
93 | ␉UInt8␉␉cbwLUN;␉␉␉␉␉// Bits 0-3: LUN, 4-7: Reserved␊ |
94 | ␉UInt8␉␉cbwCDBLength;␉␉␉// Bits 0-4: CDB Length, 5-7: Reserved␊ |
95 | ␉UInt8␉␉cbwCDB[16];␊ |
96 | };␊ |
97 | ␊ |
98 | typedef struct StorageBulkOnlyCBW␉StorageBulkOnlyCBW;␊ |
99 | ␊ |
100 | struct␉StorageBulkOnlyCSW␊ |
101 | {␊ |
102 | ␉UInt32␉␉cswSignature;␊ |
103 | ␉UInt32␉␉cswTag;␊ |
104 | ␉UInt32␉␉cswDataResidue;␊ |
105 | ␉UInt8␉␉cswStatus;␊ |
106 | };␊ |
107 | ␊ |
108 | typedef struct StorageBulkOnlyCSW␉StorageBulkOnlyCSW;␊ |
109 | ␊ |
110 | struct␉BulkOnlyRequestBlock␊ |
111 | {␊ |
112 | ␉SCSITaskIdentifier␉␉request;␊ |
113 | ␉IOUSBCompletion␉␉␉boCompletion;␊ |
114 | ␉UInt32␉␉␉␉␉currentState;␊ |
115 | ␉StorageBulkOnlyCBW␉␉boCBW;␊ |
116 | ␉StorageBulkOnlyCSW␉␉boCSW;␊ |
117 | ␉IOMemoryDescriptor *␉boPhaseDesc;␊ |
118 | ␉UInt8␉␉␉␉␉boGetStatusBuffer[2];␉// 2 bytes as specified in the USB spec␊ |
119 | };␊ |
120 | ␊ |
121 | typedef struct BulkOnlyRequestBlock␉␉BulkOnlyRequestBlock;␊ |
122 | ␊ |
123 | ␊ |
124 | #pragma mark -␊ |
125 | #pragma mark IOUSBMassStorageClass definition␊ |
126 | ␊ |
127 | class IOUSBMassStorageClass : public IOSCSIProtocolServices␊ |
128 | {␊ |
129 | OSDeclareDefaultStructors(IOUSBMassStorageClass)␊ |
130 | ␊ |
131 | private:␊ |
132 | ␉// ---- Member variables used by all protocols ----␊ |
133 | ␉// The interface object that provides the driver with access to the ␊ |
134 | ␉// USB so that it may talk to its device.␊ |
135 | IOUSBInterface *␉␉␉fInterface;␊ |
136 | ␊ |
137 | ␉// The pipe objects that the driver uses to transport data through a␊ |
138 | ␉// pipe to the appropriate endpoint.␊ |
139 | IOUSBPipe *␉␉␉␉␉fBulkInPipe;␊ |
140 | IOUSBPipe *␉␉␉␉␉fBulkOutPipe;␊ |
141 | IOUSBPipe *␉␉␉␉␉fInterruptPipe;␊ |
142 | ␉IOUSBDevRequest␉␉␉␉fUSBDeviceRequest;␊ |
143 | ␉UInt8␉␉␉␉␉␉fPreferredSubclass;␊ |
144 | ␉UInt8␉␉␉␉␉␉fPreferredProtocol;␊ |
145 | ␉␊ |
146 | ␉// The maximum Logical Unit Number. This is the highest valid LUN␊ |
147 | ␉// that the USB device supports, so if the device only supports one␊ |
148 | ␉// LUN, such as CBI and CB, this number will be zero.␊ |
149 | ␉UInt8␉␉␉␉␉␉fMaxLogicalUnitNumber;␊ |
150 | ␊ |
151 | ␉// ---- Member variables used by CBI protocol ----␊ |
152 | ␉bool␉␉␉␉␉␉fCBICommandStructInUse; ␊ |
153 | ␊ |
154 | ␉CBIRequestBlock␉␉␉␉fCBICommandRequestBlock;␊ |
155 | ␉␊ |
156 | ␉// ---- Member variables used by Bulk Only protocol ----␊ |
157 | ␉// Command tag, this driver just uses a sequential counter that is␊ |
158 | ␉// incremented for each CBW that is sent to the device.␊ |
159 | ␉UInt32 ␉␉␉␉␉␉fBulkOnlyCommandTag;␊ |
160 | ␊ |
161 | ␉bool␉␉␉␉␉␉fBulkOnlyCommandStructInUse; ␊ |
162 | ␊ |
163 | // Dedicated CBW and CSW IOMemoryDescriptors are listed in the ExpansionData struct.␊ |
164 | ␉␉␊ |
165 | ␉// The Request block that contains all the necessary data for ␊ |
166 | ␉// transporting a Bulk Only request across the USB.␊ |
167 | ␉BulkOnlyRequestBlock␉␉fBulkOnlyCommandRequestBlock;␊ |
168 | ␊ |
169 | protected:␊ |
170 | // Reserve space for future expansion.␊ |
171 | struct ExpansionData␊ |
172 | ␉{␊ |
173 | ␉␉bool␉␉␉␉␉fResetInProgress;␊ |
174 | ␉␉OSSet *␉␉␉␉␉fClients;␊ |
175 | ␉␉IOUSBPipe *␉␉␉␉fPotentiallyStalledPipe;␊ |
176 | ␉␉bool␉␉␉␉␉fUseUSBResetNotBOReset;␊ |
177 | ␉␉bool␉␉␉␉␉fAbortCurrentSCSITaskInProgress;␊ |
178 | ␉␉IOMemoryDescriptor *␉fCBIMemoryDescriptor;␊ |
179 | ␉␉IOMemoryDescriptor *␉fBulkOnlyCBWMemoryDescriptor;␊ |
180 | ␉␉IOMemoryDescriptor *␉fBulkOnlyCSWMemoryDescriptor;␊ |
181 | bool fDeviceAttached;␊ |
182 | ␉␉bool fWaitingForReconfigurationMessage;␊ |
183 | ␉␉bool␉␉␉␉␉fTerminating;␊ |
184 | bool fKnownCSWTagMismatchIssues;␊ |
185 | bool fPortSuspendResumeForPMEnabled;␊ |
186 | bool fPortIsSuspended;␊ |
187 | ␉␉bool␉␉␉␉␉fRequiresResetOnResume;␊ |
188 | ␉␉bool␉␉␉␉␉fAutonomousSpinDownWorkAround;␊ |
189 | ␉␉UInt8␉␉␉␉␉fConsecutiveResetCount;␊ |
190 | ␉␉bool␉␉␉␉␉fClearStallInProgress;␉␉␉␉/* OBSOLETE */␊ |
191 | ␉␉bool␉␉␉␉␉fTerminationDeferred;␊ |
192 | ␉};␊ |
193 | ExpansionData *␉␉␉␉reserved;␊ |
194 | ␉␊ |
195 | ␉#define fResetInProgress␉␉␉␉␉reserved->fResetInProgress␊ |
196 | ␉#define fClients␉␉␉␉␉␉␉reserved->fClients␊ |
197 | ␉#define fPotentiallyStalledPipe␉␉␉␉reserved->fPotentiallyStalledPipe␊ |
198 | #define fUseUSBResetNotBOReset␉␉␉␉reserved->fUseUSBResetNotBOReset␊ |
199 | ␉#define fAbortCurrentSCSITaskInProgress␉␉reserved->fAbortCurrentSCSITaskInProgress␊ |
200 | ␉#define fCBIMemoryDescriptor reserved->fCBIMemoryDescriptor␊ |
201 | ␉#define␉fBulkOnlyCBWMemoryDescriptor␉␉reserved->fBulkOnlyCBWMemoryDescriptor␊ |
202 | ␉#define␉fBulkOnlyCSWMemoryDescriptor␉␉reserved->fBulkOnlyCSWMemoryDescriptor␊ |
203 | #define fDeviceAttached reserved->fDeviceAttached␊ |
204 | ␉#define fWaitingForReconfigurationMessage␉reserved->fWaitingForReconfigurationMessage␊ |
205 | ␉#define fTerminating␉␉␉␉␉␉reserved->fTerminating␊ |
206 | #define fKnownCSWTagMismatchIssues reserved->fKnownCSWTagMismatchIssues␊ |
207 | #define fPortSuspendResumeForPMEnabled reserved->fPortSuspendResumeForPMEnabled␊ |
208 | #define fPortIsSuspended reserved->fPortIsSuspended␊ |
209 | ␉#define fRequiresResetOnResume␉␉␉␉reserved->fRequiresResetOnResume␊ |
210 | ␉#define fAutonomousSpinDownWorkAround␉␉reserved->fAutonomousSpinDownWorkAround␊ |
211 | ␉#define fConsecutiveResetCount␉␉␉␉reserved->fConsecutiveResetCount␊ |
212 | ␉#define fClearStallInProgress␉␉␉␉reserved->fClearStallInProgress␊ |
213 | ␉#define fTerminationDeferred␉␉␉␉reserved->fTerminationDeferred␊ |
214 | ␉␊ |
215 | ␉// Enumerated constants used to control various aspects of this␊ |
216 | ␉// driver.␊ |
217 | ␉␊ |
218 | ␉// Enumerations for Mass Storage Class Subclass types␊ |
219 | ␉enum␊ |
220 | ␉{␊ |
221 | ␉␉kUSBStorageRBCSubclass ␉␉␉␉= 1,␊ |
222 | ␉␉kUSBStorageSFF8020iSubclass ␉␉= 2,␊ |
223 | ␉␉kUSBStorageQIC157Subclass␉␉␉= 3,␊ |
224 | ␉␉kUSBStorageUFISubclass␉␉␉␉= 4,␊ |
225 | ␉␉kUSBStorageSFF8070iSubclass␉␉␉= 5,␊ |
226 | ␉␉kUSBStorageSCSITransparentSubclass␉= 6␊ |
227 | ␉};␊ |
228 | ␊ |
229 | ␉// The supported USB Mass Storage Class transport protocols.␊ |
230 | ␉enum␊ |
231 | ␉{␊ |
232 | ␉␉kProtocolControlBulkInterrupt␉= 0x00,␊ |
233 | ␉␉kProtocolControlBulk␉␉␉= 0x01,␊ |
234 | ␉␉kProtocolBulkOnly␉␉␉␉= 0x50␊ |
235 | ␉};␊ |
236 | ␊ |
237 | ␉// ------- Protocol support functions ------------␊ |
238 | ␉// The SendSCSICommand function will take a SCSITask Object and transport␊ |
239 | ␉// it across the physical wire(s) to the device␊ |
240 | ␉virtual bool ␉␉SendSCSICommand( ␉␊ |
241 | ␉␉␉␉␉␉␉␉SCSITaskIdentifier ␉␉request, ␊ |
242 | ␉␉␉␉␉␉␉␉SCSIServiceResponse *␉serviceResponse,␊ |
243 | ␉␉␉␉␉␉␉␉SCSITaskStatus␉␉*␉taskStatus );␊ |
244 | ␊ |
245 | ␉// The AbortSCSICommand function will abort the indicated SCSITask object,␊ |
246 | ␉// if it is possible and the SCSITask has not already completed.␊ |
247 | virtual SCSIServiceResponse ␉AbortSCSICommand( SCSITaskIdentifier abortTask );␊ |
248 | ␊ |
249 | ␉virtual bool␉␉␉␉␉IsProtocolServiceSupported( ␊ |
250 | ␉␉␉␉␉␉␉␉␉␉SCSIProtocolFeature ␉feature, ␊ |
251 | ␉␉␉␉␉␉␉␉␉␉void * ␉␉␉␉␉serviceValue );␊ |
252 | ␊ |
253 | ␉virtual bool␉␉␉␉␉HandleProtocolServiceFeature( ␊ |
254 | ␉␉␉␉␉␉␉␉␉␉SCSIProtocolFeature ␉feature, ␊ |
255 | ␉␉␉␉␉␉␉␉␉␉void * ␉␉␉␉␉serviceValue );␊ |
256 | ␊ |
257 | ␉// Methods for retrieving and setting the object for the Interface␊ |
258 | ␉IOUSBInterface *␉␉GetInterfaceReference( void );␊ |
259 | ␉void␉␉␉␉␉SetInterfaceReference( IOUSBInterface * newInterface );␊ |
260 | ␉␊ |
261 | ␉UInt8␉␉␉␉␉GetInterfaceSubclass( void );␊ |
262 | ␉UInt8␉␉␉␉␉GetInterfaceProtocol( void );␊ |
263 | ␉␊ |
264 | ␉// Methods for retrieving an object for a Pipe.␊ |
265 | ␉IOUSBPipe *␉␉␉␉GetControlPipe( void );␊ |
266 | ␉IOUSBPipe *␉␉␉␉GetBulkInPipe( void );␊ |
267 | ␉IOUSBPipe *␉␉␉␉GetBulkOutPipe( void );␊ |
268 | ␉IOUSBPipe *␉␉␉␉GetInterruptPipe( void );␊ |
269 | ␉␊ |
270 | ␉// Methods for getting and setting the maximum LUN of a device.␊ |
271 | ␉UInt8␉␉␉␉␉GetMaxLogicalUnitNumber( void ) const;␊ |
272 | ␉void␉␉␉␉␉SetMaxLogicalUnitNumber( UInt8 maxLUN );␊ |
273 | ␉␊ |
274 | ␉virtual void ␉␉␉CompleteSCSICommand( ␊ |
275 | ␉␉␉␉␉␉␉␉SCSITaskIdentifier request, ␊ |
276 | ␉␉␉␉␉␉␉␉IOReturn status );␊ |
277 | ␊ |
278 | ␉virtual␉bool␉␉␉BeginProvidedServices( void );␊ |
279 | ␉virtual␉bool␉␉␉EndProvidedServices( void );␊ |
280 | ␉␊ |
281 | ␉// The Protocol specific helper methods for SendSCSICommand␉␊ |
282 | ␉virtual IOReturn␉␉SendSCSICommandForCBIProtocol(␊ |
283 | ␉␉␉␉SCSITaskIdentifier request );␊ |
284 | ␉␊ |
285 | ␉virtual IOReturn␉␉SendSCSICommandForBulkOnlyProtocol(␊ |
286 | ␉␉␉␉␉␉␉␉SCSITaskIdentifier request );␊ |
287 | ␊ |
288 | ␉// The Protocol specific helper methods for AbortSCSICommand␉␊ |
289 | ␉virtual IOReturn␉␉AbortSCSICommandForCBIProtocol(␊ |
290 | ␉␉␉␉␉␉␉␉SCSITaskIdentifier abortTask );␊ |
291 | ␉␊ |
292 | ␉virtual IOReturn␉␉AbortSCSICommandForBulkOnlyProtocol(␊ |
293 | ␉␉␉␉␉␉␉␉SCSITaskIdentifier abortTask );␊ |
294 | ␊ |
295 | ␉// Helper methods for performing general USB device requests␊ |
296 | ␉virtual IOReturn␉␉ClearFeatureEndpointStall( ␊ |
297 | ␉␉␉␉␉␉␉␉IOUSBPipe *␉␉␉thePipe,␊ |
298 | ␉␉␉␉␉␉␉␉IOUSBCompletion␉*␉completion );␊ |
299 | ␉virtual IOReturn ␉␉GetStatusEndpointStatus(␊ |
300 | ␉␉␉␉␉␉␉␉IOUSBPipe *␉␉␉thePipe,␊ |
301 | ␉␉␉␉␉␉␉␉void *␉␉␉␉endpointStatus,␊ |
302 | ␉␉␉␉␉␉␉␉IOUSBCompletion␉*␉completion );␊ |
303 | ␉␊ |
304 | ␉/* All CBI transport related methods.␊ |
305 | ␉ */␊ |
306 | ␉// All definitions and structures for the CBI Protocol␊ |
307 | ␉enum␊ |
308 | ␉{␊ |
309 | ␉␉kUSBStorageAutoStatusSize␉= 2␉␉// Per the USB CBI Protocol␊ |
310 | ␉};␊ |
311 | ␊ |
312 | ␉// Methods for accessing Bulk Only specific member variables.␊ |
313 | ␉CBIRequestBlock *␉␉GetCBIRequestBlock( void );␊ |
314 | ␊ |
315 | ␉void ␉␉␉␉␉ReleaseCBIRequestBlock( ␊ |
316 | ␉␉␉␉␉␉␉␉CBIRequestBlock *␉cbiRequestBlock );␊ |
317 | ␊ |
318 | ␉// Methods used for CBI/CB command transportation.␊ |
319 | ␉static void␉␉CBIProtocolUSBCompletionAction(␊ |
320 | ␉␉␉␉␉␉void *␉␉␉␉␉target,␊ |
321 | ␉␉ void *␉␉␉␉␉parameter,␊ |
322 | ␉␉ IOReturn␉␉␉␉status,␊ |
323 | ␉␉ UInt32␉␉␉␉␉bufferSizeRemaining);␊ |
324 | ␊ |
325 | ␉IOReturn␉␉CBIProtocolTransferData( ␊ |
326 | ␉␉␉␉␉␉CBIRequestBlock *␉␉cbiRequestBlock,␊ |
327 | ␉␉␉␉␉␉UInt32␉␉␉␉␉nextExecutionState );␊ |
328 | ␉␉ ␊ |
329 | ␉IOReturn␉␉CBIProtocolReadInterrupt( ␊ |
330 | ␉␉␉␉␉␉CBIRequestBlock *␉␉cbiRequestBlock,␊ |
331 | ␉␉␉␉␉␉UInt32␉␉␉␉␉nextExecutionState );␊ |
332 | ␊ |
333 | ␉IOReturn␉␉CBIGetStatusEndpointStatus( ␊ |
334 | ␉␉␉␉␉␉IOUSBPipe *␉␉␉␉targetPipe,␊ |
335 | ␉␉␉␉␉␉CBIRequestBlock *␉␉cbiRequestBlock,␊ |
336 | ␉␉␉␉␉␉UInt32␉␉␉␉␉nextExecutionState );␊ |
337 | ␊ |
338 | ␉IOReturn␉␉CBIClearFeatureEndpointStall( ␊ |
339 | ␉␉␉␉␉␉IOUSBPipe *␉␉␉␉targetPipe,␊ |
340 | ␉␉␉␉␉␉CBIRequestBlock *␉␉cbiRequestBlock,␊ |
341 | ␉␉␉␉␉␉UInt32␉␉␉␉␉nextExecutionState );␊ |
342 | ␉␉␉␉␉␉␊ |
343 | ␉void ␉␉␉CBIProtocolCommandCompletion(␊ |
344 | ␉␉␉␉␉␉CBIRequestBlock *␉␉cbiRequestBlock,␊ |
345 | ␉␉ IOReturn␉␉␉␉resultingStatus,␊ |
346 | ␉␉ UInt32␉␉␉␉␉bufferSizeRemaining );␊ |
347 | ␉␉ ␊ |
348 | ␉/* All Bulk Only transport related methods, structures and enums.␊ |
349 | ␉ */␊ |
350 | ␉// All Bulk Only specific structures and enums.␊ |
351 | ␉␊ |
352 | ␉// All definitions and structures for the Bulk Only Protocol␊ |
353 | ␉// Command Block Wrapper (CBW)␊ |
354 | ␉enum␊ |
355 | ␉{␊ |
356 | ␉␉// CBW general struture definitions␊ |
357 | ␉␉kCommandBlockWrapperSignature␉= OSSwapHostToBigConstInt32 ( 'USBC' ),␊ |
358 | ␉␉kByteCountOfCBW␉␉␉␉␉= 31,␊ |
359 | ␊ |
360 | ␉␉// CBW LUN related definitions␊ |
361 | ␉␉kCBWLUNMask␉␉␉␉␉␉= 0x0F,␊ |
362 | ␊ |
363 | ␉␉kCBWFlagsDataOut␉␉␉␉= 0x00,␊ |
364 | ␉␉kCBWFlagsDataIn␉␉␉␉␉= 0x80␊ |
365 | ␉};␊ |
366 | ␉␊ |
367 | ␉// All definitions and structures for the Bulk Only Protocol␊ |
368 | ␉// Command Status Wrapper (CSW)␊ |
369 | ␉enum␊ |
370 | ␉{␊ |
371 | ␉␉// CSW general struture definitions␊ |
372 | ␉␉kCommandStatusWrapperSignature␉= OSSwapHostToBigConstInt32 ( 'USBS' ),␊ |
373 | ␉␉kByteCountOfCSW␉␉␉␉␉= 13,␊ |
374 | ␊ |
375 | ␉␉// CSW status definitions␊ |
376 | ␉␉kCSWCommandPassedError ␉␉␉= 0x00,␉// No error occurred␊ |
377 | ␉␉kCSWCommandFailedError␉␉␉= 0x01,␉/* An error occurred (probably a ␊ |
378 | ␉␉␉␉␉␉␉␉␉␉␉ ␉ * bad command or parameter ) */␊ |
379 | ␉␉kCSWPhaseError␉␉␉␉␉= 0x02␉/* A transfer was performed in ␊ |
380 | ␉␉␉␉␉␉␉␉␉␉␉ ␉ * the wrong sequence */␊ |
381 | ␉};␊ |
382 | ␊ |
383 | ␉// Methods for accessing Bulk Only specific member variables.␊ |
384 | ␉BulkOnlyRequestBlock *␉GetBulkOnlyRequestBlock( void );␊ |
385 | ␊ |
386 | ␉void ␉␉␉ReleaseBulkOnlyRequestBlock( ␊ |
387 | ␉␉␉␉␉␉BulkOnlyRequestBlock * ␉␉boRequestBlock );␊ |
388 | ␊ |
389 | ␉UInt32␉␉␉GetNextBulkOnlyCommandTag( void );␊ |
390 | ␊ |
391 | ␉// Methods for Bulk Only specific utility commands␊ |
392 | ␉IOReturn␉␉BulkDeviceResetDevice(␊ |
393 | ␉␉␉␉␉␉BulkOnlyRequestBlock *␉␉boRequestBlock,␊ |
394 | ␉␉␉␉␉␉UInt32␉␉␉␉␉␉nextExecutionState );␊ |
395 | ␉␉␉␉␉␉␊ |
396 | ␉// Methods used for Bulk Only command transportation.␊ |
397 | ␉IOReturn␉␉BulkOnlySendCBWPacket(␊ |
398 | ␉␉␉␉␉␉BulkOnlyRequestBlock *␉␉boRequestBlock,␊ |
399 | ␉␉␉␉␉␉UInt32␉␉␉␉␉␉nextExecutionState );␊ |
400 | ␉␊ |
401 | ␉IOReturn␉␉BulkOnlyTransferData( ␊ |
402 | ␉␉␉␉␉␉BulkOnlyRequestBlock *␉␉boRequestBlock,␊ |
403 | ␉␉␉␉␉␉UInt32␉␉␉␉␉␉nextExecutionState );␊ |
404 | ␉␊ |
405 | ␉IOReturn␉␉BulkOnlyReceiveCSWPacket(␊ |
406 | ␉␉␉␉␉␉BulkOnlyRequestBlock *␉␉boRequestBlock,␊ |
407 | ␉␉␉␉␉␉UInt32␉␉␉␉␉␉nextExecutionState );␊ |
408 | ␉␊ |
409 | ␉void␉␉␉BulkOnlyExecuteCommandCompletion (␊ |
410 | ␉␉␉␉␉␉BulkOnlyRequestBlock *␉␉boRequestBlock,␊ |
411 | ␉␉ IOReturn␉␉␉␉␉resultingStatus,␊ |
412 | ␉␉ UInt32␉␉␉␉␉␉bufferSizeRemaining );␊ |
413 | ␊ |
414 | ␉static void␉␉BulkOnlyUSBCompletionAction (␊ |
415 | ␉␉ void *␉␉␉target,␊ |
416 | ␉␉ void *␉␉␉parameter,␊ |
417 | ␉␉ IOReturn␉␉status,␊ |
418 | ␉␉ UInt32␉␉␉bufferSizeRemaining );␊ |
419 | ␉␊ |
420 | public:␊ |
421 | ␊ |
422 | bool␉␉␉␉init( OSDictionary * ␉propTable );␊ |
423 | virtual bool␉␉start( IOService *␉ ␉provider );␊ |
424 | virtual void ␉␉stop( IOService * ␉␉provider );␊ |
425 | ␉virtual void␉␉free( void );␊ |
426 | ␉virtual␉IOReturn␉message( UInt32 type, IOService * provider, void * argument = 0 );␊ |
427 | ␉␊ |
428 | ␉virtual bool willTerminate( IOService * provider, ␊ |
429 | IOOptionBits options );␊ |
430 | ␉␉␉␉␉␉␉␉␉␉␊ |
431 | ␉virtual bool didTerminate(␉IOService * provider, ␊ |
432 | IOOptionBits options, ␊ |
433 | ␉␉␉␉␉␉␉␉␉␉bool *␉␉␉defer );␊ |
434 | ␊ |
435 | ␉virtual bool␉␉handleOpen( IOService *␉␉client,␊ |
436 | ␉␉␉␉␉␉␉␉␉IOOptionBits␉options,␊ |
437 | ␉␉␉␉␉␉␉␉␉void *␉␉␉arg );␊ |
438 | ␉␊ |
439 | ␉virtual void␉␉handleClose( IOService *␉client,␊ |
440 | ␉␉␉␉␉␉␉␉␉ IOOptionBits␉options );␊ |
441 | ␉␊ |
442 | ␉virtual bool␉␉handleIsOpen( const IOService * client ) const;␊ |
443 | ␉␊ |
444 | ␉virtual IOReturn␉HandlePowerOn( void );␊ |
445 | ␉␊ |
446 | protected:␊ |
447 | ␊ |
448 | ␉static IOReturn␉␉sWaitForReset( void * refcon );␊ |
449 | ␉IOReturn␉␉␉GatedWaitForReset( void );␊ |
450 | ␉␊ |
451 | ␉static IOReturn␉␉sWaitForTaskAbort( void * refcon );␉␉␉/* OBSOLETE */␊ |
452 | ␉IOReturn␉␉␉GatedWaitForTaskAbort( void );␉␉␉␉/* OBSOLETE */␊ |
453 | ␉␊ |
454 | ␉static void␉␉␉sResetDevice( void * refcon );␊ |
455 | ␉␊ |
456 | ␉static void␉␉␉sAbortCurrentSCSITask( void * refcon );␉␉/* OBSOLETE */␊ |
457 | ␉␊ |
458 | OSMetaClassDeclareReservedUsed( IOUSBMassStorageClass, 1 );␊ |
459 | ␉virtual IOReturn␉StartDeviceRecovery( void );␉␉␉␉/* OBSOLETE */␊ |
460 | ␊ |
461 | OSMetaClassDeclareReservedUsed( IOUSBMassStorageClass, 2 );␊ |
462 | ␉virtual void␉␉FinishDeviceRecovery( IOReturn␉status );␉/* OBSOLETE */␊ |
463 | ␊ |
464 | ␉static void␉␉␉DeviceRecoveryCompletionAction(␊ |
465 | ␉␉ ␉void *␉␉␉target,␊ |
466 | ␉␉ ␉void *␉␉␉parameter,␊ |
467 | ␉␉ ␉IOReturn␉␉status,␊ |
468 | ␉␉ ␉UInt32␉␉␉bufferSizeRemaining );␉/* OBSOLETE */␊ |
469 | ␊ |
470 | void ResetDeviceNow( bool waitForReset );␊ |
471 | ␉␊ |
472 | ␉void AbortCurrentSCSITask( void );␊ |
473 | ␉␊ |
474 | ␉bool IsPhysicalInterconnectLocationInternal ( void );␊ |
475 | ␉ ␊ |
476 | ␉IOReturn SuspendPort ( bool suspend );␊ |
477 | ␉␊ |
478 | private:␊ |
479 | ␉␊ |
480 | ␉void␉␉␉␉ClearPipeStall ( void );␊ |
481 | ␉␊ |
482 | ␉IOReturn␉␉␉AcceptSCSITask ( SCSITaskIdentifier scsiTask, bool * pAccepted );␊ |
483 | ␉␊ |
484 | ␉void␉␉␉␉CheckDeferredTermination ( void );␊ |
485 | ␉␊ |
486 | ␉void␉␉␉␉GatedCompleteSCSICommand ( SCSITaskIdentifier request, SCSIServiceResponse * serviceResponse, SCSITaskStatus * taskStatus );␊ |
487 | ␉␊ |
488 | ␉// Space reserved for future expansion.␊ |
489 | OSMetaClassDeclareReservedUnused( IOUSBMassStorageClass, 3 );␊ |
490 | OSMetaClassDeclareReservedUnused( IOUSBMassStorageClass, 4 );␊ |
491 | OSMetaClassDeclareReservedUnused( IOUSBMassStorageClass, 5 );␊ |
492 | OSMetaClassDeclareReservedUnused( IOUSBMassStorageClass, 6 );␊ |
493 | OSMetaClassDeclareReservedUnused( IOUSBMassStorageClass, 7 );␊ |
494 | OSMetaClassDeclareReservedUnused( IOUSBMassStorageClass, 8 );␊ |
495 | OSMetaClassDeclareReservedUnused( IOUSBMassStorageClass, 9 );␊ |
496 | OSMetaClassDeclareReservedUnused( IOUSBMassStorageClass, 10 );␊ |
497 | OSMetaClassDeclareReservedUnused( IOUSBMassStorageClass, 11 );␊ |
498 | OSMetaClassDeclareReservedUnused( IOUSBMassStorageClass, 12 );␊ |
499 | OSMetaClassDeclareReservedUnused( IOUSBMassStorageClass, 13 );␊ |
500 | OSMetaClassDeclareReservedUnused( IOUSBMassStorageClass, 14 );␊ |
501 | OSMetaClassDeclareReservedUnused( IOUSBMassStorageClass, 15 );␊ |
502 | OSMetaClassDeclareReservedUnused( IOUSBMassStorageClass, 16 );␊ |
503 | ␉␊ |
504 | };␊ |
505 | ␊ |
506 | ␊ |
507 | #endif _IOKIT_IOUSBMASSSTORAGECLASS_H␊ |
508 |