Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Since the intention in capturing a device's PCI ...
details: https://anonhg.NetBSD.org/src/rev/854cc5909f79
branches: trunk
changeset: 746785:854cc5909f79
user: dyoung <dyoung%NetBSD.org@localhost>
date: Wed Aug 19 21:36:47 2009 +0000
description:
Since the intention in capturing a device's PCI Configuration Space
in pci_probe_device() is for pcidevdetached() to restore the device's
original PCI Configuration Space after it is detached, let's capture
a device's PCI configuration before attaching a driver to it instead
of after. Capturing the configuration after attaching is too late,
because a driver such as ath(4) may put a device to sleep promptly
after attaching it, and putting a PCI device to sleep often entails
changing PCI configuration from defaults.
diffstat:
sys/dev/pci/pci.c | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)
diffs (49 lines):
diff -r 3c85d4331ada -r 854cc5909f79 sys/dev/pci/pci.c
--- a/sys/dev/pci/pci.c Wed Aug 19 20:51:47 2009 +0000
+++ b/sys/dev/pci/pci.c Wed Aug 19 21:36:47 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci.c,v 1.123 2009/07/04 21:01:10 cegger Exp $ */
+/* $NetBSD: pci.c,v 1.124 2009/08/19 21:36:47 dyoung Exp $ */
/*
* Copyright (c) 1995, 1996, 1997, 1998
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.123 2009/07/04 21:01:10 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.124 2009/08/19 21:36:47 dyoung Exp $");
#include "opt_pci.h"
@@ -276,7 +276,6 @@
pcireg_t id, csr, class, intr, bhlcr;
int ret, pin, bus, device, function;
int locs[PCICF_NLOCS];
- device_t subdev;
pci_decompose_tag(pc, tag, &bus, &device, &function);
@@ -363,17 +362,17 @@
locs[PCICF_DEV] = device;
locs[PCICF_FUNCTION] = function;
- subdev = config_found_sm_loc(sc->sc_dev, "pci", locs, &pa,
- pciprint, config_stdsubmatch);
-
c = &sc->PCI_SC_DEVICESC(device, function);
- c->c_dev = subdev;
pci_conf_capture(pc, tag, &c->c_conf);
if (pci_get_powerstate(pc, tag, &c->c_powerstate) == 0)
c->c_psok = true;
else
c->c_psok = false;
- ret = (subdev != NULL);
+
+ c->c_dev = config_found_sm_loc(sc->sc_dev, "pci", locs, &pa,
+ pciprint, config_stdsubmatch);
+
+ ret = (c->c_dev != NULL);
}
return ret;
Home |
Main Index |
Thread Index |
Old Index