]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h
IntelFrameworkModule/Ps2Kb: ReadKeyStrokeEx always return key state
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Isa / Ps2KeyboardDxe / Ps2Keyboard.h
index deeb59b95182e46876c7feaea9cf48cff236103a..613f176401ec6b09bb5a25e5506245e1556c5708 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   PS/2 keyboard driver header file\r
 \r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -15,7 +15,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #ifndef _PS2KEYBOARD_H_\r
 #define _PS2KEYBOARD_H_\r
 \r
-#include <FrameworkDxe.h>\r
+#include <Uefi.h>\r
 \r
 #include <Protocol/SimpleTextIn.h>\r
 #include <Protocol/SimpleTextInEx.h>\r
@@ -50,7 +50,6 @@ extern EFI_COMPONENT_NAME2_PROTOCOL  gPs2KeyboardComponentName2;
 \r
 typedef struct _KEYBOARD_CONSOLE_IN_EX_NOTIFY {\r
   UINTN                               Signature;\r
-  EFI_HANDLE                          NotifyHandle;\r
   EFI_KEY_DATA                        KeyData;\r
   EFI_KEY_NOTIFY_FUNCTION             KeyNotificationFn;\r
   LIST_ENTRY                          NotifyEntry;\r
@@ -89,7 +88,7 @@ typedef struct {
   BOOLEAN                             LeftAlt;\r
   BOOLEAN                             RightAlt;\r
   BOOLEAN                             LeftShift;\r
-  BOOLEAN                             RightShift;  \r
+  BOOLEAN                             RightShift;\r
   BOOLEAN                             LeftLogo;\r
   BOOLEAN                             RightLogo;\r
   BOOLEAN                             Menu;\r
@@ -99,11 +98,13 @@ typedef struct {
   BOOLEAN                             NumLock;\r
   BOOLEAN                             ScrollLock;\r
 \r
+  BOOLEAN                             IsSupportPartialKey;\r
   //\r
   // Queue storing key scancodes\r
   //\r
   SCAN_CODE_QUEUE                     ScancodeQueue;\r
   EFI_KEY_QUEUE                       EfiKeyQueue;\r
+  EFI_KEY_QUEUE                       EfiKeyQueueForNotify;\r
 \r
   //\r
   // Error state\r
@@ -117,6 +118,7 @@ typedef struct {
   // Notification Function List\r
   //\r
   LIST_ENTRY                          NotifyList;\r
+  EFI_EVENT                           KeyNotifyProcessEvent;\r
 } KEYBOARD_CONSOLE_IN_DEV;\r
 \r
 #define KEYBOARD_CONSOLE_IN_DEV_FROM_THIS(a)  CR (a, KEYBOARD_CONSOLE_IN_DEV, ConIn, KEYBOARD_CONSOLE_IN_DEV_SIGNATURE)\r
@@ -135,9 +137,9 @@ typedef struct {
 /**\r
   The user Entry Point for module Ps2Keyboard. The user code starts with this function.\r
 \r
-  @param[in] ImageHandle    The firmware allocated handle for the EFI image.  \r
+  @param[in] ImageHandle    The firmware allocated handle for the EFI image.\r
   @param[in] SystemTable    A pointer to the EFI System Table.\r
-  \r
+\r
   @retval EFI_SUCCESS       The entry point is executed successfully.\r
   @retval other             Some error occurs when executing this entry point.\r
 \r
@@ -179,7 +181,7 @@ InstallPs2KeyboardDriver (
 #define SCANCODE_LEFT_LOGO_BREAK        0xDB\r
 #define SCANCODE_RIGHT_LOGO_MAKE        0x5C\r
 #define SCANCODE_RIGHT_LOGO_BREAK       0xDC\r
-#define SCANCODE_MENU_MAKE              0x5D //APPS key defined in Keyboard scan code \r
+#define SCANCODE_MENU_MAKE              0x5D //APPS key defined in Keyboard scan code\r
 #define SCANCODE_MENU_BREAK             0xDD\r
 #define SCANCODE_SYS_REQ_MAKE           0x37\r
 #define SCANCODE_SYS_REQ_BREAK          0xB7\r
@@ -229,7 +231,7 @@ InstallPs2KeyboardDriver (
   indicators in ConsoleIn.\r
 \r
   @param ConsoleIn Pointer to instance of KEYBOARD_CONSOLE_IN_DEV\r
-  \r
+\r
   @return status\r
 \r
 **/\r
@@ -267,6 +269,19 @@ KeyGetchar (
   IN OUT KEYBOARD_CONSOLE_IN_DEV *ConsoleIn\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
   Perform 8042 controller and keyboard Initialization.\r
   If ExtendedVerification is TRUE, do additional test for\r
@@ -321,9 +336,9 @@ KeyboardTimerHandler (
   Perform 8042 controller and keyboard initialization\r
 \r
   @param This    Pointer to instance of EFI_SIMPLE_TEXT_INPUT_PROTOCOL\r
-  @param ExtendedVerification Indicate that the driver may perform a more \r
-                              exhaustive verification operation of the device during \r
-                              reset, now this par is ignored in this driver    \r
+  @param ExtendedVerification Indicate that the driver may perform a more\r
+                              exhaustive verification operation of the device during\r
+                              reset, now this par is ignored in this driver\r
 \r
 **/\r
 EFI_STATUS\r
@@ -338,7 +353,7 @@ KeyboardEfiReset (
   Retrieve key values for driver user.\r
 \r
   @param This    Pointer to instance of EFI_SIMPLE_TEXT_INPUT_PROTOCOL\r
-  @param Key     The output buffer for key value \r
+  @param Key     The output buffer for key value\r
 \r
   @retval EFI_SUCCESS success to read key stroke\r
 **/\r
@@ -406,7 +421,7 @@ EFIAPI
 KeyboardWaitForKeyEx (\r
   IN  EFI_EVENT               Event,\r
   IN  VOID                    *Context\r
-  );  \r
+  );\r
 \r
 //\r
 // Simple Text Input Ex protocol function prototypes\r
@@ -419,7 +434,7 @@ KeyboardWaitForKeyEx (
   @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
@@ -431,19 +446,19 @@ KeyboardEfiResetEx (
   );\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
 \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
     @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
+    @retval EFI_INVALID_PARAMETER - KeyData is NULL.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -457,14 +472,14 @@ KeyboardReadKeyStrokeEx (
   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
 EFI_STATUS\r
@@ -478,43 +493,47 @@ KeyboardSetState (
     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
     @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
+    @retval EFI_INVALID_PARAMETER   - KeyData or NotifyHandle is NULL.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 KeyboardRegisterKeyNotify (\r
   IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL  *This,\r
   IN EFI_KEY_DATA                       *KeyData,\r
   IN EFI_KEY_NOTIFY_FUNCTION            KeyNotificationFunction,\r
-  OUT EFI_HANDLE                        *NotifyHandle\r
+  OUT VOID                              **NotifyHandle\r
   );\r
 \r
 /**\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
+\r
     @retval EFI_SUCCESS             - The notification function was unregistered successfully.\r
     @retval EFI_INVALID_PARAMETER   - The NotificationHandle is invalid.\r
-    @retval EFI_NOT_FOUND           - Can not find the matching entry in database.  \r
-                              \r
-**/ \r
+    @retval EFI_NOT_FOUND           - Can not find the matching entry in database.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 KeyboardUnregisterKeyNotify (\r
   IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL  *This,\r
-  IN EFI_HANDLE                         NotificationHandle\r
+  IN VOID                               *NotificationHandle\r
   );\r
 \r
 /**\r
@@ -532,18 +551,31 @@ PushEfikeyBufTail (
 /**\r
   Judge whether is a registed key\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
   IN EFI_KEY_DATA  *RegsiteredData,\r
   IN EFI_KEY_DATA  *InputData\r
   );\r
+\r
+/**\r
+  Initialize the key state.\r
+\r
+  @param  ConsoleIn     The KEYBOARD_CONSOLE_IN_DEV instance.\r
+  @param  KeyState      A pointer to receive the key state information.\r
+**/\r
+VOID\r
+InitializeKeyState (\r
+  IN  KEYBOARD_CONSOLE_IN_DEV *ConsoleIn,\r
+  OUT EFI_KEY_STATE           *KeyState\r
+  );\r
+\r
 #endif\r