Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
via_drv.h
Go to the documentation of this file.
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 
27 #include <drm/drm_mm.h>
28 #define DRIVER_AUTHOR "Various"
29 
30 #define DRIVER_NAME "via"
31 #define DRIVER_DESC "VIA Unichrome / Pro"
32 #define DRIVER_DATE "20070202"
33 
34 #define DRIVER_MAJOR 2
35 #define DRIVER_MINOR 11
36 #define DRIVER_PATCHLEVEL 1
37 
38 #include "via_verifier.h"
39 
40 #include "via_dmablit.h"
41 
42 #define VIA_PCI_BUF_SIZE 60000
43 #define VIA_FIRE_BUF_SIZE 1024
44 #define VIA_NUM_IRQS 4
45 
46 typedef struct drm_via_ring_buffer {
47  drm_local_map_t map;
50 
51 typedef uint32_t maskarray_t[5];
52 
53 typedef struct drm_via_irq {
59 
60 typedef struct drm_via_private {
62  drm_local_map_t *sarea;
63  drm_local_map_t *fb;
64  drm_local_map_t *mmio;
65  unsigned long agpAddr;
67  char *dma_ptr;
68  unsigned int dma_low;
69  unsigned int dma_high;
70  unsigned int dma_offset;
73  volatile uint32_t *hw_addr_ptr;
77  unsigned usec_per_vblank;
83  int chipset;
85  unsigned num_irqs;
89  int *irq_map;
90  unsigned int idle_fault;
92  struct drm_mm vram_mm;
94  struct drm_mm agp_mm;
96  struct idr object_idr;
97  unsigned long vram_offset;
98  unsigned long agp_offset;
102 
104  VIA_OTHER = 0, /* Baseline */
105  VIA_PRO_GROUP_A, /* Another video engine and DMA commands */
106  VIA_DX9_0 /* Same video as pro_group_a, but 3D is unsupported */
107 };
108 
109 /* VIA MMIO register access */
110 #define VIA_BASE ((dev_priv->mmio))
111 
112 #define VIA_READ(reg) DRM_READ32(VIA_BASE, reg)
113 #define VIA_WRITE(reg, val) DRM_WRITE32(VIA_BASE, reg, val)
114 #define VIA_READ8(reg) DRM_READ8(VIA_BASE, reg)
115 #define VIA_WRITE8(reg, val) DRM_WRITE8(VIA_BASE, reg, val)
116 
117 extern struct drm_ioctl_desc via_ioctls[];
118 extern int via_max_ioctl;
119 
120 extern int via_fb_init(struct drm_device *dev, void *data, struct drm_file *file_priv);
121 extern int via_mem_alloc(struct drm_device *dev, void *data, struct drm_file *file_priv);
122 extern int via_mem_free(struct drm_device *dev, void *data, struct drm_file *file_priv);
123 extern int via_agp_init(struct drm_device *dev, void *data, struct drm_file *file_priv);
124 extern int via_map_init(struct drm_device *dev, void *data, struct drm_file *file_priv);
125 extern int via_decoder_futex(struct drm_device *dev, void *data, struct drm_file *file_priv);
126 extern int via_wait_irq(struct drm_device *dev, void *data, struct drm_file *file_priv);
127 extern int via_dma_blit_sync(struct drm_device *dev, void *data, struct drm_file *file_priv);
128 extern int via_dma_blit(struct drm_device *dev, void *data, struct drm_file *file_priv);
129 
130 extern int via_driver_load(struct drm_device *dev, unsigned long chipset);
131 extern int via_driver_unload(struct drm_device *dev);
132 
133 extern int via_init_context(struct drm_device *dev, int context);
134 extern int via_final_context(struct drm_device *dev, int context);
135 
136 extern int via_do_cleanup_map(struct drm_device *dev);
137 extern u32 via_get_vblank_counter(struct drm_device *dev, int crtc);
138 extern int via_enable_vblank(struct drm_device *dev, int crtc);
139 extern void via_disable_vblank(struct drm_device *dev, int crtc);
140 
142 extern void via_driver_irq_preinstall(struct drm_device *dev);
143 extern int via_driver_irq_postinstall(struct drm_device *dev);
144 extern void via_driver_irq_uninstall(struct drm_device *dev);
145 
146 extern int via_dma_cleanup(struct drm_device *dev);
147 extern void via_init_command_verifier(void);
148 extern int via_driver_dma_quiescent(struct drm_device *dev);
152 
153 extern void via_reclaim_buffers_locked(struct drm_device *dev,
154  struct drm_file *file_priv);
155 extern void via_lastclose(struct drm_device *dev);
156 
157 extern void via_dmablit_handler(struct drm_device *dev, int engine, int from_irq);
158 extern void via_init_dmablit(struct drm_device *dev);
159 
160 #endif