diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1997-11-06 12:27:10 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1997-11-06 12:27:10 +0000 |
commit | f5902371f82ba0a4cdeae260a9bfa286bb43df23 (patch) | |
tree | 71e52b49b50dfc44c624c33d2f4679ba71aca1b1 | |
parent | f31ea30fa71988df28fa8172d41c4bf4968a55d9 (diff) |
Add some missing things for the MI vga driver. Move wscons to an MI place as
well. $OpenBSD$ tagging
31 files changed, 68 insertions, 2247 deletions
diff --git a/sys/arch/alpha/conf/files.alpha b/sys/arch/alpha/conf/files.alpha index c8d41a7b4d9..3c941b6a008 100644 --- a/sys/arch/alpha/conf/files.alpha +++ b/sys/arch/alpha/conf/files.alpha @@ -1,4 +1,4 @@ -# $OpenBSD: files.alpha,v 1.15 1997/11/06 02:53:44 niklas Exp $ +# $OpenBSD: files.alpha,v 1.16 1997/11/06 12:27:01 niklas Exp $ # $NetBSD: files.alpha,v 1.32 1996/11/25 04:03:21 cgd Exp $ # # alpha-specific configuration info @@ -48,21 +48,8 @@ major { rd = 6 } define raster include "dev/rcons/files.rcons" -file arch/alpha/wscons/wscons_rinit.c raster -file arch/alpha/wscons/wscons_rops.c raster - - -# -# "Workstation Console" glue; attaches frame buffer to emulator & kbd. -# -device wscons -attach wscons at wsconsdev -file arch/alpha/wscons/wscons.c wscons needs-flag -file arch/alpha/wscons/wscons_emul.c wscons - -file arch/alpha/wscons/event.c wscons -file arch/alpha/wscons/kbd.c wscons -file arch/alpha/wscons/ms.c wscons +file dev/wscons/wscons_rinit.c raster +file dev/wscons/wscons_rops.c raster # # TurboChannel Devices diff --git a/sys/arch/alpha/isa/isa_machdep.c b/sys/arch/alpha/isa/isa_machdep.c index cee497126c4..67813920ac6 100644 --- a/sys/arch/alpha/isa/isa_machdep.c +++ b/sys/arch/alpha/isa/isa_machdep.c @@ -43,7 +43,7 @@ #include "vga_isa.h" #if NVGA_ISA -#include <alpha/isa/vga_isavar.h> +#include <dev/isa/vga_isavar.h> #endif struct { diff --git a/sys/arch/alpha/isa/pckbd.c b/sys/arch/alpha/isa/pckbd.c index 2c335bf818c..8a6770235fb 100644 --- a/sys/arch/alpha/isa/pckbd.c +++ b/sys/arch/alpha/isa/pckbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pckbd.c,v 1.11 1997/07/08 11:19:41 niklas Exp $ */ +/* $OpenBSD: pckbd.c,v 1.12 1997/11/06 12:27:02 niklas Exp $ */ /* $NetBSD: pckbd.c,v 1.14 1996/12/05 01:39:30 cgd Exp $ */ /*- @@ -64,8 +64,8 @@ #include <machine/wsconsio.h> #include <alpha/isa/pcppivar.h> -#include <alpha/wscons/wsconsvar.h> -#include <alpha/wscons/kbd.h> +#include <dev/wscons/wsconsvar.h> +#include <dev/wscons/kbd.h> #include "wscons.h" #undef KBDATAP diff --git a/sys/arch/alpha/isa/pms.c b/sys/arch/alpha/isa/pms.c index a011a2a0022..3251fc71029 100644 --- a/sys/arch/alpha/isa/pms.c +++ b/sys/arch/alpha/isa/pms.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pms.c,v 1.5 1997/01/24 19:57:28 niklas Exp $ */ +/* $OpenBSD: pms.c,v 1.6 1997/11/06 12:27:03 niklas Exp $ */ /* $NetBSD: pms.c,v 1.7 1996/12/05 01:39:31 cgd Exp $ */ /*- @@ -48,8 +48,8 @@ #include <machine/intr.h> #include <dev/isa/isavar.h> -#include <alpha/wscons/wsconsvar.h> -#include <alpha/wscons/ms.h> +#include <dev/wscons/wsconsvar.h> +#include <dev/wscons/ms.h> #include <alpha/isa/pcppivar.h> #define PMS_DATA 0x0 /* offset for data port, read-write */ diff --git a/sys/arch/alpha/pci/pci_machdep.c b/sys/arch/alpha/pci/pci_machdep.c index e457fb3b7aa..64e71bfb838 100644 --- a/sys/arch/alpha/pci/pci_machdep.c +++ b/sys/arch/alpha/pci/pci_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.c,v 1.8 1997/04/19 21:51:29 tholo Exp $ */ +/* $OpenBSD: pci_machdep.c,v 1.9 1997/11/06 12:27:03 niklas Exp $ */ /* $NetBSD: pci_machdep.c,v 1.7 1996/11/19 04:57:32 cgd Exp $ */ /* @@ -47,7 +47,7 @@ #include "vga_pci.h" #if NVGA_PCI -#include <alpha/pci/vga_pcivar.h> +#include <dev/pci/vga_pcivar.h> #endif #include "tga.h" diff --git a/sys/arch/alpha/pci/tga.c b/sys/arch/alpha/pci/tga.c index dd27161a797..0185ce99ba9 100644 --- a/sys/arch/alpha/pci/tga.c +++ b/sys/arch/alpha/pci/tga.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tga.c,v 1.10 1997/07/31 13:40:02 kstailey Exp $ */ +/* $OpenBSD: tga.c,v 1.11 1997/11/06 12:27:04 niklas Exp $ */ /* $NetBSD: tga.c,v 1.13 1996/12/05 01:39:37 cgd Exp $ */ /* @@ -48,8 +48,8 @@ #include <alpha/pci/bt485reg.h> #include <dev/rcons/raster.h> -#include <alpha/wscons/wscons_raster.h> -#include <alpha/wscons/wsconsvar.h> +#include <dev/wscons/wscons_raster.h> +#include <dev/wscons/wsconsvar.h> #include <machine/fbio.h> #include <machine/autoconf.h> diff --git a/sys/arch/alpha/pci/tgavar.h b/sys/arch/alpha/pci/tgavar.h index 460f39a1799..71529d34750 100644 --- a/sys/arch/alpha/pci/tgavar.h +++ b/sys/arch/alpha/pci/tgavar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tgavar.h,v 1.6 1996/12/08 00:20:52 niklas Exp $ */ +/* $OpenBSD: tgavar.h,v 1.7 1997/11/06 12:27:04 niklas Exp $ */ /* $NetBSD: tgavar.h,v 1.6 1996/10/23 04:12:36 cgd Exp $ */ /* @@ -30,8 +30,8 @@ #include <machine/tgareg.h> #include <dev/rcons/raster.h> -#include <alpha/wscons/wsconsvar.h> -#include <alpha/wscons/wscons_raster.h> +#include <dev/wscons/wsconsvar.h> +#include <dev/wscons/wscons_raster.h> struct tga_devconfig; struct fbcmap; diff --git a/sys/arch/alpha/tc/cfb.c b/sys/arch/alpha/tc/cfb.c index 894d6e454ca..a59a77f225f 100644 --- a/sys/arch/alpha/tc/cfb.c +++ b/sys/arch/alpha/tc/cfb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cfb.c,v 1.8 1997/07/31 13:40:03 kstailey Exp $ */ +/* $OpenBSD: cfb.c,v 1.9 1997/11/06 12:27:05 niklas Exp $ */ /* $NetBSD: cfb.c,v 1.7 1996/12/05 01:39:39 cgd Exp $ */ /* @@ -48,8 +48,8 @@ #endif #include <dev/rcons/raster.h> -#include <alpha/wscons/wscons_raster.h> -#include <alpha/wscons/wsconsvar.h> +#include <dev/wscons/wscons_raster.h> +#include <dev/wscons/wsconsvar.h> #include <machine/fbio.h> #include <machine/autoconf.h> diff --git a/sys/arch/alpha/tc/cfbvar.h b/sys/arch/alpha/tc/cfbvar.h index 73a514ece37..6bb6217d0c6 100644 --- a/sys/arch/alpha/tc/cfbvar.h +++ b/sys/arch/alpha/tc/cfbvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cfbvar.h,v 1.3 1996/10/30 22:41:03 niklas Exp $ */ +/* $OpenBSD: cfbvar.h,v 1.4 1997/11/06 12:27:05 niklas Exp $ */ /* $NetBSD: cfbvar.h,v 1.1 1996/05/01 23:25:04 cgd Exp $ */ /* @@ -30,8 +30,8 @@ #include <machine/cfbreg.h> #include <dev/rcons/raster.h> -#include <alpha/wscons/wsconsvar.h> -#include <alpha/wscons/wscons_raster.h> +#include <dev/wscons/wsconsvar.h> +#include <dev/wscons/wscons_raster.h> struct cfb_devconfig; struct fbcmap; diff --git a/sys/arch/alpha/tc/sfb.c b/sys/arch/alpha/tc/sfb.c index 8e012398bbe..f251bed5890 100644 --- a/sys/arch/alpha/tc/sfb.c +++ b/sys/arch/alpha/tc/sfb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sfb.c,v 1.8 1997/07/31 13:40:03 kstailey Exp $ */ +/* $OpenBSD: sfb.c,v 1.9 1997/11/06 12:27:06 niklas Exp $ */ /* $NetBSD: sfb.c,v 1.7 1996/12/05 01:39:44 cgd Exp $ */ /* @@ -48,8 +48,8 @@ #endif #include <dev/rcons/raster.h> -#include <alpha/wscons/wscons_raster.h> -#include <alpha/wscons/wsconsvar.h> +#include <dev/wscons/wscons_raster.h> +#include <dev/wscons/wsconsvar.h> #include <machine/fbio.h> #include <machine/autoconf.h> diff --git a/sys/arch/alpha/tc/sfbvar.h b/sys/arch/alpha/tc/sfbvar.h index c1e46e511a2..3c228e65d46 100644 --- a/sys/arch/alpha/tc/sfbvar.h +++ b/sys/arch/alpha/tc/sfbvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sfbvar.h,v 1.3 1996/10/30 22:41:15 niklas Exp $ */ +/* $OpenBSD: sfbvar.h,v 1.4 1997/11/06 12:27:06 niklas Exp $ */ /* $NetBSD: sfbvar.h,v 1.1 1996/05/01 21:15:51 cgd Exp $ */ /* @@ -30,8 +30,8 @@ #include <machine/sfbreg.h> #include <dev/rcons/raster.h> -#include <alpha/wscons/wsconsvar.h> -#include <alpha/wscons/wscons_raster.h> +#include <dev/wscons/wsconsvar.h> +#include <dev/wscons/wscons_raster.h> struct sfb_devconfig; struct fbcmap; diff --git a/sys/arch/alpha/wscons/event.c b/sys/arch/alpha/wscons/event.c deleted file mode 100644 index 57874c90736..00000000000 --- a/sys/arch/alpha/wscons/event.c +++ /dev/null @@ -1,198 +0,0 @@ -/* $OpenBSD: event.c,v 1.3 1996/10/30 22:41:36 niklas Exp $ */ -/* $NetBSD: event.c,v 1.3 1996/09/15 17:15:26 cgd Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Lawrence Berkeley Laboratory. - * - * 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 by the University of - * California, Berkeley and its contributors. - * 4. 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. - * - * @(#)event.c 8.1 (Berkeley) 6/11/93 - */ - -/* - * Internal `Firm_event' interface for the keyboard and mouse drivers. - */ - -#include <sys/param.h> -#include <sys/fcntl.h> -#include <sys/malloc.h> -#include <sys/proc.h> -#include <sys/systm.h> -#include <sys/vnode.h> -#include <sys/select.h> -#ifdef notyet -#include <sys/poll.h> -#endif - -#include <machine/vuid_event.h> -#include <alpha/wscons/event_var.h> - -/* - * Initialize a firm_event queue. - */ -void -ev_init(ev) - register struct evvar *ev; -{ - - ev->ev_get = ev->ev_put = 0; - ev->ev_q = malloc((u_long)EV_QSIZE * sizeof(struct firm_event), - M_DEVBUF, M_WAITOK); - bzero((caddr_t)ev->ev_q, EV_QSIZE * sizeof(struct firm_event)); -} - -/* - * Tear down a firm_event queue. - */ -void -ev_fini(ev) - register struct evvar *ev; -{ - - free(ev->ev_q, M_DEVBUF); -} - -/* - * User-level interface: read, poll. - * (User cannot write an event queue.) - */ -int -ev_read(ev, uio, flags) - register struct evvar *ev; - struct uio *uio; - int flags; -{ - int s, n, cnt, error; - - /* - * Make sure we can return at least 1. - */ - if (uio->uio_resid < sizeof(struct firm_event)) - return (EMSGSIZE); /* ??? */ - s = splev(); - while (ev->ev_get == ev->ev_put) { - if (flags & IO_NDELAY) { - splx(s); - return (EWOULDBLOCK); - } - ev->ev_wanted = 1; - error = tsleep((caddr_t)ev, PEVENT | PCATCH, "firm_event", 0); - if (error) { - splx(s); - return (error); - } - } - /* - * Move firm_events from tail end of queue (there is at least one - * there). - */ - if (ev->ev_put < ev->ev_get) - cnt = EV_QSIZE - ev->ev_get; /* events in [get..QSIZE) */ - else - cnt = ev->ev_put - ev->ev_get; /* events in [get..put) */ - splx(s); - n = howmany(uio->uio_resid, sizeof(struct firm_event)); - if (cnt > n) - cnt = n; - error = uiomove((caddr_t)&ev->ev_q[ev->ev_get], - cnt * sizeof(struct firm_event), uio); - n -= cnt; - /* - * If we do not wrap to 0, used up all our space, or had an error, - * stop. Otherwise move from front of queue to put index, if there - * is anything there to move. - */ - if ((ev->ev_get = (ev->ev_get + cnt) % EV_QSIZE) != 0 || - n == 0 || error || (cnt = ev->ev_put) == 0) - return (error); - if (cnt > n) - cnt = n; - error = uiomove((caddr_t)&ev->ev_q[0], - cnt * sizeof(struct firm_event), uio); - ev->ev_get = cnt; - return (error); -} - -#ifdef notyet -int -ev_poll(ev, events, p) - register struct evvar *ev; - int events; - struct proc *p; -{ - int revents = 0; - int s = splev(); - - if (events & (POLLIN | POLLRDNORM)) - if (ev->ev_get != ev->ev_put) - revents |= events & (POLLIN | POLLRDNORM); - else - selrecord(p, &ev->ev_sel); - - splx(s); - return (revents); -} -#else -int -ev_select(ev, rw, p) - register struct evvar *ev; - int rw; - struct proc *p; -{ - int s = splev(); - - switch (rw) { - - case FREAD: - /* succeed if there is something to read */ - if (ev->ev_get != ev->ev_put) { - splx(s); - return (1); - } - selrecord(p, &ev->ev_sel); - break; - - case FWRITE: - splx(s); - return (1); /* always fails => never blocks */ - } - splx(s); - return (0); -} -#endif diff --git a/sys/arch/alpha/wscons/kbd.c b/sys/arch/alpha/wscons/kbd.c deleted file mode 100644 index 05e43d07eea..00000000000 --- a/sys/arch/alpha/wscons/kbd.c +++ /dev/null @@ -1,344 +0,0 @@ -/* $OpenBSD: kbd.c,v 1.4 1997/01/24 19:58:25 niklas Exp $ */ -/* $NetBSD: kbd.c,v 1.3 1996/11/13 21:13:39 cgd Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Lawrence Berkeley Laboratory. - * - * 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 by the University of - * California, Berkeley and its contributors. - * 4. 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. - * - * @(#)kbd.c 8.2 (Berkeley) 10/30/93 - */ - -/* - * Keyboard driver (/dev/kbd -- note that we do not have minor numbers - * [yet?]). Translates incoming bytes to ASCII or to `firm_events' and - * passes them up to the appropriate reader. - */ - -#include <sys/param.h> -#include <sys/conf.h> -#include <sys/device.h> -#include <sys/ioctl.h> -#include <sys/kernel.h> -#include <sys/proc.h> -#include <sys/signalvar.h> -#include <sys/syslog.h> -#include <sys/systm.h> -#include <sys/tty.h> -#include <sys/signalvar.h> - -#include <machine/autoconf.h> - -#include <machine/vuid_event.h> -#include <machine/kbio.h> /* XXX FOR KIOCSDIRECT */ -#include <machine/wsconsio.h> /* XXX for bell ioctls */ -#include <alpha/wscons/event_var.h> -#include <alpha/wscons/wsconsvar.h> -#include <alpha/wscons/kbd.h> - -void kbd_repeat __P((void *)); - -struct kbd_softc { - struct device *k_idev; /* the input device */ - struct wscons_idev_spec k_ispec; /* the input device information */ - - int k_evmode; /* set if we should produce events */ - struct evvar k_events; /* event queue state */ - char *k_repeatcp; /* repeated character (string) */ - int k_repeating; /* we've called timeout() */ - int k_repeat_start; /* how long (ms) until repeat */ - int k_repeat_step; /* how long (ms) until more repeats */ - - struct wsconsio_bell_data k_belldata; -} kbd_softc; - -void -kbdattach(idev, ispec) - struct device *idev; - struct wscons_idev_spec *ispec; -{ - register struct kbd_softc *k = &kbd_softc; - - /* - * It would be nice if the repeat rates were in ticks. - * However, if they were, we couldn't set them here, as - * hz might not be set up yet! - */ - k->k_repeat_start = 200; - k->k_repeat_step = 50; - - k->k_belldata.wbd_pitch = 1500; /* 1500 Hz */ - k->k_belldata.wbd_period = 100; /* 100 ms */ - k->k_belldata.wbd_volume = 50; /* 50% volume */ - - k->k_idev = idev; - k->k_ispec = *ispec; -} - -void -kbd_repeat(void *arg) -{ - struct kbd_softc *k = (struct kbd_softc *)arg; - int s = spltty(); - - if (k->k_repeating && k->k_repeatcp != NULL) { - wscons_input(k->k_repeatcp); - timeout(kbd_repeat, k, (hz * k->k_repeat_step) / 1000); - } - splx(s); -} - -void -kbd_input(register int c) -{ - register struct kbd_softc *k = &kbd_softc; - register struct firm_event *fe; - register int put; - char *cp; - - if (k->k_repeating) { - k->k_repeating = 0; - untimeout(kbd_repeat, k); - } - - /* - * If /dev/kbd is not connected in event mode translate and - * send upstream. - */ - if (!k->k_evmode) { - cp = (*k->k_ispec.wi_translate)(k->k_idev, c); - if (cp != NULL) { - wscons_input(cp); - k->k_repeating = 1; - k->k_repeatcp = cp; - timeout(kbd_repeat, k, (hz * k->k_repeat_start) / 1000); - } - return; - } - - /* - * Keyboard is generating events. Turn this keystroke into an - * event and put it in the queue. If the queue is full, the - * keystroke is lost (sorry!). - */ - put = k->k_events.ev_put; - fe = &k->k_events.ev_q[put]; - put = (put + 1) % EV_QSIZE; - if (put == k->k_events.ev_get) { - log(LOG_WARNING, "keyboard event queue overflow\n"); /* ??? */ - return; - } - fe->id = c & k->k_ispec.wi_keymask; - fe->value = (c & k->k_ispec.wi_keyupmask) != 0 ? VKEY_UP : VKEY_DOWN; - microtime(&fe->time); - k->k_events.ev_put = put; - EV_WAKEUP(&k->k_events); -} - -int -kbdopen(dev_t dev, int flags, int mode, struct proc *p) -{ - if (kbd_softc.k_events.ev_io) - return (EBUSY); - kbd_softc.k_events.ev_io = p; - ev_init(&kbd_softc.k_events); - kbd_softc.k_evmode = 1; - return (0); -} - -int -kbdclose(dev_t dev, int flags, int mode, struct proc *p) -{ - - /* - * Turn off event mode, dump the queue, and close the keyboard - * unless it is supplying console input. - */ - kbd_softc.k_evmode = 0; - ev_fini(&kbd_softc.k_events); - kbd_softc.k_events.ev_io = NULL; - return (0); -} - -int -kbdread(dev_t dev, struct uio *uio, int flags) -{ - - return (ev_read(&kbd_softc.k_events, uio, flags)); -} - -/* this routine should not exist, but is convenient to write here for now */ -int -kbdwrite(dev_t dev, struct uio *uio, int flags) -{ - - return (EOPNOTSUPP); -} - -int -kbdioctl(dev_t dev, u_long cmd, register caddr_t data, int flag, struct proc *p) -{ - struct kbd_softc *k = &kbd_softc; - struct wsconsio_bell_data *wbd; - int rv; - - rv = ENOTTY; - switch (cmd) { -#if 0 - case KIOCSDIRECT: - k->k_evmode = *(int *)data; - return (0); -#endif - - case FIONBIO: /* we will remove this someday (soon???) */ - return (0); - - case FIOASYNC: - k->k_events.ev_async = *(int *)data != 0; - return (0); - - case TIOCSPGRP: - if (*(int *)data != k->k_events.ev_io->p_pgid) - return (EPERM); - return (0); - - case WSCONSIO_BELL: - if (k->k_ispec.wi_bell != NULL) - (*k->k_ispec.wi_bell)(k->k_idev, &k->k_belldata); - return (0); - - case WSCONSIO_COMPLEXBELL: - if (k->k_ispec.wi_bell != NULL) { - wbd = (struct wsconsio_bell_data *)data; - if ((wbd->wbd_flags & WSCONSIO_BELLDATA_PITCH) == 0) - wbd->wbd_pitch = k->k_belldata.wbd_pitch; - if ((wbd->wbd_flags & WSCONSIO_BELLDATA_PERIOD) == 0) - wbd->wbd_period = k->k_belldata.wbd_period; - if ((wbd->wbd_flags & WSCONSIO_BELLDATA_VOLUME) == 0) - wbd->wbd_volume = k->k_belldata.wbd_volume; - - (*k->k_ispec.wi_bell)(k->k_idev, wbd); - } - return (0); - - case WSCONSIO_SETBELL: - wbd = (struct wsconsio_bell_data *)data; - if ((wbd->wbd_flags & WSCONSIO_BELLDATA_PITCH) != 0) - k->k_belldata.wbd_pitch = wbd->wbd_pitch; - if ((wbd->wbd_flags & WSCONSIO_BELLDATA_PERIOD) != 0) - k->k_belldata.wbd_period = wbd->wbd_period; - if ((wbd->wbd_flags & WSCONSIO_BELLDATA_VOLUME) != 0) - k->k_belldata.wbd_volume = wbd->wbd_volume; - return (0); - - case WSCONSIO_GETBELL: - wbd = (struct wsconsio_bell_data *)data; - wbd->wbd_flags = WSCONSIO_BELLDATA_PITCH | - WSCONSIO_BELLDATA_PERIOD | WSCONSIO_BELLDATA_VOLUME; - wbd->wbd_pitch = k->k_belldata.wbd_pitch; - wbd->wbd_period = k->k_belldata.wbd_period; - wbd->wbd_volume = k->k_belldata.wbd_volume ; - return (0); - -#if 0 /* XXX */ - /* XXX KEY-REPEAT RATE SETTING */ -#endif /* XXX */ - - default: - if (k->k_ispec.wi_ioctl != NULL) - rv = (*k->k_ispec.wi_ioctl)(k->k_idev, cmd, data, - flag, p); - } - return (rv); -} - -#ifdef notyet -int -kbdpoll(dev_t dev, int events, struct proc *p) -{ - return (ev_poll(&kbd_softc.k_events, events, p)); -} -#else -int -kbdselect(dev_t dev, int rw, struct proc *p) -{ - return (ev_select(&kbd_softc.k_events, rw, p)); -} -#endif - -/* Ring the console bell. (For wscons terminal emulator and other code) */ -void -wscons_kbd_bell() -{ - struct kbd_softc *k = &kbd_softc; - - if (k->k_ispec.wi_bell != NULL) - (*k->k_ispec.wi_bell)(k->k_idev, &k->k_belldata); -} - -/* - * Console handling functions. - */ - -int -kbd_cngetc(dev) - dev_t dev; -{ - struct kbd_softc *k = &kbd_softc; - - if (kbd_softc.k_evmode) /* XXX? */ - return 0; - if (k->k_ispec.wi_getc != NULL) - return (*k->k_ispec.wi_getc)(k->k_idev); - else - return 0; -} - -void -kbd_cnpollc(dev, on) - dev_t dev; - int on; -{ - struct kbd_softc *k = &kbd_softc; - - if (kbd_softc.k_evmode) /* XXX? */ - return; - if (k->k_ispec.wi_pollc != NULL) - (*k->k_ispec.wi_pollc)(k->k_idev, on); -} diff --git a/sys/arch/alpha/wscons/ms.c b/sys/arch/alpha/wscons/ms.c deleted file mode 100644 index 76a72d67721..00000000000 --- a/sys/arch/alpha/wscons/ms.c +++ /dev/null @@ -1,296 +0,0 @@ -/* $OpenBSD: ms.c,v 1.4 1997/01/24 19:58:27 niklas Exp $ */ -/* $NetBSD: ms.c,v 1.3 1996/11/13 21:13:40 cgd Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Lawrence Berkeley Laboratory. - * - * 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 by the University of - * California, Berkeley and its contributors. - * 4. 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. - * - * @(#)ms.c 8.1 (Berkeley) 6/11/93 - */ - -/* - * Mouse driver. - */ - -#include <sys/param.h> -#include <sys/conf.h> -#include <sys/ioctl.h> -#include <sys/kernel.h> -#include <sys/proc.h> -#include <sys/signalvar.h> -#include <sys/syslog.h> -#include <sys/systm.h> -#include <sys/tty.h> - -#include <machine/vuid_event.h> -#include <alpha/wscons/event_var.h> -#include <alpha/wscons/wsconsvar.h> -#include <alpha/wscons/ms.h> - -struct ms_softc { - struct device *ms_dev; - struct wscons_mdev_spec ms_spec; - char ms_mb; /* mouse button state */ - char ms_ub; /* user button state */ - int ms_dx; /* delta-x */ - int ms_dy; /* delta-y */ - volatile int ms_ready; /* event queue is ready */ - struct evvar ms_events; /* event queue state */ -} ms_softc; - -void -msattach(mdev, mspec) - struct device *mdev; - struct wscons_mdev_spec *mspec; -{ - register struct ms_softc *m = &ms_softc; - - m->ms_dev = mdev; - m->ms_spec = *mspec; -} - -void -ms_event(buttons, dx, dy) - char buttons; /* 0 is up */ - int dx, dy; -{ - register struct firm_event *fe; - register struct ms_softc *ms = &ms_softc; - register int mb, ub, d, get, put, any; - static const char to_one[] = { 1, 2, 2, 4, 4, 4, 4 }; - static const int to_id[] = { MS_RIGHT, MS_MIDDLE, 0, MS_LEFT }; - - /* - * Discard input if not ready. - */ - if (ms->ms_ready == 0) - return; - - ms->ms_mb = (buttons) & 0x7; - ms->ms_dx += dx; - ms->ms_dy += dy; - - /* - * We have at least one event (mouse button, delta-X, or - * delta-Y; possibly all three, and possibly three separate - * button events). Deliver these events until we are out - * of changes or out of room. As events get delivered, - * mark them `unchanged'. - */ - any = 0; - get = ms->ms_events.ev_get; - put = ms->ms_events.ev_put; - fe = &ms->ms_events.ev_q[put]; - - /* NEXT prepares to put the next event, backing off if necessary */ -#define NEXT \ - if ((++put) % EV_QSIZE == get) { \ - put--; \ - goto out; \ - } - /* ADVANCE completes the `put' of the event */ -#define ADVANCE \ - fe++; \ - if (put >= EV_QSIZE) { \ - put = 0; \ - fe = &ms->ms_events.ev_q[0]; \ - } \ - any = 1 - - mb = ms->ms_mb; - ub = ms->ms_ub; - while ((d = mb ^ ub) != 0) { - /* - * Mouse button change. Convert up to three changes - * to the `first' change, and drop it into the event queue. - */ - NEXT; - d = to_one[d - 1]; /* from 1..7 to {1,2,4} */ - fe->id = to_id[d - 1]; /* from {1,2,4} to ID */ - fe->value = mb & d ? VKEY_DOWN : VKEY_UP; - fe->time = time; - ADVANCE; - ub ^= d; - } - if (ms->ms_dx) { - NEXT; - fe->id = LOC_X_DELTA; - fe->value = ms->ms_dx; - fe->time = time; - ADVANCE; - ms->ms_dx = 0; - } - if (ms->ms_dy) { - NEXT; - fe->id = LOC_Y_DELTA; - fe->value = ms->ms_dy; - fe->time = time; - ADVANCE; - ms->ms_dy = 0; - } -out: - if (any) { - ms->ms_ub = ub; - ms->ms_events.ev_put = put; - EV_WAKEUP(&ms->ms_events); - } -} - -int -msopen(dev, flags, mode, p) - dev_t dev; - int flags, mode; - struct proc *p; -{ - int error; - - if (ms_softc.ms_dev == NULL) /* never attached! */ - return (ENXIO); - - if (ms_softc.ms_events.ev_io) - return (EBUSY); - - ms_softc.ms_events.ev_io = p; - ev_init(&ms_softc.ms_events); /* may cause sleep */ - - ms_softc.ms_ready = 1; /* start accepting events */ - - error = (*ms_softc.ms_spec.wm_enable)(ms_softc.ms_dev); - - if (error) { - ms_softc.ms_ready = 0; /* stop accepting events */ - ev_fini(&ms_softc.ms_events); - ms_softc.ms_events.ev_io = NULL; - return (error); - } - - return (0); -} - -int -msclose(dev, flags, mode, p) - dev_t dev; - int flags, mode; - struct proc *p; -{ - - (*ms_softc.ms_spec.wm_disable)(ms_softc.ms_dev); - - ms_softc.ms_ready = 0; /* stop accepting events */ - ev_fini(&ms_softc.ms_events); - ms_softc.ms_events.ev_io = NULL; - return (0); -} - -int -msread(dev, uio, flags) - dev_t dev; - struct uio *uio; - int flags; -{ - - return (ev_read(&ms_softc.ms_events, uio, flags)); -} - -/* this routine should not exist, but is convenient to write here for now */ -int -mswrite(dev, uio, flags) - dev_t dev; - struct uio *uio; - int flags; -{ - - return (EOPNOTSUPP); -} - -int -msioctl(dev, cmd, data, flag, p) - dev_t dev; - u_long cmd; - register caddr_t data; - int flag; - struct proc *p; -{ - switch (cmd) { - - case FIONBIO: /* we will remove this someday (soon???) */ - return (0); - - case FIOASYNC: - ms_softc.ms_events.ev_async = *(int *)data != 0; - return (0); - - case TIOCSPGRP: - if (*(int *)data != ms_softc.ms_events.ev_io->p_pgid) - return (EPERM); - return (0); - - case VUIDGFORMAT: - /* we only do firm_events */ - *(int *)data = VUID_FIRM_EVENT; - return (0); - - case VUIDSFORMAT: - if (*(int *)data != VUID_FIRM_EVENT) - return (EINVAL); - return (0); - } - return (ENOTTY); -} - -#ifdef notyet -int -mspoll(dev, events, p) - dev_t dev; - int events; - struct proc *p; -{ - return (ev_poll(&ms_softc.ms_events, events, p)); -} -#else -int -msselect(dev, rw, p) - dev_t dev; - int rw; - struct proc *p; -{ - return (ev_select(&ms_softc.ms_events, rw, p)); -} -#endif diff --git a/sys/arch/alpha/wscons/wscons.c b/sys/arch/alpha/wscons/wscons.c deleted file mode 100644 index 1a2b203c54a..00000000000 --- a/sys/arch/alpha/wscons/wscons.c +++ /dev/null @@ -1,514 +0,0 @@ -/* $OpenBSD: wscons.c,v 1.5 1997/08/22 22:25:11 deraadt Exp $ */ -/* $NetBSD: wscons.c,v 1.10 1996/12/05 01:39:47 cgd Exp $ */ - -/* - * Copyright (c) 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#include <sys/param.h> -#include <sys/device.h> -#include <sys/kernel.h> -#include <sys/conf.h> -#include <sys/systm.h> -#include <sys/malloc.h> -#include <sys/ioctl.h> -#include <sys/proc.h> -#include <sys/tty.h> -#include <sys/termios.h> - -#include <dev/cons.h> -#include <alpha/wscons/wsconsvar.h> -#include <alpha/wscons/wscons_emul.h> -#include <alpha/wscons/kbd.h> -#include <machine/wsconsio.h> - -cdev_decl(wscons); - -/* Macros to clear/set/test flags. */ -#define SET(t, f) (t) |= (f) -#define CLR(t, f) (t) &= ~(f) -#define ISSET(t, f) ((t) & (f)) - -/* - * Autoconfiguration glue. - */ -struct wscons_softc { - struct device sc_dev; - - struct wscons_emul_data *sc_emul_data; - struct tty *sc_tty; - - void *sc_fn_cookie; - wscons_ioctl_t sc_ioctl; - wscons_mmap_t sc_mmap; -}; - -#ifdef __BROKEN_INDIRECT_CONFIG -int wsconsmatch __P((struct device *, void *, void *)); -#else -int wsconsmatch __P((struct device *, struct cfdata *, void *)); -#endif -void wsconsattach __P((struct device *, struct device *, void *)); - -struct cfattach wscons_ca = { - sizeof (struct wscons_softc), wsconsmatch, wsconsattach, -}; - -struct cfdriver wscons_cd = { - NULL, "wscons", DV_TTY, -}; - -/* - * Console handing functions and variables. - */ -int wscons_console_attached; /* polled console fns attached */ -int wscons_console_unit = -1; -struct wscons_emul_data wscons_console_emul_data; - -int wscons_cngetc __P((dev_t)); -void wscons_cnputc __P((dev_t, int)); -void wscons_cnpollc __P((dev_t, int)); - -struct consdev wscons_consdev = - { NULL, NULL, wscons_cngetc, wscons_cnputc, wscons_cnpollc, NODEV, 1 }; - -/* - * Input focus handling: where characters from the keyboard are sent. - */ -int wscons_input_focus = -1; - -/* - * TTY interface helpers. - */ - -#define WSCUNIT(dev) minor(dev) - -void wsconsstart __P((struct tty *)); -int wsconsparam __P((struct tty *, struct termios *)); - - -/* - * Output device selection and attachment. - */ - -int -#ifdef __BROKEN_INDIRECT_CONFIG -wsconsmatch(parent, cfdata, aux) -#else -wsconsmatch(parent, cf, aux) -#endif - struct device *parent; -#ifdef __BROKEN_INDIRECT_CONFIG - void *cfdata; -#else - struct cfdata *cf; -#endif - void *aux; -{ - struct wscons_attach_args *waa = aux; -#ifdef __BROKEN_INDIRECT_CONFIG - struct cfdata *cf = cfdata; -#endif - - if (waa->waa_isconsole && wscons_console_unit != -1) - panic("wsconsmatch: multiple consoles?"); - - /* If console-ness specified... */ - if (cf->wsconscf_console != -1) { - /* - * If exact match, return match with high priority, - * else return don't match. - */ - if ((cf->wsconscf_console && waa->waa_isconsole) || - (!cf->wsconscf_console && !waa->waa_isconsole)) - return (10); - else - return (0); - } - - /* Otherwise match with low priority. */ - return (1); -} - -void -wsconsattach(parent, self, aux) - struct device *parent, *self; - void *aux; -{ - struct wscons_attach_args *waa = aux; - struct wscons_softc *sc = (struct wscons_softc *)self; - int console; - - console = waa->waa_isconsole; - if (console) - printf(": console"); - - /* - * If output has already been set up, record it now. Otherwise, - * do the setup. - */ - if (console) { - sc->sc_emul_data = &wscons_console_emul_data; - wscons_console_unit = sc->sc_dev.dv_unit; - wscons_consdev.cn_dev = - makedev(25, wscons_console_unit); /* XXX */ - } else { - sc->sc_emul_data = malloc(sizeof(*sc->sc_emul_data), M_DEVBUF, - M_WAITOK); - wscons_emul_attach(sc->sc_emul_data, &waa->waa_odev_spec); - } - - /* - * Set wscons input focus if this is the console device, - * or if we've not yet set the input focus. - */ - if (console || wscons_input_focus == -1) - wscons_input_focus = sc->sc_dev.dv_unit; - - /* - * Set up the device's tty structure. - */ - sc->sc_tty = ttymalloc(); - tty_attach(sc->sc_tty); - - /* - * Record other relevant information: ioctl and mmap functions. - */ - sc->sc_fn_cookie = waa->waa_odev_spec.wo_miscfuncs_cookie; - sc->sc_ioctl = waa->waa_odev_spec.wo_ioctl; - sc->sc_mmap = waa->waa_odev_spec.wo_mmap; - - printf("\n"); -} - - -/* - * Keyboard input handling. - */ - -void -wscons_input(cp) - char *cp; -{ - struct wscons_softc *sc; - struct tty *tp; - - if (wscons_input_focus == -1) - return; - -#ifdef DIAGNOSTIC - if (wscons_input_focus >= wscons_cd.cd_ndevs) - panic("wscons_input: bogus input focus"); - sc = wscons_cd.cd_devs[wscons_input_focus]; - if (sc == NULL) - panic("wscons_input: null input device"); - tp = sc->sc_tty; - if (tp == NULL) - panic("wscons_input: no tty"); -#else - sc = wscons_cd.cd_devs[wscons_input_focus]; - tp = sc->sc_tty; -#endif - - while (*cp) - (*linesw[tp->t_line].l_rint)(*cp++, tp); -} - - -/* - * Console (output) tty-handling functions. - */ - -int -wsconsopen(dev, flag, mode, p) - dev_t dev; - int flag, mode; - struct proc *p; -{ - struct wscons_softc *sc; - int unit = WSCUNIT(dev), newopen, rv; - struct tty *tp; - - if (unit >= wscons_cd.cd_ndevs) - return ENXIO; - sc = wscons_cd.cd_devs[unit]; - if (sc == NULL) - return ENXIO; - -#ifdef DIAGNOSTIC - if (!sc->sc_tty) - panic("wscopen: no tty!"); -#endif - tp = sc->sc_tty; - - tp->t_oproc = wsconsstart; - tp->t_param = wsconsparam; - tp->t_dev = dev; - newopen = (tp->t_state & TS_ISOPEN) == 0; - if (newopen) { - 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; - wsconsparam(tp, &tp->t_termios); - ttsetwater(tp); - } else if ((tp->t_state & TS_XCLUDE) != 0 && p->p_ucred->cr_uid != 0) - return EBUSY; - tp->t_state |= TS_CARR_ON; - - rv = ((*linesw[tp->t_line].l_open)(dev, tp)); - if (newopen && (rv == 0)) { - /* set window sizes to be correct */ - tp->t_winsize.ws_row = sc->sc_emul_data->ac_nrow; - tp->t_winsize.ws_col = sc->sc_emul_data->ac_ncol; - } - return (rv); -} - -int -wsconsclose(dev, flag, mode, p) - dev_t dev; - int flag, mode; - struct proc *p; -{ - struct wscons_softc *sc = wscons_cd.cd_devs[WSCUNIT(dev)]; - struct tty *tp = sc->sc_tty; - - (*linesw[tp->t_line].l_close)(tp, flag); - ttyclose(tp); - return(0); -} - -int -wsconsread(dev, uio, flag) - dev_t dev; - struct uio *uio; - int flag; -{ - struct wscons_softc *sc = wscons_cd.cd_devs[WSCUNIT(dev)]; - struct tty *tp = sc->sc_tty; - - return ((*linesw[tp->t_line].l_read)(tp, uio, flag)); -} - -int -wsconswrite(dev, uio, flag) - dev_t dev; - struct uio *uio; - int flag; -{ - struct wscons_softc *sc = wscons_cd.cd_devs[WSCUNIT(dev)]; - struct tty *tp = sc->sc_tty; - - return ((*linesw[tp->t_line].l_write)(tp, uio, flag)); -} - -struct tty * -wsconstty(dev) - dev_t dev; -{ - struct wscons_softc *sc = wscons_cd.cd_devs[WSCUNIT(dev)]; - struct tty *tp = sc->sc_tty; - - return (tp); -} - -int -wsconsioctl(dev, cmd, data, flag, p) - dev_t dev; - u_long cmd; - caddr_t data; - int flag; - struct proc *p; -{ - struct wscons_softc *sc = wscons_cd.cd_devs[WSCUNIT(dev)]; - struct tty *tp = sc->sc_tty; - int error; - - /* do the line discipline ioctls first */ - error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p); - if (error >= 0) - return error; - - /* then the tty ioctls */ - error = ttioctl(tp, cmd, data, flag, p); - if (error >= 0) - return error; - - /* then the underlying frame buffer device ioctls */ - if (sc->sc_ioctl != NULL) - error = (*sc->sc_ioctl)(sc->sc_fn_cookie, cmd, data, - flag, p); - if (error >= 0) - return error; - - /* - * then the keyboard ioctls, if we have input focus. - * This is done last because it's a special case: it will - * return ENOTTY (not -1) if it can't figure out what - * to do with the request. - */ - if (WSCUNIT(dev) == wscons_input_focus) - error = kbdioctl(0, cmd, data, flag, p); /* XXX dev */ - else - error = ENOTTY; - - return (error); -} - -int -wsconsmmap(dev, offset, prot) - dev_t dev; - int offset; /* XXX */ - int prot; -{ - struct wscons_softc *sc = wscons_cd.cd_devs[WSCUNIT(dev)]; - - if (sc->sc_mmap != NULL) - return (*sc->sc_mmap)(sc->sc_dev.dv_parent, offset, prot); - else - return -1; -} - -void -wsconsstart(tp) - register struct tty *tp; -{ - struct wscons_softc *sc; - register int s, n, i; - char buf[OBUFSIZ]; - - s = spltty(); - if (tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP)) { - splx(s); - return; - } - tp->t_state |= TS_BUSY; - splx(s); - - n = q_to_b(&tp->t_outq, buf, sizeof(buf)); - for (i = 0; i < n; ++i) - buf[i] &= 0177; /* strip parity (argh) */ - - sc = wscons_cd.cd_devs[WSCUNIT(tp->t_dev)]; - wscons_emul_input(sc->sc_emul_data, buf, n); - - s = spltty(); - tp->t_state &= ~TS_BUSY; - /* Come back if there's more to do */ - if (tp->t_outq.c_cc) { - tp->t_state |= TS_TIMEOUT; - timeout(ttrstrt, tp, 1); - } - 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); - } - splx(s); -} - -int -wsconsstop(tp, flag) - struct tty *tp; - int flag; -{ - int s; - - /* XXX ??? */ - s = spltty(); - if (ISSET(tp->t_state, TS_BUSY)) - if (!ISSET(tp->t_state, TS_TTSTOP)) - SET(tp->t_state, TS_FLUSH); - splx(s); - return 0; -} - -/* - * Set line parameters. - */ -int -wsconsparam(tp, t) - struct tty *tp; - struct termios *t; -{ - - tp->t_ispeed = t->c_ispeed; - tp->t_ospeed = t->c_ospeed; - tp->t_cflag = t->c_cflag; - return 0; -} - - -/* - * Polled-console handing setup and manipulation. - */ - -void -wscons_attach_console(wo) - const struct wscons_odev_spec *wo; -{ - - if (wscons_console_attached) - panic("wscons_attach_console: multiple times"); - - wscons_emul_attach(&wscons_console_emul_data, wo); - cn_tab = &wscons_consdev; - wscons_console_attached = 1; -} - -void -wscons_cnputc(dev, ic) - dev_t dev; - int ic; -{ - char c = ic; - - if (wscons_console_attached) - wscons_emul_input(&wscons_console_emul_data, &c, 1); -} - -int -wscons_cngetc(dev) - dev_t dev; -{ - - return kbd_cngetc(dev); /* XXX XXX */ -} - -void -wscons_cnpollc(dev, i) - dev_t dev; - int i; -{ - - kbd_cnpollc(dev, i); /* XXX XXX */ -} diff --git a/sys/arch/alpha/wscons/wscons_emul.c b/sys/arch/alpha/wscons/wscons_emul.c deleted file mode 100644 index 3b472714570..00000000000 --- a/sys/arch/alpha/wscons/wscons_emul.c +++ /dev/null @@ -1,450 +0,0 @@ -/* $OpenBSD: wscons_emul.c,v 1.11 1997/07/31 13:40:04 kstailey Exp $ */ -/* $NetBSD: wscons_emul.c,v 1.7 1996/11/19 05:23:13 cgd Exp $ */ - -/* - * Copyright (c) 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -/* - * Console emulator for a 'generic' ANSI X3.64 console. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/conf.h> -#include <alpha/wscons/wsconsvar.h> -#include <alpha/wscons/wscons_emul.h> -#include <alpha/wscons/kbd.h> -#include <alpha/wscons/ascii.h> - -static __inline int wscons_emul_input_normal - __P((struct wscons_emul_data *, char)); -static __inline int wscons_emul_input_haveesc - __P((struct wscons_emul_data *, char)); -static __inline void wscons_emul_docontrol - __P((struct wscons_emul_data *, char)); -static __inline int wscons_emul_input_control - __P((struct wscons_emul_data *, char)); - -static int wscons_emul_input_normal __P((struct wscons_emul_data *, char)); -static int wscons_emul_input_haveesc __P((struct wscons_emul_data *, char)); -static void wscons_emul_docontrol __P((struct wscons_emul_data *, char)); -static int wscons_emul_input_control __P((struct wscons_emul_data *, char)); - -void -wscons_emul_attach(we, wo) - struct wscons_emul_data *we; - const struct wscons_odev_spec *wo; -{ - int i; - -#ifdef DIAGNOSTIC - if (we == NULL || wo == NULL) - panic("wscons_emul_attach: bogus args"); - if (wo->wo_emulfuncs == NULL) - panic("wscons_emul_attach: bogus emul functions"); -#endif - if (wo->wo_nrows <= 0 || wo->wo_ncols <= 0) - panic("wscons_emul_attach: bogus size (%d/%d)", - wo->wo_nrows, wo->wo_ncols); - if (wo->wo_crow < 0 || wo->wo_ccol < 0 || - wo->wo_crow >= wo->wo_nrows || wo->wo_ccol >= wo->wo_ncols) - panic("wscons_emul_attach: bogus location (n: %d/%d, c: %d/%d", - wo->wo_nrows, wo->wo_ncols, wo->wo_crow, wo->wo_ccol); - - we->ac_state = ANSICONS_STATE_NORMAL; - we->ac_ef = wo->wo_emulfuncs; - we->ac_efa = wo->wo_emulfuncs_cookie; - - we->ac_nrow = wo->wo_nrows; - we->ac_ncol = wo->wo_ncols; - - we->ac_crow = wo->wo_crow; - we->ac_ccol = wo->wo_ccol; - - for (i = 0; i < ANSICONS_NARGS; i++) - we->ac_args[i] = 0; - - (*we->ac_ef->wef_cursor)(we->ac_efa, 1, we->ac_crow, we->ac_ccol); -} - -static __inline int -wscons_emul_input_normal(we, c) - struct wscons_emul_data *we; - char c; -{ - int newstate = ANSICONS_STATE_NORMAL; - int n; - - switch (c) { - case ASCII_BEL: - wscons_kbd_bell(); - break; - - case ASCII_BS: - if (we->ac_ccol > 0) - we->ac_ccol--; - break; - - case ASCII_HT: - n = 8 - (we->ac_ccol & 7); - if (we->ac_ccol + n >= we->ac_ncol) - n = we->ac_ncol - we->ac_ccol - 1; - - (*we->ac_ef->wef_erasecols)(we->ac_efa, we->ac_crow, - we->ac_ccol, we->ac_ccol + n); - - we->ac_ccol += n; - break; - - case ASCII_LF: - if (we->ac_crow < we->ac_nrow - 1) { - we->ac_crow++; - break; - } - -#ifdef DIAGNOSTIC - if (we->ac_crow >= we->ac_nrow) - panic("wscons_emul: didn't scroll (1)"); -#endif - (*we->ac_ef->wef_copyrows)(we->ac_efa, JUMPSCROLL, 0, - we->ac_nrow - JUMPSCROLL); - (*we->ac_ef->wef_eraserows)(we->ac_efa, - we->ac_nrow - JUMPSCROLL, JUMPSCROLL); - we->ac_crow -= JUMPSCROLL - 1; - break; - - case ASCII_VT: - if (we->ac_crow > 0) - we->ac_crow--; - break; - - case ASCII_NP: - (*we->ac_ef->wef_eraserows)(we->ac_efa, 0, we->ac_nrow); - we->ac_ccol = 0; - we->ac_crow = 0; - break; - - case ASCII_CR: - we->ac_ccol = 0; - break; - - case ASCII_ESC: - if (we->ac_state == ANSICONS_STATE_NORMAL) { - newstate = ANSICONS_STATE_HAVEESC; - break; - } - /* else fall through; we're printing one out */ - - default: - if (c == '\0') - break; - (*we->ac_ef->wef_putstr)(we->ac_efa, - we->ac_crow, we->ac_ccol, &c, 1); - we->ac_ccol++; - - /* if the current column is still on the current line, done. */ - if (we->ac_ccol < we->ac_ncol) - break; - - /* wrap the column around. */ - we->ac_ccol = 0; - - /* if the current row isn't the last, increment and leave. */ - if (we->ac_crow < we->ac_nrow - 1) { - we->ac_crow++; - break; - } - -#ifdef DIAGNOSTIC - /* check against row overflow */ - if (we->ac_crow >= we->ac_nrow) - panic("wscons_emul: didn't scroll (2)"); -#endif - - (*we->ac_ef->wef_copyrows)(we->ac_efa, JUMPSCROLL, 0, - we->ac_nrow - JUMPSCROLL); - (*we->ac_ef->wef_eraserows)(we->ac_efa, - we->ac_nrow - JUMPSCROLL, JUMPSCROLL); - we->ac_crow -= JUMPSCROLL - 1; - break; - } - - return newstate; -} - -static __inline int -wscons_emul_input_haveesc(we, c) - struct wscons_emul_data *we; - char c; -{ - int newstate = ANSICONS_STATE_NORMAL; - int i; - - switch (c) { - case '[': - for (i = 0; i < ANSICONS_NARGS; i++) - we->ac_args[i] = 0; - newstate = ANSICONS_STATE_CONTROL; - break; - - default: - wscons_emul_input_normal(we, ASCII_ESC); /* special cased */ - newstate = wscons_emul_input_normal(we, c); - break; - } - - return newstate; -} - -static __inline void -wscons_emul_docontrol(we, c) - struct wscons_emul_data *we; - char c; -{ - int n, m; - -#if 0 - printf("control: %c: %d, %d\n", c, we->ac_args[0], we->ac_args[1]); -#endif - switch (c) { - case 'A': /* Cursor Up */ - n = we->ac_args[0] ? we->ac_args[0] : 1; - n = min(n, we->ac_crow); - we->ac_crow -= n; - break; - - case 'B': /* Cursor Down */ - n = we->ac_args[0] ? we->ac_args[0] : 1; - n = min(n, we->ac_nrow - we->ac_crow - 1); - we->ac_crow += n; - break; - - case 'C': /* Cursor Forward */ - n = we->ac_args[0] ? we->ac_args[0] : 1; - n = min(n, we->ac_ncol - we->ac_ccol - 1); - we->ac_ccol += n; - break; - - case 'D': /* Cursor Backward */ - n = we->ac_args[0] ? we->ac_args[0] : 1; - n = min(n, we->ac_ccol); - we->ac_ccol -= n; - break; - - case 'E': /* Cursor Next Line */ - n = we->ac_args[0] ? we->ac_args[0] : 1; - n = min(n, we->ac_nrow - we->ac_crow - 1); - we->ac_crow += n; - we->ac_ccol = 0; - break; - - case 'f': /* Horizontal and Vertical Position */ - case 'H': /* Cursor Position */ - m = we->ac_args[1] ? we->ac_args[1] : 1; /* arg 1 */ - m = min(m, we->ac_nrow); - - n = we->ac_args[0] ? we->ac_args[0] : 1; /* arg 2 */ - n = min(n, we->ac_ncol); - - we->ac_crow = m - 1; - we->ac_ccol = n - 1; - break; - - case 'J': /* Erase in Display */ - (*we->ac_ef->wef_erasecols)(we->ac_efa, we->ac_crow, - we->ac_ccol, we->ac_ncol - we->ac_ccol); - if (we->ac_crow + 1 < we->ac_nrow) - (*we->ac_ef->wef_eraserows)(we->ac_efa, - we->ac_crow + 1, we->ac_nrow - we->ac_crow - 1); - break; - - case 'K': /* Erase in Line */ - (*we->ac_ef->wef_erasecols)(we->ac_efa, we->ac_crow, - we->ac_ccol, we->ac_ncol - we->ac_ccol); - break; - - case 'L': /* Insert Line */ - { - int copy_src, copy_dst, copy_nlines; - - n = we->ac_args[0] ? we->ac_args[0] : 1; - n = min(n, we->ac_nrow - we->ac_crow); - - copy_src = we->ac_crow; - copy_dst = we->ac_crow + n; - copy_nlines = we->ac_nrow - copy_dst; - if (copy_nlines > 0) - (*we->ac_ef->wef_copyrows)(we->ac_efa, - copy_src, copy_dst, copy_nlines); - - (*we->ac_ef->wef_eraserows)(we->ac_efa, - we->ac_crow, n); - } - break; - - case 'M': /* Delete Line */ - { - int copy_src, copy_dst, copy_nlines; - - n = we->ac_args[0] ? we->ac_args[0] : 1; - n = min(n, we->ac_nrow - we->ac_crow); - - copy_src = we->ac_crow + n; - copy_dst = we->ac_crow; - copy_nlines = we->ac_nrow - copy_src; - if (copy_nlines > 0) - (*we->ac_ef->wef_copyrows)(we->ac_efa, - copy_src, copy_dst, copy_nlines); - - (*we->ac_ef->wef_eraserows)(we->ac_efa, - we->ac_crow + copy_nlines, - we->ac_nrow - (we->ac_crow + copy_nlines)); - } - break; - - case 'P': /* Delete Character */ - { - int copy_src, copy_dst, copy_ncols; - - n = we->ac_args[0] ? we->ac_args[0] : 1; - n = min(n, we->ac_ncol - we->ac_ccol); - - copy_src = we->ac_ccol + n; - copy_dst = we->ac_ccol; - copy_ncols = we->ac_ncol - copy_src; - if (copy_ncols > 0) - (*we->ac_ef->wef_copycols)(we->ac_efa, - we->ac_crow, copy_src, copy_dst, - copy_ncols); - - (*we->ac_ef->wef_erasecols)(we->ac_efa, - we->ac_crow, we->ac_ccol + copy_ncols, - we->ac_ncol - (we->ac_ccol + copy_ncols)); - break; - } - break; - case '@': /* Insert Char */ - { - int copy_src, copy_dst, copy_ncols; - - n = we->ac_args[0] ? we->ac_args[0] : 1; - n = min(n, we->ac_ncol - we->ac_ccol); - - copy_src = we->ac_ccol; - copy_dst = we->ac_ccol + n; - copy_ncols = we->ac_ncol - copy_dst; - - if (copy_ncols > 0) - (*we->ac_ef->wef_copycols)(we->ac_efa, - we->ac_crow, copy_src, copy_dst, - copy_ncols); - - (*we->ac_ef->wef_erasecols)(we->ac_efa, - we->ac_crow, we->ac_ccol, - copy_dst - we->ac_ccol); - } - break; - case 'm': /* video attributes */ - /* 7 for so; 0 for se */ - switch (we->ac_args[0]) { - case 7: - (we->ac_ef->wef_set_attr)(we->ac_efa, 1); - break; - case 0: - (we->ac_ef->wef_set_attr)(we->ac_efa, 0); - break; - } - break; - } -} - -static __inline int -wscons_emul_input_control(we, c) - struct wscons_emul_data *we; - char c; -{ - int newstate = ANSICONS_STATE_CONTROL; - int i; - - switch (c) { - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - we->ac_args[0] *= 10; - we->ac_args[0] += c - '0'; - break; - - case ';': - for (i = 0; i < ANSICONS_NARGS - 1; i++) - we->ac_args[i + 1] = we->ac_args[i]; - we->ac_args[0] = 0; - break; - - default: - wscons_emul_docontrol(we, c); - newstate = ANSICONS_STATE_NORMAL; - break; - } - - return newstate; -} - -void -wscons_emul_input(we, cp, n) - struct wscons_emul_data *we; - char *cp; - int n; -{ - int newstate; - - (*we->ac_ef->wef_cursor)(we->ac_efa, 0, we->ac_crow, we->ac_ccol); - for (; n; n--, cp++) { - switch (we->ac_state) { - case ANSICONS_STATE_NORMAL: - newstate = wscons_emul_input_normal(we, *cp); - break; - - case ANSICONS_STATE_HAVEESC: - newstate = wscons_emul_input_haveesc(we, *cp); - break; - - case ANSICONS_STATE_CONTROL: - newstate = wscons_emul_input_control(we, *cp); - break; - - default: -#ifdef DIAGNOSTIC - panic("wscons_emul: invalid state %d\n", we->ac_state); -#endif - /* try to recover, if things get screwed up... */ - newstate = ANSICONS_STATE_NORMAL; - break; - } - - we->ac_state = newstate; - } - (*we->ac_ef->wef_cursor)(we->ac_efa, 1, we->ac_crow, we->ac_ccol); -} diff --git a/sys/arch/alpha/wscons/wscons_rinit.c b/sys/arch/alpha/wscons/wscons_rinit.c deleted file mode 100644 index 50b632f6351..00000000000 --- a/sys/arch/alpha/wscons/wscons_rinit.c +++ /dev/null @@ -1,139 +0,0 @@ -/* $OpenBSD: wscons_rinit.c,v 1.5 1997/04/08 00:47:21 michaels Exp $ */ -/* $NetBSD: wscons_rinit.c,v 1.3 1996/11/13 21:13:42 cgd Exp $ */ - -/* - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Lawrence Berkeley Laboratory. - * - * 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 by the University of - * California, Berkeley and its contributors. - * 4. 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. - * - * @(#)rcons_font.c 8.1 (Berkeley) 6/11/93 - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/device.h> - -#include <dev/rcons/raster.h> -#include <alpha/wscons/wscons_raster.h> - -#include <alpha/wscons/wscons_rfont.h> - -void rcons_initfont __P((struct rcons *, struct raster_font *)); - -void rcons_initfont __P((struct rcons *, struct raster_font *)); - -void -rcons_initfont(rc, fp) - struct rcons *rc; - struct raster_font *fp; -{ - static int initfontdone; - - rc->rc_font = fp; - - /* Get distance to top and bottom of font from font origin */ - rc->rc_font_ascent = -(rc->rc_font->chars)['a'].homey; - -#if !defined(MSBYTE_FIRST) && !defined(MSBIT_FIRST) /* XXX other cases */ - /* swap byte order on font data. ick. */ - if (!initfontdone) { - int ch, i, n, bit; - u_int32_t *pix, npix; - - for (ch = 0; ch < 256; ch++) { - if (rc->rc_font->chars[ch].r == 0) - continue; - - n = rc->rc_font->chars[ch].r->linelongs * - rc->rc_font->chars[ch].r->height; - pix = rc->rc_font->chars[ch].r->pixels; - - for (i = 0; i < n; i++) { - npix = 0; - for (bit = 0; bit < 32; bit++) - if (pix[i] & (1 << bit)) - npix |= (1 << (31 - bit)); - pix[i] = npix; - } - } - } -#endif - - initfontdone = 1; -} - -void -rcons_init(rc, mrow, mcol) - struct rcons *rc; - int mrow, mcol; -{ - struct raster *rp = rc->rc_sp; - int i; - - rcons_initfont(rc, &CONSOLE_FONT); - - i = rp->height / rc->rc_font->height; - rc->rc_maxrow = min(i, mrow); - - i = rp->width / rc->rc_font->width; - rc->rc_maxcol = min(i, mcol); - - /* Center emulator screen (but align x origin to 32 bits) */ - rc->rc_xorigin = - ((rp->width - rc->rc_maxcol * rc->rc_font->width) / 2) & ~0x1f; - rc->rc_yorigin = - (rp->height - rc->rc_maxrow * rc->rc_font->height) / 2; - - /* Raster width used for row copies */ - rc->rc_raswidth = rc->rc_maxcol * rc->rc_font->width; - if (rc->rc_raswidth & 0x1f) { - /* Pad to 32 bits */ - i = (rc->rc_raswidth + 0x1f) & ~0x1f; - /* Make sure width isn't too wide */ - if (rc->rc_xorigin + i <= rp->width) - rc->rc_raswidth = i; - } - - rc->rc_ras_blank = RAS_CLEAR; - rc->rc_bits = 0; - - /* If cursor position given, assume it's there and drawn. */ - if (*rc->rc_crowp != -1 && *rc->rc_ccolp != -1) - rc->rc_bits |= RC_CURSOR; -} diff --git a/sys/arch/alpha/wscons/wscons_rops.c b/sys/arch/alpha/wscons/wscons_rops.c deleted file mode 100644 index 821d7b76523..00000000000 --- a/sys/arch/alpha/wscons/wscons_rops.c +++ /dev/null @@ -1,226 +0,0 @@ -/* $OpenBSD: wscons_rops.c,v 1.4 1997/07/31 13:40:05 kstailey Exp $ */ -/* $NetBSD: wscons_rops.c,v 1.1 1996/04/12 02:00:55 cgd Exp $ */ - -/* - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Lawrence Berkeley Laboratory. - * - * 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 by the University of - * California, Berkeley and its contributors. - * 4. 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. - * - * @(#)rcons_subr.c 8.1 (Berkeley) 6/11/93 - */ - -#include <sys/param.h> -#include <sys/device.h> - -#include <dev/rcons/raster.h> -#include <alpha/wscons/wscons_raster.h> - -/* - * Paint (or unpaint) the cursor. - * Pays no lip service to hardware cursors. - */ -void -rcons_cursor(id, on, row, col) - void *id; - int on, row, col; -{ - register struct rcons *rc = id; - register int x, y; - - /* turn the cursor off */ - if (!on) { - /* make sure it's on */ - if ((rc->rc_bits & RC_CURSOR) == 0) - return; - - row = *rc->rc_crowp; - col = *rc->rc_ccolp; - } else { - /* unpaint the old copy. */ - *rc->rc_crowp = row; - *rc->rc_ccolp = col; - } - - x = col * rc->rc_font->width + rc->rc_xorigin; - y = row * rc->rc_font->height + rc->rc_yorigin; - - raster_op(rc->rc_sp, x, y, -#ifdef notdef - /* XXX This is the right way but too slow */ - rc->rc_font->chars[(int)' '].r->width, - rc->rc_font->chars[(int)' '].r->height, -#else - rc->rc_font->width, rc->rc_font->height, -#endif - RAS_INVERT, - (struct raster *) 0, 0, 0); - - rc->rc_bits ^= RC_CURSOR; -} - -/* - * Actually write a string to the frame buffer. - */ -void -rcons_putstr(id, row, col, str, n) - void *id; - int row, col, n; - char *str; -{ - struct rcons *rc = id; - register int x, y, op; - - x = col * rc->rc_font->width + rc->rc_xorigin; - y = row * rc->rc_font->height + rc->rc_font_ascent + rc->rc_yorigin; - - op = RAS_SRC; - if (((rc->rc_bits & RC_STANDOUT) != 0) ^ - ((rc->rc_bits & RC_INVERT) != 0)) - op = RAS_NOT(op); - raster_textn(rc->rc_sp, x, y, op, rc->rc_font, str, n); -} - -/* - * Possibly change entire display to white-on-black or black-on-white modes. - */ -void -rcons_invert(id, inverted) - void *id; - int inverted; -{ - struct rcons *rc = id; - - if (((rc->rc_bits & RC_INVERT) != 0) ^ inverted) { - /* Invert the display */ - raster_op(rc->rc_sp, 0, 0, rc->rc_sp->width, rc->rc_sp->height, - RAS_INVERT, (struct raster *) 0, 0, 0); - - /* Swap things around */ - rc->rc_ras_blank = RAS_NOT(rc->rc_ras_blank); - rc->rc_bits ^= RC_INVERT; - } -} - -/* - * Copy columns (characters) in a row (line). - */ -void -rcons_copycols(id, row, srccol, dstcol, ncols) - void *id; - int row, srccol, dstcol, ncols; -{ - struct rcons *rc = id; - int y, srcx, dstx, nx; - - y = rc->rc_yorigin + rc->rc_font->height * row; - srcx = rc->rc_xorigin + rc->rc_font->width * srccol; - dstx = rc->rc_xorigin + rc->rc_font->width * dstcol; - nx = rc->rc_font->width * ncols; - - raster_op(rc->rc_sp, dstx, y, - nx, rc->rc_font->height, RAS_SRC, - rc->rc_sp, srcx, y); -} - -/* - * Clear columns (characters) in a row (line). - */ -void -rcons_erasecols(id, row, startcol, ncols) - void *id; - int row, startcol, ncols; -{ - struct rcons *rc = id; - int y, startx, nx; - - y = rc->rc_yorigin + rc->rc_font->height * row; - startx = rc->rc_xorigin + rc->rc_font->width * startcol; - nx = rc->rc_font->width * ncols; - - raster_op(rc->rc_sp, startx, y, - nx, rc->rc_font->height, rc->rc_ras_blank, - (struct raster *) 0, 0, 0); -} - -/* - * Copy rows (lines). - */ -void -rcons_copyrows(id, srcrow, dstrow, nrows) - void *id; - int srcrow, dstrow, nrows; -{ - struct rcons *rc = id; - int srcy, dsty, ny; - - srcy = rc->rc_yorigin + rc->rc_font->height * srcrow; - dsty = rc->rc_yorigin + rc->rc_font->height * dstrow; - ny = rc->rc_font->height * nrows; - - raster_op(rc->rc_sp, rc->rc_xorigin, dsty, - rc->rc_raswidth, ny, RAS_SRC, - rc->rc_sp, rc->rc_xorigin, srcy); -} - -/* - * Erase rows (lines). - */ -void -rcons_eraserows(id, startrow, nrows) - void *id; - int startrow, nrows; -{ - struct rcons *rc = id; - int starty, ny; - - starty = rc->rc_yorigin + rc->rc_font->height * startrow; - ny = rc->rc_font->height * nrows; - - raster_op(rc->rc_sp, rc->rc_xorigin, starty, - rc->rc_raswidth, ny, rc->rc_ras_blank, - (struct raster *) 0, 0, 0); -} - -void -rcons_setattr(id, val) - void *id; - int val; -{ - /* XXX */ -} diff --git a/sys/conf/files b/sys/conf/files index 40f8d17ae0e..4c787a92cec 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1,4 +1,4 @@ -# $OpenBSD: files,v 1.68 1997/11/06 05:58:07 csapuntz Exp $ +# $OpenBSD: files,v 1.69 1997/11/06 12:27:00 niklas Exp $ # $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $ # @(#)files.newconf 7.5 (Berkeley) 5/10/93 @@ -77,14 +77,14 @@ file dev/ic/vga.c vga & (vga_isa | vga_pci) # # "Workstation Console" glue; attaches frame buffer to emulator & kbd. # -#device wscons -#attach wscons at wsconsdev -#file dev/wscons/wscons.c wscons needs-flag -#file dev/wscons/wscons_emul.c wscons +device wscons +attach wscons at wsconsdev +file dev/wscons/wscons.c wscons needs-flag +file dev/wscons/wscons_emul.c wscons -#file dev/wscons/event.c wscons -#file dev/wscons/kbd.c wscons -#file dev/wscons/ms.c wscons +file dev/wscons/event.c wscons +file dev/wscons/kbd.c wscons +file dev/wscons/ms.c wscons # Attributes which machine-independent bus support can be attached to. # These should be defined here, because some of these busses can have diff --git a/sys/dev/ic/vga.c b/sys/dev/ic/vga.c index 19c47e50c65..e29809a70bf 100644 --- a/sys/dev/ic/vga.c +++ b/sys/dev/ic/vga.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vga.c,v 1.10 1997/11/06 03:38:44 mickey Exp $ */ +/* $OpenBSD: vga.c,v 1.11 1997/11/06 12:26:54 niklas Exp $ */ /* $NetBSD: vga.c,v 1.3 1996/12/02 22:24:54 cgd Exp $ */ /* @@ -34,7 +34,7 @@ #include <sys/device.h> #include <machine/bus.h> -#include <alpha/wscons/wsconsvar.h> +#include <dev/wscons/wsconsvar.h> #include <dev/ic/vgavar.h> #define VGA_IO_D_6845_ADDR 0x4 diff --git a/sys/dev/isa/vga_isa.c b/sys/dev/isa/vga_isa.c index 19890274ef7..3e4b6973cfb 100644 --- a/sys/dev/isa/vga_isa.c +++ b/sys/dev/isa/vga_isa.c @@ -1,3 +1,4 @@ +/* $OpenBSD: vga_isa.c,v 1.6 1997/11/06 12:26:55 niklas Exp $ */ /* $NetBSD: vga_isa.c,v 1.4 1996/12/05 01:39:32 cgd Exp $ */ /* diff --git a/sys/dev/isa/vga_isavar.h b/sys/dev/isa/vga_isavar.h index 618eb26b51b..0b752a0566a 100644 --- a/sys/dev/isa/vga_isavar.h +++ b/sys/dev/isa/vga_isavar.h @@ -1,3 +1,4 @@ +/* $OpenBSD: vga_isavar.h,v 1.2 1997/11/06 12:26:55 niklas Exp $ */ /* $NetBSD: vga_isavar.h,v 1.2 1996/11/23 06:06:45 cgd Exp $ */ /* diff --git a/sys/dev/pci/vga_pci.c b/sys/dev/pci/vga_pci.c index 1b6c0be351d..6007c303a30 100644 --- a/sys/dev/pci/vga_pci.c +++ b/sys/dev/pci/vga_pci.c @@ -1,3 +1,4 @@ +/* $OpenBSD: vga_pci.c,v 1.6 1997/11/06 12:26:56 niklas Exp $ */ /* $NetBSD: vga_pci.c,v 1.4 1996/12/05 01:39:38 cgd Exp $ */ /* diff --git a/sys/dev/pci/vga_pcivar.h b/sys/dev/pci/vga_pcivar.h index 29e258c862d..cc9d50295a8 100644 --- a/sys/dev/pci/vga_pcivar.h +++ b/sys/dev/pci/vga_pcivar.h @@ -1,3 +1,4 @@ +/* $OpenBSD: vga_pcivar.h,v 1.2 1997/11/06 12:26:56 niklas Exp $ */ /* $NetBSD: vga_pcivar.h,v 1.1 1996/11/19 04:38:36 cgd Exp $ */ /* diff --git a/sys/dev/wscons/event.c b/sys/dev/wscons/event.c index 57874c90736..23edffb50eb 100644 --- a/sys/dev/wscons/event.c +++ b/sys/dev/wscons/event.c @@ -1,4 +1,4 @@ -/* $OpenBSD: event.c,v 1.3 1996/10/30 22:41:36 niklas Exp $ */ +/* $OpenBSD: event.c,v 1.4 1997/11/06 12:26:57 niklas Exp $ */ /* $NetBSD: event.c,v 1.3 1996/09/15 17:15:26 cgd Exp $ */ /* @@ -61,7 +61,7 @@ #endif #include <machine/vuid_event.h> -#include <alpha/wscons/event_var.h> +#include <dev/wscons/event_var.h> /* * Initialize a firm_event queue. diff --git a/sys/dev/wscons/kbd.c b/sys/dev/wscons/kbd.c index 05e43d07eea..9595f2d10e7 100644 --- a/sys/dev/wscons/kbd.c +++ b/sys/dev/wscons/kbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kbd.c,v 1.4 1997/01/24 19:58:25 niklas Exp $ */ +/* $OpenBSD: kbd.c,v 1.5 1997/11/06 12:26:57 niklas Exp $ */ /* $NetBSD: kbd.c,v 1.3 1996/11/13 21:13:39 cgd Exp $ */ /* @@ -68,9 +68,9 @@ #include <machine/vuid_event.h> #include <machine/kbio.h> /* XXX FOR KIOCSDIRECT */ #include <machine/wsconsio.h> /* XXX for bell ioctls */ -#include <alpha/wscons/event_var.h> -#include <alpha/wscons/wsconsvar.h> -#include <alpha/wscons/kbd.h> +#include <dev/wscons/event_var.h> +#include <dev/wscons/wsconsvar.h> +#include <dev/wscons/kbd.h> void kbd_repeat __P((void *)); diff --git a/sys/dev/wscons/ms.c b/sys/dev/wscons/ms.c index 76a72d67721..8a83c91ac56 100644 --- a/sys/dev/wscons/ms.c +++ b/sys/dev/wscons/ms.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ms.c,v 1.4 1997/01/24 19:58:27 niklas Exp $ */ +/* $OpenBSD: ms.c,v 1.5 1997/11/06 12:26:58 niklas Exp $ */ /* $NetBSD: ms.c,v 1.3 1996/11/13 21:13:40 cgd Exp $ */ /* @@ -60,9 +60,9 @@ #include <sys/tty.h> #include <machine/vuid_event.h> -#include <alpha/wscons/event_var.h> -#include <alpha/wscons/wsconsvar.h> -#include <alpha/wscons/ms.h> +#include <dev/wscons/event_var.h> +#include <dev/wscons/wsconsvar.h> +#include <dev/wscons/ms.h> struct ms_softc { struct device *ms_dev; diff --git a/sys/dev/wscons/wscons.c b/sys/dev/wscons/wscons.c index 1a2b203c54a..a01d15ff0ff 100644 --- a/sys/dev/wscons/wscons.c +++ b/sys/dev/wscons/wscons.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wscons.c,v 1.5 1997/08/22 22:25:11 deraadt Exp $ */ +/* $OpenBSD: wscons.c,v 1.6 1997/11/06 12:26:58 niklas Exp $ */ /* $NetBSD: wscons.c,v 1.10 1996/12/05 01:39:47 cgd Exp $ */ /* @@ -40,9 +40,9 @@ #include <sys/termios.h> #include <dev/cons.h> -#include <alpha/wscons/wsconsvar.h> -#include <alpha/wscons/wscons_emul.h> -#include <alpha/wscons/kbd.h> +#include <dev/wscons/wsconsvar.h> +#include <dev/wscons/wscons_emul.h> +#include <dev/wscons/kbd.h> #include <machine/wsconsio.h> cdev_decl(wscons); diff --git a/sys/dev/wscons/wscons_emul.c b/sys/dev/wscons/wscons_emul.c index 3b472714570..55d2cd92cb8 100644 --- a/sys/dev/wscons/wscons_emul.c +++ b/sys/dev/wscons/wscons_emul.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wscons_emul.c,v 1.11 1997/07/31 13:40:04 kstailey Exp $ */ +/* $OpenBSD: wscons_emul.c,v 1.12 1997/11/06 12:26:59 niklas Exp $ */ /* $NetBSD: wscons_emul.c,v 1.7 1996/11/19 05:23:13 cgd Exp $ */ /* @@ -35,10 +35,10 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/conf.h> -#include <alpha/wscons/wsconsvar.h> -#include <alpha/wscons/wscons_emul.h> -#include <alpha/wscons/kbd.h> -#include <alpha/wscons/ascii.h> +#include <dev/wscons/wsconsvar.h> +#include <dev/wscons/wscons_emul.h> +#include <dev/wscons/kbd.h> +#include <dev/wscons/ascii.h> static __inline int wscons_emul_input_normal __P((struct wscons_emul_data *, char)); diff --git a/sys/dev/wscons/wscons_rinit.c b/sys/dev/wscons/wscons_rinit.c index 50b632f6351..af0c85b46bd 100644 --- a/sys/dev/wscons/wscons_rinit.c +++ b/sys/dev/wscons/wscons_rinit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wscons_rinit.c,v 1.5 1997/04/08 00:47:21 michaels Exp $ */ +/* $OpenBSD: wscons_rinit.c,v 1.6 1997/11/06 12:26:59 niklas Exp $ */ /* $NetBSD: wscons_rinit.c,v 1.3 1996/11/13 21:13:42 cgd Exp $ */ /* @@ -50,11 +50,8 @@ #include <sys/device.h> #include <dev/rcons/raster.h> -#include <alpha/wscons/wscons_raster.h> - -#include <alpha/wscons/wscons_rfont.h> - -void rcons_initfont __P((struct rcons *, struct raster_font *)); +#include <dev/wscons/wscons_raster.h> +#include <dev/wscons/wscons_rfont.h> void rcons_initfont __P((struct rcons *, struct raster_font *)); diff --git a/sys/dev/wscons/wscons_rops.c b/sys/dev/wscons/wscons_rops.c index 821d7b76523..f9c7bbad0d1 100644 --- a/sys/dev/wscons/wscons_rops.c +++ b/sys/dev/wscons/wscons_rops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wscons_rops.c,v 1.4 1997/07/31 13:40:05 kstailey Exp $ */ +/* $OpenBSD: wscons_rops.c,v 1.5 1997/11/06 12:27:00 niklas Exp $ */ /* $NetBSD: wscons_rops.c,v 1.1 1996/04/12 02:00:55 cgd Exp $ */ /* @@ -49,7 +49,7 @@ #include <sys/device.h> #include <dev/rcons/raster.h> -#include <alpha/wscons/wscons_raster.h> +#include <dev/wscons/wscons_raster.h> /* * Paint (or unpaint) the cursor. |