summaryrefslogtreecommitdiffstats
path: root/sys/pci/pci.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1999-04-24 19:59:20 +0000
committerpeter <peter@FreeBSD.org>1999-04-24 19:59:20 +0000
commite7462e4ae57c4f138096d5845ab761b06a08fb0a (patch)
tree9ee3e749205bf562cf331a25d5e24364dcfa94bb /sys/pci/pci.c
parent484e1a3ce13414a858152975b70ae9751604a37a (diff)
downloadFreeBSD-src-e7462e4ae57c4f138096d5845ab761b06a08fb0a.zip
FreeBSD-src-e7462e4ae57c4f138096d5845ab761b06a08fb0a.tar.gz
Replace the pcidevice_set linker set based configuration mechanism for old
style pci drivers with a simple one-line change to use a module that registers itself under new-bus and should in theory enable just about all of the pci drivers to be loadable (kldload and loader(8)) but without having the impact of converting the APIs yet. This also fixes the problem of having undefined variables when only new-style pci drivers are present.
Diffstat (limited to 'sys/pci/pci.c')
-rw-r--r--sys/pci/pci.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/sys/pci/pci.c b/sys/pci/pci.c
index 889550c..6312279 100644
--- a/sys/pci/pci.c
+++ b/sys/pci/pci.c
@@ -23,7 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: pci.c,v 1.94 1999/04/11 02:47:31 eivind Exp $
+ * $Id: pci.c,v 1.95 1999/04/16 21:22:52 peter Exp $
*
*/
@@ -38,6 +38,7 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
+#include <sys/module.h>
#include <sys/fcntl.h>
#include <sys/conf.h>
#include <sys/kernel.h>
@@ -926,17 +927,17 @@ static devclass_t pci_devclass;
/*
* Create a new style driver around each old pci driver.
*/
-static void
-pci_wrap_old_drivers(void)
+int
+compat_pci_handler(struct moduledata *mod, int type, void *data)
{
- struct pci_device **dvpp, *dvp;
+ struct pci_device *dvp = (struct pci_device *)data;
+ driver_t *driver;
- dvpp = (struct pci_device **)pcidevice_set.ls_items;
- while ((dvp = *dvpp++) != NULL) {
- driver_t *driver;
+ switch (type) {
+ case MOD_LOAD:
driver = malloc(sizeof(driver_t), M_DEVBUF, M_NOWAIT);
if (!driver)
- continue;
+ return ENOMEM;
bzero(driver, sizeof(driver_t));
driver->name = dvp->pd_name;
driver->methods = pci_compat_methods;
@@ -944,7 +945,14 @@ pci_wrap_old_drivers(void)
driver->softc = sizeof(struct pci_devinfo *);
driver->priv = dvp;
devclass_add_driver(pci_devclass, driver);
+ break;
+ case MOD_UNLOAD:
+ printf("%s: module unload not supported!\n", mod->name);
+ return EOPNOTSUPP;
+ default:
+ break;
}
+ return 0;
}
/*
@@ -1330,7 +1338,7 @@ pci_modevent(module_t mod, int what, void *arg)
{
switch (what) {
case MOD_LOAD:
- pci_wrap_old_drivers();
+ /* pci_wrap_old_drivers(); */
break;
case MOD_UNLOAD:
OpenPOWER on IntegriCloud