From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 16:54:33 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C12F5106564A; Sun, 19 Apr 2009 16:54:33 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 951108FC0C; Sun, 19 Apr 2009 16:54:33 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3JGsXt5014880; Sun, 19 Apr 2009 16:54:33 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3JGsXUx014879; Sun, 19 Apr 2009 16:54:33 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200904191654.n3JGsXUx014879@svn.freebsd.org> From: Robert Noland Date: Sun, 19 Apr 2009 16:54:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191274 - head/sys/dev/drm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Apr 2009 16:54:34 -0000 Author: rnoland Date: Sun Apr 19 16:54:33 2009 New Revision: 191274 URL: http://svn.freebsd.org/changeset/base/191274 Log: Don't try to setup interrupts for drivers that don't support them. This causes sis and probably a couple of other driver to panic and fail. Tested by: cpghost PR: 133554 MFC after: 3 days Modified: head/sys/dev/drm/drm_drv.c Modified: head/sys/dev/drm/drm_drv.c ============================================================================== --- head/sys/dev/drm/drm_drv.c Sun Apr 19 16:17:13 2009 (r191273) +++ head/sys/dev/drm/drm_drv.c Sun Apr 19 16:54:33 2009 (r191274) @@ -134,7 +134,7 @@ static struct cdevsw drm_cdevsw = { .d_flags = D_TRACKCLOSE }; -int drm_msi = 1; /* Enable by default. */ +static int drm_msi = 1; /* Enable by default. */ TUNABLE_INT("hw.drm.msi", &drm_msi); static struct drm_msi_blacklist_entry drm_msi_blacklist[] = { @@ -228,28 +228,31 @@ 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); - if (drm_msi && - !drm_msi_is_blacklisted(dev->pci_vendor, dev->pci_device)) { - msicount = pci_msi_count(dev->device); - DRM_DEBUG("MSI count = %d\n", msicount); - if (msicount > 1) - msicount = 1; + if (drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) { + if (drm_msi && + !drm_msi_is_blacklisted(dev->pci_vendor, dev->pci_device)) { + msicount = pci_msi_count(dev->device); + DRM_DEBUG("MSI count = %d\n", msicount); + if (msicount > 1) + msicount = 1; + + if (pci_alloc_msi(dev->device, &msicount) == 0) { + DRM_INFO("MSI enabled %d message(s)\n", + msicount); + dev->msi_enabled = 1; + dev->irqrid = 1; + } + } - if (pci_alloc_msi(dev->device, &msicount) == 0) { - DRM_INFO("MSI enabled %d message(s)\n", msicount); - dev->msi_enabled = 1; - dev->irqrid = 1; + dev->irqr = bus_alloc_resource_any(dev->device, SYS_RES_IRQ, + &dev->irqrid, RF_SHAREABLE); + if (!dev->irqr) { + return ENOENT; } - } - dev->irqr = bus_alloc_resource_any(dev->device, SYS_RES_IRQ, - &dev->irqrid, RF_SHAREABLE); - if (!dev->irqr) { - return ENOENT; + dev->irq = (int) rman_get_start(dev->irqr); } - dev->irq = (int) rman_get_start(dev->irqr); - mtx_init(&dev->dev_lock, "drmdev", NULL, MTX_DEF); mtx_init(&dev->irq_lock, "drmirq", NULL, MTX_DEF); mtx_init(&dev->vbl_lock, "drmvbl", NULL, MTX_DEF);