X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/89b3af67bb32e691275bf6fa803d1834b2284115..21362eb3e66fd2c787aee132bce100a44d71a99c:/iokit/IOKit/IOMemoryDescriptor.h diff --git a/iokit/IOKit/IOMemoryDescriptor.h b/iokit/IOKit/IOMemoryDescriptor.h index b154cbe1d..551ecfff6 100644 --- a/iokit/IOKit/IOMemoryDescriptor.h +++ b/iokit/IOKit/IOMemoryDescriptor.h @@ -70,8 +70,6 @@ enum { kIOMemoryTypeUPL = 0x00000030, kIOMemoryTypePersistentMD = 0x00000040, // Persistent Memory Descriptor kIOMemoryTypeUIO = 0x00000050, - kIOMemoryTypeVirtual64 = 0x00000060, - kIOMemoryTypePhysical64 = 0x00000070, kIOMemoryTypeMask = 0x000000f0, kIOMemoryAsReference = 0x00000100, @@ -96,9 +94,6 @@ enum kIOMemoryIncoherentIOStore = 2, }; -#define IOMEMORYDESCRIPTOR_SUPPORTS_DMACOMMAND 1 - - /*! @class IOMemoryDescriptor : public OSObject @abstract An abstract base class defining common methods for describing physical or virtual memory. @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. */ @@ -135,7 +130,7 @@ protected: IOOptionBits _tag; public: -typedef IOOptionBits DMACommandOps; + virtual IOPhysicalAddress getSourceSegment( IOByteCount offset, IOByteCount * length ); OSMetaClassDeclareReservedUsed(IOMemoryDescriptor, 0); @@ -149,7 +144,7 @@ typedef IOOptionBits DMACommandOps; UInt32 offset, task_t task, IOOptionBits options, - IOMapper * mapper = kIOMapperSystem); + IOMapper * mapper = 0); OSMetaClassDeclareReservedUsed(IOMemoryDescriptor, 1); virtual addr64_t getPhysicalSegment64( IOByteCount offset, @@ -189,16 +184,9 @@ typedef IOOptionBits DMACommandOps; IOByteCount offset, IOByteCount length ); OSMetaClassDeclareReservedUsed(IOMemoryDescriptor, 4); -#if !(defined(__ppc__) && defined(KPI_10_4_0_PPC_COMPAT)) - // Used for dedicated communications for IODMACommand - virtual IOReturn dmaCommandOperation(DMACommandOps op, void *vData, UInt dataSize) const; - OSMetaClassDeclareReservedUsed(IOMemoryDescriptor, 5); -#endif - private: -#if (defined(__ppc__) && defined(KPI_10_4_0_PPC_COMPAT)) + OSMetaClassDeclareReservedUnused(IOMemoryDescriptor, 5); -#endif OSMetaClassDeclareReservedUnused(IOMemoryDescriptor, 6); OSMetaClassDeclareReservedUnused(IOMemoryDescriptor, 7); OSMetaClassDeclareReservedUnused(IOMemoryDescriptor, 8); @@ -271,43 +259,6 @@ public: task_t withTask, bool asReference = false); -#if !(defined(__ppc__) && defined(KPI_10_4_0_PPC_COMPAT)) -/*! @function withAddressRange - @abstract Create an IOMemoryDescriptor to describe one virtual range of the specified map. - @discussion This method creates and initializes an IOMemoryDescriptor for memory consisting of a single virtual memory range mapped into the specified map. - @param address The virtual address of the first byte in the memory. - @param withLength The length of memory. - @param options - 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. - kIOMemoryNoAutoPrepare Indicates that the temporary AutoPrepare of kernel_task memory should not be performed. - @param task The task the virtual ranges are mapped into. - @result The created IOMemoryDescriptor on success, to be released by the caller, or zero on failure. */ - - static IOMemoryDescriptor * withAddressRange( - mach_vm_address_t address, - mach_vm_size_t length, - IOOptionBits options, - task_t task); - -/*! @function withAddressRanges - @abstract Create an IOMemoryDescriptor to describe one or more virtual ranges. - @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. - @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. - @param rangeCount The member count of the ranges array. - @param options - 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. - 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. - kIOMemoryNoAutoPrepare Indicates that the temporary AutoPrepare of kernel_task memory should not be performed. - @param task The task each of the virtual ranges are mapped into. - @result The created IOMemoryDescriptor on success, to be released by the caller, or zero on failure. */ - - static IOMemoryDescriptor * withAddressRanges( - IOAddressRange * ranges, - UInt32 rangeCount, - IOOptionBits options, - task_t withTask); -#endif - /*! @function withOptions @abstract Master initialiser for all variants of memory descriptors. @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. @@ -337,7 +288,7 @@ public: UInt32 offset, task_t task, IOOptionBits options, - IOMapper * mapper = kIOMapperSystem); + IOMapper * mapper = 0); /*! @function withPhysicalRanges @abstract Create an IOMemoryDescriptor to describe one or more physical ranges. @@ -731,9 +682,8 @@ class IOGeneralMemoryDescriptor : public IOMemoryDescriptor public: union Ranges { - IOVirtualRange *v; - IOAddressRange *v64; - IOPhysicalRange *p; + IOVirtualRange * v; + IOPhysicalRange * p; void *uio; }; protected: @@ -758,27 +708,35 @@ protected: virtual void free(); -#if !(defined(__ppc__) && defined(KPI_10_4_0_PPC_COMPAT)) - virtual IOReturn dmaCommandOperation(DMACommandOps op, void *vData, UInt dataSize) const; -#endif private: + // Internal APIs may be made virtual at some time in the future. + IOReturn wireVirtual(IODirection forDirection); + void *createNamedEntry(); + + /* DEPRECATED */ IOByteCount _position; /* absolute position over all ranges */ /* DEPRECATED */ virtual void setPosition(IOByteCount position); - /* DEPRECATED */ virtual void mapIntoKernel(unsigned rangeIndex); - /* DEPRECATED */ virtual void unmapFromKernel(); - // Internal APIs may be made virtual at some time in the future. - IOReturn wireVirtual(IODirection forDirection); - void *createNamedEntry(); +/* + * DEPRECATED IOByteCount _positionAtIndex; // relative position within range #n + * + * Re-use the _positionAtIndex as a count of the number of pages in + * this memory descriptor. Convieniently vm_address_t is an unsigned integer + * type so I can get away without having to change the type. + */ + unsigned int _pages; + +/* DEPRECATED */ unsigned _positionAtOffset; //range #n in which position is now + + OSData *_memoryEntries; - // Internal - OSData * _memoryEntries; - unsigned int _pages; - ppnum_t _highestPage; - uint32_t __iomd_reservedA; - uint32_t __iomd_reservedB; - uint32_t __iomd_reservedC; + /* DEPRECATED */ vm_offset_t _kernPtrAligned; + /* DEPRECATED */ unsigned _kernPtrAtIndex; + /* DEPRECATED */ IOByteCount _kernSize; + + /* DEPRECATED */ virtual void mapIntoKernel(unsigned rangeIndex); + /* DEPRECATED */ virtual void unmapFromKernel(); public: /* @@ -791,7 +749,7 @@ public: UInt32 offset, task_t task, IOOptionBits options, - IOMapper * mapper = kIOMapperSystem); + IOMapper * mapper = 0); // Secondary initialisers virtual bool initWithAddress(void * address, @@ -819,11 +777,6 @@ public: IODirection withDirection, bool asReference = false); -#if !(defined(__ppc__) && defined(KPI_10_4_0_PPC_COMPAT)) - virtual addr64_t getPhysicalSegment64( IOByteCount offset, - IOByteCount * length ); -#endif - virtual IOPhysicalAddress getPhysicalSegment(IOByteCount offset, IOByteCount * length); @@ -900,11 +853,6 @@ protected: IOMemoryDescriptor::withRanges; IOMemoryDescriptor::withSubRange; -#if !(defined(__ppc__) && defined(KPI_10_4_0_PPC_COMPAT)) - // used by IODMACommand - virtual IOReturn dmaCommandOperation(DMACommandOps op, void *vData, UInt dataSize) const; -#endif - public: /* * Initialize or reinitialize an IOSubMemoryDescriptor to describe @@ -922,11 +870,6 @@ public: * IOMemoryDescriptor required methods */ -#if !(defined(__ppc__) && defined(KPI_10_4_0_PPC_COMPAT)) - virtual addr64_t getPhysicalSegment64( IOByteCount offset, - IOByteCount * length ); -#endif - virtual IOPhysicalAddress getPhysicalSegment(IOByteCount offset, IOByteCount * length);