diff options
| author | Warner Losh <imp@FreeBSD.org> | 2020-02-03 17:35:11 +0000 |
|---|---|---|
| committer | Warner Losh <imp@FreeBSD.org> | 2020-02-03 17:35:11 +0000 |
| commit | 58aa35d42975c298ca0adba705c042596303c9f5 (patch) | |
| tree | 2558d2b720cda9c2799970cabc266e2ce4e3a8d3 /sys/dev/uart | |
| parent | eb24e1491f9900e922c78e53af588f22a3e9535f (diff) | |
Notes
Diffstat (limited to 'sys/dev/uart')
| -rw-r--r-- | sys/dev/uart/uart_bus_ebus.c | 108 | ||||
| -rw-r--r-- | sys/dev/uart/uart_cpu_sparc64.c | 307 | ||||
| -rw-r--r-- | sys/dev/uart/uart_kbd_sun.c | 869 | ||||
| -rw-r--r-- | sys/dev/uart/uart_kbd_sun.h | 70 | ||||
| -rw-r--r-- | sys/dev/uart/uart_kbd_sun_tables.h | 144 |
5 files changed, 0 insertions, 1498 deletions
diff --git a/sys/dev/uart/uart_bus_ebus.c b/sys/dev/uart/uart_bus_ebus.c deleted file mode 100644 index dd50ff83596f..000000000000 --- a/sys/dev/uart/uart_bus_ebus.c +++ /dev/null @@ -1,108 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2001 by Thomas Moestl <tmm@FreeBSD.org>. - * 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. - * - * 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 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/bus.h> -#include <sys/kernel.h> -#include <sys/module.h> - -#include <dev/ofw/ofw_bus.h> - -#include <machine/bus.h> -#include <sys/rman.h> -#include <machine/resource.h> -#include <machine/ver.h> - -#include <dev/uart/uart.h> -#include <dev/uart/uart_bus.h> -#include <dev/uart/uart_cpu.h> - -static int uart_ebus_probe(device_t dev); - -static device_method_t uart_ebus_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, uart_ebus_probe), - DEVMETHOD(device_attach, uart_bus_attach), - DEVMETHOD(device_detach, uart_bus_detach), - { 0, 0 } -}; - -static driver_t uart_ebus_driver = { - uart_driver_name, - uart_ebus_methods, - sizeof(struct uart_softc), -}; - -static int -uart_ebus_probe(device_t dev) -{ - const char *nm, *cmpt; - struct uart_softc *sc; - struct uart_devinfo dummy; - - sc = device_get_softc(dev); - sc->sc_class = NULL; - - nm = ofw_bus_get_name(dev); - cmpt = ofw_bus_get_compat(dev); - if (cmpt == NULL) - cmpt = ""; - if (!strcmp(nm, "lom-console") || !strcmp(nm, "su") || - !strcmp(nm, "su_pnp") || !strcmp(cmpt, "rsc-console") || - !strcmp(cmpt, "rsc-control") || !strcmp(cmpt, "su") || - !strcmp(cmpt, "su16550") || !strcmp(cmpt, "su16552")) { - /* - * On AXi and AXmp boards the NS16550 (used to connect - * keyboard/mouse) share their IRQ lines with the i8042. - * Any IRQ activity (typically during attach) of the - * NS16550 used to connect the keyboard when actually the - * PS/2 keyboard is selected in OFW causes interaction - * with the OBP i8042 driver resulting in a hang and vice - * versa. As RS232 keyboards and mice obviously aren't - * meant to be used in parallel with PS/2 ones on these - * boards don't attach to the NS16550 in case the RS232 - * keyboard isn't selected in order to prevent such hangs. - */ - if ((!strcmp(sparc64_model, "SUNW,UltraAX-MP") || - !strcmp(sparc64_model, "SUNW,UltraSPARC-IIi-Engine")) && - uart_cpu_getdev(UART_DEV_KEYBOARD, &dummy)) { - device_disable(dev); - return (ENXIO); - } - sc->sc_class = &uart_ns8250_class; - return (uart_bus_probe(dev, 0, 0, 0, 0, 0, 0)); - } - - return (ENXIO); -} - -DRIVER_MODULE(uart, ebus, uart_ebus_driver, uart_devclass, 0, 0); diff --git a/sys/dev/uart/uart_cpu_sparc64.c b/sys/dev/uart/uart_cpu_sparc64.c deleted file mode 100644 index 17a2ca84bb6c..000000000000 --- a/sys/dev/uart/uart_cpu_sparc64.c +++ /dev/null @@ -1,307 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2003, 2004 Marcel Moolenaar - * Copyright (c) 2004 - 2006 Marius Strobl <marius@FreeBSD.org> - * 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. - * - * 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> - -#include <machine/bus.h> -#include <machine/bus_private.h> - -#include <dev/ofw/openfirm.h> -#include <machine/ofw_machdep.h> - -#include <dev/uart/uart.h> -#include <dev/uart/uart_cpu.h> - -bus_space_tag_t uart_bus_space_io; -bus_space_tag_t uart_bus_space_mem; - -static struct bus_space_tag bst_store[3]; - -/* - * Determine which channel of a SCC a device referenced by a full device - * path or as an alias is (in the latter case we try to look up the device - * path via the /aliases node). - * Only the device paths of devices which are used for TTYs really allow - * to do this as they look like these (taken from /aliases nodes): - * ttya: '/central/fhc/zs@0,902000:a' - * ttyc: '/pci@1f,0/pci@1,1/ebus@1/se@14,400000:a' - * Additionally, for device paths of SCCs which are connected to a RSC - * (Remote System Control) device we can hardcode the appropriate channel. - * Such device paths look like these: - * rsc: '/pci@1f,4000/ebus@1/se@14,200000:ssp' - * ttyc: '/pci@1f,4000/ebus@1/se@14,200000:ssp' - */ -static int -uart_cpu_channel(char *dev) -{ - char alias[64]; - phandle_t aliases; - int len; - const char *p; - - strcpy(alias, dev); - if ((aliases = OF_finddevice("/aliases")) != -1) - (void)OF_getprop(aliases, dev, alias, sizeof(alias)); - len = strlen(alias); - if ((p = strrchr(alias, ':')) == NULL) - return (0); - p++; - if (p - alias == len - 1 && (*p == 'a' || *p == 'b')) - return (*p - 'a' + 1); - if (strcmp(p, "ssp") == 0) - return (1); - return (0); -} - -int -uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2) -{ - - return ((b1->bsh == b2->bsh) ? 1 : 0); -} - -/* - * Get the package handle of the UART that is selected as the console, if - * the console is an UART of course. Note that we enforce that both input - * and output are selected. - * Note that the currently active console (i.e. /chosen/stdout and - * /chosen/stdin) may not be the same as the device selected in the - * environment (ie /options/output-device and /options/input-device) because - * keyboard and screen were selected but the keyboard was unplugged or the - * user has changed the environment. In the latter case I would assume that - * the user expects that FreeBSD uses the new console setting. - * For weirder configurations, use ofw_console(4). - */ -static phandle_t -uart_cpu_getdev_console(phandle_t options, char *dev, size_t devsz) -{ - char buf[sizeof("serial")]; - ihandle_t inst; - phandle_t chosen, input, output; - - if (OF_getprop(options, "input-device", dev, devsz) == -1) - return (-1); - input = OF_finddevice(dev); - if (OF_getprop(options, "output-device", dev, devsz) == -1) - return (-1); - output = OF_finddevice(dev); - if (input == -1 || output == -1 || - OF_getproplen(input, "keyboard") >= 0) { - if ((chosen = OF_finddevice("/chosen")) == -1) - return (-1); - if (OF_getprop(chosen, "stdin", &inst, sizeof(inst)) == -1) - return (-1); - if ((input = OF_instance_to_package(inst)) == -1) - return (-1); - if (OF_getprop(chosen, "stdout", &inst, sizeof(inst)) == -1) - return (-1); - if ((output = OF_instance_to_package(inst)) == -1) - return (-1); - snprintf(dev, devsz, "ttya"); - } - if (input != output) - return (-1); - if (OF_getprop(input, "device_type", buf, sizeof(buf)) == -1) - return (-1); - if (strcmp(buf, "serial") != 0) - return (-1); - /* For a Serengeti console device point to the bootbus controller. */ - if (OF_getprop(input, "name", buf, sizeof(buf)) > 0 && - !strcmp(buf, "sgcn")) { - if ((chosen = OF_finddevice("/chosen")) == -1) - return (-1); - if (OF_getprop(chosen, "iosram", &input, sizeof(input)) == -1) - return (-1); - } - return (input); -} - -/* - * Get the package handle of the UART that's selected as the debug port. - * Since there's no place for this in the OF, we use the kernel environment - * variable "hw.uart.dbgport". Note however that the variable is not a - * list of attributes. It's single device name or alias, as known by - * the OF. - */ -static phandle_t -uart_cpu_getdev_dbgport(char *dev, size_t devsz) -{ - char buf[sizeof("serial")]; - phandle_t input; - - if (!getenv_string("hw.uart.dbgport", dev, devsz)) - return (-1); - if ((input = OF_finddevice(dev)) == -1) - return (-1); - if (OF_getprop(input, "device_type", buf, sizeof(buf)) == -1) - return (-1); - if (strcmp(buf, "serial") != 0) - return (-1); - return (input); -} - -/* - * Get the package handle of the UART that is selected as the keyboard port, - * if it's actually used to connect the keyboard according to the OF. I.e. - * this will return the UART used to connect the keyboard regardless whether - * it's stdin or not, however not in case the user or the OF gave preference - * to e.g. a PS/2 keyboard by setting /aliases/keyboard accordingly. - */ -static phandle_t -uart_cpu_getdev_keyboard(char *dev, size_t devsz) -{ - char buf[sizeof("serial")]; - phandle_t input; - - if ((input = OF_finddevice("keyboard")) == -1) - return (-1); - if (OF_getprop(input, "device_type", buf, sizeof(buf)) == -1) - return (-1); - if (strcmp(buf, "serial") != 0) - return (-1); - if (OF_getprop(input, "name", dev, devsz) == -1) - return (-1); - /* - * So far this also matched PS/2 keyboard nodes so make sure it's - * one of the SCCs/UARTs known to be used to connect keyboards. - */ - if (strcmp(dev, "su") && strcmp(dev, "su_pnp") && strcmp(dev, "zs")) - return (-1); - return (input); -} - -int -uart_cpu_getdev(int devtype, struct uart_devinfo *di) -{ - char buf[32], compat[32], dev[64]; - struct uart_class *class; - phandle_t input, options; - bus_addr_t addr; - int baud, bits, error, range, space, stop; - char flag, par; - - if ((options = OF_finddevice("/options")) == -1) - return (ENXIO); - switch (devtype) { - case UART_DEV_CONSOLE: - input = uart_cpu_getdev_console(options, dev, sizeof(dev)); - break; - case UART_DEV_DBGPORT: - input = uart_cpu_getdev_dbgport(dev, sizeof(dev)); - break; - case UART_DEV_KEYBOARD: - input = uart_cpu_getdev_keyboard(dev, sizeof(dev)); - break; - default: - input = -1; - break; - } - if (input == -1) - return (ENXIO); - error = OF_decode_addr(input, 0, &space, &addr); - if (error) - return (error); - - /* Get the device class. */ - if (OF_getprop(input, "name", buf, sizeof(buf)) == -1) - return (ENXIO); - if (OF_getprop(input, "compatible", compat, sizeof(compat)) == -1) - compat[0] = '\0'; - di->bas.regshft = 0; - di->bas.rclk = 0; - class = NULL; - if (!strcmp(buf, "se") || !strcmp(buf, "FJSV,se") || - !strcmp(compat, "sab82532")) { - class = &uart_sab82532_class; - /* SAB82532 are only known to be used for TTYs. */ - if ((di->bas.chan = uart_cpu_channel(dev)) == 0) - return (ENXIO); - addr += uart_getrange(class) * (di->bas.chan - 1); - } else if (!strcmp(buf, "zs")) { - class = &uart_z8530_class; - if ((di->bas.chan = uart_cpu_channel(dev)) == 0) { - /* - * There's no way to determine from OF which - * channel has the keyboard. Should always be - * on channel 1 however. - */ - if (devtype == UART_DEV_KEYBOARD) - di->bas.chan = 1; - else - return (ENXIO); - } - di->bas.regshft = 1; - range = uart_getrange(class) << di->bas.regshft; - addr += range - range * (di->bas.chan - 1); - } else if (!strcmp(buf, "lom-console") || !strcmp(buf, "su") || - !strcmp(buf, "su_pnp") || !strcmp(compat, "rsc-console") || - !strcmp(compat, "su") || !strcmp(compat, "su16550") || - !strcmp(compat, "su16552")) { - class = &uart_ns8250_class; - di->bas.chan = 0; - } else if (!strcmp(compat, "sgsbbc")) { - class = &uart_sbbc_class; - di->bas.chan = 0; - } - if (class == NULL) - return (ENXIO); - - /* Fill in the device info. */ - di->ops = uart_getops(class); - di->bas.bst = &bst_store[devtype]; - di->bas.bsh = sparc64_fake_bustag(space, addr, di->bas.bst); - - /* Get the line settings. */ - if (devtype == UART_DEV_KEYBOARD) - di->baudrate = 1200; - else if (!strcmp(compat, "rsc-console")) - di->baudrate = 115200; - else - di->baudrate = 9600; - di->databits = 8; - di->stopbits = 1; - di->parity = UART_PARITY_NONE; - snprintf(buf, sizeof(buf), "%s-mode", dev); - if (OF_getprop(options, buf, buf, sizeof(buf)) == -1 && - OF_getprop(input, "ssp-console-modes", buf, sizeof(buf)) == -1) - return (0); - if (sscanf(buf, "%d,%d,%c,%d,%c", &baud, &bits, &par, &stop, &flag) - != 5) - return (0); - di->baudrate = baud; - di->databits = bits; - di->stopbits = stop; - di->parity = (par == 'n') ? UART_PARITY_NONE : - (par == 'o') ? UART_PARITY_ODD : UART_PARITY_EVEN; - return (0); -} diff --git a/sys/dev/uart/uart_kbd_sun.c b/sys/dev/uart/uart_kbd_sun.c deleted file mode 100644 index 5c9d7555f186..000000000000 --- a/sys/dev/uart/uart_kbd_sun.c +++ /dev/null @@ -1,869 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2003 Jake Burkholder. - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_kbd.h" -#include "opt_sunkbd.h" - -#if (defined(SUNKBD_EMULATE_ATKBD) && defined(SUNKBD_DFLT_KEYMAP)) || \ - !defined(SUNKBD_EMULATE_ATKBD) -#define KBD_DFLT_KEYMAP -#endif - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/bus.h> -#include <sys/interrupt.h> -#include <sys/kbio.h> -#include <sys/kernel.h> -#include <sys/limits.h> - -#include <machine/bus.h> - -#include <dev/kbd/kbdreg.h> -#include <dev/kbd/kbdtables.h> - -#include <dev/uart/uart.h> -#include <dev/uart/uart_bus.h> -#include <dev/uart/uart_cpu.h> - -#include <dev/uart/uart_kbd_sun.h> -#if !defined(SUNKBD_EMULATE_ATKBD) -#include <dev/uart/uart_kbd_sun_tables.h> -#endif - -#if defined(SUNKBD_EMULATE_ATKBD) && defined(SUNKBD_DFLT_KEYMAP) -#include "sunkbdmap.h" -#endif -#include "uart_if.h" - -#define SUNKBD_DRIVER_NAME "sunkbd" - -#define TODO printf("%s: unimplemented", __func__) - -struct sunkbd_softc { - keyboard_t sc_kbd; - struct uart_softc *sc_uart; - struct uart_devinfo *sc_sysdev; - - struct callout sc_repeat_callout; - int sc_repeat_key; - - int sc_accents; - int sc_composed_char; - int sc_flags; -#define KPCOMPOSE (1 << 0) - int sc_mode; - int sc_polling; - int sc_repeating; - int sc_state; - -#if defined(SUNKBD_EMULATE_ATKBD) - int sc_buffered_char[2]; -#endif -}; - -static int sunkbd_configure(int flags); -static int sunkbd_probe_keyboard(struct uart_devinfo *di); - -static int sunkbd_probe(int unit, void *arg, int flags); -static int sunkbd_init(int unit, keyboard_t **kbdp, void *arg, int flags); -static int sunkbd_term(keyboard_t *kbd); -static int sunkbd_intr(keyboard_t *kbd, void *arg); -static int sunkbd_test_if(keyboard_t *kbd); -static int sunkbd_enable(keyboard_t *kbd); -static int sunkbd_disable(keyboard_t *kbd); -static int sunkbd_read(keyboard_t *kbd, int wait); -static int sunkbd_check(keyboard_t *kbd); -static u_int sunkbd_read_char(keyboard_t *kbd, int wait); -static int sunkbd_check_char(keyboard_t *kbd); -static int sunkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t data); -static int sunkbd_lock(keyboard_t *kbd, int lock); -static void sunkbd_clear_state(keyboard_t *kbd); -static int sunkbd_get_state(keyboard_t *kbd, void *buf, size_t len); -static int sunkbd_set_state(keyboard_t *kbd, void *buf, size_t len); -static int sunkbd_poll_mode(keyboard_t *kbd, int on); -static void sunkbd_diag(keyboard_t *kbd, int level); - -static void sunkbd_repeat(void *v); -#if defined(SUNKBD_EMULATE_ATKBD) -static int keycode2scancode(int keycode, int shift, int up); -#endif - -static keyboard_switch_t sunkbdsw = { - .probe = sunkbd_probe, - .init = sunkbd_init, - .term = sunkbd_term, - .intr = sunkbd_intr, - .test_if = sunkbd_test_if, - .enable = sunkbd_enable, - .disable = sunkbd_disable, - .read = sunkbd_read, - .check = sunkbd_check, - .read_char = sunkbd_read_char, - .check_char = sunkbd_check_char, - .ioctl = sunkbd_ioctl, - .lock = sunkbd_lock, - .clear_state = sunkbd_clear_state, - .get_state = sunkbd_get_state, - .set_state = sunkbd_set_state, - .poll = sunkbd_poll_mode, - .diag = sunkbd_diag -}; - -KEYBOARD_DRIVER(sunkbd, sunkbdsw, sunkbd_configure); - -static struct sunkbd_softc sunkbd_softc; -static struct uart_devinfo uart_keyboard; - -#if defined(SUNKBD_EMULATE_ATKBD) - -#define SCAN_PRESS 0x000 -#define SCAN_RELEASE 0x080 -#define SCAN_PREFIX_E0 0x100 -#define SCAN_PREFIX_E1 0x200 -#define SCAN_PREFIX_CTL 0x400 -#define SCAN_PREFIX_SHIFT 0x800 -#define SCAN_PREFIX (SCAN_PREFIX_E0 | SCAN_PREFIX_E1 | \ - SCAN_PREFIX_CTL | SCAN_PREFIX_SHIFT) - -#define NOTR 0x0 /* no translation */ - -static const uint8_t sunkbd_trtab[] = { - NOTR, 0x6d, 0x78, 0x6e, 0x79, 0x3b, 0x3c, 0x44, /* 0x00 - 0x07 */ - 0x3d, 0x57, 0x3e, 0x58, 0x3f, 0x5d, 0x40, NOTR, /* 0x08 - 0x0f */ - 0x41, 0x42, 0x43, 0x38, 0x5f, 0x68, 0x5c, 0x46, /* 0x10 - 0x17 */ - 0x61, 0x6f, 0x70, 0x64, 0x62, 0x01, 0x02, 0x03, /* 0x18 - 0x1f */ - 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, /* 0x20 - 0x27 */ - 0x0c, 0x0d, 0x29, 0x0e, 0x66, 0x77, 0x5b, 0x37, /* 0x28 - 0x2f */ - 0x7a, 0x71, 0x53, 0x74, 0x5e, 0x0f, 0x10, 0x11, /* 0x30 - 0x37 */ - 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, /* 0x38 - 0x3f */ - 0x1a, 0x1b, 0x67, 0x6b, 0x47, 0x48, 0x49, 0x4a, /* 0x40 - 0x47 */ - 0x73, 0x72, 0x63, NOTR, 0x1d, 0x1e, 0x1f, 0x20, /* 0x48 - 0x4f */ - 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, /* 0x50 - 0x57 */ - 0x2b, 0x1c, 0x59, 0x4b, 0x4c, 0x4d, 0x52, 0x75, /* 0x58 - 0x5f */ - 0x60, 0x76, 0x45, 0x2a, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x60 - 0x67 */ - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, NOTR, /* 0x68 - 0x6f */ - 0x4f, 0x50, 0x51, NOTR, NOTR, NOTR, 0x6c, 0x3a, /* 0x70 - 0x77 */ - 0x69, 0x39, 0x6a, 0x65, 0x56, 0x4e, NOTR, NOTR /* 0x78 - 0x7f */ -}; - -#endif - -static int -sunkbd_probe_keyboard(struct uart_devinfo *di) -{ - int c, id, ltries, tries; - - for (tries = 5; tries != 0; tries--) { - uart_putc(di, SKBD_CMD_RESET); - for (ltries = 1000; ltries != 0; ltries--) { - if (uart_poll(di) == SKBD_RSP_RESET) - break; - DELAY(1000); - } - if (ltries == 0) - continue; - id = -1; - for (ltries = 1000; ltries != 0; ltries--) { - switch (c = uart_poll(di)) { - case -1: - break; - case SKBD_RSP_IDLE: - return (id); - default: - id = c; - } - DELAY(1000); - } - } - return (-1); -} - -static int sunkbd_attach(struct uart_softc *sc); -static void sunkbd_uart_intr(void *arg); - -static int -sunkbd_configure(int flags) -{ - struct sunkbd_softc *sc; - - /* - * We are only prepared to be used for the high-level console - * when the keyboard is both configured and attached. - */ - if (!(flags & KB_CONF_PROBE_ONLY)) { - if (KBD_IS_INITIALIZED(&sunkbd_softc.sc_kbd)) - goto found; - else - return (0); - } - - if (uart_cpu_getdev(UART_DEV_KEYBOARD, &uart_keyboard)) - return (0); - if (uart_probe(&uart_keyboard)) - return (0); - uart_init(&uart_keyboard); - - uart_keyboard.type = UART_DEV_KEYBOARD; - uart_keyboard.attach = sunkbd_attach; - uart_add_sysdev(&uart_keyboard); - - if (sunkbd_probe_keyboard(&uart_keyboard) != KB_SUN4) - return (0); - - sc = &sunkbd_softc; - callout_init(&sc->sc_repeat_callout, 0); - sunkbd_clear_state(&sc->sc_kbd); - -#if defined(SUNKBD_EMULATE_ATKBD) - kbd_init_struct(&sc->sc_kbd, SUNKBD_DRIVER_NAME, KB_101, 0, 0, 0, 0); - kbd_set_maps(&sc->sc_kbd, &key_map, &accent_map, fkey_tab, - sizeof(fkey_tab) / sizeof(fkey_tab[0])); -#else - kbd_init_struct(&sc->sc_kbd, SUNKBD_DRIVER_NAME, KB_OTHER, 0, 0, 0, 0); - kbd_set_maps(&sc->sc_kbd, &keymap_sun_us_unix_kbd, - &accentmap_sun_us_unix_kbd, fkey_tab, - sizeof(fkey_tab) / sizeof(fkey_tab[0])); -#endif - sc->sc_mode = K_XLATE; - kbd_register(&sc->sc_kbd); - - sc->sc_sysdev = &uart_keyboard; - - found: - /* Return number of found keyboards. */ - return (1); -} - -static int -sunkbd_attach(struct uart_softc *sc) -{ - - /* - * Don't attach if we didn't probe the keyboard. Note that - * the UART is still marked as a system device in that case. - */ - if (sunkbd_softc.sc_sysdev == NULL) { - device_printf(sc->sc_dev, "keyboard not present\n"); - return (0); - } - - if (sc->sc_sysdev != NULL) { - sunkbd_softc.sc_uart = sc; - -#ifdef KBD_INSTALL_CDEV - kbd_attach(&sunkbd_softc.sc_kbd); -#endif - sunkbd_enable(&sunkbd_softc.sc_kbd); - - swi_add(&tty_intr_event, uart_driver_name, sunkbd_uart_intr, - &sunkbd_softc, SWI_TTY, INTR_TYPE_TTY, &sc->sc_softih); - - sc->sc_opened = 1; - KBD_INIT_DONE(&sunkbd_softc.sc_kbd); - } - - return (0); -} - -static void -sunkbd_uart_intr(void *arg) -{ - struct sunkbd_softc *sc = arg; - int pend; - - if (sc->sc_uart->sc_leaving) - return; - - pend = atomic_readandclear_32(&sc->sc_uart->sc_ttypend); - if (!(pend & SER_INT_MASK)) - return; - - if (pend & SER_INT_RXREADY) { - if (KBD_IS_ACTIVE(&sc->sc_kbd) && KBD_IS_BUSY(&sc->sc_kbd)) { - sc->sc_kbd.kb_callback.kc_func(&sc->sc_kbd, - KBDIO_KEYINPUT, sc->sc_kbd.kb_callback.kc_arg); - } - } -} - -static int -sunkbd_probe(int unit, void *arg, int flags) -{ - - TODO; - return (0); -} - -static int -sunkbd_init(int unit, keyboard_t **kbdp, void *arg, int flags) -{ - - TODO; - return (0); -} - -static int -sunkbd_term(keyboard_t *kbd) -{ - - TODO; - return (0); -} - -static int -sunkbd_intr(keyboard_t *kbd, void *arg) -{ - - TODO; - return (0); -} - -static int -sunkbd_test_if(keyboard_t *kbd) -{ - - TODO; - return (0); -} - -static int -sunkbd_enable(keyboard_t *kbd) -{ - - KBD_ACTIVATE(kbd); - return (0); -} - -static int -sunkbd_disable(keyboard_t *kbd) -{ - - KBD_DEACTIVATE(kbd); - return (0); -} - -static int -sunkbd_read(keyboard_t *kbd, int wait) -{ - - TODO; - return (0); -} - -static int -sunkbd_check(keyboard_t *kbd) -{ - struct sunkbd_softc *sc; - - if (!KBD_IS_ACTIVE(kbd)) - return (FALSE); - - sc = (struct sunkbd_softc *)kbd; - -#if defined(SUNKBD_EMULATE_ATKBD) - if (sc->sc_buffered_char[0]) - return (TRUE); -#endif - - if (sc->sc_repeating) - return (TRUE); - - if (sc->sc_uart != NULL && !uart_rx_empty(sc->sc_uart)) - return (TRUE); - - if (sc->sc_polling != 0 && sc->sc_sysdev != NULL && - uart_rxready(sc->sc_sysdev)) - return (TRUE); - - return (FALSE); -} - -static u_int -sunkbd_read_char(keyboard_t *kbd, int wait) -{ - struct sunkbd_softc *sc; - int key, release, repeated, suncode; - - sc = (struct sunkbd_softc *)kbd; - -#if defined(SUNKBD_EMULATE_ATKBD) - if (sc->sc_mode == K_RAW && sc->sc_buffered_char[0]) { - key = sc->sc_buffered_char[0]; - if (key & SCAN_PREFIX) { - sc->sc_buffered_char[0] = key & ~SCAN_PREFIX; - return ((key & SCAN_PREFIX_E0) ? 0xe0 : 0xe1); - } else { - sc->sc_buffered_char[0] = sc->sc_buffered_char[1]; - sc->sc_buffered_char[1] = 0; - return (key); - } - } -#endif - - repeated = 0; - if (sc->sc_repeating) { - repeated = 1; - sc->sc_repeating = 0; - callout_reset(&sc->sc_repeat_callout, hz / 10, - sunkbd_repeat, sc); - suncode = sc->sc_repeat_key; - goto process_code; - } - - for (;;) { - next_code: - if (!(sc->sc_flags & KPCOMPOSE) && (sc->sc_composed_char > 0)) { - key = sc->sc_composed_char; - sc->sc_composed_char = 0; - if (key > UCHAR_MAX) - return (ERRKEY); - return (key); - } - - if (sc->sc_uart != NULL && !uart_rx_empty(sc->sc_uart)) { - suncode = uart_rx_get(sc->sc_uart); - } else if (sc->sc_polling != 0 && sc->sc_sysdev != NULL) { - if (wait) - suncode = uart_getc(sc->sc_sysdev); - else if ((suncode = uart_poll(sc->sc_sysdev)) == -1) - return (NOKEY); - } else { - return (NOKEY); - } - - switch (suncode) { - case SKBD_RSP_IDLE: - break; - default: - process_code: - ++kbd->kb_count; - key = SKBD_KEY_CHAR(suncode); - release = suncode & SKBD_KEY_RELEASE; - if (!repeated) { - if (release == 0) { - callout_reset(&sc->sc_repeat_callout, - hz / 2, sunkbd_repeat, sc); - sc->sc_repeat_key = suncode; - } else if (sc->sc_repeat_key == key) { - callout_stop(&sc->sc_repeat_callout); - sc->sc_repeat_key = -1; - } - } - -#if defined(SUNKBD_EMULATE_ATKBD) - key = sunkbd_trtab[key]; - if (key == NOTR) - return (NOKEY); - - if (!repeated) { - switch (key) { - case 0x1d: /* ctrl */ - if (release != 0) - sc->sc_flags &= ~CTLS; - else - sc->sc_flags |= CTLS; - break; - case 0x2a: /* left shift */ - case 0x36: /* right shift */ - if (release != 0) - sc->sc_flags &= ~SHIFTS; - else - sc->sc_flags |= SHIFTS; - break; - case 0x38: /* alt */ - case 0x5d: /* altgr */ - if (release != 0) - sc->sc_flags &= ~ALTS; - else - sc->sc_flags |= ALTS; - break; - } - } - if (sc->sc_mode == K_RAW) { - key = keycode2scancode(key, sc->sc_flags, - release); - if (key & SCAN_PREFIX) { - if (key & SCAN_PREFIX_CTL) { - sc->sc_buffered_char[0] = - 0x1d | (key & SCAN_RELEASE); - sc->sc_buffered_char[1] = - key & ~SCAN_PREFIX; - } else if (key & SCAN_PREFIX_SHIFT) { - sc->sc_buffered_char[0] = - 0x2a | (key & SCAN_RELEASE); - sc->sc_buffered_char[1] = - key & ~SCAN_PREFIX_SHIFT; - } else { - sc->sc_buffered_char[0] = - key & ~SCAN_PREFIX; - sc->sc_buffered_char[1] = 0; - } - return ((key & SCAN_PREFIX_E0) ? - 0xe0 : 0xe1); - } - return (key); - } - switch (key) { - case 0x5c: /* print screen */ - if (sc->sc_flags & ALTS) - key = 0x54; /* sysrq */ - break; - case 0x68: /* pause/break */ - if (sc->sc_flags & CTLS) - key = 0x6c; /* break */ - break; - } - - if (sc->sc_mode == K_CODE) - return (key | release); -#else - if (sc->sc_mode == K_RAW || sc->sc_mode == K_CODE) - return (suncode); -#endif - -#if defined(SUNKBD_EMULATE_ATKBD) - if (key == 0x38) { /* left alt (KP compose key) */ -#else - if (key == 0x13) { /* left alt (KP compose key) */ -#endif - if (release != 0) { - if (sc->sc_flags & KPCOMPOSE) { - sc->sc_flags &= ~KPCOMPOSE; - if (sc->sc_composed_char > - UCHAR_MAX) - sc->sc_composed_char = - 0; - } - } else { - if (!(sc->sc_flags & KPCOMPOSE)) { - sc->sc_flags |= KPCOMPOSE; - sc->sc_composed_char = 0; - } - } - } - if (sc->sc_flags & KPCOMPOSE) { - switch (suncode) { - case 0x44: /* KP 7 */ - case 0x45: /* KP 8 */ - case 0x46: /* KP 9 */ - sc->sc_composed_char *= 10; - sc->sc_composed_char += suncode - 0x3d; - if (sc->sc_composed_char > UCHAR_MAX) - return (ERRKEY); - goto next_code; - case 0x5b: /* KP 4 */ - case 0x5c: /* KP 5 */ - case 0x5d: /* KP 6 */ - sc->sc_composed_char *= 10; - sc->sc_composed_char += suncode - 0x58; - if (sc->sc_composed_char > UCHAR_MAX) - return (ERRKEY); - goto next_code; - case 0x70: /* KP 1 */ - case 0x71: /* KP 2 */ - case 0x72: /* KP 3 */ - sc->sc_composed_char *= 10; - sc->sc_composed_char += suncode - 0x6f; - if (sc->sc_composed_char > UCHAR_MAX) - return (ERRKEY); - goto next_code; - case 0x5e: /* KP 0 */ - sc->sc_composed_char *= 10; - if (sc->sc_composed_char > UCHAR_MAX) - return (ERRKEY); - goto next_code; - - case 0x44 | SKBD_KEY_RELEASE: /* KP 7 */ - case 0x45 | SKBD_KEY_RELEASE: /* KP 8 */ - case 0x46 | SKBD_KEY_RELEASE: /* KP 9 */ - case 0x5b | SKBD_KEY_RELEASE: /* KP 4 */ - case 0x5c | SKBD_KEY_RELEASE: /* KP 5 */ - case 0x5d | SKBD_KEY_RELEASE: /* KP 6 */ - case 0x70 | SKBD_KEY_RELEASE: /* KP 1 */ - case 0x71 | SKBD_KEY_RELEASE: /* KP 2 */ - case 0x72 | SKBD_KEY_RELEASE: /* KP 3 */ - case 0x5e | SKBD_KEY_RELEASE: /* KP 0 */ - goto next_code; - default: - if (sc->sc_composed_char > 0) { - sc->sc_flags &= ~KPCOMPOSE; - sc->sc_composed_char = 0; - return (ERRKEY); - } - } - } - - key = genkbd_keyaction(kbd, key, release, - &sc->sc_state, &sc->sc_accents); - if (key != NOKEY || repeated) - return (key); - } - } - return (0); -} - -static int -sunkbd_check_char(keyboard_t *kbd) -{ - struct sunkbd_softc *sc; - - if (!KBD_IS_ACTIVE(kbd)) - return (FALSE); - - sc = (struct sunkbd_softc *)kbd; - if (!(sc->sc_flags & KPCOMPOSE) && (sc->sc_composed_char > 0)) - return (TRUE); - - return (sunkbd_check(kbd)); -} - -static int -sunkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t data) -{ - struct sunkbd_softc *sc; - int c, error; -#if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) - int ival; -#endif - - sc = (struct sunkbd_softc *)kbd; - error = 0; - switch (cmd) { - case KDGKBMODE: - *(int *)data = sc->sc_mode; - break; -#if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) - case _IO('K', 7): - ival = IOCPARM_IVAL(data); - data = (caddr_t)&ival; - /* FALLTHROUGH */ -#endif - case KDSKBMODE: - switch (*(int *)data) { - case K_XLATE: - if (sc->sc_mode != K_XLATE) { - /* make lock key state and LED state match */ - sc->sc_state &= ~LOCK_MASK; - sc->sc_state |= KBD_LED_VAL(kbd); - } - /* FALLTHROUGH */ - case K_RAW: - case K_CODE: - if (sc->sc_mode != *(int *)data) { - sunkbd_clear_state(kbd); - sc->sc_mode = *(int *)data; - } - break; - default: - error = EINVAL; - break; - } - break; - case KDGETLED: - *(int *)data = KBD_LED_VAL(kbd); - break; -#if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) - case _IO('K', 66): - ival = IOCPARM_IVAL(data); - data = (caddr_t)&ival; - /* FALLTHROUGH */ -#endif - case KDSETLED: - if (*(int *)data & ~LOCK_MASK) { - error = EINVAL; - break; - } - if (sc->sc_sysdev == NULL) - break; - c = 0; - if (*(int *)data & CLKED) - c |= SKBD_LED_CAPSLOCK; - if (*(int *)data & NLKED) - c |= SKBD_LED_NUMLOCK; - if (*(int *)data & SLKED) - c |= SKBD_LED_SCROLLLOCK; - uart_lock(sc->sc_sysdev->hwmtx); - sc->sc_sysdev->ops->putc(&sc->sc_sysdev->bas, SKBD_CMD_SETLED); - sc->sc_sysdev->ops->putc(&sc->sc_sysdev->bas, c); - uart_unlock(sc->sc_sysdev->hwmtx); - KBD_LED_VAL(kbd) = *(int *)data; - break; - case KDGKBSTATE: - *(int *)data = sc->sc_state & LOCK_MASK; - break; -#if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) - case _IO('K', 20): - ival = IOCPARM_IVAL(data); - data = (caddr_t)&ival; - /* FALLTHROUGH */ -#endif - case KDSKBSTATE: - if (*(int *)data & ~LOCK_MASK) { - error = EINVAL; - break; - } - sc->sc_state &= ~LOCK_MASK; - sc->sc_state |= *(int *)data; - /* set LEDs and quit */ - return (sunkbd_ioctl(kbd, KDSETLED, data)); - case KDSETREPEAT: - case KDSETRAD: - break; - case PIO_KEYMAP: - case OPIO_KEYMAP: - case PIO_KEYMAPENT: - case PIO_DEADKEYMAP: - default: - return (genkbd_commonioctl(kbd, cmd, data)); - } - return (error); -} - -static int -sunkbd_lock(keyboard_t *kbd, int lock) -{ - - TODO; - return (0); -} - -static void -sunkbd_clear_state(keyboard_t *kbd) -{ - struct sunkbd_softc *sc; - - sc = (struct sunkbd_softc *)kbd; - sc->sc_repeat_key = -1; - sc->sc_accents = 0; - sc->sc_composed_char = 0; - sc->sc_flags = 0; - sc->sc_polling = 0; - sc->sc_repeating = 0; - sc->sc_state &= LOCK_MASK; /* Preserve locking key state. */ - -#if defined(SUNKBD_EMULATE_ATKBD) - sc->sc_buffered_char[0] = 0; - sc->sc_buffered_char[1] = 0; -#endif -} - -static int -sunkbd_get_state(keyboard_t *kbd, void *buf, size_t len) -{ - - TODO; - return (0); -} - -static int -sunkbd_set_state(keyboard_t *kbd, void *buf, size_t len) -{ - - TODO; - return (0); -} - -static int -sunkbd_poll_mode(keyboard_t *kbd, int on) -{ - struct sunkbd_softc *sc; - - sc = (struct sunkbd_softc *)kbd; - if (on) - sc->sc_polling++; - else - sc->sc_polling--; - return (0); -} - -static void -sunkbd_diag(keyboard_t *kbd, int level) -{ - - TODO; -} - -static void -sunkbd_repeat(void *v) -{ - struct sunkbd_softc *sc = v; - - if (KBD_IS_ACTIVE(&sc->sc_kbd) && KBD_IS_BUSY(&sc->sc_kbd)) { - if (sc->sc_repeat_key != -1) { - sc->sc_repeating = 1; - sc->sc_kbd.kb_callback.kc_func(&sc->sc_kbd, - KBDIO_KEYINPUT, sc->sc_kbd.kb_callback.kc_arg); - } - } -} - -#if defined(SUNKBD_EMULATE_ATKBD) -static int -keycode2scancode(int keycode, int shift, int up) -{ - static const int scan[] = { - /* KP enter, right ctrl, KP divide */ - 0x1c , 0x1d , 0x35 , - /* print screen */ - 0x37 | SCAN_PREFIX_SHIFT, - /* right alt, home, up, page up, left, right, end */ - 0x38, 0x47, 0x48, 0x49, 0x4b, 0x4d, 0x4f, - /* down, page down, insert, delete */ - 0x50, 0x51, 0x52, 0x53, - /* pause/break (see also below) */ - 0x46, - /* - * MS: left window, right window, menu - * also Sun: left meta, right meta, compose - */ - 0x5b, 0x5c, 0x5d, - /* Sun type 6 USB */ - /* help, stop, again, props, undo, front, copy */ - 0x68, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, - /* open, paste, find, cut, audiomute, audiolower, audioraise */ - 0x64, 0x65, 0x66, 0x67, 0x25, 0x1f, 0x1e, - /* power */ - 0x20 - }; - int scancode; - - scancode = keycode; - if ((keycode >= 89) && (keycode < 89 + nitems(scan))) - scancode = scan[keycode - 89] | SCAN_PREFIX_E0; - /* pause/break */ - if ((keycode == 104) && !(shift & CTLS)) - scancode = 0x45 | SCAN_PREFIX_E1 | SCAN_PREFIX_CTL; - if (shift & SHIFTS) - scancode &= ~SCAN_PREFIX_SHIFT; - return (scancode | (up ? SCAN_RELEASE : SCAN_PRESS)); -} -#endif diff --git a/sys/dev/uart/uart_kbd_sun.h b/sys/dev/uart/uart_kbd_sun.h deleted file mode 100644 index 05a4597930f9..000000000000 --- a/sys/dev/uart/uart_kbd_sun.h +++ /dev/null @@ -1,70 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-4-Clause - * - * Copyright (c) 2002 Jason L. Wright (jason@thought.net) - * 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 Jason L. Wright - * 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. - * - * Effort sponsored in part by the Defense Advanced Research Projects - * Agency (DARPA) and Air Force Research Laboratory, Air Force - * Materiel Command, USAF, under agreement number F30602-01-2-0537. - * - * $FreeBSD$ - */ - -/* keyboard commands (host->kbd) */ -#define SKBD_CMD_RESET 0x01 -#define SKBD_CMD_BELLON 0x02 -#define SKBD_CMD_BELLOFF 0x03 -#define SKBD_CMD_CLICKON 0x0a -#define SKBD_CMD_CLICKOFF 0x0b -#define SKBD_CMD_SETLED 0x0e -#define SKBD_CMD_LAYOUT 0x0f - -/* keyboard responses (kbd->host) */ -#define SKBD_RSP_RESET_OK 0x04 /* normal reset status for type 4/5/6 */ -#define SKBD_RSP_IDLE 0x7f /* no keys down */ -#define SKBD_RSP_LAYOUT 0xfe /* layout follows */ -#define SKBD_RSP_RESET 0xff /* reset status follows */ - -#define SKBD_LED_NUMLOCK 0x01 -#define SKBD_LED_COMPOSE 0x02 -#define SKBD_LED_SCROLLLOCK 0x04 -#define SKBD_LED_CAPSLOCK 0x08 - -#define SKBD_STATE_RESET 0 -#define SKBD_STATE_LAYOUT 1 -#define SKBD_STATE_GETKEY 2 - -/* keyboard types */ -#define KB_SUN2 2 /* type 2 keyboard */ -#define KB_SUN3 3 /* type 3 keyboard */ -#define KB_SUN4 4 /* type 4/5/6 keyboard */ - -#define SKBD_KEY_RELEASE 0x80 -#define SKBD_KEY_CHAR(c) ((c) & 0x7f) diff --git a/sys/dev/uart/uart_kbd_sun_tables.h b/sys/dev/uart/uart_kbd_sun_tables.h deleted file mode 100644 index e7dc61205104..000000000000 --- a/sys/dev/uart/uart_kbd_sun_tables.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Automatically generated from sun.us.unix.kbd. - * DO NOT EDIT! - * - * $FreeBSD$ - */ -static keymap_t keymap_sun_us_unix_kbd = { 0x80, { -/* alt - * scan cntrl alt alt cntrl - * code base shift cntrl shift alt shift cntrl shift spcl flgs - * --------------------------------------------------------------------------- - */ -/*00*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 }, -/*01*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*02*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*03*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*04*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*05*/{{ F( 1), F(13), F(25), F(37), S( 1), S(11), S( 1), S(11),}, 0xFF,0x00 }, -/*06*/{{ F( 2), F(14), F(26), F(38), S( 2), S(12), S( 2), S(12),}, 0xFF,0x00 }, -/*07*/{{ F(10), F(22), F(34), F(46), S(10), S(10), S(10), S(10),}, 0xFF,0x00 }, -/*08*/{{ F( 3), F(15), F(27), F(39), S( 3), S(13), S( 3), S(13),}, 0xFF,0x00 }, -/*09*/{{ F(11), F(23), F(35), F(47), S(11), S(11), S(11), S(11),}, 0xFF,0x00 }, -/*0a*/{{ F( 4), F(16), F(28), F(40), S( 4), S(14), S( 4), S(14),}, 0xFF,0x00 }, -/*0b*/{{ F(12), F(24), F(36), F(48), S(12), S(12), S(12), S(12),}, 0xFF,0x00 }, -/*0c*/{{ F( 5), F(17), F(29), F(41), S( 5), S(15), S( 5), S(15),}, 0xFF,0x00 }, -/*0d*/{{ RALT, RALT, RALT, RALT, RALT, RALT, RALT, RALT, }, 0xFF,0x00 }, -/*0e*/{{ F( 6), F(18), F(30), F(42), S( 6), S(16), S( 6), S(16),}, 0xFF,0x00 }, -/*0f*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 }, -/*10*/{{ F( 7), F(19), F(31), F(43), S( 7), S( 7), S( 7), S( 7),}, 0xFF,0x00 }, -/*11*/{{ F( 8), F(20), F(32), F(44), S( 8), S( 8), S( 8), S( 8),}, 0xFF,0x00 }, -/*12*/{{ F( 9), F(21), F(33), F(45), S( 9), S( 9), S( 9), S( 9),}, 0xFF,0x00 }, -/*13*/{{ LALT, LALT, LALT, LALT, LALT, LALT, LALT, LALT, }, 0xFF,0x00 }, -/*14*/{{ F(50), F(50), F(50), F(50), F(50), F(50), F(50), F(50),}, 0xFF,0x00 }, -/*15*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*16*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*17*/{{ SLK, SPSC, SLK, SPSC, SUSP, NOP, SUSP, NOP, }, 0xFF,0x00 }, -/*18*/{{ F(53), F(53), F(53), F(53), F(53), F(53), F(53), F(53),}, 0xFF,0x00 }, -/*19*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*1a*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*1b*/{{ F(58), F(58), F(58), F(58), F(58), F(58), F(58), F(58),}, 0xFF,0x00 }, -/*1c*/{{ F(55), F(55), F(55), F(55), F(55), F(55), F(55), F(55),}, 0xFF,0x00 }, -/*1d*/{{ 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, DBG, 0x1B, }, 0x02,0x00 }, -/*1e*/{{ '1', '!', NOP, NOP, '1', '!', NOP, NOP, }, 0x33,0x00 }, -/*1f*/{{ '2', '@', 0x00, 0x00, '2', '@', 0x00, 0x00, }, 0x00,0x00 }, -/*20*/{{ '3', '#', NOP, NOP, '3', '#', NOP, NOP, }, 0x33,0x00 }, -/*21*/{{ '4', '$', NOP, NOP, '4', '$', NOP, NOP, }, 0x33,0x00 }, -/*22*/{{ '5', '%', NOP, NOP, '5', '%', NOP, NOP, }, 0x33,0x00 }, -/*23*/{{ '6', '^', 0x1E, 0x1E, '6', '^', 0x1E, 0x1E, }, 0x00,0x00 }, -/*24*/{{ '7', '&', NOP, NOP, '7', '&', NOP, NOP, }, 0x33,0x00 }, -/*25*/{{ '8', '*', NOP, NOP, '8', '*', NOP, NOP, }, 0x33,0x00 }, -/*26*/{{ '9', '(', NOP, NOP, '9', '(', NOP, NOP, }, 0x33,0x00 }, -/*27*/{{ '0', ')', NOP, NOP, '0', ')', NOP, NOP, }, 0x33,0x00 }, -/*28*/{{ '-', '_', 0x1F, 0x1F, '-', '_', 0x1F, 0x1F, }, 0x00,0x00 }, -/*29*/{{ '=', '+', NOP, NOP, '=', '+', NOP, NOP, }, 0x33,0x00 }, -/*2a*/{{ '`', '~', NOP, NOP, '`', '~', DBG, NOP, }, 0x33,0x00 }, -/*2b*/{{ 0x7F, 0x7F, 0x08, 0x08, 0x7F, 0x7F, 0x08, 0x08, }, 0x00,0x00 }, -/*2c*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*2d*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*2e*/{{ '/', '/', '/', '/', '/', '/', '/', '/', }, 0x00,0x02 }, -/*2f*/{{ '*', '*', '*', '*', '*', '*', '*', '*', }, 0x00,0x00 }, -/*30*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 }, -/*31*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*32*/{{ 0x08, '.', '.', '.', '.', '.', RBT, RBT, }, 0x03,0x02 }, -/*33*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*34*/{{ F(49), F(49), F(49), F(49), F(49), F(49), F(49), F(49),}, 0xFF,0x00 }, -/*35*/{{ 0x09, BTAB, NOP, NOP, 0x09, BTAB, NOP, NOP, }, 0x77,0x00 }, -/*36*/{{ 'q', 'Q', 0x11, 0x11, 'q', 'Q', 0x11, 0x11, }, 0x00,0x01 }, -/*37*/{{ 'w', 'W', 0x17, 0x17, 'w', 'W', 0x17, 0x17, }, 0x00,0x01 }, -/*38*/{{ 'e', 'E', 0x05, 0x05, 'e', 'E', 0x05, 0x05, }, 0x00,0x01 }, -/*39*/{{ 'r', 'R', 0x12, 0x12, 'r', 'R', 0x12, 0x12, }, 0x00,0x01 }, -/*3a*/{{ 't', 'T', 0x14, 0x14, 't', 'T', 0x14, 0x14, }, 0x00,0x01 }, -/*3b*/{{ 'y', 'Y', 0x19, 0x19, 'y', 'Y', 0x19, 0x19, }, 0x00,0x01 }, -/*3c*/{{ 'u', 'U', 0x15, 0x15, 'u', 'U', 0x15, 0x15, }, 0x00,0x01 }, -/*3d*/{{ 'i', 'I', 0x09, 0x09, 'i', 'I', 0x09, 0x09, }, 0x00,0x01 }, -/*3e*/{{ 'o', 'O', 0x0F, 0x0F, 'o', 'O', 0x0F, 0x0F, }, 0x00,0x01 }, -/*3f*/{{ 'p', 'P', 0x10, 0x10, 'p', 'P', 0x10, 0x10, }, 0x00,0x01 }, -/*40*/{{ '[', '{', 0x1B, 0x1B, '[', '{', 0x1B, 0x1B, }, 0x00,0x00 }, -/*41*/{{ ']', '}', 0x1D, 0x1D, ']', '}', 0x1D, 0x1D, }, 0x00,0x00 }, -/*42*/{{ 0x7F, 0x7F, 0x08, 0x08, 0x7F, 0x7F, 0x08, 0x08, }, 0x00,0x00 }, -/*43*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*44*/{{ F(49), '7', '7', '7', '7', '7', '7', '7', }, 0x80,0x02 }, -/*45*/{{ F(50), '8', '8', '8', '8', '8', '8', '8', }, 0x80,0x02 }, -/*46*/{{ F(51), '9', '9', '9', '9', '9', '9', '9', }, 0x80,0x02 }, -/*47*/{{ F(52), '-', '-', '-', '-', '-', '-', '-', }, 0x80,0x02 }, -/*48*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*49*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*4a*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*4b*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 }, -/*4c*/{{ LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, }, 0xFF,0x00 }, -/*4d*/{{ 'a', 'A', 0x01, 0x01, 'a', 'A', 0x01, 0x01, }, 0x00,0x01 }, -/*4e*/{{ 's', 'S', 0x13, 0x13, 's', 'S', 0x13, 0x13, }, 0x00,0x01 }, -/*4f*/{{ 'd', 'D', 0x04, 0x04, 'd', 'D', 0x04, 0x04, }, 0x00,0x01 }, -/*50*/{{ 'f', 'F', 0x06, 0x06, 'f', 'F', 0x06, 0x06, }, 0x00,0x01 }, -/*51*/{{ 'g', 'G', 0x07, 0x07, 'g', 'G', 0x07, 0x07, }, 0x00,0x01 }, -/*52*/{{ 'h', 'H', 0x08, 0x08, 'h', 'H', 0x08, 0x08, }, 0x00,0x01 }, -/*53*/{{ 'j', 'J', 0x0A, 0x0A, 'j', 'J', 0x0A, 0x0A, }, 0x00,0x01 }, -/*54*/{{ 'k', 'K', 0x0B, 0x0B, 'k', 'K', 0x0B, 0x0B, }, 0x00,0x01 }, -/*55*/{{ 'l', 'L', 0x0C, 0x0C, 'l', 'L', 0x0C, 0x0C, }, 0x00,0x01 }, -/*56*/{{ ';', ':', NOP, NOP, ';', ':', NOP, NOP, }, 0x33,0x00 }, -/*57*/{{ '\'', '"', NOP, NOP, '\'', '"', NOP, NOP, }, 0x33,0x00 }, -/*58*/{{ '\\', '|', 0x1C, 0x1C, '\\', '|', 0x1C, 0x1C, }, 0x00,0x00 }, -/*59*/{{ 0x0D, 0x0D, 0x0A, 0x0A, 0x0D, 0x0D, 0x0A, 0x0A, }, 0x00,0x00 }, -/*5a*/{{ 0x0D, 0x0D, 0x0A, 0x0A, 0x0D, 0x0D, 0x0A, 0x0A, }, 0x00,0x00 }, -/*5b*/{{ F(53), '4', '4', '4', '4', '4', '4', '4', }, 0x80,0x02 }, -/*5c*/{{ F(54), '5', '5', '5', '5', '5', '5', '5', }, 0x80,0x02 }, -/*5d*/{{ F(55), '6', '6', '6', '6', '6', '6', '6', }, 0x80,0x02 }, -/*5e*/{{ F(60), '0', '0', '0', '0', '0', '0', '0', }, 0x80,0x02 }, -/*5f*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*60*/{{ F(51), F(51), F(51), F(51), F(51), F(51), F(51), F(51),}, 0xFF,0x00 }, -/*61*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*62*/{{ NLK, NLK, NLK, NLK, NLK, NLK, NLK, NLK, }, 0xFF,0x00 }, -/*63*/{{ LSH, LSH, LSH, LSH, LSH, LSH, LSH, LSH, }, 0xFF,0x00 }, -/*64*/{{ 'z', 'Z', 0x1A, 0x1A, 'z', 'Z', 0x1A, 0x1A, }, 0x00,0x01 }, -/*65*/{{ 'x', 'X', 0x18, 0x18, 'x', 'X', 0x18, 0x18, }, 0x00,0x01 }, -/*66*/{{ 'c', 'C', 0x03, 0x03, 'c', 'C', 0x03, 0x03, }, 0x00,0x01 }, -/*67*/{{ 'v', 'V', 0x16, 0x16, 'v', 'V', 0x16, 0x16, }, 0x00,0x01 }, -/*68*/{{ 'b', 'B', 0x02, 0x02, 'b', 'B', 0x02, 0x02, }, 0x00,0x01 }, -/*69*/{{ 'n', 'N', 0x0E, 0x0E, 'n', 'N', 0x0E, 0x0E, }, 0x00,0x01 }, -/*6a*/{{ 'm', 'M', 0x0D, 0x0D, 'm', 'M', 0x0D, 0x0D, }, 0x00,0x01 }, -/*6b*/{{ ',', '<', NOP, NOP, ',', '<', NOP, NOP, }, 0x33,0x00 }, -/*6c*/{{ '.', '>', NOP, NOP, '.', '>', NOP, NOP, }, 0x33,0x00 }, -/*6d*/{{ '/', '?', NOP, NOP, '/', '?', NOP, NOP, }, 0x33,0x00 }, -/*6e*/{{ RSH, RSH, RSH, RSH, RSH, RSH, RSH, RSH, }, 0xFF,0x00 }, -/*6f*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*70*/{{ F(57), '1', '1', '1', '1', '1', '1', '1', }, 0x80,0x02 }, -/*71*/{{ F(58), '2', '2', '2', '2', '2', '2', '2', }, 0x80,0x02 }, -/*72*/{{ F(59), '3', '3', '3', '3', '3', '3', '3', }, 0x80,0x02 }, -/*73*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 }, -/*74*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 }, -/*75*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 }, -/*76*/{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, 0x00,0x00 }, -/*77*/{{ CLK, CLK, CLK, CLK, CLK, CLK, CLK, CLK, }, 0xFF,0x00 }, -/*78*/{{ META, META, META, META, META, META, META, META, }, 0xFF,0x00 }, -/*79*/{{ ' ', ' ', 0x00, ' ', ' ', ' ', SUSP, ' ', }, 0x02,0x00 }, -/*7a*/{{ META, META, META, META, META, META, META, META, }, 0xFF,0x00 }, -/*7b*/{{ F(59), F(59), F(59), F(59), F(59), F(59), F(59), F(59),}, 0xFF,0x00 }, -/*7c*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 }, -/*7d*/{{ F(56), '+', '+', '+', '+', '+', '+', '+', }, 0x80,0x02 }, -/*7e*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 }, -/*7f*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 }, -} }; - -static accentmap_t accentmap_sun_us_unix_kbd = { 0 }; - |
