summaryrefslogtreecommitdiffstats
path: root/resources/libreboot/patch/coreboot/369b561315ca68d0cdedc38208105a513c7139b5/grub/kcma-d8/0033-drivers-pc80-Add-PS-2-mouse-presence-detect.patch
blob: 1753b05049392a6f7fc8b8b98e5942fb37f602db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
From 5bb8df0244b9839365e292bc60c344074f17f5a4 Mon Sep 17 00:00:00 2001
From: Timothy Pearson <tpearson@raptorengineeringinc.com>
Date: Tue, 24 Nov 2015 14:12:01 -0600
Subject: [PATCH 33/45] drivers/pc80: Add PS/2 mouse presence detect

On certain Winbond SuperIO devices, when a PS/2 mouse is not
present on the auxiliary channel both channels will cease to
function if the auxiliary channel is probed while the primary
channel is active.  Therefore, knowledge of mouse presence
must be gathered by coreboot during early boot, and used to
enable or disable the auxiliary PS/2 port before control is
passed to the operating system.

Add auxiliary channel PS/2 device presence detect, and update
the Winbond W83667HG-A driver to flag the auxiliary channel as
disabled if no device was detected.

Signed-off-by: Timothy Pearson <tpearson@raptorengineeringinc.com>
---
 src/drivers/pc80/keyboard.c                       | 101 +++++++++++++++++-----
 src/ec/compal/ene932/ec.c                         |   2 +-
 src/ec/google/chromeec/ec_lpc.c                   |   2 +-
 src/ec/lenovo/h8/h8.c                             |   2 +-
 src/ec/quanta/ene_kb3940q/ec.c                    |   2 +-
 src/ec/quanta/it8518/ec.c                         |   2 +-
 src/include/pc80/keyboard.h                       |   2 +-
 src/mainboard/emulation/qemu-i440fx/mainboard.c   |   2 +-
 src/mainboard/emulation/qemu-q35/mainboard.c      |   2 +-
 src/mainboard/packardbell/ms2290/mainboard.c      |   2 +-
 src/mainboard/roda/rk9/mainboard.c                |   2 +-
 src/northbridge/via/cx700/lpc.c                   |   2 +-
 src/northbridge/via/vx800/lpc.c                   |   2 +-
 src/southbridge/dmp/vortex86ex/southbridge.c      |   2 +-
 src/southbridge/sis/sis966/lpc.c                  |   2 +-
 src/southbridge/via/vt8237r/lpc.c                 |   2 +-
 src/superio/fintek/f71863fg/superio.c             |   2 +-
 src/superio/fintek/f71869ad/superio.c             |   2 +-
 src/superio/fintek/f71872/superio.c               |   2 +-
 src/superio/fintek/f81865f/superio.c              |   2 +-
 src/superio/fintek/f81866d/superio.c              |   2 +-
 src/superio/ite/it8671f/superio.c                 |   2 +-
 src/superio/ite/it8712f/superio.c                 |   2 +-
 src/superio/ite/it8716f/superio.c                 |   2 +-
 src/superio/ite/it8718f/superio.c                 |   2 +-
 src/superio/ite/it8721f/superio.c                 |   2 +-
 src/superio/ite/it8728f/superio.c                 |   2 +-
 src/superio/ite/it8772f/superio.c                 |   2 +-
 src/superio/nsc/pc87309/superio.c                 |   2 +-
 src/superio/nsc/pc87360/superio.c                 |   2 +-
 src/superio/nsc/pc87366/superio.c                 |   2 +-
 src/superio/nsc/pc87417/superio.c                 |   2 +-
 src/superio/nsc/pc97317/superio.c                 |   2 +-
 src/superio/nuvoton/nct5572d/superio.c            |   2 +-
 src/superio/nuvoton/nct6779d/superio.c            |   2 +-
 src/superio/nuvoton/wpcm450/superio.c             |   2 +-
 src/superio/renesas/m3885x/superio.c              |   2 +-
 src/superio/smsc/dme1737/superio.c                |   2 +-
 src/superio/smsc/fdc37n972/fdc37n972.c            |   2 +-
 src/superio/smsc/kbc1100/superio.c                |   2 +-
 src/superio/smsc/lpc47b272/superio.c              |   2 +-
 src/superio/smsc/lpc47b397/superio.c              |   2 +-
 src/superio/smsc/lpc47m10x/superio.c              |   2 +-
 src/superio/smsc/lpc47m15x/superio.c              |   2 +-
 src/superio/smsc/lpc47n227/superio.c              |   2 +-
 src/superio/smsc/mec1308/superio.c                |   2 +-
 src/superio/smsc/sch4037/superio.c                |   2 +-
 src/superio/smsc/sio10n268/sio10n268.c            |   2 +-
 src/superio/smsc/smscsuperio/superio.c            |   2 +-
 src/superio/winbond/w83627dhg/superio.c           |   2 +-
 src/superio/winbond/w83627ehg/superio.c           |   2 +-
 src/superio/winbond/w83627hf/superio.c            |   2 +-
 src/superio/winbond/w83627thg/superio.c           |   2 +-
 src/superio/winbond/w83627uhg/superio.c           |   2 +-
 src/superio/winbond/w83667hg-a/ps2_controller.asl |  78 +++++++++++++++++
 src/superio/winbond/w83667hg-a/superio.c          |  20 ++++-
 src/superio/winbond/w83977tf/superio.c            |   2 +-
 src/superio/winbond/wpcd376i/superio.c            |   2 +-
 58 files changed, 230 insertions(+), 79 deletions(-)
 create mode 100644 src/superio/winbond/w83667hg-a/ps2_controller.asl

