2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
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. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
28 #ifndef _IOMEMORYDESCRIPTOR_H
29 #define _IOMEMORYDESCRIPTOR_H
31 #include <sys/cdefs.h>
33 #include <IOKit/IOTypes.h>
34 #include <IOKit/IOLocks.h>
35 #include <libkern/c++/OSContainers.h>
38 #include <mach/memory_object_types.h>
41 struct IOPhysicalRange
43 IOPhysicalAddress address
;
51 * Direction of transfer, with respect to the described memory.
55 kIODirectionNone
= 0x0, // same as VM_PROT_NONE
56 kIODirectionIn
= 0x1, // User land 'read', same as VM_PROT_READ
57 kIODirectionOut
= 0x2, // User land 'write', same as VM_PROT_WRITE
58 kIODirectionOutIn
= kIODirectionOut
| kIODirectionIn
,
59 kIODirectionInOut
= kIODirectionIn
| kIODirectionOut
63 * IOOptionBits used in the withOptions variant
66 kIOMemoryDirectionMask
= 0x00000007,
67 kIOMemoryAutoPrepare
= 0x00000008, // Shared with Buffer MD
69 kIOMemoryTypeVirtual
= 0x00000010,
70 kIOMemoryTypePhysical
= 0x00000020,
71 kIOMemoryTypeUPL
= 0x00000030,
72 kIOMemoryTypePersistentMD
= 0x00000040, // Persistent Memory Descriptor
73 kIOMemoryTypeUIO
= 0x00000050,
74 kIOMemoryTypeVirtual64
= 0x00000060,
75 kIOMemoryTypePhysical64
= 0x00000070,
76 kIOMemoryTypeMask
= 0x000000f0,
78 kIOMemoryAsReference
= 0x00000100,
79 kIOMemoryBufferPageable
= 0x00000400,
80 kIOMemoryDontMap
= 0x00000800,
81 #ifdef XNU_KERNEL_PRIVATE
82 kIOMemoryRedirected
= 0x00004000,
83 kIOMemoryPreparedReadOnly
= 0x00008000,
85 kIOMemoryPersistent
= 0x00010000,
86 #ifdef XNU_KERNEL_PRIVATE
87 kIOMemoryReserved6156215
= 0x00020000,
89 kIOMemoryThreadSafe
= 0x00100000, // Shared with Buffer MD
92 #define kIOMapperNone ((IOMapper *) -1)
93 #define kIOMapperSystem ((IOMapper *) 0)
97 kIOMemoryPurgeableKeepCurrent
= 1,
98 kIOMemoryPurgeableNonVolatile
= 2,
99 kIOMemoryPurgeableVolatile
= 3,
100 kIOMemoryPurgeableEmpty
= 4
104 kIOMemoryIncoherentIOFlush
= 1,
105 kIOMemoryIncoherentIOStore
= 2,
108 #define IOMEMORYDESCRIPTOR_SUPPORTS_DMACOMMAND 1
111 /*! @class IOMemoryDescriptor : public OSObject
112 @abstract An abstract base class defining common methods for describing physical or virtual memory.
113 @discussion The IOMemoryDescriptor object represents a buffer or range of memory, specified as one or more physical or virtual address ranges. It contains methods to return the memory's physically contiguous segments (fragments), for use with the IOMemoryCursor, and methods to map the memory into any address space with caching and placed mapping options. */
115 class IOMemoryDescriptor
: public OSObject
117 friend class _IOMemoryMap
;
118 friend class IOSubMemoryDescriptor
;
120 OSDeclareDefaultStructors(IOMemoryDescriptor
);
123 /*! @struct ExpansionData
124 @discussion This structure will be used to expand the capablilties of this class in the future.
126 struct ExpansionData
{
128 unsigned int pagerContig
:1;
129 unsigned int unused
:31;
130 IOMemoryDescriptor
* memory
;
134 Reserved for future use. (Internal use only) */
135 ExpansionData
* reserved
;
142 IODirection _direction
; /* DEPRECATED: use _flags instead. direction of transfer */
143 IOByteCount _length
; /* length of all ranges */
147 typedef IOOptionBits DMACommandOps
;
148 virtual IOPhysicalAddress
getSourceSegment( IOByteCount offset
,
149 IOByteCount
* length
);
150 OSMetaClassDeclareReservedUsed(IOMemoryDescriptor
, 0);
152 /*! @function initWithOptions
153 @abstract Master initialiser for all variants of memory descriptors. For a more complete description see IOMemoryDescriptor::withOptions.
154 @discussion Note this function can be used to re-init a previously created memory descriptor.
155 @result true on success, false on failure. */
156 virtual bool initWithOptions(void * buffers
,
160 IOOptionBits options
,
161 IOMapper
* mapper
= kIOMapperSystem
);
162 OSMetaClassDeclareReservedUsed(IOMemoryDescriptor
, 1);
164 virtual addr64_t
getPhysicalSegment64( IOByteCount offset
,
165 IOByteCount
* length
);
166 OSMetaClassDeclareReservedUsed(IOMemoryDescriptor
, 2);
169 /*! @function setPurgeable
170 @abstract Control the purgeable status of a memory descriptors memory.
171 @discussion Buffers may be allocated with the ability to have their purgeable status changed - IOBufferMemoryDescriptor with the kIOMemoryPurgeable option, VM_FLAGS_PURGEABLE may be passed to vm_allocate() in user space to allocate such buffers. The purgeable status of such a buffer may be controlled with setPurgeable(). The process of making a purgeable memory descriptor non-volatile and determining its previous state is atomic - if a purgeable memory descriptor is made nonvolatile and the old state is returned as kIOMemoryPurgeableVolatile, then the memory's previous contents are completely intact and will remain so until the memory is made volatile again. If the old state is returned as kIOMemoryPurgeableEmpty then the memory was reclaimed while it was in a volatile state and its previous contents have been lost.
172 @param newState - the desired new purgeable state of the memory:<br>
173 kIOMemoryPurgeableKeepCurrent - make no changes to the memory's purgeable state.<br>
174 kIOMemoryPurgeableVolatile - make the memory volatile - the memory may be reclaimed by the VM system without saving its contents to backing store.<br>
175 kIOMemoryPurgeableNonVolatile - make the memory nonvolatile - the memory is treated as with usual allocations and must be saved to backing store if paged.<br>
176 kIOMemoryPurgeableEmpty - make the memory volatile, and discard any pages allocated to it.
177 @param oldState - if non-NULL, the previous purgeable state of the memory is returned here:<br>
178 kIOMemoryPurgeableNonVolatile - the memory was nonvolatile.<br>
179 kIOMemoryPurgeableVolatile - the memory was volatile but its content has not been discarded by the VM system.<br>
180 kIOMemoryPurgeableEmpty - the memory was volatile and has been discarded by the VM system.<br>
181 @result An IOReturn code. */
183 virtual IOReturn
setPurgeable( IOOptionBits newState
,
184 IOOptionBits
* oldState
);
185 OSMetaClassDeclareReservedUsed(IOMemoryDescriptor
, 3);
187 /*! @function performOperation
188 @abstract Perform an operation on the memory descriptor's memory.
189 @discussion This method performs some operation on a range of the memory descriptor's memory. When a memory descriptor's memory is not mapped, it should be more efficient to use this method than mapping the memory to perform the operation virtually.
190 @param options The operation to perform on the memory:<br>
191 kIOMemoryIncoherentIOFlush - pass this option to store to memory and flush any data in the processor cache for the memory range, with synchronization to ensure the data has passed through all levels of processor cache. It may not be supported on all architectures. This type of flush may be used for non-coherent I/O such as AGP - it is NOT required for PCI coherent operations. The memory descriptor must have been previously prepared.<br>
192 kIOMemoryIncoherentIOStore - pass this option to store to memory any data in the processor cache for the memory range, with synchronization to ensure the data has passed through all levels of processor cache. It may not be supported on all architectures. This type of flush may be used for non-coherent I/O such as AGP - it is NOT required for PCI coherent operations. The memory descriptor must have been previously prepared.
193 @param offset A byte offset into the memory descriptor's memory.
194 @param length The length of the data range.
195 @result An IOReturn code. */
197 virtual IOReturn
performOperation( IOOptionBits options
,
198 IOByteCount offset
, IOByteCount length
);
199 OSMetaClassDeclareReservedUsed(IOMemoryDescriptor
, 4);
201 // Used for dedicated communications for IODMACommand
202 virtual IOReturn
dmaCommandOperation(DMACommandOps op
, void *vData
, UInt dataSize
) const;
203 OSMetaClassDeclareReservedUsed(IOMemoryDescriptor
, 5);
206 OSMetaClassDeclareReservedUnused(IOMemoryDescriptor
, 6);
207 OSMetaClassDeclareReservedUnused(IOMemoryDescriptor
, 7);
208 OSMetaClassDeclareReservedUnused(IOMemoryDescriptor
, 8);
209 OSMetaClassDeclareReservedUnused(IOMemoryDescriptor
, 9);
210 OSMetaClassDeclareReservedUnused(IOMemoryDescriptor
, 10);
211 OSMetaClassDeclareReservedUnused(IOMemoryDescriptor
, 11);
212 OSMetaClassDeclareReservedUnused(IOMemoryDescriptor
, 12);
213 OSMetaClassDeclareReservedUnused(IOMemoryDescriptor
, 13);
214 OSMetaClassDeclareReservedUnused(IOMemoryDescriptor
, 14);
215 OSMetaClassDeclareReservedUnused(IOMemoryDescriptor
, 15);
220 static void initialize( void );
223 /*! @function withAddress
224 @abstract Create an IOMemoryDescriptor to describe one virtual range of the kernel task.
225 @discussion This method creates and initializes an IOMemoryDescriptor for memory consisting of a single virtual memory range mapped into the kernel map.
226 @param address The virtual address of the first byte in the memory.
227 @param withLength The length of memory.
228 @param withDirection An I/O direction to be associated with the descriptor, which may affect the operation of the prepare and complete methods on some architectures.
229 @result The created IOMemoryDescriptor on success, to be released by the caller, or zero on failure. */
231 static IOMemoryDescriptor
* withAddress(void * address
,
232 IOByteCount withLength
,
233 IODirection withDirection
);
235 /*! @function withAddress
236 @abstract Create an IOMemoryDescriptor to describe one virtual range of the specified map.
237 @discussion This method creates and initializes an IOMemoryDescriptor for memory consisting of a single virtual memory range mapped into the specified map.
238 @param address The virtual address of the first byte in the memory.
239 @param withLength The length of memory.
240 @param withDirection An I/O direction to be associated with the descriptor, which may affect the operation of the prepare and complete methods on some architectures.
241 @param withTask The task the virtual ranges are mapped into.
242 @result The created IOMemoryDescriptor on success, to be released by the caller, or zero on failure. */
244 static IOMemoryDescriptor
* withAddress(vm_address_t address
,
245 IOByteCount withLength
,
246 IODirection withDirection
,
249 /*! @function withPhysicalAddress
250 @abstract Create an IOMemoryDescriptor to describe one physical range.
251 @discussion This method creates and initializes an IOMemoryDescriptor for memory consisting of a single physical memory range.
252 @param address The physical address of the first byte in the memory.
253 @param withLength The length of memory.
254 @param withDirection An I/O direction to be associated with the descriptor, which may affect the operation of the prepare and complete methods on some architectures.
255 @result The created IOMemoryDescriptor on success, to be released by the caller, or zero on failure. */
257 static IOMemoryDescriptor
* withPhysicalAddress(
258 IOPhysicalAddress address
,
259 IOByteCount withLength
,
260 IODirection withDirection
);
262 /*! @function withRanges
263 @abstract Create an IOMemoryDescriptor to describe one or more virtual ranges.
264 @discussion This method creates and initializes an IOMemoryDescriptor for memory consisting of an array of virtual memory ranges each mapped into a specified source task.
265 @param ranges An array of IOVirtualRange structures which specify the virtual ranges in the specified map which make up the memory to be described.
266 @param withCount The member count of the ranges array.
267 @param withDirection An I/O direction to be associated with the descriptor, which may affect the operation of the prepare and complete methods on some architectures.
268 @param withTask The task each of the virtual ranges are mapped into.
269 @param asReference If false, the IOMemoryDescriptor object will make a copy of the ranges array, otherwise, the array will be used in situ, avoiding an extra allocation.
270 @result The created IOMemoryDescriptor on success, to be released by the caller, or zero on failure. */
272 static IOMemoryDescriptor
* withRanges(IOVirtualRange
* ranges
,
274 IODirection withDirection
,
276 bool asReference
= false);
278 /*! @function withAddressRange
279 @abstract Create an IOMemoryDescriptor to describe one virtual range of the specified map.
280 @discussion This method creates and initializes an IOMemoryDescriptor for memory consisting of a single virtual memory range mapped into the specified map. Note that unlike IOMemoryDescriptor::withAddress(), kernel_task memory must be explicitly prepared when passed to this api.
281 @param address The virtual address of the first byte in the memory.
282 @param withLength The length of memory.
284 kIOMemoryDirectionMask (options:direction) This nibble indicates the I/O direction to be associated with the descriptor, which may affect the operation of the prepare and complete methods on some architectures.
285 @param task The task the virtual ranges are mapped into. Note that unlike IOMemoryDescriptor::withAddress(), kernel_task memory must be explicitly prepared when passed to this api.
286 @result The created IOMemoryDescriptor on success, to be released by the caller, or zero on failure. */
288 static IOMemoryDescriptor
* withAddressRange(
289 mach_vm_address_t address
,
290 mach_vm_size_t length
,
291 IOOptionBits options
,
294 /*! @function withAddressRanges
295 @abstract Create an IOMemoryDescriptor to describe one or more virtual ranges.
296 @discussion This method creates and initializes an IOMemoryDescriptor for memory consisting of an array of virtual memory ranges each mapped into a specified source task. Note that unlike IOMemoryDescriptor::withAddress(), kernel_task memory must be explicitly prepared when passed to this api.
297 @param ranges An array of IOAddressRange structures which specify the virtual ranges in the specified map which make up the memory to be described. IOAddressRange is the 64bit version of IOVirtualRange.
298 @param rangeCount The member count of the ranges array.
300 kIOMemoryDirectionMask (options:direction) This nibble indicates the I/O direction to be associated with the descriptor, which may affect the operation of the prepare and complete methods on some architectures.
301 kIOMemoryAsReference For options:type = Virtual or Physical this indicate that the memory descriptor need not copy the ranges array into local memory. This is an optimisation to try to minimise unnecessary allocations.
302 @param task The task each of the virtual ranges are mapped into. Note that unlike IOMemoryDescriptor::withAddress(), kernel_task memory must be explicitly prepared when passed to this api.
303 @result The created IOMemoryDescriptor on success, to be released by the caller, or zero on failure. */
305 static IOMemoryDescriptor
* withAddressRanges(
306 IOAddressRange
* ranges
,
308 IOOptionBits options
,
311 /*! @function withOptions
312 @abstract Master initialiser for all variants of memory descriptors.
313 @discussion This method creates and initializes an IOMemoryDescriptor for memory it has three main variants: Virtual, Physical & mach UPL. These variants are selected with the options parameter, see below. This memory descriptor needs to be prepared before it can be used to extract data from the memory described. However we temporarily have setup a mechanism that automatically prepares kernel_task memory descriptors at creation time.
316 @param buffers A pointer to an array of IOVirtualRanges or IOPhysicalRanges if the options:type is Virtual or Physical. For type UPL it is a upl_t returned by the mach/memory_object_types.h apis, primarily used internally by the UBC.
318 @param count options:type = Virtual or Physical count contains a count of the number of entires in the buffers array. For options:type = UPL this field contains a total length.
320 @param offset Only used when options:type = UPL, in which case this field contains an offset for the memory within the buffers upl.
322 @param task Only used options:type = Virtual, The task each of the virtual ranges are mapped into.
325 kIOMemoryDirectionMask (options:direction) This nibble indicates the I/O direction to be associated with the descriptor, which may affect the operation of the prepare and complete methods on some architectures.
326 kIOMemoryTypeMask (options:type) kIOMemoryTypeVirtual, kIOMemoryTypePhysical, kIOMemoryTypeUPL Indicates that what type of memory basic memory descriptor to use. This sub-field also controls the interpretation of the buffers, count, offset & task parameters.
327 kIOMemoryAsReference For options:type = Virtual or Physical this indicate that the memory descriptor need not copy the ranges array into local memory. This is an optimisation to try to minimise unnecessary allocations.
328 kIOMemoryBufferPageable Only used by the IOBufferMemoryDescriptor as an indication that the kernel virtual memory is in fact pageable and we need to use the kernel pageable submap rather than the default map.
329 kIOMemoryNoAutoPrepare Indicates that the temporary AutoPrepare of kernel_task memory should not be performed.
331 @param mapper Which IOMapper should be used to map the in-memory physical addresses into I/O space addresses. Defaults to 0 which indicates that the system mapper is to be used, if present.
333 @result The created IOMemoryDescriptor on success, to be released by the caller, or zero on failure. */
335 static IOMemoryDescriptor
*withOptions(void * buffers
,
339 IOOptionBits options
,
340 IOMapper
* mapper
= kIOMapperSystem
);
342 /*! @function withPhysicalRanges
343 @abstract Create an IOMemoryDescriptor to describe one or more physical ranges.
344 @discussion This method creates and initializes an IOMemoryDescriptor for memory consisting of an array of physical memory ranges.
345 @param ranges An array of IOPhysicalRange structures which specify the physical ranges which make up the memory to be described.
346 @param withCount The member count of the ranges array.
347 @param withDirection An I/O direction to be associated with the descriptor, which may affect the operation of the prepare and complete methods on some architectures.
348 @param asReference If false, the IOMemoryDescriptor object will make a copy of the ranges array, otherwise, the array will be used in situ, avoiding an extra allocation.
349 @result The created IOMemoryDescriptor on success, to be released by the caller, or zero on failure. */
351 static IOMemoryDescriptor
* withPhysicalRanges(
352 IOPhysicalRange
* ranges
,
354 IODirection withDirection
,
355 bool asReference
= false);
357 /*! @function withSubRange
358 @abstract Create an IOMemoryDescriptor to describe a subrange of an existing descriptor.
359 @discussion This method creates and initializes an IOMemoryDescriptor for memory consisting of a subrange of the specified memory descriptor. The parent memory descriptor is retained by the new descriptor.
360 @param of The parent IOMemoryDescriptor of which a subrange is to be used for the new descriptor, which will be retained by the subrange IOMemoryDescriptor.
361 @param offset A byte offset into the parent memory descriptor's memory.
362 @param length The length of the subrange.
363 @param withDirection An I/O direction to be associated with the descriptor, which may affect the operation of the prepare and complete methods on some architectures. This is used over the direction of the parent descriptor.
364 @result The created IOMemoryDescriptor on success, to be released by the caller, or zero on failure. */
366 static IOMemoryDescriptor
* withSubRange(IOMemoryDescriptor
*of
,
369 IODirection withDirection
);
371 /*! @function withPersistentMemoryDescriptor
372 @abstract Copy constructor that generates a new memory descriptor if the backing memory for the same task's virtual address and length has changed.
373 @discussion If the original memory descriptor's address and length is still backed by the same real memory, i.e. the user hasn't deallocated and the reallocated memory at the same address then the original memory descriptor is returned with a additional reference. Otherwise we build a totally new memory descriptor with the same characteristics as the previous one but with a new view of the vm. Note not legal to call this function with anything except an IOGeneralMemoryDescriptor that was created with the kIOMemoryPersistent option.
374 @param originalMD The memory descriptor to be duplicated.
375 @result Either the original memory descriptor with an additional retain or a new memory descriptor, 0 for a bad original memory descriptor or some other resource shortage. */
376 static IOMemoryDescriptor
*
377 withPersistentMemoryDescriptor(IOMemoryDescriptor
*originalMD
);
379 /*! @function initWithAddress
380 @abstract Initialize or reinitialize an IOMemoryDescriptor to describe one virtual range of the kernel task.
381 @discussion This method initializes an IOMemoryDescriptor for memory consisting of a single virtual memory range mapped into the kernel map. An IOMemoryDescriptor can be re-used by calling initWithAddress or initWithRanges again on an existing instance -- note this behavior is not commonly supported in other IOKit classes, although it is supported here.
382 @param address The virtual address of the first byte in the memory.
383 @param withLength The length of memory.
384 @param withDirection An I/O direction to be associated with the descriptor, which may affect the operation of the prepare and complete methods on some architectures.
385 @result true on success, false on failure. */
387 virtual bool initWithAddress(void * address
,
388 IOByteCount withLength
,
389 IODirection withDirection
) = 0;
391 /*! @function initWithAddress
392 @abstract Initialize or reinitialize an IOMemoryDescriptor to describe one virtual range of the specified map.
393 @discussion This method initializes an IOMemoryDescriptor for memory consisting of a single virtual memory range mapped into the specified map. An IOMemoryDescriptor can be re-used by calling initWithAddress or initWithRanges again on an existing instance -- note this behavior is not commonly supported in other IOKit classes, although it is supported here.
394 @param address The virtual address of the first byte in the memory.
395 @param withLength The length of memory.
396 @param withDirection An I/O direction to be associated with the descriptor, which may affect the operation of the prepare and complete methods on some architectures.
397 @param withTask The task the virtual ranges are mapped into.
398 @result true on success, false on failure. */
400 virtual bool initWithAddress(vm_address_t address
,
401 IOByteCount withLength
,
402 IODirection withDirection
,
403 task_t withTask
) = 0;
405 /*! @function initWithPhysicalAddress
406 @abstract Initialize or reinitialize an IOMemoryDescriptor to describe one physical range.
407 @discussion This method initializes an IOMemoryDescriptor for memory consisting of a single physical memory range. An IOMemoryDescriptor can be re-used by calling initWithAddress or initWithRanges again on an existing instance -- note this behavior is not commonly supported in other IOKit classes, although it is supported here.
408 @param address The physical address of the first byte in the memory.
409 @param withLength The length of memory.
410 @param withDirection An I/O direction to be associated with the descriptor, which may affect the operation of the prepare and complete methods on some architectures.
411 @result true on success, false on failure. */
413 virtual bool initWithPhysicalAddress(
414 IOPhysicalAddress address
,
415 IOByteCount withLength
,
416 IODirection withDirection
) = 0;
418 /*! @function initWithRanges
419 @abstract Initialize or reinitialize an IOMemoryDescriptor to describe one or more virtual ranges.
420 @discussion This method initializes an IOMemoryDescriptor for memory consisting of an array of virtual memory ranges each mapped into a specified source task. An IOMemoryDescriptor can be re-used by calling initWithAddress or initWithRanges again on an existing instance -- note this behavior is not commonly supported in other IOKit classes, although it is supported here.
421 @param ranges An array of IOVirtualRange structures which specify the virtual ranges in the specified map which make up the memory to be described.
422 @param withCount The member count of the ranges array.
423 @param withDirection An I/O direction to be associated with the descriptor, which may affect the operation of the prepare and complete methods on some architectures.
424 @param withTask The task each of the virtual ranges are mapped into.
425 @param asReference If false, the IOMemoryDescriptor object will make a copy of the ranges array, otherwise, the array will be used in situ, avoiding an extra allocation.
426 @result true on success, false on failure. */
428 virtual bool initWithRanges(IOVirtualRange
* ranges
,
430 IODirection withDirection
,
432 bool asReference
= false) = 0;
434 /*! @function initWithPhysicalRanges
435 @abstract Initialize or reinitialize an IOMemoryDescriptor to describe one or more physical ranges.
436 @discussion This method initializes an IOMemoryDescriptor for memory consisting of an array of physical memory ranges. An IOMemoryDescriptor can be re-used by calling initWithAddress or initWithRanges again on an existing instance -- note this behavior is not commonly supported in other IOKit classes, although it is supported here.
437 @param ranges An array of IOPhysicalRange structures which specify the physical ranges which make up the memory to be described.
438 @param withCount The member count of the ranges array.
439 @param withDirection An I/O direction to be associated with the descriptor, which may affect the operation of the prepare and complete methods on some architectures.
440 @param asReference If false, the IOMemoryDescriptor object will make a copy of the ranges array, otherwise, the array will be used in situ, avoiding an extra allocation.
441 @result true on success, false on failure. */
443 virtual bool initWithPhysicalRanges(IOPhysicalRange
* ranges
,
445 IODirection withDirection
,
446 bool asReference
= false) = 0;
448 /*! @function getDirection
449 @abstract Accessor to get the direction the memory descriptor was created with.
450 @discussion This method returns the direction the memory descriptor was created with.
451 @result The direction. */
453 virtual IODirection
getDirection() const;
455 /*! @function getLength
456 @abstract Accessor to get the length of the memory descriptor (over all its ranges).
457 @discussion This method returns the total length of the memory described by the descriptor, ie. the sum of its ranges' lengths.
458 @result The byte count. */
460 virtual IOByteCount
getLength() const;
463 @abstract Set the tag for the memory descriptor.
464 @discussion This method sets the tag for the memory descriptor. Tag bits are not interpreted by IOMemoryDescriptor.
465 @param tag The tag. */
467 virtual void setTag( IOOptionBits tag
);
470 @abstract Accessor to the retrieve the tag for the memory descriptor.
471 @discussion This method returns the tag for the memory descriptor. Tag bits are not interpreted by IOMemoryDescriptor.
474 virtual IOOptionBits
getTag( void );
476 /*! @function readBytes
477 @abstract Copy data from the memory descriptor's buffer to the specified buffer.
478 @discussion This method copies data from the memory descriptor's memory at the given offset, to the caller's buffer. The memory descriptor MUST have the kIODirectionOut direcction bit set and be prepared. kIODirectionOut means that this memory descriptor will be output to an external device, so readBytes is used to get memory into a local buffer for a PIO transfer to the device.
479 @param offset A byte offset into the memory descriptor's memory.
480 @param bytes The caller supplied buffer to copy the data to.
481 @param withLength The length of the data to copy.
482 @result The number of bytes copied, zero will be returned if the specified offset is beyond the length of the descriptor. */
484 virtual IOByteCount
readBytes(IOByteCount offset
,
485 void * bytes
, IOByteCount withLength
);
487 /*! @function writeBytes
488 @abstract Copy data to the memory descriptor's buffer from the specified buffer.
489 @discussion This method copies data to the memory descriptor's memory at the given offset, from the caller's buffer. The memory descriptor MUST have the kIODirectionIn direcction bit set and be prepared. kIODirectionIn means that this memory descriptor will be input from an external device, so writeBytes is used to write memory into the descriptor for PIO drivers.
490 @param offset A byte offset into the memory descriptor's memory.
491 @param bytes The caller supplied buffer to copy the data from.
492 @param withLength The length of the data to copy.
493 @result The number of bytes copied, zero will be returned if the specified offset is beyond the length of the descriptor. */
495 virtual IOByteCount
writeBytes(IOByteCount offset
,
496 const void * bytes
, IOByteCount withLength
);
498 /*! @function getPhysicalSegment
499 @abstract Break a memory descriptor into its physically contiguous segments.
500 @discussion This method returns the physical address of the byte at the given offset into the memory, and optionally the length of the physically contiguous segment from that offset.
501 @param offset A byte offset into the memory whose physical address to return.
502 @param length If non-zero, getPhysicalSegment will store here the length of the physically contiguous segement at the given offset.
503 @result A physical address, or zero if the offset is beyond the length of the memory. */
505 virtual IOPhysicalAddress
getPhysicalSegment(IOByteCount offset
,
506 IOByteCount
* length
) = 0;
508 /*! @function getPhysicalAddress
509 @abstract Return the physical address of the first byte in the memory.
510 @discussion This method returns the physical address of the first byte in the memory. It is most useful on memory known to be physically contiguous.
511 @result A physical address. */
513 /* inline */ IOPhysicalAddress
getPhysicalAddress();
514 /* { return( getPhysicalSegment( 0, 0 )); } */
516 /* DEPRECATED */ /* USE INSTEAD: map(), readBytes(), writeBytes() */
517 /* DEPRECATED */ virtual void * getVirtualSegment(IOByteCount offset
,
518 /* DEPRECATED */ IOByteCount
* length
) = 0;
519 /* DEPRECATED */ /* USE INSTEAD: map(), readBytes(), writeBytes() */
521 /*! @function prepare
522 @abstract Prepare the memory for an I/O transfer.
523 @discussion This involves paging in the memory, if necessary, and wiring it down for the duration of the transfer. The complete() method completes the processing of the memory after the I/O transfer finishes. Note that the prepare call is not thread safe and it is expected that the client will more easily be able to guarantee single threading a particular memory descriptor.
524 @param forDirection The direction of the I/O just completed, or kIODirectionNone for the direction specified by the memory descriptor.
525 @result An IOReturn code. */
527 virtual IOReturn
prepare(IODirection forDirection
= kIODirectionNone
) = 0;
529 /*! @function complete
530 @abstract Complete processing of the memory after an I/O transfer finishes.
531 @discussion This method should not be called unless a prepare was previously issued; the prepare() and complete() must occur in pairs, before and after an I/O transfer involving pageable memory. In 10.3 or greater systems the direction argument to complete is not longer respected. The direction is totally determined at prepare() time.
532 @param forDirection DEPRECATED The direction of the I/O just completed, or kIODirectionNone for the direction specified by the memory descriptor.
533 @result An IOReturn code. */
535 virtual IOReturn
complete(IODirection forDirection
= kIODirectionNone
) = 0;
541 /*! @function createMappingInTask
542 @abstract Maps a IOMemoryDescriptor into a task.
543 @discussion This is the general purpose method to map all or part of the memory described by a memory descriptor into a task at any available address, or at a fixed address if possible. Caching & read-only options may be set for the mapping. The mapping is represented as a returned reference to a IOMemoryMap object, which may be shared if the mapping is compatible with an existing mapping of the IOMemoryDescriptor. The IOMemoryMap object returned should be released only when the caller has finished accessing the mapping, as freeing the object destroys the mapping.
544 @param intoTask Sets the target task for the mapping. Pass kernel_task for the kernel address space.
545 @param atAddress If a placed mapping is requested, atAddress specifies its address, and the kIOMapAnywhere should not be set. Otherwise, atAddress is ignored.
546 @param options Mapping options are defined in IOTypes.h,<br>
547 kIOMapAnywhere should be passed if the mapping can be created anywhere. If not set, the atAddress parameter sets the location of the mapping, if it is available in the target map.<br>
548 kIOMapDefaultCache to inhibit the cache in I/O areas, kIOMapCopybackCache in general purpose RAM.<br>
549 kIOMapInhibitCache, kIOMapWriteThruCache, kIOMapCopybackCache to set the appropriate caching.<br>
550 kIOMapReadOnly to allow only read only accesses to the memory - writes will cause and access fault.<br>
551 kIOMapReference will only succeed if the mapping already exists, and the IOMemoryMap object is just an extra reference, ie. no new mapping will be created.<br>
552 kIOMapUnique allows a special kind of mapping to be created that may be used with the IOMemoryMap::redirect() API. These mappings will not be shared as is the default - there will always be a unique mapping created for the caller, not an existing mapping with an extra reference.<br>
553 @param offset Is a beginning offset into the IOMemoryDescriptor's memory where the mapping starts. Zero is the default to map all the memory.
554 @param length Is the length of the mapping requested for a subset of the IOMemoryDescriptor. Zero is the default to map all the memory.
555 @result A reference to an IOMemoryMap object representing the mapping, which can supply the virtual address of the mapping and other information. The mapping may be shared with multiple callers - multiple maps are avoided if a compatible one exists. The IOMemoryMap object returned should be released only when the caller has finished accessing the mapping, as freeing the object destroys the mapping. The IOMemoryMap instance also retains the IOMemoryDescriptor it maps while it exists. */
557 IOMemoryMap
* createMappingInTask(
559 mach_vm_address_t atAddress
,
560 IOOptionBits options
,
561 mach_vm_size_t offset
= 0,
562 mach_vm_size_t length
= 0 );
565 @abstract Maps a IOMemoryDescriptor into a task - deprecated, only safe for 32 bit tasks. Use createMappingInTask instead.
566 @discussion This is the general purpose method to map all or part of the memory described by a memory descriptor into a task at any available address, or at a fixed address if possible. Caching & read-only options may be set for the mapping. The mapping is represented as a returned reference to a IOMemoryMap object, which may be shared if the mapping is compatible with an existing mapping of the IOMemoryDescriptor. The IOMemoryMap object returned should be released only when the caller has finished accessing the mapping, as freeing the object destroys the mapping.
567 @param intoTask Sets the target task for the mapping. Pass kernel_task for the kernel address space.
568 @param atAddress If a placed mapping is requested, atAddress specifies its address, and the kIOMapAnywhere should not be set. Otherwise, atAddress is ignored.
569 @param options Mapping options are defined in IOTypes.h,<br>
570 kIOMapAnywhere should be passed if the mapping can be created anywhere. If not set, the atAddress parameter sets the location of the mapping, if it is available in the target map.<br>
571 kIOMapDefaultCache to inhibit the cache in I/O areas, kIOMapCopybackCache in general purpose RAM.<br>
572 kIOMapInhibitCache, kIOMapWriteThruCache, kIOMapCopybackCache to set the appropriate caching.<br>
573 kIOMapReadOnly to allow only read only accesses to the memory - writes will cause and access fault.<br>
574 kIOMapReference will only succeed if the mapping already exists, and the IOMemoryMap object is just an extra reference, ie. no new mapping will be created.<br>
575 kIOMapUnique allows a special kind of mapping to be created that may be used with the IOMemoryMap::redirect() API. These mappings will not be shared as is the default - there will always be a unique mapping created for the caller, not an existing mapping with an extra reference.<br>
576 @param offset Is a beginning offset into the IOMemoryDescriptor's memory where the mapping starts. Zero is the default to map all the memory.
577 @param length Is the length of the mapping requested for a subset of the IOMemoryDescriptor. Zero is the default to map all the memory.
578 @result A reference to an IOMemoryMap object representing the mapping, which can supply the virtual address of the mapping and other information. The mapping may be shared with multiple callers - multiple maps are avoided if a compatible one exists. The IOMemoryMap object returned should be released only when the caller has finished accessing the mapping, as freeing the object destroys the mapping. The IOMemoryMap instance also retains the IOMemoryDescriptor it maps while it exists. */
580 virtual IOMemoryMap
* map(
582 IOVirtualAddress atAddress
,
583 IOOptionBits options
,
584 IOByteCount offset
= 0,
585 IOByteCount length
= 0 );
589 @abstract Maps a IOMemoryDescriptor into the kernel map.
590 @discussion This is a shortcut method to map all the memory described by a memory descriptor into the kernel map at any available address. See the full version of the createMappingInTask method for further details.
591 @param options Mapping options as in the full version of the createMappingInTask method, with kIOMapAnywhere assumed.
592 @result See the full version of the createMappingInTask method. */
594 virtual IOMemoryMap
* map(
595 IOOptionBits options
= 0 );
597 /*! @function setMapping
598 @abstract Establishes an already existing mapping.
599 @discussion This method tells the IOMemoryDescriptor about a mapping that exists, but was created elsewhere. It allows later callers of the map method to share this externally created mapping. The IOMemoryMap object returned is created to represent it. This method is not commonly needed.
600 @param task Address space in which the mapping exists.
601 @param mapAddress Virtual address of the mapping.
602 @param options Caching and read-only attributes of the mapping.
603 @result A IOMemoryMap object created to represent the mapping. */
605 virtual IOMemoryMap
* setMapping(
607 IOVirtualAddress mapAddress
,
608 IOOptionBits options
= 0 );
610 // Following methods are private implementation
613 IOReturn
redirect( task_t safeTask
, bool redirect
);
615 IOReturn
handleFault(
618 mach_vm_address_t address
,
619 mach_vm_size_t sourceOffset
,
620 mach_vm_size_t length
,
621 IOOptionBits options
);
624 virtual IOMemoryMap
* makeMapping(
625 IOMemoryDescriptor
* owner
,
627 IOVirtualAddress atAddress
,
628 IOOptionBits options
,
630 IOByteCount length
);
632 virtual void addMapping(
633 IOMemoryMap
* mapping
);
635 virtual void removeMapping(
636 IOMemoryMap
* mapping
);
638 virtual IOReturn
doMap(
640 IOVirtualAddress
* atAddress
,
641 IOOptionBits options
,
642 IOByteCount sourceOffset
= 0,
643 IOByteCount length
= 0 );
645 virtual IOReturn
doUnmap(
647 IOVirtualAddress logical
,
648 IOByteCount length
);
651 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
653 /*! @class IOMemoryMap : public OSObject
654 @abstract An abstract base class defining common methods for describing a memory mapping.
655 @discussion The IOMemoryMap object represents a mapped range of memory, described by a IOMemoryDescriptor. The mapping may be in the kernel or a non-kernel task and has processor cache mode attributes. IOMemoryMap instances are created by IOMemoryDescriptor when it creates mappings in its map method, and returned to the caller. */
657 class IOMemoryMap
: public OSObject
659 OSDeclareAbstractStructors(IOMemoryMap
)
662 /*! @function getVirtualAddress
663 @abstract Accessor to the virtual address of the first byte in the mapping.
664 @discussion This method returns the virtual address of the first byte in the mapping.
665 @result A virtual address. */
667 virtual IOVirtualAddress
getVirtualAddress() = 0;
669 /*! @function getPhysicalSegment
670 @abstract Break a mapping into its physically contiguous segments.
671 @discussion This method returns the physical address of the byte at the given offset into the mapping, and optionally the length of the physically contiguous segment from that offset. It functions similarly to IOMemoryDescriptor::getPhysicalSegment.
672 @param offset A byte offset into the mapping whose physical address to return.
673 @param length If non-zero, getPhysicalSegment will store here the length of the physically contiguous segement at the given offset.
674 @result A physical address, or zero if the offset is beyond the length of the mapping. */
676 virtual IOPhysicalAddress
getPhysicalSegment(IOByteCount offset
,
677 IOByteCount
* length
) = 0;
679 /*! @function getPhysicalAddress
680 @abstract Return the physical address of the first byte in the mapping.
681 @discussion This method returns the physical address of the first byte in the mapping. It is most useful on mappings known to be physically contiguous.
682 @result A physical address. */
684 /* inline */ IOPhysicalAddress
getPhysicalAddress();
685 /* { return( getPhysicalSegment( 0, 0 )); } */
687 /*! @function getLength
688 @abstract Accessor to the length of the mapping.
689 @discussion This method returns the length of the mapping.
690 @result A byte count. */
692 virtual IOByteCount
getLength() = 0;
694 /*! @function getAddressTask
695 @abstract Accessor to the task of the mapping.
696 @discussion This method returns the mach task the mapping exists in.
697 @result A mach task_t. */
699 virtual task_t
getAddressTask() = 0;
701 /*! @function getMemoryDescriptor
702 @abstract Accessor to the IOMemoryDescriptor the mapping was created from.
703 @discussion This method returns the IOMemoryDescriptor the mapping was created from.
704 @result An IOMemoryDescriptor reference, which is valid while the IOMemoryMap object is retained. It should not be released by the caller. */
706 virtual IOMemoryDescriptor
* getMemoryDescriptor() = 0;
708 /*! @function getMapOptions
709 @abstract Accessor to the options the mapping was created with.
710 @discussion This method returns the options to IOMemoryDescriptor::map the mapping was created with.
711 @result Options for the mapping, including cache settings. */
713 virtual IOOptionBits
getMapOptions() = 0;
716 @abstract Force the IOMemoryMap to unmap, without destroying the object.
717 @discussion IOMemoryMap instances will unmap themselves upon free, ie. when the last client with a reference calls release. This method forces the IOMemoryMap to destroy the mapping it represents, regardless of the number of clients. It is not generally used.
718 @result An IOReturn code. */
720 virtual IOReturn
unmap() = 0;
722 virtual void taskDied() = 0;
724 /*! @function redirect
725 @abstract Replace the memory mapped in a process with new backing memory.
726 @discussion An IOMemoryMap created with the kIOMapUnique option to IOMemoryDescriptor::map() can remapped to a new IOMemoryDescriptor backing object. If the new IOMemoryDescriptor is specified as NULL, client access to the memory map is blocked until a new backing object has been set. By blocking access and copying data, the caller can create atomic copies of the memory while the client is potentially reading or writing the memory.
727 @param newBackingMemory The IOMemoryDescriptor that represents the physical memory that is to be now mapped in the virtual range the IOMemoryMap represents. If newBackingMemory is NULL, any access to the mapping will hang (in vm_fault()) until access has been restored by a new call to redirect() with non-NULL newBackingMemory argument.
728 @param options Mapping options are defined in IOTypes.h, and are documented in IOMemoryDescriptor::map()
729 @param offset As with IOMemoryDescriptor::map(), a beginning offset into the IOMemoryDescriptor's memory where the mapping starts. Zero is the default.
730 @result An IOReturn code. */
732 virtual IOReturn
redirect(IOMemoryDescriptor
* newBackingMemory
,
733 IOOptionBits options
,
734 IOByteCount offset
= 0) = 0;
736 virtual IOReturn
redirect(IOMemoryDescriptor
* newBackingMemory
,
737 IOOptionBits options
,
738 mach_vm_size_t offset
= 0) = 0;
740 virtual mach_vm_address_t
getAddress() = 0;
741 virtual mach_vm_size_t
getSize() = 0;
744 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
746 // The following classes are private implementation of IOMemoryDescriptor - they
747 // should not be referenced directly, just through the public API's in the
748 // IOMemoryDescriptor class. For example, an IOGeneralMemoryDescriptor instance
749 // might be created by IOMemoryDescriptor::withAddress(), but there should be
750 // no need to reference as anything but a generic IOMemoryDescriptor *.
752 class IOGeneralMemoryDescriptor
: public IOMemoryDescriptor
754 OSDeclareDefaultStructors(IOGeneralMemoryDescriptor
);
765 unsigned _rangesCount
; /* number of address ranges in list */
766 bool _rangesIsAllocated
; /* is list allocated by us? */
768 task_t _task
; /* task where all ranges are mapped to */
773 } _singleRange
; /* storage space for a single range */
775 unsigned _wireCount
; /* number of outstanding wires */
777 /* DEPRECATED */ vm_address_t _cachedVirtualAddress
; /* a cached virtual-to-physical */
779 /* DEPRECATED */ IOPhysicalAddress _cachedPhysicalAddress
;
781 bool _initialized
; /* has superclass been initialized? */
785 virtual IOReturn
dmaCommandOperation(DMACommandOps op
, void *vData
, UInt dataSize
) const;
789 /* DEPRECATED */ virtual void setPosition(IOByteCount position
);
790 /* DEPRECATED */ virtual void mapIntoKernel(unsigned rangeIndex
);
791 /* DEPRECATED */ virtual void unmapFromKernel();
793 // Internal APIs may be made virtual at some time in the future.
794 IOReturn
wireVirtual(IODirection forDirection
);
795 void *createNamedEntry();
798 OSData
* _memoryEntries
;
800 ppnum_t _highestPage
;
801 uint32_t __iomd_reservedA
;
802 uint32_t __iomd_reservedB
;
804 IOLock
* _prepareLock
;
808 * IOMemoryDescriptor required methods
812 virtual bool initWithOptions(void * buffers
,
816 IOOptionBits options
,
817 IOMapper
* mapper
= kIOMapperSystem
);
819 // Secondary initialisers
820 virtual bool initWithAddress(void * address
,
821 IOByteCount withLength
,
822 IODirection withDirection
);
824 virtual bool initWithAddress(vm_address_t address
,
825 IOByteCount withLength
,
826 IODirection withDirection
,
829 virtual bool initWithPhysicalAddress(
830 IOPhysicalAddress address
,
831 IOByteCount withLength
,
832 IODirection withDirection
);
834 virtual bool initWithRanges( IOVirtualRange
* ranges
,
836 IODirection withDirection
,
838 bool asReference
= false);
840 virtual bool initWithPhysicalRanges(IOPhysicalRange
* ranges
,
842 IODirection withDirection
,
843 bool asReference
= false);
845 virtual addr64_t
getPhysicalSegment64( IOByteCount offset
,
846 IOByteCount
* length
);
848 virtual IOPhysicalAddress
getPhysicalSegment(IOByteCount offset
,
849 IOByteCount
* length
);
851 virtual IOPhysicalAddress
getSourceSegment(IOByteCount offset
,
852 IOByteCount
* length
);
854 /* DEPRECATED */ virtual void * getVirtualSegment(IOByteCount offset
,
855 /* DEPRECATED */ IOByteCount
* length
);
857 virtual IOReturn
prepare(IODirection forDirection
= kIODirectionNone
);
859 virtual IOReturn
complete(IODirection forDirection
= kIODirectionNone
);
861 virtual IOReturn
doMap(
863 IOVirtualAddress
* atAddress
,
864 IOOptionBits options
,
865 IOByteCount sourceOffset
= 0,
866 IOByteCount length
= 0 );
868 virtual IOReturn
doUnmap(
870 IOVirtualAddress logical
,
871 IOByteCount length
);
873 virtual bool serialize(OSSerialize
*s
) const;
875 // Factory method for cloning a persistent IOMD, see IOMemoryDescriptor
876 static IOMemoryDescriptor
*
877 withPersistentMemoryDescriptor(IOGeneralMemoryDescriptor
*originalMD
);
881 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
883 class IOSubMemoryDescriptor
: public IOMemoryDescriptor
885 friend class IOMemoryDescriptor
;
887 OSDeclareDefaultStructors(IOSubMemoryDescriptor
);
890 IOMemoryDescriptor
* _parent
;
895 virtual bool initWithAddress(void * address
,
896 IOByteCount withLength
,
897 IODirection withDirection
);
899 virtual bool initWithAddress(vm_address_t address
,
900 IOByteCount withLength
,
901 IODirection withDirection
,
904 virtual bool initWithPhysicalAddress(
905 IOPhysicalAddress address
,
906 IOByteCount withLength
,
907 IODirection withDirection
);
909 virtual bool initWithRanges( IOVirtualRange
* ranges
,
911 IODirection withDirection
,
913 bool asReference
= false);
915 virtual bool initWithPhysicalRanges(IOPhysicalRange
* ranges
,
917 IODirection withDirection
,
918 bool asReference
= false);
920 IOMemoryDescriptor::withAddress
;
921 IOMemoryDescriptor::withPhysicalAddress
;
922 IOMemoryDescriptor::withPhysicalRanges
;
923 IOMemoryDescriptor::withRanges
;
924 IOMemoryDescriptor::withSubRange
;
926 // used by IODMACommand
927 virtual IOReturn
dmaCommandOperation(DMACommandOps op
, void *vData
, UInt dataSize
) const;
931 * Initialize or reinitialize an IOSubMemoryDescriptor to describe
932 * a subrange of an existing descriptor.
934 * An IOSubMemoryDescriptor can be re-used by calling initSubRange
935 * again on an existing instance -- note that this behavior is not
936 * commonly supported in other IOKit classes, although it is here.
938 virtual bool initSubRange( IOMemoryDescriptor
* parent
,
939 IOByteCount offset
, IOByteCount length
,
940 IODirection withDirection
);
943 * IOMemoryDescriptor required methods
946 virtual addr64_t
getPhysicalSegment64( IOByteCount offset
,
947 IOByteCount
* length
);
949 virtual IOPhysicalAddress
getPhysicalSegment(IOByteCount offset
,
950 IOByteCount
* length
);
952 virtual IOPhysicalAddress
getSourceSegment(IOByteCount offset
,
953 IOByteCount
* length
);
955 virtual IOByteCount
readBytes(IOByteCount offset
,
956 void * bytes
, IOByteCount withLength
);
958 virtual IOByteCount
writeBytes(IOByteCount offset
,
959 const void * bytes
, IOByteCount withLength
);
961 virtual void * getVirtualSegment(IOByteCount offset
,
962 IOByteCount
* length
);
964 virtual IOReturn
prepare(IODirection forDirection
= kIODirectionNone
);
966 virtual IOReturn
complete(IODirection forDirection
= kIODirectionNone
);
969 IOReturn
redirect( task_t safeTask
, bool redirect
);
971 virtual bool serialize(OSSerialize
*s
) const;
973 virtual IOReturn
setPurgeable( IOOptionBits newState
,
974 IOOptionBits
* oldState
);
975 virtual IOReturn
performOperation( IOOptionBits options
,
976 IOByteCount offset
, IOByteCount length
);
979 virtual IOMemoryMap
* makeMapping(
980 IOMemoryDescriptor
* owner
,
982 IOVirtualAddress atAddress
,
983 IOOptionBits options
,
985 IOByteCount length
);
987 virtual IOReturn
doMap(
989 IOVirtualAddress
* atAddress
,
990 IOOptionBits options
,
991 IOByteCount sourceOffset
= 0,
992 IOByteCount length
= 0 );
995 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
997 #endif /* !_IOMEMORYDESCRIPTOR_H */