Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/vax Only allocate QDSS memory if there is a QDSS as...



details:   https://anonhg.NetBSD.org/src/rev/cb9a209e51ff
branches:  trunk
changeset: 471995:cb9a209e51ff
user:      ragge <ragge%NetBSD.org@localhost>
date:      Sat Apr 17 17:02:49 1999 +0000

description:
Only allocate QDSS memory if there is a QDSS as console.
QDSS should also work on KA650 now. (untested)

diffstat:

 sys/arch/vax/uba/qd.c   |  381 +++++++++++++++++++++++------------------------
 sys/arch/vax/vax/pmap.c |   17 +-
 2 files changed, 193 insertions(+), 205 deletions(-)

diffs (truncated from 801 to 300 lines):

diff -r 05cece8da408 -r cb9a209e51ff sys/arch/vax/uba/qd.c
--- a/sys/arch/vax/uba/qd.c     Sat Apr 17 16:52:06 1999 +0000
+++ b/sys/arch/vax/uba/qd.c     Sat Apr 17 17:02:49 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: qd.c,v 1.12 1999/01/19 21:04:48 ragge Exp $    */
+/*     $NetBSD: qd.c,v 1.13 1999/04/17 17:02:49 ragge Exp $    */
 
 /*-
  * Copyright (c) 1988 Regents of the University of California.
@@ -150,8 +150,8 @@
  */
 struct uba_device *qdinfo[NQD];  /* array of pntrs to each QDSS's */
 struct tty *qd_tty[NQD*4];     /* teletype structures for each.. */
-extern volatile char *qvmem[NQD];
-extern volatile struct pte *QVmap[NQD];
+volatile char *qvmem[NQD];
+volatile struct pte *QVmap[NQD];
 #define CHUNK    (64 * 1024)
 #define QMEMSIZE  (1024 * 1024 * 4)    /* 4 meg */
 
@@ -333,6 +333,7 @@
 int wait_status __P((volatile struct adder *, int));
 void led_control __P((int, int, int));
 void qdstart(struct tty *);
+void qdearly(void);
 int qdpolling = 0;
 
 /*
@@ -378,67 +379,65 @@
  * has been performed on qd0.  That initialization is required and must 
  * be done before the device probe routine.
  */
-int qd0cninited = 0;
+int qd0cninited = 0, qd0iscons = 0;
+
+/*
+ * Do early check if the qdss is console. If not; don't allocate
+ * any memory for it in bootstrap.
+ */
+void
+qdearly()
+{
+       extern vaddr_t virtual_avail;
+       int tmp;
+
+       /* Make sure we're running on a system that can have a QDSS */
+       if (vax_boardtype == VAX_BTYP_630)  {
+               /* Now check some undocumented flag */
+               if ((*(int *)(0x200B801E) & 0x60) == 0) 
+                       /* The KA630 isn't using a QDSS as the console,
+                        * so we won't either */
+                       return;
+       } else if (vax_boardtype != VAX_BTYP_650)
+               return;
+
+       /* How to check for console on KA650? We assume that if there is a
+        * QDSS, it is console.
+        */
+       tmp = QIOPAGE + ubdevreg(QDSSCSR);
+       if (badaddr((caddr_t)tmp, sizeof(short)))
+               return;
+
+       MAPVIRT(qvmem[0], 64 * 1024 * NQD / VAX_NBPG);
+       MAPVIRT(qd_ubaio, 16);
+       pmap_map((int)qd_ubaio, QIOPAGE, QIOPAGE + UBAIOPAGES * VAX_NBPG,
+           VM_PROT_READ|VM_PROT_WRITE);
+       qdaddr = (u_short *)((u_int)qd_ubaio + ubdevreg(QDSSCSR));
+       qd0iscons = 1;
+}
 
 void
 qdcnprobe(cndev)
