drm_drv.c (189915) | drm_drv.c (191274) |
---|---|
1/*- 2 * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. 3 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 4 * All Rights Reserved. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a 7 * copy of this software and associated documentation files (the "Software"), 8 * to deal in the Software without restriction, including without limitation --- 15 unchanged lines hidden (view full) --- 24 * 25 * Authors: 26 * Rickard E. (Rik) Faith <faith@valinux.com> 27 * Gareth Hughes <gareth@valinux.com> 28 * 29 */ 30 31#include <sys/cdefs.h> | 1/*- 2 * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. 3 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 4 * All Rights Reserved. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a 7 * copy of this software and associated documentation files (the "Software"), 8 * to deal in the Software without restriction, including without limitation --- 15 unchanged lines hidden (view full) --- 24 * 25 * Authors: 26 * Rickard E. (Rik) Faith <faith@valinux.com> 27 * Gareth Hughes <gareth@valinux.com> 28 * 29 */ 30 31#include <sys/cdefs.h> |
32__FBSDID("$FreeBSD: head/sys/dev/drm/drm_drv.c 189915 2009-03-17 03:53:44Z rnoland $"); | 32__FBSDID("$FreeBSD: head/sys/dev/drm/drm_drv.c 191274 2009-04-19 16:54:33Z rnoland $"); |
33 34/** @file drm_drv.c 35 * The catch-all file for DRM device support, including module setup/teardown, 36 * open/close, and ioctl dispatch. 37 */ 38 39 40#include <sys/limits.h> --- 88 unchanged lines hidden (view full) --- 129 .d_read = drm_read, 130 .d_ioctl = drm_ioctl, 131 .d_poll = drm_poll, 132 .d_mmap = drm_mmap, 133 .d_name = "drm", 134 .d_flags = D_TRACKCLOSE 135}; 136 | 33 34/** @file drm_drv.c 35 * The catch-all file for DRM device support, including module setup/teardown, 36 * open/close, and ioctl dispatch. 37 */ 38 39 40#include <sys/limits.h> --- 88 unchanged lines hidden (view full) --- 129 .d_read = drm_read, 130 .d_ioctl = drm_ioctl, 131 .d_poll = drm_poll, 132 .d_mmap = drm_mmap, 133 .d_name = "drm", 134 .d_flags = D_TRACKCLOSE 135}; 136 |
137int drm_msi = 1; /* Enable by default. */ | 137static int drm_msi = 1; /* Enable by default. */ |
138TUNABLE_INT("hw.drm.msi", &drm_msi); 139 140static struct drm_msi_blacklist_entry drm_msi_blacklist[] = { 141 {0x8086, 0x2772}, /* Intel i945G */ \ 142 {0x8086, 0x27A2}, /* Intel i945GM */ \ 143 {0x8086, 0x27AE}, /* Intel i945GME */ \ 144 {0, 0} 145}; --- 77 unchanged lines hidden (view full) --- 223#endif 224 dev->pci_bus = pci_get_bus(dev->device); 225 dev->pci_slot = pci_get_slot(dev->device); 226 dev->pci_func = pci_get_function(dev->device); 227 228 dev->pci_vendor = pci_get_vendor(dev->device); 229 dev->pci_device = pci_get_device(dev->device); 230 | 138TUNABLE_INT("hw.drm.msi", &drm_msi); 139 140static struct drm_msi_blacklist_entry drm_msi_blacklist[] = { 141 {0x8086, 0x2772}, /* Intel i945G */ \ 142 {0x8086, 0x27A2}, /* Intel i945GM */ \ 143 {0x8086, 0x27AE}, /* Intel i945GME */ \ 144 {0, 0} 145}; --- 77 unchanged lines hidden (view full) --- 223#endif 224 dev->pci_bus = pci_get_bus(dev->device); 225 dev->pci_slot = pci_get_slot(dev->device); 226 dev->pci_func = pci_get_function(dev->device); 227 228 dev->pci_vendor = pci_get_vendor(dev->device); 229 dev->pci_device = pci_get_device(dev->device); 230 |
231 if (drm_msi && 232 !drm_msi_is_blacklisted(dev->pci_vendor, dev->pci_device)) { 233 msicount = pci_msi_count(dev->device); 234 DRM_DEBUG("MSI count = %d\n", msicount); 235 if (msicount > 1) 236 msicount = 1; | 231 if (drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) { 232 if (drm_msi && 233 !drm_msi_is_blacklisted(dev->pci_vendor, dev->pci_device)) { 234 msicount = pci_msi_count(dev->device); 235 DRM_DEBUG("MSI count = %d\n", msicount); 236 if (msicount > 1) 237 msicount = 1; |
237 | 238 |
238 if (pci_alloc_msi(dev->device, &msicount) == 0) { 239 DRM_INFO("MSI enabled %d message(s)\n", msicount); 240 dev->msi_enabled = 1; 241 dev->irqrid = 1; | 239 if (pci_alloc_msi(dev->device, &msicount) == 0) { 240 DRM_INFO("MSI enabled %d message(s)\n", 241 msicount); 242 dev->msi_enabled = 1; 243 dev->irqrid = 1; 244 } |
242 } | 245 } |
243 } | |
244 | 246 |
245 dev->irqr = bus_alloc_resource_any(dev->device, SYS_RES_IRQ, 246 &dev->irqrid, RF_SHAREABLE); 247 if (!dev->irqr) { 248 return ENOENT; | 247 dev->irqr = bus_alloc_resource_any(dev->device, SYS_RES_IRQ, 248 &dev->irqrid, RF_SHAREABLE); 249 if (!dev->irqr) { 250 return ENOENT; 251 } 252 253 dev->irq = (int) rman_get_start(dev->irqr); |
249 } 250 | 254 } 255 |
251 dev->irq = (int) rman_get_start(dev->irqr); 252 | |
253 mtx_init(&dev->dev_lock, "drmdev", NULL, MTX_DEF); 254 mtx_init(&dev->irq_lock, "drmirq", NULL, MTX_DEF); 255 mtx_init(&dev->vbl_lock, "drmvbl", NULL, MTX_DEF); 256 mtx_init(&dev->drw_lock, "drmdrw", NULL, MTX_DEF); 257 258 id_entry = drm_find_description(dev->pci_vendor, 259 dev->pci_device, idlist); 260 dev->id_entry = id_entry; --- 582 unchanged lines hidden --- | 256 mtx_init(&dev->dev_lock, "drmdev", NULL, MTX_DEF); 257 mtx_init(&dev->irq_lock, "drmirq", NULL, MTX_DEF); 258 mtx_init(&dev->vbl_lock, "drmvbl", NULL, MTX_DEF); 259 mtx_init(&dev->drw_lock, "drmdrw", NULL, MTX_DEF); 260 261 id_entry = drm_find_description(dev->pci_vendor, 262 dev->pci_device, idlist); 263 dev->id_entry = id_entry; --- 582 unchanged lines hidden --- |