OvmfPkg/VirtioInputDxe: handle Ctrl-Alt-Del

Signed-off-by: Ivan Shapovalov <intelfx@intelfx.name>
Tested-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@futurfusion.io>
diff --git a/OvmfPkg/VirtioInputDxe/VirtioInput.inf b/OvmfPkg/VirtioInputDxe/VirtioInput.inf
index 4a20f60..13c92c2 100644
--- a/OvmfPkg/VirtioInputDxe/VirtioInput.inf
+++ b/OvmfPkg/VirtioInputDxe/VirtioInput.inf
@@ -32,6 +32,7 @@
   DebugLib

   MemoryAllocationLib

   UefiBootServicesTableLib

+  UefiRuntimeServicesTableLib

   UefiDriverEntryPoint

   UefiLib

   VirtioLib

diff --git a/OvmfPkg/VirtioInputDxe/VirtioKeyboard.c b/OvmfPkg/VirtioInputDxe/VirtioKeyboard.c
index 1d508b4..52ac813 100644
--- a/OvmfPkg/VirtioInputDxe/VirtioKeyboard.c
+++ b/OvmfPkg/VirtioInputDxe/VirtioKeyboard.c
@@ -13,6 +13,7 @@
 #include <Library/DebugLib.h>

 #include <Library/MemoryAllocationLib.h>

 #include <Library/UefiBootServicesTableLib.h>

+#include <Library/UefiRuntimeServicesTableLib.h>

 #include <Library/UefiLib.h>

 

 #include "VirtioInput.h"

@@ -441,6 +442,16 @@
     // Key pressed event received

     Dev->KeyActive[(UINT8)Event->Code] = TRUE;

 

+    // Handle Ctrl-Alt-Del (in any order)

+    if (

+        (Dev->KeyActive[KEY_LEFTCTRL] || Dev->KeyActive[KEY_RIGHTCTRL]) &&

+        (Dev->KeyActive[KEY_LEFTALT] || Dev->KeyActive[KEY_RIGHTALT]) &&

+        Dev->KeyActive[KEY_DELETE]

+        )

+    {

+      gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);

+    }

+

     //

     // Update toggle state

     // This must happen before EFI_KEY_DATA is populated, since the toggle state