From owner-freebsd-hackers Mon Dec 9 13:24:19 1996 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id NAA01514 for hackers-outgoing; Mon, 9 Dec 1996 13:24:19 -0800 (PST) Received: from bacall.lodgenet.com (bacall.lodgenet.com [205.138.147.242]) by freefall.freebsd.org (8.8.4/8.8.4) with SMTP id NAA01508 for ; Mon, 9 Dec 1996 13:24:13 -0800 (PST) Received: (from mail@localhost) by bacall.lodgenet.com (8.6.12/8.6.12) id PAA02930; Mon, 9 Dec 1996 15:22:51 -0600 Received: from garbo.lodgenet.com(204.124.123.250) by bacall via smap (V1.3) id sma002925; Mon Dec 9 15:22:40 1996 Received: from jake.lodgenet.com (jake.lodgenet.com [10.0.11.30]) by garbo.lodgenet.com (8.6.12/8.6.9) with ESMTP id PAA11734; Mon, 9 Dec 1996 15:22:53 -0600 Received: from jake.lodgenet.com (localhost [127.0.0.1]) by jake.lodgenet.com (8.8.3/8.6.12) with ESMTP id PAA13091; Mon, 9 Dec 1996 15:22:54 -0600 (CST) Message-Id: <199612092122.PAA13091@jake.lodgenet.com> X-Mailer: exmh version 1.6.9 8/22/96 To: "Jin Guojun[ITG]" cc: hackers@freebsd.org Subject: Re: Q for loadable network driver In-reply-to: Your message of "Mon, 09 Dec 1996 11:10:26 PST." <199612091910.LAA02529@george.lbl.gov> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 09 Dec 1996 15:22:53 -0600 From: "Eric L. Hernes" Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk "Jin Guojun[ITG]" writes: >I have a question in writing a loadable network driver. >How is the PCI device table is load into pcidevice_set list -- > pcidevice_set.ls_items it's a linker set, see the archives for Terry's good explanation of what these are and how they work. >That is, what is the mechanism to replace these lines : > >struct pci_device xyz_device = { > OEM_DRVNAME, > xyz_probe, > xyz_attach, > &xyz_count, > xyz_shutdown >}; > >DATA_SET(pcidevice_set, xyz_device); I believe that they're only used during the autoconf phase of the pci bus. The pci subsystem gets a signature of all devices on the bus; then asks each driver in the pcidevice_set, `hey is this your device?' by calling the probe/attach members. I think they can savely be #ifdef'ed out for the lkm case, because you're not autoconf'ing. Then lkm equivalent is done in the xyz_load call. You might be able to peruse a pci data structure that has a list of `found but not claimed' devices where you should find your device's signature, or you may be able to play with /usr/bin/pciconf to determine if your device exists before attempting the modload. > > >Thanks, > >-Jin > > eric. -- erich@lodgenet.com http://rrnet.com/~erich erich@rrnet.com