aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/drm_bufs.c37
-rw-r--r--drivers/gpu/drm/drm_proc.c4
-rw-r--r--drivers/gpu/drm/drm_vm.c22
-rw-r--r--drivers/gpu/drm/mga/mga_dma.c17
-rw-r--r--drivers/gpu/drm/mga/mga_drv.h4
-rw-r--r--drivers/gpu/drm/r128/r128_cce.c7
-rw-r--r--drivers/gpu/drm/radeon/radeon_cp.c9
-rw-r--r--include/drm/drmP.h12
8 files changed, 68 insertions, 44 deletions
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index 1b8dbd5961bc..cddea1a2472c 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -54,11 +54,29 @@ static struct drm_map_list *drm_find_matching_map(struct drm_device *dev,
54{ 54{
55 struct drm_map_list *entry; 55 struct drm_map_list *entry;
56 list_for_each_entry(entry, &dev->maplist, head) { 56 list_for_each_entry(entry, &dev->maplist, head) {
57 if (entry->map && (entry->master == dev->primary->master) && (map->type == entry->map->type) && 57 /*
58 ((entry->map->offset == map->offset) || 58 * Because the kernel-userspace ABI is fixed at a 32-bit offset
59 ((map->type == _DRM_SHM) && (map->flags&_DRM_CONTAINS_LOCK)))) { 59 * while PCI resources may live above that, we ignore the map
60 * offset for maps of type _DRM_FRAMEBUFFER or _DRM_REGISTERS.
61 * It is assumed that each driver will have only one resource of
62 * each type.
63 */
64 if (!entry->map ||
65 map->type != entry->map->type ||
66 entry->master != dev->primary->master)
67 continue;
68 switch (map->type) {
69 case _DRM_SHM:
70 if (map->flags != _DRM_CONTAINS_LOCK)
71 break;
72 case _DRM_REGISTERS:
73 case _DRM_FRAME_BUFFER:
60 return entry; 74 return entry;
75 default: /* Make gcc happy */
76 ;
61 } 77 }
78 if (entry->map->offset == map->offset)
79 return entry;
62 } 80 }
63 81
64 return NULL; 82 return NULL;
@@ -96,7 +114,7 @@ static int drm_map_handle(struct drm_device *dev, struct drm_hash_item *hash,
96 * type. Adds the map to the map list drm_device::maplist. Adds MTRR's where 114 * type. Adds the map to the map list drm_device::maplist. Adds MTRR's where
97 * applicable and if supported by the kernel. 115 * applicable and if supported by the kernel.
98 */ 116 */
99static int drm_addmap_core(struct drm_device * dev, unsigned int offset, 117static int drm_addmap_core(struct drm_device * dev, resource_size_t offset,
100 unsigned int size, enum drm_map_type type, 118 unsigned int size, enum drm_map_type type,
101 enum drm_map_flags flags, 119 enum drm_map_flags flags,
102 struct drm_map_list ** maplist) 120 struct drm_map_list ** maplist)
@@ -124,9 +142,9 @@ static int drm_addmap_core(struct drm_device * dev, unsigned int offset,
124 drm_free(map, sizeof(*map), DRM_MEM_MAPS); 142 drm_free(map, sizeof(*map), DRM_MEM_MAPS);
125 return -EINVAL; 143 return -EINVAL;
126 } 144 }
127 DRM_DEBUG("offset = 0x%08lx, size = 0x%08lx, type = %d\n", 145 DRM_DEBUG("offset = 0x%08llx, size = 0x%08lx, type = %d\n",
128 map->offset, map->size, map->type); 146 (unsigned long long)map->offset, map->size, map->type);
129 if ((map->offset & (~PAGE_MASK)) || (map->size & (~PAGE_MASK))) { 147 if ((map->offset & (~(resource_size_t)PAGE_MASK)) || (map->size & (~PAGE_MASK))) {
130 drm_free(map, sizeof(*map), DRM_MEM_MAPS); 148 drm_free(map, sizeof(*map), DRM_MEM_MAPS);
131 return -EINVAL; 149 return -EINVAL;
132 } 150 }
@@ -254,7 +272,8 @@ static int drm_addmap_core(struct drm_device * dev, unsigned int offset,
254 drm_free(map, sizeof(*map), DRM_MEM_MAPS); 272 drm_free(map, sizeof(*map), DRM_MEM_MAPS);
255 return -EPERM; 273 return -EPERM;
256 } 274 }
257 DRM_DEBUG("AGP offset = 0x%08lx, size = 0x%08lx\n", map->offset, map->size); 275 DRM_DEBUG("AGP offset = 0x%08llx, size = 0x%08lx\n",
276 (unsigned long long)map->offset, map->size);
258 277
259 break; 278 break;
260 case _DRM_GEM: 279 case _DRM_GEM:
@@ -322,7 +341,7 @@ static int drm_addmap_core(struct drm_device * dev, unsigned int offset,
322 return 0; 341 return 0;
323 } 342 }
324 343
325int drm_addmap(struct drm_device * dev, unsigned int offset, 344int drm_addmap(struct drm_device * dev, resource_size_t offset,
326 unsigned int size, enum drm_map_type type, 345 unsigned int size, enum drm_map_type type,
327 enum drm_map_flags flags, struct drm_local_map ** map_ptr) 346 enum drm_map_flags flags, struct drm_local_map ** map_ptr)
328{ 347{
diff --git a/drivers/gpu/drm/drm_proc.c b/drivers/gpu/drm/drm_proc.c
index c1959badf11f..2e3f907a203a 100644
--- a/drivers/gpu/drm/drm_proc.c
+++ b/drivers/gpu/drm/drm_proc.c
@@ -276,9 +276,9 @@ static int drm__vm_info(char *buf, char **start, off_t offset, int request,
276 type = "??"; 276 type = "??";
277 else 277 else
278 type = types[map->type]; 278 type = types[map->type];
279 DRM_PROC_PRINT("%4d 0x%08lx 0x%08lx %4.4s 0x%02x 0x%08lx ", 279 DRM_PROC_PRINT("%4d 0x%08llx 0x%08lx %4.4s 0x%02x 0x%08lx ",
280 i, 280 i,
281 map->offset, 281 (unsigned long long)map->offset,
282 map->size, type, map->flags, 282 map->size, type, map->flags,
283 (unsigned long) r_list->user_token); 283 (unsigned long) r_list->user_token);
284 if (map->mtrr < 0) { 284 if (map->mtrr < 0) {
diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c
index 0d8bbd72ec55..22f76567ac7d 100644
--- a/drivers/gpu/drm/drm_vm.c
+++ b/drivers/gpu/drm/drm_vm.c
@@ -115,9 +115,9 @@ static int drm_do_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
115 * Using vm_pgoff as a selector forces us to use this unusual 115 * Using vm_pgoff as a selector forces us to use this unusual
116 * addressing scheme. 116 * addressing scheme.
117 */ 117 */
118 unsigned long offset = (unsigned long)vmf->virtual_address - 118 resource_size_t offset = (unsigned long)vmf->virtual_address -
119 vma->vm_start; 119 vma->vm_start;
120 unsigned long baddr = map->offset + offset; 120 resource_size_t baddr = map->offset + offset;
121 struct drm_agp_mem *agpmem; 121 struct drm_agp_mem *agpmem;
122 struct page *page; 122 struct page *page;
123 123
@@ -149,8 +149,10 @@ static int drm_do_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
149 vmf->page = page; 149 vmf->page = page;
150 150
151 DRM_DEBUG 151 DRM_DEBUG
152 ("baddr = 0x%lx page = 0x%p, offset = 0x%lx, count=%d\n", 152 ("baddr = 0x%llx page = 0x%p, offset = 0x%llx, count=%d\n",
153 baddr, __va(agpmem->memory->memory[offset]), offset, 153 (unsigned long long)baddr,
154 __va(agpmem->memory->memory[offset]),
155 (unsigned long long)offset,
154 page_count(page)); 156 page_count(page));
155 return 0; 157 return 0;
156 } 158 }
@@ -512,14 +514,14 @@ static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
512 return 0; 514 return 0;
513} 515}
514 516
515unsigned long drm_core_get_map_ofs(struct drm_local_map * map) 517resource_size_t drm_core_get_map_ofs(struct drm_local_map * map)
516{ 518{
517 return map->offset; 519 return map->offset;
518} 520}
519 521
520EXPORT_SYMBOL(drm_core_get_map_ofs); 522EXPORT_SYMBOL(drm_core_get_map_ofs);
521 523
522unsigned long drm_core_get_reg_ofs(struct drm_device *dev) 524resource_size_t drm_core_get_reg_ofs(struct drm_device *dev)
523{ 525{
524#ifdef __alpha__ 526#ifdef __alpha__
525 return dev->hose->dense_mem_base - dev->hose->mem_space->start; 527 return dev->hose->dense_mem_base - dev->hose->mem_space->start;
@@ -548,7 +550,7 @@ int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
548 struct drm_file *priv = filp->private_data; 550 struct drm_file *priv = filp->private_data;
549 struct drm_device *dev = priv->minor->dev; 551 struct drm_device *dev = priv->minor->dev;
550 struct drm_local_map *map = NULL; 552 struct drm_local_map *map = NULL;
551 unsigned long offset = 0; 553 resource_size_t offset = 0;
552 struct drm_hash_item *hash; 554 struct drm_hash_item *hash;
553 555
554 DRM_DEBUG("start = 0x%lx, end = 0x%lx, page offset = 0x%lx\n", 556 DRM_DEBUG("start = 0x%lx, end = 0x%lx, page offset = 0x%lx\n",
@@ -623,9 +625,9 @@ int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
623 vma->vm_page_prot)) 625 vma->vm_page_prot))
624 return -EAGAIN; 626 return -EAGAIN;
625 DRM_DEBUG(" Type = %d; start = 0x%lx, end = 0x%lx," 627 DRM_DEBUG(" Type = %d; start = 0x%lx, end = 0x%lx,"
626 " offset = 0x%lx\n", 628 " offset = 0x%llx\n",
627 map->type, 629 map->type,
628 vma->vm_start, vma->vm_end, map->offset + offset); 630 vma->vm_start, vma->vm_end, (unsigned long long)(map->offset + offset));
629 vma->vm_ops = &drm_vm_ops; 631 vma->vm_ops = &drm_vm_ops;
630 break; 632 break;
631 case _DRM_CONSISTENT: 633 case _DRM_CONSISTENT:
diff --git a/drivers/gpu/drm/mga/mga_dma.c b/drivers/gpu/drm/mga/mga_dma.c
index b49c5ff29585..7a6bf9ffc5a3 100644
--- a/drivers/gpu/drm/mga/mga_dma.c
+++ b/drivers/gpu/drm/mga/mga_dma.c
@@ -148,8 +148,8 @@ void mga_do_dma_flush(drm_mga_private_t * dev_priv)
148 primary->space = head - tail; 148 primary->space = head - tail;
149 } 149 }
150 150
151 DRM_DEBUG(" head = 0x%06lx\n", head - dev_priv->primary->offset); 151 DRM_DEBUG(" head = 0x%06lx\n", (unsigned long)(head - dev_priv->primary->offset));
152 DRM_DEBUG(" tail = 0x%06lx\n", tail - dev_priv->primary->offset); 152 DRM_DEBUG(" tail = 0x%06lx\n", (unsigned long)(tail - dev_priv->primary->offset));
153 DRM_DEBUG(" space = 0x%06x\n", primary->space); 153 DRM_DEBUG(" space = 0x%06x\n", primary->space);
154 154
155 mga_flush_write_combine(); 155 mga_flush_write_combine();
@@ -187,7 +187,7 @@ void mga_do_dma_wrap_start(drm_mga_private_t * dev_priv)
187 primary->space = head - dev_priv->primary->offset; 187 primary->space = head - dev_priv->primary->offset;
188 } 188 }
189 189
190 DRM_DEBUG(" head = 0x%06lx\n", head - dev_priv->primary->offset); 190 DRM_DEBUG(" head = 0x%06lx\n", (unsigned long)(head - dev_priv->primary->offset));
191 DRM_DEBUG(" tail = 0x%06x\n", primary->tail); 191 DRM_DEBUG(" tail = 0x%06x\n", primary->tail);
192 DRM_DEBUG(" wrap = %d\n", primary->last_wrap); 192 DRM_DEBUG(" wrap = %d\n", primary->last_wrap);
193 DRM_DEBUG(" space = 0x%06x\n", primary->space); 193 DRM_DEBUG(" space = 0x%06x\n", primary->space);
@@ -239,7 +239,7 @@ static void mga_freelist_print(struct drm_device * dev)
239 for (entry = dev_priv->head->next; entry; entry = entry->next) { 239 for (entry = dev_priv->head->next; entry; entry = entry->next) {
240 DRM_INFO(" %p idx=%2d age=0x%x 0x%06lx\n", 240 DRM_INFO(" %p idx=%2d age=0x%x 0x%06lx\n",
241 entry, entry->buf->idx, entry->age.head, 241 entry, entry->buf->idx, entry->age.head,
242 entry->age.head - dev_priv->primary->offset); 242 (unsigned long)(entry->age.head - dev_priv->primary->offset));
243 } 243 }
244 DRM_INFO("\n"); 244 DRM_INFO("\n");
245} 245}
@@ -340,10 +340,10 @@ static struct drm_buf *mga_freelist_get(struct drm_device * dev)
340 340
341 DRM_DEBUG(" tail=0x%06lx %d\n", 341 DRM_DEBUG(" tail=0x%06lx %d\n",
342 tail->age.head ? 342 tail->age.head ?
343 tail->age.head - dev_priv->primary->offset : 0, 343 (unsigned long)(tail->age.head - dev_priv->primary->offset) : 0,
344 tail->age.wrap); 344 tail->age.wrap);
345 DRM_DEBUG(" head=0x%06lx %d\n", 345 DRM_DEBUG(" head=0x%06lx %d\n",
346 head - dev_priv->primary->offset, wrap); 346 (unsigned long)(head - dev_priv->primary->offset), wrap);
347 347
348 if (TEST_AGE(&tail->age, head, wrap)) { 348 if (TEST_AGE(&tail->age, head, wrap)) {
349 prev = dev_priv->tail->prev; 349 prev = dev_priv->tail->prev;
@@ -366,8 +366,9 @@ int mga_freelist_put(struct drm_device * dev, struct drm_buf * buf)
366 drm_mga_freelist_t *head, *entry, *prev; 366 drm_mga_freelist_t *head, *entry, *prev;
367 367
368 DRM_DEBUG("age=0x%06lx wrap=%d\n", 368 DRM_DEBUG("age=0x%06lx wrap=%d\n",
369 buf_priv->list_entry->age.head - 369 (unsigned long)(buf_priv->list_entry->age.head -
370 dev_priv->primary->offset, buf_priv->list_entry->age.wrap); 370 dev_priv->primary->offset),
371 buf_priv->list_entry->age.wrap);
371 372
372 entry = buf_priv->list_entry; 373 entry = buf_priv->list_entry;
373 head = dev_priv->head; 374 head = dev_priv->head;
diff --git a/drivers/gpu/drm/mga/mga_drv.h b/drivers/gpu/drm/mga/mga_drv.h
index 6bf4de990325..3d264f288237 100644
--- a/drivers/gpu/drm/mga/mga_drv.h
+++ b/drivers/gpu/drm/mga/mga_drv.h
@@ -317,8 +317,8 @@ do { \
317 DRM_INFO( "\n" ); \ 317 DRM_INFO( "\n" ); \
318 DRM_INFO( " tail=0x%06x head=0x%06lx\n", \ 318 DRM_INFO( " tail=0x%06x head=0x%06lx\n", \
319 dev_priv->prim.tail, \ 319 dev_priv->prim.tail, \
320 MGA_READ( MGA_PRIMADDRESS ) - \ 320 (unsigned long)(MGA_READ(MGA_PRIMADDRESS) - \
321 dev_priv->primary->offset ); \ 321 dev_priv->primary->offset)); \
322 } \ 322 } \
323 if ( !test_bit( 0, &dev_priv->prim.wrapped ) ) { \ 323 if ( !test_bit( 0, &dev_priv->prim.wrapped ) ) { \
324 if ( dev_priv->prim.space < \ 324 if ( dev_priv->prim.space < \
diff --git a/drivers/gpu/drm/r128/r128_cce.c b/drivers/gpu/drm/r128/r128_cce.c
index c31afbde62e7..32de4cedc363 100644
--- a/drivers/gpu/drm/r128/r128_cce.c
+++ b/drivers/gpu/drm/r128/r128_cce.c
@@ -525,11 +525,12 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init)
525 } else 525 } else
526#endif 526#endif
527 { 527 {
528 dev_priv->cce_ring->handle = (void *)dev_priv->cce_ring->offset; 528 dev_priv->cce_ring->handle =
529 (void *)(unsigned long)dev_priv->cce_ring->offset;
529 dev_priv->ring_rptr->handle = 530 dev_priv->ring_rptr->handle =
530 (void *)dev_priv->ring_rptr->offset; 531 (void *)(unsigned long)dev_priv->ring_rptr->offset;
531 dev->agp_buffer_map->handle = 532 dev->agp_buffer_map->handle =
532 (void *)dev->agp_buffer_map->offset; 533 (void *)(unsigned long)dev->agp_buffer_map->offset;
533 } 534 }
534 535
535#if __OS_HAS_AGP 536#if __OS_HAS_AGP
diff --git a/drivers/gpu/drm/radeon/radeon_cp.c b/drivers/gpu/drm/radeon/radeon_cp.c
index 92965dbb3c14..34c0b3f0c29e 100644
--- a/drivers/gpu/drm/radeon/radeon_cp.c
+++ b/drivers/gpu/drm/radeon/radeon_cp.c
@@ -1062,11 +1062,12 @@ static int radeon_do_init_cp(struct drm_device *dev, drm_radeon_init_t *init,
1062 } else 1062 } else
1063#endif 1063#endif
1064 { 1064 {
1065 dev_priv->cp_ring->handle = (void *)dev_priv->cp_ring->offset; 1065 dev_priv->cp_ring->handle =
1066 (void *)(unsigned long)dev_priv->cp_ring->offset;
1066 dev_priv->ring_rptr->handle = 1067 dev_priv->ring_rptr->handle =
1067 (void *)dev_priv->ring_rptr->offset; 1068 (void *)(unsigned long)dev_priv->ring_rptr->offset;
1068 dev->agp_buffer_map->handle = 1069 dev->agp_buffer_map->handle =
1069 (void *)dev->agp_buffer_map->offset; 1070 (void *)(unsigned long)dev->agp_buffer_map->offset;
1070 1071
1071 DRM_DEBUG("dev_priv->cp_ring->handle %p\n", 1072 DRM_DEBUG("dev_priv->cp_ring->handle %p\n",
1072 dev_priv->cp_ring->handle); 1073 dev_priv->cp_ring->handle);
@@ -1177,7 +1178,7 @@ static int radeon_do_init_cp(struct drm_device *dev, drm_radeon_init_t *init,
1177 /* if we have an offset set from userspace */ 1178 /* if we have an offset set from userspace */
1178 if (dev_priv->pcigart_offset_set) { 1179 if (dev_priv->pcigart_offset_set) {
1179 dev_priv->gart_info.bus_addr = 1180 dev_priv->gart_info.bus_addr =
1180 dev_priv->pcigart_offset + dev_priv->fb_location; 1181 (resource_size_t)dev_priv->pcigart_offset + dev_priv->fb_location;
1181 dev_priv->gart_info.mapping.offset = 1182 dev_priv->gart_info.mapping.offset =
1182 dev_priv->pcigart_offset + dev_priv->fb_aper_offset; 1183 dev_priv->pcigart_offset + dev_priv->fb_aper_offset;
1183 dev_priv->gart_info.mapping.size = 1184 dev_priv->gart_info.mapping.size =
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 03a7c11cb24d..c91fbb68b460 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -526,7 +526,7 @@ struct drm_mm {
526 * Kernel side of a mapping 526 * Kernel side of a mapping
527 */ 527 */
528struct drm_local_map { 528struct drm_local_map {
529 unsigned long offset; /**< Requested physical address (0 for SAREA)*/ 529 resource_size_t offset; /**< Requested physical address (0 for SAREA)*/
530 unsigned long size; /**< Requested physical size (bytes) */ 530 unsigned long size; /**< Requested physical size (bytes) */
531 enum drm_map_type type; /**< Type of memory to map */ 531 enum drm_map_type type; /**< Type of memory to map */
532 enum drm_map_flags flags; /**< Flags */ 532 enum drm_map_flags flags; /**< Flags */
@@ -760,8 +760,8 @@ struct drm_driver {
760 struct drm_file *file_priv); 760 struct drm_file *file_priv);
761 void (*reclaim_buffers_idlelocked) (struct drm_device *dev, 761 void (*reclaim_buffers_idlelocked) (struct drm_device *dev,
762 struct drm_file *file_priv); 762 struct drm_file *file_priv);
763 unsigned long (*get_map_ofs) (struct drm_local_map * map); 763 resource_size_t (*get_map_ofs) (struct drm_local_map * map);
764 unsigned long (*get_reg_ofs) (struct drm_device *dev); 764 resource_size_t (*get_reg_ofs) (struct drm_device *dev);
765 void (*set_version) (struct drm_device *dev, 765 void (*set_version) (struct drm_device *dev,
766 struct drm_set_version *sv); 766 struct drm_set_version *sv);
767 767
@@ -1062,8 +1062,8 @@ extern int drm_release(struct inode *inode, struct file *filp);
1062extern int drm_mmap(struct file *filp, struct vm_area_struct *vma); 1062extern int drm_mmap(struct file *filp, struct vm_area_struct *vma);
1063extern int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma); 1063extern int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma);
1064extern void drm_vm_open_locked(struct vm_area_struct *vma); 1064extern void drm_vm_open_locked(struct vm_area_struct *vma);
1065extern unsigned long drm_core_get_map_ofs(struct drm_local_map * map); 1065extern resource_size_t drm_core_get_map_ofs(struct drm_local_map * map);
1066extern unsigned long drm_core_get_reg_ofs(struct drm_device *dev); 1066extern resource_size_t drm_core_get_reg_ofs(struct drm_device *dev);
1067extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait); 1067extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);
1068 1068
1069 /* Memory management support (drm_memory.h) */ 1069 /* Memory management support (drm_memory.h) */
@@ -1166,7 +1166,7 @@ extern int drm_i_have_hw_lock(struct drm_device *dev, struct drm_file *file_priv
1166 /* Buffer management support (drm_bufs.h) */ 1166 /* Buffer management support (drm_bufs.h) */
1167extern int drm_addbufs_agp(struct drm_device *dev, struct drm_buf_desc * request); 1167extern int drm_addbufs_agp(struct drm_device *dev, struct drm_buf_desc * request);
1168extern int drm_addbufs_pci(struct drm_device *dev, struct drm_buf_desc * request); 1168extern int drm_addbufs_pci(struct drm_device *dev, struct drm_buf_desc * request);
1169extern int drm_addmap(struct drm_device *dev, unsigned int offset, 1169extern int drm_addmap(struct drm_device *dev, resource_size_t offset,
1170 unsigned int size, enum drm_map_type type, 1170 unsigned int size, enum drm_map_type type,
1171 enum drm_map_flags flags, struct drm_local_map **map_ptr); 1171 enum drm_map_flags flags, struct drm_local_map **map_ptr);
1172extern int drm_addmap_ioctl(struct drm_device *dev, void *data, 1172extern int drm_addmap_ioctl(struct drm_device *dev, void *data,