[coreboot] [v2] r4689 - trunk/coreboot-v2/src/pc80

svn at coreboot.org svn at coreboot.org
Tue Sep 29 21:12:23 CEST 2009


Author: myles
Date: 2009-09-29 21:12:23 +0200 (Tue, 29 Sep 2009)
New Revision: 4689

Modified:
   trunk/coreboot-v2/src/pc80/keyboard.c
Log:
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 at gmail.com>
Acked-by: Myles Watson <mylesgw at gmail.com>



Modified: trunk/coreboot-v2/src/pc80/keyboard.c
===================================================================
--- trunk/coreboot-v2/src/pc80/keyboard.c	2009-09-29 18:15:06 UTC (rev 4688)
+++ trunk/coreboot-v2/src/pc80/keyboard.c	2009-09-29 19:12:23 UTC (rev 4689)
@@ -97,7 +97,6 @@
 static void pc_keyboard_init(struct pc_keyboard *keyboard)
 {
 	u8 regval;
-	u8 resend;
 	printk_debug("Keyboard init...\n");
 
 	/* clean up any junk that might have been in the kbc */
@@ -118,21 +117,14 @@
 	}
 
 	/* Enable keyboard interface - No IRQ */
-	resend = 10;
-	regval = 0;
-	do {
-		if (!kbc_input_buffer_empty()) return;
-		outb(0x60, 0x64);
-		if (!kbc_input_buffer_empty()) return;
-		outb(0x20, 0x60);	/* send cmd: enable keyboard */
-		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);
+	if (!kbc_input_buffer_empty()) return;
+	outb(0x60, 0x64);
+	if (!kbc_input_buffer_empty()) return;
+	outb(0x20, 0x60);	/* send cmd: enable keyboard */
+	if (!kbc_input_buffer_empty()) {
+		printk_info("Timeout while enabling keyboard\n");
+		return;
+	}
 
 	/* clean up any junk that might have been in the keyboard */
 	if (!kbc_cleanup_buffers()) return;
@@ -187,18 +179,14 @@
 	}
 
 	/* All is well - enable keyboard interface */
-	resend = 10;
-	regval = 0;
-	do {
-		if (!kbc_input_buffer_empty()) return;
-		outb(0x60, 0x64);
-		if (!kbc_input_buffer_empty()) return;
-		outb(0x61, 0x60);	/* send cmd: enable keyboard and IRQ 1 */
-		if (kbc_output_buffer_full()) {
-			regval = inb(0x60);
-		}
-		--resend;
-	} while (regval == 0xFE && resend > 0);
+	if (!kbc_input_buffer_empty()) return;
+	outb(0x60, 0x64);
+	if (!kbc_input_buffer_empty()) return;
+	outb(0x61, 0x60);	/* send cmd: enable keyboard and IRQ 1 */
+	if (!kbc_input_buffer_empty()) {
+		printk_err("Timeout during final keyboard enable\n");
+		return;
+	}
 }
 
 





More information about the coreboot mailing list