From owner-freebsd-hackers Wed Mar 21 15:30: 9 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from mass.dis.org (mass.dis.org [216.240.45.41]) by hub.freebsd.org (Postfix) with ESMTP id EB42C37B71E for ; Wed, 21 Mar 2001 15:30:05 -0800 (PST) (envelope-from msmith@mass.dis.org) Received: from mass.dis.org (localhost [127.0.0.1]) by mass.dis.org (8.11.2/8.11.2) with ESMTP id f2LNReh03247; Wed, 21 Mar 2001 15:27:40 -0800 (PST) (envelope-from msmith@mass.dis.org) Message-Id: <200103212327.f2LNReh03247@mass.dis.org> X-Mailer: exmh version 2.1.1 10/15/1999 To: Alexey Dokuchaev Cc: hackers@freebsd.org Subject: Re: Some PCI-related programming things In-reply-to: Your message of "Thu, 22 Mar 2001 05:18:50 +0600." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 21 Mar 2001 15:27:40 -0800 From: Mike Smith Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > 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. This wasn't clear from your example. > > 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. Ok. So why are you attempting to manipulate PCI configuration space? > What I am doing is *porting* linux *character* device driver to FreeBSD. A device driver still talks to hardware, and by the sound of it, your hardware is PCI hardware. Since you won't actually tell me what it is you're actually doing with any sort of useful level of detail, it is very hard to give you useful answers. > 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. You're writing a device driver. Look at other device drivers that behave similarly. Whether the driver has a character interface or not is more or less irrelevant at this stage. 8) > 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? Firstly, there is no such thing as "a character device driver". Secondly, if it's running inside the kernel, it doesn't matter what it is; you don't make ioctl calls (exception: ABI shims). If you're not going to explain, in more specific terms, what it is you're doing, I'm just going to have to keep guessing. So far, I don't have enough to go on to give you very good answers; the more detail you give me, the better I can help you. If you don't like the answers you're getting, this should be a clue to you that you're not giving me enough detail. 8) Regards, Mike -- ... every activity meets with opposition, everyone who acts has his rivals and unfortunately opponents also. But not because people want to be opponents, rather because the tasks and relationships force people to take different points of view. [Dr. Fritz Todt] V I C T O R Y N O T V E N G E A N C E To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message