diff options
author | Benjamin Herrenschmidt | 2009-02-02 16:55:47 +1100 |
---|---|---|
committer | Dave Airlie | 2009-03-13 14:23:57 +1000 |
commit | 41c2e75e60200a860a74b7c84a6375c105e7437f (patch) | |
tree | 18e97662d6859eead4de816e121d001b34a7352a /drivers/gpu/drm/mga | |
parent | f77d390c9779c496aa5b99ec832996fb76bb1d13 (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.c | 17 | ||||
-rw-r--r-- | drivers/gpu/drm/mga/mga_drv.h | 4 |
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) primary->space = head - tail; } - DRM_DEBUG(" head = 0x%06lx\n", head - dev_priv->primary->offset); - DRM_DEBUG(" tail = 0x%06lx\n", tail - dev_priv->primary->offset); + DRM_DEBUG(" head = 0x%06lx\n", (unsigned long)(head - dev_priv->primary->offset)); + DRM_DEBUG(" tail = 0x%06lx\n", (unsigned long)(tail - dev_priv->primary->offset)); DRM_DEBUG(" space = 0x%06x\n", primary->space); mga_flush_write_combine(); @@ -187,7 +187,7 @@ void mga_do_dma_wrap_start(drm_mga_private_t * dev_priv) primary->space = head - dev_priv->primary->offset; } - DRM_DEBUG(" head = 0x%06lx\n", head - dev_priv->primary->offset); + DRM_DEBUG(" head = 0x%06lx\n", (unsigned long)(head - dev_priv->primary->offset)); DRM_DEBUG(" tail = 0x%06x\n", primary->tail); DRM_DEBUG(" wrap = %d\n", primary->last_wrap); DRM_DEBUG(" space = 0x%06x\n", primary->space); @@ -239,7 +239,7 @@ static void mga_freelist_print(struct drm_device * dev) for (entry = dev_priv->head->next; entry; entry = entry->next) { DRM_INFO(" %p idx=%2d age=0x%x 0x%06lx\n", entry, entry->buf->idx, entry->age.head, - entry->age.head - dev_priv->primary->offset); + (unsigned long)(entry->age.head - dev_priv->primary->offset)); } DRM_INFO("\n"); } @@ -340,10 +340,10 @@ static struct drm_buf *mga_freelist_get(struct drm_device * dev) DRM_DEBUG(" tail=0x%06lx %d\n", tail->age.head ? - tail->age.head - dev_priv->primary->offset : 0, + (unsigned long)(tail->age.head - dev_priv->primary->offset) : 0, tail->age.wrap); DRM_DEBUG(" head=0x%06lx %d\n", - head - dev_priv->primary->offset, wrap); + (unsigned long)(head - dev_priv->primary->offset), wrap); if (TEST_AGE(&tail->age, head, wrap)) { prev = dev_priv->tail->prev; @@ -366,8 +366,9 @@ int mga_freelist_put(struct drm_device * dev, struct drm_buf * buf) drm_mga_freelist_t *head, *entry, *prev; DRM_DEBUG("age=0x%06lx wrap=%d\n", - buf_priv->list_entry->age.head - - dev_priv->primary->offset, buf_priv->list_entry->age.wrap); + (unsigned long)(buf_priv->list_entry->age.head - + dev_priv->primary->offset), + buf_priv->list_entry->age.wrap); entry = buf_priv->list_entry; 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 { \ DRM_INFO( "\n" ); \ DRM_INFO( " tail=0x%06x head=0x%06lx\n", \ dev_priv->prim.tail, \ - MGA_READ( MGA_PRIMADDRESS ) - \ - dev_priv->primary->offset ); \ + (unsigned long)(MGA_READ(MGA_PRIMADDRESS) - \ + dev_priv->primary->offset)); \ } \ if ( !test_bit( 0, &dev_priv->prim.wrapped ) ) { \ if ( dev_priv->prim.space < \ |