aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorJerome Glisse <jglisse@redhat.com>2010-04-07 06:21:27 -0400
committerDave Airlie <airlied@redhat.com>2010-04-20 00:13:09 -0400
commit0c321c79627189204d7d0bf65ab19f5ac419abed (patch)
tree9df52ae46164bdca3dab6a36d5ec17360c60b9e4 /drivers/gpu/drm
parent96bf8b8778976a6e6a4fe4e6e0421d8ed7892798 (diff)
drm/ttm: remove io_ field from TTM V6
All TTM driver have been converted to new io_mem_reserve/free interface which allow driver to choose and return proper io base, offset to core TTM for ioremapping if necessary. This patch remove what is now deadcode. V2 adapt to match with change in first patch of the patchset V3 update after io_mem_reserve/io_mem_free callback balancing V4 adjust to minor cleanup V5 remove the needs ioremap flag V6 keep the ioremapping facility in TTM [airlied- squashed driver removals in here also] Signed-off-by: Jerome Glisse <jglisse@redhat.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_bo.c11
-rw-r--r--drivers/gpu/drm/radeon/radeon_ttm.c13
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c22
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo_util.c19
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c6
5 files changed, 5 insertions, 66 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index 288c2ecd937a..34be1924218f 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -390,13 +390,6 @@ nouveau_bo_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
390 man->available_caching = TTM_PL_FLAG_UNCACHED | 390 man->available_caching = TTM_PL_FLAG_UNCACHED |
391 TTM_PL_FLAG_WC; 391 TTM_PL_FLAG_WC;
392 man->default_caching = TTM_PL_FLAG_WC; 392 man->default_caching = TTM_PL_FLAG_WC;
393
394 man->io_addr = NULL;
395 man->io_offset = drm_get_resource_start(dev, 1);
396 man->io_size = drm_get_resource_len(dev, 1);
397 if (man->io_size > nouveau_mem_fb_amount(dev))
398 man->io_size = nouveau_mem_fb_amount(dev);
399
400 man->gpu_offset = dev_priv->vm_vram_base; 393 man->gpu_offset = dev_priv->vm_vram_base;
401 break; 394 break;
402 case TTM_PL_TT: 395 case TTM_PL_TT:
@@ -417,10 +410,6 @@ nouveau_bo_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
417 dev_priv->gart_info.type); 410 dev_priv->gart_info.type);
418 return -EINVAL; 411 return -EINVAL;
419 } 412 }
420
421 man->io_offset = dev_priv->gart_info.aper_base;
422 man->io_size = dev_priv->gart_info.aper_size;
423 man->io_addr = NULL;
424 man->gpu_offset = dev_priv->vm_gart_base; 413 man->gpu_offset = dev_priv->vm_gart_base;
425 break; 414 break;
426 default: 415 default:
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
index 62b4b800e0a3..91030eab22b0 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -161,21 +161,13 @@ static int radeon_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
161 (unsigned)type); 161 (unsigned)type);
162 return -EINVAL; 162 return -EINVAL;
163 } 163 }
164 man->io_offset = rdev->mc.agp_base;
165 man->io_size = rdev->mc.gtt_size;
166 man->io_addr = NULL;
167 if (!rdev->ddev->agp->cant_use_aperture) 164 if (!rdev->ddev->agp->cant_use_aperture)
168 man->flags = TTM_MEMTYPE_FLAG_MAPPABLE; 165 man->flags = TTM_MEMTYPE_FLAG_MAPPABLE;
169 man->available_caching = TTM_PL_FLAG_UNCACHED | 166 man->available_caching = TTM_PL_FLAG_UNCACHED |
170 TTM_PL_FLAG_WC; 167 TTM_PL_FLAG_WC;
171 man->default_caching = TTM_PL_FLAG_WC; 168 man->default_caching = TTM_PL_FLAG_WC;
172 } else
173#endif
174 {
175 man->io_offset = 0;
176 man->io_size = 0;
177 man->io_addr = NULL;
178 } 169 }
170#endif
179 break; 171 break;
180 case TTM_PL_VRAM: 172 case TTM_PL_VRAM:
181 /* "On-card" video ram */ 173 /* "On-card" video ram */
@@ -184,9 +176,6 @@ static int radeon_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
184 TTM_MEMTYPE_FLAG_MAPPABLE; 176 TTM_MEMTYPE_FLAG_MAPPABLE;
185 man->available_caching = TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_WC; 177 man->available_caching = TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_WC;
186 man->default_caching = TTM_PL_FLAG_WC; 178 man->default_caching = TTM_PL_FLAG_WC;
187 man->io_addr = NULL;
188 man->io_offset = rdev->mc.aper_base;
189 man->io_size = rdev->mc.aper_size;
190 break; 179 break;
191 default: 180 default:
192 DRM_ERROR("Unsupported memory type %u\n", (unsigned)type); 181 DRM_ERROR("Unsupported memory type %u\n", (unsigned)type);
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index b42e3fae1bd5..3b5b094b1397 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -79,8 +79,6 @@ static void ttm_mem_type_debug(struct ttm_bo_device *bdev, int mem_type)
79 printk(KERN_ERR TTM_PFX " use_type: %d\n", man->use_type); 79 printk(KERN_ERR TTM_PFX " use_type: %d\n", man->use_type);
80 printk(KERN_ERR TTM_PFX " flags: 0x%08X\n", man->flags); 80 printk(KERN_ERR TTM_PFX " flags: 0x%08X\n", man->flags);
81 printk(KERN_ERR TTM_PFX " gpu_offset: 0x%08lX\n", man->gpu_offset); 81 printk(KERN_ERR TTM_PFX " gpu_offset: 0x%08lX\n", man->gpu_offset);
82 printk(KERN_ERR TTM_PFX " io_offset: 0x%08lX\n", man->io_offset);
83 printk(KERN_ERR TTM_PFX " io_size: %ld\n", man->io_size);
84 printk(KERN_ERR TTM_PFX " size: %llu\n", man->size); 82 printk(KERN_ERR TTM_PFX " size: %llu\n", man->size);
85 printk(KERN_ERR TTM_PFX " available_caching: 0x%08X\n", 83 printk(KERN_ERR TTM_PFX " available_caching: 0x%08X\n",
86 man->available_caching); 84 man->available_caching);
@@ -1563,26 +1561,6 @@ bool ttm_mem_reg_is_pci(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem)
1563 return true; 1561 return true;
1564} 1562}
1565 1563
1566int ttm_bo_pci_offset(struct ttm_bo_device *bdev,
1567 struct ttm_mem_reg *mem,
1568 unsigned long *bus_base,
1569 unsigned long *bus_offset, unsigned long *bus_size)
1570{
1571 struct ttm_mem_type_manager *man = &bdev->man[mem->mem_type];
1572
1573 *bus_size = 0;
1574 if (!(man->flags & TTM_MEMTYPE_FLAG_MAPPABLE))
1575 return -EINVAL;
1576
1577 if (ttm_mem_reg_is_pci(bdev, mem)) {
1578 *bus_offset = mem->mm_node->start << PAGE_SHIFT;
1579 *bus_size = mem->num_pages << PAGE_SHIFT;
1580 *bus_base = man->io_offset + (uintptr_t)man->io_addr;
1581 }
1582
1583 return 0;
1584}
1585
1586void ttm_bo_unmap_virtual(struct ttm_buffer_object *bo) 1564void ttm_bo_unmap_virtual(struct ttm_buffer_object *bo)
1587{ 1565{
1588 struct ttm_bo_device *bdev = bo->bdev; 1566 struct ttm_bo_device *bdev = bo->bdev;
diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index d58eeb5ed22b..333b401ca4c9 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -83,24 +83,13 @@ EXPORT_SYMBOL(ttm_bo_move_ttm);
83 83
84int ttm_mem_io_reserve(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem) 84int ttm_mem_io_reserve(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem)
85{ 85{
86 struct ttm_mem_type_manager *man = &bdev->man[mem->mem_type];
87 int ret; 86 int ret;
88 87
89 if (bdev->driver->io_mem_reserve) { 88 if (!mem->bus.io_reserved) {
90 if (!mem->bus.io_reserved) { 89 mem->bus.io_reserved = true;
91 mem->bus.io_reserved = true; 90 ret = bdev->driver->io_mem_reserve(bdev, mem);
92 ret = bdev->driver->io_mem_reserve(bdev, mem);
93 if (unlikely(ret != 0))
94 return ret;
95 }
96 } else {
97 ret = ttm_bo_pci_offset(bdev, mem, &mem->bus.base, &mem->bus.offset, &mem->bus.size);
98 if (unlikely(ret != 0)) 91 if (unlikely(ret != 0))
99 return ret; 92 return ret;
100 mem->bus.addr = NULL;
101 if (!(man->flags & TTM_MEMTYPE_FLAG_NEEDS_IOREMAP))
102 mem->bus.addr = (void *)(((u8 *)man->io_addr) + mem->bus.offset);
103 mem->bus.is_iomem = (mem->bus.size > 0) ? 1 : 0;
104 } 93 }
105 return 0; 94 return 0;
106} 95}
@@ -149,7 +138,7 @@ void ttm_mem_reg_iounmap(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem,
149 138
150 man = &bdev->man[mem->mem_type]; 139 man = &bdev->man[mem->mem_type];
151 140
152 if (virtual && (man->flags & TTM_MEMTYPE_FLAG_NEEDS_IOREMAP || mem->bus.addr == NULL)) 141 if (virtual && mem->bus.addr == NULL)
153 iounmap(virtual); 142 iounmap(virtual);
154 ttm_mem_io_free(bdev, mem); 143 ttm_mem_io_free(bdev, mem);
155} 144}
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c b/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c
index f3558968fdff..c4f5114aee7c 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c
@@ -137,9 +137,6 @@ int vmw_invalidate_caches(struct ttm_bo_device *bdev, uint32_t flags)
137int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, 137int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
138 struct ttm_mem_type_manager *man) 138 struct ttm_mem_type_manager *man)
139{ 139{
140 struct vmw_private *dev_priv =
141 container_of(bdev, struct vmw_private, bdev);
142
143 switch (type) { 140 switch (type) {
144 case TTM_PL_SYSTEM: 141 case TTM_PL_SYSTEM:
145 /* System memory */ 142 /* System memory */
@@ -151,10 +148,7 @@ int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
151 case TTM_PL_VRAM: 148 case TTM_PL_VRAM:
152 /* "On-card" video ram */ 149 /* "On-card" video ram */
153 man->gpu_offset = 0; 150 man->gpu_offset = 0;
154 man->io_offset = dev_priv->vram_start;
155 man->io_size = dev_priv->vram_size;
156 man->flags = TTM_MEMTYPE_FLAG_FIXED | TTM_MEMTYPE_FLAG_MAPPABLE; 151 man->flags = TTM_MEMTYPE_FLAG_FIXED | TTM_MEMTYPE_FLAG_MAPPABLE;
157 man->io_addr = NULL;
158 man->available_caching = TTM_PL_MASK_CACHING; 152 man->available_caching = TTM_PL_MASK_CACHING;
159 man->default_caching = TTM_PL_FLAG_WC; 153 man->default_caching = TTM_PL_FLAG_WC;
160 break; 154 break;