aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/drm_bufs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/drm/drm_bufs.c')
-rw-r--r--drivers/char/drm/drm_bufs.c209
1 files changed, 101 insertions, 108 deletions
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) {