Chameleon

Chameleon Svn Source Tree

Root/branches/rewrite/i386/include/IOKit/firewire/IOFWPhysicalAddressSpace.h

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-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#ifndef _IOKIT_IOFWPHYSICALADDRESSSPACE_H
24#define _IOKIT_IOFWPHYSICALADDRESSSPACE_H
25
26#include <IOKit/firewire/IOFWAddressSpace.h>
27#include <IOKit/IODMACommand.h>
28
29/*
30 * Direct physical memory <-> FireWire address.
31 * Accesses to these addresses may be handled automatically by the
32 * hardware without notification.
33 *
34 * The 64 bit FireWire address of (32 bit) physical addr xxxx:xxxx is hostNode:0000:xxxx:xxxx
35 */
36
37class IOFWPhysicalAddressSpace;
38
39struct FWSegment
40{
41FWAddressaddress;
42UInt32length;
43};
44
45#pragma mark -
46
47/*!
48@class IOFWPhysicalAddressSpaceAux
49*/
50
51class IOFWPhysicalAddressSpaceAux : public IOFWAddressSpaceAux
52{
53 OSDeclareDefaultStructors(IOFWPhysicalAddressSpaceAux)
54
55friend class IOFWAddressSpace;
56friend class IOFWPhysicalAddressSpace;
57
58protected:
59
60/*!
61@struct ExpansionData
62@discussion This structure will be used to expand the capablilties of the class in the future.
63 */
64
65 struct ExpansionData { };
66
67/*!
68@var reserved
69Reserved for future use. (Internal use only)
70*/
71
72ExpansionData *reserved;
73
74IODMACommand *fDMACommand;
75boolfDMACommandPrepared;
76
77public:
78 virtual bool init( IOFWAddressSpace * primary );
79virtualvoid free();
80
81void setDMACommand( IODMACommand * dma_command );
82IODMACommand * getDMACommand( void );
83UInt64 getPhysicalSegment( UInt64 offset, UInt64 * length );
84
85IOReturn prepare( void );
86IOReturn synchronize( IOOptionBits options );
87IOReturn complete( void );
88
89bool isPrepared( void );
90
91IOReturn getSegments( UInt64 * offset, FWSegment * fw_segments, UInt32 * num_segments );
92
93private:
94 OSMetaClassDeclareReservedUnused(IOFWPhysicalAddressSpaceAux, 0);
95 OSMetaClassDeclareReservedUnused(IOFWPhysicalAddressSpaceAux, 1);
96 OSMetaClassDeclareReservedUnused(IOFWPhysicalAddressSpaceAux, 2);
97 OSMetaClassDeclareReservedUnused(IOFWPhysicalAddressSpaceAux, 3);
98 OSMetaClassDeclareReservedUnused(IOFWPhysicalAddressSpaceAux, 4);
99 OSMetaClassDeclareReservedUnused(IOFWPhysicalAddressSpaceAux, 5);
100 OSMetaClassDeclareReservedUnused(IOFWPhysicalAddressSpaceAux, 6);
101 OSMetaClassDeclareReservedUnused(IOFWPhysicalAddressSpaceAux, 7);
102 OSMetaClassDeclareReservedUnused(IOFWPhysicalAddressSpaceAux, 8);
103 OSMetaClassDeclareReservedUnused(IOFWPhysicalAddressSpaceAux, 9);
104
105};
106
107#pragma mark -
108
109/*!
110@class IOFWPhysicalAddressSpace
111*/
112
113class IOFWPhysicalAddressSpace : public IOFWAddressSpace
114{
115 OSDeclareDefaultStructors(IOFWPhysicalAddressSpace)
116
117friend class IOFWPhysicalAddressSpaceAux;
118
119protected:
120
121IOMemoryDescriptor *fMem;// unused
122 vm_size_tfLen;// unused
123
124 virtualvoid free();
125
126public:
127
128/*!@functioninit
129@abstractInitialize physical address space.
130@parambusPoints to IOFireWireBus object.
131@resultreturns true if success, else false */
132virtual bool init( IOFireWireBus * bus );
133
134/*!@functioninitWithDesc
135@abstractInitialize physical address space with IOMemoryDescriptor.
136@parambusPoints to IOFireWireBus object.
137@parammemPoints to IOMemoryDescriptor.
138@resultreturns true if success, else false */
139 virtual bool initWithDesc(IOFireWireBus *bus,
140 IOMemoryDescriptor *mem);
141
142/*!@functiondoRead
143@abstractA method for processing an address space read request
144@paramnodeIDFireWire Read from nodeID.
145@paramspeedat this 'speed'.
146@paramaddrwith FireWire address 'addr'.
147@paramlenread 'len' bytes from nodeID.
148@parambufpoints to a memory descriptor containing the packet data.
149@paramoffsetstart from this 'offset' in 'buf'.
150@paramrefcon Can be queried for extra info about the request.
151@resultUIn32returns kFWResponseComplete on success */
152 virtual UInt32 doRead(UInt16 nodeID, IOFWSpeed &speed, FWAddress addr, UInt32 len,
153IOMemoryDescriptor **buf, IOByteCount * offset,
154IOFWRequestRefCon refcon);
155
156/*!@functiondoWrite
157@abstractA method for processing an address space write request
158@paramnodeIDFireWire Write to nodeID.
159@paramspeedat this 'speed'.
160@paramaddrwith FireWire address 'addr'.
161@paramlenwrite 'len' bytes to nodeID.
162@parambufobtain bytes from location given by 'buf'.
163@paramreqrefcon Can be queried for extra info about the request.
164@resultUIn32returns kFWResponseComplete on success */
165 virtual UInt32 doWrite(UInt16 nodeID, IOFWSpeed &speed, FWAddress addr, UInt32 len,
166 const void *buf, IOFWRequestRefCon refcon);
167
168/*!@functiongetMemoryDescriptor
169@abstractGets the memory descriptor, which is associated to this
170PhysicalAddressSpace.
171@paramnone.
172@resultreturns the IOMemoryDescriptor */
173IOMemoryDescriptor * getMemoryDescriptor( void );
174
175/*!@functionsetMemoryDescriptor
176@abstractSets the memory descriptor, which will be associated to this
177PhysicalAddressSpace.
178@paramnone.
179@resultreturns the IOMemoryDescriptor */
180IOReturn setMemoryDescriptor( IOMemoryDescriptor * descriptor );
181
182/*!@functiongetLength
183@abstractGet the length of the memory backed by PhysicalAddressSpace.
184@paramnone.
185@resultreturns the length */
186UInt64 getLength( void );
187
188/*!@functionsetDMACommand
189@abstractSet the DMACommand for this PhysicalAddressSpace.
190@paramdma_commandPoints to IODMACommand object.
191@resultnone */
192inline void setDMACommand( IODMACommand * dma_command )
193{ ((IOFWPhysicalAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->setDMACommand( dma_command ); };
194
195/*!@functiongetDMACommand
196@abstractGet the DMACommand from this PhysicalAddressSpace.
197@paramnone.
198@resultreturn previously assigned IODMACommand, null if not initialized */
199inline IODMACommand * getDMACommand( void )
200{ return ((IOFWPhysicalAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->getDMACommand(); };
201
202/*!@functioninitWithDMACommand
203@abstractInitialize physical address space with IODMACommand.
204@parambusPoints to IOFireWireBus object.
205@paramcommandPoints to IODMACommand.
206@resultreturns true if success, else false */
207virtual bool initWithDMACommand( IOFireWireBus * control, IODMACommand * command );
208
209/*!@functionprepare
210@abstractPrepare the IODMACommand used by this PhysicalAddressSpace.
211@paramnone.
212@resultreturns kIOReturnSuccess on success */
213inline IOReturn prepare( void )
214{ return ((IOFWPhysicalAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->prepare(); };
215
216/*!@functionsynchronize
217@abstractsynchronize the IODMACommand used by this PhysicalAddressSpace.
218@paramnone.
219@resultreturns kIOReturnSuccess on success */
220inline IOReturn synchronize( IOOptionBits options )
221{ return ((IOFWPhysicalAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->synchronize( options ); };
222
223/*!@functioncomplete
224@abstractcomplete the IODMACommand used by this PhysicalAddressSpace.
225@paramnone.
226@resultreturns kIOReturnSuccess on success */
227inline IOReturn complete( void )
228{ return ((IOFWPhysicalAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->complete(); };
229
230/*!@functionisPrepared
231@abstractInspects whether the IODMACommand was prepared in this PhysicalAddressSpace.
232@paramnone.
233@resultreturns true if prepared, else false */
234inline bool isPrepared( void )
235{ return ((IOFWPhysicalAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->isPrepared(); };
236
237/*!@functiongetSegments
238@abstractReturns the scatter gather list of memory segments from the IODMACommand
239used in this PhysicalAddressSpace.
240@paramoffsetinput/output parameter, defines the starting and ending offset in the memory
241descriptor, relative to any offset passed to the prepare() method.
242FWSegment Points to an array of memory segments.
243num_segments Size of the FWSegment array.
244@resultreturns kIOReturnSuccess on success */
245inline IOReturn getSegments( UInt64 * offset, FWSegment * fw_segments, UInt32 * num_segments )
246{ return ((IOFWPhysicalAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->getSegments( offset, fw_segments, num_segments ); };
247
248/*!@functioncheckMemoryInRange
249@abstractValidates the IOMemoryDescriptor, which is used to initialize the PhysicalAddressSpace.
250@parammemoryPoints to a valid IOMemoryDescriptor.
251@resultreturns kIOReturnSuccess on success */
252IOReturn checkMemoryInRange( IOMemoryDescriptor * memory );
253
254protected:
255
256UInt64 getPhysicalSegment( UInt64 offset, UInt64 * length )
257{ return ((IOFWPhysicalAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->getPhysicalSegment( offset, length); };
258
259virtual IOFWAddressSpaceAux * createAuxiliary( void );
260
261};
262
263#endif
264

Archive Download this file

Revision: 1146