diff options
author | Martin Roth <martin.roth@se-eng.com> | 2013-07-26 16:31:21 -0600 |
---|---|---|
committer | Patrick Georgi <patrick@georgi-clan.de> | 2013-12-21 08:29:58 +0100 |
commit | 3ee59f7b313e41b8379c54f00bba2526f0d0d43b (patch) | |
tree | 55f4af66ca1280f140e0f315ba6ad9122f2a1f40 /payloads/libpayload/drivers | |
parent | 2f38b07570d504b82878efa55e55a144a81d54ee (diff) | |
download | coreboot-3ee59f7b313e41b8379c54f00bba2526f0d0d43b.tar.xz |
Libpayload: Add keyboard-disable function.
Add a function to disable and clear the keyboard controller.
Verified Code flow in normal boot/S3 resume with print statements.
Verified Keyboard was correctly disabled and flushed by booting
to recovery mode screen while pressing keys on the integrated
keyboard.
Change-Id: I3e1f011c3436fee5ce10993c6c26a3c8597c6fca
Signed-off-by: Martin Roth <martin.roth@se-eng.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/63627
Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Tested-by: Shawn Nematbakhsh <shawnn@chromium.org>
Commit-Queue: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: http://review.coreboot.org/4395
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
Diffstat (limited to 'payloads/libpayload/drivers')
-rw-r--r-- | payloads/libpayload/drivers/keyboard.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/payloads/libpayload/drivers/keyboard.c b/payloads/libpayload/drivers/keyboard.c index e65f08534a..0175bc74d9 100644 --- a/payloads/libpayload/drivers/keyboard.c +++ b/payloads/libpayload/drivers/keyboard.c @@ -31,6 +31,8 @@ #include <libpayload-config.h> #include <libpayload.h> +#define I8042_CMD_DIS_KB 0xad + struct layout_maps { const char *country; const unsigned short map[4][0x57]; @@ -300,3 +302,22 @@ void keyboard_init(void) console_add_input_driver(&cons); } +void keyboard_disconnect(void) +{ + /* If 0x64 returns 0xff, then we have no keyboard + * controller */ + if (inb(0x64) == 0xFF) + return; + + /* Empty keyboard buffer */ + while (keyboard_havechar()) + keyboard_getchar(); + + /* Send keyboard disconnect command */ + outb(I8042_CMD_DIS_KB, 0x64); + keyboard_wait_write(); + + /* Hand off with empty buffer */ + while (keyboard_havechar()) + keyboard_getchar(); +} |