diff --git a/src/drivers/pc80/keyboard.c b/src/drivers/pc80/keyboard.c
index 3e61a51..56b1fce 100644
--- a/src/drivers/pc80/keyboard.c
+++ b/src/drivers/pc80/keyboard.c
@@ -1,6 +1,7 @@
 /*
  * This file is part of the coreboot project.
  *
+ * Copyright (C) 2015 Raptor Engineering
  * Copyright (C) 2009 coresystems GmbH
  * Copyright (C) 2008 Advanced Micro Devices, Inc.
  * Copyright (C) 2003 Ollie Lo <ollielo@hotmail.com>
@@ -32,6 +33,8 @@
 // Keyboard Controller Commands
 #define KBC_CMD_READ_COMMAND	0x20	// Read command byte
 #define KBC_CMD_WRITE_COMMAND	0x60	// Write command byte
+#define KBC_CMD_AUX_ENABLE	0xA8	// Auxiliary Interface enable
+#define KBC_CMD_AUX_TEST	0xA9	// Auxiliary Interface test
 #define KBC_CMD_SELF_TEST	0xAA	// Controller self-test
 #define KBC_CMD_KBD_TEST	0xAB	// Keyboard Interface test
 
@@ -106,9 +109,14 @@ static int kbc_cleanup_buffers(void)
 	return !!timeout;
 }
 
-static enum cb_err kbc_self_test(void)
+static enum cb_err kbc_self_test(uint8_t probe_aux, uint8_t *aux_probe_result)
 {
-	u8 self_test;
+	uint8_t self_test;
+	uint8_t byte;
+
+	/* Set initial aux probe output value */
+	if (aux_probe_result)
+		*aux_probe_result = 0;
 
 	/* Clean up any junk that might have been in the KBC.
 	 * Both input and output buffers must be empty.
@@ -154,6 +162,48 @@ static enum cb_err kbc_self_test(void)
 		return CB_KBD_INTERFACE_FAILURE;
 	}
 
+	if (probe_aux) {
+		/* aux interface detect */
+		outb(KBC_CMD_AUX_ENABLE, KBD_COMMAND);
+		if (!kbc_input_buffer_empty()) {
+			printk(BIOS_ERR, "Timeout waiting for controller during aux enable.\n");
+			return CB_KBD_CONTROLLER_FAILURE;
+		}
+		outb(KBC_CMD_READ_COMMAND, KBD_COMMAND);
+		if (!kbc_output_buffer_full()) {
+			printk(BIOS_ERR, "Timeout waiting for controller during aux probe.\n");
+			return CB_KBD_CONTROLLER_FAILURE;
+		}
+
+		byte = inb(KBD_DATA);
+		if (!(byte & (0x1 << 5))) {
+			printk(BIOS_DEBUG, "PS/2 auxiliary channel detected...\n");
+
+			/* auxiliary interface test */
+			outb(KBC_CMD_AUX_TEST, KBD_COMMAND);
+
+			if (!kbc_output_buffer_full()) {
+				printk(BIOS_ERR, "Auxiliary channel probe timed out.\n");
+				goto aux_failure;
+			}
+
+			/* read test result, 0x00 should be returned in case of no failures */
+			self_test = inb(KBD_DATA);
+
+			if (self_test != 0x00) {
+				printk(BIOS_ERR, "No device detected on auxiliary channel: 0x%x\n",
+				self_test);
+				goto aux_failure;
+			}
+
+			printk(BIOS_DEBUG, "PS/2 device detected on auxiliary channel\n");
+			if (aux_probe_result)
+				*aux_probe_result = 1;
+		}
+	}
+
+aux_failure:
+
 	return CB_SUCCESS;
 }
 
@@ -187,53 +237,54 @@ static u8 send_keyboard(u8 command)
 	return regval;
 }
 
-void pc_keyboard_init(void)
+uint8_t pc_keyboard_init(uint8_t probe_aux)
 {
 	u8 retries;
 	u8 regval;
 	enum cb_err err;
+	uint8_t aux_dev_detected;
 
 	if (!CONFIG_DRIVERS_PS2_KEYBOARD)
-		return;
+		return 0;
 
 	if (acpi_is_wakeup_s3())
-		return;
+		return 0;
 
 	printk(BIOS_DEBUG, "Keyboard init...\n");
 
 	/* Run a keyboard controller self-test */
-	err = kbc_self_test();
+	err = kbc_self_test(probe_aux, &aux_dev_detected);
 	/* Ignore iterface failure as it's non-fatal.  */
 	if (err != CB_SUCCESS && err != CB_KBD_INTERFACE_FAILURE)
-		return;
+		return 0;
 
 	/* Enable keyboard interface - No IRQ */
 	if (!kbc_input_buffer_empty())
-		return;
+		return 0;
 	outb(0x60, KBD_COMMAND);
 	if (!kbc_input_buffer_empty())
-		return;
+		return 0;
 	outb(0x20, KBD_DATA);	/* send cmd: enable keyboard */
 	if (!kbc_input_buffer_empty()) {
 		printk(BIOS_INFO, "Timeout while enabling keyboard\n");
-		return;
+		return 0;
 	}
 
 	/* clean up any junk that might have been in the keyboard */
 	if (!kbc_cleanup_buffers())
-		return;
+		return 0;
 
 	/* reset keyboard and self test (keyboard side) */
 	regval = send_keyboard(0xFF);
 	if (regval == KBD_REPLY_RESEND) {
 		/* keeps sending RESENDs, probably no keyboard. */
 		printk(BIOS_INFO, "No PS/2 keyboard detected.\n");
-		return;
+		return 0;
 	}
 
 	if (regval != KBD_REPLY_ACK) {
 		printk(BIOS_ERR, "Keyboard reset failed ACK: 0x%x\n", regval);
-		return;
+		return 0;
 	}
 
 	/* the reset command takes some time, so wait a little longer */
@@ -241,14 +292,14 @@ void pc_keyboard_init(void)
 
 	if (!kbc_output_buffer_full()) {
 		printk(BIOS_ERR, "Timeout waiting for keyboard after reset.\n");
-		return;
+		return 0;
 	}
 
 	regval = inb(KBD_DATA);
 	if (regval != 0xAA) {
 		printk(BIOS_ERR, "Keyboard reset selftest failed: 0x%x\n",
 		       regval);
-		return;
+		return 0;
 	}
 
 	/*
@@ -260,7 +311,7 @@ void pc_keyboard_init(void)
 	regval = send_keyboard(0xF5);
 	if (regval != KBD_REPLY_ACK) {
 		printk(BIOS_ERR, "Keyboard disable failed ACK: 0x%x\n", regval);
-		return;
+		return 0;
 	}
 
 	/* Set scancode command */
@@ -268,34 +319,38 @@ void pc_keyboard_init(void)
 	if (regval != KBD_REPLY_ACK) {
 		printk(BIOS_ERR, "Keyboard set scancode cmd failed ACK: 0x%x\n",
 		       regval);
-		return;
+		return 0;
 	}
 	/* Set scancode mode 2 */
 	regval = send_keyboard(0x02);
 	if (regval != KBD_REPLY_ACK) {
 		printk(BIOS_ERR,
 		       "Keyboard set scancode mode failed ACK: 0x%x\n", regval);
-		return;
+		return 0;
 	}
 
 	/* All is well - enable keyboard interface */
 	if (!kbc_input_buffer_empty())
-		return;
+		return 0;
 	outb(0x60, KBD_COMMAND);
 	if (!kbc_input_buffer_empty())
-		return;
+		return 0;
 	outb(0x65, KBD_DATA);	/* send cmd: enable keyboard and IRQ 1 */
 	if (!kbc_input_buffer_empty()) {
 		printk(BIOS_ERR, "Timeout during keyboard enable\n");
-		return;
+		return 0;
 	}
 
 	/* enable the keyboard */
 	regval = send_keyboard(0xF4);
 	if (regval != KBD_REPLY_ACK) {
 		printk(BIOS_ERR, "Keyboard enable failed ACK: 0x%x\n", regval);
-		return;
+		return 0;
 	}
+
+	printk(BIOS_DEBUG, "PS/2 keyboard initialized on primary channel\n");
+
+	return aux_dev_detected;
 }
 
 /*
@@ -308,7 +363,7 @@ void set_kbc_ps2_mode(void)
 	enum cb_err err;
 
 	/* Run a keyboard controller self-test */
