From owner-svn-src-all@FreeBSD.ORG Sat Sep 6 18:20:51 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8E711557; Sat, 6 Sep 2014 18:20:51 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7A4AB13CF; Sat, 6 Sep 2014 18:20:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s86IKpfM042261; Sat, 6 Sep 2014 18:20:51 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s86IKpnw042259; Sat, 6 Sep 2014 18:20:51 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201409061820.s86IKpnw042259@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 6 Sep 2014 18:20:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r271201 - head/sys/dev/ahci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Sep 2014 18:20:51 -0000 Author: imp Date: Sat Sep 6 18:20:50 2014 New Revision: 271201 URL: http://svnweb.freebsd.org/changeset/base/271201 Log: Restore order of interrupt setup. Minor problems can result by setting up the interrupts too early: Reviewed by: mav@ Sponsored by: Netflix Modified: head/sys/dev/ahci/ahci.c head/sys/dev/ahci/ahci_pci.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Sat Sep 6 18:08:21 2014 (r271200) +++ head/sys/dev/ahci/ahci.c Sat Sep 6 18:20:50 2014 (r271201) @@ -229,6 +229,15 @@ ahci_attach(device_t dev) ahci_ctlr_setup(dev); + /* Setup interrupts. */ + if (ahci_setup_interrupt(dev)) { + bus_dma_tag_destroy(ctlr->dma_tag); + bus_release_resource(dev, SYS_RES_MEMORY, ctlr->r_rid, + ctlr->r_mem); + rman_fini(&ctlr->sc_iomem); + return ENXIO; + } + i = 0; for (u = ctlr->ichannels; u != 0; u >>= 1) i += (u & 1); Modified: head/sys/dev/ahci/ahci_pci.c ============================================================================== --- head/sys/dev/ahci/ahci_pci.c Sat Sep 6 18:08:21 2014 (r271200) +++ head/sys/dev/ahci/ahci_pci.c Sat Sep 6 18:20:50 2014 (r271201) @@ -417,13 +417,6 @@ ahci_pci_attach(device_t dev) ctlr->numirqs = 1; } - if (ahci_setup_interrupt(dev)) { - if (ctlr->msi) - pci_release_msi(dev); - bus_release_resource(dev, SYS_RES_MEMORY, ctlr->r_rid, ctlr->r_mem); - return ENXIO; - } - error = ahci_attach(dev); if (error != 0) if (ctlr->msi)