Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Mar 2009 08:42:28 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r189731 - head/sys/dev/cardbus
Message-ID:  <200903120842.n2C8gSsn023728@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Thu Mar 12 08:42:27 2009
New Revision: 189731
URL: http://svn.freebsd.org/changeset/base/189731

Log:
  Move the deactivation of the device's BAR to before the loop where we
  turn deactivate the resources.  While this likely doesn't matter, it
  is likely to be safer.

Modified:
  head/sys/dev/cardbus/cardbus.c

Modified: head/sys/dev/cardbus/cardbus.c
==============================================================================
--- head/sys/dev/cardbus/cardbus.c	Thu Mar 12 08:27:54 2009	(r189730)
+++ head/sys/dev/cardbus/cardbus.c	Thu Mar 12 08:42:27 2009	(r189731)
@@ -289,6 +289,11 @@ cardbus_release_all_resources(device_t c
 	struct resource_list_entry *rle;
 	device_t dev;
 
+	/* Turn off access to resources we're about to free */
+	dev = dinfo->pci.cfg.dev;
+	pci_write_config(dev, PCIR_COMMAND,
+	    pci_read_config(dev, PCIR_COMMAND, 2) &
+	    ~(PCIM_CMD_MEMEN | PCIM_CMD_PORTEN), 2);
 	/* Free all allocated resources */
 	STAILQ_FOREACH(rle, &dinfo->pci.resources, link) {
 		if (rle->res) {
@@ -298,11 +303,6 @@ cardbus_release_all_resources(device_t c
 		}
 	}
 	resource_list_free(&dinfo->pci.resources);
-	/* turn off the card's decoding now that the resources are done */
-	dev = dinfo->pci.cfg.dev;
-	pci_write_config(dev, PCIR_COMMAND,
-	    pci_read_config(dev, PCIR_COMMAND, 2) &
-	    ~(PCIM_CMD_MEMEN | PCIM_CMD_PORTEN), 2);
 }
 
 /************************************************************************/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903120842.n2C8gSsn023728>