Lines Matching defs:map
58 struct drm_local_map *map)
64 * while PCI resources may live above that, we ignore the map
69 if (!entry->map ||
70 map->type != entry->map->type ||
73 switch (map->type) {
75 if (map->flags != _DRM_CONTAINS_LOCK)
80 if ((entry->map->offset & 0xffffffff) ==
81 (map->offset & 0xffffffff))
86 if (entry->map->offset == map->offset)
110 * type. Adds the map to the map list drm_device::maplist. Adds MTRR's where
118 struct drm_local_map *map;
124 map = kmalloc(sizeof(*map), GFP_KERNEL);
125 if (!map)
128 map->offset = offset;
129 map->size = size;
130 map->flags = flags;
131 map->type = type;
137 if ((map->flags & _DRM_REMOVABLE) && map->type != _DRM_SHM) {
138 kfree(map, sizeof(*map));
142 (unsigned long long)map->offset, map->size, map->type);
146 * a non-aligned quantity to map the SAREA. --BenH
148 if (map->type == _DRM_SHM)
149 map->size = PAGE_ALIGN(map->size);
151 if ((map->offset & (~(resource_size_t)PAGE_MASK)) || (map->size & (~PAGE_MASK))) {
152 kfree(map, sizeof(*map));
156 if (map->offset + map->size < map->offset) {
157 kfree(map, sizeof(*map));
161 map->mtrr = -1;
162 map->handle = NULL;
164 switch (map->type) {
169 * when the server tries to create a duplicate map.
171 list = drm_find_matching_map(dev, map);
173 if (list->map->size != map->size) {
176 map->type, map->size,
177 list->map->size);
178 list->map->size = map->size;
181 kfree(map, sizeof(struct drm_local_map));
186 if (map->type == _DRM_REGISTERS) {
187 map->handle = ioremap(map->offset, map->size);
188 if (!map->handle) {
189 kfree(map, sizeof(struct drm_local_map));
196 list = drm_find_matching_map(dev, map);
198 if(list->map->size != map->size) {
201 map->type, map->size, list->map->size);
202 list->map->size = map->size;
205 kfree(map, sizeof(struct drm_local_map));
209 map->handle = ddi_umem_alloc(map->size, DDI_UMEM_NOSLEEP, &map->umem_cookie);
211 map->size, map->handle);
212 if (!map->handle) {
213 kfree(map, sizeof(struct drm_local_map));
216 map->offset = (uintptr_t)map->handle;
217 if (map->flags & _DRM_CONTAINS_LOCK) {
220 ddi_umem_free(map->umem_cookie);
221 kfree(map, sizeof(struct drm_local_map));
224 dev->primary->master->lock.hw_lock = map->handle; /* Pointer to lock */
231 kfree(map, sizeof(struct drm_local_map));
235 map->offset += dev->agp->base;
236 kvaddr = gfxp_alloc_kernel_space(map->size);
239 kfree(map, sizeof(struct drm_local_map));
242 gfxp_load_kernel_space(map->offset, map->size,
244 map->handle = (void *)(uintptr_t)kvaddr;
245 map->umem_cookie = gfxp_umem_cookie_init(map->handle, map->size);
246 if (!map->umem_cookie) {
248 gfxp_unmap_kernel_space(map->handle, map->size);
249 kfree(map, sizeof(struct drm_local_map));
259 kfree(map, sizeof(struct drm_local_map));
262 map->offset += (uintptr_t)dev->sg->virtual;
263 map->handle = (void *)map->offset;
264 map->umem_cookie = gfxp_umem_cookie_init(map->handle, map->size);
265 if (!map->umem_cookie) {
267 kfree(map, sizeof(struct drm_local_map));
273 kfree(map, sizeof(struct drm_local_map));
276 kfree(map, sizeof(struct drm_local_map));
282 if (map->type == _DRM_REGISTERS)
283 iounmap(map->handle);
284 kfree(map, sizeof(struct drm_local_map));
288 list->map = map;
295 user_token = (map->type == _DRM_SHM) ? (unsigned long)map->handle :
296 map->offset;
299 if (map->type == _DRM_REGISTERS)
300 iounmap(map->handle);
301 kfree(map, sizeof(struct drm_local_map));
309 if (!(map->flags & _DRM_DRIVER))
324 *map_ptr = list->map;
342 struct drm_map *map = data;
346 DRM_DEBUG_DRIVER("adding map of type %d, offset: %0x, size: %0x\n",
347 map->type, map->offset,map->size);
349 if (!(DRM_SUSER(credp) || map->type == _DRM_AGP || map->type == _DRM_SHM))
352 err = drm_addmap_core(dev, map->offset, map->size, map->type,
353 map->flags, &maplist);
359 map->handle = maplist->user_token;
364 * Remove a map private from list and deallocate resources if the mapping
367 * Searches the map on drm_device::maplist, removes it from the list, see if
373 int drm_rmmap_locked(struct drm_device *dev, struct drm_local_map *map)
382 /* Find the list entry for the map and remove it */
384 if (r_list->map == map) {
398 switch (map->type) {
400 iounmap(map->handle);
405 ddi_umem_free(map->umem_cookie);
408 gfxp_umem_cookie_destroy(map->umem_cookie);
409 gfxp_unmap_kernel_space(map->handle, map->size);
412 gfxp_umem_cookie_destroy(map->umem_cookie);
420 kfree(map, sizeof(struct drm_local_map));
425 int drm_rmmap(struct drm_device *dev, struct drm_local_map *map)
430 ret = drm_rmmap_locked(dev, map);
455 struct drm_local_map *map = NULL;
461 if (r_list->map &&
463 r_list->map->flags & _DRM_REMOVABLE) {
464 map = r_list->map;
472 if (list_empty(&dev->maplist) || !map) {
478 if ((map->type == _DRM_REGISTERS) || (map->type == _DRM_FRAME_BUFFER)) {
483 ret = drm_rmmap_locked(dev, map);
1104 struct drm_local_map *map = dev->agp_buffer_map;
1106 if (!map) {
1110 size = round_page(map->size);
1111 foff = (uintptr_t)map->handle;