From: Kevin O'Connor Date: Sat, 28 May 2011 15:00:28 +0000 (-0400) Subject: Add option to handle PS2 keyboards that have a slow power up. X-Git-Tag: rel-1.6.3~89 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=299dc1344867b56c9ba7ec0be2add22f0ec7fe0b;p=seabios.git 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 Signed-off-by: Kevin O'Connor --- 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;