Lines Matching refs:dev
32 __FBSDID("$FreeBSD: releng/11.0/sys/dev/drm/drm_agpsupport.c 283999 2015-06-04 20:36:16Z jhb $");
39 #include "dev/drm/drmP.h"
41 #include <dev/agp/agpreg.h>
42 #include <dev/pci/pcireg.h>
46 drm_device_find_capability(struct drm_device *dev, int cap)
49 return (pci_find_cap(dev->device, cap, NULL) == 0);
52 int drm_device_is_agp(struct drm_device *dev)
54 if (dev->driver->device_is_agp != NULL) {
60 ret = (*dev->driver->device_is_agp)(dev);
65 return (drm_device_find_capability(dev, PCIY_AGP));
68 int drm_device_is_pcie(struct drm_device *dev)
70 return (drm_device_find_capability(dev, PCIY_EXPRESS));
73 int drm_agp_info(struct drm_device * dev, struct drm_agp_info *info)
77 if (!dev->agp || !dev->agp->acquired)
80 kern = &dev->agp->info;
81 agp_get_info(dev->agp->agpdev, kern);
95 int drm_agp_info_ioctl(struct drm_device *dev, void *data,
101 err = drm_agp_info(dev, &info);
109 int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
113 return drm_agp_acquire(dev);
116 int drm_agp_acquire(struct drm_device *dev)
120 if (!dev->agp || dev->agp->acquired)
123 retcode = agp_acquire(dev->agp->agpdev);
127 dev->agp->acquired = 1;
131 int drm_agp_release_ioctl(struct drm_device *dev, void *data,
135 return drm_agp_release(dev);
138 int drm_agp_release(struct drm_device * dev)
140 if (!dev->agp || !dev->agp->acquired)
142 agp_release(dev->agp->agpdev);
143 dev->agp->acquired = 0;
147 int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode)
150 if (!dev->agp || !dev->agp->acquired)
153 dev->agp->mode = mode.mode;
154 agp_enable(dev->agp->agpdev, mode.mode);
155 dev->agp->enabled = 1;
159 int drm_agp_enable_ioctl(struct drm_device *dev, void *data,
166 return drm_agp_enable(dev, mode);
169 int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request)
177 if (!dev->agp || !dev->agp->acquired)
199 entry->next = dev->agp->memory;
200 if (dev->agp->memory)
201 dev->agp->memory->prev = entry;
202 dev->agp->memory = entry;
204 agp_memory_info(dev->agp->agpdev, entry->handle, &info);
212 int drm_agp_alloc_ioctl(struct drm_device *dev, void *data,
221 retcode = drm_agp_alloc(dev, &request);
229 static drm_agp_mem_t * drm_agp_lookup_entry(struct drm_device *dev,
234 for (entry = dev->agp->memory; entry; entry = entry->next) {
240 int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request)
245 if (!dev->agp || !dev->agp->acquired)
248 entry = drm_agp_lookup_entry(dev, (void *)request->handle);
262 int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,
271 retcode = drm_agp_unbind(dev, &request);
277 int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request)
283 if (!dev->agp || !dev->agp->acquired)
288 entry = drm_agp_lookup_entry(dev, (void *)request->handle);
298 entry->bound = dev->agp->base + (page << PAGE_SHIFT);
303 int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
312 retcode = drm_agp_bind(dev, &request);
318 int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request)
322 if (!dev->agp || !dev->agp->acquired)
325 entry = drm_agp_lookup_entry(dev, (void*)request->handle);
332 dev->agp->memory = entry->next;
348 int drm_agp_free_ioctl(struct drm_device *dev, void *data,
357 retcode = drm_agp_free(dev, &request);