aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-16 15:15:50 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-16 15:15:50 -0400
commitc2dc1ad582196208a2f990eb0230eb922046c684 (patch)
treef2c7d03a9f8007af0a43111423dbf96ccef77db4 /drivers
parent5b37696fda07b8acf37beba3853f83106397ccdf (diff)
parentff4135aeb1f9a0201f8e22400ebc1d570df9016e (diff)
Merge branch 'drm-patches' of ssh://master.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6
* 'drm-patches' of ssh://master.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: drm: remove core typedefs from the ioc32 wrappers drm: remove sarea typedefs drm: detypedef the hashtab and more of sman drm: de-typedef sman drm: detypedeffing continues... drm: detypef waitlist/freelist/buf_entry/device_dma/drm_queue structs drm: drop drm_vma_entry_t, drm_magic_entry_t drm: drop drm_buf_t typedef drm: fixup other drivers for typedef removals drm: remove drm_file_t, drm_device_t and drm_head_t typedefs drm: remove a bunch of typedefs on the userspace interface r300: updates register header radeon: add support for vblank on crtc2 drm: cleanup list initialisation drm: fix typo on code drm getsarea drm: remove DRM_GETSAREA and replace with drm_getsarea function drm: cleanup use of Linux list handling macros
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/drm/ati_pcigart.c8
-rw-r--r--drivers/char/drm/drm.h329
-rw-r--r--drivers/char/drm/drmP.h349
-rw-r--r--drivers/char/drm/drm_agpsupport.c116
-rw-r--r--drivers/char/drm/drm_auth.c40
-rw-r--r--drivers/char/drm/drm_bufs.c209
-rw-r--r--drivers/char/drm/drm_context.c97
-rw-r--r--drivers/char/drm/drm_dma.c12
-rw-r--r--drivers/char/drm/drm_drawable.c34
-rw-r--r--drivers/char/drm/drm_drv.c76
-rw-r--r--drivers/char/drm/drm_fops.c68
-rw-r--r--drivers/char/drm/drm_hashtab.c34
-rw-r--r--drivers/char/drm/drm_hashtab.h24
-rw-r--r--drivers/char/drm/drm_ioc32.c82
-rw-r--r--drivers/char/drm/drm_ioctl.c68
-rw-r--r--drivers/char/drm/drm_irq.c58
-rw-r--r--drivers/char/drm/drm_lock.c28
-rw-r--r--drivers/char/drm/drm_memory.c8
-rw-r--r--drivers/char/drm/drm_mm.c66
-rw-r--r--drivers/char/drm/drm_os_linux.h22
-rw-r--r--drivers/char/drm/drm_pci.c6
-rw-r--r--drivers/char/drm/drm_proc.c50
-rw-r--r--drivers/char/drm/drm_sarea.h26
-rw-r--r--drivers/char/drm/drm_scatter.c22
-rw-r--r--drivers/char/drm/drm_sman.c93
-rw-r--r--drivers/char/drm/drm_sman.h50
-rw-r--r--drivers/char/drm/drm_stub.c30
-rw-r--r--drivers/char/drm/drm_sysfs.c4
-rw-r--r--drivers/char/drm/drm_vm.c106
-rw-r--r--drivers/char/drm/i810_dma.c164
-rw-r--r--drivers/char/drm/i810_drm.h2
-rw-r--r--drivers/char/drm/i810_drv.h18
-rw-r--r--drivers/char/drm/i830_dma.c157
-rw-r--r--drivers/char/drm/i830_drm.h2
-rw-r--r--drivers/char/drm/i830_drv.h24
-rw-r--r--drivers/char/drm/i830_irq.c20
-rw-r--r--drivers/char/drm/i915_dma.c44
-rw-r--r--drivers/char/drm/i915_drm.h8
-rw-r--r--drivers/char/drm/i915_drv.h22
-rw-r--r--drivers/char/drm/i915_irq.c28
-rw-r--r--drivers/char/drm/i915_mem.c6
-rw-r--r--drivers/char/drm/mga_dma.c79
-rw-r--r--drivers/char/drm/mga_drm.h6
-rw-r--r--drivers/char/drm/mga_drv.c4
-rw-r--r--drivers/char/drm/mga_drv.h22
-rw-r--r--drivers/char/drm/mga_irq.c12
-rw-r--r--drivers/char/drm/mga_state.c36
-rw-r--r--drivers/char/drm/r128_cce.c41
-rw-r--r--drivers/char/drm/r128_drm.h4
-rw-r--r--drivers/char/drm/r128_drv.h20
-rw-r--r--drivers/char/drm/r128_irq.c10
-rw-r--r--drivers/char/drm/r128_state.c60
-rw-r--r--drivers/char/drm/r300_cmdbuf.c53
-rw-r--r--drivers/char/drm/r300_reg.h1163
-rw-r--r--drivers/char/drm/radeon_cp.c54
-rw-r--r--drivers/char/drm/radeon_drm.h12
-rw-r--r--drivers/char/drm/radeon_drv.c3
-rw-r--r--drivers/char/drm/radeon_drv.h45
-rw-r--r--drivers/char/drm/radeon_irq.c118
-rw-r--r--drivers/char/drm/radeon_state.c108
-rw-r--r--drivers/char/drm/savage_bci.c44
-rw-r--r--drivers/char/drm/savage_drm.h4
-rw-r--r--drivers/char/drm/savage_drv.h20
-rw-r--r--drivers/char/drm/savage_state.c28
-rw-r--r--drivers/char/drm/sis_drv.c4
-rw-r--r--drivers/char/drm/sis_drv.h9
-rw-r--r--drivers/char/drm/sis_mm.c16
-rw-r--r--drivers/char/drm/via_dma.c10
-rw-r--r--drivers/char/drm/via_dmablit.c20
-rw-r--r--drivers/char/drm/via_dmablit.h2
-rw-r--r--drivers/char/drm/via_drm.h4
-rw-r--r--drivers/char/drm/via_drv.h32
-rw-r--r--drivers/char/drm/via_irq.c12
-rw-r--r--drivers/char/drm/via_map.c10
-rw-r--r--drivers/char/drm/via_mm.c6
-rw-r--r--drivers/char/drm/via_verifier.c12
-rw-r--r--drivers/char/drm/via_verifier.h6
77 files changed, 2485 insertions, 2214 deletions
diff --git a/drivers/char/drm/ati_pcigart.c b/drivers/char/drm/ati_pcigart.c
index 5b91bc04ea4e..3345641ff904 100644
--- a/drivers/char/drm/ati_pcigart.c
+++ b/drivers/char/drm/ati_pcigart.c
@@ -73,9 +73,9 @@ static void drm_ati_free_pcigart_table(void *address, int order)
73 free_pages((unsigned long)address, order); 73 free_pages((unsigned long)address, order);
74} 74}
75 75
76int drm_ati_pcigart_cleanup(drm_device_t *dev, drm_ati_pcigart_info *gart_info) 76int drm_ati_pcigart_cleanup(struct drm_device *dev, struct drm_ati_pcigart_info *gart_info)
77{ 77{
78 drm_sg_mem_t *entry = dev->sg; 78 struct drm_sg_mem *entry = dev->sg;
79 unsigned long pages; 79 unsigned long pages;
80 int i; 80 int i;
81 int order; 81 int order;
@@ -122,9 +122,9 @@ int drm_ati_pcigart_cleanup(drm_device_t *dev, drm_ati_pcigart_info *gart_info)
122} 122}
123EXPORT_SYMBOL(drm_ati_pcigart_cleanup); 123EXPORT_SYMBOL(drm_ati_pcigart_cleanup);
124 124
125int drm_ati_pcigart_init(drm_device_t *dev, drm_ati_pcigart_info *gart_info) 125int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *gart_info)
126{ 126{
127 drm_sg_mem_t *entry = dev->sg; 127 struct drm_sg_mem *entry = dev->sg;
128 void *address = NULL; 128 void *address = NULL;
129 unsigned long pages; 129 unsigned long pages;
130 u32 *pci_gart, page_base, bus_address = 0; 130 u32 *pci_gart, page_base, bus_address = 0;
diff --git a/drivers/char/drm/drm.h b/drivers/char/drm/drm.h
index 089198491f16..2d6f2d0bd02b 100644
--- a/drivers/char/drm/drm.h
+++ b/drivers/char/drm/drm.h
@@ -109,31 +109,31 @@ typedef unsigned int drm_magic_t;
109 * \note KW: Actually it's illegal to change either for 109 * \note KW: Actually it's illegal to change either for
110 * backwards-compatibility reasons. 110 * backwards-compatibility reasons.
111 */ 111 */
112typedef struct drm_clip_rect { 112struct drm_clip_rect {
113 unsigned short x1; 113 unsigned short x1;
114 unsigned short y1; 114 unsigned short y1;
115 unsigned short x2; 115 unsigned short x2;
116 unsigned short y2; 116 unsigned short y2;
117} drm_clip_rect_t; 117};
118 118
119/** 119/**
120 * Drawable information. 120 * Drawable information.
121 */ 121 */
122typedef struct drm_drawable_info { 122struct drm_drawable_info {
123 unsigned int num_rects; 123 unsigned int num_rects;
124 drm_clip_rect_t *rects; 124 struct drm_clip_rect *rects;
125} drm_drawable_info_t; 125};
126 126
127/** 127/**
128 * Texture region, 128 * Texture region,
129 */ 129 */
130typedef struct drm_tex_region { 130struct drm_tex_region {
131 unsigned char next; 131 unsigned char next;
132 unsigned char prev; 132 unsigned char prev;
133 unsigned char in_use; 133 unsigned char in_use;
134 unsigned char padding; 134 unsigned char padding;
135 unsigned int age; 135 unsigned int age;
136} drm_tex_region_t; 136};
137 137
138/** 138/**
139 * Hardware lock. 139 * Hardware lock.
@@ -142,17 +142,17 @@ typedef struct drm_tex_region {
142 * processor bus contention on a multiprocessor system, there should not be any 142 * processor bus contention on a multiprocessor system, there should not be any
143 * other data stored in the same cache line. 143 * other data stored in the same cache line.
144 */ 144 */
145typedef struct drm_hw_lock { 145struct drm_hw_lock {
146 __volatile__ unsigned int lock; /**< lock variable */ 146 __volatile__ unsigned int lock; /**< lock variable */
147 char padding[60]; /**< Pad to cache line */ 147 char padding[60]; /**< Pad to cache line */
148} drm_hw_lock_t; 148};
149 149
150/** 150/**
151 * DRM_IOCTL_VERSION ioctl argument type. 151 * DRM_IOCTL_VERSION ioctl argument type.
152 * 152 *
153 * \sa drmGetVersion(). 153 * \sa drmGetVersion().
154 */ 154 */
155typedef struct drm_version { 155struct drm_version {
156 int version_major; /**< Major version */ 156 int version_major; /**< Major version */
157 int version_minor; /**< Minor version */ 157 int version_minor; /**< Minor version */
158 int version_patchlevel; /**< Patch level */ 158 int version_patchlevel; /**< Patch level */
@@ -162,33 +162,33 @@ typedef struct drm_version {
162 char __user *date; /**< User-space buffer to hold date */ 162 char __user *date; /**< User-space buffer to hold date */
163 size_t desc_len; /**< Length of desc buffer */ 163 size_t desc_len; /**< Length of desc buffer */
164 char __user *desc; /**< User-space buffer to hold desc */ 164 char __user *desc; /**< User-space buffer to hold desc */
165} drm_version_t; 165};
166 166
167/** 167/**
168 * DRM_IOCTL_GET_UNIQUE ioctl argument type. 168 * DRM_IOCTL_GET_UNIQUE ioctl argument type.
169 * 169 *
170 * \sa drmGetBusid() and drmSetBusId(). 170 * \sa drmGetBusid() and drmSetBusId().
171 */ 171 */
172typedef struct drm_unique { 172struct drm_unique {
173 size_t unique_len; /**< Length of unique */ 173 size_t unique_len; /**< Length of unique */
174 char __user *unique; /**< Unique name for driver instantiation */ 174 char __user *unique; /**< Unique name for driver instantiation */
175} drm_unique_t; 175};
176 176
177typedef struct drm_list { 177struct drm_list {
178 int count; /**< Length of user-space structures */ 178 int count; /**< Length of user-space structures */
179 drm_version_t __user *version; 179 struct drm_version __user *version;
180} drm_list_t; 180};
181 181
182typedef struct drm_block { 182struct drm_block {
183 int unused; 183 int unused;
184} drm_block_t; 184};
185 185
186/** 186/**
187 * DRM_IOCTL_CONTROL ioctl argument type. 187 * DRM_IOCTL_CONTROL ioctl argument type.
188 * 188 *
189 * \sa drmCtlInstHandler() and drmCtlUninstHandler(). 189 * \sa drmCtlInstHandler() and drmCtlUninstHandler().
190 */ 190 */
191typedef struct drm_control { 191struct drm_control {
192 enum { 192 enum {
193 DRM_ADD_COMMAND, 193 DRM_ADD_COMMAND,
194 DRM_RM_COMMAND, 194 DRM_RM_COMMAND,
@@ -196,24 +196,24 @@ typedef struct drm_control {
196 DRM_UNINST_HANDLER 196 DRM_UNINST_HANDLER
197 } func; 197 } func;
198 int irq; 198 int irq;
199} drm_control_t; 199};
200 200
201/** 201/**
202 * Type of memory to map. 202 * Type of memory to map.
203 */ 203 */
204typedef enum drm_map_type { 204enum drm_map_type {
205 _DRM_FRAME_BUFFER = 0, /**< WC (no caching), no core dump */ 205 _DRM_FRAME_BUFFER = 0, /**< WC (no caching), no core dump */
206 _DRM_REGISTERS = 1, /**< no caching, no core dump */ 206 _DRM_REGISTERS = 1, /**< no caching, no core dump */
207 _DRM_SHM = 2, /**< shared, cached */ 207 _DRM_SHM = 2, /**< shared, cached */
208 _DRM_AGP = 3, /**< AGP/GART */ 208 _DRM_AGP = 3, /**< AGP/GART */
209 _DRM_SCATTER_GATHER = 4, /**< Scatter/gather memory for PCI DMA */ 209 _DRM_SCATTER_GATHER = 4, /**< Scatter/gather memory for PCI DMA */
210 _DRM_CONSISTENT = 5, /**< Consistent memory for PCI DMA */ 210 _DRM_CONSISTENT = 5, /**< Consistent memory for PCI DMA */
211} drm_map_type_t; 211};
212 212
213/** 213/**
214 * Memory mapping flags. 214 * Memory mapping flags.
215 */ 215 */
216typedef enum drm_map_flags { 216enum drm_map_flags {
217 _DRM_RESTRICTED = 0x01, /**< Cannot be mapped to user-virtual */ 217 _DRM_RESTRICTED = 0x01, /**< Cannot be mapped to user-virtual */
218 _DRM_READ_ONLY = 0x02, 218 _DRM_READ_ONLY = 0x02,
219 _DRM_LOCKED = 0x04, /**< shared, cached, locked */ 219 _DRM_LOCKED = 0x04, /**< shared, cached, locked */
@@ -221,12 +221,12 @@ typedef enum drm_map_flags {
221 _DRM_WRITE_COMBINING = 0x10, /**< use write-combining if available */ 221 _DRM_WRITE_COMBINING = 0x10, /**< use write-combining if available */
222 _DRM_CONTAINS_LOCK = 0x20, /**< SHM page that contains lock */ 222 _DRM_CONTAINS_LOCK = 0x20, /**< SHM page that contains lock */
223 _DRM_REMOVABLE = 0x40 /**< Removable mapping */ 223 _DRM_REMOVABLE = 0x40 /**< Removable mapping */
224} drm_map_flags_t; 224};
225 225
226typedef struct drm_ctx_priv_map { 226struct drm_ctx_priv_map {
227 unsigned int ctx_id; /**< Context requesting private mapping */ 227 unsigned int ctx_id; /**< Context requesting private mapping */
228 void *handle; /**< Handle of map */ 228 void *handle; /**< Handle of map */
229} drm_ctx_priv_map_t; 229};
230 230
231/** 231/**
232 * DRM_IOCTL_GET_MAP, DRM_IOCTL_ADD_MAP and DRM_IOCTL_RM_MAP ioctls 232 * DRM_IOCTL_GET_MAP, DRM_IOCTL_ADD_MAP and DRM_IOCTL_RM_MAP ioctls
@@ -234,30 +234,30 @@ typedef struct drm_ctx_priv_map {
234 * 234 *
235 * \sa drmAddMap(). 235 * \sa drmAddMap().
236 */ 236 */
237typedef struct drm_map { 237struct drm_map {
238 unsigned long offset; /**< Requested physical address (0 for SAREA)*/ 238 unsigned long offset; /**< Requested physical address (0 for SAREA)*/
239 unsigned long size; /**< Requested physical size (bytes) */ 239 unsigned long size; /**< Requested physical size (bytes) */
240 drm_map_type_t type; /**< Type of memory to map */ 240 enum drm_map_type type; /**< Type of memory to map */
241 drm_map_flags_t flags; /**< Flags */ 241 enum drm_map_flags flags; /**< Flags */
242 void *handle; /**< User-space: "Handle" to pass to mmap() */ 242 void *handle; /**< User-space: "Handle" to pass to mmap() */
243 /**< Kernel-space: kernel-virtual address */ 243 /**< Kernel-space: kernel-virtual address */
244 int mtrr; /**< MTRR slot used */ 244 int mtrr; /**< MTRR slot used */
245 /* Private data */ 245 /* Private data */
246} drm_map_t; 246};
247 247
248/** 248/**
249 * DRM_IOCTL_GET_CLIENT ioctl argument type. 249 * DRM_IOCTL_GET_CLIENT ioctl argument type.
250 */ 250 */
251typedef struct drm_client { 251struct drm_client {
252 int idx; /**< Which client desired? */ 252 int idx; /**< Which client desired? */
253 int auth; /**< Is client authenticated? */ 253 int auth; /**< Is client authenticated? */
254 unsigned long pid; /**< Process ID */ 254 unsigned long pid; /**< Process ID */
255 unsigned long uid; /**< User ID */ 255 unsigned long uid; /**< User ID */
256 unsigned long magic; /**< Magic */ 256 unsigned long magic; /**< Magic */
257 unsigned long iocs; /**< Ioctl count */ 257 unsigned long iocs; /**< Ioctl count */
258} drm_client_t; 258};
259 259
260typedef enum { 260enum drm_stat_type {
261 _DRM_STAT_LOCK, 261 _DRM_STAT_LOCK,
262 _DRM_STAT_OPENS, 262 _DRM_STAT_OPENS,
263 _DRM_STAT_CLOSES, 263 _DRM_STAT_CLOSES,
@@ -275,23 +275,23 @@ typedef enum {
275 _DRM_STAT_SPECIAL, /**< Special DMA (e.g., priority or polled) */ 275 _DRM_STAT_SPECIAL, /**< Special DMA (e.g., priority or polled) */
276 _DRM_STAT_MISSED /**< Missed DMA opportunity */ 276 _DRM_STAT_MISSED /**< Missed DMA opportunity */
277 /* Add to the *END* of the list */ 277 /* Add to the *END* of the list */
278} drm_stat_type_t; 278};
279 279
280/** 280/**
281 * DRM_IOCTL_GET_STATS ioctl argument type. 281 * DRM_IOCTL_GET_STATS ioctl argument type.
282 */ 282 */
283typedef struct drm_stats { 283struct drm_stats {
284 unsigned long count; 284 unsigned long count;
285 struct { 285 struct {
286 unsigned long value; 286 unsigned long value;
287 drm_stat_type_t type; 287 enum drm_stat_type type;
288 } data[15]; 288 } data[15];
289} drm_stats_t; 289};
290 290
291/** 291/**
292 * Hardware locking flags. 292 * Hardware locking flags.
293 */ 293 */
294typedef enum drm_lock_flags { 294enum drm_lock_flags {
295 _DRM_LOCK_READY = 0x01, /**< Wait until hardware is ready for DMA */ 295 _DRM_LOCK_READY = 0x01, /**< Wait until hardware is ready for DMA */
296 _DRM_LOCK_QUIESCENT = 0x02, /**< Wait until hardware quiescent */ 296 _DRM_LOCK_QUIESCENT = 0x02, /**< Wait until hardware quiescent */
297 _DRM_LOCK_FLUSH = 0x04, /**< Flush this context's DMA queue first */ 297 _DRM_LOCK_FLUSH = 0x04, /**< Flush this context's DMA queue first */
@@ -301,17 +301,17 @@ typedef enum drm_lock_flags {
301 full-screen DGA-like mode. */ 301 full-screen DGA-like mode. */
302 _DRM_HALT_ALL_QUEUES = 0x10, /**< Halt all current and future queues */ 302 _DRM_HALT_ALL_QUEUES = 0x10, /**< Halt all current and future queues */
303 _DRM_HALT_CUR_QUEUES = 0x20 /**< Halt all current queues */ 303 _DRM_HALT_CUR_QUEUES = 0x20 /**< Halt all current queues */
304} drm_lock_flags_t; 304};
305 305
306/** 306/**
307 * DRM_IOCTL_LOCK, DRM_IOCTL_UNLOCK and DRM_IOCTL_FINISH ioctl argument type. 307 * DRM_IOCTL_LOCK, DRM_IOCTL_UNLOCK and DRM_IOCTL_FINISH ioctl argument type.
308 * 308 *
309 * \sa drmGetLock() and drmUnlock(). 309 * \sa drmGetLock() and drmUnlock().
310 */ 310 */
311typedef struct drm_lock { 311struct drm_lock {
312 int context; 312 int context;
313 drm_lock_flags_t flags; 313 enum drm_lock_flags flags;
314} drm_lock_t; 314};
315 315
316/** 316/**
317 * DMA flags 317 * DMA flags
@@ -321,7 +321,7 @@ typedef struct drm_lock {
321 * 321 *
322 * \sa drm_dma. 322 * \sa drm_dma.
323 */ 323 */
324typedef enum drm_dma_flags { 324enum drm_dma_flags {
325 /* Flags for DMA buffer dispatch */ 325 /* Flags for DMA buffer dispatch */
326 _DRM_DMA_BLOCK = 0x01, /**< 326 _DRM_DMA_BLOCK = 0x01, /**<
327 * Block until buffer dispatched. 327 * Block until buffer dispatched.
@@ -340,14 +340,14 @@ typedef enum drm_dma_flags {
340 _DRM_DMA_WAIT = 0x10, /**< Wait for free buffers */ 340 _DRM_DMA_WAIT = 0x10, /**< Wait for free buffers */
341 _DRM_DMA_SMALLER_OK = 0x20, /**< Smaller-than-requested buffers OK */ 341 _DRM_DMA_SMALLER_OK = 0x20, /**< Smaller-than-requested buffers OK */
342 _DRM_DMA_LARGER_OK = 0x40 /**< Larger-than-requested buffers OK */ 342 _DRM_DMA_LARGER_OK = 0x40 /**< Larger-than-requested buffers OK */
343} drm_dma_flags_t; 343};
344 344
345/** 345/**
346 * DRM_IOCTL_ADD_BUFS and DRM_IOCTL_MARK_BUFS ioctl argument type. 346 * DRM_IOCTL_ADD_BUFS and DRM_IOCTL_MARK_BUFS ioctl argument type.
347 * 347 *
348 * \sa drmAddBufs(). 348 * \sa drmAddBufs().
349 */ 349 */
350typedef struct drm_buf_desc { 350struct drm_buf_desc {
351 int count; /**< Number of buffers of this size */ 351 int count; /**< Number of buffers of this size */
352 int size; /**< Size in bytes */ 352 int size; /**< Size in bytes */
353 int low_mark; /**< Low water mark */ 353 int low_mark; /**< Low water mark */
@@ -363,44 +363,44 @@ typedef struct drm_buf_desc {
363 * Start address of where the AGP buffers are 363 * Start address of where the AGP buffers are
364 * in the AGP aperture 364 * in the AGP aperture
365 */ 365 */
366} drm_buf_desc_t; 366};
367 367
368/** 368/**
369 * DRM_IOCTL_INFO_BUFS ioctl argument type. 369 * DRM_IOCTL_INFO_BUFS ioctl argument type.
370 */ 370 */
371typedef struct drm_buf_info { 371struct drm_buf_info {
372 int count; /**< Entries in list */ 372 int count; /**< Entries in list */
373 drm_buf_desc_t __user *list; 373 struct drm_buf_desc __user *list;
374} drm_buf_info_t; 374};
375 375
376/** 376/**
377 * DRM_IOCTL_FREE_BUFS ioctl argument type. 377 * DRM_IOCTL_FREE_BUFS ioctl argument type.
378 */ 378 */
379typedef struct drm_buf_free { 379struct drm_buf_free {
380 int count; 380 int count;
381 int __user *list; 381 int __user *list;
382} drm_buf_free_t; 382};
383 383
384/** 384/**
385 * Buffer information 385 * Buffer information
386 * 386 *
387 * \sa drm_buf_map. 387 * \sa drm_buf_map.
388 */ 388 */
389typedef struct drm_buf_pub { 389struct drm_buf_pub {
390 int idx; /**< Index into the master buffer list */ 390 int idx; /**< Index into the master buffer list */
391 int total; /**< Buffer size */ 391 int total; /**< Buffer size */
392 int used; /**< Amount of buffer in use (for DMA) */ 392 int used; /**< Amount of buffer in use (for DMA) */
393 void __user *address; /**< Address of buffer */ 393 void __user *address; /**< Address of buffer */
394} drm_buf_pub_t; 394};
395 395
396/** 396/**
397 * DRM_IOCTL_MAP_BUFS ioctl argument type. 397 * DRM_IOCTL_MAP_BUFS ioctl argument type.
398 */ 398 */
399typedef struct drm_buf_map { 399struct drm_buf_map {
400 int count; /**< Length of the buffer list */ 400 int count; /**< Length of the buffer list */
401 void __user *virtual; /**< Mmap'd area in user-virtual */ 401 void __user *virtual; /**< Mmap'd area in user-virtual */
402 drm_buf_pub_t __user *list; /**< Buffer information */ 402 struct drm_buf_pub __user *list; /**< Buffer information */
403} drm_buf_map_t; 403};
404 404
405/** 405/**
406 * DRM_IOCTL_DMA ioctl argument type. 406 * DRM_IOCTL_DMA ioctl argument type.
@@ -409,48 +409,48 @@ typedef struct drm_buf_map {
409 * 409 *
410 * \sa drmDMA(). 410 * \sa drmDMA().
411 */ 411 */
412typedef struct drm_dma { 412struct drm_dma {
413 int context; /**< Context handle */ 413 int context; /**< Context handle */
414 int send_count; /**< Number of buffers to send */ 414 int send_count; /**< Number of buffers to send */
415 int __user *send_indices; /**< List of handles to buffers */ 415 int __user *send_indices; /**< List of handles to buffers */
416 int __user *send_sizes; /**< Lengths of data to send */ 416 int __user *send_sizes; /**< Lengths of data to send */
417 drm_dma_flags_t flags; /**< Flags */ 417 enum drm_dma_flags flags; /**< Flags */
418 int request_count; /**< Number of buffers requested */ 418 int request_count; /**< Number of buffers requested */
419 int request_size; /**< Desired size for buffers */ 419 int request_size; /**< Desired size for buffers */
420 int __user *request_indices; /**< Buffer information */ 420 int __user *request_indices; /**< Buffer information */
421 int __user *request_sizes; 421 int __user *request_sizes;
422 int granted_count; /**< Number of buffers granted */ 422 int granted_count; /**< Number of buffers granted */
423} drm_dma_t; 423};
424 424
425typedef enum { 425enum drm_ctx_flags {
426 _DRM_CONTEXT_PRESERVED = 0x01, 426 _DRM_CONTEXT_PRESERVED = 0x01,
427 _DRM_CONTEXT_2DONLY = 0x02 427 _DRM_CONTEXT_2DONLY = 0x02
428} drm_ctx_flags_t; 428};
429 429
430/** 430/**
431 * DRM_IOCTL_ADD_CTX ioctl argument type. 431 * DRM_IOCTL_ADD_CTX ioctl argument type.
432 * 432 *
433 * \sa drmCreateContext() and drmDestroyContext(). 433 * \sa drmCreateContext() and drmDestroyContext().
434 */ 434 */
435typedef struct drm_ctx { 435struct drm_ctx {
436 drm_context_t handle; 436 drm_context_t handle;
437 drm_ctx_flags_t flags; 437 enum drm_ctx_flags flags;
438} drm_ctx_t; 438};
439 439
440/** 440/**
441 * DRM_IOCTL_RES_CTX ioctl argument type. 441 * DRM_IOCTL_RES_CTX ioctl argument type.
442 */ 442 */
443typedef struct drm_ctx_res { 443struct drm_ctx_res {
444 int count; 444 int count;
445 drm_ctx_t __user *contexts; 445 struct drm_ctx __user *contexts;
446} drm_ctx_res_t; 446};
447 447
448/** 448/**
449 * DRM_IOCTL_ADD_DRAW and DRM_IOCTL_RM_DRAW ioctl argument type. 449 * DRM_IOCTL_ADD_DRAW and DRM_IOCTL_RM_DRAW ioctl argument type.
450 */ 450 */
451typedef struct drm_draw { 451struct drm_draw {
452 drm_drawable_t handle; 452 drm_drawable_t handle;
453} drm_draw_t; 453};
454 454
455/** 455/**
456 * DRM_IOCTL_UPDATE_DRAW ioctl argument type. 456 * DRM_IOCTL_UPDATE_DRAW ioctl argument type.
@@ -459,52 +459,52 @@ typedef enum {
459 DRM_DRAWABLE_CLIPRECTS, 459 DRM_DRAWABLE_CLIPRECTS,
460} drm_drawable_info_type_t; 460} drm_drawable_info_type_t;
461 461
462typedef struct drm_update_draw { 462struct drm_update_draw {
463 drm_drawable_t handle; 463 drm_drawable_t handle;
464 unsigned int type; 464 unsigned int type;
465 unsigned int num; 465 unsigned int num;
466 unsigned long long data; 466 unsigned long long data;
467} drm_update_draw_t; 467};
468 468
469/** 469/**
470 * DRM_IOCTL_GET_MAGIC and DRM_IOCTL_AUTH_MAGIC ioctl argument type. 470 * DRM_IOCTL_GET_MAGIC and DRM_IOCTL_AUTH_MAGIC ioctl argument type.
471 */ 471 */
472typedef struct drm_auth { 472struct drm_auth {
473 drm_magic_t magic; 473 drm_magic_t magic;
474} drm_auth_t; 474};
475 475
476/** 476/**
477 * DRM_IOCTL_IRQ_BUSID ioctl argument type. 477 * DRM_IOCTL_IRQ_BUSID ioctl argument type.
478 * 478 *
479 * \sa drmGetInterruptFromBusID(). 479 * \sa drmGetInterruptFromBusID().
480 */ 480 */
481typedef struct drm_irq_busid { 481struct drm_irq_busid {
482 int irq; /**< IRQ number */ 482 int irq; /**< IRQ number */
483 int busnum; /**< bus number */ 483 int busnum; /**< bus number */
484 int devnum; /**< device number */ 484 int devnum; /**< device number */
485 int funcnum; /**< function number */ 485 int funcnum; /**< function number */
486} drm_irq_busid_t; 486};
487 487
488typedef enum { 488enum drm_vblank_seq_type {
489 _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ 489 _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */
490 _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ 490 _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */
491 _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */ 491 _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */
492 _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ 492 _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */
493 _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking */ 493 _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking */
494} drm_vblank_seq_type_t; 494};
495 495
496#define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE) 496#define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE)
497#define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_SIGNAL | _DRM_VBLANK_SECONDARY | \ 497#define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_SIGNAL | _DRM_VBLANK_SECONDARY | \
498 _DRM_VBLANK_NEXTONMISS) 498 _DRM_VBLANK_NEXTONMISS)
499 499
500struct drm_wait_vblank_request { 500struct drm_wait_vblank_request {
501 drm_vblank_seq_type_t type; 501 enum drm_vblank_seq_type type;
502 unsigned int sequence; 502 unsigned int sequence;
503 unsigned long signal; 503 unsigned long signal;
504}; 504};
505 505
506struct drm_wait_vblank_reply { 506struct drm_wait_vblank_reply {
507 drm_vblank_seq_type_t type; 507 enum drm_vblank_seq_type type;
508 unsigned int sequence; 508 unsigned int sequence;
509 long tval_sec; 509 long tval_sec;
510 long tval_usec; 510 long tval_usec;
@@ -515,41 +515,41 @@ struct drm_wait_vblank_reply {
515 * 515 *
516 * \sa drmWaitVBlank(). 516 * \sa drmWaitVBlank().
517 */ 517 */
518typedef union drm_wait_vblank { 518union drm_wait_vblank {
519 struct drm_wait_vblank_request request; 519 struct drm_wait_vblank_request request;
520 struct drm_wait_vblank_reply reply; 520 struct drm_wait_vblank_reply reply;
521} drm_wait_vblank_t; 521};
522 522
523/** 523/**
524 * DRM_IOCTL_AGP_ENABLE ioctl argument type. 524 * DRM_IOCTL_AGP_ENABLE ioctl argument type.
525 * 525 *
526 * \sa drmAgpEnable(). 526 * \sa drmAgpEnable().
527 */ 527 */
528typedef struct drm_agp_mode { 528struct drm_agp_mode {
529 unsigned long mode; /**< AGP mode */ 529 unsigned long mode; /**< AGP mode */
530} drm_agp_mode_t; 530};
531 531
532/** 532/**
533 * DRM_IOCTL_AGP_ALLOC and DRM_IOCTL_AGP_FREE ioctls argument type. 533 * DRM_IOCTL_AGP_ALLOC and DRM_IOCTL_AGP_FREE ioctls argument type.
534 * 534 *
535 * \sa drmAgpAlloc() and drmAgpFree(). 535 * \sa drmAgpAlloc() and drmAgpFree().
536 */ 536 */
537typedef struct drm_agp_buffer { 537struct drm_agp_buffer {
538 unsigned long size; /**< In bytes -- will round to page boundary */ 538 unsigned long size; /**< In bytes -- will round to page boundary */
539 unsigned long handle; /**< Used for binding / unbinding */ 539 unsigned long handle; /**< Used for binding / unbinding */
540 unsigned long type; /**< Type of memory to allocate */ 540 unsigned long type; /**< Type of memory to allocate */
541 unsigned long physical; /**< Physical used by i810 */ 541 unsigned long physical; /**< Physical used by i810 */
542} drm_agp_buffer_t; 542};
543 543
544/** 544/**
545 * DRM_IOCTL_AGP_BIND and DRM_IOCTL_AGP_UNBIND ioctls argument type. 545 * DRM_IOCTL_AGP_BIND and DRM_IOCTL_AGP_UNBIND ioctls argument type.
546 * 546 *
547 * \sa drmAgpBind() and drmAgpUnbind(). 547 * \sa drmAgpBind() and drmAgpUnbind().
548 */ 548 */
549typedef struct drm_agp_binding { 549struct drm_agp_binding {
550 unsigned long handle; /**< From drm_agp_buffer */ 550 unsigned long handle; /**< From drm_agp_buffer */
551 unsigned long offset; /**< In bytes -- will round to page boundary */ 551 unsigned long offset; /**< In bytes -- will round to page boundary */
552} drm_agp_binding_t; 552};
553 553
554/** 554/**
555 * DRM_IOCTL_AGP_INFO ioctl argument type. 555 * DRM_IOCTL_AGP_INFO ioctl argument type.
@@ -558,7 +558,7 @@ typedef struct drm_agp_binding {
558 * drmAgpBase(), drmAgpSize(), drmAgpMemoryUsed(), drmAgpMemoryAvail(), 558 * drmAgpBase(), drmAgpSize(), drmAgpMemoryUsed(), drmAgpMemoryAvail(),
559 * drmAgpVendorId() and drmAgpDeviceId(). 559 * drmAgpVendorId() and drmAgpDeviceId().
560 */ 560 */
561typedef struct drm_agp_info { 561struct drm_agp_info {
562 int agp_version_major; 562 int agp_version_major;
563 int agp_version_minor; 563 int agp_version_minor;
564 unsigned long mode; 564 unsigned long mode;
@@ -570,25 +570,25 @@ typedef struct drm_agp_info {
570 /* PCI information */ 570 /* PCI information */
571 unsigned short id_vendor; 571 unsigned short id_vendor;
572 unsigned short id_device; 572 unsigned short id_device;
573} drm_agp_info_t; 573};
574 574
575/** 575/**
576 * DRM_IOCTL_SG_ALLOC ioctl argument type. 576 * DRM_IOCTL_SG_ALLOC ioctl argument type.
577 */ 577 */
578typedef struct drm_scatter_gather { 578struct drm_scatter_gather {
579 unsigned long size; /**< In bytes -- will round to page boundary */ 579 unsigned long size; /**< In bytes -- will round to page boundary */
580 unsigned long handle; /**< Used for mapping / unmapping */ 580 unsigned long handle; /**< Used for mapping / unmapping */
581} drm_scatter_gather_t; 581};
582 582
583/** 583/**
584 * DRM_IOCTL_SET_VERSION ioctl argument type. 584 * DRM_IOCTL_SET_VERSION ioctl argument type.
585 */ 585 */
586typedef struct drm_set_version { 586struct drm_set_version {
587 int drm_di_major; 587 int drm_di_major;
588 int drm_di_minor; 588 int drm_di_minor;
589 int drm_dd_major; 589 int drm_dd_major;
590 int drm_dd_minor; 590 int drm_dd_minor;
591} drm_set_version_t; 591};
592 592
593#define DRM_IOCTL_BASE 'd' 593#define DRM_IOCTL_BASE 'd'
594#define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr) 594#define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr)
@@ -596,61 +596,61 @@ typedef struct drm_set_version {
596#define DRM_IOW(nr,type) _IOW(DRM_IOCTL_BASE,nr,type) 596#define DRM_IOW(nr,type) _IOW(DRM_IOCTL_BASE,nr,type)
597#define DRM_IOWR(nr,type) _IOWR(DRM_IOCTL_BASE,nr,type) 597#define DRM_IOWR(nr,type) _IOWR(DRM_IOCTL_BASE,nr,type)
598 598
599#define DRM_IOCTL_VERSION DRM_IOWR(0x00, drm_version_t) 599#define DRM_IOCTL_VERSION DRM_IOWR(0x00, struct drm_version)
600#define DRM_IOCTL_GET_UNIQUE DRM_IOWR(0x01, drm_unique_t) 600#define DRM_IOCTL_GET_UNIQUE DRM_IOWR(0x01, struct drm_unique)
601#define DRM_IOCTL_GET_MAGIC DRM_IOR( 0x02, drm_auth_t) 601#define DRM_IOCTL_GET_MAGIC DRM_IOR( 0x02, struct drm_auth)
602#define DRM_IOCTL_IRQ_BUSID DRM_IOWR(0x03, drm_irq_busid_t) 602#define DRM_IOCTL_IRQ_BUSID DRM_IOWR(0x03, struct drm_irq_busid)
603#define DRM_IOCTL_GET_MAP DRM_IOWR(0x04, drm_map_t) 603#define DRM_IOCTL_GET_MAP DRM_IOWR(0x04, struct drm_map)
604#define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, drm_client_t) 604#define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, struct drm_client)
605#define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, drm_stats_t) 605#define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, struct drm_stats)
606#define DRM_IOCTL_SET_VERSION DRM_IOWR(0x07, drm_set_version_t) 606#define DRM_IOCTL_SET_VERSION DRM_IOWR(0x07, struct drm_set_version)
607 607
608#define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, drm_unique_t) 608#define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique)
609#define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, drm_auth_t) 609#define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth)
610#define DRM_IOCTL_BLOCK DRM_IOWR(0x12, drm_block_t) 610#define DRM_IOCTL_BLOCK DRM_IOWR(0x12, struct drm_block)
611#define DRM_IOCTL_UNBLOCK DRM_IOWR(0x13, drm_block_t) 611#define DRM_IOCTL_UNBLOCK DRM_IOWR(0x13, struct drm_block)
612#define DRM_IOCTL_CONTROL DRM_IOW( 0x14, drm_control_t) 612#define DRM_IOCTL_CONTROL DRM_IOW( 0x14, struct drm_control)
613#define DRM_IOCTL_ADD_MAP DRM_IOWR(0x15, drm_map_t) 613#define DRM_IOCTL_ADD_MAP DRM_IOWR(0x15, struct drm_map)
614#define DRM_IOCTL_ADD_BUFS DRM_IOWR(0x16, drm_buf_desc_t) 614#define DRM_IOCTL_ADD_BUFS DRM_IOWR(0x16, struct drm_buf_desc)
615#define DRM_IOCTL_MARK_BUFS DRM_IOW( 0x17, drm_buf_desc_t) 615#define DRM_IOCTL_MARK_BUFS DRM_IOW( 0x17, struct drm_buf_desc)
616#define DRM_IOCTL_INFO_BUFS DRM_IOWR(0x18, drm_buf_info_t) 616#define DRM_IOCTL_INFO_BUFS DRM_IOWR(0x18, struct drm_buf_info)
617#define DRM_IOCTL_MAP_BUFS DRM_IOWR(0x19, drm_buf_map_t) 617#define DRM_IOCTL_MAP_BUFS DRM_IOWR(0x19, struct drm_buf_map)
618#define DRM_IOCTL_FREE_BUFS DRM_IOW( 0x1a, drm_buf_free_t) 618#define DRM_IOCTL_FREE_BUFS DRM_IOW( 0x1a, struct drm_buf_free)
619 619
620#define DRM_IOCTL_RM_MAP DRM_IOW( 0x1b, drm_map_t) 620#define DRM_IOCTL_RM_MAP DRM_IOW( 0x1b, struct drm_map)
621 621
622#define DRM_IOCTL_SET_SAREA_CTX DRM_IOW( 0x1c, drm_ctx_priv_map_t) 622#define DRM_IOCTL_SET_SAREA_CTX DRM_IOW( 0x1c, struct drm_ctx_priv_map)
623#define DRM_IOCTL_GET_SAREA_CTX DRM_IOWR(0x1d, drm_ctx_priv_map_t) 623#define DRM_IOCTL_GET_SAREA_CTX DRM_IOWR(0x1d, struct drm_ctx_priv_map)
624 624
625#define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, drm_ctx_t) 625#define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, struct drm_ctx)
626#define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, drm_ctx_t) 626#define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, struct drm_ctx)
627#define DRM_IOCTL_MOD_CTX DRM_IOW( 0x22, drm_ctx_t) 627#define DRM_IOCTL_MOD_CTX DRM_IOW( 0x22, struct drm_ctx)
628#define DRM_IOCTL_GET_CTX DRM_IOWR(0x23, drm_ctx_t) 628#define DRM_IOCTL_GET_CTX DRM_IOWR(0x23, struct drm_ctx)
629#define DRM_IOCTL_SWITCH_CTX DRM_IOW( 0x24, drm_ctx_t) 629#define DRM_IOCTL_SWITCH_CTX DRM_IOW( 0x24, struct drm_ctx)
630#define DRM_IOCTL_NEW_CTX DRM_IOW( 0x25, drm_ctx_t) 630#define DRM_IOCTL_NEW_CTX DRM_IOW( 0x25, struct drm_ctx)
631#define DRM_IOCTL_RES_CTX DRM_IOWR(0x26, drm_ctx_res_t) 631#define DRM_IOCTL_RES_CTX DRM_IOWR(0x26, struct drm_ctx_res)
632#define DRM_IOCTL_ADD_DRAW DRM_IOWR(0x27, drm_draw_t) 632#define DRM_IOCTL_ADD_DRAW DRM_IOWR(0x27, struct drm_draw)
633#define DRM_IOCTL_RM_DRAW DRM_IOWR(0x28, drm_draw_t) 633#define DRM_IOCTL_RM_DRAW DRM_IOWR(0x28, struct drm_draw)
634#define DRM_IOCTL_DMA DRM_IOWR(0x29, drm_dma_t) 634#define DRM_IOCTL_DMA DRM_IOWR(0x29, struct drm_dma)
635#define DRM_IOCTL_LOCK DRM_IOW( 0x2a, drm_lock_t) 635#define DRM_IOCTL_LOCK DRM_IOW( 0x2a, struct drm_lock)
636#define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, drm_lock_t) 636#define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, struct drm_lock)
637#define DRM_IOCTL_FINISH DRM_IOW( 0x2c, drm_lock_t) 637#define DRM_IOCTL_FINISH DRM_IOW( 0x2c, struct drm_lock)
638 638
639#define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30) 639#define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30)
640#define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31) 640#define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31)
641#define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x32, drm_agp_mode_t) 641#define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x32, struct drm_agp_mode)
642#define DRM_IOCTL_AGP_INFO DRM_IOR( 0x33, drm_agp_info_t) 642#define DRM_IOCTL_AGP_INFO DRM_IOR( 0x33, struct drm_agp_info)
643#define DRM_IOCTL_AGP_ALLOC DRM_IOWR(0x34, drm_agp_buffer_t) 643#define DRM_IOCTL_AGP_ALLOC DRM_IOWR(0x34, struct drm_agp_buffer)
644#define DRM_IOCTL_AGP_FREE DRM_IOW( 0x35, drm_agp_buffer_t) 644#define DRM_IOCTL_AGP_FREE DRM_IOW( 0x35, struct drm_agp_buffer)
645#define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, drm_agp_binding_t) 645#define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, struct drm_agp_binding)
646#define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, drm_agp_binding_t) 646#define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, struct drm_agp_binding)
647 647
648#define DRM_IOCTL_SG_ALLOC DRM_IOW( 0x38, drm_scatter_gather_t) 648#define DRM_IOCTL_SG_ALLOC DRM_IOW( 0x38, struct drm_scatter_gather)
649#define DRM_IOCTL_SG_FREE DRM_IOW( 0x39, drm_scatter_gather_t) 649#define DRM_IOCTL_SG_FREE DRM_IOW( 0x39, struct drm_scatter_gather)
650 650
651#define DRM_IOCTL_WAIT_VBLANK DRM_IOWR(0x3a, drm_wait_vblank_t) 651#define DRM_IOCTL_WAIT_VBLANK DRM_IOWR(0x3a, union drm_wait_vblank)
652 652
653#define DRM_IOCTL_UPDATE_DRAW DRM_IOW(0x3f, drm_update_draw_t) 653#define DRM_IOCTL_UPDATE_DRAW DRM_IOW(0x3f, struct drm_update_draw)
654 654
655/** 655/**
656 * Device specific ioctls should only be in their respective headers 656 * Device specific ioctls should only be in their respective headers
@@ -663,4 +663,49 @@ typedef struct drm_set_version {
663#define DRM_COMMAND_BASE 0x40 663#define DRM_COMMAND_BASE 0x40
664#define DRM_COMMAND_END 0xA0 664#define DRM_COMMAND_END 0xA0
665 665
666/* typedef area */
667#ifndef __KERNEL__
668typedef struct drm_clip_rect drm_clip_rect_t;
669typedef struct drm_drawable_info drm_drawable_info_t;
670typedef struct drm_tex_region drm_tex_region_t;
671typedef struct drm_hw_lock drm_hw_lock_t;
672typedef struct drm_version drm_version_t;
673typedef struct drm_unique drm_unique_t;
674typedef struct drm_list drm_list_t;
675typedef struct drm_block drm_block_t;
676typedef struct drm_control drm_control_t;
677typedef enum drm_map_type drm_map_type_t;
678typedef enum drm_map_flags drm_map_flags_t;
679typedef struct drm_ctx_priv_map drm_ctx_priv_map_t;
680typedef struct drm_map drm_map_t;
681typedef struct drm_client drm_client_t;
682typedef enum drm_stat_type drm_stat_type_t;
683typedef struct drm_stats drm_stats_t;
684typedef enum drm_lock_flags drm_lock_flags_t;
685typedef struct drm_lock drm_lock_t;
686typedef enum drm_dma_flags drm_dma_flags_t;
687typedef struct drm_buf_desc drm_buf_desc_t;
688typedef struct drm_buf_info drm_buf_info_t;
689typedef struct drm_buf_free drm_buf_free_t;
690typedef struct drm_buf_pub drm_buf_pub_t;
691typedef struct drm_buf_map drm_buf_map_t;
692typedef struct drm_dma drm_dma_t;
693typedef union drm_wait_vblank drm_wait_vblank_t;
694typedef struct drm_agp_mode drm_agp_mode_t;
695typedef enum drm_ctx_flags drm_ctx_flags_t;
696typedef struct drm_ctx drm_ctx_t;
697typedef struct drm_ctx_res drm_ctx_res_t;
698typedef struct drm_draw drm_draw_t;
699typedef struct drm_update_draw drm_update_draw_t;
700typedef struct drm_auth drm_auth_t;
701typedef struct drm_irq_busid drm_irq_busid_t;
702typedef enum drm_vblank_seq_type drm_vblank_seq_type_t;
703
704typedef struct drm_agp_buffer drm_agp_buffer_t;
705typedef struct drm_agp_binding drm_agp_binding_t;
706typedef struct drm_agp_info drm_agp_info_t;
707typedef struct drm_scatter_gather drm_scatter_gather_t;
708typedef struct drm_set_version drm_set_version_t;
709#endif
710
666#endif 711#endif
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h
index d494315752a2..1277693e9ca4 100644
--- a/drivers/char/drm/drmP.h
+++ b/drivers/char/drm/drmP.h
@@ -274,32 +274,23 @@ typedef struct drm_ioctl_desc {
274 int flags; 274 int flags;
275} drm_ioctl_desc_t; 275} drm_ioctl_desc_t;
276 276
277typedef struct drm_devstate { 277struct drm_magic_entry {
278 pid_t owner; /**< X server pid holding x_lock */
279} drm_devstate_t;
280
281typedef struct drm_magic_entry {
282 drm_hash_item_t hash_item;
283 struct list_head head; 278 struct list_head head;
279 struct drm_hash_item hash_item;
284 struct drm_file *priv; 280 struct drm_file *priv;
285 struct drm_magic_entry *next; 281 struct drm_magic_entry *next;
286} drm_magic_entry_t; 282};
287
288typedef struct drm_magic_head {
289 struct drm_magic_entry *head;
290 struct drm_magic_entry *tail;
291} drm_magic_head_t;
292 283
293typedef struct drm_vma_entry { 284struct drm_vma_entry {
285 struct list_head head;
294 struct vm_area_struct *vma; 286 struct vm_area_struct *vma;
295 struct drm_vma_entry *next;
296 pid_t pid; 287 pid_t pid;
297} drm_vma_entry_t; 288};
298 289
299/** 290/**
300 * DMA buffer. 291 * DMA buffer.
301 */ 292 */
302typedef struct drm_buf { 293struct drm_buf {
303 int idx; /**< Index into master buflist */ 294 int idx; /**< Index into master buflist */
304 int total; /**< Buffer size */ 295 int total; /**< Buffer size */
305 int order; /**< log-base-2(total) */ 296 int order; /**< log-base-2(total) */
@@ -325,30 +316,30 @@ typedef struct drm_buf {
325 316
326 int dev_priv_size; /**< Size of buffer private storage */ 317 int dev_priv_size; /**< Size of buffer private storage */
327 void *dev_private; /**< Per-buffer private storage */ 318 void *dev_private; /**< Per-buffer private storage */
328} drm_buf_t; 319};
329 320
330/** bufs is one longer than it has to be */ 321/** bufs is one longer than it has to be */
331typedef struct drm_waitlist { 322struct drm_waitlist {
332 int count; /**< Number of possible buffers */ 323 int count; /**< Number of possible buffers */
333 drm_buf_t **bufs; /**< List of pointers to buffers */ 324 struct drm_buf **bufs; /**< List of pointers to buffers */
334 drm_buf_t **rp; /**< Read pointer */ 325 struct drm_buf **rp; /**< Read pointer */
335 drm_buf_t **wp; /**< Write pointer */ 326 struct drm_buf **wp; /**< Write pointer */
336 drm_buf_t **end; /**< End pointer */ 327 struct drm_buf **end; /**< End pointer */
337 spinlock_t read_lock; 328 spinlock_t read_lock;
338 spinlock_t write_lock; 329 spinlock_t write_lock;
339} drm_waitlist_t; 330};
340 331
341typedef struct drm_freelist { 332struct drm_freelist {
342 int initialized; /**< Freelist in use */ 333 int initialized; /**< Freelist in use */
343 atomic_t count; /**< Number of free buffers */ 334 atomic_t count; /**< Number of free buffers */
344 drm_buf_t *next; /**< End pointer */ 335 struct drm_buf *next; /**< End pointer */
345 336
346 wait_queue_head_t waiting; /**< Processes waiting on free bufs */ 337 wait_queue_head_t waiting; /**< Processes waiting on free bufs */
347 int low_mark; /**< Low water mark */ 338 int low_mark; /**< Low water mark */
348 int high_mark; /**< High water mark */ 339 int high_mark; /**< High water mark */
349 atomic_t wfh; /**< If waiting for high mark */ 340 atomic_t wfh; /**< If waiting for high mark */
350 spinlock_t lock; 341 spinlock_t lock;
351} drm_freelist_t; 342};
352 343
353typedef struct drm_dma_handle { 344typedef struct drm_dma_handle {
354 dma_addr_t busaddr; 345 dma_addr_t busaddr;
@@ -359,19 +350,19 @@ typedef struct drm_dma_handle {
359/** 350/**
360 * Buffer entry. There is one of this for each buffer size order. 351 * Buffer entry. There is one of this for each buffer size order.
361 */ 352 */
362typedef struct drm_buf_entry { 353struct drm_buf_entry {
363 int buf_size; /**< size */ 354 int buf_size; /**< size */
364 int buf_count; /**< number of buffers */ 355 int buf_count; /**< number of buffers */
365 drm_buf_t *buflist; /**< buffer list */ 356 struct drm_buf *buflist; /**< buffer list */
366 int seg_count; 357 int seg_count;
367 int page_order; 358 int page_order;
368 drm_dma_handle_t **seglist; 359 struct drm_dma_handle **seglist;
369 360
370 drm_freelist_t freelist; 361 struct drm_freelist freelist;
371} drm_buf_entry_t; 362};
372 363
373/** File private data */ 364/** File private data */
374typedef struct drm_file { 365struct drm_file {
375 int authenticated; 366 int authenticated;
376 int master; 367 int master;
377 int minor; 368 int minor;
@@ -379,16 +370,15 @@ typedef struct drm_file {
379 uid_t uid; 370 uid_t uid;
380 drm_magic_t magic; 371 drm_magic_t magic;
381 unsigned long ioctl_count; 372 unsigned long ioctl_count;
382 struct drm_file *next; 373 struct list_head lhead;
383 struct drm_file *prev;
384 struct drm_head *head; 374 struct drm_head *head;
385 int remove_auth_on_close; 375 int remove_auth_on_close;
386 unsigned long lock_count; 376 unsigned long lock_count;
387 void *driver_priv; 377 void *driver_priv;
388} drm_file_t; 378};
389 379
390/** Wait queue */ 380/** Wait queue */
391typedef struct drm_queue { 381struct drm_queue {
392 atomic_t use_count; /**< Outstanding uses (+1) */ 382 atomic_t use_count; /**< Outstanding uses (+1) */
393 atomic_t finalization; /**< Finalization in progress */ 383 atomic_t finalization; /**< Finalization in progress */
394 atomic_t block_count; /**< Count of processes waiting */ 384 atomic_t block_count; /**< Count of processes waiting */
@@ -401,16 +391,16 @@ typedef struct drm_queue {
401 atomic_t total_flushed; /**< Total flushes statistic */ 391 atomic_t total_flushed; /**< Total flushes statistic */
402 atomic_t total_locks; /**< Total locks statistics */ 392 atomic_t total_locks; /**< Total locks statistics */
403#endif 393#endif
404 drm_ctx_flags_t flags; /**< Context preserving and 2D-only */ 394 enum drm_ctx_flags flags; /**< Context preserving and 2D-only */
405 drm_waitlist_t waitlist; /**< Pending buffers */ 395 struct drm_waitlist waitlist; /**< Pending buffers */
406 wait_queue_head_t flush_queue; /**< Processes waiting until flush */ 396 wait_queue_head_t flush_queue; /**< Processes waiting until flush */
407} drm_queue_t; 397};
408 398
409/** 399/**
410 * Lock data. 400 * Lock data.
411 */ 401 */
412typedef struct drm_lock_data { 402struct drm_lock_data {
413 drm_hw_lock_t *hw_lock; /**< Hardware lock */ 403 struct drm_hw_lock *hw_lock; /**< Hardware lock */
414 struct file *filp; /**< File descr of lock holder (0=kernel) */ 404 struct file *filp; /**< File descr of lock holder (0=kernel) */
415 wait_queue_head_t lock_queue; /**< Queue of blocked processes */ 405 wait_queue_head_t lock_queue; /**< Queue of blocked processes */
416 unsigned long lock_time; /**< Time of last lock in jiffies */ 406 unsigned long lock_time; /**< Time of last lock in jiffies */
@@ -418,16 +408,16 @@ typedef struct drm_lock_data {
418 uint32_t kernel_waiters; 408 uint32_t kernel_waiters;
419 uint32_t user_waiters; 409 uint32_t user_waiters;
420 int idle_has_lock; 410 int idle_has_lock;
421} drm_lock_data_t; 411};
422 412
423/** 413/**
424 * DMA data. 414 * DMA data.
425 */ 415 */
426typedef struct drm_device_dma { 416struct drm_device_dma {
427 417
428 drm_buf_entry_t bufs[DRM_MAX_ORDER + 1]; /**< buffers, grouped by their size order */ 418 struct drm_buf_entry bufs[DRM_MAX_ORDER + 1]; /**< buffers, grouped by their size order */
429 int buf_count; /**< total number of buffers */ 419 int buf_count; /**< total number of buffers */
430 drm_buf_t **buflist; /**< Vector of pointers into drm_device_dma::bufs */ 420 struct drm_buf **buflist; /**< Vector of pointers into drm_device_dma::bufs */
431 int seg_count; 421 int seg_count;
432 int page_count; /**< number of pages */ 422 int page_count; /**< number of pages */
433 unsigned long *pagelist; /**< page list */ 423 unsigned long *pagelist; /**< page list */
@@ -439,28 +429,27 @@ typedef struct drm_device_dma {
439 _DRM_DMA_USE_PCI_RO = 0x08 429 _DRM_DMA_USE_PCI_RO = 0x08
440 } flags; 430 } flags;
441 431
442} drm_device_dma_t; 432};
443 433
444/** 434/**
445 * AGP memory entry. Stored as a doubly linked list. 435 * AGP memory entry. Stored as a doubly linked list.
446 */ 436 */
447typedef struct drm_agp_mem { 437struct drm_agp_mem {
448 unsigned long handle; /**< handle */ 438 unsigned long handle; /**< handle */
449 DRM_AGP_MEM *memory; 439 DRM_AGP_MEM *memory;
450 unsigned long bound; /**< address */ 440 unsigned long bound; /**< address */
451 int pages; 441 int pages;
452 struct drm_agp_mem *prev; /**< previous entry */ 442 struct list_head head;
453 struct drm_agp_mem *next; /**< next entry */ 443};
454} drm_agp_mem_t;
455 444
456/** 445/**
457 * AGP data. 446 * AGP data.
458 * 447 *
459 * \sa drm_agp_init() and drm_device::agp. 448 * \sa drm_agp_init() and drm_device::agp.
460 */ 449 */
461typedef struct drm_agp_head { 450struct drm_agp_head {
462 DRM_AGP_KERN agp_info; /**< AGP device information */ 451 DRM_AGP_KERN agp_info; /**< AGP device information */
463 drm_agp_mem_t *memory; /**< memory entries */ 452 struct list_head memory;
464 unsigned long mode; /**< AGP mode */ 453 unsigned long mode; /**< AGP mode */
465 struct agp_bridge_data *bridge; 454 struct agp_bridge_data *bridge;
466 int enabled; /**< whether the AGP bus as been enabled */ 455 int enabled; /**< whether the AGP bus as been enabled */
@@ -469,51 +458,51 @@ typedef struct drm_agp_head {
469 int agp_mtrr; 458 int agp_mtrr;
470 int cant_use_aperture; 459 int cant_use_aperture;
471 unsigned long page_mask; 460 unsigned long page_mask;
472} drm_agp_head_t; 461};
473 462
474/** 463/**
475 * Scatter-gather memory. 464 * Scatter-gather memory.
476 */ 465 */
477typedef struct drm_sg_mem { 466struct drm_sg_mem {
478 unsigned long handle; 467 unsigned long handle;
479 void *virtual; 468 void *virtual;
480 int pages; 469 int pages;
481 struct page **pagelist; 470 struct page **pagelist;
482 dma_addr_t *busaddr; 471 dma_addr_t *busaddr;
483} drm_sg_mem_t; 472};
484 473
485typedef struct drm_sigdata { 474struct drm_sigdata {
486 int context; 475 int context;
487 drm_hw_lock_t *lock; 476 struct drm_hw_lock *lock;
488} drm_sigdata_t; 477};
489 478
490/** 479/**
491 * Mappings list 480 * Mappings list
492 */ 481 */
493typedef struct drm_map_list { 482struct drm_map_list {
494 struct list_head head; /**< list head */ 483 struct list_head head; /**< list head */
495 drm_hash_item_t hash; 484 struct drm_hash_item hash;
496 drm_map_t *map; /**< mapping */ 485 struct drm_map *map; /**< mapping */
497 unsigned int user_token; 486 unsigned int user_token;
498} drm_map_list_t; 487};
499 488
500typedef drm_map_t drm_local_map_t; 489typedef struct drm_map drm_local_map_t;
501 490
502/** 491/**
503 * Context handle list 492 * Context handle list
504 */ 493 */
505typedef struct drm_ctx_list { 494struct drm_ctx_list {
506 struct list_head head; /**< list head */ 495 struct list_head head; /**< list head */
507 drm_context_t handle; /**< context handle */ 496 drm_context_t handle; /**< context handle */
508 drm_file_t *tag; /**< associated fd private data */ 497 struct drm_file *tag; /**< associated fd private data */
509} drm_ctx_list_t; 498};
510 499
511typedef struct drm_vbl_sig { 500struct drm_vbl_sig {
512 struct list_head head; 501 struct list_head head;
513 unsigned int sequence; 502 unsigned int sequence;
514 struct siginfo info; 503 struct siginfo info;
515 struct task_struct *task; 504 struct task_struct *task;
516} drm_vbl_sig_t; 505};
517 506
518/* location of GART table */ 507/* location of GART table */
519#define DRM_ATI_GART_MAIN 1 508#define DRM_ATI_GART_MAIN 1
@@ -523,19 +512,19 @@ typedef struct drm_vbl_sig {
523#define DRM_ATI_GART_PCIE 2 512#define DRM_ATI_GART_PCIE 2
524#define DRM_ATI_GART_IGP 3 513#define DRM_ATI_GART_IGP 3
525 514
526typedef struct ati_pcigart_info { 515struct drm_ati_pcigart_info {
527 int gart_table_location; 516 int gart_table_location;
528 int gart_reg_if; 517 int gart_reg_if;
529 void *addr; 518 void *addr;
530 dma_addr_t bus_addr; 519 dma_addr_t bus_addr;
531 drm_local_map_t mapping; 520 drm_local_map_t mapping;
532 int table_size; 521 int table_size;
533} drm_ati_pcigart_info; 522};
534 523
535/* 524/*
536 * Generic memory manager structs 525 * Generic memory manager structs
537 */ 526 */
538typedef struct drm_mm_node { 527struct drm_mm_node {
539 struct list_head fl_entry; 528 struct list_head fl_entry;
540 struct list_head ml_entry; 529 struct list_head ml_entry;
541 int free; 530 int free;
@@ -543,12 +532,12 @@ typedef struct drm_mm_node {
543 unsigned long size; 532 unsigned long size;
544 struct drm_mm *mm; 533 struct drm_mm *mm;
545 void *private; 534 void *private;
546} drm_mm_node_t; 535};
547 536
548typedef struct drm_mm { 537struct drm_mm {
549 struct list_head fl_entry; 538 struct list_head fl_entry;
550 struct list_head ml_entry; 539 struct list_head ml_entry;
551} drm_mm_t; 540};
552 541
553/** 542/**
554 * DRM driver structure. This structure represent the common code for 543 * DRM driver structure. This structure represent the common code for
@@ -560,21 +549,21 @@ struct drm_device;
560struct drm_driver { 549struct drm_driver {
561 int (*load) (struct drm_device *, unsigned long flags); 550 int (*load) (struct drm_device *, unsigned long flags);
562 int (*firstopen) (struct drm_device *); 551 int (*firstopen) (struct drm_device *);
563 int (*open) (struct drm_device *, drm_file_t *); 552 int (*open) (struct drm_device *, struct drm_file *);
564 void (*preclose) (struct drm_device *, struct file * filp); 553 void (*preclose) (struct drm_device *, struct file * filp);
565 void (*postclose) (struct drm_device *, drm_file_t *); 554 void (*postclose) (struct drm_device *, struct drm_file *);
566 void (*lastclose) (struct drm_device *); 555 void (*lastclose) (struct drm_device *);
567 int (*unload) (struct drm_device *); 556 int (*unload) (struct drm_device *);
568 int (*dma_ioctl) (DRM_IOCTL_ARGS); 557 int (*dma_ioctl) (DRM_IOCTL_ARGS);
569 void (*dma_ready) (struct drm_device *); 558 void (*dma_ready) (struct drm_device *);
570 int (*dma_quiescent) (struct drm_device *); 559 int (*dma_quiescent) (struct drm_device *);
571 int (*context_ctor) (struct drm_device * dev, int context); 560 int (*context_ctor) (struct drm_device *dev, int context);
572 int (*context_dtor) (struct drm_device * dev, int context); 561 int (*context_dtor) (struct drm_device *dev, int context);
573 int (*kernel_context_switch) (struct drm_device * dev, int old, 562 int (*kernel_context_switch) (struct drm_device *dev, int old,
574 int new); 563 int new);
575 void (*kernel_context_switch_unlock) (struct drm_device * dev); 564 void (*kernel_context_switch_unlock) (struct drm_device *dev);
576 int (*vblank_wait) (struct drm_device * dev, unsigned int *sequence); 565 int (*vblank_wait) (struct drm_device *dev, unsigned int *sequence);
577 int (*vblank_wait2) (struct drm_device * dev, unsigned int *sequence); 566 int (*vblank_wait2) (struct drm_device *dev, unsigned int *sequence);
578 int (*dri_library_name) (struct drm_device *dev, char *buf); 567 int (*dri_library_name) (struct drm_device *dev, char *buf);
579 568
580 /** 569 /**
@@ -588,22 +577,23 @@ struct drm_driver {
588 * card is absolutely \b not AGP (return of 0), absolutely \b is AGP 577 * card is absolutely \b not AGP (return of 0), absolutely \b is AGP
589 * (return of 1), or may or may not be AGP (return of 2). 578 * (return of 1), or may or may not be AGP (return of 2).
590 */ 579 */
591 int (*device_is_agp) (struct drm_device * dev); 580 int (*device_is_agp) (struct drm_device *dev);
592 581
593 /* these have to be filled in */ 582 /* these have to be filled in */
594 583
595 irqreturn_t(*irq_handler) (DRM_IRQ_ARGS); 584 irqreturn_t(*irq_handler) (DRM_IRQ_ARGS);
596 void (*irq_preinstall) (struct drm_device * dev); 585 void (*irq_preinstall) (struct drm_device *dev);
597 void (*irq_postinstall) (struct drm_device * dev); 586 void (*irq_postinstall) (struct drm_device *dev);
598 void (*irq_uninstall) (struct drm_device * dev); 587 void (*irq_uninstall) (struct drm_device *dev);
599 void (*reclaim_buffers) (struct drm_device * dev, struct file * filp); 588 void (*reclaim_buffers) (struct drm_device *dev, struct file * filp);
600 void (*reclaim_buffers_locked) (struct drm_device *dev, 589 void (*reclaim_buffers_locked) (struct drm_device *dev,
601 struct file *filp); 590 struct file *filp);
602 void (*reclaim_buffers_idlelocked) (struct drm_device *dev, 591 void (*reclaim_buffers_idlelocked) (struct drm_device *dev,
603 struct file * filp); 592 struct file * filp);
604 unsigned long (*get_map_ofs) (drm_map_t * map); 593 unsigned long (*get_map_ofs) (struct drm_map * map);
605 unsigned long (*get_reg_ofs) (struct drm_device * dev); 594 unsigned long (*get_reg_ofs) (struct drm_device *dev);
606 void (*set_version) (struct drm_device * dev, drm_set_version_t * sv); 595 void (*set_version) (struct drm_device *dev,
596 struct drm_set_version *sv);
607 597
608 int major; 598 int major;
609 int minor; 599 int minor;
@@ -625,19 +615,19 @@ struct drm_driver {
625 * that may contain multiple heads. Embed one per head of these in the 615 * that may contain multiple heads. Embed one per head of these in the
626 * private drm_device structure. 616 * private drm_device structure.
627 */ 617 */
628typedef struct drm_head { 618struct drm_head {
629 int minor; /**< Minor device number */ 619 int minor; /**< Minor device number */
630 struct drm_device *dev; 620 struct drm_device *dev;
631 struct proc_dir_entry *dev_root; /**< proc directory entry */ 621 struct proc_dir_entry *dev_root; /**< proc directory entry */
632 dev_t device; /**< Device number for mknod */ 622 dev_t device; /**< Device number for mknod */
633 struct class_device *dev_class; 623 struct class_device *dev_class;
634} drm_head_t; 624};
635 625
636/** 626/**
637 * DRM device structure. This structure represent a complete card that 627 * DRM device structure. This structure represent a complete card that
638 * may contain multiple heads. 628 * may contain multiple heads.
639 */ 629 */
640typedef struct drm_device { 630struct drm_device {
641 char *unique; /**< Unique identifier: e.g., busid */ 631 char *unique; /**< Unique identifier: e.g., busid */
642 int unique_len; /**< Length of unique field */ 632 int unique_len; /**< Length of unique field */
643 char *devname; /**< For /proc/interrupts */ 633 char *devname; /**< For /proc/interrupts */
@@ -663,35 +653,34 @@ typedef struct drm_device {
663 /** \name Performance counters */ 653 /** \name Performance counters */
664 /*@{ */ 654 /*@{ */
665 unsigned long counters; 655 unsigned long counters;
666 drm_stat_type_t types[15]; 656 enum drm_stat_type types[15];
667 atomic_t counts[15]; 657 atomic_t counts[15];
668 /*@} */ 658 /*@} */
669 659
670 /** \name Authentication */ 660 /** \name Authentication */
671 /*@{ */ 661 /*@{ */
672 drm_file_t *file_first; /**< file list head */ 662 struct list_head filelist;
673 drm_file_t *file_last; /**< file list tail */ 663 struct drm_open_hash magiclist; /**< magic hash table */
674 drm_open_hash_t magiclist; /**< magic hash table */
675 struct list_head magicfree; 664 struct list_head magicfree;
676 /*@} */ 665 /*@} */
677 666
678 /** \name Memory management */ 667 /** \name Memory management */
679 /*@{ */ 668 /*@{ */
680 drm_map_list_t *maplist; /**< Linked list of regions */ 669 struct list_head maplist; /**< Linked list of regions */
681 int map_count; /**< Number of mappable regions */ 670 int map_count; /**< Number of mappable regions */
682 drm_open_hash_t map_hash; /**< User token hash table for maps */ 671 struct drm_open_hash map_hash; /**< User token hash table for maps */
683 672
684 /** \name Context handle management */ 673 /** \name Context handle management */
685 /*@{ */ 674 /*@{ */
686 drm_ctx_list_t *ctxlist; /**< Linked list of context handles */ 675 struct list_head ctxlist; /**< Linked list of context handles */
687 int ctx_count; /**< Number of context handles */ 676 int ctx_count; /**< Number of context handles */
688 struct mutex ctxlist_mutex; /**< For ctxlist */ 677 struct mutex ctxlist_mutex; /**< For ctxlist */
689 678
690 drm_map_t **context_sareas; /**< per-context SAREA's */ 679 struct drm_map **context_sareas; /**< per-context SAREA's */
691 int max_context; 680 int max_context;
692 681
693 drm_vma_entry_t *vmalist; /**< List of vmas (for debugging) */ 682 struct list_head vmalist; /**< List of vmas (for debugging) */
694 drm_lock_data_t lock; /**< Information on hardware lock */ 683 struct drm_lock_data lock; /**< Information on hardware lock */
695 /*@} */ 684 /*@} */
696 685
697 /** \name DMA queues (contexts) */ 686 /** \name DMA queues (contexts) */
@@ -699,8 +688,8 @@ typedef struct drm_device {
699 int queue_count; /**< Number of active DMA queues */ 688 int queue_count; /**< Number of active DMA queues */
700 int queue_reserved; /**< Number of reserved DMA queues */ 689 int queue_reserved; /**< Number of reserved DMA queues */
701 int queue_slots; /**< Actual length of queuelist */ 690 int queue_slots; /**< Actual length of queuelist */
702 drm_queue_t **queuelist; /**< Vector of pointers to DMA queues */ 691 struct drm_queue **queuelist; /**< Vector of pointers to DMA queues */
703 drm_device_dma_t *dma; /**< Optional pointer for DMA support */ 692 struct drm_device_dma *dma; /**< Optional pointer for DMA support */
704 /*@} */ 693 /*@} */
705 694
706 /** \name Context support */ 695 /** \name Context support */
@@ -725,8 +714,8 @@ typedef struct drm_device {
725 atomic_t vbl_received; 714 atomic_t vbl_received;
726 atomic_t vbl_received2; /**< number of secondary VBLANK interrupts */ 715 atomic_t vbl_received2; /**< number of secondary VBLANK interrupts */
727 spinlock_t vbl_lock; 716 spinlock_t vbl_lock;
728 drm_vbl_sig_t vbl_sigs; /**< signal list to send on VBLANK */ 717 struct list_head vbl_sigs; /**< signal list to send on VBLANK */
729 drm_vbl_sig_t vbl_sigs2; /**< signals to send on secondary VBLANK */ 718 struct list_head vbl_sigs2; /**< signals to send on secondary VBLANK */
730 unsigned int vbl_pending; 719 unsigned int vbl_pending;
731 spinlock_t tasklet_lock; /**< For drm_locked_tasklet */ 720 spinlock_t tasklet_lock; /**< For drm_locked_tasklet */
732 void (*locked_tasklet_func)(struct drm_device *dev); 721 void (*locked_tasklet_func)(struct drm_device *dev);
@@ -739,7 +728,7 @@ typedef struct drm_device {
739 wait_queue_head_t buf_readers; /**< Processes waiting to read */ 728 wait_queue_head_t buf_readers; /**< Processes waiting to read */
740 wait_queue_head_t buf_writers; /**< Processes waiting to ctx switch */ 729 wait_queue_head_t buf_writers; /**< Processes waiting to ctx switch */
741 730
742 drm_agp_head_t *agp; /**< AGP data */ 731 struct drm_agp_head *agp; /**< AGP data */
743 732
744 struct pci_dev *pdev; /**< PCI device structure */ 733 struct pci_dev *pdev; /**< PCI device structure */
745 int pci_vendor; /**< PCI vendor id */ 734 int pci_vendor; /**< PCI vendor id */
@@ -747,16 +736,16 @@ typedef struct drm_device {
747#ifdef __alpha__ 736#ifdef __alpha__
748 struct pci_controller *hose; 737 struct pci_controller *hose;
749#endif 738#endif
750 drm_sg_mem_t *sg; /**< Scatter gather memory */ 739 struct drm_sg_mem *sg; /**< Scatter gather memory */
751 unsigned long *ctx_bitmap; /**< context bitmap */ 740 unsigned long *ctx_bitmap; /**< context bitmap */
752 void *dev_private; /**< device private data */ 741 void *dev_private; /**< device private data */
753 drm_sigdata_t sigdata; /**< For block_all_signals */ 742 struct drm_sigdata sigdata; /**< For block_all_signals */
754 sigset_t sigmask; 743 sigset_t sigmask;
755 744
756 struct drm_driver *driver; 745 struct drm_driver *driver;
757 drm_local_map_t *agp_buffer_map; 746 drm_local_map_t *agp_buffer_map;
758 unsigned int agp_buffer_token; 747 unsigned int agp_buffer_token;
759 drm_head_t primary; /**< primary screen head */ 748 struct drm_head primary; /**< primary screen head */
760 749
761 /** \name Drawable information */ 750 /** \name Drawable information */
762 /*@{ */ 751 /*@{ */
@@ -764,9 +753,9 @@ typedef struct drm_device {
764 unsigned int drw_bitfield_length; 753 unsigned int drw_bitfield_length;
765 u32 *drw_bitfield; 754 u32 *drw_bitfield;
766 unsigned int drw_info_length; 755 unsigned int drw_info_length;
767 drm_drawable_info_t **drw_info; 756 struct drm_drawable_info **drw_info;
768 /*@} */ 757 /*@} */
769} drm_device_t; 758};
770 759
771static __inline__ int drm_core_check_feature(struct drm_device *dev, 760static __inline__ int drm_core_check_feature(struct drm_device *dev,
772 int feature) 761 int feature)
@@ -838,7 +827,7 @@ extern int drm_ioctl(struct inode *inode, struct file *filp,
838 unsigned int cmd, unsigned long arg); 827 unsigned int cmd, unsigned long arg);
839extern long drm_compat_ioctl(struct file *filp, 828extern long drm_compat_ioctl(struct file *filp,
840 unsigned int cmd, unsigned long arg); 829 unsigned int cmd, unsigned long arg);
841extern int drm_lastclose(drm_device_t *dev); 830extern int drm_lastclose(struct drm_device *dev);
842 831
843 /* Device support (drm_fops.h) */ 832 /* Device support (drm_fops.h) */
844extern int drm_open(struct inode *inode, struct file *filp); 833extern int drm_open(struct inode *inode, struct file *filp);
@@ -857,7 +846,7 @@ extern int drm_mem_info(char *buf, char **start, off_t offset,
857 int request, int *eof, void *data); 846 int request, int *eof, void *data);
858extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area); 847extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area);
859 848
860extern DRM_AGP_MEM *drm_alloc_agp(drm_device_t * dev, int pages, u32 type); 849extern DRM_AGP_MEM *drm_alloc_agp(struct drm_device *dev, int pages, u32 type);
861extern int drm_free_agp(DRM_AGP_MEM * handle, int pages); 850extern int drm_free_agp(DRM_AGP_MEM * handle, int pages);
862extern int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start); 851extern int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start);
863extern int drm_unbind_agp(DRM_AGP_MEM * handle); 852extern int drm_unbind_agp(DRM_AGP_MEM * handle);
@@ -896,9 +885,9 @@ extern int drm_newctx(struct inode *inode, struct file *filp,
896extern int drm_rmctx(struct inode *inode, struct file *filp, 885extern int drm_rmctx(struct inode *inode, struct file *filp,
897 unsigned int cmd, unsigned long arg); 886 unsigned int cmd, unsigned long arg);
898 887
899extern int drm_ctxbitmap_init(drm_device_t * dev); 888extern int drm_ctxbitmap_init(struct drm_device *dev);
900extern void drm_ctxbitmap_cleanup(drm_device_t * dev); 889extern void drm_ctxbitmap_cleanup(struct drm_device *dev);
901extern void drm_ctxbitmap_free(drm_device_t * dev, int ctx_handle); 890extern void drm_ctxbitmap_free(struct drm_device *dev, int ctx_handle);
902 891
903extern int drm_setsareactx(struct inode *inode, struct file *filp, 892extern int drm_setsareactx(struct inode *inode, struct file *filp,
904 unsigned int cmd, unsigned long arg); 893 unsigned int cmd, unsigned long arg);
@@ -912,7 +901,7 @@ extern int drm_rmdraw(struct inode *inode, struct file *filp,
912 unsigned int cmd, unsigned long arg); 901 unsigned int cmd, unsigned long arg);
913extern int drm_update_drawable_info(struct inode *inode, struct file *filp, 902extern int drm_update_drawable_info(struct inode *inode, struct file *filp,
914 unsigned int cmd, unsigned long arg); 903 unsigned int cmd, unsigned long arg);
915extern drm_drawable_info_t *drm_get_drawable_info(drm_device_t *dev, 904extern struct drm_drawable_info *drm_get_drawable_info(struct drm_device *dev,
916 drm_drawable_t id); 905 drm_drawable_t id);
917 906
918 /* Authentication IOCTL support (drm_auth.h) */ 907 /* Authentication IOCTL support (drm_auth.h) */
@@ -926,10 +915,10 @@ extern int drm_lock(struct inode *inode, struct file *filp,
926 unsigned int cmd, unsigned long arg); 915 unsigned int cmd, unsigned long arg);
927extern int drm_unlock(struct inode *inode, struct file *filp, 916extern int drm_unlock(struct inode *inode, struct file *filp,
928 unsigned int cmd, unsigned long arg); 917 unsigned int cmd, unsigned long arg);
929extern int drm_lock_take(drm_lock_data_t *lock_data, unsigned int context); 918extern int drm_lock_take(struct drm_lock_data *lock_data, unsigned int context);
930extern int drm_lock_free(drm_lock_data_t *lock_data, unsigned int context); 919extern int drm_lock_free(struct drm_lock_data *lock_data, unsigned int context);
931extern void drm_idlelock_take(drm_lock_data_t *lock_data); 920extern void drm_idlelock_take(struct drm_lock_data *lock_data);
932extern void drm_idlelock_release(drm_lock_data_t *lock_data); 921extern void drm_idlelock_release(struct drm_lock_data *lock_data);
933 922
934/* 923/*
935 * These are exported to drivers so that they can implement fencing using 924 * These are exported to drivers so that they can implement fencing using
@@ -940,15 +929,15 @@ extern int drm_i_have_hw_lock(struct file *filp);
940extern int drm_kernel_take_hw_lock(struct file *filp); 929extern int drm_kernel_take_hw_lock(struct file *filp);
941 930
942 /* Buffer management support (drm_bufs.h) */ 931 /* Buffer management support (drm_bufs.h) */
943extern int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request); 932extern int drm_addbufs_agp(struct drm_device *dev, struct drm_buf_desc * request);
944extern int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request); 933extern int drm_addbufs_pci(struct drm_device *dev, struct drm_buf_desc * request);
945extern int drm_addmap(drm_device_t * dev, unsigned int offset, 934extern int drm_addmap(struct drm_device *dev, unsigned int offset,
946 unsigned int size, drm_map_type_t type, 935 unsigned int size, enum drm_map_type type,
947 drm_map_flags_t flags, drm_local_map_t ** map_ptr); 936 enum drm_map_flags flags, drm_local_map_t ** map_ptr);
948extern int drm_addmap_ioctl(struct inode *inode, struct file *filp, 937extern int drm_addmap_ioctl(struct inode *inode, struct file *filp,
949 unsigned int cmd, unsigned long arg); 938 unsigned int cmd, unsigned long arg);
950extern int drm_rmmap(drm_device_t * dev, drm_local_map_t * map); 939extern int drm_rmmap(struct drm_device *dev, drm_local_map_t * map);
951extern int drm_rmmap_locked(drm_device_t * dev, drm_local_map_t * map); 940extern int drm_rmmap_locked(struct drm_device *dev, drm_local_map_t * map);
952extern int drm_rmmap_ioctl(struct inode *inode, struct file *filp, 941extern int drm_rmmap_ioctl(struct inode *inode, struct file *filp,
953 unsigned int cmd, unsigned long arg); 942 unsigned int cmd, unsigned long arg);
954 943
@@ -963,56 +952,56 @@ extern int drm_freebufs(struct inode *inode, struct file *filp,
963 unsigned int cmd, unsigned long arg); 952 unsigned int cmd, unsigned long arg);
964extern int drm_mapbufs(struct inode *inode, struct file *filp, 953extern int drm_mapbufs(struct inode *inode, struct file *filp,
965 unsigned int cmd, unsigned long arg); 954 unsigned int cmd, unsigned long arg);
966extern unsigned long drm_get_resource_start(drm_device_t * dev, 955extern unsigned long drm_get_resource_start(struct drm_device *dev,
967 unsigned int resource); 956 unsigned int resource);
968extern unsigned long drm_get_resource_len(drm_device_t * dev, 957extern unsigned long drm_get_resource_len(struct drm_device *dev,
969 unsigned int resource); 958 unsigned int resource);
970 959
971 /* DMA support (drm_dma.h) */ 960 /* DMA support (drm_dma.h) */
972extern int drm_dma_setup(drm_device_t * dev); 961extern int drm_dma_setup(struct drm_device *dev);
973extern void drm_dma_takedown(drm_device_t * dev); 962extern void drm_dma_takedown(struct drm_device *dev);
974extern void drm_free_buffer(drm_device_t * dev, drm_buf_t * buf); 963extern void drm_free_buffer(struct drm_device *dev, struct drm_buf * buf);
975extern void drm_core_reclaim_buffers(drm_device_t * dev, struct file *filp); 964extern void drm_core_reclaim_buffers(struct drm_device *dev, struct file *filp);
976 965
977 /* IRQ support (drm_irq.h) */ 966 /* IRQ support (drm_irq.h) */
978extern int drm_control(struct inode *inode, struct file *filp, 967extern int drm_control(struct inode *inode, struct file *filp,
979 unsigned int cmd, unsigned long arg); 968 unsigned int cmd, unsigned long arg);
980extern irqreturn_t drm_irq_handler(DRM_IRQ_ARGS); 969extern irqreturn_t drm_irq_handler(DRM_IRQ_ARGS);
981extern int drm_irq_uninstall(drm_device_t * dev); 970extern int drm_irq_uninstall(struct drm_device *dev);
982extern void drm_driver_irq_preinstall(drm_device_t * dev); 971extern void drm_driver_irq_preinstall(struct drm_device *dev);
983extern void drm_driver_irq_postinstall(drm_device_t * dev); 972extern void drm_driver_irq_postinstall(struct drm_device *dev);
984extern void drm_driver_irq_uninstall(drm_device_t * dev); 973extern void drm_driver_irq_uninstall(struct drm_device *dev);
985 974
986extern int drm_wait_vblank(struct inode *inode, struct file *filp, 975extern int drm_wait_vblank(struct inode *inode, struct file *filp,
987 unsigned int cmd, unsigned long arg); 976 unsigned int cmd, unsigned long arg);
988extern int drm_vblank_wait(drm_device_t * dev, unsigned int *vbl_seq); 977extern int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq);
989extern void drm_vbl_send_signals(drm_device_t * dev); 978extern void drm_vbl_send_signals(struct drm_device *dev);
990extern void drm_locked_tasklet(drm_device_t *dev, void(*func)(drm_device_t*)); 979extern void drm_locked_tasklet(struct drm_device *dev, void(*func)(struct drm_device*));
991 980
992 /* AGP/GART support (drm_agpsupport.h) */ 981 /* AGP/GART support (drm_agpsupport.h) */
993extern drm_agp_head_t *drm_agp_init(drm_device_t * dev); 982extern struct drm_agp_head *drm_agp_init(struct drm_device *dev);
994extern int drm_agp_acquire(drm_device_t * dev); 983extern int drm_agp_acquire(struct drm_device *dev);
995extern int drm_agp_acquire_ioctl(struct inode *inode, struct file *filp, 984extern int drm_agp_acquire_ioctl(struct inode *inode, struct file *filp,
996 unsigned int cmd, unsigned long arg); 985 unsigned int cmd, unsigned long arg);
997extern int drm_agp_release(drm_device_t * dev); 986extern int drm_agp_release(struct drm_device *dev);
998extern int drm_agp_release_ioctl(struct inode *inode, struct file *filp, 987extern int drm_agp_release_ioctl(struct inode *inode, struct file *filp,
999 unsigned int cmd, unsigned long arg); 988 unsigned int cmd, unsigned long arg);
1000extern int drm_agp_enable(drm_device_t * dev, drm_agp_mode_t mode); 989extern int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode);
1001extern int drm_agp_enable_ioctl(struct inode *inode, struct file *filp, 990extern int drm_agp_enable_ioctl(struct inode *inode, struct file *filp,
1002 unsigned int cmd, unsigned long arg); 991 unsigned int cmd, unsigned long arg);
1003extern int drm_agp_info(drm_device_t * dev, drm_agp_info_t * info); 992extern int drm_agp_info(struct drm_device *dev, struct drm_agp_info * info);
1004extern int drm_agp_info_ioctl(struct inode *inode, struct file *filp, 993extern int drm_agp_info_ioctl(struct inode *inode, struct file *filp,
1005 unsigned int cmd, unsigned long arg); 994 unsigned int cmd, unsigned long arg);
1006extern int drm_agp_alloc(drm_device_t *dev, drm_agp_buffer_t *request); 995extern int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request);
1007extern int drm_agp_alloc_ioctl(struct inode *inode, struct file *filp, 996extern int drm_agp_alloc_ioctl(struct inode *inode, struct file *filp,
1008 unsigned int cmd, unsigned long arg); 997 unsigned int cmd, unsigned long arg);
1009extern int drm_agp_free(drm_device_t *dev, drm_agp_buffer_t *request); 998extern int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request);
1010extern int drm_agp_free_ioctl(struct inode *inode, struct file *filp, 999extern int drm_agp_free_ioctl(struct inode *inode, struct file *filp,
1011 unsigned int cmd, unsigned long arg); 1000 unsigned int cmd, unsigned long arg);
1012extern int drm_agp_unbind(drm_device_t *dev, drm_agp_binding_t *request); 1001extern int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request);
1013extern int drm_agp_unbind_ioctl(struct inode *inode, struct file *filp, 1002extern int drm_agp_unbind_ioctl(struct inode *inode, struct file *filp,
1014 unsigned int cmd, unsigned long arg); 1003 unsigned int cmd, unsigned long arg);
1015extern int drm_agp_bind(drm_device_t *dev, drm_agp_binding_t *request); 1004extern int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request);
1016extern int drm_agp_bind_ioctl(struct inode *inode, struct file *filp, 1005extern int drm_agp_bind_ioctl(struct inode *inode, struct file *filp,
1017 unsigned int cmd, unsigned long arg); 1006 unsigned int cmd, unsigned long arg);
1018extern DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data *bridge, 1007extern DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data *bridge,
@@ -1024,16 +1013,18 @@ extern int drm_agp_unbind_memory(DRM_AGP_MEM * handle);
1024 /* Stub support (drm_stub.h) */ 1013 /* Stub support (drm_stub.h) */
1025extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent, 1014extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
1026 struct drm_driver *driver); 1015 struct drm_driver *driver);
1027extern int drm_put_dev(drm_device_t * dev); 1016extern int drm_put_dev(struct drm_device *dev);
1028extern int drm_put_head(drm_head_t * head); 1017extern int drm_put_head(struct drm_head *head);
1029extern unsigned int drm_debug; 1018extern unsigned int drm_debug;
1030extern unsigned int drm_cards_limit; 1019extern unsigned int drm_cards_limit;
1031extern drm_head_t **drm_heads; 1020extern struct drm_head **drm_heads;
1032extern struct class *drm_class; 1021extern struct class *drm_class;
1033extern struct proc_dir_entry *drm_proc_root; 1022extern struct proc_dir_entry *drm_proc_root;
1034 1023
1024extern drm_local_map_t *drm_getsarea(struct drm_device *dev);
1025
1035 /* Proc support (drm_proc.h) */ 1026 /* Proc support (drm_proc.h) */
1036extern int drm_proc_init(drm_device_t * dev, 1027extern int drm_proc_init(struct drm_device *dev,
1037 int minor, 1028 int minor,
1038 struct proc_dir_entry *root, 1029 struct proc_dir_entry *root,
1039 struct proc_dir_entry **dev_root); 1030 struct proc_dir_entry **dev_root);
@@ -1042,45 +1033,45 @@ extern int drm_proc_cleanup(int minor,
1042 struct proc_dir_entry *dev_root); 1033 struct proc_dir_entry *dev_root);
1043 1034
1044 /* Scatter Gather Support (drm_scatter.h) */ 1035 /* Scatter Gather Support (drm_scatter.h) */
1045extern void drm_sg_cleanup(drm_sg_mem_t * entry); 1036extern void drm_sg_cleanup(struct drm_sg_mem * entry);
1046extern int drm_sg_alloc(struct inode *inode, struct file *filp, 1037extern int drm_sg_alloc(struct inode *inode, struct file *filp,
1047 unsigned int cmd, unsigned long arg); 1038 unsigned int cmd, unsigned long arg);
1048extern int drm_sg_free(struct inode *inode, struct file *filp, 1039extern int drm_sg_free(struct inode *inode, struct file *filp,
1049 unsigned int cmd, unsigned long arg); 1040 unsigned int cmd, unsigned long arg);
1050 1041
1051 /* ATI PCIGART support (ati_pcigart.h) */ 1042 /* ATI PCIGART support (ati_pcigart.h) */
1052extern int drm_ati_pcigart_init(drm_device_t * dev, 1043extern int drm_ati_pcigart_init(struct drm_device *dev,
1053 drm_ati_pcigart_info * gart_info); 1044 struct drm_ati_pcigart_info * gart_info);
1054extern int drm_ati_pcigart_cleanup(drm_device_t * dev, 1045extern int drm_ati_pcigart_cleanup(struct drm_device *dev,
1055 drm_ati_pcigart_info * gart_info); 1046 struct drm_ati_pcigart_info * gart_info);
1056 1047
1057extern drm_dma_handle_t *drm_pci_alloc(drm_device_t * dev, size_t size, 1048extern drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size,
1058 size_t align, dma_addr_t maxaddr); 1049 size_t align, dma_addr_t maxaddr);
1059extern void __drm_pci_free(drm_device_t * dev, drm_dma_handle_t * dmah); 1050extern void __drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah);
1060extern void drm_pci_free(drm_device_t * dev, drm_dma_handle_t * dmah); 1051extern void drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah);
1061 1052
1062 /* sysfs support (drm_sysfs.c) */ 1053 /* sysfs support (drm_sysfs.c) */
1063extern struct class *drm_sysfs_create(struct module *owner, char *name); 1054extern struct class *drm_sysfs_create(struct module *owner, char *name);
1064extern void drm_sysfs_destroy(struct class *cs); 1055extern void drm_sysfs_destroy(struct class *cs);
1065extern struct class_device *drm_sysfs_device_add(struct class *cs, 1056extern struct class_device *drm_sysfs_device_add(struct class *cs,
1066 drm_head_t *head); 1057 struct drm_head *head);
1067extern void drm_sysfs_device_remove(struct class_device *class_dev); 1058extern void drm_sysfs_device_remove(struct class_device *class_dev);
1068 1059
1069/* 1060/*
1070 * Basic memory manager support (drm_mm.c) 1061 * Basic memory manager support (drm_mm.c)
1071 */ 1062 */
1072extern drm_mm_node_t *drm_mm_get_block(drm_mm_node_t * parent, 1063extern struct drm_mm_node *drm_mm_get_block(struct drm_mm_node * parent,
1073 unsigned long size, 1064 unsigned long size,
1074 unsigned alignment); 1065 unsigned alignment);
1075void drm_mm_put_block(drm_mm_node_t * cur); 1066void drm_mm_put_block(struct drm_mm_node * cur);
1076extern drm_mm_node_t *drm_mm_search_free(const drm_mm_t *mm, unsigned long size, 1067extern struct drm_mm_node *drm_mm_search_free(const struct drm_mm *mm, unsigned long size,
1077 unsigned alignment, int best_match); 1068 unsigned alignment, int best_match);
1078extern int drm_mm_init(drm_mm_t *mm, unsigned long start, unsigned long size); 1069extern int drm_mm_init(struct drm_mm *mm, unsigned long start, unsigned long size);
1079extern void drm_mm_takedown(drm_mm_t *mm); 1070extern void drm_mm_takedown(struct drm_mm *mm);
1080extern int drm_mm_clean(drm_mm_t *mm); 1071extern int drm_mm_clean(struct drm_mm *mm);
1081extern unsigned long drm_mm_tail_space(drm_mm_t *mm); 1072extern unsigned long drm_mm_tail_space(struct drm_mm *mm);
1082extern int drm_mm_remove_space_from_tail(drm_mm_t *mm, unsigned long size); 1073extern int drm_mm_remove_space_from_tail(struct drm_mm *mm, unsigned long size);
1083extern int drm_mm_add_space_to_tail(drm_mm_t *mm, unsigned long size); 1074extern int drm_mm_add_space_to_tail(struct drm_mm *mm, unsigned long size);
1084 1075
1085extern void drm_core_ioremap(struct drm_map *map, struct drm_device *dev); 1076extern void drm_core_ioremap(struct drm_map *map, struct drm_device *dev);
1086extern void drm_core_ioremapfree(struct drm_map *map, struct drm_device *dev); 1077extern void drm_core_ioremapfree(struct drm_map *map, struct drm_device *dev);
@@ -1088,14 +1079,14 @@ extern void drm_core_ioremapfree(struct drm_map *map, struct drm_device *dev);
1088static __inline__ struct drm_map *drm_core_findmap(struct drm_device *dev, 1079static __inline__ struct drm_map *drm_core_findmap(struct drm_device *dev,
1089 unsigned int token) 1080 unsigned int token)
1090{ 1081{
1091 drm_map_list_t *_entry; 1082 struct drm_map_list *_entry;
1092 list_for_each_entry(_entry, &dev->maplist->head, head) 1083 list_for_each_entry(_entry, &dev->maplist, head)
1093 if (_entry->user_token == token) 1084 if (_entry->user_token == token)
1094 return _entry->map; 1085 return _entry->map;
1095 return NULL; 1086 return NULL;
1096} 1087}
1097 1088
1098static __inline__ int drm_device_is_agp(drm_device_t * dev) 1089static __inline__ int drm_device_is_agp(struct drm_device *dev)
1099{ 1090{
1100 if (dev->driver->device_is_agp != NULL) { 1091 if (dev->driver->device_is_agp != NULL) {
1101 int err = (*dev->driver->device_is_agp) (dev); 1092 int err = (*dev->driver->device_is_agp) (dev);
@@ -1108,7 +1099,7 @@ static __inline__ int drm_device_is_agp(drm_device_t * dev)
1108 return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP); 1099 return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP);
1109} 1100}
1110 1101
1111static __inline__ int drm_device_is_pcie(drm_device_t * dev) 1102static __inline__ int drm_device_is_pcie(struct drm_device *dev)
1112{ 1103{
1113 return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP); 1104 return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP);
1114} 1105}
@@ -1143,7 +1134,7 @@ extern void *drm_calloc(size_t nmemb, size_t size, int area);
1143 1134
1144/*@}*/ 1135/*@}*/
1145 1136
1146extern unsigned long drm_core_get_map_ofs(drm_map_t * map); 1137extern unsigned long drm_core_get_map_ofs(struct drm_map * map);
1147extern unsigned long drm_core_get_reg_ofs(struct drm_device *dev); 1138extern unsigned long drm_core_get_reg_ofs(struct drm_device *dev);
1148 1139
1149#endif /* __KERNEL__ */ 1140#endif /* __KERNEL__ */
diff --git a/drivers/char/drm/drm_agpsupport.c b/drivers/char/drm/drm_agpsupport.c
index 40bfd9b01e39..354f0e3674bf 100644
--- a/drivers/char/drm/drm_agpsupport.c
+++ b/drivers/char/drm/drm_agpsupport.c
@@ -48,7 +48,7 @@
48 * Verifies the AGP device has been initialized and acquired and fills in the 48 * Verifies the AGP device has been initialized and acquired and fills in the
49 * drm_agp_info structure with the information in drm_agp_head::agp_info. 49 * drm_agp_info structure with the information in drm_agp_head::agp_info.
50 */ 50 */
51int drm_agp_info(drm_device_t * dev, drm_agp_info_t * info) 51int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info)
52{ 52{
53 DRM_AGP_KERN *kern; 53 DRM_AGP_KERN *kern;
54 54
@@ -74,16 +74,16 @@ EXPORT_SYMBOL(drm_agp_info);
74int drm_agp_info_ioctl(struct inode *inode, struct file *filp, 74int drm_agp_info_ioctl(struct inode *inode, struct file *filp,
75 unsigned int cmd, unsigned long arg) 75 unsigned int cmd, unsigned long arg)
76{ 76{
77 drm_file_t *priv = filp->private_data; 77 struct drm_file *priv = filp->private_data;
78 drm_device_t *dev = priv->head->dev; 78 struct drm_device *dev = priv->head->dev;
79 drm_agp_info_t info; 79 struct drm_agp_info info;
80 int err; 80 int err;
81 81
82 err = drm_agp_info(dev, &info); 82 err = drm_agp_info(dev, &info);
83 if (err) 83 if (err)
84 return err; 84 return err;
85 85
86 if (copy_to_user((drm_agp_info_t __user *) arg, &info, sizeof(info))) 86 if (copy_to_user((struct drm_agp_info __user *) arg, &info, sizeof(info)))
87 return -EFAULT; 87 return -EFAULT;
88 return 0; 88 return 0;
89} 89}
@@ -97,7 +97,7 @@ int drm_agp_info_ioctl(struct inode *inode, struct file *filp,
97 * Verifies the AGP device hasn't been acquired before and calls 97 * Verifies the AGP device hasn't been acquired before and calls
98 * \c agp_backend_acquire. 98 * \c agp_backend_acquire.
99 */ 99 */
100int drm_agp_acquire(drm_device_t * dev) 100int drm_agp_acquire(struct drm_device * dev)
101{ 101{
102 if (!dev->agp) 102 if (!dev->agp)
103 return -ENODEV; 103 return -ENODEV;
@@ -126,9 +126,9 @@ EXPORT_SYMBOL(drm_agp_acquire);
126int drm_agp_acquire_ioctl(struct inode *inode, struct file *filp, 126int drm_agp_acquire_ioctl(struct inode *inode, struct file *filp,
127 unsigned int cmd, unsigned long arg) 127 unsigned int cmd, unsigned long arg)
128{ 128{
129 drm_file_t *priv = filp->private_data; 129 struct drm_file *priv = filp->private_data;
130 130
131 return drm_agp_acquire((drm_device_t *) priv->head->dev); 131 return drm_agp_acquire((struct drm_device *) priv->head->dev);
132} 132}
133 133
134/** 134/**
@@ -139,7 +139,7 @@ int drm_agp_acquire_ioctl(struct inode *inode, struct file *filp,
139 * 139 *
140 * Verifies the AGP device has been acquired and calls \c agp_backend_release. 140 * Verifies the AGP device has been acquired and calls \c agp_backend_release.
141 */ 141 */
142int drm_agp_release(drm_device_t * dev) 142int drm_agp_release(struct drm_device * dev)
143{ 143{
144 if (!dev->agp || !dev->agp->acquired) 144 if (!dev->agp || !dev->agp->acquired)
145 return -EINVAL; 145 return -EINVAL;
@@ -152,8 +152,8 @@ EXPORT_SYMBOL(drm_agp_release);
152int drm_agp_release_ioctl(struct inode *inode, struct file *filp, 152int drm_agp_release_ioctl(struct inode *inode, struct file *filp,
153 unsigned int cmd, unsigned long arg) 153 unsigned int cmd, unsigned long arg)
154{ 154{
155 drm_file_t *priv = filp->private_data; 155 struct drm_file *priv = filp->private_data;
156 drm_device_t *dev = priv->head->dev; 156 struct drm_device *dev = priv->head->dev;
157 157
158 return drm_agp_release(dev); 158 return drm_agp_release(dev);
159} 159}
@@ -168,7 +168,7 @@ int drm_agp_release_ioctl(struct inode *inode, struct file *filp,
168 * Verifies the AGP device has been acquired but not enabled, and calls 168 * Verifies the AGP device has been acquired but not enabled, and calls
169 * \c agp_enable. 169 * \c agp_enable.
170 */ 170 */
171int drm_agp_enable(drm_device_t * dev, drm_agp_mode_t mode) 171int drm_agp_enable(struct drm_device * dev, struct drm_agp_mode mode)
172{ 172{
173 if (!dev->agp || !dev->agp->acquired) 173 if (!dev->agp || !dev->agp->acquired)
174 return -EINVAL; 174 return -EINVAL;
@@ -185,11 +185,11 @@ EXPORT_SYMBOL(drm_agp_enable);
185int drm_agp_enable_ioctl(struct inode *inode, struct file *filp, 185int drm_agp_enable_ioctl(struct inode *inode, struct file *filp,
186 unsigned int cmd, unsigned long arg) 186 unsigned int cmd, unsigned long arg)
187{ 187{
188 drm_file_t *priv = filp->private_data; 188 struct drm_file *priv = filp->private_data;
189 drm_device_t *dev = priv->head->dev; 189 struct drm_device *dev = priv->head->dev;
190 drm_agp_mode_t mode; 190 struct drm_agp_mode mode;
191 191
192 if (copy_from_user(&mode, (drm_agp_mode_t __user *) arg, sizeof(mode))) 192 if (copy_from_user(&mode, (struct drm_agp_mode __user *) arg, sizeof(mode)))
193 return -EFAULT; 193 return -EFAULT;
194 194
195 return drm_agp_enable(dev, mode); 195 return drm_agp_enable(dev, mode);
@@ -207,9 +207,9 @@ int drm_agp_enable_ioctl(struct inode *inode, struct file *filp,
207 * Verifies the AGP device is present and has been acquired, allocates the 207 * Verifies the AGP device is present and has been acquired, allocates the
208 * memory via alloc_agp() and creates a drm_agp_mem entry for it. 208 * memory via alloc_agp() and creates a drm_agp_mem entry for it.
209 */ 209 */
210int drm_agp_alloc(drm_device_t *dev, drm_agp_buffer_t *request) 210int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request)
211{ 211{
212 drm_agp_mem_t *entry; 212 struct drm_agp_mem *entry;
213 DRM_AGP_MEM *memory; 213 DRM_AGP_MEM *memory;
214 unsigned long pages; 214 unsigned long pages;
215 u32 type; 215 u32 type;
@@ -232,11 +232,7 @@ int drm_agp_alloc(drm_device_t *dev, drm_agp_buffer_t *request)
232 entry->memory = memory; 232 entry->memory = memory;
233 entry->bound = 0; 233 entry->bound = 0;
234 entry->pages = pages; 234 entry->pages = pages;
235 entry->prev = NULL; 235 list_add(&entry->head, &dev->agp->memory);
236 entry->next = dev->agp->memory;
237 if (dev->agp->memory)
238 dev->agp->memory->prev = entry;
239 dev->agp->memory = entry;
240 236
241 request->handle = entry->handle; 237 request->handle = entry->handle;
242 request->physical = memory->physical; 238 request->physical = memory->physical;
@@ -248,10 +244,10 @@ EXPORT_SYMBOL(drm_agp_alloc);
248int drm_agp_alloc_ioctl(struct inode *inode, struct file *filp, 244int drm_agp_alloc_ioctl(struct inode *inode, struct file *filp,
249 unsigned int cmd, unsigned long arg) 245 unsigned int cmd, unsigned long arg)
250{ 246{
251 drm_file_t *priv = filp->private_data; 247 struct drm_file *priv = filp->private_data;
252 drm_device_t *dev = priv->head->dev; 248 struct drm_device *dev = priv->head->dev;
253 drm_agp_buffer_t request; 249 struct drm_agp_buffer request;
254 drm_agp_buffer_t __user *argp = (void __user *)arg; 250 struct drm_agp_buffer __user *argp = (void __user *)arg;
255 int err; 251 int err;
256 252
257 if (copy_from_user(&request, argp, sizeof(request))) 253 if (copy_from_user(&request, argp, sizeof(request)))
@@ -262,10 +258,12 @@ int drm_agp_alloc_ioctl(struct inode *inode, struct file *filp,
262 return err; 258 return err;
263 259
264 if (copy_to_user(argp, &request, sizeof(request))) { 260 if (copy_to_user(argp, &request, sizeof(request))) {
265 drm_agp_mem_t *entry = dev->agp->memory; 261 struct drm_agp_mem *entry;
266 262 list_for_each_entry(entry, &dev->agp->memory, head) {
267 dev->agp->memory = entry->next; 263 if (entry->handle == request.handle)
268 dev->agp->memory->prev = NULL; 264 break;
265 }
266 list_del(&entry->head);
269 drm_free_agp(entry->memory, entry->pages); 267 drm_free_agp(entry->memory, entry->pages);
270 drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); 268 drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
271 return -EFAULT; 269 return -EFAULT;
@@ -283,12 +281,12 @@ int drm_agp_alloc_ioctl(struct inode *inode, struct file *filp,
283 * 281 *
284 * Walks through drm_agp_head::memory until finding a matching handle. 282 * Walks through drm_agp_head::memory until finding a matching handle.
285 */ 283 */
286static drm_agp_mem_t *drm_agp_lookup_entry(drm_device_t * dev, 284static struct drm_agp_mem *drm_agp_lookup_entry(struct drm_device * dev,
287 unsigned long handle) 285 unsigned long handle)
288{ 286{
289 drm_agp_mem_t *entry; 287 struct drm_agp_mem *entry;
290 288
291 for (entry = dev->agp->memory; entry; entry = entry->next) { 289 list_for_each_entry(entry, &dev->agp->memory, head) {
292 if (entry->handle == handle) 290 if (entry->handle == handle)
293 return entry; 291 return entry;
294 } 292 }
@@ -307,9 +305,9 @@ static drm_agp_mem_t *drm_agp_lookup_entry(drm_device_t * dev,
307 * Verifies the AGP device is present and acquired, looks-up the AGP memory 305 * Verifies the AGP device is present and acquired, looks-up the AGP memory
308 * entry and passes it to the unbind_agp() function. 306 * entry and passes it to the unbind_agp() function.
309 */ 307 */
310int drm_agp_unbind(drm_device_t *dev, drm_agp_binding_t *request) 308int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request)
311{ 309{
312 drm_agp_mem_t *entry; 310 struct drm_agp_mem *entry;
313 int ret; 311 int ret;
314 312
315 if (!dev->agp || !dev->agp->acquired) 313 if (!dev->agp || !dev->agp->acquired)
@@ -328,12 +326,12 @@ EXPORT_SYMBOL(drm_agp_unbind);
328int drm_agp_unbind_ioctl(struct inode *inode, struct file *filp, 326int drm_agp_unbind_ioctl(struct inode *inode, struct file *filp,
329 unsigned int cmd, unsigned long arg) 327 unsigned int cmd, unsigned long arg)
330{ 328{
331 drm_file_t *priv = filp->private_data; 329 struct drm_file *priv = filp->private_data;
332 drm_device_t *dev = priv->head->dev; 330 struct drm_device *dev = priv->head->dev;
333 drm_agp_binding_t request; 331 struct drm_agp_binding request;
334 332
335 if (copy_from_user 333 if (copy_from_user
336 (&request, (drm_agp_binding_t __user *) arg, sizeof(request))) 334 (&request, (struct drm_agp_binding __user *) arg, sizeof(request)))
337 return -EFAULT; 335 return -EFAULT;
338 336
339 return drm_agp_unbind(dev, &request); 337 return drm_agp_unbind(dev, &request);
@@ -352,9 +350,9 @@ int drm_agp_unbind_ioctl(struct inode *inode, struct file *filp,
352 * is currently bound into the GATT. Looks-up the AGP memory entry and passes 350 * is currently bound into the GATT. Looks-up the AGP memory entry and passes
353 * it to bind_agp() function. 351 * it to bind_agp() function.
354 */ 352 */
355int drm_agp_bind(drm_device_t *dev, drm_agp_binding_t *request) 353int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request)
356{ 354{
357 drm_agp_mem_t *entry; 355 struct drm_agp_mem *entry;
358 int retcode; 356 int retcode;
359 int page; 357 int page;
360 358
@@ -377,12 +375,12 @@ EXPORT_SYMBOL(drm_agp_bind);
377int drm_agp_bind_ioctl(struct inode *inode, struct file *filp, 375int drm_agp_bind_ioctl(struct inode *inode, struct file *filp,
378 unsigned int cmd, unsigned long arg) 376 unsigned int cmd, unsigned long arg)
379{ 377{
380 drm_file_t *priv = filp->private_data; 378 struct drm_file *priv = filp->private_data;
381 drm_device_t *dev = priv->head->dev; 379 struct drm_device *dev = priv->head->dev;
382 drm_agp_binding_t request; 380 struct drm_agp_binding request;
383 381
384 if (copy_from_user 382 if (copy_from_user
385 (&request, (drm_agp_binding_t __user *) arg, sizeof(request))) 383 (&request, (struct drm_agp_binding __user *) arg, sizeof(request)))
386 return -EFAULT; 384 return -EFAULT;
387 385
388 return drm_agp_bind(dev, &request); 386 return drm_agp_bind(dev, &request);
@@ -402,9 +400,9 @@ int drm_agp_bind_ioctl(struct inode *inode, struct file *filp,
402 * unbind_agp(). Frees it via free_agp() as well as the entry itself 400 * unbind_agp(). Frees it via free_agp() as well as the entry itself
403 * and unlinks from the doubly linked list it's inserted in. 401 * and unlinks from the doubly linked list it's inserted in.
404 */ 402 */
405int drm_agp_free(drm_device_t *dev, drm_agp_buffer_t *request) 403int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request)
406{ 404{
407 drm_agp_mem_t *entry; 405 struct drm_agp_mem *entry;
408 406
409 if (!dev->agp || !dev->agp->acquired) 407 if (!dev->agp || !dev->agp->acquired)
410 return -EINVAL; 408 return -EINVAL;
@@ -413,13 +411,7 @@ int drm_agp_free(drm_device_t *dev, drm_agp_buffer_t *request)
413 if (entry->bound) 411 if (entry->bound)
414 drm_unbind_agp(entry->memory); 412 drm_unbind_agp(entry->memory);
415 413
416 if (entry->prev) 414 list_del(&entry->head);
417 entry->prev->next = entry->next;
418 else
419 dev->agp->memory = entry->next;
420
421 if (entry->next)
422 entry->next->prev = entry->prev;
423 415
424 drm_free_agp(entry->memory, entry->pages); 416 drm_free_agp(entry->memory, entry->pages);
425 drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); 417 drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
@@ -430,12 +422,12 @@ EXPORT_SYMBOL(drm_agp_free);
430int drm_agp_free_ioctl(struct inode *inode, struct file *filp, 422int drm_agp_free_ioctl(struct inode *inode, struct file *filp,
431 unsigned int cmd, unsigned long arg) 423 unsigned int cmd, unsigned long arg)
432{ 424{
433 drm_file_t *priv = filp->private_data; 425 struct drm_file *priv = filp->private_data;
434 drm_device_t *dev = priv->head->dev; 426 struct drm_device *dev = priv->head->dev;
435 drm_agp_buffer_t request; 427 struct drm_agp_buffer request;
436 428
437 if (copy_from_user 429 if (copy_from_user
438 (&request, (drm_agp_buffer_t __user *) arg, sizeof(request))) 430 (&request, (struct drm_agp_buffer __user *) arg, sizeof(request)))
439 return -EFAULT; 431 return -EFAULT;
440 432
441 return drm_agp_free(dev, &request); 433 return drm_agp_free(dev, &request);
@@ -450,9 +442,9 @@ int drm_agp_free_ioctl(struct inode *inode, struct file *filp,
450 * via the inter_module_* functions. Creates and initializes a drm_agp_head 442 * via the inter_module_* functions. Creates and initializes a drm_agp_head
451 * structure. 443 * structure.
452 */ 444 */
453drm_agp_head_t *drm_agp_init(drm_device_t * dev) 445struct drm_agp_head *drm_agp_init(struct drm_device *dev)
454{ 446{
455 drm_agp_head_t *head = NULL; 447 struct drm_agp_head *head = NULL;
456 448
457 if (!(head = drm_alloc(sizeof(*head), DRM_MEM_AGPLISTS))) 449 if (!(head = drm_alloc(sizeof(*head), DRM_MEM_AGPLISTS)))
458 return NULL; 450 return NULL;
@@ -472,7 +464,7 @@ drm_agp_head_t *drm_agp_init(drm_device_t * dev)
472 drm_free(head, sizeof(*head), DRM_MEM_AGPLISTS); 464 drm_free(head, sizeof(*head), DRM_MEM_AGPLISTS);
473 return NULL; 465 return NULL;
474 } 466 }
475 head->memory = NULL; 467 INIT_LIST_HEAD(&head->memory);
476 head->cant_use_aperture = head->agp_info.cant_use_aperture; 468 head->cant_use_aperture = head->agp_info.cant_use_aperture;
477 head->page_mask = head->agp_info.page_mask; 469 head->page_mask = head->agp_info.page_mask;
478 470
diff --git a/drivers/char/drm/drm_auth.c b/drivers/char/drm/drm_auth.c
index c7b19d35bcd6..7f777da872cd 100644
--- a/drivers/char/drm/drm_auth.c
+++ b/drivers/char/drm/drm_auth.c
@@ -45,15 +45,15 @@
45 * the one with matching magic number, while holding the drm_device::struct_mutex 45 * the one with matching magic number, while holding the drm_device::struct_mutex
46 * lock. 46 * lock.
47 */ 47 */
48static drm_file_t *drm_find_file(drm_device_t * dev, drm_magic_t magic) 48static struct drm_file *drm_find_file(struct drm_device * dev, drm_magic_t magic)
49{ 49{
50 drm_file_t *retval = NULL; 50 struct drm_file *retval = NULL;
51 drm_magic_entry_t *pt; 51 struct drm_magic_entry *pt;
52 drm_hash_item_t *hash; 52 struct drm_hash_item *hash;
53 53
54 mutex_lock(&dev->struct_mutex); 54 mutex_lock(&dev->struct_mutex);
55 if (!drm_ht_find_item(&dev->magiclist, (unsigned long)magic, &hash)) { 55 if (!drm_ht_find_item(&dev->magiclist, (unsigned long)magic, &hash)) {
56 pt = drm_hash_entry(hash, drm_magic_entry_t, hash_item); 56 pt = drm_hash_entry(hash, struct drm_magic_entry, hash_item);
57 retval = pt->priv; 57 retval = pt->priv;
58 } 58 }
59 mutex_unlock(&dev->struct_mutex); 59 mutex_unlock(&dev->struct_mutex);
@@ -71,10 +71,10 @@ static drm_file_t *drm_find_file(drm_device_t * dev, drm_magic_t magic)
71 * associated the magic number hash key in drm_device::magiclist, while holding 71 * associated the magic number hash key in drm_device::magiclist, while holding
72 * the drm_device::struct_mutex lock. 72 * the drm_device::struct_mutex lock.
73 */ 73 */
74static int drm_add_magic(drm_device_t * dev, drm_file_t * priv, 74static int drm_add_magic(struct drm_device * dev, struct drm_file * priv,
75 drm_magic_t magic) 75 drm_magic_t magic)
76{ 76{
77 drm_magic_entry_t *entry; 77 struct drm_magic_entry *entry;
78 78
79 DRM_DEBUG("%d\n", magic); 79 DRM_DEBUG("%d\n", magic);
80 80
@@ -102,10 +102,10 @@ static int drm_add_magic(drm_device_t * dev, drm_file_t * priv,
102 * Searches and unlinks the entry in drm_device::magiclist with the magic 102 * Searches and unlinks the entry in drm_device::magiclist with the magic
103 * number hash key, while holding the drm_device::struct_mutex lock. 103 * number hash key, while holding the drm_device::struct_mutex lock.
104 */ 104 */
105static int drm_remove_magic(drm_device_t * dev, drm_magic_t magic) 105static int drm_remove_magic(struct drm_device * dev, drm_magic_t magic)
106{ 106{
107 drm_magic_entry_t *pt; 107 struct drm_magic_entry *pt;
108 drm_hash_item_t *hash; 108 struct drm_hash_item *hash;
109 109
110 DRM_DEBUG("%d\n", magic); 110 DRM_DEBUG("%d\n", magic);
111 111
@@ -114,7 +114,7 @@ static int drm_remove_magic(drm_device_t * dev, drm_magic_t magic)
114 mutex_unlock(&dev->struct_mutex); 114 mutex_unlock(&dev->struct_mutex);
115 return -EINVAL; 115 return -EINVAL;
116 } 116 }
117 pt = drm_hash_entry(hash, drm_magic_entry_t, hash_item); 117 pt = drm_hash_entry(hash, struct drm_magic_entry, hash_item);
118 drm_ht_remove_item(&dev->magiclist, hash); 118 drm_ht_remove_item(&dev->magiclist, hash);
119 list_del(&pt->head); 119 list_del(&pt->head);
120 mutex_unlock(&dev->struct_mutex); 120 mutex_unlock(&dev->struct_mutex);
@@ -142,9 +142,9 @@ int drm_getmagic(struct inode *inode, struct file *filp,
142{ 142{
143 static drm_magic_t sequence = 0; 143 static drm_magic_t sequence = 0;
144 static DEFINE_SPINLOCK(lock); 144 static DEFINE_SPINLOCK(lock);
145 drm_file_t *priv = filp->private_data; 145 struct drm_file *priv = filp->private_data;
146 drm_device_t *dev = priv->head->dev; 146 struct drm_device *dev = priv->head->dev;
147 drm_auth_t auth; 147 struct drm_auth auth;
148 148
149 /* Find unique magic */ 149 /* Find unique magic */
150 if (priv->magic) { 150 if (priv->magic) {
@@ -162,7 +162,7 @@ int drm_getmagic(struct inode *inode, struct file *filp,
162 } 162 }
163 163
164 DRM_DEBUG("%u\n", auth.magic); 164 DRM_DEBUG("%u\n", auth.magic);
165 if (copy_to_user((drm_auth_t __user *) arg, &auth, sizeof(auth))) 165 if (copy_to_user((struct drm_auth __user *) arg, &auth, sizeof(auth)))
166 return -EFAULT; 166 return -EFAULT;
167 return 0; 167 return 0;
168} 168}
@@ -181,12 +181,12 @@ int drm_getmagic(struct inode *inode, struct file *filp,
181int drm_authmagic(struct inode *inode, struct file *filp, 181int drm_authmagic(struct inode *inode, struct file *filp,
182 unsigned int cmd, unsigned long arg) 182 unsigned int cmd, unsigned long arg)
183{ 183{
184 drm_file_t *priv = filp->private_data; 184 struct drm_file *priv = filp->private_data;
185 drm_device_t *dev = priv->head->dev; 185 struct drm_device *dev = priv->head->dev;
186 drm_auth_t auth; 186 struct drm_auth auth;
187 drm_file_t *file; 187 struct drm_file *file;
188 188
189 if (copy_from_user(&auth, (drm_auth_t __user *) arg, sizeof(auth))) 189 if (copy_from_user(&auth, (struct drm_auth __user *) arg, sizeof(auth)))
190 return -EFAULT; 190 return -EFAULT;
191 DRM_DEBUG("%u\n", auth.magic); 191 DRM_DEBUG("%u\n", auth.magic);
192 if ((file = drm_find_file(dev, auth.magic))) { 192 if ((file = drm_find_file(dev, auth.magic))) {
diff --git a/drivers/char/drm/drm_bufs.c b/drivers/char/drm/drm_bufs.c
index c11345856ffe..923174c54a1c 100644
--- a/drivers/char/drm/drm_bufs.c
+++ b/drivers/char/drm/drm_bufs.c
@@ -36,26 +36,24 @@
36#include <linux/vmalloc.h> 36#include <linux/vmalloc.h>
37#include "drmP.h" 37#include "drmP.h"
38 38
39unsigned long drm_get_resource_start(drm_device_t *dev, unsigned int resource) 39unsigned long drm_get_resource_start(struct drm_device *dev, unsigned int resource)
40{ 40{
41 return pci_resource_start(dev->pdev, resource); 41 return pci_resource_start(dev->pdev, resource);
42} 42}
43EXPORT_SYMBOL(drm_get_resource_start); 43EXPORT_SYMBOL(drm_get_resource_start);
44 44
45unsigned long drm_get_resource_len(drm_device_t *dev, unsigned int resource) 45unsigned long drm_get_resource_len(struct drm_device *dev, unsigned int resource)
46{ 46{
47 return pci_resource_len(dev->pdev, resource); 47 return pci_resource_len(dev->pdev, resource);
48} 48}
49 49
50EXPORT_SYMBOL(drm_get_resource_len); 50EXPORT_SYMBOL(drm_get_resource_len);
51 51
52static drm_map_list_t *drm_find_matching_map(drm_device_t *dev, 52static struct drm_map_list *drm_find_matching_map(struct drm_device *dev,
53 drm_local_map_t *map) 53 drm_local_map_t *map)
54{ 54{
55 struct list_head *list; 55 struct drm_map_list *entry;
56 56 list_for_each_entry(entry, &dev->maplist, head) {
57 list_for_each(list, &dev->maplist->head) {
58 drm_map_list_t *entry = list_entry(list, drm_map_list_t, head);
59 if (entry->map && map->type == entry->map->type && 57 if (entry->map && map->type == entry->map->type &&
60 ((entry->map->offset == map->offset) || 58 ((entry->map->offset == map->offset) ||
61 (map->type == _DRM_SHM && map->flags==_DRM_CONTAINS_LOCK))) { 59 (map->type == _DRM_SHM && map->flags==_DRM_CONTAINS_LOCK))) {
@@ -66,7 +64,7 @@ static drm_map_list_t *drm_find_matching_map(drm_device_t *dev,
66 return NULL; 64 return NULL;
67} 65}
68 66
69static int drm_map_handle(drm_device_t *dev, drm_hash_item_t *hash, 67static int drm_map_handle(struct drm_device *dev, struct drm_hash_item *hash,
70 unsigned long user_token, int hashed_handle) 68 unsigned long user_token, int hashed_handle)
71{ 69{
72 int use_hashed_handle; 70 int use_hashed_handle;
@@ -103,12 +101,13 @@ static int drm_map_handle(drm_device_t *dev, drm_hash_item_t *hash,
103 * type. Adds the map to the map list drm_device::maplist. Adds MTRR's where 101 * type. Adds the map to the map list drm_device::maplist. Adds MTRR's where
104 * applicable and if supported by the kernel. 102 * applicable and if supported by the kernel.
105 */ 103 */
106static int drm_addmap_core(drm_device_t * dev, unsigned int offset, 104static int drm_addmap_core(struct drm_device * dev, unsigned int offset,
107 unsigned int size, drm_map_type_t type, 105 unsigned int size, enum drm_map_type type,
108 drm_map_flags_t flags, drm_map_list_t ** maplist) 106 enum drm_map_flags flags,
107 struct drm_map_list ** maplist)
109{ 108{
110 drm_map_t *map; 109 struct drm_map *map;
111 drm_map_list_t *list; 110 struct drm_map_list *list;
112 drm_dma_handle_t *dmah; 111 drm_dma_handle_t *dmah;
113 unsigned long user_token; 112 unsigned long user_token;
114 int ret; 113 int ret;
@@ -214,7 +213,7 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset,
214 } 213 }
215 break; 214 break;
216 case _DRM_AGP: { 215 case _DRM_AGP: {
217 drm_agp_mem_t *entry; 216 struct drm_agp_mem *entry;
218 int valid = 0; 217 int valid = 0;
219 218
220 if (!drm_core_has_AGP(dev)) { 219 if (!drm_core_has_AGP(dev)) {
@@ -237,14 +236,14 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset,
237 * skipped and we double check that dev->agp->memory is 236 * skipped and we double check that dev->agp->memory is
238 * actually set as well as being invalid before EPERM'ing 237 * actually set as well as being invalid before EPERM'ing
239 */ 238 */
240 for (entry = dev->agp->memory; entry; entry = entry->next) { 239 list_for_each_entry(entry, &dev->agp->memory, head) {
241 if ((map->offset >= entry->bound) && 240 if ((map->offset >= entry->bound) &&
242 (map->offset + map->size <= entry->bound + entry->pages * PAGE_SIZE)) { 241 (map->offset + map->size <= entry->bound + entry->pages * PAGE_SIZE)) {
243 valid = 1; 242 valid = 1;
244 break; 243 break;
245 } 244 }
246 } 245 }
247 if (dev->agp->memory && !valid) { 246 if (!list_empty(&dev->agp->memory) && !valid) {
248 drm_free(map, sizeof(*map), DRM_MEM_MAPS); 247 drm_free(map, sizeof(*map), DRM_MEM_MAPS);
249 return -EPERM; 248 return -EPERM;
250 } 249 }
@@ -289,7 +288,7 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset,
289 list->map = map; 288 list->map = map;
290 289
291 mutex_lock(&dev->struct_mutex); 290 mutex_lock(&dev->struct_mutex);
292 list_add(&list->head, &dev->maplist->head); 291 list_add(&list->head, &dev->maplist);
293 292
294 /* Assign a 32-bit handle */ 293 /* Assign a 32-bit handle */
295 /* We do it here so that dev->struct_mutex protects the increment */ 294 /* We do it here so that dev->struct_mutex protects the increment */
@@ -312,11 +311,11 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset,
312 return 0; 311 return 0;
313 } 312 }
314 313
315int drm_addmap(drm_device_t * dev, unsigned int offset, 314int drm_addmap(struct drm_device * dev, unsigned int offset,
316 unsigned int size, drm_map_type_t type, 315 unsigned int size, enum drm_map_type type,
317 drm_map_flags_t flags, drm_local_map_t ** map_ptr) 316 enum drm_map_flags flags, drm_local_map_t ** map_ptr)
318{ 317{
319 drm_map_list_t *list; 318 struct drm_map_list *list;
320 int rc; 319 int rc;
321 320
322 rc = drm_addmap_core(dev, offset, size, type, flags, &list); 321 rc = drm_addmap_core(dev, offset, size, type, flags, &list);
@@ -330,11 +329,11 @@ EXPORT_SYMBOL(drm_addmap);
330int drm_addmap_ioctl(struct inode *inode, struct file *filp, 329int drm_addmap_ioctl(struct inode *inode, struct file *filp,
331 unsigned int cmd, unsigned long arg) 330 unsigned int cmd, unsigned long arg)
332{ 331{
333 drm_file_t *priv = filp->private_data; 332 struct drm_file *priv = filp->private_data;
334 drm_device_t *dev = priv->head->dev; 333 struct drm_device *dev = priv->head->dev;
335 drm_map_t map; 334 struct drm_map map;
336 drm_map_list_t *maplist; 335 struct drm_map_list *maplist;
337 drm_map_t __user *argp = (void __user *)arg; 336 struct drm_map __user *argp = (void __user *)arg;
338 int err; 337 int err;
339 338
340 if (!(filp->f_mode & 3)) 339 if (!(filp->f_mode & 3))
@@ -353,7 +352,7 @@ int drm_addmap_ioctl(struct inode *inode, struct file *filp,
353 if (err) 352 if (err)
354 return err; 353 return err;
355 354
356 if (copy_to_user(argp, maplist->map, sizeof(drm_map_t))) 355 if (copy_to_user(argp, maplist->map, sizeof(struct drm_map)))
357 return -EFAULT; 356 return -EFAULT;
358 357
359 /* avoid a warning on 64-bit, this casting isn't very nice, but the API is set so too late */ 358 /* avoid a warning on 64-bit, this casting isn't very nice, but the API is set so too late */
@@ -369,7 +368,7 @@ int drm_addmap_ioctl(struct inode *inode, struct file *filp,
369 * \param inode device inode. 368 * \param inode device inode.
370 * \param filp file pointer. 369 * \param filp file pointer.
371 * \param cmd command. 370 * \param cmd command.
372 * \param arg pointer to a drm_map_t structure. 371 * \param arg pointer to a struct drm_map structure.
373 * \return zero on success or a negative value on error. 372 * \return zero on success or a negative value on error.
374 * 373 *
375 * Searches the map on drm_device::maplist, removes it from the list, see if 374 * Searches the map on drm_device::maplist, removes it from the list, see if
@@ -378,31 +377,26 @@ int drm_addmap_ioctl(struct inode *inode, struct file *filp,
378 * 377 *
379 * \sa drm_addmap 378 * \sa drm_addmap
380 */ 379 */
381int drm_rmmap_locked(drm_device_t *dev, drm_local_map_t *map) 380int drm_rmmap_locked(struct drm_device *dev, drm_local_map_t *map)
382{ 381{
383 struct list_head *list; 382 struct drm_map_list *r_list = NULL, *list_t;
384 drm_map_list_t *r_list = NULL;
385 drm_dma_handle_t dmah; 383 drm_dma_handle_t dmah;
384 int found = 0;
386 385
387 /* Find the list entry for the map and remove it */ 386 /* Find the list entry for the map and remove it */
388 list_for_each(list, &dev->maplist->head) { 387 list_for_each_entry_safe(r_list, list_t, &dev->maplist, head) {
389 r_list = list_entry(list, drm_map_list_t, head);
390
391 if (r_list->map == map) { 388 if (r_list->map == map) {
392 list_del(list); 389 list_del(&r_list->head);
393 drm_ht_remove_key(&dev->map_hash, 390 drm_ht_remove_key(&dev->map_hash,
394 r_list->user_token >> PAGE_SHIFT); 391 r_list->user_token >> PAGE_SHIFT);
395 drm_free(list, sizeof(*list), DRM_MEM_MAPS); 392 drm_free(r_list, sizeof(*r_list), DRM_MEM_MAPS);
393 found = 1;
396 break; 394 break;
397 } 395 }
398 } 396 }
399 397
400 /* List has wrapped around to the head pointer, or it's empty and we 398 if (!found)
401 * didn't find anything.
402 */
403 if (list == (&dev->maplist->head)) {
404 return -EINVAL; 399 return -EINVAL;
405 }
406 400
407 switch (map->type) { 401 switch (map->type) {
408 case _DRM_REGISTERS: 402 case _DRM_REGISTERS:
@@ -433,7 +427,7 @@ int drm_rmmap_locked(drm_device_t *dev, drm_local_map_t *map)
433 return 0; 427 return 0;
434} 428}
435 429
436int drm_rmmap(drm_device_t *dev, drm_local_map_t *map) 430int drm_rmmap(struct drm_device *dev, drm_local_map_t *map)
437{ 431{
438 int ret; 432 int ret;
439 433
@@ -456,21 +450,19 @@ int drm_rmmap(drm_device_t *dev, drm_local_map_t *map)
456int drm_rmmap_ioctl(struct inode *inode, struct file *filp, 450int drm_rmmap_ioctl(struct inode *inode, struct file *filp,
457 unsigned int cmd, unsigned long arg) 451 unsigned int cmd, unsigned long arg)
458{ 452{
459 drm_file_t *priv = filp->private_data; 453 struct drm_file *priv = filp->private_data;
460 drm_device_t *dev = priv->head->dev; 454 struct drm_device *dev = priv->head->dev;
461 drm_map_t request; 455 struct drm_map request;
462 drm_local_map_t *map = NULL; 456 drm_local_map_t *map = NULL;
463 struct list_head *list; 457 struct drm_map_list *r_list;
464 int ret; 458 int ret;
465 459
466 if (copy_from_user(&request, (drm_map_t __user *) arg, sizeof(request))) { 460 if (copy_from_user(&request, (struct drm_map __user *) arg, sizeof(request))) {
467 return -EFAULT; 461 return -EFAULT;
468 } 462 }
469 463
470 mutex_lock(&dev->struct_mutex); 464 mutex_lock(&dev->struct_mutex);
471 list_for_each(list, &dev->maplist->head) { 465 list_for_each_entry(r_list, &dev->maplist, head) {
472 drm_map_list_t *r_list = list_entry(list, drm_map_list_t, head);
473
474 if (r_list->map && 466 if (r_list->map &&
475 r_list->user_token == (unsigned long)request.handle && 467 r_list->user_token == (unsigned long)request.handle &&
476 r_list->map->flags & _DRM_REMOVABLE) { 468 r_list->map->flags & _DRM_REMOVABLE) {
@@ -482,7 +474,7 @@ int drm_rmmap_ioctl(struct inode *inode, struct file *filp,
482 /* List has wrapped around to the head pointer, or its empty we didn't 474 /* List has wrapped around to the head pointer, or its empty we didn't
483 * find anything. 475 * find anything.
484 */ 476 */
485 if (list == (&dev->maplist->head)) { 477 if (list_empty(&dev->maplist) || !map) {
486 mutex_unlock(&dev->struct_mutex); 478 mutex_unlock(&dev->struct_mutex);
487 return -EINVAL; 479 return -EINVAL;
488 } 480 }
@@ -513,7 +505,8 @@ int drm_rmmap_ioctl(struct inode *inode, struct file *filp,
513 * 505 *
514 * Frees any pages and buffers associated with the given entry. 506 * Frees any pages and buffers associated with the given entry.
515 */ 507 */
516static void drm_cleanup_buf_error(drm_device_t * dev, drm_buf_entry_t * entry) 508static void drm_cleanup_buf_error(struct drm_device * dev,
509 struct drm_buf_entry * entry)
517{ 510{
518 int i; 511 int i;
519 512
@@ -550,20 +543,20 @@ static void drm_cleanup_buf_error(drm_device_t * dev, drm_buf_entry_t * entry)
550/** 543/**
551 * Add AGP buffers for DMA transfers. 544 * Add AGP buffers for DMA transfers.
552 * 545 *
553 * \param dev drm_device_t to which the buffers are to be added. 546 * \param dev struct drm_device to which the buffers are to be added.
554 * \param request pointer to a drm_buf_desc_t describing the request. 547 * \param request pointer to a struct drm_buf_desc describing the request.
555 * \return zero on success or a negative number on failure. 548 * \return zero on success or a negative number on failure.
556 * 549 *
557 * After some sanity checks creates a drm_buf structure for each buffer and 550 * After some sanity checks creates a drm_buf structure for each buffer and
558 * reallocates the buffer list of the same size order to accommodate the new 551 * reallocates the buffer list of the same size order to accommodate the new
559 * buffers. 552 * buffers.
560 */ 553 */
561int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request) 554int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request)
562{ 555{
563 drm_device_dma_t *dma = dev->dma; 556 struct drm_device_dma *dma = dev->dma;
564 drm_buf_entry_t *entry; 557 struct drm_buf_entry *entry;
565 drm_agp_mem_t *agp_entry; 558 struct drm_agp_mem *agp_entry;
566 drm_buf_t *buf; 559 struct drm_buf *buf;
567 unsigned long offset; 560 unsigned long offset;
568 unsigned long agp_offset; 561 unsigned long agp_offset;
569 int count; 562 int count;
@@ -574,7 +567,7 @@ int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request)
574 int total; 567 int total;
575 int byte_count; 568 int byte_count;
576 int i, valid; 569 int i, valid;
577 drm_buf_t **temp_buflist; 570 struct drm_buf **temp_buflist;
578 571
579 if (!dma) 572 if (!dma)
580 return -EINVAL; 573 return -EINVAL;
@@ -606,14 +599,14 @@ int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request)
606 599
607 /* Make sure buffers are located in AGP memory that we own */ 600 /* Make sure buffers are located in AGP memory that we own */
608 valid = 0; 601 valid = 0;
609 for (agp_entry = dev->agp->memory; agp_entry; agp_entry = agp_entry->next) { 602 list_for_each_entry(agp_entry, &dev->agp->memory, head) {
610 if ((agp_offset >= agp_entry->bound) && 603 if ((agp_offset >= agp_entry->bound) &&
611 (agp_offset + total * count <= agp_entry->bound + agp_entry->pages * PAGE_SIZE)) { 604 (agp_offset + total * count <= agp_entry->bound + agp_entry->pages * PAGE_SIZE)) {
612 valid = 1; 605 valid = 1;
613 break; 606 break;
614 } 607 }
615 } 608 }
616 if (dev->agp->memory && !valid) { 609 if (!list_empty(&dev->agp->memory) && !valid) {
617 DRM_DEBUG("zone invalid\n"); 610 DRM_DEBUG("zone invalid\n");
618 return -EINVAL; 611 return -EINVAL;
619 } 612 }
@@ -728,24 +721,24 @@ int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request)
728EXPORT_SYMBOL(drm_addbufs_agp); 721EXPORT_SYMBOL(drm_addbufs_agp);
729#endif /* __OS_HAS_AGP */ 722#endif /* __OS_HAS_AGP */
730 723
731int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request) 724int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request)
732{ 725{
733 drm_device_dma_t *dma = dev->dma; 726 struct drm_device_dma *dma = dev->dma;
734 int count; 727 int count;
735 int order; 728 int order;
736 int size; 729 int size;
737 int total; 730 int total;
738 int page_order; 731 int page_order;
739 drm_buf_entry_t *entry; 732 struct drm_buf_entry *entry;
740 drm_dma_handle_t *dmah; 733 drm_dma_handle_t *dmah;
741 drm_buf_t *buf; 734 struct drm_buf *buf;
742 int alignment; 735 int alignment;
743 unsigned long offset; 736 unsigned long offset;
744 int i; 737 int i;
745 int byte_count; 738 int byte_count;
746 int page_count; 739 int page_count;
747 unsigned long *temp_pagelist; 740 unsigned long *temp_pagelist;
748 drm_buf_t **temp_buflist; 741 struct drm_buf **temp_buflist;
749 742
750 if (!drm_core_check_feature(dev, DRIVER_PCI_DMA)) 743 if (!drm_core_check_feature(dev, DRIVER_PCI_DMA))
751 return -EINVAL; 744 return -EINVAL;
@@ -954,11 +947,11 @@ int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request)
954} 947}
955EXPORT_SYMBOL(drm_addbufs_pci); 948EXPORT_SYMBOL(drm_addbufs_pci);
956 949
957static int drm_addbufs_sg(drm_device_t * dev, drm_buf_desc_t * request) 950static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request)
958{ 951{
959 drm_device_dma_t *dma = dev->dma; 952 struct drm_device_dma *dma = dev->dma;
960 drm_buf_entry_t *entry; 953 struct drm_buf_entry *entry;
961 drm_buf_t *buf; 954 struct drm_buf *buf;
962 unsigned long offset; 955 unsigned long offset;
963 unsigned long agp_offset; 956 unsigned long agp_offset;
964 int count; 957 int count;
@@ -969,7 +962,7 @@ static int drm_addbufs_sg(drm_device_t * dev, drm_buf_desc_t * request)
969 int total; 962 int total;
970 int byte_count; 963 int byte_count;
971 int i; 964 int i;
972 drm_buf_t **temp_buflist; 965 struct drm_buf **temp_buflist;
973 966
974 if (!drm_core_check_feature(dev, DRIVER_SG)) 967 if (!drm_core_check_feature(dev, DRIVER_SG))
975 return -EINVAL; 968 return -EINVAL;
@@ -1116,11 +1109,11 @@ static int drm_addbufs_sg(drm_device_t * dev, drm_buf_desc_t * request)
1116 return 0; 1109 return 0;
1117} 1110}
1118 1111
1119static int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request) 1112static int drm_addbufs_fb(struct drm_device * dev, struct drm_buf_desc * request)
1120{ 1113{
1121 drm_device_dma_t *dma = dev->dma; 1114 struct drm_device_dma *dma = dev->dma;
1122 drm_buf_entry_t *entry; 1115 struct drm_buf_entry *entry;
1123 drm_buf_t *buf; 1116 struct drm_buf *buf;
1124 unsigned long offset; 1117 unsigned long offset;
1125 unsigned long agp_offset; 1118 unsigned long agp_offset;
1126 int count; 1119 int count;
@@ -1131,7 +1124,7 @@ static int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request)
1131 int total; 1124 int total;
1132 int byte_count; 1125 int byte_count;
1133 int i; 1126 int i;
1134 drm_buf_t **temp_buflist; 1127 struct drm_buf **temp_buflist;
1135 1128
1136 if (!drm_core_check_feature(dev, DRIVER_FB_DMA)) 1129 if (!drm_core_check_feature(dev, DRIVER_FB_DMA))
1137 return -EINVAL; 1130 return -EINVAL;
@@ -1283,7 +1276,7 @@ static int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request)
1283 * \param inode device inode. 1276 * \param inode device inode.
1284 * \param filp file pointer. 1277 * \param filp file pointer.
1285 * \param cmd command. 1278 * \param cmd command.
1286 * \param arg pointer to a drm_buf_desc_t request. 1279 * \param arg pointer to a struct drm_buf_desc request.
1287 * \return zero on success or a negative number on failure. 1280 * \return zero on success or a negative number on failure.
1288 * 1281 *
1289 * According with the memory type specified in drm_buf_desc::flags and the 1282 * According with the memory type specified in drm_buf_desc::flags and the
@@ -1294,15 +1287,15 @@ static int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request)
1294int drm_addbufs(struct inode *inode, struct file *filp, 1287int drm_addbufs(struct inode *inode, struct file *filp,
1295 unsigned int cmd, unsigned long arg) 1288 unsigned int cmd, unsigned long arg)
1296{ 1289{
1297 drm_buf_desc_t request; 1290 struct drm_buf_desc request;
1298 drm_file_t *priv = filp->private_data; 1291 struct drm_file *priv = filp->private_data;
1299 drm_device_t *dev = priv->head->dev; 1292 struct drm_device *dev = priv->head->dev;
1300 int ret; 1293 int ret;
1301 1294
1302 if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) 1295 if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
1303 return -EINVAL; 1296 return -EINVAL;
1304 1297
1305 if (copy_from_user(&request, (drm_buf_desc_t __user *) arg, 1298 if (copy_from_user(&request, (struct drm_buf_desc __user *) arg,
1306 sizeof(request))) 1299 sizeof(request)))
1307 return -EFAULT; 1300 return -EFAULT;
1308 1301
@@ -1346,11 +1339,11 @@ int drm_addbufs(struct inode *inode, struct file *filp,
1346int drm_infobufs(struct inode *inode, struct file *filp, 1339int drm_infobufs(struct inode *inode, struct file *filp,
1347 unsigned int cmd, unsigned long arg) 1340 unsigned int cmd, unsigned long arg)
1348{ 1341{
1349 drm_file_t *priv = filp->private_data; 1342 struct drm_file *priv = filp->private_data;
1350 drm_device_t *dev = priv->head->dev; 1343 struct drm_device *dev = priv->head->dev;
1351 drm_device_dma_t *dma = dev->dma; 1344 struct drm_device_dma *dma = dev->dma;
1352 drm_buf_info_t request; 1345 struct drm_buf_info request;
1353 drm_buf_info_t __user *argp = (void __user *)arg; 1346 struct drm_buf_info __user *argp = (void __user *)arg;
1354 int i; 1347 int i;
1355 int count; 1348 int count;
1356 1349
@@ -1381,10 +1374,10 @@ int drm_infobufs(struct inode *inode, struct file *filp,
1381 if (request.count >= count) { 1374 if (request.count >= count) {
1382 for (i = 0, count = 0; i < DRM_MAX_ORDER + 1; i++) { 1375 for (i = 0, count = 0; i < DRM_MAX_ORDER + 1; i++) {
1383 if (dma->bufs[i].buf_count) { 1376 if (dma->bufs[i].buf_count) {
1384 drm_buf_desc_t __user *to = 1377 struct drm_buf_desc __user *to =
1385 &request.list[count]; 1378 &request.list[count];
1386 drm_buf_entry_t *from = &dma->bufs[i]; 1379 struct drm_buf_entry *from = &dma->bufs[i];
1387 drm_freelist_t *list = &dma->bufs[i].freelist; 1380 struct drm_freelist *list = &dma->bufs[i].freelist;
1388 if (copy_to_user(&to->count, 1381 if (copy_to_user(&to->count,
1389 &from->buf_count, 1382 &from->buf_count,
1390 sizeof(from->buf_count)) || 1383 sizeof(from->buf_count)) ||
@@ -1434,12 +1427,12 @@ int drm_infobufs(struct inode *inode, struct file *filp,
1434int drm_markbufs(struct inode *inode, struct file *filp, 1427int drm_markbufs(struct inode *inode, struct file *filp,
1435 unsigned int cmd, unsigned long arg) 1428 unsigned int cmd, unsigned long arg)
1436{ 1429{
1437 drm_file_t *priv = filp->private_data; 1430 struct drm_file *priv = filp->private_data;
1438 drm_device_t *dev = priv->head->dev; 1431 struct drm_device *dev = priv->head->dev;
1439 drm_device_dma_t *dma = dev->dma; 1432 struct drm_device_dma *dma = dev->dma;
1440 drm_buf_desc_t request; 1433 struct drm_buf_desc request;
1441 int order; 1434 int order;
1442 drm_buf_entry_t *entry; 1435 struct drm_buf_entry *entry;
1443 1436
1444 if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) 1437 if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
1445 return -EINVAL; 1438 return -EINVAL;
@@ -1448,7 +1441,7 @@ int drm_markbufs(struct inode *inode, struct file *filp,
1448 return -EINVAL; 1441 return -EINVAL;
1449 1442
1450 if (copy_from_user(&request, 1443 if (copy_from_user(&request,
1451 (drm_buf_desc_t __user *) arg, sizeof(request))) 1444 (struct drm_buf_desc __user *) arg, sizeof(request)))
1452 return -EFAULT; 1445 return -EFAULT;
1453 1446
1454 DRM_DEBUG("%d, %d, %d\n", 1447 DRM_DEBUG("%d, %d, %d\n",
@@ -1484,13 +1477,13 @@ int drm_markbufs(struct inode *inode, struct file *filp,
1484int drm_freebufs(struct inode *inode, struct file *filp, 1477int drm_freebufs(struct inode *inode, struct file *filp,
1485 unsigned int cmd, unsigned long arg) 1478 unsigned int cmd, unsigned long arg)
1486{ 1479{
1487 drm_file_t *priv = filp->private_data; 1480 struct drm_file *priv = filp->private_data;
1488 drm_device_t *dev = priv->head->dev; 1481 struct drm_device *dev = priv->head->dev;
1489 drm_device_dma_t *dma = dev->dma; 1482 struct drm_device_dma *dma = dev->dma;
1490 drm_buf_free_t request; 1483 struct drm_buf_free request;
1491 int i; 1484 int i;
1492 int idx; 1485 int idx;
1493 drm_buf_t *buf; 1486 struct drm_buf *buf;
1494 1487
1495 if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) 1488 if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
1496 return -EINVAL; 1489 return -EINVAL;
@@ -1499,7 +1492,7 @@ int drm_freebufs(struct inode *inode, struct file *filp,
1499 return -EINVAL; 1492 return -EINVAL;
1500 1493
1501 if (copy_from_user(&request, 1494 if (copy_from_user(&request,
1502 (drm_buf_free_t __user *) arg, sizeof(request))) 1495 (struct drm_buf_free __user *) arg, sizeof(request)))
1503 return -EFAULT; 1496 return -EFAULT;
1504 1497
1505 DRM_DEBUG("%d\n", request.count); 1498 DRM_DEBUG("%d\n", request.count);
@@ -1540,15 +1533,15 @@ int drm_freebufs(struct inode *inode, struct file *filp,
1540int drm_mapbufs(struct inode *inode, struct file *filp, 1533int drm_mapbufs(struct inode *inode, struct file *filp,
1541 unsigned int cmd, unsigned long arg) 1534 unsigned int cmd, unsigned long arg)
1542{ 1535{
1543 drm_file_t *priv = filp->private_data; 1536 struct drm_file *priv = filp->private_data;
1544 drm_device_t *dev = priv->head->dev; 1537 struct drm_device *dev = priv->head->dev;
1545 drm_device_dma_t *dma = dev->dma; 1538 struct drm_device_dma *dma = dev->dma;
1546 drm_buf_map_t __user *argp = (void __user *)arg; 1539 struct drm_buf_map __user *argp = (void __user *)arg;
1547 int retcode = 0; 1540 int retcode = 0;
1548 const int zero = 0; 1541 const int zero = 0;
1549 unsigned long virtual; 1542 unsigned long virtual;
1550 unsigned long address; 1543 unsigned long address;
1551 drm_buf_map_t request; 1544 struct drm_buf_map request;
1552 int i; 1545 int i;
1553 1546
1554 if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) 1547 if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
@@ -1574,7 +1567,7 @@ int drm_mapbufs(struct inode *inode, struct file *filp,
1574 && (dma->flags & _DRM_DMA_USE_SG)) 1567 && (dma->flags & _DRM_DMA_USE_SG))
1575 || (drm_core_check_feature(dev, DRIVER_FB_DMA) 1568 || (drm_core_check_feature(dev, DRIVER_FB_DMA)
1576 && (dma->flags & _DRM_DMA_USE_FB))) { 1569 && (dma->flags & _DRM_DMA_USE_FB))) {
1577 drm_map_t *map = dev->agp_buffer_map; 1570 struct drm_map *map = dev->agp_buffer_map;
1578 unsigned long token = dev->agp_buffer_token; 1571 unsigned long token = dev->agp_buffer_token;
1579 1572
1580 if (!map) { 1573 if (!map) {
diff --git a/drivers/char/drm/drm_context.c b/drivers/char/drm/drm_context.c
index 83094c73da67..7fc055adec25 100644
--- a/drivers/char/drm/drm_context.c
+++ b/drivers/char/drm/drm_context.c
@@ -56,7 +56,7 @@
56 * in drm_device::context_sareas, while holding the drm_device::struct_mutex 56 * in drm_device::context_sareas, while holding the drm_device::struct_mutex
57 * lock. 57 * lock.
58 */ 58 */
59void drm_ctxbitmap_free(drm_device_t * dev, int ctx_handle) 59void drm_ctxbitmap_free(struct drm_device * dev, int ctx_handle)
60{ 60{
61 if (ctx_handle < 0) 61 if (ctx_handle < 0)
62 goto failed; 62 goto failed;
@@ -85,7 +85,7 @@ void drm_ctxbitmap_free(drm_device_t * dev, int ctx_handle)
85 * drm_device::context_sareas to accommodate the new entry while holding the 85 * drm_device::context_sareas to accommodate the new entry while holding the
86 * drm_device::struct_mutex lock. 86 * drm_device::struct_mutex lock.
87 */ 87 */
88static int drm_ctxbitmap_next(drm_device_t * dev) 88static int drm_ctxbitmap_next(struct drm_device * dev)
89{ 89{
90 int bit; 90 int bit;
91 91
@@ -100,7 +100,7 @@ static int drm_ctxbitmap_next(drm_device_t * dev)
100 if ((bit + 1) > dev->max_context) { 100 if ((bit + 1) > dev->max_context) {
101 dev->max_context = (bit + 1); 101 dev->max_context = (bit + 1);
102 if (dev->context_sareas) { 102 if (dev->context_sareas) {
103 drm_map_t **ctx_sareas; 103 struct drm_map **ctx_sareas;
104 104
105 ctx_sareas = drm_realloc(dev->context_sareas, 105 ctx_sareas = drm_realloc(dev->context_sareas,
106 (dev->max_context - 106 (dev->max_context -
@@ -147,7 +147,7 @@ static int drm_ctxbitmap_next(drm_device_t * dev)
147 * Allocates and initialize drm_device::ctx_bitmap and drm_device::context_sareas, while holding 147 * Allocates and initialize drm_device::ctx_bitmap and drm_device::context_sareas, while holding
148 * the drm_device::struct_mutex lock. 148 * the drm_device::struct_mutex lock.
149 */ 149 */
150int drm_ctxbitmap_init(drm_device_t * dev) 150int drm_ctxbitmap_init(struct drm_device * dev)
151{ 151{
152 int i; 152 int i;
153 int temp; 153 int temp;
@@ -180,7 +180,7 @@ int drm_ctxbitmap_init(drm_device_t * dev)
180 * Frees drm_device::ctx_bitmap and drm_device::context_sareas, while holding 180 * Frees drm_device::ctx_bitmap and drm_device::context_sareas, while holding
181 * the drm_device::struct_mutex lock. 181 * the drm_device::struct_mutex lock.
182 */ 182 */
183void drm_ctxbitmap_cleanup(drm_device_t * dev) 183void drm_ctxbitmap_cleanup(struct drm_device * dev)
184{ 184{
185 mutex_lock(&dev->struct_mutex); 185 mutex_lock(&dev->struct_mutex);
186 if (dev->context_sareas) 186 if (dev->context_sareas)
@@ -212,12 +212,12 @@ void drm_ctxbitmap_cleanup(drm_device_t * dev)
212int drm_getsareactx(struct inode *inode, struct file *filp, 212int drm_getsareactx(struct inode *inode, struct file *filp,
213 unsigned int cmd, unsigned long arg) 213 unsigned int cmd, unsigned long arg)
214{ 214{
215 drm_file_t *priv = filp->private_data; 215 struct drm_file *priv = filp->private_data;
216 drm_device_t *dev = priv->head->dev; 216 struct drm_device *dev = priv->head->dev;
217 drm_ctx_priv_map_t __user *argp = (void __user *)arg; 217 struct drm_ctx_priv_map __user *argp = (void __user *)arg;
218 drm_ctx_priv_map_t request; 218 struct drm_ctx_priv_map request;
219 drm_map_t *map; 219 struct drm_map *map;
220 drm_map_list_t *_entry; 220 struct drm_map_list *_entry;
221 221
222 if (copy_from_user(&request, argp, sizeof(request))) 222 if (copy_from_user(&request, argp, sizeof(request)))
223 return -EFAULT; 223 return -EFAULT;
@@ -233,7 +233,7 @@ int drm_getsareactx(struct inode *inode, struct file *filp,
233 mutex_unlock(&dev->struct_mutex); 233 mutex_unlock(&dev->struct_mutex);
234 234
235 request.handle = NULL; 235 request.handle = NULL;
236 list_for_each_entry(_entry, &dev->maplist->head, head) { 236 list_for_each_entry(_entry, &dev->maplist, head) {
237 if (_entry->map == map) { 237 if (_entry->map == map) {
238 request.handle = 238 request.handle =
239 (void *)(unsigned long)_entry->user_token; 239 (void *)(unsigned long)_entry->user_token;
@@ -263,20 +263,19 @@ int drm_getsareactx(struct inode *inode, struct file *filp,
263int drm_setsareactx(struct inode *inode, struct file *filp, 263int drm_setsareactx(struct inode *inode, struct file *filp,
264 unsigned int cmd, unsigned long arg) 264 unsigned int cmd, unsigned long arg)
265{ 265{
266 drm_file_t *priv = filp->private_data; 266 struct drm_file *priv = filp->private_data;
267 drm_device_t *dev = priv->head->dev; 267 struct drm_device *dev = priv->head->dev;
268 drm_ctx_priv_map_t request; 268 struct drm_ctx_priv_map request;
269 drm_map_t *map = NULL; 269 struct drm_map *map = NULL;
270 drm_map_list_t *r_list = NULL; 270 struct drm_map_list *r_list = NULL;
271 struct list_head *list;
272 271
273 if (copy_from_user(&request, 272 if (copy_from_user(&request,
274 (drm_ctx_priv_map_t __user *) arg, sizeof(request))) 273 (struct drm_ctx_priv_map __user *) arg,
274 sizeof(request)))
275 return -EFAULT; 275 return -EFAULT;
276 276
277 mutex_lock(&dev->struct_mutex); 277 mutex_lock(&dev->struct_mutex);
278 list_for_each(list, &dev->maplist->head) { 278 list_for_each_entry(r_list, &dev->maplist, head) {
279 r_list = list_entry(list, drm_map_list_t, head);
280 if (r_list->map 279 if (r_list->map
281 && r_list->user_token == (unsigned long)request.handle) 280 && r_list->user_token == (unsigned long)request.handle)
282 goto found; 281 goto found;
@@ -314,7 +313,7 @@ int drm_setsareactx(struct inode *inode, struct file *filp,
314 * 313 *
315 * Attempt to set drm_device::context_flag. 314 * Attempt to set drm_device::context_flag.
316 */ 315 */
317static int drm_context_switch(drm_device_t * dev, int old, int new) 316static int drm_context_switch(struct drm_device * dev, int old, int new)
318{ 317{
319 if (test_and_set_bit(0, &dev->context_flag)) { 318 if (test_and_set_bit(0, &dev->context_flag)) {
320 DRM_ERROR("Reentering -- FIXME\n"); 319 DRM_ERROR("Reentering -- FIXME\n");
@@ -342,7 +341,7 @@ static int drm_context_switch(drm_device_t * dev, int old, int new)
342 * hardware lock is held, clears the drm_device::context_flag and wakes up 341 * hardware lock is held, clears the drm_device::context_flag and wakes up
343 * drm_device::context_wait. 342 * drm_device::context_wait.
344 */ 343 */
345static int drm_context_switch_complete(drm_device_t * dev, int new) 344static int drm_context_switch_complete(struct drm_device * dev, int new)
346{ 345{
347 dev->last_context = new; /* PRE/POST: This is the _only_ writer. */ 346 dev->last_context = new; /* PRE/POST: This is the _only_ writer. */
348 dev->last_switch = jiffies; 347 dev->last_switch = jiffies;
@@ -372,9 +371,9 @@ static int drm_context_switch_complete(drm_device_t * dev, int new)
372int drm_resctx(struct inode *inode, struct file *filp, 371int drm_resctx(struct inode *inode, struct file *filp,
373 unsigned int cmd, unsigned long arg) 372 unsigned int cmd, unsigned long arg)
374{ 373{
375 drm_ctx_res_t res; 374 struct drm_ctx_res res;
376 drm_ctx_t __user *argp = (void __user *)arg; 375 struct drm_ctx_res __user *argp = (void __user *)arg;
377 drm_ctx_t ctx; 376 struct drm_ctx ctx;
378 int i; 377 int i;
379 378
380 if (copy_from_user(&res, argp, sizeof(res))) 379 if (copy_from_user(&res, argp, sizeof(res)))
@@ -409,11 +408,11 @@ int drm_resctx(struct inode *inode, struct file *filp,
409int drm_addctx(struct inode *inode, struct file *filp, 408int drm_addctx(struct inode *inode, struct file *filp,
410 unsigned int cmd, unsigned long arg) 409 unsigned int cmd, unsigned long arg)
411{ 410{
412 drm_file_t *priv = filp->private_data; 411 struct drm_file *priv = filp->private_data;
413 drm_device_t *dev = priv->head->dev; 412 struct drm_device *dev = priv->head->dev;
414 drm_ctx_list_t *ctx_entry; 413 struct drm_ctx_list *ctx_entry;
415 drm_ctx_t __user *argp = (void __user *)arg; 414 struct drm_ctx __user *argp = (void __user *)arg;
416 drm_ctx_t ctx; 415 struct drm_ctx ctx;
417 416
418 if (copy_from_user(&ctx, argp, sizeof(ctx))) 417 if (copy_from_user(&ctx, argp, sizeof(ctx)))
419 return -EFAULT; 418 return -EFAULT;
@@ -449,7 +448,7 @@ int drm_addctx(struct inode *inode, struct file *filp,
449 ctx_entry->tag = priv; 448 ctx_entry->tag = priv;
450 449
451 mutex_lock(&dev->ctxlist_mutex); 450 mutex_lock(&dev->ctxlist_mutex);
452 list_add(&ctx_entry->head, &dev->ctxlist->head); 451 list_add(&ctx_entry->head, &dev->ctxlist);
453 ++dev->ctx_count; 452 ++dev->ctx_count;
454 mutex_unlock(&dev->ctxlist_mutex); 453 mutex_unlock(&dev->ctxlist_mutex);
455 454
@@ -477,8 +476,8 @@ int drm_modctx(struct inode *inode, struct file *filp,
477int drm_getctx(struct inode *inode, struct file *filp, 476int drm_getctx(struct inode *inode, struct file *filp,
478 unsigned int cmd, unsigned long arg) 477 unsigned int cmd, unsigned long arg)
479{ 478{
480 drm_ctx_t __user *argp = (void __user *)arg; 479 struct drm_ctx __user *argp = (void __user *)arg;
481 drm_ctx_t ctx; 480 struct drm_ctx ctx;
482 481
483 if (copy_from_user(&ctx, argp, sizeof(ctx))) 482 if (copy_from_user(&ctx, argp, sizeof(ctx)))
484 return -EFAULT; 483 return -EFAULT;
@@ -505,11 +504,11 @@ int drm_getctx(struct inode *inode, struct file *filp,
505int drm_switchctx(struct inode *inode, struct file *filp, 504int drm_switchctx(struct inode *inode, struct file *filp,
506 unsigned int cmd, unsigned long arg) 505 unsigned int cmd, unsigned long arg)
507{ 506{
508 drm_file_t *priv = filp->private_data; 507 struct drm_file *priv = filp->private_data;
509 drm_device_t *dev = priv->head->dev; 508 struct drm_device *dev = priv->head->dev;
510 drm_ctx_t ctx; 509 struct drm_ctx ctx;
511 510
512 if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx))) 511 if (copy_from_user(&ctx, (struct drm_ctx __user *) arg, sizeof(ctx)))
513 return -EFAULT; 512 return -EFAULT;
514 513
515 DRM_DEBUG("%d\n", ctx.handle); 514 DRM_DEBUG("%d\n", ctx.handle);
@@ -530,11 +529,11 @@ int drm_switchctx(struct inode *inode, struct file *filp,
530int drm_newctx(struct inode *inode, struct file *filp, 529int drm_newctx(struct inode *inode, struct file *filp,
531 unsigned int cmd, unsigned long arg) 530 unsigned int cmd, unsigned long arg)
532{ 531{
533 drm_file_t *priv = filp->private_data; 532 struct drm_file *priv = filp->private_data;
534 drm_device_t *dev = priv->head->dev; 533 struct drm_device *dev = priv->head->dev;
535 drm_ctx_t ctx; 534 struct drm_ctx ctx;
536 535
537 if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx))) 536 if (copy_from_user(&ctx, (struct drm_ctx __user *) arg, sizeof(ctx)))
538 return -EFAULT; 537 return -EFAULT;
539 538
540 DRM_DEBUG("%d\n", ctx.handle); 539 DRM_DEBUG("%d\n", ctx.handle);
@@ -557,11 +556,11 @@ int drm_newctx(struct inode *inode, struct file *filp,
557int drm_rmctx(struct inode *inode, struct file *filp, 556int drm_rmctx(struct inode *inode, struct file *filp,
558 unsigned int cmd, unsigned long arg) 557 unsigned int cmd, unsigned long arg)
559{ 558{
560 drm_file_t *priv = filp->private_data; 559 struct drm_file *priv = filp->private_data;
561 drm_device_t *dev = priv->head->dev; 560 struct drm_device *dev = priv->head->dev;
562 drm_ctx_t ctx; 561 struct drm_ctx ctx;
563 562
564 if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx))) 563 if (copy_from_user(&ctx, (struct drm_ctx __user *) arg, sizeof(ctx)))
565 return -EFAULT; 564 return -EFAULT;
566 565
567 DRM_DEBUG("%d\n", ctx.handle); 566 DRM_DEBUG("%d\n", ctx.handle);
@@ -575,10 +574,10 @@ int drm_rmctx(struct inode *inode, struct file *filp,
575 } 574 }
576 575
577 mutex_lock(&dev->ctxlist_mutex); 576 mutex_lock(&dev->ctxlist_mutex);
578 if (!list_empty(&dev->ctxlist->head)) { 577 if (!list_empty(&dev->ctxlist)) {
579 drm_ctx_list_t *pos, *n; 578 struct drm_ctx_list *pos, *n;
580 579
581 list_for_each_entry_safe(pos, n, &dev->ctxlist->head, head) { 580 list_for_each_entry_safe(pos, n, &dev->ctxlist, head) {
582 if (pos->handle == ctx.handle) { 581 if (pos->handle == ctx.handle) {
583 list_del(&pos->head); 582 list_del(&pos->head);
584 drm_free(pos, sizeof(*pos), DRM_MEM_CTXLIST); 583 drm_free(pos, sizeof(*pos), DRM_MEM_CTXLIST);
diff --git a/drivers/char/drm/drm_dma.c b/drivers/char/drm/drm_dma.c
index 32ed19c9ec1c..802fbdbfe1b3 100644
--- a/drivers/char/drm/drm_dma.c
+++ b/drivers/char/drm/drm_dma.c
@@ -43,7 +43,7 @@
43 * 43 *
44 * Allocate and initialize a drm_device_dma structure. 44 * Allocate and initialize a drm_device_dma structure.
45 */ 45 */
46int drm_dma_setup(drm_device_t * dev) 46int drm_dma_setup(struct drm_device *dev)
47{ 47{
48 int i; 48 int i;
49 49
@@ -67,9 +67,9 @@ int drm_dma_setup(drm_device_t * dev)
67 * Free all pages associated with DMA buffers, the buffers and pages lists, and 67 * Free all pages associated with DMA buffers, the buffers and pages lists, and
68 * finally the drm_device::dma structure itself. 68 * finally the drm_device::dma structure itself.
69 */ 69 */
70void drm_dma_takedown(drm_device_t * dev) 70void drm_dma_takedown(struct drm_device *dev)
71{ 71{
72 drm_device_dma_t *dma = dev->dma; 72 struct drm_device_dma *dma = dev->dma;
73 int i, j; 73 int i, j;
74 74
75 if (!dma) 75 if (!dma)
@@ -129,7 +129,7 @@ void drm_dma_takedown(drm_device_t * dev)
129 * 129 *
130 * Resets the fields of \p buf. 130 * Resets the fields of \p buf.
131 */ 131 */
132void drm_free_buffer(drm_device_t * dev, drm_buf_t * buf) 132void drm_free_buffer(struct drm_device *dev, struct drm_buf * buf)
133{ 133{
134 if (!buf) 134 if (!buf)
135 return; 135 return;
@@ -152,9 +152,9 @@ void drm_free_buffer(drm_device_t * dev, drm_buf_t * buf)
152 * 152 *
153 * Frees each buffer associated with \p filp not already on the hardware. 153 * Frees each buffer associated with \p filp not already on the hardware.
154 */ 154 */
155void drm_core_reclaim_buffers(drm_device_t * dev, struct file *filp) 155void drm_core_reclaim_buffers(struct drm_device *dev, struct file *filp)
156{ 156{
157 drm_device_dma_t *dma = dev->dma; 157 struct drm_device_dma *dma = dev->dma;
158 int i; 158 int i;
159 159
160 if (!dma) 160 if (!dma)
diff --git a/drivers/char/drm/drm_drawable.c b/drivers/char/drm/drm_drawable.c
index b33313be2547..309e585a5442 100644
--- a/drivers/char/drm/drm_drawable.c
+++ b/drivers/char/drm/drm_drawable.c
@@ -47,9 +47,9 @@ int drm_adddraw(DRM_IOCTL_ARGS)
47 int i, j; 47 int i, j;
48 u32 *bitfield = dev->drw_bitfield; 48 u32 *bitfield = dev->drw_bitfield;
49 unsigned int bitfield_length = dev->drw_bitfield_length; 49 unsigned int bitfield_length = dev->drw_bitfield_length;
50 drm_drawable_info_t **info = dev->drw_info; 50 struct drm_drawable_info **info = dev->drw_info;
51 unsigned int info_length = dev->drw_info_length; 51 unsigned int info_length = dev->drw_info_length;
52 drm_draw_t draw; 52 struct drm_draw draw;
53 53
54 for (i = 0, j = 0; i < bitfield_length; i++) { 54 for (i = 0, j = 0; i < bitfield_length; i++) {
55 if (bitfield[i] == ~0) 55 if (bitfield[i] == ~0)
@@ -120,7 +120,7 @@ done:
120 120
121 spin_unlock_irqrestore(&dev->drw_lock, irqflags); 121 spin_unlock_irqrestore(&dev->drw_lock, irqflags);
122 122
123 DRM_COPY_TO_USER_IOCTL((drm_draw_t __user *)data, draw, sizeof(draw)); 123 DRM_COPY_TO_USER_IOCTL((struct drm_draw __user *)data, draw, sizeof(draw));
124 124
125 return 0; 125 return 0;
126} 126}
@@ -131,16 +131,16 @@ done:
131int drm_rmdraw(DRM_IOCTL_ARGS) 131int drm_rmdraw(DRM_IOCTL_ARGS)
132{ 132{
133 DRM_DEVICE; 133 DRM_DEVICE;
134 drm_draw_t draw; 134 struct drm_draw draw;
135 int id, idx; 135 int id, idx;
136 unsigned int shift; 136 unsigned int shift;
137 unsigned long irqflags; 137 unsigned long irqflags;
138 u32 *bitfield = dev->drw_bitfield; 138 u32 *bitfield = dev->drw_bitfield;
139 unsigned int bitfield_length = dev->drw_bitfield_length; 139 unsigned int bitfield_length = dev->drw_bitfield_length;
140 drm_drawable_info_t **info = dev->drw_info; 140 struct drm_drawable_info **info = dev->drw_info;
141 unsigned int info_length = dev->drw_info_length; 141 unsigned int info_length = dev->drw_info_length;
142 142
143 DRM_COPY_FROM_USER_IOCTL(draw, (drm_draw_t __user *) data, 143 DRM_COPY_FROM_USER_IOCTL(draw, (struct drm_draw __user *) data,
144 sizeof(draw)); 144 sizeof(draw));
145 145
146 id = draw.handle - 1; 146 id = draw.handle - 1;
@@ -161,7 +161,7 @@ int drm_rmdraw(DRM_IOCTL_ARGS)
161 161
162 if (info[id]) { 162 if (info[id]) {
163 drm_free(info[id]->rects, info[id]->num_rects * 163 drm_free(info[id]->rects, info[id]->num_rects *
164 sizeof(drm_clip_rect_t), DRM_MEM_BUFS); 164 sizeof(struct drm_clip_rect), DRM_MEM_BUFS);
165 drm_free(info[id], sizeof(**info), DRM_MEM_BUFS); 165 drm_free(info[id], sizeof(**info), DRM_MEM_BUFS);
166 } 166 }
167 167
@@ -230,15 +230,15 @@ int drm_rmdraw(DRM_IOCTL_ARGS)
230 230
231int drm_update_drawable_info(DRM_IOCTL_ARGS) { 231int drm_update_drawable_info(DRM_IOCTL_ARGS) {
232 DRM_DEVICE; 232 DRM_DEVICE;
233 drm_update_draw_t update; 233 struct drm_update_draw update;
234 unsigned int id, idx, shift; 234 unsigned int id, idx, shift;
235 u32 *bitfield = dev->drw_bitfield; 235 u32 *bitfield = dev->drw_bitfield;
236 unsigned long irqflags, bitfield_length = dev->drw_bitfield_length; 236 unsigned long irqflags, bitfield_length = dev->drw_bitfield_length;
237 drm_drawable_info_t *info; 237 struct drm_drawable_info *info;
238 drm_clip_rect_t *rects; 238 struct drm_clip_rect *rects;
239 int err; 239 int err;
240 240
241 DRM_COPY_FROM_USER_IOCTL(update, (drm_update_draw_t __user *) data, 241 DRM_COPY_FROM_USER_IOCTL(update, (struct drm_update_draw __user *) data,
242 sizeof(update)); 242 sizeof(update));
243 243
244 id = update.handle - 1; 244 id = update.handle - 1;
@@ -254,7 +254,7 @@ int drm_update_drawable_info(DRM_IOCTL_ARGS) {
254 info = dev->drw_info[id]; 254 info = dev->drw_info[id];
255 255
256 if (!info) { 256 if (!info) {
257 info = drm_calloc(1, sizeof(drm_drawable_info_t), DRM_MEM_BUFS); 257 info = drm_calloc(1, sizeof(struct drm_drawable_info), DRM_MEM_BUFS);
258 258
259 if (!info) { 259 if (!info) {
260 DRM_ERROR("Failed to allocate drawable info memory\n"); 260 DRM_ERROR("Failed to allocate drawable info memory\n");
@@ -265,7 +265,7 @@ int drm_update_drawable_info(DRM_IOCTL_ARGS) {
265 switch (update.type) { 265 switch (update.type) {
266 case DRM_DRAWABLE_CLIPRECTS: 266 case DRM_DRAWABLE_CLIPRECTS:
267 if (update.num != info->num_rects) { 267 if (update.num != info->num_rects) {
268 rects = drm_alloc(update.num * sizeof(drm_clip_rect_t), 268 rects = drm_alloc(update.num * sizeof(struct drm_clip_rect),
269 DRM_MEM_BUFS); 269 DRM_MEM_BUFS);
270 } else 270 } else
271 rects = info->rects; 271 rects = info->rects;
@@ -277,7 +277,7 @@ int drm_update_drawable_info(DRM_IOCTL_ARGS) {
277 } 277 }
278 278
279 if (update.num && DRM_COPY_FROM_USER(rects, 279 if (update.num && DRM_COPY_FROM_USER(rects,
280 (drm_clip_rect_t __user *) 280 (struct drm_clip_rect __user *)
281 (unsigned long)update.data, 281 (unsigned long)update.data,
282 update.num * 282 update.num *
283 sizeof(*rects))) { 283 sizeof(*rects))) {
@@ -290,7 +290,7 @@ int drm_update_drawable_info(DRM_IOCTL_ARGS) {
290 290
291 if (rects != info->rects) { 291 if (rects != info->rects) {
292 drm_free(info->rects, info->num_rects * 292 drm_free(info->rects, info->num_rects *
293 sizeof(drm_clip_rect_t), DRM_MEM_BUFS); 293 sizeof(struct drm_clip_rect), DRM_MEM_BUFS);
294 } 294 }
295 295
296 info->rects = rects; 296 info->rects = rects;
@@ -314,7 +314,7 @@ error:
314 drm_free(info, sizeof(*info), DRM_MEM_BUFS); 314 drm_free(info, sizeof(*info), DRM_MEM_BUFS);
315 else if (rects != dev->drw_info[id]->rects) 315 else if (rects != dev->drw_info[id]->rects)
316 drm_free(rects, update.num * 316 drm_free(rects, update.num *
317 sizeof(drm_clip_rect_t), DRM_MEM_BUFS); 317 sizeof(struct drm_clip_rect), DRM_MEM_BUFS);
318 318
319 return err; 319 return err;
320} 320}
@@ -322,7 +322,7 @@ error:
322/** 322/**
323 * Caller must hold the drawable spinlock! 323 * Caller must hold the drawable spinlock!
324 */ 324 */
325drm_drawable_info_t *drm_get_drawable_info(drm_device_t *dev, drm_drawable_t id) { 325struct drm_drawable_info *drm_get_drawable_info(struct drm_device *dev, drm_drawable_t id) {
326 u32 *bitfield = dev->drw_bitfield; 326 u32 *bitfield = dev->drw_bitfield;
327 unsigned int idx, shift; 327 unsigned int idx, shift;
328 328
diff --git a/drivers/char/drm/drm_drv.c b/drivers/char/drm/drm_drv.c
index 8e77b7ed0f44..d5cf5cfccf78 100644
--- a/drivers/char/drm/drm_drv.c
+++ b/drivers/char/drm/drm_drv.c
@@ -129,11 +129,11 @@ static drm_ioctl_desc_t drm_ioctls[] = {
129 * 129 *
130 * \sa drm_device 130 * \sa drm_device
131 */ 131 */
132int drm_lastclose(drm_device_t * dev) 132int drm_lastclose(struct drm_device * dev)
133{ 133{
134 drm_magic_entry_t *pt, *next; 134 struct drm_magic_entry *pt, *next;
135 drm_map_list_t *r_list; 135 struct drm_map_list *r_list, *list_t;
136 drm_vma_entry_t *vma, *vma_next; 136 struct drm_vma_entry *vma, *vma_temp;
137 int i; 137 int i;
138 138
139 DRM_DEBUG("\n"); 139 DRM_DEBUG("\n");
@@ -154,11 +154,11 @@ int drm_lastclose(drm_device_t * dev)
154 /* Free drawable information memory */ 154 /* Free drawable information memory */
155 for (i = 0; i < dev->drw_bitfield_length / sizeof(*dev->drw_bitfield); 155 for (i = 0; i < dev->drw_bitfield_length / sizeof(*dev->drw_bitfield);
156 i++) { 156 i++) {
157 drm_drawable_info_t *info = drm_get_drawable_info(dev, i); 157 struct drm_drawable_info *info = drm_get_drawable_info(dev, i);
158 158
159 if (info) { 159 if (info) {
160 drm_free(info->rects, info->num_rects * 160 drm_free(info->rects, info->num_rects *
161 sizeof(drm_clip_rect_t), DRM_MEM_BUFS); 161 sizeof(struct drm_clip_rect), DRM_MEM_BUFS);
162 drm_free(info, sizeof(*info), DRM_MEM_BUFS); 162 drm_free(info, sizeof(*info), DRM_MEM_BUFS);
163 } 163 }
164 } 164 }
@@ -178,19 +178,17 @@ int drm_lastclose(drm_device_t * dev)
178 178
179 /* Clear AGP information */ 179 /* Clear AGP information */
180 if (drm_core_has_AGP(dev) && dev->agp) { 180 if (drm_core_has_AGP(dev) && dev->agp) {
181 drm_agp_mem_t *entry; 181 struct drm_agp_mem *entry, *tempe;
182 drm_agp_mem_t *nexte;
183 182
184 /* Remove AGP resources, but leave dev->agp 183 /* Remove AGP resources, but leave dev->agp
185 intact until drv_cleanup is called. */ 184 intact until drv_cleanup is called. */
186 for (entry = dev->agp->memory; entry; entry = nexte) { 185 list_for_each_entry_safe(entry, tempe, &dev->agp->memory, head) {
187 nexte = entry->next;
188 if (entry->bound) 186 if (entry->bound)
189 drm_unbind_agp(entry->memory); 187 drm_unbind_agp(entry->memory);
190 drm_free_agp(entry->memory, entry->pages); 188 drm_free_agp(entry->memory, entry->pages);
191 drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); 189 drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
192 } 190 }
193 dev->agp->memory = NULL; 191 INIT_LIST_HEAD(&dev->agp->memory);
194 192
195 if (dev->agp->acquired) 193 if (dev->agp->acquired)
196 drm_agp_release(dev); 194 drm_agp_release(dev);
@@ -204,20 +202,14 @@ int drm_lastclose(drm_device_t * dev)
204 } 202 }
205 203
206 /* Clear vma list (only built for debugging) */ 204 /* Clear vma list (only built for debugging) */
207 if (dev->vmalist) { 205 list_for_each_entry_safe(vma, vma_temp, &dev->vmalist, head) {
208 for (vma = dev->vmalist; vma; vma = vma_next) { 206 list_del(&vma->head);
209 vma_next = vma->next; 207 drm_free(vma, sizeof(*vma), DRM_MEM_VMAS);
210 drm_free(vma, sizeof(*vma), DRM_MEM_VMAS);
211 }
212 dev->vmalist = NULL;
213 } 208 }
214 209
215 if (dev->maplist) { 210 list_for_each_entry_safe(r_list, list_t, &dev->maplist, head) {
216 while (!list_empty(&dev->maplist->head)) { 211 drm_rmmap_locked(dev, r_list->map);
217 struct list_head *list = dev->maplist->head.next; 212 r_list = NULL;
218 r_list = list_entry(list, drm_map_list_t, head);
219 drm_rmmap_locked(dev, r_list->map);
220 }
221 } 213 }
222 214
223 if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE) && dev->queuelist) { 215 if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE) && dev->queuelist) {
@@ -298,7 +290,7 @@ EXPORT_SYMBOL(drm_init);
298 * 290 *
299 * \sa drm_init 291 * \sa drm_init
300 */ 292 */
301static void drm_cleanup(drm_device_t * dev) 293static void drm_cleanup(struct drm_device * dev)
302{ 294{
303 DRM_DEBUG("\n"); 295 DRM_DEBUG("\n");
304 296
@@ -309,11 +301,7 @@ static void drm_cleanup(drm_device_t * dev)
309 301
310 drm_lastclose(dev); 302 drm_lastclose(dev);
311 303
312 if (dev->maplist) { 304 drm_ht_remove(&dev->map_hash);
313 drm_free(dev->maplist, sizeof(*dev->maplist), DRM_MEM_MAPS);
314 dev->maplist = NULL;
315 drm_ht_remove(&dev->map_hash);
316 }
317 305
318 drm_ctxbitmap_cleanup(dev); 306 drm_ctxbitmap_cleanup(dev);
319 307
@@ -342,8 +330,8 @@ static void drm_cleanup(drm_device_t * dev)
342void drm_exit(struct drm_driver *driver) 330void drm_exit(struct drm_driver *driver)
343{ 331{
344 int i; 332 int i;
345 drm_device_t *dev = NULL; 333 struct drm_device *dev = NULL;
346 drm_head_t *head; 334 struct drm_head *head;
347 335
348 DRM_DEBUG("\n"); 336 DRM_DEBUG("\n");
349 337
@@ -442,10 +430,10 @@ module_exit(drm_core_exit);
442static int drm_version(struct inode *inode, struct file *filp, 430static int drm_version(struct inode *inode, struct file *filp,
443 unsigned int cmd, unsigned long arg) 431 unsigned int cmd, unsigned long arg)
444{ 432{
445 drm_file_t *priv = filp->private_data; 433 struct drm_file *priv = filp->private_data;
446 drm_device_t *dev = priv->head->dev; 434 struct drm_device *dev = priv->head->dev;
447 drm_version_t __user *argp = (void __user *)arg; 435 struct drm_version __user *argp = (void __user *)arg;
448 drm_version_t version; 436 struct drm_version version;
449 int len; 437 int len;
450 438
451 if (copy_from_user(&version, argp, sizeof(version))) 439 if (copy_from_user(&version, argp, sizeof(version)))
@@ -478,8 +466,8 @@ static int drm_version(struct inode *inode, struct file *filp,
478int drm_ioctl(struct inode *inode, struct file *filp, 466int drm_ioctl(struct inode *inode, struct file *filp,
479 unsigned int cmd, unsigned long arg) 467 unsigned int cmd, unsigned long arg)
480{ 468{
481 drm_file_t *priv = filp->private_data; 469 struct drm_file *priv = filp->private_data;
482 drm_device_t *dev = priv->head->dev; 470 struct drm_device *dev = priv->head->dev;
483 drm_ioctl_desc_t *ioctl; 471 drm_ioctl_desc_t *ioctl;
484 drm_ioctl_t *func; 472 drm_ioctl_t *func;
485 unsigned int nr = DRM_IOCTL_NR(cmd); 473 unsigned int nr = DRM_IOCTL_NR(cmd);
@@ -529,3 +517,17 @@ int drm_ioctl(struct inode *inode, struct file *filp,
529} 517}
530 518
531EXPORT_SYMBOL(drm_ioctl); 519EXPORT_SYMBOL(drm_ioctl);
520
521drm_local_map_t *drm_getsarea(struct drm_device *dev)
522{
523 struct drm_map_list *entry;
524
525 list_for_each_entry(entry, &dev->maplist, head) {
526 if (entry->map && entry->map->type == _DRM_SHM &&
527 (entry->map->flags & _DRM_CONTAINS_LOCK)) {
528 return entry->map;
529 }
530 }
531 return NULL;
532}
533EXPORT_SYMBOL(drm_getsarea);
diff --git a/drivers/char/drm/drm_fops.c b/drivers/char/drm/drm_fops.c
index 3b159cab3bc8..7bc51bac450d 100644
--- a/drivers/char/drm/drm_fops.c
+++ b/drivers/char/drm/drm_fops.c
@@ -39,9 +39,9 @@
39#include <linux/poll.h> 39#include <linux/poll.h>
40 40
41static int drm_open_helper(struct inode *inode, struct file *filp, 41static int drm_open_helper(struct inode *inode, struct file *filp,
42 drm_device_t * dev); 42 struct drm_device * dev);
43 43
44static int drm_setup(drm_device_t * dev) 44static int drm_setup(struct drm_device * dev)
45{ 45{
46 drm_local_map_t *map; 46 drm_local_map_t *map;
47 int i; 47 int i;
@@ -79,13 +79,6 @@ static int drm_setup(drm_device_t * dev)
79 drm_ht_create(&dev->magiclist, DRM_MAGIC_HASH_ORDER); 79 drm_ht_create(&dev->magiclist, DRM_MAGIC_HASH_ORDER);
80 INIT_LIST_HEAD(&dev->magicfree); 80 INIT_LIST_HEAD(&dev->magicfree);
81 81
82 dev->ctxlist = drm_alloc(sizeof(*dev->ctxlist), DRM_MEM_CTXLIST);
83 if (dev->ctxlist == NULL)
84 return -ENOMEM;
85 memset(dev->ctxlist, 0, sizeof(*dev->ctxlist));
86 INIT_LIST_HEAD(&dev->ctxlist->head);
87
88 dev->vmalist = NULL;
89 dev->sigdata.lock = NULL; 82 dev->sigdata.lock = NULL;
90 init_waitqueue_head(&dev->lock.lock_queue); 83 init_waitqueue_head(&dev->lock.lock_queue);
91 dev->queue_count = 0; 84 dev->queue_count = 0;
@@ -135,7 +128,7 @@ static int drm_setup(drm_device_t * dev)
135 */ 128 */
136int drm_open(struct inode *inode, struct file *filp) 129int drm_open(struct inode *inode, struct file *filp)
137{ 130{
138 drm_device_t *dev = NULL; 131 struct drm_device *dev = NULL;
139 int minor = iminor(inode); 132 int minor = iminor(inode);
140 int retcode = 0; 133 int retcode = 0;
141 134
@@ -174,7 +167,7 @@ EXPORT_SYMBOL(drm_open);
174 */ 167 */
175int drm_stub_open(struct inode *inode, struct file *filp) 168int drm_stub_open(struct inode *inode, struct file *filp)
176{ 169{
177 drm_device_t *dev = NULL; 170 struct drm_device *dev = NULL;
178 int minor = iminor(inode); 171 int minor = iminor(inode);
179 int err = -ENODEV; 172 int err = -ENODEV;
180 const struct file_operations *old_fops; 173 const struct file_operations *old_fops;
@@ -230,10 +223,10 @@ static int drm_cpu_valid(void)
230 * filp and add it into the double linked list in \p dev. 223 * filp and add it into the double linked list in \p dev.
231 */ 224 */
232static int drm_open_helper(struct inode *inode, struct file *filp, 225static int drm_open_helper(struct inode *inode, struct file *filp,
233 drm_device_t * dev) 226 struct drm_device * dev)
234{ 227{
235 int minor = iminor(inode); 228 int minor = iminor(inode);
236 drm_file_t *priv; 229 struct drm_file *priv;
237 int ret; 230 int ret;
238 231
239 if (filp->f_flags & O_EXCL) 232 if (filp->f_flags & O_EXCL)
@@ -258,6 +251,8 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
258 priv->authenticated = capable(CAP_SYS_ADMIN); 251 priv->authenticated = capable(CAP_SYS_ADMIN);
259 priv->lock_count = 0; 252 priv->lock_count = 0;
260 253
254 INIT_LIST_HEAD(&priv->lhead);
255
261 if (dev->driver->open) { 256 if (dev->driver->open) {
262 ret = dev->driver->open(dev, priv); 257 ret = dev->driver->open(dev, priv);
263 if (ret < 0) 258 if (ret < 0)
@@ -265,19 +260,10 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
265 } 260 }
266 261
267 mutex_lock(&dev->struct_mutex); 262 mutex_lock(&dev->struct_mutex);
268 if (!dev->file_last) { 263 if (list_empty(&dev->filelist))
269 priv->next = NULL;
270 priv->prev = NULL;
271 dev->file_first = priv;
272 dev->file_last = priv;
273 /* first opener automatically becomes master */
274 priv->master = 1; 264 priv->master = 1;
275 } else { 265
276 priv->next = NULL; 266 list_add(&priv->lhead, &dev->filelist);
277 priv->prev = dev->file_last;
278 dev->file_last->next = priv;
279 dev->file_last = priv;
280 }
281 mutex_unlock(&dev->struct_mutex); 267 mutex_unlock(&dev->struct_mutex);
282 268
283#ifdef __alpha__ 269#ifdef __alpha__
@@ -309,8 +295,8 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
309/** No-op. */ 295/** No-op. */
310int drm_fasync(int fd, struct file *filp, int on) 296int drm_fasync(int fd, struct file *filp, int on)
311{ 297{
312 drm_file_t *priv = filp->private_data; 298 struct drm_file *priv = filp->private_data;
313 drm_device_t *dev = priv->head->dev; 299 struct drm_device *dev = priv->head->dev;
314 int retcode; 300 int retcode;
315 301
316 DRM_DEBUG("fd = %d, device = 0x%lx\n", fd, 302 DRM_DEBUG("fd = %d, device = 0x%lx\n", fd,
@@ -336,8 +322,8 @@ EXPORT_SYMBOL(drm_fasync);
336 */ 322 */
337int drm_release(struct inode *inode, struct file *filp) 323int drm_release(struct inode *inode, struct file *filp)
338{ 324{
339 drm_file_t *priv = filp->private_data; 325 struct drm_file *priv = filp->private_data;
340 drm_device_t *dev; 326 struct drm_device *dev;
341 int retcode = 0; 327 int retcode = 0;
342 328
343 lock_kernel(); 329 lock_kernel();
@@ -414,10 +400,10 @@ int drm_release(struct inode *inode, struct file *filp)
414 drm_fasync(-1, filp, 0); 400 drm_fasync(-1, filp, 0);
415 401
416 mutex_lock(&dev->ctxlist_mutex); 402 mutex_lock(&dev->ctxlist_mutex);
417 if (dev->ctxlist && (!list_empty(&dev->ctxlist->head))) { 403 if (!list_empty(&dev->ctxlist)) {
418 drm_ctx_list_t *pos, *n; 404 struct drm_ctx_list *pos, *n;
419 405
420 list_for_each_entry_safe(pos, n, &dev->ctxlist->head, head) { 406 list_for_each_entry_safe(pos, n, &dev->ctxlist, head) {
421 if (pos->tag == priv && 407 if (pos->tag == priv &&
422 pos->handle != DRM_KERNEL_CONTEXT) { 408 pos->handle != DRM_KERNEL_CONTEXT) {
423 if (dev->driver->context_dtor) 409 if (dev->driver->context_dtor)
@@ -436,22 +422,12 @@ int drm_release(struct inode *inode, struct file *filp)
436 422
437 mutex_lock(&dev->struct_mutex); 423 mutex_lock(&dev->struct_mutex);
438 if (priv->remove_auth_on_close == 1) { 424 if (priv->remove_auth_on_close == 1) {
439 drm_file_t *temp = dev->file_first; 425 struct drm_file *temp;
440 while (temp) { 426
427 list_for_each_entry(temp, &dev->filelist, lhead)
441 temp->authenticated = 0; 428 temp->authenticated = 0;
442 temp = temp->next;
443 }
444 }
445 if (priv->prev) {
446 priv->prev->next = priv->next;
447 } else {
448 dev->file_first = priv->next;
449 }
450 if (priv->next) {
451 priv->next->prev = priv->prev;
452 } else {
453 dev->file_last = priv->prev;
454 } 429 }
430 list_del(&priv->lhead);
455 mutex_unlock(&dev->struct_mutex); 431 mutex_unlock(&dev->struct_mutex);
456 432
457 if (dev->driver->postclose) 433 if (dev->driver->postclose)
diff --git a/drivers/char/drm/drm_hashtab.c b/drivers/char/drm/drm_hashtab.c
index 31acb621dcce..3ad319070704 100644
--- a/drivers/char/drm/drm_hashtab.c
+++ b/drivers/char/drm/drm_hashtab.c
@@ -36,7 +36,7 @@
36#include "drm_hashtab.h" 36#include "drm_hashtab.h"
37#include <linux/hash.h> 37#include <linux/hash.h>
38 38
39int drm_ht_create(drm_open_hash_t *ht, unsigned int order) 39int drm_ht_create(struct drm_open_hash *ht, unsigned int order)
40{ 40{
41 unsigned int i; 41 unsigned int i;
42 42
@@ -63,9 +63,9 @@ int drm_ht_create(drm_open_hash_t *ht, unsigned int order)
63 return 0; 63 return 0;
64} 64}
65 65
66void drm_ht_verbose_list(drm_open_hash_t *ht, unsigned long key) 66void drm_ht_verbose_list(struct drm_open_hash *ht, unsigned long key)
67{ 67{
68 drm_hash_item_t *entry; 68 struct drm_hash_item *entry;
69 struct hlist_head *h_list; 69 struct hlist_head *h_list;
70 struct hlist_node *list; 70 struct hlist_node *list;
71 unsigned int hashed_key; 71 unsigned int hashed_key;
@@ -75,15 +75,15 @@ void drm_ht_verbose_list(drm_open_hash_t *ht, unsigned long key)
75 DRM_DEBUG("Key is 0x%08lx, Hashed key is 0x%08x\n", key, hashed_key); 75 DRM_DEBUG("Key is 0x%08lx, Hashed key is 0x%08x\n", key, hashed_key);
76 h_list = &ht->table[hashed_key]; 76 h_list = &ht->table[hashed_key];
77 hlist_for_each(list, h_list) { 77 hlist_for_each(list, h_list) {
78 entry = hlist_entry(list, drm_hash_item_t, head); 78 entry = hlist_entry(list, struct drm_hash_item, head);
79 DRM_DEBUG("count %d, key: 0x%08lx\n", count++, entry->key); 79 DRM_DEBUG("count %d, key: 0x%08lx\n", count++, entry->key);
80 } 80 }
81} 81}
82 82
83static struct hlist_node *drm_ht_find_key(drm_open_hash_t *ht, 83static struct hlist_node *drm_ht_find_key(struct drm_open_hash *ht,
84 unsigned long key) 84 unsigned long key)
85{ 85{
86 drm_hash_item_t *entry; 86 struct drm_hash_item *entry;
87 struct hlist_head *h_list; 87 struct hlist_head *h_list;
88 struct hlist_node *list; 88 struct hlist_node *list;
89 unsigned int hashed_key; 89 unsigned int hashed_key;
@@ -91,7 +91,7 @@ static struct hlist_node *drm_ht_find_key(drm_open_hash_t *ht,
91 hashed_key = hash_long(key, ht->order); 91 hashed_key = hash_long(key, ht->order);
92 h_list = &ht->table[hashed_key]; 92 h_list = &ht->table[hashed_key];
93 hlist_for_each(list, h_list) { 93 hlist_for_each(list, h_list) {
94 entry = hlist_entry(list, drm_hash_item_t, head); 94 entry = hlist_entry(list, struct drm_hash_item, head);
95 if (entry->key == key) 95 if (entry->key == key)
96 return list; 96 return list;
97 if (entry->key > key) 97 if (entry->key > key)
@@ -101,9 +101,9 @@ static struct hlist_node *drm_ht_find_key(drm_open_hash_t *ht,
101} 101}
102 102
103 103
104int drm_ht_insert_item(drm_open_hash_t *ht, drm_hash_item_t *item) 104int drm_ht_insert_item(struct drm_open_hash *ht, struct drm_hash_item *item)
105{ 105{
106 drm_hash_item_t *entry; 106 struct drm_hash_item *entry;
107 struct hlist_head *h_list; 107 struct hlist_head *h_list;
108 struct hlist_node *list, *parent; 108 struct hlist_node *list, *parent;
109 unsigned int hashed_key; 109 unsigned int hashed_key;
@@ -113,7 +113,7 @@ int drm_ht_insert_item(drm_open_hash_t *ht, drm_hash_item_t *item)
113 h_list = &ht->table[hashed_key]; 113 h_list = &ht->table[hashed_key];
114 parent = NULL; 114 parent = NULL;
115 hlist_for_each(list, h_list) { 115 hlist_for_each(list, h_list) {
116 entry = hlist_entry(list, drm_hash_item_t, head); 116 entry = hlist_entry(list, struct drm_hash_item, head);
117 if (entry->key == key) 117 if (entry->key == key)
118 return -EINVAL; 118 return -EINVAL;
119 if (entry->key > key) 119 if (entry->key > key)
@@ -132,7 +132,7 @@ int drm_ht_insert_item(drm_open_hash_t *ht, drm_hash_item_t *item)
132 * Just insert an item and return any "bits" bit key that hasn't been 132 * Just insert an item and return any "bits" bit key that hasn't been
133 * used before. 133 * used before.
134 */ 134 */
135int drm_ht_just_insert_please(drm_open_hash_t *ht, drm_hash_item_t *item, 135int drm_ht_just_insert_please(struct drm_open_hash *ht, struct drm_hash_item *item,
136 unsigned long seed, int bits, int shift, 136 unsigned long seed, int bits, int shift,
137 unsigned long add) 137 unsigned long add)
138{ 138{
@@ -156,8 +156,8 @@ int drm_ht_just_insert_please(drm_open_hash_t *ht, drm_hash_item_t *item,
156 return 0; 156 return 0;
157} 157}
158 158
159int drm_ht_find_item(drm_open_hash_t *ht, unsigned long key, 159int drm_ht_find_item(struct drm_open_hash *ht, unsigned long key,
160 drm_hash_item_t **item) 160 struct drm_hash_item **item)
161{ 161{
162 struct hlist_node *list; 162 struct hlist_node *list;
163 163
@@ -165,11 +165,11 @@ int drm_ht_find_item(drm_open_hash_t *ht, unsigned long key,
165 if (!list) 165 if (!list)
166 return -EINVAL; 166 return -EINVAL;
167 167
168 *item = hlist_entry(list, drm_hash_item_t, head); 168 *item = hlist_entry(list, struct drm_hash_item, head);
169 return 0; 169 return 0;
170} 170}
171 171
172int drm_ht_remove_key(drm_open_hash_t *ht, unsigned long key) 172int drm_ht_remove_key(struct drm_open_hash *ht, unsigned long key)
173{ 173{
174 struct hlist_node *list; 174 struct hlist_node *list;
175 175
@@ -182,14 +182,14 @@ int drm_ht_remove_key(drm_open_hash_t *ht, unsigned long key)
182 return -EINVAL; 182 return -EINVAL;
183} 183}
184 184
185int drm_ht_remove_item(drm_open_hash_t *ht, drm_hash_item_t *item) 185int drm_ht_remove_item(struct drm_open_hash *ht, struct drm_hash_item *item)
186{ 186{
187 hlist_del_init(&item->head); 187 hlist_del_init(&item->head);
188 ht->fill--; 188 ht->fill--;
189 return 0; 189 return 0;
190} 190}
191 191
192void drm_ht_remove(drm_open_hash_t *ht) 192void drm_ht_remove(struct drm_open_hash *ht)
193{ 193{
194 if (ht->table) { 194 if (ht->table) {
195 if (ht->use_vmalloc) 195 if (ht->use_vmalloc)
diff --git a/drivers/char/drm/drm_hashtab.h b/drivers/char/drm/drm_hashtab.h
index 613091c970af..0f1376774168 100644
--- a/drivers/char/drm/drm_hashtab.h
+++ b/drivers/char/drm/drm_hashtab.h
@@ -37,31 +37,31 @@
37 37
38#define drm_hash_entry(_ptr, _type, _member) container_of(_ptr, _type, _member) 38#define drm_hash_entry(_ptr, _type, _member) container_of(_ptr, _type, _member)
39 39
40typedef struct drm_hash_item{ 40struct drm_hash_item {
41 struct hlist_node head; 41 struct hlist_node head;
42 unsigned long key; 42 unsigned long key;
43} drm_hash_item_t; 43};
44 44
45typedef struct drm_open_hash{ 45struct drm_open_hash {
46 unsigned int size; 46 unsigned int size;
47 unsigned int order; 47 unsigned int order;
48 unsigned int fill; 48 unsigned int fill;
49 struct hlist_head *table; 49 struct hlist_head *table;
50 int use_vmalloc; 50 int use_vmalloc;
51} drm_open_hash_t; 51};
52 52
53 53
54extern int drm_ht_create(drm_open_hash_t *ht, unsigned int order); 54extern int drm_ht_create(struct drm_open_hash *ht, unsigned int order);
55extern int drm_ht_insert_item(drm_open_hash_t *ht, drm_hash_item_t *item); 55extern int drm_ht_insert_item(struct drm_open_hash *ht, struct drm_hash_item *item);
56extern int drm_ht_just_insert_please(drm_open_hash_t *ht, drm_hash_item_t *item, 56extern int drm_ht_just_insert_please(struct drm_open_hash *ht, struct drm_hash_item *item,
57 unsigned long seed, int bits, int shift, 57 unsigned long seed, int bits, int shift,
58 unsigned long add); 58 unsigned long add);
59extern int drm_ht_find_item(drm_open_hash_t *ht, unsigned long key, drm_hash_item_t **item); 59extern int drm_ht_find_item(struct drm_open_hash *ht, unsigned long key, struct drm_hash_item **item);
60 60
61extern void drm_ht_verbose_list(drm_open_hash_t *ht, unsigned long key); 61extern void drm_ht_verbose_list(struct drm_open_hash *ht, unsigned long key);
62extern int drm_ht_remove_key(drm_open_hash_t *ht, unsigned long key); 62extern int drm_ht_remove_key(struct drm_open_hash *ht, unsigned long key);
63extern int drm_ht_remove_item(drm_open_hash_t *ht, drm_hash_item_t *item); 63extern int drm_ht_remove_item(struct drm_open_hash *ht, struct drm_hash_item *item);
64extern void drm_ht_remove(drm_open_hash_t *ht); 64extern void drm_ht_remove(struct drm_open_hash *ht);
65 65
66 66
67#endif 67#endif
diff --git a/drivers/char/drm/drm_ioc32.c b/drivers/char/drm/drm_ioc32.c
index fafeb34f89d5..462f46f2049a 100644
--- a/drivers/char/drm/drm_ioc32.c
+++ b/drivers/char/drm/drm_ioc32.c
@@ -82,7 +82,7 @@ static int compat_drm_version(struct file *file, unsigned int cmd,
82 unsigned long arg) 82 unsigned long arg)
83{ 83{
84 drm_version32_t v32; 84 drm_version32_t v32;
85 drm_version_t __user *version; 85 struct drm_version __user *version;
86 int err; 86 int err;
87 87
88 if (copy_from_user(&v32, (void __user *)arg, sizeof(v32))) 88 if (copy_from_user(&v32, (void __user *)arg, sizeof(v32)))
@@ -129,7 +129,7 @@ static int compat_drm_getunique(struct file *file, unsigned int cmd,
129 unsigned long arg) 129 unsigned long arg)
130{ 130{
131 drm_unique32_t uq32; 131 drm_unique32_t uq32;
132 drm_unique_t __user *u; 132 struct drm_unique __user *u;
133 int err; 133 int err;
134 134
135 if (copy_from_user(&uq32, (void __user *)arg, sizeof(uq32))) 135 if (copy_from_user(&uq32, (void __user *)arg, sizeof(uq32)))
@@ -159,7 +159,7 @@ static int compat_drm_setunique(struct file *file, unsigned int cmd,
159 unsigned long arg) 159 unsigned long arg)
160{ 160{
161 drm_unique32_t uq32; 161 drm_unique32_t uq32;
162 drm_unique_t __user *u; 162 struct drm_unique __user *u;
163 163
164 if (copy_from_user(&uq32, (void __user *)arg, sizeof(uq32))) 164 if (copy_from_user(&uq32, (void __user *)arg, sizeof(uq32)))
165 return -EFAULT; 165 return -EFAULT;
@@ -179,8 +179,8 @@ static int compat_drm_setunique(struct file *file, unsigned int cmd,
179typedef struct drm_map32 { 179typedef struct drm_map32 {
180 u32 offset; /**< Requested physical address (0 for SAREA)*/ 180 u32 offset; /**< Requested physical address (0 for SAREA)*/
181 u32 size; /**< Requested physical size (bytes) */ 181 u32 size; /**< Requested physical size (bytes) */
182 drm_map_type_t type; /**< Type of memory to map */ 182 enum drm_map_type type; /**< Type of memory to map */
183 drm_map_flags_t flags; /**< Flags */ 183 enum drm_map_flags flags; /**< Flags */
184 u32 handle; /**< User-space: "Handle" to pass to mmap() */ 184 u32 handle; /**< User-space: "Handle" to pass to mmap() */
185 int mtrr; /**< MTRR slot used */ 185 int mtrr; /**< MTRR slot used */
186} drm_map32_t; 186} drm_map32_t;
@@ -190,7 +190,7 @@ static int compat_drm_getmap(struct file *file, unsigned int cmd,
190{ 190{
191 drm_map32_t __user *argp = (void __user *)arg; 191 drm_map32_t __user *argp = (void __user *)arg;
192 drm_map32_t m32; 192 drm_map32_t m32;
193 drm_map_t __user *map; 193 struct drm_map __user *map;
194 int idx, err; 194 int idx, err;
195 void *handle; 195 void *handle;
196 196
@@ -228,7 +228,7 @@ static int compat_drm_addmap(struct file *file, unsigned int cmd,
228{ 228{
229 drm_map32_t __user *argp = (void __user *)arg; 229 drm_map32_t __user *argp = (void __user *)arg;
230 drm_map32_t m32; 230 drm_map32_t m32;
231 drm_map_t __user *map; 231 struct drm_map __user *map;
232 int err; 232 int err;
233 void *handle; 233 void *handle;
234 234
@@ -270,7 +270,7 @@ static int compat_drm_rmmap(struct file *file, unsigned int cmd,
270 unsigned long arg) 270 unsigned long arg)
271{ 271{
272 drm_map32_t __user *argp = (void __user *)arg; 272 drm_map32_t __user *argp = (void __user *)arg;
273 drm_map_t __user *map; 273 struct drm_map __user *map;
274 u32 handle; 274 u32 handle;
275 275
276 if (get_user(handle, &argp->handle)) 276 if (get_user(handle, &argp->handle))
@@ -300,7 +300,7 @@ static int compat_drm_getclient(struct file *file, unsigned int cmd,
300{ 300{
301 drm_client32_t c32; 301 drm_client32_t c32;
302 drm_client32_t __user *argp = (void __user *)arg; 302 drm_client32_t __user *argp = (void __user *)arg;
303 drm_client_t __user *client; 303 struct drm_client __user *client;
304 int idx, err; 304 int idx, err;
305 305
306 if (get_user(idx, &argp->idx)) 306 if (get_user(idx, &argp->idx))
@@ -333,7 +333,7 @@ typedef struct drm_stats32 {
333 u32 count; 333 u32 count;
334 struct { 334 struct {
335 u32 value; 335 u32 value;
336 drm_stat_type_t type; 336 enum drm_stat_type type;
337 } data[15]; 337 } data[15];
338} drm_stats32_t; 338} drm_stats32_t;
339 339
@@ -342,7 +342,7 @@ static int compat_drm_getstats(struct file *file, unsigned int cmd,
342{ 342{
343 drm_stats32_t s32; 343 drm_stats32_t s32;
344 drm_stats32_t __user *argp = (void __user *)arg; 344 drm_stats32_t __user *argp = (void __user *)arg;
345 drm_stats_t __user *stats; 345 struct drm_stats __user *stats;
346 int i, err; 346 int i, err;
347 347
348 stats = compat_alloc_user_space(sizeof(*stats)); 348 stats = compat_alloc_user_space(sizeof(*stats));
@@ -379,7 +379,7 @@ static int compat_drm_addbufs(struct file *file, unsigned int cmd,
379 unsigned long arg) 379 unsigned long arg)
380{ 380{
381 drm_buf_desc32_t __user *argp = (void __user *)arg; 381 drm_buf_desc32_t __user *argp = (void __user *)arg;
382 drm_buf_desc_t __user *buf; 382 struct drm_buf_desc __user *buf;
383 int err; 383 int err;
384 unsigned long agp_start; 384 unsigned long agp_start;
385 385
@@ -411,7 +411,7 @@ static int compat_drm_markbufs(struct file *file, unsigned int cmd,
411{ 411{
412 drm_buf_desc32_t b32; 412 drm_buf_desc32_t b32;
413 drm_buf_desc32_t __user *argp = (void __user *)arg; 413 drm_buf_desc32_t __user *argp = (void __user *)arg;
414 drm_buf_desc_t __user *buf; 414 struct drm_buf_desc __user *buf;
415 415
416 if (copy_from_user(&b32, argp, sizeof(b32))) 416 if (copy_from_user(&b32, argp, sizeof(b32)))
417 return -EFAULT; 417 return -EFAULT;
@@ -440,8 +440,8 @@ static int compat_drm_infobufs(struct file *file, unsigned int cmd,
440 drm_buf_info32_t req32; 440 drm_buf_info32_t req32;
441 drm_buf_info32_t __user *argp = (void __user *)arg; 441 drm_buf_info32_t __user *argp = (void __user *)arg;
442 drm_buf_desc32_t __user *to; 442 drm_buf_desc32_t __user *to;
443 drm_buf_info_t __user *request; 443 struct drm_buf_info __user *request;
444 drm_buf_desc_t __user *list; 444 struct drm_buf_desc __user *list;
445 size_t nbytes; 445 size_t nbytes;
446 int i, err; 446 int i, err;
447 int count, actual; 447 int count, actual;
@@ -457,11 +457,11 @@ static int compat_drm_infobufs(struct file *file, unsigned int cmd,
457 && !access_ok(VERIFY_WRITE, to, count * sizeof(drm_buf_desc32_t))) 457 && !access_ok(VERIFY_WRITE, to, count * sizeof(drm_buf_desc32_t)))
458 return -EFAULT; 458 return -EFAULT;
459 459
460 nbytes = sizeof(*request) + count * sizeof(drm_buf_desc_t); 460 nbytes = sizeof(*request) + count * sizeof(struct drm_buf_desc);
461 request = compat_alloc_user_space(nbytes); 461 request = compat_alloc_user_space(nbytes);
462 if (!access_ok(VERIFY_WRITE, request, nbytes)) 462 if (!access_ok(VERIFY_WRITE, request, nbytes))
463 return -EFAULT; 463 return -EFAULT;
464 list = (drm_buf_desc_t *) (request + 1); 464 list = (struct drm_buf_desc *) (request + 1);
465 465
466 if (__put_user(count, &request->count) 466 if (__put_user(count, &request->count)
467 || __put_user(list, &request->list)) 467 || __put_user(list, &request->list))
@@ -477,7 +477,7 @@ static int compat_drm_infobufs(struct file *file, unsigned int cmd,
477 if (count >= actual) 477 if (count >= actual)
478 for (i = 0; i < actual; ++i) 478 for (i = 0; i < actual; ++i)
479 if (__copy_in_user(&to[i], &list[i], 479 if (__copy_in_user(&to[i], &list[i],
480 offsetof(drm_buf_desc_t, flags))) 480 offsetof(struct drm_buf_desc, flags)))
481 return -EFAULT; 481 return -EFAULT;
482 482
483 if (__put_user(actual, &argp->count)) 483 if (__put_user(actual, &argp->count))
@@ -505,8 +505,8 @@ static int compat_drm_mapbufs(struct file *file, unsigned int cmd,
505 drm_buf_map32_t __user *argp = (void __user *)arg; 505 drm_buf_map32_t __user *argp = (void __user *)arg;
506 drm_buf_map32_t req32; 506 drm_buf_map32_t req32;
507 drm_buf_pub32_t __user *list32; 507 drm_buf_pub32_t __user *list32;
508 drm_buf_map_t __user *request; 508 struct drm_buf_map __user *request;
509 drm_buf_pub_t __user *list; 509 struct drm_buf_pub __user *list;
510 int i, err; 510 int i, err;
511 int count, actual; 511 int count, actual;
512 size_t nbytes; 512 size_t nbytes;
@@ -519,11 +519,11 @@ static int compat_drm_mapbufs(struct file *file, unsigned int cmd,
519 519
520 if (count < 0) 520 if (count < 0)
521 return -EINVAL; 521 return -EINVAL;
522 nbytes = sizeof(*request) + count * sizeof(drm_buf_pub_t); 522 nbytes = sizeof(*request) + count * sizeof(struct drm_buf_pub);
523 request = compat_alloc_user_space(nbytes); 523 request = compat_alloc_user_space(nbytes);
524 if (!access_ok(VERIFY_WRITE, request, nbytes)) 524 if (!access_ok(VERIFY_WRITE, request, nbytes))
525 return -EFAULT; 525 return -EFAULT;
526 list = (drm_buf_pub_t *) (request + 1); 526 list = (struct drm_buf_pub *) (request + 1);
527 527
528 if (__put_user(count, &request->count) 528 if (__put_user(count, &request->count)
529 || __put_user(list, &request->list)) 529 || __put_user(list, &request->list))
@@ -539,7 +539,7 @@ static int compat_drm_mapbufs(struct file *file, unsigned int cmd,
539 if (count >= actual) 539 if (count >= actual)
540 for (i = 0; i < actual; ++i) 540 for (i = 0; i < actual; ++i)
541 if (__copy_in_user(&list32[i], &list[i], 541 if (__copy_in_user(&list32[i], &list[i],
542 offsetof(drm_buf_pub_t, address)) 542 offsetof(struct drm_buf_pub, address))
543 || __get_user(addr, &list[i].address) 543 || __get_user(addr, &list[i].address)
544 || __put_user((unsigned long)addr, 544 || __put_user((unsigned long)addr,
545 &list32[i].address)) 545 &list32[i].address))
@@ -562,7 +562,7 @@ static int compat_drm_freebufs(struct file *file, unsigned int cmd,
562 unsigned long arg) 562 unsigned long arg)
563{ 563{
564 drm_buf_free32_t req32; 564 drm_buf_free32_t req32;
565 drm_buf_free_t __user *request; 565 struct drm_buf_free __user *request;
566 drm_buf_free32_t __user *argp = (void __user *)arg; 566 drm_buf_free32_t __user *argp = (void __user *)arg;
567 567
568 if (copy_from_user(&req32, argp, sizeof(req32))) 568 if (copy_from_user(&req32, argp, sizeof(req32)))
@@ -589,7 +589,7 @@ static int compat_drm_setsareactx(struct file *file, unsigned int cmd,
589 unsigned long arg) 589 unsigned long arg)
590{ 590{
591 drm_ctx_priv_map32_t req32; 591 drm_ctx_priv_map32_t req32;
592 drm_ctx_priv_map_t __user *request; 592 struct drm_ctx_priv_map __user *request;
593 drm_ctx_priv_map32_t __user *argp = (void __user *)arg; 593 drm_ctx_priv_map32_t __user *argp = (void __user *)arg;
594 594
595 if (copy_from_user(&req32, argp, sizeof(req32))) 595 if (copy_from_user(&req32, argp, sizeof(req32)))
@@ -610,7 +610,7 @@ static int compat_drm_setsareactx(struct file *file, unsigned int cmd,
610static int compat_drm_getsareactx(struct file *file, unsigned int cmd, 610static int compat_drm_getsareactx(struct file *file, unsigned int cmd,
611 unsigned long arg) 611 unsigned long arg)
612{ 612{
613 drm_ctx_priv_map_t __user *request; 613 struct drm_ctx_priv_map __user *request;
614 drm_ctx_priv_map32_t __user *argp = (void __user *)arg; 614 drm_ctx_priv_map32_t __user *argp = (void __user *)arg;
615 int err; 615 int err;
616 unsigned int ctx_id; 616 unsigned int ctx_id;
@@ -648,7 +648,7 @@ static int compat_drm_resctx(struct file *file, unsigned int cmd,
648{ 648{
649 drm_ctx_res32_t __user *argp = (void __user *)arg; 649 drm_ctx_res32_t __user *argp = (void __user *)arg;
650 drm_ctx_res32_t res32; 650 drm_ctx_res32_t res32;
651 drm_ctx_res_t __user *res; 651 struct drm_ctx_res __user *res;
652 int err; 652 int err;
653 653
654 if (copy_from_user(&res32, argp, sizeof(res32))) 654 if (copy_from_user(&res32, argp, sizeof(res32)))
@@ -658,7 +658,7 @@ static int compat_drm_resctx(struct file *file, unsigned int cmd,
658 if (!access_ok(VERIFY_WRITE, res, sizeof(*res))) 658 if (!access_ok(VERIFY_WRITE, res, sizeof(*res)))
659 return -EFAULT; 659 return -EFAULT;
660 if (__put_user(res32.count, &res->count) 660 if (__put_user(res32.count, &res->count)
661 || __put_user((drm_ctx_t __user *) (unsigned long)res32.contexts, 661 || __put_user((struct drm_ctx __user *) (unsigned long)res32.contexts,
662 &res->contexts)) 662 &res->contexts))
663 return -EFAULT; 663 return -EFAULT;
664 664
@@ -679,7 +679,7 @@ typedef struct drm_dma32 {
679 int send_count; /**< Number of buffers to send */ 679 int send_count; /**< Number of buffers to send */
680 u32 send_indices; /**< List of handles to buffers */ 680 u32 send_indices; /**< List of handles to buffers */
681 u32 send_sizes; /**< Lengths of data to send */ 681 u32 send_sizes; /**< Lengths of data to send */
682 drm_dma_flags_t flags; /**< Flags */ 682 enum drm_dma_flags flags; /**< Flags */
683 int request_count; /**< Number of buffers requested */ 683 int request_count; /**< Number of buffers requested */
684 int request_size; /**< Desired size for buffers */ 684 int request_size; /**< Desired size for buffers */
685 u32 request_indices; /**< Buffer information */ 685 u32 request_indices; /**< Buffer information */
@@ -692,7 +692,7 @@ static int compat_drm_dma(struct file *file, unsigned int cmd,
692{ 692{
693 drm_dma32_t d32; 693 drm_dma32_t d32;
694 drm_dma32_t __user *argp = (void __user *)arg; 694 drm_dma32_t __user *argp = (void __user *)arg;
695 drm_dma_t __user *d; 695 struct drm_dma __user *d;
696 int err; 696 int err;
697 697
698 if (copy_from_user(&d32, argp, sizeof(d32))) 698 if (copy_from_user(&d32, argp, sizeof(d32)))
@@ -740,7 +740,7 @@ static int compat_drm_agp_enable(struct file *file, unsigned int cmd,
740{ 740{
741 drm_agp_mode32_t __user *argp = (void __user *)arg; 741 drm_agp_mode32_t __user *argp = (void __user *)arg;
742 drm_agp_mode32_t m32; 742 drm_agp_mode32_t m32;
743 drm_agp_mode_t __user *mode; 743 struct drm_agp_mode __user *mode;
744 744
745 if (get_user(m32.mode, &argp->mode)) 745 if (get_user(m32.mode, &argp->mode))
746 return -EFAULT; 746 return -EFAULT;
@@ -772,7 +772,7 @@ static int compat_drm_agp_info(struct file *file, unsigned int cmd,
772{ 772{
773 drm_agp_info32_t __user *argp = (void __user *)arg; 773 drm_agp_info32_t __user *argp = (void __user *)arg;
774 drm_agp_info32_t i32; 774 drm_agp_info32_t i32;
775 drm_agp_info_t __user *info; 775 struct drm_agp_info __user *info;
776 int err; 776 int err;
777 777
778 info = compat_alloc_user_space(sizeof(*info)); 778 info = compat_alloc_user_space(sizeof(*info));
@@ -813,7 +813,7 @@ static int compat_drm_agp_alloc(struct file *file, unsigned int cmd,
813{ 813{
814 drm_agp_buffer32_t __user *argp = (void __user *)arg; 814 drm_agp_buffer32_t __user *argp = (void __user *)arg;
815 drm_agp_buffer32_t req32; 815 drm_agp_buffer32_t req32;
816 drm_agp_buffer_t __user *request; 816 struct drm_agp_buffer __user *request;
817 int err; 817 int err;
818 818
819 if (copy_from_user(&req32, argp, sizeof(req32))) 819 if (copy_from_user(&req32, argp, sizeof(req32)))
@@ -845,7 +845,7 @@ static int compat_drm_agp_free(struct file *file, unsigned int cmd,
845 unsigned long arg) 845 unsigned long arg)
846{ 846{
847 drm_agp_buffer32_t __user *argp = (void __user *)arg; 847 drm_agp_buffer32_t __user *argp = (void __user *)arg;
848 drm_agp_buffer_t __user *request; 848 struct drm_agp_buffer __user *request;
849 u32 handle; 849 u32 handle;
850 850
851 request = compat_alloc_user_space(sizeof(*request)); 851 request = compat_alloc_user_space(sizeof(*request));
@@ -868,7 +868,7 @@ static int compat_drm_agp_bind(struct file *file, unsigned int cmd,
868{ 868{
869 drm_agp_binding32_t __user *argp = (void __user *)arg; 869 drm_agp_binding32_t __user *argp = (void __user *)arg;
870 drm_agp_binding32_t req32; 870 drm_agp_binding32_t req32;
871 drm_agp_binding_t __user *request; 871 struct drm_agp_binding __user *request;
872 872
873 if (copy_from_user(&req32, argp, sizeof(req32))) 873 if (copy_from_user(&req32, argp, sizeof(req32)))
874 return -EFAULT; 874 return -EFAULT;
@@ -887,7 +887,7 @@ static int compat_drm_agp_unbind(struct file *file, unsigned int cmd,
887 unsigned long arg) 887 unsigned long arg)
888{ 888{
889 drm_agp_binding32_t __user *argp = (void __user *)arg; 889 drm_agp_binding32_t __user *argp = (void __user *)arg;
890 drm_agp_binding_t __user *request; 890 struct drm_agp_binding __user *request;
891 u32 handle; 891 u32 handle;
892 892
893 request = compat_alloc_user_space(sizeof(*request)); 893 request = compat_alloc_user_space(sizeof(*request));
@@ -910,7 +910,7 @@ static int compat_drm_sg_alloc(struct file *file, unsigned int cmd,
910 unsigned long arg) 910 unsigned long arg)
911{ 911{
912 drm_scatter_gather32_t __user *argp = (void __user *)arg; 912 drm_scatter_gather32_t __user *argp = (void __user *)arg;
913 drm_scatter_gather_t __user *request; 913 struct drm_scatter_gather __user *request;
914 int err; 914 int err;
915 unsigned long x; 915 unsigned long x;
916 916
@@ -938,7 +938,7 @@ static int compat_drm_sg_free(struct file *file, unsigned int cmd,
938 unsigned long arg) 938 unsigned long arg)
939{ 939{
940 drm_scatter_gather32_t __user *argp = (void __user *)arg; 940 drm_scatter_gather32_t __user *argp = (void __user *)arg;
941 drm_scatter_gather_t __user *request; 941 struct drm_scatter_gather __user *request;
942 unsigned long x; 942 unsigned long x;
943 943
944 request = compat_alloc_user_space(sizeof(*request)); 944 request = compat_alloc_user_space(sizeof(*request));
@@ -953,13 +953,13 @@ static int compat_drm_sg_free(struct file *file, unsigned int cmd,
953} 953}
954 954
955struct drm_wait_vblank_request32 { 955struct drm_wait_vblank_request32 {
956 drm_vblank_seq_type_t type; 956 enum drm_vblank_seq_type type;
957 unsigned int sequence; 957 unsigned int sequence;
958 u32 signal; 958 u32 signal;
959}; 959};
960 960
961struct drm_wait_vblank_reply32 { 961struct drm_wait_vblank_reply32 {
962 drm_vblank_seq_type_t type; 962 enum drm_vblank_seq_type type;
963 unsigned int sequence; 963 unsigned int sequence;
964 s32 tval_sec; 964 s32 tval_sec;
965 s32 tval_usec; 965 s32 tval_usec;
@@ -975,7 +975,7 @@ static int compat_drm_wait_vblank(struct file *file, unsigned int cmd,
975{ 975{
976 drm_wait_vblank32_t __user *argp = (void __user *)arg; 976 drm_wait_vblank32_t __user *argp = (void __user *)arg;
977 drm_wait_vblank32_t req32; 977 drm_wait_vblank32_t req32;
978 drm_wait_vblank_t __user *request; 978 union drm_wait_vblank __user *request;
979 int err; 979 int err;
980 980
981 if (copy_from_user(&req32, argp, sizeof(req32))) 981 if (copy_from_user(&req32, argp, sizeof(req32)))
diff --git a/drivers/char/drm/drm_ioctl.c b/drivers/char/drm/drm_ioctl.c
index 565895547d75..b195e102e737 100644
--- a/drivers/char/drm/drm_ioctl.c
+++ b/drivers/char/drm/drm_ioctl.c
@@ -52,10 +52,10 @@
52int drm_getunique(struct inode *inode, struct file *filp, 52int drm_getunique(struct inode *inode, struct file *filp,
53 unsigned int cmd, unsigned long arg) 53 unsigned int cmd, unsigned long arg)
54{ 54{
55 drm_file_t *priv = filp->private_data; 55 struct drm_file *priv = filp->private_data;
56 drm_device_t *dev = priv->head->dev; 56 struct drm_device *dev = priv->head->dev;
57 drm_unique_t __user *argp = (void __user *)arg; 57 struct drm_unique __user *argp = (void __user *)arg;
58 drm_unique_t u; 58 struct drm_unique u;
59 59
60 if (copy_from_user(&u, argp, sizeof(u))) 60 if (copy_from_user(&u, argp, sizeof(u)))
61 return -EFAULT; 61 return -EFAULT;
@@ -86,15 +86,15 @@ int drm_getunique(struct inode *inode, struct file *filp,
86int drm_setunique(struct inode *inode, struct file *filp, 86int drm_setunique(struct inode *inode, struct file *filp,
87 unsigned int cmd, unsigned long arg) 87 unsigned int cmd, unsigned long arg)
88{ 88{
89 drm_file_t *priv = filp->private_data; 89 struct drm_file *priv = filp->private_data;
90 drm_device_t *dev = priv->head->dev; 90 struct drm_device *dev = priv->head->dev;
91 drm_unique_t u; 91 struct drm_unique u;
92 int domain, bus, slot, func, ret; 92 int domain, bus, slot, func, ret;
93 93
94 if (dev->unique_len || dev->unique) 94 if (dev->unique_len || dev->unique)
95 return -EBUSY; 95 return -EBUSY;
96 96
97 if (copy_from_user(&u, (drm_unique_t __user *) arg, sizeof(u))) 97 if (copy_from_user(&u, (struct drm_unique __user *) arg, sizeof(u)))
98 return -EFAULT; 98 return -EFAULT;
99 99
100 if (!u.unique_len || u.unique_len > 1024) 100 if (!u.unique_len || u.unique_len > 1024)
@@ -136,7 +136,7 @@ int drm_setunique(struct inode *inode, struct file *filp,
136 return 0; 136 return 0;
137} 137}
138 138
139static int drm_set_busid(drm_device_t * dev) 139static int drm_set_busid(struct drm_device * dev)
140{ 140{
141 int len; 141 int len;
142 142
@@ -184,11 +184,11 @@ static int drm_set_busid(drm_device_t * dev)
184int drm_getmap(struct inode *inode, struct file *filp, 184int drm_getmap(struct inode *inode, struct file *filp,
185 unsigned int cmd, unsigned long arg) 185 unsigned int cmd, unsigned long arg)
186{ 186{
187 drm_file_t *priv = filp->private_data; 187 struct drm_file *priv = filp->private_data;
188 drm_device_t *dev = priv->head->dev; 188 struct drm_device *dev = priv->head->dev;
189 drm_map_t __user *argp = (void __user *)arg; 189 struct drm_map __user *argp = (void __user *)arg;
190 drm_map_t map; 190 struct drm_map map;
191 drm_map_list_t *r_list = NULL; 191 struct drm_map_list *r_list = NULL;
192 struct list_head *list; 192 struct list_head *list;
193 int idx; 193 int idx;
194 int i; 194 int i;
@@ -204,9 +204,9 @@ int drm_getmap(struct inode *inode, struct file *filp,
204 } 204 }
205 205
206 i = 0; 206 i = 0;
207 list_for_each(list, &dev->maplist->head) { 207 list_for_each(list, &dev->maplist) {
208 if (i == idx) { 208 if (i == idx) {
209 r_list = list_entry(list, drm_map_list_t, head); 209 r_list = list_entry(list, struct drm_map_list, head);
210 break; 210 break;
211 } 211 }
212 i++; 212 i++;
@@ -245,11 +245,11 @@ int drm_getmap(struct inode *inode, struct file *filp,
245int drm_getclient(struct inode *inode, struct file *filp, 245int drm_getclient(struct inode *inode, struct file *filp,
246 unsigned int cmd, unsigned long arg) 246 unsigned int cmd, unsigned long arg)
247{ 247{
248 drm_file_t *priv = filp->private_data; 248 struct drm_file *priv = filp->private_data;
249 drm_device_t *dev = priv->head->dev; 249 struct drm_device *dev = priv->head->dev;
250 drm_client_t __user *argp = (drm_client_t __user *)arg; 250 struct drm_client __user *argp = (struct drm_client __user *)arg;
251 drm_client_t client; 251 struct drm_client client;
252 drm_file_t *pt; 252 struct drm_file *pt;
253 int idx; 253 int idx;
254 int i; 254 int i;
255 255
@@ -257,12 +257,18 @@ int drm_getclient(struct inode *inode, struct file *filp,
257 return -EFAULT; 257 return -EFAULT;
258 idx = client.idx; 258 idx = client.idx;
259 mutex_lock(&dev->struct_mutex); 259 mutex_lock(&dev->struct_mutex);
260 for (i = 0, pt = dev->file_first; i < idx && pt; i++, pt = pt->next) ; 260
261 261 if (list_empty(&dev->filelist)) {
262 if (!pt) {
263 mutex_unlock(&dev->struct_mutex); 262 mutex_unlock(&dev->struct_mutex);
264 return -EINVAL; 263 return -EINVAL;
265 } 264 }
265
266 i = 0;
267 list_for_each_entry(pt, &dev->filelist, lhead) {
268 if (i++ >= idx)
269 break;
270 }
271
266 client.auth = pt->authenticated; 272 client.auth = pt->authenticated;
267 client.pid = pt->pid; 273 client.pid = pt->pid;
268 client.uid = pt->uid; 274 client.uid = pt->uid;
@@ -288,9 +294,9 @@ int drm_getclient(struct inode *inode, struct file *filp,
288int drm_getstats(struct inode *inode, struct file *filp, 294int drm_getstats(struct inode *inode, struct file *filp,
289 unsigned int cmd, unsigned long arg) 295 unsigned int cmd, unsigned long arg)
290{ 296{
291 drm_file_t *priv = filp->private_data; 297 struct drm_file *priv = filp->private_data;
292 drm_device_t *dev = priv->head->dev; 298 struct drm_device *dev = priv->head->dev;
293 drm_stats_t stats; 299 struct drm_stats stats;
294 int i; 300 int i;
295 301
296 memset(&stats, 0, sizeof(stats)); 302 memset(&stats, 0, sizeof(stats));
@@ -310,7 +316,7 @@ int drm_getstats(struct inode *inode, struct file *filp,
310 316
311 mutex_unlock(&dev->struct_mutex); 317 mutex_unlock(&dev->struct_mutex);
312 318
313 if (copy_to_user((drm_stats_t __user *) arg, &stats, sizeof(stats))) 319 if (copy_to_user((struct drm_stats __user *) arg, &stats, sizeof(stats)))
314 return -EFAULT; 320 return -EFAULT;
315 return 0; 321 return 0;
316} 322}
@@ -329,10 +335,10 @@ int drm_getstats(struct inode *inode, struct file *filp,
329int drm_setversion(DRM_IOCTL_ARGS) 335int drm_setversion(DRM_IOCTL_ARGS)
330{ 336{
331 DRM_DEVICE; 337 DRM_DEVICE;
332 drm_set_version_t sv; 338 struct drm_set_version sv;
333 drm_set_version_t retv; 339 struct drm_set_version retv;
334 int if_version; 340 int if_version;
335 drm_set_version_t __user *argp = (void __user *)data; 341 struct drm_set_version __user *argp = (void __user *)data;
336 int ret; 342 int ret;
337 343
338 if (copy_from_user(&sv, argp, sizeof(sv))) 344 if (copy_from_user(&sv, argp, sizeof(sv)))
diff --git a/drivers/char/drm/drm_irq.c b/drivers/char/drm/drm_irq.c
index 2e75331fd83e..871d2fde09b3 100644
--- a/drivers/char/drm/drm_irq.c
+++ b/drivers/char/drm/drm_irq.c
@@ -53,10 +53,10 @@
53int drm_irq_by_busid(struct inode *inode, struct file *filp, 53int drm_irq_by_busid(struct inode *inode, struct file *filp,
54 unsigned int cmd, unsigned long arg) 54 unsigned int cmd, unsigned long arg)
55{ 55{
56 drm_file_t *priv = filp->private_data; 56 struct drm_file *priv = filp->private_data;
57 drm_device_t *dev = priv->head->dev; 57 struct drm_device *dev = priv->head->dev;
58 drm_irq_busid_t __user *argp = (void __user *)arg; 58 struct drm_irq_busid __user *argp = (void __user *)arg;
59 drm_irq_busid_t p; 59 struct drm_irq_busid p;
60 60
61 if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) 61 if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
62 return -EINVAL; 62 return -EINVAL;
@@ -87,7 +87,7 @@ int drm_irq_by_busid(struct inode *inode, struct file *filp,
87 * \c drm_driver_irq_preinstall() and \c drm_driver_irq_postinstall() functions 87 * \c drm_driver_irq_preinstall() and \c drm_driver_irq_postinstall() functions
88 * before and after the installation. 88 * before and after the installation.
89 */ 89 */
90static int drm_irq_install(drm_device_t * dev) 90static int drm_irq_install(struct drm_device * dev)
91{ 91{
92 int ret; 92 int ret;
93 unsigned long sh_flags = 0; 93 unsigned long sh_flags = 0;
@@ -120,8 +120,8 @@ static int drm_irq_install(drm_device_t * dev)
120 120
121 spin_lock_init(&dev->vbl_lock); 121 spin_lock_init(&dev->vbl_lock);
122 122
123 INIT_LIST_HEAD(&dev->vbl_sigs.head); 123 INIT_LIST_HEAD(&dev->vbl_sigs);
124 INIT_LIST_HEAD(&dev->vbl_sigs2.head); 124 INIT_LIST_HEAD(&dev->vbl_sigs2);
125 125
126 dev->vbl_pending = 0; 126 dev->vbl_pending = 0;
127 } 127 }
@@ -155,7 +155,7 @@ static int drm_irq_install(drm_device_t * dev)
155 * 155 *
156 * Calls the driver's \c drm_driver_irq_uninstall() function, and stops the irq. 156 * Calls the driver's \c drm_driver_irq_uninstall() function, and stops the irq.
157 */ 157 */
158int drm_irq_uninstall(drm_device_t * dev) 158int drm_irq_uninstall(struct drm_device * dev)
159{ 159{
160 int irq_enabled; 160 int irq_enabled;
161 161
@@ -197,13 +197,13 @@ EXPORT_SYMBOL(drm_irq_uninstall);
197int drm_control(struct inode *inode, struct file *filp, 197int drm_control(struct inode *inode, struct file *filp,
198 unsigned int cmd, unsigned long arg) 198 unsigned int cmd, unsigned long arg)
199{ 199{
200 drm_file_t *priv = filp->private_data; 200 struct drm_file *priv = filp->private_data;
201 drm_device_t *dev = priv->head->dev; 201 struct drm_device *dev = priv->head->dev;
202 drm_control_t ctl; 202 struct drm_control ctl;
203 203
204 /* if we haven't irq we fallback for compatibility reasons - this used to be a separate function in drm_dma.h */ 204 /* if we haven't irq we fallback for compatibility reasons - this used to be a separate function in drm_dma.h */
205 205
206 if (copy_from_user(&ctl, (drm_control_t __user *) arg, sizeof(ctl))) 206 if (copy_from_user(&ctl, (struct drm_control __user *) arg, sizeof(ctl)))
207 return -EFAULT; 207 return -EFAULT;
208 208
209 switch (ctl.func) { 209 switch (ctl.func) {
@@ -244,10 +244,10 @@ int drm_control(struct inode *inode, struct file *filp,
244 */ 244 */
245int drm_wait_vblank(DRM_IOCTL_ARGS) 245int drm_wait_vblank(DRM_IOCTL_ARGS)
246{ 246{
247 drm_file_t *priv = filp->private_data; 247 struct drm_file *priv = filp->private_data;
248 drm_device_t *dev = priv->head->dev; 248 struct drm_device *dev = priv->head->dev;
249 drm_wait_vblank_t __user *argp = (void __user *)data; 249 union drm_wait_vblank __user *argp = (void __user *)data;
250 drm_wait_vblank_t vblwait; 250 union drm_wait_vblank vblwait;
251 struct timeval now; 251 struct timeval now;
252 int ret = 0; 252 int ret = 0;
253 unsigned int flags, seq; 253 unsigned int flags, seq;
@@ -292,9 +292,9 @@ int drm_wait_vblank(DRM_IOCTL_ARGS)
292 292
293 if (flags & _DRM_VBLANK_SIGNAL) { 293 if (flags & _DRM_VBLANK_SIGNAL) {
294 unsigned long irqflags; 294 unsigned long irqflags;
295 drm_vbl_sig_t *vbl_sigs = (flags & _DRM_VBLANK_SECONDARY) 295 struct list_head *vbl_sigs = (flags & _DRM_VBLANK_SECONDARY)
296 ? &dev->vbl_sigs2 : &dev->vbl_sigs; 296 ? &dev->vbl_sigs2 : &dev->vbl_sigs;
297 drm_vbl_sig_t *vbl_sig; 297 struct drm_vbl_sig *vbl_sig;
298 298
299 spin_lock_irqsave(&dev->vbl_lock, irqflags); 299 spin_lock_irqsave(&dev->vbl_lock, irqflags);
300 300
@@ -302,7 +302,7 @@ int drm_wait_vblank(DRM_IOCTL_ARGS)
302 * for the same vblank sequence number; nothing to be done in 302 * for the same vblank sequence number; nothing to be done in
303 * that case 303 * that case
304 */ 304 */
305 list_for_each_entry(vbl_sig, &vbl_sigs->head, head) { 305 list_for_each_entry(vbl_sig, vbl_sigs, head) {
306 if (vbl_sig->sequence == vblwait.request.sequence 306 if (vbl_sig->sequence == vblwait.request.sequence
307 && vbl_sig->info.si_signo == vblwait.request.signal 307 && vbl_sig->info.si_signo == vblwait.request.signal
308 && vbl_sig->task == current) { 308 && vbl_sig->task == current) {
@@ -324,7 +324,7 @@ int drm_wait_vblank(DRM_IOCTL_ARGS)
324 324
325 if (! 325 if (!
326 (vbl_sig = 326 (vbl_sig =
327 drm_alloc(sizeof(drm_vbl_sig_t), DRM_MEM_DRIVER))) { 327 drm_alloc(sizeof(struct drm_vbl_sig), DRM_MEM_DRIVER))) {
328 return -ENOMEM; 328 return -ENOMEM;
329 } 329 }
330 330
@@ -336,7 +336,7 @@ int drm_wait_vblank(DRM_IOCTL_ARGS)
336 336
337 spin_lock_irqsave(&dev->vbl_lock, irqflags); 337 spin_lock_irqsave(&dev->vbl_lock, irqflags);
338 338
339 list_add_tail((struct list_head *)vbl_sig, &vbl_sigs->head); 339 list_add_tail(&vbl_sig->head, vbl_sigs);
340 340
341 spin_unlock_irqrestore(&dev->vbl_lock, irqflags); 341 spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
342 342
@@ -371,7 +371,7 @@ int drm_wait_vblank(DRM_IOCTL_ARGS)
371 * 371 *
372 * If a signal is not requested, then calls vblank_wait(). 372 * If a signal is not requested, then calls vblank_wait().
373 */ 373 */
374void drm_vbl_send_signals(drm_device_t * dev) 374void drm_vbl_send_signals(struct drm_device * dev)
375{ 375{
376 unsigned long flags; 376 unsigned long flags;
377 int i; 377 int i;
@@ -379,20 +379,18 @@ void drm_vbl_send_signals(drm_device_t * dev)
379 spin_lock_irqsave(&dev->vbl_lock, flags); 379 spin_lock_irqsave(&dev->vbl_lock, flags);
380 380
381 for (i = 0; i < 2; i++) { 381 for (i = 0; i < 2; i++) {
382 struct list_head *list, *tmp; 382 struct drm_vbl_sig *vbl_sig, *tmp;
383 drm_vbl_sig_t *vbl_sig; 383 struct list_head *vbl_sigs = i ? &dev->vbl_sigs2 : &dev->vbl_sigs;
384 drm_vbl_sig_t *vbl_sigs = i ? &dev->vbl_sigs2 : &dev->vbl_sigs;
385 unsigned int vbl_seq = atomic_read(i ? &dev->vbl_received2 : 384 unsigned int vbl_seq = atomic_read(i ? &dev->vbl_received2 :
386 &dev->vbl_received); 385 &dev->vbl_received);
387 386
388 list_for_each_safe(list, tmp, &vbl_sigs->head) { 387 list_for_each_entry_safe(vbl_sig, tmp, vbl_sigs, head) {
389 vbl_sig = list_entry(list, drm_vbl_sig_t, head);
390 if ((vbl_seq - vbl_sig->sequence) <= (1 << 23)) { 388 if ((vbl_seq - vbl_sig->sequence) <= (1 << 23)) {
391 vbl_sig->info.si_code = vbl_seq; 389 vbl_sig->info.si_code = vbl_seq;
392 send_sig_info(vbl_sig->info.si_signo, 390 send_sig_info(vbl_sig->info.si_signo,
393 &vbl_sig->info, vbl_sig->task); 391 &vbl_sig->info, vbl_sig->task);
394 392
395 list_del(list); 393 list_del(&vbl_sig->head);
396 394
397 drm_free(vbl_sig, sizeof(*vbl_sig), 395 drm_free(vbl_sig, sizeof(*vbl_sig),
398 DRM_MEM_DRIVER); 396 DRM_MEM_DRIVER);
@@ -418,7 +416,7 @@ EXPORT_SYMBOL(drm_vbl_send_signals);
418 */ 416 */
419static void drm_locked_tasklet_func(unsigned long data) 417static void drm_locked_tasklet_func(unsigned long data)
420{ 418{
421 drm_device_t *dev = (drm_device_t*)data; 419 struct drm_device *dev = (struct drm_device *)data;
422 unsigned long irqflags; 420 unsigned long irqflags;
423 421
424 spin_lock_irqsave(&dev->tasklet_lock, irqflags); 422 spin_lock_irqsave(&dev->tasklet_lock, irqflags);
@@ -455,7 +453,7 @@ static void drm_locked_tasklet_func(unsigned long data)
455 * context, it must not make any assumptions about this. Also, the HW lock will 453 * context, it must not make any assumptions about this. Also, the HW lock will
456 * be held with the kernel context or any client context. 454 * be held with the kernel context or any client context.
457 */ 455 */
458void drm_locked_tasklet(drm_device_t *dev, void (*func)(drm_device_t*)) 456void drm_locked_tasklet(struct drm_device *dev, void (*func)(struct drm_device *))
459{ 457{
460 unsigned long irqflags; 458 unsigned long irqflags;
461 static DECLARE_TASKLET(drm_tasklet, drm_locked_tasklet_func, 0); 459 static DECLARE_TASKLET(drm_tasklet, drm_locked_tasklet_func, 0);
diff --git a/drivers/char/drm/drm_lock.c b/drivers/char/drm/drm_lock.c
index befd1af19dfe..c0534b5a8b78 100644
--- a/drivers/char/drm/drm_lock.c
+++ b/drivers/char/drm/drm_lock.c
@@ -51,15 +51,15 @@ static int drm_notifier(void *priv);
51int drm_lock(struct inode *inode, struct file *filp, 51int drm_lock(struct inode *inode, struct file *filp,
52 unsigned int cmd, unsigned long arg) 52 unsigned int cmd, unsigned long arg)
53{ 53{
54 drm_file_t *priv = filp->private_data; 54 struct drm_file *priv = filp->private_data;
55 drm_device_t *dev = priv->head->dev; 55 struct drm_device *dev = priv->head->dev;
56 DECLARE_WAITQUEUE(entry, current); 56 DECLARE_WAITQUEUE(entry, current);
57 drm_lock_t lock; 57 struct drm_lock lock;
58 int ret = 0; 58 int ret = 0;
59 59
60 ++priv->lock_count; 60 ++priv->lock_count;
61 61
62 if (copy_from_user(&lock, (drm_lock_t __user *) arg, sizeof(lock))) 62 if (copy_from_user(&lock, (struct drm_lock __user *) arg, sizeof(lock)))
63 return -EFAULT; 63 return -EFAULT;
64 64
65 if (lock.context == DRM_KERNEL_CONTEXT) { 65 if (lock.context == DRM_KERNEL_CONTEXT) {
@@ -152,12 +152,12 @@ int drm_lock(struct inode *inode, struct file *filp,
152int drm_unlock(struct inode *inode, struct file *filp, 152int drm_unlock(struct inode *inode, struct file *filp,
153 unsigned int cmd, unsigned long arg) 153 unsigned int cmd, unsigned long arg)
154{ 154{
155 drm_file_t *priv = filp->private_data; 155 struct drm_file *priv = filp->private_data;
156 drm_device_t *dev = priv->head->dev; 156 struct drm_device *dev = priv->head->dev;
157 drm_lock_t lock; 157 struct drm_lock lock;
158 unsigned long irqflags; 158 unsigned long irqflags;
159 159
160 if (copy_from_user(&lock, (drm_lock_t __user *) arg, sizeof(lock))) 160 if (copy_from_user(&lock, (struct drm_lock __user *) arg, sizeof(lock)))
161 return -EFAULT; 161 return -EFAULT;
162 162
163 if (lock.context == DRM_KERNEL_CONTEXT) { 163 if (lock.context == DRM_KERNEL_CONTEXT) {
@@ -202,7 +202,7 @@ int drm_unlock(struct inode *inode, struct file *filp,
202 * 202 *
203 * Attempt to mark the lock as held by the given context, via the \p cmpxchg instruction. 203 * Attempt to mark the lock as held by the given context, via the \p cmpxchg instruction.
204 */ 204 */
205int drm_lock_take(drm_lock_data_t *lock_data, 205int drm_lock_take(struct drm_lock_data *lock_data,
206 unsigned int context) 206 unsigned int context)
207{ 207{
208 unsigned int old, new, prev; 208 unsigned int old, new, prev;
@@ -251,7 +251,7 @@ int drm_lock_take(drm_lock_data_t *lock_data,
251 * Resets the lock file pointer. 251 * Resets the lock file pointer.
252 * Marks the lock as held by the given context, via the \p cmpxchg instruction. 252 * Marks the lock as held by the given context, via the \p cmpxchg instruction.
253 */ 253 */
254static int drm_lock_transfer(drm_lock_data_t *lock_data, 254static int drm_lock_transfer(struct drm_lock_data *lock_data,
255 unsigned int context) 255 unsigned int context)
256{ 256{
257 unsigned int old, new, prev; 257 unsigned int old, new, prev;
@@ -277,7 +277,7 @@ static int drm_lock_transfer(drm_lock_data_t *lock_data,
277 * Marks the lock as not held, via the \p cmpxchg instruction. Wakes any task 277 * Marks the lock as not held, via the \p cmpxchg instruction. Wakes any task
278 * waiting on the lock queue. 278 * waiting on the lock queue.
279 */ 279 */
280int drm_lock_free(drm_lock_data_t *lock_data, unsigned int context) 280int drm_lock_free(struct drm_lock_data *lock_data, unsigned int context)
281{ 281{
282 unsigned int old, new, prev; 282 unsigned int old, new, prev;
283 volatile unsigned int *lock = &lock_data->hw_lock->lock; 283 volatile unsigned int *lock = &lock_data->hw_lock->lock;
@@ -319,7 +319,7 @@ int drm_lock_free(drm_lock_data_t *lock_data, unsigned int context)
319 */ 319 */
320static int drm_notifier(void *priv) 320static int drm_notifier(void *priv)
321{ 321{
322 drm_sigdata_t *s = (drm_sigdata_t *) priv; 322 struct drm_sigdata *s = (struct drm_sigdata *) priv;
323 unsigned int old, new, prev; 323 unsigned int old, new, prev;
324 324
325 /* Allow signal delivery if lock isn't held */ 325 /* Allow signal delivery if lock isn't held */
@@ -350,7 +350,7 @@ static int drm_notifier(void *priv)
350 * having to worry about starvation. 350 * having to worry about starvation.
351 */ 351 */
352 352
353void drm_idlelock_take(drm_lock_data_t *lock_data) 353void drm_idlelock_take(struct drm_lock_data *lock_data)
354{ 354{
355 int ret = 0; 355 int ret = 0;
356 356
@@ -369,7 +369,7 @@ void drm_idlelock_take(drm_lock_data_t *lock_data)
369} 369}
370EXPORT_SYMBOL(drm_idlelock_take); 370EXPORT_SYMBOL(drm_idlelock_take);
371 371
372void drm_idlelock_release(drm_lock_data_t *lock_data) 372void drm_idlelock_release(struct drm_lock_data *lock_data)
373{ 373{
374 unsigned int old, prev; 374 unsigned int old, prev;
375 volatile unsigned int *lock = &lock_data->hw_lock->lock; 375 volatile unsigned int *lock = &lock_data->hw_lock->lock;
diff --git a/drivers/char/drm/drm_memory.c b/drivers/char/drm/drm_memory.c
index 92a867082376..93019901bd30 100644
--- a/drivers/char/drm/drm_memory.c
+++ b/drivers/char/drm/drm_memory.c
@@ -80,7 +80,7 @@ void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area)
80 80
81#if __OS_HAS_AGP 81#if __OS_HAS_AGP
82static void *agp_remap(unsigned long offset, unsigned long size, 82static void *agp_remap(unsigned long offset, unsigned long size,
83 drm_device_t * dev) 83 struct drm_device * dev)
84{ 84{
85 unsigned long *phys_addr_map, i, num_pages = 85 unsigned long *phys_addr_map, i, num_pages =
86 PAGE_ALIGN(size) / PAGE_SIZE; 86 PAGE_ALIGN(size) / PAGE_SIZE;
@@ -94,7 +94,7 @@ static void *agp_remap(unsigned long offset, unsigned long size,
94 offset -= dev->hose->mem_space->start; 94 offset -= dev->hose->mem_space->start;
95#endif 95#endif
96 96
97 for (agpmem = dev->agp->memory; agpmem; agpmem = agpmem->next) 97 list_for_each_entry(agpmem, &dev->agp->memory, head)
98 if (agpmem->bound <= offset 98 if (agpmem->bound <= offset
99 && (agpmem->bound + (agpmem->pages << PAGE_SHIFT)) >= 99 && (agpmem->bound + (agpmem->pages << PAGE_SHIFT)) >=
100 (offset + size)) 100 (offset + size))
@@ -123,7 +123,7 @@ static void *agp_remap(unsigned long offset, unsigned long size,
123} 123}
124 124
125/** Wrapper around agp_allocate_memory() */ 125/** Wrapper around agp_allocate_memory() */
126DRM_AGP_MEM *drm_alloc_agp(drm_device_t * dev, int pages, u32 type) 126DRM_AGP_MEM *drm_alloc_agp(struct drm_device * dev, int pages, u32 type)
127{ 127{
128 return drm_agp_allocate_memory(dev->agp->bridge, pages, type); 128 return drm_agp_allocate_memory(dev->agp->bridge, pages, type);
129} 129}
@@ -148,7 +148,7 @@ int drm_unbind_agp(DRM_AGP_MEM * handle)
148 148
149#else /* __OS_HAS_AGP */ 149#else /* __OS_HAS_AGP */
150static inline void *agp_remap(unsigned long offset, unsigned long size, 150static inline void *agp_remap(unsigned long offset, unsigned long size,
151 drm_device_t * dev) 151 struct drm_device * dev)
152{ 152{
153 return NULL; 153 return NULL;
154} 154}
diff --git a/drivers/char/drm/drm_mm.c b/drivers/char/drm/drm_mm.c
index 2ec1d9f26264..3e6bc14f7441 100644
--- a/drivers/char/drm/drm_mm.c
+++ b/drivers/char/drm/drm_mm.c
@@ -44,26 +44,26 @@
44#include "drmP.h" 44#include "drmP.h"
45#include <linux/slab.h> 45#include <linux/slab.h>
46 46
47unsigned long drm_mm_tail_space(drm_mm_t *mm) 47unsigned long drm_mm_tail_space(struct drm_mm *mm)
48{ 48{
49 struct list_head *tail_node; 49 struct list_head *tail_node;
50 drm_mm_node_t *entry; 50 struct drm_mm_node *entry;
51 51
52 tail_node = mm->ml_entry.prev; 52 tail_node = mm->ml_entry.prev;
53 entry = list_entry(tail_node, drm_mm_node_t, ml_entry); 53 entry = list_entry(tail_node, struct drm_mm_node, ml_entry);
54 if (!entry->free) 54 if (!entry->free)
55 return 0; 55 return 0;
56 56
57 return entry->size; 57 return entry->size;
58} 58}
59 59
60int drm_mm_remove_space_from_tail(drm_mm_t *mm, unsigned long size) 60int drm_mm_remove_space_from_tail(struct drm_mm *mm, unsigned long size)
61{ 61{
62 struct list_head *tail_node; 62 struct list_head *tail_node;
63 drm_mm_node_t *entry; 63 struct drm_mm_node *entry;
64 64
65 tail_node = mm->ml_entry.prev; 65 tail_node = mm->ml_entry.prev;
66 entry = list_entry(tail_node, drm_mm_node_t, ml_entry); 66 entry = list_entry(tail_node, struct drm_mm_node, ml_entry);
67 if (!entry->free) 67 if (!entry->free)
68 return -ENOMEM; 68 return -ENOMEM;
69 69
@@ -75,13 +75,13 @@ int drm_mm_remove_space_from_tail(drm_mm_t *mm, unsigned long size)
75} 75}
76 76
77 77
78static int drm_mm_create_tail_node(drm_mm_t *mm, 78static int drm_mm_create_tail_node(struct drm_mm *mm,
79 unsigned long start, 79 unsigned long start,
80 unsigned long size) 80 unsigned long size)
81{ 81{
82 drm_mm_node_t *child; 82 struct drm_mm_node *child;
83 83
84 child = (drm_mm_node_t *) 84 child = (struct drm_mm_node *)
85 drm_alloc(sizeof(*child), DRM_MEM_MM); 85 drm_alloc(sizeof(*child), DRM_MEM_MM);
86 if (!child) 86 if (!child)
87 return -ENOMEM; 87 return -ENOMEM;
@@ -98,13 +98,13 @@ static int drm_mm_create_tail_node(drm_mm_t *mm,
98} 98}
99 99
100 100
101int drm_mm_add_space_to_tail(drm_mm_t *mm, unsigned long size) 101int drm_mm_add_space_to_tail(struct drm_mm *mm, unsigned long size)
102{ 102{
103 struct list_head *tail_node; 103 struct list_head *tail_node;
104 drm_mm_node_t *entry; 104 struct drm_mm_node *entry;
105 105
106 tail_node = mm->ml_entry.prev; 106 tail_node = mm->ml_entry.prev;
107 entry = list_entry(tail_node, drm_mm_node_t, ml_entry); 107 entry = list_entry(tail_node, struct drm_mm_node, ml_entry);
108 if (!entry->free) { 108 if (!entry->free) {
109 return drm_mm_create_tail_node(mm, entry->start + entry->size, size); 109 return drm_mm_create_tail_node(mm, entry->start + entry->size, size);
110 } 110 }
@@ -112,12 +112,12 @@ int drm_mm_add_space_to_tail(drm_mm_t *mm, unsigned long size)
112 return 0; 112 return 0;
113} 113}
114 114
115static drm_mm_node_t *drm_mm_split_at_start(drm_mm_node_t *parent, 115static struct drm_mm_node *drm_mm_split_at_start(struct drm_mm_node *parent,
116 unsigned long size) 116 unsigned long size)
117{ 117{
118 drm_mm_node_t *child; 118 struct drm_mm_node *child;
119 119
120 child = (drm_mm_node_t *) 120 child = (struct drm_mm_node *)
121 drm_alloc(sizeof(*child), DRM_MEM_MM); 121 drm_alloc(sizeof(*child), DRM_MEM_MM);
122 if (!child) 122 if (!child)
123 return NULL; 123 return NULL;
@@ -139,12 +139,12 @@ static drm_mm_node_t *drm_mm_split_at_start(drm_mm_node_t *parent,
139 139
140 140
141 141
142drm_mm_node_t *drm_mm_get_block(drm_mm_node_t * parent, 142struct drm_mm_node *drm_mm_get_block(struct drm_mm_node * parent,
143 unsigned long size, unsigned alignment) 143 unsigned long size, unsigned alignment)
144{ 144{
145 145
146 drm_mm_node_t *align_splitoff = NULL; 146 struct drm_mm_node *align_splitoff = NULL;
147 drm_mm_node_t *child; 147 struct drm_mm_node *child;
148 unsigned tmp = 0; 148 unsigned tmp = 0;
149 149
150 if (alignment) 150 if (alignment)
@@ -175,26 +175,26 @@ drm_mm_node_t *drm_mm_get_block(drm_mm_node_t * parent,
175 * Otherwise add to the free stack. 175 * Otherwise add to the free stack.
176 */ 176 */
177 177
178void drm_mm_put_block(drm_mm_node_t * cur) 178void drm_mm_put_block(struct drm_mm_node * cur)
179{ 179{
180 180
181 drm_mm_t *mm = cur->mm; 181 struct drm_mm *mm = cur->mm;
182 struct list_head *cur_head = &cur->ml_entry; 182 struct list_head *cur_head = &cur->ml_entry;
183 struct list_head *root_head = &mm->ml_entry; 183 struct list_head *root_head = &mm->ml_entry;
184 drm_mm_node_t *prev_node = NULL; 184 struct drm_mm_node *prev_node = NULL;
185 drm_mm_node_t *next_node; 185 struct drm_mm_node *next_node;
186 186
187 int merged = 0; 187 int merged = 0;
188 188
189 if (cur_head->prev != root_head) { 189 if (cur_head->prev != root_head) {
190 prev_node = list_entry(cur_head->prev, drm_mm_node_t, ml_entry); 190 prev_node = list_entry(cur_head->prev, struct drm_mm_node, ml_entry);
191 if (prev_node->free) { 191 if (prev_node->free) {
192 prev_node->size += cur->size; 192 prev_node->size += cur->size;
193 merged = 1; 193 merged = 1;
194 } 194 }
195 } 195 }
196 if (cur_head->next != root_head) { 196 if (cur_head->next != root_head) {
197 next_node = list_entry(cur_head->next, drm_mm_node_t, ml_entry); 197 next_node = list_entry(cur_head->next, struct drm_mm_node, ml_entry);
198 if (next_node->free) { 198 if (next_node->free) {
199 if (merged) { 199 if (merged) {
200 prev_node->size += next_node->size; 200 prev_node->size += next_node->size;
@@ -218,14 +218,14 @@ void drm_mm_put_block(drm_mm_node_t * cur)
218 } 218 }
219} 219}
220 220
221drm_mm_node_t *drm_mm_search_free(const drm_mm_t * mm, 221struct drm_mm_node *drm_mm_search_free(const struct drm_mm * mm,
222 unsigned long size, 222 unsigned long size,
223 unsigned alignment, int best_match) 223 unsigned alignment, int best_match)
224{ 224{
225 struct list_head *list; 225 struct list_head *list;
226 const struct list_head *free_stack = &mm->fl_entry; 226 const struct list_head *free_stack = &mm->fl_entry;
227 drm_mm_node_t *entry; 227 struct drm_mm_node *entry;
228 drm_mm_node_t *best; 228 struct drm_mm_node *best;
229 unsigned long best_size; 229 unsigned long best_size;
230 unsigned wasted; 230 unsigned wasted;
231 231
@@ -233,7 +233,7 @@ drm_mm_node_t *drm_mm_search_free(const drm_mm_t * mm,
233 best_size = ~0UL; 233 best_size = ~0UL;
234 234
235 list_for_each(list, free_stack) { 235 list_for_each(list, free_stack) {
236 entry = list_entry(list, drm_mm_node_t, fl_entry); 236 entry = list_entry(list, struct drm_mm_node, fl_entry);
237 wasted = 0; 237 wasted = 0;
238 238
239 if (entry->size < size) 239 if (entry->size < size)
@@ -259,14 +259,14 @@ drm_mm_node_t *drm_mm_search_free(const drm_mm_t * mm,
259 return best; 259 return best;
260} 260}
261 261
262int drm_mm_clean(drm_mm_t * mm) 262int drm_mm_clean(struct drm_mm * mm)
263{ 263{
264 struct list_head *head = &mm->ml_entry; 264 struct list_head *head = &mm->ml_entry;
265 265
266 return (head->next->next == head); 266 return (head->next->next == head);
267} 267}
268 268
269int drm_mm_init(drm_mm_t * mm, unsigned long start, unsigned long size) 269int drm_mm_init(struct drm_mm * mm, unsigned long start, unsigned long size)
270{ 270{
271 INIT_LIST_HEAD(&mm->ml_entry); 271 INIT_LIST_HEAD(&mm->ml_entry);
272 INIT_LIST_HEAD(&mm->fl_entry); 272 INIT_LIST_HEAD(&mm->fl_entry);
@@ -275,12 +275,12 @@ int drm_mm_init(drm_mm_t * mm, unsigned long start, unsigned long size)
275} 275}
276 276
277 277
278void drm_mm_takedown(drm_mm_t * mm) 278void drm_mm_takedown(struct drm_mm * mm)
279{ 279{
280 struct list_head *bnode = mm->fl_entry.next; 280 struct list_head *bnode = mm->fl_entry.next;
281 drm_mm_node_t *entry; 281 struct drm_mm_node *entry;
282 282
283 entry = list_entry(bnode, drm_mm_node_t, fl_entry); 283 entry = list_entry(bnode, struct drm_mm_node, fl_entry);
284 284
285 if (entry->ml_entry.next != &mm->ml_entry || 285 if (entry->ml_entry.next != &mm->ml_entry ||
286 entry->fl_entry.next != &mm->fl_entry) { 286 entry->fl_entry.next != &mm->fl_entry) {
diff --git a/drivers/char/drm/drm_os_linux.h b/drivers/char/drm/drm_os_linux.h
index 0fe7b4497927..0b8d3433386d 100644
--- a/drivers/char/drm/drm_os_linux.h
+++ b/drivers/char/drm/drm_os_linux.h
@@ -34,8 +34,8 @@
34/** Read/write memory barrier */ 34/** Read/write memory barrier */
35#define DRM_MEMORYBARRIER() mb() 35#define DRM_MEMORYBARRIER() mb()
36/** DRM device local declaration */ 36/** DRM device local declaration */
37#define DRM_DEVICE drm_file_t *priv = filp->private_data; \ 37#define DRM_DEVICE struct drm_file *priv = filp->private_data; \
38 drm_device_t *dev = priv->head->dev 38 struct drm_device *dev = priv->head->dev
39 39
40/** IRQ handler arguments and return type and values */ 40/** IRQ handler arguments and return type and values */
41#define DRM_IRQ_ARGS int irq, void *arg 41#define DRM_IRQ_ARGS int irq, void *arg
@@ -96,24 +96,6 @@ static __inline__ int mtrr_del(int reg, unsigned long base, unsigned long size)
96 96
97#define DRM_GET_PRIV_WITH_RETURN(_priv, _filp) _priv = _filp->private_data 97#define DRM_GET_PRIV_WITH_RETURN(_priv, _filp) _priv = _filp->private_data
98 98
99/**
100 * Get the pointer to the SAREA.
101 *
102 * Searches the SAREA on the mapping lists and points drm_device::sarea to it.
103 */
104#define DRM_GETSAREA() \
105do { \
106 drm_map_list_t *entry; \
107 list_for_each_entry( entry, &dev->maplist->head, head ) { \
108 if ( entry->map && \
109 entry->map->type == _DRM_SHM && \
110 (entry->map->flags & _DRM_CONTAINS_LOCK) ) { \
111 dev_priv->sarea = entry->map; \
112 break; \
113 } \
114 } \
115} while (0)
116
117#define DRM_HZ HZ 99#define DRM_HZ HZ
118 100
119#define DRM_WAIT_ON( ret, queue, timeout, condition ) \ 101#define DRM_WAIT_ON( ret, queue, timeout, condition ) \
diff --git a/drivers/char/drm/drm_pci.c b/drivers/char/drm/drm_pci.c
index 86a0f1c22091..e292bb0eaca2 100644
--- a/drivers/char/drm/drm_pci.c
+++ b/drivers/char/drm/drm_pci.c
@@ -47,7 +47,7 @@
47/** 47/**
48 * \brief Allocate a PCI consistent memory block, for DMA. 48 * \brief Allocate a PCI consistent memory block, for DMA.
49 */ 49 */
50drm_dma_handle_t *drm_pci_alloc(drm_device_t * dev, size_t size, size_t align, 50drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t align,
51 dma_addr_t maxaddr) 51 dma_addr_t maxaddr)
52{ 52{
53 drm_dma_handle_t *dmah; 53 drm_dma_handle_t *dmah;
@@ -126,7 +126,7 @@ EXPORT_SYMBOL(drm_pci_alloc);
126 * 126 *
127 * This function is for internal use in the Linux-specific DRM core code. 127 * This function is for internal use in the Linux-specific DRM core code.
128 */ 128 */
129void __drm_pci_free(drm_device_t * dev, drm_dma_handle_t * dmah) 129void __drm_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah)
130{ 130{
131#if 1 131#if 1
132 unsigned long addr; 132 unsigned long addr;
@@ -172,7 +172,7 @@ void __drm_pci_free(drm_device_t * dev, drm_dma_handle_t * dmah)
172/** 172/**
173 * \brief Free a PCI consistent memory block 173 * \brief Free a PCI consistent memory block
174 */ 174 */
175void drm_pci_free(drm_device_t * dev, drm_dma_handle_t * dmah) 175void drm_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah)
176{ 176{
177 __drm_pci_free(dev, dmah); 177 __drm_pci_free(dev, dmah);
178 kfree(dmah); 178 kfree(dmah);
diff --git a/drivers/char/drm/drm_proc.c b/drivers/char/drm/drm_proc.c
index b204498d1a28..12dfea89c7f3 100644
--- a/drivers/char/drm/drm_proc.c
+++ b/drivers/char/drm/drm_proc.c
@@ -87,7 +87,7 @@ static struct drm_proc_list {
87 * "/proc/dri/%minor%/", and each entry in proc_list as 87 * "/proc/dri/%minor%/", and each entry in proc_list as
88 * "/proc/dri/%minor%/%name%". 88 * "/proc/dri/%minor%/%name%".
89 */ 89 */
90int drm_proc_init(drm_device_t * dev, int minor, 90int drm_proc_init(struct drm_device * dev, int minor,
91 struct proc_dir_entry *root, struct proc_dir_entry **dev_root) 91 struct proc_dir_entry *root, struct proc_dir_entry **dev_root)
92{ 92{
93 struct proc_dir_entry *ent; 93 struct proc_dir_entry *ent;
@@ -163,7 +163,7 @@ int drm_proc_cleanup(int minor, struct proc_dir_entry *root,
163static int drm_name_info(char *buf, char **start, off_t offset, int request, 163static int drm_name_info(char *buf, char **start, off_t offset, int request,
164 int *eof, void *data) 164 int *eof, void *data)
165{ 165{
166 drm_device_t *dev = (drm_device_t *) data; 166 struct drm_device *dev = (struct drm_device *) data;
167 int len = 0; 167 int len = 0;
168 168
169 if (offset > DRM_PROC_LIMIT) { 169 if (offset > DRM_PROC_LIMIT) {
@@ -205,11 +205,10 @@ static int drm_name_info(char *buf, char **start, off_t offset, int request,
205static int drm__vm_info(char *buf, char **start, off_t offset, int request, 205static int drm__vm_info(char *buf, char **start, off_t offset, int request,
206 int *eof, void *data) 206 int *eof, void *data)
207{ 207{
208 drm_device_t *dev = (drm_device_t *) data; 208 struct drm_device *dev = (struct drm_device *) data;
209 int len = 0; 209 int len = 0;
210 drm_map_t *map; 210 struct drm_map *map;
211 drm_map_list_t *r_list; 211 struct drm_map_list *r_list;
212 struct list_head *list;
213 212
214 /* Hardcoded from _DRM_FRAME_BUFFER, 213 /* Hardcoded from _DRM_FRAME_BUFFER,
215 _DRM_REGISTERS, _DRM_SHM, _DRM_AGP, and 214 _DRM_REGISTERS, _DRM_SHM, _DRM_AGP, and
@@ -229,9 +228,7 @@ static int drm__vm_info(char *buf, char **start, off_t offset, int request,
229 DRM_PROC_PRINT("slot offset size type flags " 228 DRM_PROC_PRINT("slot offset size type flags "
230 "address mtrr\n\n"); 229 "address mtrr\n\n");
231 i = 0; 230 i = 0;
232 if (dev->maplist != NULL) 231 list_for_each_entry(r_list, &dev->maplist, head) {
233 list_for_each(list, &dev->maplist->head) {
234 r_list = list_entry(list, drm_map_list_t, head);
235 map = r_list->map; 232 map = r_list->map;
236 if (!map) 233 if (!map)
237 continue; 234 continue;
@@ -242,14 +239,15 @@ static int drm__vm_info(char *buf, char **start, off_t offset, int request,
242 DRM_PROC_PRINT("%4d 0x%08lx 0x%08lx %4.4s 0x%02x 0x%08x ", 239 DRM_PROC_PRINT("%4d 0x%08lx 0x%08lx %4.4s 0x%02x 0x%08x ",
243 i, 240 i,
244 map->offset, 241 map->offset,
245 map->size, type, map->flags, r_list->user_token); 242 map->size, type, map->flags,
243 r_list->user_token);
246 if (map->mtrr < 0) { 244 if (map->mtrr < 0) {
247 DRM_PROC_PRINT("none\n"); 245 DRM_PROC_PRINT("none\n");
248 } else { 246 } else {
249 DRM_PROC_PRINT("%4d\n", map->mtrr); 247 DRM_PROC_PRINT("%4d\n", map->mtrr);
250 } 248 }
251 i++; 249 i++;
252 } 250 }
253 251
254 if (len > request + offset) 252 if (len > request + offset)
255 return request; 253 return request;
@@ -263,7 +261,7 @@ static int drm__vm_info(char *buf, char **start, off_t offset, int request,
263static int drm_vm_info(char *buf, char **start, off_t offset, int request, 261static int drm_vm_info(char *buf, char **start, off_t offset, int request,
264 int *eof, void *data) 262 int *eof, void *data)
265{ 263{
266 drm_device_t *dev = (drm_device_t *) data; 264 struct drm_device *dev = (struct drm_device *) data;
267 int ret; 265 int ret;
268 266
269 mutex_lock(&dev->struct_mutex); 267 mutex_lock(&dev->struct_mutex);
@@ -286,10 +284,10 @@ static int drm_vm_info(char *buf, char **start, off_t offset, int request,
286static int drm__queues_info(char *buf, char **start, off_t offset, 284static int drm__queues_info(char *buf, char **start, off_t offset,
287 int request, int *eof, void *data) 285 int request, int *eof, void *data)
288{ 286{
289 drm_device_t *dev = (drm_device_t *) data; 287 struct drm_device *dev = (struct drm_device *) data;
290 int len = 0; 288 int len = 0;
291 int i; 289 int i;
292 drm_queue_t *q; 290 struct drm_queue *q;
293 291
294 if (offset > DRM_PROC_LIMIT) { 292 if (offset > DRM_PROC_LIMIT) {
295 *eof = 1; 293 *eof = 1;
@@ -336,7 +334,7 @@ static int drm__queues_info(char *buf, char **start, off_t offset,
336static int drm_queues_info(char *buf, char **start, off_t offset, int request, 334static int drm_queues_info(char *buf, char **start, off_t offset, int request,
337 int *eof, void *data) 335 int *eof, void *data)
338{ 336{
339 drm_device_t *dev = (drm_device_t *) data; 337 struct drm_device *dev = (struct drm_device *) data;
340 int ret; 338 int ret;
341 339
342 mutex_lock(&dev->struct_mutex); 340 mutex_lock(&dev->struct_mutex);
@@ -359,9 +357,9 @@ static int drm_queues_info(char *buf, char **start, off_t offset, int request,
359static int drm__bufs_info(char *buf, char **start, off_t offset, int request, 357static int drm__bufs_info(char *buf, char **start, off_t offset, int request,
360 int *eof, void *data) 358 int *eof, void *data)
361{ 359{
362 drm_device_t *dev = (drm_device_t *) data; 360 struct drm_device *dev = (struct drm_device *) data;
363 int len = 0; 361 int len = 0;
364 drm_device_dma_t *dma = dev->dma; 362 struct drm_device_dma *dma = dev->dma;
365 int i; 363 int i;
366 364
367 if (!dma || offset > DRM_PROC_LIMIT) { 365 if (!dma || offset > DRM_PROC_LIMIT) {
@@ -408,7 +406,7 @@ static int drm__bufs_info(char *buf, char **start, off_t offset, int request,
408static int drm_bufs_info(char *buf, char **start, off_t offset, int request, 406static int drm_bufs_info(char *buf, char **start, off_t offset, int request,
409 int *eof, void *data) 407 int *eof, void *data)
410{ 408{
411 drm_device_t *dev = (drm_device_t *) data; 409 struct drm_device *dev = (struct drm_device *) data;
412 int ret; 410 int ret;
413 411
414 mutex_lock(&dev->struct_mutex); 412 mutex_lock(&dev->struct_mutex);
@@ -431,9 +429,9 @@ static int drm_bufs_info(char *buf, char **start, off_t offset, int request,
431static int drm__clients_info(char *buf, char **start, off_t offset, 429static int drm__clients_info(char *buf, char **start, off_t offset,
432 int request, int *eof, void *data) 430 int request, int *eof, void *data)
433{ 431{
434 drm_device_t *dev = (drm_device_t *) data; 432 struct drm_device *dev = (struct drm_device *) data;
435 int len = 0; 433 int len = 0;
436 drm_file_t *priv; 434 struct drm_file *priv;
437 435
438 if (offset > DRM_PROC_LIMIT) { 436 if (offset > DRM_PROC_LIMIT) {
439 *eof = 1; 437 *eof = 1;
@@ -444,7 +442,7 @@ static int drm__clients_info(char *buf, char **start, off_t offset,
444 *eof = 0; 442 *eof = 0;
445 443
446 DRM_PROC_PRINT("a dev pid uid magic ioctls\n\n"); 444 DRM_PROC_PRINT("a dev pid uid magic ioctls\n\n");
447 for (priv = dev->file_first; priv; priv = priv->next) { 445 list_for_each_entry(priv, &dev->filelist, lhead) {
448 DRM_PROC_PRINT("%c %3d %5d %5d %10u %10lu\n", 446 DRM_PROC_PRINT("%c %3d %5d %5d %10u %10lu\n",
449 priv->authenticated ? 'y' : 'n', 447 priv->authenticated ? 'y' : 'n',
450 priv->minor, 448 priv->minor,
@@ -464,7 +462,7 @@ static int drm__clients_info(char *buf, char **start, off_t offset,
464static int drm_clients_info(char *buf, char **start, off_t offset, 462static int drm_clients_info(char *buf, char **start, off_t offset,
465 int request, int *eof, void *data) 463 int request, int *eof, void *data)
466{ 464{
467 drm_device_t *dev = (drm_device_t *) data; 465 struct drm_device *dev = (struct drm_device *) data;
468 int ret; 466 int ret;
469 467
470 mutex_lock(&dev->struct_mutex); 468 mutex_lock(&dev->struct_mutex);
@@ -478,9 +476,9 @@ static int drm_clients_info(char *buf, char **start, off_t offset,
478static int drm__vma_info(char *buf, char **start, off_t offset, int request, 476static int drm__vma_info(char *buf, char **start, off_t offset, int request,
479 int *eof, void *data) 477 int *eof, void *data)
480{ 478{
481 drm_device_t *dev = (drm_device_t *) data; 479 struct drm_device *dev = (struct drm_device *) data;
482 int len = 0; 480 int len = 0;
483 drm_vma_entry_t *pt; 481 struct drm_vma_entry *pt;
484 struct vm_area_struct *vma; 482 struct vm_area_struct *vma;
485#if defined(__i386__) 483#if defined(__i386__)
486 unsigned int pgprot; 484 unsigned int pgprot;
@@ -497,7 +495,7 @@ static int drm__vma_info(char *buf, char **start, off_t offset, int request,
497 DRM_PROC_PRINT("vma use count: %d, high_memory = %p, 0x%08lx\n", 495 DRM_PROC_PRINT("vma use count: %d, high_memory = %p, 0x%08lx\n",
498 atomic_read(&dev->vma_count), 496 atomic_read(&dev->vma_count),
499 high_memory, virt_to_phys(high_memory)); 497 high_memory, virt_to_phys(high_memory));
500 for (pt = dev->vmalist; pt; pt = pt->next) { 498 list_for_each_entry(pt, &dev->vmalist, head) {
501 if (!(vma = pt->vma)) 499 if (!(vma = pt->vma))
502 continue; 500 continue;
503 DRM_PROC_PRINT("\n%5d 0x%08lx-0x%08lx %c%c%c%c%c%c 0x%08lx000", 501 DRM_PROC_PRINT("\n%5d 0x%08lx-0x%08lx %c%c%c%c%c%c 0x%08lx000",
@@ -537,7 +535,7 @@ static int drm__vma_info(char *buf, char **start, off_t offset, int request,
537static int drm_vma_info(char *buf, char **start, off_t offset, int request, 535static int drm_vma_info(char *buf, char **start, off_t offset, int request,
538 int *eof, void *data) 536 int *eof, void *data)
539{ 537{
540 drm_device_t *dev = (drm_device_t *) data; 538 struct drm_device *dev = (struct drm_device *) data;
541 int ret; 539 int ret;
542 540
543 mutex_lock(&dev->struct_mutex); 541 mutex_lock(&dev->struct_mutex);
diff --git a/drivers/char/drm/drm_sarea.h b/drivers/char/drm/drm_sarea.h
index e94297b751b8..f5466966081e 100644
--- a/drivers/char/drm/drm_sarea.h
+++ b/drivers/char/drm/drm_sarea.h
@@ -50,29 +50,35 @@
50#define SAREA_DRAWABLE_CLAIMED_ENTRY 0x80000000 50#define SAREA_DRAWABLE_CLAIMED_ENTRY 0x80000000
51 51
52/** SAREA drawable */ 52/** SAREA drawable */
53typedef struct drm_sarea_drawable { 53struct drm_sarea_drawable {
54 unsigned int stamp; 54 unsigned int stamp;
55 unsigned int flags; 55 unsigned int flags;
56} drm_sarea_drawable_t; 56};
57 57
58/** SAREA frame */ 58/** SAREA frame */
59typedef struct drm_sarea_frame { 59struct drm_sarea_frame {
60 unsigned int x; 60 unsigned int x;
61 unsigned int y; 61 unsigned int y;
62 unsigned int width; 62 unsigned int width;
63 unsigned int height; 63 unsigned int height;
64 unsigned int fullscreen; 64 unsigned int fullscreen;
65} drm_sarea_frame_t; 65};
66 66
67/** SAREA */ 67/** SAREA */
68typedef struct drm_sarea { 68struct drm_sarea {
69 /** first thing is always the DRM locking structure */ 69 /** first thing is always the DRM locking structure */
70 drm_hw_lock_t lock; 70 struct drm_hw_lock lock;
71 /** \todo Use readers/writer lock for drm_sarea::drawable_lock */ 71 /** \todo Use readers/writer lock for drm_sarea::drawable_lock */
72 drm_hw_lock_t drawable_lock; 72 struct drm_hw_lock drawable_lock;
73 drm_sarea_drawable_t drawableTable[SAREA_MAX_DRAWABLES]; /**< drawables */ 73 struct drm_sarea_drawable drawableTable[SAREA_MAX_DRAWABLES]; /**< drawables */
74 drm_sarea_frame_t frame; /**< frame */ 74 struct drm_sarea_frame frame; /**< frame */
75 drm_context_t dummy_context; 75 drm_context_t dummy_context;
76} drm_sarea_t; 76};
77
78#ifndef __KERNEL__
79typedef struct drm_sarea_drawable drm_sarea_drawable_t;
80typedef struct drm_sarea_frame drm_sarea_frame_t;
81typedef struct drm_sarea drm_sarea_t;
82#endif
77 83
78#endif /* _DRM_SAREA_H_ */ 84#endif /* _DRM_SAREA_H_ */
diff --git a/drivers/char/drm/drm_scatter.c b/drivers/char/drm/drm_scatter.c
index 06ef7ddbe67d..067d25daaf17 100644
--- a/drivers/char/drm/drm_scatter.c
+++ b/drivers/char/drm/drm_scatter.c
@@ -36,7 +36,7 @@
36 36
37#define DEBUG_SCATTER 0 37#define DEBUG_SCATTER 0
38 38
39void drm_sg_cleanup(drm_sg_mem_t * entry) 39void drm_sg_cleanup(struct drm_sg_mem * entry)
40{ 40{
41 struct page *page; 41 struct page *page;
42 int i; 42 int i;
@@ -65,11 +65,11 @@ void drm_sg_cleanup(drm_sg_mem_t * entry)
65int drm_sg_alloc(struct inode *inode, struct file *filp, 65int drm_sg_alloc(struct inode *inode, struct file *filp,
66 unsigned int cmd, unsigned long arg) 66 unsigned int cmd, unsigned long arg)
67{ 67{
68 drm_file_t *priv = filp->private_data; 68 struct drm_file *priv = filp->private_data;
69 drm_device_t *dev = priv->head->dev; 69 struct drm_device *dev = priv->head->dev;
70 drm_scatter_gather_t __user *argp = (void __user *)arg; 70 struct drm_scatter_gather __user *argp = (void __user *)arg;
71 drm_scatter_gather_t request; 71 struct drm_scatter_gather request;
72 drm_sg_mem_t *entry; 72 struct drm_sg_mem *entry;
73 unsigned long pages, i, j; 73 unsigned long pages, i, j;
74 74
75 DRM_DEBUG("%s\n", __FUNCTION__); 75 DRM_DEBUG("%s\n", __FUNCTION__);
@@ -201,16 +201,16 @@ int drm_sg_alloc(struct inode *inode, struct file *filp,
201int drm_sg_free(struct inode *inode, struct file *filp, 201int drm_sg_free(struct inode *inode, struct file *filp,
202 unsigned int cmd, unsigned long arg) 202 unsigned int cmd, unsigned long arg)
203{ 203{
204 drm_file_t *priv = filp->private_data; 204 struct drm_file *priv = filp->private_data;
205 drm_device_t *dev = priv->head->dev; 205 struct drm_device *dev = priv->head->dev;
206 drm_scatter_gather_t request; 206 struct drm_scatter_gather request;
207 drm_sg_mem_t *entry; 207 struct drm_sg_mem *entry;
208 208
209 if (!drm_core_check_feature(dev, DRIVER_SG)) 209 if (!drm_core_check_feature(dev, DRIVER_SG))
210 return -EINVAL; 210 return -EINVAL;
211 211
212 if (copy_from_user(&request, 212 if (copy_from_user(&request,
213 (drm_scatter_gather_t __user *) arg, 213 (struct drm_scatter_gather __user *) arg,
214 sizeof(request))) 214 sizeof(request)))
215 return -EFAULT; 215 return -EFAULT;
216 216
diff --git a/drivers/char/drm/drm_sman.c b/drivers/char/drm/drm_sman.c
index e15db6d6bea9..8421a93946d8 100644
--- a/drivers/char/drm/drm_sman.c
+++ b/drivers/char/drm/drm_sman.c
@@ -38,13 +38,13 @@
38 38
39#include "drm_sman.h" 39#include "drm_sman.h"
40 40
41typedef struct drm_owner_item { 41struct drm_owner_item {
42 drm_hash_item_t owner_hash; 42 struct drm_hash_item owner_hash;
43 struct list_head sman_list; 43 struct list_head sman_list;
44 struct list_head mem_blocks; 44 struct list_head mem_blocks;
45} drm_owner_item_t; 45};
46 46
47void drm_sman_takedown(drm_sman_t * sman) 47void drm_sman_takedown(struct drm_sman * sman)
48{ 48{
49 drm_ht_remove(&sman->user_hash_tab); 49 drm_ht_remove(&sman->user_hash_tab);
50 drm_ht_remove(&sman->owner_hash_tab); 50 drm_ht_remove(&sman->owner_hash_tab);
@@ -56,12 +56,12 @@ void drm_sman_takedown(drm_sman_t * sman)
56EXPORT_SYMBOL(drm_sman_takedown); 56EXPORT_SYMBOL(drm_sman_takedown);
57 57
58int 58int
59drm_sman_init(drm_sman_t * sman, unsigned int num_managers, 59drm_sman_init(struct drm_sman * sman, unsigned int num_managers,
60 unsigned int user_order, unsigned int owner_order) 60 unsigned int user_order, unsigned int owner_order)
61{ 61{
62 int ret = 0; 62 int ret = 0;
63 63
64 sman->mm = (drm_sman_mm_t *) drm_calloc(num_managers, sizeof(*sman->mm), 64 sman->mm = (struct drm_sman_mm *) drm_calloc(num_managers, sizeof(*sman->mm),
65 DRM_MEM_MM); 65 DRM_MEM_MM);
66 if (!sman->mm) { 66 if (!sman->mm) {
67 ret = -ENOMEM; 67 ret = -ENOMEM;
@@ -88,8 +88,8 @@ EXPORT_SYMBOL(drm_sman_init);
88static void *drm_sman_mm_allocate(void *private, unsigned long size, 88static void *drm_sman_mm_allocate(void *private, unsigned long size,
89 unsigned alignment) 89 unsigned alignment)
90{ 90{
91 drm_mm_t *mm = (drm_mm_t *) private; 91 struct drm_mm *mm = (struct drm_mm *) private;
92 drm_mm_node_t *tmp; 92 struct drm_mm_node *tmp;
93 93
94 tmp = drm_mm_search_free(mm, size, alignment, 1); 94 tmp = drm_mm_search_free(mm, size, alignment, 1);
95 if (!tmp) { 95 if (!tmp) {
@@ -101,30 +101,30 @@ static void *drm_sman_mm_allocate(void *private, unsigned long size,
101 101
102static void drm_sman_mm_free(void *private, void *ref) 102static void drm_sman_mm_free(void *private, void *ref)
103{ 103{
104 drm_mm_node_t *node = (drm_mm_node_t *) ref; 104 struct drm_mm_node *node = (struct drm_mm_node *) ref;
105 105
106 drm_mm_put_block(node); 106 drm_mm_put_block(node);
107} 107}
108 108
109static void drm_sman_mm_destroy(void *private) 109static void drm_sman_mm_destroy(void *private)
110{ 110{
111 drm_mm_t *mm = (drm_mm_t *) private; 111 struct drm_mm *mm = (struct drm_mm *) private;
112 drm_mm_takedown(mm); 112 drm_mm_takedown(mm);
113 drm_free(mm, sizeof(*mm), DRM_MEM_MM); 113 drm_free(mm, sizeof(*mm), DRM_MEM_MM);
114} 114}
115 115
116static unsigned long drm_sman_mm_offset(void *private, void *ref) 116static unsigned long drm_sman_mm_offset(void *private, void *ref)
117{ 117{
118 drm_mm_node_t *node = (drm_mm_node_t *) ref; 118 struct drm_mm_node *node = (struct drm_mm_node *) ref;
119 return node->start; 119 return node->start;
120} 120}
121 121
122int 122int
123drm_sman_set_range(drm_sman_t * sman, unsigned int manager, 123drm_sman_set_range(struct drm_sman * sman, unsigned int manager,
124 unsigned long start, unsigned long size) 124 unsigned long start, unsigned long size)
125{ 125{
126 drm_sman_mm_t *sman_mm; 126 struct drm_sman_mm *sman_mm;
127 drm_mm_t *mm; 127 struct drm_mm *mm;
128 int ret; 128 int ret;
129 129
130 BUG_ON(manager >= sman->num_managers); 130 BUG_ON(manager >= sman->num_managers);
@@ -153,8 +153,8 @@ drm_sman_set_range(drm_sman_t * sman, unsigned int manager,
153EXPORT_SYMBOL(drm_sman_set_range); 153EXPORT_SYMBOL(drm_sman_set_range);
154 154
155int 155int
156drm_sman_set_manager(drm_sman_t * sman, unsigned int manager, 156drm_sman_set_manager(struct drm_sman * sman, unsigned int manager,
157 drm_sman_mm_t * allocator) 157 struct drm_sman_mm * allocator)
158{ 158{
159 BUG_ON(manager >= sman->num_managers); 159 BUG_ON(manager >= sman->num_managers);
160 sman->mm[manager] = *allocator; 160 sman->mm[manager] = *allocator;
@@ -163,16 +163,16 @@ drm_sman_set_manager(drm_sman_t * sman, unsigned int manager,
163} 163}
164EXPORT_SYMBOL(drm_sman_set_manager); 164EXPORT_SYMBOL(drm_sman_set_manager);
165 165
166static drm_owner_item_t *drm_sman_get_owner_item(drm_sman_t * sman, 166static struct drm_owner_item *drm_sman_get_owner_item(struct drm_sman * sman,
167 unsigned long owner) 167 unsigned long owner)
168{ 168{
169 int ret; 169 int ret;
170 drm_hash_item_t *owner_hash_item; 170 struct drm_hash_item *owner_hash_item;
171 drm_owner_item_t *owner_item; 171 struct drm_owner_item *owner_item;
172 172
173 ret = drm_ht_find_item(&sman->owner_hash_tab, owner, &owner_hash_item); 173 ret = drm_ht_find_item(&sman->owner_hash_tab, owner, &owner_hash_item);
174 if (!ret) { 174 if (!ret) {
175 return drm_hash_entry(owner_hash_item, drm_owner_item_t, 175 return drm_hash_entry(owner_hash_item, struct drm_owner_item,
176 owner_hash); 176 owner_hash);
177 } 177 }
178 178
@@ -194,14 +194,14 @@ out:
194 return NULL; 194 return NULL;
195} 195}
196 196
197drm_memblock_item_t *drm_sman_alloc(drm_sman_t *sman, unsigned int manager, 197struct drm_memblock_item *drm_sman_alloc(struct drm_sman *sman, unsigned int manager,
198 unsigned long size, unsigned alignment, 198 unsigned long size, unsigned alignment,
199 unsigned long owner) 199 unsigned long owner)
200{ 200{
201 void *tmp; 201 void *tmp;
202 drm_sman_mm_t *sman_mm; 202 struct drm_sman_mm *sman_mm;
203 drm_owner_item_t *owner_item; 203 struct drm_owner_item *owner_item;
204 drm_memblock_item_t *memblock; 204 struct drm_memblock_item *memblock;
205 205
206 BUG_ON(manager >= sman->num_managers); 206 BUG_ON(manager >= sman->num_managers);
207 207
@@ -246,9 +246,9 @@ out:
246 246
247EXPORT_SYMBOL(drm_sman_alloc); 247EXPORT_SYMBOL(drm_sman_alloc);
248 248
249static void drm_sman_free(drm_memblock_item_t *item) 249static void drm_sman_free(struct drm_memblock_item *item)
250{ 250{
251 drm_sman_t *sman = item->sman; 251 struct drm_sman *sman = item->sman;
252 252
253 list_del(&item->owner_list); 253 list_del(&item->owner_list);
254 drm_ht_remove_item(&sman->user_hash_tab, &item->user_hash); 254 drm_ht_remove_item(&sman->user_hash_tab, &item->user_hash);
@@ -256,40 +256,41 @@ static void drm_sman_free(drm_memblock_item_t *item)
256 drm_free(item, sizeof(*item), DRM_MEM_MM); 256 drm_free(item, sizeof(*item), DRM_MEM_MM);
257} 257}
258 258
259int drm_sman_free_key(drm_sman_t *sman, unsigned int key) 259int drm_sman_free_key(struct drm_sman *sman, unsigned int key)
260{ 260{
261 drm_hash_item_t *hash_item; 261 struct drm_hash_item *hash_item;
262 drm_memblock_item_t *memblock_item; 262 struct drm_memblock_item *memblock_item;
263 263
264 if (drm_ht_find_item(&sman->user_hash_tab, key, &hash_item)) 264 if (drm_ht_find_item(&sman->user_hash_tab, key, &hash_item))
265 return -EINVAL; 265 return -EINVAL;
266 266
267 memblock_item = drm_hash_entry(hash_item, drm_memblock_item_t, user_hash); 267 memblock_item = drm_hash_entry(hash_item, struct drm_memblock_item,
268 user_hash);
268 drm_sman_free(memblock_item); 269 drm_sman_free(memblock_item);
269 return 0; 270 return 0;
270} 271}
271 272
272EXPORT_SYMBOL(drm_sman_free_key); 273EXPORT_SYMBOL(drm_sman_free_key);
273 274
274static void drm_sman_remove_owner(drm_sman_t *sman, 275static void drm_sman_remove_owner(struct drm_sman *sman,
275 drm_owner_item_t *owner_item) 276 struct drm_owner_item *owner_item)
276{ 277{
277 list_del(&owner_item->sman_list); 278 list_del(&owner_item->sman_list);
278 drm_ht_remove_item(&sman->owner_hash_tab, &owner_item->owner_hash); 279 drm_ht_remove_item(&sman->owner_hash_tab, &owner_item->owner_hash);
279 drm_free(owner_item, sizeof(*owner_item), DRM_MEM_MM); 280 drm_free(owner_item, sizeof(*owner_item), DRM_MEM_MM);
280} 281}
281 282
282int drm_sman_owner_clean(drm_sman_t *sman, unsigned long owner) 283int drm_sman_owner_clean(struct drm_sman *sman, unsigned long owner)
283{ 284{
284 285
285 drm_hash_item_t *hash_item; 286 struct drm_hash_item *hash_item;
286 drm_owner_item_t *owner_item; 287 struct drm_owner_item *owner_item;
287 288
288 if (drm_ht_find_item(&sman->owner_hash_tab, owner, &hash_item)) { 289 if (drm_ht_find_item(&sman->owner_hash_tab, owner, &hash_item)) {
289 return -1; 290 return -1;
290 } 291 }
291 292
292 owner_item = drm_hash_entry(hash_item, drm_owner_item_t, owner_hash); 293 owner_item = drm_hash_entry(hash_item, struct drm_owner_item, owner_hash);
293 if (owner_item->mem_blocks.next == &owner_item->mem_blocks) { 294 if (owner_item->mem_blocks.next == &owner_item->mem_blocks) {
294 drm_sman_remove_owner(sman, owner_item); 295 drm_sman_remove_owner(sman, owner_item);
295 return -1; 296 return -1;
@@ -300,10 +301,10 @@ int drm_sman_owner_clean(drm_sman_t *sman, unsigned long owner)
300 301
301EXPORT_SYMBOL(drm_sman_owner_clean); 302EXPORT_SYMBOL(drm_sman_owner_clean);
302 303
303static void drm_sman_do_owner_cleanup(drm_sman_t *sman, 304static void drm_sman_do_owner_cleanup(struct drm_sman *sman,
304 drm_owner_item_t *owner_item) 305 struct drm_owner_item *owner_item)
305{ 306{
306 drm_memblock_item_t *entry, *next; 307 struct drm_memblock_item *entry, *next;
307 308
308 list_for_each_entry_safe(entry, next, &owner_item->mem_blocks, 309 list_for_each_entry_safe(entry, next, &owner_item->mem_blocks,
309 owner_list) { 310 owner_list) {
@@ -312,28 +313,28 @@ static void drm_sman_do_owner_cleanup(drm_sman_t *sman,
312 drm_sman_remove_owner(sman, owner_item); 313 drm_sman_remove_owner(sman, owner_item);
313} 314}
314 315
315void drm_sman_owner_cleanup(drm_sman_t *sman, unsigned long owner) 316void drm_sman_owner_cleanup(struct drm_sman *sman, unsigned long owner)
316{ 317{
317 318
318 drm_hash_item_t *hash_item; 319 struct drm_hash_item *hash_item;
319 drm_owner_item_t *owner_item; 320 struct drm_owner_item *owner_item;
320 321
321 if (drm_ht_find_item(&sman->owner_hash_tab, owner, &hash_item)) { 322 if (drm_ht_find_item(&sman->owner_hash_tab, owner, &hash_item)) {
322 323
323 return; 324 return;
324 } 325 }
325 326
326 owner_item = drm_hash_entry(hash_item, drm_owner_item_t, owner_hash); 327 owner_item = drm_hash_entry(hash_item, struct drm_owner_item, owner_hash);
327 drm_sman_do_owner_cleanup(sman, owner_item); 328 drm_sman_do_owner_cleanup(sman, owner_item);
328} 329}
329 330
330EXPORT_SYMBOL(drm_sman_owner_cleanup); 331EXPORT_SYMBOL(drm_sman_owner_cleanup);
331 332
332void drm_sman_cleanup(drm_sman_t *sman) 333void drm_sman_cleanup(struct drm_sman *sman)
333{ 334{
334 drm_owner_item_t *entry, *next; 335 struct drm_owner_item *entry, *next;
335 unsigned int i; 336 unsigned int i;
336 drm_sman_mm_t *sman_mm; 337 struct drm_sman_mm *sman_mm;
337 338
338 list_for_each_entry_safe(entry, next, &sman->owner_items, sman_list) { 339 list_for_each_entry_safe(entry, next, &sman->owner_items, sman_list) {
339 drm_sman_do_owner_cleanup(sman, entry); 340 drm_sman_do_owner_cleanup(sman, entry);
diff --git a/drivers/char/drm/drm_sman.h b/drivers/char/drm/drm_sman.h
index ddc732a1bf27..39a39fefeef1 100644
--- a/drivers/char/drm/drm_sman.h
+++ b/drivers/char/drm/drm_sman.h
@@ -50,7 +50,7 @@
50 * for memory management. 50 * for memory management.
51 */ 51 */
52 52
53typedef struct drm_sman_mm { 53struct drm_sman_mm {
54 /* private info. If allocated, needs to be destroyed by the destroy 54 /* private info. If allocated, needs to be destroyed by the destroy
55 function */ 55 function */
56 void *private; 56 void *private;
@@ -74,30 +74,30 @@ typedef struct drm_sman_mm {
74 "alloc" function */ 74 "alloc" function */
75 75
76 unsigned long (*offset) (void *private, void *ref); 76 unsigned long (*offset) (void *private, void *ref);
77} drm_sman_mm_t; 77};
78 78
79typedef struct drm_memblock_item { 79struct drm_memblock_item {
80 struct list_head owner_list; 80 struct list_head owner_list;
81 drm_hash_item_t user_hash; 81 struct drm_hash_item user_hash;
82 void *mm_info; 82 void *mm_info;
83 drm_sman_mm_t *mm; 83 struct drm_sman_mm *mm;
84 struct drm_sman *sman; 84 struct drm_sman *sman;
85} drm_memblock_item_t; 85};
86 86
87typedef struct drm_sman { 87struct drm_sman {
88 drm_sman_mm_t *mm; 88 struct drm_sman_mm *mm;
89 int num_managers; 89 int num_managers;
90 drm_open_hash_t owner_hash_tab; 90 struct drm_open_hash owner_hash_tab;
91 drm_open_hash_t user_hash_tab; 91 struct drm_open_hash user_hash_tab;
92 struct list_head owner_items; 92 struct list_head owner_items;
93} drm_sman_t; 93};
94 94
95/* 95/*
96 * Take down a memory manager. This function should only be called after a 96 * Take down a memory manager. This function should only be called after a
97 * successful init and after a call to drm_sman_cleanup. 97 * successful init and after a call to drm_sman_cleanup.
98 */ 98 */
99 99
100extern void drm_sman_takedown(drm_sman_t * sman); 100extern void drm_sman_takedown(struct drm_sman * sman);
101 101
102/* 102/*
103 * Allocate structures for a manager. 103 * Allocate structures for a manager.
@@ -112,7 +112,7 @@ extern void drm_sman_takedown(drm_sman_t * sman);
112 * 112 *
113 */ 113 */
114 114
115extern int drm_sman_init(drm_sman_t * sman, unsigned int num_managers, 115extern int drm_sman_init(struct drm_sman * sman, unsigned int num_managers,
116 unsigned int user_order, unsigned int owner_order); 116 unsigned int user_order, unsigned int owner_order);
117 117
118/* 118/*
@@ -120,7 +120,7 @@ extern int drm_sman_init(drm_sman_t * sman, unsigned int num_managers,
120 * manager unless a customized allogator is used. 120 * manager unless a customized allogator is used.
121 */ 121 */
122 122
123extern int drm_sman_set_range(drm_sman_t * sman, unsigned int manager, 123extern int drm_sman_set_range(struct drm_sman * sman, unsigned int manager,
124 unsigned long start, unsigned long size); 124 unsigned long start, unsigned long size);
125 125
126/* 126/*
@@ -129,23 +129,23 @@ extern int drm_sman_set_range(drm_sman_t * sman, unsigned int manager,
129 * so it can be destroyed after this call. 129 * so it can be destroyed after this call.
130 */ 130 */
131 131
132extern int drm_sman_set_manager(drm_sman_t * sman, unsigned int mananger, 132extern int drm_sman_set_manager(struct drm_sman * sman, unsigned int mananger,
133 drm_sman_mm_t * allocator); 133 struct drm_sman_mm * allocator);
134 134
135/* 135/*
136 * Allocate a memory block. Aligment is not implemented yet. 136 * Allocate a memory block. Aligment is not implemented yet.
137 */ 137 */
138 138
139extern drm_memblock_item_t *drm_sman_alloc(drm_sman_t * sman, 139extern struct drm_memblock_item *drm_sman_alloc(struct drm_sman * sman,
140 unsigned int manager, 140 unsigned int manager,
141 unsigned long size, 141 unsigned long size,
142 unsigned alignment, 142 unsigned alignment,
143 unsigned long owner); 143 unsigned long owner);
144/* 144/*
145 * Free a memory block identified by its user hash key. 145 * Free a memory block identified by its user hash key.
146 */ 146 */
147 147
148extern int drm_sman_free_key(drm_sman_t * sman, unsigned int key); 148extern int drm_sman_free_key(struct drm_sman * sman, unsigned int key);
149 149
150/* 150/*
151 * returns 1 iff there are no stale memory blocks associated with this owner. 151 * returns 1 iff there are no stale memory blocks associated with this owner.
@@ -154,7 +154,7 @@ extern int drm_sman_free_key(drm_sman_t * sman, unsigned int key);
154 * resources associated with owner. 154 * resources associated with owner.
155 */ 155 */
156 156
157extern int drm_sman_owner_clean(drm_sman_t * sman, unsigned long owner); 157extern int drm_sman_owner_clean(struct drm_sman * sman, unsigned long owner);
158 158
159/* 159/*
160 * Frees all stale memory blocks associated with this owner. Note that this 160 * Frees all stale memory blocks associated with this owner. Note that this
@@ -164,13 +164,13 @@ extern int drm_sman_owner_clean(drm_sman_t * sman, unsigned long owner);
164 * is not going to be referenced anymore. 164 * is not going to be referenced anymore.
165 */ 165 */
166 166
167extern void drm_sman_owner_cleanup(drm_sman_t * sman, unsigned long owner); 167extern void drm_sman_owner_cleanup(struct drm_sman * sman, unsigned long owner);
168 168
169/* 169/*
170 * Frees all stale memory blocks associated with the memory manager. 170 * Frees all stale memory blocks associated with the memory manager.
171 * See idling above. 171 * See idling above.
172 */ 172 */
173 173
174extern void drm_sman_cleanup(drm_sman_t * sman); 174extern void drm_sman_cleanup(struct drm_sman * sman);
175 175
176#endif 176#endif
diff --git a/drivers/char/drm/drm_stub.c b/drivers/char/drm/drm_stub.c
index 19408adcc775..9138b49e676e 100644
--- a/drivers/char/drm/drm_stub.c
+++ b/drivers/char/drm/drm_stub.c
@@ -49,16 +49,21 @@ MODULE_PARM_DESC(debug, "Enable debug output");
49module_param_named(cards_limit, drm_cards_limit, int, 0444); 49module_param_named(cards_limit, drm_cards_limit, int, 0444);
50module_param_named(debug, drm_debug, int, 0600); 50module_param_named(debug, drm_debug, int, 0600);
51 51
52drm_head_t **drm_heads; 52struct drm_head **drm_heads;
53struct class *drm_class; 53struct class *drm_class;
54struct proc_dir_entry *drm_proc_root; 54struct proc_dir_entry *drm_proc_root;
55 55
56static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev, 56static int drm_fill_in_dev(struct drm_device * dev, struct pci_dev *pdev,
57 const struct pci_device_id *ent, 57 const struct pci_device_id *ent,
58 struct drm_driver *driver) 58 struct drm_driver *driver)
59{ 59{
60 int retcode; 60 int retcode;
61 61
62 INIT_LIST_HEAD(&dev->filelist);
63 INIT_LIST_HEAD(&dev->ctxlist);
64 INIT_LIST_HEAD(&dev->vmalist);
65 INIT_LIST_HEAD(&dev->maplist);
66
62 spin_lock_init(&dev->count_lock); 67 spin_lock_init(&dev->count_lock);
63 spin_lock_init(&dev->drw_lock); 68 spin_lock_init(&dev->drw_lock);
64 spin_lock_init(&dev->tasklet_lock); 69 spin_lock_init(&dev->tasklet_lock);
@@ -76,12 +81,7 @@ static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev,
76#endif 81#endif
77 dev->irq = pdev->irq; 82 dev->irq = pdev->irq;
78 83
79 dev->maplist = drm_calloc(1, sizeof(*dev->maplist), DRM_MEM_MAPS);
80 if (dev->maplist == NULL)
81 return -ENOMEM;
82 INIT_LIST_HEAD(&dev->maplist->head);
83 if (drm_ht_create(&dev->map_hash, 12)) { 84 if (drm_ht_create(&dev->map_hash, 12)) {
84 drm_free(dev->maplist, sizeof(*dev->maplist), DRM_MEM_MAPS);
85 return -ENOMEM; 85 return -ENOMEM;
86 } 86 }
87 87
@@ -143,9 +143,9 @@ static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev,
143 * create the proc init entry via proc_init(). This routines assigns 143 * create the proc init entry via proc_init(). This routines assigns
144 * minor numbers to secondary heads of multi-headed cards 144 * minor numbers to secondary heads of multi-headed cards
145 */ 145 */
146static int drm_get_head(drm_device_t * dev, drm_head_t * head) 146static int drm_get_head(struct drm_device * dev, struct drm_head * head)
147{ 147{
148 drm_head_t **heads = drm_heads; 148 struct drm_head **heads = drm_heads;
149 int ret; 149 int ret;
150 int minor; 150 int minor;
151 151
@@ -154,7 +154,7 @@ static int drm_get_head(drm_device_t * dev, drm_head_t * head)
154 for (minor = 0; minor < drm_cards_limit; minor++, heads++) { 154 for (minor = 0; minor < drm_cards_limit; minor++, heads++) {
155 if (!*heads) { 155 if (!*heads) {
156 156
157 *head = (drm_head_t) { 157 *head = (struct drm_head) {
158 .dev = dev,.device = 158 .dev = dev,.device =
159 MKDEV(DRM_MAJOR, minor),.minor = minor,}; 159 MKDEV(DRM_MAJOR, minor),.minor = minor,};
160 160
@@ -184,7 +184,7 @@ static int drm_get_head(drm_device_t * dev, drm_head_t * head)
184 err_g2: 184 err_g2:
185 drm_proc_cleanup(minor, drm_proc_root, head->dev_root); 185 drm_proc_cleanup(minor, drm_proc_root, head->dev_root);
186 err_g1: 186 err_g1:
187 *head = (drm_head_t) { 187 *head = (struct drm_head) {
188 .dev = NULL}; 188 .dev = NULL};
189 return ret; 189 return ret;
190} 190}
@@ -203,7 +203,7 @@ static int drm_get_head(drm_device_t * dev, drm_head_t * head)
203int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent, 203int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
204 struct drm_driver *driver) 204 struct drm_driver *driver)
205{ 205{
206 drm_device_t *dev; 206 struct drm_device *dev;
207 int ret; 207 int ret;
208 208
209 DRM_DEBUG("\n"); 209 DRM_DEBUG("\n");
@@ -246,7 +246,7 @@ err_g1:
246 * "drm" data, otherwise unregisters the "drm" data, frees the dev list and 246 * "drm" data, otherwise unregisters the "drm" data, frees the dev list and
247 * unregisters the character device. 247 * unregisters the character device.
248 */ 248 */
249int drm_put_dev(drm_device_t * dev) 249int drm_put_dev(struct drm_device * dev)
250{ 250{
251 DRM_DEBUG("release primary %s\n", dev->driver->pci_driver.name); 251 DRM_DEBUG("release primary %s\n", dev->driver->pci_driver.name);
252 252
@@ -274,7 +274,7 @@ int drm_put_dev(drm_device_t * dev)
274 * last minor released. 274 * last minor released.
275 * 275 *
276 */ 276 */
277int drm_put_head(drm_head_t * head) 277int drm_put_head(struct drm_head * head)
278{ 278{
279 int minor = head->minor; 279 int minor = head->minor;
280 280
@@ -283,7 +283,7 @@ int drm_put_head(drm_head_t * head)
283 drm_proc_cleanup(minor, drm_proc_root, head->dev_root); 283 drm_proc_cleanup(minor, drm_proc_root, head->dev_root);
284 drm_sysfs_device_remove(head->dev_class); 284 drm_sysfs_device_remove(head->dev_class);
285 285
286 *head = (drm_head_t) {.dev = NULL}; 286 *head = (struct drm_head) {.dev = NULL};
287 287
288 drm_heads[minor] = NULL; 288 drm_heads[minor] = NULL;
289 289
diff --git a/drivers/char/drm/drm_sysfs.c b/drivers/char/drm/drm_sysfs.c
index cc8e2ebe128c..cf4349b00b07 100644
--- a/drivers/char/drm/drm_sysfs.c
+++ b/drivers/char/drm/drm_sysfs.c
@@ -80,7 +80,7 @@ void drm_sysfs_destroy(struct class *class)
80 80
81static ssize_t show_dri(struct class_device *class_device, char *buf) 81static ssize_t show_dri(struct class_device *class_device, char *buf)
82{ 82{
83 drm_device_t * dev = ((drm_head_t *)class_get_devdata(class_device))->dev; 83 struct drm_device * dev = ((struct drm_head *)class_get_devdata(class_device))->dev;
84 if (dev->driver->dri_library_name) 84 if (dev->driver->dri_library_name)
85 return dev->driver->dri_library_name(dev, buf); 85 return dev->driver->dri_library_name(dev, buf);
86 return snprintf(buf, PAGE_SIZE, "%s\n", dev->driver->pci_driver.name); 86 return snprintf(buf, PAGE_SIZE, "%s\n", dev->driver->pci_driver.name);
@@ -104,7 +104,7 @@ static struct class_device_attribute class_device_attrs[] = {
104 * Note: the struct class passed to this function must have previously been 104 * Note: the struct class passed to this function must have previously been
105 * created with a call to drm_sysfs_create(). 105 * created with a call to drm_sysfs_create().
106 */ 106 */
107struct class_device *drm_sysfs_device_add(struct class *cs, drm_head_t *head) 107struct class_device *drm_sysfs_device_add(struct class *cs, struct drm_head *head)
108{ 108{
109 struct class_device *class_dev; 109 struct class_device *class_dev;
110 int i, j, err; 110 int i, j, err;
diff --git a/drivers/char/drm/drm_vm.c b/drivers/char/drm/drm_vm.c
index b5c5b9fa84c3..68e36e51ba0c 100644
--- a/drivers/char/drm/drm_vm.c
+++ b/drivers/char/drm/drm_vm.c
@@ -79,11 +79,11 @@ static pgprot_t drm_io_prot(uint32_t map_type, struct vm_area_struct *vma)
79static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma, 79static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma,
80 unsigned long address) 80 unsigned long address)
81{ 81{
82 drm_file_t *priv = vma->vm_file->private_data; 82 struct drm_file *priv = vma->vm_file->private_data;
83 drm_device_t *dev = priv->head->dev; 83 struct drm_device *dev = priv->head->dev;
84 drm_map_t *map = NULL; 84 struct drm_map *map = NULL;
85 drm_map_list_t *r_list; 85 struct drm_map_list *r_list;
86 drm_hash_item_t *hash; 86 struct drm_hash_item *hash;
87 87
88 /* 88 /*
89 * Find the right map 89 * Find the right map
@@ -97,7 +97,7 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma,
97 if (drm_ht_find_item(&dev->map_hash, vma->vm_pgoff, &hash)) 97 if (drm_ht_find_item(&dev->map_hash, vma->vm_pgoff, &hash))
98 goto vm_nopage_error; 98 goto vm_nopage_error;
99 99
100 r_list = drm_hash_entry(hash, drm_map_list_t, hash); 100 r_list = drm_hash_entry(hash, struct drm_map_list, hash);
101 map = r_list->map; 101 map = r_list->map;
102 102
103 if (map && map->type == _DRM_AGP) { 103 if (map && map->type == _DRM_AGP) {
@@ -116,7 +116,7 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma,
116 /* 116 /*
117 * It's AGP memory - find the real physical page to map 117 * It's AGP memory - find the real physical page to map
118 */ 118 */
119 for (agpmem = dev->agp->memory; agpmem; agpmem = agpmem->next) { 119 list_for_each_entry(agpmem, &dev->agp->memory, head) {
120 if (agpmem->bound <= baddr && 120 if (agpmem->bound <= baddr &&
121 agpmem->bound + agpmem->pages * PAGE_SIZE > baddr) 121 agpmem->bound + agpmem->pages * PAGE_SIZE > baddr)
122 break; 122 break;
@@ -163,7 +163,7 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma,
163static __inline__ struct page *drm_do_vm_shm_nopage(struct vm_area_struct *vma, 163static __inline__ struct page *drm_do_vm_shm_nopage(struct vm_area_struct *vma,
164 unsigned long address) 164 unsigned long address)
165{ 165{
166 drm_map_t *map = (drm_map_t *) vma->vm_private_data; 166 struct drm_map *map = (struct drm_map *) vma->vm_private_data;
167 unsigned long offset; 167 unsigned long offset;
168 unsigned long i; 168 unsigned long i;
169 struct page *page; 169 struct page *page;
@@ -194,12 +194,11 @@ static __inline__ struct page *drm_do_vm_shm_nopage(struct vm_area_struct *vma,
194 */ 194 */
195static void drm_vm_shm_close(struct vm_area_struct *vma) 195static void drm_vm_shm_close(struct vm_area_struct *vma)
196{ 196{
197 drm_file_t *priv = vma->vm_file->private_data; 197 struct drm_file *priv = vma->vm_file->private_data;
198 drm_device_t *dev = priv->head->dev; 198 struct drm_device *dev = priv->head->dev;
199 drm_vma_entry_t *pt, *prev, *next; 199 struct drm_vma_entry *pt, *temp;
200 drm_map_t *map; 200 struct drm_map *map;
201 drm_map_list_t *r_list; 201 struct drm_map_list *r_list;
202 struct list_head *list;
203 int found_maps = 0; 202 int found_maps = 0;
204 203
205 DRM_DEBUG("0x%08lx,0x%08lx\n", 204 DRM_DEBUG("0x%08lx,0x%08lx\n",
@@ -209,30 +208,22 @@ static void drm_vm_shm_close(struct vm_area_struct *vma)
209 map = vma->vm_private_data; 208 map = vma->vm_private_data;
210 209
211 mutex_lock(&dev->struct_mutex); 210 mutex_lock(&dev->struct_mutex);
212 for (pt = dev->vmalist, prev = NULL; pt; pt = next) { 211 list_for_each_entry_safe(pt, temp, &dev->vmalist, head) {
213 next = pt->next;
214 if (pt->vma->vm_private_data == map) 212 if (pt->vma->vm_private_data == map)
215 found_maps++; 213 found_maps++;
216 if (pt->vma == vma) { 214 if (pt->vma == vma) {
217 if (prev) { 215 list_del(&pt->head);
218 prev->next = pt->next;
219 } else {
220 dev->vmalist = pt->next;
221 }
222 drm_free(pt, sizeof(*pt), DRM_MEM_VMAS); 216 drm_free(pt, sizeof(*pt), DRM_MEM_VMAS);
223 } else {
224 prev = pt;
225 } 217 }
226 } 218 }
219
227 /* We were the only map that was found */ 220 /* We were the only map that was found */
228 if (found_maps == 1 && map->flags & _DRM_REMOVABLE) { 221 if (found_maps == 1 && map->flags & _DRM_REMOVABLE) {
229 /* Check to see if we are in the maplist, if we are not, then 222 /* Check to see if we are in the maplist, if we are not, then
230 * we delete this mappings information. 223 * we delete this mappings information.
231 */ 224 */
232 found_maps = 0; 225 found_maps = 0;
233 list = &dev->maplist->head; 226 list_for_each_entry(r_list, &dev->maplist, head) {
234 list_for_each(list, &dev->maplist->head) {
235 r_list = list_entry(list, drm_map_list_t, head);
236 if (r_list->map == map) 227 if (r_list->map == map)
237 found_maps++; 228 found_maps++;
238 } 229 }
@@ -283,9 +274,9 @@ static void drm_vm_shm_close(struct vm_area_struct *vma)
283static __inline__ struct page *drm_do_vm_dma_nopage(struct vm_area_struct *vma, 274static __inline__ struct page *drm_do_vm_dma_nopage(struct vm_area_struct *vma,
284 unsigned long address) 275 unsigned long address)
285{ 276{
286 drm_file_t *priv = vma->vm_file->private_data; 277 struct drm_file *priv = vma->vm_file->private_data;
287 drm_device_t *dev = priv->head->dev; 278 struct drm_device *dev = priv->head->dev;
288 drm_device_dma_t *dma = dev->dma; 279 struct drm_device_dma *dma = dev->dma;
289 unsigned long offset; 280 unsigned long offset;
290 unsigned long page_nr; 281 unsigned long page_nr;
291 struct page *page; 282 struct page *page;
@@ -319,10 +310,10 @@ static __inline__ struct page *drm_do_vm_dma_nopage(struct vm_area_struct *vma,
319static __inline__ struct page *drm_do_vm_sg_nopage(struct vm_area_struct *vma, 310static __inline__ struct page *drm_do_vm_sg_nopage(struct vm_area_struct *vma,
320 unsigned long address) 311 unsigned long address)
321{ 312{
322 drm_map_t *map = (drm_map_t *) vma->vm_private_data; 313 struct drm_map *map = (struct drm_map *) vma->vm_private_data;
323 drm_file_t *priv = vma->vm_file->private_data; 314 struct drm_file *priv = vma->vm_file->private_data;
324 drm_device_t *dev = priv->head->dev; 315 struct drm_device *dev = priv->head->dev;
325 drm_sg_mem_t *entry = dev->sg; 316 struct drm_sg_mem *entry = dev->sg;
326 unsigned long offset; 317 unsigned long offset;
327 unsigned long map_offset; 318 unsigned long map_offset;
328 unsigned long page_offset; 319 unsigned long page_offset;
@@ -414,9 +405,9 @@ static struct vm_operations_struct drm_vm_sg_ops = {
414 */ 405 */
415static void drm_vm_open_locked(struct vm_area_struct *vma) 406static void drm_vm_open_locked(struct vm_area_struct *vma)
416{ 407{
417 drm_file_t *priv = vma->vm_file->private_data; 408 struct drm_file *priv = vma->vm_file->private_data;
418 drm_device_t *dev = priv->head->dev; 409 struct drm_device *dev = priv->head->dev;
419 drm_vma_entry_t *vma_entry; 410 struct drm_vma_entry *vma_entry;
420 411
421 DRM_DEBUG("0x%08lx,0x%08lx\n", 412 DRM_DEBUG("0x%08lx,0x%08lx\n",
422 vma->vm_start, vma->vm_end - vma->vm_start); 413 vma->vm_start, vma->vm_end - vma->vm_start);
@@ -425,16 +416,15 @@ static void drm_vm_open_locked(struct vm_area_struct *vma)
425 vma_entry = drm_alloc(sizeof(*vma_entry), DRM_MEM_VMAS); 416 vma_entry = drm_alloc(sizeof(*vma_entry), DRM_MEM_VMAS);
426 if (vma_entry) { 417 if (vma_entry) {
427 vma_entry->vma = vma; 418 vma_entry->vma = vma;
428 vma_entry->next = dev->vmalist;
429 vma_entry->pid = current->pid; 419 vma_entry->pid = current->pid;
430 dev->vmalist = vma_entry; 420 list_add(&vma_entry->head, &dev->vmalist);
431 } 421 }
432} 422}
433 423
434static void drm_vm_open(struct vm_area_struct *vma) 424static void drm_vm_open(struct vm_area_struct *vma)
435{ 425{
436 drm_file_t *priv = vma->vm_file->private_data; 426 struct drm_file *priv = vma->vm_file->private_data;
437 drm_device_t *dev = priv->head->dev; 427 struct drm_device *dev = priv->head->dev;
438 428
439 mutex_lock(&dev->struct_mutex); 429 mutex_lock(&dev->struct_mutex);
440 drm_vm_open_locked(vma); 430 drm_vm_open_locked(vma);
@@ -451,22 +441,18 @@ static void drm_vm_open(struct vm_area_struct *vma)
451 */ 441 */
452static void drm_vm_close(struct vm_area_struct *vma) 442static void drm_vm_close(struct vm_area_struct *vma)
453{ 443{
454 drm_file_t *priv = vma->vm_file->private_data; 444 struct drm_file *priv = vma->vm_file->private_data;
455 drm_device_t *dev = priv->head->dev; 445 struct drm_device *dev = priv->head->dev;
456 drm_vma_entry_t *pt, *prev; 446 struct drm_vma_entry *pt, *temp;
457 447
458 DRM_DEBUG("0x%08lx,0x%08lx\n", 448 DRM_DEBUG("0x%08lx,0x%08lx\n",
459 vma->vm_start, vma->vm_end - vma->vm_start); 449 vma->vm_start, vma->vm_end - vma->vm_start);
460 atomic_dec(&dev->vma_count); 450 atomic_dec(&dev->vma_count);
461 451
462 mutex_lock(&dev->struct_mutex); 452 mutex_lock(&dev->struct_mutex);
463 for (pt = dev->vmalist, prev = NULL; pt; prev = pt, pt = pt->next) { 453 list_for_each_entry_safe(pt, temp, &dev->vmalist, head) {
464 if (pt->vma == vma) { 454 if (pt->vma == vma) {
465 if (prev) { 455 list_del(&pt->head);
466 prev->next = pt->next;
467 } else {
468 dev->vmalist = pt->next;
469 }
470 drm_free(pt, sizeof(*pt), DRM_MEM_VMAS); 456 drm_free(pt, sizeof(*pt), DRM_MEM_VMAS);
471 break; 457 break;
472 } 458 }
@@ -486,9 +472,9 @@ static void drm_vm_close(struct vm_area_struct *vma)
486 */ 472 */
487static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma) 473static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
488{ 474{
489 drm_file_t *priv = filp->private_data; 475 struct drm_file *priv = filp->private_data;
490 drm_device_t *dev; 476 struct drm_device *dev;
491 drm_device_dma_t *dma; 477 struct drm_device_dma *dma;
492 unsigned long length = vma->vm_end - vma->vm_start; 478 unsigned long length = vma->vm_end - vma->vm_start;
493 479
494 dev = priv->head->dev; 480 dev = priv->head->dev;
@@ -526,7 +512,7 @@ static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
526 return 0; 512 return 0;
527} 513}
528 514
529unsigned long drm_core_get_map_ofs(drm_map_t * map) 515unsigned long drm_core_get_map_ofs(struct drm_map * map)
530{ 516{
531 return map->offset; 517 return map->offset;
532} 518}
@@ -559,11 +545,11 @@ EXPORT_SYMBOL(drm_core_get_reg_ofs);
559 */ 545 */
560static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma) 546static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
561{ 547{
562 drm_file_t *priv = filp->private_data; 548 struct drm_file *priv = filp->private_data;
563 drm_device_t *dev = priv->head->dev; 549 struct drm_device *dev = priv->head->dev;
564 drm_map_t *map = NULL; 550 struct drm_map *map = NULL;
565 unsigned long offset = 0; 551 unsigned long offset = 0;
566 drm_hash_item_t *hash; 552 struct drm_hash_item *hash;
567 553
568 DRM_DEBUG("start = 0x%lx, end = 0x%lx, page offset = 0x%lx\n", 554 DRM_DEBUG("start = 0x%lx, end = 0x%lx, page offset = 0x%lx\n",
569 vma->vm_start, vma->vm_end, vma->vm_pgoff); 555 vma->vm_start, vma->vm_end, vma->vm_pgoff);
@@ -588,7 +574,7 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
588 return -EINVAL; 574 return -EINVAL;
589 } 575 }
590 576
591 map = drm_hash_entry(hash, drm_map_list_t, hash)->map; 577 map = drm_hash_entry(hash, struct drm_map_list, hash)->map;
592 if (!map || ((map->flags & _DRM_RESTRICTED) && !capable(CAP_SYS_ADMIN))) 578 if (!map || ((map->flags & _DRM_RESTRICTED) && !capable(CAP_SYS_ADMIN)))
593 return -EPERM; 579 return -EPERM;
594 580
@@ -677,8 +663,8 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
677 663
678int drm_mmap(struct file *filp, struct vm_area_struct *vma) 664int drm_mmap(struct file *filp, struct vm_area_struct *vma)
679{ 665{
680 drm_file_t *priv = filp->private_data; 666 struct drm_file *priv = filp->private_data;
681 drm_device_t *dev = priv->head->dev; 667 struct drm_device *dev = priv->head->dev;
682 int ret; 668 int ret;
683 669
684 mutex_lock(&dev->struct_mutex); 670 mutex_lock(&dev->struct_mutex);
diff --git a/drivers/char/drm/i810_dma.c b/drivers/char/drm/i810_dma.c
index 603d17fd2d69..cb449999d0ef 100644
--- a/drivers/char/drm/i810_dma.c
+++ b/drivers/char/drm/i810_dma.c
@@ -45,16 +45,16 @@
45#define I810_BUF_UNMAPPED 0 45#define I810_BUF_UNMAPPED 0
46#define I810_BUF_MAPPED 1 46#define I810_BUF_MAPPED 1
47 47
48static drm_buf_t *i810_freelist_get(drm_device_t * dev) 48static struct drm_buf *i810_freelist_get(struct drm_device * dev)
49{ 49{
50 drm_device_dma_t *dma = dev->dma; 50 struct drm_device_dma *dma = dev->dma;
51 int i; 51 int i;
52 int used; 52 int used;
53 53
54 /* Linear search might not be the best solution */ 54 /* Linear search might not be the best solution */
55 55
56 for (i = 0; i < dma->buf_count; i++) { 56 for (i = 0; i < dma->buf_count; i++) {
57 drm_buf_t *buf = dma->buflist[i]; 57 struct drm_buf *buf = dma->buflist[i];
58 drm_i810_buf_priv_t *buf_priv = buf->dev_private; 58 drm_i810_buf_priv_t *buf_priv = buf->dev_private;
59 /* In use is already a pointer */ 59 /* In use is already a pointer */
60 used = cmpxchg(buf_priv->in_use, I810_BUF_FREE, 60 used = cmpxchg(buf_priv->in_use, I810_BUF_FREE,
@@ -70,7 +70,7 @@ static drm_buf_t *i810_freelist_get(drm_device_t * dev)
70 * yet, the hardware updates in use for us once its on the ring buffer. 70 * yet, the hardware updates in use for us once its on the ring buffer.
71 */ 71 */
72 72
73static int i810_freelist_put(drm_device_t * dev, drm_buf_t * buf) 73static int i810_freelist_put(struct drm_device * dev, struct drm_buf * buf)
74{ 74{
75 drm_i810_buf_priv_t *buf_priv = buf->dev_private; 75 drm_i810_buf_priv_t *buf_priv = buf->dev_private;
76 int used; 76 int used;
@@ -87,10 +87,10 @@ static int i810_freelist_put(drm_device_t * dev, drm_buf_t * buf)
87 87
88static int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma) 88static int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
89{ 89{
90 drm_file_t *priv = filp->private_data; 90 struct drm_file *priv = filp->private_data;
91 drm_device_t *dev; 91 struct drm_device *dev;
92 drm_i810_private_t *dev_priv; 92 drm_i810_private_t *dev_priv;
93 drm_buf_t *buf; 93 struct drm_buf *buf;
94 drm_i810_buf_priv_t *buf_priv; 94 drm_i810_buf_priv_t *buf_priv;
95 95
96 lock_kernel(); 96 lock_kernel();
@@ -120,10 +120,10 @@ static const struct file_operations i810_buffer_fops = {
120 .fasync = drm_fasync, 120 .fasync = drm_fasync,
121}; 121};
122 122
123static int i810_map_buffer(drm_buf_t * buf, struct file *filp) 123static int i810_map_buffer(struct drm_buf * buf, struct file *filp)
124{ 124{
125 drm_file_t *priv = filp->private_data; 125 struct drm_file *priv = filp->private_data;
126 drm_device_t *dev = priv->head->dev; 126 struct drm_device *dev = priv->head->dev;
127 drm_i810_buf_priv_t *buf_priv = buf->dev_private; 127 drm_i810_buf_priv_t *buf_priv = buf->dev_private;
128 drm_i810_private_t *dev_priv = dev->dev_private; 128 drm_i810_private_t *dev_priv = dev->dev_private;
129 const struct file_operations *old_fops; 129 const struct file_operations *old_fops;
@@ -152,7 +152,7 @@ static int i810_map_buffer(drm_buf_t * buf, struct file *filp)
152 return retcode; 152 return retcode;
153} 153}
154 154
155static int i810_unmap_buffer(drm_buf_t * buf) 155static int i810_unmap_buffer(struct drm_buf * buf)
156{ 156{
157 drm_i810_buf_priv_t *buf_priv = buf->dev_private; 157 drm_i810_buf_priv_t *buf_priv = buf->dev_private;
158 int retcode = 0; 158 int retcode = 0;
@@ -172,10 +172,10 @@ static int i810_unmap_buffer(drm_buf_t * buf)
172 return retcode; 172 return retcode;
173} 173}
174 174
175static int i810_dma_get_buffer(drm_device_t * dev, drm_i810_dma_t * d, 175static int i810_dma_get_buffer(struct drm_device * dev, drm_i810_dma_t * d,
176 struct file *filp) 176 struct file *filp)
177{ 177{
178 drm_buf_t *buf; 178 struct drm_buf *buf;
179 drm_i810_buf_priv_t *buf_priv; 179 drm_i810_buf_priv_t *buf_priv;
180 int retcode = 0; 180 int retcode = 0;
181 181
@@ -202,9 +202,9 @@ static int i810_dma_get_buffer(drm_device_t * dev, drm_i810_dma_t * d,
202 return retcode; 202 return retcode;
203} 203}
204 204
205static int i810_dma_cleanup(drm_device_t * dev) 205static int i810_dma_cleanup(struct drm_device * dev)
206{ 206{
207 drm_device_dma_t *dma = dev->dma; 207 struct drm_device_dma *dma = dev->dma;
208 208
209 /* Make sure interrupts are disabled here because the uninstall ioctl 209 /* Make sure interrupts are disabled here because the uninstall ioctl
210 * may not have been called from userspace and after dev_private 210 * may not have been called from userspace and after dev_private
@@ -233,7 +233,7 @@ static int i810_dma_cleanup(drm_device_t * dev)
233 dev->dev_private = NULL; 233 dev->dev_private = NULL;
234 234
235 for (i = 0; i < dma->buf_count; i++) { 235 for (i = 0; i < dma->buf_count; i++) {
236 drm_buf_t *buf = dma->buflist[i]; 236 struct drm_buf *buf = dma->buflist[i];
237 drm_i810_buf_priv_t *buf_priv = buf->dev_private; 237 drm_i810_buf_priv_t *buf_priv = buf->dev_private;
238 238
239 if (buf_priv->kernel_virtual && buf->total) 239 if (buf_priv->kernel_virtual && buf->total)
@@ -243,7 +243,7 @@ static int i810_dma_cleanup(drm_device_t * dev)
243 return 0; 243 return 0;
244} 244}
245 245
246static int i810_wait_ring(drm_device_t * dev, int n) 246static int i810_wait_ring(struct drm_device * dev, int n)
247{ 247{
248 drm_i810_private_t *dev_priv = dev->dev_private; 248 drm_i810_private_t *dev_priv = dev->dev_private;
249 drm_i810_ring_buffer_t *ring = &(dev_priv->ring); 249 drm_i810_ring_buffer_t *ring = &(dev_priv->ring);
@@ -276,7 +276,7 @@ static int i810_wait_ring(drm_device_t * dev, int n)
276 return iters; 276 return iters;
277} 277}
278 278
279static void i810_kernel_lost_context(drm_device_t * dev) 279static void i810_kernel_lost_context(struct drm_device * dev)
280{ 280{
281 drm_i810_private_t *dev_priv = dev->dev_private; 281 drm_i810_private_t *dev_priv = dev->dev_private;
282 drm_i810_ring_buffer_t *ring = &(dev_priv->ring); 282 drm_i810_ring_buffer_t *ring = &(dev_priv->ring);
@@ -288,9 +288,9 @@ static void i810_kernel_lost_context(drm_device_t * dev)
288 ring->space += ring->Size; 288 ring->space += ring->Size;
289} 289}
290 290
291static int i810_freelist_init(drm_device_t * dev, drm_i810_private_t * dev_priv) 291static int i810_freelist_init(struct drm_device * dev, drm_i810_private_t * dev_priv)
292{ 292{
293 drm_device_dma_t *dma = dev->dma; 293 struct drm_device_dma *dma = dev->dma;
294 int my_idx = 24; 294 int my_idx = 24;
295 u32 *hw_status = (u32 *) (dev_priv->hw_status_page + my_idx); 295 u32 *hw_status = (u32 *) (dev_priv->hw_status_page + my_idx);
296 int i; 296 int i;
@@ -301,7 +301,7 @@ static int i810_freelist_init(drm_device_t * dev, drm_i810_private_t * dev_priv)
301 } 301 }
302 302
303 for (i = 0; i < dma->buf_count; i++) { 303 for (i = 0; i < dma->buf_count; i++) {
304 drm_buf_t *buf = dma->buflist[i]; 304 struct drm_buf *buf = dma->buflist[i];
305 drm_i810_buf_priv_t *buf_priv = buf->dev_private; 305 drm_i810_buf_priv_t *buf_priv = buf->dev_private;
306 306
307 buf_priv->in_use = hw_status++; 307 buf_priv->in_use = hw_status++;
@@ -323,16 +323,14 @@ static int i810_freelist_init(drm_device_t * dev, drm_i810_private_t * dev_priv)
323 return 0; 323 return 0;
324} 324}
325 325
326static int i810_dma_initialize(drm_device_t * dev, 326static int i810_dma_initialize(struct drm_device * dev,
327 drm_i810_private_t * dev_priv, 327 drm_i810_private_t * dev_priv,
328 drm_i810_init_t * init) 328 drm_i810_init_t * init)
329{ 329{
330 struct list_head *list; 330 struct drm_map_list *r_list;
331
332 memset(dev_priv, 0, sizeof(drm_i810_private_t)); 331 memset(dev_priv, 0, sizeof(drm_i810_private_t));
333 332
334 list_for_each(list, &dev->maplist->head) { 333 list_for_each_entry(r_list, &dev->maplist, head) {
335 drm_map_list_t *r_list = list_entry(list, drm_map_list_t, head);
336 if (r_list->map && 334 if (r_list->map &&
337 r_list->map->type == _DRM_SHM && 335 r_list->map->type == _DRM_SHM &&
338 r_list->map->flags & _DRM_CONTAINS_LOCK) { 336 r_list->map->flags & _DRM_CONTAINS_LOCK) {
@@ -478,8 +476,8 @@ static int i810_dma_init_compat(drm_i810_init_t * init, unsigned long arg)
478static int i810_dma_init(struct inode *inode, struct file *filp, 476static int i810_dma_init(struct inode *inode, struct file *filp,
479 unsigned int cmd, unsigned long arg) 477 unsigned int cmd, unsigned long arg)
480{ 478{
481 drm_file_t *priv = filp->private_data; 479 struct drm_file *priv = filp->private_data;
482 drm_device_t *dev = priv->head->dev; 480 struct drm_device *dev = priv->head->dev;
483 drm_i810_private_t *dev_priv; 481 drm_i810_private_t *dev_priv;
484 drm_i810_init_t init; 482 drm_i810_init_t init;
485 int retcode = 0; 483 int retcode = 0;
@@ -536,7 +534,7 @@ static int i810_dma_init(struct inode *inode, struct file *filp,
536 * Use 'volatile' & local var tmp to force the emitted values to be 534 * Use 'volatile' & local var tmp to force the emitted values to be
537 * identical to the verified ones. 535 * identical to the verified ones.
538 */ 536 */
539static void i810EmitContextVerified(drm_device_t * dev, 537static void i810EmitContextVerified(struct drm_device * dev,
540 volatile unsigned int *code) 538 volatile unsigned int *code)
541{ 539{
542 drm_i810_private_t *dev_priv = dev->dev_private; 540 drm_i810_private_t *dev_priv = dev->dev_private;
@@ -569,7 +567,7 @@ static void i810EmitContextVerified(drm_device_t * dev,
569 ADVANCE_LP_RING(); 567 ADVANCE_LP_RING();
570} 568}
571 569
572static void i810EmitTexVerified(drm_device_t * dev, volatile unsigned int *code) 570static void i810EmitTexVerified(struct drm_device * dev, volatile unsigned int *code)
573{ 571{
574 drm_i810_private_t *dev_priv = dev->dev_private; 572 drm_i810_private_t *dev_priv = dev->dev_private;
575 int i, j = 0; 573 int i, j = 0;
@@ -602,7 +600,7 @@ static void i810EmitTexVerified(drm_device_t * dev, volatile unsigned int *code)
602 600
603/* Need to do some additional checking when setting the dest buffer. 601/* Need to do some additional checking when setting the dest buffer.
604 */ 602 */
605static void i810EmitDestVerified(drm_device_t * dev, 603static void i810EmitDestVerified(struct drm_device * dev,
606 volatile unsigned int *code) 604 volatile unsigned int *code)
607{ 605{
608 drm_i810_private_t *dev_priv = dev->dev_private; 606 drm_i810_private_t *dev_priv = dev->dev_private;
@@ -637,7 +635,7 @@ static void i810EmitDestVerified(drm_device_t * dev,
637 ADVANCE_LP_RING(); 635 ADVANCE_LP_RING();
638} 636}
639 637
640static void i810EmitState(drm_device_t * dev) 638static void i810EmitState(struct drm_device * dev)
641{ 639{
642 drm_i810_private_t *dev_priv = dev->dev_private; 640 drm_i810_private_t *dev_priv = dev->dev_private;
643 drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv; 641 drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv;
@@ -668,14 +666,14 @@ static void i810EmitState(drm_device_t * dev)
668 666
669/* need to verify 667/* need to verify
670 */ 668 */
671static void i810_dma_dispatch_clear(drm_device_t * dev, int flags, 669static void i810_dma_dispatch_clear(struct drm_device * dev, int flags,
672 unsigned int clear_color, 670 unsigned int clear_color,
673 unsigned int clear_zval) 671 unsigned int clear_zval)
674{ 672{
675 drm_i810_private_t *dev_priv = dev->dev_private; 673 drm_i810_private_t *dev_priv = dev->dev_private;
676 drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv; 674 drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv;
677 int nbox = sarea_priv->nbox; 675 int nbox = sarea_priv->nbox;
678 drm_clip_rect_t *pbox = sarea_priv->boxes; 676 struct drm_clip_rect *pbox = sarea_priv->boxes;
679 int pitch = dev_priv->pitch; 677 int pitch = dev_priv->pitch;
680 int cpp = 2; 678 int cpp = 2;
681 int i; 679 int i;
@@ -743,12 +741,12 @@ static void i810_dma_dispatch_clear(drm_device_t * dev, int flags,
743 } 741 }
744} 742}
745 743
746static void i810_dma_dispatch_swap(drm_device_t * dev) 744static void i810_dma_dispatch_swap(struct drm_device * dev)
747{ 745{
748 drm_i810_private_t *dev_priv = dev->dev_private; 746 drm_i810_private_t *dev_priv = dev->dev_private;
749 drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv; 747 drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv;
750 int nbox = sarea_priv->nbox; 748 int nbox = sarea_priv->nbox;
751 drm_clip_rect_t *pbox = sarea_priv->boxes; 749 struct drm_clip_rect *pbox = sarea_priv->boxes;
752 int pitch = dev_priv->pitch; 750 int pitch = dev_priv->pitch;
753 int cpp = 2; 751 int cpp = 2;
754 int i; 752 int i;
@@ -789,13 +787,13 @@ static void i810_dma_dispatch_swap(drm_device_t * dev)
789 } 787 }
790} 788}
791 789
792static void i810_dma_dispatch_vertex(drm_device_t * dev, 790static void i810_dma_dispatch_vertex(struct drm_device * dev,
793 drm_buf_t * buf, int discard, int used) 791 struct drm_buf * buf, int discard, int used)
794{ 792{
795 drm_i810_private_t *dev_priv = dev->dev_private; 793 drm_i810_private_t *dev_priv = dev->dev_private;
796 drm_i810_buf_priv_t *buf_priv = buf->dev_private; 794 drm_i810_buf_priv_t *buf_priv = buf->dev_private;
797 drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv; 795 drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv;
798 drm_clip_rect_t *box = sarea_priv->boxes; 796 struct drm_clip_rect *box = sarea_priv->boxes;
799 int nbox = sarea_priv->nbox; 797 int nbox = sarea_priv->nbox;
800 unsigned long address = (unsigned long)buf->bus_address; 798 unsigned long address = (unsigned long)buf->bus_address;
801 unsigned long start = address - dev->agp->base; 799 unsigned long start = address - dev->agp->base;
@@ -869,7 +867,7 @@ static void i810_dma_dispatch_vertex(drm_device_t * dev,
869 } 867 }
870} 868}
871 869
872static void i810_dma_dispatch_flip(drm_device_t * dev) 870static void i810_dma_dispatch_flip(struct drm_device * dev)
873{ 871{
874 drm_i810_private_t *dev_priv = dev->dev_private; 872 drm_i810_private_t *dev_priv = dev->dev_private;
875 int pitch = dev_priv->pitch; 873 int pitch = dev_priv->pitch;
@@ -916,7 +914,7 @@ static void i810_dma_dispatch_flip(drm_device_t * dev)
916 914
917} 915}
918 916
919static void i810_dma_quiescent(drm_device_t * dev) 917static void i810_dma_quiescent(struct drm_device * dev)
920{ 918{
921 drm_i810_private_t *dev_priv = dev->dev_private; 919 drm_i810_private_t *dev_priv = dev->dev_private;
922 RING_LOCALS; 920 RING_LOCALS;
@@ -935,10 +933,10 @@ static void i810_dma_quiescent(drm_device_t * dev)
935 i810_wait_ring(dev, dev_priv->ring.Size - 8); 933 i810_wait_ring(dev, dev_priv->ring.Size - 8);
936} 934}
937 935
938static int i810_flush_queue(drm_device_t * dev) 936static int i810_flush_queue(struct drm_device * dev)
939{ 937{
940 drm_i810_private_t *dev_priv = dev->dev_private; 938 drm_i810_private_t *dev_priv = dev->dev_private;
941 drm_device_dma_t *dma = dev->dma; 939 struct drm_device_dma *dma = dev->dma;
942 int i, ret = 0; 940 int i, ret = 0;
943 RING_LOCALS; 941 RING_LOCALS;
944 942
@@ -954,7 +952,7 @@ static int i810_flush_queue(drm_device_t * dev)
954 i810_wait_ring(dev, dev_priv->ring.Size - 8); 952 i810_wait_ring(dev, dev_priv->ring.Size - 8);
955 953
956 for (i = 0; i < dma->buf_count; i++) { 954 for (i = 0; i < dma->buf_count; i++) {
957 drm_buf_t *buf = dma->buflist[i]; 955 struct drm_buf *buf = dma->buflist[i];
958 drm_i810_buf_priv_t *buf_priv = buf->dev_private; 956 drm_i810_buf_priv_t *buf_priv = buf->dev_private;
959 957
960 int used = cmpxchg(buf_priv->in_use, I810_BUF_HARDWARE, 958 int used = cmpxchg(buf_priv->in_use, I810_BUF_HARDWARE,
@@ -970,9 +968,9 @@ static int i810_flush_queue(drm_device_t * dev)
970} 968}
971 969
972/* Must be called with the lock held */ 970/* Must be called with the lock held */
973static void i810_reclaim_buffers(drm_device_t * dev, struct file *filp) 971static void i810_reclaim_buffers(struct drm_device * dev, struct file *filp)
974{ 972{
975 drm_device_dma_t *dma = dev->dma; 973 struct drm_device_dma *dma = dev->dma;
976 int i; 974 int i;
977 975
978 if (!dma) 976 if (!dma)
@@ -985,7 +983,7 @@ static void i810_reclaim_buffers(drm_device_t * dev, struct file *filp)
985 i810_flush_queue(dev); 983 i810_flush_queue(dev);
986 984
987 for (i = 0; i < dma->buf_count; i++) { 985 for (i = 0; i < dma->buf_count; i++) {
988 drm_buf_t *buf = dma->buflist[i]; 986 struct drm_buf *buf = dma->buflist[i];
989 drm_i810_buf_priv_t *buf_priv = buf->dev_private; 987 drm_i810_buf_priv_t *buf_priv = buf->dev_private;
990 988
991 if (buf->filp == filp && buf_priv) { 989 if (buf->filp == filp && buf_priv) {
@@ -1003,8 +1001,8 @@ static void i810_reclaim_buffers(drm_device_t * dev, struct file *filp)
1003static int i810_flush_ioctl(struct inode *inode, struct file *filp, 1001static int i810_flush_ioctl(struct inode *inode, struct file *filp,
1004 unsigned int cmd, unsigned long arg) 1002 unsigned int cmd, unsigned long arg)
1005{ 1003{
1006 drm_file_t *priv = filp->private_data; 1004 struct drm_file *priv = filp->private_data;
1007 drm_device_t *dev = priv->head->dev; 1005 struct drm_device *dev = priv->head->dev;
1008 1006
1009 LOCK_TEST_WITH_RETURN(dev, filp); 1007 LOCK_TEST_WITH_RETURN(dev, filp);
1010 1008
@@ -1015,9 +1013,9 @@ static int i810_flush_ioctl(struct inode *inode, struct file *filp,
1015static int i810_dma_vertex(struct inode *inode, struct file *filp, 1013static int i810_dma_vertex(struct inode *inode, struct file *filp,
1016 unsigned int cmd, unsigned long arg) 1014 unsigned int cmd, unsigned long arg)
1017{ 1015{
1018 drm_file_t *priv = filp->private_data; 1016 struct drm_file *priv = filp->private_data;
1019 drm_device_t *dev = priv->head->dev; 1017 struct drm_device *dev = priv->head->dev;
1020 drm_device_dma_t *dma = dev->dma; 1018 struct drm_device_dma *dma = dev->dma;
1021 drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private; 1019 drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private;
1022 u32 *hw_status = dev_priv->hw_status_page; 1020 u32 *hw_status = dev_priv->hw_status_page;
1023 drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) 1021 drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *)
@@ -1051,8 +1049,8 @@ static int i810_dma_vertex(struct inode *inode, struct file *filp,
1051static int i810_clear_bufs(struct inode *inode, struct file *filp, 1049static int i810_clear_bufs(struct inode *inode, struct file *filp,
1052 unsigned int cmd, unsigned long arg) 1050 unsigned int cmd, unsigned long arg)
1053{ 1051{
1054 drm_file_t *priv = filp->private_data; 1052 struct drm_file *priv = filp->private_data;
1055 drm_device_t *dev = priv->head->dev; 1053 struct drm_device *dev = priv->head->dev;
1056 drm_i810_clear_t clear; 1054 drm_i810_clear_t clear;
1057 1055
1058 if (copy_from_user 1056 if (copy_from_user
@@ -1074,8 +1072,8 @@ static int i810_clear_bufs(struct inode *inode, struct file *filp,
1074static int i810_swap_bufs(struct inode *inode, struct file *filp, 1072static int i810_swap_bufs(struct inode *inode, struct file *filp,
1075 unsigned int cmd, unsigned long arg) 1073 unsigned int cmd, unsigned long arg)
1076{ 1074{
1077 drm_file_t *priv = filp->private_data; 1075 struct drm_file *priv = filp->private_data;
1078 drm_device_t *dev = priv->head->dev; 1076 struct drm_device *dev = priv->head->dev;
1079 1077
1080 DRM_DEBUG("i810_swap_bufs\n"); 1078 DRM_DEBUG("i810_swap_bufs\n");
1081 1079
@@ -1088,8 +1086,8 @@ static int i810_swap_bufs(struct inode *inode, struct file *filp,
1088static int i810_getage(struct inode *inode, struct file *filp, unsigned int cmd, 1086static int i810_getage(struct inode *inode, struct file *filp, unsigned int cmd,
1089 unsigned long arg) 1087 unsigned long arg)
1090{ 1088{
1091 drm_file_t *priv = filp->private_data; 1089 struct drm_file *priv = filp->private_data;
1092 drm_device_t *dev = priv->head->dev; 1090 struct drm_device *dev = priv->head->dev;
1093 drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private; 1091 drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private;
1094 u32 *hw_status = dev_priv->hw_status_page; 1092 u32 *hw_status = dev_priv->hw_status_page;
1095 drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) 1093 drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *)
@@ -1102,8 +1100,8 @@ static int i810_getage(struct inode *inode, struct file *filp, unsigned int cmd,
1102static int i810_getbuf(struct inode *inode, struct file *filp, unsigned int cmd, 1100static int i810_getbuf(struct inode *inode, struct file *filp, unsigned int cmd,
1103 unsigned long arg) 1101 unsigned long arg)
1104{ 1102{
1105 drm_file_t *priv = filp->private_data; 1103 struct drm_file *priv = filp->private_data;
1106 drm_device_t *dev = priv->head->dev; 1104 struct drm_device *dev = priv->head->dev;
1107 int retcode = 0; 1105 int retcode = 0;
1108 drm_i810_dma_t d; 1106 drm_i810_dma_t d;
1109 drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private; 1107 drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private;
@@ -1123,7 +1121,7 @@ static int i810_getbuf(struct inode *inode, struct file *filp, unsigned int cmd,
1123 DRM_DEBUG("i810_dma: %d returning %d, granted = %d\n", 1121 DRM_DEBUG("i810_dma: %d returning %d, granted = %d\n",
1124 current->pid, retcode, d.granted); 1122 current->pid, retcode, d.granted);
1125 1123
1126 if (copy_to_user((drm_dma_t __user *) arg, &d, sizeof(d))) 1124 if (copy_to_user((void __user *) arg, &d, sizeof(d)))
1127 return -EFAULT; 1125 return -EFAULT;
1128 sarea_priv->last_dispatch = (int)hw_status[5]; 1126 sarea_priv->last_dispatch = (int)hw_status[5];
1129 1127
@@ -1144,7 +1142,7 @@ static int i810_docopy(struct inode *inode, struct file *filp, unsigned int cmd,
1144 return 0; 1142 return 0;
1145} 1143}
1146 1144
1147static void i810_dma_dispatch_mc(drm_device_t * dev, drm_buf_t * buf, int used, 1145static void i810_dma_dispatch_mc(struct drm_device * dev, struct drm_buf * buf, int used,
1148 unsigned int last_render) 1146 unsigned int last_render)
1149{ 1147{
1150 drm_i810_private_t *dev_priv = dev->dev_private; 1148 drm_i810_private_t *dev_priv = dev->dev_private;
@@ -1207,9 +1205,9 @@ static void i810_dma_dispatch_mc(drm_device_t * dev, drm_buf_t * buf, int used,
1207static int i810_dma_mc(struct inode *inode, struct file *filp, 1205static int i810_dma_mc(struct inode *inode, struct file *filp,
1208 unsigned int cmd, unsigned long arg) 1206 unsigned int cmd, unsigned long arg)
1209{ 1207{
1210 drm_file_t *priv = filp->private_data; 1208 struct drm_file *priv = filp->private_data;
1211 drm_device_t *dev = priv->head->dev; 1209 struct drm_device *dev = priv->head->dev;
1212 drm_device_dma_t *dma = dev->dma; 1210 struct drm_device_dma *dma = dev->dma;
1213 drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private; 1211 drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private;
1214 u32 *hw_status = dev_priv->hw_status_page; 1212 u32 *hw_status = dev_priv->hw_status_page;
1215 drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) 1213 drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *)
@@ -1238,8 +1236,8 @@ static int i810_dma_mc(struct inode *inode, struct file *filp,
1238static int i810_rstatus(struct inode *inode, struct file *filp, 1236static int i810_rstatus(struct inode *inode, struct file *filp,
1239 unsigned int cmd, unsigned long arg) 1237 unsigned int cmd, unsigned long arg)
1240{ 1238{
1241 drm_file_t *priv = filp->private_data; 1239 struct drm_file *priv = filp->private_data;
1242 drm_device_t *dev = priv->head->dev; 1240 struct drm_device *dev = priv->head->dev;
1243 drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private; 1241 drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private;
1244 1242
1245 return (int)(((u32 *) (dev_priv->hw_status_page))[4]); 1243 return (int)(((u32 *) (dev_priv->hw_status_page))[4]);
@@ -1248,8 +1246,8 @@ static int i810_rstatus(struct inode *inode, struct file *filp,
1248static int i810_ov0_info(struct inode *inode, struct file *filp, 1246static int i810_ov0_info(struct inode *inode, struct file *filp,
1249 unsigned int cmd, unsigned long arg) 1247 unsigned int cmd, unsigned long arg)
1250{ 1248{
1251 drm_file_t *priv = filp->private_data; 1249 struct drm_file *priv = filp->private_data;
1252 drm_device_t *dev = priv->head->dev; 1250 struct drm_device *dev = priv->head->dev;
1253 drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private; 1251 drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private;
1254 drm_i810_overlay_t data; 1252 drm_i810_overlay_t data;
1255 1253
@@ -1264,8 +1262,8 @@ static int i810_ov0_info(struct inode *inode, struct file *filp,
1264static int i810_fstatus(struct inode *inode, struct file *filp, 1262static int i810_fstatus(struct inode *inode, struct file *filp,
1265 unsigned int cmd, unsigned long arg) 1263 unsigned int cmd, unsigned long arg)
1266{ 1264{
1267 drm_file_t *priv = filp->private_data; 1265 struct drm_file *priv = filp->private_data;
1268 drm_device_t *dev = priv->head->dev; 1266 struct drm_device *dev = priv->head->dev;
1269 drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private; 1267 drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private;
1270 1268
1271 LOCK_TEST_WITH_RETURN(dev, filp); 1269 LOCK_TEST_WITH_RETURN(dev, filp);
@@ -1276,8 +1274,8 @@ static int i810_fstatus(struct inode *inode, struct file *filp,
1276static int i810_ov0_flip(struct inode *inode, struct file *filp, 1274static int i810_ov0_flip(struct inode *inode, struct file *filp,
1277 unsigned int cmd, unsigned long arg) 1275 unsigned int cmd, unsigned long arg)
1278{ 1276{
1279 drm_file_t *priv = filp->private_data; 1277 struct drm_file *priv = filp->private_data;
1280 drm_device_t *dev = priv->head->dev; 1278 struct drm_device *dev = priv->head->dev;
1281 drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private; 1279 drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private;
1282 1280
1283 LOCK_TEST_WITH_RETURN(dev, filp); 1281 LOCK_TEST_WITH_RETURN(dev, filp);
@@ -1290,7 +1288,7 @@ static int i810_ov0_flip(struct inode *inode, struct file *filp,
1290 1288
1291/* Not sure why this isn't set all the time: 1289/* Not sure why this isn't set all the time:
1292 */ 1290 */
1293static void i810_do_init_pageflip(drm_device_t * dev) 1291static void i810_do_init_pageflip(struct drm_device * dev)
1294{ 1292{
1295 drm_i810_private_t *dev_priv = dev->dev_private; 1293 drm_i810_private_t *dev_priv = dev->dev_private;
1296 1294
@@ -1300,7 +1298,7 @@ static void i810_do_init_pageflip(drm_device_t * dev)
1300 dev_priv->sarea_priv->pf_current_page = dev_priv->current_page; 1298 dev_priv->sarea_priv->pf_current_page = dev_priv->current_page;
1301} 1299}
1302 1300
1303static int i810_do_cleanup_pageflip(drm_device_t * dev) 1301static int i810_do_cleanup_pageflip(struct drm_device * dev)
1304{ 1302{
1305 drm_i810_private_t *dev_priv = dev->dev_private; 1303 drm_i810_private_t *dev_priv = dev->dev_private;
1306 1304
@@ -1315,8 +1313,8 @@ static int i810_do_cleanup_pageflip(drm_device_t * dev)
1315static int i810_flip_bufs(struct inode *inode, struct file *filp, 1313static int i810_flip_bufs(struct inode *inode, struct file *filp,
1316 unsigned int cmd, unsigned long arg) 1314 unsigned int cmd, unsigned long arg)
1317{ 1315{
1318 drm_file_t *priv = filp->private_data; 1316 struct drm_file *priv = filp->private_data;
1319 drm_device_t *dev = priv->head->dev; 1317 struct drm_device *dev = priv->head->dev;
1320 drm_i810_private_t *dev_priv = dev->dev_private; 1318 drm_i810_private_t *dev_priv = dev->dev_private;
1321 1319
1322 DRM_DEBUG("%s\n", __FUNCTION__); 1320 DRM_DEBUG("%s\n", __FUNCTION__);
@@ -1330,7 +1328,7 @@ static int i810_flip_bufs(struct inode *inode, struct file *filp,
1330 return 0; 1328 return 0;
1331} 1329}
1332 1330
1333int i810_driver_load(drm_device_t *dev, unsigned long flags) 1331int i810_driver_load(struct drm_device *dev, unsigned long flags)
1334{ 1332{
1335 /* i810 has 4 more counters */ 1333 /* i810 has 4 more counters */
1336 dev->counters += 4; 1334 dev->counters += 4;
@@ -1342,12 +1340,12 @@ int i810_driver_load(drm_device_t *dev, unsigned long flags)
1342 return 0; 1340 return 0;
1343} 1341}
1344 1342
1345void i810_driver_lastclose(drm_device_t * dev) 1343void i810_driver_lastclose(struct drm_device * dev)
1346{ 1344{
1347 i810_dma_cleanup(dev); 1345 i810_dma_cleanup(dev);
1348} 1346}
1349 1347
1350void i810_driver_preclose(drm_device_t * dev, DRMFILE filp) 1348void i810_driver_preclose(struct drm_device * dev, DRMFILE filp)
1351{ 1349{
1352 if (dev->dev_private) { 1350 if (dev->dev_private) {
1353 drm_i810_private_t *dev_priv = dev->dev_private; 1351 drm_i810_private_t *dev_priv = dev->dev_private;
@@ -1357,12 +1355,12 @@ void i810_driver_preclose(drm_device_t * dev, DRMFILE filp)
1357 } 1355 }
1358} 1356}
1359 1357
1360void i810_driver_reclaim_buffers_locked(drm_device_t * dev, struct file *filp) 1358void i810_driver_reclaim_buffers_locked(struct drm_device * dev, struct file *filp)
1361{ 1359{
1362 i810_reclaim_buffers(dev, filp); 1360 i810_reclaim_buffers(dev, filp);
1363} 1361}
1364 1362
1365int i810_driver_dma_quiescent(drm_device_t * dev) 1363int i810_driver_dma_quiescent(struct drm_device * dev)
1366{ 1364{
1367 i810_dma_quiescent(dev); 1365 i810_dma_quiescent(dev);
1368 return 0; 1366 return 0;
@@ -1399,7 +1397,7 @@ int i810_max_ioctl = DRM_ARRAY_SIZE(i810_ioctls);
1399 * \returns 1397 * \returns
1400 * A value of 1 is always retured to indictate every i810 is AGP. 1398 * A value of 1 is always retured to indictate every i810 is AGP.
1401 */ 1399 */
1402int i810_driver_device_is_agp(drm_device_t * dev) 1400int i810_driver_device_is_agp(struct drm_device * dev)
1403{ 1401{
1404 return 1; 1402 return 1;
1405} 1403}
diff --git a/drivers/char/drm/i810_drm.h b/drivers/char/drm/i810_drm.h
index 2deb925a94f3..614977dbce45 100644
--- a/drivers/char/drm/i810_drm.h
+++ b/drivers/char/drm/i810_drm.h
@@ -158,7 +158,7 @@ typedef struct _drm_i810_sarea {
158 unsigned int dirty; 158 unsigned int dirty;
159 159
160 unsigned int nbox; 160 unsigned int nbox;
161 drm_clip_rect_t boxes[I810_NR_SAREA_CLIPRECTS]; 161 struct drm_clip_rect boxes[I810_NR_SAREA_CLIPRECTS];
162 162
163 /* Maintain an LRU of contiguous regions of texture space. If 163 /* Maintain an LRU of contiguous regions of texture space. If
164 * you think you own a region of texture memory, and it has an 164 * you think you own a region of texture memory, and it has an
diff --git a/drivers/char/drm/i810_drv.h b/drivers/char/drm/i810_drv.h
index e6df49f4928a..648833844c7f 100644
--- a/drivers/char/drm/i810_drv.h
+++ b/drivers/char/drm/i810_drv.h
@@ -77,8 +77,8 @@ typedef struct _drm_i810_ring_buffer {
77} drm_i810_ring_buffer_t; 77} drm_i810_ring_buffer_t;
78 78
79typedef struct drm_i810_private { 79typedef struct drm_i810_private {
80 drm_map_t *sarea_map; 80 struct drm_map *sarea_map;
81 drm_map_t *mmio_map; 81 struct drm_map *mmio_map;
82 82
83 drm_i810_sarea_t *sarea_priv; 83 drm_i810_sarea_t *sarea_priv;
84 drm_i810_ring_buffer_t ring; 84 drm_i810_ring_buffer_t ring;
@@ -88,7 +88,7 @@ typedef struct drm_i810_private {
88 88
89 dma_addr_t dma_status_page; 89 dma_addr_t dma_status_page;
90 90
91 drm_buf_t *mmap_buffer; 91 struct drm_buf *mmap_buffer;
92 92
93 u32 front_di1, back_di1, zi1; 93 u32 front_di1, back_di1, zi1;
94 94
@@ -115,15 +115,15 @@ typedef struct drm_i810_private {
115} drm_i810_private_t; 115} drm_i810_private_t;
116 116
117 /* i810_dma.c */ 117 /* i810_dma.c */
118extern int i810_driver_dma_quiescent(drm_device_t * dev); 118extern int i810_driver_dma_quiescent(struct drm_device * dev);
119extern void i810_driver_reclaim_buffers_locked(drm_device_t * dev, 119extern void i810_driver_reclaim_buffers_locked(struct drm_device * dev,
120 struct file *filp); 120 struct file *filp);
121extern int i810_driver_load(struct drm_device *, unsigned long flags); 121extern int i810_driver_load(struct drm_device *, unsigned long flags);
122extern void i810_driver_lastclose(drm_device_t * dev); 122extern void i810_driver_lastclose(struct drm_device * dev);
123extern void i810_driver_preclose(drm_device_t * dev, DRMFILE filp); 123extern void i810_driver_preclose(struct drm_device * dev, DRMFILE filp);
124extern void i810_driver_reclaim_buffers_locked(drm_device_t * dev, 124extern void i810_driver_reclaim_buffers_locked(struct drm_device * dev,
125 struct file *filp); 125 struct file *filp);
126extern int i810_driver_device_is_agp(drm_device_t * dev); 126extern int i810_driver_device_is_agp(struct drm_device * dev);
127 127
128extern drm_ioctl_desc_t i810_ioctls[]; 128extern drm_ioctl_desc_t i810_ioctls[];
129extern int i810_max_ioctl; 129extern int i810_max_ioctl;
diff --git a/drivers/char/drm/i830_dma.c b/drivers/char/drm/i830_dma.c
index 3314a9fea9e5..dc20c1a7834e 100644
--- a/drivers/char/drm/i830_dma.c
+++ b/drivers/char/drm/i830_dma.c
@@ -47,16 +47,16 @@
47#define I830_BUF_UNMAPPED 0 47#define I830_BUF_UNMAPPED 0
48#define I830_BUF_MAPPED 1 48#define I830_BUF_MAPPED 1
49 49
50static drm_buf_t *i830_freelist_get(drm_device_t * dev) 50static struct drm_buf *i830_freelist_get(struct drm_device * dev)
51{ 51{
52 drm_device_dma_t *dma = dev->dma; 52 struct drm_device_dma *dma = dev->dma;
53 int i; 53 int i;
54 int used; 54 int used;
55 55
56 /* Linear search might not be the best solution */ 56 /* Linear search might not be the best solution */
57 57
58 for (i = 0; i < dma->buf_count; i++) { 58 for (i = 0; i < dma->buf_count; i++) {
59 drm_buf_t *buf = dma->buflist[i]; 59 struct drm_buf *buf = dma->buflist[i];
60 drm_i830_buf_priv_t *buf_priv = buf->dev_private; 60 drm_i830_buf_priv_t *buf_priv = buf->dev_private;
61 /* In use is already a pointer */ 61 /* In use is already a pointer */
62 used = cmpxchg(buf_priv->in_use, I830_BUF_FREE, 62 used = cmpxchg(buf_priv->in_use, I830_BUF_FREE,
@@ -72,7 +72,7 @@ static drm_buf_t *i830_freelist_get(drm_device_t * dev)
72 * yet, the hardware updates in use for us once its on the ring buffer. 72 * yet, the hardware updates in use for us once its on the ring buffer.
73 */ 73 */
74 74
75static int i830_freelist_put(drm_device_t * dev, drm_buf_t * buf) 75static int i830_freelist_put(struct drm_device * dev, struct drm_buf * buf)
76{ 76{
77 drm_i830_buf_priv_t *buf_priv = buf->dev_private; 77 drm_i830_buf_priv_t *buf_priv = buf->dev_private;
78 int used; 78 int used;
@@ -89,10 +89,10 @@ static int i830_freelist_put(drm_device_t * dev, drm_buf_t * buf)
89 89
90static int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma) 90static int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
91{ 91{
92 drm_file_t *priv = filp->private_data; 92 struct drm_file *priv = filp->private_data;
93 drm_device_t *dev; 93 struct drm_device *dev;
94 drm_i830_private_t *dev_priv; 94 drm_i830_private_t *dev_priv;
95 drm_buf_t *buf; 95 struct drm_buf *buf;
96 drm_i830_buf_priv_t *buf_priv; 96 drm_i830_buf_priv_t *buf_priv;
97 97
98 lock_kernel(); 98 lock_kernel();
@@ -122,10 +122,10 @@ static const struct file_operations i830_buffer_fops = {
122 .fasync = drm_fasync, 122 .fasync = drm_fasync,
123}; 123};
124 124
125static int i830_map_buffer(drm_buf_t * buf, struct file *filp) 125static int i830_map_buffer(struct drm_buf * buf, struct file *filp)
126{ 126{
127 drm_file_t *priv = filp->private_data; 127 struct drm_file *priv = filp->private_data;
128 drm_device_t *dev = priv->head->dev; 128 struct drm_device *dev = priv->head->dev;
129 drm_i830_buf_priv_t *buf_priv = buf->dev_private; 129 drm_i830_buf_priv_t *buf_priv = buf->dev_private;
130 drm_i830_private_t *dev_priv = dev->dev_private; 130 drm_i830_private_t *dev_priv = dev->dev_private;
131 const struct file_operations *old_fops; 131 const struct file_operations *old_fops;
@@ -156,7 +156,7 @@ static int i830_map_buffer(drm_buf_t * buf, struct file *filp)
156 return retcode; 156 return retcode;
157} 157}
158 158
159static int i830_unmap_buffer(drm_buf_t * buf) 159static int i830_unmap_buffer(struct drm_buf * buf)
160{ 160{
161 drm_i830_buf_priv_t *buf_priv = buf->dev_private; 161 drm_i830_buf_priv_t *buf_priv = buf->dev_private;
162 int retcode = 0; 162 int retcode = 0;
@@ -176,10 +176,10 @@ static int i830_unmap_buffer(drm_buf_t * buf)
176 return retcode; 176 return retcode;
177} 177}
178 178
179static int i830_dma_get_buffer(drm_device_t * dev, drm_i830_dma_t * d, 179static int i830_dma_get_buffer(struct drm_device * dev, drm_i830_dma_t * d,
180 struct file *filp) 180 struct file *filp)
181{ 181{
182 drm_buf_t *buf; 182 struct drm_buf *buf;
183 drm_i830_buf_priv_t *buf_priv; 183 drm_i830_buf_priv_t *buf_priv;
184 int retcode = 0; 184 int retcode = 0;
185 185
@@ -206,9 +206,9 @@ static int i830_dma_get_buffer(drm_device_t * dev, drm_i830_dma_t * d,
206 return retcode; 206 return retcode;
207} 207}
208 208
209static int i830_dma_cleanup(drm_device_t * dev) 209static int i830_dma_cleanup(struct drm_device * dev)
210{ 210{
211 drm_device_dma_t *dma = dev->dma; 211 struct drm_device_dma *dma = dev->dma;
212 212
213 /* Make sure interrupts are disabled here because the uninstall ioctl 213 /* Make sure interrupts are disabled here because the uninstall ioctl
214 * may not have been called from userspace and after dev_private 214 * may not have been called from userspace and after dev_private
@@ -238,7 +238,7 @@ static int i830_dma_cleanup(drm_device_t * dev)
238 dev->dev_private = NULL; 238 dev->dev_private = NULL;
239 239
240 for (i = 0; i < dma->buf_count; i++) { 240 for (i = 0; i < dma->buf_count; i++) {
241 drm_buf_t *buf = dma->buflist[i]; 241 struct drm_buf *buf = dma->buflist[i];
242 drm_i830_buf_priv_t *buf_priv = buf->dev_private; 242 drm_i830_buf_priv_t *buf_priv = buf->dev_private;
243 if (buf_priv->kernel_virtual && buf->total) 243 if (buf_priv->kernel_virtual && buf->total)
244 drm_core_ioremapfree(&buf_priv->map, dev); 244 drm_core_ioremapfree(&buf_priv->map, dev);
@@ -247,7 +247,7 @@ static int i830_dma_cleanup(drm_device_t * dev)
247 return 0; 247 return 0;
248} 248}
249 249
250int i830_wait_ring(drm_device_t * dev, int n, const char *caller) 250int i830_wait_ring(struct drm_device * dev, int n, const char *caller)
251{ 251{
252 drm_i830_private_t *dev_priv = dev->dev_private; 252 drm_i830_private_t *dev_priv = dev->dev_private;
253 drm_i830_ring_buffer_t *ring = &(dev_priv->ring); 253 drm_i830_ring_buffer_t *ring = &(dev_priv->ring);
@@ -281,7 +281,7 @@ int i830_wait_ring(drm_device_t * dev, int n, const char *caller)
281 return iters; 281 return iters;
282} 282}
283 283
284static void i830_kernel_lost_context(drm_device_t * dev) 284static void i830_kernel_lost_context(struct drm_device * dev)
285{ 285{
286 drm_i830_private_t *dev_priv = dev->dev_private; 286 drm_i830_private_t *dev_priv = dev->dev_private;
287 drm_i830_ring_buffer_t *ring = &(dev_priv->ring); 287 drm_i830_ring_buffer_t *ring = &(dev_priv->ring);
@@ -296,9 +296,9 @@ static void i830_kernel_lost_context(drm_device_t * dev)
296 dev_priv->sarea_priv->perf_boxes |= I830_BOX_RING_EMPTY; 296 dev_priv->sarea_priv->perf_boxes |= I830_BOX_RING_EMPTY;
297} 297}
298 298
299static int i830_freelist_init(drm_device_t * dev, drm_i830_private_t * dev_priv) 299static int i830_freelist_init(struct drm_device * dev, drm_i830_private_t * dev_priv)
300{ 300{
301 drm_device_dma_t *dma = dev->dma; 301 struct drm_device_dma *dma = dev->dma;
302 int my_idx = 36; 302 int my_idx = 36;
303 u32 *hw_status = (u32 *) (dev_priv->hw_status_page + my_idx); 303 u32 *hw_status = (u32 *) (dev_priv->hw_status_page + my_idx);
304 int i; 304 int i;
@@ -309,7 +309,7 @@ static int i830_freelist_init(drm_device_t * dev, drm_i830_private_t * dev_priv)
309 } 309 }
310 310
311 for (i = 0; i < dma->buf_count; i++) { 311 for (i = 0; i < dma->buf_count; i++) {
312 drm_buf_t *buf = dma->buflist[i]; 312 struct drm_buf *buf = dma->buflist[i];
313 drm_i830_buf_priv_t *buf_priv = buf->dev_private; 313 drm_i830_buf_priv_t *buf_priv = buf->dev_private;
314 314
315 buf_priv->in_use = hw_status++; 315 buf_priv->in_use = hw_status++;
@@ -330,16 +330,15 @@ static int i830_freelist_init(drm_device_t * dev, drm_i830_private_t * dev_priv)
330 return 0; 330 return 0;
331} 331}
332 332
333static int i830_dma_initialize(drm_device_t * dev, 333static int i830_dma_initialize(struct drm_device * dev,
334 drm_i830_private_t * dev_priv, 334 drm_i830_private_t * dev_priv,
335 drm_i830_init_t * init) 335 drm_i830_init_t * init)
336{ 336{
337 struct list_head *list; 337 struct drm_map_list *r_list;
338 338
339 memset(dev_priv, 0, sizeof(drm_i830_private_t)); 339 memset(dev_priv, 0, sizeof(drm_i830_private_t));
340 340
341 list_for_each(list, &dev->maplist->head) { 341 list_for_each_entry(r_list, &dev->maplist, head) {
342 drm_map_list_t *r_list = list_entry(list, drm_map_list_t, head);
343 if (r_list->map && 342 if (r_list->map &&
344 r_list->map->type == _DRM_SHM && 343 r_list->map->type == _DRM_SHM &&
345 r_list->map->flags & _DRM_CONTAINS_LOCK) { 344 r_list->map->flags & _DRM_CONTAINS_LOCK) {
@@ -455,8 +454,8 @@ static int i830_dma_initialize(drm_device_t * dev,
455static int i830_dma_init(struct inode *inode, struct file *filp, 454static int i830_dma_init(struct inode *inode, struct file *filp,
456 unsigned int cmd, unsigned long arg) 455 unsigned int cmd, unsigned long arg)
457{ 456{
458 drm_file_t *priv = filp->private_data; 457 struct drm_file *priv = filp->private_data;
459 drm_device_t *dev = priv->head->dev; 458 struct drm_device *dev = priv->head->dev;
460 drm_i830_private_t *dev_priv; 459 drm_i830_private_t *dev_priv;
461 drm_i830_init_t init; 460 drm_i830_init_t init;
462 int retcode = 0; 461 int retcode = 0;
@@ -490,7 +489,7 @@ static int i830_dma_init(struct inode *inode, struct file *filp,
490/* Most efficient way to verify state for the i830 is as it is 489/* Most efficient way to verify state for the i830 is as it is
491 * emitted. Non-conformant state is silently dropped. 490 * emitted. Non-conformant state is silently dropped.
492 */ 491 */
493static void i830EmitContextVerified(drm_device_t * dev, unsigned int *code) 492static void i830EmitContextVerified(struct drm_device * dev, unsigned int *code)
494{ 493{
495 drm_i830_private_t *dev_priv = dev->dev_private; 494 drm_i830_private_t *dev_priv = dev->dev_private;
496 int i, j = 0; 495 int i, j = 0;
@@ -535,7 +534,7 @@ static void i830EmitContextVerified(drm_device_t * dev, unsigned int *code)
535 ADVANCE_LP_RING(); 534 ADVANCE_LP_RING();
536} 535}
537 536
538static void i830EmitTexVerified(drm_device_t * dev, unsigned int *code) 537static void i830EmitTexVerified(struct drm_device * dev, unsigned int *code)
539{ 538{
540 drm_i830_private_t *dev_priv = dev->dev_private; 539 drm_i830_private_t *dev_priv = dev->dev_private;
541 int i, j = 0; 540 int i, j = 0;
@@ -569,7 +568,7 @@ static void i830EmitTexVerified(drm_device_t * dev, unsigned int *code)
569 printk("rejected packet %x\n", code[0]); 568 printk("rejected packet %x\n", code[0]);
570} 569}
571 570
572static void i830EmitTexBlendVerified(drm_device_t * dev, 571static void i830EmitTexBlendVerified(struct drm_device * dev,
573 unsigned int *code, unsigned int num) 572 unsigned int *code, unsigned int num)
574{ 573{
575 drm_i830_private_t *dev_priv = dev->dev_private; 574 drm_i830_private_t *dev_priv = dev->dev_private;
@@ -594,7 +593,7 @@ static void i830EmitTexBlendVerified(drm_device_t * dev,
594 ADVANCE_LP_RING(); 593 ADVANCE_LP_RING();
595} 594}
596 595
597static void i830EmitTexPalette(drm_device_t * dev, 596static void i830EmitTexPalette(struct drm_device * dev,
598 unsigned int *palette, int number, int is_shared) 597 unsigned int *palette, int number, int is_shared)
599{ 598{
600 drm_i830_private_t *dev_priv = dev->dev_private; 599 drm_i830_private_t *dev_priv = dev->dev_private;
@@ -621,7 +620,7 @@ static void i830EmitTexPalette(drm_device_t * dev,
621 620
622/* Need to do some additional checking when setting the dest buffer. 621/* Need to do some additional checking when setting the dest buffer.
623 */ 622 */
624static void i830EmitDestVerified(drm_device_t * dev, unsigned int *code) 623static void i830EmitDestVerified(struct drm_device * dev, unsigned int *code)
625{ 624{
626 drm_i830_private_t *dev_priv = dev->dev_private; 625 drm_i830_private_t *dev_priv = dev->dev_private;
627 unsigned int tmp; 626 unsigned int tmp;
@@ -682,7 +681,7 @@ static void i830EmitDestVerified(drm_device_t * dev, unsigned int *code)
682 ADVANCE_LP_RING(); 681 ADVANCE_LP_RING();
683} 682}
684 683
685static void i830EmitStippleVerified(drm_device_t * dev, unsigned int *code) 684static void i830EmitStippleVerified(struct drm_device * dev, unsigned int *code)
686{ 685{
687 drm_i830_private_t *dev_priv = dev->dev_private; 686 drm_i830_private_t *dev_priv = dev->dev_private;
688 RING_LOCALS; 687 RING_LOCALS;
@@ -693,7 +692,7 @@ static void i830EmitStippleVerified(drm_device_t * dev, unsigned int *code)
693 ADVANCE_LP_RING(); 692 ADVANCE_LP_RING();
694} 693}
695 694
696static void i830EmitState(drm_device_t * dev) 695static void i830EmitState(struct drm_device * dev)
697{ 696{
698 drm_i830_private_t *dev_priv = dev->dev_private; 697 drm_i830_private_t *dev_priv = dev->dev_private;
699 drm_i830_sarea_t *sarea_priv = dev_priv->sarea_priv; 698 drm_i830_sarea_t *sarea_priv = dev_priv->sarea_priv;
@@ -796,7 +795,7 @@ static void i830EmitState(drm_device_t * dev)
796 * Performance monitoring functions 795 * Performance monitoring functions
797 */ 796 */
798 797
799static void i830_fill_box(drm_device_t * dev, 798static void i830_fill_box(struct drm_device * dev,
800 int x, int y, int w, int h, int r, int g, int b) 799 int x, int y, int w, int h, int r, int g, int b)
801{ 800{
802 drm_i830_private_t *dev_priv = dev->dev_private; 801 drm_i830_private_t *dev_priv = dev->dev_private;
@@ -834,7 +833,7 @@ static void i830_fill_box(drm_device_t * dev,
834 ADVANCE_LP_RING(); 833 ADVANCE_LP_RING();
835} 834}
836 835
837static void i830_cp_performance_boxes(drm_device_t * dev) 836static void i830_cp_performance_boxes(struct drm_device * dev)
838{ 837{
839 drm_i830_private_t *dev_priv = dev->dev_private; 838 drm_i830_private_t *dev_priv = dev->dev_private;
840 839
@@ -879,7 +878,7 @@ static void i830_cp_performance_boxes(drm_device_t * dev)
879 dev_priv->sarea_priv->perf_boxes = 0; 878 dev_priv->sarea_priv->perf_boxes = 0;
880} 879}
881 880
882static void i830_dma_dispatch_clear(drm_device_t * dev, int flags, 881static void i830_dma_dispatch_clear(struct drm_device * dev, int flags,
883 unsigned int clear_color, 882 unsigned int clear_color,
884 unsigned int clear_zval, 883 unsigned int clear_zval,
885 unsigned int clear_depthmask) 884 unsigned int clear_depthmask)
@@ -887,7 +886,7 @@ static void i830_dma_dispatch_clear(drm_device_t * dev, int flags,
887 drm_i830_private_t *dev_priv = dev->dev_private; 886 drm_i830_private_t *dev_priv = dev->dev_private;
888 drm_i830_sarea_t *sarea_priv = dev_priv->sarea_priv; 887 drm_i830_sarea_t *sarea_priv = dev_priv->sarea_priv;
889 int nbox = sarea_priv->nbox; 888 int nbox = sarea_priv->nbox;
890 drm_clip_rect_t *pbox = sarea_priv->boxes; 889 struct drm_clip_rect *pbox = sarea_priv->boxes;
891 int pitch = dev_priv->pitch; 890 int pitch = dev_priv->pitch;
892 int cpp = dev_priv->cpp; 891 int cpp = dev_priv->cpp;
893 int i; 892 int i;
@@ -974,12 +973,12 @@ static void i830_dma_dispatch_clear(drm_device_t * dev, int flags,
974 } 973 }
975} 974}
976 975
977static void i830_dma_dispatch_swap(drm_device_t * dev) 976static void i830_dma_dispatch_swap(struct drm_device * dev)
978{ 977{
979 drm_i830_private_t *dev_priv = dev->dev_private; 978 drm_i830_private_t *dev_priv = dev->dev_private;
980 drm_i830_sarea_t *sarea_priv = dev_priv->sarea_priv; 979 drm_i830_sarea_t *sarea_priv = dev_priv->sarea_priv;
981 int nbox = sarea_priv->nbox; 980 int nbox = sarea_priv->nbox;
982 drm_clip_rect_t *pbox = sarea_priv->boxes; 981 struct drm_clip_rect *pbox = sarea_priv->boxes;
983 int pitch = dev_priv->pitch; 982 int pitch = dev_priv->pitch;
984 int cpp = dev_priv->cpp; 983 int cpp = dev_priv->cpp;
985 int i; 984 int i;
@@ -1044,7 +1043,7 @@ static void i830_dma_dispatch_swap(drm_device_t * dev)
1044 } 1043 }
1045} 1044}
1046 1045
1047static void i830_dma_dispatch_flip(drm_device_t * dev) 1046static void i830_dma_dispatch_flip(struct drm_device * dev)
1048{ 1047{
1049 drm_i830_private_t *dev_priv = dev->dev_private; 1048 drm_i830_private_t *dev_priv = dev->dev_private;
1050 RING_LOCALS; 1049 RING_LOCALS;
@@ -1087,13 +1086,13 @@ static void i830_dma_dispatch_flip(drm_device_t * dev)
1087 dev_priv->sarea_priv->pf_current_page = dev_priv->current_page; 1086 dev_priv->sarea_priv->pf_current_page = dev_priv->current_page;
1088} 1087}
1089 1088
1090static void i830_dma_dispatch_vertex(drm_device_t * dev, 1089static void i830_dma_dispatch_vertex(struct drm_device * dev,
1091 drm_buf_t * buf, int discard, int used) 1090 struct drm_buf * buf, int discard, int used)
1092{ 1091{
1093 drm_i830_private_t *dev_priv = dev->dev_private; 1092 drm_i830_private_t *dev_priv = dev->dev_private;
1094 drm_i830_buf_priv_t *buf_priv = buf->dev_private; 1093 drm_i830_buf_priv_t *buf_priv = buf->dev_private;
1095 drm_i830_sarea_t *sarea_priv = dev_priv->sarea_priv; 1094 drm_i830_sarea_t *sarea_priv = dev_priv->sarea_priv;
1096 drm_clip_rect_t *box = sarea_priv->boxes; 1095 struct drm_clip_rect *box = sarea_priv->boxes;
1097 int nbox = sarea_priv->nbox; 1096 int nbox = sarea_priv->nbox;
1098 unsigned long address = (unsigned long)buf->bus_address; 1097 unsigned long address = (unsigned long)buf->bus_address;
1099 unsigned long start = address - dev->agp->base; 1098 unsigned long start = address - dev->agp->base;
@@ -1199,7 +1198,7 @@ static void i830_dma_dispatch_vertex(drm_device_t * dev,
1199 } 1198 }
1200} 1199}
1201 1200
1202static void i830_dma_quiescent(drm_device_t * dev) 1201static void i830_dma_quiescent(struct drm_device * dev)
1203{ 1202{
1204 drm_i830_private_t *dev_priv = dev->dev_private; 1203 drm_i830_private_t *dev_priv = dev->dev_private;
1205 RING_LOCALS; 1204 RING_LOCALS;
@@ -1216,10 +1215,10 @@ static void i830_dma_quiescent(drm_device_t * dev)
1216 i830_wait_ring(dev, dev_priv->ring.Size - 8, __FUNCTION__); 1215 i830_wait_ring(dev, dev_priv->ring.Size - 8, __FUNCTION__);
1217} 1216}
1218 1217
1219static int i830_flush_queue(drm_device_t * dev) 1218static int i830_flush_queue(struct drm_device * dev)
1220{ 1219{
1221 drm_i830_private_t *dev_priv = dev->dev_private; 1220 drm_i830_private_t *dev_priv = dev->dev_private;
1222 drm_device_dma_t *dma = dev->dma; 1221 struct drm_device_dma *dma = dev->dma;
1223 int i, ret = 0; 1222 int i, ret = 0;
1224 RING_LOCALS; 1223 RING_LOCALS;
1225 1224
@@ -1233,7 +1232,7 @@ static int i830_flush_queue(drm_device_t * dev)
1233 i830_wait_ring(dev, dev_priv->ring.Size - 8, __FUNCTION__); 1232 i830_wait_ring(dev, dev_priv->ring.Size - 8, __FUNCTION__);
1234 1233
1235 for (i = 0; i < dma->buf_count; i++) { 1234 for (i = 0; i < dma->buf_count; i++) {
1236 drm_buf_t *buf = dma->buflist[i]; 1235 struct drm_buf *buf = dma->buflist[i];
1237 drm_i830_buf_priv_t *buf_priv = buf->dev_private; 1236 drm_i830_buf_priv_t *buf_priv = buf->dev_private;
1238 1237
1239 int used = cmpxchg(buf_priv->in_use, I830_BUF_HARDWARE, 1238 int used = cmpxchg(buf_priv->in_use, I830_BUF_HARDWARE,
@@ -1249,9 +1248,9 @@ static int i830_flush_queue(drm_device_t * dev)
1249} 1248}
1250 1249
1251/* Must be called with the lock held */ 1250/* Must be called with the lock held */
1252static void i830_reclaim_buffers(drm_device_t * dev, struct file *filp) 1251static void i830_reclaim_buffers(struct drm_device * dev, struct file *filp)
1253{ 1252{
1254 drm_device_dma_t *dma = dev->dma; 1253 struct drm_device_dma *dma = dev->dma;
1255 int i; 1254 int i;
1256 1255
1257 if (!dma) 1256 if (!dma)
@@ -1264,7 +1263,7 @@ static void i830_reclaim_buffers(drm_device_t * dev, struct file *filp)
1264 i830_flush_queue(dev); 1263 i830_flush_queue(dev);
1265 1264
1266 for (i = 0; i < dma->buf_count; i++) { 1265 for (i = 0; i < dma->buf_count; i++) {
1267 drm_buf_t *buf = dma->buflist[i]; 1266 struct drm_buf *buf = dma->buflist[i];
1268 drm_i830_buf_priv_t *buf_priv = buf->dev_private; 1267 drm_i830_buf_priv_t *buf_priv = buf->dev_private;
1269 1268
1270 if (buf->filp == filp && buf_priv) { 1269 if (buf->filp == filp && buf_priv) {
@@ -1282,8 +1281,8 @@ static void i830_reclaim_buffers(drm_device_t * dev, struct file *filp)
1282static int i830_flush_ioctl(struct inode *inode, struct file *filp, 1281static int i830_flush_ioctl(struct inode *inode, struct file *filp,
1283 unsigned int cmd, unsigned long arg) 1282 unsigned int cmd, unsigned long arg)
1284{ 1283{
1285 drm_file_t *priv = filp->private_data; 1284 struct drm_file *priv = filp->private_data;
1286 drm_device_t *dev = priv->head->dev; 1285 struct drm_device *dev = priv->head->dev;
1287 1286
1288 LOCK_TEST_WITH_RETURN(dev, filp); 1287 LOCK_TEST_WITH_RETURN(dev, filp);
1289 1288
@@ -1294,9 +1293,9 @@ static int i830_flush_ioctl(struct inode *inode, struct file *filp,
1294static int i830_dma_vertex(struct inode *inode, struct file *filp, 1293static int i830_dma_vertex(struct inode *inode, struct file *filp,
1295 unsigned int cmd, unsigned long arg) 1294 unsigned int cmd, unsigned long arg)
1296{ 1295{
1297 drm_file_t *priv = filp->private_data; 1296 struct drm_file *priv = filp->private_data;
1298 drm_device_t *dev = priv->head->dev; 1297 struct drm_device *dev = priv->head->dev;
1299 drm_device_dma_t *dma = dev->dma; 1298 struct drm_device_dma *dma = dev->dma;
1300 drm_i830_private_t *dev_priv = (drm_i830_private_t *) dev->dev_private; 1299 drm_i830_private_t *dev_priv = (drm_i830_private_t *) dev->dev_private;
1301 u32 *hw_status = dev_priv->hw_status_page; 1300 u32 *hw_status = dev_priv->hw_status_page;
1302 drm_i830_sarea_t *sarea_priv = (drm_i830_sarea_t *) 1301 drm_i830_sarea_t *sarea_priv = (drm_i830_sarea_t *)
@@ -1328,8 +1327,8 @@ static int i830_dma_vertex(struct inode *inode, struct file *filp,
1328static int i830_clear_bufs(struct inode *inode, struct file *filp, 1327static int i830_clear_bufs(struct inode *inode, struct file *filp,
1329 unsigned int cmd, unsigned long arg) 1328 unsigned int cmd, unsigned long arg)
1330{ 1329{
1331 drm_file_t *priv = filp->private_data; 1330 struct drm_file *priv = filp->private_data;
1332 drm_device_t *dev = priv->head->dev; 1331 struct drm_device *dev = priv->head->dev;
1333 drm_i830_clear_t clear; 1332 drm_i830_clear_t clear;
1334 1333
1335 if (copy_from_user 1334 if (copy_from_user
@@ -1352,8 +1351,8 @@ static int i830_clear_bufs(struct inode *inode, struct file *filp,
1352static int i830_swap_bufs(struct inode *inode, struct file *filp, 1351static int i830_swap_bufs(struct inode *inode, struct file *filp,
1353 unsigned int cmd, unsigned long arg) 1352 unsigned int cmd, unsigned long arg)
1354{ 1353{
1355 drm_file_t *priv = filp->private_data; 1354 struct drm_file *priv = filp->private_data;
1356 drm_device_t *dev = priv->head->dev; 1355 struct drm_device *dev = priv->head->dev;
1357 1356
1358 DRM_DEBUG("i830_swap_bufs\n"); 1357 DRM_DEBUG("i830_swap_bufs\n");
1359 1358
@@ -1365,7 +1364,7 @@ static int i830_swap_bufs(struct inode *inode, struct file *filp,
1365 1364
1366/* Not sure why this isn't set all the time: 1365/* Not sure why this isn't set all the time:
1367 */ 1366 */
1368static void i830_do_init_pageflip(drm_device_t * dev) 1367static void i830_do_init_pageflip(struct drm_device * dev)
1369{ 1368{
1370 drm_i830_private_t *dev_priv = dev->dev_private; 1369 drm_i830_private_t *dev_priv = dev->dev_private;
1371 1370
@@ -1375,7 +1374,7 @@ static void i830_do_init_pageflip(drm_device_t * dev)
1375 dev_priv->sarea_priv->pf_current_page = dev_priv->current_page; 1374 dev_priv->sarea_priv->pf_current_page = dev_priv->current_page;
1376} 1375}
1377 1376
1378static int i830_do_cleanup_pageflip(drm_device_t * dev) 1377static int i830_do_cleanup_pageflip(struct drm_device * dev)
1379{ 1378{
1380 drm_i830_private_t *dev_priv = dev->dev_private; 1379 drm_i830_private_t *dev_priv = dev->dev_private;
1381 1380
@@ -1390,8 +1389,8 @@ static int i830_do_cleanup_pageflip(drm_device_t * dev)
1390static int i830_flip_bufs(struct inode *inode, struct file *filp, 1389static int i830_flip_bufs(struct inode *inode, struct file *filp,
1391 unsigned int cmd, unsigned long arg) 1390 unsigned int cmd, unsigned long arg)
1392{ 1391{
1393 drm_file_t *priv = filp->private_data; 1392 struct drm_file *priv = filp->private_data;
1394 drm_device_t *dev = priv->head->dev; 1393 struct drm_device *dev = priv->head->dev;
1395 drm_i830_private_t *dev_priv = dev->dev_private; 1394 drm_i830_private_t *dev_priv = dev->dev_private;
1396 1395
1397 DRM_DEBUG("%s\n", __FUNCTION__); 1396 DRM_DEBUG("%s\n", __FUNCTION__);
@@ -1408,8 +1407,8 @@ static int i830_flip_bufs(struct inode *inode, struct file *filp,
1408static int i830_getage(struct inode *inode, struct file *filp, unsigned int cmd, 1407static int i830_getage(struct inode *inode, struct file *filp, unsigned int cmd,
1409 unsigned long arg) 1408 unsigned long arg)
1410{ 1409{
1411 drm_file_t *priv = filp->private_data; 1410 struct drm_file *priv = filp->private_data;
1412 drm_device_t *dev = priv->head->dev; 1411 struct drm_device *dev = priv->head->dev;
1413 drm_i830_private_t *dev_priv = (drm_i830_private_t *) dev->dev_private; 1412 drm_i830_private_t *dev_priv = (drm_i830_private_t *) dev->dev_private;
1414 u32 *hw_status = dev_priv->hw_status_page; 1413 u32 *hw_status = dev_priv->hw_status_page;
1415 drm_i830_sarea_t *sarea_priv = (drm_i830_sarea_t *) 1414 drm_i830_sarea_t *sarea_priv = (drm_i830_sarea_t *)
@@ -1422,8 +1421,8 @@ static int i830_getage(struct inode *inode, struct file *filp, unsigned int cmd,
1422static int i830_getbuf(struct inode *inode, struct file *filp, unsigned int cmd, 1421static int i830_getbuf(struct inode *inode, struct file *filp, unsigned int cmd,
1423 unsigned long arg) 1422 unsigned long arg)
1424{ 1423{
1425 drm_file_t *priv = filp->private_data; 1424 struct drm_file *priv = filp->private_data;
1426 drm_device_t *dev = priv->head->dev; 1425 struct drm_device *dev = priv->head->dev;
1427 int retcode = 0; 1426 int retcode = 0;
1428 drm_i830_dma_t d; 1427 drm_i830_dma_t d;
1429 drm_i830_private_t *dev_priv = (drm_i830_private_t *) dev->dev_private; 1428 drm_i830_private_t *dev_priv = (drm_i830_private_t *) dev->dev_private;
@@ -1444,7 +1443,7 @@ static int i830_getbuf(struct inode *inode, struct file *filp, unsigned int cmd,
1444 DRM_DEBUG("i830_dma: %d returning %d, granted = %d\n", 1443 DRM_DEBUG("i830_dma: %d returning %d, granted = %d\n",
1445 current->pid, retcode, d.granted); 1444 current->pid, retcode, d.granted);
1446 1445
1447 if (copy_to_user((drm_dma_t __user *) arg, &d, sizeof(d))) 1446 if (copy_to_user((void __user *) arg, &d, sizeof(d)))
1448 return -EFAULT; 1447 return -EFAULT;
1449 sarea_priv->last_dispatch = (int)hw_status[5]; 1448 sarea_priv->last_dispatch = (int)hw_status[5];
1450 1449
@@ -1467,8 +1466,8 @@ static int i830_docopy(struct inode *inode, struct file *filp, unsigned int cmd,
1467static int i830_getparam(struct inode *inode, struct file *filp, 1466static int i830_getparam(struct inode *inode, struct file *filp,
1468 unsigned int cmd, unsigned long arg) 1467 unsigned int cmd, unsigned long arg)
1469{ 1468{
1470 drm_file_t *priv = filp->private_data; 1469 struct drm_file *priv = filp->private_data;
1471 drm_device_t *dev = priv->head->dev; 1470 struct drm_device *dev = priv->head->dev;
1472 drm_i830_private_t *dev_priv = dev->dev_private; 1471 drm_i830_private_t *dev_priv = dev->dev_private;
1473 drm_i830_getparam_t param; 1472 drm_i830_getparam_t param;
1474 int value; 1473 int value;
@@ -1501,8 +1500,8 @@ static int i830_getparam(struct inode *inode, struct file *filp,
1501static int i830_setparam(struct inode *inode, struct file *filp, 1500static int i830_setparam(struct inode *inode, struct file *filp,
1502 unsigned int cmd, unsigned long arg) 1501 unsigned int cmd, unsigned long arg)
1503{ 1502{
1504 drm_file_t *priv = filp->private_data; 1503 struct drm_file *priv = filp->private_data;
1505 drm_device_t *dev = priv->head->dev; 1504 struct drm_device *dev = priv->head->dev;
1506 drm_i830_private_t *dev_priv = dev->dev_private; 1505 drm_i830_private_t *dev_priv = dev->dev_private;
1507 drm_i830_setparam_t param; 1506 drm_i830_setparam_t param;
1508 1507
@@ -1526,7 +1525,7 @@ static int i830_setparam(struct inode *inode, struct file *filp,
1526 return 0; 1525 return 0;
1527} 1526}
1528 1527
1529int i830_driver_load(drm_device_t *dev, unsigned long flags) 1528int i830_driver_load(struct drm_device *dev, unsigned long flags)
1530{ 1529{
1531 /* i830 has 4 more counters */ 1530 /* i830 has 4 more counters */
1532 dev->counters += 4; 1531 dev->counters += 4;
@@ -1538,12 +1537,12 @@ int i830_driver_load(drm_device_t *dev, unsigned long flags)
1538 return 0; 1537 return 0;
1539} 1538}
1540 1539
1541void i830_driver_lastclose(drm_device_t * dev) 1540void i830_driver_lastclose(struct drm_device * dev)
1542{ 1541{
1543 i830_dma_cleanup(dev); 1542 i830_dma_cleanup(dev);
1544} 1543}
1545 1544
1546void i830_driver_preclose(drm_device_t * dev, DRMFILE filp) 1545void i830_driver_preclose(struct drm_device * dev, DRMFILE filp)
1547{ 1546{
1548 if (dev->dev_private) { 1547 if (dev->dev_private) {
1549 drm_i830_private_t *dev_priv = dev->dev_private; 1548 drm_i830_private_t *dev_priv = dev->dev_private;
@@ -1553,12 +1552,12 @@ void i830_driver_preclose(drm_device_t * dev, DRMFILE filp)
1553 } 1552 }
1554} 1553}
1555 1554
1556void i830_driver_reclaim_buffers_locked(drm_device_t * dev, struct file *filp) 1555void i830_driver_reclaim_buffers_locked(struct drm_device * dev, struct file *filp)
1557{ 1556{
1558 i830_reclaim_buffers(dev, filp); 1557 i830_reclaim_buffers(dev, filp);
1559} 1558}
1560 1559
1561int i830_driver_dma_quiescent(drm_device_t * dev) 1560int i830_driver_dma_quiescent(struct drm_device * dev)
1562{ 1561{
1563 i830_dma_quiescent(dev); 1562 i830_dma_quiescent(dev);
1564 return 0; 1563 return 0;
@@ -1594,7 +1593,7 @@ int i830_max_ioctl = DRM_ARRAY_SIZE(i830_ioctls);
1594 * \returns 1593 * \returns
1595 * A value of 1 is always retured to indictate every i8xx is AGP. 1594 * A value of 1 is always retured to indictate every i8xx is AGP.
1596 */ 1595 */
1597int i830_driver_device_is_agp(drm_device_t * dev) 1596int i830_driver_device_is_agp(struct drm_device * dev)
1598{ 1597{
1599 return 1; 1598 return 1;
1600} 1599}
diff --git a/drivers/char/drm/i830_drm.h b/drivers/char/drm/i830_drm.h
index 66dd75027967..968a6d9f9dcb 100644
--- a/drivers/char/drm/i830_drm.h
+++ b/drivers/char/drm/i830_drm.h
@@ -191,7 +191,7 @@ typedef struct _drm_i830_sarea {
191 unsigned int dirty; 191 unsigned int dirty;
192 192
193 unsigned int nbox; 193 unsigned int nbox;
194 drm_clip_rect_t boxes[I830_NR_SAREA_CLIPRECTS]; 194 struct drm_clip_rect boxes[I830_NR_SAREA_CLIPRECTS];
195 195
196 /* Maintain an LRU of contiguous regions of texture space. If 196 /* Maintain an LRU of contiguous regions of texture space. If
197 * you think you own a region of texture memory, and it has an 197 * you think you own a region of texture memory, and it has an
diff --git a/drivers/char/drm/i830_drv.h b/drivers/char/drm/i830_drv.h
index e91f94afb4bb..ddda67956dea 100644
--- a/drivers/char/drm/i830_drv.h
+++ b/drivers/char/drm/i830_drv.h
@@ -84,8 +84,8 @@ typedef struct _drm_i830_ring_buffer {
84} drm_i830_ring_buffer_t; 84} drm_i830_ring_buffer_t;
85 85
86typedef struct drm_i830_private { 86typedef struct drm_i830_private {
87 drm_map_t *sarea_map; 87 struct drm_map *sarea_map;
88 drm_map_t *mmio_map; 88 struct drm_map *mmio_map;
89 89
90 drm_i830_sarea_t *sarea_priv; 90 drm_i830_sarea_t *sarea_priv;
91 drm_i830_ring_buffer_t ring; 91 drm_i830_ring_buffer_t ring;
@@ -95,7 +95,7 @@ typedef struct drm_i830_private {
95 95
96 dma_addr_t dma_status_page; 96 dma_addr_t dma_status_page;
97 97
98 drm_buf_t *mmap_buffer; 98 struct drm_buf *mmap_buffer;
99 99
100 u32 front_di1, back_di1, zi1; 100 u32 front_di1, back_di1, zi1;
101 101
@@ -132,16 +132,16 @@ extern int i830_irq_wait(struct inode *inode, struct file *filp,
132 unsigned int cmd, unsigned long arg); 132 unsigned int cmd, unsigned long arg);
133 133
134extern irqreturn_t i830_driver_irq_handler(DRM_IRQ_ARGS); 134extern irqreturn_t i830_driver_irq_handler(DRM_IRQ_ARGS);
135extern void i830_driver_irq_preinstall(drm_device_t * dev); 135extern void i830_driver_irq_preinstall(struct drm_device * dev);
136extern void i830_driver_irq_postinstall(drm_device_t * dev); 136extern void i830_driver_irq_postinstall(struct drm_device * dev);
137extern void i830_driver_irq_uninstall(drm_device_t * dev); 137extern void i830_driver_irq_uninstall(struct drm_device * dev);
138extern int i830_driver_load(struct drm_device *, unsigned long flags); 138extern int i830_driver_load(struct drm_device *, unsigned long flags);
139extern void i830_driver_preclose(drm_device_t * dev, DRMFILE filp); 139extern void i830_driver_preclose(struct drm_device * dev, DRMFILE filp);
140extern void i830_driver_lastclose(drm_device_t * dev); 140extern void i830_driver_lastclose(struct drm_device * dev);
141extern void i830_driver_reclaim_buffers_locked(drm_device_t * dev, 141extern void i830_driver_reclaim_buffers_locked(struct drm_device * dev,
142 struct file *filp); 142 struct file *filp);
143extern int i830_driver_dma_quiescent(drm_device_t * dev); 143extern int i830_driver_dma_quiescent(struct drm_device * dev);
144extern int i830_driver_device_is_agp(drm_device_t * dev); 144extern int i830_driver_device_is_agp(struct drm_device * dev);
145 145
146#define I830_READ(reg) DRM_READ32(dev_priv->mmio_map, reg) 146#define I830_READ(reg) DRM_READ32(dev_priv->mmio_map, reg)
147#define I830_WRITE(reg,val) DRM_WRITE32(dev_priv->mmio_map, reg, val) 147#define I830_WRITE(reg,val) DRM_WRITE32(dev_priv->mmio_map, reg, val)
@@ -180,7 +180,7 @@ extern int i830_driver_device_is_agp(drm_device_t * dev);
180 I830_WRITE(LP_RING + RING_TAIL, outring); \ 180 I830_WRITE(LP_RING + RING_TAIL, outring); \
181} while(0) 181} while(0)
182 182
183extern int i830_wait_ring(drm_device_t * dev, int n, const char *caller); 183extern int i830_wait_ring(struct drm_device * dev, int n, const char *caller);
184 184
185#define GFX_OP_USER_INTERRUPT ((0<<29)|(2<<23)) 185#define GFX_OP_USER_INTERRUPT ((0<<29)|(2<<23))
186#define GFX_OP_BREAKPOINT_INTERRUPT ((0<<29)|(1<<23)) 186#define GFX_OP_BREAKPOINT_INTERRUPT ((0<<29)|(1<<23))
diff --git a/drivers/char/drm/i830_irq.c b/drivers/char/drm/i830_irq.c
index 5841f7674956..a1b5c63c3c3e 100644
--- a/drivers/char/drm/i830_irq.c
+++ b/drivers/char/drm/i830_irq.c
@@ -35,7 +35,7 @@
35 35
36irqreturn_t i830_driver_irq_handler(DRM_IRQ_ARGS) 36irqreturn_t i830_driver_irq_handler(DRM_IRQ_ARGS)
37{ 37{
38 drm_device_t *dev = (drm_device_t *) arg; 38 struct drm_device *dev = (struct drm_device *) arg;
39 drm_i830_private_t *dev_priv = (drm_i830_private_t *) dev->dev_private; 39 drm_i830_private_t *dev_priv = (drm_i830_private_t *) dev->dev_private;
40 u16 temp; 40 u16 temp;
41 41
@@ -53,7 +53,7 @@ irqreturn_t i830_driver_irq_handler(DRM_IRQ_ARGS)
53 return IRQ_HANDLED; 53 return IRQ_HANDLED;
54} 54}
55 55
56static int i830_emit_irq(drm_device_t * dev) 56static int i830_emit_irq(struct drm_device * dev)
57{ 57{
58 drm_i830_private_t *dev_priv = dev->dev_private; 58 drm_i830_private_t *dev_priv = dev->dev_private;
59 RING_LOCALS; 59 RING_LOCALS;
@@ -70,7 +70,7 @@ static int i830_emit_irq(drm_device_t * dev)
70 return atomic_read(&dev_priv->irq_emitted); 70 return atomic_read(&dev_priv->irq_emitted);
71} 71}
72 72
73static int i830_wait_irq(drm_device_t * dev, int irq_nr) 73static int i830_wait_irq(struct drm_device * dev, int irq_nr)
74{ 74{
75 drm_i830_private_t *dev_priv = (drm_i830_private_t *) dev->dev_private; 75 drm_i830_private_t *dev_priv = (drm_i830_private_t *) dev->dev_private;
76 DECLARE_WAITQUEUE(entry, current); 76 DECLARE_WAITQUEUE(entry, current);
@@ -117,8 +117,8 @@ static int i830_wait_irq(drm_device_t * dev, int irq_nr)
117int i830_irq_emit(struct inode *inode, struct file *filp, unsigned int cmd, 117int i830_irq_emit(struct inode *inode, struct file *filp, unsigned int cmd,
118 unsigned long arg) 118 unsigned long arg)
119{ 119{
120 drm_file_t *priv = filp->private_data; 120 struct drm_file *priv = filp->private_data;
121 drm_device_t *dev = priv->head->dev; 121 struct drm_device *dev = priv->head->dev;
122 drm_i830_private_t *dev_priv = dev->dev_private; 122 drm_i830_private_t *dev_priv = dev->dev_private;
123 drm_i830_irq_emit_t emit; 123 drm_i830_irq_emit_t emit;
124 int result; 124 int result;
@@ -149,8 +149,8 @@ int i830_irq_emit(struct inode *inode, struct file *filp, unsigned int cmd,
149int i830_irq_wait(struct inode *inode, struct file *filp, unsigned int cmd, 149int i830_irq_wait(struct inode *inode, struct file *filp, unsigned int cmd,
150 unsigned long arg) 150 unsigned long arg)
151{ 151{
152 drm_file_t *priv = filp->private_data; 152 struct drm_file *priv = filp->private_data;
153 drm_device_t *dev = priv->head->dev; 153 struct drm_device *dev = priv->head->dev;
154 drm_i830_private_t *dev_priv = dev->dev_private; 154 drm_i830_private_t *dev_priv = dev->dev_private;
155 drm_i830_irq_wait_t irqwait; 155 drm_i830_irq_wait_t irqwait;
156 156
@@ -168,7 +168,7 @@ int i830_irq_wait(struct inode *inode, struct file *filp, unsigned int cmd,
168 168
169/* drm_dma.h hooks 169/* drm_dma.h hooks
170*/ 170*/
171void i830_driver_irq_preinstall(drm_device_t * dev) 171void i830_driver_irq_preinstall(struct drm_device * dev)
172{ 172{
173 drm_i830_private_t *dev_priv = (drm_i830_private_t *) dev->dev_private; 173 drm_i830_private_t *dev_priv = (drm_i830_private_t *) dev->dev_private;
174 174
@@ -180,14 +180,14 @@ void i830_driver_irq_preinstall(drm_device_t * dev)
180 init_waitqueue_head(&dev_priv->irq_queue); 180 init_waitqueue_head(&dev_priv->irq_queue);
181} 181}
182 182
183void i830_driver_irq_postinstall(drm_device_t * dev) 183void i830_driver_irq_postinstall(struct drm_device * dev)
184{ 184{
185 drm_i830_private_t *dev_priv = (drm_i830_private_t *) dev->dev_private; 185 drm_i830_private_t *dev_priv = (drm_i830_private_t *) dev->dev_private;
186 186
187 I830_WRITE16(I830REG_INT_ENABLE_R, 0x2); 187 I830_WRITE16(I830REG_INT_ENABLE_R, 0x2);
188} 188}
189 189
190void i830_driver_irq_uninstall(drm_device_t * dev) 190void i830_driver_irq_uninstall(struct drm_device * dev)
191{ 191{
192 drm_i830_private_t *dev_priv = (drm_i830_private_t *) dev->dev_private; 192 drm_i830_private_t *dev_priv = (drm_i830_private_t *) dev->dev_private;
193 if (!dev_priv) 193 if (!dev_priv)
diff --git a/drivers/char/drm/i915_dma.c b/drivers/char/drm/i915_dma.c
index ea52740af4f6..3359cc2b9736 100644
--- a/drivers/char/drm/i915_dma.c
+++ b/drivers/char/drm/i915_dma.c
@@ -47,7 +47,7 @@
47 * the head pointer changes, so that EBUSY only happens if the ring 47 * the head pointer changes, so that EBUSY only happens if the ring
48 * actually stalls for (eg) 3 seconds. 48 * actually stalls for (eg) 3 seconds.
49 */ 49 */
50int i915_wait_ring(drm_device_t * dev, int n, const char *caller) 50int i915_wait_ring(struct drm_device * dev, int n, const char *caller)
51{ 51{
52 drm_i915_private_t *dev_priv = dev->dev_private; 52 drm_i915_private_t *dev_priv = dev->dev_private;
53 drm_i915_ring_buffer_t *ring = &(dev_priv->ring); 53 drm_i915_ring_buffer_t *ring = &(dev_priv->ring);
@@ -73,7 +73,7 @@ int i915_wait_ring(drm_device_t * dev, int n, const char *caller)
73 return DRM_ERR(EBUSY); 73 return DRM_ERR(EBUSY);
74} 74}
75 75
76void i915_kernel_lost_context(drm_device_t * dev) 76void i915_kernel_lost_context(struct drm_device * dev)
77{ 77{
78 drm_i915_private_t *dev_priv = dev->dev_private; 78 drm_i915_private_t *dev_priv = dev->dev_private;
79 drm_i915_ring_buffer_t *ring = &(dev_priv->ring); 79 drm_i915_ring_buffer_t *ring = &(dev_priv->ring);
@@ -88,7 +88,7 @@ void i915_kernel_lost_context(drm_device_t * dev)
88 dev_priv->sarea_priv->perf_boxes |= I915_BOX_RING_EMPTY; 88 dev_priv->sarea_priv->perf_boxes |= I915_BOX_RING_EMPTY;
89} 89}
90 90
91static int i915_dma_cleanup(drm_device_t * dev) 91static int i915_dma_cleanup(struct drm_device * dev)
92{ 92{
93 /* Make sure interrupts are disabled here because the uninstall ioctl 93 /* Make sure interrupts are disabled here because the uninstall ioctl
94 * may not have been called from userspace and after dev_private 94 * may not have been called from userspace and after dev_private
@@ -126,13 +126,13 @@ static int i915_dma_cleanup(drm_device_t * dev)
126 return 0; 126 return 0;
127} 127}
128 128
129static int i915_initialize(drm_device_t * dev, 129static int i915_initialize(struct drm_device * dev,
130 drm_i915_private_t * dev_priv, 130 drm_i915_private_t * dev_priv,
131 drm_i915_init_t * init) 131 drm_i915_init_t * init)
132{ 132{
133 memset(dev_priv, 0, sizeof(drm_i915_private_t)); 133 memset(dev_priv, 0, sizeof(drm_i915_private_t));
134 134
135 DRM_GETSAREA(); 135 dev_priv->sarea = drm_getsarea(dev);
136 if (!dev_priv->sarea) { 136 if (!dev_priv->sarea) {
137 DRM_ERROR("can not find sarea!\n"); 137 DRM_ERROR("can not find sarea!\n");
138 dev->dev_private = (void *)dev_priv; 138 dev->dev_private = (void *)dev_priv;
@@ -211,7 +211,7 @@ static int i915_initialize(drm_device_t * dev,
211 return 0; 211 return 0;
212} 212}
213 213
214static int i915_dma_resume(drm_device_t * dev) 214static int i915_dma_resume(struct drm_device * dev)
215{ 215{
216 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 216 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
217 217
@@ -357,7 +357,7 @@ static int validate_cmd(int cmd)
357 return ret; 357 return ret;
358} 358}
359 359
360static int i915_emit_cmds(drm_device_t * dev, int __user * buffer, int dwords) 360static int i915_emit_cmds(struct drm_device * dev, int __user * buffer, int dwords)
361{ 361{
362 drm_i915_private_t *dev_priv = dev->dev_private; 362 drm_i915_private_t *dev_priv = dev->dev_private;
363 int i; 363 int i;
@@ -396,12 +396,12 @@ static int i915_emit_cmds(drm_device_t * dev, int __user * buffer, int dwords)
396 return 0; 396 return 0;
397} 397}
398 398
399static int i915_emit_box(drm_device_t * dev, 399static int i915_emit_box(struct drm_device * dev,
400 drm_clip_rect_t __user * boxes, 400 struct drm_clip_rect __user * boxes,
401 int i, int DR1, int DR4) 401 int i, int DR1, int DR4)
402{ 402{
403 drm_i915_private_t *dev_priv = dev->dev_private; 403 drm_i915_private_t *dev_priv = dev->dev_private;
404 drm_clip_rect_t box; 404 struct drm_clip_rect box;
405 RING_LOCALS; 405 RING_LOCALS;
406 406
407 if (DRM_COPY_FROM_USER_UNCHECKED(&box, &boxes[i], sizeof(box))) { 407 if (DRM_COPY_FROM_USER_UNCHECKED(&box, &boxes[i], sizeof(box))) {
@@ -439,7 +439,7 @@ static int i915_emit_box(drm_device_t * dev,
439 * emit. For now, do it in both places: 439 * emit. For now, do it in both places:
440 */ 440 */
441 441
442static void i915_emit_breadcrumb(drm_device_t *dev) 442static void i915_emit_breadcrumb(struct drm_device *dev)
443{ 443{
444 drm_i915_private_t *dev_priv = dev->dev_private; 444 drm_i915_private_t *dev_priv = dev->dev_private;
445 RING_LOCALS; 445 RING_LOCALS;
@@ -457,7 +457,7 @@ static void i915_emit_breadcrumb(drm_device_t *dev)
457 ADVANCE_LP_RING(); 457 ADVANCE_LP_RING();
458} 458}
459 459
460static int i915_dispatch_cmdbuffer(drm_device_t * dev, 460static int i915_dispatch_cmdbuffer(struct drm_device * dev,
461 drm_i915_cmdbuffer_t * cmd) 461 drm_i915_cmdbuffer_t * cmd)
462{ 462{
463 int nbox = cmd->num_cliprects; 463 int nbox = cmd->num_cliprects;
@@ -489,11 +489,11 @@ static int i915_dispatch_cmdbuffer(drm_device_t * dev,
489 return 0; 489 return 0;
490} 490}
491 491
492static int i915_dispatch_batchbuffer(drm_device_t * dev, 492static int i915_dispatch_batchbuffer(struct drm_device * dev,
493 drm_i915_batchbuffer_t * batch) 493 drm_i915_batchbuffer_t * batch)
494{ 494{
495 drm_i915_private_t *dev_priv = dev->dev_private; 495 drm_i915_private_t *dev_priv = dev->dev_private;
496 drm_clip_rect_t __user *boxes = batch->cliprects; 496 struct drm_clip_rect __user *boxes = batch->cliprects;
497 int nbox = batch->num_cliprects; 497 int nbox = batch->num_cliprects;
498 int i = 0, count; 498 int i = 0, count;
499 RING_LOCALS; 499 RING_LOCALS;
@@ -535,7 +535,7 @@ static int i915_dispatch_batchbuffer(drm_device_t * dev,
535 return 0; 535 return 0;
536} 536}
537 537
538static int i915_dispatch_flip(drm_device_t * dev) 538static int i915_dispatch_flip(struct drm_device * dev)
539{ 539{
540 drm_i915_private_t *dev_priv = dev->dev_private; 540 drm_i915_private_t *dev_priv = dev->dev_private;
541 RING_LOCALS; 541 RING_LOCALS;
@@ -583,7 +583,7 @@ static int i915_dispatch_flip(drm_device_t * dev)
583 return 0; 583 return 0;
584} 584}
585 585
586static int i915_quiescent(drm_device_t * dev) 586static int i915_quiescent(struct drm_device * dev)
587{ 587{
588 drm_i915_private_t *dev_priv = dev->dev_private; 588 drm_i915_private_t *dev_priv = dev->dev_private;
589 589
@@ -625,7 +625,7 @@ static int i915_batchbuffer(DRM_IOCTL_ARGS)
625 625
626 if (batch.num_cliprects && DRM_VERIFYAREA_READ(batch.cliprects, 626 if (batch.num_cliprects && DRM_VERIFYAREA_READ(batch.cliprects,
627 batch.num_cliprects * 627 batch.num_cliprects *
628 sizeof(drm_clip_rect_t))) 628 sizeof(struct drm_clip_rect)))
629 return DRM_ERR(EFAULT); 629 return DRM_ERR(EFAULT);
630 630
631 ret = i915_dispatch_batchbuffer(dev, &batch); 631 ret = i915_dispatch_batchbuffer(dev, &batch);
@@ -655,7 +655,7 @@ static int i915_cmdbuffer(DRM_IOCTL_ARGS)
655 if (cmdbuf.num_cliprects && 655 if (cmdbuf.num_cliprects &&
656 DRM_VERIFYAREA_READ(cmdbuf.cliprects, 656 DRM_VERIFYAREA_READ(cmdbuf.cliprects,
657 cmdbuf.num_cliprects * 657 cmdbuf.num_cliprects *
658 sizeof(drm_clip_rect_t))) { 658 sizeof(struct drm_clip_rect))) {
659 DRM_ERROR("Fault accessing cliprects\n"); 659 DRM_ERROR("Fault accessing cliprects\n");
660 return DRM_ERR(EFAULT); 660 return DRM_ERR(EFAULT);
661 } 661 }
@@ -792,7 +792,7 @@ static int i915_set_status_page(DRM_IOCTL_ARGS)
792 return 0; 792 return 0;
793} 793}
794 794
795int i915_driver_load(drm_device_t *dev, unsigned long flags) 795int i915_driver_load(struct drm_device *dev, unsigned long flags)
796{ 796{
797 /* i915 has 4 more counters */ 797 /* i915 has 4 more counters */
798 dev->counters += 4; 798 dev->counters += 4;
@@ -804,7 +804,7 @@ int i915_driver_load(drm_device_t *dev, unsigned long flags)
804 return 0; 804 return 0;
805} 805}
806 806
807void i915_driver_lastclose(drm_device_t * dev) 807void i915_driver_lastclose(struct drm_device * dev)
808{ 808{
809 if (dev->dev_private) { 809 if (dev->dev_private) {
810 drm_i915_private_t *dev_priv = dev->dev_private; 810 drm_i915_private_t *dev_priv = dev->dev_private;
@@ -813,7 +813,7 @@ void i915_driver_lastclose(drm_device_t * dev)
813 i915_dma_cleanup(dev); 813 i915_dma_cleanup(dev);
814} 814}
815 815
816void i915_driver_preclose(drm_device_t * dev, DRMFILE filp) 816void i915_driver_preclose(struct drm_device * dev, DRMFILE filp)
817{ 817{
818 if (dev->dev_private) { 818 if (dev->dev_private) {
819 drm_i915_private_t *dev_priv = dev->dev_private; 819 drm_i915_private_t *dev_priv = dev->dev_private;
@@ -854,7 +854,7 @@ int i915_max_ioctl = DRM_ARRAY_SIZE(i915_ioctls);
854 * \returns 854 * \returns
855 * A value of 1 is always retured to indictate every i9x5 is AGP. 855 * A value of 1 is always retured to indictate every i9x5 is AGP.
856 */ 856 */
857int i915_driver_device_is_agp(drm_device_t * dev) 857int i915_driver_device_is_agp(struct drm_device * dev)
858{ 858{
859 return 1; 859 return 1;
860} 860}
diff --git a/drivers/char/drm/i915_drm.h b/drivers/char/drm/i915_drm.h
index 7b7b68b96f31..05c66cf03a9e 100644
--- a/drivers/char/drm/i915_drm.h
+++ b/drivers/char/drm/i915_drm.h
@@ -64,7 +64,7 @@ typedef struct _drm_i915_init {
64} drm_i915_init_t; 64} drm_i915_init_t;
65 65
66typedef struct _drm_i915_sarea { 66typedef struct _drm_i915_sarea {
67 drm_tex_region_t texList[I915_NR_TEX_REGIONS + 1]; 67 struct drm_tex_region texList[I915_NR_TEX_REGIONS + 1];
68 int last_upload; /* last time texture was uploaded */ 68 int last_upload; /* last time texture was uploaded */
69 int last_enqueue; /* last time a buffer was enqueued */ 69 int last_enqueue; /* last time a buffer was enqueued */
70 int last_dispatch; /* age of the most recently dispatched buffer */ 70 int last_dispatch; /* age of the most recently dispatched buffer */
@@ -170,7 +170,7 @@ typedef struct _drm_i915_batchbuffer {
170 int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ 170 int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */
171 int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */ 171 int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */
172 int num_cliprects; /* mulitpass with multiple cliprects? */ 172 int num_cliprects; /* mulitpass with multiple cliprects? */
173 drm_clip_rect_t __user *cliprects; /* pointer to userspace cliprects */ 173 struct drm_clip_rect __user *cliprects; /* pointer to userspace cliprects */
174} drm_i915_batchbuffer_t; 174} drm_i915_batchbuffer_t;
175 175
176/* As above, but pass a pointer to userspace buffer which can be 176/* As above, but pass a pointer to userspace buffer which can be
@@ -182,7 +182,7 @@ typedef struct _drm_i915_cmdbuffer {
182 int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ 182 int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */
183 int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */ 183 int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */
184 int num_cliprects; /* mulitpass with multiple cliprects? */ 184 int num_cliprects; /* mulitpass with multiple cliprects? */
185 drm_clip_rect_t __user *cliprects; /* pointer to userspace cliprects */ 185 struct drm_clip_rect __user *cliprects; /* pointer to userspace cliprects */
186} drm_i915_cmdbuffer_t; 186} drm_i915_cmdbuffer_t;
187 187
188/* Userspace can request & wait on irq's: 188/* Userspace can request & wait on irq's:
@@ -259,7 +259,7 @@ typedef struct drm_i915_vblank_pipe {
259 */ 259 */
260typedef struct drm_i915_vblank_swap { 260typedef struct drm_i915_vblank_swap {
261 drm_drawable_t drawable; 261 drm_drawable_t drawable;
262 drm_vblank_seq_type_t seqtype; 262 enum drm_vblank_seq_type seqtype;
263 unsigned int sequence; 263 unsigned int sequence;
264} drm_i915_vblank_swap_t; 264} drm_i915_vblank_swap_t;
265 265
diff --git a/drivers/char/drm/i915_drv.h b/drivers/char/drm/i915_drv.h
index 85e323acb95d..fd918565f4e5 100644
--- a/drivers/char/drm/i915_drv.h
+++ b/drivers/char/drm/i915_drv.h
@@ -120,11 +120,11 @@ extern drm_ioctl_desc_t i915_ioctls[];
120extern int i915_max_ioctl; 120extern int i915_max_ioctl;
121 121
122 /* i915_dma.c */ 122 /* i915_dma.c */
123extern void i915_kernel_lost_context(drm_device_t * dev); 123extern void i915_kernel_lost_context(struct drm_device * dev);
124extern int i915_driver_load(struct drm_device *, unsigned long flags); 124extern int i915_driver_load(struct drm_device *, unsigned long flags);
125extern void i915_driver_lastclose(drm_device_t * dev); 125extern void i915_driver_lastclose(struct drm_device * dev);
126extern void i915_driver_preclose(drm_device_t * dev, DRMFILE filp); 126extern void i915_driver_preclose(struct drm_device * dev, DRMFILE filp);
127extern int i915_driver_device_is_agp(drm_device_t * dev); 127extern int i915_driver_device_is_agp(struct drm_device * dev);
128extern long i915_compat_ioctl(struct file *filp, unsigned int cmd, 128extern long i915_compat_ioctl(struct file *filp, unsigned int cmd,
129 unsigned long arg); 129 unsigned long arg);
130 130
@@ -132,12 +132,12 @@ extern long i915_compat_ioctl(struct file *filp, unsigned int cmd,
132extern int i915_irq_emit(DRM_IOCTL_ARGS); 132extern int i915_irq_emit(DRM_IOCTL_ARGS);
133extern int i915_irq_wait(DRM_IOCTL_ARGS); 133extern int i915_irq_wait(DRM_IOCTL_ARGS);
134 134
135extern int i915_driver_vblank_wait(drm_device_t *dev, unsigned int *sequence); 135extern int i915_driver_vblank_wait(struct drm_device *dev, unsigned int *sequence);
136extern int i915_driver_vblank_wait2(drm_device_t *dev, unsigned int *sequence); 136extern int i915_driver_vblank_wait2(struct drm_device *dev, unsigned int *sequence);
137extern irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS); 137extern irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS);
138extern void i915_driver_irq_preinstall(drm_device_t * dev); 138extern void i915_driver_irq_preinstall(struct drm_device * dev);
139extern void i915_driver_irq_postinstall(drm_device_t * dev); 139extern void i915_driver_irq_postinstall(struct drm_device * dev);
140extern void i915_driver_irq_uninstall(drm_device_t * dev); 140extern void i915_driver_irq_uninstall(struct drm_device * dev);
141extern int i915_vblank_pipe_set(DRM_IOCTL_ARGS); 141extern int i915_vblank_pipe_set(DRM_IOCTL_ARGS);
142extern int i915_vblank_pipe_get(DRM_IOCTL_ARGS); 142extern int i915_vblank_pipe_get(DRM_IOCTL_ARGS);
143extern int i915_vblank_swap(DRM_IOCTL_ARGS); 143extern int i915_vblank_swap(DRM_IOCTL_ARGS);
@@ -148,7 +148,7 @@ extern int i915_mem_free(DRM_IOCTL_ARGS);
148extern int i915_mem_init_heap(DRM_IOCTL_ARGS); 148extern int i915_mem_init_heap(DRM_IOCTL_ARGS);
149extern int i915_mem_destroy_heap(DRM_IOCTL_ARGS); 149extern int i915_mem_destroy_heap(DRM_IOCTL_ARGS);
150extern void i915_mem_takedown(struct mem_block **heap); 150extern void i915_mem_takedown(struct mem_block **heap);
151extern void i915_mem_release(drm_device_t * dev, 151extern void i915_mem_release(struct drm_device * dev,
152 DRMFILE filp, struct mem_block *heap); 152 DRMFILE filp, struct mem_block *heap);
153 153
154#define I915_READ(reg) DRM_READ32(dev_priv->mmio_map, (reg)) 154#define I915_READ(reg) DRM_READ32(dev_priv->mmio_map, (reg))
@@ -188,7 +188,7 @@ extern void i915_mem_release(drm_device_t * dev,
188 I915_WRITE(LP_RING + RING_TAIL, outring); \ 188 I915_WRITE(LP_RING + RING_TAIL, outring); \
189} while(0) 189} while(0)
190 190
191extern int i915_wait_ring(drm_device_t * dev, int n, const char *caller); 191extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
192 192
193#define GFX_OP_USER_INTERRUPT ((0<<29)|(2<<23)) 193#define GFX_OP_USER_INTERRUPT ((0<<29)|(2<<23))
194#define GFX_OP_BREAKPOINT_INTERRUPT ((0<<29)|(1<<23)) 194#define GFX_OP_BREAKPOINT_INTERRUPT ((0<<29)|(1<<23))
diff --git a/drivers/char/drm/i915_irq.c b/drivers/char/drm/i915_irq.c
index b92062a239f1..4b4b2ce89863 100644
--- a/drivers/char/drm/i915_irq.c
+++ b/drivers/char/drm/i915_irq.c
@@ -42,7 +42,7 @@
42 * 42 *
43 * This function will be called with the HW lock held. 43 * This function will be called with the HW lock held.
44 */ 44 */
45static void i915_vblank_tasklet(drm_device_t *dev) 45static void i915_vblank_tasklet(struct drm_device *dev)
46{ 46{
47 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 47 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
48 unsigned long irqflags; 48 unsigned long irqflags;
@@ -50,7 +50,7 @@ static void i915_vblank_tasklet(drm_device_t *dev)
50 int nhits, nrects, slice[2], upper[2], lower[2], i; 50 int nhits, nrects, slice[2], upper[2], lower[2], i;
51 unsigned counter[2] = { atomic_read(&dev->vbl_received), 51 unsigned counter[2] = { atomic_read(&dev->vbl_received),
52 atomic_read(&dev->vbl_received2) }; 52 atomic_read(&dev->vbl_received2) };
53 drm_drawable_info_t *drw; 53 struct drm_drawable_info *drw;
54 drm_i915_sarea_t *sarea_priv = dev_priv->sarea_priv; 54 drm_i915_sarea_t *sarea_priv = dev_priv->sarea_priv;
55 u32 cpp = dev_priv->cpp; 55 u32 cpp = dev_priv->cpp;
56 u32 cmd = (cpp == 4) ? (XY_SRC_COPY_BLT_CMD | 56 u32 cmd = (cpp == 4) ? (XY_SRC_COPY_BLT_CMD |
@@ -95,7 +95,7 @@ static void i915_vblank_tasklet(drm_device_t *dev)
95 list_for_each(hit, &hits) { 95 list_for_each(hit, &hits) {
96 drm_i915_vbl_swap_t *swap_cmp = 96 drm_i915_vbl_swap_t *swap_cmp =
97 list_entry(hit, drm_i915_vbl_swap_t, head); 97 list_entry(hit, drm_i915_vbl_swap_t, head);
98 drm_drawable_info_t *drw_cmp = 98 struct drm_drawable_info *drw_cmp =
99 drm_get_drawable_info(dev, swap_cmp->drw_id); 99 drm_get_drawable_info(dev, swap_cmp->drw_id);
100 100
101 if (drw_cmp && 101 if (drw_cmp &&
@@ -160,7 +160,7 @@ static void i915_vblank_tasklet(drm_device_t *dev)
160 list_for_each(hit, &hits) { 160 list_for_each(hit, &hits) {
161 drm_i915_vbl_swap_t *swap_hit = 161 drm_i915_vbl_swap_t *swap_hit =
162 list_entry(hit, drm_i915_vbl_swap_t, head); 162 list_entry(hit, drm_i915_vbl_swap_t, head);
163 drm_clip_rect_t *rect; 163 struct drm_clip_rect *rect;
164 int num_rects, pipe; 164 int num_rects, pipe;
165 unsigned short top, bottom; 165 unsigned short top, bottom;
166 166
@@ -211,7 +211,7 @@ static void i915_vblank_tasklet(drm_device_t *dev)
211 211
212irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) 212irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
213{ 213{
214 drm_device_t *dev = (drm_device_t *) arg; 214 struct drm_device *dev = (struct drm_device *) arg;
215 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 215 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
216 u16 temp; 216 u16 temp;
217 217
@@ -257,7 +257,7 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
257 return IRQ_HANDLED; 257 return IRQ_HANDLED;
258} 258}
259 259
260static int i915_emit_irq(drm_device_t * dev) 260static int i915_emit_irq(struct drm_device * dev)
261{ 261{
262 drm_i915_private_t *dev_priv = dev->dev_private; 262 drm_i915_private_t *dev_priv = dev->dev_private;
263 RING_LOCALS; 263 RING_LOCALS;
@@ -283,7 +283,7 @@ static int i915_emit_irq(drm_device_t * dev)
283 return dev_priv->counter; 283 return dev_priv->counter;
284} 284}
285 285
286static int i915_wait_irq(drm_device_t * dev, int irq_nr) 286static int i915_wait_irq(struct drm_device * dev, int irq_nr)
287{ 287{
288 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 288 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
289 int ret = 0; 289 int ret = 0;
@@ -309,7 +309,7 @@ static int i915_wait_irq(drm_device_t * dev, int irq_nr)
309 return ret; 309 return ret;
310} 310}
311 311
312static int i915_driver_vblank_do_wait(drm_device_t *dev, unsigned int *sequence, 312static int i915_driver_vblank_do_wait(struct drm_device *dev, unsigned int *sequence,
313 atomic_t *counter) 313 atomic_t *counter)
314{ 314{
315 drm_i915_private_t *dev_priv = dev->dev_private; 315 drm_i915_private_t *dev_priv = dev->dev_private;
@@ -331,12 +331,12 @@ static int i915_driver_vblank_do_wait(drm_device_t *dev, unsigned int *sequence,
331} 331}
332 332
333 333
334int i915_driver_vblank_wait(drm_device_t *dev, unsigned int *sequence) 334int i915_driver_vblank_wait(struct drm_device *dev, unsigned int *sequence)
335{ 335{
336 return i915_driver_vblank_do_wait(dev, sequence, &dev->vbl_received); 336 return i915_driver_vblank_do_wait(dev, sequence, &dev->vbl_received);
337} 337}
338 338
339int i915_driver_vblank_wait2(drm_device_t *dev, unsigned int *sequence) 339int i915_driver_vblank_wait2(struct drm_device *dev, unsigned int *sequence)
340{ 340{
341 return i915_driver_vblank_do_wait(dev, sequence, &dev->vbl_received2); 341 return i915_driver_vblank_do_wait(dev, sequence, &dev->vbl_received2);
342} 342}
@@ -389,7 +389,7 @@ int i915_irq_wait(DRM_IOCTL_ARGS)
389 return i915_wait_irq(dev, irqwait.irq_seq); 389 return i915_wait_irq(dev, irqwait.irq_seq);
390} 390}
391 391
392static void i915_enable_interrupt (drm_device_t *dev) 392static void i915_enable_interrupt (struct drm_device *dev)
393{ 393{
394 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 394 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
395 u16 flag; 395 u16 flag;
@@ -569,7 +569,7 @@ int i915_vblank_swap(DRM_IOCTL_ARGS)
569 569
570/* drm_dma.h hooks 570/* drm_dma.h hooks
571*/ 571*/
572void i915_driver_irq_preinstall(drm_device_t * dev) 572void i915_driver_irq_preinstall(struct drm_device * dev)
573{ 573{
574 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 574 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
575 575
@@ -578,7 +578,7 @@ void i915_driver_irq_preinstall(drm_device_t * dev)
578 I915_WRITE16(I915REG_INT_ENABLE_R, 0x0); 578 I915_WRITE16(I915REG_INT_ENABLE_R, 0x0);
579} 579}
580 580
581void i915_driver_irq_postinstall(drm_device_t * dev) 581void i915_driver_irq_postinstall(struct drm_device * dev)
582{ 582{
583 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 583 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
584 584
@@ -592,7 +592,7 @@ void i915_driver_irq_postinstall(drm_device_t * dev)
592 DRM_INIT_WAITQUEUE(&dev_priv->irq_queue); 592 DRM_INIT_WAITQUEUE(&dev_priv->irq_queue);
593} 593}
594 594
595void i915_driver_irq_uninstall(drm_device_t * dev) 595void i915_driver_irq_uninstall(struct drm_device * dev)
596{ 596{
597 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 597 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
598 u16 temp; 598 u16 temp;
diff --git a/drivers/char/drm/i915_mem.c b/drivers/char/drm/i915_mem.c
index 52c67324df58..50b4bacef0e0 100644
--- a/drivers/char/drm/i915_mem.c
+++ b/drivers/char/drm/i915_mem.c
@@ -43,11 +43,11 @@
43 * block to allocate, and the ring is drained prior to allocations -- 43 * block to allocate, and the ring is drained prior to allocations --
44 * in other words allocation is expensive. 44 * in other words allocation is expensive.
45 */ 45 */
46static void mark_block(drm_device_t * dev, struct mem_block *p, int in_use) 46static void mark_block(struct drm_device * dev, struct mem_block *p, int in_use)
47{ 47{
48 drm_i915_private_t *dev_priv = dev->dev_private; 48 drm_i915_private_t *dev_priv = dev->dev_private;
49 drm_i915_sarea_t *sarea_priv = dev_priv->sarea_priv; 49 drm_i915_sarea_t *sarea_priv = dev_priv->sarea_priv;
50 drm_tex_region_t *list; 50 struct drm_tex_region *list;
51 unsigned shift, nr; 51 unsigned shift, nr;
52 unsigned start; 52 unsigned start;
53 unsigned end; 53 unsigned end;
@@ -208,7 +208,7 @@ static int init_heap(struct mem_block **heap, int start, int size)
208 208
209/* Free all blocks associated with the releasing file. 209/* Free all blocks associated with the releasing file.
210 */ 210 */
211void i915_mem_release(drm_device_t * dev, DRMFILE filp, struct mem_block *heap) 211void i915_mem_release(struct drm_device * dev, DRMFILE filp, struct mem_block *heap)
212{ 212{
213 struct mem_block *p; 213 struct mem_block *p;
214 214
diff --git a/drivers/char/drm/mga_dma.c b/drivers/char/drm/mga_dma.c
index c2a4bac14521..9c73a6e3861b 100644
--- a/drivers/char/drm/mga_dma.c
+++ b/drivers/char/drm/mga_dma.c
@@ -46,7 +46,7 @@
46 46
47#define MINIMAL_CLEANUP 0 47#define MINIMAL_CLEANUP 0
48#define FULL_CLEANUP 1 48#define FULL_CLEANUP 1
49static int mga_do_cleanup_dma(drm_device_t *dev, int full_cleanup); 49static int mga_do_cleanup_dma(struct drm_device *dev, int full_cleanup);
50 50
51/* ================================================================ 51/* ================================================================
52 * Engine control 52 * Engine control
@@ -224,7 +224,7 @@ void mga_do_dma_wrap_end(drm_mga_private_t * dev_priv)
224#define MGA_BUFFER_FREE 0 224#define MGA_BUFFER_FREE 0
225 225
226#if MGA_FREELIST_DEBUG 226#if MGA_FREELIST_DEBUG
227static void mga_freelist_print(drm_device_t * dev) 227static void mga_freelist_print(struct drm_device * dev)
228{ 228{
229 drm_mga_private_t *dev_priv = dev->dev_private; 229 drm_mga_private_t *dev_priv = dev->dev_private;
230 drm_mga_freelist_t *entry; 230 drm_mga_freelist_t *entry;
@@ -245,10 +245,10 @@ static void mga_freelist_print(drm_device_t * dev)
245} 245}
246#endif 246#endif
247 247
248static int mga_freelist_init(drm_device_t * dev, drm_mga_private_t * dev_priv) 248static int mga_freelist_init(struct drm_device * dev, drm_mga_private_t * dev_priv)
249{ 249{
250 drm_device_dma_t *dma = dev->dma; 250 struct drm_device_dma *dma = dev->dma;
251 drm_buf_t *buf; 251 struct drm_buf *buf;
252 drm_mga_buf_priv_t *buf_priv; 252 drm_mga_buf_priv_t *buf_priv;
253 drm_mga_freelist_t *entry; 253 drm_mga_freelist_t *entry;
254 int i; 254 int i;
@@ -291,7 +291,7 @@ static int mga_freelist_init(drm_device_t * dev, drm_mga_private_t * dev_priv)
291 return 0; 291 return 0;
292} 292}
293 293
294static void mga_freelist_cleanup(drm_device_t * dev) 294static void mga_freelist_cleanup(struct drm_device * dev)
295{ 295{
296 drm_mga_private_t *dev_priv = dev->dev_private; 296 drm_mga_private_t *dev_priv = dev->dev_private;
297 drm_mga_freelist_t *entry; 297 drm_mga_freelist_t *entry;
@@ -311,10 +311,10 @@ static void mga_freelist_cleanup(drm_device_t * dev)
311#if 0 311#if 0
312/* FIXME: Still needed? 312/* FIXME: Still needed?
313 */ 313 */
314static void mga_freelist_reset(drm_device_t * dev) 314static void mga_freelist_reset(struct drm_device * dev)
315{ 315{
316 drm_device_dma_t *dma = dev->dma; 316 struct drm_device_dma *dma = dev->dma;
317 drm_buf_t *buf; 317 struct drm_buf *buf;
318 drm_mga_buf_priv_t *buf_priv; 318 drm_mga_buf_priv_t *buf_priv;
319 int i; 319 int i;
320 320
@@ -326,7 +326,7 @@ static void mga_freelist_reset(drm_device_t * dev)
326} 326}
327#endif 327#endif
328 328
329static drm_buf_t *mga_freelist_get(drm_device_t * dev) 329static struct drm_buf *mga_freelist_get(struct drm_device * dev)
330{ 330{
331 drm_mga_private_t *dev_priv = dev->dev_private; 331 drm_mga_private_t *dev_priv = dev->dev_private;
332 drm_mga_freelist_t *next; 332 drm_mga_freelist_t *next;
@@ -359,7 +359,7 @@ static drm_buf_t *mga_freelist_get(drm_device_t * dev)
359 return NULL; 359 return NULL;
360} 360}
361 361
362int mga_freelist_put(drm_device_t * dev, drm_buf_t * buf) 362int mga_freelist_put(struct drm_device * dev, struct drm_buf * buf)
363{ 363{
364 drm_mga_private_t *dev_priv = dev->dev_private; 364 drm_mga_private_t *dev_priv = dev->dev_private;
365 drm_mga_buf_priv_t *buf_priv = buf->dev_private; 365 drm_mga_buf_priv_t *buf_priv = buf->dev_private;
@@ -393,7 +393,7 @@ int mga_freelist_put(drm_device_t * dev, drm_buf_t * buf)
393 * DMA initialization, cleanup 393 * DMA initialization, cleanup
394 */ 394 */
395 395
396int mga_driver_load(drm_device_t * dev, unsigned long flags) 396int mga_driver_load(struct drm_device * dev, unsigned long flags)
397{ 397{
398 drm_mga_private_t *dev_priv; 398 drm_mga_private_t *dev_priv;
399 399
@@ -434,7 +434,7 @@ int mga_driver_load(drm_device_t * dev, unsigned long flags)
434 * 434 *
435 * \sa mga_do_dma_bootstrap, mga_do_pci_dma_bootstrap 435 * \sa mga_do_dma_bootstrap, mga_do_pci_dma_bootstrap
436 */ 436 */
437static int mga_do_agp_dma_bootstrap(drm_device_t * dev, 437static int mga_do_agp_dma_bootstrap(struct drm_device * dev,
438 drm_mga_dma_bootstrap_t * dma_bs) 438 drm_mga_dma_bootstrap_t * dma_bs)
439{ 439{
440 drm_mga_private_t *const dev_priv = 440 drm_mga_private_t *const dev_priv =
@@ -445,11 +445,11 @@ static int mga_do_agp_dma_bootstrap(drm_device_t * dev,
445 const unsigned secondary_size = dma_bs->secondary_bin_count 445 const unsigned secondary_size = dma_bs->secondary_bin_count
446 * dma_bs->secondary_bin_size; 446 * dma_bs->secondary_bin_size;
447 const unsigned agp_size = (dma_bs->agp_size << 20); 447 const unsigned agp_size = (dma_bs->agp_size << 20);
448 drm_buf_desc_t req; 448 struct drm_buf_desc req;
449 drm_agp_mode_t mode; 449 struct drm_agp_mode mode;
450 drm_agp_info_t info; 450 struct drm_agp_info info;
451 drm_agp_buffer_t agp_req; 451 struct drm_agp_buffer agp_req;
452 drm_agp_binding_t bind_req; 452 struct drm_agp_binding bind_req;
453 453
454 /* Acquire AGP. */ 454 /* Acquire AGP. */
455 err = drm_agp_acquire(dev); 455 err = drm_agp_acquire(dev);
@@ -548,10 +548,10 @@ static int mga_do_agp_dma_bootstrap(drm_device_t * dev,
548 } 548 }
549 549
550 { 550 {
551 drm_map_list_t *_entry; 551 struct drm_map_list *_entry;
552 unsigned long agp_token = 0; 552 unsigned long agp_token = 0;
553 553
554 list_for_each_entry(_entry, &dev->maplist->head, head) { 554 list_for_each_entry(_entry, &dev->maplist, head) {
555 if (_entry->map == dev->agp_buffer_map) 555 if (_entry->map == dev->agp_buffer_map)
556 agp_token = _entry->user_token; 556 agp_token = _entry->user_token;
557 } 557 }
@@ -588,7 +588,7 @@ static int mga_do_agp_dma_bootstrap(drm_device_t * dev,
588 return 0; 588 return 0;
589} 589}
590#else 590#else
591static int mga_do_agp_dma_bootstrap(drm_device_t * dev, 591static int mga_do_agp_dma_bootstrap(struct drm_device * dev,
592 drm_mga_dma_bootstrap_t * dma_bs) 592 drm_mga_dma_bootstrap_t * dma_bs)
593{ 593{
594 return -EINVAL; 594 return -EINVAL;
@@ -609,7 +609,7 @@ static int mga_do_agp_dma_bootstrap(drm_device_t * dev,
609 * 609 *
610 * \sa mga_do_dma_bootstrap, mga_do_agp_dma_bootstrap 610 * \sa mga_do_dma_bootstrap, mga_do_agp_dma_bootstrap
611 */ 611 */
612static int mga_do_pci_dma_bootstrap(drm_device_t * dev, 612static int mga_do_pci_dma_bootstrap(struct drm_device * dev,
613 drm_mga_dma_bootstrap_t * dma_bs) 613 drm_mga_dma_bootstrap_t * dma_bs)
614{ 614{
615 drm_mga_private_t *const dev_priv = 615 drm_mga_private_t *const dev_priv =
@@ -618,7 +618,7 @@ static int mga_do_pci_dma_bootstrap(drm_device_t * dev,
618 unsigned int primary_size; 618 unsigned int primary_size;
619 unsigned int bin_count; 619 unsigned int bin_count;
620 int err; 620 int err;
621 drm_buf_desc_t req; 621 struct drm_buf_desc req;
622 622
623 if (dev->dma == NULL) { 623 if (dev->dma == NULL) {
624 DRM_ERROR("dev->dma is NULL\n"); 624 DRM_ERROR("dev->dma is NULL\n");
@@ -699,7 +699,7 @@ static int mga_do_pci_dma_bootstrap(drm_device_t * dev,
699 return 0; 699 return 0;
700} 700}
701 701
702static int mga_do_dma_bootstrap(drm_device_t * dev, 702static int mga_do_dma_bootstrap(struct drm_device * dev,
703 drm_mga_dma_bootstrap_t * dma_bs) 703 drm_mga_dma_bootstrap_t * dma_bs)
704{ 704{
705 const int is_agp = (dma_bs->agp_mode != 0) && drm_device_is_agp(dev); 705 const int is_agp = (dma_bs->agp_mode != 0) && drm_device_is_agp(dev);
@@ -793,7 +793,7 @@ int mga_dma_bootstrap(DRM_IOCTL_ARGS)
793 return err; 793 return err;
794} 794}
795 795
796static int mga_do_init_dma(drm_device_t * dev, drm_mga_init_t * init) 796static int mga_do_init_dma(struct drm_device * dev, drm_mga_init_t * init)
797{ 797{
798 drm_mga_private_t *dev_priv; 798 drm_mga_private_t *dev_priv;
799 int ret; 799 int ret;
@@ -823,8 +823,7 @@ static int mga_do_init_dma(drm_device_t * dev, drm_mga_init_t * init)
823 dev_priv->texture_offset = init->texture_offset[0]; 823 dev_priv->texture_offset = init->texture_offset[0];
824 dev_priv->texture_size = init->texture_size[0]; 824 dev_priv->texture_size = init->texture_size[0];
825 825
826 DRM_GETSAREA(); 826 dev_priv->sarea = drm_getsarea(dev);
827
828 if (!dev_priv->sarea) { 827 if (!dev_priv->sarea) {
829 DRM_ERROR("failed to find sarea!\n"); 828 DRM_ERROR("failed to find sarea!\n");
830 return DRM_ERR(EINVAL); 829 return DRM_ERR(EINVAL);
@@ -934,7 +933,7 @@ static int mga_do_init_dma(drm_device_t * dev, drm_mga_init_t * init)
934 return 0; 933 return 0;
935} 934}
936 935
937static int mga_do_cleanup_dma(drm_device_t *dev, int full_cleanup) 936static int mga_do_cleanup_dma(struct drm_device *dev, int full_cleanup)
938{ 937{
939 int err = 0; 938 int err = 0;
940 DRM_DEBUG("\n"); 939 DRM_DEBUG("\n");
@@ -963,8 +962,8 @@ static int mga_do_cleanup_dma(drm_device_t *dev, int full_cleanup)
963 if (dev_priv->used_new_dma_init) { 962 if (dev_priv->used_new_dma_init) {
964#if __OS_HAS_AGP 963#if __OS_HAS_AGP
965 if (dev_priv->agp_handle != 0) { 964 if (dev_priv->agp_handle != 0) {
966 drm_agp_binding_t unbind_req; 965 struct drm_agp_binding unbind_req;
967 drm_agp_buffer_t free_req; 966 struct drm_agp_buffer free_req;
968 967
969 unbind_req.handle = dev_priv->agp_handle; 968 unbind_req.handle = dev_priv->agp_handle;
970 drm_agp_unbind(dev, &unbind_req); 969 drm_agp_unbind(dev, &unbind_req);
@@ -1041,11 +1040,11 @@ int mga_dma_flush(DRM_IOCTL_ARGS)
1041{ 1040{
1042 DRM_DEVICE; 1041 DRM_DEVICE;
1043 drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; 1042 drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private;
1044 drm_lock_t lock; 1043 struct drm_lock lock;
1045 1044
1046 LOCK_TEST_WITH_RETURN(dev, filp); 1045 LOCK_TEST_WITH_RETURN(dev, filp);
1047 1046
1048 DRM_COPY_FROM_USER_IOCTL(lock, (drm_lock_t __user *) data, 1047 DRM_COPY_FROM_USER_IOCTL(lock, (struct drm_lock __user *) data,
1049 sizeof(lock)); 1048 sizeof(lock));
1050 1049
1051 DRM_DEBUG("%s%s%s\n", 1050 DRM_DEBUG("%s%s%s\n",
@@ -1087,9 +1086,9 @@ int mga_dma_reset(DRM_IOCTL_ARGS)
1087 * DMA buffer management 1086 * DMA buffer management
1088 */ 1087 */
1089 1088
1090static int mga_dma_get_buffers(DRMFILE filp, drm_device_t * dev, drm_dma_t * d) 1089static int mga_dma_get_buffers(DRMFILE filp, struct drm_device * dev, struct drm_dma * d)
1091{ 1090{
1092 drm_buf_t *buf; 1091 struct drm_buf *buf;
1093 int i; 1092 int i;
1094 1093
1095 for (i = d->granted_count; i < d->request_count; i++) { 1094 for (i = d->granted_count; i < d->request_count; i++) {
@@ -1114,10 +1113,10 @@ static int mga_dma_get_buffers(DRMFILE filp, drm_device_t * dev, drm_dma_t * d)
1114int mga_dma_buffers(DRM_IOCTL_ARGS) 1113int mga_dma_buffers(DRM_IOCTL_ARGS)
1115{ 1114{
1116 DRM_DEVICE; 1115 DRM_DEVICE;
1117 drm_device_dma_t *dma = dev->dma; 1116 struct drm_device_dma *dma = dev->dma;
1118 drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; 1117 drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private;
1119 drm_dma_t __user *argp = (void __user *)data; 1118 struct drm_dma __user *argp = (void __user *)data;
1120 drm_dma_t d; 1119 struct drm_dma d;
1121 int ret = 0; 1120 int ret = 0;
1122 1121
1123 LOCK_TEST_WITH_RETURN(dev, filp); 1122 LOCK_TEST_WITH_RETURN(dev, filp);
@@ -1156,7 +1155,7 @@ int mga_dma_buffers(DRM_IOCTL_ARGS)
1156/** 1155/**
1157 * Called just before the module is unloaded. 1156 * Called just before the module is unloaded.
1158 */ 1157 */
1159int mga_driver_unload(drm_device_t * dev) 1158int mga_driver_unload(struct drm_device * dev)
1160{ 1159{
1161 drm_free(dev->dev_private, sizeof(drm_mga_private_t), DRM_MEM_DRIVER); 1160 drm_free(dev->dev_private, sizeof(drm_mga_private_t), DRM_MEM_DRIVER);
1162 dev->dev_private = NULL; 1161 dev->dev_private = NULL;
@@ -1167,12 +1166,12 @@ int mga_driver_unload(drm_device_t * dev)
1167/** 1166/**
1168 * Called when the last opener of the device is closed. 1167 * Called when the last opener of the device is closed.
1169 */ 1168 */
1170void mga_driver_lastclose(drm_device_t * dev) 1169void mga_driver_lastclose(struct drm_device * dev)
1171{ 1170{
1172 mga_do_cleanup_dma(dev, FULL_CLEANUP); 1171 mga_do_cleanup_dma(dev, FULL_CLEANUP);
1173} 1172}
1174 1173
1175int mga_driver_dma_quiescent(drm_device_t * dev) 1174int mga_driver_dma_quiescent(struct drm_device * dev)
1176{ 1175{
1177 drm_mga_private_t *dev_priv = dev->dev_private; 1176 drm_mga_private_t *dev_priv = dev->dev_private;
1178 return mga_do_wait_for_idle(dev_priv); 1177 return mga_do_wait_for_idle(dev_priv);
diff --git a/drivers/char/drm/mga_drm.h b/drivers/char/drm/mga_drm.h
index 44d1293e2947..944b50a5ff24 100644
--- a/drivers/char/drm/mga_drm.h
+++ b/drivers/char/drm/mga_drm.h
@@ -181,7 +181,7 @@ typedef struct _drm_mga_sarea {
181 181
182 /* The current cliprects, or a subset thereof. 182 /* The current cliprects, or a subset thereof.
183 */ 183 */
184 drm_clip_rect_t boxes[MGA_NR_SAREA_CLIPRECTS]; 184 struct drm_clip_rect boxes[MGA_NR_SAREA_CLIPRECTS];
185 unsigned int nbox; 185 unsigned int nbox;
186 186
187 /* Information about the most recently used 3d drawable. The 187 /* Information about the most recently used 3d drawable. The
@@ -202,7 +202,7 @@ typedef struct _drm_mga_sarea {
202 unsigned int exported_nback; 202 unsigned int exported_nback;
203 int exported_back_x, exported_front_x, exported_w; 203 int exported_back_x, exported_front_x, exported_w;
204 int exported_back_y, exported_front_y, exported_h; 204 int exported_back_y, exported_front_y, exported_h;
205 drm_clip_rect_t exported_boxes[MGA_NR_SAREA_CLIPRECTS]; 205 struct drm_clip_rect exported_boxes[MGA_NR_SAREA_CLIPRECTS];
206 206
207 /* Counters for aging textures and for client-side throttling. 207 /* Counters for aging textures and for client-side throttling.
208 */ 208 */
@@ -216,7 +216,7 @@ typedef struct _drm_mga_sarea {
216 216
217 /* LRU lists for texture memory in agp space and on the card. 217 /* LRU lists for texture memory in agp space and on the card.
218 */ 218 */
219 drm_tex_region_t texList[MGA_NR_TEX_HEAPS][MGA_NR_TEX_REGIONS + 1]; 219 struct drm_tex_region texList[MGA_NR_TEX_HEAPS][MGA_NR_TEX_REGIONS + 1];
220 unsigned int texAge[MGA_NR_TEX_HEAPS]; 220 unsigned int texAge[MGA_NR_TEX_HEAPS];
221 221
222 /* Mechanism to validate card state. 222 /* Mechanism to validate card state.
diff --git a/drivers/char/drm/mga_drv.c b/drivers/char/drm/mga_drv.c
index be49dbb9ec3f..5572939fc7d1 100644
--- a/drivers/char/drm/mga_drv.c
+++ b/drivers/char/drm/mga_drv.c
@@ -36,7 +36,7 @@
36 36
37#include "drm_pciids.h" 37#include "drm_pciids.h"
38 38
39static int mga_driver_device_is_agp(drm_device_t * dev); 39static int mga_driver_device_is_agp(struct drm_device * dev);
40 40
41static struct pci_device_id pciidlist[] = { 41static struct pci_device_id pciidlist[] = {
42 mga_PCI_IDS 42 mga_PCI_IDS
@@ -118,7 +118,7 @@ MODULE_LICENSE("GPL and additional rights");
118 * \returns 118 * \returns
119 * If the device is a PCI G450, zero is returned. Otherwise 2 is returned. 119 * If the device is a PCI G450, zero is returned. Otherwise 2 is returned.
120 */ 120 */
121static int mga_driver_device_is_agp(drm_device_t * dev) 121static int mga_driver_device_is_agp(struct drm_device * dev)
122{ 122{
123 const struct pci_dev *const pdev = dev->pdev; 123 const struct pci_dev *const pdev = dev->pdev;
124 124
diff --git a/drivers/char/drm/mga_drv.h b/drivers/char/drm/mga_drv.h
index 6b0c53193506..49253affa475 100644
--- a/drivers/char/drm/mga_drv.h
+++ b/drivers/char/drm/mga_drv.h
@@ -65,7 +65,7 @@ typedef struct drm_mga_freelist {
65 struct drm_mga_freelist *next; 65 struct drm_mga_freelist *next;
66 struct drm_mga_freelist *prev; 66 struct drm_mga_freelist *prev;
67 drm_mga_age_t age; 67 drm_mga_age_t age;
68 drm_buf_t *buf; 68 struct drm_buf *buf;
69} drm_mga_freelist_t; 69} drm_mga_freelist_t;
70 70
71typedef struct { 71typedef struct {
@@ -157,10 +157,10 @@ extern int mga_dma_init(DRM_IOCTL_ARGS);
157extern int mga_dma_flush(DRM_IOCTL_ARGS); 157extern int mga_dma_flush(DRM_IOCTL_ARGS);
158extern int mga_dma_reset(DRM_IOCTL_ARGS); 158extern int mga_dma_reset(DRM_IOCTL_ARGS);
159extern int mga_dma_buffers(DRM_IOCTL_ARGS); 159extern int mga_dma_buffers(DRM_IOCTL_ARGS);
160extern int mga_driver_load(drm_device_t *dev, unsigned long flags); 160extern int mga_driver_load(struct drm_device *dev, unsigned long flags);
161extern int mga_driver_unload(drm_device_t * dev); 161extern int mga_driver_unload(struct drm_device * dev);
162extern void mga_driver_lastclose(drm_device_t * dev); 162extern void mga_driver_lastclose(struct drm_device * dev);
163extern int mga_driver_dma_quiescent(drm_device_t * dev); 163extern int mga_driver_dma_quiescent(struct drm_device * dev);
164 164
165extern int mga_do_wait_for_idle(drm_mga_private_t * dev_priv); 165extern int mga_do_wait_for_idle(drm_mga_private_t * dev_priv);
166 166
@@ -168,7 +168,7 @@ extern void mga_do_dma_flush(drm_mga_private_t * dev_priv);
168extern void mga_do_dma_wrap_start(drm_mga_private_t * dev_priv); 168extern void mga_do_dma_wrap_start(drm_mga_private_t * dev_priv);
169extern void mga_do_dma_wrap_end(drm_mga_private_t * dev_priv); 169extern void mga_do_dma_wrap_end(drm_mga_private_t * dev_priv);
170 170
171extern int mga_freelist_put(drm_device_t * dev, drm_buf_t * buf); 171extern int mga_freelist_put(struct drm_device * dev, struct drm_buf * buf);
172 172
173 /* mga_warp.c */ 173 /* mga_warp.c */
174extern unsigned int mga_warp_microcode_size(const drm_mga_private_t * dev_priv); 174extern unsigned int mga_warp_microcode_size(const drm_mga_private_t * dev_priv);
@@ -176,12 +176,12 @@ extern int mga_warp_install_microcode(drm_mga_private_t * dev_priv);
176extern int mga_warp_init(drm_mga_private_t * dev_priv); 176extern int mga_warp_init(drm_mga_private_t * dev_priv);
177 177
178 /* mga_irq.c */ 178 /* mga_irq.c */
179extern int mga_driver_fence_wait(drm_device_t * dev, unsigned int *sequence); 179extern int mga_driver_fence_wait(struct drm_device * dev, unsigned int *sequence);
180extern int mga_driver_vblank_wait(drm_device_t * dev, unsigned int *sequence); 180extern int mga_driver_vblank_wait(struct drm_device * dev, unsigned int *sequence);
181extern irqreturn_t mga_driver_irq_handler(DRM_IRQ_ARGS); 181extern irqreturn_t mga_driver_irq_handler(DRM_IRQ_ARGS);
182extern void mga_driver_irq_preinstall(drm_device_t * dev); 182extern void mga_driver_irq_preinstall(struct drm_device * dev);
183extern void mga_driver_irq_postinstall(drm_device_t * dev); 183extern void mga_driver_irq_postinstall(struct drm_device * dev);
184extern void mga_driver_irq_uninstall(drm_device_t * dev); 184extern void mga_driver_irq_uninstall(struct drm_device * dev);
185extern long mga_compat_ioctl(struct file *filp, unsigned int cmd, 185extern long mga_compat_ioctl(struct file *filp, unsigned int cmd,
186 unsigned long arg); 186 unsigned long arg);
187 187
diff --git a/drivers/char/drm/mga_irq.c b/drivers/char/drm/mga_irq.c
index eb9644024172..9302cb8f0f83 100644
--- a/drivers/char/drm/mga_irq.c
+++ b/drivers/char/drm/mga_irq.c
@@ -37,7 +37,7 @@
37 37
38irqreturn_t mga_driver_irq_handler(DRM_IRQ_ARGS) 38irqreturn_t mga_driver_irq_handler(DRM_IRQ_ARGS)
39{ 39{
40 drm_device_t *dev = (drm_device_t *) arg; 40 struct drm_device *dev = (struct drm_device *) arg;
41 drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; 41 drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private;
42 int status; 42 int status;
43 int handled = 0; 43 int handled = 0;
@@ -78,7 +78,7 @@ irqreturn_t mga_driver_irq_handler(DRM_IRQ_ARGS)
78 return IRQ_NONE; 78 return IRQ_NONE;
79} 79}
80 80
81int mga_driver_vblank_wait(drm_device_t * dev, unsigned int *sequence) 81int mga_driver_vblank_wait(struct drm_device * dev, unsigned int *sequence)
82{ 82{
83 unsigned int cur_vblank; 83 unsigned int cur_vblank;
84 int ret = 0; 84 int ret = 0;
@@ -96,7 +96,7 @@ int mga_driver_vblank_wait(drm_device_t * dev, unsigned int *sequence)
96 return ret; 96 return ret;
97} 97}
98 98
99int mga_driver_fence_wait(drm_device_t * dev, unsigned int *sequence) 99int mga_driver_fence_wait(struct drm_device * dev, unsigned int *sequence)
100{ 100{
101 drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; 101 drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private;
102 unsigned int cur_fence; 102 unsigned int cur_fence;
@@ -115,7 +115,7 @@ int mga_driver_fence_wait(drm_device_t * dev, unsigned int *sequence)
115 return ret; 115 return ret;
116} 116}
117 117
118void mga_driver_irq_preinstall(drm_device_t * dev) 118void mga_driver_irq_preinstall(struct drm_device * dev)
119{ 119{
120 drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; 120 drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private;
121 121
@@ -125,7 +125,7 @@ void mga_driver_irq_preinstall(drm_device_t * dev)
125 MGA_WRITE(MGA_ICLEAR, ~0); 125 MGA_WRITE(MGA_ICLEAR, ~0);
126} 126}
127 127
128void mga_driver_irq_postinstall(drm_device_t * dev) 128void mga_driver_irq_postinstall(struct drm_device * dev)
129{ 129{
130 drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; 130 drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private;
131 131
@@ -135,7 +135,7 @@ void mga_driver_irq_postinstall(drm_device_t * dev)
135 MGA_WRITE(MGA_IEN, MGA_VLINEIEN | MGA_SOFTRAPEN); 135 MGA_WRITE(MGA_IEN, MGA_VLINEIEN | MGA_SOFTRAPEN);
136} 136}
137 137
138void mga_driver_irq_uninstall(drm_device_t * dev) 138void mga_driver_irq_uninstall(struct drm_device * dev)
139{ 139{
140 drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; 140 drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private;
141 if (!dev_priv) 141 if (!dev_priv)
diff --git a/drivers/char/drm/mga_state.c b/drivers/char/drm/mga_state.c
index 2837e669183a..d448b0aef33c 100644
--- a/drivers/char/drm/mga_state.c
+++ b/drivers/char/drm/mga_state.c
@@ -42,7 +42,7 @@
42 */ 42 */
43 43
44static void mga_emit_clip_rect(drm_mga_private_t * dev_priv, 44static void mga_emit_clip_rect(drm_mga_private_t * dev_priv,
45 drm_clip_rect_t * box) 45 struct drm_clip_rect * box)
46{ 46{
47 drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; 47 drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
48 drm_mga_context_regs_t *ctx = &sarea_priv->context_state; 48 drm_mga_context_regs_t *ctx = &sarea_priv->context_state;
@@ -480,12 +480,12 @@ static int mga_verify_blit(drm_mga_private_t * dev_priv,
480 * 480 *
481 */ 481 */
482 482
483static void mga_dma_dispatch_clear(drm_device_t * dev, drm_mga_clear_t * clear) 483static void mga_dma_dispatch_clear(struct drm_device * dev, drm_mga_clear_t * clear)
484{ 484{
485 drm_mga_private_t *dev_priv = dev->dev_private; 485 drm_mga_private_t *dev_priv = dev->dev_private;
486 drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; 486 drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
487 drm_mga_context_regs_t *ctx = &sarea_priv->context_state; 487 drm_mga_context_regs_t *ctx = &sarea_priv->context_state;
488 drm_clip_rect_t *pbox = sarea_priv->boxes; 488 struct drm_clip_rect *pbox = sarea_priv->boxes;
489 int nbox = sarea_priv->nbox; 489 int nbox = sarea_priv->nbox;
490 int i; 490 int i;
491 DMA_LOCALS; 491 DMA_LOCALS;
@@ -500,7 +500,7 @@ static void mga_dma_dispatch_clear(drm_device_t * dev, drm_mga_clear_t * clear)
500 ADVANCE_DMA(); 500 ADVANCE_DMA();
501 501
502 for (i = 0; i < nbox; i++) { 502 for (i = 0; i < nbox; i++) {
503 drm_clip_rect_t *box = &pbox[i]; 503 struct drm_clip_rect *box = &pbox[i];
504 u32 height = box->y2 - box->y1; 504 u32 height = box->y2 - box->y1;
505 505
506 DRM_DEBUG(" from=%d,%d to=%d,%d\n", 506 DRM_DEBUG(" from=%d,%d to=%d,%d\n",
@@ -568,12 +568,12 @@ static void mga_dma_dispatch_clear(drm_device_t * dev, drm_mga_clear_t * clear)
568 FLUSH_DMA(); 568 FLUSH_DMA();
569} 569}
570 570
571static void mga_dma_dispatch_swap(drm_device_t * dev) 571static void mga_dma_dispatch_swap(struct drm_device * dev)
572{ 572{
573 drm_mga_private_t *dev_priv = dev->dev_private; 573 drm_mga_private_t *dev_priv = dev->dev_private;
574 drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; 574 drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
575 drm_mga_context_regs_t *ctx = &sarea_priv->context_state; 575 drm_mga_context_regs_t *ctx = &sarea_priv->context_state;
576 drm_clip_rect_t *pbox = sarea_priv->boxes; 576 struct drm_clip_rect *pbox = sarea_priv->boxes;
577 int nbox = sarea_priv->nbox; 577 int nbox = sarea_priv->nbox;
578 int i; 578 int i;
579 DMA_LOCALS; 579 DMA_LOCALS;
@@ -598,7 +598,7 @@ static void mga_dma_dispatch_swap(drm_device_t * dev)
598 MGA_PLNWT, 0xffffffff, MGA_DWGCTL, MGA_DWGCTL_COPY); 598 MGA_PLNWT, 0xffffffff, MGA_DWGCTL, MGA_DWGCTL_COPY);
599 599
600 for (i = 0; i < nbox; i++) { 600 for (i = 0; i < nbox; i++) {
601 drm_clip_rect_t *box = &pbox[i]; 601 struct drm_clip_rect *box = &pbox[i];
602 u32 height = box->y2 - box->y1; 602 u32 height = box->y2 - box->y1;
603 u32 start = box->y1 * dev_priv->front_pitch; 603 u32 start = box->y1 * dev_priv->front_pitch;
604 604
@@ -622,7 +622,7 @@ static void mga_dma_dispatch_swap(drm_device_t * dev)
622 DRM_DEBUG("%s... done.\n", __FUNCTION__); 622 DRM_DEBUG("%s... done.\n", __FUNCTION__);
623} 623}
624 624
625static void mga_dma_dispatch_vertex(drm_device_t * dev, drm_buf_t * buf) 625static void mga_dma_dispatch_vertex(struct drm_device * dev, struct drm_buf * buf)
626{ 626{
627 drm_mga_private_t *dev_priv = dev->dev_private; 627 drm_mga_private_t *dev_priv = dev->dev_private;
628 drm_mga_buf_priv_t *buf_priv = buf->dev_private; 628 drm_mga_buf_priv_t *buf_priv = buf->dev_private;
@@ -669,7 +669,7 @@ static void mga_dma_dispatch_vertex(drm_device_t * dev, drm_buf_t * buf)
669 FLUSH_DMA(); 669 FLUSH_DMA();
670} 670}
671 671
672static void mga_dma_dispatch_indices(drm_device_t * dev, drm_buf_t * buf, 672static void mga_dma_dispatch_indices(struct drm_device * dev, struct drm_buf * buf,
673 unsigned int start, unsigned int end) 673 unsigned int start, unsigned int end)
674{ 674{
675 drm_mga_private_t *dev_priv = dev->dev_private; 675 drm_mga_private_t *dev_priv = dev->dev_private;
@@ -718,7 +718,7 @@ static void mga_dma_dispatch_indices(drm_device_t * dev, drm_buf_t * buf,
718/* This copies a 64 byte aligned agp region to the frambuffer with a 718/* This copies a 64 byte aligned agp region to the frambuffer with a
719 * standard blit, the ioctl needs to do checking. 719 * standard blit, the ioctl needs to do checking.
720 */ 720 */
721static void mga_dma_dispatch_iload(drm_device_t * dev, drm_buf_t * buf, 721static void mga_dma_dispatch_iload(struct drm_device * dev, struct drm_buf * buf,
722 unsigned int dstorg, unsigned int length) 722 unsigned int dstorg, unsigned int length)
723{ 723{
724 drm_mga_private_t *dev_priv = dev->dev_private; 724 drm_mga_private_t *dev_priv = dev->dev_private;
@@ -766,12 +766,12 @@ static void mga_dma_dispatch_iload(drm_device_t * dev, drm_buf_t * buf,
766 FLUSH_DMA(); 766 FLUSH_DMA();
767} 767}
768 768
769static void mga_dma_dispatch_blit(drm_device_t * dev, drm_mga_blit_t * blit) 769static void mga_dma_dispatch_blit(struct drm_device * dev, drm_mga_blit_t * blit)
770{ 770{
771 drm_mga_private_t *dev_priv = dev->dev_private; 771 drm_mga_private_t *dev_priv = dev->dev_private;
772 drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; 772 drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
773 drm_mga_context_regs_t *ctx = &sarea_priv->context_state; 773 drm_mga_context_regs_t *ctx = &sarea_priv->context_state;
774 drm_clip_rect_t *pbox = sarea_priv->boxes; 774 struct drm_clip_rect *pbox = sarea_priv->boxes;
775 int nbox = sarea_priv->nbox; 775 int nbox = sarea_priv->nbox;
776 u32 scandir = 0, i; 776 u32 scandir = 0, i;
777 DMA_LOCALS; 777 DMA_LOCALS;
@@ -880,8 +880,8 @@ static int mga_dma_vertex(DRM_IOCTL_ARGS)
880{ 880{
881 DRM_DEVICE; 881 DRM_DEVICE;
882 drm_mga_private_t *dev_priv = dev->dev_private; 882 drm_mga_private_t *dev_priv = dev->dev_private;
883 drm_device_dma_t *dma = dev->dma; 883 struct drm_device_dma *dma = dev->dma;
884 drm_buf_t *buf; 884 struct drm_buf *buf;
885 drm_mga_buf_priv_t *buf_priv; 885 drm_mga_buf_priv_t *buf_priv;
886 drm_mga_vertex_t vertex; 886 drm_mga_vertex_t vertex;
887 887
@@ -920,8 +920,8 @@ static int mga_dma_indices(DRM_IOCTL_ARGS)
920{ 920{
921 DRM_DEVICE; 921 DRM_DEVICE;
922 drm_mga_private_t *dev_priv = dev->dev_private; 922 drm_mga_private_t *dev_priv = dev->dev_private;
923 drm_device_dma_t *dma = dev->dma; 923 struct drm_device_dma *dma = dev->dma;
924 drm_buf_t *buf; 924 struct drm_buf *buf;
925 drm_mga_buf_priv_t *buf_priv; 925 drm_mga_buf_priv_t *buf_priv;
926 drm_mga_indices_t indices; 926 drm_mga_indices_t indices;
927 927
@@ -959,9 +959,9 @@ static int mga_dma_indices(DRM_IOCTL_ARGS)
959static int mga_dma_iload(DRM_IOCTL_ARGS) 959static int mga_dma_iload(DRM_IOCTL_ARGS)
960{ 960{
961 DRM_DEVICE; 961 DRM_DEVICE;
962 drm_device_dma_t *dma = dev->dma; 962 struct drm_device_dma *dma = dev->dma;
963 drm_mga_private_t *dev_priv = dev->dev_private; 963 drm_mga_private_t *dev_priv = dev->dev_private;
964 drm_buf_t *buf; 964 struct drm_buf *buf;
965 drm_mga_buf_priv_t *buf_priv; 965 drm_mga_buf_priv_t *buf_priv;
966 drm_mga_iload_t iload; 966 drm_mga_iload_t iload;
967 DRM_DEBUG("\n"); 967 DRM_DEBUG("\n");
diff --git a/drivers/char/drm/r128_cce.c b/drivers/char/drm/r128_cce.c
index 1014602c43a7..b163ed09bd81 100644
--- a/drivers/char/drm/r128_cce.c
+++ b/drivers/char/drm/r128_cce.c
@@ -81,7 +81,7 @@ static u32 r128_cce_microcode[] = {
81 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 81 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
82}; 82};
83 83
84static int R128_READ_PLL(drm_device_t * dev, int addr) 84static int R128_READ_PLL(struct drm_device * dev, int addr)
85{ 85{
86 drm_r128_private_t *dev_priv = dev->dev_private; 86 drm_r128_private_t *dev_priv = dev->dev_private;
87 87
@@ -271,7 +271,7 @@ static void r128_do_cce_stop(drm_r128_private_t * dev_priv)
271 271
272/* Reset the engine. This will stop the CCE if it is running. 272/* Reset the engine. This will stop the CCE if it is running.
273 */ 273 */
274static int r128_do_engine_reset(drm_device_t * dev) 274static int r128_do_engine_reset(struct drm_device * dev)
275{ 275{
276 drm_r128_private_t *dev_priv = dev->dev_private; 276 drm_r128_private_t *dev_priv = dev->dev_private;
277 u32 clock_cntl_index, mclk_cntl, gen_reset_cntl; 277 u32 clock_cntl_index, mclk_cntl, gen_reset_cntl;
@@ -308,7 +308,7 @@ static int r128_do_engine_reset(drm_device_t * dev)
308 return 0; 308 return 0;
309} 309}
310 310
311static void r128_cce_init_ring_buffer(drm_device_t * dev, 311static void r128_cce_init_ring_buffer(struct drm_device * dev,
312 drm_r128_private_t * dev_priv) 312 drm_r128_private_t * dev_priv)
313{ 313{
314 u32 ring_start; 314 u32 ring_start;
@@ -347,7 +347,7 @@ static void r128_cce_init_ring_buffer(drm_device_t * dev,
347 R128_WRITE(R128_BUS_CNTL, tmp); 347 R128_WRITE(R128_BUS_CNTL, tmp);
348} 348}
349 349
350static int r128_do_init_cce(drm_device_t * dev, drm_r128_init_t * init) 350static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init)
351{ 351{
352 drm_r128_private_t *dev_priv; 352 drm_r128_private_t *dev_priv;
353 353
@@ -456,8 +456,7 @@ static int r128_do_init_cce(drm_device_t * dev, drm_r128_init_t * init)
456 dev_priv->span_pitch_offset_c = (((dev_priv->depth_pitch / 8) << 21) | 456 dev_priv->span_pitch_offset_c = (((dev_priv->depth_pitch / 8) << 21) |
457 (dev_priv->span_offset >> 5)); 457 (dev_priv->span_offset >> 5));
458 458
459 DRM_GETSAREA(); 459 dev_priv->sarea = drm_getsarea(dev);
460
461 if (!dev_priv->sarea) { 460 if (!dev_priv->sarea) {
462 DRM_ERROR("could not find sarea!\n"); 461 DRM_ERROR("could not find sarea!\n");
463 dev->dev_private = (void *)dev_priv; 462 dev->dev_private = (void *)dev_priv;
@@ -585,7 +584,7 @@ static int r128_do_init_cce(drm_device_t * dev, drm_r128_init_t * init)
585 return 0; 584 return 0;
586} 585}
587 586
588int r128_do_cleanup_cce(drm_device_t * dev) 587int r128_do_cleanup_cce(struct drm_device * dev)
589{ 588{
590 589
591 /* Make sure interrupts are disabled here because the uninstall ioctl 590 /* Make sure interrupts are disabled here because the uninstall ioctl
@@ -770,11 +769,11 @@ int r128_fullscreen(DRM_IOCTL_ARGS)
770#define R128_BUFFER_FREE 0 769#define R128_BUFFER_FREE 0
771 770
772#if 0 771#if 0
773static int r128_freelist_init(drm_device_t * dev) 772static int r128_freelist_init(struct drm_device * dev)
774{ 773{
775 drm_device_dma_t *dma = dev->dma; 774 struct drm_device_dma *dma = dev->dma;
776 drm_r128_private_t *dev_priv = dev->dev_private; 775 drm_r128_private_t *dev_priv = dev->dev_private;
777 drm_buf_t *buf; 776 struct drm_buf *buf;
778 drm_r128_buf_priv_t *buf_priv; 777 drm_r128_buf_priv_t *buf_priv;
779 drm_r128_freelist_t *entry; 778 drm_r128_freelist_t *entry;
780 int i; 779 int i;
@@ -816,12 +815,12 @@ static int r128_freelist_init(drm_device_t * dev)
816} 815}
817#endif 816#endif
818 817
819static drm_buf_t *r128_freelist_get(drm_device_t * dev) 818static struct drm_buf *r128_freelist_get(struct drm_device * dev)
820{ 819{
821 drm_device_dma_t *dma = dev->dma; 820 struct drm_device_dma *dma = dev->dma;
822 drm_r128_private_t *dev_priv = dev->dev_private; 821 drm_r128_private_t *dev_priv = dev->dev_private;
823 drm_r128_buf_priv_t *buf_priv; 822 drm_r128_buf_priv_t *buf_priv;
824 drm_buf_t *buf; 823 struct drm_buf *buf;
825 int i, t; 824 int i, t;
826 825
827 /* FIXME: Optimize -- use freelist code */ 826 /* FIXME: Optimize -- use freelist code */
@@ -854,13 +853,13 @@ static drm_buf_t *r128_freelist_get(drm_device_t * dev)
854 return NULL; 853 return NULL;
855} 854}
856 855
857void r128_freelist_reset(drm_device_t * dev) 856void r128_freelist_reset(struct drm_device * dev)
858{ 857{
859 drm_device_dma_t *dma = dev->dma; 858 struct drm_device_dma *dma = dev->dma;
860 int i; 859 int i;
861 860
862 for (i = 0; i < dma->buf_count; i++) { 861 for (i = 0; i < dma->buf_count; i++) {
863 drm_buf_t *buf = dma->buflist[i]; 862 struct drm_buf *buf = dma->buflist[i];
864 drm_r128_buf_priv_t *buf_priv = buf->dev_private; 863 drm_r128_buf_priv_t *buf_priv = buf->dev_private;
865 buf_priv->age = 0; 864 buf_priv->age = 0;
866 } 865 }
@@ -887,10 +886,10 @@ int r128_wait_ring(drm_r128_private_t * dev_priv, int n)
887 return DRM_ERR(EBUSY); 886 return DRM_ERR(EBUSY);
888} 887}
889 888
890static int r128_cce_get_buffers(DRMFILE filp, drm_device_t * dev, drm_dma_t * d) 889static int r128_cce_get_buffers(DRMFILE filp, struct drm_device * dev, struct drm_dma * d)
891{ 890{
892 int i; 891 int i;
893 drm_buf_t *buf; 892 struct drm_buf *buf;
894 893
895 for (i = d->granted_count; i < d->request_count; i++) { 894 for (i = d->granted_count; i < d->request_count; i++) {
896 buf = r128_freelist_get(dev); 895 buf = r128_freelist_get(dev);
@@ -914,10 +913,10 @@ static int r128_cce_get_buffers(DRMFILE filp, drm_device_t * dev, drm_dma_t * d)
914int r128_cce_buffers(DRM_IOCTL_ARGS) 913int r128_cce_buffers(DRM_IOCTL_ARGS)
915{ 914{
916 DRM_DEVICE; 915 DRM_DEVICE;
917 drm_device_dma_t *dma = dev->dma; 916 struct drm_device_dma *dma = dev->dma;
918 int ret = 0; 917 int ret = 0;
919 drm_dma_t __user *argp = (void __user *)data; 918 struct drm_dma __user *argp = (void __user *)data;
920 drm_dma_t d; 919 struct drm_dma d;
921 920
922 LOCK_TEST_WITH_RETURN(dev, filp); 921 LOCK_TEST_WITH_RETURN(dev, filp);
923 922
diff --git a/drivers/char/drm/r128_drm.h b/drivers/char/drm/r128_drm.h
index 6e8af313f2b4..e94a39c6e327 100644
--- a/drivers/char/drm/r128_drm.h
+++ b/drivers/char/drm/r128_drm.h
@@ -153,7 +153,7 @@ typedef struct drm_r128_sarea {
153 153
154 /* The current cliprects, or a subset thereof. 154 /* The current cliprects, or a subset thereof.
155 */ 155 */
156 drm_clip_rect_t boxes[R128_NR_SAREA_CLIPRECTS]; 156 struct drm_clip_rect boxes[R128_NR_SAREA_CLIPRECTS];
157 unsigned int nbox; 157 unsigned int nbox;
158 158
159 /* Counters for client-side throttling of rendering clients. 159 /* Counters for client-side throttling of rendering clients.
@@ -161,7 +161,7 @@ typedef struct drm_r128_sarea {
161 unsigned int last_frame; 161 unsigned int last_frame;
162 unsigned int last_dispatch; 162 unsigned int last_dispatch;
163 163
164 drm_tex_region_t tex_list[R128_NR_TEX_HEAPS][R128_NR_TEX_REGIONS + 1]; 164 struct drm_tex_region tex_list[R128_NR_TEX_HEAPS][R128_NR_TEX_REGIONS + 1];
165 unsigned int tex_age[R128_NR_TEX_HEAPS]; 165 unsigned int tex_age[R128_NR_TEX_HEAPS];
166 int ctx_owner; 166 int ctx_owner;
167 int pfAllowPageFlip; /* number of 3d windows (0,1,2 or more) */ 167 int pfAllowPageFlip; /* number of 3d windows (0,1,2 or more) */
diff --git a/drivers/char/drm/r128_drv.h b/drivers/char/drm/r128_drv.h
index 9086835686dc..72249fb2fd1c 100644
--- a/drivers/char/drm/r128_drv.h
+++ b/drivers/char/drm/r128_drv.h
@@ -57,7 +57,7 @@
57 57
58typedef struct drm_r128_freelist { 58typedef struct drm_r128_freelist {
59 unsigned int age; 59 unsigned int age;
60 drm_buf_t *buf; 60 struct drm_buf *buf;
61 struct drm_r128_freelist *next; 61 struct drm_r128_freelist *next;
62 struct drm_r128_freelist *prev; 62 struct drm_r128_freelist *prev;
63} drm_r128_freelist_t; 63} drm_r128_freelist_t;
@@ -118,7 +118,7 @@ typedef struct drm_r128_private {
118 drm_local_map_t *cce_ring; 118 drm_local_map_t *cce_ring;
119 drm_local_map_t *ring_rptr; 119 drm_local_map_t *ring_rptr;
120 drm_local_map_t *agp_textures; 120 drm_local_map_t *agp_textures;
121 drm_ati_pcigart_info gart_info; 121 struct drm_ati_pcigart_info gart_info;
122} drm_r128_private_t; 122} drm_r128_private_t;
123 123
124typedef struct drm_r128_buf_priv { 124typedef struct drm_r128_buf_priv {
@@ -142,21 +142,21 @@ extern int r128_engine_reset(DRM_IOCTL_ARGS);
142extern int r128_fullscreen(DRM_IOCTL_ARGS); 142extern int r128_fullscreen(DRM_IOCTL_ARGS);
143extern int r128_cce_buffers(DRM_IOCTL_ARGS); 143extern int r128_cce_buffers(DRM_IOCTL_ARGS);
144 144
145extern void r128_freelist_reset(drm_device_t * dev); 145extern void r128_freelist_reset(struct drm_device * dev);
146 146
147extern int r128_wait_ring(drm_r128_private_t * dev_priv, int n); 147extern int r128_wait_ring(drm_r128_private_t * dev_priv, int n);
148 148
149extern int r128_do_cce_idle(drm_r128_private_t * dev_priv); 149extern int r128_do_cce_idle(drm_r128_private_t * dev_priv);
150extern int r128_do_cleanup_cce(drm_device_t * dev); 150extern int r128_do_cleanup_cce(struct drm_device * dev);
151 151
152extern int r128_driver_vblank_wait(drm_device_t * dev, unsigned int *sequence); 152extern int r128_driver_vblank_wait(struct drm_device * dev, unsigned int *sequence);
153 153
154extern irqreturn_t r128_driver_irq_handler(DRM_IRQ_ARGS); 154extern irqreturn_t r128_driver_irq_handler(DRM_IRQ_ARGS);
155extern void r128_driver_irq_preinstall(drm_device_t * dev); 155extern void r128_driver_irq_preinstall(struct drm_device * dev);
156extern void r128_driver_irq_postinstall(drm_device_t * dev); 156extern void r128_driver_irq_postinstall(struct drm_device * dev);
157extern void r128_driver_irq_uninstall(drm_device_t * dev); 157extern void r128_driver_irq_uninstall(struct drm_device * dev);
158extern void r128_driver_lastclose(drm_device_t * dev); 158extern void r128_driver_lastclose(struct drm_device * dev);
159extern void r128_driver_preclose(drm_device_t * dev, DRMFILE filp); 159extern void r128_driver_preclose(struct drm_device * dev, DRMFILE filp);
160 160
161extern long r128_compat_ioctl(struct file *filp, unsigned int cmd, 161extern long r128_compat_ioctl(struct file *filp, unsigned int cmd,
162 unsigned long arg); 162 unsigned long arg);
diff --git a/drivers/char/drm/r128_irq.c b/drivers/char/drm/r128_irq.c
index 87f8ca2b0685..c76fdca7662d 100644
--- a/drivers/char/drm/r128_irq.c
+++ b/drivers/char/drm/r128_irq.c
@@ -37,7 +37,7 @@
37 37
38irqreturn_t r128_driver_irq_handler(DRM_IRQ_ARGS) 38irqreturn_t r128_driver_irq_handler(DRM_IRQ_ARGS)
39{ 39{
40 drm_device_t *dev = (drm_device_t *) arg; 40 struct drm_device *dev = (struct drm_device *) arg;
41 drm_r128_private_t *dev_priv = (drm_r128_private_t *) dev->dev_private; 41 drm_r128_private_t *dev_priv = (drm_r128_private_t *) dev->dev_private;
42 int status; 42 int status;
43 43
@@ -54,7 +54,7 @@ irqreturn_t r128_driver_irq_handler(DRM_IRQ_ARGS)
54 return IRQ_NONE; 54 return IRQ_NONE;
55} 55}
56 56
57int r128_driver_vblank_wait(drm_device_t * dev, unsigned int *sequence) 57int r128_driver_vblank_wait(struct drm_device * dev, unsigned int *sequence)
58{ 58{
59 unsigned int cur_vblank; 59 unsigned int cur_vblank;
60 int ret = 0; 60 int ret = 0;
@@ -72,7 +72,7 @@ int r128_driver_vblank_wait(drm_device_t * dev, unsigned int *sequence)
72 return ret; 72 return ret;
73} 73}
74 74
75void r128_driver_irq_preinstall(drm_device_t * dev) 75void r128_driver_irq_preinstall(struct drm_device * dev)
76{ 76{
77 drm_r128_private_t *dev_priv = (drm_r128_private_t *) dev->dev_private; 77 drm_r128_private_t *dev_priv = (drm_r128_private_t *) dev->dev_private;
78 78
@@ -82,7 +82,7 @@ void r128_driver_irq_preinstall(drm_device_t * dev)
82 R128_WRITE(R128_GEN_INT_STATUS, R128_CRTC_VBLANK_INT_AK); 82 R128_WRITE(R128_GEN_INT_STATUS, R128_CRTC_VBLANK_INT_AK);
83} 83}
84 84
85void r128_driver_irq_postinstall(drm_device_t * dev) 85void r128_driver_irq_postinstall(struct drm_device * dev)
86{ 86{
87 drm_r128_private_t *dev_priv = (drm_r128_private_t *) dev->dev_private; 87 drm_r128_private_t *dev_priv = (drm_r128_private_t *) dev->dev_private;
88 88
@@ -90,7 +90,7 @@ void r128_driver_irq_postinstall(drm_device_t * dev)
90 R128_WRITE(R128_GEN_INT_CNTL, R128_CRTC_VBLANK_INT_EN); 90 R128_WRITE(R128_GEN_INT_CNTL, R128_CRTC_VBLANK_INT_EN);
91} 91}
92 92
93void r128_driver_irq_uninstall(drm_device_t * dev) 93void r128_driver_irq_uninstall(struct drm_device * dev)
94{ 94{
95 drm_r128_private_t *dev_priv = (drm_r128_private_t *) dev->dev_private; 95 drm_r128_private_t *dev_priv = (drm_r128_private_t *) dev->dev_private;
96 if (!dev_priv) 96 if (!dev_priv)
diff --git a/drivers/char/drm/r128_state.c b/drivers/char/drm/r128_state.c
index 17b11e7d8f32..7b334fb7d649 100644
--- a/drivers/char/drm/r128_state.c
+++ b/drivers/char/drm/r128_state.c
@@ -38,7 +38,7 @@
38 */ 38 */
39 39
40static void r128_emit_clip_rects(drm_r128_private_t * dev_priv, 40static void r128_emit_clip_rects(drm_r128_private_t * dev_priv,
41 drm_clip_rect_t * boxes, int count) 41 struct drm_clip_rect * boxes, int count)
42{ 42{
43 u32 aux_sc_cntl = 0x00000000; 43 u32 aux_sc_cntl = 0x00000000;
44 RING_LOCALS; 44 RING_LOCALS;
@@ -352,13 +352,13 @@ static void r128_print_dirty(const char *msg, unsigned int flags)
352 (flags & R128_REQUIRE_QUIESCENCE) ? "quiescence, " : ""); 352 (flags & R128_REQUIRE_QUIESCENCE) ? "quiescence, " : "");
353} 353}
354 354
355static void r128_cce_dispatch_clear(drm_device_t * dev, 355static void r128_cce_dispatch_clear(struct drm_device * dev,
356 drm_r128_clear_t * clear) 356 drm_r128_clear_t * clear)
357{ 357{
358 drm_r128_private_t *dev_priv = dev->dev_private; 358 drm_r128_private_t *dev_priv = dev->dev_private;
359 drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; 359 drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;
360 int nbox = sarea_priv->nbox; 360 int nbox = sarea_priv->nbox;
361 drm_clip_rect_t *pbox = sarea_priv->boxes; 361 struct drm_clip_rect *pbox = sarea_priv->boxes;
362 unsigned int flags = clear->flags; 362 unsigned int flags = clear->flags;
363 int i; 363 int i;
364 RING_LOCALS; 364 RING_LOCALS;
@@ -458,12 +458,12 @@ static void r128_cce_dispatch_clear(drm_device_t * dev,
458 } 458 }
459} 459}
460 460
461static void r128_cce_dispatch_swap(drm_device_t * dev) 461static void r128_cce_dispatch_swap(struct drm_device * dev)
462{ 462{
463 drm_r128_private_t *dev_priv = dev->dev_private; 463 drm_r128_private_t *dev_priv = dev->dev_private;
464 drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; 464 drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;
465 int nbox = sarea_priv->nbox; 465 int nbox = sarea_priv->nbox;
466 drm_clip_rect_t *pbox = sarea_priv->boxes; 466 struct drm_clip_rect *pbox = sarea_priv->boxes;
467 int i; 467 int i;
468 RING_LOCALS; 468 RING_LOCALS;
469 DRM_DEBUG("%s\n", __FUNCTION__); 469 DRM_DEBUG("%s\n", __FUNCTION__);
@@ -524,7 +524,7 @@ static void r128_cce_dispatch_swap(drm_device_t * dev)
524 ADVANCE_RING(); 524 ADVANCE_RING();
525} 525}
526 526
527static void r128_cce_dispatch_flip(drm_device_t * dev) 527static void r128_cce_dispatch_flip(struct drm_device * dev)
528{ 528{
529 drm_r128_private_t *dev_priv = dev->dev_private; 529 drm_r128_private_t *dev_priv = dev->dev_private;
530 RING_LOCALS; 530 RING_LOCALS;
@@ -567,7 +567,7 @@ static void r128_cce_dispatch_flip(drm_device_t * dev)
567 ADVANCE_RING(); 567 ADVANCE_RING();
568} 568}
569 569
570static void r128_cce_dispatch_vertex(drm_device_t * dev, drm_buf_t * buf) 570static void r128_cce_dispatch_vertex(struct drm_device * dev, struct drm_buf * buf)
571{ 571{
572 drm_r128_private_t *dev_priv = dev->dev_private; 572 drm_r128_private_t *dev_priv = dev->dev_private;
573 drm_r128_buf_priv_t *buf_priv = buf->dev_private; 573 drm_r128_buf_priv_t *buf_priv = buf->dev_private;
@@ -637,8 +637,8 @@ static void r128_cce_dispatch_vertex(drm_device_t * dev, drm_buf_t * buf)
637 sarea_priv->nbox = 0; 637 sarea_priv->nbox = 0;
638} 638}
639 639
640static void r128_cce_dispatch_indirect(drm_device_t * dev, 640static void r128_cce_dispatch_indirect(struct drm_device * dev,
641 drm_buf_t * buf, int start, int end) 641 struct drm_buf * buf, int start, int end)
642{ 642{
643 drm_r128_private_t *dev_priv = dev->dev_private; 643 drm_r128_private_t *dev_priv = dev->dev_private;
644 drm_r128_buf_priv_t *buf_priv = buf->dev_private; 644 drm_r128_buf_priv_t *buf_priv = buf->dev_private;
@@ -692,8 +692,8 @@ static void r128_cce_dispatch_indirect(drm_device_t * dev,
692 dev_priv->sarea_priv->last_dispatch++; 692 dev_priv->sarea_priv->last_dispatch++;
693} 693}
694 694
695static void r128_cce_dispatch_indices(drm_device_t * dev, 695static void r128_cce_dispatch_indices(struct drm_device * dev,
696 drm_buf_t * buf, 696 struct drm_buf * buf,
697 int start, int end, int count) 697 int start, int end, int count)
698{ 698{
699 drm_r128_private_t *dev_priv = dev->dev_private; 699 drm_r128_private_t *dev_priv = dev->dev_private;
@@ -777,11 +777,11 @@ static void r128_cce_dispatch_indices(drm_device_t * dev,
777} 777}
778 778
779static int r128_cce_dispatch_blit(DRMFILE filp, 779static int r128_cce_dispatch_blit(DRMFILE filp,
780 drm_device_t * dev, drm_r128_blit_t * blit) 780 struct drm_device * dev, drm_r128_blit_t * blit)
781{ 781{
782 drm_r128_private_t *dev_priv = dev->dev_private; 782 drm_r128_private_t *dev_priv = dev->dev_private;
783 drm_device_dma_t *dma = dev->dma; 783 struct drm_device_dma *dma = dev->dma;
784 drm_buf_t *buf; 784 struct drm_buf *buf;
785 drm_r128_buf_priv_t *buf_priv; 785 drm_r128_buf_priv_t *buf_priv;
786 u32 *data; 786 u32 *data;
787 int dword_shift, dwords; 787 int dword_shift, dwords;
@@ -887,7 +887,7 @@ static int r128_cce_dispatch_blit(DRMFILE filp,
887 * have hardware stencil support. 887 * have hardware stencil support.
888 */ 888 */
889 889
890static int r128_cce_dispatch_write_span(drm_device_t * dev, 890static int r128_cce_dispatch_write_span(struct drm_device * dev,
891 drm_r128_depth_t * depth) 891 drm_r128_depth_t * depth)
892{ 892{
893 drm_r128_private_t *dev_priv = dev->dev_private; 893 drm_r128_private_t *dev_priv = dev->dev_private;
@@ -983,7 +983,7 @@ static int r128_cce_dispatch_write_span(drm_device_t * dev,
983 return 0; 983 return 0;
984} 984}
985 985
986static int r128_cce_dispatch_write_pixels(drm_device_t * dev, 986static int r128_cce_dispatch_write_pixels(struct drm_device * dev,
987 drm_r128_depth_t * depth) 987 drm_r128_depth_t * depth)
988{ 988{
989 drm_r128_private_t *dev_priv = dev->dev_private; 989 drm_r128_private_t *dev_priv = dev->dev_private;
@@ -1105,7 +1105,7 @@ static int r128_cce_dispatch_write_pixels(drm_device_t * dev,
1105 return 0; 1105 return 0;
1106} 1106}
1107 1107
1108static int r128_cce_dispatch_read_span(drm_device_t * dev, 1108static int r128_cce_dispatch_read_span(struct drm_device * dev,
1109 drm_r128_depth_t * depth) 1109 drm_r128_depth_t * depth)
1110{ 1110{
1111 drm_r128_private_t *dev_priv = dev->dev_private; 1111 drm_r128_private_t *dev_priv = dev->dev_private;
@@ -1148,7 +1148,7 @@ static int r128_cce_dispatch_read_span(drm_device_t * dev,
1148 return 0; 1148 return 0;
1149} 1149}
1150 1150
1151static int r128_cce_dispatch_read_pixels(drm_device_t * dev, 1151static int r128_cce_dispatch_read_pixels(struct drm_device * dev,
1152 drm_r128_depth_t * depth) 1152 drm_r128_depth_t * depth)
1153{ 1153{
1154 drm_r128_private_t *dev_priv = dev->dev_private; 1154 drm_r128_private_t *dev_priv = dev->dev_private;
@@ -1220,7 +1220,7 @@ static int r128_cce_dispatch_read_pixels(drm_device_t * dev,
1220 * Polygon stipple 1220 * Polygon stipple
1221 */ 1221 */
1222 1222
1223static void r128_cce_dispatch_stipple(drm_device_t * dev, u32 * stipple) 1223static void r128_cce_dispatch_stipple(struct drm_device * dev, u32 * stipple)
1224{ 1224{
1225 drm_r128_private_t *dev_priv = dev->dev_private; 1225 drm_r128_private_t *dev_priv = dev->dev_private;
1226 int i; 1226 int i;
@@ -1269,7 +1269,7 @@ static int r128_cce_clear(DRM_IOCTL_ARGS)
1269 return 0; 1269 return 0;
1270} 1270}
1271 1271
1272static int r128_do_init_pageflip(drm_device_t * dev) 1272static int r128_do_init_pageflip(struct drm_device * dev)
1273{ 1273{
1274 drm_r128_private_t *dev_priv = dev->dev_private; 1274 drm_r128_private_t *dev_priv = dev->dev_private;
1275 DRM_DEBUG("\n"); 1275 DRM_DEBUG("\n");
@@ -1288,7 +1288,7 @@ static int r128_do_init_pageflip(drm_device_t * dev)
1288 return 0; 1288 return 0;
1289} 1289}
1290 1290
1291static int r128_do_cleanup_pageflip(drm_device_t * dev) 1291static int r128_do_cleanup_pageflip(struct drm_device * dev)
1292{ 1292{
1293 drm_r128_private_t *dev_priv = dev->dev_private; 1293 drm_r128_private_t *dev_priv = dev->dev_private;
1294 DRM_DEBUG("\n"); 1294 DRM_DEBUG("\n");
@@ -1354,8 +1354,8 @@ static int r128_cce_vertex(DRM_IOCTL_ARGS)
1354{ 1354{
1355 DRM_DEVICE; 1355 DRM_DEVICE;
1356 drm_r128_private_t *dev_priv = dev->dev_private; 1356 drm_r128_private_t *dev_priv = dev->dev_private;
1357 drm_device_dma_t *dma = dev->dma; 1357 struct drm_device_dma *dma = dev->dma;
1358 drm_buf_t *buf; 1358 struct drm_buf *buf;
1359 drm_r128_buf_priv_t *buf_priv; 1359 drm_r128_buf_priv_t *buf_priv;
1360 drm_r128_vertex_t vertex; 1360 drm_r128_vertex_t vertex;
1361 1361
@@ -1413,8 +1413,8 @@ static int r128_cce_indices(DRM_IOCTL_ARGS)
1413{ 1413{
1414 DRM_DEVICE; 1414 DRM_DEVICE;
1415 drm_r128_private_t *dev_priv = dev->dev_private; 1415 drm_r128_private_t *dev_priv = dev->dev_private;
1416 drm_device_dma_t *dma = dev->dma; 1416 struct drm_device_dma *dma = dev->dma;
1417 drm_buf_t *buf; 1417 struct drm_buf *buf;
1418 drm_r128_buf_priv_t *buf_priv; 1418 drm_r128_buf_priv_t *buf_priv;
1419 drm_r128_indices_t elts; 1419 drm_r128_indices_t elts;
1420 int count; 1420 int count;
@@ -1483,7 +1483,7 @@ static int r128_cce_indices(DRM_IOCTL_ARGS)
1483static int r128_cce_blit(DRM_IOCTL_ARGS) 1483static int r128_cce_blit(DRM_IOCTL_ARGS)
1484{ 1484{
1485 DRM_DEVICE; 1485 DRM_DEVICE;
1486 drm_device_dma_t *dma = dev->dma; 1486 struct drm_device_dma *dma = dev->dma;
1487 drm_r128_private_t *dev_priv = dev->dev_private; 1487 drm_r128_private_t *dev_priv = dev->dev_private;
1488 drm_r128_blit_t blit; 1488 drm_r128_blit_t blit;
1489 int ret; 1489 int ret;
@@ -1571,8 +1571,8 @@ static int r128_cce_indirect(DRM_IOCTL_ARGS)
1571{ 1571{
1572 DRM_DEVICE; 1572 DRM_DEVICE;
1573 drm_r128_private_t *dev_priv = dev->dev_private; 1573 drm_r128_private_t *dev_priv = dev->dev_private;
1574 drm_device_dma_t *dma = dev->dma; 1574 struct drm_device_dma *dma = dev->dma;
1575 drm_buf_t *buf; 1575 struct drm_buf *buf;
1576 drm_r128_buf_priv_t *buf_priv; 1576 drm_r128_buf_priv_t *buf_priv;
1577 drm_r128_indirect_t indirect; 1577 drm_r128_indirect_t indirect;
1578#if 0 1578#if 0
@@ -1675,7 +1675,7 @@ static int r128_getparam(DRM_IOCTL_ARGS)
1675 return 0; 1675 return 0;
1676} 1676}
1677 1677
1678void r128_driver_preclose(drm_device_t * dev, DRMFILE filp) 1678void r128_driver_preclose(struct drm_device * dev, DRMFILE filp)
1679{ 1679{
1680 if (dev->dev_private) { 1680 if (dev->dev_private) {
1681 drm_r128_private_t *dev_priv = dev->dev_private; 1681 drm_r128_private_t *dev_priv = dev->dev_private;
@@ -1685,7 +1685,7 @@ void r128_driver_preclose(drm_device_t * dev, DRMFILE filp)
1685 } 1685 }
1686} 1686}
1687 1687
1688void r128_driver_lastclose(drm_device_t * dev) 1688void r128_driver_lastclose(struct drm_device * dev)
1689{ 1689{
1690 r128_do_cleanup_cce(dev); 1690 r128_do_cleanup_cce(dev);
1691} 1691}
diff --git a/drivers/char/drm/r300_cmdbuf.c b/drivers/char/drm/r300_cmdbuf.c
index 032a022ec6a8..4e5aca6ba59a 100644
--- a/drivers/char/drm/r300_cmdbuf.c
+++ b/drivers/char/drm/r300_cmdbuf.c
@@ -55,7 +55,7 @@ static const int r300_cliprect_cntl[4] = {
55static int r300_emit_cliprects(drm_radeon_private_t *dev_priv, 55static int r300_emit_cliprects(drm_radeon_private_t *dev_priv,
56 drm_radeon_kcmd_buffer_t *cmdbuf, int n) 56 drm_radeon_kcmd_buffer_t *cmdbuf, int n)
57{ 57{
58 drm_clip_rect_t box; 58 struct drm_clip_rect box;
59 int nr; 59 int nr;
60 int i; 60 int i;
61 RING_LOCALS; 61 RING_LOCALS;
@@ -148,15 +148,16 @@ void r300_init_reg_flags(void)
148 148
149 /* these match cmducs() command in r300_driver/r300/r300_cmdbuf.c */ 149 /* these match cmducs() command in r300_driver/r300/r300_cmdbuf.c */
150 ADD_RANGE(R300_SE_VPORT_XSCALE, 6); 150 ADD_RANGE(R300_SE_VPORT_XSCALE, 6);
151 ADD_RANGE(0x2080, 1); 151 ADD_RANGE(R300_VAP_CNTL, 1);
152 ADD_RANGE(R300_SE_VTE_CNTL, 2); 152 ADD_RANGE(R300_SE_VTE_CNTL, 2);
153 ADD_RANGE(0x2134, 2); 153 ADD_RANGE(0x2134, 2);
154 ADD_RANGE(0x2140, 1); 154 ADD_RANGE(R300_VAP_CNTL_STATUS, 1);
155 ADD_RANGE(R300_VAP_INPUT_CNTL_0, 2); 155 ADD_RANGE(R300_VAP_INPUT_CNTL_0, 2);
156 ADD_RANGE(0x21DC, 1); 156 ADD_RANGE(0x21DC, 1);
157 ADD_RANGE(0x221C, 1); 157 ADD_RANGE(R300_VAP_UNKNOWN_221C, 1);
158 ADD_RANGE(0x2220, 4); 158 ADD_RANGE(R300_VAP_CLIP_X_0, 4);
159 ADD_RANGE(0x2288, 1); 159 ADD_RANGE(R300_VAP_PVS_WAITIDLE, 1);
160 ADD_RANGE(R300_VAP_UNKNOWN_2288, 1);
160 ADD_RANGE(R300_VAP_OUTPUT_VTX_FMT_0, 2); 161 ADD_RANGE(R300_VAP_OUTPUT_VTX_FMT_0, 2);
161 ADD_RANGE(R300_VAP_PVS_CNTL_1, 3); 162 ADD_RANGE(R300_VAP_PVS_CNTL_1, 3);
162 ADD_RANGE(R300_GB_ENABLE, 1); 163 ADD_RANGE(R300_GB_ENABLE, 1);
@@ -168,13 +169,13 @@ void r300_init_reg_flags(void)
168 ADD_RANGE(R300_RE_POINTSIZE, 1); 169 ADD_RANGE(R300_RE_POINTSIZE, 1);
169 ADD_RANGE(0x4230, 3); 170 ADD_RANGE(0x4230, 3);
170 ADD_RANGE(R300_RE_LINE_CNT, 1); 171 ADD_RANGE(R300_RE_LINE_CNT, 1);
171 ADD_RANGE(0x4238, 1); 172 ADD_RANGE(R300_RE_UNK4238, 1);
172 ADD_RANGE(0x4260, 3); 173 ADD_RANGE(0x4260, 3);
173 ADD_RANGE(0x4274, 4); 174 ADD_RANGE(R300_RE_SHADE, 4);
174 ADD_RANGE(0x4288, 5); 175 ADD_RANGE(R300_RE_POLYGON_MODE, 5);
175 ADD_RANGE(0x42A0, 1); 176 ADD_RANGE(R300_RE_ZBIAS_CNTL, 1);
176 ADD_RANGE(R300_RE_ZBIAS_T_FACTOR, 4); 177 ADD_RANGE(R300_RE_ZBIAS_T_FACTOR, 4);
177 ADD_RANGE(0x42B4, 1); 178 ADD_RANGE(R300_RE_OCCLUSION_CNTL, 1);
178 ADD_RANGE(R300_RE_CULL_CNTL, 1); 179 ADD_RANGE(R300_RE_CULL_CNTL, 1);
179 ADD_RANGE(0x42C0, 2); 180 ADD_RANGE(0x42C0, 2);
180 ADD_RANGE(R300_RS_CNTL_0, 2); 181 ADD_RANGE(R300_RS_CNTL_0, 2);
@@ -190,22 +191,22 @@ void r300_init_reg_flags(void)
190 ADD_RANGE(R300_PFS_INSTR1_0, 64); 191 ADD_RANGE(R300_PFS_INSTR1_0, 64);
191 ADD_RANGE(R300_PFS_INSTR2_0, 64); 192 ADD_RANGE(R300_PFS_INSTR2_0, 64);
192 ADD_RANGE(R300_PFS_INSTR3_0, 64); 193 ADD_RANGE(R300_PFS_INSTR3_0, 64);
193 ADD_RANGE(0x4BC0, 1); 194 ADD_RANGE(R300_RE_FOG_STATE, 1);
194 ADD_RANGE(0x4BC8, 3); 195 ADD_RANGE(R300_FOG_COLOR_R, 3);
195 ADD_RANGE(R300_PP_ALPHA_TEST, 2); 196 ADD_RANGE(R300_PP_ALPHA_TEST, 2);
196 ADD_RANGE(0x4BD8, 1); 197 ADD_RANGE(0x4BD8, 1);
197 ADD_RANGE(R300_PFS_PARAM_0_X, 64); 198 ADD_RANGE(R300_PFS_PARAM_0_X, 64);
198 ADD_RANGE(0x4E00, 1); 199 ADD_RANGE(0x4E00, 1);
199 ADD_RANGE(R300_RB3D_CBLEND, 2); 200 ADD_RANGE(R300_RB3D_CBLEND, 2);
200 ADD_RANGE(R300_RB3D_COLORMASK, 1); 201 ADD_RANGE(R300_RB3D_COLORMASK, 1);
201 ADD_RANGE(0x4E10, 3); 202 ADD_RANGE(R300_RB3D_BLEND_COLOR, 3);
202 ADD_RANGE_MARK(R300_RB3D_COLOROFFSET0, 1, MARK_CHECK_OFFSET); /* check offset */ 203 ADD_RANGE_MARK(R300_RB3D_COLOROFFSET0, 1, MARK_CHECK_OFFSET); /* check offset */
203 ADD_RANGE(R300_RB3D_COLORPITCH0, 1); 204 ADD_RANGE(R300_RB3D_COLORPITCH0, 1);
204 ADD_RANGE(0x4E50, 9); 205 ADD_RANGE(0x4E50, 9);
205 ADD_RANGE(0x4E88, 1); 206 ADD_RANGE(0x4E88, 1);
206 ADD_RANGE(0x4EA0, 2); 207 ADD_RANGE(0x4EA0, 2);
207 ADD_RANGE(R300_RB3D_ZSTENCIL_CNTL_0, 3); 208 ADD_RANGE(R300_RB3D_ZSTENCIL_CNTL_0, 3);
208 ADD_RANGE(0x4F10, 4); 209 ADD_RANGE(R300_RB3D_ZSTENCIL_FORMAT, 4);
209 ADD_RANGE_MARK(R300_RB3D_DEPTHOFFSET, 1, MARK_CHECK_OFFSET); /* check offset */ 210 ADD_RANGE_MARK(R300_RB3D_DEPTHOFFSET, 1, MARK_CHECK_OFFSET); /* check offset */
210 ADD_RANGE(R300_RB3D_DEPTHPITCH, 1); 211 ADD_RANGE(R300_RB3D_DEPTHPITCH, 1);
211 ADD_RANGE(0x4F28, 1); 212 ADD_RANGE(0x4F28, 1);
@@ -224,7 +225,7 @@ void r300_init_reg_flags(void)
224 ADD_RANGE(R300_TX_BORDER_COLOR_0, 16); 225 ADD_RANGE(R300_TX_BORDER_COLOR_0, 16);
225 226
226 /* Sporadic registers used as primitives are emitted */ 227 /* Sporadic registers used as primitives are emitted */
227 ADD_RANGE(0x4f18, 1); 228 ADD_RANGE(R300_RB3D_ZCACHE_CTLSTAT, 1);
228 ADD_RANGE(R300_RB3D_DSTCACHE_CTLSTAT, 1); 229 ADD_RANGE(R300_RB3D_DSTCACHE_CTLSTAT, 1);
229 ADD_RANGE(R300_VAP_INPUT_ROUTE_0_0, 8); 230 ADD_RANGE(R300_VAP_INPUT_ROUTE_0_0, 8);
230 ADD_RANGE(R300_VAP_INPUT_ROUTE_1_0, 8); 231 ADD_RANGE(R300_VAP_INPUT_ROUTE_1_0, 8);
@@ -692,9 +693,9 @@ static __inline__ void r300_pacify(drm_radeon_private_t *dev_priv)
692 693
693 BEGIN_RING(6); 694 BEGIN_RING(6);
694 OUT_RING(CP_PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); 695 OUT_RING(CP_PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0));
695 OUT_RING(0xa); 696 OUT_RING(R300_RB3D_DSTCACHE_UNKNOWN_0A);
696 OUT_RING(CP_PACKET0(0x4f18, 0)); 697 OUT_RING(CP_PACKET0(R300_RB3D_ZCACHE_CTLSTAT, 0));
697 OUT_RING(0x3); 698 OUT_RING(R300_RB3D_ZCACHE_UNKNOWN_03);
698 OUT_RING(CP_PACKET3(RADEON_CP_NOP, 0)); 699 OUT_RING(CP_PACKET3(RADEON_CP_NOP, 0));
699 OUT_RING(0x0); 700 OUT_RING(0x0);
700 ADVANCE_RING(); 701 ADVANCE_RING();
@@ -705,7 +706,7 @@ static __inline__ void r300_pacify(drm_radeon_private_t *dev_priv)
705 * The actual age emit is done by r300_do_cp_cmdbuf, which is why you must 706 * The actual age emit is done by r300_do_cp_cmdbuf, which is why you must
706 * be careful about how this function is called. 707 * be careful about how this function is called.
707 */ 708 */
708static void r300_discard_buffer(drm_device_t * dev, drm_buf_t * buf) 709static void r300_discard_buffer(struct drm_device * dev, struct drm_buf * buf)
709{ 710{
710 drm_radeon_private_t *dev_priv = dev->dev_private; 711 drm_radeon_private_t *dev_priv = dev->dev_private;
711 drm_radeon_buf_priv_t *buf_priv = buf->dev_private; 712 drm_radeon_buf_priv_t *buf_priv = buf->dev_private;
@@ -766,8 +767,8 @@ static int r300_scratch(drm_radeon_private_t *dev_priv,
766 } 767 }
767 768
768 BEGIN_RING(2); 769 BEGIN_RING(2);
769 OUT_RING(CP_PACKET0(RADEON_SCRATCH_REG0 + header.scratch.reg * 4, 0)); 770 OUT_RING( CP_PACKET0( RADEON_SCRATCH_REG0 + header.scratch.reg * 4, 0 ) );
770 OUT_RING(dev_priv->scratch_ages[header.scratch.reg]); 771 OUT_RING( dev_priv->scratch_ages[header.scratch.reg] );
771 ADVANCE_RING(); 772 ADVANCE_RING();
772 773
773 return 0; 774 return 0;
@@ -778,14 +779,14 @@ static int r300_scratch(drm_radeon_private_t *dev_priv,
778 * commands on the DMA ring buffer. 779 * commands on the DMA ring buffer.
779 * Called by the ioctl handler function radeon_cp_cmdbuf. 780 * Called by the ioctl handler function radeon_cp_cmdbuf.
780 */ 781 */
781int r300_do_cp_cmdbuf(drm_device_t *dev, 782int r300_do_cp_cmdbuf(struct drm_device *dev,
782 DRMFILE filp, 783 DRMFILE filp,
783 drm_file_t *filp_priv, 784 struct drm_file *filp_priv,
784 drm_radeon_kcmd_buffer_t *cmdbuf) 785 drm_radeon_kcmd_buffer_t *cmdbuf)
785{ 786{
786 drm_radeon_private_t *dev_priv = dev->dev_private; 787 drm_radeon_private_t *dev_priv = dev->dev_private;
787 drm_device_dma_t *dma = dev->dma; 788 struct drm_device_dma *dma = dev->dma;
788 drm_buf_t *buf = NULL; 789 struct drm_buf *buf = NULL;
789 int emit_dispatch_age = 0; 790 int emit_dispatch_age = 0;
790 int ret = 0; 791 int ret = 0;
791 792
diff --git a/drivers/char/drm/r300_reg.h b/drivers/char/drm/r300_reg.h
index ecda760ae8c0..3ae57ecc7afd 100644
--- a/drivers/char/drm/r300_reg.h
+++ b/drivers/char/drm/r300_reg.h
@@ -47,12 +47,12 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
47# define R300_MC_MISC__MC_GLOBW_FULL_LAT_SHIFT 28 47# define R300_MC_MISC__MC_GLOBW_FULL_LAT_SHIFT 28
48 48
49/* 49/*
50This file contains registers and constants for the R300. They have been 50 * This file contains registers and constants for the R300. They have been
51found mostly by examining command buffers captured using glxtest, as well 51 * found mostly by examining command buffers captured using glxtest, as well
52as by extrapolating some known registers and constants from the R200. 52 * as by extrapolating some known registers and constants from the R200.
53 53 * I am fairly certain that they are correct unless stated otherwise
54I am fairly certain that they are correct unless stated otherwise in comments. 54 * in comments.
55*/ 55 */
56 56
57#define R300_SE_VPORT_XSCALE 0x1D98 57#define R300_SE_VPORT_XSCALE 0x1D98
58#define R300_SE_VPORT_XOFFSET 0x1D9C 58#define R300_SE_VPORT_XOFFSET 0x1D9C
@@ -61,49 +61,60 @@ I am fairly certain that they are correct unless stated otherwise in comments.
61#define R300_SE_VPORT_ZSCALE 0x1DA8 61#define R300_SE_VPORT_ZSCALE 0x1DA8
62#define R300_SE_VPORT_ZOFFSET 0x1DAC 62#define R300_SE_VPORT_ZOFFSET 0x1DAC
63 63
64/* This register is written directly and also starts data section in many 3d CP_PACKET3's */
65#define R300_VAP_VF_CNTL 0x2084
66 64
67# define R300_VAP_VF_CNTL__PRIM_TYPE__SHIFT 0 65/*
68# define R300_VAP_VF_CNTL__PRIM_NONE (0<<0) 66 * Vertex Array Processing (VAP) Control
69# define R300_VAP_VF_CNTL__PRIM_POINTS (1<<0) 67 * Stolen from r200 code from Christoph Brill (It's a guess!)
70# define R300_VAP_VF_CNTL__PRIM_LINES (2<<0) 68 */
71# define R300_VAP_VF_CNTL__PRIM_LINE_STRIP (3<<0) 69#define R300_VAP_CNTL 0x2080
72# define R300_VAP_VF_CNTL__PRIM_TRIANGLES (4<<0) 70
73# define R300_VAP_VF_CNTL__PRIM_TRIANGLE_FAN (5<<0) 71/* This register is written directly and also starts data section
74# define R300_VAP_VF_CNTL__PRIM_TRIANGLE_STRIP (6<<0) 72 * in many 3d CP_PACKET3's
75# define R300_VAP_VF_CNTL__PRIM_LINE_LOOP (12<<0) 73 */
76# define R300_VAP_VF_CNTL__PRIM_QUADS (13<<0) 74#define R300_VAP_VF_CNTL 0x2084
77# define R300_VAP_VF_CNTL__PRIM_QUAD_STRIP (14<<0) 75# define R300_VAP_VF_CNTL__PRIM_TYPE__SHIFT 0
78# define R300_VAP_VF_CNTL__PRIM_POLYGON (15<<0) 76# define R300_VAP_VF_CNTL__PRIM_NONE (0<<0)
79 77# define R300_VAP_VF_CNTL__PRIM_POINTS (1<<0)
80# define R300_VAP_VF_CNTL__PRIM_WALK__SHIFT 4 78# define R300_VAP_VF_CNTL__PRIM_LINES (2<<0)
81 /* State based - direct writes to registers trigger vertex generation */ 79# define R300_VAP_VF_CNTL__PRIM_LINE_STRIP (3<<0)
82# define R300_VAP_VF_CNTL__PRIM_WALK_STATE_BASED (0<<4) 80# define R300_VAP_VF_CNTL__PRIM_TRIANGLES (4<<0)
83# define R300_VAP_VF_CNTL__PRIM_WALK_INDICES (1<<4) 81# define R300_VAP_VF_CNTL__PRIM_TRIANGLE_FAN (5<<0)
84# define R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST (2<<4) 82# define R300_VAP_VF_CNTL__PRIM_TRIANGLE_STRIP (6<<0)
85# define R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_EMBEDDED (3<<4) 83# define R300_VAP_VF_CNTL__PRIM_LINE_LOOP (12<<0)
86 84# define R300_VAP_VF_CNTL__PRIM_QUADS (13<<0)
87 /* I don't think I saw these three used.. */ 85# define R300_VAP_VF_CNTL__PRIM_QUAD_STRIP (14<<0)
88# define R300_VAP_VF_CNTL__COLOR_ORDER__SHIFT 6 86# define R300_VAP_VF_CNTL__PRIM_POLYGON (15<<0)
89# define R300_VAP_VF_CNTL__TCL_OUTPUT_CTL_ENA__SHIFT 9 87
90# define R300_VAP_VF_CNTL__PROG_STREAM_ENA__SHIFT 10 88# define R300_VAP_VF_CNTL__PRIM_WALK__SHIFT 4
91 89 /* State based - direct writes to registers trigger vertex
92 /* index size - when not set the indices are assumed to be 16 bit */ 90 generation */
93# define R300_VAP_VF_CNTL__INDEX_SIZE_32bit (1<<11) 91# define R300_VAP_VF_CNTL__PRIM_WALK_STATE_BASED (0<<4)
94 /* number of vertices */ 92# define R300_VAP_VF_CNTL__PRIM_WALK_INDICES (1<<4)
95# define R300_VAP_VF_CNTL__NUM_VERTICES__SHIFT 16 93# define R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST (2<<4)
94# define R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_EMBEDDED (3<<4)
95
96 /* I don't think I saw these three used.. */
97# define R300_VAP_VF_CNTL__COLOR_ORDER__SHIFT 6
98# define R300_VAP_VF_CNTL__TCL_OUTPUT_CTL_ENA__SHIFT 9
99# define R300_VAP_VF_CNTL__PROG_STREAM_ENA__SHIFT 10
100
101 /* index size - when not set the indices are assumed to be 16 bit */
102# define R300_VAP_VF_CNTL__INDEX_SIZE_32bit (1<<11)
103 /* number of vertices */
104# define R300_VAP_VF_CNTL__NUM_VERTICES__SHIFT 16
96 105
97/* BEGIN: Wild guesses */ 106/* BEGIN: Wild guesses */
98#define R300_VAP_OUTPUT_VTX_FMT_0 0x2090 107#define R300_VAP_OUTPUT_VTX_FMT_0 0x2090
99# define R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT (1<<0) 108# define R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT (1<<0)
100# define R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT (1<<1) 109# define R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT (1<<1)
101# define R300_VAP_OUTPUT_VTX_FMT_0__COLOR_1_PRESENT (1<<2) /* GUESS */ 110# define R300_VAP_OUTPUT_VTX_FMT_0__COLOR_1_PRESENT (1<<2) /* GUESS */
102# define R300_VAP_OUTPUT_VTX_FMT_0__COLOR_2_PRESENT (1<<3) /* GUESS */ 111# define R300_VAP_OUTPUT_VTX_FMT_0__COLOR_2_PRESENT (1<<3) /* GUESS */
103# define R300_VAP_OUTPUT_VTX_FMT_0__COLOR_3_PRESENT (1<<4) /* GUESS */ 112# define R300_VAP_OUTPUT_VTX_FMT_0__COLOR_3_PRESENT (1<<4) /* GUESS */
104# define R300_VAP_OUTPUT_VTX_FMT_0__PT_SIZE_PRESENT (1<<16) /* GUESS */ 113# define R300_VAP_OUTPUT_VTX_FMT_0__PT_SIZE_PRESENT (1<<16) /* GUESS */
105 114
106#define R300_VAP_OUTPUT_VTX_FMT_1 0x2094 115#define R300_VAP_OUTPUT_VTX_FMT_1 0x2094
116 /* each of the following is 3 bits wide, specifies number
117 of components */
107# define R300_VAP_OUTPUT_VTX_FMT_1__TEX_0_COMP_CNT_SHIFT 0 118# define R300_VAP_OUTPUT_VTX_FMT_1__TEX_0_COMP_CNT_SHIFT 0
108# define R300_VAP_OUTPUT_VTX_FMT_1__TEX_1_COMP_CNT_SHIFT 3 119# define R300_VAP_OUTPUT_VTX_FMT_1__TEX_1_COMP_CNT_SHIFT 3
109# define R300_VAP_OUTPUT_VTX_FMT_1__TEX_2_COMP_CNT_SHIFT 6 120# define R300_VAP_OUTPUT_VTX_FMT_1__TEX_2_COMP_CNT_SHIFT 6
@@ -112,7 +123,7 @@ I am fairly certain that they are correct unless stated otherwise in comments.
112# define R300_VAP_OUTPUT_VTX_FMT_1__TEX_5_COMP_CNT_SHIFT 15 123# define R300_VAP_OUTPUT_VTX_FMT_1__TEX_5_COMP_CNT_SHIFT 15
113# define R300_VAP_OUTPUT_VTX_FMT_1__TEX_6_COMP_CNT_SHIFT 18 124# define R300_VAP_OUTPUT_VTX_FMT_1__TEX_6_COMP_CNT_SHIFT 18
114# define R300_VAP_OUTPUT_VTX_FMT_1__TEX_7_COMP_CNT_SHIFT 21 125# define R300_VAP_OUTPUT_VTX_FMT_1__TEX_7_COMP_CNT_SHIFT 21
115/* END */ 126/* END: Wild guesses */
116 127
117#define R300_SE_VTE_CNTL 0x20b0 128#define R300_SE_VTE_CNTL 0x20b0
118# define R300_VPORT_X_SCALE_ENA 0x00000001 129# define R300_VPORT_X_SCALE_ENA 0x00000001
@@ -128,43 +139,54 @@ I am fairly certain that they are correct unless stated otherwise in comments.
128# define R300_VTX_ST_DENORMALIZED 0x00001000 139# define R300_VTX_ST_DENORMALIZED 0x00001000
129 140
130/* BEGIN: Vertex data assembly - lots of uncertainties */ 141/* BEGIN: Vertex data assembly - lots of uncertainties */
142
143/* gap */
144
145#define R300_VAP_CNTL_STATUS 0x2140
146# define R300_VC_NO_SWAP (0 << 0)
147# define R300_VC_16BIT_SWAP (1 << 0)
148# define R300_VC_32BIT_SWAP (2 << 0)
149# define R300_VAP_TCL_BYPASS (1 << 8)
150
131/* gap */ 151/* gap */
152
132/* Where do we get our vertex data? 153/* Where do we get our vertex data?
133// 154 *
134// Vertex data either comes either from immediate mode registers or from 155 * Vertex data either comes either from immediate mode registers or from
135// vertex arrays. 156 * vertex arrays.
136// There appears to be no mixed mode (though we can force the pitch of 157 * There appears to be no mixed mode (though we can force the pitch of
137// vertex arrays to 0, effectively reusing the same element over and over 158 * vertex arrays to 0, effectively reusing the same element over and over
138// again). 159 * again).
139// 160 *
140// Immediate mode is controlled by the INPUT_CNTL registers. I am not sure 161 * Immediate mode is controlled by the INPUT_CNTL registers. I am not sure
141// if these registers influence vertex array processing. 162 * if these registers influence vertex array processing.
142// 163 *
143// Vertex arrays are controlled via the 3D_LOAD_VBPNTR packet3. 164 * Vertex arrays are controlled via the 3D_LOAD_VBPNTR packet3.
144// 165 *
145// In both cases, vertex attributes are then passed through INPUT_ROUTE. 166 * In both cases, vertex attributes are then passed through INPUT_ROUTE.
146 167 *
147// Beginning with INPUT_ROUTE_0_0 is a list of WORDs that route vertex data 168 * Beginning with INPUT_ROUTE_0_0 is a list of WORDs that route vertex data
148// into the vertex processor's input registers. 169 * into the vertex processor's input registers.
149// The first word routes the first input, the second word the second, etc. 170 * The first word routes the first input, the second word the second, etc.
150// The corresponding input is routed into the register with the given index. 171 * The corresponding input is routed into the register with the given index.
151// The list is ended by a word with INPUT_ROUTE_END set. 172 * The list is ended by a word with INPUT_ROUTE_END set.
152// 173 *
153// Always set COMPONENTS_4 in immediate mode. */ 174 * Always set COMPONENTS_4 in immediate mode.
175 */
154 176
155#define R300_VAP_INPUT_ROUTE_0_0 0x2150 177#define R300_VAP_INPUT_ROUTE_0_0 0x2150
156# define R300_INPUT_ROUTE_COMPONENTS_1 (0 << 0) 178# define R300_INPUT_ROUTE_COMPONENTS_1 (0 << 0)
157# define R300_INPUT_ROUTE_COMPONENTS_2 (1 << 0) 179# define R300_INPUT_ROUTE_COMPONENTS_2 (1 << 0)
158# define R300_INPUT_ROUTE_COMPONENTS_3 (2 << 0) 180# define R300_INPUT_ROUTE_COMPONENTS_3 (2 << 0)
159# define R300_INPUT_ROUTE_COMPONENTS_4 (3 << 0) 181# define R300_INPUT_ROUTE_COMPONENTS_4 (3 << 0)
160# define R300_INPUT_ROUTE_COMPONENTS_RGBA (4 << 0) /* GUESS */ 182# define R300_INPUT_ROUTE_COMPONENTS_RGBA (4 << 0) /* GUESS */
161# define R300_VAP_INPUT_ROUTE_IDX_SHIFT 8 183# define R300_VAP_INPUT_ROUTE_IDX_SHIFT 8
162# define R300_VAP_INPUT_ROUTE_IDX_MASK (31 << 8) /* GUESS */ 184# define R300_VAP_INPUT_ROUTE_IDX_MASK (31 << 8) /* GUESS */
163# define R300_VAP_INPUT_ROUTE_END (1 << 13) 185# define R300_VAP_INPUT_ROUTE_END (1 << 13)
164# define R300_INPUT_ROUTE_IMMEDIATE_MODE (0 << 14) /* GUESS */ 186# define R300_INPUT_ROUTE_IMMEDIATE_MODE (0 << 14) /* GUESS */
165# define R300_INPUT_ROUTE_FLOAT (1 << 14) /* GUESS */ 187# define R300_INPUT_ROUTE_FLOAT (1 << 14) /* GUESS */
166# define R300_INPUT_ROUTE_UNSIGNED_BYTE (2 << 14) /* GUESS */ 188# define R300_INPUT_ROUTE_UNSIGNED_BYTE (2 << 14) /* GUESS */
167# define R300_INPUT_ROUTE_FLOAT_COLOR (3 << 14) /* GUESS */ 189# define R300_INPUT_ROUTE_FLOAT_COLOR (3 << 14) /* GUESS */
168#define R300_VAP_INPUT_ROUTE_0_1 0x2154 190#define R300_VAP_INPUT_ROUTE_0_1 0x2154
169#define R300_VAP_INPUT_ROUTE_0_2 0x2158 191#define R300_VAP_INPUT_ROUTE_0_2 0x2158
170#define R300_VAP_INPUT_ROUTE_0_3 0x215C 192#define R300_VAP_INPUT_ROUTE_0_3 0x215C
@@ -174,10 +196,12 @@ I am fairly certain that they are correct unless stated otherwise in comments.
174#define R300_VAP_INPUT_ROUTE_0_7 0x216C 196#define R300_VAP_INPUT_ROUTE_0_7 0x216C
175 197
176/* gap */ 198/* gap */
199
177/* Notes: 200/* Notes:
178// - always set up to produce at least two attributes: 201 * - always set up to produce at least two attributes:
179// if vertex program uses only position, fglrx will set normal, too 202 * if vertex program uses only position, fglrx will set normal, too
180// - INPUT_CNTL_0_COLOR and INPUT_CNTL_COLOR bits are always equal */ 203 * - INPUT_CNTL_0_COLOR and INPUT_CNTL_COLOR bits are always equal.
204 */
181#define R300_VAP_INPUT_CNTL_0 0x2180 205#define R300_VAP_INPUT_CNTL_0 0x2180
182# define R300_INPUT_CNTL_0_COLOR 0x00000001 206# define R300_INPUT_CNTL_0_COLOR 0x00000001
183#define R300_VAP_INPUT_CNTL_1 0x2184 207#define R300_VAP_INPUT_CNTL_1 0x2184
@@ -186,20 +210,22 @@ I am fairly certain that they are correct unless stated otherwise in comments.
186# define R300_INPUT_CNTL_COLOR 0x00000004 210# define R300_INPUT_CNTL_COLOR 0x00000004
187# define R300_INPUT_CNTL_TC0 0x00000400 211# define R300_INPUT_CNTL_TC0 0x00000400
188# define R300_INPUT_CNTL_TC1 0x00000800 212# define R300_INPUT_CNTL_TC1 0x00000800
189# define R300_INPUT_CNTL_TC2 0x00001000 /* GUESS */ 213# define R300_INPUT_CNTL_TC2 0x00001000 /* GUESS */
190# define R300_INPUT_CNTL_TC3 0x00002000 /* GUESS */ 214# define R300_INPUT_CNTL_TC3 0x00002000 /* GUESS */
191# define R300_INPUT_CNTL_TC4 0x00004000 /* GUESS */ 215# define R300_INPUT_CNTL_TC4 0x00004000 /* GUESS */
192# define R300_INPUT_CNTL_TC5 0x00008000 /* GUESS */ 216# define R300_INPUT_CNTL_TC5 0x00008000 /* GUESS */
193# define R300_INPUT_CNTL_TC6 0x00010000 /* GUESS */ 217# define R300_INPUT_CNTL_TC6 0x00010000 /* GUESS */
194# define R300_INPUT_CNTL_TC7 0x00020000 /* GUESS */ 218# define R300_INPUT_CNTL_TC7 0x00020000 /* GUESS */
195 219
196/* gap */ 220/* gap */
221
197/* Words parallel to INPUT_ROUTE_0; All words that are active in INPUT_ROUTE_0 222/* Words parallel to INPUT_ROUTE_0; All words that are active in INPUT_ROUTE_0
198// are set to a swizzling bit pattern, other words are 0. 223 * are set to a swizzling bit pattern, other words are 0.
199// 224 *
200// In immediate mode, the pattern is always set to xyzw. In vertex array 225 * In immediate mode, the pattern is always set to xyzw. In vertex array
201// mode, the swizzling pattern is e.g. used to set zw components in texture 226 * mode, the swizzling pattern is e.g. used to set zw components in texture
202// coordinates with only tweo components. */ 227 * coordinates with only tweo components.
228 */
203#define R300_VAP_INPUT_ROUTE_1_0 0x21E0 229#define R300_VAP_INPUT_ROUTE_1_0 0x21E0
204# define R300_INPUT_ROUTE_SELECT_X 0 230# define R300_INPUT_ROUTE_SELECT_X 0
205# define R300_INPUT_ROUTE_SELECT_Y 1 231# define R300_INPUT_ROUTE_SELECT_Y 1
@@ -208,11 +234,11 @@ I am fairly certain that they are correct unless stated otherwise in comments.
208# define R300_INPUT_ROUTE_SELECT_ZERO 4 234# define R300_INPUT_ROUTE_SELECT_ZERO 4
209# define R300_INPUT_ROUTE_SELECT_ONE 5 235# define R300_INPUT_ROUTE_SELECT_ONE 5
210# define R300_INPUT_ROUTE_SELECT_MASK 7 236# define R300_INPUT_ROUTE_SELECT_MASK 7
211# define R300_INPUT_ROUTE_X_SHIFT 0 237# define R300_INPUT_ROUTE_X_SHIFT 0
212# define R300_INPUT_ROUTE_Y_SHIFT 3 238# define R300_INPUT_ROUTE_Y_SHIFT 3
213# define R300_INPUT_ROUTE_Z_SHIFT 6 239# define R300_INPUT_ROUTE_Z_SHIFT 6
214# define R300_INPUT_ROUTE_W_SHIFT 9 240# define R300_INPUT_ROUTE_W_SHIFT 9
215# define R300_INPUT_ROUTE_ENABLE (15 << 12) 241# define R300_INPUT_ROUTE_ENABLE (15 << 12)
216#define R300_VAP_INPUT_ROUTE_1_1 0x21E4 242#define R300_VAP_INPUT_ROUTE_1_1 0x21E4
217#define R300_VAP_INPUT_ROUTE_1_2 0x21E8 243#define R300_VAP_INPUT_ROUTE_1_2 0x21E8
218#define R300_VAP_INPUT_ROUTE_1_3 0x21EC 244#define R300_VAP_INPUT_ROUTE_1_3 0x21EC
@@ -221,79 +247,107 @@ I am fairly certain that they are correct unless stated otherwise in comments.
221#define R300_VAP_INPUT_ROUTE_1_6 0x21F8 247#define R300_VAP_INPUT_ROUTE_1_6 0x21F8
222#define R300_VAP_INPUT_ROUTE_1_7 0x21FC 248#define R300_VAP_INPUT_ROUTE_1_7 0x21FC
223 249
224/* END */ 250/* END: Vertex data assembly */
225 251
226/* gap */ 252/* gap */
227/* BEGIN: Upload vertex program and data 253
228// The programmable vertex shader unit has a memory bank of unknown size 254/* BEGIN: Upload vertex program and data */
229// that can be written to in 16 byte units by writing the address into 255
230// UPLOAD_ADDRESS, followed by data in UPLOAD_DATA (multiples of 4 DWORDs). 256/*
231// 257 * The programmable vertex shader unit has a memory bank of unknown size
232// Pointers into the memory bank are always in multiples of 16 bytes. 258 * that can be written to in 16 byte units by writing the address into
233// 259 * UPLOAD_ADDRESS, followed by data in UPLOAD_DATA (multiples of 4 DWORDs).
234// The memory bank is divided into areas with fixed meaning. 260 *
235// 261 * Pointers into the memory bank are always in multiples of 16 bytes.
236// Starting at address UPLOAD_PROGRAM: Vertex program instructions. 262 *
237// Native limits reported by drivers from ATI suggest size 256 (i.e. 4KB), 263 * The memory bank is divided into areas with fixed meaning.
238// whereas the difference between known addresses suggests size 512. 264 *
239// 265 * Starting at address UPLOAD_PROGRAM: Vertex program instructions.
240// Starting at address UPLOAD_PARAMETERS: Vertex program parameters. 266 * Native limits reported by drivers from ATI suggest size 256 (i.e. 4KB),
241// Native reported limits and the VPI layout suggest size 256, whereas 267 * whereas the difference between known addresses suggests size 512.
242// difference between known addresses suggests size 512. 268 *
243// 269 * Starting at address UPLOAD_PARAMETERS: Vertex program parameters.
244// At address UPLOAD_POINTSIZE is a vector (0, 0, ps, 0), where ps is the 270 * Native reported limits and the VPI layout suggest size 256, whereas
245// floating point pointsize. The exact purpose of this state is uncertain, 271 * difference between known addresses suggests size 512.
246// as there is also the R300_RE_POINTSIZE register. 272 *
247// 273 * At address UPLOAD_POINTSIZE is a vector (0, 0, ps, 0), where ps is the
248// Multiple vertex programs and parameter sets can be loaded at once, 274 * floating point pointsize. The exact purpose of this state is uncertain,
249// which could explain the size discrepancy. */ 275 * as there is also the R300_RE_POINTSIZE register.
276 *
277 * Multiple vertex programs and parameter sets can be loaded at once,
278 * which could explain the size discrepancy.
279 */
250#define R300_VAP_PVS_UPLOAD_ADDRESS 0x2200 280#define R300_VAP_PVS_UPLOAD_ADDRESS 0x2200
251# define R300_PVS_UPLOAD_PROGRAM 0x00000000 281# define R300_PVS_UPLOAD_PROGRAM 0x00000000
252# define R300_PVS_UPLOAD_PARAMETERS 0x00000200 282# define R300_PVS_UPLOAD_PARAMETERS 0x00000200
253# define R300_PVS_UPLOAD_POINTSIZE 0x00000406 283# define R300_PVS_UPLOAD_POINTSIZE 0x00000406
284
254/* gap */ 285/* gap */
286
255#define R300_VAP_PVS_UPLOAD_DATA 0x2208 287#define R300_VAP_PVS_UPLOAD_DATA 0x2208
256/* END */ 288
289/* END: Upload vertex program and data */
257 290
258/* gap */ 291/* gap */
292
259/* I do not know the purpose of this register. However, I do know that 293/* I do not know the purpose of this register. However, I do know that
260// it is set to 221C_CLEAR for clear operations and to 221C_NORMAL 294 * it is set to 221C_CLEAR for clear operations and to 221C_NORMAL
261// for normal rendering. */ 295 * for normal rendering.
296 */
262#define R300_VAP_UNKNOWN_221C 0x221C 297#define R300_VAP_UNKNOWN_221C 0x221C
263# define R300_221C_NORMAL 0x00000000 298# define R300_221C_NORMAL 0x00000000
264# define R300_221C_CLEAR 0x0001C000 299# define R300_221C_CLEAR 0x0001C000
265 300
301/* These seem to be per-pixel and per-vertex X and Y clipping planes. The first
302 * plane is per-pixel and the second plane is per-vertex.
303 *
304 * This was determined by experimentation alone but I believe it is correct.
305 *
306 * These registers are called X_QUAD0_1_FL to X_QUAD0_4_FL by glxtest.
307 */
308#define R300_VAP_CLIP_X_0 0x2220
309#define R300_VAP_CLIP_X_1 0x2224
310#define R300_VAP_CLIP_Y_0 0x2228
311#define R300_VAP_CLIP_Y_1 0x2230
312
266/* gap */ 313/* gap */
314
267/* Sometimes, END_OF_PKT and 0x2284=0 are the only commands sent between 315/* Sometimes, END_OF_PKT and 0x2284=0 are the only commands sent between
268// rendering commands and overwriting vertex program parameters. 316 * rendering commands and overwriting vertex program parameters.
269// Therefore, I suspect writing zero to 0x2284 synchronizes the engine and 317 * Therefore, I suspect writing zero to 0x2284 synchronizes the engine and
270// avoids bugs caused by still running shaders reading bad data from memory. */ 318 * avoids bugs caused by still running shaders reading bad data from memory.
271#define R300_VAP_PVS_WAITIDLE 0x2284 /* GUESS */ 319 */
320#define R300_VAP_PVS_WAITIDLE 0x2284 /* GUESS */
272 321
273/* Absolutely no clue what this register is about. */ 322/* Absolutely no clue what this register is about. */
274#define R300_VAP_UNKNOWN_2288 0x2288 323#define R300_VAP_UNKNOWN_2288 0x2288
275# define R300_2288_R300 0x00750000 /* -- nh */ 324# define R300_2288_R300 0x00750000 /* -- nh */
276# define R300_2288_RV350 0x0000FFFF /* -- Vladimir */ 325# define R300_2288_RV350 0x0000FFFF /* -- Vladimir */
277 326
278/* gap */ 327/* gap */
328
279/* Addresses are relative to the vertex program instruction area of the 329/* Addresses are relative to the vertex program instruction area of the
280// memory bank. PROGRAM_END points to the last instruction of the active 330 * memory bank. PROGRAM_END points to the last instruction of the active
281// program 331 * program
282// 332 *
283// The meaning of the two UNKNOWN fields is obviously not known. However, 333 * The meaning of the two UNKNOWN fields is obviously not known. However,
284// experiments so far have shown that both *must* point to an instruction 334 * experiments so far have shown that both *must* point to an instruction
285// inside the vertex program, otherwise the GPU locks up. 335 * inside the vertex program, otherwise the GPU locks up.
286// fglrx usually sets CNTL_3_UNKNOWN to the end of the program and 336 *
287// CNTL_1_UNKNOWN points to instruction where last write to position takes place. 337 * fglrx usually sets CNTL_3_UNKNOWN to the end of the program and
288// Most likely this is used to ignore rest of the program in cases where group of verts arent visible. 338 * R300_PVS_CNTL_1_POS_END_SHIFT points to instruction where last write to
289// For some reason this "section" is sometimes accepted other instruction that have 339 * position takes place.
290// no relationship with position calculations. 340 *
291*/ 341 * Most likely this is used to ignore rest of the program in cases
342 * where group of verts arent visible. For some reason this "section"
343 * is sometimes accepted other instruction that have no relationship with
344 * position calculations.
345 */
292#define R300_VAP_PVS_CNTL_1 0x22D0 346#define R300_VAP_PVS_CNTL_1 0x22D0
293# define R300_PVS_CNTL_1_PROGRAM_START_SHIFT 0 347# define R300_PVS_CNTL_1_PROGRAM_START_SHIFT 0
294# define R300_PVS_CNTL_1_POS_END_SHIFT 10 348# define R300_PVS_CNTL_1_POS_END_SHIFT 10
295# define R300_PVS_CNTL_1_PROGRAM_END_SHIFT 20 349# define R300_PVS_CNTL_1_PROGRAM_END_SHIFT 20
296/* Addresses are relative to the vertex program parameters area. */ 350/* Addresses are relative the the vertex program parameters area. */
297#define R300_VAP_PVS_CNTL_2 0x22D4 351#define R300_VAP_PVS_CNTL_2 0x22D4
298# define R300_PVS_CNTL_2_PARAM_OFFSET_SHIFT 0 352# define R300_PVS_CNTL_2_PARAM_OFFSET_SHIFT 0
299# define R300_PVS_CNTL_2_PARAM_COUNT_SHIFT 16 353# define R300_PVS_CNTL_2_PARAM_COUNT_SHIFT 16
@@ -302,23 +356,26 @@ I am fairly certain that they are correct unless stated otherwise in comments.
302# define R300_PVS_CNTL_3_PROGRAM_UNKNOWN2_SHIFT 0 356# define R300_PVS_CNTL_3_PROGRAM_UNKNOWN2_SHIFT 0
303 357
304/* The entire range from 0x2300 to 0x2AC inclusive seems to be used for 358/* The entire range from 0x2300 to 0x2AC inclusive seems to be used for
305// immediate vertices */ 359 * immediate vertices
360 */
306#define R300_VAP_VTX_COLOR_R 0x2464 361#define R300_VAP_VTX_COLOR_R 0x2464
307#define R300_VAP_VTX_COLOR_G 0x2468 362#define R300_VAP_VTX_COLOR_G 0x2468
308#define R300_VAP_VTX_COLOR_B 0x246C 363#define R300_VAP_VTX_COLOR_B 0x246C
309#define R300_VAP_VTX_POS_0_X_1 0x2490 /* used for glVertex2*() */ 364#define R300_VAP_VTX_POS_0_X_1 0x2490 /* used for glVertex2*() */
310#define R300_VAP_VTX_POS_0_Y_1 0x2494 365#define R300_VAP_VTX_POS_0_Y_1 0x2494
311#define R300_VAP_VTX_COLOR_PKD 0x249C /* RGBA */ 366#define R300_VAP_VTX_COLOR_PKD 0x249C /* RGBA */
312#define R300_VAP_VTX_POS_0_X_2 0x24A0 /* used for glVertex3*() */ 367#define R300_VAP_VTX_POS_0_X_2 0x24A0 /* used for glVertex3*() */
313#define R300_VAP_VTX_POS_0_Y_2 0x24A4 368#define R300_VAP_VTX_POS_0_Y_2 0x24A4
314#define R300_VAP_VTX_POS_0_Z_2 0x24A8 369#define R300_VAP_VTX_POS_0_Z_2 0x24A8
315#define R300_VAP_VTX_END_OF_PKT 0x24AC /* write 0 to indicate end of packet? */ 370/* write 0 to indicate end of packet? */
371#define R300_VAP_VTX_END_OF_PKT 0x24AC
316 372
317/* gap */ 373/* gap */
318 374
319/* These are values from r300_reg/r300_reg.h - they are known to be correct 375/* These are values from r300_reg/r300_reg.h - they are known to be correct
320 and are here so we can use one register file instead of several 376 * and are here so we can use one register file instead of several
321 - Vladimir */ 377 * - Vladimir
378 */
322#define R300_GB_VAP_RASTER_VTX_FMT_0 0x4000 379#define R300_GB_VAP_RASTER_VTX_FMT_0 0x4000
323# define R300_GB_VAP_RASTER_VTX_FMT_0__POS_PRESENT (1<<0) 380# define R300_GB_VAP_RASTER_VTX_FMT_0__POS_PRESENT (1<<0)
324# define R300_GB_VAP_RASTER_VTX_FMT_0__COLOR_0_PRESENT (1<<1) 381# define R300_GB_VAP_RASTER_VTX_FMT_0__COLOR_0_PRESENT (1<<1)
@@ -341,14 +398,16 @@ I am fairly certain that they are correct unless stated otherwise in comments.
341# define R300_GB_VAP_RASTER_VTX_FMT_1__TEX_7_COMP_CNT_SHIFT 21 398# define R300_GB_VAP_RASTER_VTX_FMT_1__TEX_7_COMP_CNT_SHIFT 21
342 399
343/* UNK30 seems to enables point to quad transformation on textures 400/* UNK30 seems to enables point to quad transformation on textures
344 (or something closely related to that). 401 * (or something closely related to that).
345 This bit is rather fatal at the time being due to lackings at pixel shader side */ 402 * This bit is rather fatal at the time being due to lackings at pixel
403 * shader side
404 */
346#define R300_GB_ENABLE 0x4008 405#define R300_GB_ENABLE 0x4008
347# define R300_GB_POINT_STUFF_ENABLE (1<<0) 406# define R300_GB_POINT_STUFF_ENABLE (1<<0)
348# define R300_GB_LINE_STUFF_ENABLE (1<<1) 407# define R300_GB_LINE_STUFF_ENABLE (1<<1)
349# define R300_GB_TRIANGLE_STUFF_ENABLE (1<<2) 408# define R300_GB_TRIANGLE_STUFF_ENABLE (1<<2)
350# define R300_GB_STENCIL_AUTO_ENABLE (1<<4) 409# define R300_GB_STENCIL_AUTO_ENABLE (1<<4)
351# define R300_GB_UNK30 (1<<30) 410# define R300_GB_UNK31 (1<<31)
352 /* each of the following is 2 bits wide */ 411 /* each of the following is 2 bits wide */
353#define R300_GB_TEX_REPLICATE 0 412#define R300_GB_TEX_REPLICATE 0
354#define R300_GB_TEX_ST 1 413#define R300_GB_TEX_ST 1
@@ -383,11 +442,13 @@ I am fairly certain that they are correct unless stated otherwise in comments.
383# define R300_GB_MSPOS1__MS_Y5_SHIFT 20 442# define R300_GB_MSPOS1__MS_Y5_SHIFT 20
384# define R300_GB_MSPOS1__MSBD1 24 443# define R300_GB_MSPOS1__MSBD1 24
385 444
445
386#define R300_GB_TILE_CONFIG 0x4018 446#define R300_GB_TILE_CONFIG 0x4018
387# define R300_GB_TILE_ENABLE (1<<0) 447# define R300_GB_TILE_ENABLE (1<<0)
388# define R300_GB_TILE_PIPE_COUNT_RV300 0 448# define R300_GB_TILE_PIPE_COUNT_RV300 0
389# define R300_GB_TILE_PIPE_COUNT_R300 (3<<1) 449# define R300_GB_TILE_PIPE_COUNT_R300 (3<<1)
390# define R300_GB_TILE_PIPE_COUNT_R420 (7<<1) 450# define R300_GB_TILE_PIPE_COUNT_R420 (7<<1)
451# define R300_GB_TILE_PIPE_COUNT_RV410 (3<<1)
391# define R300_GB_TILE_SIZE_8 0 452# define R300_GB_TILE_SIZE_8 0
392# define R300_GB_TILE_SIZE_16 (1<<4) 453# define R300_GB_TILE_SIZE_16 (1<<4)
393# define R300_GB_TILE_SIZE_32 (2<<4) 454# define R300_GB_TILE_SIZE_32 (2<<4)
@@ -442,17 +503,18 @@ I am fairly certain that they are correct unless stated otherwise in comments.
442# define R300_GB_W_SELECT_1 (1<<4) 503# define R300_GB_W_SELECT_1 (1<<4)
443 504
444#define R300_GB_AA_CONFIG 0x4020 505#define R300_GB_AA_CONFIG 0x4020
506# define R300_AA_DISABLE 0x00
445# define R300_AA_ENABLE 0x01 507# define R300_AA_ENABLE 0x01
446# define R300_AA_SUBSAMPLES_2 0 508# define R300_AA_SUBSAMPLES_2 0
447# define R300_AA_SUBSAMPLES_3 (1<<1) 509# define R300_AA_SUBSAMPLES_3 (1<<1)
448# define R300_AA_SUBSAMPLES_4 (2<<1) 510# define R300_AA_SUBSAMPLES_4 (2<<1)
449# define R300_AA_SUBSAMPLES_6 (3<<1) 511# define R300_AA_SUBSAMPLES_6 (3<<1)
450 512
451/* END */
452
453/* gap */ 513/* gap */
514
454/* Zero to flush caches. */ 515/* Zero to flush caches. */
455#define R300_TX_CNTL 0x4100 516#define R300_TX_CNTL 0x4100
517#define R300_TX_FLUSH 0x0
456 518
457/* The upper enable bits are guessed, based on fglrx reported limits. */ 519/* The upper enable bits are guessed, based on fglrx reported limits. */
458#define R300_TX_ENABLE 0x4104 520#define R300_TX_ENABLE 0x4104
@@ -474,24 +536,25 @@ I am fairly certain that they are correct unless stated otherwise in comments.
474# define R300_TX_ENABLE_15 (1 << 15) 536# define R300_TX_ENABLE_15 (1 << 15)
475 537
476/* The pointsize is given in multiples of 6. The pointsize can be 538/* The pointsize is given in multiples of 6. The pointsize can be
477// enormous: Clear() renders a single point that fills the entire 539 * enormous: Clear() renders a single point that fills the entire
478// framebuffer. */ 540 * framebuffer.
541 */
479#define R300_RE_POINTSIZE 0x421C 542#define R300_RE_POINTSIZE 0x421C
480# define R300_POINTSIZE_Y_SHIFT 0 543# define R300_POINTSIZE_Y_SHIFT 0
481# define R300_POINTSIZE_Y_MASK (0xFFFF << 0) /* GUESS */ 544# define R300_POINTSIZE_Y_MASK (0xFFFF << 0) /* GUESS */
482# define R300_POINTSIZE_X_SHIFT 16 545# define R300_POINTSIZE_X_SHIFT 16
483# define R300_POINTSIZE_X_MASK (0xFFFF << 16) /* GUESS */ 546# define R300_POINTSIZE_X_MASK (0xFFFF << 16) /* GUESS */
484# define R300_POINTSIZE_MAX (R300_POINTSIZE_Y_MASK / 6) 547# define R300_POINTSIZE_MAX (R300_POINTSIZE_Y_MASK / 6)
485 548
486/* The line width is given in multiples of 6. 549/* The line width is given in multiples of 6.
487 In default mode lines are classified as vertical lines. 550 * In default mode lines are classified as vertical lines.
488 HO: horizontal 551 * HO: horizontal
489 VE: vertical or horizontal 552 * VE: vertical or horizontal
490 HO & VE: no classification 553 * HO & VE: no classification
491*/ 554 */
492#define R300_RE_LINE_CNT 0x4234 555#define R300_RE_LINE_CNT 0x4234
493# define R300_LINESIZE_SHIFT 0 556# define R300_LINESIZE_SHIFT 0
494# define R300_LINESIZE_MASK (0xFFFF << 0) /* GUESS */ 557# define R300_LINESIZE_MASK (0xFFFF << 0) /* GUESS */
495# define R300_LINESIZE_MAX (R300_LINESIZE_MASK / 6) 558# define R300_LINESIZE_MAX (R300_LINESIZE_MASK / 6)
496# define R300_LINE_CNT_HO (1 << 16) 559# define R300_LINE_CNT_HO (1 << 16)
497# define R300_LINE_CNT_VE (1 << 17) 560# define R300_LINE_CNT_VE (1 << 17)
@@ -499,6 +562,9 @@ I am fairly certain that they are correct unless stated otherwise in comments.
499/* Some sort of scale or clamp value for texcoordless textures. */ 562/* Some sort of scale or clamp value for texcoordless textures. */
500#define R300_RE_UNK4238 0x4238 563#define R300_RE_UNK4238 0x4238
501 564
565/* Something shade related */
566#define R300_RE_SHADE 0x4274
567
502#define R300_RE_SHADE_MODEL 0x4278 568#define R300_RE_SHADE_MODEL 0x4278
503# define R300_RE_SHADE_MODEL_SMOOTH 0x3aaaa 569# define R300_RE_SHADE_MODEL_SMOOTH 0x3aaaa
504# define R300_RE_SHADE_MODEL_FLAT 0x39595 570# define R300_RE_SHADE_MODEL_FLAT 0x39595
@@ -513,24 +579,31 @@ I am fairly certain that they are correct unless stated otherwise in comments.
513# define R300_PM_BACK_LINE (1 << 7) 579# define R300_PM_BACK_LINE (1 << 7)
514# define R300_PM_BACK_FILL (1 << 8) 580# define R300_PM_BACK_FILL (1 << 8)
515 581
582/* Fog parameters */
583#define R300_RE_FOG_SCALE 0x4294
584#define R300_RE_FOG_START 0x4298
585
516/* Not sure why there are duplicate of factor and constant values. 586/* Not sure why there are duplicate of factor and constant values.
517 My best guess so far is that there are seperate zbiases for test and write. 587 * My best guess so far is that there are seperate zbiases for test and write.
518 Ordering might be wrong. 588 * Ordering might be wrong.
519 Some of the tests indicate that fgl has a fallback implementation of zbias 589 * Some of the tests indicate that fgl has a fallback implementation of zbias
520 via pixel shaders. */ 590 * via pixel shaders.
591 */
592#define R300_RE_ZBIAS_CNTL 0x42A0 /* GUESS */
521#define R300_RE_ZBIAS_T_FACTOR 0x42A4 593#define R300_RE_ZBIAS_T_FACTOR 0x42A4
522#define R300_RE_ZBIAS_T_CONSTANT 0x42A8 594#define R300_RE_ZBIAS_T_CONSTANT 0x42A8
523#define R300_RE_ZBIAS_W_FACTOR 0x42AC 595#define R300_RE_ZBIAS_W_FACTOR 0x42AC
524#define R300_RE_ZBIAS_W_CONSTANT 0x42B0 596#define R300_RE_ZBIAS_W_CONSTANT 0x42B0
525 597
526/* This register needs to be set to (1<<1) for RV350 to correctly 598/* This register needs to be set to (1<<1) for RV350 to correctly
527 perform depth test (see --vb-triangles in r300_demo) 599 * perform depth test (see --vb-triangles in r300_demo)
528 Don't know about other chips. - Vladimir 600 * Don't know about other chips. - Vladimir
529 This is set to 3 when GL_POLYGON_OFFSET_FILL is on. 601 * This is set to 3 when GL_POLYGON_OFFSET_FILL is on.
530 My guess is that there are two bits for each zbias primitive (FILL, LINE, POINT). 602 * My guess is that there are two bits for each zbias primitive
531 One to enable depth test and one for depth write. 603 * (FILL, LINE, POINT).
532 Yet this doesnt explain why depth writes work ... 604 * One to enable depth test and one for depth write.
533 */ 605 * Yet this doesnt explain why depth writes work ...
606 */
534#define R300_RE_OCCLUSION_CNTL 0x42B4 607#define R300_RE_OCCLUSION_CNTL 0x42B4
535# define R300_OCCLUSION_ON (1<<1) 608# define R300_OCCLUSION_ON (1<<1)
536 609
@@ -540,30 +613,38 @@ I am fairly certain that they are correct unless stated otherwise in comments.
540# define R300_FRONT_FACE_CCW (0 << 2) 613# define R300_FRONT_FACE_CCW (0 << 2)
541# define R300_FRONT_FACE_CW (1 << 2) 614# define R300_FRONT_FACE_CW (1 << 2)
542 615
543/* BEGIN: Rasterization / Interpolators - many guesses 616
544// 0_UNKNOWN_18 has always been set except for clear operations. 617/* BEGIN: Rasterization / Interpolators - many guesses */
545// TC_CNT is the number of incoming texture coordinate sets (i.e. it depends 618
546// on the vertex program, *not* the fragment program) */ 619/* 0_UNKNOWN_18 has always been set except for clear operations.
620 * TC_CNT is the number of incoming texture coordinate sets (i.e. it depends
621 * on the vertex program, *not* the fragment program)
622 */
547#define R300_RS_CNTL_0 0x4300 623#define R300_RS_CNTL_0 0x4300
548# define R300_RS_CNTL_TC_CNT_SHIFT 2 624# define R300_RS_CNTL_TC_CNT_SHIFT 2
549# define R300_RS_CNTL_TC_CNT_MASK (7 << 2) 625# define R300_RS_CNTL_TC_CNT_MASK (7 << 2)
550# define R300_RS_CNTL_CI_CNT_SHIFT 7 /* number of color interpolators used */ 626 /* number of color interpolators used */
627# define R300_RS_CNTL_CI_CNT_SHIFT 7
551# define R300_RS_CNTL_0_UNKNOWN_18 (1 << 18) 628# define R300_RS_CNTL_0_UNKNOWN_18 (1 << 18)
552/* Guess: RS_CNTL_1 holds the index of the highest used RS_ROUTE_n register. */ 629 /* Guess: RS_CNTL_1 holds the index of the highest used RS_ROUTE_n
630 register. */
553#define R300_RS_CNTL_1 0x4304 631#define R300_RS_CNTL_1 0x4304
554 632
555/* gap */ 633/* gap */
634
556/* Only used for texture coordinates. 635/* Only used for texture coordinates.
557// Use the source field to route texture coordinate input from the vertex program 636 * Use the source field to route texture coordinate input from the
558// to the desired interpolator. Note that the source field is relative to the 637 * vertex program to the desired interpolator. Note that the source
559// outputs the vertex program *actually* writes. If a vertex program only writes 638 * field is relative to the outputs the vertex program *actually*
560// texcoord[1], this will be source index 0. 639 * writes. If a vertex program only writes texcoord[1], this will
561// Set INTERP_USED on all interpolators that produce data used by the 640 * be source index 0.
562// fragment program. INTERP_USED looks like a swizzling mask, but 641 * Set INTERP_USED on all interpolators that produce data used by
563// I haven't seen it used that way. 642 * the fragment program. INTERP_USED looks like a swizzling mask,
564// 643 * but I haven't seen it used that way.
565// Note: The _UNKNOWN constants are always set in their respective register. 644 *
566// I don't know if this is necessary. */ 645 * Note: The _UNKNOWN constants are always set in their respective
646 * register. I don't know if this is necessary.
647 */
567#define R300_RS_INTERP_0 0x4310 648#define R300_RS_INTERP_0 0x4310
568#define R300_RS_INTERP_1 0x4314 649#define R300_RS_INTERP_1 0x4314
569# define R300_RS_INTERP_1_UNKNOWN 0x40 650# define R300_RS_INTERP_1_UNKNOWN 0x40
@@ -580,54 +661,63 @@ I am fairly certain that they are correct unless stated otherwise in comments.
580# define R300_RS_INTERP_USED 0x00D10000 661# define R300_RS_INTERP_USED 0x00D10000
581 662
582/* These DWORDs control how vertex data is routed into fragment program 663/* These DWORDs control how vertex data is routed into fragment program
583// registers, after interpolators. */ 664 * registers, after interpolators.
665 */
584#define R300_RS_ROUTE_0 0x4330 666#define R300_RS_ROUTE_0 0x4330
585#define R300_RS_ROUTE_1 0x4334 667#define R300_RS_ROUTE_1 0x4334
586#define R300_RS_ROUTE_2 0x4338 668#define R300_RS_ROUTE_2 0x4338
587#define R300_RS_ROUTE_3 0x433C /* GUESS */ 669#define R300_RS_ROUTE_3 0x433C /* GUESS */
588#define R300_RS_ROUTE_4 0x4340 /* GUESS */ 670#define R300_RS_ROUTE_4 0x4340 /* GUESS */
589#define R300_RS_ROUTE_5 0x4344 /* GUESS */ 671#define R300_RS_ROUTE_5 0x4344 /* GUESS */
590#define R300_RS_ROUTE_6 0x4348 /* GUESS */ 672#define R300_RS_ROUTE_6 0x4348 /* GUESS */
591#define R300_RS_ROUTE_7 0x434C /* GUESS */ 673#define R300_RS_ROUTE_7 0x434C /* GUESS */
592# define R300_RS_ROUTE_SOURCE_INTERP_0 0 674# define R300_RS_ROUTE_SOURCE_INTERP_0 0
593# define R300_RS_ROUTE_SOURCE_INTERP_1 1 675# define R300_RS_ROUTE_SOURCE_INTERP_1 1
594# define R300_RS_ROUTE_SOURCE_INTERP_2 2 676# define R300_RS_ROUTE_SOURCE_INTERP_2 2
595# define R300_RS_ROUTE_SOURCE_INTERP_3 3 677# define R300_RS_ROUTE_SOURCE_INTERP_3 3
596# define R300_RS_ROUTE_SOURCE_INTERP_4 4 678# define R300_RS_ROUTE_SOURCE_INTERP_4 4
597# define R300_RS_ROUTE_SOURCE_INTERP_5 5 /* GUESS */ 679# define R300_RS_ROUTE_SOURCE_INTERP_5 5 /* GUESS */
598# define R300_RS_ROUTE_SOURCE_INTERP_6 6 /* GUESS */ 680# define R300_RS_ROUTE_SOURCE_INTERP_6 6 /* GUESS */
599# define R300_RS_ROUTE_SOURCE_INTERP_7 7 /* GUESS */ 681# define R300_RS_ROUTE_SOURCE_INTERP_7 7 /* GUESS */
600# define R300_RS_ROUTE_ENABLE (1 << 3) /* GUESS */ 682# define R300_RS_ROUTE_ENABLE (1 << 3) /* GUESS */
601# define R300_RS_ROUTE_DEST_SHIFT 6 683# define R300_RS_ROUTE_DEST_SHIFT 6
602# define R300_RS_ROUTE_DEST_MASK (31 << 6) /* GUESS */ 684# define R300_RS_ROUTE_DEST_MASK (31 << 6) /* GUESS */
603 685
604/* Special handling for color: When the fragment program uses color, 686/* Special handling for color: When the fragment program uses color,
605// the ROUTE_0_COLOR bit is set and ROUTE_0_COLOR_DEST contains the 687 * the ROUTE_0_COLOR bit is set and ROUTE_0_COLOR_DEST contains the
606// color register index. */ 688 * color register index.
689 *
690 * Apperently you may set the R300_RS_ROUTE_0_COLOR bit, but not provide any
691 * R300_RS_ROUTE_0_COLOR_DEST value; this setup is used for clearing the state.
692 * See r300_ioctl.c:r300EmitClearState. I'm not sure if this setup is strictly
693 * correct or not. - Oliver.
694 */
607# define R300_RS_ROUTE_0_COLOR (1 << 14) 695# define R300_RS_ROUTE_0_COLOR (1 << 14)
608# define R300_RS_ROUTE_0_COLOR_DEST_SHIFT 17 696# define R300_RS_ROUTE_0_COLOR_DEST_SHIFT 17
609# define R300_RS_ROUTE_0_COLOR_DEST_MASK (31 << 17) /* GUESS */ 697# define R300_RS_ROUTE_0_COLOR_DEST_MASK (31 << 17) /* GUESS */
610/* As above, but for secondary color */ 698/* As above, but for secondary color */
611# define R300_RS_ROUTE_1_COLOR1 (1 << 14) 699# define R300_RS_ROUTE_1_COLOR1 (1 << 14)
612# define R300_RS_ROUTE_1_COLOR1_DEST_SHIFT 17 700# define R300_RS_ROUTE_1_COLOR1_DEST_SHIFT 17
613# define R300_RS_ROUTE_1_COLOR1_DEST_MASK (31 << 17) 701# define R300_RS_ROUTE_1_COLOR1_DEST_MASK (31 << 17)
614# define R300_RS_ROUTE_1_UNKNOWN11 (1 << 11) 702# define R300_RS_ROUTE_1_UNKNOWN11 (1 << 11)
615/* END */ 703/* END: Rasterization / Interpolators - many guesses */
616 704
617/* BEGIN: Scissors and cliprects 705/* BEGIN: Scissors and cliprects */
618// There are four clipping rectangles. Their corner coordinates are inclusive. 706
619// Every pixel is assigned a number from 0 and 15 by setting bits 0-3 depending 707/* There are four clipping rectangles. Their corner coordinates are inclusive.
620// on whether the pixel is inside cliprects 0-3, respectively. For example, 708 * Every pixel is assigned a number from 0 and 15 by setting bits 0-3 depending
621// if a pixel is inside cliprects 0 and 1, but outside 2 and 3, it is assigned 709 * on whether the pixel is inside cliprects 0-3, respectively. For example,
622// the number 3 (binary 0011). 710 * if a pixel is inside cliprects 0 and 1, but outside 2 and 3, it is assigned
623// Iff the bit corresponding to the pixel's number in RE_CLIPRECT_CNTL is set, 711 * the number 3 (binary 0011).
624// the pixel is rasterized. 712 * Iff the bit corresponding to the pixel's number in RE_CLIPRECT_CNTL is set,
625// 713 * the pixel is rasterized.
626// In addition to this, there is a scissors rectangle. Only pixels inside the 714 *
627// scissors rectangle are drawn. (coordinates are inclusive) 715 * In addition to this, there is a scissors rectangle. Only pixels inside the
628// 716 * scissors rectangle are drawn. (coordinates are inclusive)
629// For some reason, the top-left corner of the framebuffer is at (1440, 1440) 717 *
630// for the purpose of clipping and scissors. */ 718 * For some reason, the top-left corner of the framebuffer is at (1440, 1440)
719 * for the purpose of clipping and scissors.
720 */
631#define R300_RE_CLIPRECT_TL_0 0x43B0 721#define R300_RE_CLIPRECT_TL_0 0x43B0
632#define R300_RE_CLIPRECT_BR_0 0x43B4 722#define R300_RE_CLIPRECT_BR_0 0x43B4
633#define R300_RE_CLIPRECT_TL_1 0x43B8 723#define R300_RE_CLIPRECT_TL_1 0x43B8
@@ -661,6 +751,7 @@ I am fairly certain that they are correct unless stated otherwise in comments.
661# define R300_CLIP_3210 (1 << 15) 751# define R300_CLIP_3210 (1 << 15)
662 752
663/* gap */ 753/* gap */
754
664#define R300_RE_SCISSORS_TL 0x43E0 755#define R300_RE_SCISSORS_TL 0x43E0
665#define R300_RE_SCISSORS_BR 0x43E4 756#define R300_RE_SCISSORS_BR 0x43E4
666# define R300_SCISSORS_OFFSET 1440 757# define R300_SCISSORS_OFFSET 1440
@@ -668,12 +759,15 @@ I am fairly certain that they are correct unless stated otherwise in comments.
668# define R300_SCISSORS_X_MASK (0x1FFF << 0) 759# define R300_SCISSORS_X_MASK (0x1FFF << 0)
669# define R300_SCISSORS_Y_SHIFT 13 760# define R300_SCISSORS_Y_SHIFT 13
670# define R300_SCISSORS_Y_MASK (0x1FFF << 13) 761# define R300_SCISSORS_Y_MASK (0x1FFF << 13)
671/* END */ 762/* END: Scissors and cliprects */
672 763
673/* BEGIN: Texture specification 764/* BEGIN: Texture specification */
674// The texture specification dwords are grouped by meaning and not by texture unit. 765
675// This means that e.g. the offset for texture image unit N is found in register 766/*
676// TX_OFFSET_0 + (4*N) */ 767 * The texture specification dwords are grouped by meaning and not by texture
768 * unit. This means that e.g. the offset for texture image unit N is found in
769 * register TX_OFFSET_0 + (4*N)
770 */
677#define R300_TX_FILTER_0 0x4400 771#define R300_TX_FILTER_0 0x4400
678# define R300_TX_REPEAT 0 772# define R300_TX_REPEAT 0
679# define R300_TX_MIRRORED 1 773# define R300_TX_MIRRORED 1
@@ -697,13 +791,14 @@ I am fairly certain that they are correct unless stated otherwise in comments.
697# define R300_TX_MIN_FILTER_LINEAR_MIP_LINEAR (10 << 11) 791# define R300_TX_MIN_FILTER_LINEAR_MIP_LINEAR (10 << 11)
698 792
699/* NOTE: NEAREST doesnt seem to exist. 793/* NOTE: NEAREST doesnt seem to exist.
700 Im not seting MAG_FILTER_MASK and (3 << 11) on for all 794 * Im not seting MAG_FILTER_MASK and (3 << 11) on for all
701 anisotropy modes because that would void selected mag filter */ 795 * anisotropy modes because that would void selected mag filter
702# define R300_TX_MIN_FILTER_ANISO_NEAREST ((0 << 13) /*|R300_TX_MAG_FILTER_MASK|(3<<11)*/) 796 */
703# define R300_TX_MIN_FILTER_ANISO_LINEAR ((0 << 13) /*|R300_TX_MAG_FILTER_MASK|(3<<11)*/) 797# define R300_TX_MIN_FILTER_ANISO_NEAREST (0 << 13)
704# define R300_TX_MIN_FILTER_ANISO_NEAREST_MIP_NEAREST ((1 << 13) /*|R300_TX_MAG_FILTER_MASK|(3<<11)*/) 798# define R300_TX_MIN_FILTER_ANISO_LINEAR (0 << 13)
705# define R300_TX_MIN_FILTER_ANISO_NEAREST_MIP_LINEAR ((2 << 13) /*|R300_TX_MAG_FILTER_MASK|(3<<11)*/) 799# define R300_TX_MIN_FILTER_ANISO_NEAREST_MIP_NEAREST (1 << 13)
706# define R300_TX_MIN_FILTER_MASK ( (15 << 11) | (3 << 13) ) 800# define R300_TX_MIN_FILTER_ANISO_NEAREST_MIP_LINEAR (2 << 13)
801# define R300_TX_MIN_FILTER_MASK ( (15 << 11) | (3 << 13) )
707# define R300_TX_MAX_ANISO_1_TO_1 (0 << 21) 802# define R300_TX_MAX_ANISO_1_TO_1 (0 << 21)
708# define R300_TX_MAX_ANISO_2_TO_1 (2 << 21) 803# define R300_TX_MAX_ANISO_2_TO_1 (2 << 21)
709# define R300_TX_MAX_ANISO_4_TO_1 (4 << 21) 804# define R300_TX_MAX_ANISO_4_TO_1 (4 << 21)
@@ -734,10 +829,10 @@ I am fairly certain that they are correct unless stated otherwise in comments.
734# define R300_TX_HEIGHTMASK_SHIFT 11 829# define R300_TX_HEIGHTMASK_SHIFT 11
735# define R300_TX_HEIGHTMASK_MASK (2047 << 11) 830# define R300_TX_HEIGHTMASK_MASK (2047 << 11)
736# define R300_TX_UNK23 (1 << 23) 831# define R300_TX_UNK23 (1 << 23)
737# define R300_TX_SIZE_SHIFT 26 /* largest of width, height */ 832# define R300_TX_MAX_MIP_LEVEL_SHIFT 26
738# define R300_TX_SIZE_MASK (15 << 26) 833# define R300_TX_MAX_MIP_LEVEL_MASK (0xf << 26)
739# define R300_TX_SIZE_PROJECTED (1<<30) 834# define R300_TX_SIZE_PROJECTED (1<<30)
740# define R300_TX_SIZE_TXPITCH_EN (1<<31) 835# define R300_TX_SIZE_TXPITCH_EN (1<<31)
741#define R300_TX_FORMAT_0 0x44C0 836#define R300_TX_FORMAT_0 0x44C0
742 /* The interpretation of the format word by Wladimir van der Laan */ 837 /* The interpretation of the format word by Wladimir van der Laan */
743 /* The X, Y, Z and W refer to the layout of the components. 838 /* The X, Y, Z and W refer to the layout of the components.
@@ -761,11 +856,11 @@ I am fairly certain that they are correct unless stated otherwise in comments.
761# define R300_TX_FORMAT_DXT1 0xF 856# define R300_TX_FORMAT_DXT1 0xF
762# define R300_TX_FORMAT_DXT3 0x10 857# define R300_TX_FORMAT_DXT3 0x10
763# define R300_TX_FORMAT_DXT5 0x11 858# define R300_TX_FORMAT_DXT5 0x11
764# define R300_TX_FORMAT_D3DMFT_CxV8U8 0x12 /* no swizzle */ 859# define R300_TX_FORMAT_D3DMFT_CxV8U8 0x12 /* no swizzle */
765# define R300_TX_FORMAT_A8R8G8B8 0x13 /* no swizzle */ 860# define R300_TX_FORMAT_A8R8G8B8 0x13 /* no swizzle */
766# define R300_TX_FORMAT_B8G8_B8G8 0x14 /* no swizzle */ 861# define R300_TX_FORMAT_B8G8_B8G8 0x14 /* no swizzle */
767# define R300_TX_FORMAT_G8R8_G8B8 0x15 /* no swizzle */ 862# define R300_TX_FORMAT_G8R8_G8B8 0x15 /* no swizzle */
768 /* 0x16 - some 16 bit green format.. ?? */ 863 /* 0x16 - some 16 bit green format.. ?? */
769# define R300_TX_FORMAT_UNK25 (1 << 25) /* no swizzle */ 864# define R300_TX_FORMAT_UNK25 (1 << 25) /* no swizzle */
770# define R300_TX_FORMAT_CUBIC_MAP (1 << 26) 865# define R300_TX_FORMAT_CUBIC_MAP (1 << 26)
771 866
@@ -793,23 +888,26 @@ I am fairly certain that they are correct unless stated otherwise in comments.
793# define R300_TX_FORMAT_W 3 888# define R300_TX_FORMAT_W 3
794# define R300_TX_FORMAT_ZERO 4 889# define R300_TX_FORMAT_ZERO 4
795# define R300_TX_FORMAT_ONE 5 890# define R300_TX_FORMAT_ONE 5
796# define R300_TX_FORMAT_CUT_Z 6 /* 2.0*Z, everything above 1.0 is set to 0.0 */ 891 /* 2.0*Z, everything above 1.0 is set to 0.0 */
797# define R300_TX_FORMAT_CUT_W 7 /* 2.0*W, everything above 1.0 is set to 0.0 */ 892# define R300_TX_FORMAT_CUT_Z 6
893 /* 2.0*W, everything above 1.0 is set to 0.0 */
894# define R300_TX_FORMAT_CUT_W 7
798 895
799# define R300_TX_FORMAT_B_SHIFT 18 896# define R300_TX_FORMAT_B_SHIFT 18
800# define R300_TX_FORMAT_G_SHIFT 15 897# define R300_TX_FORMAT_G_SHIFT 15
801# define R300_TX_FORMAT_R_SHIFT 12 898# define R300_TX_FORMAT_R_SHIFT 12
802# define R300_TX_FORMAT_A_SHIFT 9 899# define R300_TX_FORMAT_A_SHIFT 9
803 /* Convenience macro to take care of layout and swizzling */ 900 /* Convenience macro to take care of layout and swizzling */
804# define R300_EASY_TX_FORMAT(B, G, R, A, FMT) (\ 901# define R300_EASY_TX_FORMAT(B, G, R, A, FMT) ( \
805 ((R300_TX_FORMAT_##B)<<R300_TX_FORMAT_B_SHIFT) \ 902 ((R300_TX_FORMAT_##B)<<R300_TX_FORMAT_B_SHIFT) \
806 | ((R300_TX_FORMAT_##G)<<R300_TX_FORMAT_G_SHIFT) \ 903 | ((R300_TX_FORMAT_##G)<<R300_TX_FORMAT_G_SHIFT) \
807 | ((R300_TX_FORMAT_##R)<<R300_TX_FORMAT_R_SHIFT) \ 904 | ((R300_TX_FORMAT_##R)<<R300_TX_FORMAT_R_SHIFT) \
808 | ((R300_TX_FORMAT_##A)<<R300_TX_FORMAT_A_SHIFT) \ 905 | ((R300_TX_FORMAT_##A)<<R300_TX_FORMAT_A_SHIFT) \
809 | (R300_TX_FORMAT_##FMT) \ 906 | (R300_TX_FORMAT_##FMT) \
810 ) 907 )
811 /* These can be ORed with result of R300_EASY_TX_FORMAT() */ 908 /* These can be ORed with result of R300_EASY_TX_FORMAT()
812 /* We don't really know what they do. Take values from a constant color ? */ 909 We don't really know what they do. Take values from a
910 constant color ? */
813# define R300_TX_FORMAT_CONST_X (1<<5) 911# define R300_TX_FORMAT_CONST_X (1<<5)
814# define R300_TX_FORMAT_CONST_Y (2<<5) 912# define R300_TX_FORMAT_CONST_Y (2<<5)
815# define R300_TX_FORMAT_CONST_Z (4<<5) 913# define R300_TX_FORMAT_CONST_Z (4<<5)
@@ -819,7 +917,7 @@ I am fairly certain that they are correct unless stated otherwise in comments.
819 917
820#define R300_TX_PITCH_0 0x4500 /* obvious missing in gap */ 918#define R300_TX_PITCH_0 0x4500 /* obvious missing in gap */
821#define R300_TX_OFFSET_0 0x4540 919#define R300_TX_OFFSET_0 0x4540
822/* BEGIN: Guess from R200 */ 920 /* BEGIN: Guess from R200 */
823# define R300_TXO_ENDIAN_NO_SWAP (0 << 0) 921# define R300_TXO_ENDIAN_NO_SWAP (0 << 0)
824# define R300_TXO_ENDIAN_BYTE_SWAP (1 << 0) 922# define R300_TXO_ENDIAN_BYTE_SWAP (1 << 0)
825# define R300_TXO_ENDIAN_WORD_SWAP (2 << 0) 923# define R300_TXO_ENDIAN_WORD_SWAP (2 << 0)
@@ -828,53 +926,61 @@ I am fairly certain that they are correct unless stated otherwise in comments.
828# define R300_TXO_MICRO_TILE (1 << 3) 926# define R300_TXO_MICRO_TILE (1 << 3)
829# define R300_TXO_OFFSET_MASK 0xffffffe0 927# define R300_TXO_OFFSET_MASK 0xffffffe0
830# define R300_TXO_OFFSET_SHIFT 5 928# define R300_TXO_OFFSET_SHIFT 5
831/* END */ 929 /* END: Guess from R200 */
832#define R300_TX_CHROMA_KEY_0 0x4580 /* 32 bit chroma key */ 930
833#define R300_TX_BORDER_COLOR_0 0x45C0 //ff00ff00 == { 0, 1.0, 0, 1.0 } 931/* 32 bit chroma key */
834 932#define R300_TX_CHROMA_KEY_0 0x4580
835/* END */ 933/* ff00ff00 == { 0, 1.0, 0, 1.0 } */
836 934#define R300_TX_BORDER_COLOR_0 0x45C0
837/* BEGIN: Fragment program instruction set 935
838// Fragment programs are written directly into register space. 936/* END: Texture specification */
839// There are separate instruction streams for texture instructions and ALU 937
840// instructions. 938/* BEGIN: Fragment program instruction set */
841// In order to synchronize these streams, the program is divided into up 939
842// to 4 nodes. Each node begins with a number of TEX operations, followed 940/* Fragment programs are written directly into register space.
843// by a number of ALU operations. 941 * There are separate instruction streams for texture instructions and ALU
844// The first node can have zero TEX ops, all subsequent nodes must have at least 942 * instructions.
845// one TEX ops. 943 * In order to synchronize these streams, the program is divided into up
846// All nodes must have at least one ALU op. 944 * to 4 nodes. Each node begins with a number of TEX operations, followed
847// 945 * by a number of ALU operations.
848// The index of the last node is stored in PFS_CNTL_0: A value of 0 means 946 * The first node can have zero TEX ops, all subsequent nodes must have at
849// 1 node, a value of 3 means 4 nodes. 947 * least
850// The total amount of instructions is defined in PFS_CNTL_2. The offsets are 948 * one TEX ops.
851// offsets into the respective instruction streams, while *_END points to the 949 * All nodes must have at least one ALU op.
852// last instruction relative to this offset. */ 950 *
951 * The index of the last node is stored in PFS_CNTL_0: A value of 0 means
952 * 1 node, a value of 3 means 4 nodes.
953 * The total amount of instructions is defined in PFS_CNTL_2. The offsets are
954 * offsets into the respective instruction streams, while *_END points to the
955 * last instruction relative to this offset.
956 */
853#define R300_PFS_CNTL_0 0x4600 957#define R300_PFS_CNTL_0 0x4600
854# define R300_PFS_CNTL_LAST_NODES_SHIFT 0 958# define R300_PFS_CNTL_LAST_NODES_SHIFT 0
855# define R300_PFS_CNTL_LAST_NODES_MASK (3 << 0) 959# define R300_PFS_CNTL_LAST_NODES_MASK (3 << 0)
856# define R300_PFS_CNTL_FIRST_NODE_HAS_TEX (1 << 3) 960# define R300_PFS_CNTL_FIRST_NODE_HAS_TEX (1 << 3)
857#define R300_PFS_CNTL_1 0x4604 961#define R300_PFS_CNTL_1 0x4604
858/* There is an unshifted value here which has so far always been equal to the 962/* There is an unshifted value here which has so far always been equal to the
859// index of the highest used temporary register. */ 963 * index of the highest used temporary register.
964 */
860#define R300_PFS_CNTL_2 0x4608 965#define R300_PFS_CNTL_2 0x4608
861# define R300_PFS_CNTL_ALU_OFFSET_SHIFT 0 966# define R300_PFS_CNTL_ALU_OFFSET_SHIFT 0
862# define R300_PFS_CNTL_ALU_OFFSET_MASK (63 << 0) 967# define R300_PFS_CNTL_ALU_OFFSET_MASK (63 << 0)
863# define R300_PFS_CNTL_ALU_END_SHIFT 6 968# define R300_PFS_CNTL_ALU_END_SHIFT 6
864# define R300_PFS_CNTL_ALU_END_MASK (63 << 0) 969# define R300_PFS_CNTL_ALU_END_MASK (63 << 6)
865# define R300_PFS_CNTL_TEX_OFFSET_SHIFT 12 970# define R300_PFS_CNTL_TEX_OFFSET_SHIFT 12
866# define R300_PFS_CNTL_TEX_OFFSET_MASK (31 << 12) /* GUESS */ 971# define R300_PFS_CNTL_TEX_OFFSET_MASK (31 << 12) /* GUESS */
867# define R300_PFS_CNTL_TEX_END_SHIFT 18 972# define R300_PFS_CNTL_TEX_END_SHIFT 18
868# define R300_PFS_CNTL_TEX_END_MASK (31 << 18) /* GUESS */ 973# define R300_PFS_CNTL_TEX_END_MASK (31 << 18) /* GUESS */
869 974
870/* gap */ 975/* gap */
976
871/* Nodes are stored backwards. The last active node is always stored in 977/* Nodes are stored backwards. The last active node is always stored in
872// PFS_NODE_3. 978 * PFS_NODE_3.
873// Example: In a 2-node program, NODE_0 and NODE_1 are set to 0. The 979 * Example: In a 2-node program, NODE_0 and NODE_1 are set to 0. The
874// first node is stored in NODE_2, the second node is stored in NODE_3. 980 * first node is stored in NODE_2, the second node is stored in NODE_3.
875// 981 *
876// Offsets are relative to the master offset from PFS_CNTL_2. 982 * Offsets are relative to the master offset from PFS_CNTL_2.
877// LAST_NODE is set for the last node, and only for the last node. */ 983 */
878#define R300_PFS_NODE_0 0x4610 984#define R300_PFS_NODE_0 0x4610
879#define R300_PFS_NODE_1 0x4614 985#define R300_PFS_NODE_1 0x4614
880#define R300_PFS_NODE_2 0x4618 986#define R300_PFS_NODE_2 0x4618
@@ -887,91 +993,98 @@ I am fairly certain that they are correct unless stated otherwise in comments.
887# define R300_PFS_NODE_TEX_OFFSET_MASK (31 << 12) 993# define R300_PFS_NODE_TEX_OFFSET_MASK (31 << 12)
888# define R300_PFS_NODE_TEX_END_SHIFT 17 994# define R300_PFS_NODE_TEX_END_SHIFT 17
889# define R300_PFS_NODE_TEX_END_MASK (31 << 17) 995# define R300_PFS_NODE_TEX_END_MASK (31 << 17)
890/*# define R300_PFS_NODE_LAST_NODE (1 << 22) */
891# define R300_PFS_NODE_OUTPUT_COLOR (1 << 22) 996# define R300_PFS_NODE_OUTPUT_COLOR (1 << 22)
892# define R300_PFS_NODE_OUTPUT_DEPTH (1 << 23) 997# define R300_PFS_NODE_OUTPUT_DEPTH (1 << 23)
893 998
894/* TEX 999/* TEX
895// As far as I can tell, texture instructions cannot write into output 1000 * As far as I can tell, texture instructions cannot write into output
896// registers directly. A subsequent ALU instruction is always necessary, 1001 * registers directly. A subsequent ALU instruction is always necessary,
897// even if it's just MAD o0, r0, 1, 0 */ 1002 * even if it's just MAD o0, r0, 1, 0
1003 */
898#define R300_PFS_TEXI_0 0x4620 1004#define R300_PFS_TEXI_0 0x4620
899# define R300_FPITX_SRC_SHIFT 0 1005# define R300_FPITX_SRC_SHIFT 0
900# define R300_FPITX_SRC_MASK (31 << 0) 1006# define R300_FPITX_SRC_MASK (31 << 0)
901# define R300_FPITX_SRC_CONST (1 << 5) /* GUESS */ 1007 /* GUESS */
902# define R300_FPITX_DST_SHIFT 6 1008# define R300_FPITX_SRC_CONST (1 << 5)
903# define R300_FPITX_DST_MASK (31 << 6) 1009# define R300_FPITX_DST_SHIFT 6
904# define R300_FPITX_IMAGE_SHIFT 11 1010# define R300_FPITX_DST_MASK (31 << 6)
905# define R300_FPITX_IMAGE_MASK (15 << 11) /* GUESS based on layout and native limits */ 1011# define R300_FPITX_IMAGE_SHIFT 11
1012 /* GUESS based on layout and native limits */
1013# define R300_FPITX_IMAGE_MASK (15 << 11)
906/* Unsure if these are opcodes, or some kind of bitfield, but this is how 1014/* Unsure if these are opcodes, or some kind of bitfield, but this is how
907 * they were set when I checked 1015 * they were set when I checked
908 */ 1016 */
909# define R300_FPITX_OPCODE_SHIFT 15 1017# define R300_FPITX_OPCODE_SHIFT 15
910# define R300_FPITX_OP_TEX 1 1018# define R300_FPITX_OP_TEX 1
911# define R300_FPITX_OP_KIL 2 1019# define R300_FPITX_OP_KIL 2
912# define R300_FPITX_OP_TXP 3 1020# define R300_FPITX_OP_TXP 3
913# define R300_FPITX_OP_TXB 4 1021# define R300_FPITX_OP_TXB 4
1022# define R300_FPITX_OPCODE_MASK (7 << 15)
914 1023
915/* ALU 1024/* ALU
916// The ALU instructions register blocks are enumerated according to the order 1025 * The ALU instructions register blocks are enumerated according to the order
917// in which fglrx. I assume there is space for 64 instructions, since 1026 * in which fglrx. I assume there is space for 64 instructions, since
918// each block has space for a maximum of 64 DWORDs, and this matches reported 1027 * each block has space for a maximum of 64 DWORDs, and this matches reported
919// native limits. 1028 * native limits.
920// 1029 *
921// The basic functional block seems to be one MAD for each color and alpha, 1030 * The basic functional block seems to be one MAD for each color and alpha,
922// and an adder that adds all components after the MUL. 1031 * and an adder that adds all components after the MUL.
923// - ADD, MUL, MAD etc.: use MAD with appropriate neutral operands 1032 * - ADD, MUL, MAD etc.: use MAD with appropriate neutral operands
924// - DP4: Use OUTC_DP4, OUTA_DP4 1033 * - DP4: Use OUTC_DP4, OUTA_DP4
925// - DP3: Use OUTC_DP3, OUTA_DP4, appropriate alpha operands 1034 * - DP3: Use OUTC_DP3, OUTA_DP4, appropriate alpha operands
926// - DPH: Use OUTC_DP4, OUTA_DP4, appropriate alpha operands 1035 * - DPH: Use OUTC_DP4, OUTA_DP4, appropriate alpha operands
927// - CMP: If ARG2 < 0, return ARG1, else return ARG0 1036 * - CMPH: If ARG2 > 0.5, return ARG0, else return ARG1
928// - FLR: use FRC+MAD 1037 * - CMP: If ARG2 < 0, return ARG1, else return ARG0
929// - XPD: use MAD+MAD 1038 * - FLR: use FRC+MAD
930// - SGE, SLT: use MAD+CMP 1039 * - XPD: use MAD+MAD
931// - RSQ: use ABS modifier for argument 1040 * - SGE, SLT: use MAD+CMP
932// - Use OUTC_REPL_ALPHA to write results of an alpha-only operation (e.g. RCP) 1041 * - RSQ: use ABS modifier for argument
933// into color register 1042 * - Use OUTC_REPL_ALPHA to write results of an alpha-only operation
934// - apparently, there's no quick DST operation 1043 * (e.g. RCP) into color register
935// - fglrx set FPI2_UNKNOWN_31 on a "MAD fragment.color, tmp0, tmp1, tmp2" 1044 * - apparently, there's no quick DST operation
936// - fglrx set FPI2_UNKNOWN_31 on a "MAX r2, r1, c0" 1045 * - fglrx set FPI2_UNKNOWN_31 on a "MAD fragment.color, tmp0, tmp1, tmp2"
937// - fglrx once set FPI0_UNKNOWN_31 on a "FRC r1, r1" 1046 * - fglrx set FPI2_UNKNOWN_31 on a "MAX r2, r1, c0"
938// 1047 * - fglrx once set FPI0_UNKNOWN_31 on a "FRC r1, r1"
939// Operand selection 1048 *
940// First stage selects three sources from the available registers and 1049 * Operand selection
941// constant parameters. This is defined in INSTR1 (color) and INSTR3 (alpha). 1050 * First stage selects three sources from the available registers and
942// fglrx sorts the three source fields: Registers before constants, 1051 * constant parameters. This is defined in INSTR1 (color) and INSTR3 (alpha).
943// lower indices before higher indices; I do not know whether this is necessary. 1052 * fglrx sorts the three source fields: Registers before constants,
944// fglrx fills unused sources with "read constant 0" 1053 * lower indices before higher indices; I do not know whether this is
945// According to specs, you cannot select more than two different constants. 1054 * necessary.
946// 1055 *
947// Second stage selects the operands from the sources. This is defined in 1056 * fglrx fills unused sources with "read constant 0"
948// INSTR0 (color) and INSTR2 (alpha). You can also select the special constants 1057 * According to specs, you cannot select more than two different constants.
949// zero and one. 1058 *
950// Swizzling and negation happens in this stage, as well. 1059 * Second stage selects the operands from the sources. This is defined in
951// 1060 * INSTR0 (color) and INSTR2 (alpha). You can also select the special constants
952// Important: Color and alpha seem to be mostly separate, i.e. their sources 1061 * zero and one.
953// selection appears to be fully independent (the register storage is probably 1062 * Swizzling and negation happens in this stage, as well.
954// physically split into a color and an alpha section). 1063 *
955// However (because of the apparent physical split), there is some interaction 1064 * Important: Color and alpha seem to be mostly separate, i.e. their sources
956// WRT swizzling. If, for example, you want to load an R component into an 1065 * selection appears to be fully independent (the register storage is probably
957// Alpha operand, this R component is taken from a *color* source, not from 1066 * physically split into a color and an alpha section).
958// an alpha source. The corresponding register doesn't even have to appear in 1067 * However (because of the apparent physical split), there is some interaction
959// the alpha sources list. (I hope this alll makes sense to you) 1068 * WRT swizzling. If, for example, you want to load an R component into an
960// 1069 * Alpha operand, this R component is taken from a *color* source, not from
961// Destination selection 1070 * an alpha source. The corresponding register doesn't even have to appear in
962// The destination register index is in FPI1 (color) and FPI3 (alpha) together 1071 * the alpha sources list. (I hope this all makes sense to you)
963// with enable bits. 1072 *
964// There are separate enable bits for writing into temporary registers 1073 * Destination selection
965// (DSTC_REG_* /DSTA_REG) and and program output registers (DSTC_OUTPUT_* /DSTA_OUTPUT). 1074 * The destination register index is in FPI1 (color) and FPI3 (alpha)
966// You can write to both at once, or not write at all (the same index 1075 * together with enable bits.
967// must be used for both). 1076 * There are separate enable bits for writing into temporary registers
968// 1077 * (DSTC_REG_* /DSTA_REG) and and program output registers (DSTC_OUTPUT_*
969// Note: There is a special form for LRP 1078 * /DSTA_OUTPUT). You can write to both at once, or not write at all (the
970// - Argument order is the same as in ARB_fragment_program. 1079 * same index must be used for both).
971// - Operation is MAD 1080 *
972// - ARG1 is set to ARGC_SRC1C_LRP/ARGC_SRC1A_LRP 1081 * Note: There is a special form for LRP
973// - Set FPI0/FPI2_SPECIAL_LRP 1082 * - Argument order is the same as in ARB_fragment_program.
974// Arbitrary LRP (including support for swizzling) requires vanilla MAD+MAD */ 1083 * - Operation is MAD
1084 * - ARG1 is set to ARGC_SRC1C_LRP/ARGC_SRC1A_LRP
1085 * - Set FPI0/FPI2_SPECIAL_LRP
1086 * Arbitrary LRP (including support for swizzling) requires vanilla MAD+MAD
1087 */
975#define R300_PFS_INSTR1_0 0x46C0 1088#define R300_PFS_INSTR1_0 0x46C0
976# define R300_FPI1_SRC0C_SHIFT 0 1089# define R300_FPI1_SRC0C_SHIFT 0
977# define R300_FPI1_SRC0C_MASK (31 << 0) 1090# define R300_FPI1_SRC0C_MASK (31 << 0)
@@ -982,6 +1095,7 @@ I am fairly certain that they are correct unless stated otherwise in comments.
982# define R300_FPI1_SRC2C_SHIFT 12 1095# define R300_FPI1_SRC2C_SHIFT 12
983# define R300_FPI1_SRC2C_MASK (31 << 12) 1096# define R300_FPI1_SRC2C_MASK (31 << 12)
984# define R300_FPI1_SRC2C_CONST (1 << 17) 1097# define R300_FPI1_SRC2C_CONST (1 << 17)
1098# define R300_FPI1_SRC_MASK 0x0003ffff
985# define R300_FPI1_DSTC_SHIFT 18 1099# define R300_FPI1_DSTC_SHIFT 18
986# define R300_FPI1_DSTC_MASK (31 << 18) 1100# define R300_FPI1_DSTC_MASK (31 << 18)
987# define R300_FPI1_DSTC_REG_MASK_SHIFT 23 1101# define R300_FPI1_DSTC_REG_MASK_SHIFT 23
@@ -1003,6 +1117,7 @@ I am fairly certain that they are correct unless stated otherwise in comments.
1003# define R300_FPI3_SRC2A_SHIFT 12 1117# define R300_FPI3_SRC2A_SHIFT 12
1004# define R300_FPI3_SRC2A_MASK (31 << 12) 1118# define R300_FPI3_SRC2A_MASK (31 << 12)
1005# define R300_FPI3_SRC2A_CONST (1 << 17) 1119# define R300_FPI3_SRC2A_CONST (1 << 17)
1120# define R300_FPI3_SRC_MASK 0x0003ffff
1006# define R300_FPI3_DSTA_SHIFT 18 1121# define R300_FPI3_DSTA_SHIFT 18
1007# define R300_FPI3_DSTA_MASK (31 << 18) 1122# define R300_FPI3_DSTA_MASK (31 << 18)
1008# define R300_FPI3_DSTA_REG (1 << 23) 1123# define R300_FPI3_DSTA_REG (1 << 23)
@@ -1028,7 +1143,8 @@ I am fairly certain that they are correct unless stated otherwise in comments.
1028# define R300_FPI0_ARGC_SRC1C_LRP 15 1143# define R300_FPI0_ARGC_SRC1C_LRP 15
1029# define R300_FPI0_ARGC_ZERO 20 1144# define R300_FPI0_ARGC_ZERO 20
1030# define R300_FPI0_ARGC_ONE 21 1145# define R300_FPI0_ARGC_ONE 21
1031# define R300_FPI0_ARGC_HALF 22 /* GUESS */ 1146 /* GUESS */
1147# define R300_FPI0_ARGC_HALF 22
1032# define R300_FPI0_ARGC_SRC0C_YZX 23 1148# define R300_FPI0_ARGC_SRC0C_YZX 23
1033# define R300_FPI0_ARGC_SRC1C_YZX 24 1149# define R300_FPI0_ARGC_SRC1C_YZX 24
1034# define R300_FPI0_ARGC_SRC2C_YZX 25 1150# define R300_FPI0_ARGC_SRC2C_YZX 25
@@ -1057,6 +1173,7 @@ I am fairly certain that they are correct unless stated otherwise in comments.
1057# define R300_FPI0_OUTC_DP4 (2 << 23) 1173# define R300_FPI0_OUTC_DP4 (2 << 23)
1058# define R300_FPI0_OUTC_MIN (4 << 23) 1174# define R300_FPI0_OUTC_MIN (4 << 23)
1059# define R300_FPI0_OUTC_MAX (5 << 23) 1175# define R300_FPI0_OUTC_MAX (5 << 23)
1176# define R300_FPI0_OUTC_CMPH (7 << 23)
1060# define R300_FPI0_OUTC_CMP (8 << 23) 1177# define R300_FPI0_OUTC_CMP (8 << 23)
1061# define R300_FPI0_OUTC_FRC (9 << 23) 1178# define R300_FPI0_OUTC_FRC (9 << 23)
1062# define R300_FPI0_OUTC_REPL_ALPHA (10 << 23) 1179# define R300_FPI0_OUTC_REPL_ALPHA (10 << 23)
@@ -1079,20 +1196,23 @@ I am fairly certain that they are correct unless stated otherwise in comments.
1079# define R300_FPI2_ARGA_SRC1A_LRP 15 1196# define R300_FPI2_ARGA_SRC1A_LRP 15
1080# define R300_FPI2_ARGA_ZERO 16 1197# define R300_FPI2_ARGA_ZERO 16
1081# define R300_FPI2_ARGA_ONE 17 1198# define R300_FPI2_ARGA_ONE 17
1082# define R300_FPI2_ARGA_HALF 18 /* GUESS */ 1199 /* GUESS */
1083 1200# define R300_FPI2_ARGA_HALF 18
1084# define R300_FPI2_ARG0A_SHIFT 0 1201# define R300_FPI2_ARG0A_SHIFT 0
1085# define R300_FPI2_ARG0A_MASK (31 << 0) 1202# define R300_FPI2_ARG0A_MASK (31 << 0)
1086# define R300_FPI2_ARG0A_NEG (1 << 5) 1203# define R300_FPI2_ARG0A_NEG (1 << 5)
1087# define R300_FPI2_ARG0A_ABS (1 << 6) /* GUESS */ 1204 /* GUESS */
1205# define R300_FPI2_ARG0A_ABS (1 << 6)
1088# define R300_FPI2_ARG1A_SHIFT 7 1206# define R300_FPI2_ARG1A_SHIFT 7
1089# define R300_FPI2_ARG1A_MASK (31 << 7) 1207# define R300_FPI2_ARG1A_MASK (31 << 7)
1090# define R300_FPI2_ARG1A_NEG (1 << 12) 1208# define R300_FPI2_ARG1A_NEG (1 << 12)
1091# define R300_FPI2_ARG1A_ABS (1 << 13) /* GUESS */ 1209 /* GUESS */
1210# define R300_FPI2_ARG1A_ABS (1 << 13)
1092# define R300_FPI2_ARG2A_SHIFT 14 1211# define R300_FPI2_ARG2A_SHIFT 14
1093# define R300_FPI2_ARG2A_MASK (31 << 14) 1212# define R300_FPI2_ARG2A_MASK (31 << 14)
1094# define R300_FPI2_ARG2A_NEG (1 << 19) 1213# define R300_FPI2_ARG2A_NEG (1 << 19)
1095# define R300_FPI2_ARG2A_ABS (1 << 20) /* GUESS */ 1214 /* GUESS */
1215# define R300_FPI2_ARG2A_ABS (1 << 20)
1096# define R300_FPI2_SPECIAL_LRP (1 << 21) 1216# define R300_FPI2_SPECIAL_LRP (1 << 21)
1097# define R300_FPI2_OUTA_MAD (0 << 23) 1217# define R300_FPI2_OUTA_MAD (0 << 23)
1098# define R300_FPI2_OUTA_DP4 (1 << 23) 1218# define R300_FPI2_OUTA_DP4 (1 << 23)
@@ -1106,9 +1226,19 @@ I am fairly certain that they are correct unless stated otherwise in comments.
1106# define R300_FPI2_OUTA_RSQ (11 << 23) 1226# define R300_FPI2_OUTA_RSQ (11 << 23)
1107# define R300_FPI2_OUTA_SAT (1 << 30) 1227# define R300_FPI2_OUTA_SAT (1 << 30)
1108# define R300_FPI2_UNKNOWN_31 (1 << 31) 1228# define R300_FPI2_UNKNOWN_31 (1 << 31)
1109/* END */ 1229/* END: Fragment program instruction set */
1230
1231/* Fog state and color */
1232#define R300_RE_FOG_STATE 0x4BC0
1233# define R300_FOG_ENABLE (1 << 0)
1234# define R300_FOG_MODE_LINEAR (0 << 1)
1235# define R300_FOG_MODE_EXP (1 << 1)
1236# define R300_FOG_MODE_EXP2 (2 << 1)
1237# define R300_FOG_MODE_MASK (3 << 1)
1238#define R300_FOG_COLOR_R 0x4BC8
1239#define R300_FOG_COLOR_G 0x4BCC
1240#define R300_FOG_COLOR_B 0x4BD0
1110 1241
1111/* gap */
1112#define R300_PP_ALPHA_TEST 0x4BD4 1242#define R300_PP_ALPHA_TEST 0x4BD4
1113# define R300_REF_ALPHA_MASK 0x000000ff 1243# define R300_REF_ALPHA_MASK 0x000000ff
1114# define R300_ALPHA_TEST_FAIL (0 << 8) 1244# define R300_ALPHA_TEST_FAIL (0 << 8)
@@ -1123,6 +1253,7 @@ I am fairly certain that they are correct unless stated otherwise in comments.
1123# define R300_ALPHA_TEST_ENABLE (1 << 11) 1253# define R300_ALPHA_TEST_ENABLE (1 << 11)
1124 1254
1125/* gap */ 1255/* gap */
1256
1126/* Fragment program parameters in 7.16 floating point */ 1257/* Fragment program parameters in 7.16 floating point */
1127#define R300_PFS_PARAM_0_X 0x4C00 1258#define R300_PFS_PARAM_0_X 0x4C00
1128#define R300_PFS_PARAM_0_Y 0x4C04 1259#define R300_PFS_PARAM_0_Y 0x4C04
@@ -1135,45 +1266,48 @@ I am fairly certain that they are correct unless stated otherwise in comments.
1135#define R300_PFS_PARAM_31_W 0x4DFC 1266#define R300_PFS_PARAM_31_W 0x4DFC
1136 1267
1137/* Notes: 1268/* Notes:
1138// - AFAIK fglrx always sets BLEND_UNKNOWN when blending is used in the application 1269 * - AFAIK fglrx always sets BLEND_UNKNOWN when blending is used in
1139// - AFAIK fglrx always sets BLEND_NO_SEPARATE when CBLEND and ABLEND are set to the same 1270 * the application
1140// function (both registers are always set up completely in any case) 1271 * - AFAIK fglrx always sets BLEND_NO_SEPARATE when CBLEND and ABLEND
1141// - Most blend flags are simply copied from R200 and not tested yet */ 1272 * are set to the same
1273 * function (both registers are always set up completely in any case)
1274 * - Most blend flags are simply copied from R200 and not tested yet
1275 */
1142#define R300_RB3D_CBLEND 0x4E04 1276#define R300_RB3D_CBLEND 0x4E04
1143#define R300_RB3D_ABLEND 0x4E08 1277#define R300_RB3D_ABLEND 0x4E08
1144 /* the following only appear in CBLEND */ 1278/* the following only appear in CBLEND */
1145# define R300_BLEND_ENABLE (1 << 0) 1279# define R300_BLEND_ENABLE (1 << 0)
1146# define R300_BLEND_UNKNOWN (3 << 1) 1280# define R300_BLEND_UNKNOWN (3 << 1)
1147# define R300_BLEND_NO_SEPARATE (1 << 3) 1281# define R300_BLEND_NO_SEPARATE (1 << 3)
1148 /* the following are shared between CBLEND and ABLEND */ 1282/* the following are shared between CBLEND and ABLEND */
1149# define R300_FCN_MASK (3 << 12) 1283# define R300_FCN_MASK (3 << 12)
1150# define R300_COMB_FCN_ADD_CLAMP (0 << 12) 1284# define R300_COMB_FCN_ADD_CLAMP (0 << 12)
1151# define R300_COMB_FCN_ADD_NOCLAMP (1 << 12) 1285# define R300_COMB_FCN_ADD_NOCLAMP (1 << 12)
1152# define R300_COMB_FCN_SUB_CLAMP (2 << 12) 1286# define R300_COMB_FCN_SUB_CLAMP (2 << 12)
1153# define R300_COMB_FCN_SUB_NOCLAMP (3 << 12) 1287# define R300_COMB_FCN_SUB_NOCLAMP (3 << 12)
1154# define R300_SRC_BLEND_GL_ZERO (32 << 16) 1288# define R300_COMB_FCN_MIN (4 << 12)
1155# define R300_SRC_BLEND_GL_ONE (33 << 16) 1289# define R300_COMB_FCN_MAX (5 << 12)
1156# define R300_SRC_BLEND_GL_SRC_COLOR (34 << 16) 1290# define R300_COMB_FCN_RSUB_CLAMP (6 << 12)
1157# define R300_SRC_BLEND_GL_ONE_MINUS_SRC_COLOR (35 << 16) 1291# define R300_COMB_FCN_RSUB_NOCLAMP (7 << 12)
1158# define R300_SRC_BLEND_GL_DST_COLOR (36 << 16) 1292# define R300_BLEND_GL_ZERO (32)
1159# define R300_SRC_BLEND_GL_ONE_MINUS_DST_COLOR (37 << 16) 1293# define R300_BLEND_GL_ONE (33)
1160# define R300_SRC_BLEND_GL_SRC_ALPHA (38 << 16) 1294# define R300_BLEND_GL_SRC_COLOR (34)
1161# define R300_SRC_BLEND_GL_ONE_MINUS_SRC_ALPHA (39 << 16) 1295# define R300_BLEND_GL_ONE_MINUS_SRC_COLOR (35)
1162# define R300_SRC_BLEND_GL_DST_ALPHA (40 << 16) 1296# define R300_BLEND_GL_DST_COLOR (36)
1163# define R300_SRC_BLEND_GL_ONE_MINUS_DST_ALPHA (41 << 16) 1297# define R300_BLEND_GL_ONE_MINUS_DST_COLOR (37)
1164# define R300_SRC_BLEND_GL_SRC_ALPHA_SATURATE (42 << 16) 1298# define R300_BLEND_GL_SRC_ALPHA (38)
1165# define R300_SRC_BLEND_MASK (63 << 16) 1299# define R300_BLEND_GL_ONE_MINUS_SRC_ALPHA (39)
1166# define R300_DST_BLEND_GL_ZERO (32 << 24) 1300# define R300_BLEND_GL_DST_ALPHA (40)
1167# define R300_DST_BLEND_GL_ONE (33 << 24) 1301# define R300_BLEND_GL_ONE_MINUS_DST_ALPHA (41)
1168# define R300_DST_BLEND_GL_SRC_COLOR (34 << 24) 1302# define R300_BLEND_GL_SRC_ALPHA_SATURATE (42)
1169# define R300_DST_BLEND_GL_ONE_MINUS_SRC_COLOR (35 << 24) 1303# define R300_BLEND_GL_CONST_COLOR (43)
1170# define R300_DST_BLEND_GL_DST_COLOR (36 << 24) 1304# define R300_BLEND_GL_ONE_MINUS_CONST_COLOR (44)
1171# define R300_DST_BLEND_GL_ONE_MINUS_DST_COLOR (37 << 24) 1305# define R300_BLEND_GL_CONST_ALPHA (45)
1172# define R300_DST_BLEND_GL_SRC_ALPHA (38 << 24) 1306# define R300_BLEND_GL_ONE_MINUS_CONST_ALPHA (46)
1173# define R300_DST_BLEND_GL_ONE_MINUS_SRC_ALPHA (39 << 24) 1307# define R300_BLEND_MASK (63)
1174# define R300_DST_BLEND_GL_DST_ALPHA (40 << 24) 1308# define R300_SRC_BLEND_SHIFT (16)
1175# define R300_DST_BLEND_GL_ONE_MINUS_DST_ALPHA (41 << 24) 1309# define R300_DST_BLEND_SHIFT (24)
1176# define R300_DST_BLEND_MASK (63 << 24) 1310#define R300_RB3D_BLEND_COLOR 0x4E10
1177#define R300_RB3D_COLORMASK 0x4E0C 1311#define R300_RB3D_COLORMASK 0x4E0C
1178# define R300_COLORMASK0_B (1<<0) 1312# define R300_COLORMASK0_B (1<<0)
1179# define R300_COLORMASK0_G (1<<1) 1313# define R300_COLORMASK0_G (1<<1)
@@ -1181,41 +1315,49 @@ I am fairly certain that they are correct unless stated otherwise in comments.
1181# define R300_COLORMASK0_A (1<<3) 1315# define R300_COLORMASK0_A (1<<3)
1182 1316
1183/* gap */ 1317/* gap */
1318
1184#define R300_RB3D_COLOROFFSET0 0x4E28 1319#define R300_RB3D_COLOROFFSET0 0x4E28
1185# define R300_COLOROFFSET_MASK 0xFFFFFFF0 /* GUESS */ 1320# define R300_COLOROFFSET_MASK 0xFFFFFFF0 /* GUESS */
1186#define R300_RB3D_COLOROFFSET1 0x4E2C /* GUESS */ 1321#define R300_RB3D_COLOROFFSET1 0x4E2C /* GUESS */
1187#define R300_RB3D_COLOROFFSET2 0x4E30 /* GUESS */ 1322#define R300_RB3D_COLOROFFSET2 0x4E30 /* GUESS */
1188#define R300_RB3D_COLOROFFSET3 0x4E34 /* GUESS */ 1323#define R300_RB3D_COLOROFFSET3 0x4E34 /* GUESS */
1324
1189/* gap */ 1325/* gap */
1326
1190/* Bit 16: Larger tiles 1327/* Bit 16: Larger tiles
1191// Bit 17: 4x2 tiles 1328 * Bit 17: 4x2 tiles
1192// Bit 18: Extremely weird tile like, but some pixels duplicated? */ 1329 * Bit 18: Extremely weird tile like, but some pixels duplicated?
1330 */
1193#define R300_RB3D_COLORPITCH0 0x4E38 1331#define R300_RB3D_COLORPITCH0 0x4E38
1194# define R300_COLORPITCH_MASK 0x00001FF8 /* GUESS */ 1332# define R300_COLORPITCH_MASK 0x00001FF8 /* GUESS */
1195# define R300_COLOR_TILE_ENABLE (1 << 16) /* GUESS */ 1333# define R300_COLOR_TILE_ENABLE (1 << 16) /* GUESS */
1196# define R300_COLOR_MICROTILE_ENABLE (1 << 17) /* GUESS */ 1334# define R300_COLOR_MICROTILE_ENABLE (1 << 17) /* GUESS */
1197# define R300_COLOR_ENDIAN_NO_SWAP (0 << 18) /* GUESS */ 1335# define R300_COLOR_ENDIAN_NO_SWAP (0 << 18) /* GUESS */
1198# define R300_COLOR_ENDIAN_WORD_SWAP (1 << 18) /* GUESS */ 1336# define R300_COLOR_ENDIAN_WORD_SWAP (1 << 18) /* GUESS */
1199# define R300_COLOR_ENDIAN_DWORD_SWAP (2 << 18) /* GUESS */ 1337# define R300_COLOR_ENDIAN_DWORD_SWAP (2 << 18) /* GUESS */
1200# define R300_COLOR_FORMAT_RGB565 (2 << 22) 1338# define R300_COLOR_FORMAT_RGB565 (2 << 22)
1201# define R300_COLOR_FORMAT_ARGB8888 (3 << 22) 1339# define R300_COLOR_FORMAT_ARGB8888 (3 << 22)
1202#define R300_RB3D_COLORPITCH1 0x4E3C /* GUESS */ 1340#define R300_RB3D_COLORPITCH1 0x4E3C /* GUESS */
1203#define R300_RB3D_COLORPITCH2 0x4E40 /* GUESS */ 1341#define R300_RB3D_COLORPITCH2 0x4E40 /* GUESS */
1204#define R300_RB3D_COLORPITCH3 0x4E44 /* GUESS */ 1342#define R300_RB3D_COLORPITCH3 0x4E44 /* GUESS */
1205 1343
1206/* gap */ 1344/* gap */
1345
1207/* Guess by Vladimir. 1346/* Guess by Vladimir.
1208// Set to 0A before 3D operations, set to 02 afterwards. */ 1347 * Set to 0A before 3D operations, set to 02 afterwards.
1348 */
1209#define R300_RB3D_DSTCACHE_CTLSTAT 0x4E4C 1349#define R300_RB3D_DSTCACHE_CTLSTAT 0x4E4C
1210# define R300_RB3D_DSTCACHE_02 0x00000002 1350# define R300_RB3D_DSTCACHE_UNKNOWN_02 0x00000002
1211# define R300_RB3D_DSTCACHE_0A 0x0000000A 1351# define R300_RB3D_DSTCACHE_UNKNOWN_0A 0x0000000A
1212 1352
1213/* gap */ 1353/* gap */
1214/* There seems to be no "write only" setting, so use Z-test = ALWAYS for this. */ 1354/* There seems to be no "write only" setting, so use Z-test = ALWAYS
1215/* Bit (1<<8) is the "test" bit. so plain write is 6 - vd */ 1355 * for this.
1356 * Bit (1<<8) is the "test" bit. so plain write is 6 - vd
1357 */
1216#define R300_RB3D_ZSTENCIL_CNTL_0 0x4F00 1358#define R300_RB3D_ZSTENCIL_CNTL_0 0x4F00
1217# define R300_RB3D_Z_DISABLED_1 0x00000010 /* GUESS */ 1359# define R300_RB3D_Z_DISABLED_1 0x00000010
1218# define R300_RB3D_Z_DISABLED_2 0x00000014 /* GUESS */ 1360# define R300_RB3D_Z_DISABLED_2 0x00000014
1219# define R300_RB3D_Z_TEST 0x00000012 1361# define R300_RB3D_Z_TEST 0x00000012
1220# define R300_RB3D_Z_TEST_AND_WRITE 0x00000016 1362# define R300_RB3D_Z_TEST_AND_WRITE 0x00000016
1221# define R300_RB3D_Z_WRITE_ONLY 0x00000006 1363# define R300_RB3D_Z_WRITE_ONLY 0x00000006
@@ -1226,7 +1368,7 @@ I am fairly certain that they are correct unless stated otherwise in comments.
1226# define R300_RB3D_STENCIL_ENABLE 0x00000001 1368# define R300_RB3D_STENCIL_ENABLE 0x00000001
1227 1369
1228#define R300_RB3D_ZSTENCIL_CNTL_1 0x4F04 1370#define R300_RB3D_ZSTENCIL_CNTL_1 0x4F04
1229 /* functions */ 1371 /* functions */
1230# define R300_ZS_NEVER 0 1372# define R300_ZS_NEVER 0
1231# define R300_ZS_LESS 1 1373# define R300_ZS_LESS 1
1232# define R300_ZS_LEQUAL 2 1374# define R300_ZS_LEQUAL 2
@@ -1236,7 +1378,7 @@ I am fairly certain that they are correct unless stated otherwise in comments.
1236# define R300_ZS_NOTEQUAL 6 1378# define R300_ZS_NOTEQUAL 6
1237# define R300_ZS_ALWAYS 7 1379# define R300_ZS_ALWAYS 7
1238# define R300_ZS_MASK 7 1380# define R300_ZS_MASK 7
1239 /* operations */ 1381 /* operations */
1240# define R300_ZS_KEEP 0 1382# define R300_ZS_KEEP 0
1241# define R300_ZS_ZERO 1 1383# define R300_ZS_ZERO 1
1242# define R300_ZS_REPLACE 2 1384# define R300_ZS_REPLACE 2
@@ -1245,9 +1387,8 @@ I am fairly certain that they are correct unless stated otherwise in comments.
1245# define R300_ZS_INVERT 5 1387# define R300_ZS_INVERT 5
1246# define R300_ZS_INCR_WRAP 6 1388# define R300_ZS_INCR_WRAP 6
1247# define R300_ZS_DECR_WRAP 7 1389# define R300_ZS_DECR_WRAP 7
1248 1390 /* front and back refer to operations done for front
1249 /* front and back refer to operations done for front 1391 and back faces, i.e. separate stencil function support */
1250 and back faces, i.e. separate stencil function support */
1251# define R300_RB3D_ZS1_DEPTH_FUNC_SHIFT 0 1392# define R300_RB3D_ZS1_DEPTH_FUNC_SHIFT 0
1252# define R300_RB3D_ZS1_FRONT_FUNC_SHIFT 3 1393# define R300_RB3D_ZS1_FRONT_FUNC_SHIFT 3
1253# define R300_RB3D_ZS1_FRONT_FAIL_OP_SHIFT 6 1394# define R300_RB3D_ZS1_FRONT_FAIL_OP_SHIFT 6
@@ -1269,45 +1410,64 @@ I am fairly certain that they are correct unless stated otherwise in comments.
1269#define R300_RB3D_ZSTENCIL_FORMAT 0x4F10 1410#define R300_RB3D_ZSTENCIL_FORMAT 0x4F10
1270# define R300_DEPTH_FORMAT_16BIT_INT_Z (0 << 0) 1411# define R300_DEPTH_FORMAT_16BIT_INT_Z (0 << 0)
1271# define R300_DEPTH_FORMAT_24BIT_INT_Z (2 << 0) 1412# define R300_DEPTH_FORMAT_24BIT_INT_Z (2 << 0)
1413 /* 16 bit format or some aditional bit ? */
1414# define R300_DEPTH_FORMAT_UNK32 (32 << 0)
1415
1416#define R300_RB3D_EARLY_Z 0x4F14
1417# define R300_EARLY_Z_DISABLE (0 << 0)
1418# define R300_EARLY_Z_ENABLE (1 << 0)
1419
1420/* gap */
1421
1422#define R300_RB3D_ZCACHE_CTLSTAT 0x4F18 /* GUESS */
1423# define R300_RB3D_ZCACHE_UNKNOWN_01 0x1
1424# define R300_RB3D_ZCACHE_UNKNOWN_03 0x3
1272 1425
1273/* gap */ 1426/* gap */
1427
1274#define R300_RB3D_DEPTHOFFSET 0x4F20 1428#define R300_RB3D_DEPTHOFFSET 0x4F20
1275#define R300_RB3D_DEPTHPITCH 0x4F24 1429#define R300_RB3D_DEPTHPITCH 0x4F24
1276# define R300_DEPTHPITCH_MASK 0x00001FF8 /* GUESS */ 1430# define R300_DEPTHPITCH_MASK 0x00001FF8 /* GUESS */
1277# define R300_DEPTH_TILE_ENABLE (1 << 16) /* GUESS */ 1431# define R300_DEPTH_TILE_ENABLE (1 << 16) /* GUESS */
1278# define R300_DEPTH_MICROTILE_ENABLE (1 << 17) /* GUESS */ 1432# define R300_DEPTH_MICROTILE_ENABLE (1 << 17) /* GUESS */
1279# define R300_DEPTH_ENDIAN_NO_SWAP (0 << 18) /* GUESS */ 1433# define R300_DEPTH_ENDIAN_NO_SWAP (0 << 18) /* GUESS */
1280# define R300_DEPTH_ENDIAN_WORD_SWAP (1 << 18) /* GUESS */ 1434# define R300_DEPTH_ENDIAN_WORD_SWAP (1 << 18) /* GUESS */
1281# define R300_DEPTH_ENDIAN_DWORD_SWAP (2 << 18) /* GUESS */ 1435# define R300_DEPTH_ENDIAN_DWORD_SWAP (2 << 18) /* GUESS */
1282 1436
1283/* BEGIN: Vertex program instruction set 1437/* BEGIN: Vertex program instruction set */
1284// Every instruction is four dwords long: 1438
1285// DWORD 0: output and opcode 1439/* Every instruction is four dwords long:
1286// DWORD 1: first argument 1440 * DWORD 0: output and opcode
1287// DWORD 2: second argument 1441 * DWORD 1: first argument
1288// DWORD 3: third argument 1442 * DWORD 2: second argument
1289// 1443 * DWORD 3: third argument
1290// Notes: 1444 *
1291// - ABS r, a is implemented as MAX r, a, -a 1445 * Notes:
1292// - MOV is implemented as ADD to zero 1446 * - ABS r, a is implemented as MAX r, a, -a
1293// - XPD is implemented as MUL + MAD 1447 * - MOV is implemented as ADD to zero
1294// - FLR is implemented as FRC + ADD 1448 * - XPD is implemented as MUL + MAD
1295// - apparently, fglrx tries to schedule instructions so that there is at least 1449 * - FLR is implemented as FRC + ADD
1296// one instruction between the write to a temporary and the first read 1450 * - apparently, fglrx tries to schedule instructions so that there is at
1297// from said temporary; however, violations of this scheduling are allowed 1451 * least one instruction between the write to a temporary and the first
1298// - register indices seem to be unrelated with OpenGL aliasing to conventional state 1452 * read from said temporary; however, violations of this scheduling are
1299// - only one attribute and one parameter can be loaded at a time; however, the 1453 * allowed
1300// same attribute/parameter can be used for more than one argument 1454 * - register indices seem to be unrelated with OpenGL aliasing to
1301// - the second software argument for POW is the third hardware argument (no idea why) 1455 * conventional state
1302// - MAD with only temporaries as input seems to use VPI_OUT_SELECT_MAD_2 1456 * - only one attribute and one parameter can be loaded at a time; however,
1303// 1457 * the same attribute/parameter can be used for more than one argument
1304// There is some magic surrounding LIT: 1458 * - the second software argument for POW is the third hardware argument
1305// The single argument is replicated across all three inputs, but swizzled: 1459 * (no idea why)
1306// First argument: xyzy 1460 * - MAD with only temporaries as input seems to use VPI_OUT_SELECT_MAD_2
1307// Second argument: xyzx 1461 *
1308// Third argument: xyzw 1462 * There is some magic surrounding LIT:
1309// Whenever the result is used later in the fragment program, fglrx forces x and w 1463 * The single argument is replicated across all three inputs, but swizzled:
1310// to be 1.0 in the input selection; I don't know whether this is strictly necessary */ 1464 * First argument: xyzy
1465 * Second argument: xyzx
1466 * Third argument: xyzw
1467 * Whenever the result is used later in the fragment program, fglrx forces
1468 * x and w to be 1.0 in the input selection; I don't know whether this is
1469 * strictly necessary
1470 */
1311#define R300_VPI_OUT_OP_DOT (1 << 0) 1471#define R300_VPI_OUT_OP_DOT (1 << 0)
1312#define R300_VPI_OUT_OP_MUL (2 << 0) 1472#define R300_VPI_OUT_OP_MUL (2 << 0)
1313#define R300_VPI_OUT_OP_ADD (3 << 0) 1473#define R300_VPI_OUT_OP_ADD (3 << 0)
@@ -1318,26 +1478,33 @@ I am fairly certain that they are correct unless stated otherwise in comments.
1318#define R300_VPI_OUT_OP_MIN (8 << 0) 1478#define R300_VPI_OUT_OP_MIN (8 << 0)
1319#define R300_VPI_OUT_OP_SGE (9 << 0) 1479#define R300_VPI_OUT_OP_SGE (9 << 0)
1320#define R300_VPI_OUT_OP_SLT (10 << 0) 1480#define R300_VPI_OUT_OP_SLT (10 << 0)
1321#define R300_VPI_OUT_OP_UNK12 (12 << 0) /* Used in GL_POINT_DISTANCE_ATTENUATION_ARB, vector(scalar, vector) */ 1481 /* Used in GL_POINT_DISTANCE_ATTENUATION_ARB, vector(scalar, vector) */
1482#define R300_VPI_OUT_OP_UNK12 (12 << 0)
1483#define R300_VPI_OUT_OP_ARL (13 << 0)
1322#define R300_VPI_OUT_OP_EXP (65 << 0) 1484#define R300_VPI_OUT_OP_EXP (65 << 0)
1323#define R300_VPI_OUT_OP_LOG (66 << 0) 1485#define R300_VPI_OUT_OP_LOG (66 << 0)
1324#define R300_VPI_OUT_OP_UNK67 (67 << 0) /* Used in fog computations, scalar(scalar) */ 1486 /* Used in fog computations, scalar(scalar) */
1487#define R300_VPI_OUT_OP_UNK67 (67 << 0)
1325#define R300_VPI_OUT_OP_LIT (68 << 0) 1488#define R300_VPI_OUT_OP_LIT (68 << 0)
1326#define R300_VPI_OUT_OP_POW (69 << 0) 1489#define R300_VPI_OUT_OP_POW (69 << 0)
1327#define R300_VPI_OUT_OP_RCP (70 << 0) 1490#define R300_VPI_OUT_OP_RCP (70 << 0)
1328#define R300_VPI_OUT_OP_RSQ (72 << 0) 1491#define R300_VPI_OUT_OP_RSQ (72 << 0)
1329#define R300_VPI_OUT_OP_UNK73 (73 << 0) /* Used in GL_POINT_DISTANCE_ATTENUATION_ARB, scalar(scalar) */ 1492 /* Used in GL_POINT_DISTANCE_ATTENUATION_ARB, scalar(scalar) */
1493#define R300_VPI_OUT_OP_UNK73 (73 << 0)
1330#define R300_VPI_OUT_OP_EX2 (75 << 0) 1494#define R300_VPI_OUT_OP_EX2 (75 << 0)
1331#define R300_VPI_OUT_OP_LG2 (76 << 0) 1495#define R300_VPI_OUT_OP_LG2 (76 << 0)
1332#define R300_VPI_OUT_OP_MAD_2 (128 << 0) 1496#define R300_VPI_OUT_OP_MAD_2 (128 << 0)
1333#define R300_VPI_OUT_OP_UNK129 (129 << 0) /* all temps, vector(scalar, vector, vector) */ 1497 /* all temps, vector(scalar, vector, vector) */
1498#define R300_VPI_OUT_OP_UNK129 (129 << 0)
1334 1499
1335#define R300_VPI_OUT_REG_CLASS_TEMPORARY (0 << 8) 1500#define R300_VPI_OUT_REG_CLASS_TEMPORARY (0 << 8)
1501#define R300_VPI_OUT_REG_CLASS_ADDR (1 << 8)
1336#define R300_VPI_OUT_REG_CLASS_RESULT (2 << 8) 1502#define R300_VPI_OUT_REG_CLASS_RESULT (2 << 8)
1337#define R300_VPI_OUT_REG_CLASS_MASK (31 << 8) 1503#define R300_VPI_OUT_REG_CLASS_MASK (31 << 8)
1338 1504
1339#define R300_VPI_OUT_REG_INDEX_SHIFT 13 1505#define R300_VPI_OUT_REG_INDEX_SHIFT 13
1340#define R300_VPI_OUT_REG_INDEX_MASK (31 << 13) /* GUESS based on fglrx native limits */ 1506 /* GUESS based on fglrx native limits */
1507#define R300_VPI_OUT_REG_INDEX_MASK (31 << 13)
1341 1508
1342#define R300_VPI_OUT_WRITE_X (1 << 20) 1509#define R300_VPI_OUT_WRITE_X (1 << 20)
1343#define R300_VPI_OUT_WRITE_Y (1 << 21) 1510#define R300_VPI_OUT_WRITE_Y (1 << 21)
@@ -1348,14 +1515,16 @@ I am fairly certain that they are correct unless stated otherwise in comments.
1348#define R300_VPI_IN_REG_CLASS_ATTRIBUTE (1 << 0) 1515#define R300_VPI_IN_REG_CLASS_ATTRIBUTE (1 << 0)
1349#define R300_VPI_IN_REG_CLASS_PARAMETER (2 << 0) 1516#define R300_VPI_IN_REG_CLASS_PARAMETER (2 << 0)
1350#define R300_VPI_IN_REG_CLASS_NONE (9 << 0) 1517#define R300_VPI_IN_REG_CLASS_NONE (9 << 0)
1351#define R300_VPI_IN_REG_CLASS_MASK (31 << 0) /* GUESS */ 1518#define R300_VPI_IN_REG_CLASS_MASK (31 << 0)
1352 1519
1353#define R300_VPI_IN_REG_INDEX_SHIFT 5 1520#define R300_VPI_IN_REG_INDEX_SHIFT 5
1354#define R300_VPI_IN_REG_INDEX_MASK (255 << 5) /* GUESS based on fglrx native limits */ 1521 /* GUESS based on fglrx native limits */
1522#define R300_VPI_IN_REG_INDEX_MASK (255 << 5)
1355 1523
1356/* The R300 can select components from the input register arbitrarily. 1524/* The R300 can select components from the input register arbitrarily.
1357// Use the following constants, shifted by the component shift you 1525 * Use the following constants, shifted by the component shift you
1358// want to select */ 1526 * want to select
1527 */
1359#define R300_VPI_IN_SELECT_X 0 1528#define R300_VPI_IN_SELECT_X 0
1360#define R300_VPI_IN_SELECT_Y 1 1529#define R300_VPI_IN_SELECT_Y 1
1361#define R300_VPI_IN_SELECT_Z 2 1530#define R300_VPI_IN_SELECT_Z 2
@@ -1373,11 +1542,11 @@ I am fairly certain that they are correct unless stated otherwise in comments.
1373#define R300_VPI_IN_NEG_Y (1 << 26) 1542#define R300_VPI_IN_NEG_Y (1 << 26)
1374#define R300_VPI_IN_NEG_Z (1 << 27) 1543#define R300_VPI_IN_NEG_Z (1 << 27)
1375#define R300_VPI_IN_NEG_W (1 << 28) 1544#define R300_VPI_IN_NEG_W (1 << 28)
1376/* END */ 1545/* END: Vertex program instruction set */
1377 1546
1378//BEGIN: Packet 3 commands 1547/* BEGIN: Packet 3 commands */
1379 1548
1380// A primitive emission dword. 1549/* A primitive emission dword. */
1381#define R300_PRIM_TYPE_NONE (0 << 0) 1550#define R300_PRIM_TYPE_NONE (0 << 0)
1382#define R300_PRIM_TYPE_POINT (1 << 0) 1551#define R300_PRIM_TYPE_POINT (1 << 0)
1383#define R300_PRIM_TYPE_LINE (2 << 0) 1552#define R300_PRIM_TYPE_LINE (2 << 0)
@@ -1389,7 +1558,8 @@ I am fairly certain that they are correct unless stated otherwise in comments.
1389#define R300_PRIM_TYPE_RECT_LIST (8 << 0) 1558#define R300_PRIM_TYPE_RECT_LIST (8 << 0)
1390#define R300_PRIM_TYPE_3VRT_POINT_LIST (9 << 0) 1559#define R300_PRIM_TYPE_3VRT_POINT_LIST (9 << 0)
1391#define R300_PRIM_TYPE_3VRT_LINE_LIST (10 << 0) 1560#define R300_PRIM_TYPE_3VRT_LINE_LIST (10 << 0)
1392#define R300_PRIM_TYPE_POINT_SPRITES (11 << 0) // GUESS (based on r200) 1561 /* GUESS (based on r200) */
1562#define R300_PRIM_TYPE_POINT_SPRITES (11 << 0)
1393#define R300_PRIM_TYPE_LINE_LOOP (12 << 0) 1563#define R300_PRIM_TYPE_LINE_LOOP (12 << 0)
1394#define R300_PRIM_TYPE_QUADS (13 << 0) 1564#define R300_PRIM_TYPE_QUADS (13 << 0)
1395#define R300_PRIM_TYPE_QUAD_STRIP (14 << 0) 1565#define R300_PRIM_TYPE_QUAD_STRIP (14 << 0)
@@ -1399,37 +1569,58 @@ I am fairly certain that they are correct unless stated otherwise in comments.
1399#define R300_PRIM_WALK_LIST (2 << 4) 1569#define R300_PRIM_WALK_LIST (2 << 4)
1400#define R300_PRIM_WALK_RING (3 << 4) 1570#define R300_PRIM_WALK_RING (3 << 4)
1401#define R300_PRIM_WALK_MASK (3 << 4) 1571#define R300_PRIM_WALK_MASK (3 << 4)
1402#define R300_PRIM_COLOR_ORDER_BGRA (0 << 6) // GUESS (based on r200) 1572 /* GUESS (based on r200) */
1403#define R300_PRIM_COLOR_ORDER_RGBA (1 << 6) // GUESS 1573#define R300_PRIM_COLOR_ORDER_BGRA (0 << 6)
1574#define R300_PRIM_COLOR_ORDER_RGBA (1 << 6)
1404#define R300_PRIM_NUM_VERTICES_SHIFT 16 1575#define R300_PRIM_NUM_VERTICES_SHIFT 16
1576#define R300_PRIM_NUM_VERTICES_MASK 0xffff
1405 1577
1406// Draw a primitive from vertex data in arrays loaded via 3D_LOAD_VBPNTR. 1578/* Draw a primitive from vertex data in arrays loaded via 3D_LOAD_VBPNTR.
1407// Two parameter dwords: 1579 * Two parameter dwords:
1408// 0. The first parameter appears to be always 0 1580 * 0. The first parameter appears to be always 0
1409// 1. The second parameter is a standard primitive emission dword. 1581 * 1. The second parameter is a standard primitive emission dword.
1582 */
1410#define R300_PACKET3_3D_DRAW_VBUF 0x00002800 1583#define R300_PACKET3_3D_DRAW_VBUF 0x00002800
1411 1584
1412// Specify the full set of vertex arrays as (address, stride). 1585/* Specify the full set of vertex arrays as (address, stride).
1413// The first parameter is the number of vertex arrays specified. 1586 * The first parameter is the number of vertex arrays specified.
1414// The rest of the command is a variable length list of blocks, where 1587 * The rest of the command is a variable length list of blocks, where
1415// each block is three dwords long and specifies two arrays. 1588 * each block is three dwords long and specifies two arrays.
1416// The first dword of a block is split into two words, the lower significant 1589 * The first dword of a block is split into two words, the lower significant
1417// word refers to the first array, the more significant word to the second 1590 * word refers to the first array, the more significant word to the second
1418// array in the block. 1591 * array in the block.
1419// The low byte of each word contains the size of an array entry in dwords, 1592 * The low byte of each word contains the size of an array entry in dwords,
1420// the high byte contains the stride of the array. 1593 * the high byte contains the stride of the array.
1421// The second dword of a block contains the pointer to the first array, 1594 * The second dword of a block contains the pointer to the first array,
1422// the third dword of a block contains the pointer to the second array. 1595 * the third dword of a block contains the pointer to the second array.
1423// Note that if the total number of arrays is odd, the third dword of 1596 * Note that if the total number of arrays is odd, the third dword of
1424// the last block is omitted. 1597 * the last block is omitted.
1598 */
1425#define R300_PACKET3_3D_LOAD_VBPNTR 0x00002F00 1599#define R300_PACKET3_3D_LOAD_VBPNTR 0x00002F00
1426 1600
1427#define R300_PACKET3_INDX_BUFFER 0x00003300 1601#define R300_PACKET3_INDX_BUFFER 0x00003300
1428# define R300_EB_UNK1_SHIFT 24 1602# define R300_EB_UNK1_SHIFT 24
1429# define R300_EB_UNK1 (0x80<<24) 1603# define R300_EB_UNK1 (0x80<<24)
1430# define R300_EB_UNK2 0x0810 1604# define R300_EB_UNK2 0x0810
1605#define R300_PACKET3_3D_DRAW_VBUF_2 0x00003400
1431#define R300_PACKET3_3D_DRAW_INDX_2 0x00003600 1606#define R300_PACKET3_3D_DRAW_INDX_2 0x00003600
1432 1607
1433//END 1608/* END: Packet 3 commands */
1609
1610
1611/* Color formats for 2d packets
1612 */
1613#define R300_CP_COLOR_FORMAT_CI8 2
1614#define R300_CP_COLOR_FORMAT_ARGB1555 3
1615#define R300_CP_COLOR_FORMAT_RGB565 4
1616#define R300_CP_COLOR_FORMAT_ARGB8888 6
1617#define R300_CP_COLOR_FORMAT_RGB332 7
1618#define R300_CP_COLOR_FORMAT_RGB8 9
1619#define R300_CP_COLOR_FORMAT_ARGB4444 15
1620
1621/*
1622 * CP type-3 packets
1623 */
1624#define R300_CP_CMD_BITBLT_MULTI 0xC0009B00
1434 1625
1435#endif /* _R300_REG_H */ 1626#endif /* _R300_REG_H */
diff --git a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c
index 68338389d836..af5790f8fd53 100644
--- a/drivers/char/drm/radeon_cp.c
+++ b/drivers/char/drm/radeon_cp.c
@@ -36,7 +36,7 @@
36 36
37#define RADEON_FIFO_DEBUG 0 37#define RADEON_FIFO_DEBUG 0
38 38
39static int radeon_do_cleanup_cp(drm_device_t * dev); 39static int radeon_do_cleanup_cp(struct drm_device * dev);
40 40
41/* CP microcode (from ATI) */ 41/* CP microcode (from ATI) */
42static const u32 R200_cp_microcode[][2] = { 42static const u32 R200_cp_microcode[][2] = {
@@ -816,7 +816,7 @@ static const u32 R300_cp_microcode[][2] = {
816 {0000000000, 0000000000}, 816 {0000000000, 0000000000},
817}; 817};
818 818
819static int RADEON_READ_PLL(drm_device_t * dev, int addr) 819static int RADEON_READ_PLL(struct drm_device * dev, int addr)
820{ 820{
821 drm_radeon_private_t *dev_priv = dev->dev_private; 821 drm_radeon_private_t *dev_priv = dev->dev_private;
822 822
@@ -1066,7 +1066,7 @@ static void radeon_do_cp_stop(drm_radeon_private_t * dev_priv)
1066 1066
1067/* Reset the engine. This will stop the CP if it is running. 1067/* Reset the engine. This will stop the CP if it is running.
1068 */ 1068 */
1069static int radeon_do_engine_reset(drm_device_t * dev) 1069static int radeon_do_engine_reset(struct drm_device * dev)
1070{ 1070{
1071 drm_radeon_private_t *dev_priv = dev->dev_private; 1071 drm_radeon_private_t *dev_priv = dev->dev_private;
1072 u32 clock_cntl_index, mclk_cntl, rbbm_soft_reset; 1072 u32 clock_cntl_index, mclk_cntl, rbbm_soft_reset;
@@ -1122,7 +1122,7 @@ static int radeon_do_engine_reset(drm_device_t * dev)
1122 return 0; 1122 return 0;
1123} 1123}
1124 1124
1125static void radeon_cp_init_ring_buffer(drm_device_t * dev, 1125static void radeon_cp_init_ring_buffer(struct drm_device * dev,
1126 drm_radeon_private_t * dev_priv) 1126 drm_radeon_private_t * dev_priv)
1127{ 1127{
1128 u32 ring_start, cur_read_ptr; 1128 u32 ring_start, cur_read_ptr;
@@ -1174,7 +1174,7 @@ static void radeon_cp_init_ring_buffer(drm_device_t * dev,
1174 } else 1174 } else
1175#endif 1175#endif
1176 { 1176 {
1177 drm_sg_mem_t *entry = dev->sg; 1177 struct drm_sg_mem *entry = dev->sg;
1178 unsigned long tmp_ofs, page_ofs; 1178 unsigned long tmp_ofs, page_ofs;
1179 1179
1180 tmp_ofs = dev_priv->ring_rptr->offset - 1180 tmp_ofs = dev_priv->ring_rptr->offset -
@@ -1384,7 +1384,7 @@ static void radeon_set_pcigart(drm_radeon_private_t * dev_priv, int on)
1384 } 1384 }
1385} 1385}
1386 1386
1387static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init) 1387static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
1388{ 1388{
1389 drm_radeon_private_t *dev_priv = dev->dev_private; 1389 drm_radeon_private_t *dev_priv = dev->dev_private;
1390 1390
@@ -1420,6 +1420,10 @@ static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init)
1420 return DRM_ERR(EINVAL); 1420 return DRM_ERR(EINVAL);
1421 } 1421 }
1422 1422
1423 /* Enable vblank on CRTC1 for older X servers
1424 */
1425 dev_priv->vblank_crtc = DRM_RADEON_VBLANK_CRTC1;
1426
1423 switch(init->func) { 1427 switch(init->func) {
1424 case RADEON_INIT_R200_CP: 1428 case RADEON_INIT_R200_CP:
1425 dev_priv->microcode_version = UCODE_R200; 1429 dev_priv->microcode_version = UCODE_R200;
@@ -1501,13 +1505,13 @@ static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init)
1501 RADEON_ROUND_MODE_TRUNC | 1505 RADEON_ROUND_MODE_TRUNC |
1502 RADEON_ROUND_PREC_8TH_PIX); 1506 RADEON_ROUND_PREC_8TH_PIX);
1503 1507
1504 DRM_GETSAREA();
1505 1508
1506 dev_priv->ring_offset = init->ring_offset; 1509 dev_priv->ring_offset = init->ring_offset;
1507 dev_priv->ring_rptr_offset = init->ring_rptr_offset; 1510 dev_priv->ring_rptr_offset = init->ring_rptr_offset;
1508 dev_priv->buffers_offset = init->buffers_offset; 1511 dev_priv->buffers_offset = init->buffers_offset;
1509 dev_priv->gart_textures_offset = init->gart_textures_offset; 1512 dev_priv->gart_textures_offset = init->gart_textures_offset;
1510 1513
1514 dev_priv->sarea = drm_getsarea(dev);
1511 if (!dev_priv->sarea) { 1515 if (!dev_priv->sarea) {
1512 DRM_ERROR("could not find sarea!\n"); 1516 DRM_ERROR("could not find sarea!\n");
1513 radeon_do_cleanup_cp(dev); 1517 radeon_do_cleanup_cp(dev);
@@ -1731,7 +1735,7 @@ static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init)
1731 return 0; 1735 return 0;
1732} 1736}
1733 1737
1734static int radeon_do_cleanup_cp(drm_device_t * dev) 1738static int radeon_do_cleanup_cp(struct drm_device * dev)
1735{ 1739{
1736 drm_radeon_private_t *dev_priv = dev->dev_private; 1740 drm_radeon_private_t *dev_priv = dev->dev_private;
1737 DRM_DEBUG("\n"); 1741 DRM_DEBUG("\n");
@@ -1787,7 +1791,7 @@ static int radeon_do_cleanup_cp(drm_device_t * dev)
1787 * 1791 *
1788 * Charl P. Botha <http://cpbotha.net> 1792 * Charl P. Botha <http://cpbotha.net>
1789 */ 1793 */
1790static int radeon_do_resume_cp(drm_device_t * dev) 1794static int radeon_do_resume_cp(struct drm_device * dev)
1791{ 1795{
1792 drm_radeon_private_t *dev_priv = dev->dev_private; 1796 drm_radeon_private_t *dev_priv = dev->dev_private;
1793 1797
@@ -1914,7 +1918,7 @@ int radeon_cp_stop(DRM_IOCTL_ARGS)
1914 return 0; 1918 return 0;
1915} 1919}
1916 1920
1917void radeon_do_release(drm_device_t * dev) 1921void radeon_do_release(struct drm_device * dev)
1918{ 1922{
1919 drm_radeon_private_t *dev_priv = dev->dev_private; 1923 drm_radeon_private_t *dev_priv = dev->dev_private;
1920 int i, ret; 1924 int i, ret;
@@ -2042,12 +2046,12 @@ int radeon_fullscreen(DRM_IOCTL_ARGS)
2042 * they can't get the lock. 2046 * they can't get the lock.
2043 */ 2047 */
2044 2048
2045drm_buf_t *radeon_freelist_get(drm_device_t * dev) 2049struct drm_buf *radeon_freelist_get(struct drm_device * dev)
2046{ 2050{
2047 drm_device_dma_t *dma = dev->dma; 2051 struct drm_device_dma *dma = dev->dma;
2048 drm_radeon_private_t *dev_priv = dev->dev_private; 2052 drm_radeon_private_t *dev_priv = dev->dev_private;
2049 drm_radeon_buf_priv_t *buf_priv; 2053 drm_radeon_buf_priv_t *buf_priv;
2050 drm_buf_t *buf; 2054 struct drm_buf *buf;
2051 int i, t; 2055 int i, t;
2052 int start; 2056 int start;
2053 2057
@@ -2082,12 +2086,12 @@ drm_buf_t *radeon_freelist_get(drm_device_t * dev)
2082} 2086}
2083 2087
2084#if 0 2088#if 0
2085drm_buf_t *radeon_freelist_get(drm_device_t * dev) 2089struct drm_buf *radeon_freelist_get(struct drm_device * dev)
2086{ 2090{
2087 drm_device_dma_t *dma = dev->dma; 2091 struct drm_device_dma *dma = dev->dma;
2088 drm_radeon_private_t *dev_priv = dev->dev_private; 2092 drm_radeon_private_t *dev_priv = dev->dev_private;
2089 drm_radeon_buf_priv_t *buf_priv; 2093 drm_radeon_buf_priv_t *buf_priv;
2090 drm_buf_t *buf; 2094 struct drm_buf *buf;
2091 int i, t; 2095 int i, t;
2092 int start; 2096 int start;
2093 u32 done_age = DRM_READ32(dev_priv->ring_rptr, RADEON_SCRATCHOFF(1)); 2097 u32 done_age = DRM_READ32(dev_priv->ring_rptr, RADEON_SCRATCHOFF(1));
@@ -2116,15 +2120,15 @@ drm_buf_t *radeon_freelist_get(drm_device_t * dev)
2116} 2120}
2117#endif 2121#endif
2118 2122
2119void radeon_freelist_reset(drm_device_t * dev) 2123void radeon_freelist_reset(struct drm_device * dev)
2120{ 2124{
2121 drm_device_dma_t *dma = dev->dma; 2125 struct drm_device_dma *dma = dev->dma;
2122 drm_radeon_private_t *dev_priv = dev->dev_private; 2126 drm_radeon_private_t *dev_priv = dev->dev_private;
2123 int i; 2127 int i;
2124 2128
2125 dev_priv->last_buf = 0; 2129 dev_priv->last_buf = 0;
2126 for (i = 0; i < dma->buf_count; i++) { 2130 for (i = 0; i < dma->buf_count; i++) {
2127 drm_buf_t *buf = dma->buflist[i]; 2131 struct drm_buf *buf = dma->buflist[i];
2128 drm_radeon_buf_priv_t *buf_priv = buf->dev_private; 2132 drm_radeon_buf_priv_t *buf_priv = buf->dev_private;
2129 buf_priv->age = 0; 2133 buf_priv->age = 0;
2130 } 2134 }
@@ -2166,11 +2170,11 @@ int radeon_wait_ring(drm_radeon_private_t * dev_priv, int n)
2166 return DRM_ERR(EBUSY); 2170 return DRM_ERR(EBUSY);
2167} 2171}
2168 2172
2169static int radeon_cp_get_buffers(DRMFILE filp, drm_device_t * dev, 2173static int radeon_cp_get_buffers(DRMFILE filp, struct drm_device * dev,
2170 drm_dma_t * d) 2174 struct drm_dma * d)
2171{ 2175{
2172 int i; 2176 int i;
2173 drm_buf_t *buf; 2177 struct drm_buf *buf;
2174 2178
2175 for (i = d->granted_count; i < d->request_count; i++) { 2179 for (i = d->granted_count; i < d->request_count; i++) {
2176 buf = radeon_freelist_get(dev); 2180 buf = radeon_freelist_get(dev);
@@ -2194,10 +2198,10 @@ static int radeon_cp_get_buffers(DRMFILE filp, drm_device_t * dev,
2194int radeon_cp_buffers(DRM_IOCTL_ARGS) 2198int radeon_cp_buffers(DRM_IOCTL_ARGS)
2195{ 2199{
2196 DRM_DEVICE; 2200 DRM_DEVICE;
2197 drm_device_dma_t *dma = dev->dma; 2201 struct drm_device_dma *dma = dev->dma;
2198 int ret = 0; 2202 int ret = 0;
2199 drm_dma_t __user *argp = (void __user *)data; 2203 struct drm_dma __user *argp = (void __user *)data;
2200 drm_dma_t d; 2204 struct drm_dma d;
2201 2205
2202 LOCK_TEST_WITH_RETURN(dev, filp); 2206 LOCK_TEST_WITH_RETURN(dev, filp);
2203 2207
diff --git a/drivers/char/drm/radeon_drm.h b/drivers/char/drm/radeon_drm.h
index 66c4b6fed04f..5a8e23f916fc 100644
--- a/drivers/char/drm/radeon_drm.h
+++ b/drivers/char/drm/radeon_drm.h
@@ -417,7 +417,7 @@ typedef struct {
417 417
418 /* The current cliprects, or a subset thereof. 418 /* The current cliprects, or a subset thereof.
419 */ 419 */
420 drm_clip_rect_t boxes[RADEON_NR_SAREA_CLIPRECTS]; 420 struct drm_clip_rect boxes[RADEON_NR_SAREA_CLIPRECTS];
421 unsigned int nbox; 421 unsigned int nbox;
422 422
423 /* Counters for client-side throttling of rendering clients. 423 /* Counters for client-side throttling of rendering clients.
@@ -426,7 +426,7 @@ typedef struct {
426 unsigned int last_dispatch; 426 unsigned int last_dispatch;
427 unsigned int last_clear; 427 unsigned int last_clear;
428 428
429 drm_tex_region_t tex_list[RADEON_NR_TEX_HEAPS][RADEON_NR_TEX_REGIONS + 429 struct drm_tex_region tex_list[RADEON_NR_TEX_HEAPS][RADEON_NR_TEX_REGIONS +
430 1]; 430 1];
431 unsigned int tex_age[RADEON_NR_TEX_HEAPS]; 431 unsigned int tex_age[RADEON_NR_TEX_HEAPS];
432 int ctx_owner; 432 int ctx_owner;
@@ -604,7 +604,7 @@ typedef struct drm_radeon_cmd_buffer {
604 int bufsz; 604 int bufsz;
605 char __user *buf; 605 char __user *buf;
606 int nbox; 606 int nbox;
607 drm_clip_rect_t __user *boxes; 607 struct drm_clip_rect __user *boxes;
608} drm_radeon_cmd_buffer_t; 608} drm_radeon_cmd_buffer_t;
609 609
610typedef struct drm_radeon_tex_image { 610typedef struct drm_radeon_tex_image {
@@ -655,6 +655,7 @@ typedef struct drm_radeon_indirect {
655#define RADEON_PARAM_GART_TEX_HANDLE 10 655#define RADEON_PARAM_GART_TEX_HANDLE 10
656#define RADEON_PARAM_SCRATCH_OFFSET 11 656#define RADEON_PARAM_SCRATCH_OFFSET 11
657#define RADEON_PARAM_CARD_TYPE 12 657#define RADEON_PARAM_CARD_TYPE 12
658#define RADEON_PARAM_VBLANK_CRTC 13 /* VBLANK CRTC */
658 659
659typedef struct drm_radeon_getparam { 660typedef struct drm_radeon_getparam {
660 int param; 661 int param;
@@ -708,7 +709,7 @@ typedef struct drm_radeon_setparam {
708#define RADEON_SETPARAM_PCIGART_LOCATION 3 /* PCI Gart Location */ 709#define RADEON_SETPARAM_PCIGART_LOCATION 3 /* PCI Gart Location */
709#define RADEON_SETPARAM_NEW_MEMMAP 4 /* Use new memory map */ 710#define RADEON_SETPARAM_NEW_MEMMAP 4 /* Use new memory map */
710#define RADEON_SETPARAM_PCIGART_TABLE_SIZE 5 /* PCI GART Table Size */ 711#define RADEON_SETPARAM_PCIGART_TABLE_SIZE 5 /* PCI GART Table Size */
711 712#define RADEON_SETPARAM_VBLANK_CRTC 6 /* VBLANK CRTC */
712/* 1.14: Clients can allocate/free a surface 713/* 1.14: Clients can allocate/free a surface
713 */ 714 */
714typedef struct drm_radeon_surface_alloc { 715typedef struct drm_radeon_surface_alloc {
@@ -721,4 +722,7 @@ typedef struct drm_radeon_surface_free {
721 unsigned int address; 722 unsigned int address;
722} drm_radeon_surface_free_t; 723} drm_radeon_surface_free_t;
723 724
725#define DRM_RADEON_VBLANK_CRTC1 1
726#define DRM_RADEON_VBLANK_CRTC2 2
727
724#endif 728#endif
diff --git a/drivers/char/drm/radeon_drv.c b/drivers/char/drm/radeon_drv.c
index 2eb652ec6745..349ac3d3b848 100644
--- a/drivers/char/drm/radeon_drv.c
+++ b/drivers/char/drm/radeon_drv.c
@@ -60,7 +60,7 @@ static struct drm_driver driver = {
60 .driver_features = 60 .driver_features =
61 DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG | 61 DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG |
62 DRIVER_HAVE_IRQ | DRIVER_HAVE_DMA | DRIVER_IRQ_SHARED | 62 DRIVER_HAVE_IRQ | DRIVER_HAVE_DMA | DRIVER_IRQ_SHARED |
63 DRIVER_IRQ_VBL, 63 DRIVER_IRQ_VBL | DRIVER_IRQ_VBL2,
64 .dev_priv_size = sizeof(drm_radeon_buf_priv_t), 64 .dev_priv_size = sizeof(drm_radeon_buf_priv_t),
65 .load = radeon_driver_load, 65 .load = radeon_driver_load,
66 .firstopen = radeon_driver_firstopen, 66 .firstopen = radeon_driver_firstopen,
@@ -70,6 +70,7 @@ static struct drm_driver driver = {
70 .lastclose = radeon_driver_lastclose, 70 .lastclose = radeon_driver_lastclose,
71 .unload = radeon_driver_unload, 71 .unload = radeon_driver_unload,
72 .vblank_wait = radeon_driver_vblank_wait, 72 .vblank_wait = radeon_driver_vblank_wait,
73 .vblank_wait2 = radeon_driver_vblank_wait2,
73 .dri_library_name = dri_library_name, 74 .dri_library_name = dri_library_name,
74 .irq_preinstall = radeon_driver_irq_preinstall, 75 .irq_preinstall = radeon_driver_irq_preinstall,
75 .irq_postinstall = radeon_driver_irq_postinstall, 76 .irq_postinstall = radeon_driver_irq_postinstall,
diff --git a/drivers/char/drm/radeon_drv.h b/drivers/char/drm/radeon_drv.h
index 54f49ef4bef0..3b3d9357201c 100644
--- a/drivers/char/drm/radeon_drv.h
+++ b/drivers/char/drm/radeon_drv.h
@@ -97,9 +97,10 @@
97 * new packet type) 97 * new packet type)
98 * 1.26- Add support for variable size PCI(E) gart aperture 98 * 1.26- Add support for variable size PCI(E) gart aperture
99 * 1.27- Add support for IGP GART 99 * 1.27- Add support for IGP GART
100 * 1.28- Add support for VBL on CRTC2
100 */ 101 */
101#define DRIVER_MAJOR 1 102#define DRIVER_MAJOR 1
102#define DRIVER_MINOR 27 103#define DRIVER_MINOR 28
103#define DRIVER_PATCHLEVEL 0 104#define DRIVER_PATCHLEVEL 0
104 105
105/* 106/*
@@ -154,7 +155,7 @@ enum radeon_chip_flags {
154 155
155typedef struct drm_radeon_freelist { 156typedef struct drm_radeon_freelist {
156 unsigned int age; 157 unsigned int age;
157 drm_buf_t *buf; 158 struct drm_buf *buf;
158 struct drm_radeon_freelist *next; 159 struct drm_radeon_freelist *next;
159 struct drm_radeon_freelist *prev; 160 struct drm_radeon_freelist *prev;
160} drm_radeon_freelist_t; 161} drm_radeon_freelist_t;
@@ -277,13 +278,16 @@ typedef struct drm_radeon_private {
277 /* SW interrupt */ 278 /* SW interrupt */
278 wait_queue_head_t swi_queue; 279 wait_queue_head_t swi_queue;
279 atomic_t swi_emitted; 280 atomic_t swi_emitted;
281 int vblank_crtc;
282 uint32_t irq_enable_reg;
283 int irq_enabled;
280 284
281 struct radeon_surface surfaces[RADEON_MAX_SURFACES]; 285 struct radeon_surface surfaces[RADEON_MAX_SURFACES];
282 struct radeon_virt_surface virt_surfaces[2 * RADEON_MAX_SURFACES]; 286 struct radeon_virt_surface virt_surfaces[2 * RADEON_MAX_SURFACES];
283 287
284 unsigned long pcigart_offset; 288 unsigned long pcigart_offset;
285 unsigned int pcigart_offset_set; 289 unsigned int pcigart_offset_set;
286 drm_ati_pcigart_info gart_info; 290 struct drm_ati_pcigart_info gart_info;
287 291
288 u32 scratch_ages[5]; 292 u32 scratch_ages[5];
289 293
@@ -299,7 +303,7 @@ typedef struct drm_radeon_kcmd_buffer {
299 int bufsz; 303 int bufsz;
300 char *buf; 304 char *buf;
301 int nbox; 305 int nbox;
302 drm_clip_rect_t __user *boxes; 306 struct drm_clip_rect __user *boxes;
303} drm_radeon_kcmd_buffer_t; 307} drm_radeon_kcmd_buffer_t;
304 308
305extern int radeon_no_wb; 309extern int radeon_no_wb;
@@ -332,8 +336,8 @@ extern int radeon_engine_reset(DRM_IOCTL_ARGS);
332extern int radeon_fullscreen(DRM_IOCTL_ARGS); 336extern int radeon_fullscreen(DRM_IOCTL_ARGS);
333extern int radeon_cp_buffers(DRM_IOCTL_ARGS); 337extern int radeon_cp_buffers(DRM_IOCTL_ARGS);
334 338
335extern void radeon_freelist_reset(drm_device_t * dev); 339extern void radeon_freelist_reset(struct drm_device * dev);
336extern drm_buf_t *radeon_freelist_get(drm_device_t * dev); 340extern struct drm_buf *radeon_freelist_get(struct drm_device * dev);
337 341
338extern int radeon_wait_ring(drm_radeon_private_t * dev_priv, int n); 342extern int radeon_wait_ring(drm_radeon_private_t * dev_priv, int n);
339 343
@@ -353,29 +357,33 @@ extern void radeon_mem_release(DRMFILE filp, struct mem_block *heap);
353extern int radeon_irq_emit(DRM_IOCTL_ARGS); 357extern int radeon_irq_emit(DRM_IOCTL_ARGS);
354extern int radeon_irq_wait(DRM_IOCTL_ARGS); 358extern int radeon_irq_wait(DRM_IOCTL_ARGS);
355 359
356extern void radeon_do_release(drm_device_t * dev); 360extern void radeon_do_release(struct drm_device * dev);
357extern int radeon_driver_vblank_wait(drm_device_t * dev, 361extern int radeon_driver_vblank_wait(struct drm_device * dev,
358 unsigned int *sequence); 362 unsigned int *sequence);
363extern int radeon_driver_vblank_wait2(struct drm_device * dev,
364 unsigned int *sequence);
359extern irqreturn_t radeon_driver_irq_handler(DRM_IRQ_ARGS); 365extern irqreturn_t radeon_driver_irq_handler(DRM_IRQ_ARGS);
360extern void radeon_driver_irq_preinstall(drm_device_t * dev); 366extern void radeon_driver_irq_preinstall(struct drm_device * dev);
361extern void radeon_driver_irq_postinstall(drm_device_t * dev); 367extern void radeon_driver_irq_postinstall(struct drm_device * dev);
362extern void radeon_driver_irq_uninstall(drm_device_t * dev); 368extern void radeon_driver_irq_uninstall(struct drm_device * dev);
369extern int radeon_vblank_crtc_get(struct drm_device *dev);
370extern int radeon_vblank_crtc_set(struct drm_device *dev, int64_t value);
363 371
364extern int radeon_driver_load(struct drm_device *dev, unsigned long flags); 372extern int radeon_driver_load(struct drm_device *dev, unsigned long flags);
365extern int radeon_driver_unload(struct drm_device *dev); 373extern int radeon_driver_unload(struct drm_device *dev);
366extern int radeon_driver_firstopen(struct drm_device *dev); 374extern int radeon_driver_firstopen(struct drm_device *dev);
367extern void radeon_driver_preclose(drm_device_t * dev, DRMFILE filp); 375extern void radeon_driver_preclose(struct drm_device * dev, DRMFILE filp);
368extern void radeon_driver_postclose(drm_device_t * dev, drm_file_t * filp); 376extern void radeon_driver_postclose(struct drm_device * dev, struct drm_file * filp);
369extern void radeon_driver_lastclose(drm_device_t * dev); 377extern void radeon_driver_lastclose(struct drm_device * dev);
370extern int radeon_driver_open(drm_device_t * dev, drm_file_t * filp_priv); 378extern int radeon_driver_open(struct drm_device * dev, struct drm_file * filp_priv);
371extern long radeon_compat_ioctl(struct file *filp, unsigned int cmd, 379extern long radeon_compat_ioctl(struct file *filp, unsigned int cmd,
372 unsigned long arg); 380 unsigned long arg);
373 381
374/* r300_cmdbuf.c */ 382/* r300_cmdbuf.c */
375extern void r300_init_reg_flags(void); 383extern void r300_init_reg_flags(void);
376 384
377extern int r300_do_cp_cmdbuf(drm_device_t * dev, DRMFILE filp, 385extern int r300_do_cp_cmdbuf(struct drm_device * dev, DRMFILE filp,
378 drm_file_t * filp_priv, 386 struct drm_file * filp_priv,
379 drm_radeon_kcmd_buffer_t * cmdbuf); 387 drm_radeon_kcmd_buffer_t * cmdbuf);
380 388
381/* Flags for stats.boxes 389/* Flags for stats.boxes
@@ -496,12 +504,15 @@ extern int r300_do_cp_cmdbuf(drm_device_t * dev, DRMFILE filp,
496 504
497#define RADEON_GEN_INT_CNTL 0x0040 505#define RADEON_GEN_INT_CNTL 0x0040
498# define RADEON_CRTC_VBLANK_MASK (1 << 0) 506# define RADEON_CRTC_VBLANK_MASK (1 << 0)
507# define RADEON_CRTC2_VBLANK_MASK (1 << 9)
499# define RADEON_GUI_IDLE_INT_ENABLE (1 << 19) 508# define RADEON_GUI_IDLE_INT_ENABLE (1 << 19)
500# define RADEON_SW_INT_ENABLE (1 << 25) 509# define RADEON_SW_INT_ENABLE (1 << 25)
501 510
502#define RADEON_GEN_INT_STATUS 0x0044 511#define RADEON_GEN_INT_STATUS 0x0044
503# define RADEON_CRTC_VBLANK_STAT (1 << 0) 512# define RADEON_CRTC_VBLANK_STAT (1 << 0)
504# define RADEON_CRTC_VBLANK_STAT_ACK (1 << 0) 513# define RADEON_CRTC_VBLANK_STAT_ACK (1 << 0)
514# define RADEON_CRTC2_VBLANK_STAT (1 << 9)
515# define RADEON_CRTC2_VBLANK_STAT_ACK (1 << 9)
505# define RADEON_GUI_IDLE_INT_TEST_ACK (1 << 19) 516# define RADEON_GUI_IDLE_INT_TEST_ACK (1 << 19)
506# define RADEON_SW_INT_TEST (1 << 25) 517# define RADEON_SW_INT_TEST (1 << 25)
507# define RADEON_SW_INT_TEST_ACK (1 << 25) 518# define RADEON_SW_INT_TEST_ACK (1 << 25)
diff --git a/drivers/char/drm/radeon_irq.c b/drivers/char/drm/radeon_irq.c
index 3ff0baa2fbfa..ad8a0ac7182e 100644
--- a/drivers/char/drm/radeon_irq.c
+++ b/drivers/char/drm/radeon_irq.c
@@ -64,7 +64,7 @@ static __inline__ u32 radeon_acknowledge_irqs(drm_radeon_private_t * dev_priv,
64 64
65irqreturn_t radeon_driver_irq_handler(DRM_IRQ_ARGS) 65irqreturn_t radeon_driver_irq_handler(DRM_IRQ_ARGS)
66{ 66{
67 drm_device_t *dev = (drm_device_t *) arg; 67 struct drm_device *dev = (struct drm_device *) arg;
68 drm_radeon_private_t *dev_priv = 68 drm_radeon_private_t *dev_priv =
69 (drm_radeon_private_t *) dev->dev_private; 69 (drm_radeon_private_t *) dev->dev_private;
70 u32 stat; 70 u32 stat;
@@ -73,18 +73,35 @@ irqreturn_t radeon_driver_irq_handler(DRM_IRQ_ARGS)
73 * outside the DRM 73 * outside the DRM
74 */ 74 */
75 stat = radeon_acknowledge_irqs(dev_priv, (RADEON_SW_INT_TEST_ACK | 75 stat = radeon_acknowledge_irqs(dev_priv, (RADEON_SW_INT_TEST_ACK |
76 RADEON_CRTC_VBLANK_STAT)); 76 RADEON_CRTC_VBLANK_STAT |
77 RADEON_CRTC2_VBLANK_STAT));
77 if (!stat) 78 if (!stat)
78 return IRQ_NONE; 79 return IRQ_NONE;
79 80
81 stat &= dev_priv->irq_enable_reg;
82
80 /* SW interrupt */ 83 /* SW interrupt */
81 if (stat & RADEON_SW_INT_TEST) { 84 if (stat & RADEON_SW_INT_TEST) {
82 DRM_WAKEUP(&dev_priv->swi_queue); 85 DRM_WAKEUP(&dev_priv->swi_queue);
83 } 86 }
84 87
85 /* VBLANK interrupt */ 88 /* VBLANK interrupt */
86 if (stat & RADEON_CRTC_VBLANK_STAT) { 89 if (stat & (RADEON_CRTC_VBLANK_STAT|RADEON_CRTC2_VBLANK_STAT)) {
87 atomic_inc(&dev->vbl_received); 90 int vblank_crtc = dev_priv->vblank_crtc;
91
92 if ((vblank_crtc &
93 (DRM_RADEON_VBLANK_CRTC1 | DRM_RADEON_VBLANK_CRTC2)) ==
94 (DRM_RADEON_VBLANK_CRTC1 | DRM_RADEON_VBLANK_CRTC2)) {
95 if (stat & RADEON_CRTC_VBLANK_STAT)
96 atomic_inc(&dev->vbl_received);
97 if (stat & RADEON_CRTC2_VBLANK_STAT)
98 atomic_inc(&dev->vbl_received2);
99 } else if (((stat & RADEON_CRTC_VBLANK_STAT) &&
100 (vblank_crtc & DRM_RADEON_VBLANK_CRTC1)) ||
101 ((stat & RADEON_CRTC2_VBLANK_STAT) &&
102 (vblank_crtc & DRM_RADEON_VBLANK_CRTC2)))
103 atomic_inc(&dev->vbl_received);
104
88 DRM_WAKEUP(&dev->vbl_queue); 105 DRM_WAKEUP(&dev->vbl_queue);
89 drm_vbl_send_signals(dev); 106 drm_vbl_send_signals(dev);
90 } 107 }
@@ -92,7 +109,7 @@ irqreturn_t radeon_driver_irq_handler(DRM_IRQ_ARGS)
92 return IRQ_HANDLED; 109 return IRQ_HANDLED;
93} 110}
94 111
95static int radeon_emit_irq(drm_device_t * dev) 112static int radeon_emit_irq(struct drm_device * dev)
96{ 113{
97 drm_radeon_private_t *dev_priv = dev->dev_private; 114 drm_radeon_private_t *dev_priv = dev->dev_private;
98 unsigned int ret; 115 unsigned int ret;
@@ -110,7 +127,7 @@ static int radeon_emit_irq(drm_device_t * dev)
110 return ret; 127 return ret;
111} 128}
112 129
113static int radeon_wait_irq(drm_device_t * dev, int swi_nr) 130static int radeon_wait_irq(struct drm_device * dev, int swi_nr)
114{ 131{
115 drm_radeon_private_t *dev_priv = 132 drm_radeon_private_t *dev_priv =
116 (drm_radeon_private_t *) dev->dev_private; 133 (drm_radeon_private_t *) dev->dev_private;
@@ -127,19 +144,30 @@ static int radeon_wait_irq(drm_device_t * dev, int swi_nr)
127 return ret; 144 return ret;
128} 145}
129 146
130int radeon_driver_vblank_wait(drm_device_t * dev, unsigned int *sequence) 147int radeon_driver_vblank_do_wait(struct drm_device * dev, unsigned int *sequence,
148 int crtc)
131{ 149{
132 drm_radeon_private_t *dev_priv = 150 drm_radeon_private_t *dev_priv =
133 (drm_radeon_private_t *) dev->dev_private; 151 (drm_radeon_private_t *) dev->dev_private;
134 unsigned int cur_vblank; 152 unsigned int cur_vblank;
135 int ret = 0; 153 int ret = 0;
136 154 int ack = 0;
155 atomic_t *counter;
137 if (!dev_priv) { 156 if (!dev_priv) {
138 DRM_ERROR("%s called with no initialization\n", __FUNCTION__); 157 DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
139 return DRM_ERR(EINVAL); 158 return DRM_ERR(EINVAL);
140 } 159 }
141 160
142 radeon_acknowledge_irqs(dev_priv, RADEON_CRTC_VBLANK_STAT); 161 if (crtc == DRM_RADEON_VBLANK_CRTC1) {
162 counter = &dev->vbl_received;
163 ack |= RADEON_CRTC_VBLANK_STAT;
164 } else if (crtc == DRM_RADEON_VBLANK_CRTC2) {
165 counter = &dev->vbl_received2;
166 ack |= RADEON_CRTC2_VBLANK_STAT;
167 } else
168 return DRM_ERR(EINVAL);
169
170 radeon_acknowledge_irqs(dev_priv, ack);
143 171
144 dev_priv->stats.boxes |= RADEON_BOX_WAIT_IDLE; 172 dev_priv->stats.boxes |= RADEON_BOX_WAIT_IDLE;
145 173
@@ -148,7 +176,7 @@ int radeon_driver_vblank_wait(drm_device_t * dev, unsigned int *sequence)
148 * using vertical blanks... 176 * using vertical blanks...
149 */ 177 */
150 DRM_WAIT_ON(ret, dev->vbl_queue, 3 * DRM_HZ, 178 DRM_WAIT_ON(ret, dev->vbl_queue, 3 * DRM_HZ,
151 (((cur_vblank = atomic_read(&dev->vbl_received)) 179 (((cur_vblank = atomic_read(counter))
152 - *sequence) <= (1 << 23))); 180 - *sequence) <= (1 << 23)));
153 181
154 *sequence = cur_vblank; 182 *sequence = cur_vblank;
@@ -156,6 +184,16 @@ int radeon_driver_vblank_wait(drm_device_t * dev, unsigned int *sequence)
156 return ret; 184 return ret;
157} 185}
158 186
187int radeon_driver_vblank_wait(struct drm_device *dev, unsigned int *sequence)
188{
189 return radeon_driver_vblank_do_wait(dev, sequence, DRM_RADEON_VBLANK_CRTC1);
190}
191
192int radeon_driver_vblank_wait2(struct drm_device *dev, unsigned int *sequence)
193{
194 return radeon_driver_vblank_do_wait(dev, sequence, DRM_RADEON_VBLANK_CRTC2);
195}
196
159/* Needs the lock as it touches the ring. 197/* Needs the lock as it touches the ring.
160 */ 198 */
161int radeon_irq_emit(DRM_IOCTL_ARGS) 199int radeon_irq_emit(DRM_IOCTL_ARGS)
@@ -204,9 +242,24 @@ int radeon_irq_wait(DRM_IOCTL_ARGS)
204 return radeon_wait_irq(dev, irqwait.irq_seq); 242 return radeon_wait_irq(dev, irqwait.irq_seq);
205} 243}
206 244
245static void radeon_enable_interrupt(struct drm_device *dev)
246{
247 drm_radeon_private_t *dev_priv = (drm_radeon_private_t *) dev->dev_private;
248
249 dev_priv->irq_enable_reg = RADEON_SW_INT_ENABLE;
250 if (dev_priv->vblank_crtc & DRM_RADEON_VBLANK_CRTC1)
251 dev_priv->irq_enable_reg |= RADEON_CRTC_VBLANK_MASK;
252
253 if (dev_priv->vblank_crtc & DRM_RADEON_VBLANK_CRTC2)
254 dev_priv->irq_enable_reg |= RADEON_CRTC2_VBLANK_MASK;
255
256 RADEON_WRITE(RADEON_GEN_INT_CNTL, dev_priv->irq_enable_reg);
257 dev_priv->irq_enabled = 1;
258}
259
207/* drm_dma.h hooks 260/* drm_dma.h hooks
208*/ 261*/
209void radeon_driver_irq_preinstall(drm_device_t * dev) 262void radeon_driver_irq_preinstall(struct drm_device * dev)
210{ 263{
211 drm_radeon_private_t *dev_priv = 264 drm_radeon_private_t *dev_priv =
212 (drm_radeon_private_t *) dev->dev_private; 265 (drm_radeon_private_t *) dev->dev_private;
@@ -216,10 +269,11 @@ void radeon_driver_irq_preinstall(drm_device_t * dev)
216 269
217 /* Clear bits if they're already high */ 270 /* Clear bits if they're already high */
218 radeon_acknowledge_irqs(dev_priv, (RADEON_SW_INT_TEST_ACK | 271 radeon_acknowledge_irqs(dev_priv, (RADEON_SW_INT_TEST_ACK |
219 RADEON_CRTC_VBLANK_STAT)); 272 RADEON_CRTC_VBLANK_STAT |
273 RADEON_CRTC2_VBLANK_STAT));
220} 274}
221 275
222void radeon_driver_irq_postinstall(drm_device_t * dev) 276void radeon_driver_irq_postinstall(struct drm_device * dev)
223{ 277{
224 drm_radeon_private_t *dev_priv = 278 drm_radeon_private_t *dev_priv =
225 (drm_radeon_private_t *) dev->dev_private; 279 (drm_radeon_private_t *) dev->dev_private;
@@ -227,18 +281,48 @@ void radeon_driver_irq_postinstall(drm_device_t * dev)
227 atomic_set(&dev_priv->swi_emitted, 0); 281 atomic_set(&dev_priv->swi_emitted, 0);
228 DRM_INIT_WAITQUEUE(&dev_priv->swi_queue); 282 DRM_INIT_WAITQUEUE(&dev_priv->swi_queue);
229 283
230 /* Turn on SW and VBL ints */ 284 radeon_enable_interrupt(dev);
231 RADEON_WRITE(RADEON_GEN_INT_CNTL,
232 RADEON_CRTC_VBLANK_MASK | RADEON_SW_INT_ENABLE);
233} 285}
234 286
235void radeon_driver_irq_uninstall(drm_device_t * dev) 287void radeon_driver_irq_uninstall(struct drm_device * dev)
236{ 288{
237 drm_radeon_private_t *dev_priv = 289 drm_radeon_private_t *dev_priv =
238 (drm_radeon_private_t *) dev->dev_private; 290 (drm_radeon_private_t *) dev->dev_private;
239 if (!dev_priv) 291 if (!dev_priv)
240 return; 292 return;
241 293
294 dev_priv->irq_enabled = 0;
295
242 /* Disable *all* interrupts */ 296 /* Disable *all* interrupts */
243 RADEON_WRITE(RADEON_GEN_INT_CNTL, 0); 297 RADEON_WRITE(RADEON_GEN_INT_CNTL, 0);
244} 298}
299
300
301int radeon_vblank_crtc_get(struct drm_device *dev)
302{
303 drm_radeon_private_t *dev_priv = (drm_radeon_private_t *) dev->dev_private;
304 u32 flag;
305 u32 value;
306
307 flag = RADEON_READ(RADEON_GEN_INT_CNTL);
308 value = 0;
309
310 if (flag & RADEON_CRTC_VBLANK_MASK)
311 value |= DRM_RADEON_VBLANK_CRTC1;
312
313 if (flag & RADEON_CRTC2_VBLANK_MASK)
314 value |= DRM_RADEON_VBLANK_CRTC2;
315 return value;
316}
317
318int radeon_vblank_crtc_set(struct drm_device *dev, int64_t value)
319{
320 drm_radeon_private_t *dev_priv = (drm_radeon_private_t *) dev->dev_private;
321 if (value & ~(DRM_RADEON_VBLANK_CRTC1 | DRM_RADEON_VBLANK_CRTC2)) {
322 DRM_ERROR("called with invalid crtc 0x%x\n", (unsigned int)value);
323 return DRM_ERR(EINVAL);
324 }
325 dev_priv->vblank_crtc = (unsigned int)value;
326 radeon_enable_interrupt(dev);
327 return 0;
328}
diff --git a/drivers/char/drm/radeon_state.c b/drivers/char/drm/radeon_state.c
index 98c5f1d3a8e7..3ddf86f2abf0 100644
--- a/drivers/char/drm/radeon_state.c
+++ b/drivers/char/drm/radeon_state.c
@@ -39,7 +39,7 @@
39 39
40static __inline__ int radeon_check_and_fixup_offset(drm_radeon_private_t * 40static __inline__ int radeon_check_and_fixup_offset(drm_radeon_private_t *
41 dev_priv, 41 dev_priv,
42 drm_file_t * filp_priv, 42 struct drm_file * filp_priv,
43 u32 *offset) 43 u32 *offset)
44{ 44{
45 u64 off = *offset; 45 u64 off = *offset;
@@ -90,7 +90,7 @@ static __inline__ int radeon_check_and_fixup_offset(drm_radeon_private_t *
90 90
91static __inline__ int radeon_check_and_fixup_packets(drm_radeon_private_t * 91static __inline__ int radeon_check_and_fixup_packets(drm_radeon_private_t *
92 dev_priv, 92 dev_priv,
93 drm_file_t * filp_priv, 93 struct drm_file * filp_priv,
94 int id, u32 *data) 94 int id, u32 *data)
95{ 95{
96 switch (id) { 96 switch (id) {
@@ -264,7 +264,7 @@ static __inline__ int radeon_check_and_fixup_packets(drm_radeon_private_t *
264 264
265static __inline__ int radeon_check_and_fixup_packet3(drm_radeon_private_t * 265static __inline__ int radeon_check_and_fixup_packet3(drm_radeon_private_t *
266 dev_priv, 266 dev_priv,
267 drm_file_t *filp_priv, 267 struct drm_file *filp_priv,
268 drm_radeon_kcmd_buffer_t * 268 drm_radeon_kcmd_buffer_t *
269 cmdbuf, 269 cmdbuf,
270 unsigned int *cmdsz) 270 unsigned int *cmdsz)
@@ -421,7 +421,7 @@ static __inline__ int radeon_check_and_fixup_packet3(drm_radeon_private_t *
421 */ 421 */
422 422
423static __inline__ void radeon_emit_clip_rect(drm_radeon_private_t * dev_priv, 423static __inline__ void radeon_emit_clip_rect(drm_radeon_private_t * dev_priv,
424 drm_clip_rect_t * box) 424 struct drm_clip_rect * box)
425{ 425{
426 RING_LOCALS; 426 RING_LOCALS;
427 427
@@ -439,7 +439,7 @@ static __inline__ void radeon_emit_clip_rect(drm_radeon_private_t * dev_priv,
439/* Emit 1.1 state 439/* Emit 1.1 state
440 */ 440 */
441static int radeon_emit_state(drm_radeon_private_t * dev_priv, 441static int radeon_emit_state(drm_radeon_private_t * dev_priv,
442 drm_file_t * filp_priv, 442 struct drm_file * filp_priv,
443 drm_radeon_context_regs_t * ctx, 443 drm_radeon_context_regs_t * ctx,
444 drm_radeon_texture_regs_t * tex, 444 drm_radeon_texture_regs_t * tex,
445 unsigned int dirty) 445 unsigned int dirty)
@@ -608,7 +608,7 @@ static int radeon_emit_state(drm_radeon_private_t * dev_priv,
608/* Emit 1.2 state 608/* Emit 1.2 state
609 */ 609 */
610static int radeon_emit_state2(drm_radeon_private_t * dev_priv, 610static int radeon_emit_state2(drm_radeon_private_t * dev_priv,
611 drm_file_t * filp_priv, 611 struct drm_file * filp_priv,
612 drm_radeon_state_t * state) 612 drm_radeon_state_t * state)
613{ 613{
614 RING_LOCALS; 614 RING_LOCALS;
@@ -844,7 +844,7 @@ static void radeon_cp_performance_boxes(drm_radeon_private_t * dev_priv)
844 * CP command dispatch functions 844 * CP command dispatch functions
845 */ 845 */
846 846
847static void radeon_cp_dispatch_clear(drm_device_t * dev, 847static void radeon_cp_dispatch_clear(struct drm_device * dev,
848 drm_radeon_clear_t * clear, 848 drm_radeon_clear_t * clear,
849 drm_radeon_clear_rect_t * depth_boxes) 849 drm_radeon_clear_rect_t * depth_boxes)
850{ 850{
@@ -852,7 +852,7 @@ static void radeon_cp_dispatch_clear(drm_device_t * dev,
852 drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; 852 drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv;
853 drm_radeon_depth_clear_t *depth_clear = &dev_priv->depth_clear; 853 drm_radeon_depth_clear_t *depth_clear = &dev_priv->depth_clear;
854 int nbox = sarea_priv->nbox; 854 int nbox = sarea_priv->nbox;
855 drm_clip_rect_t *pbox = sarea_priv->boxes; 855 struct drm_clip_rect *pbox = sarea_priv->boxes;
856 unsigned int flags = clear->flags; 856 unsigned int flags = clear->flags;
857 u32 rb3d_cntl = 0, rb3d_stencilrefmask = 0; 857 u32 rb3d_cntl = 0, rb3d_stencilrefmask = 0;
858 int i; 858 int i;
@@ -1335,12 +1335,12 @@ static void radeon_cp_dispatch_clear(drm_device_t * dev,
1335 ADVANCE_RING(); 1335 ADVANCE_RING();
1336} 1336}
1337 1337
1338static void radeon_cp_dispatch_swap(drm_device_t * dev) 1338static void radeon_cp_dispatch_swap(struct drm_device * dev)
1339{ 1339{
1340 drm_radeon_private_t *dev_priv = dev->dev_private; 1340 drm_radeon_private_t *dev_priv = dev->dev_private;
1341 drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; 1341 drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv;
1342 int nbox = sarea_priv->nbox; 1342 int nbox = sarea_priv->nbox;
1343 drm_clip_rect_t *pbox = sarea_priv->boxes; 1343 struct drm_clip_rect *pbox = sarea_priv->boxes;
1344 int i; 1344 int i;
1345 RING_LOCALS; 1345 RING_LOCALS;
1346 DRM_DEBUG("\n"); 1346 DRM_DEBUG("\n");
@@ -1412,10 +1412,10 @@ static void radeon_cp_dispatch_swap(drm_device_t * dev)
1412 ADVANCE_RING(); 1412 ADVANCE_RING();
1413} 1413}
1414 1414
1415static void radeon_cp_dispatch_flip(drm_device_t * dev) 1415static void radeon_cp_dispatch_flip(struct drm_device * dev)
1416{ 1416{
1417 drm_radeon_private_t *dev_priv = dev->dev_private; 1417 drm_radeon_private_t *dev_priv = dev->dev_private;
1418 drm_sarea_t *sarea = (drm_sarea_t *) dev_priv->sarea->handle; 1418 struct drm_sarea *sarea = (struct drm_sarea *) dev_priv->sarea->handle;
1419 int offset = (dev_priv->sarea_priv->pfCurrentPage == 1) 1419 int offset = (dev_priv->sarea_priv->pfCurrentPage == 1)
1420 ? dev_priv->front_offset : dev_priv->back_offset; 1420 ? dev_priv->front_offset : dev_priv->back_offset;
1421 RING_LOCALS; 1421 RING_LOCALS;
@@ -1491,8 +1491,8 @@ typedef struct {
1491 unsigned int vc_format; 1491 unsigned int vc_format;
1492} drm_radeon_tcl_prim_t; 1492} drm_radeon_tcl_prim_t;
1493 1493
1494static void radeon_cp_dispatch_vertex(drm_device_t * dev, 1494static void radeon_cp_dispatch_vertex(struct drm_device * dev,
1495 drm_buf_t * buf, 1495 struct drm_buf * buf,
1496 drm_radeon_tcl_prim_t * prim) 1496 drm_radeon_tcl_prim_t * prim)
1497{ 1497{
1498 drm_radeon_private_t *dev_priv = dev->dev_private; 1498 drm_radeon_private_t *dev_priv = dev->dev_private;
@@ -1537,7 +1537,7 @@ static void radeon_cp_dispatch_vertex(drm_device_t * dev,
1537 } while (i < nbox); 1537 } while (i < nbox);
1538} 1538}
1539 1539
1540static void radeon_cp_discard_buffer(drm_device_t * dev, drm_buf_t * buf) 1540static void radeon_cp_discard_buffer(struct drm_device * dev, struct drm_buf * buf)
1541{ 1541{
1542 drm_radeon_private_t *dev_priv = dev->dev_private; 1542 drm_radeon_private_t *dev_priv = dev->dev_private;
1543 drm_radeon_buf_priv_t *buf_priv = buf->dev_private; 1543 drm_radeon_buf_priv_t *buf_priv = buf->dev_private;
@@ -1554,8 +1554,8 @@ static void radeon_cp_discard_buffer(drm_device_t * dev, drm_buf_t * buf)
1554 buf->used = 0; 1554 buf->used = 0;
1555} 1555}
1556 1556
1557static void radeon_cp_dispatch_indirect(drm_device_t * dev, 1557static void radeon_cp_dispatch_indirect(struct drm_device * dev,
1558 drm_buf_t * buf, int start, int end) 1558 struct drm_buf * buf, int start, int end)
1559{ 1559{
1560 drm_radeon_private_t *dev_priv = dev->dev_private; 1560 drm_radeon_private_t *dev_priv = dev->dev_private;
1561 RING_LOCALS; 1561 RING_LOCALS;
@@ -1588,8 +1588,8 @@ static void radeon_cp_dispatch_indirect(drm_device_t * dev,
1588 } 1588 }
1589} 1589}
1590 1590
1591static void radeon_cp_dispatch_indices(drm_device_t * dev, 1591static void radeon_cp_dispatch_indices(struct drm_device * dev,
1592 drm_buf_t * elt_buf, 1592 struct drm_buf * elt_buf,
1593 drm_radeon_tcl_prim_t * prim) 1593 drm_radeon_tcl_prim_t * prim)
1594{ 1594{
1595 drm_radeon_private_t *dev_priv = dev->dev_private; 1595 drm_radeon_private_t *dev_priv = dev->dev_private;
@@ -1647,13 +1647,13 @@ static void radeon_cp_dispatch_indices(drm_device_t * dev,
1647#define RADEON_MAX_TEXTURE_SIZE RADEON_BUFFER_SIZE 1647#define RADEON_MAX_TEXTURE_SIZE RADEON_BUFFER_SIZE
1648 1648
1649static int radeon_cp_dispatch_texture(DRMFILE filp, 1649static int radeon_cp_dispatch_texture(DRMFILE filp,
1650 drm_device_t * dev, 1650 struct drm_device * dev,
1651 drm_radeon_texture_t * tex, 1651 drm_radeon_texture_t * tex,
1652 drm_radeon_tex_image_t * image) 1652 drm_radeon_tex_image_t * image)
1653{ 1653{
1654 drm_radeon_private_t *dev_priv = dev->dev_private; 1654 drm_radeon_private_t *dev_priv = dev->dev_private;
1655 drm_file_t *filp_priv; 1655 struct drm_file *filp_priv;
1656 drm_buf_t *buf; 1656 struct drm_buf *buf;
1657 u32 format; 1657 u32 format;
1658 u32 *buffer; 1658 u32 *buffer;
1659 const u8 __user *data; 1659 const u8 __user *data;
@@ -1881,7 +1881,7 @@ static int radeon_cp_dispatch_texture(DRMFILE filp,
1881 return 0; 1881 return 0;
1882} 1882}
1883 1883
1884static void radeon_cp_dispatch_stipple(drm_device_t * dev, u32 * stipple) 1884static void radeon_cp_dispatch_stipple(struct drm_device * dev, u32 * stipple)
1885{ 1885{
1886 drm_radeon_private_t *dev_priv = dev->dev_private; 1886 drm_radeon_private_t *dev_priv = dev->dev_private;
1887 int i; 1887 int i;
@@ -2134,7 +2134,7 @@ static int radeon_cp_clear(DRM_IOCTL_ARGS)
2134 2134
2135/* Not sure why this isn't set all the time: 2135/* Not sure why this isn't set all the time:
2136 */ 2136 */
2137static int radeon_do_init_pageflip(drm_device_t * dev) 2137static int radeon_do_init_pageflip(struct drm_device * dev)
2138{ 2138{
2139 drm_radeon_private_t *dev_priv = dev->dev_private; 2139 drm_radeon_private_t *dev_priv = dev->dev_private;
2140 RING_LOCALS; 2140 RING_LOCALS;
@@ -2206,10 +2206,10 @@ static int radeon_cp_vertex(DRM_IOCTL_ARGS)
2206{ 2206{
2207 DRM_DEVICE; 2207 DRM_DEVICE;
2208 drm_radeon_private_t *dev_priv = dev->dev_private; 2208 drm_radeon_private_t *dev_priv = dev->dev_private;
2209 drm_file_t *filp_priv; 2209 struct drm_file *filp_priv;
2210 drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; 2210 drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv;
2211 drm_device_dma_t *dma = dev->dma; 2211 struct drm_device_dma *dma = dev->dma;
2212 drm_buf_t *buf; 2212 struct drm_buf *buf;
2213 drm_radeon_vertex_t vertex; 2213 drm_radeon_vertex_t vertex;
2214 drm_radeon_tcl_prim_t prim; 2214 drm_radeon_tcl_prim_t prim;
2215 2215
@@ -2289,10 +2289,10 @@ static int radeon_cp_indices(DRM_IOCTL_ARGS)
2289{ 2289{
2290 DRM_DEVICE; 2290 DRM_DEVICE;
2291 drm_radeon_private_t *dev_priv = dev->dev_private; 2291 drm_radeon_private_t *dev_priv = dev->dev_private;
2292 drm_file_t *filp_priv; 2292 struct drm_file *filp_priv;
2293 drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; 2293 drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv;
2294 drm_device_dma_t *dma = dev->dma; 2294 struct drm_device_dma *dma = dev->dma;
2295 drm_buf_t *buf; 2295 struct drm_buf *buf;
2296 drm_radeon_indices_t elts; 2296 drm_radeon_indices_t elts;
2297 drm_radeon_tcl_prim_t prim; 2297 drm_radeon_tcl_prim_t prim;
2298 int count; 2298 int count;
@@ -2438,8 +2438,8 @@ static int radeon_cp_indirect(DRM_IOCTL_ARGS)
2438{ 2438{
2439 DRM_DEVICE; 2439 DRM_DEVICE;
2440 drm_radeon_private_t *dev_priv = dev->dev_private; 2440 drm_radeon_private_t *dev_priv = dev->dev_private;
2441 drm_device_dma_t *dma = dev->dma; 2441 struct drm_device_dma *dma = dev->dma;
2442 drm_buf_t *buf; 2442 struct drm_buf *buf;
2443 drm_radeon_indirect_t indirect; 2443 drm_radeon_indirect_t indirect;
2444 RING_LOCALS; 2444 RING_LOCALS;
2445 2445
@@ -2507,10 +2507,10 @@ static int radeon_cp_vertex2(DRM_IOCTL_ARGS)
2507{ 2507{
2508 DRM_DEVICE; 2508 DRM_DEVICE;
2509 drm_radeon_private_t *dev_priv = dev->dev_private; 2509 drm_radeon_private_t *dev_priv = dev->dev_private;
2510 drm_file_t *filp_priv; 2510 struct drm_file *filp_priv;
2511 drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; 2511 drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv;
2512 drm_device_dma_t *dma = dev->dma; 2512 struct drm_device_dma *dma = dev->dma;
2513 drm_buf_t *buf; 2513 struct drm_buf *buf;
2514 drm_radeon_vertex2_t vertex; 2514 drm_radeon_vertex2_t vertex;
2515 int i; 2515 int i;
2516 unsigned char laststate; 2516 unsigned char laststate;
@@ -2603,7 +2603,7 @@ static int radeon_cp_vertex2(DRM_IOCTL_ARGS)
2603} 2603}
2604 2604
2605static int radeon_emit_packets(drm_radeon_private_t * dev_priv, 2605static int radeon_emit_packets(drm_radeon_private_t * dev_priv,
2606 drm_file_t * filp_priv, 2606 struct drm_file * filp_priv,
2607 drm_radeon_cmd_header_t header, 2607 drm_radeon_cmd_header_t header,
2608 drm_radeon_kcmd_buffer_t *cmdbuf) 2608 drm_radeon_kcmd_buffer_t *cmdbuf)
2609{ 2609{
@@ -2728,8 +2728,8 @@ static __inline__ int radeon_emit_veclinear(drm_radeon_private_t *dev_priv,
2728 return 0; 2728 return 0;
2729} 2729}
2730 2730
2731static int radeon_emit_packet3(drm_device_t * dev, 2731static int radeon_emit_packet3(struct drm_device * dev,
2732 drm_file_t * filp_priv, 2732 struct drm_file * filp_priv,
2733 drm_radeon_kcmd_buffer_t *cmdbuf) 2733 drm_radeon_kcmd_buffer_t *cmdbuf)
2734{ 2734{
2735 drm_radeon_private_t *dev_priv = dev->dev_private; 2735 drm_radeon_private_t *dev_priv = dev->dev_private;
@@ -2754,16 +2754,16 @@ static int radeon_emit_packet3(drm_device_t * dev,
2754 return 0; 2754 return 0;
2755} 2755}
2756 2756
2757static int radeon_emit_packet3_cliprect(drm_device_t *dev, 2757static int radeon_emit_packet3_cliprect(struct drm_device *dev,
2758 drm_file_t *filp_priv, 2758 struct drm_file *filp_priv,
2759 drm_radeon_kcmd_buffer_t *cmdbuf, 2759 drm_radeon_kcmd_buffer_t *cmdbuf,
2760 int orig_nbox) 2760 int orig_nbox)
2761{ 2761{
2762 drm_radeon_private_t *dev_priv = dev->dev_private; 2762 drm_radeon_private_t *dev_priv = dev->dev_private;
2763 drm_clip_rect_t box; 2763 struct drm_clip_rect box;
2764 unsigned int cmdsz; 2764 unsigned int cmdsz;
2765 int ret; 2765 int ret;
2766 drm_clip_rect_t __user *boxes = cmdbuf->boxes; 2766 struct drm_clip_rect __user *boxes = cmdbuf->boxes;
2767 int i = 0; 2767 int i = 0;
2768 RING_LOCALS; 2768 RING_LOCALS;
2769 2769
@@ -2816,7 +2816,7 @@ static int radeon_emit_packet3_cliprect(drm_device_t *dev,
2816 return 0; 2816 return 0;
2817} 2817}
2818 2818
2819static int radeon_emit_wait(drm_device_t * dev, int flags) 2819static int radeon_emit_wait(struct drm_device * dev, int flags)
2820{ 2820{
2821 drm_radeon_private_t *dev_priv = dev->dev_private; 2821 drm_radeon_private_t *dev_priv = dev->dev_private;
2822 RING_LOCALS; 2822 RING_LOCALS;
@@ -2849,9 +2849,9 @@ static int radeon_cp_cmdbuf(DRM_IOCTL_ARGS)
2849{ 2849{
2850 DRM_DEVICE; 2850 DRM_DEVICE;
2851 drm_radeon_private_t *dev_priv = dev->dev_private; 2851 drm_radeon_private_t *dev_priv = dev->dev_private;
2852 drm_file_t *filp_priv; 2852 struct drm_file *filp_priv;
2853 drm_device_dma_t *dma = dev->dma; 2853 struct drm_device_dma *dma = dev->dma;
2854 drm_buf_t *buf = NULL; 2854 struct drm_buf *buf = NULL;
2855 int idx; 2855 int idx;
2856 drm_radeon_kcmd_buffer_t cmdbuf; 2856 drm_radeon_kcmd_buffer_t cmdbuf;
2857 drm_radeon_cmd_header_t header; 2857 drm_radeon_cmd_header_t header;
@@ -3085,6 +3085,9 @@ static int radeon_cp_getparam(DRM_IOCTL_ARGS)
3085 else 3085 else
3086 value = RADEON_CARD_PCI; 3086 value = RADEON_CARD_PCI;
3087 break; 3087 break;
3088 case RADEON_PARAM_VBLANK_CRTC:
3089 value = radeon_vblank_crtc_get(dev);
3090 break;
3088 default: 3091 default:
3089 DRM_DEBUG("Invalid parameter %d\n", param.param); 3092 DRM_DEBUG("Invalid parameter %d\n", param.param);
3090 return DRM_ERR(EINVAL); 3093 return DRM_ERR(EINVAL);
@@ -3102,7 +3105,7 @@ static int radeon_cp_setparam(DRM_IOCTL_ARGS)
3102{ 3105{
3103 DRM_DEVICE; 3106 DRM_DEVICE;
3104 drm_radeon_private_t *dev_priv = dev->dev_private; 3107 drm_radeon_private_t *dev_priv = dev->dev_private;
3105 drm_file_t *filp_priv; 3108 struct drm_file *filp_priv;
3106 drm_radeon_setparam_t sp; 3109 drm_radeon_setparam_t sp;
3107 struct drm_radeon_driver_file_fields *radeon_priv; 3110 struct drm_radeon_driver_file_fields *radeon_priv;
3108 3111
@@ -3141,6 +3144,9 @@ static int radeon_cp_setparam(DRM_IOCTL_ARGS)
3141 if (dev_priv->gart_info.table_size < RADEON_PCIGART_TABLE_SIZE) 3144 if (dev_priv->gart_info.table_size < RADEON_PCIGART_TABLE_SIZE)
3142 dev_priv->gart_info.table_size = RADEON_PCIGART_TABLE_SIZE; 3145 dev_priv->gart_info.table_size = RADEON_PCIGART_TABLE_SIZE;
3143 break; 3146 break;
3147 case RADEON_SETPARAM_VBLANK_CRTC:
3148 return radeon_vblank_crtc_set(dev, sp.value);
3149 break;
3144 default: 3150 default:
3145 DRM_DEBUG("Invalid parameter %d\n", sp.param); 3151 DRM_DEBUG("Invalid parameter %d\n", sp.param);
3146 return DRM_ERR(EINVAL); 3152 return DRM_ERR(EINVAL);
@@ -3156,7 +3162,7 @@ static int radeon_cp_setparam(DRM_IOCTL_ARGS)
3156 * 3162 *
3157 * DRM infrastructure takes care of reclaiming dma buffers. 3163 * DRM infrastructure takes care of reclaiming dma buffers.
3158 */ 3164 */
3159void radeon_driver_preclose(drm_device_t * dev, DRMFILE filp) 3165void radeon_driver_preclose(struct drm_device *dev, DRMFILE filp)
3160{ 3166{
3161 if (dev->dev_private) { 3167 if (dev->dev_private) {
3162 drm_radeon_private_t *dev_priv = dev->dev_private; 3168 drm_radeon_private_t *dev_priv = dev->dev_private;
@@ -3167,7 +3173,7 @@ void radeon_driver_preclose(drm_device_t * dev, DRMFILE filp)
3167 } 3173 }
3168} 3174}
3169 3175
3170void radeon_driver_lastclose(drm_device_t * dev) 3176void radeon_driver_lastclose(struct drm_device *dev)
3171{ 3177{
3172 if (dev->dev_private) { 3178 if (dev->dev_private) {
3173 drm_radeon_private_t *dev_priv = dev->dev_private; 3179 drm_radeon_private_t *dev_priv = dev->dev_private;
@@ -3180,7 +3186,7 @@ void radeon_driver_lastclose(drm_device_t * dev)
3180 radeon_do_release(dev); 3186 radeon_do_release(dev);
3181} 3187}
3182 3188
3183int radeon_driver_open(drm_device_t * dev, drm_file_t * filp_priv) 3189int radeon_driver_open(struct drm_device *dev, struct drm_file *filp_priv)
3184{ 3190{
3185 drm_radeon_private_t *dev_priv = dev->dev_private; 3191 drm_radeon_private_t *dev_priv = dev->dev_private;
3186 struct drm_radeon_driver_file_fields *radeon_priv; 3192 struct drm_radeon_driver_file_fields *radeon_priv;
@@ -3202,7 +3208,7 @@ int radeon_driver_open(drm_device_t * dev, drm_file_t * filp_priv)
3202 return 0; 3208 return 0;
3203} 3209}
3204 3210
3205void radeon_driver_postclose(drm_device_t * dev, drm_file_t * filp_priv) 3211void radeon_driver_postclose(struct drm_device *dev, struct drm_file *filp_priv)
3206{ 3212{
3207 struct drm_radeon_driver_file_fields *radeon_priv = 3213 struct drm_radeon_driver_file_fields *radeon_priv =
3208 filp_priv->driver_priv; 3214 filp_priv->driver_priv;
diff --git a/drivers/char/drm/savage_bci.c b/drivers/char/drm/savage_bci.c
index b94fab556809..18c7235f6b73 100644
--- a/drivers/char/drm/savage_bci.c
+++ b/drivers/char/drm/savage_bci.c
@@ -32,7 +32,7 @@
32#define SAVAGE_EVENT_USEC_TIMEOUT 5000000 /* 5s */ 32#define SAVAGE_EVENT_USEC_TIMEOUT 5000000 /* 5s */
33#define SAVAGE_FREELIST_DEBUG 0 33#define SAVAGE_FREELIST_DEBUG 0
34 34
35static int savage_do_cleanup_bci(drm_device_t *dev); 35static int savage_do_cleanup_bci(struct drm_device *dev);
36 36
37static int 37static int
38savage_bci_wait_fifo_shadow(drm_savage_private_t * dev_priv, unsigned int n) 38savage_bci_wait_fifo_shadow(drm_savage_private_t * dev_priv, unsigned int n)
@@ -203,11 +203,11 @@ uint16_t savage_bci_emit_event(drm_savage_private_t * dev_priv,
203/* 203/*
204 * Freelist management 204 * Freelist management
205 */ 205 */
206static int savage_freelist_init(drm_device_t * dev) 206static int savage_freelist_init(struct drm_device * dev)
207{ 207{
208 drm_savage_private_t *dev_priv = dev->dev_private; 208 drm_savage_private_t *dev_priv = dev->dev_private;
209 drm_device_dma_t *dma = dev->dma; 209 struct drm_device_dma *dma = dev->dma;
210 drm_buf_t *buf; 210 struct drm_buf *buf;
211 drm_savage_buf_priv_t *entry; 211 drm_savage_buf_priv_t *entry;
212 int i; 212 int i;
213 DRM_DEBUG("count=%d\n", dma->buf_count); 213 DRM_DEBUG("count=%d\n", dma->buf_count);
@@ -236,7 +236,7 @@ static int savage_freelist_init(drm_device_t * dev)
236 return 0; 236 return 0;
237} 237}
238 238
239static drm_buf_t *savage_freelist_get(drm_device_t * dev) 239static struct drm_buf *savage_freelist_get(struct drm_device * dev)
240{ 240{
241 drm_savage_private_t *dev_priv = dev->dev_private; 241 drm_savage_private_t *dev_priv = dev->dev_private;
242 drm_savage_buf_priv_t *tail = dev_priv->tail.prev; 242 drm_savage_buf_priv_t *tail = dev_priv->tail.prev;
@@ -269,7 +269,7 @@ static drm_buf_t *savage_freelist_get(drm_device_t * dev)
269 return NULL; 269 return NULL;
270} 270}
271 271
272void savage_freelist_put(drm_device_t * dev, drm_buf_t * buf) 272void savage_freelist_put(struct drm_device * dev, struct drm_buf * buf)
273{ 273{
274 drm_savage_private_t *dev_priv = dev->dev_private; 274 drm_savage_private_t *dev_priv = dev->dev_private;
275 drm_savage_buf_priv_t *entry = buf->dev_private, *prev, *next; 275 drm_savage_buf_priv_t *entry = buf->dev_private, *prev, *next;
@@ -535,7 +535,7 @@ static void savage_fake_dma_flush(drm_savage_private_t * dev_priv)
535 dev_priv->first_dma_page = dev_priv->current_dma_page = 0; 535 dev_priv->first_dma_page = dev_priv->current_dma_page = 0;
536} 536}
537 537
538int savage_driver_load(drm_device_t *dev, unsigned long chipset) 538int savage_driver_load(struct drm_device *dev, unsigned long chipset)
539{ 539{
540 drm_savage_private_t *dev_priv; 540 drm_savage_private_t *dev_priv;
541 541
@@ -558,7 +558,7 @@ int savage_driver_load(drm_device_t *dev, unsigned long chipset)
558 * in drm_addmap. Therefore we add them manually before the maps are 558 * in drm_addmap. Therefore we add them manually before the maps are
559 * initialized, and tear them down on last close. 559 * initialized, and tear them down on last close.
560 */ 560 */
561int savage_driver_firstopen(drm_device_t *dev) 561int savage_driver_firstopen(struct drm_device *dev)
562{ 562{
563 drm_savage_private_t *dev_priv = dev->dev_private; 563 drm_savage_private_t *dev_priv = dev->dev_private;
564 unsigned long mmio_base, fb_base, fb_size, aperture_base; 564 unsigned long mmio_base, fb_base, fb_size, aperture_base;
@@ -655,7 +655,7 @@ int savage_driver_firstopen(drm_device_t *dev)
655/* 655/*
656 * Delete MTRRs and free device-private data. 656 * Delete MTRRs and free device-private data.
657 */ 657 */
658void savage_driver_lastclose(drm_device_t *dev) 658void savage_driver_lastclose(struct drm_device *dev)
659{ 659{
660 drm_savage_private_t *dev_priv = dev->dev_private; 660 drm_savage_private_t *dev_priv = dev->dev_private;
661 int i; 661 int i;
@@ -667,7 +667,7 @@ void savage_driver_lastclose(drm_device_t *dev)
667 dev_priv->mtrr[i].size, DRM_MTRR_WC); 667 dev_priv->mtrr[i].size, DRM_MTRR_WC);
668} 668}
669 669
670int savage_driver_unload(drm_device_t *dev) 670int savage_driver_unload(struct drm_device *dev)
671{ 671{
672 drm_savage_private_t *dev_priv = dev->dev_private; 672 drm_savage_private_t *dev_priv = dev->dev_private;
673 673
@@ -676,7 +676,7 @@ int savage_driver_unload(drm_device_t *dev)
676 return 0; 676 return 0;
677} 677}
678 678
679static int savage_do_init_bci(drm_device_t * dev, drm_savage_init_t * init) 679static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init)
680{ 680{
681 drm_savage_private_t *dev_priv = dev->dev_private; 681 drm_savage_private_t *dev_priv = dev->dev_private;
682 682
@@ -711,7 +711,7 @@ static int savage_do_init_bci(drm_device_t * dev, drm_savage_init_t * init)
711 dev_priv->texture_offset = init->texture_offset; 711 dev_priv->texture_offset = init->texture_offset;
712 dev_priv->texture_size = init->texture_size; 712 dev_priv->texture_size = init->texture_size;
713 713
714 DRM_GETSAREA(); 714 dev_priv->sarea = drm_getsarea(dev);
715 if (!dev_priv->sarea) { 715 if (!dev_priv->sarea) {
716 DRM_ERROR("could not find sarea!\n"); 716 DRM_ERROR("could not find sarea!\n");
717 savage_do_cleanup_bci(dev); 717 savage_do_cleanup_bci(dev);
@@ -898,7 +898,7 @@ static int savage_do_init_bci(drm_device_t * dev, drm_savage_init_t * init)
898 return 0; 898 return 0;
899} 899}
900 900
901static int savage_do_cleanup_bci(drm_device_t * dev) 901static int savage_do_cleanup_bci(struct drm_device * dev)
902{ 902{
903 drm_savage_private_t *dev_priv = dev->dev_private; 903 drm_savage_private_t *dev_priv = dev->dev_private;
904 904
@@ -1007,9 +1007,9 @@ static int savage_bci_event_wait(DRM_IOCTL_ARGS)
1007 * DMA buffer management 1007 * DMA buffer management
1008 */ 1008 */
1009 1009
1010static int savage_bci_get_buffers(DRMFILE filp, drm_device_t *dev, drm_dma_t *d) 1010static int savage_bci_get_buffers(DRMFILE filp, struct drm_device *dev, struct drm_dma *d)
1011{ 1011{
1012 drm_buf_t *buf; 1012 struct drm_buf *buf;
1013 int i; 1013 int i;
1014 1014
1015 for (i = d->granted_count; i < d->request_count; i++) { 1015 for (i = d->granted_count; i < d->request_count; i++) {
@@ -1034,13 +1034,13 @@ static int savage_bci_get_buffers(DRMFILE filp, drm_device_t *dev, drm_dma_t *d)
1034int savage_bci_buffers(DRM_IOCTL_ARGS) 1034int savage_bci_buffers(DRM_IOCTL_ARGS)
1035{ 1035{
1036 DRM_DEVICE; 1036 DRM_DEVICE;
1037 drm_device_dma_t *dma = dev->dma; 1037 struct drm_device_dma *dma = dev->dma;
1038 drm_dma_t d; 1038 struct drm_dma d;
1039 int ret = 0; 1039 int ret = 0;
1040 1040
1041 LOCK_TEST_WITH_RETURN(dev, filp); 1041 LOCK_TEST_WITH_RETURN(dev, filp);
1042 1042
1043 DRM_COPY_FROM_USER_IOCTL(d, (drm_dma_t __user *) data, sizeof(d)); 1043 DRM_COPY_FROM_USER_IOCTL(d, (struct drm_dma __user *) data, sizeof(d));
1044 1044
1045 /* Please don't send us buffers. 1045 /* Please don't send us buffers.
1046 */ 1046 */
@@ -1064,14 +1064,14 @@ int savage_bci_buffers(DRM_IOCTL_ARGS)
1064 ret = savage_bci_get_buffers(filp, dev, &d); 1064 ret = savage_bci_get_buffers(filp, dev, &d);
1065 } 1065 }
1066 1066
1067 DRM_COPY_TO_USER_IOCTL((drm_dma_t __user *) data, d, sizeof(d)); 1067 DRM_COPY_TO_USER_IOCTL((struct drm_dma __user *) data, d, sizeof(d));
1068 1068
1069 return ret; 1069 return ret;
1070} 1070}
1071 1071
1072void savage_reclaim_buffers(drm_device_t *dev, DRMFILE filp) 1072void savage_reclaim_buffers(struct drm_device *dev, DRMFILE filp)
1073{ 1073{
1074 drm_device_dma_t *dma = dev->dma; 1074 struct drm_device_dma *dma = dev->dma;
1075 drm_savage_private_t *dev_priv = dev->dev_private; 1075 drm_savage_private_t *dev_priv = dev->dev_private;
1076 int i; 1076 int i;
1077 1077
@@ -1085,7 +1085,7 @@ void savage_reclaim_buffers(drm_device_t *dev, DRMFILE filp)
1085 /*i830_flush_queue(dev); */ 1085 /*i830_flush_queue(dev); */
1086 1086
1087 for (i = 0; i < dma->buf_count; i++) { 1087 for (i = 0; i < dma->buf_count; i++) {
1088 drm_buf_t *buf = dma->buflist[i]; 1088 struct drm_buf *buf = dma->buflist[i];
1089 drm_savage_buf_priv_t *buf_priv = buf->dev_private; 1089 drm_savage_buf_priv_t *buf_priv = buf->dev_private;
1090 1090
1091 if (buf->filp == filp && buf_priv && 1091 if (buf->filp == filp && buf_priv &&
diff --git a/drivers/char/drm/savage_drm.h b/drivers/char/drm/savage_drm.h
index e1148e8e7994..8a576ef01821 100644
--- a/drivers/char/drm/savage_drm.h
+++ b/drivers/char/drm/savage_drm.h
@@ -47,7 +47,7 @@
47typedef struct _drm_savage_sarea { 47typedef struct _drm_savage_sarea {
48 /* LRU lists for texture memory in agp space and on the card. 48 /* LRU lists for texture memory in agp space and on the card.
49 */ 49 */
50 drm_tex_region_t texList[SAVAGE_NR_TEX_HEAPS][SAVAGE_NR_TEX_REGIONS + 50 struct drm_tex_region texList[SAVAGE_NR_TEX_HEAPS][SAVAGE_NR_TEX_REGIONS +
51 1]; 51 1];
52 unsigned int texAge[SAVAGE_NR_TEX_HEAPS]; 52 unsigned int texAge[SAVAGE_NR_TEX_HEAPS];
53 53
@@ -113,7 +113,7 @@ typedef struct drm_savage_cmdbuf {
113 unsigned int vb_size; /* size of client vertex buffer in bytes */ 113 unsigned int vb_size; /* size of client vertex buffer in bytes */
114 unsigned int vb_stride; /* stride of vertices in 32bit words */ 114 unsigned int vb_stride; /* stride of vertices in 32bit words */
115 /* boxes in client's address space */ 115 /* boxes in client's address space */
116 drm_clip_rect_t __user *box_addr; 116 struct drm_clip_rect __user *box_addr;
117 unsigned int nbox; /* number of clipping boxes */ 117 unsigned int nbox; /* number of clipping boxes */
118} drm_savage_cmdbuf_t; 118} drm_savage_cmdbuf_t;
119 119
diff --git a/drivers/char/drm/savage_drv.h b/drivers/char/drm/savage_drv.h
index 8f04b3d82292..5fd54de4280e 100644
--- a/drivers/char/drm/savage_drv.h
+++ b/drivers/char/drm/savage_drv.h
@@ -58,7 +58,7 @@ typedef struct drm_savage_buf_priv {
58 struct drm_savage_buf_priv *next; 58 struct drm_savage_buf_priv *next;
59 struct drm_savage_buf_priv *prev; 59 struct drm_savage_buf_priv *prev;
60 drm_savage_age_t age; 60 drm_savage_age_t age;
61 drm_buf_t *buf; 61 struct drm_buf *buf;
62} drm_savage_buf_priv_t; 62} drm_savage_buf_priv_t;
63 63
64typedef struct drm_savage_dma_page { 64typedef struct drm_savage_dma_page {
@@ -192,7 +192,7 @@ typedef struct drm_savage_private {
192 /* Err, there is a macro wait_event in include/linux/wait.h. 192 /* Err, there is a macro wait_event in include/linux/wait.h.
193 * Avoid unwanted macro expansion. */ 193 * Avoid unwanted macro expansion. */
194 void (*emit_clip_rect) (struct drm_savage_private * dev_priv, 194 void (*emit_clip_rect) (struct drm_savage_private * dev_priv,
195 const drm_clip_rect_t * pbox); 195 const struct drm_clip_rect * pbox);
196 void (*dma_flush) (struct drm_savage_private * dev_priv); 196 void (*dma_flush) (struct drm_savage_private * dev_priv);
197} drm_savage_private_t; 197} drm_savage_private_t;
198 198
@@ -203,22 +203,22 @@ extern int savage_bci_buffers(DRM_IOCTL_ARGS);
203/* BCI functions */ 203/* BCI functions */
204extern uint16_t savage_bci_emit_event(drm_savage_private_t * dev_priv, 204extern uint16_t savage_bci_emit_event(drm_savage_private_t * dev_priv,
205 unsigned int flags); 205 unsigned int flags);
206extern void savage_freelist_put(drm_device_t * dev, drm_buf_t * buf); 206extern void savage_freelist_put(struct drm_device * dev, struct drm_buf * buf);
207extern void savage_dma_reset(drm_savage_private_t * dev_priv); 207extern void savage_dma_reset(drm_savage_private_t * dev_priv);
208extern void savage_dma_wait(drm_savage_private_t * dev_priv, unsigned int page); 208extern void savage_dma_wait(drm_savage_private_t * dev_priv, unsigned int page);
209extern uint32_t *savage_dma_alloc(drm_savage_private_t * dev_priv, 209extern uint32_t *savage_dma_alloc(drm_savage_private_t * dev_priv,
210 unsigned int n); 210 unsigned int n);
211extern int savage_driver_load(drm_device_t *dev, unsigned long chipset); 211extern int savage_driver_load(struct drm_device *dev, unsigned long chipset);
212extern int savage_driver_firstopen(drm_device_t *dev); 212extern int savage_driver_firstopen(struct drm_device *dev);
213extern void savage_driver_lastclose(drm_device_t *dev); 213extern void savage_driver_lastclose(struct drm_device *dev);
214extern int savage_driver_unload(drm_device_t *dev); 214extern int savage_driver_unload(struct drm_device *dev);
215extern void savage_reclaim_buffers(drm_device_t * dev, DRMFILE filp); 215extern void savage_reclaim_buffers(struct drm_device * dev, DRMFILE filp);
216 216
217/* state functions */ 217/* state functions */
218extern void savage_emit_clip_rect_s3d(drm_savage_private_t * dev_priv, 218extern void savage_emit_clip_rect_s3d(drm_savage_private_t * dev_priv,
219 const drm_clip_rect_t * pbox); 219 const struct drm_clip_rect * pbox);
220extern void savage_emit_clip_rect_s4(drm_savage_private_t * dev_priv, 220extern void savage_emit_clip_rect_s4(drm_savage_private_t * dev_priv,
221 const drm_clip_rect_t * pbox); 221 const struct drm_clip_rect * pbox);
222 222
223#define SAVAGE_FB_SIZE_S3 0x01000000 /* 16MB */ 223#define SAVAGE_FB_SIZE_S3 0x01000000 /* 16MB */
224#define SAVAGE_FB_SIZE_S4 0x02000000 /* 32MB */ 224#define SAVAGE_FB_SIZE_S4 0x02000000 /* 32MB */
diff --git a/drivers/char/drm/savage_state.c b/drivers/char/drm/savage_state.c
index 1ca1e9cb5a33..77497841478a 100644
--- a/drivers/char/drm/savage_state.c
+++ b/drivers/char/drm/savage_state.c
@@ -27,7 +27,7 @@
27#include "savage_drv.h" 27#include "savage_drv.h"
28 28
29void savage_emit_clip_rect_s3d(drm_savage_private_t * dev_priv, 29void savage_emit_clip_rect_s3d(drm_savage_private_t * dev_priv,
30 const drm_clip_rect_t * pbox) 30 const struct drm_clip_rect * pbox)
31{ 31{
32 uint32_t scstart = dev_priv->state.s3d.new_scstart; 32 uint32_t scstart = dev_priv->state.s3d.new_scstart;
33 uint32_t scend = dev_priv->state.s3d.new_scend; 33 uint32_t scend = dev_priv->state.s3d.new_scend;
@@ -53,7 +53,7 @@ void savage_emit_clip_rect_s3d(drm_savage_private_t * dev_priv,
53} 53}
54 54
55void savage_emit_clip_rect_s4(drm_savage_private_t * dev_priv, 55void savage_emit_clip_rect_s4(drm_savage_private_t * dev_priv,
56 const drm_clip_rect_t * pbox) 56 const struct drm_clip_rect * pbox)
57{ 57{
58 uint32_t drawctrl0 = dev_priv->state.s4.new_drawctrl0; 58 uint32_t drawctrl0 = dev_priv->state.s4.new_drawctrl0;
59 uint32_t drawctrl1 = dev_priv->state.s4.new_drawctrl1; 59 uint32_t drawctrl1 = dev_priv->state.s4.new_drawctrl1;
@@ -277,7 +277,7 @@ static int savage_dispatch_state(drm_savage_private_t * dev_priv,
277 277
278static int savage_dispatch_dma_prim(drm_savage_private_t * dev_priv, 278static int savage_dispatch_dma_prim(drm_savage_private_t * dev_priv,
279 const drm_savage_cmd_header_t * cmd_header, 279 const drm_savage_cmd_header_t * cmd_header,
280 const drm_buf_t * dmabuf) 280 const struct drm_buf * dmabuf)
281{ 281{
282 unsigned char reorder = 0; 282 unsigned char reorder = 0;
283 unsigned int prim = cmd_header->prim.prim; 283 unsigned int prim = cmd_header->prim.prim;
@@ -536,7 +536,7 @@ static int savage_dispatch_vb_prim(drm_savage_private_t * dev_priv,
536static int savage_dispatch_dma_idx(drm_savage_private_t * dev_priv, 536static int savage_dispatch_dma_idx(drm_savage_private_t * dev_priv,
537 const drm_savage_cmd_header_t * cmd_header, 537 const drm_savage_cmd_header_t * cmd_header,
538 const uint16_t *idx, 538 const uint16_t *idx,
539 const drm_buf_t * dmabuf) 539 const struct drm_buf * dmabuf)
540{ 540{
541 unsigned char reorder = 0; 541 unsigned char reorder = 0;
542 unsigned int prim = cmd_header->idx.prim; 542 unsigned int prim = cmd_header->idx.prim;
@@ -792,7 +792,7 @@ static int savage_dispatch_clear(drm_savage_private_t * dev_priv,
792 const drm_savage_cmd_header_t * cmd_header, 792 const drm_savage_cmd_header_t * cmd_header,
793 const drm_savage_cmd_header_t *data, 793 const drm_savage_cmd_header_t *data,
794 unsigned int nbox, 794 unsigned int nbox,
795 const drm_clip_rect_t *boxes) 795 const struct drm_clip_rect *boxes)
796{ 796{
797 unsigned int flags = cmd_header->clear0.flags; 797 unsigned int flags = cmd_header->clear0.flags;
798 unsigned int clear_cmd; 798 unsigned int clear_cmd;
@@ -861,7 +861,7 @@ static int savage_dispatch_clear(drm_savage_private_t * dev_priv,
861} 861}
862 862
863static int savage_dispatch_swap(drm_savage_private_t * dev_priv, 863static int savage_dispatch_swap(drm_savage_private_t * dev_priv,
864 unsigned int nbox, const drm_clip_rect_t *boxes) 864 unsigned int nbox, const struct drm_clip_rect *boxes)
865{ 865{
866 unsigned int swap_cmd; 866 unsigned int swap_cmd;
867 unsigned int i; 867 unsigned int i;
@@ -892,11 +892,11 @@ static int savage_dispatch_swap(drm_savage_private_t * dev_priv,
892static int savage_dispatch_draw(drm_savage_private_t * dev_priv, 892static int savage_dispatch_draw(drm_savage_private_t * dev_priv,
893 const drm_savage_cmd_header_t *start, 893 const drm_savage_cmd_header_t *start,
894 const drm_savage_cmd_header_t *end, 894 const drm_savage_cmd_header_t *end,
895 const drm_buf_t * dmabuf, 895 const struct drm_buf * dmabuf,
896 const unsigned int *vtxbuf, 896 const unsigned int *vtxbuf,
897 unsigned int vb_size, unsigned int vb_stride, 897 unsigned int vb_size, unsigned int vb_stride,
898 unsigned int nbox, 898 unsigned int nbox,
899 const drm_clip_rect_t *boxes) 899 const struct drm_clip_rect *boxes)
900{ 900{
901 unsigned int i, j; 901 unsigned int i, j;
902 int ret; 902 int ret;
@@ -957,13 +957,13 @@ int savage_bci_cmdbuf(DRM_IOCTL_ARGS)
957{ 957{
958 DRM_DEVICE; 958 DRM_DEVICE;
959 drm_savage_private_t *dev_priv = dev->dev_private; 959 drm_savage_private_t *dev_priv = dev->dev_private;
960 drm_device_dma_t *dma = dev->dma; 960 struct drm_device_dma *dma = dev->dma;
961 drm_buf_t *dmabuf; 961 struct drm_buf *dmabuf;
962 drm_savage_cmdbuf_t cmdbuf; 962 drm_savage_cmdbuf_t cmdbuf;
963 drm_savage_cmd_header_t *kcmd_addr = NULL; 963 drm_savage_cmd_header_t *kcmd_addr = NULL;
964 drm_savage_cmd_header_t *first_draw_cmd; 964 drm_savage_cmd_header_t *first_draw_cmd;
965 unsigned int *kvb_addr = NULL; 965 unsigned int *kvb_addr = NULL;
966 drm_clip_rect_t *kbox_addr = NULL; 966 struct drm_clip_rect *kbox_addr = NULL;
967 unsigned int i, j; 967 unsigned int i, j;
968 int ret = 0; 968 int ret = 0;
969 969
@@ -1019,7 +1019,7 @@ int savage_bci_cmdbuf(DRM_IOCTL_ARGS)
1019 cmdbuf.vb_addr = kvb_addr; 1019 cmdbuf.vb_addr = kvb_addr;
1020 } 1020 }
1021 if (cmdbuf.nbox) { 1021 if (cmdbuf.nbox) {
1022 kbox_addr = drm_alloc(cmdbuf.nbox * sizeof(drm_clip_rect_t), 1022 kbox_addr = drm_alloc(cmdbuf.nbox * sizeof(struct drm_clip_rect),
1023 DRM_MEM_DRIVER); 1023 DRM_MEM_DRIVER);
1024 if (kbox_addr == NULL) { 1024 if (kbox_addr == NULL) {
1025 ret = DRM_ERR(ENOMEM); 1025 ret = DRM_ERR(ENOMEM);
@@ -1027,7 +1027,7 @@ int savage_bci_cmdbuf(DRM_IOCTL_ARGS)
1027 } 1027 }
1028 1028
1029 if (DRM_COPY_FROM_USER(kbox_addr, cmdbuf.box_addr, 1029 if (DRM_COPY_FROM_USER(kbox_addr, cmdbuf.box_addr,
1030 cmdbuf.nbox * sizeof(drm_clip_rect_t))) { 1030 cmdbuf.nbox * sizeof(struct drm_clip_rect))) {
1031 ret = DRM_ERR(EFAULT); 1031 ret = DRM_ERR(EFAULT);
1032 goto done; 1032 goto done;
1033 } 1033 }
@@ -1158,7 +1158,7 @@ done:
1158 /* If we didn't need to allocate them, these'll be NULL */ 1158 /* If we didn't need to allocate them, these'll be NULL */
1159 drm_free(kcmd_addr, cmdbuf.size * 8, DRM_MEM_DRIVER); 1159 drm_free(kcmd_addr, cmdbuf.size * 8, DRM_MEM_DRIVER);
1160 drm_free(kvb_addr, cmdbuf.vb_size, DRM_MEM_DRIVER); 1160 drm_free(kvb_addr, cmdbuf.vb_size, DRM_MEM_DRIVER);
1161 drm_free(kbox_addr, cmdbuf.nbox * sizeof(drm_clip_rect_t), 1161 drm_free(kbox_addr, cmdbuf.nbox * sizeof(struct drm_clip_rect),
1162 DRM_MEM_DRIVER); 1162 DRM_MEM_DRIVER);
1163 1163
1164 return ret; 1164 return ret;
diff --git a/drivers/char/drm/sis_drv.c b/drivers/char/drm/sis_drv.c
index 690e0af8e7c2..1912f5857051 100644
--- a/drivers/char/drm/sis_drv.c
+++ b/drivers/char/drm/sis_drv.c
@@ -35,7 +35,7 @@ static struct pci_device_id pciidlist[] = {
35 sisdrv_PCI_IDS 35 sisdrv_PCI_IDS
36}; 36};
37 37
38static int sis_driver_load(drm_device_t *dev, unsigned long chipset) 38static int sis_driver_load(struct drm_device *dev, unsigned long chipset)
39{ 39{
40 drm_sis_private_t *dev_priv; 40 drm_sis_private_t *dev_priv;
41 int ret; 41 int ret;
@@ -54,7 +54,7 @@ static int sis_driver_load(drm_device_t *dev, unsigned long chipset)
54 return ret; 54 return ret;
55} 55}
56 56
57static int sis_driver_unload(drm_device_t *dev) 57static int sis_driver_unload(struct drm_device *dev)
58{ 58{
59 drm_sis_private_t *dev_priv = dev->dev_private; 59 drm_sis_private_t *dev_priv = dev->dev_private;
60 60
diff --git a/drivers/char/drm/sis_drv.h b/drivers/char/drm/sis_drv.h
index 70d4ede75fe8..5630df874353 100644
--- a/drivers/char/drm/sis_drv.h
+++ b/drivers/char/drm/sis_drv.h
@@ -46,6 +46,7 @@ enum sis_family {
46 46
47#include "drm_sman.h" 47#include "drm_sman.h"
48 48
49
49#define SIS_BASE (dev_priv->mmio) 50#define SIS_BASE (dev_priv->mmio)
50#define SIS_READ(reg) DRM_READ32(SIS_BASE, reg); 51#define SIS_READ(reg) DRM_READ32(SIS_BASE, reg);
51#define SIS_WRITE(reg, val) DRM_WRITE32(SIS_BASE, reg, val); 52#define SIS_WRITE(reg, val) DRM_WRITE32(SIS_BASE, reg, val);
@@ -53,7 +54,7 @@ enum sis_family {
53typedef struct drm_sis_private { 54typedef struct drm_sis_private {
54 drm_local_map_t *mmio; 55 drm_local_map_t *mmio;
55 unsigned int idle_fault; 56 unsigned int idle_fault;
56 drm_sman_t sman; 57 struct drm_sman sman;
57 unsigned int chipset; 58 unsigned int chipset;
58 int vram_initialized; 59 int vram_initialized;
59 int agp_initialized; 60 int agp_initialized;
@@ -61,9 +62,9 @@ typedef struct drm_sis_private {
61 unsigned long agp_offset; 62 unsigned long agp_offset;
62} drm_sis_private_t; 63} drm_sis_private_t;
63 64
64extern int sis_idle(drm_device_t *dev); 65extern int sis_idle(struct drm_device *dev);
65extern void sis_reclaim_buffers_locked(drm_device_t *dev, struct file *filp); 66extern void sis_reclaim_buffers_locked(struct drm_device *dev, struct file *filp);
66extern void sis_lastclose(drm_device_t *dev); 67extern void sis_lastclose(struct drm_device *dev);
67 68
68extern drm_ioctl_desc_t sis_ioctls[]; 69extern drm_ioctl_desc_t sis_ioctls[];
69extern int sis_max_ioctl; 70extern int sis_max_ioctl;
diff --git a/drivers/char/drm/sis_mm.c b/drivers/char/drm/sis_mm.c
index d26f5dbb7853..0580fa33cb77 100644
--- a/drivers/char/drm/sis_mm.c
+++ b/drivers/char/drm/sis_mm.c
@@ -123,14 +123,14 @@ static int sis_fb_init(DRM_IOCTL_ARGS)
123 return 0; 123 return 0;
124} 124}
125 125
126static int sis_drm_alloc(drm_device_t * dev, drm_file_t * priv, 126static int sis_drm_alloc(struct drm_device *dev, struct drm_file * priv,
127 unsigned long data, int pool) 127 unsigned long data, int pool)
128{ 128{
129 drm_sis_private_t *dev_priv = dev->dev_private; 129 drm_sis_private_t *dev_priv = dev->dev_private;
130 drm_sis_mem_t __user *argp = (drm_sis_mem_t __user *) data; 130 drm_sis_mem_t __user *argp = (drm_sis_mem_t __user *) data;
131 drm_sis_mem_t mem; 131 drm_sis_mem_t mem;
132 int retval = 0; 132 int retval = 0;
133 drm_memblock_item_t *item; 133 struct drm_memblock_item *item;
134 134
135 DRM_COPY_FROM_USER_IOCTL(mem, argp, sizeof(mem)); 135 DRM_COPY_FROM_USER_IOCTL(mem, argp, sizeof(mem));
136 136
@@ -229,12 +229,12 @@ static int sis_ioctl_agp_alloc(DRM_IOCTL_ARGS)
229 return sis_drm_alloc(dev, priv, data, AGP_TYPE); 229 return sis_drm_alloc(dev, priv, data, AGP_TYPE);
230} 230}
231 231
232static drm_local_map_t *sis_reg_init(drm_device_t *dev) 232static drm_local_map_t *sis_reg_init(struct drm_device *dev)
233{ 233{
234 drm_map_list_t *entry; 234 struct drm_map_list *entry;
235 drm_local_map_t *map; 235 drm_local_map_t *map;
236 236
237 list_for_each_entry(entry, &dev->maplist->head, head) { 237 list_for_each_entry(entry, &dev->maplist, head) {
238 map = entry->map; 238 map = entry->map;
239 if (!map) 239 if (!map)
240 continue; 240 continue;
@@ -245,7 +245,7 @@ static drm_local_map_t *sis_reg_init(drm_device_t *dev)
245 return NULL; 245 return NULL;
246} 246}
247 247
248int sis_idle(drm_device_t *dev) 248int sis_idle(struct drm_device *dev)
249{ 249{
250 drm_sis_private_t *dev_priv = dev->dev_private; 250 drm_sis_private_t *dev_priv = dev->dev_private;
251 uint32_t idle_reg; 251 uint32_t idle_reg;
@@ -314,10 +314,10 @@ void sis_lastclose(struct drm_device *dev)
314 mutex_unlock(&dev->struct_mutex); 314 mutex_unlock(&dev->struct_mutex);
315} 315}
316 316
317void sis_reclaim_buffers_locked(drm_device_t * dev, struct file *filp) 317void sis_reclaim_buffers_locked(struct drm_device * dev, struct file *filp)
318{ 318{
319 drm_sis_private_t *dev_priv = dev->dev_private; 319 drm_sis_private_t *dev_priv = dev->dev_private;
320 drm_file_t *priv = filp->private_data; 320 struct drm_file *priv = filp->private_data;
321 321
322 mutex_lock(&dev->struct_mutex); 322 mutex_lock(&dev->struct_mutex);
323 if (drm_sman_owner_clean(&dev_priv->sman, (unsigned long)priv)) { 323 if (drm_sman_owner_clean(&dev_priv->sman, (unsigned long)priv)) {
diff --git a/drivers/char/drm/via_dma.c b/drivers/char/drm/via_dma.c
index 13a9c5ca4593..7ff2b623c2d4 100644
--- a/drivers/char/drm/via_dma.c
+++ b/drivers/char/drm/via_dma.c
@@ -151,7 +151,7 @@ static inline uint32_t *via_check_dma(drm_via_private_t * dev_priv,
151 return (uint32_t *) (dev_priv->dma_ptr + dev_priv->dma_low); 151 return (uint32_t *) (dev_priv->dma_ptr + dev_priv->dma_low);
152} 152}
153 153
154int via_dma_cleanup(drm_device_t * dev) 154int via_dma_cleanup(struct drm_device * dev)
155{ 155{
156 if (dev->dev_private) { 156 if (dev->dev_private) {
157 drm_via_private_t *dev_priv = 157 drm_via_private_t *dev_priv =
@@ -169,7 +169,7 @@ int via_dma_cleanup(drm_device_t * dev)
169 return 0; 169 return 0;
170} 170}
171 171
172static int via_initialize(drm_device_t * dev, 172static int via_initialize(struct drm_device * dev,
173 drm_via_private_t * dev_priv, 173 drm_via_private_t * dev_priv,
174 drm_via_dma_init_t * init) 174 drm_via_dma_init_t * init)
175{ 175{
@@ -262,7 +262,7 @@ static int via_dma_init(DRM_IOCTL_ARGS)
262 return retcode; 262 return retcode;
263} 263}
264 264
265static int via_dispatch_cmdbuffer(drm_device_t * dev, drm_via_cmdbuffer_t * cmd) 265static int via_dispatch_cmdbuffer(struct drm_device * dev, drm_via_cmdbuffer_t * cmd)
266{ 266{
267 drm_via_private_t *dev_priv; 267 drm_via_private_t *dev_priv;
268 uint32_t *vb; 268 uint32_t *vb;
@@ -316,7 +316,7 @@ static int via_dispatch_cmdbuffer(drm_device_t * dev, drm_via_cmdbuffer_t * cmd)
316 return 0; 316 return 0;
317} 317}
318 318
319int via_driver_dma_quiescent(drm_device_t * dev) 319int via_driver_dma_quiescent(struct drm_device * dev)
320{ 320{
321 drm_via_private_t *dev_priv = dev->dev_private; 321 drm_via_private_t *dev_priv = dev->dev_private;
322 322
@@ -356,7 +356,7 @@ static int via_cmdbuffer(DRM_IOCTL_ARGS)
356 return 0; 356 return 0;
357} 357}
358 358
359static int via_dispatch_pci_cmdbuffer(drm_device_t * dev, 359static int via_dispatch_pci_cmdbuffer(struct drm_device * dev,
360 drm_via_cmdbuffer_t * cmd) 360 drm_via_cmdbuffer_t * cmd)
361{ 361{
362 drm_via_private_t *dev_priv = dev->dev_private; 362 drm_via_private_t *dev_priv = dev->dev_private;
diff --git a/drivers/char/drm/via_dmablit.c b/drivers/char/drm/via_dmablit.c
index 2881a06b6f55..fdb8609dd76f 100644
--- a/drivers/char/drm/via_dmablit.c
+++ b/drivers/char/drm/via_dmablit.c
@@ -207,7 +207,7 @@ via_free_sg_info(struct pci_dev *pdev, drm_via_sg_info_t *vsg)
207 */ 207 */
208 208
209static void 209static void
210via_fire_dmablit(drm_device_t *dev, drm_via_sg_info_t *vsg, int engine) 210via_fire_dmablit(struct drm_device *dev, drm_via_sg_info_t *vsg, int engine)
211{ 211{
212 drm_via_private_t *dev_priv = (drm_via_private_t *)dev->dev_private; 212 drm_via_private_t *dev_priv = (drm_via_private_t *)dev->dev_private;
213 213
@@ -289,7 +289,7 @@ via_alloc_desc_pages(drm_via_sg_info_t *vsg)
289} 289}
290 290
291static void 291static void
292via_abort_dmablit(drm_device_t *dev, int engine) 292via_abort_dmablit(struct drm_device *dev, int engine)
293{ 293{
294 drm_via_private_t *dev_priv = (drm_via_private_t *)dev->dev_private; 294 drm_via_private_t *dev_priv = (drm_via_private_t *)dev->dev_private;
295 295
@@ -297,7 +297,7 @@ via_abort_dmablit(drm_device_t *dev, int engine)
297} 297}
298 298
299static void 299static void
300via_dmablit_engine_off(drm_device_t *dev, int engine) 300via_dmablit_engine_off(struct drm_device *dev, int engine)
301{ 301{
302 drm_via_private_t *dev_priv = (drm_via_private_t *)dev->dev_private; 302 drm_via_private_t *dev_priv = (drm_via_private_t *)dev->dev_private;
303 303
@@ -314,7 +314,7 @@ via_dmablit_engine_off(drm_device_t *dev, int engine)
314 */ 314 */
315 315
316void 316void
317via_dmablit_handler(drm_device_t *dev, int engine, int from_irq) 317via_dmablit_handler(struct drm_device *dev, int engine, int from_irq)
318{ 318{
319 drm_via_private_t *dev_priv = (drm_via_private_t *)dev->dev_private; 319 drm_via_private_t *dev_priv = (drm_via_private_t *)dev->dev_private;
320 drm_via_blitq_t *blitq = dev_priv->blit_queues + engine; 320 drm_via_blitq_t *blitq = dev_priv->blit_queues + engine;
@@ -433,7 +433,7 @@ via_dmablit_active(drm_via_blitq_t *blitq, int engine, uint32_t handle, wait_que
433 */ 433 */
434 434
435static int 435static int
436via_dmablit_sync(drm_device_t *dev, uint32_t handle, int engine) 436via_dmablit_sync(struct drm_device *dev, uint32_t handle, int engine)
437{ 437{
438 438
439 drm_via_private_t *dev_priv = (drm_via_private_t *)dev->dev_private; 439 drm_via_private_t *dev_priv = (drm_via_private_t *)dev->dev_private;
@@ -466,7 +466,7 @@ static void
466via_dmablit_timer(unsigned long data) 466via_dmablit_timer(unsigned long data)
467{ 467{
468 drm_via_blitq_t *blitq = (drm_via_blitq_t *) data; 468 drm_via_blitq_t *blitq = (drm_via_blitq_t *) data;
469 drm_device_t *dev = blitq->dev; 469 struct drm_device *dev = blitq->dev;
470 int engine = (int) 470 int engine = (int)
471 (blitq - ((drm_via_private_t *)dev->dev_private)->blit_queues); 471 (blitq - ((drm_via_private_t *)dev->dev_private)->blit_queues);
472 472
@@ -502,7 +502,7 @@ static void
502via_dmablit_workqueue(struct work_struct *work) 502via_dmablit_workqueue(struct work_struct *work)
503{ 503{
504 drm_via_blitq_t *blitq = container_of(work, drm_via_blitq_t, wq); 504 drm_via_blitq_t *blitq = container_of(work, drm_via_blitq_t, wq);
505 drm_device_t *dev = blitq->dev; 505 struct drm_device *dev = blitq->dev;
506 unsigned long irqsave; 506 unsigned long irqsave;
507 drm_via_sg_info_t *cur_sg; 507 drm_via_sg_info_t *cur_sg;
508 int cur_released; 508 int cur_released;
@@ -545,7 +545,7 @@ via_dmablit_workqueue(struct work_struct *work)
545 545
546 546
547void 547void
548via_init_dmablit(drm_device_t *dev) 548via_init_dmablit(struct drm_device *dev)
549{ 549{
550 int i,j; 550 int i,j;
551 drm_via_private_t *dev_priv = (drm_via_private_t *)dev->dev_private; 551 drm_via_private_t *dev_priv = (drm_via_private_t *)dev->dev_private;
@@ -582,7 +582,7 @@ via_init_dmablit(drm_device_t *dev)
582 582
583 583
584static int 584static int
585via_build_sg_info(drm_device_t *dev, drm_via_sg_info_t *vsg, drm_via_dmablit_t *xfer) 585via_build_sg_info(struct drm_device *dev, drm_via_sg_info_t *vsg, drm_via_dmablit_t *xfer)
586{ 586{
587 int draw = xfer->to_fb; 587 int draw = xfer->to_fb;
588 int ret = 0; 588 int ret = 0;
@@ -730,7 +730,7 @@ via_dmablit_release_slot(drm_via_blitq_t *blitq)
730 730
731 731
732static int 732static int
733via_dmablit(drm_device_t *dev, drm_via_dmablit_t *xfer) 733via_dmablit(struct drm_device *dev, drm_via_dmablit_t *xfer)
734{ 734{
735 drm_via_private_t *dev_priv = (drm_via_private_t *)dev->dev_private; 735 drm_via_private_t *dev_priv = (drm_via_private_t *)dev->dev_private;
736 drm_via_sg_info_t *vsg; 736 drm_via_sg_info_t *vsg;
diff --git a/drivers/char/drm/via_dmablit.h b/drivers/char/drm/via_dmablit.h
index f4036cd5d0e0..6f6a513d5147 100644
--- a/drivers/char/drm/via_dmablit.h
+++ b/drivers/char/drm/via_dmablit.h
@@ -59,7 +59,7 @@ typedef struct _drm_via_sg_info {
59} drm_via_sg_info_t; 59} drm_via_sg_info_t;
60 60
61typedef struct _drm_via_blitq { 61typedef struct _drm_via_blitq {
62 drm_device_t *dev; 62 struct drm_device *dev;
63 uint32_t cur_blit_handle; 63 uint32_t cur_blit_handle;
64 uint32_t done_blit_handle; 64 uint32_t done_blit_handle;
65 unsigned serviced; 65 unsigned serviced;
diff --git a/drivers/char/drm/via_drm.h b/drivers/char/drm/via_drm.h
index e4ee97d7156f..8f53c76062e9 100644
--- a/drivers/char/drm/via_drm.h
+++ b/drivers/char/drm/via_drm.h
@@ -40,7 +40,7 @@
40#define VIA_NR_XVMC_LOCKS 5 40#define VIA_NR_XVMC_LOCKS 5
41#define VIA_MAX_CACHELINE_SIZE 64 41#define VIA_MAX_CACHELINE_SIZE 64
42#define XVMCLOCKPTR(saPriv,lockNo) \ 42#define XVMCLOCKPTR(saPriv,lockNo) \
43 ((volatile drm_hw_lock_t *)(((((unsigned long) (saPriv)->XvMCLockArea) + \ 43 ((volatile struct drm_hw_lock *)(((((unsigned long) (saPriv)->XvMCLockArea) + \
44 (VIA_MAX_CACHELINE_SIZE - 1)) & \ 44 (VIA_MAX_CACHELINE_SIZE - 1)) & \
45 ~(VIA_MAX_CACHELINE_SIZE - 1)) + \ 45 ~(VIA_MAX_CACHELINE_SIZE - 1)) + \
46 VIA_MAX_CACHELINE_SIZE*(lockNo))) 46 VIA_MAX_CACHELINE_SIZE*(lockNo)))
@@ -182,7 +182,7 @@ typedef struct _drm_via_tex_region {
182typedef struct _drm_via_sarea { 182typedef struct _drm_via_sarea {
183 unsigned int dirty; 183 unsigned int dirty;
184 unsigned int nbox; 184 unsigned int nbox;
185 drm_clip_rect_t boxes[VIA_NR_SAREA_CLIPRECTS]; 185 struct drm_clip_rect boxes[VIA_NR_SAREA_CLIPRECTS];
186 drm_via_tex_region_t texList[VIA_NR_TEX_REGIONS + 1]; 186 drm_via_tex_region_t texList[VIA_NR_TEX_REGIONS + 1];
187 int texAge; /* last time texture was uploaded */ 187 int texAge; /* last time texture was uploaded */
188 int ctxOwner; /* last context to upload state */ 188 int ctxOwner; /* last context to upload state */
diff --git a/drivers/char/drm/via_drv.h b/drivers/char/drm/via_drv.h
index b46ca8e6306d..576711564a11 100644
--- a/drivers/char/drm/via_drv.h
+++ b/drivers/char/drm/via_drv.h
@@ -87,7 +87,7 @@ typedef struct drm_via_private {
87 uint32_t irq_pending_mask; 87 uint32_t irq_pending_mask;
88 int *irq_map; 88 int *irq_map;
89 unsigned int idle_fault; 89 unsigned int idle_fault;
90 drm_sman_t sman; 90 struct drm_sman sman;
91 int vram_initialized; 91 int vram_initialized;
92 int agp_initialized; 92 int agp_initialized;
93 unsigned long vram_offset; 93 unsigned long vram_offset;
@@ -123,31 +123,31 @@ extern int via_wait_irq(DRM_IOCTL_ARGS);
123extern int via_dma_blit_sync( DRM_IOCTL_ARGS ); 123extern int via_dma_blit_sync( DRM_IOCTL_ARGS );
124extern int via_dma_blit( DRM_IOCTL_ARGS ); 124extern int via_dma_blit( DRM_IOCTL_ARGS );
125 125
126extern int via_driver_load(drm_device_t *dev, unsigned long chipset); 126extern int via_driver_load(struct drm_device *dev, unsigned long chipset);
127extern int via_driver_unload(drm_device_t *dev); 127extern int via_driver_unload(struct drm_device *dev);
128 128
129extern int via_init_context(drm_device_t * dev, int context); 129extern int via_init_context(struct drm_device * dev, int context);
130extern int via_final_context(drm_device_t * dev, int context); 130extern int via_final_context(struct drm_device * dev, int context);
131 131
132extern int via_do_cleanup_map(drm_device_t * dev); 132extern int via_do_cleanup_map(struct drm_device * dev);
133extern int via_driver_vblank_wait(drm_device_t * dev, unsigned int *sequence); 133extern int via_driver_vblank_wait(struct drm_device * dev, unsigned int *sequence);
134 134
135extern irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS); 135extern irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS);
136extern void via_driver_irq_preinstall(drm_device_t * dev); 136extern void via_driver_irq_preinstall(struct drm_device * dev);
137extern void via_driver_irq_postinstall(drm_device_t * dev); 137extern void via_driver_irq_postinstall(struct drm_device * dev);
138extern void via_driver_irq_uninstall(drm_device_t * dev); 138extern void via_driver_irq_uninstall(struct drm_device * dev);
139 139
140extern int via_dma_cleanup(drm_device_t * dev); 140extern int via_dma_cleanup(struct drm_device * dev);
141extern void via_init_command_verifier(void); 141extern void via_init_command_verifier(void);
142extern int via_driver_dma_quiescent(drm_device_t * dev); 142extern int via_driver_dma_quiescent(struct drm_device * dev);
143extern void via_init_futex(drm_via_private_t * dev_priv); 143extern void via_init_futex(drm_via_private_t * dev_priv);
144extern void via_cleanup_futex(drm_via_private_t * dev_priv); 144extern void via_cleanup_futex(drm_via_private_t * dev_priv);
145extern void via_release_futex(drm_via_private_t * dev_priv, int context); 145extern void via_release_futex(drm_via_private_t * dev_priv, int context);
146 146
147extern void via_reclaim_buffers_locked(drm_device_t *dev, struct file *filp); 147extern void via_reclaim_buffers_locked(struct drm_device *dev, struct file *filp);
148extern void via_lastclose(drm_device_t *dev); 148extern void via_lastclose(struct drm_device *dev);
149 149
150extern void via_dmablit_handler(drm_device_t *dev, int engine, int from_irq); 150extern void via_dmablit_handler(struct drm_device *dev, int engine, int from_irq);
151extern void via_init_dmablit(drm_device_t *dev); 151extern void via_init_dmablit(struct drm_device *dev);
152 152
153#endif 153#endif
diff --git a/drivers/char/drm/via_irq.c b/drivers/char/drm/via_irq.c
index 1ac5941ad237..8dc99b5fbab6 100644
--- a/drivers/char/drm/via_irq.c
+++ b/drivers/char/drm/via_irq.c
@@ -98,7 +98,7 @@ static unsigned time_diff(struct timeval *now, struct timeval *then)
98 98
99irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS) 99irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS)
100{ 100{
101 drm_device_t *dev = (drm_device_t *) arg; 101 struct drm_device *dev = (struct drm_device *) arg;
102 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; 102 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
103 u32 status; 103 u32 status;
104 int handled = 0; 104 int handled = 0;
@@ -163,7 +163,7 @@ static __inline__ void viadrv_acknowledge_irqs(drm_via_private_t * dev_priv)
163 } 163 }
164} 164}
165 165
166int via_driver_vblank_wait(drm_device_t * dev, unsigned int *sequence) 166int via_driver_vblank_wait(struct drm_device * dev, unsigned int *sequence)
167{ 167{
168 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; 168 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
169 unsigned int cur_vblank; 169 unsigned int cur_vblank;
@@ -191,7 +191,7 @@ int via_driver_vblank_wait(drm_device_t * dev, unsigned int *sequence)
191} 191}
192 192
193static int 193static int
194via_driver_irq_wait(drm_device_t * dev, unsigned int irq, int force_sequence, 194via_driver_irq_wait(struct drm_device * dev, unsigned int irq, int force_sequence,
195 unsigned int *sequence) 195 unsigned int *sequence)
196{ 196{
197 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; 197 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
@@ -244,7 +244,7 @@ via_driver_irq_wait(drm_device_t * dev, unsigned int irq, int force_sequence,
244 * drm_dma.h hooks 244 * drm_dma.h hooks
245 */ 245 */
246 246
247void via_driver_irq_preinstall(drm_device_t * dev) 247void via_driver_irq_preinstall(struct drm_device * dev)
248{ 248{
249 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; 249 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
250 u32 status; 250 u32 status;
@@ -293,7 +293,7 @@ void via_driver_irq_preinstall(drm_device_t * dev)
293 } 293 }
294} 294}
295 295
296void via_driver_irq_postinstall(drm_device_t * dev) 296void via_driver_irq_postinstall(struct drm_device * dev)
297{ 297{
298 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; 298 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
299 u32 status; 299 u32 status;
@@ -312,7 +312,7 @@ void via_driver_irq_postinstall(drm_device_t * dev)
312 } 312 }
313} 313}
314 314
315void via_driver_irq_uninstall(drm_device_t * dev) 315void via_driver_irq_uninstall(struct drm_device * dev)
316{ 316{
317 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; 317 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
318 u32 status; 318 u32 status;
diff --git a/drivers/char/drm/via_map.c b/drivers/char/drm/via_map.c
index 4e3fc072aa3b..7fb9d2a2cce2 100644
--- a/drivers/char/drm/via_map.c
+++ b/drivers/char/drm/via_map.c
@@ -25,13 +25,13 @@
25#include "via_drm.h" 25#include "via_drm.h"
26#include "via_drv.h" 26#include "via_drv.h"
27 27
28static int via_do_init_map(drm_device_t * dev, drm_via_init_t * init) 28static int via_do_init_map(struct drm_device * dev, drm_via_init_t * init)
29{ 29{
30 drm_via_private_t *dev_priv = dev->dev_private; 30 drm_via_private_t *dev_priv = dev->dev_private;
31 31
32 DRM_DEBUG("%s\n", __FUNCTION__); 32 DRM_DEBUG("%s\n", __FUNCTION__);
33 33
34 DRM_GETSAREA(); 34 dev_priv->sarea = drm_getsarea(dev);
35 if (!dev_priv->sarea) { 35 if (!dev_priv->sarea) {
36 DRM_ERROR("could not find sarea!\n"); 36 DRM_ERROR("could not find sarea!\n");
37 dev->dev_private = (void *)dev_priv; 37 dev->dev_private = (void *)dev_priv;
@@ -68,7 +68,7 @@ static int via_do_init_map(drm_device_t * dev, drm_via_init_t * init)
68 return 0; 68 return 0;
69} 69}
70 70
71int via_do_cleanup_map(drm_device_t * dev) 71int via_do_cleanup_map(struct drm_device * dev)
72{ 72{
73 via_dma_cleanup(dev); 73 via_dma_cleanup(dev);
74 74
@@ -95,7 +95,7 @@ int via_map_init(DRM_IOCTL_ARGS)
95 return -EINVAL; 95 return -EINVAL;
96} 96}
97 97
98int via_driver_load(drm_device_t *dev, unsigned long chipset) 98int via_driver_load(struct drm_device *dev, unsigned long chipset)
99{ 99{
100 drm_via_private_t *dev_priv; 100 drm_via_private_t *dev_priv;
101 int ret = 0; 101 int ret = 0;
@@ -115,7 +115,7 @@ int via_driver_load(drm_device_t *dev, unsigned long chipset)
115 return ret; 115 return ret;
116} 116}
117 117
118int via_driver_unload(drm_device_t *dev) 118int via_driver_unload(struct drm_device *dev)
119{ 119{
120 drm_via_private_t *dev_priv = dev->dev_private; 120 drm_via_private_t *dev_priv = dev->dev_private;
121 121
diff --git a/drivers/char/drm/via_mm.c b/drivers/char/drm/via_mm.c
index 2fcf0577a7aa..85d56acd9d82 100644
--- a/drivers/char/drm/via_mm.c
+++ b/drivers/char/drm/via_mm.c
@@ -127,7 +127,7 @@ int via_mem_alloc(DRM_IOCTL_ARGS)
127 127
128 drm_via_mem_t mem; 128 drm_via_mem_t mem;
129 int retval = 0; 129 int retval = 0;
130 drm_memblock_item_t *item; 130 struct drm_memblock_item *item;
131 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; 131 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
132 unsigned long tmpSize; 132 unsigned long tmpSize;
133 133
@@ -188,10 +188,10 @@ int via_mem_free(DRM_IOCTL_ARGS)
188} 188}
189 189
190 190
191void via_reclaim_buffers_locked(drm_device_t * dev, struct file *filp) 191void via_reclaim_buffers_locked(struct drm_device * dev, struct file *filp)
192{ 192{
193 drm_via_private_t *dev_priv = dev->dev_private; 193 drm_via_private_t *dev_priv = dev->dev_private;
194 drm_file_t *priv = filp->private_data; 194 struct drm_file *priv = filp->private_data;
195 195
196 mutex_lock(&dev->struct_mutex); 196 mutex_lock(&dev->struct_mutex);
197 if (drm_sman_owner_clean(&dev_priv->sman, (unsigned long)priv)) { 197 if (drm_sman_owner_clean(&dev_priv->sman, (unsigned long)priv)) {
diff --git a/drivers/char/drm/via_verifier.c b/drivers/char/drm/via_verifier.c
index 2e7e08078287..832d48356e91 100644
--- a/drivers/char/drm/via_verifier.c
+++ b/drivers/char/drm/via_verifier.c
@@ -252,10 +252,9 @@ eat_words(const uint32_t ** buf, const uint32_t * buf_end, unsigned num_words)
252static __inline__ drm_local_map_t *via_drm_lookup_agp_map(drm_via_state_t *seq, 252static __inline__ drm_local_map_t *via_drm_lookup_agp_map(drm_via_state_t *seq,
253 unsigned long offset, 253 unsigned long offset,
254 unsigned long size, 254 unsigned long size,
255 drm_device_t * dev) 255 struct drm_device * dev)
256{ 256{
257 struct list_head *list; 257 struct drm_map_list *r_list;
258 drm_map_list_t *r_list;
259 drm_local_map_t *map = seq->map_cache; 258 drm_local_map_t *map = seq->map_cache;
260 259
261 if (map && map->offset <= offset 260 if (map && map->offset <= offset
@@ -263,8 +262,7 @@ static __inline__ drm_local_map_t *via_drm_lookup_agp_map(drm_via_state_t *seq,
263 return map; 262 return map;
264 } 263 }
265 264
266 list_for_each(list, &dev->maplist->head) { 265 list_for_each_entry(r_list, &dev->maplist, head) {
267 r_list = (drm_map_list_t *) list;
268 map = r_list->map; 266 map = r_list->map;
269 if (!map) 267 if (!map)
270 continue; 268 continue;
@@ -964,7 +962,7 @@ via_parse_vheader6(drm_via_private_t * dev_priv, uint32_t const **buffer,
964 962
965int 963int
966via_verify_command_stream(const uint32_t * buf, unsigned int size, 964via_verify_command_stream(const uint32_t * buf, unsigned int size,
967 drm_device_t * dev, int agp) 965 struct drm_device * dev, int agp)
968{ 966{
969 967
970 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; 968 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
@@ -1039,7 +1037,7 @@ via_verify_command_stream(const uint32_t * buf, unsigned int size,
1039} 1037}
1040 1038
1041int 1039int
1042via_parse_command_stream(drm_device_t * dev, const uint32_t * buf, 1040via_parse_command_stream(struct drm_device * dev, const uint32_t * buf,
1043 unsigned int size) 1041 unsigned int size)
1044{ 1042{
1045 1043
diff --git a/drivers/char/drm/via_verifier.h b/drivers/char/drm/via_verifier.h
index b77f59df0278..28b50296a7bd 100644
--- a/drivers/char/drm/via_verifier.h
+++ b/drivers/char/drm/via_verifier.h
@@ -47,7 +47,7 @@ typedef struct {
47 drm_via_sequence_t unfinished; 47 drm_via_sequence_t unfinished;
48 int agp_texture; 48 int agp_texture;
49 int multitex; 49 int multitex;
50 drm_device_t *dev; 50 struct drm_device *dev;
51 drm_local_map_t *map_cache; 51 drm_local_map_t *map_cache;
52 uint32_t vertex_count; 52 uint32_t vertex_count;
53 int agp; 53 int agp;
@@ -55,8 +55,8 @@ typedef struct {
55} drm_via_state_t; 55} drm_via_state_t;
56 56
57extern int via_verify_command_stream(const uint32_t * buf, unsigned int size, 57extern int via_verify_command_stream(const uint32_t * buf, unsigned int size,
58 drm_device_t * dev, int agp); 58 struct drm_device * dev, int agp);
59extern int via_parse_command_stream(drm_device_t *dev, const uint32_t *buf, 59extern int via_parse_command_stream(struct drm_device *dev, const uint32_t *buf,
60 unsigned int size); 60 unsigned int size);
61 61
62#endif 62#endif