From owner-freebsd-current Tue Jan 21 16:16:57 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id QAA24721 for current-outgoing; Tue, 21 Jan 1997 16:16:57 -0800 (PST) Received: from Sisyphos.MI.Uni-Koeln.DE (Sisyphos.MI.Uni-Koeln.DE [134.95.212.10]) by freefall.freebsd.org (8.8.4/8.8.4) with SMTP id QAA24716 for ; Tue, 21 Jan 1997 16:16:49 -0800 (PST) Received: from x14.mi.uni-koeln.de (annexr3-11.slip.Uni-Koeln.DE) by Sisyphos.MI.Uni-Koeln.DE with SMTP id AA18571 (5.67b/IDA-1.5 for ); Wed, 22 Jan 1997 01:13:53 +0100 Received: (from se@localhost) by x14.mi.uni-koeln.de (8.8.4/8.6.9) id BAA24037; Wed, 22 Jan 1997 01:13:50 +0100 (CET) Message-Id: 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 X-Mailer: Mutt 0.55-PL15 Mime-Version: 1.0 Sender: owner-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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