a5bd9f6
From 99462758030178ce8e28fc59e9275824e1e0fd1b Mon Sep 17 00:00:00 2001
a5bd9f6
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
a5bd9f6
Date: Sat, 23 Mar 2013 16:54:36 +0100
a5bd9f6
Subject: [PATCH 225/364] 	* grub-core/term/at_keyboard.c: Increase
a5bd9f6
 robustness on coreboot 	and qemu.
a5bd9f6
a5bd9f6
---
a5bd9f6
 ChangeLog                    |  5 +++++
a5bd9f6
 grub-core/term/at_keyboard.c | 16 +++++++++++++---
a5bd9f6
 2 files changed, 18 insertions(+), 3 deletions(-)
a5bd9f6
a5bd9f6
diff --git a/ChangeLog b/ChangeLog
a5bd9f6
index 8175269..9841659 100644
a5bd9f6
--- a/ChangeLog
a5bd9f6
+++ b/ChangeLog
a5bd9f6
@@ -1,3 +1,8 @@
a5bd9f6
+2013-03-23  Vladimir Serbinenko  <phcoder@gmail.com>
a5bd9f6
+
a5bd9f6
+	* grub-core/term/at_keyboard.c: Increase robustness on coreboot
a5bd9f6
+	and qemu.
a5bd9f6
+
a5bd9f6
 2013-03-22  Vladimir Serbinenko  <phcoder@gmail.com>
a5bd9f6
 
a5bd9f6
 	* grub-core/fs/zfs/zfs.c: Fix incorrect handling of special volumes.
a5bd9f6
diff --git a/grub-core/term/at_keyboard.c b/grub-core/term/at_keyboard.c
a5bd9f6
index 2afcceb..b2f328f 100644
a5bd9f6
--- a/grub-core/term/at_keyboard.c
a5bd9f6
+++ b/grub-core/term/at_keyboard.c
a5bd9f6
@@ -259,7 +259,13 @@ grub_keyboard_controller_write (grub_uint8_t c)
a5bd9f6
   grub_outb (c, KEYBOARD_REG_DATA);
a5bd9f6
 }
a5bd9f6
 
a5bd9f6
-#if !defined (GRUB_MACHINE_MIPS_LOONGSON) && !defined (GRUB_MACHINE_QEMU) && !defined (GRUB_MACHINE_MIPS_QEMU_MIPS)
a5bd9f6
+#if defined (GRUB_MACHINE_MIPS_LOONGSON) || defined (GRUB_MACHINE_QEMU) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS)
a5bd9f6
+#define USE_SCANCODE_SET 1
a5bd9f6
+#else
a5bd9f6
+#define USE_SCANCODE_SET 0
a5bd9f6
+#endif
a5bd9f6
+
a5bd9f6
+#if !USE_SCANCODE_SET
a5bd9f6
 
a5bd9f6
 static grub_uint8_t
a5bd9f6
 grub_keyboard_controller_read (void)
a5bd9f6
@@ -332,7 +338,7 @@ set_scancodes (void)
a5bd9f6
       return;
a5bd9f6
     }
a5bd9f6
 
a5bd9f6
-#if !(defined (GRUB_MACHINE_MIPS_LOONGSON) || defined (GRUB_MACHINE_QEMU) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS))
a5bd9f6
+#if !USE_SCANCODE_SET
a5bd9f6
   current_set = 1;
a5bd9f6
   return;
a5bd9f6
 #else
a5bd9f6
@@ -570,9 +576,13 @@ grub_keyboard_controller_init (struct grub_term_input *term __attribute__ ((unus
a5bd9f6
       keyboard_controller_wait_until_ready ();
a5bd9f6
       grub_inb (KEYBOARD_REG_DATA);
a5bd9f6
     }
a5bd9f6
-#if defined (GRUB_MACHINE_MIPS_LOONGSON) || defined (GRUB_MACHINE_QEMU) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS)
a5bd9f6
+#if defined (GRUB_MACHINE_MIPS_LOONGSON) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS)
a5bd9f6
   grub_keyboard_controller_orig = 0;
a5bd9f6
   grub_keyboard_orig_set = 2;
a5bd9f6
+#elif defined (GRUB_MACHINE_QEMU) || defined (GRUB_MACHINE_COREBOOT)
a5bd9f6
+  /* *BSD relies on those settings.  */
a5bd9f6
+  grub_keyboard_controller_orig = KEYBOARD_AT_TRANSLATE;
a5bd9f6
+  grub_keyboard_orig_set = 2;
a5bd9f6
 #else
a5bd9f6
   grub_keyboard_controller_orig = grub_keyboard_controller_read ();
a5bd9f6
   grub_keyboard_orig_set = query_mode ();
a5bd9f6
-- 
a5bd9f6
1.8.1.4
a5bd9f6