Only allocate QDSS memory if there is a QDSS as console.
QDSS should also work on KA650 now. (untested)
This commit is contained in:
parent
2519327c42
commit
d80adac6a7
@ -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,67 +379,65 @@ 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)
|
||||||
struct consdev *cndev;
|
struct consdev *cndev;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
cndev->cn_pri = CN_DEAD;
|
cndev->cn_pri = CN_DEAD;
|
||||||
|
|
||||||
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) {
|
return;
|
||||||
/*
|
|
||||||
* 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 */
|
/* Find the console device corresponding to the console QDSS */
|
||||||
if ((*(int *)((uint)qd_ubaio + 0x1E) & 0x60) == 0)
|
for (i = 0; i < nchrdev; i++)
|
||||||
/* The KA630 isn't using a QDSS as the console,
|
if (cdevsw[i].d_open == qdopen) {
|
||||||
* so we won't either */
|
cndev->cn_dev = makedev(i,0);
|
||||||
return;
|
cndev->cn_pri = CN_INTERNAL;
|
||||||
} else /* if (vax_boardtype != VAX_BTYP_650) */
|
return;
|
||||||
/*
|
}
|
||||||
* The KA640, 650 and 655 should also support a QDSS.
|
return;
|
||||||
* 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -447,32 +446,32 @@ qdcnprobe(cndev)
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
qdcninit(cndev)
|
qdcninit(cndev)
|
||||||
struct consdev *cndev;
|
struct consdev *cndev;
|
||||||
{
|
{
|
||||||
caddr_t phys_adr; /* physical QDSS base adrs */
|
caddr_t phys_adr; /* physical QDSS base adrs */
|
||||||
u_int mapix; /* index into QVmap[] array */
|
u_int mapix; /* index into QVmap[] array */
|
||||||
int unit;
|
int unit;
|
||||||
|
|
||||||
/* qdaddr must point to CSR for this unit! */
|
/* qdaddr must point to CSR for this unit! */
|
||||||
|
|
||||||
/* The console QDSS is QDSS unit 0 */
|
/* The console QDSS is QDSS unit 0 */
|
||||||
unit = 0;
|
unit = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Map q-bus memory used by qdss. (separate map)
|
* Map q-bus memory used by qdss. (separate map)
|
||||||
*/
|
*/
|
||||||
mapix = QMEMSIZE - (CHUNK * (unit + 1));
|
mapix = QMEMSIZE - (CHUNK * (unit + 1));
|
||||||
(int)phys_adr = QMEM + mapix;
|
(int)phys_adr = QMEM + mapix;
|
||||||
pmap_map((int)(qvmem[0]), (int)phys_adr, (int)(phys_adr + (CHUNK*NQD)),
|
pmap_map((int)(qvmem[0]), (int)phys_adr, (int)(phys_adr + (CHUNK*NQD)),
|
||||||
VM_PROT_READ|VM_PROT_WRITE);
|
VM_PROT_READ|VM_PROT_WRITE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set QVmap to point to page table entries for what we just
|
* Set QVmap to point to page table entries for what we just
|
||||||
* mapped.
|
* mapped.
|
||||||
*/
|
*/
|
||||||
QVmap[0] = (struct pte *)kvtopte(qvmem[0]);
|
QVmap[0] = (struct pte *)kvtopte(qvmem[0]);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* tell QDSS which Q memory address base to decode
|
* tell QDSS which Q memory address base to decode
|
||||||
* (shifted right 16 bits - its in 64K units)
|
* (shifted right 16 bits - its in 64K units)
|
||||||
*/
|
*/
|
||||||
@ -509,8 +508,8 @@ qdcninit(cndev)
|
|||||||
ldcursor(unit, cons_cursor); /* load default cursor map */
|
ldcursor(unit, cons_cursor); /* load default cursor map */
|
||||||
setup_input(unit); /* init the DUART */
|
setup_input(unit); /* init the DUART */
|
||||||
|
|
||||||
/* Set flag so probe knows */
|
/* Set flag so probe knows */
|
||||||
qd0cninited = 1;
|
qd0cninited = 1;
|
||||||
} /* qdcninit */
|
} /* qdcninit */
|
||||||
|
|
||||||
|
|
||||||
@ -527,13 +526,13 @@ qdcninit(cndev)
|
|||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
qd_match(parent, match, aux)
|
qd_match(parent, match, aux)
|
||||||
struct device *parent;
|
struct device *parent;
|
||||||
struct cfdata *match;
|
struct cfdata *match;
|
||||||
void *aux;
|
void *aux;
|
||||||
{
|
{
|
||||||
struct uba_attach_args *ua = aux;
|
struct uba_attach_args *ua = aux;
|
||||||
struct uba_softc *uh = (void *)parent;
|
struct uba_softc *uh = (void *)parent;
|
||||||
register int *reg = (int *)(ua->ua_addr);
|
register int *reg = (int *)(ua->ua_addr);
|
||||||
register int unit;
|
register int unit;
|
||||||
volatile struct dga *dga; /* pointer to gate array structure */
|
volatile struct dga *dga; /* pointer to gate array structure */
|
||||||
int vector;
|
int vector;
|
||||||
@ -555,7 +554,7 @@ qd_match(parent, match, aux)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* QDSS regs must be mapped to Qbus memory space at a 64kb
|
* 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
|
* the system memory space at config time. After config
|
||||||
* runs, "qvmem[0]" (ubavar.h) holds the system virtual adrs
|
* runs, "qvmem[0]" (ubavar.h) holds the system virtual adrs
|
||||||
* of the start of Qbus memory. The Qbus memory page table
|
* of the start of Qbus memory. The Qbus memory page table
|
||||||
@ -570,7 +569,7 @@ qd_match(parent, match, aux)
|
|||||||
* Only if QD is the graphics device.
|
* 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) {
|
if (unit != 0) {
|
||||||
printf("qd: can't support two qdss's (yet)\n");
|
printf("qd: can't support two qdss's (yet)\n");
|
||||||
@ -633,30 +632,30 @@ qd_match(parent, match, aux)
|
|||||||
}
|
}
|
||||||
#endif /*notdef*/
|
#endif /*notdef*/
|
||||||
} else {
|
} else {
|
||||||
/* We are dealing with qd0 */
|
/* We are dealing with qd0 */
|
||||||
|
|
||||||
if (!qd0cninited) {
|
if (!qd0cninited) {
|
||||||
/*
|
/*
|
||||||
* qd0 has not been initiallized as the console.
|
* qd0 has not been initiallized as the console.
|
||||||
* We need to do some initialization now
|
* We need to do some initialization now
|
||||||
*
|
*
|
||||||
* XXX
|
* XXX
|
||||||
* However, if the QDSS is not the console then
|
* However, if the QDSS is not the console then
|
||||||
* that stupid undocumented bit (see qdcnprobe)
|
* that stupid undocumented bit (see qdcnprobe)
|
||||||
* is cleared. Then the QDSS refuses to work.
|
* is cleared. Then the QDSS refuses to work.
|
||||||
* (What did the ROM do to it!?)
|
* (What did the ROM do to it!?)
|
||||||
* XXX
|
* XXX
|
||||||
*/
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
qdaddr = (void *)reg;
|
qdaddr = (void *)reg;
|
||||||
|
|
||||||
/* Lame probe for QDSS. Should be ok for qd0 */
|
/* Lame probe for QDSS. Should be ok for qd0 */
|
||||||
if (badaddr((caddr_t)qdaddr, sizeof(short)))
|
if (badaddr((caddr_t)qdaddr, sizeof(short)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
qdcninit(NULL);
|
qdcninit(NULL);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -696,25 +695,25 @@ qd_match(parent, match, aux)
|
|||||||
DELAY(20000); /* wait for the intrpt */
|
DELAY(20000); /* wait for the intrpt */
|
||||||
dga->csr = HALT; /* stop the wheels */
|
dga->csr = HALT; /* stop the wheels */
|
||||||
|
|
||||||
/* Set interrupt vector for DMA service routine */
|
/* Set interrupt vector for DMA service routine */
|
||||||
ua->ua_ivec = qddint;
|
ua->ua_ivec = qddint;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* score this as an existing qdss
|
* score this as an existing qdss
|
||||||
*/
|
*/
|
||||||
qdcount++;
|
qdcount++;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
} /* qdprobe */
|
} /* qdprobe */
|
||||||
|
|
||||||
|
|
||||||
void qd_attach(parent, self, aux)
|
void qd_attach(parent, self, aux)
|
||||||
struct device *parent, *self;
|
struct device *parent, *self;
|
||||||
void *aux;
|
void *aux;
|
||||||
{
|
{
|
||||||
register struct uba_attach_args *ua = aux;
|
register struct uba_attach_args *ua = aux;
|
||||||
|
|
||||||
register int unit; /* QDSS module # for this call */
|
register int unit; /* QDSS module # for this call */
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
@ -770,7 +769,7 @@ void qd_attach(parent, self, aux)
|
|||||||
|
|
||||||
/* see <sys/device.h> */
|
/* see <sys/device.h> */
|
||||||
struct cfattach qd_ca = {
|
struct cfattach qd_ca = {
|
||||||
sizeof(struct device), qd_match, qd_attach
|
sizeof(struct device), qd_match, qd_attach
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -779,7 +778,7 @@ int
|
|||||||
qdopen(dev, flag, mode, p)
|
qdopen(dev, flag, mode, p)
|
||||||
dev_t dev;
|
dev_t dev;
|
||||||
int flag, mode;
|
int flag, mode;
|
||||||
struct proc *p;
|
struct proc *p;
|
||||||
{
|
{
|
||||||
volatile register struct dga *dga; /* ptr to gate array struct */
|
volatile register struct dga *dga; /* ptr to gate array struct */
|
||||||
register struct tty *tp;
|
register struct tty *tp;
|
||||||
@ -793,10 +792,10 @@ qdopen(dev, flag, mode, p)
|
|||||||
/*
|
/*
|
||||||
* check for illegal conditions
|
* check for illegal conditions
|
||||||
*/
|
*/
|
||||||
if (unit >= qd_cd.cd_ndevs || qd_cd.cd_devs[unit] == NULL)
|
if (unit >= qd_cd.cd_ndevs || qd_cd.cd_devs[unit] == NULL)
|
||||||
return (ENXIO); /* no such device or address */
|
return (ENXIO); /* no such device or address */
|
||||||
|
|
||||||
duart = (struct duart *) qdmap[unit].duart;
|
duart = (struct duart *) qdmap[unit].duart;
|
||||||
dga = (struct dga *) qdmap[unit].dga;
|
dga = (struct dga *) qdmap[unit].dga;
|
||||||
|
|
||||||
if ((minor_dev & 0x03) == 2) {
|
if ((minor_dev & 0x03) == 2) {
|
||||||
@ -815,14 +814,14 @@ qdopen(dev, flag, mode, p)
|
|||||||
duart->imask = qdflags[unit].duart_imask;
|
duart->imask = qdflags[unit].duart_imask;
|
||||||
} else {
|
} else {
|
||||||
/* Only one console */
|
/* Only one console */
|
||||||
if (minor_dev) return ENXIO;
|
if (minor_dev) return ENXIO;
|
||||||
|
|
||||||
/* If not done already, allocate tty structure */
|
/* If not done already, allocate tty structure */
|
||||||
if (qd_tty[minor_dev] == NULL)
|
if (qd_tty[minor_dev] == NULL)
|
||||||
qd_tty[minor_dev] = ttymalloc();
|
qd_tty[minor_dev] = ttymalloc();
|
||||||
|
|
||||||
if (qd_tty[minor_dev] == NULL)
|
if (qd_tty[minor_dev] == NULL)
|
||||||
return ENXIO;
|
return ENXIO;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* this is the console
|
* this is the console
|
||||||
@ -837,7 +836,7 @@ qdopen(dev, flag, mode, p)
|
|||||||
tp = qd_tty[minor_dev];
|
tp = qd_tty[minor_dev];
|
||||||
/* tp->t_addr = ui->ui_addr; */
|
/* tp->t_addr = ui->ui_addr; */
|
||||||
tp->t_oproc = qdstart;
|
tp->t_oproc = qdstart;
|
||||||
tp->t_dev = dev;
|
tp->t_dev = dev;
|
||||||
if ((tp->t_state & TS_ISOPEN) == 0) {
|
if ((tp->t_state & TS_ISOPEN) == 0) {
|
||||||
ttychars(tp);
|
ttychars(tp);
|
||||||
tp->t_ispeed = B9600;
|
tp->t_ispeed = B9600;
|
||||||
@ -847,12 +846,12 @@ qdopen(dev, flag, mode, p)
|
|||||||
tp->t_oflag = TTYDEF_OFLAG;
|
tp->t_oflag = TTYDEF_OFLAG;
|
||||||
tp->t_lflag = TTYDEF_LFLAG;
|
tp->t_lflag = TTYDEF_LFLAG;
|
||||||
tp->t_cflag = TTYDEF_CFLAG;
|
tp->t_cflag = TTYDEF_CFLAG;
|
||||||
ttsetwater(tp);
|
ttsetwater(tp);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* enable intrpts, open line discipline
|
* enable intrpts, open line discipline
|
||||||
*/
|
*/
|
||||||
dga->csr |= GLOBAL_IE; /* turn on the interrupts */
|
dga->csr |= GLOBAL_IE; /* turn on the interrupts */
|
||||||
return ((*linesw[tp->t_line].l_open)(dev, tp));
|
return ((*linesw[tp->t_line].l_open)(dev, tp));
|
||||||
}
|
}
|
||||||
dga->csr |= GLOBAL_IE; /* turn on the interrupts */
|
dga->csr |= GLOBAL_IE; /* turn on the interrupts */
|
||||||
@ -877,14 +876,14 @@ qdclose(dev, flag, mode, p)
|
|||||||
int minor_dev;
|
int minor_dev;
|
||||||
u_int mapix;
|
u_int mapix;
|
||||||
int i; /* SIGNED index */
|
int i; /* SIGNED index */
|
||||||
struct uba_softc *uh;
|
struct uba_softc *uh;
|
||||||
|
|
||||||
minor_dev = minor(dev); /* get minor device number */
|
minor_dev = minor(dev); /* get minor device number */
|
||||||
unit = minor_dev >> 2; /* get QDSS number */
|
unit = minor_dev >> 2; /* get QDSS number */
|
||||||
qd = &qdmap[unit];
|
qd = &qdmap[unit];
|
||||||
|
|
||||||
uh = (struct uba_softc *)
|
uh = (struct uba_softc *)
|
||||||
(((struct device *)(qd_cd.cd_devs[unit]))->dv_parent);
|
(((struct device *)(qd_cd.cd_devs[unit]))->dv_parent);
|
||||||
|
|
||||||
|
|
||||||
if ((minor_dev & 0x03) == 2) {
|
if ((minor_dev & 0x03) == 2) {
|
||||||
@ -892,7 +891,7 @@ qdclose(dev, flag, mode, p)
|
|||||||
* this is the graphic device...
|
* this is the graphic device...
|
||||||
*/
|
*/
|
||||||
if (qdopened[unit] != 1)
|
if (qdopened[unit] != 1)
|
||||||
return(EBUSY);
|
return(EBUSY);
|
||||||
else
|
else
|
||||||
qdopened[unit] = 0; /* allow it to be re-opened */
|
qdopened[unit] = 0; /* allow it to be re-opened */
|
||||||
/*
|
/*
|
||||||
@ -1056,9 +1055,9 @@ int
|
|||||||
qdioctl(dev, cmd, datap, flags, p)
|
qdioctl(dev, cmd, datap, flags, p)
|
||||||
dev_t dev;
|
dev_t dev;
|
||||||
u_long cmd;
|
u_long cmd;
|
||||||
caddr_t datap;
|
caddr_t datap;
|
||||||
int flags;
|
int flags;
|
||||||
struct proc *p;
|
struct proc *p;
|
||||||
{
|
{
|
||||||
volatile register int *ptep; /* page table entry pointer */
|
volatile register int *ptep; /* page table entry pointer */
|
||||||
register int mapix; /* QVmap[] page table index */
|
register int mapix; /* QVmap[] page table index */
|
||||||
@ -1077,10 +1076,10 @@ qdioctl(dev, cmd, datap, flags, p)
|
|||||||
int error;
|
int error;
|
||||||
int s;
|
int s;
|
||||||
short *temp; /* a pointer to template RAM */
|
short *temp; /* a pointer to template RAM */
|
||||||
struct uba_softc *uh;
|
struct uba_softc *uh;
|
||||||
|
|
||||||
uh = (struct uba_softc *)
|
uh = (struct uba_softc *)
|
||||||
(((struct device *)(qd_cd.cd_devs[unit]))->dv_parent);
|
(((struct device *)(qd_cd.cd_devs[unit]))->dv_parent);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* service graphic device ioctl commands
|
* service graphic device ioctl commands
|
||||||
@ -1207,7 +1206,7 @@ qdioctl(dev, cmd, datap, flags, p)
|
|||||||
for (i = 0; i < vax_btop(CLRSIZE); i++, ptep++)
|
for (i = 0; i < vax_btop(CLRSIZE); i++, ptep++)
|
||||||
*ptep = (*ptep & ~PG_PROT) | PG_RW | PG_V;
|
*ptep = (*ptep & ~PG_PROT) | PG_RW | PG_V;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* enable user write to DUART
|
* enable user write to DUART
|
||||||
*/
|
*/
|
||||||
mapix = VTOP((int)qd->duart) - VTOP(qvmem[0]);
|
mapix = VTOP((int)qd->duart) - VTOP(qvmem[0]);
|
||||||
@ -1216,12 +1215,12 @@ qdioctl(dev, cmd, datap, flags, p)
|
|||||||
|
|
||||||
mtpr(0, PR_TBIA); /* invalidate translation buffer */
|
mtpr(0, PR_TBIA); /* invalidate translation buffer */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* stuff qdmap structure in return buffer
|
* stuff qdmap structure in return buffer
|
||||||
*/
|
*/
|
||||||
bcopy((caddr_t)qd, datap, sizeof(struct qdmap));
|
bcopy((caddr_t)qd, datap, sizeof(struct qdmap));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QD_MAPIOBUF:
|
case QD_MAPIOBUF:
|
||||||
/*
|
/*
|
||||||
@ -1481,77 +1480,77 @@ qdioctl(dev, cmd, datap, flags, p)
|
|||||||
|
|
||||||
int
|
int
|
||||||
qdpoll(dev, events, p)
|
qdpoll(dev, events, p)
|
||||||
dev_t dev;
|
dev_t dev;
|
||||||
int events;
|
int events;
|
||||||
struct proc *p;
|
struct proc *p;
|
||||||
{
|
{
|
||||||
register int s;
|
register int s;
|
||||||
register int unit;
|
register int unit;
|
||||||
register struct tty *tp;
|
register struct tty *tp;
|
||||||
u_int minor_dev = minor(dev);
|
u_int minor_dev = minor(dev);
|
||||||
int revents = 0;
|
int revents = 0;
|
||||||
|
|
||||||
s = spl5();
|
s = spl5();
|
||||||
unit = minor_dev >> 2;
|
unit = minor_dev >> 2;
|
||||||
|
|
||||||
if ((minor_dev & 0x03) == 2) {
|
if ((minor_dev & 0x03) == 2) {
|
||||||
/*
|
/*
|
||||||
* This is a graphics device, so check for events.
|
* This is a graphics device, so check for events.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (events & (POLLIN | POLLRDNORM))
|
if (events & (POLLIN | POLLRDNORM))
|
||||||
if(!(ISEMPTY(eq_header[unit])))
|
if(!(ISEMPTY(eq_header[unit])))
|
||||||
revents |= events & (POLLIN | POLLRDNORM);
|
revents |= events & (POLLIN | POLLRDNORM);
|
||||||
|
|
||||||
if (events & (POLLOUT | POLLWRNORM))
|
if (events & (POLLOUT | POLLWRNORM))
|
||||||
if (DMA_ISEMPTY(DMAheader[unit]))
|
if (DMA_ISEMPTY(DMAheader[unit]))
|
||||||
revents |= events & (POLLOUT | POLLWRNORM);
|
revents |= events & (POLLOUT | POLLWRNORM);
|
||||||
|
|
||||||
if (revents == 0) {
|
if (revents == 0) {
|
||||||
if (events & (POLLIN | POLLRDNORM)) {
|
if (events & (POLLIN | POLLRDNORM)) {
|
||||||
selrecord(p, &qdrsel[unit]);
|
selrecord(p, &qdrsel[unit]);
|
||||||
qdflags[unit].selmask |= SEL_READ;
|
qdflags[unit].selmask |= SEL_READ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (events & (POLLOUT | POLLWRNORM)) {
|
if (events & (POLLOUT | POLLWRNORM)) {
|
||||||
selrecord(p, &qdrsel[unit]);
|
selrecord(p, &qdrsel[unit]);
|
||||||
qdflags[unit].selmask |= SEL_WRITE;
|
qdflags[unit].selmask |= SEL_WRITE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* this is a tty device
|
* this is a tty device
|
||||||
*/
|
*/
|
||||||
tp = qd_tty[minor_dev];
|
tp = qd_tty[minor_dev];
|
||||||
|
|
||||||
if (events & (POLLIN | POLLRDNORM)) {
|
if (events & (POLLIN | POLLRDNORM)) {
|
||||||
/* This is ttnread. It's static and I don't feel
|
/* This is ttnread. It's static and I don't feel
|
||||||
* like altering platform independant parts of NetBSD
|
* like altering platform independant parts of NetBSD
|
||||||
*/
|
*/
|
||||||
int nread;
|
int nread;
|
||||||
/* if (tp->t_lflag & PENDIN)
|
/* if (tp->t_lflag & PENDIN)
|
||||||
ttypend(tp); */
|
ttypend(tp); */
|
||||||
nread = tp->t_canq.c_cc;
|
nread = tp->t_canq.c_cc;
|
||||||
if (!(tp->t_lflag & ICANON)) {
|
if (!(tp->t_lflag & ICANON)) {
|
||||||
nread += tp->t_rawq.c_cc;
|
nread += tp->t_rawq.c_cc;
|
||||||
if (nread < tp->t_cc[VMIN] && !tp->t_cc[VTIME])
|
if (nread < tp->t_cc[VMIN] && !tp->t_cc[VTIME])
|
||||||
nread = 0;
|
nread = 0;
|
||||||
}
|
}
|
||||||
if (nread > 0)
|
if (nread > 0)
|
||||||
revents |= events & (POLLIN | POLLRDNORM);
|
revents |= events & (POLLIN | POLLRDNORM);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (events & (POLLOUT | POLLWRNORM))
|
if (events & (POLLOUT | POLLWRNORM))
|
||||||
if (tp->t_outq.c_cc <= tp->t_lowat)
|
if (tp->t_outq.c_cc <= tp->t_lowat)
|
||||||
revents |= events & (POLLOUT | POLLWRNORM);
|
revents |= events & (POLLOUT | POLLWRNORM);
|
||||||
|
|
||||||
if (revents == 0) {
|
if (revents == 0) {
|
||||||
if (events & (POLLIN | POLLRDNORM))
|
if (events & (POLLIN | POLLRDNORM))
|
||||||
selrecord(p, &tp->t_rsel);
|
selrecord(p, &tp->t_rsel);
|
||||||
|
|
||||||
if (events & (POLLOUT | POLLWRNORM))
|
if (events & (POLLOUT | POLLWRNORM))
|
||||||
selrecord(p, &tp->t_wsel);
|
selrecord(p, &tp->t_wsel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
splx(s);
|
splx(s);
|
||||||
@ -1604,7 +1603,7 @@ qdread(dev, uio, flag)
|
|||||||
unit = (minor_dev >> 2) & 0x07;
|
unit = (minor_dev >> 2) & 0x07;
|
||||||
|
|
||||||
if ((minor_dev & 0x03) != 0x02 && qdflags[unit].inuse & CONS_DEV) {
|
if ((minor_dev & 0x03) != 0x02 && qdflags[unit].inuse & CONS_DEV) {
|
||||||
/*
|
/*
|
||||||
* this is the console
|
* this is the console
|
||||||
*/
|
*/
|
||||||
tp = qd_tty[minor_dev];
|
tp = qd_tty[minor_dev];
|
||||||
@ -1637,12 +1636,12 @@ qd_strategy(bp)
|
|||||||
int QBAreg;
|
int QBAreg;
|
||||||
int s;
|
int s;
|
||||||
int cookie;
|
int cookie;
|
||||||
struct uba_softc *uh;
|
struct uba_softc *uh;
|
||||||
|
|
||||||
unit = (minor(bp->b_dev) >> 2) & 0x07;
|
unit = (minor(bp->b_dev) >> 2) & 0x07;
|
||||||
|
|
||||||
uh = (struct uba_softc *)
|
uh = (struct uba_softc *)
|
||||||
(((struct device *)(qd_cd.cd_devs[unit]))->dv_parent);
|
(((struct device *)(qd_cd.cd_devs[unit]))->dv_parent);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* init pointers
|
* init pointers
|
||||||
@ -1672,7 +1671,7 @@ qd_strategy(bp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
STRAT_ERR:
|
STRAT_ERR:
|
||||||
adder = (struct adder *) qdmap[unit].adder;
|
adder = (struct adder *) qdmap[unit].adder;
|
||||||
adder->command = CANCEL; /* cancel adder activity */
|
adder->command = CANCEL; /* cancel adder activity */
|
||||||
dga->csr &= ~DMA_IE;
|
dga->csr &= ~DMA_IE;
|
||||||
dga->csr &= ~0x0600; /* halt DMA (reset fifo) */
|
dga->csr &= ~0x0600; /* halt DMA (reset fifo) */
|
||||||
@ -2017,7 +2016,7 @@ qddint(qd)
|
|||||||
* if this was a DMA from user space...
|
* if this was a DMA from user space...
|
||||||
*/
|
*/
|
||||||
if (qdflags[qd].user_dma) {
|
if (qdflags[qd].user_dma) {
|
||||||
qdflags[qd].user_dma = 0;
|
qdflags[qd].user_dma = 0;
|
||||||
wakeup((caddr_t)&qdflags[qd].user_dma);
|
wakeup((caddr_t)&qdflags[qd].user_dma);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2037,7 +2036,7 @@ qddint(qd)
|
|||||||
header->newest = header->oldest;
|
header->newest = header->oldest;
|
||||||
header->used = 0;
|
header->used = 0;
|
||||||
|
|
||||||
if (qdrsel[qd].si_pid && qdflags[qd].selmask & SEL_WRITE) {
|
if (qdrsel[qd].si_pid && qdflags[qd].selmask & SEL_WRITE) {
|
||||||
selwakeup(&qdrsel[qd]);
|
selwakeup(&qdrsel[qd]);
|
||||||
qdrsel[qd].si_pid = 0;
|
qdrsel[qd].si_pid = 0;
|
||||||
qdflags[qd].selmask &= ~SEL_WRITE;
|
qdflags[qd].selmask &= ~SEL_WRITE;
|
||||||
@ -2056,7 +2055,7 @@ qddint(qd)
|
|||||||
* wakeup "select" client.
|
* wakeup "select" client.
|
||||||
*/
|
*/
|
||||||
if (DMA_ISFULL(header)) {
|
if (DMA_ISFULL(header)) {
|
||||||
if (qdrsel[qd].si_pid && qdflags[qd].selmask & SEL_WRITE) {
|
if (qdrsel[qd].si_pid && qdflags[qd].selmask & SEL_WRITE) {
|
||||||
selwakeup(&qdrsel[qd]);
|
selwakeup(&qdrsel[qd]);
|
||||||
qdrsel[qd].si_pid = 0;
|
qdrsel[qd].si_pid = 0;
|
||||||
qdflags[qd].selmask &= ~SEL_WRITE;
|
qdflags[qd].selmask &= ~SEL_WRITE;
|
||||||
@ -2521,7 +2520,7 @@ GET_MBUTTON:
|
|||||||
|
|
||||||
} /* get last byte of report */
|
} /* get last byte of report */
|
||||||
} else if ((status = duart->statusB)&RCV_RDY &&
|
} else if ((status = duart->statusB)&RCV_RDY &&
|
||||||
qdflags[qd].pntr_id == TABLET_ID) {
|
qdflags[qd].pntr_id == TABLET_ID) {
|
||||||
/*
|
/*
|
||||||
* pickup tablet input, if any
|
* pickup tablet input, if any
|
||||||
*/
|
*/
|
||||||
@ -2720,10 +2719,10 @@ GET_TBUTTON:
|
|||||||
if (qdpolling)
|
if (qdpolling)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (qd >= qd_cd.cd_ndevs || qd_cd.cd_devs[qd] == NULL)
|
if (qd >= qd_cd.cd_ndevs || qd_cd.cd_devs[qd] == NULL)
|
||||||
return; /* no such device or address */
|
return; /* no such device or address */
|
||||||
|
|
||||||
tp = qd_tty[qd << 2];
|
tp = qd_tty[qd << 2];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get a character from the keyboard.
|
* Get a character from the keyboard.
|
||||||
@ -2808,16 +2807,16 @@ GET_TBUTTON:
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#ifdef DDB
|
#ifdef DDB
|
||||||
/* Check for kernel debugger escape here */
|
/* Check for kernel debugger escape here */
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
j = kdbrint(chr&0177);
|
j = kdbrint(chr&0177);
|
||||||
|
|
||||||
if (j == 1) /* Escape received, just return */
|
if (j == 1) /* Escape received, just return */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (j == 2) /* Second char wasn't 'D' */
|
if (j == 2) /* Second char wasn't 'D' */
|
||||||
(*linesw[tp->t_line].l_rint)(27, tp);
|
(*linesw[tp->t_line].l_rint)(27, tp);
|
||||||
#endif
|
#endif
|
||||||
(*linesw[tp->t_line].l_rint)(chr&0177, tp);
|
(*linesw[tp->t_line].l_rint)(chr&0177, tp);
|
||||||
}
|
}
|
||||||
@ -2876,7 +2875,7 @@ clear_qd_screen(unit)
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
qdcnputc(dev, chr)
|
qdcnputc(dev, chr)
|
||||||
dev_t dev;
|
dev_t dev;
|
||||||
int chr;
|
int chr;
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -2898,7 +2897,7 @@ qdcnputc(dev, chr)
|
|||||||
void
|
void
|
||||||
ldcursor(unit, bitmap)
|
ldcursor(unit, bitmap)
|
||||||
int unit;
|
int unit;
|
||||||
short *bitmap;
|
short *bitmap;
|
||||||
{
|
{
|
||||||
volatile register struct dga *dga;
|
volatile register struct dga *dga;
|
||||||
volatile register short *temp;
|
volatile register short *temp;
|
||||||
@ -3063,8 +3062,8 @@ ldfont(unit)
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
qdcnpollc(dev, onoff)
|
qdcnpollc(dev, onoff)
|
||||||
dev_t dev;
|
dev_t dev;
|
||||||
int onoff;
|
int onoff;
|
||||||
{
|
{
|
||||||
qdpolling = onoff;
|
qdpolling = onoff;
|
||||||
}
|
}
|
||||||
@ -3075,7 +3074,7 @@ qdcnpollc(dev, onoff)
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
qdcngetc(dev)
|
qdcngetc(dev)
|
||||||
dev_t dev;
|
dev_t dev;
|
||||||
{
|
{
|
||||||
register short key;
|
register short key;
|
||||||
register char chr;
|
register char chr;
|
||||||
@ -3264,7 +3263,7 @@ scroll_up(adder)
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
init_shared(unit)
|
init_shared(unit)
|
||||||
int unit;
|
int unit;
|
||||||
{
|
{
|
||||||
volatile register struct dga *dga;
|
volatile register struct dga *dga;
|
||||||
|
|
||||||
@ -3750,7 +3749,7 @@ OUT:
|
|||||||
int
|
int
|
||||||
wait_status(adder, mask)
|
wait_status(adder, mask)
|
||||||
volatile struct adder *adder;
|
volatile struct adder *adder;
|
||||||
int mask;
|
int mask;
|
||||||
{
|
{
|
||||||
register int i;
|
register int i;
|
||||||
|
|
||||||
@ -3772,7 +3771,7 @@ wait_status(adder, mask)
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
write_ID(adder, adrs, data)
|
write_ID(adder, adrs, data)
|
||||||
volatile struct adder *adder;
|
volatile struct adder *adder;
|
||||||
short adrs;
|
short adrs;
|
||||||
short data;
|
short data;
|
||||||
{
|
{
|
||||||
|
@ -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 */
|
||||||
|
Loading…
Reference in New Issue
Block a user