Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
494 | giacomo | 1 | #ifndef _I8042_IO_H |
2 | #define _I8042_IO_H |
||
3 | |||
4 | /* |
||
5 | * This program is free software; you can redistribute it and/or modify it |
||
6 | * under the terms of the GNU General Public License version 2 as published by |
||
7 | * the Free Software Foundation. |
||
8 | */ |
||
9 | |||
10 | /* |
||
11 | * Names. |
||
12 | */ |
||
13 | |||
14 | #define I8042_KBD_PHYS_DESC "isa0060/serio0" |
||
15 | #define I8042_AUX_PHYS_DESC "isa0060/serio1" |
||
16 | #define I8042_MUX_PHYS_DESC "isa0060/serio%d" |
||
17 | |||
18 | /* |
||
19 | * IRQs. |
||
20 | */ |
||
21 | |||
22 | #ifdef __alpha__ |
||
23 | # define I8042_KBD_IRQ 1 |
||
24 | # define I8042_AUX_IRQ (RTC_PORT(0) == 0x170 ? 9 : 12) /* Jensen is special */ |
||
25 | #elif defined(__ia64__) |
||
26 | # define I8042_KBD_IRQ isa_irq_to_vector(1) |
||
27 | # define I8042_AUX_IRQ isa_irq_to_vector(12) |
||
28 | #else |
||
29 | # define I8042_KBD_IRQ 1 |
||
30 | # define I8042_AUX_IRQ 12 |
||
31 | #endif |
||
32 | |||
33 | /* |
||
34 | * Register numbers. |
||
35 | */ |
||
36 | |||
37 | #define I8042_COMMAND_REG 0x64 |
||
38 | #define I8042_STATUS_REG 0x64 |
||
39 | #define I8042_DATA_REG 0x60 |
||
40 | |||
41 | static inline int i8042_read_data(void) |
||
42 | { |
||
43 | return inb(I8042_DATA_REG); |
||
44 | } |
||
45 | |||
46 | static inline int i8042_read_status(void) |
||
47 | { |
||
48 | return inb(I8042_STATUS_REG); |
||
49 | } |
||
50 | |||
51 | static inline void i8042_write_data(int val) |
||
52 | { |
||
53 | outb(val, I8042_DATA_REG); |
||
54 | return; |
||
55 | } |
||
56 | |||
57 | static inline void i8042_write_command(int val) |
||
58 | { |
||
59 | outb(val, I8042_COMMAND_REG); |
||
60 | return; |
||
61 | } |
||
62 | |||
63 | static inline int i8042_platform_init(void) |
||
64 | { |
||
65 | /* |
||
66 | * On ix86 platforms touching the i8042 data register region can do really |
||
67 | * bad things. Because of this the region is always reserved on ix86 boxes. |
||
68 | */ |
||
69 | #if !defined(__i386__) && !defined(__sh__) && !defined(__alpha__) && !defined(__x86_64__) |
||
70 | if (!request_region(I8042_DATA_REG, 16, "i8042")) |
||
71 | return -1; |
||
72 | #endif |
||
73 | |||
74 | #if !defined(__i386__) && !defined(__x86_64__) |
||
75 | i8042_reset = 1; |
||
76 | #endif |
||
77 | return 0; |
||
78 | } |
||
79 | |||
80 | static inline void i8042_platform_exit(void) |
||
81 | { |
||
82 | #if !defined(__i386__) && !defined(__sh__) && !defined(__alpha__) && !defined(__x86_64__) |
||
83 | release_region(I8042_DATA_REG, 16); |
||
84 | #endif |
||
85 | } |
||
86 | |||
87 | #endif /* _I8042_IO_H */ |