aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/drm_pci.c')
-rw-r--r--drivers/gpu/drm/drm_pci.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index 80c0b2b29801..1f96cee6eee8 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -52,10 +52,8 @@
52drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t align) 52drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t align)
53{ 53{
54 drm_dma_handle_t *dmah; 54 drm_dma_handle_t *dmah;
55#if 1
56 unsigned long addr; 55 unsigned long addr;
57 size_t sz; 56 size_t sz;
58#endif
59 57
60 /* pci_alloc_consistent only guarantees alignment to the smallest 58 /* pci_alloc_consistent only guarantees alignment to the smallest
61 * PAGE_SIZE order which is greater than or equal to the requested size. 59 * PAGE_SIZE order which is greater than or equal to the requested size.
@@ -97,10 +95,8 @@ EXPORT_SYMBOL(drm_pci_alloc);
97 */ 95 */
98void __drm_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah) 96void __drm_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah)
99{ 97{
100#if 1
101 unsigned long addr; 98 unsigned long addr;
102 size_t sz; 99 size_t sz;
103#endif
104 100
105 if (dmah->vaddr) { 101 if (dmah->vaddr) {
106 /* XXX - Is virt_to_page() legal for consistent mem? */ 102 /* XXX - Is virt_to_page() legal for consistent mem? */
@@ -276,17 +272,26 @@ static int drm_pci_agp_init(struct drm_device *dev)
276 DRM_ERROR("Cannot initialize the agpgart module.\n"); 272 DRM_ERROR("Cannot initialize the agpgart module.\n");
277 return -EINVAL; 273 return -EINVAL;
278 } 274 }
279 if (drm_core_has_MTRR(dev)) { 275 if (dev->agp) {
280 if (dev->agp) 276 dev->agp->agp_mtrr = arch_phys_wc_add(
281 dev->agp->agp_mtrr = arch_phys_wc_add( 277 dev->agp->agp_info.aper_base,
282 dev->agp->agp_info.aper_base, 278 dev->agp->agp_info.aper_size *
283 dev->agp->agp_info.aper_size * 279 1024 * 1024);
284 1024 * 1024);
285 } 280 }
286 } 281 }
287 return 0; 282 return 0;
288} 283}
289 284
285static void drm_pci_agp_destroy(struct drm_device *dev)
286{
287 if (drm_core_has_AGP(dev) && dev->agp) {
288 arch_phys_wc_del(dev->agp->agp_mtrr);
289 drm_agp_clear(dev);
290 drm_agp_destroy(dev->agp);
291 dev->agp = NULL;
292 }
293}
294
290static struct drm_bus drm_pci_bus = { 295static struct drm_bus drm_pci_bus = {
291 .bus_type = DRIVER_BUS_PCI, 296 .bus_type = DRIVER_BUS_PCI,
292 .get_irq = drm_pci_get_irq, 297 .get_irq = drm_pci_get_irq,
@@ -295,6 +300,7 @@ static struct drm_bus drm_pci_bus = {
295 .set_unique = drm_pci_set_unique, 300 .set_unique = drm_pci_set_unique,
296 .irq_by_busid = drm_pci_irq_by_busid, 301 .irq_by_busid = drm_pci_irq_by_busid,
297 .agp_init = drm_pci_agp_init, 302 .agp_init = drm_pci_agp_init,
303 .agp_destroy = drm_pci_agp_destroy,
298}; 304};
299 305
300/** 306/**
@@ -348,6 +354,12 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
348 goto err_g2; 354 goto err_g2;
349 } 355 }
350 356
357 if (drm_core_check_feature(dev, DRIVER_RENDER) && drm_rnodes) {
358 ret = drm_get_minor(dev, &dev->render, DRM_MINOR_RENDER);
359 if (ret)
360 goto err_g21;
361 }
362
351 if ((ret = drm_get_minor(dev, &dev->primary, DRM_MINOR_LEGACY))) 363 if ((ret = drm_get_minor(dev, &dev->primary, DRM_MINOR_LEGACY)))
352 goto err_g3; 364 goto err_g3;
353 365
@@ -377,6 +389,9 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
377err_g4: 389err_g4:
378 drm_put_minor(&dev->primary); 390 drm_put_minor(&dev->primary);
379err_g3: 391err_g3:
392 if (dev->render)
393 drm_put_minor(&dev->render);
394err_g21:
380 if (drm_core_check_feature(dev, DRIVER_MODESET)) 395 if (drm_core_check_feature(dev, DRIVER_MODESET))
381 drm_put_minor(&dev->control); 396 drm_put_minor(&dev->control);
382err_g2: 397err_g2: