vserver 1.9.3
[linux-2.6.git] / drivers / input / serio / i8042-io.h
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 #elif defined(__arm__)
29 /* defined in include/asm-arm/arch-xxx/irqs.h */
30 #include <asm/irq.h>
31 #elif defined(CONFIG_SUPERH64)
32 #include <asm/irq.h>
33 #else
34 # define I8042_KBD_IRQ  1
35 # define I8042_AUX_IRQ  12
36 #endif
37
38 /*
39  * Register numbers.
40  */
41
42 #define I8042_COMMAND_REG       0x64    
43 #define I8042_STATUS_REG        0x64    
44 #define I8042_DATA_REG          0x60
45
46 static inline int i8042_read_data(void)
47 {
48         return inb(I8042_DATA_REG);
49 }
50
51 static inline int i8042_read_status(void)
52 {
53         return inb(I8042_STATUS_REG);
54 }
55
56 static inline void i8042_write_data(int val)
57 {
58         outb(val, I8042_DATA_REG);
59         return;
60 }
61
62 static inline void i8042_write_command(int val)
63 {
64         outb(val, I8042_COMMAND_REG);
65         return;
66 }
67
68 #if defined(__i386__)
69
70 #include <linux/dmi.h>
71
72 static struct dmi_system_id __initdata i8042_dmi_table[] = {
73         {
74                 .ident = "Compaq Proliant 8500",
75                 .matches = {
76                         DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
77                         DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"),
78                         DMI_MATCH(DMI_PRODUCT_VERSION, "8500"),
79                 },
80         },
81         {
82                 .ident = "Compaq Proliant DL760",
83                 .matches = {
84                         DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
85                         DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"),
86                         DMI_MATCH(DMI_PRODUCT_VERSION, "DL760"),
87                 },
88         },
89         { }
90 };
91 #endif
92
93 static inline int i8042_platform_init(void)
94 {
95 /*
96  * On ix86 platforms touching the i8042 data register region can do really
97  * bad things. Because of this the region is always reserved on ix86 boxes.
98  */
99 #if !defined(__i386__) && !defined(__sh__) && !defined(__alpha__) && !defined(__x86_64__) && !defined(__mips__)
100         if (!request_region(I8042_DATA_REG, 16, "i8042"))
101                 return -1;
102 #endif
103
104 #if !defined(__i386__) && !defined(__x86_64__)
105         i8042_reset = 1;
106 #endif
107
108 #if defined(__i386__)
109         if (dmi_check_system(i8042_dmi_table))
110                 i8042_noloop = 1;
111 #endif
112
113         return 0;
114 }
115
116 static inline void i8042_platform_exit(void)
117 {
118 #if !defined(__i386__) && !defined(__sh__) && !defined(__alpha__) && !defined(__x86_64__)
119         release_region(I8042_DATA_REG, 16);
120 #endif
121 }
122
123 #endif /* _I8042_IO_H */