Loading...
iokit/Kernel/IOInterleavedMemoryDescriptor.cpp xnu-3789.31.2 xnu-1228
--- xnu/xnu-3789.31.2/iokit/Kernel/IOInterleavedMemoryDescriptor.cpp
+++ xnu/xnu-1228/iokit/Kernel/IOInterleavedMemoryDescriptor.cpp
@@ -32,8 +32,65 @@
 #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(
-                                  IOByteCount           capacity,
+                                  UInt32                capacity,
                                   IODirection           direction )
 {
     //
@@ -55,8 +112,10 @@
     return me;
 }
 
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
 bool IOInterleavedMemoryDescriptor::initWithCapacity(
-                                  IOByteCount           capacity,
+                                  UInt32                capacity,
                                   IODirection           direction )
 {
     //
@@ -72,10 +131,7 @@
     
     // Initialize our minimal state.
 
-    _flags                  = direction;
-#ifndef __LP64__
-    _direction              = (IODirection) (_flags & kIOMemoryDirectionMask);
-#endif /* !__LP64__ */
+    _direction              = direction;
     _length                 = 0;
     _mappings               = 0;
     _tag                    = 0;
@@ -92,6 +148,8 @@
     return true;
 }
 
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
 void IOInterleavedMemoryDescriptor::clearMemoryDescriptors( IODirection direction )
 {
     UInt32 index;
@@ -99,7 +157,7 @@
     for ( index = 0; index < _descriptorCount; index++ )
     {
         if ( _descriptorPrepared )
-	    _descriptors[index]->complete(getDirection());
+	    _descriptors[index]->complete(_direction);
 
 	_descriptors[index]->release();
 	_descriptors[index] = 0;
@@ -109,12 +167,7 @@
     }
 
     if ( direction != kIODirectionNone )
-    {
-        _flags = (_flags & ~kIOMemoryDirectionMask) | direction;
-#ifndef __LP64__
-        _direction = (IODirection) (_flags & kIOMemoryDirectionMask);
-#endif /* !__LP64__ */
-    }
+        _direction = direction;
 
     _descriptorCount = 0;
     _length = 0;
@@ -123,6 +176,8 @@
 
 };
 
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
 bool IOInterleavedMemoryDescriptor::setMemoryDescriptor(
                                              IOMemoryDescriptor * descriptor,
 					     IOByteCount offset,
@@ -134,7 +189,7 @@
     if ( (offset + length) > descriptor->getLength() )
         return false;
 
-//    if ( descriptor->getDirection() != getDirection() )
+//    if ( descriptor->getDirection() != _direction )
 //        return false;
 
     descriptor->retain();
@@ -149,6 +204,8 @@
     return true;
 }
 
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
 void IOInterleavedMemoryDescriptor::free()
 {
     //
@@ -172,6 +229,8 @@
 
     super::free();
 }
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
 IOReturn IOInterleavedMemoryDescriptor::prepare(IODirection forDirection)
 {
@@ -189,7 +248,7 @@
 
     if ( forDirection == kIODirectionNone )
     {
-        forDirection = getDirection();
+        forDirection = _direction;
     }
 
     for ( index = 0; index < _descriptorCount; index++ ) 
@@ -212,6 +271,8 @@
     return status;
 }
 
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
 IOReturn IOInterleavedMemoryDescriptor::complete(IODirection forDirection)
 {
     //
@@ -227,7 +288,7 @@
 
     if ( forDirection == kIODirectionNone )
     {
-        forDirection = getDirection();
+        forDirection = _direction;
     }
 
     for ( unsigned index = 0; index < _descriptorCount; index++ ) 
@@ -242,10 +303,10 @@
     return statusFinal;
 }
 
-addr64_t IOInterleavedMemoryDescriptor::getPhysicalSegment( 
-                                                       IOByteCount   offset,
-                                                       IOByteCount * length,
-                                                       IOOptionBits  options )
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+addr64_t IOInterleavedMemoryDescriptor::getPhysicalSegment64( 
+				    IOByteCount   offset, IOByteCount * length )
 {
     //
     // This method returns the physical address of the byte at the given offset
@@ -261,7 +322,7 @@
     {
         if ( offset < _descriptorLengths[index] )
         {
-            pa = _descriptors[index]->getPhysicalSegment(_descriptorOffsets[index] + offset, length, options);
+            pa = _descriptors[index]->getPhysicalSegment64(_descriptorOffsets[index] + offset, length);
 	    if ((_descriptorLengths[index] - offset) < *length) *length = _descriptorLengths[index] - offset;
             return pa;
         }
@@ -272,3 +333,74 @@
 
     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(
+                                                       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]->getSourceSegment(_descriptorOffsets[index] + offset, length);
+	    if ((_descriptorLengths[index] - offset) < *length) *length = _descriptorLengths[index] - offset;
+            return pa;
+        }
+        offset -= _descriptorLengths[index];
+    }
+
+    if ( length )  *length = 0;
+
+    return 0;
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+void * IOInterleavedMemoryDescriptor::getVirtualSegment( IOByteCount   /* offset */ ,
+                                                   IOByteCount * /* length */ )
+{
+    return 0;
+}