IOFWPhysicalAddressSpace.h [plain text]
#ifndef _IOKIT_IOFWPHYSICALADDRESSSPACE_H
#define _IOKIT_IOFWPHYSICALADDRESSSPACE_H
#include <IOKit/firewire/IOFWAddressSpace.h>
#include <IOKit/IODMACommand.h>
class IOFWPhysicalAddressSpace;
struct FWSegment
{
FWAddress address;
UInt32 length;
};
#pragma mark -
class IOFWPhysicalAddressSpaceAux : public IOFWAddressSpaceAux
{
OSDeclareDefaultStructors(IOFWPhysicalAddressSpaceAux)
friend class IOFWAddressSpace;
friend class IOFWPhysicalAddressSpace;
protected:
struct ExpansionData { };
ExpansionData *reserved;
IODMACommand * fDMACommand;
bool fDMACommandPrepared;
public:
virtual bool init( IOFWAddressSpace * primary );
virtual void free();
void setDMACommand( IODMACommand * dma_command );
IODMACommand * getDMACommand( void );
UInt64 getPhysicalSegment( UInt64 offset, UInt64 * length );
IOReturn prepare( void );
IOReturn synchronize( IOOptionBits options );
IOReturn complete( void );
bool isPrepared( void );
IOReturn getSegments( UInt64 * offset, FWSegment * fw_segments, UInt32 * num_segments );
private:
OSMetaClassDeclareReservedUnused(IOFWPhysicalAddressSpaceAux, 0);
OSMetaClassDeclareReservedUnused(IOFWPhysicalAddressSpaceAux, 1);
OSMetaClassDeclareReservedUnused(IOFWPhysicalAddressSpaceAux, 2);
OSMetaClassDeclareReservedUnused(IOFWPhysicalAddressSpaceAux, 3);
OSMetaClassDeclareReservedUnused(IOFWPhysicalAddressSpaceAux, 4);
OSMetaClassDeclareReservedUnused(IOFWPhysicalAddressSpaceAux, 5);
OSMetaClassDeclareReservedUnused(IOFWPhysicalAddressSpaceAux, 6);
OSMetaClassDeclareReservedUnused(IOFWPhysicalAddressSpaceAux, 7);
OSMetaClassDeclareReservedUnused(IOFWPhysicalAddressSpaceAux, 8);
OSMetaClassDeclareReservedUnused(IOFWPhysicalAddressSpaceAux, 9);
};
#pragma mark -
class IOFWPhysicalAddressSpace : public IOFWAddressSpace
{
OSDeclareDefaultStructors(IOFWPhysicalAddressSpace)
friend class IOFWPhysicalAddressSpaceAux;
protected:
IOMemoryDescriptor * fMem; vm_size_t fLen;
virtual void free();
public:
virtual bool init( IOFireWireBus * bus );
virtual bool initWithDesc(IOFireWireBus *bus,
IOMemoryDescriptor *mem);
virtual UInt32 doRead(UInt16 nodeID, IOFWSpeed &speed, FWAddress addr, UInt32 len,
IOMemoryDescriptor **buf, IOByteCount * offset,
IOFWRequestRefCon refcon);
virtual UInt32 doWrite(UInt16 nodeID, IOFWSpeed &speed, FWAddress addr, UInt32 len,
const void *buf, IOFWRequestRefCon refcon);
IOMemoryDescriptor * getMemoryDescriptor( void );
IOReturn setMemoryDescriptor( IOMemoryDescriptor * descriptor );
UInt64 getLength( void );
inline void setDMACommand( IODMACommand * dma_command )
{ ((IOFWPhysicalAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->setDMACommand( dma_command ); };
inline IODMACommand * getDMACommand( void )
{ return ((IOFWPhysicalAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->getDMACommand(); };
virtual bool initWithDMACommand( IOFireWireBus * control, IODMACommand * command );
inline IOReturn prepare( void )
{ return ((IOFWPhysicalAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->prepare(); };
inline IOReturn synchronize( IOOptionBits options )
{ return ((IOFWPhysicalAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->synchronize( options ); };
inline IOReturn complete( void )
{ return ((IOFWPhysicalAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->complete(); };
inline bool isPrepared( void )
{ return ((IOFWPhysicalAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->isPrepared(); };
inline IOReturn getSegments( UInt64 * offset, FWSegment * fw_segments, UInt32 * num_segments )
{ return ((IOFWPhysicalAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->getSegments( offset, fw_segments, num_segments ); };
IOReturn checkMemoryInRange( IOMemoryDescriptor * memory );
protected:
UInt64 getPhysicalSegment( UInt64 offset, UInt64 * length )
{ return ((IOFWPhysicalAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->getPhysicalSegment( offset, length); };
virtual IOFWAddressSpaceAux * createAuxiliary( void );
};
#endif