]> git.saurik.com Git - apple/xnu.git/blobdiff - iokit/Kernel/IORegistryEntry.cpp
xnu-3789.21.4.tar.gz
[apple/xnu.git] / iokit / Kernel / IORegistryEntry.cpp
index 7af40d2932f5ede5b19d9cae7ced380b99f4296a..f07b4231805428004c7417c315a87b4d645e3730 100644 (file)
 #include <libkern/c++/OSContainers.h>
 #include <IOKit/IOService.h>
 #include <IOKit/IOKitKeys.h>
+#include <IOKit/IOTimeStamp.h>
 
 #include <IOKit/IOLib.h>
 
 #include <IOKit/assert.h>
 
+#include "IOKitKernelInternal.h"
+
 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 #define super OSObject
@@ -821,6 +824,19 @@ void IORegistryEntry::setName( const OSSymbol * name,
         else
             key = gIONameKey;
 
+        if (gIOKitTrace && reserved && reserved->fRegistryEntryID)
+        {
+            uint64_t str_id = 0;
+            uint64_t __unused regID = getRegistryEntryID();
+            kernel_debug_string(IODBG_IOREGISTRY(IOREGISTRYENTRY_NAME_STRING), &str_id, name->getCStringNoCopy());
+            KERNEL_DEBUG_CONSTANT(IODBG_IOREGISTRY(IOREGISTRYENTRY_NAME),
+                (uintptr_t) regID,
+                (uintptr_t) (regID >> 32),
+                (uintptr_t) str_id,
+                (uintptr_t) (str_id >> 32),
+                0);
+        }
+
        WLOCK;
         registryTable()->setObject( key, (OSObject *) name);
        UNLOCK;
@@ -1668,6 +1684,7 @@ bool IORegistryEntry::attachToParent( IORegistryEntry * parent,
     OSArray *  links;
     bool       ret;
     bool       needParent;
+    bool        traceName = false;
 
     if( this == parent)
        return( false );
@@ -1675,7 +1692,10 @@ bool IORegistryEntry::attachToParent( IORegistryEntry * parent,
     WLOCK;
 
     if (!reserved->fRegistryEntryID)
+    {
        reserved->fRegistryEntryID = ++gIORegistryLastID;
+       traceName = (0 != gIOKitTrace);
+    }
 
     ret = makeLink( parent, kParentSetIndex, plane );
 
@@ -1686,6 +1706,19 @@ bool IORegistryEntry::attachToParent( IORegistryEntry * parent,
 
     UNLOCK;
 
+    if (traceName)
+    {
+        uint64_t str_id = 0;
+        uint64_t __unused regID = getRegistryEntryID();
+        kernel_debug_string(IODBG_IOREGISTRY(IOREGISTRYENTRY_NAME_STRING), &str_id, getName());
+        KERNEL_DEBUG_CONSTANT(IODBG_IOREGISTRY(IOREGISTRYENTRY_NAME),
+            (uintptr_t) regID,
+            (uintptr_t) (regID >> 32),
+            (uintptr_t) str_id,
+            (uintptr_t) (str_id >> 32),
+            0);
+    }
+
     PLOCK;
 
     // Mark any collections in the property list as immutable