From 7789e9aa75ba82a0bc52dc8b2b44fa9b16234173 Mon Sep 17 00:00:00 2001
From: Andreas Sandberg <andreas.sandberg@arm.com>
Date: Mon, 9 Apr 2018 22:16:13 +0000
Subject: [PATCH] ps2: Implement the keyboard reset command

Linux tries to reset the PS/2 keyboard at boot.

Change-Id: I727fbf6138b654885d82d85be9d964ee3d3365ef
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/9766
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
---
 src/dev/ps2/keyboard.cc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/dev/ps2/keyboard.cc b/src/dev/ps2/keyboard.cc
index 1f8b54411..c9bc21986 100644
--- a/src/dev/ps2/keyboard.cc
+++ b/src/dev/ps2/keyboard.cc
@@ -127,6 +127,12 @@ PS2Keyboard::recv(const std::vector<uint8_t> &data)
         enabled = false;
         sendAck();
         return true;
+      case Reset:
+        DPRINTF(PS2, "Resetting keyboard.\n");
+        sendAck();
+        enabled = true;
+        send(Ps2::SelfTestPass);
+        return true;
       case AllKeysToTypematic:
         panic("Setting all keys to typemantic unimplemented.\n");
       case AllKeysToMakeRelease:
@@ -144,8 +150,6 @@ PS2Keyboard::recv(const std::vector<uint8_t> &data)
         panic("Setting key to make only unimplemented.\n");
       case Resend:
         panic("Keyboard resend unimplemented.\n");
-      case Reset:
-        panic("Keyboard reset unimplemented.\n");
       default:
         panic("Unknown keyboard command %#02x.\n", data[0]);
     }
-- 
2.30.2