Only allocate QDSS memory if there is a QDSS as console.

QDSS should also work on KA650 now. (untested)
This commit is contained in:
ragge 1999-04-17 17:02:49 +00:00
parent 2519327c42
commit d80adac6a7
2 changed files with 183 additions and 195 deletions

View File

@ -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. * Copyright (c) 1988 Regents of the University of California.
@ -150,8 +150,8 @@ struct qdflags {
*/ */
struct uba_device *qdinfo[NQD]; /* array of pntrs to each QDSS's */ struct uba_device *qdinfo[NQD]; /* array of pntrs to each QDSS's */
struct tty *qd_tty[NQD*4]; /* teletype structures for each.. */ struct tty *qd_tty[NQD*4]; /* teletype structures for each.. */
extern volatile char *qvmem[NQD]; volatile char *qvmem[NQD];
extern volatile struct pte *QVmap[NQD]; volatile struct pte *QVmap[NQD];
#define CHUNK (64 * 1024) #define CHUNK (64 * 1024)
#define QMEMSIZE (1024 * 1024 * 4) /* 4 meg */ #define QMEMSIZE (1024 * 1024 * 4) /* 4 meg */
@ -333,6 +333,7 @@ void write_ID __P((volatile struct adder *, short, short));
int wait_status __P((volatile struct adder *, int)); int wait_status __P((volatile struct adder *, int));
void led_control __P((int, int, int)); void led_control __P((int, int, int));
void qdstart(struct tty *); void qdstart(struct tty *);
void qdearly(void);
int qdpolling = 0; int qdpolling = 0;
/* /*
@ -378,7 +379,42 @@ volatile u_short *qdaddr; /* Virtual address for QDSS CSR */
* has been performed on qd0. That initialization is required and must * has been performed on qd0. That initialization is required and must
* be done before the device probe routine. * 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 void
qdcnprobe(cndev) qdcnprobe(cndev)
@ -391,44 +427,7 @@ qdcnprobe(cndev)
if (mfpr(PR_MAPEN) == 0) if (mfpr(PR_MAPEN) == 0)
return; /* Cannot use qd if vm system is OFF */ return; /* Cannot use qd if vm system is OFF */
/* Make sure we're running on a system that can have a QDSS */ if (!qd0iscons)
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; return;
/* Find the console device corresponding to the console QDSS */ /* Find the console device corresponding to the console QDSS */

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.62 1999/04/17 00:01:19 ragge Exp $ */ /* $NetBSD: pmap.c,v 1.63 1999/04/17 17:02:50 ragge Exp $ */
/* /*
* Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden. * Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden.
* All rights reserved. * All rights reserved.
@ -60,13 +60,7 @@
/* QDSS console mapping hack */ /* QDSS console mapping hack */
#include "qd.h" #include "qd.h"
#if NQD > 0 void qdearly(void);
/* Pointer to virtual memory for for mapping QDSS */
void *qvmem[NQD];
/* Pointer to page tables for this virtual memory */
struct pte *QVmap[NQD];
extern void *qd_ubaio;
#endif
#define ISTACK_SIZE NBPG #define ISTACK_SIZE NBPG
vaddr_t istack; vaddr_t istack;
@ -218,12 +212,7 @@ pmap_bootstrap()
/* QDSS console mapping hack */ /* QDSS console mapping hack */
#if NQD > 0 #if NQD > 0
/* qdearly();
* This allocates some kernel virtual address space. qdcninit
* maps things here
*/
MAPVIRT(qvmem[0], 64 * 1024 * NQD / VAX_NBPG);
MAPVIRT(qd_ubaio, 16);
#endif #endif
MAPVIRT(iospace, IOSPSZ); /* Device iospace mapping area */ MAPVIRT(iospace, IOSPSZ); /* Device iospace mapping area */