Author: stepan Date: Sun Feb 28 20:12:37 2010 New Revision: 5173 URL: http://tracker.coreboot.org/trac/coreboot/changeset/5173
Log: 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
Modified: trunk/src/pc80/keyboard.c
Modified: trunk/src/pc80/keyboard.c ============================================================================== --- trunk/src/pc80/keyboard.c Sun Feb 28 19:37:38 2010 (r5172) +++ trunk/src/pc80/keyboard.c Sun Feb 28 20:12:37 2010 (r5173) @@ -154,7 +154,7 @@ } regval = inb(KBD_DATA); --resend; - } while (regval == 0xFE && resend > 0); + } while (regval == KBD_REPLY_RESEND && resend > 0);
return regval; } @@ -183,7 +183,13 @@
/* 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 @@
/* 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; }