Lines Matching +full:mem +full:- +full:base

55 	if (!dev->agp || !dev->agp->acquired)  in drm_agp_info()
56 return -EINVAL; in drm_agp_info()
58 kern = &dev->agp->agp_info; in drm_agp_info()
59 agp_get_info(dev->agp->bridge, kern); in drm_agp_info()
60 info->agp_version_major = 1; in drm_agp_info()
61 info->agp_version_minor = 0; in drm_agp_info()
62 info->mode = kern->ai_mode; in drm_agp_info()
63 info->aperture_base = kern->ai_aperture_base; in drm_agp_info()
64 info->aperture_size = kern->ai_aperture_size; in drm_agp_info()
65 info->memory_allowed = kern->ai_memory_allowed; in drm_agp_info()
66 info->memory_used = kern->ai_memory_used; in drm_agp_info()
67 info->id_vendor = kern->ai_devid & 0xffff; in drm_agp_info()
68 info->id_device = kern->ai_devid >> 16; in drm_agp_info()
101 if (!dev->agp) in drm_agp_acquire()
102 return -ENODEV; in drm_agp_acquire()
103 if (dev->agp->acquired) in drm_agp_acquire()
104 return -EBUSY; in drm_agp_acquire()
105 retcode = agp_acquire(dev->agp->bridge); in drm_agp_acquire()
107 return -retcode; in drm_agp_acquire()
108 dev->agp->acquired = 1; in drm_agp_acquire()
129 return drm_agp_acquire((struct drm_device *) file_priv->minor->dev); in drm_agp_acquire_ioctl()
142 if (!dev->agp || !dev->agp->acquired) in drm_agp_release()
143 return -EINVAL; in drm_agp_release()
144 agp_release(dev->agp->bridge); in drm_agp_release()
145 dev->agp->acquired = 0; in drm_agp_release()
168 if (!dev->agp || !dev->agp->acquired) in drm_agp_enable()
169 return -EINVAL; in drm_agp_enable()
171 dev->agp->mode = mode.mode; in drm_agp_enable()
172 agp_enable(dev->agp->bridge, mode.mode); in drm_agp_enable()
173 dev->agp->enabled = 1; in drm_agp_enable()
207 if (!dev->agp || !dev->agp->acquired) in drm_agp_alloc()
208 return -EINVAL; in drm_agp_alloc()
210 return -ENOMEM; in drm_agp_alloc()
214 pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE; in drm_agp_alloc()
215 type = (u32) request->type; in drm_agp_alloc()
216 if (!(memory = agp_alloc_memory(dev->agp->bridge, type, pages << PAGE_SHIFT))) { in drm_agp_alloc()
218 return -ENOMEM; in drm_agp_alloc()
221 entry->handle = (unsigned long)memory; in drm_agp_alloc()
222 entry->memory = memory; in drm_agp_alloc()
223 entry->bound = 0; in drm_agp_alloc()
224 entry->pages = pages; in drm_agp_alloc()
225 list_add(&entry->head, &dev->agp->memory); in drm_agp_alloc()
227 agp_memory_info(dev->agp->bridge, entry->memory, &info); in drm_agp_alloc()
229 request->handle = entry->handle; in drm_agp_alloc()
230 request->physical = info.ami_physical; in drm_agp_alloc()
259 list_for_each_entry(entry, &dev->agp->memory, head) { in drm_agp_lookup_entry()
260 if (entry->handle == handle) in drm_agp_lookup_entry()
275 * Verifies the AGP device is present and acquired, looks-up the AGP memory
283 if (!dev->agp || !dev->agp->acquired) in drm_agp_unbind()
284 return -EINVAL; in drm_agp_unbind()
285 if (!(entry = drm_agp_lookup_entry(dev, request->handle))) in drm_agp_unbind()
286 return -EINVAL; in drm_agp_unbind()
287 if (!entry->bound) in drm_agp_unbind()
288 return -EINVAL; in drm_agp_unbind()
289 ret = drm_unbind_agp(entry->memory); in drm_agp_unbind()
291 entry->bound = 0; in drm_agp_unbind()
315 * is currently bound into the GATT. Looks-up the AGP memory entry and passes
324 if (!dev->agp || !dev->agp->acquired) in drm_agp_bind()
325 return -EINVAL; in drm_agp_bind()
326 if (!(entry = drm_agp_lookup_entry(dev, request->handle))) in drm_agp_bind()
327 return -EINVAL; in drm_agp_bind()
328 if (entry->bound) in drm_agp_bind()
329 return -EINVAL; in drm_agp_bind()
330 page = (request->offset + PAGE_SIZE - 1) / PAGE_SIZE; in drm_agp_bind()
331 if ((retcode = drm_bind_agp(entry->memory, page))) in drm_agp_bind()
333 entry->bound = dev->agp->base + (page << PAGE_SHIFT); in drm_agp_bind()
334 DRM_DEBUG("base = 0x%lx entry->bound = 0x%lx\n", in drm_agp_bind()
335 dev->agp->base, entry->bound); in drm_agp_bind()
367 if (!dev->agp || !dev->agp->acquired) in drm_agp_free()
368 return -EINVAL; in drm_agp_free()
369 if (!(entry = drm_agp_lookup_entry(dev, request->handle))) in drm_agp_free()
370 return -EINVAL; in drm_agp_free()
371 if (entry->bound) in drm_agp_free()
372 drm_unbind_agp(entry->memory); in drm_agp_free()
374 list_del(&entry->head); in drm_agp_free()
376 drm_free_agp(entry->memory, entry->pages); in drm_agp_free()
408 head->bridge = agp_find_device(); in drm_agp_init()
409 if (!head->bridge) { in drm_agp_init()
413 agp_get_info(head->bridge, &head->agp_info); in drm_agp_init()
415 INIT_LIST_HEAD(&head->memory); in drm_agp_init()
416 head->cant_use_aperture = 0; in drm_agp_init()
417 head->base = head->agp_info.ai_aperture_base; in drm_agp_init()
426 * No reference is held on the pages during this time -- it is up to the
436 DRM_AGP_MEM *mem; in drm_agp_bind_pages() local
441 mem = agp_allocate_memory(dev->agp->bridge, num_pages, in drm_agp_bind_pages()
443 if (mem == NULL) { in drm_agp_bind_pages()
450 mem->pages[i] = pages[i]; in drm_agp_bind_pages()
451 mem->page_count = num_pages; in drm_agp_bind_pages()
453 mem->is_flushed = true; in drm_agp_bind_pages()
454 ret = agp_bind_memory(mem, gtt_offset / PAGE_SIZE); in drm_agp_bind_pages()
457 agp_free_memory(mem); in drm_agp_bind_pages()
461 return mem; in drm_agp_bind_pages()