diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2006-07-19 20:22:39 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2006-07-19 20:22:39 +0000 |
commit | f250bf06901e944cda4205634d21d378a33606c7 (patch) | |
tree | 9b6fa9da1e01778668d9f481d2ec66b314b8bed5 | |
parent | baf51d608a21989226a34772f1e9cf3a1a3d4dff (diff) |
Remove long dead meat and irrelevant defines. No functional change.
-rw-r--r-- | sys/arch/vax/include/scb.h | 3 | ||||
-rw-r--r-- | sys/arch/vax/include/sid.h | 7 | ||||
-rw-r--r-- | sys/arch/vax/qbus/ubavar.h | 3 | ||||
-rw-r--r-- | sys/arch/vax/vax/dzcons.c | 354 | ||||
-rw-r--r-- | sys/arch/vax/vax/uvax.c | 100 | ||||
-rw-r--r-- | sys/arch/vax/vax/uvax_proto.c | 139 | ||||
-rw-r--r-- | sys/arch/vax/vsa/dc.c | 1024 | ||||
-rw-r--r-- | sys/arch/vax/vsa/dc7085cons.h | 167 | ||||
-rw-r--r-- | sys/arch/vax/vsa/lk201.c | 396 | ||||
-rw-r--r-- | sys/arch/vax/vsa/ncr.c | 4 |
10 files changed, 4 insertions, 2193 deletions
diff --git a/sys/arch/vax/include/scb.h b/sys/arch/vax/include/scb.h index 82b09d6ec22..8cb5786f167 100644 --- a/sys/arch/vax/include/scb.h +++ b/sys/arch/vax/include/scb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: scb.h,v 1.7 2004/07/07 23:10:45 deraadt Exp $ */ +/* $OpenBSD: scb.h,v 1.8 2006/07/19 20:22:36 miod Exp $ */ /* $NetBSD: scb.h,v 1.11 2000/07/10 09:14:34 ragge Exp $ */ /* @@ -130,7 +130,6 @@ struct ivec_dsp { extern const struct ivec_dsp idsptch; extern struct scb *scb; extern struct ivec_dsp *scb_vec; -extern struct evcount devipl_intrcnts[4]; /* IPL 2[0123] */ extern paddr_t scb_init (paddr_t); extern int scb_vecref (int *, int *); diff --git a/sys/arch/vax/include/sid.h b/sys/arch/vax/include/sid.h index 5e4d0657076..f785c39a667 100644 --- a/sys/arch/vax/include/sid.h +++ b/sys/arch/vax/include/sid.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sid.h,v 1.14 2006/03/04 19:33:21 miod Exp $ */ +/* $OpenBSD: sid.h,v 1.15 2006/07/19 20:22:36 miod Exp $ */ /* $NetBSD: sid.h,v 1.12 1999/12/11 17:55:13 ragge Exp $ */ /* @@ -205,11 +205,6 @@ #define VAX_BTYP_1701 0x17000001 /* - * Highest Number supported by OpenBSD/VAX - */ -#define VAX_TYP_MAX VAX_TYP_RIGEL - -/* * compatibility with old names: */ diff --git a/sys/arch/vax/qbus/ubavar.h b/sys/arch/vax/qbus/ubavar.h index cca630c9dd2..de9c102ff96 100644 --- a/sys/arch/vax/qbus/ubavar.h +++ b/sys/arch/vax/qbus/ubavar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ubavar.h,v 1.6 2004/07/07 23:10:46 deraadt Exp $ */ +/* $OpenBSD: ubavar.h,v 1.7 2006/07/19 20:22:37 miod Exp $ */ /* $NetBSD: ubavar.h,v 1.31 2001/04/26 19:16:07 ragge Exp $ */ /* @@ -145,7 +145,6 @@ struct ubinfo { /* * Some common defines for all subtypes of U/Q-buses/adapters. */ -#define MAXUBAXFER (63*1024) /* Max transfer size in bytes */ #define UBAIOSIZE (8*1024) /* 8K I/O space */ #define ubdevreg(addr) ((addr) & 017777) diff --git a/sys/arch/vax/vax/dzcons.c b/sys/arch/vax/vax/dzcons.c deleted file mode 100644 index fa3aa3ca8f6..00000000000 --- a/sys/arch/vax/vax/dzcons.c +++ /dev/null @@ -1,354 +0,0 @@ -/* $OpenBSD: dzcons.c,v 1.6 2006/01/01 11:59:40 miod Exp $ */ -/* $NetBSD: dzcons.c,v 1.5 1997/03/22 12:51:01 ragge Exp $ */ -/* - * Copyright (c) 1994 Gordon W. Ross - * Copyright (c) 1994 Ludd, University of Lule}, Sweden. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed at Ludd, University of Lule}. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * kd.c,v 1.2 1994/05/05 04:46:51 gwr Exp $ - */ - -#include <sys/param.h> -#include <sys/proc.h> -#include <sys/systm.h> -#include <sys/ioctl.h> -#include <sys/tty.h> -#include <sys/file.h> -#include <sys/conf.h> -#include <sys/device.h> -#include <sys/reboot.h> - -#include <dev/cons.h> - -#include <machine/mtpr.h> -#include <machine/sid.h> -#include <machine/uvax.h> -#include <machine/ka410.h> -#include <machine/../vax/gencons.h> - -volatile unsigned char *ka410_intreq = (void *)KA410_INTREQ; -volatile unsigned char *ka410_intclr = (void *)KA410_INTCLR; -volatile unsigned char *ka410_intmsk = (void *)KA410_INTMSK; - - - -/*----------------------------------------------------------------------*/ - -#define REG(name) short name; short X##name##X; -static volatile struct {/* base address of DZ-controller: 0x200A0000 */ - REG(csr); /* 00 Csr: control/status register */ - REG(rbuf); /* 04 Rbuf/Lpr: receive buffer/line param reg. */ - REG(tcr); /* 08 Tcr: transmit console register */ - REG(tdr); /* 0C Msr/Tdr: modem status reg/transmit data reg */ - REG(lpr0); /* 10 Lpr0: */ - REG(lpr1); /* 14 Lpr0: */ - REG(lpr2); /* 18 Lpr0: */ - REG(lpr3); /* 1C Lpr0: */ -} *dz = (void *)0x200A0000; -#undef REG - -void dzcnputc (); - -int -dzcngetc(dev) - dev_t dev; -{ - int c; - int mapen; - int imsk; - - imsk = *ka410_intmsk; /* save interrupt-mask */ - *ka410_intmsk = 0; /* disable console-receive interrupt! */ - - do { - while ((dz->csr & 0x80) == 0); /* Wait for char */ - c = dz->rbuf & 0xff; - } while (c == 17 || c == 19); /* ignore XON/XOFF */ - - *ka410_intclr = 0x80; /* clear the interrupt request */ - *ka410_intmsk = imsk; /* restore interrupt-mask */ - - if (c == 13) - c = 10; - return (c); -} - -struct tty *dzcn_tty[1]; - -int dzcnparam(); -void dzcnstart(); - -int ka410_consintr_enable(void); - -int -dzcnopen(dev, flag, mode, p) - dev_t dev; - int flag, mode; - struct proc *p; -{ - int unit; - struct tty *tp; - - unit = minor(dev); - if (unit) return ENXIO; - - if (dzcn_tty[0] == NULL) - dzcn_tty[0] = ttymalloc(); - - tp = dzcn_tty[0]; - - tp->t_oproc = dzcnstart; - tp->t_param = dzcnparam; - tp->t_dev = dev; - if ((tp->t_state & TS_ISOPEN) == 0) { - tp->t_state |= TS_WOPEN; - ttychars(tp); - tp->t_iflag = TTYDEF_IFLAG; - tp->t_oflag = TTYDEF_OFLAG; - tp->t_cflag = TTYDEF_CFLAG; - tp->t_lflag = TTYDEF_LFLAG; - tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED; - dzcnparam(tp, &tp->t_termios); - ttsetwater(tp); - } else if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) - return EBUSY; - tp->t_state |= TS_CARR_ON; - ka410_consintr_enable(); /* Turn on interrupts */ - - - return ((*linesw[tp->t_line].l_open)(dev, tp)); -} - -int -dzcnclose(dev, flag, mode, p) - dev_t dev; - int flag, mode; - struct proc *p; -{ - int unit = minor(dev); - struct tty *tp = dzcn_tty[0]; - - (*linesw[tp->t_line].l_close)(tp, flag); - ttyclose(tp); - return (0); -} - -struct tty * -dzcntty(dev) - dev_t dev; -{ - - return dzcn_tty[0]; /* XXX */ -} - -int -dzcnread(dev, uio, flag) - dev_t dev; - struct uio *uio; - int flag; -{ - int unit = minor(dev); - struct tty *tp = dzcn_tty[0]; - - return ((*linesw[tp->t_line].l_read)(tp, uio, flag)); -} - -int -dzcnwrite(dev, uio, flag) - dev_t dev; - struct uio *uio; - int flag; -{ - int unit = minor(dev); - struct tty *tp = dzcn_tty[0]; - - return ((*linesw[tp->t_line].l_write)(tp, uio, flag)); -} - -int -dzcnioctl(dev, cmd, data, flag, p) - dev_t dev; - int cmd; - caddr_t data; - int flag; - struct proc *p; -{ - int error; - int unit = minor(dev); - struct tty *tp = dzcn_tty[0]; - - error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p); - if (error >= 0) - return error; - error = ttioctl(tp, cmd, data, flag, p); - if (error >= 0) return error; - - return ENOTTY; -} - -void -dzcnstart(tp) - struct tty *tp; -{ - struct clist *cl; - int s, ch; - - s = spltty(); - if (tp->t_state & (TS_BUSY|TS_TTSTOP|TS_TIMEOUT)) - goto out; - cl = &tp->t_outq; - - if(cl->c_cc){ - tp->t_state |= TS_BUSY; - ch = getc(cl); - dz->tdr = ch; - } else { - if (tp->t_state & TS_ASLEEP) { - tp->t_state &= ~TS_ASLEEP; - wakeup((caddr_t)cl); - } - selwakeup(&tp->t_wsel); - } - -out: splx(s); -} - -dzcnrint() -{ - struct tty *tp; - int i, j; - - tp = dzcn_tty[0]; - while ((dz->csr & 0x80) == 0); /* Wait for char */ - i = dz->rbuf & 0xff; - -#ifdef DDB - j = kdbrint(i); - - if (j == 1) /* Escape received, just return */ - return; - - if (j == 2) /* Second char wasn't 'D' */ - (*linesw[tp->t_line].l_rint)(27, tp); -#endif - - (*linesw[tp->t_line].l_rint)(i,tp); - return; -} - -void -dzcnstop(tp, flag) - struct tty *tp; - int flag; -{ - -} - -dzcntint() -{ - struct tty *tp; - - tp = dzcn_tty[0]; - tp->t_state &= ~TS_BUSY; - - dzcnstart(tp); -} - -int -dzcnparam(tp, t) - struct tty *tp; - struct termios *t; -{ - /* XXX - These are ignored... */ - tp->t_ispeed = t->c_ispeed; - tp->t_ospeed = t->c_ospeed; - tp->t_cflag = t->c_cflag; - return 0; -} - -void -dzcnprobe(cndev) - struct consdev *cndev; -{ - int i; - - switch (vax_boardtype) { - case VAX_BTYP_410: - case VAX_BTYP_420: - case VAX_BTYP_43: - break; - - default: - return; - } - - for (i = 0; i < nchrdev; i++) - if (cdevsw[i].d_open == dzcnopen) { - cndev->cn_dev = makedev(i,0); - cndev->cn_pri = CN_NORMAL; - return; - } -} - -int -dzcninit(cndev) - struct consdev *cndev; -{ - dz = (void *)uvax_phys2virt ((int) dz); - ka410_intreq = (void *)uvax_phys2virt ((int)ka410_intreq); - ka410_intclr = (void *)uvax_phys2virt ((int)ka410_intclr); - ka410_intmsk = (void *)uvax_phys2virt ((int)ka410_intmsk); - - dz->csr = 0; /* Disable scanning until initting is done */ - dz->rbuf = 0; /* Turn off line 0's receiver */ - dz->rbuf = 1; /* Turn off line 1's receiver */ - dz->rbuf = 2; /* Turn off line 2's receiver */ - /* Leave line 3 alone */ - dz->tcr = 8; /* Turn off all but line 3's xmitter */ - dz->csr = 0x20; /* Turn scanning back on */ -} - - -void -dzcnputc(dev,ch) - dev_t dev; - int ch; -{ - int imsk; - int timeout = 1<<15; /* don't hang the machine! */ - - imsk = *ka410_intmsk; - *ka410_intmsk = 0; - - while ((dz->csr & 0x8000) == 0) /* Wait until ready */ - if (--timeout < 0) - break; - dz->tdr = ch; /* Put the character */ - - *ka410_intmsk = imsk; -} diff --git a/sys/arch/vax/vax/uvax.c b/sys/arch/vax/vax/uvax.c deleted file mode 100644 index f19154cdfd3..00000000000 --- a/sys/arch/vax/vax/uvax.c +++ /dev/null @@ -1,100 +0,0 @@ -/* $OpenBSD: uvax.c,v 1.10 2005/11/06 22:21:33 miod Exp $ */ -/* $NetBSD: uvax.c,v 1.4 1997/02/19 10:04:27 ragge Exp $ */ -/* - * Copyright (c) 1996 Ludd, University of Lule}, Sweden. - * Copyright (c) 1982, 1988, 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * generic(?) MicroVAX and VAXstation support - * - * There are similarities to struct cpu_calls[] in autoconf.c - */ - -#include <sys/param.h> -#include <sys/types.h> -#include <sys/device.h> -#include <uvm/uvm_extern.h> - -#include <machine/pte.h> -#include <machine/mtpr.h> -#include <machine/sid.h> -#include <machine/pmap.h> -#include <machine/nexus.h> -#include <machine/uvax.h> -#include <machine/cpu.h> - -/* - * NB: mapping should/must be done in chunks of PAGE_SIZE (ie. 1024), - * while pmap_map() expects size to be in chunks of NBPG (ie. 512). - * - * Thus we round down the start-address to be aligned wrt PAGE_SIZE and - * the end-address up to be just beyond the next multiple of PAGE_SIZE. - * size is the number of bytes between start and end expressed in NBPG. - */ -void -uvax_fillmap() -{ - extern vaddr_t avail_start, virtual_avail, avail_end; - register struct uc_map *p; - register u_int base, end, off, size; - - for (p = dep_call->cpu_map; p->um_base != 0; p++) { - base = TRUNC_PAGE(p->um_base); /* round base down */ - off = p->um_base - base; - size = ROUND_PAGE(off + p->um_size); - if (size < PAGE_SIZE) { - printf("invalid size %d in uVAX_fillmap\n", size); - size = PAGE_SIZE; - } - end = base + size - 1; - MAPVIRT(p->um_virt, size/NBPG); - pmap_map((vaddr_t)p->um_virt, base, end, - VM_PROT_READ|VM_PROT_WRITE); - - } -} - -u_long -uvax_phys2virt(phys) - u_long phys; -{ - register struct uc_map *p; - u_long virt = 0; - - for (p = dep_call->cpu_map; p->um_base != 0; p++) { - if (p->um_base > phys || p->um_end < phys) - continue; - virt = p->um_virt + (phys - trunc_page((vaddr_t)p->um_base)); - break; - } - -#ifdef DIAGNOSTIC - if (virt == 0) - panic("invalid argument %p to uvax_phys2virt()", phys); -#endif - return (virt); -} diff --git a/sys/arch/vax/vax/uvax_proto.c b/sys/arch/vax/vax/uvax_proto.c deleted file mode 100644 index d6c877883e8..00000000000 --- a/sys/arch/vax/vax/uvax_proto.c +++ /dev/null @@ -1,139 +0,0 @@ -/* $OpenBSD: uvax_proto.c,v 1.3 2003/06/02 23:27:59 millert Exp $ */ -/* $NetBSD: uvax_proto.c,v 1.3 1996/10/13 03:36:06 christos Exp $ */ -/*- - * Copyright (c) 1982, 1988, 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -/* - * MicroVAX and VAXstation and their different models have many - * similarities and also many very specific implementations/solutions. - * Thus this is a trial to have generic and prototypic routines - * which can be used instead of specific routines whenever possible. - * - * usually there are groups of machines using the same CPU chips, eg. - * MicroVAX II - * MicroVAX 2000 - * VAXstation 2000 - * have the same CPU and thus can share the CPU dependent code. - * - * On the other hand the above machines are quite differnet wrt. the - * way the board-specific details (system-bus, NVRAM layout, etc.) - * and thus can't share this code. - * - * It's also possible to find groups of machines which have enough - * similarities wrt. to board-specific implementations, to share some - * code between them. Eg. - * VAXstation 2000 - * VAXstation 3100 (which models ???) - * VAXstation 4000 (which models ???) - * use the same (nonexistent "virtual") system-bus and thus can share - * some pieces of code... - */ - -#include <sys/param.h> -#include <sys/types.h> -#include <sys/device.h> - -#include <machine/mtpr.h> - -static int -uVAX_clkread(base) - time_t base; -{ - register struct uVAX_clock *claddr = uVAX_clkptr; - struct chiptime c; - int timeout = 1<<15, rv; - - claddr->csr1 = uVAX_CLKSET; - while ((claddr->csr0 & uVAX_CLKUIP) != 0) - if (--timeout == 0) { - printf ("TOY clock timed out"); - return CLKREAD_BAD; - } - - c.sec = claddr->sec; - c.min = claddr->min; - c.hour = claddr->hr; - c.day = claddr->day; - c.mon = claddr->mon; - c.year = claddr->yr; - - /* If the clock is valid, use it. */ - if ((claddr->csr3 & uVAX_CLKVRT) != 0 && - (claddr->csr1 & uVAX_CLKENABLE) == uVAX_CLKENABLE) { - /* simple sanity checks */ - time.tv_sec = chiptotime(&c); - if (c.mon < 1 || c.mon > 12 || - c.day < 1 || c.day > 31) { - printf("WARNING: preposterous clock chip time"); - rv = CLKREAD_WARN; - } else - rv = CLKREAD_OK; - - claddr->csr0 = uVAX_CLKRATE; - claddr->csr1 = uVAX_CLKENABLE; - return rv; - } - - printf("WARNING: TOY clock invalid"); - return CLKREAD_BAD; -} - -/* Set the time of day clock, called via. stime system call.. */ -static void -uVAX_clkwrite() -{ - register struct uVAX_clock *claddr = uVAX_clkptr; - struct chiptime c; - int timeout = 1<<15; - int s; - - timetochip(&c); - - s = splhigh(); - - claddr->csr1 = uVAX_CLKSET; - while ((claddr->csr0 & uVAX_CLKUIP) != 0) - if (--timeout == 0) { - printf("Trouble saving date, TOY clock timed out\n"); - break; - } - - claddr->sec = c.sec; - claddr->min = c.min; - claddr->hr = c.hour; - claddr->day = c.day; - claddr->mon = c.mon; - claddr->yr = c.year; - - claddr->csr0 = uVAX_CLKRATE; - claddr->csr1 = uVAX_CLKENABLE; - - splx(s); -} diff --git a/sys/arch/vax/vsa/dc.c b/sys/arch/vax/vsa/dc.c deleted file mode 100644 index 1e2e9e7ca19..00000000000 --- a/sys/arch/vax/vsa/dc.c +++ /dev/null @@ -1,1024 +0,0 @@ -/* $OpenBSD: dc.c,v 1.11 2004/09/19 21:34:42 mickey Exp $ */ -/* $NetBSD: dc.c,v 1.4 1996/10/13 03:36:10 christos Exp $ */ -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ralph Campbell and Rick Macklem. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)dc.c 8.2 (Berkeley) 11/30/93 - */ - -/* - * devDC7085.c -- - * - * This file contains machine-dependent routines that handle the - * output queue for the serial lines. - * - * Copyright (C) 1989 Digital Equipment Corporation. - * Permission to use, copy, modify, and distribute this software and - * its documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appears in all copies. - * Digital Equipment Corporation makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * from: Header: /sprite/src/kernel/dev/ds3100.md/RCS/devDC7085.c, - * v 1.4 89/08/29 11:55:30 nelson Exp SPRITE (DECWRL)"; - */ - -#include "dc.h" -#if NDC > 0 -/* - * DC7085 (DZ-11 look alike) Driver - * - * bertram 13-apr-1996: slightly modified for DC367B in VS2000 - */ -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/ioctl.h> -#include <sys/tty.h> -#include <sys/proc.h> -#include <sys/buf.h> -#include <sys/conf.h> -#include <sys/file.h> -#include <sys/uio.h> -#include <sys/kernel.h> -#include <sys/syslog.h> -#include <sys/timeout.h> - -/* - * bertram 17-apr-1996: we could use most of the include files directly - * from the pmax port, only some of the paddings need - * to be changed. For now we use modified copies... - * - * #include <pmax/include/dc7085cons.h> - * #include <pmax/include/pmioctl.h> - * - * #include <pmax/dev/pdma.h> - * #include <pmax/dev/lk201.h> - */ -#include "dc7085cons.h" /* this one is modified !!! */ -#include <pmax/include/pmioctl.h> -#include <pmax/dev/pdma.h> -#include <pmax/dev/lk201.h> - -#include <sys/device.h> - -/* - * here follow some pmax specific includes which we don't need... - */ -#ifdef pmax -#include <machine/autoconf.h> -#include <machine/machConst.h> -#include <pmax/pmax/pmaxtype.h> -#include <pmax/pmax/cons.h> -#endif - -#ifdef vax -#include <machine/sid.h> -#include <machine/uvax.h> -#include <machine/vsbus.h> -#include <pmax/pmax/cons.h> /* we need to modify this for VAXen */ -#define MachEmptyWriteBuffer() /* we don't need this for VAXstation */ -#endif - -#include <pmax/dev/dcvar.h> - -struct dc_softc { - struct device sc_dv; - struct pdma dc_pdma[4]; - void *xmit_cfargs; - void *recv_cfargs; -}; - -/* - * Autoconfiguration data for config. - * - * Use the statically-allocated softc until old autoconfig code and - * config.old are completely gone. - */ -int dcmatch(struct device * parent, void *cfdata, void *aux); -void dcattach(struct device *parent, struct device *self, void *aux); - -int dc_doprobe(void *addr, int unit, int flags, int pri); -int dcintr(void * xxxunit); - -struct cfdriver dc_cd = { - NULL, "dc", DV_TTY -}; -struct cfattach dc_ca = { - sizeof(struct dc_softc), dcmatch, dcattach -}; - - -#define NDCLINE (NDC*4) - -void dcstart(struct tty *); -void dcxint(struct tty *); -void dcPutc(dev_t, int); -void dcscan(void *); -int dcGetc(dev_t); -int dcparam(struct tty *, struct termios *); - -struct tty *dc_tty[NDCLINE]; -int dc_cnt = NDCLINE; -void (*dcDivertXInput)(); /* X windows keyboard input routine */ -void (*dcMouseEvent)(); /* X windows mouse motion event routine */ -void (*dcMouseButtons)(); /* X windows mouse buttons event routine */ -#ifdef DEBUG -int debugChar; -#endif - -/* - * Software copy of brk register since it isn't readable - */ -int dc_brk[NDC]; -char dcsoftCAR[NDC]; /* mask of dc's with carrier on (DSR) */ - -/* - * The DC7085 doesn't interrupt on carrier transitions, so - * we have to use a timer to watch it. - */ -int dc_timer; /* true if timer started */ -struct timeout dc_timeout; - -/* - * Pdma structures for fast output code - */ -struct pdma dcpdma[NDCLINE]; - -const struct speedtab dcspeedtab[] = { - 0, 0, - 50, LPR_B50, - 75, LPR_B75, - 110, LPR_B110, - 134, LPR_B134, - 150, LPR_B150, - 300, LPR_B300, - 600, LPR_B600, - 1200, LPR_B1200, - 1800, LPR_B1800, - 2400, LPR_B2400, - 4800, LPR_B4800, - 9600, LPR_B9600, - 19200, LPR_B19200, - -1, -1 -}; - -#ifndef PORTSELECTOR -#define ISPEED TTYDEF_SPEED -#define LFLAG TTYDEF_LFLAG -#else -#define ISPEED B4800 -#define LFLAG (TTYDEF_LFLAG & ~ECHO) -#endif - -static struct { - void *xmit_cfargs; - void *recv_cfargs; -} vs2000_hack = { NULL, NULL }; - -/* - * Match driver based on name - */ -int -dcmatch(parent, match, aux) - struct device *parent; - void *match; - void *aux; -{ - struct cfdata *cf = match; - struct confargs *ca = aux; - - static int nunits = 0; - - return (0); - - if (strcmp(ca->ca_name, "dc") != 0 && - strcmp(ca->ca_name, "mdc") != 0 && - strcmp(ca->ca_name, "dc367") != 0 && - strcmp(ca->ca_name, "dc7085") != 0) - return (0); - - /* - * Use statically-allocated softc and attach code until - * old config is completely gone. Don't over-run softc. - */ - if (nunits > NDC) { - printf("dc: too many units for old config\n"); - return (0); - } - nunits++; - return (1); -} - -void -dcattach(parent, self, aux) - struct device *parent; - struct device *self; - void *aux; -{ - register struct confargs *ca = aux; - u_long dcaddr; - - dcaddr = (u_long)ca->ca_ioaddr; - (void) dc_doprobe((void *)uvax_phys2virt(dcaddr), - self->dv_unit, self->dv_cfdata->cf_flags, - ca->ca_intslot); - - /* tie pseudo-slot to device */ -#ifdef notyet - vsbus_intr_register(ca, dcintr, self); - vsbus_intr_enable(ca); -#endif - printf("\n"); -} - -/* - * Is there a framebuffer console device using this serial driver? - * XXX used for ugly special-cased console input that should be redone - * more cleanly. - */ -static inline int -raster_console() -{ - return (cn_tab->cn_pri == CN_INTERNAL || - cn_tab->cn_pri == CN_NORMAL); -} - - -/* - * DC7085 (dz-11) probe routine from old-style config. - * This is only here out of inertia. - */ -int -dc_doprobe(addr, unit, flags, priority) - void *addr; - int unit, flags, priority; -{ - register dcregs *dcaddr; - register struct pdma *pdp; - register struct tty *tp; - register int cntr; - int s; - - if (unit >= NDC) - return (0); - if (badaddr(addr, 2)) - return (0); - - /* - * For a remote console, wait a while for previous output to - * complete. - */ - if (major(cn_tab->cn_dev) == DCDEV && unit == 0 && - cn_tab->cn_pri == CN_REMOTE) - DELAY(10000); - - /* reset chip */ - dcaddr = (dcregs *)addr; - dcaddr->dc_csr = CSR_CLR; - MachEmptyWriteBuffer(); - while (dcaddr->dc_csr & CSR_CLR) - ; - dcaddr->dc_csr = CSR_MSE | CSR_TIE | CSR_RIE; - - /* init pseudo DMA structures */ - pdp = &dcpdma[unit * 4]; - for (cntr = 0; cntr < 4; cntr++) { - pdp->p_addr = (void *)dcaddr; - tp = dc_tty[unit * 4 + cntr] = ttymalloc(); - pdp->p_arg = (int) tp; - pdp->p_fcn = dcxint; - pdp++; - } - dcsoftCAR[unit] = flags | 0xB; - - if (dc_timer == 0) { - dc_timer = 1; - timeout_set(&dc_timeout, dcscan, NULL); - timeout_add(&dc_timeout, hz); - } - - /* - * Special handling for consoles. - */ - if (unit == 0) { - if (cn_tab->cn_pri == CN_INTERNAL || - cn_tab->cn_pri == CN_NORMAL) { - s = spltty(); - dcaddr->dc_lpr = LPR_RXENAB | LPR_8_BIT_CHAR | - LPR_B4800 | DCKBD_PORT; - MachEmptyWriteBuffer(); - dcaddr->dc_lpr = LPR_RXENAB | LPR_B4800 | LPR_OPAR | - LPR_PARENB | LPR_8_BIT_CHAR | DCMOUSE_PORT; - MachEmptyWriteBuffer(); - DELAY(1000); - KBDReset(makedev(DCDEV, DCKBD_PORT), dcPutc); - MouseInit(makedev(DCDEV, DCMOUSE_PORT), dcPutc, dcGetc); - splx(s); - } else if (major(cn_tab->cn_dev) == DCDEV) { - s = spltty(); - dcaddr->dc_lpr = LPR_RXENAB | LPR_8_BIT_CHAR | - LPR_B9600 | minor(cn_tab->cn_dev); - MachEmptyWriteBuffer(); - DELAY(1000); - /*cn_tab.cn_disabled = 0;*/ /* FIXME */ - splx(s); - } - } - - return (1); -} - -dcopen(dev, flag, mode, p) - dev_t dev; - int flag, mode; - struct proc *p; -{ - register struct tty *tp; - register int unit; - int s, error = 0; - - unit = minor(dev); - if (unit >= dc_cnt || dcpdma[unit].p_addr == (void *)0) - return (ENXIO); - tp = dc_tty[unit]; - if (tp == NULL) - tp = dc_tty[unit] = ttymalloc(); - tp->t_oproc = dcstart; - tp->t_param = dcparam; - tp->t_dev = dev; - if ((tp->t_state & TS_ISOPEN) == 0) { - tp->t_state |= TS_WOPEN; - ttychars(tp); -#ifndef PORTSELECTOR - if (tp->t_ispeed == 0) { -#endif - tp->t_iflag = TTYDEF_IFLAG; - tp->t_oflag = TTYDEF_OFLAG; - tp->t_cflag = TTYDEF_CFLAG; - tp->t_lflag = LFLAG; - tp->t_ispeed = tp->t_ospeed = ISPEED; -#ifdef PORTSELECTOR - tp->t_cflag |= HUPCL; -#else - } -#endif - (void) dcparam(tp, &tp->t_termios); - ttsetwater(tp); - } else if ((tp->t_state & TS_XCLUDE) && curproc->p_ucred->cr_uid != 0) - return (EBUSY); - (void) dcmctl(dev, DML_DTR, DMSET); - s = spltty(); - while (!(flag & O_NONBLOCK) && !(tp->t_cflag & CLOCAL) && - !(tp->t_state & TS_CARR_ON)) { - tp->t_state |= TS_WOPEN; - if (error = ttysleep(tp, (caddr_t)&tp->t_rawq, TTIPRI | PCATCH, - ttopen, 0)) - break; - } - splx(s); - if (error) - return (error); - return ((*linesw[tp->t_line].l_open)(dev, tp)); -} - -/*ARGSUSED*/ -dcclose(dev, flag, mode, p) - dev_t dev; - int flag, mode; - struct proc *p; -{ - register struct tty *tp; - register int unit, bit; - - unit = minor(dev); - tp = dc_tty[unit]; - bit = 1 << ((unit & 03) + 8); - if (dc_brk[unit >> 2] & bit) { - dc_brk[unit >> 2] &= ~bit; - ttyoutput(0, tp); - } - (*linesw[tp->t_line].l_close)(tp, flag); - if ((tp->t_cflag & HUPCL) || (tp->t_state & TS_WOPEN) || - !(tp->t_state & TS_ISOPEN)) - (void) dcmctl(dev, 0, DMSET); - return (ttyclose(tp)); -} - -dcread(dev, uio, flag) - dev_t dev; - struct uio *uio; -{ - register struct tty *tp; - - tp = dc_tty[minor(dev)]; - return ((*linesw[tp->t_line].l_read)(tp, uio, flag)); -} - -dcwrite(dev, uio, flag) - dev_t dev; - struct uio *uio; -{ - register struct tty *tp; - - tp = dc_tty[minor(dev)]; - return ((*linesw[tp->t_line].l_write)(tp, uio, flag)); -} - -struct tty * -dctty(dev) - dev_t dev; -{ - struct tty *tp = dc_tty [minor (dev)]; - return (tp); -} - -/*ARGSUSED*/ -dcioctl(dev, cmd, data, flag, p) - dev_t dev; - int cmd; - caddr_t data; - int flag; - struct proc *p; -{ - register struct tty *tp; - register int unit = minor(dev); - register int dc = unit >> 2; - int error; - - tp = dc_tty[unit]; - error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p); - if (error >= 0) - return (error); - error = ttioctl(tp, cmd, data, flag, p); - if (error >= 0) - return (error); - - switch (cmd) { - - case TIOCSBRK: - dc_brk[dc] |= 1 << ((unit & 03) + 8); - ttyoutput(0, tp); - break; - - case TIOCCBRK: - dc_brk[dc] &= ~(1 << ((unit & 03) + 8)); - ttyoutput(0, tp); - break; - - case TIOCSDTR: - (void) dcmctl(dev, DML_DTR|DML_RTS, DMBIS); - break; - - case TIOCCDTR: - (void) dcmctl(dev, DML_DTR|DML_RTS, DMBIC); - break; - - case TIOCMSET: - (void) dcmctl(dev, *(int *)data, DMSET); - break; - - case TIOCMBIS: - (void) dcmctl(dev, *(int *)data, DMBIS); - break; - - case TIOCMBIC: - (void) dcmctl(dev, *(int *)data, DMBIC); - break; - - case TIOCMGET: - *(int *)data = dcmctl(dev, 0, DMGET); - break; - - default: - return (ENOTTY); - } - return (0); -} - -dcparam(tp, t) - register struct tty *tp; - register struct termios *t; -{ - register dcregs *dcaddr; - register int lpr; - register int cflag = t->c_cflag; - int unit = minor(tp->t_dev); - int ospeed = ttspeedtab(t->c_ospeed, dcspeedtab); - - /* check requested parameters */ - if (ospeed < 0 || (t->c_ispeed && t->c_ispeed != t->c_ospeed) || - (cflag & CSIZE) == CS5 || (cflag & CSIZE) == CS6 || - (vax_boardtype == -1 && t->c_ospeed == 19200)) - return (EINVAL); - /* and copy to tty */ - tp->t_ispeed = t->c_ispeed; - tp->t_ospeed = t->c_ospeed; - tp->t_cflag = cflag; - - dcaddr = (dcregs *)dcpdma[unit].p_addr; - - /* - * Handle console cases specially. - */ - if (raster_console()) { - if (unit == DCKBD_PORT) { - dcaddr->dc_lpr = LPR_RXENAB | LPR_8_BIT_CHAR | - LPR_B4800 | DCKBD_PORT; - MachEmptyWriteBuffer(); - return (0); - } else if (unit == DCMOUSE_PORT) { - dcaddr->dc_lpr = LPR_RXENAB | LPR_B4800 | LPR_OPAR | - LPR_PARENB | LPR_8_BIT_CHAR | DCMOUSE_PORT; - MachEmptyWriteBuffer(); - return (0); - } - } else if (tp->t_dev == cn_tab->cn_dev) { - dcaddr->dc_lpr = LPR_RXENAB | LPR_8_BIT_CHAR | - LPR_B9600 | unit; - MachEmptyWriteBuffer(); - return (0); - } - if (ospeed == 0) { - (void) dcmctl(unit, 0, DMSET); /* hang up line */ - return (0); - } - lpr = LPR_RXENAB | ospeed | (unit & 03); - if ((cflag & CSIZE) == CS7) - lpr |= LPR_7_BIT_CHAR; - else - lpr |= LPR_8_BIT_CHAR; - if (cflag & PARENB) - lpr |= LPR_PARENB; - if (cflag & PARODD) - lpr |= LPR_OPAR; - if (cflag & CSTOPB) - lpr |= LPR_2_STOP; - dcaddr->dc_lpr = lpr; - MachEmptyWriteBuffer(); - DELAY(10); - return (0); -} - -/* - * Check for interrupts from all devices. - */ -int -dcintr(xxxunit) - void *xxxunit; -{ - register struct dc_softc *sc = xxxunit; - register dcregs *dcaddr; - register unsigned csr; - - register int unit = sc->sc_dv.dv_unit; - - unit <<= 2; - dcaddr = (dcregs *)dcpdma[unit].p_addr; - while ((csr = dcaddr->dc_csr) & (CSR_RDONE | CSR_TRDY)) { - if (csr & CSR_RDONE) - dcrint(unit); - if (csr & CSR_TRDY) - dcxint(dc_tty[unit + ((csr >> 8) & 03)]); - } - /* XXX check for spurious interrupts */ - return 0; -} - -dcrint(unit) - register int unit; -{ - register dcregs *dcaddr; - register struct tty *tp; - register int c, cc; - int overrun = 0; - - dcaddr = (dcregs *)dcpdma[unit].p_addr; - while ((c = dcaddr->dc_rbuf) < 0) { /* char present */ - cc = c & 0xff; - tp = dc_tty[unit + ((c >> 8) & 03)]; - if ((c & RBUF_OERR) && overrun == 0) { - log(LOG_WARNING, "dc%d,%d: silo overflow\n", unit >> 2, - (c >> 8) & 03); - overrun = 1; - } - /* the keyboard requires special translation */ - if (tp == dc_tty[DCKBD_PORT] && raster_console()) { -#ifdef KADB - if (cc == LK_DO) { - spl0(); - kdbpanic(); - return; - } -#endif -#ifdef DEBUG - debugChar = cc; -#endif - if (dcDivertXInput) { - (*dcDivertXInput)(cc); - return; - } - if ((cc = kbdMapChar(cc)) < 0) - return; -#ifdef notyet - } else if (tp == dc_tty[DCMOUSE_PORT] && dcMouseButtons) { - mouseInput(cc); - return; -#endif - } - if (!(tp->t_state & TS_ISOPEN)) { - wakeup((caddr_t)&tp->t_rawq); -#ifdef PORTSELECTOR - if (!(tp->t_state & TS_WOPEN)) -#endif - return; - } - if (c & RBUF_FERR) - cc |= TTY_FE; - if (c & RBUF_PERR) - cc |= TTY_PE; - (*linesw[tp->t_line].l_rint)(cc, tp); - } - DELAY(10); -} - -void -dcxint(tp) - register struct tty *tp; -{ - register struct pdma *dp; - register dcregs *dcaddr; - int unit = minor(tp->t_dev); - - dp = &dcpdma[unit]; - if (dp->p_mem < dp->p_end) { - dcaddr = (dcregs *)dp->p_addr; - dcaddr->dc_tdr = dc_brk[unit >> 2] | *dp->p_mem++; - MachEmptyWriteBuffer(); - DELAY(10); - return; - } - tp->t_state &= ~TS_BUSY; - if (tp->t_state & TS_FLUSH) - tp->t_state &= ~TS_FLUSH; - else { - ndflush(&tp->t_outq, dp->p_mem - (caddr_t) tp->t_outq.c_cf); - dp->p_end = dp->p_mem = tp->t_outq.c_cf; - } - if (tp->t_line) - (*linesw[tp->t_line].l_start)(tp); - else - dcstart(tp); - if (tp->t_outq.c_cc == 0 || !(tp->t_state & TS_BUSY)) { - dcaddr = (dcregs *)dp->p_addr; - dcaddr->dc_tcr &= ~(1 << (unit & 03)); - MachEmptyWriteBuffer(); - DELAY(10); - } -} - -void -dcstart(tp) - register struct tty *tp; -{ - register struct pdma *dp; - register dcregs *dcaddr; - register int cc; - int s; - - dp = &dcpdma[minor(tp->t_dev)]; - dcaddr = (dcregs *)dp->p_addr; - s = spltty(); - if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP)) - goto out; - if (tp->t_outq.c_cc <= tp->t_lowat) { - if (tp->t_state & TS_ASLEEP) { - tp->t_state &= ~TS_ASLEEP; - wakeup((caddr_t)&tp->t_outq); - } - selwakeup(&tp->t_wsel); - } - if (tp->t_outq.c_cc == 0) - goto out; - /* handle console specially */ - if (tp == dc_tty[DCKBD_PORT] && raster_console()) { - while (tp->t_outq.c_cc > 0) { - cc = getc(&tp->t_outq) & 0x7f; - cnputc(cc); - } - /* - * After we flush the output queue we may need to wake - * up the process that made the output. - */ - if (tp->t_outq.c_cc <= tp->t_lowat) { - if (tp->t_state & TS_ASLEEP) { - tp->t_state &= ~TS_ASLEEP; - wakeup((caddr_t)&tp->t_outq); - } - selwakeup(&tp->t_wsel); - } - goto out; - } - cc = ndqb(&tp->t_outq, 0); - if (cc == 0) - goto out; - - tp->t_state |= TS_BUSY; - dp->p_end = dp->p_mem = tp->t_outq.c_cf; - dp->p_end += cc; - dcaddr->dc_tcr |= 1 << (minor(tp->t_dev) & 03); - MachEmptyWriteBuffer(); -out: - splx(s); -} - -/* - * Stop output on a line. - */ -/*ARGSUSED*/ -void -dcstop(tp, flag) - register struct tty *tp; -{ - register struct pdma *dp; - register int s; - - dp = &dcpdma[minor(tp->t_dev)]; - s = spltty(); - if (tp->t_state & TS_BUSY) { - dp->p_end = dp->p_mem; - if (!(tp->t_state & TS_TTSTOP)) - tp->t_state |= TS_FLUSH; - } - splx(s); -} - -dcmctl(dev, bits, how) - dev_t dev; - int bits, how; -{ - register dcregs *dcaddr; - register int unit, mbits; - int b, s; - register int msr; - - unit = minor(dev); - b = 1 << (unit & 03); - dcaddr = (dcregs *)dcpdma[unit].p_addr; - s = spltty(); - /* only channel 2 has modem control (what about line 3?) */ - mbits = DML_DTR | DML_DSR | DML_CAR; - switch (unit & 03) { - case 2: - mbits = 0; - if (dcaddr->dc_tcr & TCR_DTR2) - mbits |= DML_DTR; - msr = dcaddr->dc_msr; - if (msr & MSR_CD2) - mbits |= DML_CAR; - if (msr & MSR_DSR2) { - if (vax_boardtype == -1) - mbits |= DML_CAR | DML_DSR; - else - mbits |= DML_DSR; - } - break; - - case 3: - if (vax_boardtype != -1) { - mbits = 0; - if (dcaddr->dc_tcr & TCR_DTR3) - mbits |= DML_DTR; - msr = dcaddr->dc_msr; - if (msr & MSR_CD3) - mbits |= DML_CAR; - if (msr & MSR_DSR3) - mbits |= DML_DSR; - } - } - switch (how) { - case DMSET: - mbits = bits; - break; - - case DMBIS: - mbits |= bits; - break; - - case DMBIC: - mbits &= ~bits; - break; - - case DMGET: - splx(s); - return (mbits); - } - switch (unit & 03) { - case 2: - if (mbits & DML_DTR) - dcaddr->dc_tcr |= TCR_DTR2; - else - dcaddr->dc_tcr &= ~TCR_DTR2; - break; - - case 3: - if (vax_boardtype != -1) { - if (mbits & DML_DTR) - dcaddr->dc_tcr |= TCR_DTR3; - else - dcaddr->dc_tcr &= ~TCR_DTR3; - } - } - if ((mbits & DML_DTR) && (dcsoftCAR[unit >> 2] & b)) - dc_tty[unit]->t_state |= TS_CARR_ON; - splx(s); - return (mbits); -} - -/* - * This is called by timeout() periodically. - * Check to see if modem status bits have changed. - */ -void -dcscan(arg) - void *arg; -{ - register dcregs *dcaddr; - register struct tty *tp; - register int i, bit, car; - int s; - - s = spltty(); - /* only channel 2 has modem control (what about line 3?) */ - dcaddr = (dcregs *)dcpdma[i = 2].p_addr; - tp = dc_tty[i]; - bit = TCR_DTR2; - if (dcsoftCAR[i >> 2] & bit) - car = 1; - else - car = dcaddr->dc_msr & MSR_DSR2; - if (car) { - /* carrier present */ - if (!(tp->t_state & TS_CARR_ON)) - (void)(*linesw[tp->t_line].l_modem)(tp, 1); - } else if ((tp->t_state & TS_CARR_ON) && - (*linesw[tp->t_line].l_modem)(tp, 0) == 0) - dcaddr->dc_tcr &= ~bit; - splx(s); - timeout_add(&dc_timeout, hz); -} - -/* - * ---------------------------------------------------------------------------- - * - * dcGetc -- - * - * Read a character from a serial line. - * - * Results: - * A character read from the serial port. - * - * Side effects: - * None. - * - * ---------------------------------------------------------------------------- - */ -int -dcGetc(dev) - dev_t dev; -{ - register dcregs *dcaddr; - register int c; - int s; - - dcaddr = (dcregs *)dcpdma[minor(dev)].p_addr; - if (!dcaddr) - return (0); - s = spltty(); - for (;;) { - if (!(dcaddr->dc_csr & CSR_RDONE)) - continue; - c = dcaddr->dc_rbuf; - DELAY(10); - if (((c >> 8) & 03) == (minor(dev) & 03)) - break; - } - splx(s); - return (c & 0xff); -} - -/* - * Send a char on a port, non interrupt driven. - */ -void -dcPutc(dev, c) - dev_t dev; - int c; -{ - register dcregs *dcaddr; - register u_short tcr; - register int timeout; - int s, line; - - s = spltty(); - - dcaddr = (dcregs *)dcpdma[minor(dev)].p_addr; - tcr = dcaddr->dc_tcr; - dcaddr->dc_tcr = tcr | (1 << minor(dev)); - MachEmptyWriteBuffer(); - DELAY(10); - while (1) { - /* - * Wait for transmitter to be not busy. - */ - timeout = 1000000; - while (!(dcaddr->dc_csr & CSR_TRDY) && timeout > 0) - timeout--; - if (timeout == 0) { - printf("dcPutc: timeout waiting for CSR_TRDY\n"); - break; - } - line = (dcaddr->dc_csr >> 8) & 3; - /* - * Check to be sure its the right port. - */ - if (line != minor(dev)) { - tcr |= 1 << line; - dcaddr->dc_tcr &= ~(1 << line); - MachEmptyWriteBuffer(); - DELAY(10); - continue; - } - /* - * Start sending the character. - */ - dcaddr->dc_tdr = dc_brk[0] | (c & 0xff); - MachEmptyWriteBuffer(); - DELAY(10); - /* - * Wait for character to be sent. - */ - while (1) { - /* - * cc -O bug: this code produces and infinite loop! - * while (!(dcaddr->dc_csr & CSR_TRDY)) - * ; - */ - timeout = 1000000; - while (!(dcaddr->dc_csr & CSR_TRDY) && timeout > 0) - timeout--; - line = (dcaddr->dc_csr >> 8) & 3; - if (line != minor(dev)) { - tcr |= 1 << line; - dcaddr->dc_tcr &= ~(1 << line); - MachEmptyWriteBuffer(); - DELAY(10); - continue; - } - dcaddr->dc_tcr &= ~(1 << minor(dev)); - MachEmptyWriteBuffer(); - DELAY(10); - break; - } - break; - } - /* - * Enable interrupts for other lines which became ready. - */ - if (tcr & 0xF) { - dcaddr->dc_tcr = tcr; - MachEmptyWriteBuffer(); - DELAY(10); - } - - splx(s); -} -#endif /* NDC */ diff --git a/sys/arch/vax/vsa/dc7085cons.h b/sys/arch/vax/vsa/dc7085cons.h deleted file mode 100644 index 45e2bf8d019..00000000000 --- a/sys/arch/vax/vsa/dc7085cons.h +++ /dev/null @@ -1,167 +0,0 @@ -/* $OpenBSD: dc7085cons.h,v 1.3 2003/06/02 23:27:59 millert Exp $ */ -/* $NetBSD: dc7085cons.h,v 1.1 1996/07/20 18:55:10 ragge Exp $ */ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ralph Campbell and Rick Macklem. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)dc7085cons.h 8.1 (Berkeley) 6/10/93 - * - * dc7085.h -- - * - * Definitions for the dc7085 chip. - * - * Copyright (C) 1989 Digital Equipment Corporation. - * Permission to use, copy, modify, and distribute this software and - * its documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appears in all copies. - * Digital Equipment Corporation makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * from: Header: /sprite/src/kernel/dev/ds3100.md/RCS/dc7085.h, - * - * v 1.4 89/08/15 19:52:46 rab Exp SPRITE (DECWRL) - */ - -#ifndef _DC7085 -#define _DC7085 - -typedef volatile struct dc7085regs { - u_short dc_csr; /* control and status (R/W) */ - u_short pad0; - short dc_rbuf_lpr; /* receiver data (R), line params (W) */ - u_short pad1; - u_short dc_tcr; /* transmitter control (R/W) */ - u_short pad2; - u_short dc_msr_tdr; /* modem status (R), transmit data (W) */ -} dcregs; -#define dc_rbuf dc_rbuf_lpr -#define dc_lpr dc_rbuf_lpr -#define dc_msr dc_msr_tdr -#define dc_tdr dc_msr_tdr - -/* - * Control status register bits. - */ -#define CSR_TRDY 0x8000 -#define CSR_TIE 0x4000 /* not avail on VS2000 */ -#define CSR_TX_LINE_NUM 0x0300 -#define CSR_RDONE 0x0080 -#define CSR_RIE 0x0040 /* not avail on VS2000 */ -#define CSR_MSE 0x0020 -#define CSR_CLR 0x0010 -#define CSR_MAINT 0x0008 - -/* - * Receiver buffer register bits. - */ -#define RBUF_DVAL 0x8000 -#define RBUF_OERR 0x4000 -#define RBUF_FERR 0x2000 -#define RBUF_PERR 0x1000 -#define RBUF_LINE_NUM 0x0300 -#define RBUF_LINE_NUM_SHIFT 8 -#define RBUF_CHAR 0x00FF - -/* - * Transmit control register values. - */ -#define TCR_DTR2 0x0400 -#define TCR_EN3 0x0008 -#define TCR_EN2 0x0004 -#define TCR_EN1 0x0002 -#define TCR_EN0 0x0001 - -#define TCR_RTS2 0x0800 /* VS2000: LLBK_2 */ -#define TCR_RTS3 0x0200 /* VS2000: DSRS_2 */ -#define TCR_DTR3 0x0100 /* VS2000: RTS_2 */ - -/* - * Line parameter register bits. - */ -#define LPR_RXENAB 0x1000 -#define LPR_B50 0x0000 -#define LPR_B75 0x0100 -#define LPR_B110 0x0200 -#define LPR_B134 0x0300 -#define LPR_B150 0x0400 -#define LPR_B300 0x0500 -#define LPR_B600 0x0600 -#define LPR_B1200 0x0700 -#define LPR_B1800 0x0800 -#define LPR_B2000 0x0900 -#define LPR_B2400 0x0A00 -#define LPR_B3600 0x0B00 -#define LPR_B4800 0x0C00 -#define LPR_B7200 0x0D00 -#define LPR_B9600 0x0E00 -#define LPR_B19200 0x0F00 -#define LPR_B38400 0x0F00 -#define LPR_OPAR 0x0080 -#define LPR_PARENB 0x0040 -#define LPR_2_STOP 0x0020 -#define LPR_8_BIT_CHAR 0x0018 -#define LPR_7_BIT_CHAR 0x0010 -#define LPR_6_BIT_CHAR 0x0008 -#define LPR_5_BIT_CHAR 0x0000 - -/* - * Modem status register bits. - */ -#define MSR_DSR2 0x0200 - -#define MSR_RI2 0x0800 /* VS2000: 0x0004 */ -#define MSR_CD2 0x0400 -#define MSR_CTS2 0x0100 -#define MSR_RI3 0x0008 /* VS2000: not used/available */ -#define MSR_CD3 0x0004 /* VS2000: RI2 */ -#define MSR_DSR3 0x0002 /* VS2000: MBZ */ -#define MSR_CTS3 0x0001 /* VS2000: TMI_2 */ - -/* - * The four serial ports. - */ -#define DCKBD_PORT 0 -#define DCMOUSE_PORT 1 -#define DCCOMM_PORT 2 -#define DCPRINTER_PORT 3 - -/* bits in dm lsr, copied from dmreg.h */ -#define DML_DSR 0000400 /* data set ready, not a real DM bit */ -#define DML_RNG 0000200 /* ring */ -#define DML_CAR 0000100 /* carrier detect */ -#define DML_CTS 0000040 /* clear to send */ -#define DML_SR 0000020 /* secondary receive */ -#define DML_ST 0000010 /* secondary transmit */ -#define DML_RTS 0000004 /* request to send */ -#define DML_DTR 0000002 /* data terminal ready */ -#define DML_LE 0000001 /* line enable */ - -#endif /* _DC7085 */ diff --git a/sys/arch/vax/vsa/lk201.c b/sys/arch/vax/vsa/lk201.c deleted file mode 100644 index 3ffcdd36352..00000000000 --- a/sys/arch/vax/vsa/lk201.c +++ /dev/null @@ -1,396 +0,0 @@ -/* $OpenBSD: lk201.c,v 1.6 2005/11/21 18:16:37 millert Exp $ */ - -/* - * The LK201 keycode mapping routine is here, along with initialization - * functions for the keyboard and mouse. - */ - - -#include <sys/param.h> -#include <sys/syslog.h> -#include <sys/selinfo.h> -#include <dev/cons.h> - -#include <pmax/include/pmioctl.h> - -#include <pmax/dev/lk201.h> - - -/* Exported functions */ -extern int kbdMapChar(int keycode); - -extern void KBDReset(dev_t dev, void (*putc)(dev_t, int)); - -/* - * Keyboard to Ascii, unshifted. - */ -static unsigned char unshiftedAscii[] = { -/* 0 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 4 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 8 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 10 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 14 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 18 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 1c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 20 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 24 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 28 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 2c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 30 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 34 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 38 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 3c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 40 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 44 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 48 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 4c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 50 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 54 */ KBD_NOKEY, KBD_NOKEY, KBD_F1, KBD_F2, -/* 58 */ KBD_F3, KBD_F4, KBD_F5, KBD_NOKEY, -/* 5c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 60 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 64 */ KBD_F6, KBD_F7, KBD_F8, KBD_F9, -/* 68 */ KBD_F10, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 6c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 70 */ KBD_NOKEY, '\033', KBD_F12, KBD_F13, -/* 74 */ KBD_F14, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 78 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 7c */ KBD_HELP, KBD_DO, KBD_NOKEY, KBD_NOKEY, -/* 80 */ KBD_F17, KBD_F18, KBD_F19, KBD_F20, -/* 84 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 88 */ KBD_NOKEY, KBD_NOKEY, KBD_FIND, KBD_INSERT, -/* 8c */ KBD_REMOVE, KBD_SELECT, KBD_PREVIOUS, KBD_NEXT, -/* 90 */ KBD_NOKEY, KBD_NOKEY, '0', KBD_NOKEY, -/* 94 */ '.', KBD_KP_ENTER, '1', '2', -/* 98 */ '3', '4', '5', '6', -/* 9c */ ',', '7', '8', '9', -/* a0 */ '-', KBD_KP_F1, KBD_KP_F2, KBD_KP_F3, -/* a4 */ KBD_KP_F4, KBD_NOKEY, KBD_NOKEY, KBD_LEFT, -/* a8 */ KBD_RIGHT, KBD_DOWN, KBD_UP, KBD_NOKEY, -/* ac */ KBD_NOKEY, KBD_NOKEY, KBD_SHIFT, KBD_CONTROL, -/* b0 */ KBD_CAPSLOCK, KBD_ALTERNATE, KBD_NOKEY, KBD_NOKEY, -/* b4 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* b8 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* bc */ KBD_DEL, KBD_RET, KBD_TAB, '`', -/* c0 */ '1', 'q', 'a', 'z', -/* c4 */ KBD_NOKEY, '2', 'w', 's', -/* c8 */ 'x', '<', KBD_NOKEY, '3', -/* cc */ 'e', 'd', 'c', KBD_NOKEY, -/* d0 */ '4', 'r', 'f', 'v', -/* d4 */ ' ', KBD_NOKEY, '5', 't', -/* d8 */ 'g', 'b', KBD_NOKEY, '6', -/* dc */ 'y', 'h', 'n', KBD_NOKEY, -/* e0 */ '7', 'u', 'j', 'm', -/* e4 */ KBD_NOKEY, '8', 'i', 'k', -/* e8 */ ',', KBD_NOKEY, '9', 'o', -/* ec */ 'l', '.', KBD_NOKEY, '0', -/* f0 */ 'p', KBD_NOKEY, ';', '/', -/* f4 */ KBD_NOKEY, '=', ']', '\\', -/* f8 */ KBD_NOKEY, '-', '[', '\'', -/* fc */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -}; - -/* - * Keyboard to Ascii, shifted. - */ -static unsigned char shiftedAscii[] = { -/* 0 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 4 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 8 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 10 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 14 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 18 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 1c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 20 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 24 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 28 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 2c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 30 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 34 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 38 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 3c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 40 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 44 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 48 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 4c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 50 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 54 */ KBD_NOKEY, KBD_NOKEY, KBD_F1, KBD_F2, -/* 58 */ KBD_F3, KBD_F4, KBD_F5, KBD_NOKEY, -/* 5c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 60 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 64 */ KBD_F6, KBD_F7, KBD_F8, KBD_F9, -/* 68 */ KBD_F10, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 6c */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 70 */ KBD_NOKEY, KBD_F11, KBD_F12, KBD_F13, -/* 74 */ KBD_F14, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 78 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 7c */ KBD_HELP, KBD_DO, KBD_NOKEY, KBD_NOKEY, -/* 80 */ KBD_F17, KBD_F18, KBD_F19, KBD_F20, -/* 84 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* 88 */ KBD_NOKEY, KBD_NOKEY, KBD_FIND, KBD_INSERT, -/* 8c */ KBD_REMOVE, KBD_SELECT, KBD_PREVIOUS, KBD_NEXT, -/* 90 */ KBD_NOKEY, KBD_NOKEY, '0', KBD_NOKEY, -/* 94 */ '.', KBD_KP_ENTER, '1', '2', -/* 98 */ '3', '4', '5', '6', -/* 9c */ ',', '7', '8', '9', -/* a0 */ '-', KBD_KP_F1, KBD_KP_F2, KBD_KP_F3, -/* a4 */ KBD_KP_F4, KBD_NOKEY, KBD_NOKEY, KBD_LEFT, -/* a8 */ KBD_RIGHT, KBD_DOWN, KBD_UP, KBD_NOKEY, -/* ac */ KBD_NOKEY, KBD_NOKEY, KBD_SHIFT, KBD_CONTROL, -/* b0 */ KBD_CAPSLOCK, KBD_ALTERNATE, KBD_NOKEY, KBD_NOKEY, -/* b4 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* b8 */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -/* bc */ KBD_DEL, KBD_RET, KBD_TAB, '~', -/* c0 */ '!', 'q', 'a', 'z', -/* c4 */ KBD_NOKEY, '@', 'w', 's', -/* c8 */ 'x', '>', KBD_NOKEY, '#', -/* cc */ 'e', 'd', 'c', KBD_NOKEY, -/* d0 */ '$', 'r', 'f', 'v', -/* d4 */ ' ', KBD_NOKEY, '%', 't', -/* d8 */ 'g', 'b', KBD_NOKEY, '^', -/* dc */ 'y', 'h', 'n', KBD_NOKEY, -/* e0 */ '&', 'u', 'j', 'm', -/* e4 */ KBD_NOKEY, '*', 'i', 'k', -/* e8 */ '<', KBD_NOKEY, '(', 'o', -/* ec */ 'l', '>', KBD_NOKEY, ')', -/* f0 */ 'p', KBD_NOKEY, ':', '?', -/* f4 */ KBD_NOKEY, '+', '}', '|', -/* f8 */ KBD_NOKEY, '_', '{', '"', -/* fc */ KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, KBD_NOKEY, -}; - -/* - * Keyboard initialization string. - */ -static u_char kbdInitString[] = { - LK_LED_ENABLE, LED_ALL, /* show we are resetting keyboard */ - LK_DEFAULTS, - LK_CMD_MODE(LK_AUTODOWN, 1), - LK_CMD_MODE(LK_AUTODOWN, 2), - LK_CMD_MODE(LK_AUTODOWN, 3), - LK_CMD_MODE(LK_DOWN, 4), /* could also be LK_AUTODOWN */ - LK_CMD_MODE(LK_UPDOWN, 5), - LK_CMD_MODE(LK_UPDOWN, 6), - LK_CMD_MODE(LK_AUTODOWN, 7), - LK_CMD_MODE(LK_AUTODOWN, 8), - LK_CMD_MODE(LK_AUTODOWN, 9), - LK_CMD_MODE(LK_AUTODOWN, 10), - LK_CMD_MODE(LK_AUTODOWN, 11), - LK_CMD_MODE(LK_AUTODOWN, 12), - LK_CMD_MODE(LK_DOWN, 13), - LK_CMD_MODE(LK_AUTODOWN, 14), - LK_AR_ENABLE, /* we want autorepeat by default */ - LK_CL_ENABLE, 0x83, /* keyclick, volume */ - LK_KBD_ENABLE, /* the keyboard itself */ - LK_BELL_ENABLE, 0x83, /* keyboard bell, volume */ - LK_LED_DISABLE, LED_ALL, /* clear keyboard leds */ -}; - - -/* - * Initialize the Keyboard. - */ -void -KBDReset(kbddev, putc) - dev_t kbddev; - void (*putc)(dev_t, int); -{ - register int i; - static int inKBDReset; - - if (inKBDReset) - return; - inKBDReset = 1; - for (i = 0; i < sizeof(kbdInitString); i++) - (*putc)(kbddev, (int)kbdInitString[i]); - inKBDReset = 0; -} - -/* - * ---------------------------------------------------------------------------- - * - * kbdMapChar -- - * - * Map characters from the keyboard to ASCII. Return -1 if there is - * no valid mapping. - * - * Results: - * None. - * - * Side effects: - * Remember state of shift and control keys. - * - * ---------------------------------------------------------------------------- - */ -int -kbdMapChar(cc) - int cc; -{ - static u_char shiftDown; - static u_char ctrlDown; - static u_char lastChar; - - switch (cc) { - case KEY_REPEAT: - cc = lastChar; - goto done; - - case KEY_UP: - shiftDown = 0; - ctrlDown = 0; - return (-1); - - case KEY_SHIFT: - case KEY_R_SHIFT: - if (ctrlDown || shiftDown) - shiftDown = 0; - else - shiftDown = 1; - return (-1); - - case KEY_CONTROL: - if (shiftDown || ctrlDown) - ctrlDown = 0; - else - ctrlDown = 1; - return (-1); - - case LK_POWER_ERROR: - case LK_KDOWN_ERROR: - case LK_INPUT_ERROR: - case LK_OUTPUT_ERROR: - log(LOG_WARNING, - "lk201: keyboard error, code=%x\n", cc); - return (-1); - } - if (shiftDown) - cc = shiftedAscii[cc]; - else - cc = unshiftedAscii[cc]; - if (cc >= KBD_NOKEY) { - /* - * A function key was typed - ignore it. - */ - return (-1); - } - if (cc >= 'a' && cc <= 'z') { - if (ctrlDown) - cc = cc - 'a' + '\1'; /* ^A */ - else if (shiftDown) - cc = cc - 'a' + 'A'; - } else if (ctrlDown) { - if (cc >= '[' && cc <= '_') - cc = cc - '@'; - else if (cc == ' ' || cc == '@') - cc = '\0'; - } - lastChar = cc; -done: - return (cc); -} - - -static int (*raw_kbd_getc)(dev_t dev) = NULL; -static dev_t lk_in_dev = NODEV; - -/* - * Divert input from a serial port to the lk-201 keyboard handler. - */ -void -lk_divert(getfn, in_dev) - int (*getfn)(dev_t dev) ; - dev_t in_dev; -{ - raw_kbd_getc = getfn; - lk_in_dev = in_dev; -} - -/* - * Get an ASCII character off of the keyboard. - * Simply pass the getc request onto the underlying - * serial driver, and map the resulting LK-201 keycode to ASCII. - * FIXME: this design can't handle cursor or keypad keys, - * and should be thrown away and replaced with a stackable - * "Bstreams"-style driver. - */ -int -LKgetc(dev) - dev_t dev; /* ignored */ -{ - register int c; - - extern sccGetc(); - -#if 0 -/*XXX*/ printf("LK-201 getc 0x%x( [%d %d]) in_dev [%d %d]\n", - raw_kbd_getc, - major(dev), minor(dev), - major(lk_in_dev), minor(lk_in_dev)); -#endif - - if (raw_kbd_getc == NULL) { - panic("Reading from LK-201 before keyboard driver diverted"); - return (-1); - } - - for (;;) { - /* c = (*cn_tab.cn_kbdgetc)(cn_tab.cn_dev); */ - c = (*raw_kbd_getc) (lk_in_dev); -#if 0 -/*XXX*/ printf(" 0x%x [%c]", c, c); -#endif - if (c == 0) - return (-1); - if ((c = kbdMapChar(c & 0xff)) >= 0) - break; - } - return (c); -} - - -/* - * Initialize the mouse. (Doesn't really belong here.) - */ -void -MouseInit(mdev, putc, getc) - dev_t mdev; - void (*putc)(dev_t, int); - int (*getc)(dev_t); -{ - int id_byte1, id_byte2, id_byte3, id_byte4; - - /* - * Initialize the mouse. - */ - (*putc)(mdev, MOUSE_SELF_TEST); - id_byte1 = (*getc)(mdev); - if (id_byte1 < 0) { - printf("MouseInit: Timeout on 1st byte of self-test report\n"); - return; - } - id_byte2 = (*getc)(mdev); - if (id_byte2 < 0) { - printf("MouseInit: Timeout on 2nd byte of self-test report\n"); - return; - } - id_byte3 = (*getc)(mdev); - if (id_byte3 < 0) { - printf("MouseInit: Timeout on 3rd byte of self-test report\n"); - return; - } - id_byte4 = (*getc)(mdev); - if (id_byte4 < 0) { - printf("MouseInit: Timeout on 4th byte of self-test report\n"); - return; - } - if ((id_byte2 & 0x0f) != 0x2) - printf("MouseInit: We don't have a mouse!!!\n"); - /* - * For some reason, the mouse doesn't see this command if it comes - * too soon after a self test. - */ - DELAY(100); - (*putc)(mdev, MOUSE_INCREMENTAL); -} diff --git a/sys/arch/vax/vsa/ncr.c b/sys/arch/vax/vsa/ncr.c index df5896604cd..42448636c76 100644 --- a/sys/arch/vax/vsa/ncr.c +++ b/sys/arch/vax/vsa/ncr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ncr.c,v 1.17 2006/07/12 18:09:56 miod Exp $ */ +/* $OpenBSD: ncr.c,v 1.18 2006/07/19 20:22:38 miod Exp $ */ /* $NetBSD: ncr.c,v 1.32 2000/06/25 16:00:43 ragge Exp $ */ /*- @@ -149,8 +149,6 @@ struct cfdriver ncr_cd = { NULL, "ncr", DV_DULL }; -extern struct cfdriver sd_cd; - static int si_match(parent, cf, aux) struct device *parent; |