Lines Matching refs:dev
40 __FBSDID("$FreeBSD: releng/11.0/sys/dev/drm2/drm_pci.c 293851 2016-01-13 20:35:02Z dumbbell $");
42 #include <dev/drm2/drmP.h>
68 drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size,
86 mtx_assert(&dev->dma_lock, MA_NOTOWNED);
87 if (mtx_owned(&dev->dma_lock))
91 bus_get_dma_tag(dev->dev), /* parent */
130 void __drm_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah)
143 void drm_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah)
145 __drm_pci_free(dev, dmah);
151 static int drm_get_pci_domain(struct drm_device *dev)
153 return dev->pci_domain;
156 static int drm_pci_get_irq(struct drm_device *dev)
159 if (dev->irqr)
160 return (dev->irq);
162 dev->irqr = bus_alloc_resource_any(dev->dev, SYS_RES_IRQ,
163 &dev->irqrid, RF_SHAREABLE);
164 if (!dev->irqr) {
165 dev_err(dev->dev, "Failed to allocate IRQ\n");
169 dev->irq = (int) rman_get_start(dev->irqr);
171 return (dev->irq);
174 static void drm_pci_free_irq(struct drm_device *dev)
176 if (dev->irqr == NULL)
179 bus_release_resource(dev->dev, SYS_RES_IRQ,
180 dev->irqrid, dev->irqr);
182 dev->irqr = NULL;
183 dev->irq = 0;
186 static const char *drm_pci_get_name(struct drm_device *dev)
188 return dev->driver->name;
191 int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master)
203 dev->pci_domain,
204 dev->pci_bus,
205 dev->pci_slot,
206 dev->pci_func);
220 int drm_pci_set_unique(struct drm_device *dev,
253 if ((domain != dev->pci_domain) ||
254 (bus != dev->pci_bus) ||
255 (slot != dev->pci_slot) ||
256 (func != dev->pci_func)) {
266 static int drm_pci_irq_by_busid(struct drm_device *dev, struct drm_irq_busid *p)
268 if ((p->busnum >> 8) != drm_get_pci_domain(dev) ||
269 (p->busnum & 0xff) != dev->pci_bus ||
270 p->devnum != dev->pci_slot || p->funcnum != dev->pci_func)
273 p->irq = dev->irq;
280 int drm_pci_agp_init(struct drm_device *dev)
282 if (drm_core_has_AGP(dev)) {
283 if (drm_pci_device_is_agp(dev))
284 dev->agp = drm_agp_init(dev);
285 if (drm_core_check_feature(dev, DRIVER_REQUIRE_AGP)
286 && (dev->agp == NULL)) {
290 if (drm_core_has_MTRR(dev)) {
291 if (dev->agp && dev->agp->agp_info.ai_aperture_base != 0) {
292 if (drm_mtrr_add(dev->agp->agp_info.ai_aperture_base,
293 dev->agp->agp_info.ai_aperture_size, DRM_MTRR_WC) == 0)
294 dev->agp->agp_mtrr = 1;
296 dev->agp->agp_mtrr = -1;
325 int drm_get_pci_dev(device_t kdev, struct drm_device *dev,
334 dev->dev = kdev;
336 dev->pci_domain = pci_get_domain(dev->dev);
337 dev->pci_bus = pci_get_bus(dev->dev);
338 dev->pci_slot = pci_get_slot(dev->dev);
339 dev->pci_func = pci_get_function(dev->dev);
341 dev->pci_vendor = pci_get_vendor(dev->dev);
342 dev->pci_device = pci_get_device(dev->dev);
343 dev->pci_subvendor = pci_get_subvendor(dev->dev);
344 dev->pci_subdevice = pci_get_subdevice(dev->dev);
348 if ((ret = drm_fill_in_dev(dev, driver))) {
349 DRM_ERROR("Failed to fill in dev: %d\n", ret);
353 if (drm_core_check_feature(dev, DRIVER_MODESET)) {
354 ret = drm_get_minor(dev, &dev->control, DRM_MINOR_CONTROL);
359 if ((ret = drm_get_minor(dev, &dev->primary, DRM_MINOR_LEGACY)))
362 if (dev->driver->load) {
363 ret = dev->driver->load(dev,
364 dev->id_entry->driver_private);
370 if (drm_core_check_feature(dev, DRIVER_MODESET)) {
371 ret = drm_mode_group_init_legacy_group(dev,
372 &dev->primary->mode_group);
378 list_add_tail(&dev->driver_item, &driver->device_list);
383 driver->date, device_get_nameunit(dev->dev), dev->primary->index);
389 if (dev->driver->unload)
390 dev->driver->unload(dev);
392 drm_put_minor(&dev->primary);
394 if (drm_core_check_feature(dev, DRIVER_MODESET))
395 drm_put_minor(&dev->control);
397 drm_cancel_fill_in_dev(dev);
405 drm_pci_enable_msi(struct drm_device *dev)
412 msicount = pci_msi_count(dev->dev);
417 ret = pci_alloc_msi(dev->dev, &msicount);
420 dev->msi_enabled = 1;
421 dev->irqrid = 1;
428 drm_pci_disable_msi(struct drm_device *dev)
431 if (!dev->msi_enabled)
434 pci_release_msi(dev->dev);
435 dev->msi_enabled = 0;
436 dev->irqrid = 0;
439 int drm_pcie_get_speed_cap_mask(struct drm_device *dev, u32 *mask)
446 if (!drm_pci_device_is_pcie(dev))
453 dev->dev))); /* `-- drmn */