From owner-svn-src-stable@FreeBSD.ORG Sun Feb 9 14:58:48 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8105ECF3; Sun, 9 Feb 2014 14:58:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6AD3C1B93; Sun, 9 Feb 2014 14:58:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s19Ewmr7068419; Sun, 9 Feb 2014 14:58:48 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s19EwmgI068417; Sun, 9 Feb 2014 14:58:48 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201402091458.s19EwmgI068417@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Sun, 9 Feb 2014 14:58:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r261658 - stable/9/sys/dev/drm2 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Feb 2014 14:58:48 -0000 Author: dumbbell Date: Sun Feb 9 14:58:47 2014 New Revision: 261658 URL: http://svnweb.freebsd.org/changeset/base/261658 Log: MFC r254820: drm: Use driver-provided "use_msi" callback to determine if MSI is blacklisted For now, keep the static array for i915. But eventually, it should be moved to a callback in the driver itself. Modified: stable/9/sys/dev/drm2/drmP.h stable/9/sys/dev/drm2/drm_drv.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/drm2/drmP.h ============================================================================== --- stable/9/sys/dev/drm2/drmP.h Sun Feb 9 14:46:50 2014 (r261657) +++ stable/9/sys/dev/drm2/drmP.h Sun Feb 9 14:58:47 2014 (r261658) @@ -697,6 +697,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); @@ -828,8 +829,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 */ Modified: stable/9/sys/dev/drm2/drm_drv.c ============================================================================== --- stable/9/sys/dev/drm2/drm_drv.c Sun Feb 9 14:46:50 2014 (r261657) +++ stable/9/sys/dev/drm2/drm_drv.c Sun Feb 9 14:58:47 2014 (r261658) @@ -207,13 +207,22 @@ static struct drm_msi_blacklist_entry dr {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; } } @@ -262,10 +271,16 @@ int drm_attach(device_t kdev, drm_pci_id 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) @@ -295,10 +310,6 @@ int drm_attach(device_t kdev, drm_pci_id 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);