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>
This commit is contained in:

committed by
Dave Airlie

parent
f77d390c97
commit
41c2e75e60
@@ -1062,11 +1062,12 @@ static int radeon_do_init_cp(struct drm_device *dev, drm_radeon_init_t *init,
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
dev_priv->cp_ring->handle = (void *)dev_priv->cp_ring->offset;
|
||||
dev_priv->cp_ring->handle =
|
||||
(void *)(unsigned long)dev_priv->cp_ring->offset;
|
||||
dev_priv->ring_rptr->handle =
|
||||
(void *)dev_priv->ring_rptr->offset;
|
||||
(void *)(unsigned long)dev_priv->ring_rptr->offset;
|
||||
dev->agp_buffer_map->handle =
|
||||
(void *)dev->agp_buffer_map->offset;
|
||||
(void *)(unsigned long)dev->agp_buffer_map->offset;
|
||||
|
||||
DRM_DEBUG("dev_priv->cp_ring->handle %p\n",
|
||||
dev_priv->cp_ring->handle);
|
||||
@@ -1177,7 +1178,7 @@ static int radeon_do_init_cp(struct drm_device *dev, drm_radeon_init_t *init,
|
||||
/* if we have an offset set from userspace */
|
||||
if (dev_priv->pcigart_offset_set) {
|
||||
dev_priv->gart_info.bus_addr =
|
||||
dev_priv->pcigart_offset + dev_priv->fb_location;
|
||||
(resource_size_t)dev_priv->pcigart_offset + dev_priv->fb_location;
|
||||
dev_priv->gart_info.mapping.offset =
|
||||
dev_priv->pcigart_offset + dev_priv->fb_aper_offset;
|
||||
dev_priv->gart_info.mapping.size =
|
||||
|
Reference in New Issue
Block a user