]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Csm/BiosThunk/KeyboardDxe/BiosKeyboard.h
IntelFrameworkModulePkg: Clean up source files
[mirror_edk2.git] / IntelFrameworkModulePkg / Csm / BiosThunk / KeyboardDxe / BiosKeyboard.h
index e83608659bc1afce9a3ebc291a7fc5070949ea57..ef2c822c55fdbd704b6b88d8add513106eda6a37 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
 \r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions\r
@@ -18,6 +18,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 \r
 #include <FrameworkDxe.h>\r
+#include <Pi/PiDxeCis.h>\r
 \r
 #include <Guid/StatusCodeDataTypeId.h>\r
 #include <Protocol/SimpleTextIn.h>\r
@@ -33,6 +34,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/ReportStatusCodeLib.h>\r
 #include <Library/UefiDriverEntryPoint.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/DxeServicesTableLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/BaseLib.h>\r
 #include <Library/PcdLib.h>\r
@@ -218,18 +220,21 @@ typedef struct {
   UINT16                                      StatusRegisterAddress;\r
   UINT16                                      CommandRegisterAddress;\r
   BOOLEAN                                     ExtendedKeyboard;\r
-  \r
+\r
+  EFI_KEY_STATE                               KeyState;\r
   //\r
   // Buffer storing EFI_KEY_DATA\r
   //\r
   SIMPLE_QUEUE                                Queue;\r
+  SIMPLE_QUEUE                                QueueForNotify;\r
 \r
   //\r
   // Notification Function List\r
   //\r
   LIST_ENTRY                                  NotifyList;\r
+  EFI_EVENT                                   KeyNotifyProcessEvent;\r
   EFI_EVENT                                   TimerEvent;\r
-  \r
+\r
 } BIOS_KEYBOARD_DEV;\r
 \r
 #define BIOS_KEYBOARD_DEV_FROM_THIS(a)  CR (a, BIOS_KEYBOARD_DEV, SimpleTextIn, BIOS_KEYBOARD_DEV_SIGNATURE)\r
