rtlwifi: Change order in device startup
[deliverable/linux.git] / 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 #ifdef CONFIG_X86
11 #include <asm/x86_init.h>
12 #endif
13
14 /*
15 * Names.
16 */
17
18 #define I8042_KBD_PHYS_DESC "isa0060/serio0"
19 #define I8042_AUX_PHYS_DESC "isa0060/serio1"
20 #define I8042_MUX_PHYS_DESC "isa0060/serio%d"
21
22 /*
23 * IRQs.
24 */
25
26 #if defined(__ia64__)
27 # define I8042_MAP_IRQ(x) isa_irq_to_vector((x))
28 #else
29 # define I8042_MAP_IRQ(x) (x)
30 #endif
31
32 #define I8042_KBD_IRQ i8042_kbd_irq
33 #define I8042_AUX_IRQ i8042_aux_irq
34
35 static int i8042_kbd_irq;
36 static int i8042_aux_irq;
37
38 /*
39 * Register numbers.
40 */
41
42 #define I8042_COMMAND_REG i8042_command_reg
43 #define I8042_STATUS_REG i8042_command_reg
44 #define I8042_DATA_REG i8042_data_reg
45
46 static int i8042_command_reg = 0x64;
47 static int i8042_data_reg = 0x60;
48
49
50 static inline int i8042_read_data(void)
51 {
52 return inb(I8042_DATA_REG);
53 }
54
55 static inline int i8042_read_status(void)
56 {
57 return inb(I8042_STATUS_REG);
58 }
59
60 static inline void i8042_write_data(int val)
61 {
62 outb(val, I8042_DATA_REG);
63 }
64
65 static inline void i8042_write_command(int val)
66 {
67 outb(val, I8042_COMMAND_REG);
68 }
69
70 #ifdef CONFIG_X86
71
72 #include <linux/dmi.h>
73
74 static const struct dmi_system_id __initconst i8042_dmi_noloop_table[] = {
75 {
76 /*
77 * Arima-Rioworks HDAMB -
78 * AUX LOOP command does not raise AUX IRQ
79 */
80 .matches = {
81 DMI_MATCH(DMI_BOARD_VENDOR, "RIOWORKS"),
82 DMI_MATCH(DMI_BOARD_NAME, "HDAMB"),
83 DMI_MATCH(DMI_BOARD_VERSION, "Rev E"),
84 },
85 },
86 {
87 /* ASUS G1S */
88 .matches = {
89 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer Inc."),
90 DMI_MATCH(DMI_BOARD_NAME, "G1S"),
91 DMI_MATCH(DMI_BOARD_VERSION, "1.0"),
92 },
93 },
94 {
95 /* ASUS P65UP5 - AUX LOOP command does not raise AUX IRQ */
96 .matches = {
97 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
98 DMI_MATCH(DMI_BOARD_NAME, "P/I-P65UP5"),
99 DMI_MATCH(DMI_BOARD_VERSION, "REV 2.X"),
100 },
101 },
102 {
103 .matches = {
104 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
105 DMI_MATCH(DMI_PRODUCT_NAME, "X750LN"),
106 },
107 },
108 {
109 .matches = {
110 DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
111 DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"),
112 DMI_MATCH(DMI_PRODUCT_VERSION, "8500"),
113 },
114 },
115 {
116 .matches = {
117 DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
118 DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"),
119 DMI_MATCH(DMI_PRODUCT_VERSION, "DL760"),
120 },
121 },
122 {
123 /* OQO Model 01 */
124 .matches = {
125 DMI_MATCH(DMI_SYS_VENDOR, "OQO"),
126 DMI_MATCH(DMI_PRODUCT_NAME, "ZEPTO"),
127 DMI_MATCH(DMI_PRODUCT_VERSION, "00"),
128 },
129 },
130 {
131 /* ULI EV4873 - AUX LOOP does not work properly */
132 .matches = {
133 DMI_MATCH(DMI_SYS_VENDOR, "ULI"),
134 DMI_MATCH(DMI_PRODUCT_NAME, "EV4873"),
135 DMI_MATCH(DMI_PRODUCT_VERSION, "5a"),
136 },
137 },
138 {
139 /* Microsoft Virtual Machine */
140 .matches = {
141 DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
142 DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"),
143 DMI_MATCH(DMI_PRODUCT_VERSION, "VS2005R2"),
144 },
145 },
146 {
147 /* Medion MAM 2070 */
148 .matches = {
149 DMI_MATCH(DMI_SYS_VENDOR, "Notebook"),
150 DMI_MATCH(DMI_PRODUCT_NAME, "MAM 2070"),
151 DMI_MATCH(DMI_PRODUCT_VERSION, "5a"),
152 },
153 },
154 {
155 /* Blue FB5601 */
156 .matches = {
157 DMI_MATCH(DMI_SYS_VENDOR, "blue"),
158 DMI_MATCH(DMI_PRODUCT_NAME, "FB5601"),
159 DMI_MATCH(DMI_PRODUCT_VERSION, "M606"),
160 },
161 },
162 {
163 /* Gigabyte M912 */
164 .matches = {
165 DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
166 DMI_MATCH(DMI_PRODUCT_NAME, "M912"),
167 DMI_MATCH(DMI_PRODUCT_VERSION, "01"),
168 },
169 },
170 {
171 /* Gigabyte M1022M netbook */
172 .matches = {
173 DMI_MATCH(DMI_BOARD_VENDOR, "Gigabyte Technology Co.,Ltd."),
174 DMI_MATCH(DMI_BOARD_NAME, "M1022E"),
175 DMI_MATCH(DMI_BOARD_VERSION, "1.02"),
176 },
177 },
178 {
179 /* Gigabyte Spring Peak - defines wrong chassis type */
180 .matches = {
181 DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
182 DMI_MATCH(DMI_PRODUCT_NAME, "Spring Peak"),
183 },
184 },
185 {
186 /* Gigabyte T1005 - defines wrong chassis type ("Other") */
187 .matches = {
188 DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
189 DMI_MATCH(DMI_PRODUCT_NAME, "T1005"),
190 },
191 },
192 {
193 /* Gigabyte T1005M/P - defines wrong chassis type ("Other") */
194 .matches = {
195 DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
196 DMI_MATCH(DMI_PRODUCT_NAME, "T1005M/P"),
197 },
198 },
199 {
200 .matches = {
201 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
202 DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv9700"),
203 DMI_MATCH(DMI_PRODUCT_VERSION, "Rev 1"),
204 },
205 },
206 { }
207 };
208
209 /*
210 * Some laptops do implement active multiplexing mode correctly;
211 * unfortunately they are in minority.
212 */
213 static const struct dmi_system_id __initconst i8042_dmi_mux_table[] = {
214 {
215 /*
216 * Panasonic CF-18 needs to be in MUX mode since the
217 * touchscreen is on serio3 and it also has touchpad.
218 */
219 .matches = {
220 DMI_MATCH(DMI_PRODUCT_NAME, "CF-18"),
221 },
222 },
223 { }
224 };
225
226 static const struct dmi_system_id __initconst i8042_dmi_reset_table[] = {
227 {
228 /* MSI Wind U-100 */
229 .matches = {
230 DMI_MATCH(DMI_BOARD_NAME, "U-100"),
231 DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"),
232 },
233 },
234 {
235 /* LG Electronics X110 */
236 .matches = {
237 DMI_MATCH(DMI_BOARD_NAME, "X110"),
238 DMI_MATCH(DMI_BOARD_VENDOR, "LG Electronics Inc."),
239 },
240 },
241 {
242 /* Acer Aspire One 150 */
243 .matches = {
244 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
245 DMI_MATCH(DMI_PRODUCT_NAME, "AOA150"),
246 },
247 },
248 {
249 /* Advent 4211 */
250 .matches = {
251 DMI_MATCH(DMI_SYS_VENDOR, "DIXONSXP"),
252 DMI_MATCH(DMI_PRODUCT_NAME, "Advent 4211"),
253 },
254 },
255 {
256 /* Medion Akoya Mini E1210 */
257 .matches = {
258 DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
259 DMI_MATCH(DMI_PRODUCT_NAME, "E1210"),
260 },
261 },
262 {
263 /* Medion Akoya E1222 */
264 .matches = {
265 DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
266 DMI_MATCH(DMI_PRODUCT_NAME, "E122X"),
267 },
268 },
269 {
270 /* Mivvy M310 */
271 .matches = {
272 DMI_MATCH(DMI_SYS_VENDOR, "VIOOO"),
273 DMI_MATCH(DMI_PRODUCT_NAME, "N10"),
274 },
275 },
276 {
277 /* Dell Vostro 1320 */
278 .matches = {
279 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
280 DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1320"),
281 },
282 },
283 {
284 /* Dell Vostro 1520 */
285 .matches = {
286 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
287 DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1520"),
288 },
289 },
290 {
291 /* Dell Vostro 1720 */
292 .matches = {
293 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
294 DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1720"),
295 },
296 },
297 {
298 /* Lenovo Ideapad U455 */
299 .matches = {
300 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
301 DMI_MATCH(DMI_PRODUCT_NAME, "20046"),
302 },
303 },
304 { }
305 };
306
307 #ifdef CONFIG_PNP
308 static const struct dmi_system_id __initconst i8042_dmi_nopnp_table[] = {
309 {
310 /* Intel MBO Desktop D845PESV */
311 .matches = {
312 DMI_MATCH(DMI_BOARD_NAME, "D845PESV"),
313 DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"),
314 },
315 },
316 {
317 /* MSI Wind U-100 */
318 .matches = {
319 DMI_MATCH(DMI_BOARD_NAME, "U-100"),
320 DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"),
321 },
322 },
323 { }
324 };
325
326 static const struct dmi_system_id __initconst i8042_dmi_laptop_table[] = {
327 {
328 .matches = {
329 DMI_MATCH(DMI_CHASSIS_TYPE, "8"), /* Portable */
330 },
331 },
332 {
333 .matches = {
334 DMI_MATCH(DMI_CHASSIS_TYPE, "9"), /* Laptop */
335 },
336 },
337 {
338 .matches = {
339 DMI_MATCH(DMI_CHASSIS_TYPE, "10"), /* Notebook */
340 },
341 },
342 {
343 .matches = {
344 DMI_MATCH(DMI_CHASSIS_TYPE, "14"), /* Sub-Notebook */
345 },
346 },
347 { }
348 };
349 #endif
350
351 static const struct dmi_system_id __initconst i8042_dmi_notimeout_table[] = {
352 {
353 /* Dell Vostro V13 */
354 .matches = {
355 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
356 DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V13"),
357 },
358 },
359 {
360 /* Newer HP Pavilion dv4 models */
361 .matches = {
362 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
363 DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"),
364 },
365 },
366 {
367 /* Fujitsu U574 laptop */
368 /* https://bugzilla.kernel.org/show_bug.cgi?id=69731 */
369 .matches = {
370 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
371 DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK U574"),
372 },
373 },
374 { }
375 };
376
377 /*
378 * Some Wistron based laptops need us to explicitly enable the 'Dritek
379 * keyboard extension' to make their extra keys start generating scancodes.
380 * Originally, this was just confined to older laptops, but a few Acer laptops
381 * have turned up in 2007 that also need this again.
382 */
383 static const struct dmi_system_id __initconst i8042_dmi_dritek_table[] = {
384 {
385 /* Acer Aspire 5100 */
386 .matches = {
387 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
388 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5100"),
389 },
390 },
391 {
392 /* Acer Aspire 5610 */
393 .matches = {
394 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
395 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5610"),
396 },
397 },
398 {
399 /* Acer Aspire 5630 */
400 .matches = {
401 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
402 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5630"),
403 },
404 },
405 {
406 /* Acer Aspire 5650 */
407 .matches = {
408 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
409 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5650"),
410 },
411 },
412 {
413 /* Acer Aspire 5680 */
414 .matches = {
415 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
416 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5680"),
417 },
418 },
419 {
420 /* Acer Aspire 5720 */
421 .matches = {
422 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
423 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5720"),
424 },
425 },
426 {
427 /* Acer Aspire 9110 */
428 .matches = {
429 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
430 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 9110"),
431 },
432 },
433 {
434 /* Acer TravelMate 660 */
435 .matches = {
436 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
437 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 660"),
438 },
439 },
440 {
441 /* Acer TravelMate 2490 */
442 .matches = {
443 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
444 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 2490"),
445 },
446 },
447 {
448 /* Acer TravelMate 4280 */
449 .matches = {
450 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
451 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 4280"),
452 },
453 },
454 { }
455 };
456
457 #endif /* CONFIG_X86 */
458
459 #ifdef CONFIG_PNP
460 #include <linux/pnp.h>
461
462 static bool i8042_pnp_kbd_registered;
463 static unsigned int i8042_pnp_kbd_devices;
464 static bool i8042_pnp_aux_registered;
465 static unsigned int i8042_pnp_aux_devices;
466
467 static int i8042_pnp_command_reg;
468 static int i8042_pnp_data_reg;
469 static int i8042_pnp_kbd_irq;
470 static int i8042_pnp_aux_irq;
471
472 static char i8042_pnp_kbd_name[32];
473 static char i8042_pnp_aux_name[32];
474
475 static void i8042_pnp_id_to_string(struct pnp_id *id, char *dst, int dst_size)
476 {
477 strlcpy(dst, "PNP:", dst_size);
478
479 while (id) {
480 strlcat(dst, " ", dst_size);
481 strlcat(dst, id->id, dst_size);
482 id = id->next;
483 }
484 }
485
486 static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id *did)
487 {
488 if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1)
489 i8042_pnp_data_reg = pnp_port_start(dev,0);
490
491 if (pnp_port_valid(dev, 1) && pnp_port_len(dev, 1) == 1)
492 i8042_pnp_command_reg = pnp_port_start(dev, 1);
493
494 if (pnp_irq_valid(dev,0))
495 i8042_pnp_kbd_irq = pnp_irq(dev, 0);
496
497 strlcpy(i8042_pnp_kbd_name, did->id, sizeof(i8042_pnp_kbd_name));
498 if (strlen(pnp_dev_name(dev))) {
499 strlcat(i8042_pnp_kbd_name, ":", sizeof(i8042_pnp_kbd_name));
500 strlcat(i8042_pnp_kbd_name, pnp_dev_name(dev), sizeof(i8042_pnp_kbd_name));
501 }
502 i8042_pnp_id_to_string(dev->id, i8042_kbd_firmware_id,
503 sizeof(i8042_kbd_firmware_id));
504
505 /* Keyboard ports are always supposed to be wakeup-enabled */
506 device_set_wakeup_enable(&dev->dev, true);
507
508 i8042_pnp_kbd_devices++;
509 return 0;
510 }
511
512 static int i8042_pnp_aux_probe(struct pnp_dev *dev, const struct pnp_device_id *did)
513 {
514 if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1)
515 i8042_pnp_data_reg = pnp_port_start(dev,0);
516
517 if (pnp_port_valid(dev, 1) && pnp_port_len(dev, 1) == 1)
518 i8042_pnp_command_reg = pnp_port_start(dev, 1);
519
520 if (pnp_irq_valid(dev, 0))
521 i8042_pnp_aux_irq = pnp_irq(dev, 0);
522
523 strlcpy(i8042_pnp_aux_name, did->id, sizeof(i8042_pnp_aux_name));
524 if (strlen(pnp_dev_name(dev))) {
525 strlcat(i8042_pnp_aux_name, ":", sizeof(i8042_pnp_aux_name));
526 strlcat(i8042_pnp_aux_name, pnp_dev_name(dev), sizeof(i8042_pnp_aux_name));
527 }
528 i8042_pnp_id_to_string(dev->id, i8042_aux_firmware_id,
529 sizeof(i8042_aux_firmware_id));
530
531 i8042_pnp_aux_devices++;
532 return 0;
533 }
534
535 static struct pnp_device_id pnp_kbd_devids[] = {
536 { .id = "PNP0300", .driver_data = 0 },
537 { .id = "PNP0301", .driver_data = 0 },
538 { .id = "PNP0302", .driver_data = 0 },
539 { .id = "PNP0303", .driver_data = 0 },
540 { .id = "PNP0304", .driver_data = 0 },
541 { .id = "PNP0305", .driver_data = 0 },
542 { .id = "PNP0306", .driver_data = 0 },
543 { .id = "PNP0309", .driver_data = 0 },
544 { .id = "PNP030a", .driver_data = 0 },
545 { .id = "PNP030b", .driver_data = 0 },
546 { .id = "PNP0320", .driver_data = 0 },
547 { .id = "PNP0343", .driver_data = 0 },
548 { .id = "PNP0344", .driver_data = 0 },
549 { .id = "PNP0345", .driver_data = 0 },
550 { .id = "CPQA0D7", .driver_data = 0 },
551 { .id = "", },
552 };
553 MODULE_DEVICE_TABLE(pnp, pnp_kbd_devids);
554
555 static struct pnp_driver i8042_pnp_kbd_driver = {
556 .name = "i8042 kbd",
557 .id_table = pnp_kbd_devids,
558 .probe = i8042_pnp_kbd_probe,
559 };
560
561 static struct pnp_device_id pnp_aux_devids[] = {
562 { .id = "AUI0200", .driver_data = 0 },
563 { .id = "FJC6000", .driver_data = 0 },
564 { .id = "FJC6001", .driver_data = 0 },
565 { .id = "PNP0f03", .driver_data = 0 },
566 { .id = "PNP0f0b", .driver_data = 0 },
567 { .id = "PNP0f0e", .driver_data = 0 },
568 { .id = "PNP0f12", .driver_data = 0 },
569 { .id = "PNP0f13", .driver_data = 0 },
570 { .id = "PNP0f19", .driver_data = 0 },
571 { .id = "PNP0f1c", .driver_data = 0 },
572 { .id = "SYN0801", .driver_data = 0 },
573 { .id = "", },
574 };
575 MODULE_DEVICE_TABLE(pnp, pnp_aux_devids);
576
577 static struct pnp_driver i8042_pnp_aux_driver = {
578 .name = "i8042 aux",
579 .id_table = pnp_aux_devids,
580 .probe = i8042_pnp_aux_probe,
581 };
582
583 static void i8042_pnp_exit(void)
584 {
585 if (i8042_pnp_kbd_registered) {
586 i8042_pnp_kbd_registered = false;
587 pnp_unregister_driver(&i8042_pnp_kbd_driver);
588 }
589
590 if (i8042_pnp_aux_registered) {
591 i8042_pnp_aux_registered = false;
592 pnp_unregister_driver(&i8042_pnp_aux_driver);
593 }
594 }
595
596 static int __init i8042_pnp_init(void)
597 {
598 char kbd_irq_str[4] = { 0 }, aux_irq_str[4] = { 0 };
599 bool pnp_data_busted = false;
600 int err;
601
602 #ifdef CONFIG_X86
603 if (dmi_check_system(i8042_dmi_nopnp_table))
604 i8042_nopnp = true;
605 #endif
606
607 if (i8042_nopnp) {
608 pr_info("PNP detection disabled\n");
609 return 0;
610 }
611
612 err = pnp_register_driver(&i8042_pnp_kbd_driver);
613 if (!err)
614 i8042_pnp_kbd_registered = true;
615
616 err = pnp_register_driver(&i8042_pnp_aux_driver);
617 if (!err)
618 i8042_pnp_aux_registered = true;
619
620 if (!i8042_pnp_kbd_devices && !i8042_pnp_aux_devices) {
621 i8042_pnp_exit();
622 #if defined(__ia64__)
623 return -ENODEV;
624 #else
625 pr_info("PNP: No PS/2 controller found. Probing ports directly.\n");
626 return 0;
627 #endif
628 }
629
630 if (i8042_pnp_kbd_devices)
631 snprintf(kbd_irq_str, sizeof(kbd_irq_str),
632 "%d", i8042_pnp_kbd_irq);
633 if (i8042_pnp_aux_devices)
634 snprintf(aux_irq_str, sizeof(aux_irq_str),
635 "%d", i8042_pnp_aux_irq);
636
637 pr_info("PNP: PS/2 Controller [%s%s%s] at %#x,%#x irq %s%s%s\n",
638 i8042_pnp_kbd_name, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "",
639 i8042_pnp_aux_name,
640 i8042_pnp_data_reg, i8042_pnp_command_reg,
641 kbd_irq_str, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "",
642 aux_irq_str);
643
644 #if defined(__ia64__)
645 if (!i8042_pnp_kbd_devices)
646 i8042_nokbd = true;
647 if (!i8042_pnp_aux_devices)
648 i8042_noaux = true;
649 #endif
650
651 if (((i8042_pnp_data_reg & ~0xf) == (i8042_data_reg & ~0xf) &&
652 i8042_pnp_data_reg != i8042_data_reg) ||
653 !i8042_pnp_data_reg) {
654 pr_warn("PNP: PS/2 controller has invalid data port %#x; using default %#x\n",
655 i8042_pnp_data_reg, i8042_data_reg);
656 i8042_pnp_data_reg = i8042_data_reg;
657 pnp_data_busted = true;
658 }
659
660 if (((i8042_pnp_command_reg & ~0xf) == (i8042_command_reg & ~0xf) &&
661 i8042_pnp_command_reg != i8042_command_reg) ||
662 !i8042_pnp_command_reg) {
663 pr_warn("PNP: PS/2 controller has invalid command port %#x; using default %#x\n",
664 i8042_pnp_command_reg, i8042_command_reg);
665 i8042_pnp_command_reg = i8042_command_reg;
666 pnp_data_busted = true;
667 }
668
669 if (!i8042_nokbd && !i8042_pnp_kbd_irq) {
670 pr_warn("PNP: PS/2 controller doesn't have KBD irq; using default %d\n",
671 i8042_kbd_irq);
672 i8042_pnp_kbd_irq = i8042_kbd_irq;
673 pnp_data_busted = true;
674 }
675
676 if (!i8042_noaux && !i8042_pnp_aux_irq) {
677 if (!pnp_data_busted && i8042_pnp_kbd_irq) {
678 pr_warn("PNP: PS/2 appears to have AUX port disabled, "
679 "if this is incorrect please boot with i8042.nopnp\n");
680 i8042_noaux = true;
681 } else {
682 pr_warn("PNP: PS/2 controller doesn't have AUX irq; using default %d\n",
683 i8042_aux_irq);
684 i8042_pnp_aux_irq = i8042_aux_irq;
685 }
686 }
687
688 i8042_data_reg = i8042_pnp_data_reg;
689 i8042_command_reg = i8042_pnp_command_reg;
690 i8042_kbd_irq = i8042_pnp_kbd_irq;
691 i8042_aux_irq = i8042_pnp_aux_irq;
692
693 #ifdef CONFIG_X86
694 i8042_bypass_aux_irq_test = !pnp_data_busted &&
695 dmi_check_system(i8042_dmi_laptop_table);
696 #endif
697
698 return 0;
699 }
700
701 #else
702 static inline int i8042_pnp_init(void) { return 0; }
703 static inline void i8042_pnp_exit(void) { }
704 #endif
705
706 static int __init i8042_platform_init(void)
707 {
708 int retval;
709
710 #ifdef CONFIG_X86
711 u8 a20_on = 0xdf;
712 /* Just return if pre-detection shows no i8042 controller exist */
713 if (!x86_platform.i8042_detect())
714 return -ENODEV;
715 #endif
716
717 /*
718 * On ix86 platforms touching the i8042 data register region can do really
719 * bad things. Because of this the region is always reserved on ix86 boxes.
720 *
721 * if (!request_region(I8042_DATA_REG, 16, "i8042"))
722 * return -EBUSY;
723 */
724
725 i8042_kbd_irq = I8042_MAP_IRQ(1);
726 i8042_aux_irq = I8042_MAP_IRQ(12);
727
728 retval = i8042_pnp_init();
729 if (retval)
730 return retval;
731
732 #if defined(__ia64__)
733 i8042_reset = true;
734 #endif
735
736 #ifdef CONFIG_X86
737 if (dmi_check_system(i8042_dmi_reset_table))
738 i8042_reset = true;
739
740 if (dmi_check_system(i8042_dmi_noloop_table))
741 i8042_noloop = true;
742
743 if (dmi_check_system(i8042_dmi_mux_table))
744 i8042_nomux = false;
745
746 if (dmi_check_system(i8042_dmi_notimeout_table))
747 i8042_notimeout = true;
748
749 if (dmi_check_system(i8042_dmi_dritek_table))
750 i8042_dritek = true;
751
752 /*
753 * A20 was already enabled during early kernel init. But some buggy
754 * BIOSes (in MSI Laptops) require A20 to be enabled using 8042 to
755 * resume from S3. So we do it here and hope that nothing breaks.
756 */
757 i8042_command(&a20_on, 0x10d1);
758 i8042_command(NULL, 0x00ff); /* Null command for SMM firmware */
759 #endif /* CONFIG_X86 */
760
761 return retval;
762 }
763
764 static inline void i8042_platform_exit(void)
765 {
766 i8042_pnp_exit();
767 }
768
769 #endif /* _I8042_X86IA64IO_H */
This page took 0.047448 seconds and 5 git commands to generate.