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