Lines Matching refs:rdev

71 int radeon_gart_table_ram_alloc(struct radeon_device *rdev)  in radeon_gart_table_ram_alloc()  argument
75 ptr = dma_alloc_coherent(&rdev->pdev->dev, rdev->gart.table_size, in radeon_gart_table_ram_alloc()
76 &rdev->gart.table_addr, GFP_KERNEL); in radeon_gart_table_ram_alloc()
81 if (rdev->family == CHIP_RS400 || rdev->family == CHIP_RS480 || in radeon_gart_table_ram_alloc()
82 rdev->family == CHIP_RS690 || rdev->family == CHIP_RS740) { in radeon_gart_table_ram_alloc()
84 rdev->gart.table_size >> PAGE_SHIFT); in radeon_gart_table_ram_alloc()
87 rdev->gart.ptr = ptr; in radeon_gart_table_ram_alloc()
100 void radeon_gart_table_ram_free(struct radeon_device *rdev) in radeon_gart_table_ram_free() argument
102 if (!rdev->gart.ptr) in radeon_gart_table_ram_free()
106 if (rdev->family == CHIP_RS400 || rdev->family == CHIP_RS480 || in radeon_gart_table_ram_free()
107 rdev->family == CHIP_RS690 || rdev->family == CHIP_RS740) { in radeon_gart_table_ram_free()
108 set_memory_wb((unsigned long)rdev->gart.ptr, in radeon_gart_table_ram_free()
109 rdev->gart.table_size >> PAGE_SHIFT); in radeon_gart_table_ram_free()
112 dma_free_coherent(&rdev->pdev->dev, rdev->gart.table_size, in radeon_gart_table_ram_free()
113 (void *)rdev->gart.ptr, rdev->gart.table_addr); in radeon_gart_table_ram_free()
114 rdev->gart.ptr = NULL; in radeon_gart_table_ram_free()
115 rdev->gart.table_addr = 0; in radeon_gart_table_ram_free()
128 int radeon_gart_table_vram_alloc(struct radeon_device *rdev) in radeon_gart_table_vram_alloc() argument
132 if (rdev->gart.robj == NULL) { in radeon_gart_table_vram_alloc()
133 r = radeon_bo_create(rdev, rdev->gart.table_size, in radeon_gart_table_vram_alloc()
135 0, NULL, NULL, &rdev->gart.robj); in radeon_gart_table_vram_alloc()
152 int radeon_gart_table_vram_pin(struct radeon_device *rdev) in radeon_gart_table_vram_pin() argument
157 r = radeon_bo_reserve(rdev->gart.robj, false); in radeon_gart_table_vram_pin()
160 r = radeon_bo_pin(rdev->gart.robj, in radeon_gart_table_vram_pin()
163 radeon_bo_unreserve(rdev->gart.robj); in radeon_gart_table_vram_pin()
166 r = radeon_bo_kmap(rdev->gart.robj, &rdev->gart.ptr); in radeon_gart_table_vram_pin()
168 radeon_bo_unpin(rdev->gart.robj); in radeon_gart_table_vram_pin()
169 radeon_bo_unreserve(rdev->gart.robj); in radeon_gart_table_vram_pin()
170 rdev->gart.table_addr = gpu_addr; in radeon_gart_table_vram_pin()
178 for (i = 0; i < rdev->gart.num_gpu_pages; i++) in radeon_gart_table_vram_pin()
179 radeon_gart_set_page(rdev, i, rdev->gart.pages_entry[i]); in radeon_gart_table_vram_pin()
181 radeon_gart_tlb_flush(rdev); in radeon_gart_table_vram_pin()
195 void radeon_gart_table_vram_unpin(struct radeon_device *rdev) in radeon_gart_table_vram_unpin() argument
199 if (!rdev->gart.robj) in radeon_gart_table_vram_unpin()
202 r = radeon_bo_reserve(rdev->gart.robj, false); in radeon_gart_table_vram_unpin()
204 radeon_bo_kunmap(rdev->gart.robj); in radeon_gart_table_vram_unpin()
205 radeon_bo_unpin(rdev->gart.robj); in radeon_gart_table_vram_unpin()
206 radeon_bo_unreserve(rdev->gart.robj); in radeon_gart_table_vram_unpin()
207 rdev->gart.ptr = NULL; in radeon_gart_table_vram_unpin()
220 void radeon_gart_table_vram_free(struct radeon_device *rdev) in radeon_gart_table_vram_free() argument
222 if (!rdev->gart.robj) in radeon_gart_table_vram_free()
225 radeon_bo_unref(&rdev->gart.robj); in radeon_gart_table_vram_free()
241 void radeon_gart_unbind(struct radeon_device *rdev, unsigned int offset, in radeon_gart_unbind() argument
247 if (!rdev->gart.ready) { in radeon_gart_unbind()
254 if (rdev->gart.pages[p]) { in radeon_gart_unbind()
255 rdev->gart.pages[p] = NULL; in radeon_gart_unbind()
257 rdev->gart.pages_entry[t] = rdev->dummy_page.entry; in radeon_gart_unbind()
258 if (rdev->gart.ptr) { in radeon_gart_unbind()
259 radeon_gart_set_page(rdev, t, in radeon_gart_unbind()
260 rdev->dummy_page.entry); in radeon_gart_unbind()
265 if (rdev->gart.ptr) { in radeon_gart_unbind()
267 radeon_gart_tlb_flush(rdev); in radeon_gart_unbind()
285 int radeon_gart_bind(struct radeon_device *rdev, unsigned int offset, in radeon_gart_bind() argument
293 if (!rdev->gart.ready) { in radeon_gart_bind()
301 rdev->gart.pages[p] = pagelist ? pagelist[i] : in radeon_gart_bind()
302 rdev->dummy_page.page; in radeon_gart_bind()
306 rdev->gart.pages_entry[t] = page_entry; in radeon_gart_bind()
307 if (rdev->gart.ptr) in radeon_gart_bind()
308 radeon_gart_set_page(rdev, t, page_entry); in radeon_gart_bind()
313 if (rdev->gart.ptr) { in radeon_gart_bind()
315 radeon_gart_tlb_flush(rdev); in radeon_gart_bind()
328 int radeon_gart_init(struct radeon_device *rdev) in radeon_gart_init() argument
332 if (rdev->gart.pages) in radeon_gart_init()
340 r = radeon_dummy_page_init(rdev); in radeon_gart_init()
344 rdev->gart.num_cpu_pages = rdev->mc.gtt_size / PAGE_SIZE; in radeon_gart_init()
345 rdev->gart.num_gpu_pages = rdev->mc.gtt_size / RADEON_GPU_PAGE_SIZE; in radeon_gart_init()
347 rdev->gart.num_cpu_pages, rdev->gart.num_gpu_pages); in radeon_gart_init()
349 rdev->gart.pages = vzalloc(array_size(sizeof(void *), in radeon_gart_init()
350 rdev->gart.num_cpu_pages)); in radeon_gart_init()
351 if (rdev->gart.pages == NULL) { in radeon_gart_init()
352 radeon_gart_fini(rdev); in radeon_gart_init()
355 rdev->gart.pages_entry = vmalloc(array_size(sizeof(uint64_t), in radeon_gart_init()
356 rdev->gart.num_gpu_pages)); in radeon_gart_init()
357 if (rdev->gart.pages_entry == NULL) { in radeon_gart_init()
358 radeon_gart_fini(rdev); in radeon_gart_init()
362 for (i = 0; i < rdev->gart.num_gpu_pages; i++) in radeon_gart_init()
363 rdev->gart.pages_entry[i] = rdev->dummy_page.entry; in radeon_gart_init()
374 void radeon_gart_fini(struct radeon_device *rdev) in radeon_gart_fini() argument
376 if (rdev->gart.ready) { in radeon_gart_fini()
378 radeon_gart_unbind(rdev, 0, rdev->gart.num_cpu_pages); in radeon_gart_fini()
380 rdev->gart.ready = false; in radeon_gart_fini()
381 vfree(rdev->gart.pages); in radeon_gart_fini()
382 vfree(rdev->gart.pages_entry); in radeon_gart_fini()
383 rdev->gart.pages = NULL; in radeon_gart_fini()
384 rdev->gart.pages_entry = NULL; in radeon_gart_fini()
386 radeon_dummy_page_fini(rdev); in radeon_gart_fini()