1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
/*
* linux/include/asm-ppc/keyboard.h
*
* Created 3 Nov 1996 by Geert Uytterhoeven
*
* $Id: keyboard.h,v 1.6 1998/08/20 14:41:03 ralf Exp $
* Modified for Power Macintosh by Paul Mackerras
*/
/*
* This file contains the ppc architecture specific keyboard definitions -
* like the intel pc for prep systems, different for power macs.
*/
#ifndef __ASMPPC_KEYBOARD_H
#define __ASMPPC_KEYBOARD_H
#ifdef __KERNEL__
#include <asm/io.h>
#include <linux/config.h>
#include <asm/adb.h>
#ifdef CONFIG_APUS
#include <asm-m68k/keyboard.h>
#else
#define KEYBOARD_IRQ 1
#define DISABLE_KBD_DURING_INTERRUPTS 0
#define INIT_KBD
extern int mackbd_setkeycode(unsigned int scancode, unsigned int keycode);
extern int mackbd_getkeycode(unsigned int scancode);
extern int mackbd_pretranslate(unsigned char scancode, char raw_mode);
extern int mackbd_translate(unsigned char scancode, unsigned char *keycode,
char raw_mode);
extern int mackbd_unexpected_up(unsigned char keycode);
extern void mackbd_leds(unsigned char leds);
extern void mackbd_init_hw(void);
extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode);
extern int pckbd_getkeycode(unsigned int scancode);
extern int pckbd_pretranslate(unsigned char scancode, char raw_mode);
extern int pckbd_translate(unsigned char scancode, unsigned char *keycode,
char raw_mode);
extern char pckbd_unexpected_up(unsigned char keycode);
extern void pckbd_leds(unsigned char leds);
extern void pckbd_init_hw(void);
static inline int kbd_setkeycode(unsigned int scancode, unsigned int keycode)
{
if ( is_prep )
return pckbd_setkeycode(scancode,keycode);
else if ( is_chrp )
#ifndef CONFIG_MAC_KEYBOARD
return pckbd_setkeycode(scancode,keycode);
#else
/* I'm not actually sure if it's legal to have a CHRP machine
* without an ADB controller. In any case, this should really
* be changed to be a test to see if an ADB _keyboard_ exists
* (not just a controller), but that's another story for
* another night.
*/
if ( adb_hardware == ADB_NONE )
return pckbd_setkeycode(scancode,keycode);
else
return mackbd_setkeycode(scancode,keycode);
#endif
else
return mackbd_setkeycode(scancode,keycode);
}
static inline int kbd_getkeycode(unsigned int x)
{
if ( is_prep )
return pckbd_getkeycode(x);
else if ( is_chrp )
#ifndef CONFIG_MAC_KEYBOARD
return pckbd_getkeycode(x);
#else
if ( adb_hardware == ADB_NONE )
return pckbd_getkeycode(x);
else
return mackbd_getkeycode(x);
#endif
else
return mackbd_getkeycode(x);
}
static inline int kbd_pretranslate(unsigned char x,char y)
{
if ( is_prep )
return pckbd_pretranslate(x,y);
else if ( is_chrp )
#ifndef CONFIG_MAC_KEYBOARD
return pckbd_pretranslate(x,y);
#else
if ( adb_hardware == ADB_NONE )
return pckbd_pretranslate(x,y);
else
return mackbd_pretranslate(x,y);
#endif
else
return mackbd_pretranslate(x,y);
}
static inline int kbd_translate(unsigned char keycode, unsigned char *keycodep,
char raw_mode)
{
if ( is_prep )
return pckbd_translate(keycode,keycodep,raw_mode);
else if ( is_chrp )
#ifndef CONFIG_MAC_KEYBOARD
return pckbd_translate(keycode,keycodep,raw_mode);
#else
if ( adb_hardware == ADB_NONE )
return pckbd_translate(keycode,keycodep,raw_mode);
else
return mackbd_translate(keycode,keycodep,raw_mode);
#endif
else
return mackbd_translate(keycode,keycodep,raw_mode);
}
static inline int kbd_unexpected_up(unsigned char keycode)
{
if ( is_prep )
return pckbd_unexpected_up(keycode);
else if ( is_chrp )
#ifndef CONFIG_MAC_KEYBOARD
return pckbd_unexpected_up(keycode);
#else
if ( adb_hardware == ADB_NONE )
return pckbd_unexpected_up(keycode);
else
return mackbd_unexpected_up(keycode);
#endif
else
return mackbd_unexpected_up(keycode);
}
static inline void kbd_leds(unsigned char leds)
{
if ( is_prep )
pckbd_leds(leds);
else if ( is_chrp )
#ifndef CONFIG_MAC_KEYBOARD
pckbd_leds(leds);
#else
if ( adb_hardware == ADB_NONE )
pckbd_leds(leds);
else
mackbd_leds(leds);
#endif
else
mackbd_leds(leds);
}
static inline void kbd_init_hw(void)
{
if ( is_prep )
pckbd_init_hw();
else if ( is_chrp )
#ifndef CONFIG_MAC_KEYBOARD
pckbd_init_hw();
#else
if ( adb_hardware == ADB_NONE )
pckbd_init_hw();
else
mackbd_init_hw();
#endif
else
mackbd_init_hw();
}
#endif /* CONFIG_APUS */
/* How to access the keyboard macros on this platform. */
#define kbd_read_input() inb(KBD_DATA_REG)
#define kbd_read_status() inb(KBD_STATUS_REG)
#define kbd_write_output(val) outb(val, KBD_DATA_REG)
#define kbd_write_command(val) outb(val, KBD_CNTL_REG)
/* Some stoneage hardware needs delays after some operations. */
#define kbd_pause() do { } while(0)
#endif /* CONFIG_MAC_KEYBOARD */
#define keyboard_setup() \
request_region(0x60, 16, "keyboard")
/*
* Machine specific bits for the PS/2 driver
*
* FIXME: does any PPC machine use the PS/2 driver at all? If so,
* this should work, if not it's dead code ...
*/
#define AUX_IRQ 12
#define ps2_request_irq() \
request_irq(AUX_IRQ, aux_interrupt, 0, "PS/2 Mouse", NULL)
#define ps2_free_irq(inode) free_irq(AUX_IRQ, NULL)
#endif /* __KERNEL__ */
#endif /* __ASMPPC_KEYBOARD_H */
|