- OSArray * array;
- IODeviceMemory * range;
-
- parentEntry = regEntry->getParentEntry( gIODTPlane );
- addressProperty = (OSData *) regEntry->getProperty( addressPropertyName );
- if( (0 == addressProperty) || (0 == parentEntry))
- return( 0);
-
- IODTGetCellCounts( parentEntry, &sizeCells, &addressCells );
- if( 0 == sizeCells)
- return( 0);
-
- cells = sizeCells + addressCells;
- reg = (UInt32 *) addressProperty->getBytesNoCopy();
- num = addressProperty->getLength() / (4 * cells);
-
- array = OSArray::withCapacity( 1 );
- if( 0 == array)
- return( 0);
-
- for( i = 0; i < num; i++) {
-
- if( IODTResolveAddressCell( parentEntry, reg, &phys, &len )) {
-
- range = 0;
- if( parent)
- range = IODeviceMemory::withSubRange( parent,
- phys - parent->getPhysicalAddress(), len );
- if( 0 == range)
- range = IODeviceMemory::withRange( phys, len );
- if( range)
- array->setObject( range );
- }
- reg += cells;
- }
-
- regEntry->setProperty( gIODeviceMemoryKey, array);
- array->release(); /* ??? */
-
- return( array);
-}
-
-static void IODTGetNVLocation(
- IORegistryEntry * parent,
- IORegistryEntry * regEntry,
- UInt8 * busNum, UInt8 * deviceNum, UInt8 * functionNum )
-{
-
- OSData * prop;
- IODTPersistent * persist;
- UInt32 * cell;
-
- prop = (OSData *) parent->getProperty( gIODTPersistKey );
- if( prop) {
- persist = (IODTPersistent *) prop->getBytesNoCopy();
- (*persist->locationFunc)( regEntry, busNum, deviceNum, functionNum );
+ OSArray *array;
+ IODeviceMemory *range;
+
+ array = 0;
+ do
+ {
+ parentEntry = regEntry->copyParentEntry( gIODTPlane );
+ addressProperty = (OSData *) regEntry->getProperty( addressPropertyName );
+ if( (0 == addressProperty) || (0 == parentEntry)) break;
+
+ IODTGetCellCounts( parentEntry, &sizeCells, &addressCells );
+ if( 0 == sizeCells) break;
+
+ cells = sizeCells + addressCells;
+ reg = (UInt32 *) addressProperty->getBytesNoCopy();
+ num = addressProperty->getLength() / (4 * cells);
+
+ array = OSArray::withCapacity( 1 );
+ if( 0 == array) break;
+
+ for( i = 0; i < num; i++) {
+ if( IODTResolveAddressCell( parentEntry, reg, &phys, &len )) {
+ range = 0;
+ if( parent)
+ range = IODeviceMemory::withSubRange( parent,
+ phys - parent->getPhysicalSegment(0, 0, kIOMemoryMapperNone), len );
+ if( 0 == range)
+ range = IODeviceMemory::withRange( phys, len );
+ if( range)
+ array->setObject( range );
+ }
+ reg += cells;
+ }