Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Jan 1997 01:13:50 +0100
From:      se@freebsd.org (Stefan Esser)
To:        current@freebsd.org
Subject:   PCI LKM support added to -current
Message-ID:  <Mutt.19970122011350.se@x14.mi.uni-koeln.de>

next in thread | raw e-mail | index | archive | help
On Jan 21, se@freefall.freebsd.org (Stefan Esser) wrote:
> se          97/01/21 15:41:44
> 
>   Modified:    sys/pci   pcibus.h
>   Log:
>   Add PCI LKM support:
>   The new function pci_register_lkm (struct pci_device *dvp) appends the
>   driver to the list of known PCI drivers, and initiates a PCI bus rescan.

This completes my changes to add PCI LKM support to FreeBSD-current.

Some code has to be called from /etc/rc, if PCI LKMs are to be modloaded
automatically as part of going multi-user. 

I'm suggesting something as follows (to be called from rc.d):

*** /dev/null   Tue Dec 31 15:02:04 1996
--- load-pci-lkm.sh     Tue Dec 31 14:25:31 1996
***************
*** 0 ****
--- 1,12 ----
+ #!/bin/sh
+ for dev in `pciconf -l |cut -f1`
+ do
+     if pciconf -a $dev | grep -q "not attached"
+     then
+ 	DevVendorID=`pciconf -r $dev 0`
+ 	LKM=`grep $DevVendorID /etc/pcidevices | cut -f 2`
+ 	LKMfile=/lkm/pci/$LKM.o
+ 	echo "$dev Loading $LKMfile for DevVendorID $DevVendorID"
+ 	modload $LKMfile
+     fi
+ done

The file /etc/pcidevices will contain lines with the PCI vendor and device
ID, and an associated driver object file:

0x802910ec      if_ed


In order to attach a PCI LKM, just call pci_register_lkm with the address
of a struct pci_device (which is a parameter to the DATA_SET macro in the
non-LKM case). On return from pci_register_lkm(), all devices that have 
no driver attached, will have been offered to the new device's probe()
function, and will have been attached, if the probe succeeded.

An pci_unregister_lkm function is expected to follow soon.
It will require changes to all PCI drivers, since a shutdown function has
to be provided in struct pci_device.

Regards, STefan



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