Root/
Source at commit 2744 created 8 years 11 months ago. By ifabio, Removing old RLE/Clut data | |
---|---|
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 | ␊ |
37 | class IOFWPhysicalAddressSpace;␊ |
38 | ␊ |
39 | struct FWSegment␊ |
40 | {␊ |
41 | ␉FWAddress␉address;␊ |
42 | ␉UInt32␉␉length;␊ |
43 | };␊ |
44 | ␊ |
45 | #pragma mark -␊ |
46 | ␊ |
47 | /*! ␊ |
48 | ␉@class IOFWPhysicalAddressSpaceAux␊ |
49 | */␊ |
50 | ␊ |
51 | class IOFWPhysicalAddressSpaceAux : public IOFWAddressSpaceAux␊ |
52 | {␊ |
53 | OSDeclareDefaultStructors(IOFWPhysicalAddressSpaceAux)␊ |
54 | ␊ |
55 | ␉friend class IOFWAddressSpace;␊ |
56 | ␉friend class IOFWPhysicalAddressSpace;␊ |
57 | ␉␊ |
58 | protected:␊ |
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␊ |
69 | ␉␉Reserved for future use. (Internal use only) ␊ |
70 | ␉*/␊ |
71 | ␊ |
72 | ␉ExpansionData *reserved;␊ |
73 | ␉␊ |
74 | ␉IODMACommand *␉fDMACommand;␊ |
75 | ␉bool␉␉␉fDMACommandPrepared;␊ |
76 | ␉␊ |
77 | public:␊ |
78 | virtual bool init( IOFWAddressSpace * primary );␊ |
79 | ␉virtual␉void free();␊ |
80 | ␊ |
81 | ␉void setDMACommand( IODMACommand * dma_command );␊ |
82 | ␉IODMACommand * getDMACommand( void ); ␊ |
83 | ␉UInt64 getPhysicalSegment( UInt64 offset, UInt64 * length );␊ |
84 | ␉␊ |
85 | ␉IOReturn prepare( void );␊ |
86 | ␉IOReturn synchronize( IOOptionBits options );␊ |
87 | ␉IOReturn complete( void );␊ |
88 | ␊ |
89 | ␉bool isPrepared( void );␊ |
90 | ␊ |
91 | ␉IOReturn getSegments( UInt64 * offset, FWSegment * fw_segments, UInt32 * num_segments );␊ |
92 | ␉␊ |
93 | private:␊ |
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 | ␊ |
113 | class IOFWPhysicalAddressSpace : public IOFWAddressSpace␊ |
114 | {␊ |
115 | OSDeclareDefaultStructors(IOFWPhysicalAddressSpace)␊ |
116 | ␊ |
117 | ␉friend class IOFWPhysicalAddressSpaceAux;␊ |
118 | ␊ |
119 | protected:␊ |
120 | ␊ |
121 | ␉IOMemoryDescriptor *␉fMem;␉// unused␊ |
122 | vm_size_t␉␉␉␉fLen;␉// unused␊ |
123 | ␉␊ |
124 | virtual␉void ␉␉␉␉␉free();␊ |
125 | ␊ |
126 | public:␊ |
127 | ␊ |
128 | /*!␉@function␉init␊ |
129 | ␉@abstract␉Initialize physical address space.␊ |
130 | ␉@param␉␉bus␉Points to IOFireWireBus object.␊ |
131 | ␉@result␉␉returns true if success, else false */␊ |
132 | ␉virtual bool init( IOFireWireBus * bus );␊ |
133 | ␉␊ |
134 | /*!␉@function␉initWithDesc␊ |
135 | ␉@abstract␉Initialize physical address space with IOMemoryDescriptor.␊ |
136 | ␉@param␉␉bus␉Points to IOFireWireBus object.␊ |
137 | ␉@param␉␉mem␉Points to IOMemoryDescriptor.␊ |
138 | ␉@result␉␉returns true if success, else false */␊ |
139 | virtual bool initWithDesc(IOFireWireBus *bus,␊ |
140 | IOMemoryDescriptor *mem);␊ |
141 | ␊ |
142 | /*!␉@function␉doRead␊ |
143 | ␉@abstract␉A method for processing an address space read request␊ |
144 | ␉@param␉␉nodeID␉FireWire Read from nodeID.␊ |
145 | ␉@param␉␉speed␉at this 'speed'.␊ |
146 | ␉@param␉␉addr␉with FireWire address 'addr'.␊ |
147 | ␉@param␉␉len␉␉read 'len' bytes from nodeID.␊ |
148 | ␉@param␉␉buf␉␉points to a memory descriptor containing the packet data.␊ |
149 | ␉@param␉␉offset␉start from this 'offset' in 'buf'.␊ |
150 | ␉@param␉␉refcon Can be queried for extra info about the request.␊ |
151 | ␉@result␉␉UIn32␉returns kFWResponseComplete on success */␊ |
152 | virtual UInt32 doRead(UInt16 nodeID, IOFWSpeed &speed, FWAddress addr, UInt32 len, ␊ |
153 | ␉␉␉␉␉␉␉IOMemoryDescriptor **buf, IOByteCount * offset,␊ |
154 | ␉␉␉␉␉␉␉IOFWRequestRefCon refcon);␊ |
155 | ␊ |
156 | /*!␉@function␉doWrite␊ |
157 | ␉@abstract␉A method for processing an address space write request␊ |
158 | ␉@param␉␉nodeID␉FireWire Write to nodeID.␊ |
159 | ␉@param␉␉speed␉at this 'speed'.␊ |
160 | ␉@param␉␉addr␉with FireWire address 'addr'.␊ |
161 | ␉@param␉␉len␉␉write 'len' bytes to nodeID.␊ |
162 | ␉@param␉␉buf␉␉obtain bytes from location given by 'buf'.␊ |
163 | ␉@param␉␉reqrefcon Can be queried for extra info about the request.␊ |
164 | ␉@result␉␉UIn32␉returns kFWResponseComplete on success */␊ |
165 | virtual UInt32 doWrite(UInt16 nodeID, IOFWSpeed &speed, FWAddress addr, UInt32 len,␊ |
166 | const void *buf, IOFWRequestRefCon refcon);␊ |
167 | ␊ |
168 | /*!␉@function␉getMemoryDescriptor␊ |
169 | ␉@abstract␉Gets the memory descriptor, which is associated to this ␊ |
170 | ␉␉␉␉PhysicalAddressSpace.␊ |
171 | ␉@param␉␉none.␊ |
172 | ␉@result␉␉returns the IOMemoryDescriptor */␊ |
173 | ␉IOMemoryDescriptor * getMemoryDescriptor( void );␊ |
174 | ␊ |
175 | /*!␉@function␉setMemoryDescriptor␊ |
176 | ␉@abstract␉Sets the memory descriptor, which will be associated to this ␊ |
177 | ␉␉␉␉PhysicalAddressSpace.␊ |
178 | ␉@param␉␉none.␊ |
179 | ␉@result␉␉returns the IOMemoryDescriptor */␊ |
180 | ␉IOReturn setMemoryDescriptor( IOMemoryDescriptor * descriptor );␊ |
181 | ␊ |
182 | /*!␉@function␉getLength␊ |
183 | ␉@abstract␉Get the length of the memory backed by PhysicalAddressSpace.␊ |
184 | ␉@param␉␉none.␊ |
185 | ␉@result␉␉returns the length */␊ |
186 | ␉UInt64 getLength( void );␊ |
187 | ␊ |
188 | /*!␉@function␉setDMACommand␊ |
189 | ␉@abstract␉Set the DMACommand for this PhysicalAddressSpace.␊ |
190 | ␉@param␉␉dma_command␉Points to IODMACommand object.␊ |
191 | ␉@result␉␉none */␊ |
192 | ␉inline void setDMACommand( IODMACommand * dma_command )␊ |
193 | ␉␉{ ((IOFWPhysicalAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->setDMACommand( dma_command ); };␊ |
194 | ␉␉␊ |
195 | /*!␉@function␉getDMACommand␊ |
196 | ␉@abstract␉Get the DMACommand from this PhysicalAddressSpace.␊ |
197 | ␉@param␉␉none.␊ |
198 | ␉@result␉␉return previously assigned IODMACommand, null if not initialized */␊ |
199 | ␉inline IODMACommand * getDMACommand( void )␊ |
200 | ␉␉{ return ((IOFWPhysicalAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->getDMACommand(); };␊ |
201 | ␊ |
202 | /*!␉@function␉initWithDMACommand␊ |
203 | ␉@abstract␉Initialize physical address space with IODMACommand.␊ |
204 | ␉@param␉␉bus␉Points to IOFireWireBus object.␊ |
205 | ␉@param␉␉command␉Points to IODMACommand.␊ |
206 | ␉@result␉␉returns true if success, else false */␊ |
207 | ␉virtual bool initWithDMACommand( IOFireWireBus * control, IODMACommand * command );␊ |
208 | ␉␊ |
209 | /*!␉@function␉prepare␊ |
210 | ␉@abstract␉Prepare the IODMACommand used by this PhysicalAddressSpace.␊ |
211 | ␉@param␉␉none.␊ |
212 | ␉@result␉␉returns kIOReturnSuccess on success */␊ |
213 | ␉inline IOReturn prepare( void )␊ |
214 | ␉␉{ return ((IOFWPhysicalAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->prepare(); };␊ |
215 | ␊ |
216 | /*!␉@function␉synchronize␊ |
217 | ␉@abstract␉synchronize the IODMACommand used by this PhysicalAddressSpace.␊ |
218 | ␉@param␉␉none.␊ |
219 | ␉@result␉␉returns kIOReturnSuccess on success */␊ |
220 | ␉inline IOReturn synchronize( IOOptionBits options )␊ |
221 | ␉␉{ return ((IOFWPhysicalAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->synchronize( options ); };␊ |
222 | ␉␉ ␊ |
223 | /*!␉@function␉complete␊ |
224 | ␉@abstract␉complete the IODMACommand used by this PhysicalAddressSpace.␊ |
225 | ␉@param␉␉none.␊ |
226 | ␉@result␉␉returns kIOReturnSuccess on success */␊ |
227 | ␉inline IOReturn complete( void )␊ |
228 | ␉␉{ return ((IOFWPhysicalAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->complete(); };␊ |
229 | ␊ |
230 | /*!␉@function␉isPrepared␊ |
231 | ␉@abstract␉Inspects whether the IODMACommand was prepared in this PhysicalAddressSpace.␊ |
232 | ␉@param␉␉none.␊ |
233 | ␉@result␉␉returns true if prepared, else false */␊ |
234 | ␉inline bool isPrepared( void )␊ |
235 | ␉␉{ return ((IOFWPhysicalAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->isPrepared(); };␊ |
236 | ␊ |
237 | /*!␉@function␉getSegments␊ |
238 | ␉@abstract␉Returns the scatter gather list of memory segments from the IODMACommand␊ |
239 | ␉␉␉␉used in this PhysicalAddressSpace.␊ |
240 | ␉@param␉␉offset␉␉input/output parameter, defines the starting and ending offset in the memory ␊ |
241 | ␉␉␉␉␉␉␉descriptor, relative to any offset passed to the prepare() method.␊ |
242 | ␉␉␉␉FWSegment ␉Points to an array of memory segments.␊ |
243 | ␉␉␉␉num_segments Size of the FWSegment array. ␊ |
244 | ␉@result␉␉returns kIOReturnSuccess on success */␊ |
245 | ␉inline IOReturn getSegments( UInt64 * offset, FWSegment * fw_segments, UInt32 * num_segments )␊ |
246 | ␉␉{ return ((IOFWPhysicalAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->getSegments( offset, fw_segments, num_segments ); };␊ |
247 | ␊ |
248 | /*!␉@function␉checkMemoryInRange␊ |
249 | ␉@abstract␉Validates the IOMemoryDescriptor, which is used to initialize the PhysicalAddressSpace.␊ |
250 | ␉@param␉␉memory␉Points to a valid IOMemoryDescriptor.␊ |
251 | ␉@result␉␉returns kIOReturnSuccess on success */␊ |
252 | ␉IOReturn checkMemoryInRange( IOMemoryDescriptor * memory );␊ |
253 | ␉␉␊ |
254 | protected:␊ |
255 | ␊ |
256 | ␉UInt64 getPhysicalSegment( UInt64 offset, UInt64 * length )␊ |
257 | ␉␉{ return ((IOFWPhysicalAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->getPhysicalSegment( offset, length); };␊ |
258 | ␉␉␉␊ |
259 | ␉virtual IOFWAddressSpaceAux * createAuxiliary( void );␊ |
260 | ␉␊ |
261 | };␊ |
262 | ␊ |
263 | #endif␊ |
264 |