[comp.unix.ultrix] Device driver help

grr@cbmvax.commodore.com (George Robbins) (06/12/91)

In article <haines.676665330@valkyrie> haines@valkyrie.ecn.uoknor.edu (Mark Haines) writes:
> The long, boring story:
> 
>    I recently took a job with the O.U. physics department. We have a DEC
> MicroVAX II. When I got here it was running under Ultrix v1.2 and we had
> v2.3 with manuals and media. Also hanging around is some code for a device
> driver. The driver code is for a DRV11-WA, a DMA card.  When I first started
> I had no idea what I was doing. But as time progressed, I learned more and
> more about what's going on.

>    However, I am now at an impass. There are questions I can't seem to find
> answers to. I seem to be able to compile the code into the kernel, but when
> I try and open the device through a node, it comes back with "No such device
> or address". This is the same error I get when I make a node with an
> arbitrary number. I've listed my device driver in the devices file, so
> why doesn't it find it? Is there something else I'm missing?

If the device is in the cdevsw table and your major node matches, then the
open should be getting to your driver, where kernel printf or other debugging
techniques can be used.  There might be some requirement that the probe
routine return something to admit that the device is present.

>    It might be good if someone out there could suggest a book or paper on
> writing a device driver. I've looked through a couple of Unix books and
> understand the basic principles, but not the specifics.

There are several sources: The Unix Device Driver Book, which is mostly
oriented towards AT&T unix, some documents in the Sun manual set which
are partly sun specific, but at least talk in BSD terms and there is a
new document in the Ultrix 4.2 manual set which describes writing turbo-
channel drivers, which is probably the only Ultrix specific thing you'll
find.  There were rumors of some other Ultrix driver manual or paper,
but it wasn't general distribution or may have only been available to
source licencees, perhaps one of the DEC people could comment.  Finally,
the 4.3BSD Unix Operating System book by Leffler et. all. has a good
overview of the I/O system and driver requirements.

>                                                          I would also like
> to know if there are any differences as far device drivers are concerned
> between v1.2 and v2.3 of Ultrix. I would much rather be running v2.3 (actually
> I would much rather be running v4.2, but I can't seem to talk then prof into
> shelling out the $$).

Yes, there are differences.  Ultrix 1.0 was essentially BSD 4.2 and things
evolved from there.  BSD 4.2 drivers had some magic returns where putting
things in certain register variable would communicate them back to the
kernel.  Ultrix changed these to  globals by 2.X.  The interface to the kernel
memory allocator changed around 3.x.  Ultrix 4.X adds confusion to support
SMP, though this can apparently be avoided.

These things have never been cumulatively documented (perhaps in the new
turbo-driver manual?), sometimes they showed up in the release notes for
a particular release.

-- 
George Robbins - now working for,     uucp:   {uunet|pyramid|rutgers}!cbmvax!grr
but no way officially representing:   domain: grr@cbmvax.commodore.com
Commodore, Engineering Department     phone:  215-431-9349 (only by moonlite)

haines@valkyrie.ecn.uoknor.edu (Mark Haines) (06/12/91)

The long, boring story:

   I recently took a job with the O.U. physics department. We have a DEC
MicroVAX II. When I got here it was running under Ultrix v1.2 and we had
v2.3 with manuals and media. Also hanging around is some code for a device
driver. The driver code is for a DRV11-WA, a DMA card.  When I first started
I had no idea what I was doing. But as time progressed, I learned more and
more about what's going on.
   However, I am now at an impass. There are questions I can't seem to find
answers to. I seem to be able to compile the code into the kernel, but when
I try and open the device through a node, it comes back with "No such device
or address". This is the same error I get when I make a node with an
arbitrary number. I've listed my device driver in the devices file, so
why doesn't it find it? Is there something else I'm missing?
   It might be good if someone out there could suggest a book or paper on
writing a device driver. I've looked through a couple of Unix books and
understand the basic principles, but not the specifics. I would also like
to know if there are any differences as far device drivers are concerned
between v1.2 and v2.3 of Ultrix. I would much rather be running v2.3 (actually
I would much rather be running v4.2, but I can't seem to talk then prof into
shelling out the $$).
   Actually, the whole reason I'm running v1.2 is that before I got this
job, someone managed to compile in a psuedo-functional device driver. I
have a copy of the binary image of it, but not the source code. I'm told
that the source code I was given is close to the orginal, but not quite.
   Anyways, that's the long, boring story. Any help would be appreciated.
If you have any to offer (help that is) please send me mail at:

haines@valkyrie.ecn.uoknor.edu


Thanks in advance,
    Mark


P.S. - Anyone got some spare hair? I seem to have pulled most of mine out.

map@decvax.DEC.COM (Mark Parenti) (06/12/91)

In article <22345@cbmvax.commodore.com>, grr@cbmvax.commodore.com (George Robbins) writes:
|> In article <haines.676665330@valkyrie> haines@valkyrie.ecn.uoknor.edu (Mark Haines) writes:

|> >    It might be good if someone out there could suggest a book or paper on
|> > writing a device driver. I've looked through a couple of Unix books and
|> > understand the basic principles, but not the specifics.
|> 
|> There are several sources: The Unix Device Driver Book, which is mostly
|> oriented towards AT&T unix, some documents in the Sun manual set which
|> are partly sun specific, but at least talk in BSD terms and there is a
|> new document in the Ultrix 4.2 manual set which describes writing turbo-
|> channel drivers, which is probably the only Ultrix specific thing you'll
|> find.  There were rumors of some other Ultrix driver manual or paper,
|> but it wasn't general distribution or may have only been available to
|> source licencees, perhaps one of the DEC people could comment.  Finally,
|> the 4.3BSD Unix Operating System book by Leffler et. all. has a good
|> overview of the I/O system and driver requirements.
|> 

The guide included with V4.2 (Guide to Writing and Porting VMEbus and
TURBOchannel Device Drivers) includes a lot of general ULTRIX device driver
information, including how to include a driver into the kernel, the steps
you should go through for driver installation, and an appendix of kernel 
routine manpages.

If you can't get V4.2 you might try to contact your salesperson or the 
TRIADD organization to see if you can get a copy of the manual.

There are plans to do a more comprehensive set of books which would include a
device driver tutorial.



Mark Parenti
ULTRIX Engineering Group
map@decvax.dec.com