-        struct  consdev *cndev;
+       struct  consdev *cndev;
 {
-        int i;
-
-        cndev->cn_pri = CN_DEAD;
+       int i;
+
+       cndev->cn_pri = CN_DEAD;
    
        if (mfpr(PR_MAPEN) == 0)
                return; /* Cannot use qd if vm system is OFF */
 
-        /* Make sure we're running on a system that can have a QDSS */
-        if (vax_boardtype == VAX_BTYP_630)  {
-                /*
-                * The KA630 can have a QDSS and we can even check if 
-                * the ROM is using it. 
-                */
-           
-                /* Temporarily map in physical memory */
-               pmap_map((int)qd_ubaio, 0x200B8000, 0x200B8000 + VAX_NBPG,
-                                           VM_PROT_READ|VM_PROT_WRITE);
-
-               /* Now check some undocumented flag */
-               if ((*(int *)((uint)qd_ubaio + 0x1E) & 0x60) == 0) 
-                       /* The KA630 isn't using a QDSS as the console,
-                        * so we won't either */
-                       return;
-       } else /* if (vax_boardtype != VAX_BTYP_650) */
-                /* 
-                * The KA640, 650 and 655 should also support a QDSS.
-                * Otherwise, it shouldn't be there so apply artificial
-                * feature blocking.
-                */
-                return;
-             
-        /*
-        * Map device registers - the last 8K of qvmem.
-        */
-        pmap_map((int)qd_ubaio, QIOPAGE, QIOPAGE + UBAIOPAGES * VAX_NBPG,
-                                   VM_PROT_READ|VM_PROT_WRITE);
-        qdaddr = (u_short *)((u_int)qd_ubaio + ubdevreg(QDSSCSR));
-
-        /* 
-        * If there's nothing there then we don't have a console QDSS. 
-        * If something is there then we have a console QDSS.  
-        * ie.  Don't put anything at QDSSCSR.  The ROM would also
-        * think you have a QDSS.
-         */  
-        if (badaddr((caddr_t)qdaddr, sizeof(short)))
-                     return;
-
-        /* Find the console device corresponding to the console QDSS */
-        for (i = 0; i < nchrdev; i++)
-                if (cdevsw[i].d_open == qdopen)  {
-                              cndev->cn_dev = makedev(i,0);
-                              cndev->cn_pri = CN_INTERNAL;
-                              return;
-                 }
-        return;
+       if (!qd0iscons)
+               return;
+
+       /* Find the console device corresponding to the console QDSS */
+       for (i = 0; i < nchrdev; i++)
+               if (cdevsw[i].d_open == qdopen)  {
+                             cndev->cn_dev = makedev(i,0);
+                             cndev->cn_pri = CN_INTERNAL;
+                             return;
+                }
+       return;
 }
 
 
@@ -447,32 +446,32 @@
  */
 void
 qdcninit(cndev)
-        struct  consdev *cndev;
+       struct  consdev *cndev;
 {
        caddr_t phys_adr;               /* physical QDSS base adrs */
        u_int mapix;                    /* index into QVmap[] array */
-        int unit;
-
-        /* qdaddr must point to CSR for this unit! */
+       int unit;
+
+       /* qdaddr must point to CSR for this unit! */
    
-        /* The console QDSS is QDSS unit 0 */
-        unit = 0;
-
-        /*
+       /* The console QDSS is QDSS unit 0 */
+       unit = 0;
+
+       /*
         * Map q-bus memory used by qdss. (separate map)
         */
        mapix = QMEMSIZE - (CHUNK * (unit + 1));
-        (int)phys_adr = QMEM + mapix;
-        pmap_map((int)(qvmem[0]), (int)phys_adr, (int)(phys_adr + (CHUNK*NQD)),
-                                   VM_PROT_READ|VM_PROT_WRITE);
-
-        /* 
+       (int)phys_adr = QMEM + mapix;
+       pmap_map((int)(qvmem[0]), (int)phys_adr, (int)(phys_adr + (CHUNK*NQD)),
+                                   VM_PROT_READ|VM_PROT_WRITE);
+
+       /* 
         * Set QVmap to point to page table entries for what we just
         * mapped.
         */
-        QVmap[0] = (struct pte *)kvtopte(qvmem[0]);
+       QVmap[0] = (struct pte *)kvtopte(qvmem[0]);
    
-        /*
+       /*
         * tell QDSS which Q memory address base to decode 
         * (shifted right 16 bits - its in 64K units)
         */
@@ -509,8 +508,8 @@
        ldcursor(unit, cons_cursor);    /* load default cursor map */
        setup_input(unit);              /* init the DUART */
 
-        /* Set flag so probe knows */
-        qd0cninited = 1;
+       /* Set flag so probe knows */
+       qd0cninited = 1;
 } /* qdcninit */
 
  
