via_drv.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
  3. * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining a
  6. * copy of this software and associated documentation files (the "Software"),
  7. * to deal in the Software without restriction, including without limitation
  8. * the rights to use, copy, modify, merge, publish, distribute, sub license,
  9. * and/or sell copies of the Software, and to permit persons to whom the
  10. * Software is furnished to do so, subject to the following conditions:
  11. *
  12. * The above copyright notice and this permission notice (including the
  13. * next paragraph) shall be included in all copies or substantial portions
  14. * of the Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
  19. * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
  20. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  21. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  22. * DEALINGS IN THE SOFTWARE.
  23. */
  24. #ifndef _VIA_DRV_H_
  25. #define _VIA_DRV_H_
  26. #define DRIVER_AUTHOR "VIA"
  27. #define DRIVER_NAME "via"
  28. #define DRIVER_DESC "VIA Unichrome / Pro"
  29. #define DRIVER_DATE "20050523"
  30. #define DRIVER_MAJOR 2
  31. #define DRIVER_MINOR 6
  32. #define DRIVER_PATCHLEVEL 3
  33. #include "via_verifier.h"
  34. #define VIA_PCI_BUF_SIZE 60000
  35. #define VIA_FIRE_BUF_SIZE 1024
  36. #define VIA_NUM_IRQS 2
  37. typedef struct drm_via_ring_buffer {
  38. drm_map_t map;
  39. char *virtual_start;
  40. } drm_via_ring_buffer_t;
  41. typedef uint32_t maskarray_t[5];
  42. typedef struct drm_via_irq {
  43. atomic_t irq_received;
  44. uint32_t pending_mask;
  45. uint32_t enable_mask;
  46. wait_queue_head_t irq_queue;
  47. } drm_via_irq_t;
  48. typedef struct drm_via_private {
  49. drm_via_sarea_t *sarea_priv;
  50. drm_map_t *sarea;
  51. drm_map_t *fb;
  52. drm_map_t *mmio;
  53. unsigned long agpAddr;
  54. wait_queue_head_t decoder_queue[VIA_NR_XVMC_LOCKS];
  55. char *dma_ptr;
  56. unsigned int dma_low;
  57. unsigned int dma_high;
  58. unsigned int dma_offset;
  59. uint32_t dma_wrap;
  60. volatile uint32_t *last_pause_ptr;
  61. volatile uint32_t *hw_addr_ptr;
  62. drm_via_ring_buffer_t ring;
  63. struct timeval last_vblank;
  64. int last_vblank_valid;
  65. unsigned usec_per_vblank;
  66. drm_via_state_t hc_state;
  67. char pci_buf[VIA_PCI_BUF_SIZE];
  68. const uint32_t *fire_offsets[VIA_FIRE_BUF_SIZE];
  69. uint32_t num_fire_offsets;
  70. int pro_group_a;
  71. drm_via_irq_t via_irqs[VIA_NUM_IRQS];
  72. unsigned num_irqs;
  73. maskarray_t *irq_masks;
  74. uint32_t irq_enable_mask;
  75. uint32_t irq_pending_mask;
  76. } drm_via_private_t;
  77. /* VIA MMIO register access */
  78. #define VIA_BASE ((dev_priv->mmio))
  79. #define VIA_READ(reg) DRM_READ32(VIA_BASE, reg)
  80. #define VIA_WRITE(reg,val) DRM_WRITE32(VIA_BASE, reg, val)
  81. #define VIA_READ8(reg) DRM_READ8(VIA_BASE, reg)
  82. #define VIA_WRITE8(reg,val) DRM_WRITE8(VIA_BASE, reg, val)
  83. extern int via_init_context(drm_device_t * dev, int context);
  84. extern int via_final_context(drm_device_t * dev, int context);
  85. extern int via_do_cleanup_map(drm_device_t * dev);
  86. extern int via_map_init(struct inode *inode, struct file *filp,
  87. unsigned int cmd, unsigned long arg);
  88. extern int via_driver_vblank_wait(drm_device_t * dev, unsigned int *sequence);
  89. extern irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS);
  90. extern void via_driver_irq_preinstall(drm_device_t * dev);
  91. extern void via_driver_irq_postinstall(drm_device_t * dev);
  92. extern void via_driver_irq_uninstall(drm_device_t * dev);
  93. extern int via_dma_cleanup(drm_device_t * dev);
  94. extern void via_init_command_verifier(void);
  95. extern int via_driver_dma_quiescent(drm_device_t * dev);
  96. extern void via_init_futex(drm_via_private_t *dev_priv);
  97. extern void via_cleanup_futex(drm_via_private_t *dev_priv);
  98. extern void via_release_futex(drm_via_private_t *dev_priv, int context);
  99. #endif