Input: i8042 - bypass AUX IRQ delivery test on laptops
[safe/jmp/linux-2.6] / drivers / input / serio / i8042-x86ia64io.h
1 #ifndef _I8042_X86IA64IO_H
2 #define _I8042_X86IA64IO_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 #if defined(__ia64__)
23 # define I8042_MAP_IRQ(x)       isa_irq_to_vector((x))
24 #else
25 # define I8042_MAP_IRQ(x)       (x)
26 #endif
27
28 #define I8042_KBD_IRQ   i8042_kbd_irq
29 #define I8042_AUX_IRQ   i8042_aux_irq
30
31 static int i8042_kbd_irq;
32 static int i8042_aux_irq;
33
34 /*
35  * Register numbers.
36  */
37
38 #define I8042_COMMAND_REG       i8042_command_reg
39 #define I8042_STATUS_REG        i8042_command_reg
40 #define I8042_DATA_REG          i8042_data_reg
41
42 static int i8042_command_reg = 0x64;
43 static int i8042_data_reg = 0x60;
44
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 }
60
61 static inline void i8042_write_command(int val)
62 {
63         outb(val, I8042_COMMAND_REG);
64 }
65
66 #ifdef CONFIG_X86
67
68 #include <linux/dmi.h>
69
70 static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = {
71         {
72                 /* AUX LOOP command does not raise AUX IRQ */
73                 .ident = "Arima-Rioworks HDAMB",
74                 .matches = {
75                         DMI_MATCH(DMI_BOARD_VENDOR, "RIOWORKS"),
76                         DMI_MATCH(DMI_BOARD_NAME, "HDAMB"),
77                         DMI_MATCH(DMI_BOARD_VERSION, "Rev E"),
78                 },
79         },
80         {
81                 .ident = "ASUS G1S",
82                 .matches = {
83                         DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer Inc."),
84                         DMI_MATCH(DMI_BOARD_NAME, "G1S"),
85                         DMI_MATCH(DMI_BOARD_VERSION, "1.0"),
86                 },
87         },
88         {
89                 /* AUX LOOP command does not raise AUX IRQ */
90                 .ident = "ASUS P65UP5",
91                 .matches = {
92                         DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
93                         DMI_MATCH(DMI_BOARD_NAME, "P/I-P65UP5"),
94                         DMI_MATCH(DMI_BOARD_VERSION, "REV 2.X"),
95                 },
96         },
97         {
98                 .ident = "Compaq Proliant 8500",
99                 .matches = {
100                         DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
101                         DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"),
102                         DMI_MATCH(DMI_PRODUCT_VERSION, "8500"),
103                 },
104         },
105         {
106                 .ident = "Compaq Proliant DL760",
107                 .matches = {
108                         DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
109                         DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"),
110                         DMI_MATCH(DMI_PRODUCT_VERSION, "DL760"),
111                 },
112         },
113         {
114                 .ident = "OQO Model 01",
115                 .matches = {
116                         DMI_MATCH(DMI_SYS_VENDOR, "OQO"),
117                         DMI_MATCH(DMI_PRODUCT_NAME, "ZEPTO"),
118                         DMI_MATCH(DMI_PRODUCT_VERSION, "00"),
119                 },
120         },
121         {
122                 /* AUX LOOP does not work properly */
123                 .ident = "ULI EV4873",
124                 .matches = {
125                         DMI_MATCH(DMI_SYS_VENDOR, "ULI"),
126                         DMI_MATCH(DMI_PRODUCT_NAME, "EV4873"),
127                         DMI_MATCH(DMI_PRODUCT_VERSION, "5a"),
128                 },
129         },
130         {
131                 .ident = "Microsoft Virtual Machine",
132                 .matches = {
133                         DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
134                         DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"),
135                         DMI_MATCH(DMI_PRODUCT_VERSION, "VS2005R2"),
136                 },
137         },
138         {
139                 .ident = "Medion MAM 2070",
140                 .matches = {
141                         DMI_MATCH(DMI_SYS_VENDOR, "Notebook"),
142                         DMI_MATCH(DMI_PRODUCT_NAME, "MAM 2070"),
143                         DMI_MATCH(DMI_PRODUCT_VERSION, "5a"),
144                 },
145         },
146         {
147                 .ident = "Blue FB5601",
148                 .matches = {
149                         DMI_MATCH(DMI_SYS_VENDOR, "blue"),
150                         DMI_MATCH(DMI_PRODUCT_NAME, "FB5601"),
151                         DMI_MATCH(DMI_PRODUCT_VERSION, "M606"),
152                 },
153         },
154         {
155                 .ident = "Gigabyte M912",
156                 .matches = {
157                         DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
158                         DMI_MATCH(DMI_PRODUCT_NAME, "M912"),
159                         DMI_MATCH(DMI_PRODUCT_VERSION, "01"),
160                 },
161         },
162         {
163                 .ident = "HP DV9700",
164                 .matches = {
165                         DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
166                         DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv9700"),
167                         DMI_MATCH(DMI_PRODUCT_VERSION, "Rev 1"),
168                 },
169         },
170         { }
171 };
172
173 /*
174  * Some Fujitsu notebooks are having trouble with touchpads if
175  * active multiplexing mode is activated. Luckily they don't have
176  * external PS/2 ports so we can safely disable it.
177  * ... apparently some Toshibas don't like MUX mode either and
178  * die horrible death on reboot.
179  */
180 static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = {
181         {
182                 .ident = "Fujitsu Lifebook P7010/P7010D",
183                 .matches = {
184                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
185                         DMI_MATCH(DMI_PRODUCT_NAME, "P7010"),
186                 },
187         },
188         {
189                 .ident = "Fujitsu Lifebook P7010",
190                 .matches = {
191                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
192                         DMI_MATCH(DMI_PRODUCT_NAME, "0000000000"),
193                 },
194         },
195         {
196                 .ident = "Fujitsu Lifebook P5020D",
197                 .matches = {
198                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
199                         DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook P Series"),
200                 },
201         },
202         {
203                 .ident = "Fujitsu Lifebook S2000",
204                 .matches = {
205                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
206                         DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S Series"),
207                 },
208         },
209         {
210                 .ident = "Fujitsu Lifebook S6230",
211                 .matches = {
212                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
213                         DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S6230"),
214                 },
215         },
216         {
217                 .ident = "Fujitsu T70H",
218                 .matches = {
219                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
220                         DMI_MATCH(DMI_PRODUCT_NAME, "FMVLT70H"),
221                 },
222         },
223         {
224                 .ident = "Fujitsu-Siemens Lifebook T3010",
225                 .matches = {
226                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
227                         DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK T3010"),
228                 },
229         },
230         {
231                 .ident = "Fujitsu-Siemens Lifebook E4010",
232                 .matches = {
233                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
234                         DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E4010"),
235                 },
236         },
237         {
238                 .ident = "Fujitsu-Siemens Amilo Pro 2010",
239                 .matches = {
240                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
241                         DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pro V2010"),
242                 },
243         },
244         {
245                 .ident = "Fujitsu-Siemens Amilo Pro 2030",
246                 .matches = {
247                         DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
248                         DMI_MATCH(DMI_PRODUCT_NAME, "AMILO PRO V2030"),
249                 },
250         },
251         {
252                 /*
253                  * No data is coming from the touchscreen unless KBC
254                  * is in legacy mode.
255                  */
256                 .ident = "Panasonic CF-29",
257                 .matches = {
258                         DMI_MATCH(DMI_SYS_VENDOR, "Matsushita"),
259                         DMI_MATCH(DMI_PRODUCT_NAME, "CF-29"),
260                 },
261         },
262         {
263                 /*
264                  * Errors on MUX ports are reported without raising AUXDATA
265                  * causing "spurious NAK" messages.
266                  */
267                 .ident = "HP Pavilion DV4017EA",
268                 .matches = {
269                         DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
270                         DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EA032EA#ABF)"),
271                 },
272         },
273         {
274                 /*
275                  * Like DV4017EA does not raise AUXERR for errors on MUX ports.
276                  */
277                 .ident = "HP Pavilion ZT1000",
278                 .matches = {
279                         DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
280                         DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion Notebook PC"),
281                         DMI_MATCH(DMI_PRODUCT_VERSION, "HP Pavilion Notebook ZT1000"),
282                 },
283         },
284         {
285                 /*
286                  * Like DV4017EA does not raise AUXERR for errors on MUX ports.
287                  */
288                 .ident = "HP Pavilion DV4270ca",
289                 .matches = {
290                         DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
291                         DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EH476UA#ABL)"),
292                 },
293         },
294         {
295                 .ident = "Toshiba P10",
296                 .matches = {
297                         DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
298                         DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P10"),
299                 },
300         },
301         {
302                 .ident = "Toshiba Equium A110",
303                 .matches = {
304                         DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
305                         DMI_MATCH(DMI_PRODUCT_NAME, "EQUIUM A110"),
306                 },
307         },
308         {
309                 .ident = "Alienware Sentia",
310                 .matches = {
311                         DMI_MATCH(DMI_SYS_VENDOR, "ALIENWARE"),
312                         DMI_MATCH(DMI_PRODUCT_NAME, "Sentia"),
313                 },
314         },
315         {
316                 .ident = "Sharp Actius MM20",
317                 .matches = {
318                         DMI_MATCH(DMI_SYS_VENDOR, "SHARP"),
319                         DMI_MATCH(DMI_PRODUCT_NAME, "PC-MM20 Series"),
320                 },
321         },
322         {
323                 .ident = "Sony Vaio FS-115b",
324                 .matches = {
325                         DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
326                         DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FS115B"),
327                 },
328         },
329         {
330                 .ident = "Amoi M636/A737",
331                 .matches = {
332                         DMI_MATCH(DMI_SYS_VENDOR, "Amoi Electronics CO.,LTD."),
333                         DMI_MATCH(DMI_PRODUCT_NAME, "M636/A737 platform"),
334                 },
335         },
336         {
337                 .ident = "Lenovo 3000 n100",
338                 .matches = {
339                         DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
340                         DMI_MATCH(DMI_PRODUCT_NAME, "076804U"),
341                 },
342         },
343         {
344                 .ident = "Acer Aspire 1360",
345                 .matches = {
346                         DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
347                         DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1360"),
348                 },
349         },
350         {
351                 .ident = "Gericom Bellagio",
352                 .matches = {
353                         DMI_MATCH(DMI_SYS_VENDOR, "Gericom"),
354                         DMI_MATCH(DMI_PRODUCT_NAME, "N34AS6"),
355                 },
356         },
357         {
358                 .ident = "IBM 2656",
359                 .matches = {
360                         DMI_MATCH(DMI_SYS_VENDOR, "IBM"),
361                         DMI_MATCH(DMI_PRODUCT_NAME, "2656"),
362                 },
363         },
364         {
365                 .ident = "Dell XPS M1530",
366                 .matches = {
367                         DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
368                         DMI_MATCH(DMI_PRODUCT_NAME, "XPS M1530"),
369                 },
370         },
371         {
372                 .ident = "Compal HEL80I",
373                 .matches = {
374                         DMI_MATCH(DMI_SYS_VENDOR, "COMPAL"),
375                         DMI_MATCH(DMI_PRODUCT_NAME, "HEL80I"),
376                 },
377         },
378         {
379                 .ident = "Dell Vostro 1510",
380                 .matches = {
381                         DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
382                         DMI_MATCH(DMI_PRODUCT_NAME, "Vostro1510"),
383                 },
384         },
385         { }
386 };
387
388 static struct dmi_system_id __initdata i8042_dmi_reset_table[] = {
389         {
390                 .ident = "MSI Wind U-100",
391                 .matches = {
392                         DMI_MATCH(DMI_BOARD_NAME, "U-100"),
393                         DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"),
394                 },
395         },
396         {
397                 .ident = "LG Electronics X110",
398                 .matches = {
399                         DMI_MATCH(DMI_BOARD_NAME, "X110"),
400                         DMI_MATCH(DMI_BOARD_VENDOR, "LG Electronics Inc."),
401                 },
402         },
403         {
404                 .ident = "Acer Aspire One 150",
405                 .matches = {
406                         DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
407                         DMI_MATCH(DMI_PRODUCT_NAME, "AOA150"),
408                 },
409         },
410         {
411                 .ident = "Advent 4211",
412                 .matches = {
413                         DMI_MATCH(DMI_SYS_VENDOR, "DIXONSXP"),
414                         DMI_MATCH(DMI_PRODUCT_NAME, "Advent 4211"),
415                 },
416         },
417         {
418                 .ident = "Medion Akoya Mini E1210",
419                 .matches = {
420                         DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
421                         DMI_MATCH(DMI_PRODUCT_NAME, "E1210"),
422                 },
423         },
424         {
425                 .ident = "Mivvy M310",
426                 .matches = {
427                         DMI_MATCH(DMI_SYS_VENDOR, "VIOOO"),
428                         DMI_MATCH(DMI_PRODUCT_NAME, "N10"),
429                 },
430         },
431         { }
432 };
433
434 #ifdef CONFIG_PNP
435 static struct dmi_system_id __initdata i8042_dmi_nopnp_table[] = {
436         {
437                 .ident = "Intel MBO Desktop D845PESV",
438                 .matches = {
439                         DMI_MATCH(DMI_BOARD_NAME, "D845PESV"),
440                         DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"),
441                 },
442         },
443         {
444                 .ident = "MSI Wind U-100",
445                 .matches = {
446                         DMI_MATCH(DMI_BOARD_NAME, "U-100"),
447                         DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"),
448                 },
449         },
450         { }
451 };
452
453 static struct dmi_system_id __initdata i8042_dmi_laptop_table[] = {
454         {
455                 .ident = "Portable",
456                 .matches = {
457                         DMI_MATCH(DMI_CHASSIS_TYPE, "8"), /* Portable */
458                 },
459         },
460         {
461                 .ident = "Laptop",
462                 .matches = {
463                         DMI_MATCH(DMI_CHASSIS_TYPE, "9"), /* Laptop */
464                 },
465         },
466         {
467                 .ident = "Notebook",
468                 .matches = {
469                         DMI_MATCH(DMI_CHASSIS_TYPE, "10"), /* Notebook */
470                 },
471         },
472         {
473                 .ident = "Sub-Notebook",
474                 .matches = {
475                         DMI_MATCH(DMI_CHASSIS_TYPE, "14"), /* Sub-Notebook */
476                 },
477         },
478         { }
479 };
480 #endif
481
482 /*
483  * Some Wistron based laptops need us to explicitly enable the 'Dritek
484  * keyboard extension' to make their extra keys start generating scancodes.
485  * Originally, this was just confined to older laptops, but a few Acer laptops
486  * have turned up in 2007 that also need this again.
487  */
488 static struct dmi_system_id __initdata i8042_dmi_dritek_table[] = {
489         {
490                 .ident = "Acer Aspire 5630",
491                 .matches = {
492                         DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
493                         DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5630"),
494                 },
495         },
496         {
497                 .ident = "Acer Aspire 5650",
498                 .matches = {
499                         DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
500                         DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5650"),
501                 },
502         },
503         {
504                 .ident = "Acer Aspire 5680",
505                 .matches = {
506                         DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
507                         DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5680"),
508                 },
509         },
510         {
511                 .ident = "Acer Aspire 5720",
512                 .matches = {
513                         DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
514                         DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5720"),
515                 },
516         },
517         {
518                 .ident = "Acer Aspire 9110",
519                 .matches = {
520                         DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
521                         DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 9110"),
522                 },
523         },
524         {
525                 .ident = "Acer TravelMate 660",
526                 .matches = {
527                         DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
528                         DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 660"),
529                 },
530         },
531         {
532                 .ident = "Acer TravelMate 2490",
533                 .matches = {
534                         DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
535                         DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 2490"),
536                 },
537         },
538         {
539                 .ident = "Acer TravelMate 4280",
540                 .matches = {
541                         DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
542                         DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 4280"),
543                 },
544         },
545         { }
546 };
547
548 #endif /* CONFIG_X86 */
549
550 #ifdef CONFIG_PNP
551 #include <linux/pnp.h>
552
553 static int i8042_pnp_kbd_registered;
554 static unsigned int i8042_pnp_kbd_devices;
555 static int i8042_pnp_aux_registered;
556 static unsigned int i8042_pnp_aux_devices;
557
558 static int i8042_pnp_command_reg;
559 static int i8042_pnp_data_reg;
560 static int i8042_pnp_kbd_irq;
561 static int i8042_pnp_aux_irq;
562
563 static char i8042_pnp_kbd_name[32];
564 static char i8042_pnp_aux_name[32];
565
566 static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id *did)
567 {
568         if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1)
569                 i8042_pnp_data_reg = pnp_port_start(dev,0);
570
571         if (pnp_port_valid(dev, 1) && pnp_port_len(dev, 1) == 1)
572                 i8042_pnp_command_reg = pnp_port_start(dev, 1);
573
574         if (pnp_irq_valid(dev,0))
575                 i8042_pnp_kbd_irq = pnp_irq(dev, 0);
576
577         strlcpy(i8042_pnp_kbd_name, did->id, sizeof(i8042_pnp_kbd_name));
578         if (strlen(pnp_dev_name(dev))) {
579                 strlcat(i8042_pnp_kbd_name, ":", sizeof(i8042_pnp_kbd_name));
580                 strlcat(i8042_pnp_kbd_name, pnp_dev_name(dev), sizeof(i8042_pnp_kbd_name));
581         }
582
583         i8042_pnp_kbd_devices++;
584         return 0;
585 }
586
587 static int i8042_pnp_aux_probe(struct pnp_dev *dev, const struct pnp_device_id *did)
588 {
589         if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1)
590                 i8042_pnp_data_reg = pnp_port_start(dev,0);
591
592         if (pnp_port_valid(dev, 1) && pnp_port_len(dev, 1) == 1)
593                 i8042_pnp_command_reg = pnp_port_start(dev, 1);
594
595         if (pnp_irq_valid(dev, 0))
596                 i8042_pnp_aux_irq = pnp_irq(dev, 0);
597
598         strlcpy(i8042_pnp_aux_name, did->id, sizeof(i8042_pnp_aux_name));
599         if (strlen(pnp_dev_name(dev))) {
600                 strlcat(i8042_pnp_aux_name, ":", sizeof(i8042_pnp_aux_name));
601                 strlcat(i8042_pnp_aux_name, pnp_dev_name(dev), sizeof(i8042_pnp_aux_name));
602         }
603
604         i8042_pnp_aux_devices++;
605         return 0;
606 }
607
608 static struct pnp_device_id pnp_kbd_devids[] = {
609         { .id = "PNP0303", .driver_data = 0 },
610         { .id = "PNP030b", .driver_data = 0 },
611         { .id = "", },
612 };
613
614 static struct pnp_driver i8042_pnp_kbd_driver = {
615         .name           = "i8042 kbd",
616         .id_table       = pnp_kbd_devids,
617         .probe          = i8042_pnp_kbd_probe,
618 };
619
620 static struct pnp_device_id pnp_aux_devids[] = {
621         { .id = "FJC6000", .driver_data = 0 },
622         { .id = "FJC6001", .driver_data = 0 },
623         { .id = "PNP0f03", .driver_data = 0 },
624         { .id = "PNP0f0b", .driver_data = 0 },
625         { .id = "PNP0f0e", .driver_data = 0 },
626         { .id = "PNP0f12", .driver_data = 0 },
627         { .id = "PNP0f13", .driver_data = 0 },
628         { .id = "PNP0f19", .driver_data = 0 },
629         { .id = "PNP0f1c", .driver_data = 0 },
630         { .id = "SYN0801", .driver_data = 0 },
631         { .id = "", },
632 };
633
634 static struct pnp_driver i8042_pnp_aux_driver = {
635         .name           = "i8042 aux",
636         .id_table       = pnp_aux_devids,
637         .probe          = i8042_pnp_aux_probe,
638 };
639
640 static void i8042_pnp_exit(void)
641 {
642         if (i8042_pnp_kbd_registered) {
643                 i8042_pnp_kbd_registered = 0;
644                 pnp_unregister_driver(&i8042_pnp_kbd_driver);
645         }
646
647         if (i8042_pnp_aux_registered) {
648                 i8042_pnp_aux_registered = 0;
649                 pnp_unregister_driver(&i8042_pnp_aux_driver);
650         }
651 }
652
653 static int __init i8042_pnp_init(void)
654 {
655         char kbd_irq_str[4] = { 0 }, aux_irq_str[4] = { 0 };
656         int pnp_data_busted = 0;
657         int err;
658
659 #ifdef CONFIG_X86
660         if (dmi_check_system(i8042_dmi_nopnp_table))
661                 i8042_nopnp = 1;
662 #endif
663
664         if (i8042_nopnp) {
665                 printk(KERN_INFO "i8042: PNP detection disabled\n");
666                 return 0;
667         }
668
669         err = pnp_register_driver(&i8042_pnp_kbd_driver);
670         if (!err)
671                 i8042_pnp_kbd_registered = 1;
672
673         err = pnp_register_driver(&i8042_pnp_aux_driver);
674         if (!err)
675                 i8042_pnp_aux_registered = 1;
676
677         if (!i8042_pnp_kbd_devices && !i8042_pnp_aux_devices) {
678                 i8042_pnp_exit();
679 #if defined(__ia64__)
680                 return -ENODEV;
681 #else
682                 printk(KERN_INFO "PNP: No PS/2 controller found. Probing ports directly.\n");
683                 return 0;
684 #endif
685         }
686
687         if (i8042_pnp_kbd_devices)
688                 snprintf(kbd_irq_str, sizeof(kbd_irq_str),
689                         "%d", i8042_pnp_kbd_irq);
690         if (i8042_pnp_aux_devices)
691                 snprintf(aux_irq_str, sizeof(aux_irq_str),
692                         "%d", i8042_pnp_aux_irq);
693
694         printk(KERN_INFO "PNP: PS/2 Controller [%s%s%s] at %#x,%#x irq %s%s%s\n",
695                 i8042_pnp_kbd_name, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "",
696                 i8042_pnp_aux_name,
697                 i8042_pnp_data_reg, i8042_pnp_command_reg,
698                 kbd_irq_str, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "",
699                 aux_irq_str);
700
701 #if defined(__ia64__)
702         if (!i8042_pnp_kbd_devices)
703                 i8042_nokbd = 1;
704         if (!i8042_pnp_aux_devices)
705                 i8042_noaux = 1;
706 #endif
707
708         if (((i8042_pnp_data_reg & ~0xf) == (i8042_data_reg & ~0xf) &&
709               i8042_pnp_data_reg != i8042_data_reg) ||
710             !i8042_pnp_data_reg) {
711                 printk(KERN_WARNING
712                         "PNP: PS/2 controller has invalid data port %#x; "
713                         "using default %#x\n",
714                         i8042_pnp_data_reg, i8042_data_reg);
715                 i8042_pnp_data_reg = i8042_data_reg;
716                 pnp_data_busted = 1;
717         }
718
719         if (((i8042_pnp_command_reg & ~0xf) == (i8042_command_reg & ~0xf) &&
720               i8042_pnp_command_reg != i8042_command_reg) ||
721             !i8042_pnp_command_reg) {
722                 printk(KERN_WARNING
723                         "PNP: PS/2 controller has invalid command port %#x; "
724                         "using default %#x\n",
725                         i8042_pnp_command_reg, i8042_command_reg);
726                 i8042_pnp_command_reg = i8042_command_reg;
727                 pnp_data_busted = 1;
728         }
729
730         if (!i8042_nokbd && !i8042_pnp_kbd_irq) {
731                 printk(KERN_WARNING
732                         "PNP: PS/2 controller doesn't have KBD irq; "
733                         "using default %d\n", i8042_kbd_irq);
734                 i8042_pnp_kbd_irq = i8042_kbd_irq;
735                 pnp_data_busted = 1;
736         }
737
738         if (!i8042_noaux && !i8042_pnp_aux_irq) {
739                 if (!pnp_data_busted && i8042_pnp_kbd_irq) {
740                         printk(KERN_WARNING
741                                 "PNP: PS/2 appears to have AUX port disabled, "
742                                 "if this is incorrect please boot with "
743                                 "i8042.nopnp\n");
744                         i8042_noaux = 1;
745                 } else {
746                         printk(KERN_WARNING
747                                 "PNP: PS/2 controller doesn't have AUX irq; "
748                                 "using default %d\n", i8042_aux_irq);
749                         i8042_pnp_aux_irq = i8042_aux_irq;
750                 }
751         }
752
753         i8042_data_reg = i8042_pnp_data_reg;
754         i8042_command_reg = i8042_pnp_command_reg;
755         i8042_kbd_irq = i8042_pnp_kbd_irq;
756         i8042_aux_irq = i8042_pnp_aux_irq;
757
758 #ifdef CONFIG_X86
759         i8042_bypass_aux_irq_test = !pnp_data_busted &&
760                                     dmi_check_system(i8042_dmi_laptop_table);
761 #endif
762
763         return 0;
764 }
765
766 #else
767 static inline int i8042_pnp_init(void) { return 0; }
768 static inline void i8042_pnp_exit(void) { }
769 #endif
770
771 static int __init i8042_platform_init(void)
772 {
773         int retval;
774
775 /*
776  * On ix86 platforms touching the i8042 data register region can do really
777  * bad things. Because of this the region is always reserved on ix86 boxes.
778  *
779  *      if (!request_region(I8042_DATA_REG, 16, "i8042"))
780  *              return -EBUSY;
781  */
782
783         i8042_kbd_irq = I8042_MAP_IRQ(1);
784         i8042_aux_irq = I8042_MAP_IRQ(12);
785
786         retval = i8042_pnp_init();
787         if (retval)
788                 return retval;
789
790 #if defined(__ia64__)
791         i8042_reset = 1;
792 #endif
793
794 #ifdef CONFIG_X86
795         if (dmi_check_system(i8042_dmi_reset_table))
796                 i8042_reset = 1;
797
798         if (dmi_check_system(i8042_dmi_noloop_table))
799                 i8042_noloop = 1;
800
801         if (dmi_check_system(i8042_dmi_nomux_table))
802                 i8042_nomux = 1;
803
804         if (dmi_check_system(i8042_dmi_dritek_table))
805                 i8042_dritek = 1;
806 #endif /* CONFIG_X86 */
807
808         return retval;
809 }
810
811 static inline void i8042_platform_exit(void)
812 {
813         i8042_pnp_exit();
814 }
815
816 #endif /* _I8042_X86IA64IO_H */