-	err = kbc_self_test();
+	err = kbc_self_test(0, NULL);
 	/* Ignore iterface failure as it's non-fatal.  */
 	if (err != CB_SUCCESS && err != CB_KBD_INTERFACE_FAILURE)
 		return;
diff --git a/src/ec/compal/ene932/ec.c b/src/ec/compal/ene932/ec.c
index d1687e9..50b8b5e 100644
--- a/src/ec/compal/ene932/ec.c
+++ b/src/ec/compal/ene932/ec.c
@@ -133,7 +133,7 @@ static void ene932_init(struct device *dev)
 		return;
 
 	printk(BIOS_DEBUG, "Compal ENE932: Initializing keyboard.\n");
-	pc_keyboard_init();
+	pc_keyboard_init(0);
 
 }
 
diff --git a/src/ec/google/chromeec/ec_lpc.c b/src/ec/google/chromeec/ec_lpc.c
index 9a16906..8a04135 100644
--- a/src/ec/google/chromeec/ec_lpc.c
+++ b/src/ec/google/chromeec/ec_lpc.c
@@ -403,7 +403,7 @@ static void lpc_ec_init(struct device *dev)
 	if (!dev->enabled)
 		return;
 
-	pc_keyboard_init();
+	pc_keyboard_init(0);
 	google_chromeec_init();
 }
 
diff --git a/src/ec/lenovo/h8/h8.c b/src/ec/lenovo/h8/h8.c
index 3cd30bc..f0ccd48 100644
--- a/src/ec/lenovo/h8/h8.c
+++ b/src/ec/lenovo/h8/h8.c
@@ -175,7 +175,7 @@ static void h8_smbios_strings(struct device *dev, struct smbios_type11 *t)
 
 static void h8_init(device_t dev)
 {
-	pc_keyboard_init();
+	pc_keyboard_init(0);
 }
 
 struct device_operations h8_dev_ops = {
diff --git a/src/ec/quanta/ene_kb3940q/ec.c b/src/ec/quanta/ene_kb3940q/ec.c
index 8f23e33..a7d5bd7 100644
--- a/src/ec/quanta/ene_kb3940q/ec.c
+++ b/src/ec/quanta/ene_kb3940q/ec.c
@@ -142,7 +142,7 @@ static void ene_kb3940q_init(struct device *dev)
 		return;
 
 	printk(BIOS_DEBUG, "Quanta EnE KB3940Q: Initializing keyboard.\n");
-	pc_keyboard_init();
+	pc_keyboard_init(0);
 
 	ene_kb3940q_log_events();
 }
diff --git a/src/ec/quanta/it8518/ec.c b/src/ec/quanta/it8518/ec.c
index 7388c01..dd7268a 100644
--- a/src/ec/quanta/it8518/ec.c
+++ b/src/ec/quanta/it8518/ec.c
@@ -157,7 +157,7 @@ static void it8518_init(struct device *dev)
 		return;
 
 	printk(BIOS_DEBUG, "Quanta IT8518: Initializing keyboard.\n");
