Subject: Setting up the QDSS as the console and twisted uba stuff.
To: None <port-vax@NetBSD.ORG>
From: Boris Gjenero <bgjenero@undergrad.math.uwaterloo.ca>
List: port-vax
Date: 02/17/1998 00:21:44
Well, so far I've managed to get all of qd.c to compile except for a
part which configures the QDSS as the console.  This is twisted and it
is confusing me.

It seems this gets called at the beginning.  This is apparently after
memory management has been enabled but before any configuration has been
done (because the configuration outputs messages to the console).  So
basically I have to use a qbus device before the device or tbe bus has
been configured by the kernel.  I don't think that there is any other
device driver in NetBSD/vax which does such a thing.

Here's the code.  It was in qdcons_init and and this should get done in
qdcninit. (pcpu is a structure for the current cpu)
-----
        /*
         * Map device registers - the last 8K of qvmem.
         */
        qb = (struct qbus *)pcpu->pc_io->io_details;
        ioaccess(qb->qb_iopage, UMEMmap[0] + qb->qb_memsize,
                 UBAIOPAGES * NBPG);
        devptr = (u_short *)((char *)umem[0]+(qb->qb_memsize * NBPG));
        qdaddr = (u_short *)((u_int)devptr + ubdevreg(QDSSCSR));
        if (badaddr((caddr_t)qdaddr, sizeof(short)))
                return 0;

        /*
         * Map q-bus memory used by qdss. (separate map)
         */
        mapix = QMEMSIZE - (CHUNK * (unit + 1));
        phys_adr = qb->qb_maddr + mapix;
        ioaccess(phys_adr, QVmap[0], (CHUNK*NQD));
------

It seems to me that the first ioaccess maps the *entire* Q-bus IO page. 
It also seems uba.c does this with kmem_suballoc followed by pmap_map. 
I don't suppose that two repeated mappings are a good thing.
The second ioaccess maps a page of Q-bus memory.  Could the
kmem_suballoc, pmap_map method be used?  Am I making any sense?

(I think I really need some assistance from somebody who knows what this 
better than I do.)

BTW.  Apparently this is all the mapping I need, and these mappings
should hold even after config is complete (at least for the primary
QDSS.  Multiple QDSS aren't supported by qd.c yet even though I see some
attempts at support.)

-- 
|  Boris Gjenero <bgjenero@undergrad.math.uwaterloo.ca>              |
|  Home page:  http://www.undergrad.math.uwaterloo.ca/~bgjenero/     |
|  "Luke, you're going to find that many of the truths we cling to   |
|  depend greatly on our own point of view." - Obi-Wan Kenobi, ROTJ  |