aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/mga
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-02-02 00:55:47 -0500
committerDave Airlie <airlied@redhat.com>2009-03-13 00:23:57 -0400
commit41c2e75e60200a860a74b7c84a6375c105e7437f (patch)
tree18e97662d6859eead4de816e121d001b34a7352a /drivers/gpu/drm/mga
parentf77d390c9779c496aa5b99ec832996fb76bb1d13 (diff)
drm: Make drm_local_map use a resource_size_t offset
This changes drm_local_map to use a resource_size for its "offset" member instead of an unsigned long, thus allowing 32-bit machines with a >32-bit physical address space to be able to store there their register or framebuffer addresses when those are above 4G, such as when using a PCI video card on a recent AMCC 440 SoC. This patch isn't as "trivial" as it sounds: A few functions needed to have some unsigned long/int changed to resource_size_t and a few printk's had to be adjusted. But also, because userspace isn't capable of passing such offsets, I had to modify drm_find_matching_map() to ignore the offset passed in for maps of type _DRM_FRAMEBUFFER or _DRM_REGISTERS. If we ever support multiple _DRM_FRAMEBUFFER or _DRM_REGISTERS maps for a given device, we might have to change that trick, but I don't think that happens on any current driver. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/gpu/drm/mga')
-rw-r--r--drivers/gpu/drm/mga/mga_dma.c17
-rw-r--r--drivers/gpu/drm/mga/mga_drv.h4
2 files changed, 11 insertions, 10 deletions
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 < \