[coreboot] r3675 - trunk/payloads/libpayload/drivers

svn at coreboot.org svn at coreboot.org
Mon Oct 20 19:07:26 CEST 2008


Author: jcrouse
Date: 2008-10-20 19:07:26 +0200 (Mon, 20 Oct 2008)
New Revision: 3675

Modified:
   trunk/payloads/libpayload/drivers/keyboard.c
Log:
[PATCH] libpayload:  Bail if the keyboard controller isn't there

If the system in question does not have a superIO, then a read of
0x64 will return 0xFF and we will loop forever.

Signed-off-by: Jordan Crouse <jordan.crouse at amd.com>
Acked-by: Patrick Georgi <patrick.georgi at coresystems.de>


Modified: trunk/payloads/libpayload/drivers/keyboard.c
===================================================================
--- trunk/payloads/libpayload/drivers/keyboard.c	2008-10-20 16:52:06 UTC (rev 3674)
+++ trunk/payloads/libpayload/drivers/keyboard.c	2008-10-20 17:07:26 UTC (rev 3675)
@@ -175,11 +175,10 @@
 	while (inb(0x64) & 2);
 }
 
-
 int keyboard_havechar(void)
 {
 	unsigned char c = inb(0x64);
-	return c & 1;
+	return (c == 0xFF) ? 0 : c & 1;
 }
 
 unsigned char keyboard_get_scancode(void)
@@ -332,6 +331,12 @@
 	u8 mode;
 	map = &keyboard_layouts[0];
 
+	/* If 0x64 returns 0xff, then we have no keyboard
+	 * controller */
+
+	if (inb(0x64) == 0xFF)
+		return;
+
 	/* Empty keyboard buffer */
 	while (keyboard_havechar()) keyboard_getchar();
 





More information about the coreboot mailing list