Root/
Source at commit 1146 created 12 years 11 months ago. By azimutz, Sync with trunk (r1145). Add nVidia dev id's, 0DF4 for "GeForce GT 450M" (issue 99) and 1251 for "GeForce GTX 560M" (thanks to oSxFr33k for testing). | |
---|---|
1 | /*␊ |
2 | * Copyright (c) 1998-2010 Apple Computer, Inc. All rights reserved.␊ |
3 | *␊ |
4 | * @APPLE_LICENSE_HEADER_START@␊ |
5 | * ␊ |
6 | * The contents of this file constitute Original Code as defined in and␊ |
7 | * are subject to the Apple Public Source License Version 1.2 (the␊ |
8 | * "License"). You may not use this file except in compliance with the␊ |
9 | * License. Please obtain a copy of the License at␊ |
10 | * http://www.apple.com/publicsource and read it before using this file.␊ |
11 | * ␊ |
12 | * This Original Code and all software distributed under the License are␊ |
13 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER␊ |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,␊ |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,␊ |
16 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. ␊ |
17 | * Please see the License for the specific language governing rights and ␊ |
18 | * limitations under the License.␊ |
19 | * ␊ |
20 | * @APPLE_LICENSE_HEADER_END@␊ |
21 | */␊ |
22 | ␊ |
23 | #ifndef _IOKIT_IOUSBCONTROLLER_H␊ |
24 | #define _IOKIT_IOUSBCONTROLLER_H␊ |
25 | ␊ |
26 | //================================================================================================␊ |
27 | //␊ |
28 | // Headers␊ |
29 | //␊ |
30 | //================================================================================================␊ |
31 | //␊ |
32 | #include <libkern/c++/OSArray.h>␊ |
33 | ␊ |
34 | #include <IOKit/IOService.h>␊ |
35 | #include <IOKit/IOMemoryDescriptor.h>␊ |
36 | #include <IOKit/IODeviceMemory.h>␊ |
37 | #include <IOKit/IOWorkLoop.h>␊ |
38 | #include <IOKit/IOCommandGate.h>␊ |
39 | #include <IOKit/IOCommandPool.h>␊ |
40 | ␊ |
41 | #include <IOKit/usb/USB.h>␊ |
42 | #include <IOKit/usb/USBHub.h>␊ |
43 | #include <IOKit/usb/IOUSBBus.h>␊ |
44 | #include <IOKit/usb/IOUSBNub.h>␊ |
45 | #include <IOKit/usb/IOUSBCommand.h>␊ |
46 | #include <IOKit/usb/IOUSBWorkLoop.h>␊ |
47 | ␊ |
48 | ␊ |
49 | //================================================================================================␊ |
50 | //␊ |
51 | // Types and Constants␊ |
52 | //␊ |
53 | //================================================================================================␊ |
54 | //␊ |
55 | enum␊ |
56 | {␊ |
57 | kErrataCMDDisableTestMode␉␉␉␉␉= (1 << 0),␉␉// turn off UHCI test mode␊ |
58 | kErrataOnlySinglePageTransfers␉␉␉␉= (1 << 1),␉␉// Don't cross page boundaries in a single transfer␊ |
59 | kErrataRetryBufferUnderruns␉␉␉␉␉= (1 << 2),␉␉// Don't cross page boundaries in a single transfer␊ |
60 | kErrataLSHSOpti␉␉␉␉␉␉␉␉= (1 << 3),␉␉// Don't cross page boundaries in a single transfer␊ |
61 | kErrataDisableOvercurrent␉␉␉␉␉= (1 << 4),␉␉// Always set the NOCP bit in rhDescriptorA register␊ |
62 | kErrataLucentSuspendResume␉␉␉␉␉= (1 << 5),␉␉// Don't allow port suspend at the root hub␊ |
63 | kErrataNeedsWatchdogTimer␉␉␉␉␉= (1 << 6),␉␉// Use Watchdog timer to reset confused controllers␊ |
64 | kErrataNeedsPortPowerOff␉␉␉␉␉= (1 << 7),␉␉// Power off the ports and back on again to clear weird status.␊ |
65 | kErrataAgereEHCIAsyncSched␉␉␉␉␉= (1 << 8),␉␉// needs workaround for Async Sched bug␊ |
66 | kErrataNECOHCIIsochWraparound␉␉␉␉= (1 << 9),␉␉// needs workaround for NEC isoch buffer wraparound problem␊ |
67 | ␉kErrataNECIncompleteWrite␉␉␉␉␉= (1 << 10),␉// needs workaround for NEC bits not sticking (errata IBB-2UE-00030 Jun 23 2005)␊ |
68 | ␉kErrataICH6PowerSequencing␉␉␉␉␉= (1 << 11),␉// needs special power sequencing for early Transition machines␊ |
69 | ␉kErrataICH7ISTBuffer␉␉␉␉␉␉= (1 << 12),␉// buffer for Isochronous Scheduling Threshold␊ |
70 | ␉kErrataUHCISupportsOvercurrent␉␉␉␉= (1 << 13),␉// UHCI controller supports overcurrent detection␊ |
71 | ␉kErrataNeedsOvercurrentDebounce␉␉␉␉= (1 << 14),␉// The overcurrent indicator should be debounced by 10ms␊ |
72 | ␉kErrataSupportsPortResumeEnable␉␉␉␉= (1 << 15),␉// UHCI has resume enable bits at config address 0xC4␊ |
73 | ␉kErrataNoCSonSplitIsoch␉␉␉␉␉␉= (1 << 16),␉// MCP79 - split iscoh is a little different␊ |
74 | ␉kErrataOHCINoGlobalSuspendOnSleep␉␉␉= (1 << 17),␉// when sleeping, do not put the OHCI controller in SUSPEND state. just leave it Operational with suspended downstream ports␊ |
75 | ␉kErrataMissingPortChangeInt␉␉␉␉␉= (1 << 18),␉// sometimes the port change interrupt may be missing␊ |
76 | ␉kErrataMCP79IgnoreDisconnect␉␉␉␉= (1 << 19),␉// MCP79 - need to ignore a connect/disconnect on wake␊ |
77 | ␉kErrataUse32bitEHCI␉␉␉␉␉␉␉= (1 << 20)␉,␉// MCP79 - EHCI should only run with 32 bit DMA addresses␊ |
78 | ␉kErrataUHCISupportsResumeDetectOnConnect␉= (1 << 21),␉// UHCI controller will generate a ResumeDetect interrupt while in Global Suspend if a device is plugged in␊ |
79 | ␉kErrataDontUseCompanionController␉␉␉= (1 << 22)␉␉// For systems which will end up being EHCI only␊ |
80 | };␊ |
81 | ␊ |
82 | enum␊ |
83 | {␊ |
84 | kUSBWatchdogTimeoutMS = 1000␊ |
85 | };␊ |
86 | ␊ |
87 | ␊ |
88 | /*!␊ |
89 | @struct␊ |
90 | @discussion This table contains the list of errata that are necessary for known problems with particular devices.␊ |
91 | The format is vendorID, product ID, lowest revisionID needing errata, highest rev needing errata, errataBits.␊ |
92 | The result of all matches is ORed together, so more than one entry may match.␊ |
93 | Typically for a given errata a list of revisions that this applies to is supplied.␊ |
94 | @field vendID The Vendor ID of the device␊ |
95 | @field deviceID Product ID of device␊ |
96 | @field revisionLo Lowest product revsion to apply errata to␊ |
97 | @field revisionHi Highest product revision to apply errata to␊ |
98 | @field errata Bit field flagging which errata to apply to device.␊ |
99 | */␊ |
100 | ␊ |
101 | struct ErrataListEntryStruct␊ |
102 | {␊ |
103 | UInt16 ␉␉␉␉vendID;␊ |
104 | UInt16 ␉␉␉␉deviceID;␊ |
105 | UInt16 ␉␉␉␉revisionLo;␊ |
106 | UInt16 ␉␉␉␉revisionHi;␊ |
107 | UInt32 ␉␉␉␉errata;␊ |
108 | };␊ |
109 | ␊ |
110 | typedef struct ErrataListEntryStruct ErrataListEntry, *ErrataListEntryPtr;␊ |
111 | ␊ |
112 | ␊ |
113 | //================================================================================================␊ |
114 | //␊ |
115 | // Routines used to implement synchronous I/O␊ |
116 | //␊ |
117 | //================================================================================================␊ |
118 | //␊ |
119 | void IOUSBSyncCompletion(void *target, void * parameter, IOReturn status, UInt32 bufferSizeRemaining);␊ |
120 | ␊ |
121 | void IOUSBSyncIsoCompletion(void *target, void * parameter, IOReturn status, IOUSBIsocFrame *pFrames);␊ |
122 | ␊ |
123 | ␊ |
124 | //================================================================================================␊ |
125 | //␊ |
126 | // Forward Declarations␊ |
127 | //␊ |
128 | //================================================================================================␊ |
129 | //␊ |
130 | class IOUSBDevice;␊ |
131 | class IOUSBLog;␊ |
132 | class IOUSBHubDevice;␊ |
133 | class IOUSBRootHubDevice;␊ |
134 | class IOMemoryDescriptor;␊ |
135 | ␊ |
136 | ␊ |
137 | //================================================================================================␊ |
138 | //␊ |
139 | // IOUSBController Class␊ |
140 | //␊ |
141 | //================================================================================================␊ |
142 | //␊ |
143 | /*!␊ |
144 | @class IOUSBController␊ |
145 | @abstract Base class for USB hardware driver␊ |
146 | @discussion Not many directly useful methods for USB device driver writers,␊ |
147 | IOUSBDevice, IOUSBInterface and IOUSBPipe provide more useful abstractions.␊ |
148 | The bulk of this class interfaces between IOKit and the low-level UIM, which is␊ |
149 | based on the MacOS9 UIM. To impliment a new controller type, subclass␊ |
150 | IOUSBController and impiment all the "UIM functions". AppleUSBOHCI␊ |
151 | is an example of this implementing all the functions necessary to drive an␊ |
152 | OHCI controller.␊ |
153 | */␊ |
154 | class IOUSBController : public IOUSBBus␊ |
155 | {␊ |
156 | OSDeclareAbstractStructors(IOUSBController)␊ |
157 | friend class IOUSBControllerV2;␊ |
158 | friend class IOUSBControllerV3;␊ |
159 | ␊ |
160 | protected:␊ |
161 | ␊ |
162 | IOUSBWorkLoop *␉␉␉_workLoop;␊ |
163 | IOCommandGate *␉␉␉_commandGate;␊ |
164 | IOUSBRootHubDevice *␉_rootHubDevice;␊ |
165 | UInt32␉␉␉␉␉_devZeroLock;␊ |
166 | static UInt32␉␉␉_busCount;␊ |
167 | static bool␉␉␉␉gUsedBusIDs[256];␊ |
168 | ␊ |
169 | struct ExpansionData ␊ |
170 | {␊ |
171 | ␉␉IOCommandPool␉␉*freeUSBCommandPool;␊ |
172 | ␉␉IOCommandPool␉␉*freeUSBIsocCommandPool;␊ |
173 | IOTimerEventSource␉*watchdogUSBTimer;␊ |
174 | bool␉␉␉␉_terminating;␊ |
175 | bool␉␉␉␉_watchdogTimerActive;␊ |
176 | bool␉␉␉␉_pcCardEjected;␉␉␉␉␉␉// Obsolete␊ |
177 | UInt32␉␉␉␉_busNumber;␊ |
178 | UInt32␉␉␉␉_currentSizeOfCommandPool;␊ |
179 | UInt32␉␉␉␉_currentSizeOfIsocCommandPool;␊ |
180 | UInt8␉␉␉␉_controllerSpeed;␉␉␉␉␉// Controller speed, passed down for splits␊ |
181 | thread_call_t␉␉_terminatePCCardThread;␉␉␉␉// Obsolete␊ |
182 | bool␉␉␉␉_addressPending[128];␊ |
183 | ␉␉SInt32␉␉␉␉_activeIsochTransfers;␉␉␉␉// isochronous transfers in the queue␊ |
184 | ␉␉IOService␉␉␉*_provider;␉␉␉␉␉␉␉// common name for our provider␊ |
185 | ␉␉bool␉␉␉␉_controllerCanSleep;␉␉␉␉// true iff the controller is able to support sleep/wake␊ |
186 | ␉␉bool␉␉␉␉_needToClose;␊ |
187 | ␉␉UInt32␉␉␉␉_isochMaxBusStall;␉␉␉␉␉// value (in ns) of the maximum PCI bus stall allowed for Isoch..␊ |
188 | };␊ |
189 | ExpansionData *_expansionData;␊ |
190 | ␉␊ |
191 | // The following methods do not use and upper case initial letter because they are part of IOKit␊ |
192 | //␊ |
193 | ␊ |
194 | public:␊ |
195 | virtual bool ␉␉init( OSDictionary * propTable );␊ |
196 | virtual bool ␉␉start( IOService * provider );␊ |
197 | virtual void ␉␉stop( IOService * provider );␊ |
198 | virtual bool ␉␉finalize(IOOptionBits options);␊ |
199 | virtual IOReturn ␉message( UInt32 type, IOService * provider, void * argument = 0 );␊ |
200 | virtual bool␉␉didTerminate( IOService * provider, IOOptionBits options, bool * defer );␊ |
201 | ␉␊ |
202 | protected:␊ |
203 | ␉␉␊ |
204 | IOReturn␉␉␉getNubResources( IOService * regEntry );␊ |
205 | ␊ |
206 | virtual UInt32 ␉␉GetErrataBits(␊ |
207 | UInt16 vendorID, ␊ |
208 | UInt16 deviceID, ␊ |
209 | UInt16 revisionID ); ␊ |
210 | ␊ |
211 | ␊ |
212 | static IOReturn ␉␉DoDeleteEP( ␊ |
213 | OSObject *␉owner, ␊ |
214 | void *␉arg0, ␊ |
215 | void *␉arg1, ␊ |
216 | void *␉arg2, ␊ |
217 | void *␉arg3 );␊ |
218 | ␊ |
219 | static IOReturn ␉␉DoAbortEP( ␊ |
220 | OSObject *␉owner, ␊ |
221 | void *␉arg0, ␊ |
222 | void *␉arg1, ␊ |
223 | void *␉arg2, ␊ |
224 | void *␉arg3 );␊ |
225 | ␊ |
226 | static IOReturn ␉␉DoClearEPStall( ␊ |
227 | OSObject *␉owner, ␊ |
228 | void *␉arg0, ␊ |
229 | void *␉arg1, ␊ |
230 | void *␉arg2, ␊ |
231 | void *␉arg3 );␊ |
232 | ␊ |
233 | static IOReturn ␉␉DoCreateEP( ␊ |
234 | OSObject *␉owner, ␊ |
235 | void *␉arg0, ␊ |
236 | void *␉arg1, ␊ |
237 | void *␉arg2, ␊ |
238 | void *␉arg3 );␊ |
239 | static IOReturn ␉␉DoControlTransfer( ␊ |
240 | OSObject *␉owner, ␊ |
241 | void *␉arg0, ␊ |
242 | void *␉arg1, ␊ |
243 | void *␉arg2, ␊ |
244 | void *␉arg3 );␊ |
245 | ␊ |
246 | static IOReturn ␉␉DoIOTransfer( ␊ |
247 | OSObject *␉owner, ␊ |
248 | void *␉arg0, ␊ |
249 | void *␉arg1, ␊ |
250 | void *␉arg2, ␊ |
251 | void *␉arg3 );␊ |
252 | ␊ |
253 | static IOReturn ␉␉DoIsocTransfer(␉␊ |
254 | OSObject *␉owner, ␊ |
255 | void *␉arg0, ␊ |
256 | void *␉arg1, ␊ |
257 | void *␉arg2, ␊ |
258 | void *␉arg3 );␊ |
259 | ␊ |
260 | static IOReturn ␉␉DoLowLatencyIsocTransfer(␉␊ |
261 | OSObject *␉owner, ␊ |
262 | void *␉arg0, ␊ |
263 | void *␉arg1, ␊ |
264 | void *␉arg2, ␊ |
265 | void *␉arg3 );␊ |
266 | ␊ |
267 | static void␉␉␉ControlPacketHandler( ␊ |
268 | OSObject *␉target,␊ |
269 | void *␉parameter,␊ |
270 | IOReturn␉status,␊ |
271 | UInt32␉bufferSizeRemaining );␊ |
272 | ␊ |
273 | static void␉␉␉InterruptPacketHandler(␊ |
274 | OSObject *␉target,␊ |
275 | void * ␉parameter,␊ |
276 | IOReturn␉status,␊ |
277 | UInt32␉bufferSizeRemaining );␊ |
278 | ␊ |
279 | static void␉␉␉BulkPacketHandler(␊ |
280 | OSObject *␉target,␊ |
281 | void * ␉parameter,␊ |
282 | IOReturn␉status,␊ |
283 | UInt32␉bufferSizeRemaining );␊ |
284 | ␊ |
285 | static void␉␉␉IsocCompletionHandler(␊ |
286 | OSObject *␉␉target,␊ |
287 | void * ␉␉parameter,␊ |
288 | IOReturn␉␉status,␊ |
289 | IOUSBIsocFrame␉*pFrames );␊ |
290 | ␊ |
291 | static void␉␉␉LowLatencyIsocCompletionHandler(␊ |
292 | OSObject *␉␉target,␊ |
293 | void * ␉␉parameter,␊ |
294 | IOReturn␉␉status,␊ |
295 | IOUSBLowLatencyIsocFrame␉*pFrames );␊ |
296 | ␊ |
297 | static void␉␉␉WatchdogTimer(OSObject *target, IOTimerEventSource *sender);␊ |
298 | ␊ |
299 | ␉// Obsolete␊ |
300 | static void ␉␉TerminatePCCard(OSObject *target);␊ |
301 | ␊ |
302 | static IOReturn␉␉ProtectedDevZeroLock(OSObject *target, void* lock, void *, void *, void*);␊ |
303 | ␊ |
304 | ␊ |
305 | USBDeviceAddress␉␉GetNewAddress( void );␊ |
306 | ␊ |
307 | IOReturn ␉␉ControlTransaction( IOUSBCommand * command );␊ |
308 | ␊ |
309 | IOReturn ␉␉InterruptTransaction( IOUSBCommand * command );␊ |
310 | ␊ |
311 | IOReturn ␉␉BulkTransaction( IOUSBCommand *␉command );␊ |
312 | ␊ |
313 | IOReturn ␉␉IsocTransaction( IOUSBIsocCommand * command );␊ |
314 | ␊ |
315 | IOReturn ␉␉LowLatencyIsocTransaction( IOUSBIsocCommand * command );␊ |
316 | ␊ |
317 | void ␉␉␉FreeCommand( IOUSBCommand * command );␊ |
318 | ␊ |
319 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -␊ |
320 | // Invokes the specified completion action of the request. If␊ |
321 | // the completion action is unspecified, no action is taken.␊ |
322 | void ␉␉␉Complete(␊ |
323 | IOUSBCompletion␉completion,␊ |
324 | IOReturn␉␉status,␊ |
325 | UInt32␉␉actualByteCount = 0 );␊ |
326 | ␊ |
327 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -␊ |
328 | // Invokes the specified completion action of the request. If␊ |
329 | // the completion action is unspecified, no action is taken.␊ |
330 | void␉CompleteWithTimeStamp (␊ |
331 | IOUSBCompletionWithTimeStamp␉␉completion,␊ |
332 | IOReturn␉␉␉␉status,␊ |
333 | UInt32␉␉␉␉␉actualByteCount,␊ |
334 | AbsoluteTime␉␉␉␉timeStamp);␊ |
335 | ␊ |
336 | ␊ |
337 | ␊ |
338 | //␊ |
339 | // UIM methods␊ |
340 | //␊ |
341 | ␊ |
342 | /*!␊ |
343 | @function UIMInitialize␊ |
344 | @abstract UIM function, initialise the controller and UIM data structures.␊ |
345 | */␊ |
346 | virtual IOReturn ␉␉UIMInitialize( IOService * provider ) = 0;␊ |
347 | ␊ |
348 | /*!␊ |
349 | @function UIMFinalize␊ |
350 | @abstract UIM function, finalise the controller and UIM data structures prior to removal.␊ |
351 | */␊ |
352 | virtual IOReturn ␉␉UIMFinalize() = 0;␊ |
353 | ␊ |
354 | // Control␊ |
355 | /*!␊ |
356 | @function UIMCreateControlEndpoint␊ |
357 | @abstract UIM function, create a control endpoint for the controller.␊ |
358 | @param functionNumber The USB device ID of the device for this endpoint␊ |
359 | @param endpointNumber The endpoint number for this endpoint␊ |
360 | @param maxPacketSize Maximum packet size of this endpoint␊ |
361 | @param speed speed of the device: kUSBDeviceSpeedLow or kUSBDeviceSpeedFull ␊ |
362 | */␊ |
363 | virtual IOReturn ␉␉UIMCreateControlEndpoint(␊ |
364 | UInt8␉functionNumber,␊ |
365 | UInt8␉endpointNumber,␊ |
366 | UInt16␉maxPacketSize,␊ |
367 | UInt8␉speed) = 0;␊ |
368 | ␊ |
369 | /* Note: this function has been superceded. */␊ |
370 | virtual IOReturn ␉␉UIMCreateControlTransfer( short␉␉functionNumber,␊ |
371 | short␉␉endpointNumber,␊ |
372 | IOUSBCompletion␉completion,␊ |
373 | void *␉␉CBP,␊ |
374 | bool␉␉bufferRounding,␊ |
375 | UInt32␉␉bufferSize,␊ |
376 | short␉␉direction) = 0;␊ |
377 | ␊ |
378 | /*!␊ |
379 | @function UIMCreateControlTransfer␊ |
380 | @abstract UIM function, Do a transfer on a control endpoint.␊ |
381 | This method supercedes the method which takes a void * parameter.␊ |
382 | @param functionNumber The USB device ID of the device to perform the transaction with␊ |
383 | @param endpointNumber The endpoint number for the transaction␊ |
384 | @param completion Action to perform when I/O completes␊ |
385 | @param CBP Memory descriptor describing the buffer to transfer. Will never describe␊ |
386 | memory which has disjoint packets.␊ |
387 | @param bufferRounding If true, short packets are OK and do not cause an error␊ |
388 | @param bufferSize Size of the data to transfer in the data phase. (C␊ |
389 | @param direction Specifies direction and PID for transaction. kUSBIn, KUSBOut (DATA PID) or kUSBSetup (SETUP PID).␊ |
390 | */␊ |
391 | virtual IOReturn ␉␉UIMCreateControlTransfer( short␉␉␉functionNumber,␊ |
392 | short␉␉␉endpointNumber,␊ |
393 | IOUSBCompletion␉␉completion,␊ |
394 | IOMemoryDescriptor *␉CBP,␊ |
395 | bool␉␉␉bufferRounding,␊ |
396 | UInt32␉␉␉bufferSize,␊ |
397 | short␉␉␉direction) = 0;␊ |
398 | ␊ |
399 | // Bulk␊ |
400 | /*!␊ |
401 | @function UIMCreateBulkEndpoint␊ |
402 | @abstract UIM function, create a bulk endpoint for the controller.␊ |
403 | @param functionNumber The USB device ID of the device for this endpoint␊ |
404 | @param endpointNumber The endpoint number for this endpoint␊ |
405 | @param direction Specifies direction for the endpoint. kUSBIn or KUSBOut.␊ |
406 | @param speed speed of the device: kUSBDeviceSpeedLow or kUSBDeviceSpeedFull ␊ |
407 | @param maxPacketSize Maximum packet size of this endpoint␊ |
408 | */␊ |
409 | virtual IOReturn ␉␉UIMCreateBulkEndpoint(␊ |
410 | UInt8␉␉functionNumber,␊ |
411 | UInt8␉␉endpointNumber,␊ |
412 | UInt8␉␉direction,␊ |
413 | UInt8␉␉speed,␊ |
414 | UInt8␉␉maxPacketSize) = 0;␊ |
415 | ␊ |
416 | /* Note: this function has been superceded. */␊ |
417 | virtual IOReturn ␉␉UIMCreateBulkTransfer( short␉␉␉functionNumber,␊ |
418 | short␉␉␉endpointNumber,␊ |
419 | IOUSBCompletion␉␉completion,␊ |
420 | IOMemoryDescriptor *␉CBP,␊ |
421 | bool␉␉␉bufferRounding,␊ |
422 | UInt32␉␉␉bufferSize,␊ |
423 | short␉␉␉direction) = 0;␊ |
424 | ␊ |
425 | // Interrupt␊ |
426 | /*!␊ |
427 | @function UIMCreateInterruptEndpoint␊ |
428 | @abstract UIM function, create an interrupt endpoint for the controller.␊ |
429 | @param functionNumber The USB device ID of the device for this endpoint␊ |
430 | @param endpointNumber The endpoint number for this endpoint␊ |
431 | @param direction Specifies direction for the endpoint. kUSBIn or KUSBOut.␊ |
432 | @param speed speed of the device: kUSBDeviceSpeedLow or kUSBDeviceSpeedFull ␊ |
433 | @param maxPacketSize Maximum packet size of this endpoint␊ |
434 | @param pollingRate The maximum polling interval from the endpoint descriptor.␊ |
435 | */␊ |
436 | virtual IOReturn␉␉UIMCreateInterruptEndpoint(␊ |
437 | short␉␉functionAddress,␊ |
438 | short␉␉endpointNumber,␊ |
439 | UInt8␉␉direction,␊ |
440 | short␉␉speed,␊ |
441 | UInt16␉␉maxPacketSize,␊ |
442 | short␉␉pollingRate) = 0;␊ |
443 | ␊ |
444 | /* Note: this function has been superceded. */␊ |
445 | virtual IOReturn ␉␉UIMCreateInterruptTransfer( short␉␉␉functionNumber,␊ |
446 | short␉␉␉endpointNumber,␊ |
447 | IOUSBCompletion␉␉completion,␊ |
448 | IOMemoryDescriptor *␉CBP,␊ |
449 | bool␉␉␉bufferRounding,␊ |
450 | UInt32␉␉␉bufferSize,␊ |
451 | short␉␉␉direction) = 0;␊ |
452 | ␊ |
453 | // Isoch␊ |
454 | /*!␊ |
455 | ␉@function UIMCreateIsochEndpoint␊ |
456 | @abstract Create an Isochronous endpoint in the controller.␊ |
457 | @param functionNumber The USB device ID of the device for this endpoint␊ |
458 | @param endpointNumber The endpoint number for this endpoint␊ |
459 | @param maxPacketSize Maximum packet size of this endpoint␊ |
460 | @param direction Specifies direction for the endpoint. kUSBIn or KUSBOut.␊ |
461 | */␊ |
462 | virtual IOReturn ␉␉UIMCreateIsochEndpoint(␊ |
463 | short␉␉functionAddress,␊ |
464 | short␉␉endpointNumber,␊ |
465 | UInt32␉␉maxPacketSize,␊ |
466 | UInt8␉␉direction) = 0;␊ |
467 | ␊ |
468 | /*!␊ |
469 | @function UIMCreateIsochTransfer␊ |
470 | @abstract UIM function, Do a transfer on an Isocchronous endpoint.␊ |
471 | @param functionNumber The USB device ID of the device to perform the transaction with␊ |
472 | @param endpointNumber The endpoint number for the transaction␊ |
473 | @param completion Action to perform when I/O completes␊ |
474 | @param direction Specifies direction for transfer. kUSBIn or KUSBOut.␊ |
475 | @param frameStart The frame number in which to start the transactions␊ |
476 | @param pBuffer describes memory buffer. ␊ |
477 | @param frameCount number of frames to do transactions in␊ |
478 | @param pFrames Describes transactions in individual frames, gives sizes and reults for transactions.␊ |
479 | */␊ |
480 | virtual IOReturn ␉␉UIMCreateIsochTransfer(␊ |
481 | short␉␉␉functionAddress,␊ |
482 | short␉␉␉endpointNumber,␊ |
483 | IOUSBIsocCompletion␉completion,␊ |
484 | UInt8␉␉␉direction,␊ |
485 | UInt64␉␉␉frameStart,␊ |
486 | IOMemoryDescriptor *␉pBuffer,␊ |
487 | UInt32␉␉␉frameCount,␊ |
488 | IOUSBIsocFrame␉␉*pFrames) = 0;␊ |
489 | ␊ |
490 | /*!␊ |
491 | @function UIMAbortEndpoint␊ |
492 | @abstract UIM function Abort the specified endpoint, return all transactions queued on it.␊ |
493 | @param functionNumber The USB device ID of the device to Abort␊ |
494 | @param endpointNumber The endpoint number to Abort␊ |
495 | @param direction Specifies direction of the endpoint for uniqueness. kUSBIn or KUSBOut.␊ |
496 | */␊ |
497 | virtual IOReturn ␉␉UIMAbortEndpoint(␊ |
498 | short␉␉functionNumber,␊ |
499 | short␉␉endpointNumber,␊ |
500 | short␉␉direction) = 0;␊ |
501 | ␊ |
502 | /*!␊ |
503 | @function UIMDeleteEndpoint␊ |
504 | @abstract UIM function Delete the specified endpoint, returning all transactions queued on it.␊ |
505 | @param functionNumber The USB device ID of the device to Delete␊ |
506 | @param endpointNumber The endpoint number to Delete␊ |
507 | @param direction Specifies direction of the endpoint for uniqueness. kUSBIn or KUSBOut.␊ |
508 | */␊ |
509 | virtual IOReturn ␉␉UIMDeleteEndpoint(␊ |
510 | short␉functionNumber,␊ |
511 | short␉endpointNumber,␊ |
512 | short␉direction) = 0;␊ |
513 | ␊ |
514 | /*!␊ |
515 | @function UIMClearEndpointStall␊ |
516 | @abstract UIM function Clear stall on the specified endpoint, set data toggle to zero,␊ |
517 | return all transactions queued on it.␊ |
518 | @param functionNumber The USB device ID of the device to Clear␊ |
519 | @param endpointNumber The endpoint number to Clear␊ |
520 | @param direction Specifies direction of the endpoint for uniqueness. kUSBIn or KUSBOut.␊ |
521 | */␊ |
522 | virtual IOReturn ␉␉UIMClearEndpointStall(␊ |
523 | short␉␉functionNumber,␊ |
524 | short␉␉endpointNumber,␊ |
525 | short␉␉direction) = 0;␊ |
526 | ␊ |
527 | /*!␊ |
528 | @function UIMRootHubStatusChange␊ |
529 | @abstract UIM function UIMRootHubStatusChange - This method was internal to the UIM (never called by the superclass) until␊ |
530 | ␉␉␉␉␉␉␉IOUSBControllerV3. For UIMs which are a subclass of IOUSBController or IOUSBControllerV2, it can␊ |
531 | ␉␉␉␉␉␉␉still be used internally only. For subclasses of IOUSBControllerV3, however, the meaning has changed␊ |
532 | ␉␉␉␉␉␉␉slightly. Now, it is used to determine if there is a status change on the root hub, and if so, it ␊ |
533 | ␉␉␉␉␉␉␉needs to update the IOUSBControllerV3 instance variable _rootHubStatusChangedBitmap␊ |
534 | */␊ |
535 | virtual void ␉␉UIMRootHubStatusChange(void) = 0;␊ |
536 | ␊ |
537 | static const IORegistryPlane␉*gIOUSBPlane;␊ |
538 | ␊ |
539 | public:␊ |
540 | ␊ |
541 | static IOUSBLog␉␉*_log;␊ |
542 | ␉␊ |
543 | IOCommandGate *␉␉GetCommandGate(void);␊ |
544 | ␊ |
545 | /*!␊ |
546 | ␉@struct Endpoint␊ |
547 | Describes an endpoint of a device.␊ |
548 | ␉Simply an easier to use version of the endpoint descriptor.␊ |
549 | @field descriptor The raw endpoint descriptor.␊ |
550 | @field number Endpoint number␊ |
551 | ␉@field direction Endpoint direction: kUSBOut, kUSBIn, kUSBAnyDirn␊ |
552 | ␉@field transferType Type of endpoint: kUSBControl, kUSBIsoc, kUSBBulk, kUSBInterrupt␊ |
553 | ␉@field maxPacketSize Maximum packet size for endpoint␊ |
554 | ␉@field interval Polling interval in milliseconds (only relevent for Interrupt endpoints)␊ |
555 | */␊ |
556 | struct Endpoint {␊ |
557 | IOUSBEndpointDescriptor␉*␉descriptor;␊ |
558 | UInt8 ␉␉␉␉number;␊ |
559 | UInt8␉␉␉␉direction;␉// in, out␊ |
560 | UInt8␉␉␉␉transferType;␉// cntrl, bulk, isoc, int␊ |
561 | UInt16␉␉␉␉maxPacketSize;␊ |
562 | UInt8␉␉␉␉interval;␊ |
563 | };␊ |
564 | ␊ |
565 | // Implements IOService::getWorkLoop const member function␊ |
566 | virtual IOWorkLoop *␉getWorkLoop() const;␊ |
567 | ␊ |
568 | /*␊ |
569 | * Root hub methods␊ |
570 | * Only of interest to the IOUSBRootHubDevice object␊ |
571 | */␊ |
572 | /*!␊ |
573 | @function GetRootHubDeviceDescriptor␊ |
574 | @abstract UIM function, return the device descriptor of the simulated root hub device␊ |
575 | As GET_DESCRIPTOR control request for device descrptor␊ |
576 | @param desc Descriptor structure to return data in␊ |
577 | */␊ |
578 | virtual IOReturn ␉␉GetRootHubDeviceDescriptor( IOUSBDeviceDescriptor *desc ) = 0;␊ |
579 | ␊ |
580 | /*!␊ |
581 | @function GetRootHubDescriptor␊ |
582 | @abstract UIM function, return the hub descriptor of the simulated root hub device␊ |
583 | As GET_DESCRIPTOR control request for hub descrptor␊ |
584 | @param desc Descriptor structure to return data in␊ |
585 | */␊ |
586 | virtual IOReturn ␉␉GetRootHubDescriptor( IOUSBHubDescriptor *desc ) = 0;␊ |
587 | ␊ |
588 | /*!␊ |
589 | @function SetRootHubDescriptor␊ |
590 | @abstract UIM function, optional. Set the hub descriptor data.␊ |
591 | As SET_DESCRIPTOR control request for hub descrptor␊ |
592 | @param buffer Descriptor data␊ |
593 | */␊ |
594 | virtual IOReturn ␉␉SetRootHubDescriptor( OSData *buffer ) = 0;␊ |
595 | ␊ |
596 | /*!␊ |
597 | @function GetRootHubConfDescriptor␊ |
598 | @abstract UIM function, retrun the configuration descriptor of the simulated root hub device␊ |
599 | As GET_DESCRIPTOR control request for configuration descrptor␊ |
600 | @param desc Descriptor structure to return data in␊ |
601 | */␊ |
602 | virtual IOReturn ␉␉GetRootHubConfDescriptor( OSData *desc ) = 0;␊ |
603 | ␊ |
604 | /*!␊ |
605 | @function GetRootHubStatus␊ |
606 | @abstract UIM function, get the status of the root hub. As GET_STATUS control request to device.␊ |
607 | @param status Status structure to return␊ |
608 | */␊ |
609 | virtual IOReturn ␉␉GetRootHubStatus( IOUSBHubStatus *status ) = 0;␊ |
610 | ␊ |
611 | /*!␊ |
612 | @function SetRootHubFeature␊ |
613 | @abstract UIM function, set feature of root hub, As SET_FEATURE control request.␊ |
614 | @param wValue The feature to set, as would be transferred in wValue field of SETUP packet.␊ |
615 | */␊ |
616 | virtual IOReturn ␉␉SetRootHubFeature( UInt16 wValue ) = 0;␊ |
617 | ␊ |
618 | /*!␊ |
619 | @function ClearRootHubFeature␊ |
620 | @abstract UIM function, set feature of root hub, As CLEAR_FEATURE control request.␊ |
621 | @param wValue The feature to clear, as would be transferred in wValue field of SETUP packet.␊ |
622 | */␊ |
623 | virtual IOReturn␉␉ClearRootHubFeature( UInt16 wValue ) = 0;␊ |
624 | ␊ |
625 | /*!␊ |
626 | @function GetRootHubPortStatus␊ |
627 | @abstract UIM function, get the status of a root hub port. As GET_STATUS control request to the port.␊ |
628 | @param status Status structure to return␊ |
629 | @param port Port to get status for.␊ |
630 | */␊ |
631 | virtual IOReturn ␉␉GetRootHubPortStatus( IOUSBHubPortStatus *status, UInt16 port ) = 0;␊ |
632 | ␊ |
633 | /*!␊ |
634 | @function SetRootHubPortFeature␊ |
635 | @abstract UIM function, set feature of a root hub port, As SET_FEATURE control request to a port.␊ |
636 | @param wValue The feature to set, as would be transferred in wValue field of SETUP packet.␊ |
637 | @param port Port to set feature for␊ |
638 | */␊ |
639 | virtual IOReturn ␉␉SetRootHubPortFeature( UInt16 wValue, UInt16 port ) = 0;␊ |
640 | ␊ |
641 | /*!␊ |
642 | @function ClearRootHubPortFeature␊ |
643 | @abstract UIM function, clear feature of a root hub port, As CLEAR_FEATURE control request to a port.␊ |
644 | @param wValue The feature to clear, as would be transferred in wValue field of SETUP packet.␊ |
645 | @param port Port to clear feature for␊ |
646 | */␊ |
647 | virtual IOReturn ␉␉ClearRootHubPortFeature( UInt16 wValue, UInt16 port ) = 0;␊ |
648 | ␊ |
649 | /*!␊ |
650 | @function ClearRootHubPortFeature␊ |
651 | @abstract UIM function, Impliments GET_BUS_STATE control request, now obsolete.␊ |
652 | */␊ |
653 | virtual IOReturn ␉␉GetRootHubPortState( UInt8 *state, UInt16 port ) = 0;␊ |
654 | ␊ |
655 | /*!␊ |
656 | @function SetHubAddress␊ |
657 | @abstract UIM function, set the address of the simulated root hub device, as SET_ADDRESS␊ |
658 | @param wValue␉ New address for root hub.␊ |
659 | */␊ |
660 | virtual IOReturn ␉␉SetHubAddress( UInt16 wValue ) = 0;␊ |
661 | ␊ |
662 | ␊ |
663 | /*!␊ |
664 | ␉␉@function openPipe␊ |
665 | Open a pipe to the specified device endpoint␊ |
666 | @param address Address of the device on the USB bus␊ |
667 | ␉␉@param speed of the device: kUSBHighSpeed or kUSBLowSpeed␊ |
668 | @param endpoint description of endpoint to connect to␊ |
669 | */␊ |
670 | virtual IOReturn ␉␉OpenPipe( USBDeviceAddress ␉address, ␊ |
671 | ␉␉␉␉␉␉␉␉␉␉UInt8␉␉␉␉speed,␊ |
672 | Endpoint *␉␉␉endpoint );␊ |
673 | /*!␊ |
674 | @function closePipe␊ |
675 | Close a pipe to the specified device endpoint␊ |
676 | @param address Address of the device on the USB bus␊ |
677 | ␉␉@param endpoint description of endpoint␊ |
678 | */␊ |
679 | virtual IOReturn ␉␉ClosePipe(␉USBDeviceAddress ␉address,␊ |
680 | Endpoint *␉␉␉endpoint );␊ |
681 | ␊ |
682 | // Controlling pipe state␊ |
683 | /*!␊ |
684 | @function abortPipe␊ |
685 | Abort pending I/O to/from the specified endpoint, causing them to complete with return code kIOReturnAborted␊ |
686 | @param address Address of the device on the USB bus␊ |
687 | @param endpoint description of endpoint␊ |
688 | */␊ |
689 | virtual IOReturn ␉␉AbortPipe(␊ |
690 | USBDeviceAddress ␉address,␊ |
691 | Endpoint *␉␉␉endpoint );␊ |
692 | /*!␊ |
693 | @function resetPipe␊ |
694 | Abort pending I/O and clear stalled state - this method is a combination of abortPipe and clearPipeStall␊ |
695 | @param address Address of the device on the USB bus␊ |
696 | @param endpoint description of endpoint␊ |
697 | */␊ |
698 | virtual IOReturn ␉␉ResetPipe(␉USBDeviceAddress ␉address,␊ |
699 | Endpoint *␉␉␉endpoint );␊ |
700 | /*!␊ |
701 | @function clearPipeStall␊ |
702 | Clear a pipe stall.␊ |
703 | @param address Address of the device on the USB bus␊ |
704 | @param endpoint description of endpoint␊ |
705 | */␊ |
706 | virtual IOReturn ␉␉ClearPipeStall(␉USBDeviceAddress ␉address,␊ |
707 | ␉␉␉␉␉␉␉␉␉␉␉Endpoint *␉␉␉endpoint );␊ |
708 | ␊ |
709 | // Transferring Data␊ |
710 | /*!␊ |
711 | @function read␊ |
712 | Read from an interrupt or bulk endpoint␊ |
713 | ␉␉@param buffer place to put the transferred data␊ |
714 | @param address Address of the device on the USB bus␊ |
715 | @param endpoint description of endpoint␊ |
716 | ␉␉@param completion describes action to take when buffer has been filled ␊ |
717 | */␊ |
718 | virtual IOReturn ␉␉Read(␉IOMemoryDescriptor * ␉buffer,␊ |
719 | ␉␉␉␉␉␉␉␉␉USBDeviceAddress␉␉address,␊ |
720 | ␉␉␉␉␉␉␉␉␉Endpoint *␉␉␉␉endpoint,␊ |
721 | ␉␉␉␉␉␉␉␉␉IOUSBCompletion *␉␉completion );␊ |
722 | /*!␊ |
723 | @function write␊ |
724 | Write to an interrupt or bulk endpoint␊ |
725 | @param buffer place to get the transferred data␊ |
726 | @param address Address of the device on the USB bus␊ |
727 | @param endpoint description of endpoint␊ |
728 | @param completion describes action to take when buffer has been emptied␊ |
729 | */␊ |
730 | virtual IOReturn ␉␉Write(␉IOMemoryDescriptor *␉buffer,␊ |
731 | ␉␉␉␉␉␉␉␉␉USBDeviceAddress ␉address,␊ |
732 | ␉␉␉␉␉␉␉␉␉Endpoint *␉␉endpoint,␊ |
733 | ␉␉␉␉␉␉␉␉␉IOUSBCompletion *␉completion );␊ |
734 | ␊ |
735 | /*!␊ |
736 | @function isocIO␊ |
737 | Read from or write to an isochronous endpoint␊ |
738 | @param buffer place to put the transferred data␊ |
739 | @param frameStart USB frame number of the frame to start transfer␊ |
740 | @param numFrames Number of frames to transfer␊ |
741 | @param frameList Bytes to transfer and result for each frame␊ |
742 | @param address Address of the device on the USB bus␊ |
743 | @param endpoint description of endpoint␊ |
744 | @param completion describes action to take when buffer has been filled␊ |
745 | */␊ |
746 | virtual IOReturn ␉␉IsocIO(␉IOMemoryDescriptor * ␉buffer,␊ |
747 | ␉␉␉␉␉␉␉␉␉UInt64␉␉␉␉␉frameStart,␊ |
748 | ␉␉␉␉␉␉␉␉␉UInt32␉␉␉␉␉numFrames,␊ |
749 | ␉␉␉␉␉␉␉␉␉IOUSBIsocFrame *␉␉frameList,␊ |
750 | ␉␉␉␉␉␉␉␉␉USBDeviceAddress␉␉address,␊ |
751 | ␉␉␉␉␉␉␉␉␉Endpoint *␉␉␉␉endpoint,␊ |
752 | ␉␉␉␉␉␉␉␉␉IOUSBIsocCompletion *␉completion );␊ |
753 | /*!␊ |
754 | @function deviceRequest␊ |
755 | Make a control request to the specified endpoint␊ |
756 | ␉␉There are two versions of this method, one uses a simple void *␊ |
757 | to point to the data portion of the transfer, the other uses an␊ |
758 | ␉␉IOMemoryDescriptor to point to the data.␊ |
759 | ␉␉@param request parameter block for the control request␊ |
760 | ␉␉@param completion describes action to take when the request has been executed␊ |
761 | @param address Address of the device on the USB bus␊ |
762 | ␉␉@param epNum endpoint number␊ |
763 | */␊ |
764 | virtual IOReturn ␉␉DeviceRequest(␉IOUSBDevRequest *␉request,␊ |
765 | ␉␉␉␉␉␉␉␉␉␉␉IOUSBCompletion *␉completion,␊ |
766 | ␉␉␉␉␉␉␉␉␉␉␉USBDeviceAddress ␉address, ␊ |
767 | ␉␉␉␉␉␉␉␉␉␉␉UInt8␉␉␉␉epNum );␊ |
768 | ␉␉␉␉␉␉␉␉␉␉␉␊ |
769 | virtual IOReturn ␉␉DeviceRequest(␉IOUSBDevRequestDesc *␉request,␊ |
770 | ␉␉␉␉␉␉␉␉␉␉␉IOUSBCompletion *␉␉completion,␊ |
771 | ␉␉␉␉␉␉␉␉␉␉␉USBDeviceAddress␉␉address, ␊ |
772 | ␉␉␉␉␉␉␉␉␉␉␉UInt8␉␉␉␉␉epNum );␊ |
773 | ␊ |
774 | /*␊ |
775 | * Methods used by the hub driver to initialize a device␊ |
776 | */␊ |
777 | /*!␊ |
778 | ␉@function AcquireDeviceZero␊ |
779 | ␉Get the device zero lock - call this before resetting a device, to ensure there's␊ |
780 | ␉only one device with address 0␊ |
781 | */␊ |
782 | virtual IOReturn ␉␉AcquireDeviceZero( void );␊ |
783 | /*!␊ |
784 | @function ReleaseDeviceZero␊ |
785 | Release the device zero lock - call this to release the device zero lock,␊ |
786 | ␉␉when there is no longer a device at address 0␊ |
787 | */␊ |
788 | virtual void␉␉␉ReleaseDeviceZero( void );␊ |
789 | ␊ |
790 | ␉// non-virtual methods␊ |
791 | void␉␉␉␉WaitForReleaseDeviceZero( void );␊ |
792 | IOReturn␉␉␉ConfigureDeviceZero( UInt8 maxPacketSize, UInt8 speed );␊ |
793 | IOReturn␉␉␉GetDeviceZeroDescriptor( IOUSBDeviceDescriptor * desc, UInt16 size );␊ |
794 | IOReturn␉␉␉SetDeviceZeroAddress(USBDeviceAddress address);␊ |
795 | IOUSBDevice *␉␉MakeDevice(USBDeviceAddress *address); ␊ |
796 | IOUSBHubDevice *␉MakeHubDevice(USBDeviceAddress *address); ␊ |
797 | ␉IOReturn␉␉␉CreateDevice(␉IOUSBDevice *␉␉device,␊ |
798 | ␉␉␉␉␉␉␉␉␉␉USBDeviceAddress␉deviceAddress,␊ |
799 | ␉␉␉␉␉␉␉␉␉␉UInt8␉␉␉␉maxPacketSize,␊ |
800 | ␉␉␉␉␉␉␉␉␉␉UInt8␉␉␉␉speed,␊ |
801 | ␉␉␉␉␉␉␉␉␉␉UInt32␉␉␉␉powerAvailable );␊ |
802 | ␊ |
803 | /*!␊ |
804 | ␉@function GetBandwidthAvailable␊ |
805 | Returns the available bandwidth (in bytes) per frame or microframe for␊ |
806 | ␉isochronous transfers.␊ |
807 | ␉@result maximum number of bytes that a new iso pipe could transfer␊ |
808 | ␉per frame given current allocations.␊ |
809 | */␊ |
810 | virtual UInt32 ␉␉GetBandwidthAvailable( void ) = 0;␊ |
811 | ␊ |
812 | /*!␊ |
813 | @function GetFrameNumber␊ |
814 | Returns the full current frame number.␊ |
815 | @result The frame number.␊ |
816 | */␊ |
817 | virtual UInt64 ␉␉GetFrameNumber( void ) = 0;␊ |
818 | ␊ |
819 | /*!␊ |
820 | @function GetFrameNumber32␊ |
821 | Returns the least significant 32 bits of the frame number.␊ |
822 | @result The lsb 32 bits of the frame number.␊ |
823 | */␊ |
824 | virtual UInt32 ␉␉GetFrameNumber32( void ) = 0;␊ |
825 | ␊ |
826 | // Debugger polled mode␊ |
827 | virtual void ␉␉PollInterrupts( IOUSBCompletionAction safeAction = 0 ) = 0;␊ |
828 | ␊ |
829 | virtual IOReturn ␉␉PolledRead(␊ |
830 | short␉␉␉functionNumber,␊ |
831 | short␉␉␉endpointNumber,␊ |
832 | IOUSBCompletion␉␉completion,␊ |
833 | IOMemoryDescriptor *␉CBP,␊ |
834 | bool␉␉␉bufferRounding,␊ |
835 | UInt32␉␉␉bufferSize);␊ |
836 | ␊ |
837 | OSMetaClassDeclareReservedUsed(IOUSBController, 0);␊ |
838 | virtual void UIMCheckForTimeouts(void);␊ |
839 | ␊ |
840 | OSMetaClassDeclareReservedUsed(IOUSBController, 1);␊ |
841 | virtual IOReturn ␉␉UIMCreateControlTransfer( short␉␉functionNumber,␊ |
842 | short␉␉endpointNumber,␊ |
843 | IOUSBCommand*␉command,␊ |
844 | void*␉␉CBP,␊ |
845 | bool␉␉bufferRounding,␊ |
846 | UInt32␉␉bufferSize,␊ |
847 | short␉␉direction);␊ |
848 | ␊ |
849 | OSMetaClassDeclareReservedUsed(IOUSBController, 2);␊ |
850 | virtual IOReturn ␉␉UIMCreateControlTransfer( short␉␉␉functionNumber,␊ |
851 | short␉␉␉endpointNumber,␊ |
852 | IOUSBCommand*␉␉command,␊ |
853 | IOMemoryDescriptor*␉␉CBP,␊ |
854 | bool␉␉␉bufferRounding,␊ |
855 | UInt32␉␉␉bufferSize,␊ |
856 | short␉␉␉direction);␊ |
857 | ␊ |
858 | OSMetaClassDeclareReservedUsed(IOUSBController, 3);␊ |
859 | /*!␊ |
860 | @function UIMCreateBulkTransfer␊ |
861 | @abstract UIM function, Do a transfer on a bulk endpoint.␊ |
862 | This method supercedes the method which takes multiple parameters.␊ |
863 | @param command paramters for transfer.␊ |
864 | */␊ |
865 | virtual IOReturn ␉␉UIMCreateBulkTransfer(IOUSBCommand* command);␊ |
866 | ␊ |
867 | OSMetaClassDeclareReservedUsed(IOUSBController, 4);␊ |
868 | /*!␊ |
869 | @function UIMCreateInterruptTransfer␊ |
870 | @abstract UIM function, Do a transfer on an interrupt endpoint.␊ |
871 | This method supercedes the method which takes multiple parameters.␊ |
872 | @param command paramters for transfer.␊ |
873 | */␊ |
874 | virtual IOReturn ␉␉UIMCreateInterruptTransfer(IOUSBCommand* command);␊ |
875 | ␊ |
876 | /*!␊ |
877 | @function deviceRequest␊ |
878 | Make a control request to the specified endpoint␊ |
879 | ␉␉There are two versions of this method, one uses a simple void *␊ |
880 | to point to the data portion of the transfer, the other uses an␊ |
881 | ␉␉IOMemoryDescriptor to point to the data.␊ |
882 | ␉␉@param request parameter block for the control request␊ |
883 | ␉␉@param completion describes action to take when the request has been executed␊ |
884 | @param address Address of the device on the USB bus␊ |
885 | ␉␉@param epNum endpoint number␊ |
886 | */␊ |
887 | OSMetaClassDeclareReservedUsed(IOUSBController, 5);␊ |
888 | virtual IOReturn ␉␉DeviceRequest( IOUSBDevRequest *␉request,␊ |
889 | IOUSBCompletion *␉completion,␊ |
890 | USBDeviceAddress ␉address, ␊ |
891 | UInt8 ␉␉␉epNum,␊ |
892 | ␉␉␉␉␉␉UInt32␉␉␉noDataTimeout,␊ |
893 | ␉␉␉␉␉␉UInt32␉␉␉completionTimeout );␊ |
894 | ␉␉␉␉␉␉␊ |
895 | OSMetaClassDeclareReservedUsed(IOUSBController, 6);␊ |
896 | virtual IOReturn ␉␉DeviceRequest( IOUSBDevRequestDesc *␉request,␊ |
897 | IOUSBCompletion *␉completion,␊ |
898 | USBDeviceAddress ␉address, ␊ |
899 | UInt8 ␉␉␉epNum,␊ |
900 | ␉␉␉␉␉␉UInt32␉␉␉noDataTimeout,␊ |
901 | ␉␉␉␉␉␉UInt32␉␉␉completionTimeout );␊ |
902 | ␊ |
903 | ␊ |
904 | ␊ |
905 | OSMetaClassDeclareReservedUsed(IOUSBController, 7);␊ |
906 | /*!␊ |
907 | @function read␊ |
908 | Read from an interrupt or bulk endpoint␊ |
909 | ␉␉@param buffer place to put the transferred data␊ |
910 | @param address Address of the device on the USB bus␊ |
911 | @param endpoint description of endpoint␊ |
912 | ␉␉@param completion describes action to take when buffer has been filled ␊ |
913 | */␊ |
914 | virtual IOReturn ␉␉Read( IOMemoryDescriptor * ␉buffer,␊ |
915 | USBDeviceAddress ␉address,␊ |
916 | Endpoint *␉␉endpoint,␊ |
917 | IOUSBCompletion *␉completion,␊ |
918 | ␉␉␉␉␉UInt32␉␉␉noDataTimeout,␊ |
919 | ␉␉␉␉␉UInt32␉␉␉completionTimeout );␊ |
920 | ␊ |
921 | OSMetaClassDeclareReservedUsed(IOUSBController, 8);␊ |
922 | /*!␊ |
923 | @function write␊ |
924 | Write to an interrupt or bulk endpoint␊ |
925 | @param buffer place to get the transferred data␊ |
926 | @param address Address of the device on the USB bus␊ |
927 | @param endpoint description of endpoint␊ |
928 | @param completion describes action to take when buffer has been emptied␊ |
929 | */␊ |
930 | virtual IOReturn ␉␉Write( IOMemoryDescriptor *␉buffer,␊ |
931 | USBDeviceAddress ␉address,␊ |
932 | Endpoint *␉␉endpoint,␊ |
933 | IOUSBCompletion *␉completion,␊ |
934 | ␉␉␉␉␉UInt32␉␉␉noDataTimeout,␊ |
935 | ␉␉␉␉␉UInt32␉␉␉completionTimeout );␊ |
936 | ␊ |
937 | // this should really not be using a padding slot, since free is in our superclas, but we shipped this way so now we need to leave it.␊ |
938 | OSMetaClassDeclareReservedUsed(IOUSBController, 9);␊ |
939 | virtual void free();␊ |
940 | ␊ |
941 | protected:␊ |
942 | ␉␊ |
943 | /*!␊ |
944 | @function UIMRootHubStatusChange(bool)␊ |
945 | @abstract UIM function UIMRootHubStatusChange(bool) - This method was internal to the UIM (never called by the superclass) until␊ |
946 | ␉␉␉␉␉␉␉IOUSBControllerV3. For UIMs which are a subclass of IOUSBController or IOUSBControllerV2, it can␊ |
947 | ␉␉␉␉␉␉␉still be used internally only. For subclasses of IOUSBControllerV3, however, it has become obsolete␊ |
948 | ␉␉␉␉␉␉␉(it still needs to be implemented since it is pure virtual)␊ |
949 | */␊ |
950 | OSMetaClassDeclareReservedUsed(IOUSBController, 10);␊ |
951 | virtual void ␉␉UIMRootHubStatusChange( bool abort ) = 0;␊ |
952 | ␊ |
953 | public:␊ |
954 | ␊ |
955 | OSMetaClassDeclareReservedUsed(IOUSBController, 11);␊ |
956 | virtual IOReturn CreateRootHubDevice( IOService * provider, IOUSBRootHubDevice ** rootHubDevice);␊ |
957 | ␊ |
958 | OSMetaClassDeclareReservedUsed(IOUSBController, 12);␊ |
959 | /*!␊ |
960 | @function Read␊ |
961 | Read from an interrupt or bulk endpoint␊ |
962 | ␉␉@param buffer place to put the transferred data␊ |
963 | @param address Address of the device on the USB bus␊ |
964 | @param endpoint description of endpoint␊ |
965 | ␉␉@param completion describes action to take when buffer has been filled␊ |
966 | ␉␉@param noDataTimeout number of milliseconds of no data movement before the request is aborted␊ |
967 | ␉␉@param completionTimeout number of milliseonds after the command is on the bus in which it must complete␊ |
968 | ␉␉@param reqCount number of bytes requested for the transfer (must not be greater than the length of the buffer)␊ |
969 | */␊ |
970 | virtual IOReturn ␉␉Read( IOMemoryDescriptor * ␉buffer,␊ |
971 | USBDeviceAddress ␉address,␊ |
972 | Endpoint *␉␉endpoint,␊ |
973 | IOUSBCompletion *␉completion,␊ |
974 | ␉␉␉␉␉UInt32␉␉␉noDataTimeout,␊ |
975 | ␉␉␉␉␉UInt32␉␉␉completionTimeout,␊ |
976 | ␉␉␉␉␉IOByteCount␉␉reqCount );␊ |
977 | ␊ |
978 | OSMetaClassDeclareReservedUsed(IOUSBController, 13);␊ |
979 | /*!␊ |
980 | @function Write␊ |
981 | Write to an interrupt or bulk endpoint␊ |
982 | @param buffer place to get the transferred data␊ |
983 | @param address Address of the device on the USB bus␊ |
984 | @param endpoint description of endpoint␊ |
985 | @param completion describes action to take when buffer has been emptied␊ |
986 | ␉␉@param noDataTimeout number of milliseconds of no data movement before the request is aborted␊ |
987 | ␉␉@param completionTimeout number of milliseonds after the command is on the bus in which it must complete␊ |
988 | ␉␉@param reqCount number of bytes requested for the transfer (must not be greater than the length of the buffer)␊ |
989 | */␊ |
990 | virtual IOReturn ␉␉Write( IOMemoryDescriptor *␉buffer,␊ |
991 | USBDeviceAddress ␉address,␊ |
992 | Endpoint *␉␉endpoint,␊ |
993 | IOUSBCompletion *␉completion,␊ |
994 | ␉␉␉␉␉UInt32␉␉␉noDataTimeout,␊ |
995 | ␉␉␉␉␉UInt32␉␉␉completionTimeout,␊ |
996 | ␉␉␉␉␉IOByteCount␉␉reqCount );␊ |
997 | ␊ |
998 | OSMetaClassDeclareReservedUsed(IOUSBController, 14);␊ |
999 | ␊ |
1000 | virtual IOReturn GetRootHubStringDescriptor(UInt8␉index, OSData *desc) = 0;␊ |
1001 | ␊ |
1002 | OSMetaClassDeclareReservedUsed(IOUSBController, 15);␊ |
1003 | /*!␊ |
1004 | @function IsocIO␊ |
1005 | Read from or write to an isochronous endpoint␊ |
1006 | @param buffer place to put the transferred data␊ |
1007 | @param frameStart USB frame number of the frame to start transfer␊ |
1008 | @param numFrames Number of frames to transfer␊ |
1009 | @param frameList Bytes to transfer and result for each frame␊ |
1010 | @param address Address of the device on the USB bus␊ |
1011 | @param endpoint description of endpoint␊ |
1012 | @param completion describes action to take when buffer has been filled␊ |
1013 | @param updateFrequency describes how often to update the framelist once the transfer has completed (in ms)␊ |
1014 | */␊ |
1015 | virtual IOReturn IsocIO( IOMemoryDescriptor * ␉␉␉buffer,␊ |
1016 | UInt64 ␉␉␉␉frameStart,␊ |
1017 | UInt32 ␉␉␉␉numFrames,␊ |
1018 | IOUSBLowLatencyIsocFrame *␉frameList,␊ |
1019 | USBDeviceAddress ␉␉address,␊ |
1020 | Endpoint *␉␉␉endpoint,␊ |
1021 | IOUSBLowLatencyIsocCompletion *␉completion,␊ |
1022 | UInt32␉␉␉␉updateFrequency );␊ |
1023 | ␊ |
1024 | OSMetaClassDeclareReservedUsed(IOUSBController, 16);␊ |
1025 | ␊ |
1026 | /*!␊ |
1027 | ␉␉@function UIMCreateIsochTransfer␊ |
1028 | ␉␉@abstract UIM function, Do a transfer on an Isocchronous endpoint.␊ |
1029 | ␉␉@param functionNumber The USB device ID of the device to perform the transaction with␊ |
1030 | ␉␉@param endpointNumber The endpoint number for the transaction␊ |
1031 | ␉␉@param completion Action to perform when I/O completes␊ |
1032 | ␉␉@param direction Specifies direction for transfer. kUSBIn or KUSBOut.␊ |
1033 | ␉␉@param frameStart The frame number in which to start the transactions␊ |
1034 | ␉␉@param pBuffer describes memory buffer. ␊ |
1035 | ␉␉@param frameCount number of frames to do transactions in␊ |
1036 | ␉␉@param pFrames Describes transactions in individual frames, gives sizes and reults for transactions.␊ |
1037 | ␉␉@param updateFrequency Describes how often we update the frameList parameters (in ms)␊ |
1038 | ␉*/␊ |
1039 | virtual IOReturn ␉␉UIMCreateIsochTransfer(␊ |
1040 | short␉␉␉functionAddress,␊ |
1041 | short␉␉␉endpointNumber,␊ |
1042 | IOUSBIsocCompletion␉completion,␊ |
1043 | UInt8␉␉␉direction,␊ |
1044 | UInt64␉␉␉frameStart,␊ |
1045 | IOMemoryDescriptor *␉pBuffer,␊ |
1046 | UInt32␉␉␉frameCount,␊ |
1047 | IOUSBLowLatencyIsocFrame *pFrames,␊ |
1048 | UInt32␉␉␉updateFrequency);␊ |
1049 | ␊ |
1050 | ␊ |
1051 | OSMetaClassDeclareReservedUsed(IOUSBController, 17);␊ |
1052 | virtual IOReturn ␉␉CheckForDisjointDescriptor(IOUSBCommand *command, UInt16 maxPacketSize);␊ |
1053 | ␊ |
1054 | /*!␊ |
1055 | ␉␉@function UIMCreateIsochTransfer␊ |
1056 | ␉␉@abstract UIM function, Do a transfer on an Isocchronous endpoint.␊ |
1057 | ␉␉@param command an IOUSBIsocCommand object with all the necessary information␊ |
1058 | ␉ */␊ |
1059 | OSMetaClassDeclareReservedUsed(IOUSBController, 18);␊ |
1060 | ␉virtual IOReturn UIMCreateIsochTransfer(IOUSBIsocCommand *command);␊ |
1061 | ␉␊ |
1062 | ␉// do not use this slot without first checking bug rdar://6022420␊ |
1063 | OSMetaClassDeclareReservedUnused(IOUSBController, 19);␊ |
1064 | ␊ |
1065 | protected:␊ |
1066 | void␉IncreaseIsocCommandPool();␊ |
1067 | void ␉IncreaseCommandPool();␊ |
1068 | void␉ParsePCILocation(const char *str, int *deviceNum, int *functionNum);␊ |
1069 | int␉␉ValueOfHexDigit(char c);␊ |
1070 | };␊ |
1071 | ␊ |
1072 | #endif /* ! _IOKIT_IOUSBCONTROLLER_H */␊ |
1073 | ␊ |
1074 |