Date: Mon, 29 Sep 1997 23:50:03 +0200 From: Stefan Esser <se@FreeBSD.ORG> To: "Ron G. Minnich" <rminnich@sarnoff.com> Cc: hackers@FreeBSD.ORG Subject: Re: PCI device loadable module Message-ID: <19970929235003.22285@mi.uni-koeln.de> In-Reply-To: <Pine.SUN.3.91.970929152430.7416A-100000@terra>; from Ron G. Minnich on Mon, Sep 29, 1997 at 03:28:29PM -0400 References: <Pine.SUN.3.91.970929152430.7416A-100000@terra>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sep 29, "Ron G. Minnich" <rminnich@Sarnoff.COM> wrote: > maybe this is all clear on 3.0, but i am on 2.2.1. Hmm, I added PCI LKM support to the then 2.2-current in January 1997, but it has been temporarily disabled there, when I replaced the PCI code by a total rewrite ... Since I expected some data structures to change again, I did not move these changes into the -stable tree, yet. You want revision 1.64 of /sys/pci/pci.c and revision 1.8 of /sys/pci/pcibus.h, which should just fit into a 2.2.1 source tree. Let me know, if you have any trouble with them! > Here's the question: I have a loadable module for a device. How do I > arrange for the probe() to be called? As i understand it on fbsd this > happens at pci_configure time, which is done at boot time. But my driver > is not in at that point, obviously: so what's the right thing to do? You call pci_register_lkm(&xxx_device). The parameter is the address of the struct pci_device that is put into the DATA_SET in case of a compiled in driver ... > pci_configure says it can be called more than once. So, should my load > entry point call pci_configure()? what's the right way here? There are no > examples in the lkm's that I can find that point the way. The following is from a message I sent to the -current list on January 22, 1997: % From se@freebsd.org Wed Jan 22 05:18:09 1997 % Subject: PCI LKM support added to -current % % 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. Regards, STefan
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19970929235003.22285>