-	pc_keyboard_init();
+	pc_keyboard_init(0);
 }
 
 static struct device_operations ops = {
diff --git a/src/include/pc80/keyboard.h b/src/include/pc80/keyboard.h
index 16cb959..5258d47 100644
--- a/src/include/pc80/keyboard.h
+++ b/src/include/pc80/keyboard.h
@@ -1,7 +1,7 @@
 #ifndef PC80_KEYBOARD_H
 #define PC80_KEYBOARD_H
 
-void pc_keyboard_init(void);
+uint8_t pc_keyboard_init(uint8_t probe_aux);
 void set_kbc_ps2_mode(void);
 
 #endif /* PC80_KEYBOARD_H */
diff --git a/src/mainboard/emulation/qemu-i440fx/mainboard.c b/src/mainboard/emulation/qemu-i440fx/mainboard.c
index b2fb46c..e5fb3cb 100644
--- a/src/mainboard/emulation/qemu-i440fx/mainboard.c
+++ b/src/mainboard/emulation/qemu-i440fx/mainboard.c
@@ -39,7 +39,7 @@ static void qemu_nb_init(device_t dev)
 	/* This sneaked in here, because Qemu does not
 	 * emulate a SuperIO chip
 	 */
-	pc_keyboard_init();
+	pc_keyboard_init(0);
 
 	/* setup IRQ routing */
 	for (i = 0; i < 32; i++)
diff --git a/src/mainboard/emulation/qemu-q35/mainboard.c b/src/mainboard/emulation/qemu-q35/mainboard.c
index 82716c9..0000564 100644
--- a/src/mainboard/emulation/qemu-q35/mainboard.c
+++ b/src/mainboard/emulation/qemu-q35/mainboard.c
@@ -60,7 +60,7 @@ static void qemu_nb_init(device_t dev)
 	/* This sneaked in here, because Qemu does not
 	 * emulate a SuperIO chip
 	 */
-	pc_keyboard_init();
+	pc_keyboard_init(0);
 
 	/* setup IRQ routing for pci slots */
 	for (i = 0; i < 25; i++)
diff --git a/src/mainboard/packardbell/ms2290/mainboard.c b/src/mainboard/packardbell/ms2290/mainboard.c
index 065ca94..f964c57 100644
--- a/src/mainboard/packardbell/ms2290/mainboard.c
+++ b/src/mainboard/packardbell/ms2290/mainboard.c
@@ -121,7 +121,7 @@ static void mainboard_enable(device_t dev)
 
 	/* This sneaked in here, because EasyNote has no SuperIO chip.
 	 */
-	pc_keyboard_init();
+	pc_keyboard_init(0);
 }
 
 struct chip_operations mainboard_ops = {
diff --git a/src/mainboard/roda/rk9/mainboard.c b/src/mainboard/roda/rk9/mainboard.c
index a5465f9..50e9a75 100644
--- a/src/mainboard/roda/rk9/mainboard.c
+++ b/src/mainboard/roda/rk9/mainboard.c
@@ -46,7 +46,7 @@ static void mainboard_enable(device_t dev)
 
 	/* We have no driver for the embedded controller since the firmware
 	   does most of the job. Hence, initialize keyboards here. */
-	pc_keyboard_init();
+	pc_keyboard_init(0);
 }
 
 struct chip_operations mainboard_ops = {
diff --git a/src/northbridge/via/cx700/lpc.c b/src/northbridge/via/cx700/lpc.c
index 9262e40..e19f638 100644
--- a/src/northbridge/via/cx700/lpc.c
+++ b/src/northbridge/via/cx700/lpc.c
@@ -285,7 +285,7 @@ static void cx700_lpc_init(struct device *dev)
 	isa_dma_init();
 
 	/* Initialize keyboard controller */
-	pc_keyboard_init();
+	pc_keyboard_init(0);
 }
 
 static struct device_operations cx700_lpc_ops = {
diff --git a/src/northbridge/via/vx800/lpc.c b/src/northbridge/via/vx800/lpc.c
index 8fbb3be..1bdd7b8 100644
--- a/src/northbridge/via/vx800/lpc.c
+++ b/src/northbridge/via/vx800/lpc.c
@@ -322,7 +322,7 @@ static void southbridge_init(struct device *dev)
 	setup_i8259();		// make sure interupt controller is configured before keyboard init
 
 	/* turn on keyboard and RTC, no need to visit this reg twice */
-	pc_keyboard_init();
+	pc_keyboard_init(0);
 
 	printk(BIOS_DEBUG, "ps2 usb lid, you  set who can wakeup system from s3 sleep\n");
 	S3_ps2_kb_ms_wakeup(dev);
diff --git a/src/southbridge/dmp/vortex86ex/southbridge.c b/src/southbridge/dmp/vortex86ex/southbridge.c
index 3ef6a5d..5da7d74 100644
--- a/src/southbridge/dmp/vortex86ex/southbridge.c
+++ b/src/southbridge/dmp/vortex86ex/southbridge.c
@@ -607,7 +607,7 @@ static void southbridge_init(struct device *dev)
 		retries--;
 	}
 	post_code(POST_DMP_KBD_IS_READY);
-	pc_keyboard_init();
+	pc_keyboard_init(0);
 }
 
 static struct device_operations vortex_sb_ops = {
diff --git a/src/southbridge/sis/sis966/lpc.c b/src/southbridge/sis/sis966/lpc.c
index 940844b..c40df0a 100644
--- a/src/southbridge/sis/sis966/lpc.c
+++ b/src/southbridge/sis/sis966/lpc.c
@@ -91,7 +91,7 @@ static void lpc_init(device_t dev)
 	int nmi_option;
 
 	printk(BIOS_DEBUG, "LPC_INIT -------->\n");
-	pc_keyboard_init();
+	pc_keyboard_init(0);
 
 	lpc_usb_legacy_init(dev);
 	lpc_common_init(dev);
diff --git a/src/southbridge/via/vt8237r/lpc.c b/src/southbridge/via/vt8237r/lpc.c
index b54d494..113ce93 100644
--- a/src/southbridge/via/vt8237r/lpc.c
+++ b/src/southbridge/via/vt8237r/lpc.c
@@ -625,7 +625,7 @@ static void init_keyboard(struct device *dev)
 {
 	u8 regval = pci_read_config8(dev, 0x51);
 	if (regval & 0x1)
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 }
 
 static void southbridge_init_common(struct device *dev)
diff --git a/src/superio/fintek/f71863fg/superio.c b/src/superio/fintek/f71863fg/superio.c
index 8e0a643..bb09d01 100644
--- a/src/superio/fintek/f71863fg/superio.c
+++ b/src/superio/fintek/f71863fg/superio.c
@@ -34,7 +34,7 @@ static void f71863fg_init(struct device *dev)
 	/* TODO: Might potentially need code for HWM or FDC etc. */
 	case F71863FG_KBC:
 		res0 = find_resource(dev, PNP_IDX_IO0);
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	}
 }
