Remove lkc, add lkkbd/lkms support.

This commit is contained in:
ragge 2000-12-02 17:09:43 +00:00
parent a81d92ef69
commit 3321363123
1 changed files with 87 additions and 67 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: dz_ibus.c,v 1.20 2000/07/26 21:50:49 matt Exp $ */ /* $NetBSD: dz_ibus.c,v 1.21 2000/12/02 17:09:43 ragge Exp $ */
/* /*
* Copyright (c) 1998 Ludd, University of Lule}, Sweden. * Copyright (c) 1998 Ludd, University of Lule}, Sweden.
* All rights reserved. * All rights reserved.
@ -56,14 +56,17 @@
#include <dev/qbus/dzreg.h> #include <dev/qbus/dzreg.h>
#include <dev/qbus/dzvar.h> #include <dev/qbus/dzvar.h>
#include <dev/dec/dzkbdvar.h>
#include "ioconf.h" #include "ioconf.h"
#include "lkc.h" #include "dzkbd.h"
#include "dzms.h"
static int dz_vsbus_match(struct device *, struct cfdata *, void *); static int dz_vsbus_match(struct device *, struct cfdata *, void *);
static void dz_vsbus_attach(struct device *, struct device *, void *); static void dz_vsbus_attach(struct device *, struct device *, void *);
static int dz_print(void *, const char *);
static vaddr_t dz_regs; /* Used for console */ static vaddr_t dz_regs; /* Used for console */
//static struct dz_linestate dz_conslinestate = { NULL, -1, NULL, NULL, NULL };
struct cfattach dz_vsbus_ca = { struct cfattach dz_vsbus_ca = {
sizeof(struct dz_softc), dz_vsbus_match, dz_vsbus_attach sizeof(struct dz_softc), dz_vsbus_match, dz_vsbus_attach
@ -83,22 +86,31 @@ static volatile struct ss_dz {/* base address of DZ-controller: 0x200A0000 */
#undef REG #undef REG
cons_decl(dz); cons_decl(dz);
cdev_decl(dz);
int static int
dz_print(aux, name) dz_print(void *aux, const char *name)
void *aux;
const char *name;
{ {
#if 0
#if NDZKBD > 0 || NDZMS > 0
struct dz_attach_args *dz_args = aux;
if (name == NULL) {
printf (" line %d", dz_args->line);
if (dz_args->hwflags & DZ_HWFLAG_CONSOLE)
printf (" (console)");
}
return (QUIET);
#else
if (name) if (name)
printf ("lkc at %s", name); printf ("lkc at %s", name);
return (UNCONF); return (UNCONF);
#endif
#endif
return (UNCONF);
} }
static int static int
dz_vsbus_match(parent, cf, aux) dz_vsbus_match(struct device *parent, struct cfdata *cf, void *aux)
struct device *parent;
struct cfdata *cf;
void *aux;
{ {
struct vsbus_attach_args *va = aux; struct vsbus_attach_args *va = aux;
struct ss_dz *dzP; struct ss_dz *dzP;
@ -118,12 +130,13 @@ dz_vsbus_match(parent, cf, aux)
} }
static void static void
dz_vsbus_attach(parent, self, aux) dz_vsbus_attach(struct device *parent, struct device *self, void *aux)
struct device *parent, *self;
void *aux;
{ {
struct dz_softc *sc = (void *)self; struct dz_softc *sc = (void *)self;
struct vsbus_attach_args *va = aux; struct vsbus_attach_args *va = aux;
#if NDZKBD > 0 || NDZMS > 0
struct dzkm_attach_args daa;
#endif
/* /*
* XXX - This is evil and ugly, but... * XXX - This is evil and ugly, but...
@ -151,15 +164,28 @@ dz_vsbus_attach(parent, self, aux)
dzattach(sc, NULL); dzattach(sc, NULL);
if (((vax_confdata & 0x80) == 0) ||/* workstation, have lkc */ #if NDZKBD > 0
(vax_boardtype == VAX_BTYP_48)) /* Don't change speed if this is the console */
if (cn_tab->cn_pri > CN_NORMAL) /* Passed cnsl detect */ if (cn_tab->cn_dev != makedev(getmajor(dzopen), 0))
config_found(self, 0, dz_print); dz->rbuf = DZ_LPR_RX_ENABLE | (DZ_LPR_B4800 << 8)
| DZ_LPR_8_BIT_CHAR;
daa.daa_line = 0;
daa.daa_flags = (cn_tab->cn_pri == CN_INTERNAL ? DZKBD_CONSOLE : 0);
config_found(self, &daa, dz_print);
#endif
#if NDZMS > 0
dz->rbuf = DZ_LPR_RX_ENABLE | (DZ_LPR_B4800 << 8) | DZ_LPR_7_BIT_CHAR \
| DZ_LPR_PARENB | DZ_LPR_OPAR | 1 /* line */;
daa.daa_line = 1;
daa.daa_flags = 0;
config_found(self, &daa, dz_print);
#endif
dzrint(sc);
dzxint(sc);
} }
int int
dzcngetc(dev) dzcngetc(dev_t dev)
dev_t dev;
{ {
int c = 0; int c = 0;
int mino = minor(dev); int mino = minor(dev);
@ -180,11 +206,8 @@ dzcngetc(dev)
return (c); return (c);
} }
#define DZMAJOR 1
void void
dzcnprobe(cndev) dzcnprobe(struct consdev *cndev)
struct consdev *cndev;
{ {
extern vaddr_t iospace; extern vaddr_t iospace;
int diagcons; int diagcons;
@ -215,14 +238,13 @@ dzcnprobe(cndev)
cndev->cn_pri = CN_REMOTE; cndev->cn_pri = CN_REMOTE;
else else
cndev->cn_pri = CN_NORMAL; cndev->cn_pri = CN_NORMAL;
cndev->cn_dev = makedev(DZMAJOR, diagcons); cndev->cn_dev = makedev(getmajor(dzopen), diagcons);
dz_regs = iospace; (vaddr_t)dz = dz_regs = iospace;
ioaccess(iospace, ioaddr, 1); ioaccess(iospace, ioaddr, 1);
} }
void void
dzcninit(cndev) dzcninit(struct consdev *cndev)
struct consdev *cndev;
{ {
dz = (void*)dz_regs; dz = (void*)dz_regs;
@ -233,9 +255,7 @@ dzcninit(cndev)
void void
dzcnputc(dev,ch) dzcnputc(dev_t dev, int ch)
dev_t dev;
int ch;
{ {
int timeout = 1<<15; /* don't hang the machine! */ int timeout = 1<<15; /* don't hang the machine! */
int mino = minor(dev); int mino = minor(dev);
@ -272,43 +292,43 @@ dzcnpollc(dev, pollflag)
vsbus_setmask(mask); vsbus_setmask(mask);
} }
#if NLKC int
cons_decl(lkc); dzgetc(ls)
struct dz_linestate *ls;
{
int line = ls->dz_line;
u_short rbuf;
for (;;) {
for(; (dz->csr & DZ_CSR_RX_DONE) == 0;);
rbuf = dz->rbuf;
if (((rbuf >> 8) & 3) == line)
return (rbuf & 0xff);
}
}
void void
lkccninit(cndev) dzputc(ls,ch)
struct consdev *cndev; struct dz_linestate *ls;
int ch;
{ {
dz = (void*)dz_regs; int line = 0; /* = ls->dz_line; */
u_short tcr;
int s;
dz->csr = 0; /* Disable scanning until initting is done */ /* if the dz has already been attached, the MI
dz->tcr = 1; /* Turn off all but line 0's xmitter */ driver will do the transmitting: */
dz->rbuf = 0x1c18; /* XXX */ if (ls && ls->dz_sc) {
dz->csr = 0x20; /* Turn scanning back on */ s = spltty();
putc(ch, &ls->dz_sc->sc_dz[line].dz_tty->t_outq);
tcr = dz->tcr;
if (!(tcr & (1 << line)))
dz->tcr = tcr | (1 << line);
dzxint(ls->dz_sc);
splx(s);
return;
}
/* use dzcnputc to do the transmitting: */
dzcnputc(makedev(getmajor(dzopen), line), ch);
} }
int
lkccngetc(dev)
dev_t dev;
{
int lkc_decode(int);
int c;
// u_char mask;
// mask = vsbus_setmask(0); /* save old state */
loop:
while ((dz->csr & 0x80) == 0)
; /* Wait for char */
c = lkc_decode(dz->rbuf & 255);
if (c < 1)
goto loop;
// vsbus_clrintr(0x80); /* XXX */
// vsbus_setmask(mask);
return (c);
}
#endif