aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2017-02-11 12:13:03 -0500
committerGerd Hoffmann <kraxel@redhat.com>2017-02-24 15:01:12 +0100
commitd2ac5648f489e96d07e8e656c4ad7dda02ad0cd8 (patch)
treee514e7b898d390fa68a140bf7ee78546c141b71c
parentb0e3c6761423925d51a4247cf341da7613a9dc54 (diff)
downloadseabios-d2ac5648f489e96d07e8e656c4ad7dda02ad0cd8.zip
seabios-d2ac5648f489e96d07e8e656c4ad7dda02ad0cd8.tar.gz
seabios-d2ac5648f489e96d07e8e656c4ad7dda02ad0cd8.tar.bz2
ps2port: Disable keyboard/mouse prior to resetting ps2 controller
If one of the ps2 ports is enabled prior to the ps2 controller reset then it is possible a device event (eg, key press or mouse move) could be mistaken for the controller reset response code. This would result in a failure and the keyboard would be disabled during the boot. Always disabling the keyboard and mouse prior to reset ensures that the controller reset return code can be read properly. Tested-by: Paul Menzel <paulepanter@users.sourceforge.net> Signed-off-by: Kevin O'Connor <kevin@koconnor.net> (cherry picked from commit dbf9dd27f3aefc171839d60c188134da8ad3089d)
-rw-r--r--src/hw/ps2port.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/hw/ps2port.c b/src/hw/ps2port.c
index d9727d2..88b1059 100644
--- a/src/hw/ps2port.c
+++ b/src/hw/ps2port.c
@@ -449,11 +449,22 @@ ps2_check_event(void)
static void
ps2_keyboard_setup(void *data)
{
- /* flush incoming keys */
+ // flush incoming keys (also verifies port is likely present)
int ret = i8042_flush();
if (ret)
return;
+ // Disable keyboard / mouse and drain any input they may have sent
+ ret = i8042_command(I8042_CMD_KBD_DISABLE, NULL);
+ if (ret)
+ return;
+ ret = i8042_command(I8042_CMD_AUX_DISABLE, NULL);
+ if (ret)
+ return;
+ ret = i8042_flush();
+ if (ret)
+ return;
+
// Controller self-test.
u8 param[2];
ret = i8042_command(I8042_CMD_CTL_TEST, param);