aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <dumbbell@FreeBSD.org>2013-08-25 00:13:53 +0000
committerJean-Sébastien Pédron <dumbbell@FreeBSD.org>2013-08-25 00:13:53 +0000
commit22f61fe5d4d7a382223c4b4225085aa14809727e (patch)
tree12773d6dce9b73449f72e16474ab92fb66346fa4
parentf7eda40d0ea74e760c83198883b79bb8a359f921 (diff)
Notes
-rw-r--r--sys/dev/drm2/drmP.h7
-rw-r--r--sys/dev/drm2/drm_drv.c27
2 files changed, 24 insertions, 10 deletions
diff --git a/sys/dev/drm2/drmP.h b/sys/dev/drm2/drmP.h
index 9db04f37c273..284bb7fc110c 100644
--- a/sys/dev/drm2/drmP.h
+++ b/sys/dev/drm2/drmP.h
@@ -698,6 +698,7 @@ struct drm_gem_object {
struct drm_driver_info {
int (*load)(struct drm_device *, unsigned long flags);
+ int (*use_msi)(struct drm_device *, unsigned long flags);
int (*firstopen)(struct drm_device *);
int (*open)(struct drm_device *, struct drm_file *);
void (*preclose)(struct drm_device *, struct drm_file *file_priv);
@@ -829,8 +830,10 @@ struct drm_device {
struct drm_driver_info *driver;
drm_pci_id_list_t *id_entry; /* PCI ID, name, and chipset private */
- u_int16_t pci_device; /* PCI device id */
- u_int16_t pci_vendor; /* PCI vendor id */
+ uint16_t pci_device; /* PCI device id */
+ uint16_t pci_vendor; /* PCI vendor id */
+ uint16_t pci_subdevice; /* PCI subsystem device id */
+ uint16_t pci_subvendor; /* PCI subsystem vendor id */
char *unique; /* Unique identifier: e.g., busid */
int unique_len; /* Length of unique field */
diff --git a/sys/dev/drm2/drm_drv.c b/sys/dev/drm2/drm_drv.c
index bd882418b5bd..53ec93092419 100644
--- a/sys/dev/drm2/drm_drv.c
+++ b/sys/dev/drm2/drm_drv.c
@@ -209,13 +209,22 @@ static struct drm_msi_blacklist_entry drm_msi_blacklist[] = {
{0, 0}
};
-static int drm_msi_is_blacklisted(int vendor, int device)
+static int drm_msi_is_blacklisted(struct drm_device *dev, unsigned long flags)
{
int i = 0;
+ if (dev->driver->use_msi != NULL) {
+ int use_msi;
+
+ use_msi = dev->driver->use_msi(dev, flags);
+
+ return (!use_msi);
+ }
+
+ /* TODO: Maybe move this to a callback in i915? */
for (i = 0; drm_msi_blacklist[i].vendor != 0; i++) {
- if ((drm_msi_blacklist[i].vendor == vendor) &&
- (drm_msi_blacklist[i].device == device)) {
+ if ((drm_msi_blacklist[i].vendor == dev->pci_vendor) &&
+ (drm_msi_blacklist[i].device == dev->pci_device)) {
return 1;
}
}
@@ -264,10 +273,16 @@ int drm_attach(device_t kdev, drm_pci_id_list_t *idlist)
dev->pci_vendor = pci_get_vendor(dev->device);
dev->pci_device = pci_get_device(dev->device);
+ dev->pci_subvendor = pci_get_subvendor(dev->device);
+ dev->pci_subdevice = pci_get_subdevice(dev->device);
+
+ id_entry = drm_find_description(dev->pci_vendor,
+ dev->pci_device, idlist);
+ dev->id_entry = id_entry;
if (drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) {
if (drm_msi &&
- !drm_msi_is_blacklisted(dev->pci_vendor, dev->pci_device)) {
+ !drm_msi_is_blacklisted(dev, dev->id_entry->driver_private)) {
msicount = pci_msi_count(dev->device);
DRM_DEBUG("MSI count = %d\n", msicount);
if (msicount > 1)
@@ -297,10 +312,6 @@ int drm_attach(device_t kdev, drm_pci_id_list_t *idlist)
mtx_init(&dev->event_lock, "drmev", NULL, MTX_DEF);
sx_init(&dev->dev_struct_lock, "drmslk");
- id_entry = drm_find_description(dev->pci_vendor,
- dev->pci_device, idlist);
- dev->id_entry = id_entry;
-
error = drm_load(dev);
if (error == 0)
error = drm_create_cdevs(kdev);