use names instead of numbers where possible, also print a better message if no

keyboard is connected.

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>



git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5173 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Stefan Reinauer 2010-02-28 19:12:37 +00:00 committed by Stefan Reinauer
parent c89c4d4602
commit 9c3e8b52d6
1 changed files with 12 additions and 6 deletions

View File

@ -154,7 +154,7 @@ static u8 send_keyboard(u8 command)
} }
regval = inb(KBD_DATA); regval = inb(KBD_DATA);
--resend; --resend;
} while (regval == 0xFE && resend > 0); } while (regval == KBD_REPLY_RESEND && resend > 0);
return regval; return regval;
} }
@ -183,7 +183,13 @@ void pc_keyboard_init(struct pc_keyboard *keyboard)
/* reset keyboard and self test (keyboard side) */ /* reset keyboard and self test (keyboard side) */
regval = send_keyboard(0xFF); regval = send_keyboard(0xFF);
if (regval != 0xFA) { if (regval == KBD_REPLY_RESEND) {
/* keeps sending RESENDs, probably no keyboard. */
printk_info("No PS/2 keyboard detected.\n");
return;
}
if (regval != KBD_REPLY_ACK) {
printk_err("Keyboard selftest failed ACK: 0x%x\n", regval); printk_err("Keyboard selftest failed ACK: 0x%x\n", regval);
return; return;
} }
@ -206,27 +212,27 @@ void pc_keyboard_init(struct pc_keyboard *keyboard)
/* disable the keyboard */ /* disable the keyboard */
regval = send_keyboard(0xF5); regval = send_keyboard(0xF5);
if (regval != 0xFA) { if (regval != KBD_REPLY_ACK) {
printk_err("Keyboard disable failed ACK: 0x%x\n", regval); printk_err("Keyboard disable failed ACK: 0x%x\n", regval);
return; return;
} }
/* Set scancode command */ /* Set scancode command */
regval = send_keyboard(0xF0); regval = send_keyboard(0xF0);
if (regval != 0xFA) { if (regval != KBD_REPLY_ACK) {
printk_err("Keyboard set scancode cmd failed ACK: 0x%x\n", regval); printk_err("Keyboard set scancode cmd failed ACK: 0x%x\n", regval);
return; return;
} }
/* Set scancode mode 2 */ /* Set scancode mode 2 */
regval = send_keyboard(0x02); regval = send_keyboard(0x02);
if (regval != 0xFA) { if (regval != KBD_REPLY_ACK) {
printk_err("Keyboard set scancode mode failed ACK: 0x%x\n", regval); printk_err("Keyboard set scancode mode failed ACK: 0x%x\n", regval);
return; return;
} }
/* enable the keyboard */ /* enable the keyboard */
regval = send_keyboard(0xF4); regval = send_keyboard(0xF4);
if (regval != 0xFA) { if (regval != KBD_REPLY_ACK) {
printk_err("Keyboard enable failed ACK: 0x%x\n", regval); printk_err("Keyboard enable failed ACK: 0x%x\n", regval);
return; return;
} }