Subject: Adding device drivers
To: None <tech-kern@NetBSD.ORG>
From: Robin Birch <firstname.lastname@example.org>
Date: 08/24/1996 18:44:41
This is the copy of a letter that I have sent to Bertram Barth in Germany.
I guess he won't mind me publishing it. I am stuck, not just in one
place, I don't even understand that place I am in let alone where the
door out is.
To give some background, I am writing some drivers to enhance the handling
of the ka640 cpu in the vax port. I have a major understanding gap of how
device drivers, controllers and busses talk to each other as a software
protocol. Can someone please answer this, even if it is pointing at a book
or academic paper or pages on the net.
I'm getting close to explosion point as I can't see the logic behind anything
as there are sod all comments in any of the code examples and no guidance on
the overall structure. I should explain that I'm not new to this, I have
written many device drivers in the past and am familiar with the process
of adding them to earlier unixes, such as BSD 2. I need some basic guidance
on the structure and protocols between the various bits and then I should
be able to work it out myself.
So HELP!!!!!!!! Please.
Well the mud got thicker. I am now trying to get to the botton of
busses and why we need them.
I have got to the stage where I am allocating space for the le controller
registers and placing these in some registers that can be passed to the
le driver. I now want to write some boiler plate lematch and leattach
routines that can be expanded to actually become the driver. I have worked
out what these routines must do and it all looks quite simple.
Now, I looked at files.vax and came to a shuddering halt. In each entry
there is a line that says something like "attach uba0 at sbi0" and some
vector information if appropriate. I don't have a bus for this driver
to attach to. The problem is that the driver is accessed through an
interrupt register (D4) that is down amongst the system stuff in the
bottom of the interrupt vectors, not up in the bus stuff. In addition
the map for the ka640 doesn't look anything like the map for a vaxstation.
So, I have several questions. Unfortunately these are going to be basic.
1) Everything appears to attach to sbi0 (system backplane I assume).
What function does this perform and is there a protocol of how
the various things attach, what service they get and so on. I am
sorry about such a fundamental question but I must admit I don't
even know the real function, other than galloping elegantism, that
these busses fullfil.
2) If I have to attach to sbi0, how do I fill in the appropriate
interrupt vector. Would it be sufficient to write a handler
and just reference it in the intvec.s stuff or are there specific
things that I have to go through.
3) Do I have to have a separate bus?. I think that it might be a
good idea as there are at least two interrupts that I am going to
have to field (C4 and D4) that are unique to this cpu family. If
this is so what does such a thing look like, what functions does
it have to provide and what are the protocols that it has to pass
up and down.
I am sorry about the basic nature of these questions but I have a serious
understanding gap here. I don't even understand what function these are
all fullfilling as all they appear to do is group various families of
devices together, don't get me wrong this is a good thing, and overly
complicate the device driver interfaces with a lot of stuff that appears
to be totally undocumented and only serve to further isolate the hardware
from the code that is supposed to be serving it :-((((.
I really am stuck here, where oh where can I find documentation on this,
I don't believe that it can't exist as there are so many people who have
worked and contributed on this from widely separated physical locations.