X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/fe8ab488e9161c46dd9885d58fc52996dc0249ff..7e41aa883dd258f888d0470250eead40a53ef1f5:/iokit/Kernel/IODeviceTreeSupport.cpp?ds=sidebyside diff --git a/iokit/Kernel/IODeviceTreeSupport.cpp b/iokit/Kernel/IODeviceTreeSupport.cpp index 6533ed937..ce4a65ef7 100644 --- a/iokit/Kernel/IODeviceTreeSupport.cpp +++ b/iokit/Kernel/IODeviceTreeSupport.cpp @@ -37,6 +37,8 @@ #include +typedef UInt32 dtptr_t; + #include extern "C" { @@ -61,6 +63,7 @@ const OSSymbol * gIODTUnitKey; const OSSymbol * gIODTCompatibleKey; const OSSymbol * gIODTTypeKey; const OSSymbol * gIODTModelKey; +const OSSymbol * gIODTTargetTypeKey; const OSSymbol * gIODTSizeCellKey; const OSSymbol * gIODTAddressCellKey; @@ -106,6 +109,7 @@ IODeviceTreeAlloc( void * dtTop ) gIODTCompatibleKey = OSSymbol::withCStringNoCopy( "compatible" ); gIODTTypeKey = OSSymbol::withCStringNoCopy( "device_type" ); gIODTModelKey = OSSymbol::withCStringNoCopy( "model" ); + gIODTTargetTypeKey = OSSymbol::withCStringNoCopy( "target-type" ); gIODTSizeCellKey = OSSymbol::withCStringNoCopy( "#size-cells" ); gIODTAddressCellKey = OSSymbol::withCStringNoCopy( "#address-cells" ); gIODTRangeKey = OSSymbol::withCStringNoCopy( "ranges" ); @@ -251,7 +255,7 @@ int IODTGetLoaderInfo( const char *key, void **infoAddr, int *infoSize ) { IORegistryEntry *chosen; OSData *propObj; - unsigned int *propPtr; + dtptr_t *propPtr; unsigned int propSize; chosen = IORegistryEntry::fromPath( "/chosen/memory-map", gIODTPlane ); @@ -261,9 +265,9 @@ int IODTGetLoaderInfo( const char *key, void **infoAddr, int *infoSize ) if ( propObj == 0 ) return -1; propSize = propObj->getLength(); - if ( propSize != (2 * sizeof(UInt32)) ) return -1; + if ( propSize != (2 * sizeof(dtptr_t)) ) return -1; - propPtr = (unsigned int *)propObj->getBytesNoCopy(); + propPtr = (dtptr_t *)propObj->getBytesNoCopy(); if ( propPtr == 0 ) return -1; *infoAddr = (void *)(uintptr_t) (propPtr[0]); @@ -898,7 +902,7 @@ OSCollectionIterator * IODTFindMatchingEntries( IORegistryEntry * from, } cIter = OSCollectionIterator::withCollection( result); - result->release(); + if (result) result->release(); return( cIter); }