diff --git a/src/superio/fintek/f71869ad/superio.c b/src/superio/fintek/f71869ad/superio.c
index f16c37f..8cf9008 100644
--- a/src/superio/fintek/f71869ad/superio.c
+++ b/src/superio/fintek/f71869ad/superio.c
@@ -34,7 +34,7 @@ static void f71869ad_init(struct device *dev)
 	switch(dev->path.pnp.device) {
 	/* TODO: Might potentially need code for HWM or FDC etc. */
 	case F71869AD_KBC:
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	case F71869AD_HWM:
 		f71869ad_multifunc_init(dev);
diff --git a/src/superio/fintek/f71872/superio.c b/src/superio/fintek/f71872/superio.c
index 6b4de2d..a973da8 100644
--- a/src/superio/fintek/f71872/superio.c
+++ b/src/superio/fintek/f71872/superio.c
@@ -32,7 +32,7 @@ static void f71872_init(struct device *dev)
 	switch(dev->path.pnp.device) {
 	/* TODO: Might potentially need code for HWM or FDC etc. */
 	case F71872_KBC:
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	}
 }
diff --git a/src/superio/fintek/f81865f/superio.c b/src/superio/fintek/f81865f/superio.c
index 9cd5c95..fa9e23e 100644
--- a/src/superio/fintek/f81865f/superio.c
+++ b/src/superio/fintek/f81865f/superio.c
@@ -32,7 +32,7 @@ static void f81865f_init(struct device *dev)
 	switch (dev->path.pnp.device) {
 	/* TODO: Might potentially need code for HWM or FDC etc. */
 	case F81865F_KBC:
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	}
 }
diff --git a/src/superio/fintek/f81866d/superio.c b/src/superio/fintek/f81866d/superio.c
index ce0e066..2a95219 100644
--- a/src/superio/fintek/f81866d/superio.c
+++ b/src/superio/fintek/f81866d/superio.c
@@ -34,7 +34,7 @@ static void f81866d_init(struct device *dev)
 	switch (dev->path.pnp.device) {
 	/* TODO: Might potentially need extra code for serial, wdt etc. */
 	case F81866D_KBC:
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	case F81866D_HWM:
 		// Fixing temp sensor read out and init Fan control
diff --git a/src/superio/ite/it8671f/superio.c b/src/superio/ite/it8671f/superio.c
index 72e31f1..907e020 100644
--- a/src/superio/ite/it8671f/superio.c
+++ b/src/superio/ite/it8671f/superio.c
@@ -32,7 +32,7 @@ static void init(struct device *dev)
 	case IT8671F_PP: /* TODO. */
 		break;
 	case IT8671F_KBCK:
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	case IT8671F_KBCM: /* TODO. */
 		break;
diff --git a/src/superio/ite/it8712f/superio.c b/src/superio/ite/it8712f/superio.c
index 02cbefc..1d87f47 100644
--- a/src/superio/ite/it8712f/superio.c
+++ b/src/superio/ite/it8712f/superio.c
@@ -39,7 +39,7 @@ static void it8712f_init(struct device *dev)
 		break;
 	case IT8712F_KBCK:
 		set_kbc_ps2_mode();
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	case IT8712F_KBCM: /* TODO. */
 		break;
diff --git a/src/superio/ite/it8716f/superio.c b/src/superio/ite/it8716f/superio.c
index 3a9e790..469c255 100644
--- a/src/superio/ite/it8716f/superio.c
+++ b/src/superio/ite/it8716f/superio.c
@@ -60,7 +60,7 @@ static void it8716f_init(struct device *dev)
 		init_ec(res0->base + EC_INDEX_PORT);
 		break;
 	case IT8716F_KBCK:
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	}
 }
diff --git a/src/superio/ite/it8718f/superio.c b/src/superio/ite/it8718f/superio.c
index ccef043..825fb53 100644
--- a/src/superio/ite/it8718f/superio.c
+++ b/src/superio/ite/it8718f/superio.c
@@ -34,7 +34,7 @@ static void init(struct device *dev)
 	case IT8718F_EC: /* TODO. */
 		break;
 	case IT8718F_KBCK:
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	case IT8718F_KBCM: /* TODO. */
 		break;
diff --git a/src/superio/ite/it8721f/superio.c b/src/superio/ite/it8721f/superio.c
index 4fc0562..ae052a3 100644
--- a/src/superio/ite/it8721f/superio.c
+++ b/src/superio/ite/it8721f/superio.c
@@ -35,7 +35,7 @@ static void init(struct device *dev)
 	case IT8721F_EC: /* TODO. */
 		break;
 	case IT8721F_KBCK:
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	case IT8721F_KBCM: /* TODO. */
 		break;
diff --git a/src/superio/ite/it8728f/superio.c b/src/superio/ite/it8728f/superio.c
index 4591bb1..3849d63 100644
--- a/src/superio/ite/it8728f/superio.c
+++ b/src/superio/ite/it8728f/superio.c
@@ -38,7 +38,7 @@ static void it8728f_init(struct device *dev)
 		break;
 	case IT8728F_KBCK:
 		set_kbc_ps2_mode();
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	}
 }
diff --git a/src/superio/ite/it8772f/superio.c b/src/superio/ite/it8772f/superio.c
index 6c6a503..17145b8 100644
--- a/src/superio/ite/it8772f/superio.c
+++ b/src/superio/ite/it8772f/superio.c
@@ -196,7 +196,7 @@ static void it8772f_init(struct device *dev)
 	case IT8772F_KBCK:
 		if (!conf->skip_keyboard) {
 			set_kbc_ps2_mode();
-			pc_keyboard_init();
+			pc_keyboard_init(0);
 		}
 		break;
 	case IT8772F_KBCM:
diff --git a/src/superio/nsc/pc87309/superio.c b/src/superio/nsc/pc87309/superio.c
index ecda1e7..f22566c 100644
--- a/src/superio/nsc/pc87309/superio.c
+++ b/src/superio/nsc/pc87309/superio.c
@@ -29,7 +29,7 @@ static void init(struct device *dev)
 
 	switch (dev->path.pnp.device) {
 	case PC87309_KBCK:
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	}
 }
