A keyboard controller fix to stop the code from waiting for a code that never
comes. Boot tested on SimNOW (fixes the hang there), and Tyan s2895. Signed-off-by: Marc Jones <marcj303@gmail.com> Acked-by: Myles Watson <mylesgw@gmail.com> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4689 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
@@ -97,7 +97,6 @@ static u8 send_keyboard(u8 command)
|
|||||||
static void pc_keyboard_init(struct pc_keyboard *keyboard)
|
static void pc_keyboard_init(struct pc_keyboard *keyboard)
|
||||||
{
|
{
|
||||||
u8 regval;
|
u8 regval;
|
||||||
u8 resend;
|
|
||||||
printk_debug("Keyboard init...\n");
|
printk_debug("Keyboard init...\n");
|
||||||
|
|
||||||
/* clean up any junk that might have been in the kbc */
|
/* clean up any junk that might have been in the kbc */
|
||||||
@@ -118,21 +117,14 @@ static void pc_keyboard_init(struct pc_keyboard *keyboard)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Enable keyboard interface - No IRQ */
|
/* Enable keyboard interface - No IRQ */
|
||||||
resend = 10;
|
if (!kbc_input_buffer_empty()) return;
|
||||||
regval = 0;
|
outb(0x60, 0x64);
|
||||||
do {
|
if (!kbc_input_buffer_empty()) return;
|
||||||
if (!kbc_input_buffer_empty()) return;
|
outb(0x20, 0x60); /* send cmd: enable keyboard */
|
||||||
outb(0x60, 0x64);
|
if (!kbc_input_buffer_empty()) {
|
||||||
if (!kbc_input_buffer_empty()) return;
|
printk_info("Timeout while enabling keyboard\n");
|
||||||
outb(0x20, 0x60); /* send cmd: enable keyboard */
|
return;
|
||||||
if (kbc_output_buffer_full()) {
|
}
|
||||||
regval = inb(0x60);
|
|
||||||
} else {
|
|
||||||
printk_info("Timeout while enabling keyboard. (No keyboard present?)\n");
|
|
||||||
regval = inb(0x60); /* Better than 0 ? */
|
|
||||||
}
|
|
||||||
--resend;
|
|
||||||
} while (regval == 0xFE && resend > 0);
|
|
||||||
|
|
||||||
/* clean up any junk that might have been in the keyboard */
|
/* clean up any junk that might have been in the keyboard */
|
||||||
if (!kbc_cleanup_buffers()) return;
|
if (!kbc_cleanup_buffers()) return;
|
||||||
@@ -187,18 +179,14 @@ static void pc_keyboard_init(struct pc_keyboard *keyboard)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* All is well - enable keyboard interface */
|
/* All is well - enable keyboard interface */
|
||||||
resend = 10;
|
if (!kbc_input_buffer_empty()) return;
|
||||||
regval = 0;
|
outb(0x60, 0x64);
|
||||||
do {
|
if (!kbc_input_buffer_empty()) return;
|
||||||
if (!kbc_input_buffer_empty()) return;
|
outb(0x61, 0x60); /* send cmd: enable keyboard and IRQ 1 */
|
||||||
outb(0x60, 0x64);
|
if (!kbc_input_buffer_empty()) {
|
||||||
if (!kbc_input_buffer_empty()) return;
|
printk_err("Timeout during final keyboard enable\n");
|
||||||
outb(0x61, 0x60); /* send cmd: enable keyboard and IRQ 1 */
|
return;
|
||||||
if (kbc_output_buffer_full()) {
|
}
|
||||||
regval = inb(0x60);
|
|
||||||
}
|
|
||||||
--resend;
|
|
||||||
} while (regval == 0xFE && resend > 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user