Date: Mon, 13 Nov 2000 00:44:10 -0600 From: Robert Lipe <robertlipe@usa.net> To: freebsd-hackers@freebsd.org Subject: pci bus enumeration & cdevsw indexing Message-ID: <20001113004410.W20018@rjlhome.sco.com>
next in thread | raw e-mail | index | archive | help
I'm new to FreeBSD, but an experienced kernel guy. I'm workgin with 4.1.1 on IA32 and need help understanding the ways of your world. :-) I'd like my project to look like a "normal" driver and use supported interfaces, but I'll patch the core code if I need to. I have a need to walk the PCI bus, gleaning PCI IDs and other data. (Yes, I know a dozen reasons why to NOT do that.) What I *almost* need is the loop in pci_ioctl that walks pci_dev[]. The catch here is that this is a private data structure (static, lots of dependencies on private headers not in <sys/...>, etc) and therefore unavailable. I considered calling the ioctl code myself from withing my driver, but that seems too weird. I thought about shipping the data to myself by way of user-space (daemon does an ioctl ('pciconf -l'ish) to PCI driver, turns around and hands data to me on an ioctl) but that sounds like an application to be punished. Is there a "normal" way for a conforming driver to walk the busses, pluck out bus number, slot number, device id, subsystem id, and all that traditional stuff, or do I just need to carve up pci.c and build my own interface to do it? Also, I have a question on loadable character devices. Is there a way to avoid the hard-coded major numbers in the cdevsw[] entry that's passed? It seems like make_dev() should be able to roam cdevsw, find an empty slot, and create the dev nodes for me. I'm envisioning a very dynamic system with lots of modules (enough that we really don't want to allocate them with a human involved) being popped in and out and would like to not handle the major number management and inevitable conflicts on my own. How is this handled for, say, third-party drivers? Thanx for any help offered. RJL To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001113004410.W20018>