diff --git a/src/superio/nsc/pc87360/superio.c b/src/superio/nsc/pc87360/superio.c
index 6b6e790..248c793 100644
--- a/src/superio/nsc/pc87360/superio.c
+++ b/src/superio/nsc/pc87360/superio.c
@@ -31,7 +31,7 @@ static void init(struct device *dev)
 
 	switch(dev->path.pnp.device) {
 	case PC87360_KBCK:
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	}
 }
diff --git a/src/superio/nsc/pc87366/superio.c b/src/superio/nsc/pc87366/superio.c
index f9dca21..e5c8ac2 100644
--- a/src/superio/nsc/pc87366/superio.c
+++ b/src/superio/nsc/pc87366/superio.c
@@ -31,7 +31,7 @@ static void init(struct device *dev)
 
 	switch(dev->path.pnp.device) {
 	case PC87366_KBCK:
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	}
 }
diff --git a/src/superio/nsc/pc87417/superio.c b/src/superio/nsc/pc87417/superio.c
index 1855db9..7a8d76f 100644
--- a/src/superio/nsc/pc87417/superio.c
+++ b/src/superio/nsc/pc87417/superio.c
@@ -32,7 +32,7 @@ static void init(struct device *dev)
 
 	switch(dev->path.pnp.device) {
 	case PC87417_KBCK:
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	}
 }
diff --git a/src/superio/nsc/pc97317/superio.c b/src/superio/nsc/pc97317/superio.c
index e8cf842..983c7f1 100644
--- a/src/superio/nsc/pc97317/superio.c
+++ b/src/superio/nsc/pc97317/superio.c
@@ -33,7 +33,7 @@ static void init(struct device *dev)
 		pnp_set_enable(dev, 0);		   /* Disable keyboard */
 		pnp_write_config(dev, 0xf0, 0x40); /* Set KBC clock to 8 MHz. */
 		pnp_set_enable(dev, 1);		   /* Enable keyboard */
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	default:
 		break;
diff --git a/src/superio/nuvoton/nct5572d/superio.c b/src/superio/nuvoton/nct5572d/superio.c
index 81a8326..6b5febd 100644
--- a/src/superio/nuvoton/nct5572d/superio.c
+++ b/src/superio/nuvoton/nct5572d/superio.c
@@ -45,7 +45,7 @@ static void nct5572d_init(struct device *dev)
 	switch(dev->path.pnp.device) {
 	/* TODO: Might potentially need code for HWM or FDC etc. */
 	case NCT5572D_KBC:
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	case NCT5572D_ACPI:
 		/* Set power state after power fail */
diff --git a/src/superio/nuvoton/nct6779d/superio.c b/src/superio/nuvoton/nct6779d/superio.c
index 79a25b7..c16a736 100644
--- a/src/superio/nuvoton/nct6779d/superio.c
+++ b/src/superio/nuvoton/nct6779d/superio.c
@@ -39,7 +39,7 @@ static void nct6779d_init(struct device *dev)
 	switch(dev->path.pnp.device) {
 	/* TODO: Might potentially need code for HWM or FDC etc. */
 	case NCT6779D_KBC:
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	}
 }
diff --git a/src/superio/nuvoton/wpcm450/superio.c b/src/superio/nuvoton/wpcm450/superio.c
index bfc3c5e..c6cb494 100644
--- a/src/superio/nuvoton/wpcm450/superio.c
+++ b/src/superio/nuvoton/wpcm450/superio.c
@@ -31,7 +31,7 @@ static void init(struct device *dev)
 
 	switch(dev->path.pnp.device) {
 	case WPCM450_KBCK:
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	}
 }
diff --git a/src/superio/renesas/m3885x/superio.c b/src/superio/renesas/m3885x/superio.c
index 1f30bfe..84c014c 100644
--- a/src/superio/renesas/m3885x/superio.c
+++ b/src/superio/renesas/m3885x/superio.c
@@ -33,7 +33,7 @@ static void m3885x_init(struct device *dev)
 
 	printk(BIOS_DEBUG, "Renesas M3885x: Initializing keyboard.\n");
 	set_kbc_ps2_mode();
-	pc_keyboard_init();
+	pc_keyboard_init(0);
 	m3885_configure_multikey();
 }
 
diff --git a/src/superio/smsc/dme1737/superio.c b/src/superio/smsc/dme1737/superio.c
index 23f2c7d..0e9bd4c 100644
--- a/src/superio/smsc/dme1737/superio.c
+++ b/src/superio/smsc/dme1737/superio.c
@@ -35,7 +35,7 @@ static void dme1737_init(struct device *dev)
 
 	switch(dev->path.pnp.device) {
 	case DME1737_KBC:
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	}
 }
diff --git a/src/superio/smsc/fdc37n972/fdc37n972.c b/src/superio/smsc/fdc37n972/fdc37n972.c
index 0c6b517..cf94912 100644
--- a/src/superio/smsc/fdc37n972/fdc37n972.c
+++ b/src/superio/smsc/fdc37n972/fdc37n972.c
@@ -31,7 +31,7 @@ static void init(struct device *dev)
 	case FDC37N972_PP: /* TODO. */
 		break;
 	case FDC37N972_KBDC:
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	// [..] The rest: TODO
 	}
diff --git a/src/superio/smsc/kbc1100/superio.c b/src/superio/smsc/kbc1100/superio.c
index 81fb394..687691c 100644
--- a/src/superio/smsc/kbc1100/superio.c
+++ b/src/superio/smsc/kbc1100/superio.c
@@ -68,7 +68,7 @@ static void kbc1100_init(struct device *dev)
   case KBC1100_KBC:
     res0 = find_resource(dev, PNP_IDX_IO0);
     res1 = find_resource(dev, PNP_IDX_IO1);
-    pc_keyboard_init();
+    pc_keyboard_init(0);
     break;
   }
 }
diff --git a/src/superio/smsc/lpc47b272/superio.c b/src/superio/smsc/lpc47b272/superio.c
index 6cc4823..e8d4741 100644
--- a/src/superio/smsc/lpc47b272/superio.c
+++ b/src/superio/smsc/lpc47b272/superio.c
@@ -46,7 +46,7 @@ static void lpc47b272_init(struct device *dev)
 
 	switch(dev->path.pnp.device) {
 	case LPC47B272_KBC:
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	}
 }
