aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/via_dma.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@starflyer.(none)>2005-11-12 05:52:46 -0500
committerDave Airlie <airlied@linux.ie>2005-11-12 05:52:46 -0500
commit925142431bd653175b80ae153bd7a8bc13628bde (patch)
tree594c1e65d3bf25b10961ea2b97dee5704b4f6cb5 /drivers/char/drm/via_dma.c
parent792d2b9a12594522111fbe2a7f17460a4d7edff7 (diff)
drm: update VIA driver to 2.7.2
Add PCI DMA blitengine to VIA DRM Add portability code for porting VIA to FreeBSD. Sync via_drm.h with 3d driver From: Thomas Hellstrom <unichrome@shipmail.org>, Eric Anholt <anholt@freebsd.org> Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char/drm/via_dma.c')
-rw-r--r--drivers/char/drm/via_dma.c36
1 files changed, 26 insertions, 10 deletions
diff --git a/drivers/char/drm/via_dma.c b/drivers/char/drm/via_dma.c
index d4b1766608b0..1acbeeb28069 100644
--- a/drivers/char/drm/via_dma.c
+++ b/drivers/char/drm/via_dma.c
@@ -213,7 +213,9 @@ static int via_initialize(drm_device_t * dev,
213 dev_priv->dma_wrap = init->size; 213 dev_priv->dma_wrap = init->size;
214 dev_priv->dma_offset = init->offset; 214 dev_priv->dma_offset = init->offset;
215 dev_priv->last_pause_ptr = NULL; 215 dev_priv->last_pause_ptr = NULL;
216 dev_priv->hw_addr_ptr = dev_priv->mmio->handle + init->reg_pause_addr; 216 dev_priv->hw_addr_ptr =
217 (volatile uint32_t *)((char *)dev_priv->mmio->handle +
218 init->reg_pause_addr);
217 219
218 via_cmdbuf_start(dev_priv); 220 via_cmdbuf_start(dev_priv);
219 221
@@ -232,13 +234,13 @@ int via_dma_init(DRM_IOCTL_ARGS)
232 234
233 switch (init.func) { 235 switch (init.func) {
234 case VIA_INIT_DMA: 236 case VIA_INIT_DMA:
235 if (!capable(CAP_SYS_ADMIN)) 237 if (!DRM_SUSER(DRM_CURPROC))
236 retcode = DRM_ERR(EPERM); 238 retcode = DRM_ERR(EPERM);
237 else 239 else
238 retcode = via_initialize(dev, dev_priv, &init); 240 retcode = via_initialize(dev, dev_priv, &init);
239 break; 241 break;
240 case VIA_CLEANUP_DMA: 242 case VIA_CLEANUP_DMA:
241 if (!capable(CAP_SYS_ADMIN)) 243 if (!DRM_SUSER(DRM_CURPROC))
242 retcode = DRM_ERR(EPERM); 244 retcode = DRM_ERR(EPERM);
243 else 245 else
244 retcode = via_dma_cleanup(dev); 246 retcode = via_dma_cleanup(dev);
@@ -349,9 +351,6 @@ int via_cmdbuffer(DRM_IOCTL_ARGS)
349 return 0; 351 return 0;
350} 352}
351 353
352extern int
353via_parse_command_stream(drm_device_t * dev, const uint32_t * buf,
354 unsigned int size);
355static int via_dispatch_pci_cmdbuffer(drm_device_t * dev, 354static int via_dispatch_pci_cmdbuffer(drm_device_t * dev,
356 drm_via_cmdbuffer_t * cmd) 355 drm_via_cmdbuffer_t * cmd)
357{ 356{
@@ -450,9 +449,9 @@ static int via_hook_segment(drm_via_private_t * dev_priv,
450 if ((count <= 8) && (count >= 0)) { 449 if ((count <= 8) && (count >= 0)) {
451 uint32_t rgtr, ptr; 450 uint32_t rgtr, ptr;
452 rgtr = *(dev_priv->hw_addr_ptr); 451 rgtr = *(dev_priv->hw_addr_ptr);
453 ptr = ((char *)dev_priv->last_pause_ptr - dev_priv->dma_ptr) + 452 ptr = ((volatile char *)dev_priv->last_pause_ptr -
454 dev_priv->dma_offset + (uint32_t) dev_priv->agpAddr + 4 - 453 dev_priv->dma_ptr) + dev_priv->dma_offset +
455 CMDBUF_ALIGNMENT_SIZE; 454 (uint32_t) dev_priv->agpAddr + 4 - CMDBUF_ALIGNMENT_SIZE;
456 if (rgtr <= ptr) { 455 if (rgtr <= ptr) {
457 DRM_ERROR 456 DRM_ERROR
458 ("Command regulator\npaused at count %d, address %x, " 457 ("Command regulator\npaused at count %d, address %x, "
@@ -472,7 +471,7 @@ static int via_hook_segment(drm_via_private_t * dev_priv,
472 && count--) ; 471 && count--) ;
473 472
474 rgtr = *(dev_priv->hw_addr_ptr); 473 rgtr = *(dev_priv->hw_addr_ptr);
475 ptr = ((char *)paused_at - dev_priv->dma_ptr) + 474 ptr = ((volatile char *)paused_at - dev_priv->dma_ptr) +
476 dev_priv->dma_offset + (uint32_t) dev_priv->agpAddr + 4; 475 dev_priv->dma_offset + (uint32_t) dev_priv->agpAddr + 4;
477 476
478 ptr_low = (ptr > 3 * CMDBUF_ALIGNMENT_SIZE) ? 477 ptr_low = (ptr > 3 * CMDBUF_ALIGNMENT_SIZE) ?
@@ -724,3 +723,20 @@ int via_cmdbuf_size(DRM_IOCTL_ARGS)
724 sizeof(d_siz)); 723 sizeof(d_siz));
725 return ret; 724 return ret;
726} 725}
726
727drm_ioctl_desc_t via_ioctls[] = {
728 [DRM_IOCTL_NR(DRM_VIA_ALLOCMEM)] = {via_mem_alloc, 1, 0},
729 [DRM_IOCTL_NR(DRM_VIA_FREEMEM)] = {via_mem_free, 1, 0},
730 [DRM_IOCTL_NR(DRM_VIA_AGP_INIT)] = {via_agp_init, 1, 0},
731 [DRM_IOCTL_NR(DRM_VIA_FB_INIT)] = {via_fb_init, 1, 0},
732 [DRM_IOCTL_NR(DRM_VIA_MAP_INIT)] = {via_map_init, 1, 0},
733 [DRM_IOCTL_NR(DRM_VIA_DEC_FUTEX)] = {via_decoder_futex, 1, 0},
734 [DRM_IOCTL_NR(DRM_VIA_DMA_INIT)] = {via_dma_init, 1, 0},
735 [DRM_IOCTL_NR(DRM_VIA_CMDBUFFER)] = {via_cmdbuffer, 1, 0},
736 [DRM_IOCTL_NR(DRM_VIA_FLUSH)] = {via_flush_ioctl, 1, 0},
737 [DRM_IOCTL_NR(DRM_VIA_PCICMD)] = {via_pci_cmdbuffer, 1, 0},
738 [DRM_IOCTL_NR(DRM_VIA_CMDBUF_SIZE)] = {via_cmdbuf_size, 1, 0},
739 [DRM_IOCTL_NR(DRM_VIA_WAIT_IRQ)] = {via_wait_irq, 1, 0}
740};
741
742int via_max_ioctl = DRM_ARRAY_SIZE(via_ioctls);