PERFORCE change 127077 for review
John Birrell
jb at FreeBSD.org
Mon Oct 1 17:35:24 PDT 2007
http://perforce.freebsd.org/chv.cgi?CH=127077
Change 127077 by jb at jb_freebsd1 on 2007/10/02 00:34:56
IF6
Affected files ...
.. //depot/projects/dtrace6/src/etc/rc.d/kerberos#2 integrate
.. //depot/projects/dtrace6/src/sbin/tunefs/tunefs.8#2 integrate
.. //depot/projects/dtrace6/src/sys/compat/ia32/ia32_sysvec.c#2 integrate
.. //depot/projects/dtrace6/src/sys/conf/files.sparc64#2 integrate
.. //depot/projects/dtrace6/src/sys/conf/options.sparc64#2 integrate
.. //depot/projects/dtrace6/src/sys/dev/acpica/acpi_cpu.c#2 integrate
.. //depot/projects/dtrace6/src/sys/dev/syscons/syscons.c#2 integrate
.. //depot/projects/dtrace6/src/sys/dev/uart/uart_kbd_sun.c#2 integrate
.. //depot/projects/dtrace6/src/sys/dev/uart/uart_kbd_sun.h#2 integrate
.. //depot/projects/dtrace6/src/sys/i386/isa/pcvt/pcvt_ext.c#2 integrate
.. //depot/projects/dtrace6/src/sys/sparc64/conf/NOTES#2 integrate
Differences ...
==== //depot/projects/dtrace6/src/etc/rc.d/kerberos#2 (text+ko) ====
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $FreeBSD: src/etc/rc.d/kerberos,v 1.4.2.1 2005/09/25 18:45:56 rwatson Exp $
+# $FreeBSD: src/etc/rc.d/kerberos,v 1.4.2.2 2007/10/01 23:37:39 mtm Exp $
#
# PROVIDE: kerberos
@@ -12,6 +12,6 @@
load_rc_config $name
rcvar="kerberos5_server_enable"
command="${kerberos5_server}"
-command_args="${kerberos5_server_flags} &"
+command_args="${kerberos5_server_flags} --detach"
run_rc_command "$1"
==== //depot/projects/dtrace6/src/sbin/tunefs/tunefs.8#2 (text+ko) ====
@@ -26,9 +26,9 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)tunefs.8 8.2 (Berkeley) 12/11/93
-.\" $FreeBSD: src/sbin/tunefs/tunefs.8,v 1.36 2005/02/13 22:25:17 ru Exp $
+.\" $FreeBSD: src/sbin/tunefs/tunefs.8,v 1.36.2.1 2007/09/29 16:31:44 maxim Exp $
.\"
-.Dd May 18, 2002
+.Dd August 13, 2007
.Dt TUNEFS 8
.Os
.Sh NAME
@@ -162,6 +162,8 @@
.Bx 4.2 .
.Sh BUGS
This utility should work on active file systems.
+To change the root file system, the system must be rebooted
+after the file system is tuned.
.\" Take this out and a Unix Daemon will dog your steps from now until
.\" the time_t's wrap around.
.Pp
==== //depot/projects/dtrace6/src/sys/compat/ia32/ia32_sysvec.c#2 (text+ko) ====
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/ia32/ia32_sysvec.c,v 1.20.2.1 2007/05/23 18:24:43 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/ia32/ia32_sysvec.c,v 1.20.2.2 2007/10/01 20:13:49 jhb Exp $");
#include "opt_compat.h"
@@ -272,10 +272,13 @@
static u_long ia32_maxdsiz = IA32_MAXDSIZ;
SYSCTL_ULONG(_compat_ia32, OID_AUTO, maxdsiz, CTLFLAG_RW, &ia32_maxdsiz, 0, "");
+TUNABLE_ULONG("compat.ia32.maxdsiz", &ia32_maxdsiz);
static u_long ia32_maxssiz = IA32_MAXSSIZ;
SYSCTL_ULONG(_compat_ia32, OID_AUTO, maxssiz, CTLFLAG_RW, &ia32_maxssiz, 0, "");
+TUNABLE_ULONG("compat.ia32.maxssiz", &ia32_maxssiz);
static u_long ia32_maxvmem = IA32_MAXVMEM;
SYSCTL_ULONG(_compat_ia32, OID_AUTO, maxvmem, CTLFLAG_RW, &ia32_maxvmem, 0, "");
+TUNABLE_ULONG("compat.ia32.maxvmem", &ia32_maxvmem);
static void
ia32_fixlimit(struct rlimit *rl, int which)
==== //depot/projects/dtrace6/src/sys/conf/files.sparc64#2 (text+ko) ====
@@ -1,7 +1,7 @@
# This file tells config what files go into building a kernel,
# files marked standard are always included.
#
-# $FreeBSD: src/sys/conf/files.sparc64,v 1.73.2.3 2006/07/11 16:34:38 sam Exp $
+# $FreeBSD: src/sys/conf/files.sparc64,v 1.73.2.4 2007/09/30 19:33:19 marius Exp $
#
# The long compile-with and dependency lines are required because of
# limitations in config: backslash-newline doesn't work in strings, and
@@ -12,6 +12,11 @@
no-obj no-implicit-rule before-depend \
clean "atkbdmap.h"
#
+sunkbdmap.h optional sunkbd_dflt_keymap \
+ compile-with "/usr/sbin/kbdcontrol -L ${SUNKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > sunkbdmap.h" \
+ no-obj no-implicit-rule before-depend \
+ clean "sunkbdmap.h"
+#
ukbdmap.h optional ukbd_dflt_keymap \
compile-with "/usr/sbin/kbdcontrol -L ${UKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > ukbdmap.h" \
no-obj no-implicit-rule before-depend \
==== //depot/projects/dtrace6/src/sys/conf/options.sparc64#2 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/options.sparc64,v 1.13 2005/06/10 20:58:59 marius Exp $
+# $FreeBSD: src/sys/conf/options.sparc64,v 1.13.2.1 2007/09/30 19:33:19 marius Exp $
SUN4U opt_global.h
@@ -18,3 +18,5 @@
PSM_DEBUG opt_psm.h
PSM_HOOKRESUME opt_psm.h
PSM_RESETAFTERSUSPEND opt_psm.h
+SUNKBD_DFLT_KEYMAP opt_sunkbd.h
+SUNKBD_EMULATE_ATKBD opt_sunkbd.h
==== //depot/projects/dtrace6/src/sys/dev/acpica/acpi_cpu.c#2 (text+ko) ====
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_cpu.c,v 1.57.2.3 2007/06/11 18:54:09 njl Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_cpu.c,v 1.57.2.4 2007/09/29 23:13:38 rpaulo Exp $");
#include "opt_acpi.h"
#include <sys/param.h>
@@ -257,7 +257,7 @@
acpi_cpu_attach(device_t dev)
{
ACPI_BUFFER buf;
- ACPI_OBJECT arg, *obj;
+ ACPI_OBJECT arg[4], *obj;
ACPI_OBJECT_LIST arglist;
struct pcpu *pcpu_data;
struct acpi_cpu_softc *sc;
@@ -268,6 +268,11 @@
driver_t **drivers;
uint32_t cap_set[3];
+ /* UUID needed by _OSC evaluation */
+ static uint8_t cpu_oscuuid[16] = { 0x16, 0xA6, 0x77, 0x40, 0x0C, 0x29,
+ 0xBE, 0x47, 0x9E, 0xBD, 0xD8, 0x70,
+ 0x58, 0x71, 0x39, 0x53 };
+
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
sc = device_get_softc(dev);
@@ -334,19 +339,39 @@
/*
* CPU capabilities are specified as a buffer of 32-bit integers:
* revision, count, and one or more capabilities. The revision of
- * "1" is not specified anywhere but seems to match Linux. We should
- * also support _OSC here.
+ * "1" is not specified anywhere but seems to match Linux.
*/
if (sc->cpu_features) {
- arglist.Pointer = &arg;
+ arglist.Pointer = arg;
arglist.Count = 1;
- arg.Type = ACPI_TYPE_BUFFER;
- arg.Buffer.Length = sizeof(cap_set);
- arg.Buffer.Pointer = (uint8_t *)cap_set;
+ arg[0].Type = ACPI_TYPE_BUFFER;
+ arg[0].Buffer.Length = sizeof(cap_set);
+ arg[0].Buffer.Pointer = (uint8_t *)cap_set;
cap_set[0] = 1; /* revision */
cap_set[1] = 1; /* number of capabilities integers */
cap_set[2] = sc->cpu_features;
AcpiEvaluateObject(sc->cpu_handle, "_PDC", &arglist, NULL);
+
+ /*
+ * On some systems we need to evaluate _OSC so that the ASL
+ * loads the _PSS and/or _PDC methods at runtime.
+ *
+ * TODO: evaluate failure of _OSC.
+ */
+ arglist.Pointer = arg;
+ arglist.Count = 4;
+ arg[0].Type = ACPI_TYPE_BUFFER;
+ arg[0].Buffer.Length = sizeof(cpu_oscuuid);
+ arg[0].Buffer.Pointer = cpu_oscuuid; /* UUID */
+ arg[1].Type = ACPI_TYPE_INTEGER;
+ arg[1].Integer.Value = 1; /* revision */
+ arg[2].Type = ACPI_TYPE_INTEGER;
+ arg[2].Integer.Value = 1; /* count */
+ arg[3].Type = ACPI_TYPE_BUFFER;
+ arg[3].Buffer.Length = sizeof(cap_set); /* Capabilities buffer */
+ arg[3].Buffer.Pointer = (uint8_t *)cap_set;
+ cap_set[0] = 0;
+ AcpiEvaluateObject(sc->cpu_handle, "_OSC", &arglist, NULL);
}
/* Probe for Cx state support. */
==== //depot/projects/dtrace6/src/sys/dev/syscons/syscons.c#2 (text+ko) ====
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/syscons/syscons.c,v 1.436.2.8 2006/11/27 14:37:09 ru Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/syscons/syscons.c,v 1.436.2.9 2007/09/30 06:16:20 marcus Exp $");
#include "opt_syscons.h"
#include "opt_splash.h"
@@ -1060,8 +1060,7 @@
scp = sc_get_stat(SC_DEV(sc, i));
if (scp == scp->sc->cur_scp)
return 0;
- while ((error=tsleep(&scp->smode, PZERO|PCATCH,
- "waitvt", 0)) == ERESTART) ;
+ error = tsleep(&scp->smode, PZERO | PCATCH, "waitvt", 0);
return error;
case VT_GETACTIVE: /* get active vty # */
==== //depot/projects/dtrace6/src/sys/dev/uart/uart_kbd_sun.c#2 (text+ko) ====
@@ -25,9 +25,15 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/uart/uart_kbd_sun.c,v 1.5.2.3 2006/10/04 06:09:09 ru Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/uart/uart_kbd_sun.c,v 1.5.2.4 2007/09/30 19:33:19 marius Exp $");
#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>
@@ -35,26 +41,30 @@
#include <sys/interrupt.h>
#include <sys/kbio.h>
#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/ktr.h>
+#include <sys/limits.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
#include <machine/bus.h>
-#include <machine/resource.h>
-
-#include <sys/rman.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_BUF_SIZE 128
+#define SUNKBD_DRIVER_NAME "sunkbd"
#define TODO printf("%s: unimplemented", __func__)
@@ -63,14 +73,23 @@
struct uart_softc *sc_uart;
struct uart_devinfo *sc_sysdev;
+ int sc_checked_key;
+
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);
@@ -96,6 +115,9 @@
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 = {
sunkbd_probe,
@@ -124,41 +146,46 @@
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}
+#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 tries;
+ int c, id, ltries, 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)
@@ -167,17 +194,18 @@
}
if (ltries == 0)
continue;
+ id = -1;
for (ltries = 1000; ltries != 0; ltries--) {
- if (uart_poll(di) == SKBD_RSP_IDLE)
+ switch (c = uart_poll(di)) {
+ case -1:
break;
+ case SKBD_RSP_IDLE:
+ return (id);
+ default:
+ id = c;
+ }
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);
}
@@ -211,18 +239,23 @@
uart_keyboard.attach = sunkbd_attach;
uart_add_sysdev(&uart_keyboard);
- if (sunkbd_probe_keyboard(&uart_keyboard) == -1)
+ if (sunkbd_probe_keyboard(&uart_keyboard) != KB_SUN4)
return (0);
sc = &sunkbd_softc;
callout_init(&sc->sc_repeat_callout, 0);
- sc->sc_repeat_key = -1;
- sc->sc_repeating = 0;
+ sunkbd_clear_state(&sc->sc_kbd);
- kbd_init_struct(&sc->sc_kbd, "sunkbd", KB_OTHER, 0, 0, 0, 0);
+#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);
@@ -283,12 +316,12 @@
KBDIO_KEYINPUT, sc->sc_kbd.kb_callback.kc_arg);
}
}
-
}
static int
sunkbd_probe(int unit, void *arg, int flags)
{
+
TODO;
return (0);
}
@@ -296,6 +329,7 @@
static int
sunkbd_init(int unit, keyboard_t **kbdp, void *arg, int flags)
{
+
TODO;
return (0);
}
@@ -303,6 +337,7 @@
static int
sunkbd_term(keyboard_t *kbd)
{
+
TODO;
return (0);
}
@@ -310,6 +345,7 @@
static int
sunkbd_intr(keyboard_t *kbd, void *arg)
{
+
TODO;
return (0);
}
@@ -317,6 +353,7 @@
static int
sunkbd_test_if(keyboard_t *kbd)
{
+
TODO;
return (0);
}
@@ -324,6 +361,7 @@
static int
sunkbd_enable(keyboard_t *kbd)
{
+
KBD_ACTIVATE(kbd);
return (0);
}
@@ -331,6 +369,7 @@
static int
sunkbd_disable(keyboard_t *kbd)
{
+
KBD_DEACTIVATE(kbd);
return (0);
}
@@ -338,6 +377,7 @@
static int
sunkbd_read(keyboard_t *kbd, int wait)
{
+
TODO;
return (0);
}
@@ -345,69 +385,256 @@
static int
sunkbd_check(keyboard_t *kbd)
{
- TODO;
- return (0);
+ 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 &&
+ (sc->sc_checked_key = uart_poll(sc->sc_sysdev)) != -1)
+ return (TRUE);
+
+ return (FALSE);
}
static u_int
sunkbd_read_char(keyboard_t *kbd, int wait)
{
struct sunkbd_softc *sc;
- int action;
- int key;
+ 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);
- 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);
+ suncode = sc->sc_repeat_key;
+ goto process_code;
+ }
+
+ if (sc->sc_checked_key != -1) {
+ suncode = sc->sc_checked_key;
+ sc->sc_checked_key = -1;
+ goto process_code;
}
for (;;) {
- /* XXX compose */
+ 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)) {
- key = uart_rx_get(sc->sc_uart);
+ suncode = 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)
+ suncode = uart_getc(sc->sc_sysdev);
+ else if ((suncode = uart_poll(sc->sc_sysdev)) == -1)
return (NOKEY);
} else {
return (NOKEY);
}
- switch (key) {
+ switch (suncode) {
case SKBD_RSP_IDLE:
break;
default:
+ process_code:
++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)) {
+ 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 (sc->sc_mode == K_RAW)
+#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
- action = genkbd_keyaction(kbd, key & 0x7f, key & 0x80,
+#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 (action != NOKEY)
- return (action);
- break;
+ if (key != NOKEY || repeated)
+ return (key);
}
}
return (0);
@@ -416,16 +643,23 @@
static int
sunkbd_check_char(keyboard_t *kbd)
{
- TODO;
- return (0);
+ 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 error;
- int ival;
+ int c, error, ival;
sc = (struct sunkbd_softc *)kbd;
error = 0;
@@ -470,18 +704,19 @@
error = EINVAL;
break;
}
- if (sc->sc_uart == NULL)
+ if (sc->sc_sysdev == NULL)
break;
- sc->sc_uart->sc_txdatasz = 2;
- sc->sc_uart->sc_txbuf[0] = SKBD_CMD_SETLED;
- sc->sc_uart->sc_txbuf[1] = 0;
+ c = 0;
if (*(int *)data & CLKED)
- sc->sc_uart->sc_txbuf[1] |= SKBD_LED_CAPSLOCK;
+ c |= SKBD_LED_CAPSLOCK;
if (*(int *)data & NLKED)
- sc->sc_uart->sc_txbuf[1] |= SKBD_LED_NUMLOCK;
+ c |= SKBD_LED_NUMLOCK;
if (*(int *)data & SLKED)
- sc->sc_uart->sc_txbuf[1] |= SKBD_LED_SCROLLLOCK;
- UART_TRANSMIT(sc->sc_uart);
+ c |= SKBD_LED_SCROLLLOCK;
+ mtx_lock_spin(&sc->sc_uart->sc_hwmtx);
+ sc->sc_sysdev->ops.putc(&sc->sc_sysdev->bas, SKBD_CMD_SETLED);
+ sc->sc_sysdev->ops.putc(&sc->sc_sysdev->bas, c);
+ mtx_unlock_spin(&sc->sc_uart->sc_hwmtx);
KBD_LED_VAL(kbd) = *(int *)data;
break;
case KDGKBSTATE:
@@ -515,6 +750,7 @@
static int
sunkbd_lock(keyboard_t *kbd, int lock)
{
+
TODO;
return (0);
}
@@ -522,12 +758,28 @@
static void
sunkbd_clear_state(keyboard_t *kbd)
{
- /* TODO; */
+ struct sunkbd_softc *sc;
+
+ sc = (struct sunkbd_softc *)kbd;
+ sc->sc_checked_key = -1;
+ 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);
}
@@ -535,6 +787,7 @@
static int
sunkbd_set_state(keyboard_t *kbd, void *buf, size_t len)
{
+
TODO;
return (0);
}
@@ -555,6 +808,7 @@
static void
sunkbd_diag(keyboard_t *kbd, int level)
{
+
TODO;
}
@@ -571,3 +825,45 @@
}
}
}
+
+#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 + sizeof(scan) / sizeof(scan[0])))
+ 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
==== //depot/projects/dtrace6/src/sys/dev/uart/uart_kbd_sun.h#2 (text+ko) ====
@@ -32,7 +32,7 @@
* Agency (DARPA) and Air Force Research Laboratory, Air Force
* Materiel Command, USAF, under agreement number F30602-01-2-0537.
*
- * $FreeBSD: src/sys/dev/uart/uart_kbd_sun.h,v 1.2 2005/01/06 01:43:26 imp Exp $
+ * $FreeBSD: src/sys/dev/uart/uart_kbd_sun.h,v 1.2.2.1 2007/09/30 19:33:19 marius Exp $
*/
/* keyboard commands (host->kbd) */
@@ -63,3 +63,6 @@
#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)
==== //depot/projects/dtrace6/src/sys/i386/isa/pcvt/pcvt_ext.c#2 (text+ko) ====
@@ -44,7 +44,7 @@
*
* Last Edit-Date: [Fri Mar 8 19:57:55 2002]
*
- * $FreeBSD: src/sys/i386/isa/pcvt/pcvt_ext.c,v 1.35 2005/01/06 22:18:17 imp Exp $
+ * $FreeBSD: src/sys/i386/isa/pcvt/pcvt_ext.c,v 1.35.2.1 2007/09/30 06:22:13 marcus Exp $
*
*---------------------------------------------------------------------------*/
@@ -2590,26 +2590,20 @@
/* sleep until vt switch happened */
i = *(int *)data - 1;
- if(i != -1
- && (i < 0 || i >= PCVT_NSCREENS))
+ if(i == -1)
+ i = minor(dev);
+
+ if(i < 0 || i >= PCVT_NSCREENS)
return EINVAL;
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list