Date: Mon, 16 Dec 1996 13:19:33 -0800 From: "Jin Guojun[ITG]" <jin@george.lbl.gov> To: erich@lodgenet.com Cc: hackers@freebsd.org Subject: Re: Q for loadable network driver Message-ID: <199612162119.NAA29129@george.lbl.gov>
next in thread | raw e-mail | index | archive | help
Another question is that is necessary to link the newly loaded driver to the kernel control block -- /sys/pci.c:155:static struct pcicb *pcicb; ------------------------------------------------------------- pci/pci.c: unmodified: line 704 -- /* ** allocate bus descriptor for bus behind the bridge */ link = &pcicb->pcicb_down; while (*link && (*link)->pcicb_bus < secondary) link = &(*link)->pcicb_next; this = malloc (sizeof (*this), M_DEVBUF, M_WAITOK); ... ... /* ** Link it in chain. */ *link=this; pci/pci.c: unmodified: line 819 -- ----------------------------------------------------------------- Without an interface to get the PCI control block address -- &pcicb -- it is hardly to link the new information into the kernel PCI chain. Also, is the segment above (pci/pci.c line 704 - 819) necessary for loading a loadable device driver? Thanks for any information, -Jin }>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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199612162119.NAA29129>