From owner-freebsd-hackers Wed Mar 21 15:19:13 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from linux.ssc.nsu.ru (linux.ssc.nsu.ru [193.124.219.91]) by hub.freebsd.org (Postfix) with SMTP id 9226137B71F for ; Wed, 21 Mar 2001 15:19:08 -0800 (PST) (envelope-from danfe@inet.ssc.nsu.ru) Received: (qmail 1544 invoked from network); 21 Mar 2001 23:19:06 -0000 Received: from inet.ssc.nsu.ru (62.76.110.12) by hub.freebsd.org with SMTP; 21 Mar 2001 23:19:06 -0000 Received: from localhost (danfe@localhost) by inet.ssc.nsu.ru (8.9.3/8.9.3) with ESMTP id FAA26677; Thu, 22 Mar 2001 05:18:50 +0600 Date: Thu, 22 Mar 2001 05:18:50 +0600 (NOVT) From: Alexey Dokuchaev To: Mike Smith Cc: freebsd-hackers@freebsd.org Subject: Re: Some PCI-related programming things In-Reply-To: <200103212304.f2LN4lh03035@mass.dis.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Wed, 21 Mar 2001, Mike Smith wrote: > > > > Did I say I'm doing it from userspace?! If I did (too lazy to dig into > > > > sent-mail), I beg your pardon :) > > > > > > Your FreeBSD sample involved making an ioctl call, so it must have been > > > from userspace. > > > > Is anything wrong with using ioctl calls from device driver? > > Perhaps a more polite answer is called for. 8) > > Ioctls allow user processes to make function calls within a device > driver; they are a mechanism for exporting functionality from a device > driver out into userspace. I know that, of course. > You don't call them from other device drivers, no. There are exported > interfaces inside the kernel for doing this, and you will understand > everything much better if you go look at a simple FreeBSD PCI device > driver, particularly the _probe and _attach functions. Look, I am *not* coding a PCI driver. I have looked at various examples in sound/pci/ and I know what PCI device driver should look like. What I am doing is *porting* linux *character* device driver to FreeBSD. That is, if original version called all that linuxish pci_whatever() functions, I have to provide the same functionality under FreeBSD. I didn't know how to do this. What I did was, I said man pci, from there I figured out about pciconf utility. I took a look at it, and thought, ok, this must be the way I have to go for under FreeBSD. At first, I thought I calling ioctl's from kernel space is probably at least weird idea (if not to call it bad). But I was unable to find any PCI-related doc which would answer my questions. Trust me, if I wanted to code a PCI dev driver, I would certainly not do this. I have a code to take a look at, and I only ask questions when I seem to fail to comprehend going of things from the code. It's not written anywhere I can't use ioctl from char device driver. Or is it? -- Me To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message