From owner-freebsd-hackers Sun Nov 12 22:42:55 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from rjlhome.sco.com (unknown [207.65.180.181]) by hub.freebsd.org (Postfix) with ESMTP id 47F1137B479 for ; Sun, 12 Nov 2000 22:42:53 -0800 (PST) Received: by rjlhome.sco.com (8.9.3/SCO5) id AAA16520 for freebsd-hackers@freebsd.org; Mon, 13 Nov 2000 00:44:10 -0600 (CST) Date: Mon, 13 Nov 2000 00:44:10 -0600 From: Robert Lipe To: freebsd-hackers@freebsd.org Subject: pci bus enumeration & cdevsw indexing Message-ID: <20001113004410.W20018@rjlhome.sco.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.4i Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 , 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