diff options
| author | pgoyette <pgoyette@NetBSD.org> | 2019-01-27 02:08:33 +0000 |
|---|---|---|
| committer | pgoyette <pgoyette@NetBSD.org> | 2019-01-27 02:08:33 +0000 |
| commit | cc17ee2ece085d7d746bcd8fa9be19170855aaac (patch) | |
| tree | 5be40613f405cb081b2c44410b1506781927f8e3 /sys/dev/wscons | |
| parent | 10dd4cc92542aa04b0e59469a484a48e4c3cdd24 (diff) | |
Merge the [pgoyette-compat] branch
Diffstat (limited to 'sys/dev/wscons')
| -rw-r--r-- | sys/dev/wscons/files.wscons | 3 | ||||
| -rw-r--r-- | sys/dev/wscons/wsevent.c | 45 | ||||
| -rw-r--r-- | sys/dev/wscons/wsevent_50.c | 160 | ||||
| -rw-r--r-- | sys/dev/wscons/wsevent_50.h | 38 |
4 files changed, 209 insertions, 37 deletions
diff --git a/sys/dev/wscons/files.wscons b/sys/dev/wscons/files.wscons index 8c8102cfe90..6ffc0d9d7cd 100644 --- a/sys/dev/wscons/files.wscons +++ b/sys/dev/wscons/files.wscons @@ -1,4 +1,4 @@ -# $NetBSD: files.wscons,v 1.55 2017/12/18 18:59:32 jmcneill Exp $ +# $NetBSD: files.wscons,v 1.56 2019/01/27 02:08:42 pgoyette Exp $ # # "Workstation Console" glue; attaches frame buffer to emulator & keyboard, @@ -58,6 +58,7 @@ file dev/wscons/wsemul_vt100_subr.c wsdisplay & wsemul_vt100 file dev/wscons/wsemul_vt100_chars.c wsdisplay & wsemul_vt100 file dev/wscons/wsemul_vt100_keys.c wsdisplay & wsemul_vt100 file dev/wscons/wsevent.c wsdisplay | wskbd | wsmouse | wsmux +file dev/wscons/wsevent_50.c compat_50 file dev/wscons/wskbd.c wskbd needs-flag file dev/wscons/wskbdutil.c wskbd needs-flag file dev/wscons/wsmouse.c wsmouse needs-flag diff --git a/sys/dev/wscons/wsevent.c b/sys/dev/wscons/wsevent.c index c26947fc849..6281798b486 100644 --- a/sys/dev/wscons/wsevent.c +++ b/sys/dev/wscons/wsevent.c @@ -1,4 +1,4 @@ -/* $NetBSD: wsevent.c,v 1.39 2018/06/14 10:30:55 uwe Exp $ */ +/* $NetBSD: wsevent.c,v 1.40 2019/01/27 02:08:42 pgoyette Exp $ */ /*- * Copyright (c) 2006, 2008 The NetBSD Foundation, Inc. @@ -104,7 +104,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 1.39 2018/06/14 10:30:55 uwe Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 1.40 2019/01/27 02:08:42 pgoyette Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -120,6 +120,7 @@ __KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 1.39 2018/06/14 10:30:55 uwe Exp $"); #include <sys/vnode.h> #include <sys/select.h> #include <sys/poll.h> +#include <sys/compat_stub.h> #include <dev/wscons/wsconsio.h> #include <dev/wscons/wseventvar.h> @@ -188,47 +189,19 @@ wsevent_fini(struct wseventvar *ev) softint_disestablish(ev->sih); } -#if defined(COMPAT_50) || defined(MODULAR) -static int -wsevent_copyout_events50(const struct wscons_event *events, int cnt, - struct uio *uio) -{ - int i; - - for (i = 0; i < cnt; i++) { - const struct wscons_event *ev = &events[i]; - struct owscons_event ev50; - int error; - - ev50.type = ev->type; - ev50.value = ev->value; - timespec_to_timespec50(&ev->time, &ev50.time); - - error = uiomove(&ev50, sizeof(ev50), uio); - if (error) { - return error; - } - } - return 0; -} -#else /* defined(COMPAT_50) || defined(MODULAR) */ -static int -wsevent_copyout_events50(const struct wscons_event *events, int cnt, - struct uio *uio) -{ - - return EINVAL; -} -#endif /* defined(COMPAT_50) || defined(MODULAR) */ - static int wsevent_copyout_events(const struct wscons_event *events, int cnt, struct uio *uio, int ver) { + int error; switch (ver) { case 0: - return wsevent_copyout_events50(events, cnt, uio); + MODULE_CALL_HOOK(wsevent_50_copyout_events_hook, + (events, cnt, uio), enosys(), error); + if (error == ENOSYS) + error = EINVAL; + return error; case WSEVENT_VERSION: return uiomove(__UNCONST(events), cnt * sizeof(*events), uio); default: diff --git a/sys/dev/wscons/wsevent_50.c b/sys/dev/wscons/wsevent_50.c new file mode 100644 index 00000000000..7a1f5d9ca46 --- /dev/null +++ b/sys/dev/wscons/wsevent_50.c @@ -0,0 +1,160 @@ +/* $NetBSD: wsevent_50.c,v 1.2 2019/01/27 02:08:42 pgoyette Exp $ */ + +/*- + * Copyright (c) 2006, 2008 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Julio M. Merino Vidal. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +/* + * Copyright (c) 1996, 1997 Christopher G. Demetriou. 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 by Christopher G. Demetriou + * for the NetBSD Project. + * 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. + */ + +/* + * 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. 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 "wscons_event" queue interface for the keyboard and mouse drivers. + */ + +#include <sys/cdefs.h> +__KERNEL_RCSID(0, "$NetBSD: wsevent_50.c,v 1.2 2019/01/27 02:08:42 pgoyette Exp $"); + +#include <sys/param.h> +#include <sys/kernel.h> +#include <sys/fcntl.h> +#include <sys/kmem.h> +#include <sys/proc.h> +#include <sys/systm.h> +#include <sys/vnode.h> +#include <sys/select.h> +#include <sys/poll.h> +#include <sys/compat_stub.h> + +#include <dev/wscons/wsconsio.h> +#include <dev/wscons/wseventvar.h> +#include <dev/wscons/wsevent_50.h> + +static int +wsevent_copyout_events50(const struct wscons_event *events, int cnt, + struct uio *uio) +{ + int i; + + for (i = 0; i < cnt; i++) { + const struct wscons_event *ev = &events[i]; + struct owscons_event ev50; + int error; + + ev50.type = ev->type; + ev50.value = ev->value; + timespec_to_timespec50(&ev->time, &ev50.time); + + error = uiomove(&ev50, sizeof(ev50), uio); + if (error) { + return error; + } + } + return 0; +} + +void +wsevent_50_init(void) +{ + + MODULE_SET_HOOK(wsevent_50_copyout_events_hook, "wsc_50", + wsevent_copyout_events50); +} + +void +wsevent_50_fini(void) +{ + + MODULE_UNSET_HOOK(wsevent_50_copyout_events_hook); +} diff --git a/sys/dev/wscons/wsevent_50.h b/sys/dev/wscons/wsevent_50.h new file mode 100644 index 00000000000..b937c1a1c77 --- /dev/null +++ b/sys/dev/wscons/wsevent_50.h @@ -0,0 +1,38 @@ +/* $NetBSD: wsevent_50.h,v 1.2 2019/01/27 02:08:42 pgoyette Exp $ */ + +/*- + * Copyright (c) 2018 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Paul Goyette + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +#ifndef _DEV_WSCONS_WSEVENT_50_H +#define _DEV_WSCONS_WSEVENT_50_H + +void wsevent_50_init(void); +void wsevent_50_fini(void); + +#endif /* _DEV_WSCONS_WSEVENT_50_H */ |
