aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/cardbus
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2009-03-12 08:42:27 +0000
committerWarner Losh <imp@FreeBSD.org>2009-03-12 08:42:27 +0000
commitafb1ec6d569403a78f60ef4802e2e67c29edf2f4 (patch)
tree4a23a01d53627955ef6a0f4053c93296fc318aba /sys/dev/cardbus
parentb1db3b7a40df17c17e2c93d95a5318aa1d55792f (diff)
downloadsrc-afb1ec6d569403a78f60ef4802e2e67c29edf2f4.tar.gz
src-afb1ec6d569403a78f60ef4802e2e67c29edf2f4.zip
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.
Notes
Notes: svn path=/head/; revision=189731
Diffstat (limited to 'sys/dev/cardbus')
-rw-r--r--sys/dev/cardbus/cardbus.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/dev/cardbus/cardbus.c b/sys/dev/cardbus/cardbus.c
index 75e3339152b9..8a333ada3388 100644
--- a/sys/dev/cardbus/cardbus.c
+++ b/sys/dev/cardbus/cardbus.c
@@ -289,6 +289,11 @@ cardbus_release_all_resources(device_t cbdev, struct cardbus_devinfo *dinfo)
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 cbdev, struct cardbus_devinfo *dinfo)
}
}
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);
}
/************************************************************************/