Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 09 Dec 1996 15:22:53 -0600
From:      "Eric L. Hernes" <erich@lodgenet.com>
To:        "Jin Guojun[ITG]" <jin@george.lbl.gov>
Cc:        hackers@freebsd.org
Subject:   Re: Q for loadable network driver 
Message-ID:  <199612092122.PAA13091@jake.lodgenet.com>
In-Reply-To: Your message of "Mon, 09 Dec 1996 11:10:26 PST." <199612091910.LAA02529@george.lbl.gov> 

next in thread | previous in thread | raw e-mail | index | archive | help
"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






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