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/sys/kbd.h
+++ new/usr/src/uts/common/sys/kbd.h
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 (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
|
↓ open down ↓ |
18 lines elided |
↑ open up ↑ |
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 24 */
25 25
26 26 #ifndef _SYS_KBD_H
27 27 #define _SYS_KBD_H
28 28
29 -#pragma ident "%Z%%M% %I% %E% SMI" /* SunOS4.0 1.18 */
30 -
31 29 #ifdef __cplusplus
32 30 extern "C" {
33 31 #endif
34 32
35 33 /*
36 34 * Following #defines are related to the older keyboards which
37 35 * are no longer supported by kb module. The #defines ane left
38 36 * for older programs to still compile.
39 37 */
40 38 #define KB_KLUNK 0x00 /* Micro Switch 103SD32-2 */
41 39 #define KB_VT100 0x01 /* Keytronics VT100 compatible */
42 40 #define KB_SUN2 0x02 /* Sun-2 custom keyboard */
43 41 #define KB_VT220 0x81 /* Emulation VT220 */
44 42 #define KB_VT220I 0x82 /* International VT220 Emulation */
45 43
46 44 #define NOTPRESENT 0xFF /* Keyboard is not plugged in */
47 45 #define KBD_CMD_LED1 0x04 /* Turn on LED 1 for Sun-2 */
48 46 #define KBD_CMD_NOLED1 0x05 /* Turn off LED 1 for Sun-2 */
49 47 #define KBD_CMD_LED2 0x06 /* Turn on LED 2 for Sun-2 */
50 48 #define KBD_CMD_NOLED2 0x07 /* Turn off LED 2 for Sun-2 */
51 49
52 50 #define CTLSMASK 0x0100 /* Set if ^S was last keyed of ^S, ^Q */
53 51 /* determines which NOSCROLL sends. */
54 52
55 53 #define NOSCROLL 0x303 /* This key alternately sends ^S or ^Q */
56 54 #define CTRLS 0x304 /* This sends ^S and lets NOSCROLL know */
57 55 #define CTRLQ 0x305 /* This sends ^Q and lets NOSCROLL know */
58 56
59 57
60 58 /*
61 59 * Following are the only keyboard types supported by kb module.
62 60 * (Type 5, Hobo, US101A are also supported but they report
63 61 * themselves as Type 4 keyboard with a different layout id.)
64 62 */
65 63 #define KB_SUN3 3 /* Type 3 Sun keyboard */
66 64 #define KB_SUN4 4 /* Type 4 Sun keyboard */
67 65 #define KB_USB 6 /* USB keyboard */
68 66 #define KB_PC 101 /* Type 101 AT keyboard */
69 67
70 68 #define KB_ASCII 0x0F /* Ascii terminal masquerading as kbd */
71 69
72 70 /*
73 71 * This structure is used to enumerate the supported keyboard types.
74 72 * The array of these is terminated by an entry with a NULL table entry.
75 73 * The first entry is used if none match.
76 74 */
77 75 struct keyboards {
78 76 int id; /* Keyboard type, per KIOCTYPE */
79 77 struct keyboard *table; /* Keyboard table to use. */
80 78 };
81 79
82 80 /*
83 81 * Various special characters that might show up on the port
84 82 */
85 83 #define IDLEKEY 0x7F /* Keyboard is idle; no keys down */
86 84 #define ERRORKEY 0x7E /* Keyboard detected an error */
87 85 #define RESETKEY 0xFF /* Keyboard was just reset */
88 86 #define LAYOUTKEY 0xFE /* Keyboard layout byte follows */
89 87
90 88 #define PRESSED 0x00 /* 0x80 bit off: key was pressed */
91 89 #define RELEASED 0x80 /* 0x80 bit on : key was released */
92 90
93 91 /*
94 92 * Commands to the Sun-3 keyboard.
95 93 */
96 94 #define KBD_CMD_RESET 0x01 /* Reset keyboard as if power-up */
97 95 #define KBD_CMD_BELL 0x02 /* Turn on the bell */
98 96 #define KBD_CMD_NOBELL 0x03 /* Turn off the bell */
99 97 #define KBD_CMD_CLICK 0x0A /* Turn on the click annunciator */
100 98 #define KBD_CMD_NOCLICK 0x0B /* Turn off the click annunciator */
101 99
102 100 /*
103 101 * Commands to the Type 4 keyboard, in addition to those above.
104 102 */
105 103 #define KBD_CMD_AUTOTEST 0x0C /* Initiate test sequence */
106 104 #define KBD_CMD_SETLED 0x0E /* Set keyboard LED's */
107 105 #define KBD_CMD_GETLAYOUT 0x0F /* Request that keyboard indicate */
108 106 /* layout */
109 107 /*
110 108 * Type 4 keyboard LED masks (used to set LED's)
111 109 */
112 110 #define LED_NUM_LOCK 0x1
113 111 #define LED_COMPOSE 0x2
114 112 #define LED_SCROLL_LOCK 0x4
115 113 #define LED_CAPS_LOCK 0x8
116 114 #define LED_KANA 0x10 /* Valid only on Japanese layout */
117 115
118 116 /*
119 117 * Software related definitions
120 118 */
121 119 /*
122 120 * These are the states that the keyboard scanner can be in.
123 121 *
124 122 * It starts out in NORMAL state.
125 123 */
126 124 #define NORMAL 0 /* The usual (ho, hum) */
127 125 #define ABORT1 1 /* Got KEYABORT1 */
128 126 #define COMPOSE1 2 /* Got COMPOSE */
129 127 #define COMPOSE2 3 /* Got COMPOSE plus first key */
130 128 #define FLTACCENT 4 /* Got floating accent key */
131 129 #define NEWABORT1 5 /* Got NEW KEYABORT1 */
132 130
133 131 /*
134 132 * Size of ASCII set as used in compose handling.
135 133 */
136 134 #define ASCII_SET_SIZE 128
137 135
138 136 /*
139 137 * These are how you can have your input translated.
140 138 * TR_EVENT means that each keystroke is sent as a firm event.
141 139 * TR_UNTRANS_EVENT also sends a firm event for each up / down transition,
142 140 * but the value is untranslated: the event id is the key station; the
143 141 * value indicates whether the transition was up or down; the value of the
144 142 * shift-mask is undefined.
145 143 */
146 144 #define TR_NONE 0
147 145 #define TR_ASCII 1
148 146 #define TR_EVENT 2
149 147 #define TR_UNTRANS_EVENT 3
150 148
151 149 /*
152 150 * These bits can appear in the result of TR_NONE & TR_UNTRANS_EVENT getkey()s.
153 151 */
154 152 #define BUILDKEY(key, state) (key | state)
155 153 #define STATEOF(key) ((key) & RELEASED) /* 0 = key down, !=0 = key up */
156 154 #define KEYOF(key) ((key) & ~RELEASED) /* The key number that moved */
157 155 #define NOKEY (-1) /* The argument was 0, and no key was */
158 156 /* depressed. They were all elated. */
159 157
160 158 /*
161 159 * "Bucky" bits. These are bits for mode keys. The META bit is ORed into the
162 160 * result of TR_ASCII getkey()s, and can be ORed into the result of TR_EVENT
163 161 * getkey()s for backwards compatibility.
164 162 * (NOKEY can also appear if no keypress was queued up.)
165 163 */
166 164 #define METABIT 0 /* Meta key depressed with key */
167 165 #define METAMASK 0x000080
168 166 #define SYSTEMBIT 1 /* Upper left key was down w/key */
169 167 #define SYSTEMMASK 0x000100
170 168 /* other "bucky" bits can be defined at will. See "BUCKYBITS" below. */
171 169
172 170 /*
173 171 * This defines the bit positions used within "shiftmask" to
174 172 * indicate the "pressed" (1) or "released" (0) state of shift keys.
175 173 * Both the bit numbers, and the aggregate masks, are defined.
176 174 *
177 175 * The "UPMASK" is a minor kludge. Since whether the key is going
178 176 * up or down determines the translation table (just as the shift
179 177 * keys' positions do), we OR it with "shiftmask" to get "tempmask",
180 178 * which is the mask which is actually used to determine the
181 179 * translation table to use. Don't reassign 0x0080 for anything
182 180 * else, or we'll have to shift and such to squeeze in UPMASK,
183 181 * since it comes in from the hardware as 0x80.
184 182 */
185 183 #define CAPSLOCK 0 /* Caps Lock key */
186 184 #define CAPSMASK 0x0001
187 185 #define SHIFTLOCK 1 /* Shift Lock key */
188 186 #define LEFTSHIFT 2 /* Left-hand shift key */
189 187 #define RIGHTSHIFT 3 /* Right-hand shift key */
190 188 #define SHIFTMASK 0x000E
191 189 #define LEFTCTRL 4 /* Left-hand (or only) control key */
192 190 #define RIGHTCTRL 5 /* Right-hand control key */
193 191 #define CTRLMASK 0x0030
194 192 /* META 6 Meta keys */
195 193 /* META_SHIFT_MASK 0x0040 reserved */
196 194 /* TOP 7 do not use! */
197 195 /* TOPMASK 0x0080 UPMASK in keyboard driver */
198 196 /* CMD 8 reserved */
199 197 /* CMDMASK 0x0100 reserved */
200 198 #define ALTGRAPH 9 /* Alt Graph key */
201 199 #define ALTGRAPHMASK 0x0200
202 200 #define ALT 10 /* Left (or only) Alt key */
203 201 #define LEFTALT 10 /* Left Alt key */
204 202 #define ALTMASK 0x1400
205 203 #define NUMLOCK 11 /* Num Lock key */
206 204 #define NUMLOCKMASK 0x0800
207 205 #define RIGHTALT 12 /* Right Alt key */
208 206 #define UPMASK 0x0080
209 207
210 208 /*
211 209 * This defines the format of translation tables.
212 210 *
213 211 * A translation table is KEYMAP_SIZE "entries", each of which is 2 bytes
214 212 * (unsigned shorts). The top 8 bits of each entry are decoded by
215 213 * a case statement in getkey.c. If the entry is less than 0x100, it
216 214 * is sent out as an EUC character (possibly with bucky bits
217 215 * OR-ed in). "Special" entries are 0x100 or greater, and
|
↓ open down ↓ |
177 lines elided |
↑ open up ↑ |
218 216 * invoke more complicated actions.
219 217 *
220 218 * The KEYMAP_SIZE is dependent upon the keyboard type. For example, the
221 219 * Sun Type 4/5 keyboards have a KEYMAP_SIZE of 128 where a USB keyboard
222 220 * has a KEYMAP_SIZE of 255. Instead of defining a KEYMAP_SIZE per
223 221 * keyboard type, a keyboard specific module/driver may supply the value
224 222 * at run time by defining the KEYMAP_SIZE_VARIABLE and filling in the
225 223 * keyboard struct appropriately.
226 224 */
227 225
226 +typedef unsigned int keymap_entry_t;
228 227 #ifdef KEYMAP_SIZE_VARIABLE
229 228
230 -typedef unsigned short keymap_entry_t;
231 229
232 230 #else
233 231 #define KEYMAP_SIZE 128
234 232
235 233 struct keymap {
236 - unsigned short keymap[KEYMAP_SIZE]; /* maps keycodes to actions */
234 + keymap_entry_t keymap[KEYMAP_SIZE]; /* maps keycodes to actions */
237 235 };
238 236
239 237 #endif
240 238
241 239 /*
242 240 * This structure is used for "exception" cases for key sequences that
243 241 * we want to map, that should not be handled by keymap entries (For
244 242 * example: using Control-Shift-F1 on PC's for the compose key).
245 243 */
246 244 struct exception_map {
247 245 /*
248 246 * these are the modifier keys that we "care" about
249 247 */
250 248 unsigned int exc_care;
251 249
252 250 /*
253 251 * This is the mask of modifier keys that we want to match
254 252 */
|
↓ open down ↓ |
8 lines elided |
↑ open up ↑ |
255 253 unsigned int exc_mask;
256 254
257 255 /*
258 256 * This is the key that we want to match.
259 257 */
260 258 int exc_key;
261 259
262 260 /*
263 261 * This is our translated version of the matching sequence.
264 262 */
265 - unsigned short exc_entry;
263 + keymap_entry_t exc_entry;
266 264 };
267 265
268 266 /*
269 267 * A keyboard is defined by its keymaps and what state it resets at idle.
270 268 *
271 269 * The masks k_idleshifts and k_idlebuckys are AND-ed with the current
272 270 * state of shiftmask and buckybits when a "keyboard idle" code
273 271 * is received. This ensures that where we "think" the shift & bucky
274 272 * keys are, more accurately reflects where they really are, since the
275 273 * keyboard knows better than us. However, some keyboards don't know
276 274 * about shift states that should be remembered across idles. Such
277 275 * shifts are described by k_toggleshifts. k_toggleshifts are used to
278 276 * identify such shifts. A toggle shift state is maintained separately
279 277 * from the general shift state. The toggle shift state is OR-ed
280 278 * with the state general shift state when an idle is received.
281 279 * k_toggleshifts should not appear in the k_up table.
282 280 */
283 281 struct keyboard {
284 282 #ifdef KEYMAP_SIZE_VARIABLE
285 283 int k_keymap_size; /* Number of entries in keymaps */
286 284 keymap_entry_t *k_normal; /* Unshifted */
287 285 keymap_entry_t *k_shifted; /* Shifted */
288 286 keymap_entry_t *k_caps; /* Caps locked */
289 287 keymap_entry_t *k_altgraph; /* Alt Graph down */
290 288 keymap_entry_t *k_numlock; /* Num Lock down */
291 289 keymap_entry_t *k_control; /* Controlled */
292 290 keymap_entry_t *k_up; /* Key went up */
293 291 #else
294 292 struct keymap *k_normal; /* Unshifted */
295 293 struct keymap *k_shifted; /* Shifted */
296 294 struct keymap *k_caps; /* Caps locked */
297 295 struct keymap *k_altgraph; /* Alt Graph down */
298 296 struct keymap *k_numlock; /* Num Lock down */
299 297 struct keymap *k_control; /* Controlled */
300 298 struct keymap *k_up; /* Key went up */
301 299 #endif
302 300 int k_idleshifts; /* Shifts that keep across idle */
303 301 int k_idlebuckys; /* Bucky bits that keep across idle */
304 302 unsigned char k_abort1; /* 1st key of abort sequence */
305 303 unsigned char k_abort1a; /* alternate 1st key */
306 304 unsigned char k_abort2; /* 2nd key of abort sequence */
307 305 int k_toggleshifts; /* Shifts that toggle on down from */
308 306 /* kbd and keep across idle */
309 307 struct exception_map *k_except; /* Oddball cases */
310 308 unsigned char k_newabort1; /* 1st key of new abort sequence */
311 309 unsigned char k_newabort1a; /* alternate 1st key */
|
↓ open down ↓ |
36 lines elided |
↑ open up ↑ |
312 310 unsigned char k_newabort2; /* 2nd key of new abort sequence */
313 311 };
314 312
315 313 /*
316 314 * Define the compose sequence structure. First and second
317 315 * ASCII chars of 0 indicate the end of the table.
318 316 */
319 317 struct compose_sequence_t {
320 318 unsigned char first; /* first ASCII char after COMPOSE key */
321 319 unsigned char second; /* second ASCII char after COMPOSE key */
322 - unsigned char iso; /* equivalent ISO code */
320 + keymap_entry_t utf8; /* equivalent UTF-8 code */
323 321 };
324 322
325 323 /*
326 324 * Define the floating accent sequence structure.
327 325 */
328 326 struct fltaccent_sequence_t {
329 - unsigned short fa_entry; /* floating accent keymap entry */
327 + keymap_entry_t fa_entry; /* floating accent keymap entry */
330 328 unsigned char ascii; /* ASCII char after FA-type key */
331 - unsigned char iso; /* equivalent ISO code */
329 + keymap_entry_t utf8; /* equivalent UTF-8 code */
332 330 };
333 331
334 332 /*
333 + * The top byte is used to store the flags, leaving 24 bits for char.
334 + */
335 +#define KEYCHAR(c) ((c) & 0x00ffffff)
336 +#define KEYFLAGS(c) ((c) & ~0x00ffffff)
337 +
338 +/*
335 339 * The "special" entries' top 4 bits are defined below. Generally they are
336 340 * used with a 4-bit parameter (such as a bit number) in the low 4 bits.
337 341 * The bytes whose top 4 bits are 0x0 thru 0x7 happen to be ascii
338 342 * characters. They are not special cased, but just normal cased.
339 343 */
340 344
341 -#define SHIFTKEYS 0x100 /* thru 0x10F. This key helps to determine */
345 +#define SPECIAL(h, l) (((h) << 24) | (l))
346 +
347 +#define SHIFTKEYS SPECIAL(0x1, 0)
348 + /* thru 0x10F. This key helps to determine */
342 349 /* the translation table used. The bit */
343 350 /* position of its bit in "shiftmask" */
344 351 /* is added to the entry, eg */
345 352 /* SHIFTKEYS+LEFTCTRL. When this entry is */
346 353 /* invoked, the bit in "shiftmask" is */
347 354 /* toggled. Depending which tables you put */
348 355 /* it in, this works well for hold-down */
349 356 /* keys or press-on, press-off keys. */
350 -#define BUCKYBITS 0x200 /* thru 0x20F. This key determines the state */
357 +#define BUCKYBITS SPECIAL(0x2, 0)
358 + /* thru 0x20F. This key determines the state */
351 359 /* of one of the "bucky" bits above the */
352 360 /* returned ASCII character. This is */
353 361 /* basically a way to pass mode-key-up/down */
354 362 /* information back to the caller with each */
355 363 /* "real" key depressed. The concept, and */
356 364 /* name "bucky" (derivation unknown) comes */
357 365 /* from the MIT/SAIL "TV" system...they had */
358 366 /* TOP, META, CTRL, and a few other bucky */
359 367 /* bits. The bit position of its bit in */
360 368 /* "buckybits", minus 7, is added to the */
361 369 /* entry; eg bit 0x00000400 is BUCKYBITS+3. */
362 370 /* The "-7" prevents us from messing up the */
363 371 /* ASCII char, and gives us 16 useful bucky */
364 372 /* bits. When this entry is invoked, */
365 373 /* the designated bit in "buckybits" is */
366 374 /* toggled. Depending which tables you put */
367 375 /* it in, this works well for hold-down */
368 376 /* keys or press-on, press-off keys. */
369 -#define FUNNY 0x300 /* thru 0x30F. This key does one of 16 funny */
377 +#define FUNNY SPECIAL(0x3, 0) /* thru 0x30F. This key does one of 16 funny */
370 378 /* things based on the low 4 bits: */
371 -#define NOP 0x300 /* This key does nothing. */
372 -#define OOPS 0x301 /* This key exists but is undefined. */
373 -#define HOLE 0x302 /* This key does not exist on the keyboard. */
379 +#define NOP SPECIAL(0x3, 0x0) /* This key does nothing. */
380 +#define OOPS SPECIAL(0x3, 0x1) /* This key exists but is undefined. */
381 +#define HOLE SPECIAL(0x3, 0x2) /* This key does not exist on the keyboard. */
374 382 /* Its position code should never be */
375 383 /* generated. This indicates a software/ */
376 384 /* hardware mismatch, or bugs. */
377 -#define RESET 0x306 /* Kbd was just reset */
378 -#define ERROR 0x307 /* Kbd just detected an internal error */
379 -#define IDLE 0x308 /* Kbd is idle (no keys down) */
380 -#define COMPOSE 0x309 /* This key is the Compose key. */
381 -#define NONL 0x30A /* This key not affected by Num Lock */
385 +#define RESET SPECIAL(0x3, 0x6) /* Kbd was just reset */
386 +#define ERROR SPECIAL(0x3, 0x7) /* Kbd just detected an internal error */
387 +#define IDLE SPECIAL(0x3, 0x8) /* Kbd is idle (no keys down) */
388 +#define COMPOSE SPECIAL(0x3, 0x9) /* This key is the Compose key. */
389 +#define NONL SPECIAL(0x3, 0xA) /* This key not affected by Num Lock */
382 390 /* Combinations 0x30B to 0x30F are reserved for non-parameterized functions */
383 391
384 -#define FA_CLASS 0x400 /* thru 0x40F. These are for "floating */
392 +#define FA_CLASS SPECIAL(0x4, 0)
393 + /* thru 0x40F. These are for "floating */
385 394 /* accent" characters. The low-order 4 bits */
386 395 /* select one of those characters. */
387 396 /* Definitions for the individual floating accents: */
388 -#define FA_UMLAUT 0x400 /* umlaut accent */
389 -#define FA_CFLEX 0x401 /* circumflex accent */
390 -#define FA_TILDE 0x402 /* tilde accent */
391 -#define FA_CEDILLA 0x403 /* cedilla accent */
392 -#define FA_ACUTE 0x404 /* acute accent */
393 -#define FA_GRAVE 0x405 /* grave accent */
397 +#define FA_UMLAUT SPECIAL(0x4, 0x0) /* umlaut accent */
398 +#define FA_CFLEX SPECIAL(0x4, 0x1) /* circumflex accent */
399 +#define FA_TILDE SPECIAL(0x4, 0x2) /* tilde accent */
400 +#define FA_CEDILLA SPECIAL(0x4, 0x3) /* cedilla accent */
401 +#define FA_ACUTE SPECIAL(0x4, 0x4) /* acute accent */
402 +#define FA_GRAVE SPECIAL(0x4, 0x5) /* grave accent */
403 +#define FA_MACRON SPECIAL(0x4, 0x6) /* macron accent */
404 +#define FA_BREVE SPECIAL(0x4, 0x7) /* breve accent */
405 +#define FA_DOT SPECIAL(0x4, 0x8) /* dot accent */
406 +#define FA_SLASH SPECIAL(0x4, 0x9) /* slash accent */
407 +#define FA_RING SPECIAL(0x4, 0xa) /* ring accent */
408 +#define FA_APOSTROPHE SPECIAL(0x4, 0xb) /* apostrophe accent */
409 +#define FA_DACUTE SPECIAL(0x4, 0xc) /* double acute accent */
410 +#define FA_OGONEK SPECIAL(0x4, 0xd) /* ogonek accent */
411 +#define FA_CARON SPECIAL(0x4, 0xe) /* caron accent */
394 412
395 -#define STRING 0x500 /* thru 0x50F. The low-order 4 bits index */
413 +#define STRING SPECIAL(0x5, 0) /* thru 0x50F. The low-order 4 bits index */
396 414 /* a table select a string to be returned, */
397 415 /* char by char. Each entry the table is */
398 416 /* null terminated. */
399 417 #define KTAB_STRLEN 10 /* Maximum string length (including null) */
400 418 /* Definitions for the individual string numbers: */
401 419 #define HOMEARROW 0x00
402 420 #define UPARROW 0x01
403 421 #define DOWNARROW 0x02
404 422 #define LEFTARROW 0x03
405 423 #define RIGHTARROW 0x04
406 424 /* string numbers 5 thru F are available to users making custom entries */
407 425
408 426 /*
409 427 * In the following function key groupings, the low-order 4 bits indicate
410 428 * the function key number within the group, and the next 4 bits indicate
411 429 * the group.
412 430 */
413 -#define FUNCKEYS 0x600
414 -#define LEFTFUNC 0x600 /* thru 0x60F. The "left" group. */
415 -#define RIGHTFUNC 0x610 /* thru 0x61F. The "right" group. */
416 -#define TOPFUNC 0x620 /* thru 0x62F. The "top" group. */
417 -#define BOTTOMFUNC 0x630 /* thru 0x63F. The "bottom" group. */
431 +#define FUNCKEYS SPECIAL(0x6, 0)
432 +#define LEFTFUNC SPECIAL(0x6, 0x0) /* thru 0x60F. The "left" group. */
433 +#define RIGHTFUNC SPECIAL(0x6, 0x10) /* thru 0x61F. The "right" group. */
434 +#define TOPFUNC SPECIAL(0x6, 0x20) /* thru 0x62F. The "top" group. */
435 +#define BOTTOMFUNC SPECIAL(0x6, 0x30) /* thru 0x63F. The "bottom" group. */
418 436 #define LF(n) (LEFTFUNC+(n)-1)
419 437 #define RF(n) (RIGHTFUNC+(n)-1)
420 438 #define TF(n) (TOPFUNC+(n)-1)
421 439 #define BF(n) (BOTTOMFUNC+(n)-1)
422 440
423 441 /*
424 442 * The actual keyboard positions may not be on the left/right/top/bottom
425 443 * of the physical keyboard (although they usually are).
426 444 * What is important is that we have reserved 64 keys for function keys.
427 445 *
428 446 * Normally, striking a function key will cause the following escape sequence
429 447 * to be sent through the character stream:
430 448 * ESC[0..9z
431 449 * where ESC is a single escape character and 0..9 indicate some number of
432 450 * digits needed to encode the function key as a decimal number.
433 451 */
434 -#define PADKEYS 0x700
435 -#define PADEQUAL 0x700 /* keypad = */
436 -#define PADSLASH 0x701 /* keypad / */
437 -#define PADSTAR 0x702 /* keypad * */
438 -#define PADMINUS 0x703 /* keypad - */
439 -#define PADSEP 0x704 /* keypad, */
440 -#define PAD7 0x705 /* keypad 7 */
441 -#define PAD8 0x706 /* keypad 8 */
442 -#define PAD9 0x707 /* keypad 9 */
443 -#define PADPLUS 0x708 /* keypad + */
444 -#define PAD4 0x709 /* keypad 4 */
445 -#define PAD5 0x70A /* keypad 5 */
446 -#define PAD6 0x70B /* keypad 6 */
447 -#define PAD1 0x70C /* keypad 1 */
448 -#define PAD2 0x70D /* keypad 2 */
449 -#define PAD3 0x70E /* keypad 3 */
450 -#define PAD0 0x70F /* keypad 0 */
451 -#define PADDOT 0x710 /* keypad . */
452 -#define PADENTER 0x711 /* keypad Enter */
452 +#define PADKEYS SPECIAL(0x7, 0)
453 +#define PADEQUAL SPECIAL(0x7, 0x00) /* keypad = */
454 +#define PADSLASH SPECIAL(0x7, 0x01) /* keypad / */
455 +#define PADSTAR SPECIAL(0x7, 0x02) /* keypad * */
456 +#define PADMINUS SPECIAL(0x7, 0x03) /* keypad - */
457 +#define PADSEP SPECIAL(0x7, 0x04) /* keypad, */
458 +#define PAD7 SPECIAL(0x7, 0x05) /* keypad 7 */
459 +#define PAD8 SPECIAL(0x7, 0x06) /* keypad 8 */
460 +#define PAD9 SPECIAL(0x7, 0x07) /* keypad 9 */
461 +#define PADPLUS SPECIAL(0x7, 0x08) /* keypad + */
462 +#define PAD4 SPECIAL(0x7, 0x09) /* keypad 4 */
463 +#define PAD5 SPECIAL(0x7, 0x0A) /* keypad 5 */
464 +#define PAD6 SPECIAL(0x7, 0x0B) /* keypad 6 */
465 +#define PAD1 SPECIAL(0x7, 0x0C) /* keypad 1 */
466 +#define PAD2 SPECIAL(0x7, 0x0D) /* keypad 2 */
467 +#define PAD3 SPECIAL(0x7, 0x0E) /* keypad 3 */
468 +#define PAD0 SPECIAL(0x7, 0x0F) /* keypad 0 */
469 +#define PADDOT SPECIAL(0x7, 0x10) /* keypad . */
470 +#define PADENTER SPECIAL(0x7, 0x11) /* keypad Enter */
453 471
454 472 #ifdef __cplusplus
455 473 }
456 474 #endif
457 475
458 476 #endif /* _SYS_KBD_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX