From 9c3e8b52d64c95d8e27c187598f6e4e41e596da9 Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Sun, 28 Feb 2010 19:12:37 +0000 Subject: use names instead of numbers where possible, also print a better message if no keyboard is connected. Signed-off-by: Stefan Reinauer Acked-by: Stefan Reinauer git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5173 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- src/pc80/keyboard.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/pc80') diff --git a/src/pc80/keyboard.c b/src/pc80/keyboard.c index 04abe043cb..6b80620695 100644 --- a/src/pc80/keyboard.c +++ b/src/pc80/keyboard.c @@ -154,7 +154,7 @@ static u8 send_keyboard(u8 command) } regval = inb(KBD_DATA); --resend; - } while (regval == 0xFE && resend > 0); + } while (regval == KBD_REPLY_RESEND && resend > 0); return regval; } @@ -183,7 +183,13 @@ void pc_keyboard_init(struct pc_keyboard *keyboard) /* reset keyboard and self test (keyboard side) */ 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); return; } @@ -206,27 +212,27 @@ void pc_keyboard_init(struct pc_keyboard *keyboard) /* disable the keyboard */ regval = send_keyboard(0xF5); - if (regval != 0xFA) { + if (regval != KBD_REPLY_ACK) { printk_err("Keyboard disable failed ACK: 0x%x\n", regval); return; } /* Set scancode command */ regval = send_keyboard(0xF0); - if (regval != 0xFA) { + if (regval != KBD_REPLY_ACK) { printk_err("Keyboard set scancode cmd failed ACK: 0x%x\n", regval); return; } /* Set scancode mode 2 */ regval = send_keyboard(0x02); - if (regval != 0xFA) { + if (regval != KBD_REPLY_ACK) { printk_err("Keyboard set scancode mode failed ACK: 0x%x\n", regval); return; } /* enable the keyboard */ regval = send_keyboard(0xF4); - if (regval != 0xFA) { + if (regval != KBD_REPLY_ACK) { printk_err("Keyboard enable failed ACK: 0x%x\n", regval); return; } -- cgit v1.2.3