--- researchv9/sys/sundev/zs.c 2018/04/24 17:21:59 1.1 +++ researchv9/sys/sundev/zs.c 2018/04/24 17:30:57 1.1.1.2 @@ -18,6 +18,7 @@ #include "../sundev/zsreg.h" #include "../sundev/zscom.h" #include "../sundev/zsvar.h" +#include "../sun/fbio.h" #define ZSWR1_INIT (ZSWR1_SIE|ZSWR1_TIE|ZSWR1_RIE) #define ZS_ON (ZSWR5_DTR|ZSWR5_RTS) @@ -219,13 +220,6 @@ register struct queue *q; } za->rdq = q; za->state |= ISOPEN; - /* - * The 0 channel of the keyboard UART controls - * the keyboard, so push the keyboard line - * discipline on it automatically. - */ - if ((zssoftflags[dev] & ZS_KBDMS) && !(dev & 1)) - pushkeyld(WR(q->next), d); splx(s); } TRC('o'); @@ -309,6 +303,16 @@ register struct block *bp; qreply(q, bp); return; + case KBIOISKBD: + s = za - zsaline; + if ((zssoftflags[s] & ZS_KBDMS) && !(s & 1)) + bp->type = M_IOCACK; + else + bp->type = M_IOCNAK; + bp->wptr = bp->rptr; + qreply(q, bp); + return; + default: bp->wptr = bp->rptr; bp->type = M_IOCNAK; @@ -616,14 +620,27 @@ zsa_xsint(zs) ZSSETSOFT(zs); } -zsa_rxint(zs) +zsa_rxint(zs, d0) register struct zscom *zs; { + struct lregs { + int r[4]; /* d0, d1, a0, a1 */ + u_short sr; + int pc; + } *lp; + extern struct zscom zscom[]; register struct zsaline *za = (struct zsaline *)zs->zs_priv; register struct zscc_device *zsaddr = zs->zs_addr; register u_char c; c = zsaddr->zscc_data; + if (zs == &zscom[2] && c == 1) { /* A no nonsense abort */ + lp = (struct lregs *)&d0; + printf("kernel aborted\n"); + printf("pc = 0x%x, sr= 0x%x, &pc = 0x%x\n", lp->pc, lp->sr, + (int)&lp->pc); + panic("abort"); + } if (c == 0 && (za->za_rr0 & ZSRR0_BREAK)) return; za->za_ibuf[za->za_iptr++] = c; @@ -774,27 +791,3 @@ zsa_process(za) } while (za->za_sptr != za->za_iptr && ++i < 20); return (i >= 20); } - -/* - * push the keyboard line discipline on the line - * function equivalent of FIOPUSHLD, but occurs automatically on open - */ -#include "kbd.h" -#if NKBD > 0 - extern struct streamtab kbdinfo; -#else -# define kbdinfo *(struct streamtab *)NULL -#endif - -pushkeyld(q, d) -register struct queue *q; -{ - if (&kbdinfo == (struct streamtab *)NULL) - return; - if (qattach(&kbdinfo, RD(q), d)) { - long nip = - (*q->next->qinfo->qopen)(RD(q->next), d); - if (nip ==0) - qdetach(RD(q->next), 0); - } -}