Print this page
NEX-16819 loader UEFI support
Includes work by Toomas Soome <tsoome@me.com>
Upstream commits:
loader: pxe receive cleanup
9475 libefi: Do not return only if ReceiveFilter
installboot: should support efi system partition
8931 boot1.efi: scan all display modes rather than
loader: spinconsole updates
loader: gfx experiment to try GOP Blt() function.
sha1 build test
loader: add sha1 hash calculation
common/sha1: update for loader build
loader: biosdisk rework
uts: 32-bit kernel FB needs mapping in low memory
uts: add diag-device
uts: boot console mirror with diag-device
uts: enable very early console on ttya
kmdb: add diag-device as input/output device
uts: test VGA memory exclusion from mapping
uts: clear boot mapping and protect boot pages test
uts: add dboot map debug printf
uts: need to release FB pages in release_bootstrap()
uts: add screenmap ioctl
uts: update sys/queue.h
loader: add illumos uts/common to include path
loader: tem/gfx font cleanup
loader: vbe checks
uts: gfx_private set KD_TEXT when KD_RESETTEXT is
uts: gfx 8-bit update
loader: gfx 8-bit fix
loader: always set media size from partition.
uts: MB2 support for 32-bit kernel
loader: x86 should have tem 80x25
uts: x86 should have tem 80x25
uts: font update
loader: font update
uts: tem attributes
loader: tem.c comment added
uts: use font module
loader: add font module
loader: build rules for new font setup
uts: gfx_private update for new font structure
uts: early boot update for new font structure
uts: font update
uts: font build rules update for new fonts
uts: tem update to new font structure
loader: module.c needs to include tem_impl.h
uts: gfx_private 8x16 font rework
uts: make font_lookup public
loader: font rework
uts: font rework
9259 libefi: efi_alloc_and_read should check for PMBR
uts: tem utf-8 support
loader: implement tem utf-8 support
loader: tem should be able to display UTF-8
7784 uts: console input should support utf-8
7796 uts: ldterm default to utf-8
uts: do not reset serial console
uts: set up colors even if tem is not console
uts: add type for early boot properties
uts: gfx_private experiment with drm and vga
uts: gfx_private should use setmode drm callback.
uts: identify FB types and set up gfx_private based
loader: replace gop and vesa with framebuffer
uts: boot needs simple tem to support mdb
uts: boot_keyboard should emit esc sequences for
uts: gfx_private FB showuld be written by line
kmdb: set terminal window size
uts: gfx_private needs to keep track of early boot FB
pnglite: move pnglite to usr/src/common
loader: gfx_fb
ficl-sys: add gfx primitives
loader: add illumos.png logo
ficl: add fb-putimage
loader: add png support
loader: add alpha blending for gfx_fb
loader: use term-drawrect for menu frame
ficl: add simple gfx words
uts: provide fb_info via fbgattr dev_specific array.
uts: gfx_private add alpha blending
uts: update sys/ascii.h
uts: tem OSC support (incomplete)
uts: implement env module support and use data from
uts: tem get colors from early boot data
loader: use crc32 from libstand (libz)
loader: optimize for size
loader: pass tem info to the environment
loader: import tem for loader console
loader: UEFI loader needs to set ISADIR based on
loader: need UEFI32 support
8918 loader.efi: add vesa edid support
uts: tem_safe_pix_clear_prom_output() should only
uts: tem_safe_pix_clear_entire_screen() should use
uts: tem_safe_check_first_time() should query cursor
uts: tem implement cls callback & visual_io v4
uts: gfx_vgatext use block cursor for vgatext
uts: gfx_private implement cls callback & visual_io
uts: gfx_private bitmap framebuffer implementation
uts: early start frame buffer console support
uts: font functions should check the input char
uts: font rendering should support 16/24/32bit depths
uts: use smallest font as fallback default.
uts: update terminal dimensions based on selected
7834 uts: vgatext should use gfx_private
uts: add spacing property to 8859-1.bdf
terminfo: add underline for sun-color
terminfo: sun-color has 16 colors
uts: add font load callback type
loader: do not repeat int13 calls with error 0x20 and
8905 loader: add skein/edonr support
8904 common/crypto: make skein and edonr loader
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Revert "NEX-16819 loader UEFI support"
This reverts commit ec06b9fc617b99234e538bf2e7e4d02a24993e0c.
Reverting due to failures in the zfs-tests and the sharefs-tests
NEX-16819 loader UEFI support
Includes work by Toomas Soome <tsoome@me.com>
Upstream commits:
loader: pxe receive cleanup
9475 libefi: Do not return only if ReceiveFilter
installboot: should support efi system partition
8931 boot1.efi: scan all display modes rather than
loader: spinconsole updates
loader: gfx experiment to try GOP Blt() function.
sha1 build test
loader: add sha1 hash calculation
common/sha1: update for loader build
loader: biosdisk rework
uts: 32-bit kernel FB needs mapping in low memory
uts: add diag-device
uts: boot console mirror with diag-device
uts: enable very early console on ttya
kmdb: add diag-device as input/output device
uts: test VGA memory exclusion from mapping
uts: clear boot mapping and protect boot pages test
uts: add dboot map debug printf
uts: need to release FB pages in release_bootstrap()
uts: add screenmap ioctl
uts: update sys/queue.h
loader: add illumos uts/common to include path
loader: tem/gfx font cleanup
loader: vbe checks
uts: gfx_private set KD_TEXT when KD_RESETTEXT is
uts: gfx 8-bit update
loader: gfx 8-bit fix
loader: always set media size from partition.
uts: MB2 support for 32-bit kernel
loader: x86 should have tem 80x25
uts: x86 should have tem 80x25
uts: font update
loader: font update
uts: tem attributes
loader: tem.c comment added
uts: use font module
loader: add font module
loader: build rules for new font setup
uts: gfx_private update for new font structure
uts: early boot update for new font structure
uts: font update
uts: font build rules update for new fonts
uts: tem update to new font structure
loader: module.c needs to include tem_impl.h
uts: gfx_private 8x16 font rework
uts: make font_lookup public
loader: font rework
uts: font rework
libefi: efi_alloc_and_read should check for PMBR
uts: tem utf-8 support
loader: implement tem utf-8 support
loader: tem should be able to display UTF-8
7784 uts: console input should support utf-8
7796 uts: ldterm default to utf-8
uts: do not reset serial console
uts: set up colors even if tem is not console
uts: add type for early boot properties
uts: gfx_private experiment with drm and vga
uts: gfx_private should use setmode drm callback.
uts: identify FB types and set up gfx_private based
loader: replace gop and vesa with framebuffer
uts: boot needs simple tem to support mdb
uts: boot_keyboard should emit esc sequences for
uts: gfx_private FB showuld be written by line
kmdb: set terminal window size
uts: gfx_private needs to keep track of early boot FB
pnglite: move pnglite to usr/src/common
loader: gfx_fb
ficl-sys: add gfx primitives
loader: add illumos.png logo
ficl: add fb-putimage
loader: add png support
loader: add alpha blending for gfx_fb
loader: use term-drawrect for menu frame
ficl: add simple gfx words
uts: provide fb_info via fbgattr dev_specific array.
uts: gfx_private add alpha blending
uts: update sys/ascii.h
uts: tem OSC support (incomplete)
uts: implement env module support and use data from
uts: tem get colors from early boot data
loader: use crc32 from libstand (libz)
loader: optimize for size
loader: pass tem info to the environment
loader: import tem for loader console
loader: UEFI loader needs to set ISADIR based on
loader: need UEFI32 support
8918 loader.efi: add vesa edid support
uts: tem_safe_pix_clear_prom_output() should only
uts: tem_safe_pix_clear_entire_screen() should use
uts: tem_safe_check_first_time() should query cursor
uts: tem implement cls callback & visual_io v4
uts: gfx_vgatext use block cursor for vgatext
uts: gfx_private implement cls callback & visual_io
uts: gfx_private bitmap framebuffer implementation
uts: early start frame buffer console support
uts: font functions should check the input char
uts: font rendering should support 16/24/32bit depths
uts: use smallest font as fallback default.
uts: update terminal dimensions based on selected
7834 uts: vgatext should use gfx_private
uts: add spacing property to 8859-1.bdf
terminfo: add underline for sun-color
terminfo: sun-color has 16 colors
uts: add font load callback type
loader: do not repeat int13 calls with error 0x20 and
8905 loader: add skein/edonr support
8904 common/crypto: make skein and edonr loader
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/io/kbtrans/kbtrans.c
+++ new/usr/src/uts/common/io/kbtrans/kbtrans.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License, Version 1.0 only
6 6 * (the "License"). You may not use this file except in compliance
7 7 * with the License.
8 8 *
9 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 * or http://www.opensolaris.org/os/licensing.
11 11 * See the License for the specific language governing permissions
12 12 * and limitations under the License.
13 13 *
14 14 * When distributing Covered Code, include this CDDL HEADER in each
15 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 * If applicable, add the following below this CDDL HEADER, with the
|
↓ open down ↓ |
16 lines elided |
↑ open up ↑ |
17 17 * fields enclosed by brackets "[]" replaced with your own identifying
18 18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 19 *
20 20 * CDDL HEADER END
21 21 */
22 22 /*
23 23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 25 */
26 26
27 -#pragma ident "%Z%%M% %I% %E% SMI"
28 -
29 27 /*
30 28 * Generic keyboard support: translation
31 29 *
32 30 * This module is project private. Please see PSARC/1998/176 and
33 31 * PSARC/1998/026 for references to the kbtrans module.
34 32 *
35 33 * It is believed that it is safe to call these functions within debugger mode
36 34 * except kbtrans_dprintf. Debugger mode is a single threaded mode where most
37 35 * kernel services are not available, including memory allocation. Debugger
38 36 * mode is for kmdb and OBP debugging, where the debugger calls back into the
39 37 * kernel to obtain console input.
40 38 *
41 39 * Please be _very_ careful about what external functions you call.
42 40 */
43 41
44 42 #define KEYMAP_SIZE_VARIABLE
45 43
46 44 #include <sys/types.h>
47 45 #include <sys/cred.h>
48 46 #include <sys/ddi.h>
49 47 #include <sys/sunddi.h>
50 48 #include <sys/kmem.h>
51 49 #include <sys/kbd.h>
52 50 #include <sys/cmn_err.h>
53 51 #include <sys/modctl.h>
54 52 #include <sys/kbio.h>
55 53 #include <sys/vuid_event.h>
|
↓ open down ↓ |
17 lines elided |
↑ open up ↑ |
56 54 #include <sys/consdev.h>
57 55 #include <sys/kbtrans.h>
58 56 #include <sys/errno.h>
59 57 #include <sys/promif.h>
60 58 #include <sys/varargs.h>
61 59 #include "kbtrans_lower.h"
62 60
63 61 /*
64 62 * Internal Function Prototypes
65 63 */
66 -static boolean_t kbtrans_do_compose(struct kbtrans_lower *, ushort_t,
67 - ushort_t, ushort_t *);
68 -static void kbtrans_translate(struct kbtrans_lower *,
69 - struct keyboard_callback *, kbtrans_key_t,
70 - enum keystate);
64 +static boolean_t kbtrans_do_compose(struct kbtrans_lower *, keymap_entry_t,
65 + keymap_entry_t, keymap_entry_t *);
66 +static void kbtrans_translate(struct kbtrans_lower *,
67 + struct keyboard_callback *, kbtrans_key_t, enum keystate);
68 +
71 69 /*
72 70 * kbtrans_processkey:
73 71 *
74 72 * lower - state information used by the calling driver
75 73 * this parameter is passed back to the callback routines.
76 74 * key - scancode
77 75 * state - KEY_PRESSED / KEY_RELEASED
78 76 *
79 77 * This routine checks to see if there is a raw callback, and calls it
80 78 * if it exists. If there is no raw callback, the key is translated.
81 79 * The raw callback allows the driver that called the translation module
82 80 * to be passed untranslated scancodes.
83 81 */
84 82 void
85 83 kbtrans_processkey(struct kbtrans_lower *lower,
86 - struct keyboard_callback *cb,
87 - kbtrans_key_t key,
88 - enum keystate state)
84 + struct keyboard_callback *cb, kbtrans_key_t key, enum keystate state)
89 85 {
90 86 DPRINTF(PRINT_L0, PRINT_MASK_ALL, (lower, "kbtrans_processkey: "
91 - "newstate=%d key=%d", state, key));
87 + "newstate=%d key=%d", state, key));
92 88
93 89 /*
94 90 * If there is a raw routine, then call it and return.
95 91 */
96 92 if (cb->kc_keypressed_raw != NULL) {
97 93
98 94 if (state == KEY_PRESSED) {
99 95
100 96 cb->kc_keypressed_raw(lower->kbtrans_upper, key);
101 97 } else {
102 98
103 99 cb->kc_keyreleased_raw(lower->kbtrans_upper, key);
104 100 }
105 101
106 102 return;
107 103 }
108 104
109 105 /*
110 106 * translate the scancode into a key.
111 107 */
112 108 kbtrans_translate(lower, cb, key, state);
113 109 }
114 110
115 111
116 112 /*
117 113 * kbtrans_translate:
118 114 *
|
↓ open down ↓ |
17 lines elided |
↑ open up ↑ |
119 115 * lower - state information used by the calling driver
120 116 * this parameter is passed back to the callback routines.
121 117 * key - scan code
122 118 * state - KEY_PRESSED / KEY_RELEASED
123 119 *
124 120 * Called to process key events if we are in TR_ASCII or TR_EVENT
125 121 * (sunview) mode. This routine will call the appropriate translation_callback
126 122 * for the character when it is done translating it.
127 123 */
128 124 static void
129 -kbtrans_translate(struct kbtrans_lower *lower,
130 - struct keyboard_callback *cb,
131 - kbtrans_key_t key,
132 - enum keystate newstate)
125 +kbtrans_translate(struct kbtrans_lower *lower, struct keyboard_callback *cb,
126 + kbtrans_key_t key, enum keystate newstate)
133 127 {
134 128 unsigned shiftmask;
135 - register ushort_t entry;
136 - register ushort_t entrytype;
137 - ushort_t result_iso;
138 - unsigned short *ke;
129 + register keymap_entry_t entry;
130 + register unsigned entrytype;
131 + keymap_entry_t result;
132 + keymap_entry_t *ke;
139 133 int i;
140 134 boolean_t good_compose;
141 135
142 136 DPRINTF(PRINT_L0, PRINT_MASK_ALL, (lower, "KEY TRANSLATE "
143 - "newstate=0x%x key=0x%x\n", newstate, key));
137 + "newstate=0x%x key=0x%x\n", newstate, key));
144 138
145 139 if (lower->kbtrans_keyboard == NULL) {
146 140 /*
147 141 * Nobody has told us about this keyboard yet.
148 142 */
149 143 return;
150 144 }
151 145
152 146 /*
153 147 * Get the current state of the shiftmask
154 148 */
155 149 shiftmask = lower->kbtrans_shiftmask;
156 150
157 151 /*
158 152 * If the key has been released, then or in the UPMASK flag.
159 153 */
160 154 if (newstate == KEY_RELEASED)
161 155 shiftmask |= UPMASK;
162 156
163 157 /*
164 158 * Based on the shiftmask, lookup the keymap entry that we should
165 159 * be using for this scancode.
166 160 */
167 161 ke = kbtrans_find_entry(lower, shiftmask, key);
168 162
169 163 if (ke == NULL) {
170 164 /*
171 165 * This is a gross error. Cancel the repeat key and exit,
172 166 * we can not translate this scancode.
173 167 */
174 168 cb->kc_cancel_repeat(lower->kbtrans_upper);
175 169
176 170 return;
177 171 }
178 172
179 173 /*
180 174 * Get the key for this scancode.
|
↓ open down ↓ |
27 lines elided |
↑ open up ↑ |
181 175 */
182 176 entry = *ke;
183 177
184 178 if (entry == NONL) {
185 179 /*
186 180 * NONL appears only in the Num Lock table, and indicates that
187 181 * this key is not affected by Num Lock. This means we should
188 182 * ask for the table we would have gotten had Num Lock not been
189 183 * down, and translate using that table.
190 184 */
191 - ke = kbtrans_find_entry(lower, shiftmask & ~NUMLOCKMASK,
192 - key);
185 + ke = kbtrans_find_entry(lower, shiftmask & ~NUMLOCKMASK, key);
193 186
194 187 if (ke == NULL) {
195 188 /*
196 189 * This is a gross error. Cancel the repeat key and
197 190 * exit, we can not translate this scancode.
198 191 */
199 192 cb->kc_cancel_repeat(lower->kbtrans_upper);
200 193
201 194 return;
202 195 }
203 196
204 197 /*
|
↓ open down ↓ |
2 lines elided |
↑ open up ↑ |
205 198 * Get the new key for this scancode.
206 199 */
207 200 entry = *ke;
208 201 }
209 202
210 203 /*
211 204 * The entrytype indicates what category of key we are processing.
212 205 * Categories include shift keys, function keys, and numeric keypad
213 206 * keys.
214 207 */
215 - entrytype = (ushort_t)(entry & 0xFF00);
208 + entrytype = KEYFLAGS(entry);
216 209
217 210 if (entrytype == SHIFTKEYS) {
218 211 /*
219 212 * Handle the state of toggle shifts specially.
220 213 * Ups should be ignored, and downs should be mapped to ups if
221 214 * that shift is currently on.
222 215 */
223 216 if ((1 << (entry & 0x0F)) &
224 217 lower->kbtrans_keyboard->k_toggleshifts) {
225 - if ((1 << (entry & 0x0F)) &
226 - lower->kbtrans_togglemask) {
218 + if ((1 << (entry & 0x0F)) & lower->kbtrans_togglemask) {
227 219 newstate = KEY_RELEASED; /* toggling off */
228 220 } else {
229 221 newstate = KEY_PRESSED; /* toggling on */
230 222 }
231 223 }
232 224 } else {
233 225 /*
234 226 * Handle Compose and floating accent key sequences
235 227 */
236 228 switch (lower->kbtrans_state) {
237 229 case COMPOSE1:
238 230 if (newstate == KEY_RELEASED)
239 -
240 231 return;
241 232
242 233 if (entry < ASCII_SET_SIZE) {
243 234 if (lower->kbtrans_compose_map[entry] >= 0) {
244 235 lower->kbtrans_compose_key = entry;
245 236 lower->kbtrans_state = COMPOSE2;
246 237
247 238 return;
248 239 }
249 240 }
250 241 lower->kbtrans_state = NORMAL;
251 242 lower->kbtrans_led_state &= ~LED_COMPOSE;
252 243
253 244 cb->kc_setled(lower->kbtrans_upper);
254 245
255 246 return;
256 247
257 248 case COMPOSE2:
|
↓ open down ↓ |
8 lines elided |
↑ open up ↑ |
258 249 if (newstate == KEY_RELEASED)
259 250 return;
260 251
261 252 /* next state is "normal" */
262 253 lower->kbtrans_state = NORMAL;
263 254 lower->kbtrans_led_state &= ~LED_COMPOSE;
264 255
265 256 cb->kc_setled(lower->kbtrans_upper);
266 257
267 258 good_compose = kbtrans_do_compose(lower,
268 - lower->kbtrans_compose_key, entry,
269 - &result_iso);
259 + lower->kbtrans_compose_key, entry, &result);
270 260 if (good_compose) {
271 - if (lower->kbtrans_compat)
272 - result_iso += ISO_FIRST;
273 - else
274 - result_iso += EUC_FIRST;
275 261 cb->kc_keypressed(lower->kbtrans_upper,
276 - entrytype, key, result_iso);
262 + entrytype, key, result);
277 263 }
278 264 return;
279 265
280 266 case FLTACCENT:
281 267 if (newstate == KEY_RELEASED)
282 -
283 268 return;
284 269
285 270 /* next state is "normal" */
286 271 lower->kbtrans_state = NORMAL;
287 272 for (i = 0;
288 - (lower->kbtrans_fltaccent_table[i].fa_entry
289 - != lower->kbtrans_fltaccent_entry) ||
273 + (lower->kbtrans_fltaccent_table[i].fa_entry !=
274 + lower->kbtrans_fltaccent_entry) ||
290 275 (lower->kbtrans_fltaccent_table[i].ascii != entry);
291 276 i++) {
292 277 if (lower->kbtrans_fltaccent_table[i].fa_entry
293 278 == 0) {
294 279 /* Invalid second key: ignore key */
295 280
296 281 return;
297 282 }
298 283 }
299 284
300 - cb->kc_keypressed(lower->kbtrans_upper, entrytype,
301 - key, (lower->kbtrans_compat ?
302 - ISO_FIRST : EUC_FIRST) +
303 - lower->kbtrans_fltaccent_table[i].iso);
285 + cb->kc_keypressed(lower->kbtrans_upper, entrytype, key,
286 + lower->kbtrans_fltaccent_table[i].utf8);
304 287
305 288 return;
306 289 }
307 290 }
308 291
309 292 /*
310 293 * If the key is going down, and it's not one of the keys that doesn't
311 294 * auto-repeat, set up the auto-repeat timeout.
312 295 *
313 296 * The keys that don't auto-repeat are the Compose key,
314 297 * the shift keys, the "bucky bit" keys, the "floating accent" keys,
315 298 * and the function keys when in TR_EVENT mode.
316 299 */
317 300 if (newstate == KEY_PRESSED && entrytype != SHIFTKEYS &&
318 301 entrytype != BUCKYBITS && entrytype != FUNNY &&
319 302 entrytype != FA_CLASS) {
320 303
321 304 if (lower->kbtrans_repeatkey != key) {
322 305 cb->kc_cancel_repeat(lower->kbtrans_upper);
323 306 cb->kc_setup_repeat(lower->kbtrans_upper, entrytype,
324 - key);
307 + key);
325 308 }
326 309 /* key going up */
327 310 } else if (key == lower->kbtrans_repeatkey) {
328 311
329 312 cb->kc_cancel_repeat(lower->kbtrans_upper);
330 313 }
331 314
332 315 if (newstate == KEY_RELEASED) {
333 316 cb->kc_keyreleased(lower->kbtrans_upper, key);
334 317 }
335 318
336 319 /*
337 320 * We assume here that keys other than shift keys and bucky keys have
338 321 * entries in the "up" table that cause nothing to be done, and thus we
339 322 * don't have to check for newstate == KEY_RELEASED.
340 323 */
341 324 switch (entrytype) {
342 325
343 326 case 0x0: /* regular key */
344 327 cb->kc_keypressed(lower->kbtrans_upper, entrytype, key,
345 - entry | lower->kbtrans_buckybits);
328 + SPECIAL(lower->kbtrans_buckybits, entry));
346 329 break;
347 330
348 331 case SHIFTKEYS: {
349 332 uint_t shiftbit = 1 << (entry & 0x0F);
350 333
351 334 /* Modify toggle state (see toggle processing above) */
352 335 if (shiftbit & lower->kbtrans_keyboard->k_toggleshifts) {
353 336 if (newstate == KEY_RELEASED) {
354 337 if (shiftbit == CAPSMASK) {
355 338 lower->kbtrans_led_state &=
356 - ~LED_CAPS_LOCK;
339 + ~LED_CAPS_LOCK;
357 340
358 341 cb->kc_setled(lower->kbtrans_upper);
359 342
360 343 } else if (shiftbit == NUMLOCKMASK) {
361 344 lower->kbtrans_led_state &=
362 - ~LED_NUM_LOCK;
345 + ~LED_NUM_LOCK;
363 346
364 347 cb->kc_setled(lower->kbtrans_upper);
365 348 }
366 349 lower->kbtrans_togglemask &= ~shiftbit;
367 350 } else {
368 351 if (shiftbit == CAPSMASK) {
369 352 lower->kbtrans_led_state |=
370 - LED_CAPS_LOCK;
353 + LED_CAPS_LOCK;
371 354
372 355 cb->kc_setled(lower->kbtrans_upper);
373 356 } else if (shiftbit == NUMLOCKMASK) {
374 357 lower->kbtrans_led_state |=
375 - LED_NUM_LOCK;
358 + LED_NUM_LOCK;
376 359
377 360 cb->kc_setled(lower->kbtrans_upper);
378 361 }
379 362 lower->kbtrans_togglemask |= shiftbit;
380 363 }
381 364 }
382 365
383 366 if (newstate == KEY_RELEASED)
384 367 lower->kbtrans_shiftmask &= ~shiftbit;
385 368 else
386 369 lower->kbtrans_shiftmask |= shiftbit;
387 370
388 371 if (newstate == KEY_PRESSED) {
389 372 cb->kc_keypressed(lower->kbtrans_upper, entrytype, key,
390 - entry);
373 + entry);
391 374 }
392 375
393 376 break;
394 377 }
395 378
396 379 case BUCKYBITS:
397 - lower->kbtrans_buckybits ^= 1 << (7 + (entry & 0x0F));
380 + lower->kbtrans_buckybits ^= 1 << (entry & 0x0F);
398 381
399 382 if (newstate == KEY_PRESSED) {
400 383 cb->kc_keypressed(lower->kbtrans_upper, entrytype, key,
401 - entry);
384 + entry);
402 385 }
403 386
404 387 break;
405 388
406 389 case FUNNY:
407 390 switch (entry) {
408 391 case NOP:
409 392 break;
410 393
411 394 case IDLE:
412 395 /* Fall thru into RESET code */
413 396 /* FALLTHRU */
414 397 case RESET:
415 398 case ERROR:
416 399 lower->kbtrans_shiftmask &=
417 - lower->kbtrans_keyboard->k_idleshifts;
400 + lower->kbtrans_keyboard->k_idleshifts;
418 401
419 402 lower->kbtrans_shiftmask |=
420 - lower->kbtrans_togglemask;
403 + lower->kbtrans_togglemask;
421 404
422 405 lower->kbtrans_buckybits &=
423 - lower->kbtrans_keyboard->k_idlebuckys;
406 + lower->kbtrans_keyboard->k_idlebuckys;
424 407
425 408 cb->kc_cancel_repeat(lower->kbtrans_upper);
426 409
427 410 cb->kc_keypressed(lower->kbtrans_upper, entrytype, key,
428 - entry);
411 + entry);
429 412
430 413 break;
431 414
432 415
433 416 case COMPOSE:
434 417 lower->kbtrans_state = COMPOSE1;
435 418 lower->kbtrans_led_state |= LED_COMPOSE;
436 419 cb->kc_setled(lower->kbtrans_upper);
437 420 break;
438 421 /*
439 422 * Remember when adding new entries that,
440 423 * if they should NOT auto-repeat,
441 424 * they should be put into the IF statement
442 425 * just above this switch block.
443 426 */
444 427 default:
445 428 /* Ignore it */
446 429 break;
447 430 }
448 431 break;
449 432
450 433 case FA_CLASS:
451 434 if (lower->kbtrans_state == NORMAL) {
452 435 lower->kbtrans_fltaccent_entry = entry;
453 436 lower->kbtrans_state = FLTACCENT;
454 437 }
455 438 break;
456 439
457 440 case STRING:
458 441 cb->kc_keypressed(lower->kbtrans_upper, entrytype, key, entry);
459 442
460 443 break;
461 444
462 445 case FUNCKEYS:
463 446 cb->kc_keypressed(lower->kbtrans_upper, entrytype, key, entry);
464 447
465 448 break;
466 449
467 450 /*
468 451 * Remember when adding new entries that,
469 452 * if they should NOT auto-repeat,
470 453 * they should be put into the IF statement
471 454 * just above this switch block.
472 455 */
|
↓ open down ↓ |
34 lines elided |
↑ open up ↑ |
473 456 case PADKEYS:
474 457 cb->kc_keypressed(lower->kbtrans_upper, entrytype, key, entry);
475 458
476 459 break;
477 460 }
478 461 }
479 462
480 463 /*
481 464 * kbtrans_do_compose:
482 465 * Given a two key compose sequence, lookup the iso equivalent and put
483 - * the result in the result_iso_ptr.
466 + * the result in the result_ptr.
484 467 */
485 468 static boolean_t
486 -kbtrans_do_compose(struct kbtrans_lower *lower,
487 - ushort_t first_entry,
488 - ushort_t second_entry,
489 - ushort_t *result_iso_ptr)
469 +kbtrans_do_compose(struct kbtrans_lower *lower, keymap_entry_t first_entry,
470 + keymap_entry_t second_entry, keymap_entry_t *result_ptr)
490 471 {
491 472 struct compose_sequence_t *ptr;
492 - ushort_t tmp;
473 + keymap_entry_t tmp;
493 474
494 475 /*
495 476 * Validate the second keystroke.
496 477 */
497 478 if (second_entry >= ASCII_SET_SIZE)
498 479 return (B_FALSE);
499 480
500 481 if (lower->kbtrans_compose_map[second_entry] < 0)
501 482 return (B_FALSE);
502 483
503 484 /*
504 485 * Get them in code order, rather than press order.
505 486 */
506 487 if (first_entry > second_entry) {
507 488 tmp = first_entry;
508 489 first_entry = second_entry;
509 490 second_entry = tmp;
510 491 }
511 492
512 493 ptr = lower->kbtrans_compose_table +
513 - lower->kbtrans_compose_map[first_entry];
494 + lower->kbtrans_compose_map[first_entry];
514 495
515 496 while (ptr->first == first_entry) {
516 497 if (ptr->second == second_entry) {
517 - *result_iso_ptr = ptr->iso;
498 + *result_ptr = ptr->utf8;
518 499
519 500 return (B_TRUE);
520 501 }
521 502 ptr++;
522 503 }
523 504 return (B_FALSE);
524 505 }
525 506
526 507
527 508 /*
528 509 * kbtrans_find_entry:
529 510 * This routine finds the entry corresponding to the current shift
530 511 * state and keycode.
531 512 */
532 -unsigned short *
533 -kbtrans_find_entry(struct kbtrans_lower *lower,
534 - register uint_t mask,
535 - kbtrans_key_t key_station)
513 +keymap_entry_t *
514 +kbtrans_find_entry(struct kbtrans_lower *lower, uint_t mask,
515 + kbtrans_key_t key_station)
536 516 {
537 517 register struct keyboard *kp;
538 518 keymap_entry_t *km;
539 519 struct exception_map *ex;
540 520
541 521 kp = lower->kbtrans_keyboard;
542 522
543 523 if (kp == NULL)
544 524 return (NULL);
545 525
546 526 if (key_station < 0 || key_station >= kp->k_keymap_size)
547 527 return (NULL);
548 528
549 529 ex = kp->k_except;
550 530 if (ex != NULL) {
551 531 for (; ex->exc_care != 0; ex++) {
552 532 if ((mask & ex->exc_care) == ex->exc_mask &&
553 533 key_station == ex->exc_key)
554 534 return (&ex->exc_entry);
555 535 }
556 536 }
557 537
558 538 if (mask & UPMASK)
559 539 km = kp->k_up;
560 540 else if (mask & NUMLOCKMASK)
561 541 km = kp->k_numlock;
562 542 else if (mask & CTRLMASK)
563 543 km = kp->k_control;
564 544 else if (mask & ALTGRAPHMASK)
565 545 km = kp->k_altgraph;
566 546 else if (mask & SHIFTMASK)
567 547 km = kp->k_shifted;
568 548 else if (mask & CAPSMASK)
569 549 km = kp->k_caps;
570 550 else km = kp->k_normal;
571 551
572 552 return (&km[key_station]);
573 553 }
574 554
575 555 #ifdef DEBUG
576 556 /*ARGSUSED*/
577 557 void
578 558 kbtrans_dprintf(void *un, const char *fmt, ...)
579 559 {
580 560 char buf[256];
581 561 va_list ap;
582 562
583 563 va_start(ap, fmt);
584 564 (void) vsprintf(buf, fmt, ap);
585 565 va_end(ap);
586 566
587 567 cmn_err(CE_CONT, "kbtrans: %s", buf);
588 568 }
589 569 #endif
|
↓ open down ↓ |
44 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX