#include <pexpert/device_tree.h>
+typedef UInt32 dtptr_t;
+
#include <machine/machine_routines.h>
extern "C" {
const OSSymbol * gIODTCompatibleKey;
const OSSymbol * gIODTTypeKey;
const OSSymbol * gIODTModelKey;
+const OSSymbol * gIODTTargetTypeKey;
const OSSymbol * gIODTSizeCellKey;
const OSSymbol * gIODTAddressCellKey;
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" );
{
IORegistryEntry *chosen;
OSData *propObj;
- unsigned int *propPtr;
+ dtptr_t *propPtr;
unsigned int propSize;
chosen = IORegistryEntry::fromPath( "/chosen/memory-map", gIODTPlane );
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]);
}
cIter = OSCollectionIterator::withCollection( result);
- result->release();
+ if (result) result->release();
return( cIter);
}