svn commit: r271201 - head/sys/dev/ahci

Warner Losh imp at FreeBSD.org
Sat Sep 6 18:20:51 UTC 2014


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)


More information about the svn-src-head mailing list