Subject: RE: okey, its time to get some more terminals.
To: Gunnar Helliesen <gunnar@bitcon.no>
From: Johnny Billquist <bqt@Update.UU.SE>
List: port-vax
Date: 09/17/1998 18:33:35
On Thu, 17 Sep 1998, Gunnar Helliesen wrote:

> Ronny Svedman wrote:
> > 
> > Is it not possible to avoid building a kernel, by simply 
> > setting the card
> > switches to whatever is teh kernels idea of where it's at ?
> 
> Well, that depends on what other hardware you have installed. The point
> is to avoid conflicts on the bus.

Correct.

> Some examples. Let's say you have exactly one RQDX3, one TQK50, one
> DELQA and one DHV11:
> 
> 
> VMS$ mc sysgen
> SYSGEN>  CONFIG
> DEVICE> uda
> DEVICE> tu81
> DEVICE> qna
> DEVICE> dhv11
> DEVICE>  Exit 
> Device: UDA    Name: PUA  CSR: 772150   Vector: 154   Support: yes 
> Device: TU81   Name: PTA  CSR: 774500   Vector: 260   Support: yes 
> Device: QNA    Name: XQA  CSR: 774440   Vector: 120   Support: yes 
> Device: DHV11  Name: TXA  CSR: 760440*  Vector: 300*  Support: yes 
> SYSGEN>  
> 
> 
> As you can see, in this case you can leave the DVH11 at its default
> setting and simply use the generic kernel.

Please note the '*' after the addresses. They are very important if you
want to understand this... The '*' means that it has been assigned an
address in the floating space of the bus.

> Next example. One RQDX3 and one UC07 (MSCP), one TQK50 and one UC07
> (TMSCP), two DEQNA and four DHV11:
> 
> 
> SYSGEN>  CONFIG
> DEVICE> uda,2
> DEVICE> tu81,2
> DEVICE> qna,2
> DEVICE> dhv11,4
> DEVICE>  Exit 
> Device: UDA    Name: PUA  CSR: 772150   Vector: 154   Support: yes 
> Device: TU81   Name: PTA  CSR: 774500   Vector: 260   Support: yes 
> Device: QNA    Name: XQA  CSR: 774440   Vector: 120   Support: yes 
> Device: QNA    Name: XQB  CSR: 774460   Vector: 300*  Support: yes 
> Device: UDA    Name: PUB  CSR: 760334*  Vector: 304*  Support: yes 
> Device: TU81   Name: PTB  CSR: 760444*  Vector: 310*  Support: yes 
> Device: DHV11  Name: TXA  CSR: 760500*  Vector: 320*  Support: yes 
> Device: DHV11  Name: TXB  CSR: 760520*  Vector: 330*  Support: yes 
> Device: DHV11  Name: TXC  CSR: 760540*  Vector: 340*  Support: yes 
> Device: DHV11  Name: TXD  CSR: 760560*  Vector: 350*  Support: yes 
> SYSGEN>  
> 
> 
> In this case you _have_ to change the settings of the DHV11s. The
> default CSR of 760440 would clash with the second tape controller and
> the default Vector of 300 would clash with the second DEQNA.

Actually no. 760440 is not used by anything. The UDA only uses two
addresses, so 760440 is actually free. But will also note that a lot of
things are now assigned addresses in the free space.

So, what is the free space, why are addresses assigned like this by
SYSGEN, and what does it have to do with us?

First of all. The address space of the bus is 760000-777776 (octal). When
DEC designed the Unibus (yes, this all has to do with the Unibus), some
peripherials were deemed to standard that (almost) all systems would have
them. Those perihperials were therefore given standardized addresses on
the bus. But a lot of perihperials were more uncommon, and could exist in
any number, so it wasn't practical to assign fixed addresses for all cards
so that you could cover all combinations customers might want. So instead
they decided that part of the address space were free. Nothing was decided
about that space, and cards could be configured to exist anywhere in
there, thus 'floating space'.

Now, if you think plug-and-play is a new concept, you'd better reconsider.
DEC wanted the systems for the pdp-11 to be able to autoconfigure
themself, and in order to do this, DEC thought of a scheme to be able to
automatically figure out what cards were in the system. Remember that most
cards don't have any kind of id, so you cannot just probe an address and
see what card is there. So DEC decided on ordering all cards they made.
The first card (in this order) went at the first address in floating
space (760020), and every card of the same type follow immediately after.
When you have put in all cards of the first type in the system, you leave
an empty space in the addressing range for yet another card of that type.
Then you do the same thing with the next card in the ordering scheme. (One
additional rule is that cards with two registers must be on an address
modulo four, four registers on an address modulo eight, and so on...)

Now, how does this work then? Simple. The operating system knows the
decided order for the cards too, and it starts probing the start of the
floating address range for the first cards, and for each address it can
access it decides that one card of that type exist. When you get a bus
timeout, there are no more cards of that type, and you start probing for
the next type of cards the same way.

How does this affect us? Actually, not at all. There are absolutely
nothing that forces us to use the DEC floating space scheme. It can be an
advantage if we want to run DEC software, such as diagnostics, but it
definitely isn't neccesary. Will something bad happen to NetBSD if we
don't follow it? No. Will DEC software not run if we don't follow it.
Probably no, unless that software probes for extra devices, and really
need them to work to get things going. Note for instance that the first
UDA-50 (or equivalent) has a fixed address, as do the console, so most
things work just fine even if you do probe for stuff.

So, for each type of device, you'll get a gap in the address space in
DEC's scheme. Follow that scheme if you like, or start plugging things in
from 760020 if you care to. The Q-bus works the same way as the Unibus in
this regard.

So, for Gunnar's example previously. 760440 is actually the gap that
indicates that there are no more UDA-50 in the system. It's a free
address, and if the DHV-11 only uses two registers, if will fit just fine.
After that comes the TU81, which also is a two-registerer device, so after
760450 you have a little more free area.

But the thing you *cannot* do is to allow two devices to really overlap
each other, that is a Bad Thing(tm).

Sorry if this became long...

	Johnny

Johnny Billquist                  || "I'm on a bus
                                  ||  on a psychedelic trip
email: bqt@update.uu.se           ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol