Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Writing a PCI device driver

2 views
Skip to first unread message

Steven Grunza

unread,
Jul 25, 2000, 3:00:00 AM7/25/00
to
I'm writing a PCI device driver for a proprietary board. It really
wants to be a STREAMS driver since the board is a network interface
card; however, NetBSD doesn't do STREAMS, yet....

Since the data packet size varies from a couple of characters to a few
hundred, I'm trying to structure the driver as a character device. I've
written a character pseudo-driver for NetBSD but I'm having some
problems with the what happens after _attach(). My driver currently
finds my board, supposedly assigns an IRQ to it, and then does nothing.

If anyone is interested I can send the current driver to them if it
would help (not much in it yet). Thanks for any input.

Steven Grunza

PS
This is a side project I'm doing at my company but if it works well,
NetBSD should get some good exposure in my company. We currently test
in SPARC based chassis with Solaris and have had some really bad crashes
from test people pulling the power plug. If I can get NetBSD to talk to
the board enough to do diagnostics, I can build a SPARC boot floppy with
the driver and diagnostic program. If the power get pulled, no harm
done since the whole OS will be running from a RAMdisk.....

Manuel Bouyer

unread,
Jul 26, 2000, 3:00:00 AM7/26/00
to
On Tue, Jul 25, 2000 at 02:44:09PM -0400, Steven Grunza wrote:
> I'm writing a PCI device driver for a proprietary board. It really
> wants to be a STREAMS driver since the board is a network interface
> card; however, NetBSD doesn't do STREAMS, yet....
>
> Since the data packet size varies from a couple of characters to a few
> hundred, I'm trying to structure the driver as a character device. I've
> written a character pseudo-driver for NetBSD but I'm having some
> problems with the what happens after _attach(). My driver currently
> finds my board, supposedly assigns an IRQ to it, and then does nothing.

For what you want to do I guess your should't have a character pseudo-driver;
it's your PCI driver which should have a /dev character device entry.

It's not really hard, I think you can just merge your pseudo-driver back in
the PCI driver. You can for example look at the sys/dev/scsipi/uk.c driver.
It's not a PCI one but also have an attach function. As far as the character
device is concerned it should work the same way.

--
Manuel Bouyer, LIP6, Universite Paris VI. Manuel...@lip6.fr
--

Steven Grunza

unread,
Jul 26, 2000, 3:00:00 AM7/26/00
to
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm at the point now where config complains about *'d devices and
needs-count.

I've found the prototypes for a character device with:
read
write
open
close
ioctl

If I use "jag* at pci? dev ? function ? " I get an error.

If I use "jag0 at pci? dev ? function ?
jag1 at pci? dev ? function ?" it works.

Now to write the real driver code....

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBOX8hh75JUwXGNWihEQKa9ACcCx24wMNfsl4lRAanFq7dWsfzGB4Anjxp
ZsxrYJUFyzVtDwh8nvo/DQ2z
=qvuL
-----END PGP SIGNATURE-----

----------------------------------------------------------------------
"Luke, you're going to find that many | Steven Grunza
of the truths we cling to depend | voice: (856) 787 - 2759
greatly on our own point of view." | fax: (856) 866 - 2033
- Obi Wan Kenobi, Return of the Jedi | e-mail: steven...@ieee.org
----------------------------------------------------------------------

Manuel Bouyer

unread,
Jul 26, 2000, 3:00:00 AM7/26/00
to
On Wed, Jul 26, 2000 at 01:36:08PM -0400, Steven Grunza wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I'm at the point now where config complains about *'d devices and
> needs-count.

Then you just have to drop needs-count from the device description in
file.pci, it's not mandatory. A sane driver shouldn't use needs-count
anyway :)

>
> I've found the prototypes for a character device with:
> read
> write
> open
> close
> ioctl

Depends on what you intend to do, you may not need the read and write
routines (this is the case if you only want to talk with the driver through
IOCTLs).

--
Manuel Bouyer <bou...@antioche.eu.org>
--

0 new messages