summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/conf/files.sparc641
-rw-r--r--sys/dev/uart/uart_kbd_sun.c529
-rw-r--r--sys/dev/uart/uart_kbd_sun.h65
-rw-r--r--sys/dev/uart/uart_kbd_sun_tables.h144
4 files changed, 739 insertions, 0 deletions
diff --git a/sys/conf/files.sparc64 b/sys/conf/files.sparc64
index 9befc1f..62d44a5 100644
--- a/sys/conf/files.sparc64
+++ b/sys/conf/files.sparc64
@@ -33,6 +33,7 @@ dev/syscons/scvtb.c optional sc
dev/syscons/syscons.c optional sc
dev/syscons/sysmouse.c optional sc
dev/uart/uart_cpu_sparc64.c optional uart
+dev/uart/uart_kbd_sun.c optional uart sc
geom/geom_bsd.c standard
geom/geom_bsd_enc.c standard
geom/geom_sunlabel.c standard
diff --git a/sys/dev/uart/uart_kbd_sun.c b/sys/dev/uart/uart_kbd_sun.c
new file mode 100644
index 0000000..7b99ec2
--- /dev/null
+++ b/sys/dev/uart/uart_kbd_sun.c
@@ -0,0 +1,529 @@
+/*-
+ * 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.
+ *
+ * $FreeBSD$
+ */
+
+#include "opt_kbd.h"
+
+#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/malloc.h>
+#include <sys/ktr.h>
+
+#include <machine/bus.h>
+#include <machine/resource.h>
+
+#include <sys/rman.h>
+
+#include <dev/kbd/kbdreg.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>
+#include <dev/uart/uart_kbd_sun_tables.h>
+
+#include "uart_if.h"
+
+#define SUNKBD_BUF_SIZE 128
+
+#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_mode;
+ int sc_polling;
+ int sc_repeating;
+ int sc_state;
+};
+
+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);
+
+static keyboard_switch_t sunkbdsw = {
+ sunkbd_probe,
+ sunkbd_init,
+ sunkbd_term,
+ sunkbd_intr,
+ sunkbd_test_if,
+ sunkbd_enable,
+ sunkbd_disable,
+ sunkbd_read,
+ sunkbd_check,
+ sunkbd_read_char,
+ sunkbd_check_char,
+ sunkbd_ioctl,
+ sunkbd_lock,
+ sunkbd_clear_state,
+ sunkbd_get_state,
+ sunkbd_set_state,
+ genkbd_get_fkeystr,
+ sunkbd_poll_mode,
+ sunkbd_diag
+};
+
+KEYBOARD_DRIVER(sunkbd, sunkbdsw, sunkbd_configure);
+
+static struct sunkbd_softc sunkbd_softc;
+static struct uart_devinfo uart_keyboard;
+
+static fkeytab_t fkey_tab[96] = {
+/* 01-04 */ {"\033[M", 3}, {"\033[N", 3}, {"\033[O", 3}, {"\033[P", 3},
+/* 05-08 */ {"\033[Q", 3}, {"\033[R", 3}, {"\033[S", 3}, {"\033[T", 3},
+/* 09-12 */ {"\033[U", 3}, {"\033[V", 3}, {"\033[W", 3}, {"\033[X", 3},
+/* 13-16 */ {"\033[Y", 3}, {"\033[Z", 3}, {"\033[a", 3}, {"\033[b", 3},
+/* 17-20 */ {"\033[c", 3}, {"\033[d", 3}, {"\033[e", 3}, {"\033[f", 3},
+/* 21-24 */ {"\033[g", 3}, {"\033[h", 3}, {"\033[i", 3}, {"\033[j", 3},
+/* 25-28 */ {"\033[k", 3}, {"\033[l", 3}, {"\033[m", 3}, {"\033[n", 3},
+/* 29-32 */ {"\033[o", 3}, {"\033[p", 3}, {"\033[q", 3}, {"\033[r", 3},
+/* 33-36 */ {"\033[s", 3}, {"\033[t", 3}, {"\033[u", 3}, {"\033[v", 3},
+/* 37-40 */ {"\033[w", 3}, {"\033[x", 3}, {"\033[y", 3}, {"\033[z", 3},
+/* 41-44 */ {"\033[@", 3}, {"\033[[", 3}, {"\033[\\",3}, {"\033[]", 3},
+/* 45-48 */ {"\033[^", 3}, {"\033[_", 3}, {"\033[`", 3}, {"\033[{", 3},
+/* 49-52 */ {"\033[H", 3}, {"\033[A", 3}, {"\033[I", 3}, {"-" , 1},
+/* 53-56 */ {"\033[D", 3}, {"\033[E", 3}, {"\033[C", 3}, {"+" , 1},
+/* 57-60 */ {"\033[F", 3}, {"\033[B", 3}, {"\033[G", 3}, {"\033[L", 3},
+/* 61-64 */ {"\177", 1}, {"\033[J", 3}, {"\033[~", 3}, {"\033[}", 3},
+/* 65-68 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} ,
+/* 69-72 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} ,
+/* 73-76 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} ,
+/* 77-80 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} ,
+/* 81-84 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} ,
+/* 85-88 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} ,
+/* 89-92 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} ,
+/* 93-96 */ {"", 0} , {"", 0} , {"", 0} , {"", 0}
+};
+
+static int
+sunkbd_probe_keyboard(struct uart_devinfo *di)
+{
+ int tries;
+
+ for (tries = 5; tries != 0; tries--) {
+ int ltries;
+
+ 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;
+ for (ltries = 1000; ltries != 0; ltries--) {
+ if (uart_poll(di) == SKBD_RSP_IDLE)
+ break;
+ DELAY(1000);
+ }
+ if (ltries == 0)
+ continue;
+ uart_putc(di, SKBD_CMD_LAYOUT);
+ if (uart_getc(di) != SKBD_RSP_LAYOUT)
+ break;
+ return (uart_getc(di));
+ }
+ 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;
+
+ if (uart_cpu_getdev(UART_DEV_KEYBOARD, &uart_keyboard))
+ return (0);
+ if (uart_probe(&uart_keyboard))
+ return (0);
+ uart_init(&uart_keyboard);
+ if (sunkbd_probe_keyboard(&uart_keyboard) == -1)
+ return (0);
+ uart_keyboard.type = UART_DEV_KEYBOARD;
+ uart_keyboard.attach = sunkbd_attach;
+ uart_add_sysdev(&uart_keyboard);
+
+ sc = &sunkbd_softc;
+ callout_init(&sc->sc_repeat_callout, 0);
+ sc->sc_repeat_key = -1;
+ sc->sc_repeating = 0;
+
+ kbd_init_struct(&sc->sc_kbd, "sunkbd", 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]));
+ sc->sc_mode = K_XLATE;
+ kbd_register(&sc->sc_kbd);
+
+ sc->sc_sysdev = &uart_keyboard;
+
+ return (0);
+}
+
+static int
+sunkbd_attach(struct uart_softc *sc)
+{
+
+ if (sc->sc_sysdev != NULL) {
+ sunkbd_softc.sc_uart = sc;
+
+ kbd_attach(&sunkbd_softc.sc_kbd);
+ sunkbd_enable(&sunkbd_softc.sc_kbd);
+
+ swi_add(&tty_ithd, uart_driver_name, sunkbd_uart_intr,
+ &sunkbd_softc, SWI_TTY, INTR_TYPE_TTY, &sc->sc_softih);
+
+ sc->sc_opened = 1;
+ }
+
+ 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 & UART_IPEND_MASK))
+ return;
+
+ if (pend & UART_IPEND_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)
+{
+ TODO;
+ return (0);
+}
+
+static u_int
+sunkbd_read_char(keyboard_t *kbd, int wait)
+{
+ struct sunkbd_softc *sc;
+ int action;
+ int key;
+
+ sc = (struct sunkbd_softc *)kbd;
+ if (sc->sc_repeating) {
+ sc->sc_repeating = 0;
+ callout_reset(&sc->sc_repeat_callout, hz / 10,
+ sunkbd_repeat, sc);
+ key = sc->sc_repeat_key;
+ if (sc->sc_mode == K_RAW)
+ return (key);
+ else
+ return genkbd_keyaction(kbd, key & 0x7f, key & 0x80,
+ &sc->sc_state, &sc->sc_accents);
+ }
+
+ for (;;) {
+ /* XXX compose */
+
+ if (sc->sc_uart != NULL && !uart_rx_empty(sc->sc_uart)) {
+ key = uart_rx_get(sc->sc_uart);
+ } else if (sc->sc_polling != 0 && sc->sc_sysdev != NULL) {
+ if (wait)
+ key = uart_getc(sc->sc_sysdev);
+ else if ((key = uart_poll(sc->sc_sysdev)) == -1)
+ return (NOKEY);
+ } else {
+ return (NOKEY);
+ }
+
+ switch (key) {
+ case SKBD_RSP_IDLE:
+ break;
+ default:
+ ++kbd->kb_count;
+
+ if ((key & 0x80) == 0) {
+ callout_reset(&sc->sc_repeat_callout, hz / 2,
+ sunkbd_repeat, sc);
+ sc->sc_repeat_key = key;
+ } else {
+ if (sc->sc_repeat_key == (key & 0x7f)) {
+ callout_stop(&sc->sc_repeat_callout);
+ sc->sc_repeat_key = -1;
+ }
+ }
+
+ if (sc->sc_mode == K_RAW)
+ return (key);
+
+ action = genkbd_keyaction(kbd, key & 0x7f, key & 0x80,
+ &sc->sc_state, &sc->sc_accents);
+ if (action != NOKEY)
+ return (action);
+ break;
+ }
+ }
+ return (0);
+}
+
+static int
+sunkbd_check_char(keyboard_t *kbd)
+{
+ TODO;
+ return (0);
+}
+
+static int
+sunkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t data)
+{
+ struct sunkbd_softc *sc;
+ int error;
+
+ sc = (struct sunkbd_softc *)kbd;
+ error = 0;
+ switch (cmd) {
+ case KDGKBMODE:
+ *(int *)data = sc->sc_mode;
+ break;
+ 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;
+ case KDSETLED:
+ if (*(int *)data & ~LOCK_MASK) {
+ error = EINVAL;
+ break;
+ }
+ if (sc->sc_uart == NULL)
+ break;
+ sc->sc_uart->sc_txdatasz = 2;
+ sc->sc_uart->sc_txbuf[0] = SKBD_CMD_SETLED;
+ sc->sc_uart->sc_txbuf[1] = 0;
+ if (*(int *)data & CLKED)
+ sc->sc_uart->sc_txbuf[1] |= SKBD_LED_CAPSLOCK;
+ if (*(int *)data & NLKED)
+ sc->sc_uart->sc_txbuf[1] |= SKBD_LED_NUMLOCK;
+ if (*(int *)data & SLKED)
+ sc->sc_uart->sc_txbuf[1] |= SKBD_LED_SCROLLLOCK;
+ UART_TRANSMIT(sc->sc_uart);
+ KBD_LED_VAL(kbd) = *(int *)data;
+ break;
+ case KDGKBSTATE:
+ *(int *)data = sc->sc_state & LOCK_MASK;
+ break;
+ case KDSKBSTATE:
+ if (*(int *)data & ~LOCK_MASK) {
+ error = EINVAL;
+ break;
+ }
+ sc->sc_state &= ~LOCK_MASK;
+ sc->sc_state |= *(int *)data;
+ break;
+ case KDSETREPEAT:
+ case KDSETRAD:
+ break;
+ case PIO_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)
+{
+ /* TODO; */
+}
+
+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 (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);
+ }
+}
diff --git a/sys/dev/uart/uart_kbd_sun.h b/sys/dev/uart/uart_kbd_sun.h
new file mode 100644
index 0000000..574e966
--- /dev/null
+++ b/sys/dev/uart/uart_kbd_sun.h
@@ -0,0 +1,65 @@
+/*
+ * 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 */
diff --git a/sys/dev/uart/uart_kbd_sun_tables.h b/sys/dev/uart/uart_kbd_sun_tables.h
new file mode 100644
index 0000000..e7dc612
--- /dev/null
+++ b/sys/dev/uart/uart_kbd_sun_tables.h
@@ -0,0 +1,144 @@
+/*
+ * 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 };
+
OpenPOWER on IntegriCloud