/*
* Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
*
- * @APPLE_LICENSE_HEADER_START@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
- * The contents of this file constitute Original Code as defined in and
- * are subject to the Apple Public Source License Version 1.1 (the
- * "License"). You may not use this file except in compliance with the
- * License. Please obtain a copy of the License at
- * http://www.apple.com/publicsource and read it before using this file.
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
*
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
- * @APPLE_LICENSE_HEADER_END@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _IOMULTIMEMORYDESCRIPTOR_H
UInt32 _descriptorsCount;
bool _descriptorsIsAllocated;
- virtual void free();
-
- /*
- * These methods are not supported under this subclass.
- */
-
- virtual bool initWithAddress( void * address, /* not supported */
- IOByteCount withLength,
- IODirection withDirection );
-
- virtual bool initWithAddress( vm_address_t address, /* not supported */
- IOByteCount withLength,
- IODirection withDirection,
- task_t withTask );
-
- virtual bool initWithPhysicalAddress(
- IOPhysicalAddress address, /* not supported */
- IOByteCount withLength,
- IODirection withDirection );
-
- virtual bool initWithPhysicalRanges(
- IOPhysicalRange * ranges, /* not supported */
- UInt32 withCount,
- IODirection withDirection,
- bool asReference = false );
-
- virtual bool initWithRanges( IOVirtualRange * ranges, /* not supported */
- UInt32 withCount,
- IODirection withDirection,
- task_t withTask,
- bool asReference = false );
-
- virtual void * getVirtualSegment( IOByteCount offset, /* not supported */
- IOByteCount * length );
-
- IOMemoryDescriptor::withAddress; /* not supported */
- IOMemoryDescriptor::withPhysicalAddress; /* not supported */
- IOMemoryDescriptor::withPhysicalRanges; /* not supported */
- IOMemoryDescriptor::withRanges; /* not supported */
- IOMemoryDescriptor::withSubRange; /* not supported */
+ virtual void free() APPLE_KEXT_OVERRIDE;
public:
IODirection withDirection,
bool asReference = false );
-/*! @function getPhysicalAddress
- @abstract Return the physical address of the first byte in the memory.
- @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.
- @result A physical address. */
+/*! @function getPhysicalSegment
+ @abstract Break a memory descriptor into its physically contiguous segments.
+ @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.
+ @param offset A byte offset into the memory whose physical address to return.
+ @param length If non-zero, getPhysicalSegment will store here the length of the physically contiguous segement at the given offset.
+ @result A physical address, or zero if the offset is beyond the length of the memory. */
- virtual IOPhysicalAddress getPhysicalSegment( IOByteCount offset,
- IOByteCount * length );
+ virtual addr64_t getPhysicalSegment( IOByteCount offset,
+ IOByteCount * length,
+ IOOptionBits options = 0 ) APPLE_KEXT_OVERRIDE;
/*! @function prepare
@abstract Prepare the memory for an I/O transfer.
@param forDirection The direction of the I/O just completed, or kIODirectionNone for the direction specified by the memory descriptor.
@result An IOReturn code. */
- virtual IOReturn prepare(IODirection forDirection = kIODirectionNone);
+ virtual IOReturn prepare(IODirection forDirection = kIODirectionNone) APPLE_KEXT_OVERRIDE;
/*! @function complete
@abstract Complete processing of the memory after an I/O transfer finishes.
@param forDirection The direction of the I/O just completed, or kIODirectionNone for the direction specified by the memory descriptor.
@result An IOReturn code. */
- virtual IOReturn complete(IODirection forDirection = kIODirectionNone);
-
-/*! @function readBytes
- @abstract Copy data from the memory descriptor's buffer to the specified buffer.
- @discussion This method copies data from the memory descriptor's memory at the given offset, to the caller's buffer.
- @param offset A byte offset into the memory descriptor's memory.
- @param bytes The caller supplied buffer to copy the data to.
- @param withLength The length of the data to copy.
- @result The number of bytes copied, zero will be returned if the specified offset is beyond the length of the descriptor. */
-
- virtual IOByteCount readBytes( IOByteCount offset,
- void * bytes,
- IOByteCount withLength );
-
-/*! @function writeBytes
- @abstract Copy data to the memory descriptor's buffer from the specified buffer.
- @discussion This method copies data to the memory descriptor's memory at the given offset, from the caller's buffer.
- @param offset A byte offset into the memory descriptor's memory.
- @param bytes The caller supplied buffer to copy the data from.
- @param withLength The length of the data to copy.
- @result The number of bytes copied, zero will be returned if the specified offset is beyond the length of the descriptor. */
-
- virtual IOByteCount writeBytes( IOByteCount offset,
- const void * bytes,
- IOByteCount withLength );
-
- virtual IOPhysicalAddress getSourceSegment(IOByteCount offset,
- IOByteCount * length);
+ virtual IOReturn complete(IODirection forDirection = kIODirectionNone) APPLE_KEXT_OVERRIDE;
+
+ virtual IOReturn setPurgeable(IOOptionBits newState, IOOptionBits * oldState) APPLE_KEXT_OVERRIDE;
+
+/*! @function getPageCounts
+ @abstract Retrieve the number of resident and/or dirty pages encompassed by an IOMemoryDescriptor.
+ @discussion This method returns the number of resident and/or dirty pages encompassed by an IOMemoryDescriptor.
+ @param residentPageCount - If non-null, a pointer to a byte count that will return the number of resident pages encompassed by this IOMemoryDescriptor.
+ @param dirtyPageCount - If non-null, a pointer to a byte count that will return the number of dirty pages encompassed by this IOMemoryDescriptor.
+ @result An IOReturn code. */
+
+ IOReturn getPageCounts(IOByteCount * residentPageCount,
+ IOByteCount * dirtyPageCount);
+
+#define IOMULTIMEMORYDESCRIPTOR_SUPPORTS_GETPAGECOUNTS 1
+
+private:
+ virtual IOReturn doMap(vm_map_t addressMap,
+ IOVirtualAddress * atAddress,
+ IOOptionBits options,
+ IOByteCount sourceOffset = 0,
+ IOByteCount length = 0 ) APPLE_KEXT_OVERRIDE;
};
#endif /* !_IOMULTIMEMORYDESCRIPTOR_H */