From c1207dc20cfb10830a48d20d77f7a913d7a96029 Mon Sep 17 00:00:00 2001 From: jhb Date: Thu, 27 Jun 2013 20:21:54 +0000 Subject: Make detaching drivers from PCI devices more robust. While here, fix a bug where a PCI device would be powered down if it failed to probe, but not when its driver was detached (e.g. via kldunload). - Add a new helper method resource_list_release_active() which forcefully releases any active resources of a specified type from a resource list. - Add a bus_child_detached method for the PCI bus driver which forces any active resources to be released (and whines to the console if it finds any) and then powers the device down. - Call pci_child_detached() if we fail to probe a device when a driver is kldloaded. This isn't perfect but can avoid leaking resources from a probe() routine in the kldload case. Reviewed by: imp, brooks MFC after: 1 month --- sys/dev/pci/pci_private.h | 1 + 1 file changed, 1 insertion(+) (limited to 'sys/dev/pci/pci_private.h') diff --git a/sys/dev/pci/pci_private.h b/sys/dev/pci/pci_private.h index b4c0c9e..9eb0df0 100644 --- a/sys/dev/pci/pci_private.h +++ b/sys/dev/pci/pci_private.h @@ -106,6 +106,7 @@ struct pci_devinfo *pci_read_device(device_t pcib, int d, int b, int s, int f, size_t size); void pci_print_verbose(struct pci_devinfo *dinfo); int pci_freecfg(struct pci_devinfo *dinfo); +void pci_child_detached(device_t dev, device_t child); int pci_child_location_str_method(device_t cbdev, device_t child, char *buf, size_t buflen); int pci_child_pnpinfo_str_method(device_t cbdev, device_t child, -- cgit v1.1