Chameleon Applications

Chameleon Applications Svn Source Tree

Root/branches/iFabio/Chameleon/i386/include/IOKit/firewire/IOFireWireBus.h

Source at commit 296 created 12 years 10 months ago.
By ifabio, add i386 folder
1/*
2 * Copyright (c) 1998-2002 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.1 (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 OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22/*
23 * Copyright (c) 1999-2002 Apple Computer, Inc. All rights reserved.
24 *
25 * HISTORY
26 *
27 */
28
29
30#ifndef _IOKIT_IOFIREWIREBUS_H
31#define _IOKIT_IOFIREWIREBUS_H
32
33#include <IOKit/IOService.h>
34#include <IOKit/firewire/IOFWIsochChannel.h>
35#include <IOKit/firewire/IOFWAddressSpace.h>
36#include <IOKit/firewire/IOFWCommand.h>
37#include <IOKit/firewire/IOFireWireFamilyCommon.h>
38
39extern const OSSymbol *gFireWireROM;
40extern const OSSymbol *gFireWireNodeID;
41extern const OSSymbol *gFireWireSelfIDs;
42extern const OSSymbol *gFireWireSpeed;
43extern const OSSymbol *gFireWireUnit_Spec_ID;
44extern const OSSymbol *gFireWireUnit_SW_Version;
45extern const OSSymbol *gFireWireVendor_ID;
46extern const OSSymbol *gFireWire_GUID;
47extern const OSSymbol *gFireWireVendor_Name;
48extern const OSSymbol *gFireWireProduct_Name;
49extern const OSSymbol *gFireWireModel_ID;
50extern const OSSymbol *gFireWireTDM;
51
52class IOFireWireDevice;
53class IOLocalConfigDirectory;
54class IOFWLocalIsochPort;
55class IOFireWirePowerManager;
56class IOFireWireBus;
57class IOFWDCLPool;
58class IOFWSimpleContiguousPhysicalAddressSpace;
59class IOFWSimplePhysicalAddressSpace;
60class IOFWUserObjectExporter;
61
62#pragma mark -
63
64/*!
65@class IOFireWireBusAux
66*/
67
68class IOFireWireBusAux : public OSObject
69{
70 OSDeclareAbstractStructors(IOFireWireBusAux)
71
72friend class IOFireWireBus;
73
74protected:
75
76/*!
77@struct ExpansionData
78@discussion This structure will be used to expand the capablilties of the class in the future.
79*/
80
81struct ExpansionData { };
82
83/*!
84@var reserved
85Reserved for future use. (Internal use only)
86*/
87
88ExpansionData * reserved;
89
90public :
91
92virtual IOFWDCLPool *createDCLPool ( unsigned capacity ) const = 0 ;
93OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 32);
94virtual UInt8 getMaxRec( void ) = 0;
95
96virtual UInt64 getFireWirePhysicalAddressMask( void ) = 0;
97virtual UInt32 getFireWirePhysicalAddressBits( void ) = 0;
98virtual UInt64 getFireWirePhysicalBufferMask( void ) = 0;
99virtual UInt32 getFireWirePhysicalBufferBits( void ) = 0;
100
101virtual IOFWSimpleContiguousPhysicalAddressSpace * createSimpleContiguousPhysicalAddressSpace( vm_size_t size, IODirection direction ) = 0;
102virtual IOFWSimplePhysicalAddressSpace * createSimplePhysicalAddressSpace( vm_size_t size, IODirection direction ) = 0;
103
104virtual IOFWUserObjectExporter * getSessionRefExporter( void ) = 0;
105
106private:
107OSMetaClassDeclareReservedUsed(IOFireWireBusAux, 0);
108OSMetaClassDeclareReservedUsed(IOFireWireBusAux, 1);
109OSMetaClassDeclareReservedUsed(IOFireWireBusAux, 2);
110OSMetaClassDeclareReservedUsed(IOFireWireBusAux, 3);
111OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 4);
112OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 5);
113OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 6);
114OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 7);
115OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 8);
116OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 9);
117OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 10);
118OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 11);
119OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 12);
120OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 13);
121OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 14);
122OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 15);
123OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 16);
124OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 17);
125OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 18);
126OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 19);
127OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 20);
128OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 21);
129OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 22);
130OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 23);
131OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 24);
132OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 25);
133OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 26);
134OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 27);
135OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 28);
136OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 29);
137OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 30);
138OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 31);
139
140};
141
142#pragma mark -
143
144/*!
145@class IOFireWireBus
146@abstract IOFireWireBus is a public class the provides access to
147general FireWire functionality...
148*/
149
150class IOFireWireBus : public IOService
151{
152 OSDeclareAbstractStructors(IOFireWireBus)
153
154public:
155
156struct DCLTaskInfoAux
157{
158unsigned version ;
159union// u
160{
161struct// v0
162{
163IOMemoryMap * bufferMemoryMap ;// This field required to get physical addresses to program DMA.
164// If NULL, we try to make the map ourselves.
165// If you created a buffer memory descriptor
166// for your program's buffers, just call map() on it
167// and pass the returned object here...
168} v0 ;
169
170struct // v1
171{
172IOMemoryMap * bufferMemoryMap ;// same as 'bufferMemoryMap' from version 0, above.
173
174IOWorkLoop * workloop ;// A workloop on which to run callbacks for this port..
175// Can be NULL to use FireWire isochronous workloop...
176// The workloop will be retained by the program object.
177} v1 ;
178
179struct
180{
181IOMemoryMap * bufferMemoryMap ;// same as 'bufferMemoryMap' from version 0, above.
182
183IOWorkLoop * workloop ;// A workloop on which to run callbacks for this port..
184// Can be NULL to use FireWire isochronous workloop...
185// The workloop will be retained by the program object.
186IOFWIsochPortOptions options ;// extra options
187} v2 ;
188} u ;
189} ;
190
191// this struct has been redefined for our next generation isochronous architecture,
192// but is backwards compatible with the old definition.. This means we should
193// be safe when an old-style driver is loaded..
194// To use DCLTaskInfo (see createLocalIsochPort) make sure all 'unused' fields are set to 0 or NULL
195// and that auxInfo points to a valid DCLTaskInfoAux struct, defined above.
196
197struct DCLTaskInfo
198{
199task_t unused0 ;
200vm_address_t unused1 ;
201UInt32 unused2 ;
202vm_address_t unused3 ;
203UInt32 unused4 ;
204void(*unused5)(void) ;
205DCLTaskInfoAux *auxInfo ;// Refcon for user call
206} ;
207
208static const IORegistryPlane * gIOFireWirePlane;
209
210IOFireWireBusAux * fAuxiliary;
211
212 // Create an Isochronous Channel object
213 virtual IOFWIsochChannel *createIsochChannel(
214 bool doIRM, UInt32 bandwidth, IOFWSpeed prefSpeed,
215 IOFWIsochChannel::ForceStopNotificationProc stopProc=NULL,
216 void *stopRefCon=NULL) = 0;
217
218/*!@function createLocalIsochPort
219@abstract Create a local isochronous port to run the given DCL program
220@param talking Pass true to create a talker port; pass false to create a listener port.
221@param opcodes A pointer to your DCL program (linked list of DCLCommand structs)
222To use an IOFWDCL/IOFWDCLPool program, pass the DCLCommand returned by
223IOFWDCLPool::getProgram().
224@param info (Optional) Pointer to DCLTaskInfo struct containing additional
225configuration information. If you have an IOMemoryMap for your DCL program data buffers,
226pass it here. You can also pass an IOWorkLoop if you want to use your own
227workloop to handle callbacks for the created port object.
228@param startEvent Specifies a bus condition on which the port should start receiving/sending packets
229Must be kFWDCLImmediateEvent, kFWDCLCycleEvent, or kFWDCLSyBitsEvent.
230Pass kFWDCLImmediateEvent to start without waiting when start() is called. Pass kFWDCLCycleEvent
231to start() transmitting at a specified bus cycle time. Pass kFWDCLSyBitsEvent (receive only)
232to start receiving packets once an isochronous packet with a specified sync field arrives.
233@param startState Pass the value for the desired start condition, as specified by 'startEvent'
234kFWDCLImmediateEvent: set to 0
235kFWDCLCycleEvent: the cycle timer value on which to start processing packets. For talker
236ports, This value will be masked by 'startMask' and packet processing will be begin on the
237next cycle whose lowest bits match the masked value. For listener ports, pass a 15-bit value
238containg to the low order two bits of cycleSeconds and the 13-bit cycleCount on which to start
239processing packets.
240kFWDCLSyBitsEvent: The value of the sync field on which to start receive packets. The value will be masked
241by 'startMask'. For DCLCommand based isoch ports, processing will begin on the first received packet
242that has an isochronous header sync field matching 'startState'. For IOFWDCL/IOFWDCLPool based
243ports, processing will pause on each IOFWDCL that has wait set to true until a packet that has
244an isochronous header sync field matching 'startState' is received.
245@result Returns an IOFWLocalIsochPort on success.*/
246 virtual IOFWLocalIsochPort *createLocalIsochPort(bool talking,
247 DCLCommand *opcodes, DCLTaskInfo *info = 0,
248 UInt32 startEvent = 0, UInt32 startState = 0, UInt32 startMask = 0) = 0;
249
250 virtual IOReturn getCycleTime(UInt32 &cycleTime) = 0;
251 virtual IOReturn getBusCycleTime(UInt32 &busTime, UInt32 &cycleTime) = 0;
252
253 // Methods to manipulate the local Config ROM
254 virtual IOReturn AddUnitDirectory(IOLocalConfigDirectory *unitDir) = 0;
255 virtual IOReturn RemoveUnitDirectory(IOLocalConfigDirectory *unitDir) = 0;
256
257 // Cause a bus reset
258 virtual IOReturn resetBus() = 0;
259
260 // Convert a firewire nodeID into the IOFireWireDevice for it
261 virtual IOFireWireDevice * nodeIDtoDevice(UInt32 generation, UInt16 nodeID) = 0;
262
263 // Execute specified function on workloop after specified delay
264 // Returned command is for delay, call it's cancel() function to cancel timeout.
265 virtual IOFWDelayCommand * createDelayedCmd(UInt32 uSecDelay, FWBusCallback func, void *refcon) = 0;
266
267 virtual IOFWPhysicalAddressSpace *createPhysicalAddressSpace(IOMemoryDescriptor *mem) = 0;
268 virtual IOFWPseudoAddressSpace *createPseudoAddressSpace(FWAddress *addr, UInt32 len,
269 FWReadCallback reader, FWWriteCallback writer, void *refcon) = 0;
270
271
272 // Extract info about the async request
273 virtual bool isLockRequest(IOFWRequestRefCon refcon) = 0;
274 virtual bool isQuadRequest(IOFWRequestRefCon refcon) = 0;
275 virtual UInt32 getExtendedTCode(IOFWRequestRefCon refcon) = 0;
276
277 // How big (as a power of two) can packets sent to/received from the node be?
278 virtual int maxPackLog ( bool forSend, UInt16 nodeAddress) const = 0;
279
280 // How big (as a power of two) can packets sent from A to B be?
281 virtual int maxPackLog ( UInt16 nodeA, UInt16 nodeB) const = 0;
282
283 // Force given node to be root (via root holdoff Phy packet)
284 virtual IOReturn makeRoot ( UInt32 generation, UInt16 nodeID) = 0;
285
286 // Create address space at fixed address in initial register space
287 virtual IOFWPseudoAddressSpace * createInitialAddressSpace (UInt32 addressLo, UInt32 len,
288FWReadCallback reader, FWWriteCallback writer, void *refcon) = 0;
289
290 // Get address space object for given address, if any
291 virtual IOFWAddressSpace *getAddressSpace(FWAddress address) = 0;
292
293 // Extract info about the async request - was the request ack'ed complete already?
294 virtual boolisCompleteRequest(IOFWRequestRefCon refcon) = 0;
295
296 virtual IOFWAsyncStreamCommand *createAsyncStreamCommand( UInt32 generation,
297UInt32 channel, UInt32 sync, UInt32 tag, IOMemoryDescriptor *hostMem,
298UInt32 size, int speed,FWAsyncStreamCallback completion=NULL, void *refcon=NULL) = 0;
299virtual UInt32hopCount(UInt16 nodeAAddress, UInt16 nodeBAddress ) = 0;
300virtual UInt32hopCount(UInt16 nodeAAddress ) = 0;
301virtual IOFireWirePowerManager *getBusPowerManager( void ) = 0;
302
303protected:
304
305virtual IOFireWireBusAux *createAuxiliary( void ) = 0;
306
307public :
308
309inline IOFWDCLPool *createDCLPool ( UInt32 capacity = 0 ){ return fAuxiliary->createDCLPool ( capacity ) ; }
310inline UInt8getMaxRec( void ){ return fAuxiliary->getMaxRec(); }
311
312// get the physical addressing limitations for this controller
313
314// returns the physical mask for memory addressable by the bus and this controller's DMA engine
315// intended for use with IOBufferMemoryDescriptor::inTaskWithPhysicalMask()
316// all current hardware is 32 bit --- currently returns 0x00000000FFFFFFFF
317// this API is intended for allocating physical buffers.
318// it will not return more than 48 bits so that buffer addresses can be turned into FWAddresses
319inline UInt64 getFireWirePhysicalAddressMask( void )
320{ return fAuxiliary->getFireWirePhysicalAddressMask(); }
321
322// returns a count of the maximum addressing bits supported by the bus and this controller
323// intended for use with IODMACommand::withSpecification()
324// all current hardware is 32 bit --- currently returns 32
325// this API is intended for allocating physical buffers.
326// it will not return more than 48 bits so that buffer addresses can be turned into FWAddresses
327inline UInt32 getFireWirePhysicalAddressBits( void )
328{ return fAuxiliary->getFireWirePhysicalAddressBits(); }
329
330// returns the physical mask for memory addressable by this controller's DMA engine
331// intended for use with IOBufferMemoryDescriptor::inTaskWithPhysicalMask()
332// all current hardware is 32 bit --- currently returns 0x00000000FFFFFFFF
333// this API is to allocate isoch and other buffers that don't need to be addressable by the bus
334// it may someday return as high 64 bits
335inline UInt64 getFireWirePhysicalBufferMask( void )
336{ return fAuxiliary->getFireWirePhysicalBufferMask(); }
337
338// returns a count of the maximum addressing bits supported by this controller
339// intended for use with IODMACommand::withSpecification()
340// all current hardware is 32 bit --- currently returns 32
341// this API is to allocate isoch and other buffers that don't need to be addressable by the bus
342// it may someday return as high 64 bits
343inline UInt32 getFireWirePhysicalBufferBits( void )
344{ return fAuxiliary->getFireWirePhysicalBufferBits(); }
345
346inline IOFWSimpleContiguousPhysicalAddressSpace * createSimpleContiguousPhysicalAddressSpace( vm_size_t size, IODirection direction )
347{ return fAuxiliary->createSimpleContiguousPhysicalAddressSpace( size, direction ); }
348
349inline IOFWSimplePhysicalAddressSpace * createSimplePhysicalAddressSpace( vm_size_t size, IODirection direction )
350{ return fAuxiliary->createSimplePhysicalAddressSpace( size, direction ); }
351
352virtual IOFWAsyncStreamCommand * createAsyncStreamCommand( UInt32 generation,
353UInt32 channel, UInt32 sync, UInt32 tag, IOMemoryDescriptor *hostMem,
354UInt32 size, int speed,FWAsyncStreamCallback completion, void *refcon, boolfailOnReset) = 0;
355
356inline IOFWUserObjectExporter * getSessionRefExporter( void )
357{ return fAuxiliary->getSessionRefExporter(); }
358
359private:
360
361OSMetaClassDeclareReservedUsed(IOFireWireBus, 0);
362OSMetaClassDeclareReservedUsed(IOFireWireBus, 1);
363OSMetaClassDeclareReservedUsed(IOFireWireBus, 2);
364OSMetaClassDeclareReservedUsed(IOFireWireBus, 3);
365OSMetaClassDeclareReservedUsed(IOFireWireBus, 4);
366OSMetaClassDeclareReservedUsed(IOFireWireBus, 5);
367OSMetaClassDeclareReservedUsed(IOFireWireBus, 6);
368OSMetaClassDeclareReservedUsed(IOFireWireBus, 7);
369
370};
371
372#endif /* ! _IOKIT_IOFIREWIREBUS_H */
373
374

Archive Download this file

Revision: 296