FreeBSD/sys/dev/drm2/radeon/radeon_gart.c
/**
 * radeon_gart_unbind - unbind pages from the gart page table
 *
 * @rdev: radeon_device pointer
 * @offset: offset into the GPU's gart aperture
 * @pages: number of pages to unbind
 *
 * Unbinds the requested pages from the gart page table and
 * replaces them with the dummy page (all asics).
 */
unbind pages from the gart page table
@rdev: radeon_device pointer
@offset: offset into the GPU's gart aperture
@pages: number of pages to unbind

Unbinds the requested pages from the gart page table and
replaces them with the dummy page (all asics).
unbind pages from the gart page table @rdev : radeon_device pointer @offset : offset into the GPU ' s gart aperture @pages : number of pages to unbind Unbinds the requested pages from the gart page table and replaces them with the dummy page ( all asics ) .
void radeon_gart_unbind(struct radeon_device *rdev, unsigned offset,
			int pages)
{
	unsigned t;
	unsigned p;
	int i, j;
	u64 page_base;
	if (!rdev->gart.ready) {
		DRM_ERROR("trying to unbind memory from uninitialized GART !\n");
		return;
	}
	t = offset / RADEON_GPU_PAGE_SIZE;
	p = t / (PAGE_SIZE / RADEON_GPU_PAGE_SIZE);
	for (i = 0; i < pages; i++, p++) {
		if (rdev->gart.pages[p]) {
			rdev->gart.pages[p] = NULL;
			rdev->gart.pages_addr[p] = rdev->dummy_page.addr;
			page_base = rdev->gart.pages_addr[p];
			for (j = 0; j < (PAGE_SIZE / RADEON_GPU_PAGE_SIZE); j++, t++) {
				if (rdev->gart.ptr) {
					radeon_gart_set_page(rdev, t, page_base);
				}
				page_base += RADEON_GPU_PAGE_SIZE;
			}
		}
	}
	mb();
	radeon_gart_tlb_flush(rdev);
}
void radeon_gart_unbind ( struct radeon_device * rdev , unsigned offset , int pages ) { unsigned t ; unsigned p ; int i , j ; u64 page_base ; if ( ! rdev -> gart . ready ) { DRM_ERROR ( " \n " ) ; return ; } t = offset / RADEON_GPU_PAGE_SIZE ; p = t / ( PAGE_SIZE / RADEON_GPU_PAGE_SIZE ) ; for ( i = 0 ; i < pages ; i ++ , p ++ ) { if ( rdev -> gart . pages [ p ] ) { rdev -> gart . pages [ p ] = NULL ; rdev -> gart . pages_addr [ p ] = rdev -> dummy_page . addr ; page_base = rdev -> gart . pages_addr [ p ] ; for ( j = 0 ; j < ( PAGE_SIZE / RADEON_GPU_PAGE_SIZE ) ; j ++ , t ++ ) { if ( rdev -> gart . ptr ) { radeon_gart_set_page ( rdev , t , page_base ) ; } page_base += RADEON_GPU_PAGE_SIZE ; } } } mb ( ) ; radeon_gart_tlb_flush ( rdev ) ; }
radeon_gart_unbind - unbind pages from the gart page table
 @rdev: radeon_device pointer
 @offset: offset into the GPU's gart aperture
 @pages: number of pages to unbind
radeon_gart_unbind - unbind pages from the gart page table @rdev : radeon_device pointer @offset : offset into the GPU ' s gart aperture @pages : number of pages to unbind