aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2011-05-28 11:00:28 -0400
committerKevin O'Connor <kevin@koconnor.net>2011-05-28 11:00:28 -0400
commit299dc1344867b56c9ba7ec0be2add22f0ec7fe0b (patch)
tree0bf9cd5a842a5954218aae99b2ec1be457ac7cdf
parent67b059c95fe36fc076f35e0840cb8a8411cfc402 (diff)
downloadseabios-299dc1344867b56c9ba7ec0be2add22f0ec7fe0b.tar.gz
Add option to handle PS2 keyboards that have a slow power up.
Add PS2_KEYBOARD_SPINUP option to give certain keyboards more time to initialize. Based on report and feedback from: Sven Schnelle <svens@stackframe.org> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--src/Kconfig8
-rw-r--r--src/ps2port.c15
2 files changed, 20 insertions, 3 deletions
diff --git a/src/Kconfig b/src/Kconfig
index 123db01..2195bad 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -125,6 +125,14 @@ menu "Hardware support"
default y
help
Support PS2 ports (keyboard and mouse).
+ config PS2_KEYBOARD_SPINUP
+ depends on PS2PORT
+ int "Extra time (in ms) to allow a keyboard to initialize"
+ default 0
+ help
+ Some PS2 keyboards don't respond to commands immediately
+ after powering on. Specify a positive value here to allow
+ additional time for the keyboard to become responsive.
config USB
bool "USB"
diff --git a/src/ps2port.c b/src/ps2port.c
index 81d47c9..8259f65 100644
--- a/src/ps2port.c
+++ b/src/ps2port.c
@@ -438,9 +438,18 @@ keyboard_init(void *data)
/* ------------------- keyboard side ------------------------*/
/* reset keyboard and self test (keyboard side) */
- ret = ps2_kbd_command(ATKBD_CMD_RESET_BAT, param);
- if (ret)
- return;
+ u64 end = calc_future_tsc(CONFIG_PS2_KEYBOARD_SPINUP);
+ for (;;) {
+ ret = ps2_kbd_command(ATKBD_CMD_RESET_BAT, param);
+ if (!ret)
+ break;
+ if (check_tsc(end)) {
+ if (CONFIG_PS2_KEYBOARD_SPINUP)
+ warn_timeout();
+ return;
+ }
+ yield();
+ }
if (param[0] != 0xaa) {
dprintf(1, "keyboard self test failed (got %x not 0xaa)\n", param[0]);
return;