diff --git a/src/superio/smsc/lpc47b397/superio.c b/src/superio/smsc/lpc47b397/superio.c
index 6270d92..76164b5 100644
--- a/src/superio/smsc/lpc47b397/superio.c
+++ b/src/superio/smsc/lpc47b397/superio.c
@@ -45,7 +45,7 @@ static void lpc47b397_init(struct device *dev)
 
 	switch(dev->path.pnp.device) {
 	case LPC47B397_KBC:
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	}
 }
diff --git a/src/superio/smsc/lpc47m10x/superio.c b/src/superio/smsc/lpc47m10x/superio.c
index c3c7feb..bcde524 100644
--- a/src/superio/smsc/lpc47m10x/superio.c
+++ b/src/superio/smsc/lpc47m10x/superio.c
@@ -44,7 +44,7 @@ static void lpc47m10x_init(struct device *dev)
 
 	switch(dev->path.pnp.device) {
 	case LPC47M10X2_KBC:
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	}
 }
diff --git a/src/superio/smsc/lpc47m15x/superio.c b/src/superio/smsc/lpc47m15x/superio.c
index 166f383..6736621 100644
--- a/src/superio/smsc/lpc47m15x/superio.c
+++ b/src/superio/smsc/lpc47m15x/superio.c
@@ -66,7 +66,7 @@ static void lpc47m15x_init(struct device *dev)
 
 	switch(dev->path.pnp.device) {
 	case LPC47M15X_KBC:
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	}
 }
diff --git a/src/superio/smsc/lpc47n227/superio.c b/src/superio/smsc/lpc47n227/superio.c
index 3885ef3..a5e33fa 100644
--- a/src/superio/smsc/lpc47n227/superio.c
+++ b/src/superio/smsc/lpc47n227/superio.c
@@ -131,7 +131,7 @@ static void lpc47n227_init(struct device *dev)
 	switch (dev->path.pnp.device) {
 	case LPC47N227_KBDC:
 		printk(BIOS_DEBUG, "LPC47N227: Initializing keyboard.\n");
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	}
 }
diff --git a/src/superio/smsc/mec1308/superio.c b/src/superio/smsc/mec1308/superio.c
index 2beeec6..aa3d012 100644
--- a/src/superio/smsc/mec1308/superio.c
+++ b/src/superio/smsc/mec1308/superio.c
@@ -34,7 +34,7 @@ static void mec1308_init(struct device *dev)
 
 	switch(dev->path.pnp.device) {
 	case MEC1308_KBC:
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	}
 }
diff --git a/src/superio/smsc/sch4037/superio.c b/src/superio/smsc/sch4037/superio.c
index 0f09914..4906aa2 100644
--- a/src/superio/smsc/sch4037/superio.c
+++ b/src/superio/smsc/sch4037/superio.c
@@ -33,7 +33,7 @@ static void sch4037_init(struct device *dev)
 
 	switch(dev->path.pnp.device) {
 		case SCH4037_KBC:
-			pc_keyboard_init();
+			pc_keyboard_init(0);
 			break;
 	}
 }
diff --git a/src/superio/smsc/sio10n268/sio10n268.c b/src/superio/smsc/sio10n268/sio10n268.c
index 5892f0c..e0b0d99 100644
--- a/src/superio/smsc/sio10n268/sio10n268.c
+++ b/src/superio/smsc/sio10n268/sio10n268.c
@@ -31,7 +31,7 @@ static void init(struct device *dev)
 		break;
 	case SIO10N268_KBDC:
 		/* TODO: This is still hardcoded. */
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	// [..] The rest: TODO
 	}
diff --git a/src/superio/smsc/smscsuperio/superio.c b/src/superio/smsc/smscsuperio/superio.c
index b3238de..fec8157 100644
--- a/src/superio/smsc/smscsuperio/superio.c
+++ b/src/superio/smsc/smscsuperio/superio.c
@@ -163,7 +163,7 @@ static void smsc_init(struct device *dev)
 	/* A Super I/O was found, so initialize the respective device. */
 	ld = dev->path.pnp.device;
 	if (ld == logical_device_table[i].devs[LD_KBC]) {
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 	}
 }
 
diff --git a/src/superio/winbond/w83627dhg/superio.c b/src/superio/winbond/w83627dhg/superio.c
index 10dba59..ddda25e 100644
--- a/src/superio/winbond/w83627dhg/superio.c
+++ b/src/superio/winbond/w83627dhg/superio.c
@@ -43,7 +43,7 @@ static void w83627dhg_init(struct device *dev)
 		w83627dhg_enable_UR2(dev);
 		break;
 	case W83627DHG_KBC:
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	}
 }
diff --git a/src/superio/winbond/w83627ehg/superio.c b/src/superio/winbond/w83627ehg/superio.c
index ea7a982..1060059 100644
--- a/src/superio/winbond/w83627ehg/superio.c
+++ b/src/superio/winbond/w83627ehg/superio.c
@@ -85,7 +85,7 @@ static void w83627ehg_init(struct device *dev)
 
 	switch(dev->path.pnp.device) {
 	case W83627EHG_KBC:
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	case W83627EHG_HWM:
 		res0 = find_resource(dev, PNP_IDX_IO0);
diff --git a/src/superio/winbond/w83627hf/superio.c b/src/superio/winbond/w83627hf/superio.c
index fe250a1..2402ae0 100644
--- a/src/superio/winbond/w83627hf/superio.c
+++ b/src/superio/winbond/w83627hf/superio.c
@@ -92,7 +92,7 @@ static void w83627hf_init(struct device *dev)
 
 	switch(dev->path.pnp.device) {
 	case W83627HF_KBC:
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	case W83627HF_HWM:
 		res0 = find_resource(dev, PNP_IDX_IO0);
diff --git a/src/superio/winbond/w83627thg/superio.c b/src/superio/winbond/w83627thg/superio.c
index f42f948..da9bab2 100644
--- a/src/superio/winbond/w83627thg/superio.c
+++ b/src/superio/winbond/w83627thg/superio.c
@@ -33,7 +33,7 @@ static void w83627thg_init(struct device *dev)
 
 	switch(dev->path.pnp.device) {
 	case W83627THG_KBC:
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	}
 }
diff --git a/src/superio/winbond/w83627uhg/superio.c b/src/superio/winbond/w83627uhg/superio.c
index 5192c32..d0e443c 100644
--- a/src/superio/winbond/w83627uhg/superio.c
+++ b/src/superio/winbond/w83627uhg/superio.c
@@ -79,7 +79,7 @@ static void w83627uhg_init(struct device *dev)
 		set_uart_clock_source(dev, 0);
 		break;
 	case W83627UHG_KBC:
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	}
 }
