aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/drm2/radeon/radeon_ttm.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/drm2/radeon/radeon_ttm.c')
-rw-r--r--sys/dev/drm2/radeon/radeon_ttm.c42
1 files changed, 13 insertions, 29 deletions
diff --git a/sys/dev/drm2/radeon/radeon_ttm.c b/sys/dev/drm2/radeon/radeon_ttm.c
index f4ac1787bf5a..abfe774f77fb 100644
--- a/sys/dev/drm2/radeon/radeon_ttm.c
+++ b/sys/dev/drm2/radeon/radeon_ttm.c
@@ -561,13 +561,13 @@ static struct ttm_tt *radeon_ttm_tt_create(struct ttm_bo_device *bdev,
rdev = radeon_get_rdev(bdev);
#if __OS_HAS_AGP
if (rdev->flags & RADEON_IS_AGP) {
- return ttm_agp_tt_create(bdev, rdev->ddev->agp->agpdev,
+ return ttm_agp_tt_create(bdev, rdev->ddev->agp->bridge,
size, page_flags, dummy_read_page);
}
#endif
gtt = malloc(sizeof(struct radeon_ttm_tt),
- DRM_MEM_DRIVER, M_WAITOK | M_ZERO);
+ DRM_MEM_DRIVER, M_NOWAIT | M_ZERO);
if (gtt == NULL) {
return NULL;
}
@@ -586,25 +586,21 @@ static int radeon_ttm_tt_populate(struct ttm_tt *ttm)
struct radeon_ttm_tt *gtt = (void *)ttm;
unsigned i;
int r;
-#ifdef DUMBBELL_WIP
+#ifdef FREEBSD_WIP
bool slave = !!(ttm->page_flags & TTM_PAGE_FLAG_SG);
-#endif /* DUMBBELL_WIP */
+#endif /* FREEBSD_WIP */
if (ttm->state != tt_unpopulated)
return 0;
-#ifdef DUMBBELL_WIP
- /*
- * Maybe unneeded on FreeBSD.
- * -- dumbbell@
- */
+#ifdef FREEBSD_WIP
if (slave && ttm->sg) {
drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,
gtt->ttm.dma_address, ttm->num_pages);
ttm->state = tt_unbound;
return 0;
}
-#endif /* DUMBBELL_WIP */
+#endif /* FREEBSD_WIP */
rdev = radeon_get_rdev(ttm->bdev);
#if __OS_HAS_AGP
@@ -626,7 +622,7 @@ static int radeon_ttm_tt_populate(struct ttm_tt *ttm)
for (i = 0; i < ttm->num_pages; i++) {
gtt->ttm.dma_address[i] = VM_PAGE_TO_PHYS(ttm->pages[i]);
-#ifdef DUMBBELL_WIP
+#ifdef FREEBSD_WIP
gtt->ttm.dma_address[i] = pci_map_page(rdev->pdev, ttm->pages[i],
0, PAGE_SIZE,
PCI_DMA_BIDIRECTIONAL);
@@ -639,7 +635,7 @@ static int radeon_ttm_tt_populate(struct ttm_tt *ttm)
ttm_pool_unpopulate(ttm);
return -EFAULT;
}
-#endif /* DUMBBELL_WIP */
+#endif /* FREEBSD_WIP */
}
return 0;
}
@@ -672,10 +668,10 @@ static void radeon_ttm_tt_unpopulate(struct ttm_tt *ttm)
for (i = 0; i < ttm->num_pages; i++) {
if (gtt->ttm.dma_address[i]) {
gtt->ttm.dma_address[i] = 0;
-#ifdef DUMBBELL_WIP
+#ifdef FREEBSD_WIP
pci_unmap_page(rdev->pdev, gtt->ttm.dma_address[i],
PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
-#endif /* DUMBBELL_WIP */
+#endif /* FREEBSD_WIP */
}
}
@@ -704,7 +700,7 @@ static struct ttm_bo_driver radeon_bo_driver = {
int radeon_ttm_init(struct radeon_device *rdev)
{
- int r, r2;
+ int r;
r = radeon_ttm_global_init(rdev);
if (r) {
@@ -750,12 +746,6 @@ int radeon_ttm_init(struct radeon_device *rdev)
rdev->mc.gtt_size >> PAGE_SHIFT);
if (r) {
DRM_ERROR("Failed initializing GTT heap.\n");
- r2 = radeon_bo_reserve(rdev->stollen_vga_memory, false);
- if (likely(r2 == 0)) {
- radeon_bo_unpin(rdev->stollen_vga_memory);
- radeon_bo_unreserve(rdev->stollen_vga_memory);
- }
- radeon_bo_unref(&rdev->stollen_vga_memory);
return r;
}
DRM_INFO("radeon: %uM of GTT memory ready.\n",
@@ -764,12 +754,6 @@ int radeon_ttm_init(struct radeon_device *rdev)
r = radeon_ttm_debugfs_init(rdev);
if (r) {
DRM_ERROR("Failed to init debugfs\n");
- r2 = radeon_bo_reserve(rdev->stollen_vga_memory, false);
- if (likely(r2 == 0)) {
- radeon_bo_unpin(rdev->stollen_vga_memory);
- radeon_bo_unreserve(rdev->stollen_vga_memory);
- }
- radeon_bo_unref(&rdev->stollen_vga_memory);
return r;
}
return 0;
@@ -812,7 +796,7 @@ void radeon_ttm_set_active_vram_size(struct radeon_device *rdev, u64 size)
man->size = size >> PAGE_SHIFT;
}
-#ifdef DUMBBELL_WIP
+#ifdef FREEBSD_WIP
static struct vm_operations_struct radeon_ttm_vm_ops;
static const struct vm_operations_struct *ttm_vm_ops = NULL;
@@ -860,7 +844,7 @@ int radeon_mmap(struct file *filp, struct vm_area_struct *vma)
vma->vm_ops = &radeon_ttm_vm_ops;
return 0;
}
-#endif /* DUMBBELL_WIP */
+#endif /* FREEBSD_WIP */
#define RADEON_DEBUGFS_MEM_TYPES 2