@@ -527,13 +526,13 @@
  */
 static int
 qd_match(parent, match, aux)
-        struct device *parent;
+       struct device *parent;
        struct cfdata *match;
-        void *aux;
+       void *aux;
 {
-        struct uba_attach_args *ua = aux;
-        struct uba_softc *uh = (void *)parent;
-        register int *reg = (int *)(ua->ua_addr);
+       struct uba_attach_args *ua = aux;
+       struct uba_softc *uh = (void *)parent;
+       register int *reg = (int *)(ua->ua_addr);
        register int unit;
        volatile struct dga *dga;       /* pointer to gate array structure */
        int vector;
@@ -555,7 +554,7 @@
 
        /*
         * QDSS regs must be mapped to Qbus memory space at a 64kb
-        * physical boundary.  The Qbus memory space is mapped into
+        * physical boundary.  The Qbus memory space is mapped into
         * the system memory space at config time.  After config
         * runs, "qvmem[0]" (ubavar.h) holds the system virtual adrs
         * of the start of Qbus memory.   The Qbus memory page table
@@ -570,7 +569,7 @@
         * Only if QD is the graphics device.
         */
 
-        /* if this QDSS is NOT the console, then do init here.. */
+       /* if this QDSS is NOT the console, then do init here.. */
 
        if (unit != 0) {
                printf("qd: can't support two qdss's (yet)\n");
@@ -633,30 +632,30 @@
                }
 #endif /*notdef*/
        } else {
-               /* We are dealing with qd0 */
-                
-               if (!qd0cninited) {
-                       /* 
+               /* We are dealing with qd0 */
+                
+               if (!qd0cninited) {
+                       /* 
                         * qd0 has not been initiallized as the console.
                         * We need to do some initialization now
                         * 
-                        * XXX 
+                        * XXX 
                         * However, if the QDSS is not the console then
                         * that stupid undocumented bit (see qdcnprobe)
                         * is cleared.  Then the QDSS refuses to work.
                         * (What did the ROM do to it!?)
                         * XXX
                         */
-                        return 0;
+                        return 0;
                   
 #if 0             
-                        qdaddr = (void *)reg;
-
-                        /* Lame probe for QDSS.  Should be ok for qd0 */
-                        if (badaddr((caddr_t)qdaddr, sizeof(short)))
-                                 return 0;
-
-                        qdcninit(NULL);
+                        qdaddr = (void *)reg;
+
+                        /* Lame probe for QDSS.  Should be ok for qd0 */
+                        if (badaddr((caddr_t)qdaddr, sizeof(short)))
+                                return 0;
+
+                        qdcninit(NULL);
 #endif            
                }
        }
@@ -696,25 +695,25 @@
        DELAY(20000);                   /* wait for the intrpt */
        dga->csr = HALT;                /* stop the wheels */
 
-        /* Set interrupt vector for DMA service routine */      
-        ua->ua_ivec = qddint;
+       /* Set interrupt vector for DMA service routine */      
+       ua->ua_ivec = qddint;
    
        /*
        * score this as an existing qdss
        */
        qdcount++;



Home | Main Index | Thread Index | Old Index