IOBufferMemoryDescriptor.h [plain text]
#ifndef _IOBUFFERMEMORYDESCRIPTOR_H
#define _IOBUFFERMEMORYDESCRIPTOR_H
#include <IOKit/IOMemoryDescriptor.h>
enum {
kIOMemoryDirectionMask = 0x0000000f,
kIOMemoryPhysicallyContiguous = 0x00000010,
kIOMemoryPageable = 0x00000020,
kIOMemorySharingTypeMask = 0x000f0000,
kIOMemoryUnshared = 0x00000000,
kIOMemoryKernelUserShared = 0x00010000,
};
class IOBufferMemoryDescriptor : public IOGeneralMemoryDescriptor
{
OSDeclareDefaultStructors(IOBufferMemoryDescriptor);
protected:
struct ExpansionData { };
ExpansionData * reserved;
protected:
void * _buffer;
vm_size_t _capacity;
vm_offset_t _alignment;
IOOptionBits _options;
IOPhysicalAddress * _physAddrs;
unsigned _physSegCount;
private:
OSMetaClassDeclareReservedUnused(IOBufferMemoryDescriptor, 0);
OSMetaClassDeclareReservedUnused(IOBufferMemoryDescriptor, 1);
OSMetaClassDeclareReservedUnused(IOBufferMemoryDescriptor, 2);
OSMetaClassDeclareReservedUnused(IOBufferMemoryDescriptor, 3);
OSMetaClassDeclareReservedUnused(IOBufferMemoryDescriptor, 4);
OSMetaClassDeclareReservedUnused(IOBufferMemoryDescriptor, 5);
OSMetaClassDeclareReservedUnused(IOBufferMemoryDescriptor, 6);
OSMetaClassDeclareReservedUnused(IOBufferMemoryDescriptor, 7);
OSMetaClassDeclareReservedUnused(IOBufferMemoryDescriptor, 8);
OSMetaClassDeclareReservedUnused(IOBufferMemoryDescriptor, 9);
OSMetaClassDeclareReservedUnused(IOBufferMemoryDescriptor, 10);
OSMetaClassDeclareReservedUnused(IOBufferMemoryDescriptor, 11);
OSMetaClassDeclareReservedUnused(IOBufferMemoryDescriptor, 12);
OSMetaClassDeclareReservedUnused(IOBufferMemoryDescriptor, 13);
OSMetaClassDeclareReservedUnused(IOBufferMemoryDescriptor, 14);
OSMetaClassDeclareReservedUnused(IOBufferMemoryDescriptor, 15);
protected:
virtual void free();
virtual bool initWithAddress( void * address,
IOByteCount withLength,
IODirection withDirection );
virtual bool initWithAddress( vm_address_t address,
IOByteCount withLength,
IODirection withDirection,
task_t withTask );
virtual bool initWithPhysicalAddress(
IOPhysicalAddress address,
IOByteCount withLength,
IODirection withDirection );
virtual bool initWithPhysicalRanges(
IOPhysicalRange * ranges,
UInt32 withCount,
IODirection withDirection,
bool asReference = false );
virtual bool initWithRanges( IOVirtualRange * ranges,
UInt32 withCount,
IODirection withDirection,
task_t withTask,
bool asReference = false );
IOGeneralMemoryDescriptor::withAddress;
IOGeneralMemoryDescriptor::withPhysicalAddress;
IOGeneralMemoryDescriptor::withPhysicalRanges;
IOGeneralMemoryDescriptor::withRanges;
IOGeneralMemoryDescriptor::withSubRange;
public:
virtual bool initWithOptions( IOOptionBits options,
vm_size_t capacity,
vm_offset_t alignment);
static IOBufferMemoryDescriptor * withOptions( IOOptionBits options,
vm_size_t capacity,
vm_offset_t alignment = 1);
static IOBufferMemoryDescriptor * withCapacity(
vm_size_t capacity,
IODirection withDirection,
bool withContiguousMemory = false);
virtual bool initWithBytes(const void * bytes,
vm_size_t withLength,
IODirection withDirection,
bool withContiguousMemory = false);
static IOBufferMemoryDescriptor * withBytes(
const void * bytes,
vm_size_t withLength,
IODirection withDirection,
bool withContiguousMemory = false);
virtual void setLength(vm_size_t length);
virtual void setDirection(IODirection direction);
virtual vm_size_t getCapacity() const;
virtual void *getBytesNoCopy();
virtual void *getBytesNoCopy(vm_size_t start, vm_size_t withLength);
virtual bool appendBytes(const void *bytes, vm_size_t withLength);
virtual IOPhysicalAddress getPhysicalSegment(IOByteCount offset,
IOByteCount * length);
};
#endif