Lines 235-243
Link Here
|
235 |
#ifdef __alpha__ |
235 |
#ifdef __alpha__ |
236 |
map->offset += dev->hose->mem_space->start; |
236 |
map->offset += dev->hose->mem_space->start; |
237 |
#endif |
237 |
#endif |
|
|
238 |
/* Note: dev->agp->base may actually be 0 when the DRM |
239 |
* is not in control of AGP space. But if user space is |
240 |
* it should already have added the AGP base itself. |
241 |
*/ |
238 |
map->offset += dev->agp->base; |
242 |
map->offset += dev->agp->base; |
239 |
map->mtrr = dev->agp->agp_mtrr; /* for getmap */ |
243 |
map->mtrr = dev->agp->agp_mtrr; /* for getmap */ |
240 |
|
244 |
|
|
|
245 |
/* This assumes the DRM is in total control of AGP space. |
246 |
* It's not always the case as AGP can be in the control |
247 |
* of user space (i.e. i810 driver). So this loop will get |
248 |
* skipped and we double check that dev->agp->memory is |
249 |
* actually set as well as being invalid before EPERM'ing |
250 |
*/ |
241 |
for (entry = dev->agp->memory; entry; entry = entry->next) { |
251 |
for (entry = dev->agp->memory; entry; entry = entry->next) { |
242 |
if ((map->offset >= entry->bound) && |
252 |
if ((map->offset >= entry->bound) && |
243 |
(map->offset + map->size <= entry->bound + entry->pages * PAGE_SIZE)) { |
253 |
(map->offset + map->size <= entry->bound + entry->pages * PAGE_SIZE)) { |
Lines 245-251
Link Here
|
245 |
break; |
255 |
break; |
246 |
} |
256 |
} |
247 |
} |
257 |
} |
248 |
if (!valid) { |
258 |
if (dev->agp->memory && !valid) { |
249 |
drm_free(map, sizeof(*map), DRM_MEM_MAPS); |
259 |
drm_free(map, sizeof(*map), DRM_MEM_MAPS); |
250 |
return -EPERM; |
260 |
return -EPERM; |
251 |
} |
261 |
} |
Lines 599-605
Link Here
|
599 |
break; |
609 |
break; |
600 |
} |
610 |
} |
601 |
} |
611 |
} |
602 |
if (!valid) { |
612 |
if (dev->agp->memory && !valid) { |
603 |
DRM_DEBUG("zone invalid\n"); |
613 |
DRM_DEBUG("zone invalid\n"); |
604 |
return -EINVAL; |
614 |
return -EINVAL; |
605 |
} |
615 |
} |