aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/char/drm/drm_bufs.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/char/drm/drm_bufs.c b/drivers/char/drm/drm_bufs.c
index 07b774fa3f38..bde64b84166e 100644
--- a/drivers/char/drm/drm_bufs.c
+++ b/drivers/char/drm/drm_bufs.c
@@ -229,11 +229,17 @@ static int drm_addmap_core(struct drm_device * dev, unsigned int offset,
229#ifdef __alpha__ 229#ifdef __alpha__
230 map->offset += dev->hose->mem_space->start; 230 map->offset += dev->hose->mem_space->start;
231#endif 231#endif
232 /* Note: dev->agp->base may actually be 0 when the DRM 232 /* In some cases (i810 driver), user space may have already
233 * is not in control of AGP space. But if user space is 233 * added the AGP base itself, because dev->agp->base previously
234 * it should already have added the AGP base itself. 234 * only got set during AGP enable. So, only add the base
235 * address if the map's offset isn't already within the
236 * aperture.
235 */ 237 */
236 map->offset += dev->agp->base; 238 if (map->offset < dev->agp->base ||
239 map->offset > dev->agp->base +
240 dev->agp->agp_info.aper_size * 1024 * 1024 - 1) {
241 map->offset += dev->agp->base;
242 }
237 map->mtrr = dev->agp->agp_mtrr; /* for getmap */ 243 map->mtrr = dev->agp->agp_mtrr; /* for getmap */
238 244
239 /* This assumes the DRM is in total control of AGP space. 245 /* This assumes the DRM is in total control of AGP space.