diff options
Diffstat (limited to 'drivers/char/drm/i915_dma.c')
-rw-r--r-- | drivers/char/drm/i915_dma.c | 65 |
1 files changed, 38 insertions, 27 deletions
diff --git a/drivers/char/drm/i915_dma.c b/drivers/char/drm/i915_dma.c index 34f552f90c4a..f0bb0bdbb6e2 100644 --- a/drivers/char/drm/i915_dma.c +++ b/drivers/char/drm/i915_dma.c | |||
@@ -85,14 +85,14 @@ static int i915_dma_cleanup(drm_device_t * dev) | |||
85 | * is freed, it's too late. | 85 | * is freed, it's too late. |
86 | */ | 86 | */ |
87 | if (dev->irq) | 87 | if (dev->irq) |
88 | drm_irq_uninstall (dev); | 88 | drm_irq_uninstall(dev); |
89 | 89 | ||
90 | if (dev->dev_private) { | 90 | if (dev->dev_private) { |
91 | drm_i915_private_t *dev_priv = | 91 | drm_i915_private_t *dev_priv = |
92 | (drm_i915_private_t *) dev->dev_private; | 92 | (drm_i915_private_t *) dev->dev_private; |
93 | 93 | ||
94 | if (dev_priv->ring.virtual_start) { | 94 | if (dev_priv->ring.virtual_start) { |
95 | drm_core_ioremapfree( &dev_priv->ring.map, dev); | 95 | drm_core_ioremapfree(&dev_priv->ring.map, dev); |
96 | } | 96 | } |
97 | 97 | ||
98 | if (dev_priv->status_page_dmah) { | 98 | if (dev_priv->status_page_dmah) { |
@@ -101,8 +101,8 @@ static int i915_dma_cleanup(drm_device_t * dev) | |||
101 | I915_WRITE(0x02080, 0x1ffff000); | 101 | I915_WRITE(0x02080, 0x1ffff000); |
102 | } | 102 | } |
103 | 103 | ||
104 | drm_free (dev->dev_private, sizeof(drm_i915_private_t), | 104 | drm_free(dev->dev_private, sizeof(drm_i915_private_t), |
105 | DRM_MEM_DRIVER); | 105 | DRM_MEM_DRIVER); |
106 | 106 | ||
107 | dev->dev_private = NULL; | 107 | dev->dev_private = NULL; |
108 | } | 108 | } |
@@ -146,7 +146,7 @@ static int i915_initialize(drm_device_t * dev, | |||
146 | dev_priv->ring.map.flags = 0; | 146 | dev_priv->ring.map.flags = 0; |
147 | dev_priv->ring.map.mtrr = 0; | 147 | dev_priv->ring.map.mtrr = 0; |
148 | 148 | ||
149 | drm_core_ioremap( &dev_priv->ring.map, dev ); | 149 | drm_core_ioremap(&dev_priv->ring.map, dev); |
150 | 150 | ||
151 | if (dev_priv->ring.map.handle == NULL) { | 151 | if (dev_priv->ring.map.handle == NULL) { |
152 | dev->dev_private = (void *)dev_priv; | 152 | dev->dev_private = (void *)dev_priv; |
@@ -243,8 +243,8 @@ static int i915_dma_init(DRM_IOCTL_ARGS) | |||
243 | 243 | ||
244 | switch (init.func) { | 244 | switch (init.func) { |
245 | case I915_INIT_DMA: | 245 | case I915_INIT_DMA: |
246 | dev_priv = drm_alloc (sizeof(drm_i915_private_t), | 246 | dev_priv = drm_alloc(sizeof(drm_i915_private_t), |
247 | DRM_MEM_DRIVER); | 247 | DRM_MEM_DRIVER); |
248 | if (dev_priv == NULL) | 248 | if (dev_priv == NULL) |
249 | return DRM_ERR(ENOMEM); | 249 | return DRM_ERR(ENOMEM); |
250 | retcode = i915_initialize(dev, dev_priv, &init); | 250 | retcode = i915_initialize(dev, dev_priv, &init); |
@@ -297,7 +297,7 @@ static int do_validate_cmd(int cmd) | |||
297 | case 0x1c: | 297 | case 0x1c: |
298 | return 1; | 298 | return 1; |
299 | case 0x1d: | 299 | case 0x1d: |
300 | switch ((cmd>>16)&0xff) { | 300 | switch ((cmd >> 16) & 0xff) { |
301 | case 0x3: | 301 | case 0x3: |
302 | return (cmd & 0x1f) + 2; | 302 | return (cmd & 0x1f) + 2; |
303 | case 0x4: | 303 | case 0x4: |
@@ -699,35 +699,46 @@ static int i915_setparam(DRM_IOCTL_ARGS) | |||
699 | return 0; | 699 | return 0; |
700 | } | 700 | } |
701 | 701 | ||
702 | void i915_driver_pretakedown(drm_device_t *dev) | 702 | void i915_driver_pretakedown(drm_device_t * dev) |
703 | { | 703 | { |
704 | if ( dev->dev_private ) { | 704 | if (dev->dev_private) { |
705 | drm_i915_private_t *dev_priv = dev->dev_private; | 705 | drm_i915_private_t *dev_priv = dev->dev_private; |
706 | i915_mem_takedown( &(dev_priv->agp_heap) ); | 706 | i915_mem_takedown(&(dev_priv->agp_heap)); |
707 | } | 707 | } |
708 | i915_dma_cleanup( dev ); | 708 | i915_dma_cleanup(dev); |
709 | } | 709 | } |
710 | 710 | ||
711 | void i915_driver_prerelease(drm_device_t *dev, DRMFILE filp) | 711 | void i915_driver_prerelease(drm_device_t * dev, DRMFILE filp) |
712 | { | 712 | { |
713 | if ( dev->dev_private ) { | 713 | if (dev->dev_private) { |
714 | drm_i915_private_t *dev_priv = dev->dev_private; | 714 | drm_i915_private_t *dev_priv = dev->dev_private; |
715 | i915_mem_release( dev, filp, dev_priv->agp_heap ); | 715 | i915_mem_release(dev, filp, dev_priv->agp_heap); |
716 | } | 716 | } |
717 | } | 717 | } |
718 | 718 | ||
719 | drm_ioctl_desc_t i915_ioctls[] = { | 719 | drm_ioctl_desc_t i915_ioctls[] = { |
720 | [DRM_IOCTL_NR(DRM_I915_INIT)] = {i915_dma_init, 1, 1}, | 720 | [DRM_IOCTL_NR(DRM_I915_INIT)] = {i915_dma_init, 1, 1} |
721 | [DRM_IOCTL_NR(DRM_I915_FLUSH)] = {i915_flush_ioctl, 1, 0}, | 721 | , |
722 | [DRM_IOCTL_NR(DRM_I915_FLIP)] = {i915_flip_bufs, 1, 0}, | 722 | [DRM_IOCTL_NR(DRM_I915_FLUSH)] = {i915_flush_ioctl, 1, 0} |
723 | [DRM_IOCTL_NR(DRM_I915_BATCHBUFFER)] = {i915_batchbuffer, 1, 0}, | 723 | , |
724 | [DRM_IOCTL_NR(DRM_I915_IRQ_EMIT)] = {i915_irq_emit, 1, 0}, | 724 | [DRM_IOCTL_NR(DRM_I915_FLIP)] = {i915_flip_bufs, 1, 0} |
725 | [DRM_IOCTL_NR(DRM_I915_IRQ_WAIT)] = {i915_irq_wait, 1, 0}, | 725 | , |
726 | [DRM_IOCTL_NR(DRM_I915_GETPARAM)] = {i915_getparam, 1, 0}, | 726 | [DRM_IOCTL_NR(DRM_I915_BATCHBUFFER)] = {i915_batchbuffer, 1, 0} |
727 | [DRM_IOCTL_NR(DRM_I915_SETPARAM)] = {i915_setparam, 1, 1}, | 727 | , |
728 | [DRM_IOCTL_NR(DRM_I915_ALLOC)] = {i915_mem_alloc, 1, 0}, | 728 | [DRM_IOCTL_NR(DRM_I915_IRQ_EMIT)] = {i915_irq_emit, 1, 0} |
729 | [DRM_IOCTL_NR(DRM_I915_FREE)] = {i915_mem_free, 1, 0}, | 729 | , |
730 | [DRM_IOCTL_NR(DRM_I915_INIT_HEAP)] = {i915_mem_init_heap, 1, 1}, | 730 | [DRM_IOCTL_NR(DRM_I915_IRQ_WAIT)] = {i915_irq_wait, 1, 0} |
731 | , | ||
732 | [DRM_IOCTL_NR(DRM_I915_GETPARAM)] = {i915_getparam, 1, 0} | ||
733 | , | ||
734 | [DRM_IOCTL_NR(DRM_I915_SETPARAM)] = {i915_setparam, 1, 1} | ||
735 | , | ||
736 | [DRM_IOCTL_NR(DRM_I915_ALLOC)] = {i915_mem_alloc, 1, 0} | ||
737 | , | ||
738 | [DRM_IOCTL_NR(DRM_I915_FREE)] = {i915_mem_free, 1, 0} | ||
739 | , | ||
740 | [DRM_IOCTL_NR(DRM_I915_INIT_HEAP)] = {i915_mem_init_heap, 1, 1} | ||
741 | , | ||
731 | [DRM_IOCTL_NR(DRM_I915_CMDBUFFER)] = {i915_cmdbuffer, 1, 0} | 742 | [DRM_IOCTL_NR(DRM_I915_CMDBUFFER)] = {i915_cmdbuffer, 1, 0} |
732 | }; | 743 | }; |
733 | 744 | ||