diff --git a/src/superio/winbond/w83667hg-a/ps2_controller.asl b/src/superio/winbond/w83667hg-a/ps2_controller.asl
new file mode 100644
index 0000000..c3b5c75
--- /dev/null
+++ b/src/superio/winbond/w83667hg-a/ps2_controller.asl
@@ -0,0 +1,78 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (c) 2013 Vladimir Serbinenko
+ * Copyright (c) 2015 Raptor Engineering
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; version 2 of
+ * the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+	/* SuperIO control port */
+	Name (SPIO, 0x2E)
+
+	/* SuperIO control map */
+	OperationRegion (SPIM, SystemIO, SPIO, 0x02)
+		Field (SPIM, ByteAcc, NoLock, Preserve) {
+		SIOI, 8,
+		SIOD, 8
+	}
+
+	/* SuperIO control registers */
+	IndexField (SIOI, SIOD, ByteAcc, NoLock, Preserve) {
+		Offset (0x2A),
+		CR2A, 8,		/* Pin function selection */
+	}
+
+	Device (PS2K)		// Keyboard
+	{
+		Name(_HID, EISAID("PNP0303"))
+		Name(_CID, EISAID("PNP030B"))
+
+		Name(_CRS, ResourceTemplate()
+		{
+			IO (Decode16, 0x60, 0x60, 0x01, 0x01)
+			IO (Decode16, 0x64, 0x64, 0x01, 0x01)
+			IRQ (Edge, ActiveHigh, Exclusive) { 0x01 } // IRQ 1
+		})
+
+		Method (_STA, 0)
+		{
+			Return (0xf)
+		}
+	}
+
+	Device (PS2M)		// Mouse
+	{
+		Name(_HID, EISAID("PNP0F13"))
+		Name(_CRS, ResourceTemplate()
+		{
+			IRQ (Edge, ActiveHigh, Exclusive) { 0x0c } // IRQ 12
+		})
+
+		Method(_STA, 0)
+		{
+			/* Access SuperIO ACPI device */
+			Store(0x87, SIOI)
+			Store(0x87, SIOI)
+
+			/* Read Pin56 function select */
+			And(CR2A, 0x2, Local0)
+
+			/* Restore default SuperIO access */
+			Store(0xAA, SIOI)
+
+			if (LEqual(Local0, 0x0)) {
+				/* Mouse function selected */
+				Return (0xf)
+			}
+			Return (0x0)
+		}
+	}
diff --git a/src/superio/winbond/w83667hg-a/superio.c b/src/superio/winbond/w83667hg-a/superio.c
index b539871..d6f2ee5 100644
--- a/src/superio/winbond/w83667hg-a/superio.c
+++ b/src/superio/winbond/w83667hg-a/superio.c
@@ -23,6 +23,7 @@
 #include <pc80/keyboard.h>
 #include <pc80/mc146818rtc.h>
 #include <stdlib.h>
+#include <arch/acpi.h>
 #include <superio/conf_mode.h>
 
 #include "w83667hg-a.h"
@@ -38,6 +39,7 @@ static void w83667hg_a_init(struct device *dev)
 {
 	uint8_t byte;
 	uint8_t power_status;
+	uint8_t mouse_detected;
 
 	if (!dev->enabled)
 		return;
@@ -45,7 +47,23 @@ static void w83667hg_a_init(struct device *dev)
 	switch(dev->path.pnp.device) {
 	/* TODO: Might potentially need code for HWM or FDC etc. */
 	case W83667HG_A_KBC:
-		pc_keyboard_init();
+		/* Enable mouse controller */
+		pnp_enter_conf_mode_8787(dev);
+		byte = pnp_read_config(dev, 0x2a);
+		byte &= ~(0x1 << 1);
+		pnp_write_config(dev, 0x2a, byte);
+		pnp_exit_conf_mode_aa(dev);
+
+		mouse_detected = pc_keyboard_init(1);
+
+		if (!mouse_detected && !acpi_is_wakeup_s3()) {
+			/* Disable mouse controller */
+			pnp_enter_conf_mode_8787(dev);
+			byte = pnp_read_config(dev, 0x2a);
+			byte |= 0x1 << 1;
+			pnp_write_config(dev, 0x2a, byte);
+			pnp_exit_conf_mode_aa(dev);
+		}
 		break;
 	case W83667HG_A_ACPI:
 		/* Set power state after power fail */
diff --git a/src/superio/winbond/w83977tf/superio.c b/src/superio/winbond/w83977tf/superio.c
index f23d7c4..b4fe594 100644
--- a/src/superio/winbond/w83977tf/superio.c
+++ b/src/superio/winbond/w83977tf/superio.c
@@ -34,7 +34,7 @@ static void w83977tf_init(struct device *dev)
 
 	switch(dev->path.pnp.device) {
 	case W83977TF_KBC:
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	}
 }
diff --git a/src/superio/winbond/wpcd376i/superio.c b/src/superio/winbond/wpcd376i/superio.c
index d54c4af..f2d520d 100644
--- a/src/superio/winbond/wpcd376i/superio.c
+++ b/src/superio/winbond/wpcd376i/superio.c
@@ -45,7 +45,7 @@ static void init(device_t dev)
 		break;
 
 	case WPCD376I_KBCK:
-		pc_keyboard_init();
+		pc_keyboard_init(0);
 		break;
 	}
 }
-- 
2.1.4