From owner-freebsd-current Wed Aug 18 13: 7:54 1999 Delivered-To: freebsd-current@freebsd.org Received: from rah.star-gate.com (216-200-29-190.snj0.flashcom.net [216.200.29.194]) by hub.freebsd.org (Postfix) with ESMTP id 578DE15A4E for ; Wed, 18 Aug 1999 13:07:44 -0700 (PDT) (envelope-from hasty@rah.star-gate.com) Received: from rah.star-gate.com (localhost.star-gate.com [127.0.0.1]) by rah.star-gate.com (8.9.3/8.8.8) with ESMTP id NAA01623; Wed, 18 Aug 1999 13:04:31 -0700 (PDT) (envelope-from hasty@rah.star-gate.com) Message-Id: <199908182004.NAA01623@rah.star-gate.com> X-Mailer: exmh version 2.0.2 2/24/98 To: "Kenneth D. Merry" Cc: dillon@apollo.backplane.com, wilko@yedi.iaf.nl, current@FreeBSD.ORG Subject: Re: [re]writable cdrom drive In-reply-to: Your message of "Wed, 18 Aug 1999 13:55:38 MDT." <199908181955.NAA21794@panzer.kdm.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 18 Aug 1999 13:04:31 -0700 From: Amancio Hasty Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > Amancio Hasty wrote... > > > There is a generic SCSI bus enumerator API, and one for PCI as well. There > > > isn't a generic API to get trees of devices of any type in the system, > > > though. With new-bus that might be possible, but having done two > > > enumerator APIs already (I wrote the CAM and PCI enumerator code), I can > > > predict that it might be very complicated to do properly. (Things get > > > really hairy when you have to keep the device tree from changing while > > > you're traversing it.) > > > > > > In any case, for the two applications you specified, cdrecord is only > > > interested in SCSI devices, and there is already an API -- that cdrecord > > > already supports -- to do bus/device enumeration. The cdrecord -scanbus > > > code already uses that API. > > > > > > Similarly, there is already a PCI device listing interface, so fxtv should > > > be able to easily pull out the devices it is interested in. All it has to > > > do is search for all "meteor" or "bktr" devices to find what it wants. > > > > > > Ken > > > > Now how can I map a device name from this bus enumeration so that I can issue > > an "open" to the device: > > > > pciconf -l > > chip0@pci0:0:0: class=0x060000 card=0x00000000 chip=0x12378086 rev=0x02 > > hdr=0x00 > > isab0@pci0:1:0: class=0x060100 card=0x00000000 chip=0x70008086 rev=0x01 > > hdr=0x00 > > ide_pci0@pci0:1:1: class=0x010180 card=0x00000000 chip=0x70108086 > > rev=0x00 hdr=0x00 > > chip1@pci0:1:2: class=0x0c0300 card=0x00000000 chip=0x70208086 rev=0x01 > > hdr=0x00 > > de0@pci0:9:0: class=0x020000 card=0x11001385 chip=0x00091011 rev=0x22 > > hdr=0x00 > > bktr0@pci0:10:0: class=0x040000 card=0x13eb0070 chip=0x036e109e > > rev=0x02 hdr=0x00 > > none0@pci0:10:1: class=0x048000 card=0x13eb0070 chip=0x0878109e > > rev=0x02 hdr=0x00 > > ahc0@pci0:11:0: class=0x010000 card=0x00000000 chip=0x81789004 rev=0x00 > > hdr=0x00 > > ahc1@pci0:12:0: class=0x010000 card=0x00000000 chip=0x71789004 rev=0x03 > > hdr=0x00 > > vga-pci0@pci0:13:0: class=0x030000 card=0x00000000 chip=0x0519102b > > rev=0x01 hdr=0x00 > > Only one of the above devices actually has a character device interface in > /dev. All you have to do is something like this: > > sprintf(foo, "/dev/%s%d", p->pd_name, p->pd_unit); > > The only way it would become complicated is if the device name in the > kernel were different than the device name in /dev. > > Ken Or if there is a system call or modification to open such that I can issue : open("pci0:10:0", .....) On the kernel side, I hope that the pci code can translate a bus enumeration to an actual major , minor device. The only problem that I see with such an approach is security and I would rather deal with that later. -- Amancio Hasty hasty@rah.star-gate.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message