OSArray * IODeviceMemory::arrayFromList( InitElement list[], IOItemCount count ) { OSArray * array; IODeviceMemory * range; IOItemCount i; array = OSArray::withCapacity( count ); if( 0 == array ) return( 0); for( i = 0; i < count; i++) { range = IODeviceMemory::withRange( list[i].start, list[i].length ); if( range) { range->setTag( list[i].tag ); array->setObject( range); range->release(); } else { array->release(); array = 0; break; } } return( array ); }
/*! @function getApertureRange @abstract Return reference to IODeviceMemory object representing memory range of framebuffer. @discussion IOFramebuffer subclasses must implement this method to describe the memory used by the framebuffer in the current mode. The OS will map this memory range into user space for client access - the range should only include vram memory not hardware registers. how is the connection specified? @param aperture The system will only access the aperture kIOFBSystemAperture. @result an IODeviceMemory instance. A reference will be consumed by the caller for each call of this method - the implementatation should create a new instance of IODeviceMemory for each call, or return one instance with a retain for each call. */ IODeviceMemory * com_doequalsglory_driver_IOProxyFramebuffer::getApertureRange(IOPixelAperture aper) { #if defined(DEBUG_CALLS) IOLog(kDebugStr "getApertureRange(%p)\n", aper); #endif if (fCurrentDisplayMode == 0) { return NULL; } if (aper != kIOFBSystemAperture) { return NULL; } IODeviceMemory *deviceMemory = getVRAMRange(); if (deviceMemory == NULL) { return NULL; } IODeviceMemory *apertureRange = IODeviceMemory::withSubRange(deviceMemory, 0, getApertureSize(fCurrentDisplayMode, fCurrentDepth)); deviceMemory->release(); // since getNVRAMRange() does a retain() return apertureRange; }