4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 /* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */
23 /* Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T */
24 /* All Rights Reserved */
27 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
28 * Use is subject to license terms.
39 * Messages from keyboard.
41 #define KB_ERROR 0x00 /* Keyboard overrun or detection error */
42 #define KB_POST_OK 0xAA /* Sent at completion of poweron */
43 #define KB_ECHO 0xEE /* Response to Echo command (EE) */
44 #define KB_ACK 0xFA /* Acknowledgement byte from keyboard */
45 #define KB_POST_FAIL 0xFC /* Power On Self Test failed */
46 #define KB_RESEND 0xFE /* response from keyboard to resend data */
47 #define KB_REPLY_MAXLEN 8 /* Maximum # of bytes the keyboard can reply */
49 * Commands to keyboard.
51 #define KB_SET_LED 0xED /* Tell kbd that following byte is led status */
52 #define KB_READID 0xF2 /* command to read keyboard id */
53 #define KB_ENABLE 0xF4 /* command to to enable keyboard */
54 #define KB_RESET 0xFF /* command to reset keyboard */
55 #define KB_SET_TYPE 0xF3 /* command--next byte is typematic values */
56 #define KB_SET_SCAN 0xF0 /* kbd command to set scan code set */
61 #define LED_SCR 0x01 /* Flag bit for scroll lock */
62 #define LED_CAP 0x04 /* Flag bit for cap lock */
63 #define LED_NUM 0x02 /* Flag bit for num lock */
66 * Keyboard scan code prefixes
68 #define KAT_BREAK 0xf0 /* first byte in two byte break sequence */
69 #define KXT_EXTEND 0xe0 /* first byte in two byte extended sequence */
70 #define KXT_EXTEND2 0xe1 /* Used in "Pause" sequence */
73 * Korean keyboard keys. We handle these specially to avoid having to
74 * dramatically extend the table.
76 #define KXT_HANGUL_HANJA 0xf1
77 #define KXT_HANGUL 0xf2
82 kmutex_t w_hw_mutex
; /* hardware mutex */
83 int w_init
; /* workstation has been initialized */
84 queue_t
*w_qp
; /* pointer to queue for this minor device */
85 int w_kblayout
; /* keyboard layout code */
86 dev_t w_dev
; /* major/minor for this device */
87 ddi_iblock_cookie_t w_iblock
;
88 ddi_acc_handle_t handle
;
90 int kb_old_key_pos
; /* scancode for autorepeat filtering */
96 struct kbtrans
*hw_kbtrans
;
97 struct cons_polledio polledio
;
101 unsigned char trigger
;
106 boolean_t polled_synthetic_release_pending
;
107 int polled_synthetic_release_key
;
108 int simulated_kbd_type
;
113 kcondvar_t suspend_cv
;
120 extern boolean_t
KeyboardConvertScan(struct kb8042
*, unsigned char scan
,
121 int *keynum
, enum keystate
*, boolean_t
*);
122 extern int KeyboardConvertScan_init(struct kb8042
*, int scanset
);
124 #if defined(__i386) || defined(__amd64)
126 * We pick up the initial state of the keyboard from the BIOS state.
128 #define BIOS_KB_FLAG 0x417 /* address of BIOS keyboard state */
129 #define BIOS_SCROLL_STATE 0x10
130 #define BIOS_NUM_STATE 0x20
131 #define BIOS_CAPS_STATE 0x40
135 * Initialization states
137 #define KB8042_UNINITIALIZED 0x00000000
138 #define KB8042_MINOR_NODE_CREATED 0x00000001
139 #define KB8042_REGS_MAPPED 0x00000002
140 #define KB8042_HW_MUTEX_INITTED 0x00000004
141 #define KB8042_INTR_ADDED 0x00000008
144 * Key values that map into the USB translation table in kb8042.c
146 #define K8042_STOP 160
154 #endif /* _KB8042_H */