@@ -495,7 +500,7 @@ BiosKeyboardWaitForKey (
   Check key buffer to get the key stroke status.\r
 \r
   @param  This         Pointer of the protocol EFI_SIMPLE_TEXT_IN_PROTOCOL.\r
-  \r
+\r
   @retval EFI_SUCCESS  A key is being pressed now.\r
   @retval Other        No key is now pressed.\r
 \r
@@ -512,7 +517,7 @@ BiosKeyboardCheckForKey (
   @param  KeyChar      Unicode of key.\r
   @param  ScanCode     Scan code of key.\r
 \r
-  @return The value of EFI Scancode for the key.    \r
+  @return The value of EFI Scancode for the key.\r
   @retval SCAN_NULL   No corresponding value in the EFI convert table is found for the key.\r
 \r
 **/\r
@@ -525,7 +530,7 @@ ConvertToEFIScanCode (
 /**\r
   Check whether there is Ps/2 Keyboard device in system by 0xF4 Keyboard Command\r
   If Keyboard receives 0xF4, it will respond with 'ACK'. If it doesn't respond, the device\r
-  should not be in system. \r
+  should not be in system.\r
 \r
   @param  BiosKeyboardPrivate  Keyboard Private Data Struture\r
 \r
@@ -540,9 +545,9 @@ CheckKeyboardConnect (
 \r
 /**\r
   Timer event handler: read a series of key stroke from 8042\r
-  and put them into memory key buffer. \r
+  and put them into memory key buffer.\r
   It is registered as running under TPL_NOTIFY\r
-  \r
+\r
   @param  Event   The timer event\r
   @param  Context A BIOS_KEYBOARD_DEV pointer\r
 \r
@@ -554,14 +559,27 @@ BiosKeyboardTimerHandler (
   IN VOID         *Context\r
   );\r
 \r
+/**\r
+  Process key notify.\r
+\r
+  @param  Event                 Indicates the event that invoke this function.\r
+  @param  Context               Indicates the calling context.\r
+**/\r
+VOID\r
+EFIAPI\r
+KeyNotifyProcessHandler (\r
+  IN  EFI_EVENT                 Event,\r
+  IN  VOID                      *Context\r
+  );\r
+\r
 /**\r
   Reset the input device and optionaly run diagnostics\r
\r
+\r
   @param  This                  Protocol instance pointer.\r
   @param  ExtendedVerification  Driver may perform diagnostics on reset.\r
 \r
   @retval EFI_SUCCESS           The device was reset.\r
-  @retval EFI_DEVICE_ERROR      The device is not functioning properly and could \r
+  @retval EFI_DEVICE_ERROR      The device is not functioning properly and could\r
                                 not be reset.\r
 \r
 **/\r
@@ -573,19 +591,19 @@ BiosKeyboardResetEx (
   );\r
 \r
 /**\r
-  Reads the next keystroke from the input device. The WaitForKey Event can \r
+  Reads the next keystroke from the input device. The WaitForKey Event can\r
   be used to test for existance of a keystroke via WaitForEvent () call.\r
 \r
   @param  This         Protocol instance pointer.\r
-  @param  KeyData      A pointer to a buffer that is filled in with the keystroke \r
+  @param  KeyData      A pointer to a buffer that is filled in with the keystroke\r
                        state data for the key that was pressed.\r
-  \r
+\r
   @retval  EFI_SUCCESS           The keystroke information was returned.\r
   @retval  EFI_NOT_READY         There was no keystroke data availiable.\r
-  @retval  EFI_DEVICE_ERROR      The keystroke information was not returned due to \r
+  @retval  EFI_DEVICE_ERROR      The keystroke information was not returned due to\r
                                  hardware errors.\r
-  @retval  EFI_INVALID_PARAMETER KeyData is NULL.                        \r
-    \r
+  @retval  EFI_INVALID_PARAMETER KeyData is NULL.\r
+\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -598,16 +616,16 @@ BiosKeyboardReadKeyStrokeEx (
   Set certain state for the input device.\r
 \r
   @param  This              Protocol instance pointer.\r
-  @param  KeyToggleState    A pointer to the EFI_KEY_TOGGLE_STATE to set the \r
+  @param  KeyToggleState    A pointer to the EFI_KEY_TOGGLE_STATE to set the\r
                             state for the input device.\r
 \r
   @retval EFI_SUCCESS           The device state was set successfully.\r
-  @retval EFI_DEVICE_ERROR      The device is not functioning correctly and could \r
+  @retval EFI_DEVICE_ERROR      The device is not functioning correctly and could\r
                                 not have the setting adjusted.\r
   @retval EFI_UNSUPPORTED       The device does not have the ability to set its state.\r
-  @retval EFI_INVALID_PARAMETER KeyToggleState is NULL.                       \r
+  @retval EFI_INVALID_PARAMETER KeyToggleState is NULL.\r
 \r
-**/   \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 BiosKeyboardSetState (\r
@@ -619,18 +637,22 @@ BiosKeyboardSetState (
   Register a notification function for a particular keystroke for the input device.\r
 \r
   @param  This                    Protocol instance pointer.\r
-  @param  KeyData                 A pointer to a buffer that is filled in with the keystroke \r
-                                  information data for the key that was pressed.\r
-  @param  KeyNotificationFunction Points to the function to be called when the key \r
-                                  sequence is typed specified by KeyData.                        \r
-  @param  NotifyHandle            Points to the unique handle assigned to the registered notification.                          \r
+  @param  KeyData                 A pointer to a buffer that is filled in with the keystroke\r
+                                  information data for the key that was pressed. If KeyData.Key,\r
+                                  KeyData.KeyState.KeyToggleState and KeyData.KeyState.KeyShiftState\r
+                                  are 0, then any incomplete keystroke will trigger a notification of\r
+                                  the KeyNotificationFunction.\r
+  @param  KeyNotificationFunction Points to the function to be called when the key\r
+                                  sequence is typed specified by KeyData. This notification function\r
+                                  should be called at <=TPL_CALLBACK.\r
+  @param  NotifyHandle            Points to the unique handle assigned to the registered notification.\r
+\r
 \r
-  \r
   @retval EFI_SUCCESS             The notification function was registered successfully.\r
   @retval EFI_OUT_OF_RESOURCES    Unable to allocate resources for necesssary data structures.\r
   @retval EFI_INVALID_PARAMETER   KeyData or NotifyHandle is NULL.\r
-                                                  \r
-**/   \r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 BiosKeyboardRegisterKeyNotify (\r
@@ -643,13 +665,13 @@ BiosKeyboardRegisterKeyNotify (
 /**\r
   Remove a registered notification function from a particular keystroke.\r
 \r
-  @param  This                 Protocol instance pointer.    \r
+  @param  This                 Protocol instance pointer.\r
   @param  NotificationHandle   The handle of the notification function being unregistered.\r
-  \r
+\r
   @retval EFI_SUCCESS             The notification function was unregistered successfully.\r
   @retval EFI_INVALID_PARAMETER   The NotificationHandle is invalid.\r
-                              \r
-**/   \r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 BiosKeyboardUnregisterKeyNotify (\r
@@ -705,19 +727,19 @@ KeyboardWrite (
 EFI_STATUS\r
 BiosKeyboardFreeNotifyList (\r
   IN OUT LIST_ENTRY           *ListHead\r
-  );  \r
+  );\r
 \r
 /**\r
   Check if key is registered.\r
 \r
-  @param  RegsiteredData    A pointer to a buffer that is filled in with the keystroke \r
+  @param  RegsiteredData    A pointer to a buffer that is filled in with the keystroke\r
                             state data for the key that was registered.\r
-  @param  InputData         A pointer to a buffer that is filled in with the keystroke \r
+  @param  InputData         A pointer to a buffer that is filled in with the keystroke\r
                             state data for the key that was pressed.\r
 \r
   @retval TRUE              Key be pressed matches a registered key.\r
-  @retval FLASE             Match failed. \r
-  \r
+  @retval FLASE             Match failed.\r
+\r
 **/\r
 BOOLEAN\r
 IsKeyRegistered (\r
@@ -730,7 +752,7 @@ IsKeyRegistered (
 \r
   @param  Event    The event that be siganlled when any key has been stroked.\r
   @param  Context  Pointer of the protocol EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.\r
-  \r
+\r
 **/\r
 VOID\r
 EFIAPI\r