#define super IOMemoryDescriptor
OSDefineMetaClassAndStructors(IOInterleavedMemoryDescriptor, IOMemoryDescriptor)
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-bool IOInterleavedMemoryDescriptor::initWithAddress(
- void * /* address */ ,
- IOByteCount /* withLength */ ,
- IODirection /* withDirection */ )
-{
- return false;
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-bool IOInterleavedMemoryDescriptor::initWithAddress(
- vm_address_t /* address */ ,
- IOByteCount /* withLength */ ,
- IODirection /* withDirection */ ,
- task_t /* withTask */ )
-{
- return false;
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-bool IOInterleavedMemoryDescriptor::initWithPhysicalAddress(
- IOPhysicalAddress /* address */ ,
- IOByteCount /* withLength */ ,
- IODirection /* withDirection */ )
-{
- return false;
-}
-
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-bool IOInterleavedMemoryDescriptor::initWithPhysicalRanges(
- IOPhysicalRange * /* ranges */ ,
- UInt32 /* withCount */ ,
- IODirection /* withDirection */ ,
- bool /* asReference */ )
-{
- return false;
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-bool IOInterleavedMemoryDescriptor::initWithRanges(
- IOVirtualRange * /* ranges */ ,
- UInt32 /* withCount */ ,
- IODirection /* withDirection */ ,
- task_t /* withTask */ ,
- bool /* asReference */ )
-{
- return false;
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
IOInterleavedMemoryDescriptor * IOInterleavedMemoryDescriptor::withCapacity(
- UInt32 capacity,
+ IOByteCount capacity,
IODirection direction )
{
//
return me;
}
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
bool IOInterleavedMemoryDescriptor::initWithCapacity(
- UInt32 capacity,
+ IOByteCount capacity,
IODirection direction )
{
//
// Initialize our minimal state.
- _direction = direction;
+ _flags = direction;
+#ifndef __LP64__
+ _direction = (IODirection) (_flags & kIOMemoryDirectionMask);
+#endif /* !__LP64__ */
_length = 0;
_mappings = 0;
_tag = 0;
return true;
}
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
void IOInterleavedMemoryDescriptor::clearMemoryDescriptors( IODirection direction )
{
UInt32 index;
for ( index = 0; index < _descriptorCount; index++ )
{
if ( _descriptorPrepared )
- _descriptors[index]->complete(_direction);
+ _descriptors[index]->complete(getDirection());
_descriptors[index]->release();
_descriptors[index] = 0;
}
if ( direction != kIODirectionNone )
- _direction = direction;
+ {
+ _flags = (_flags & ~kIOMemoryDirectionMask) | direction;
+#ifndef __LP64__
+ _direction = (IODirection) (_flags & kIOMemoryDirectionMask);
+#endif /* !__LP64__ */
+ }
_descriptorCount = 0;
_length = 0;
};
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
bool IOInterleavedMemoryDescriptor::setMemoryDescriptor(
IOMemoryDescriptor * descriptor,
IOByteCount offset,
if ( (offset + length) > descriptor->getLength() )
return false;
-// if ( descriptor->getDirection() != _direction )
+// if ( descriptor->getDirection() != getDirection() )
// return false;
descriptor->retain();
return true;
}
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
void IOInterleavedMemoryDescriptor::free()
{
//
super::free();
}
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
IOReturn IOInterleavedMemoryDescriptor::prepare(IODirection forDirection)
{
//
if ( forDirection == kIODirectionNone )
{
- forDirection = _direction;
+ forDirection = getDirection();
}
for ( index = 0; index < _descriptorCount; index++ )
return status;
}
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
IOReturn IOInterleavedMemoryDescriptor::complete(IODirection forDirection)
{
//
if ( forDirection == kIODirectionNone )
{
- forDirection = _direction;
+ forDirection = getDirection();
}
for ( unsigned index = 0; index < _descriptorCount; index++ )
return statusFinal;
}
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-addr64_t IOInterleavedMemoryDescriptor::getPhysicalSegment64(
- IOByteCount offset, IOByteCount * length )
-{
- //
- // 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.
- //
-
- addr64_t pa;
-
- assert(offset <= _length);
-
- for ( unsigned index = 0; index < _descriptorCount; index++ )
- {
- if ( offset < _descriptorLengths[index] )
- {
- pa = _descriptors[index]->getPhysicalSegment64(_descriptorOffsets[index] + offset, length);
- if ((_descriptorLengths[index] - offset) < *length) *length = _descriptorLengths[index] - offset;
- return pa;
- }
- offset -= _descriptorLengths[index];
- }
-
- if ( length ) *length = 0;
-
- return 0;
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-IOPhysicalAddress IOInterleavedMemoryDescriptor::getPhysicalSegment(
- IOByteCount offset, IOByteCount * length )
-{
- //
- // 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.
- //
-
- IOPhysicalAddress pa;
-
- assert(offset <= _length);
-
- for ( unsigned index = 0; index < _descriptorCount; index++ )
- {
- if ( offset < _descriptorLengths[index] )
- {
- pa = _descriptors[index]->getPhysicalSegment(_descriptorOffsets[index] + offset, length);
- if ((_descriptorLengths[index] - offset) < *length) *length = _descriptorLengths[index] - offset;
- return pa;
- }
- offset -= _descriptorLengths[index];
- }
-
- if ( length ) *length = 0;
-
- return 0;
-}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-IOPhysicalAddress IOInterleavedMemoryDescriptor::getSourceSegment(
+addr64_t IOInterleavedMemoryDescriptor::getPhysicalSegment(
IOByteCount offset,
- IOByteCount * length )
+ IOByteCount * length,
+ IOOptionBits options )
{
//
// This method returns the physical address of the byte at the given offset
// segment from that offset.
//
- IOPhysicalAddress pa;
+ addr64_t pa;
assert(offset <= _length);
{
if ( offset < _descriptorLengths[index] )
{
- pa = _descriptors[index]->getSourceSegment(_descriptorOffsets[index] + offset, length);
+ pa = _descriptors[index]->getPhysicalSegment(_descriptorOffsets[index] + offset, length, options);
if ((_descriptorLengths[index] - offset) < *length) *length = _descriptorLengths[index] - offset;
return pa;
}
return 0;
}
-
-// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-void * IOInterleavedMemoryDescriptor::getVirtualSegment( IOByteCount /* offset */ ,
- IOByteCount * /* length */ )
-{
- return 0;
-}