]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h
clean up the un-suitable ';' location when declaring the functions.
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Isa / Ps2KeyboardDxe / Ps2Keyboard.h
index 4f1080fe1b11fa1845055c4c9fb1a4862cff6f21..95c036d7405ca11b4fee263065fb978d7a5506f5 100644 (file)
@@ -1,5 +1,5 @@
 /**@file\r
-       PS/2 keyboard driver header file\r
+  PS/2 keyboard driver header file\r
 \r
 Copyright (c) 2006 - 2007, Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
@@ -19,6 +19,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Framework/StatusCode.h>\r
 \r
 #include <Protocol/SimpleTextIn.h>\r
+#include <Protocol/SimpleTextInEx.h>\r
 #include <Protocol/IsaIo.h>\r
 #include <Protocol/DevicePath.h>\r
 #include <Protocol/Ps2Policy.h>\r
@@ -30,18 +31,31 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/DebugLib.h>\r
 #include <Library/UefiRuntimeServicesTableLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
+#include <Library/BaseLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
 \r
 //\r
 // Driver Private Data\r
 //\r
 #define KEYBOARD_BUFFER_MAX_COUNT         32\r
 #define KEYBOARD_CONSOLE_IN_DEV_SIGNATURE EFI_SIGNATURE_32 ('k', 'k', 'e', 'y')\r
+#define KEYBOARD_CONSOLE_IN_EX_NOTIFY_SIGNATURE EFI_SIGNATURE_32 ('k', 'c', 'e', 'n')\r
+\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
+} KEYBOARD_CONSOLE_IN_EX_NOTIFY;\r
+\r
 \r
 typedef struct {\r
   UINTN                               Signature;\r
 \r
   EFI_HANDLE                          Handle;\r
   EFI_SIMPLE_TEXT_INPUT_PROTOCOL      ConIn;\r
+  EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL   ConInEx;\r
   EFI_ISA_IO_PROTOCOL                 *IsaIo;\r
 \r
   EFI_EVENT                           TimerEvent;\r
@@ -51,6 +65,14 @@ typedef struct {
   UINT32                              CommandRegisterAddress;\r
 \r
   EFI_INPUT_KEY                       Key;\r
+  EFI_KEY_STATE                       KeyState;\r
+\r
+  BOOLEAN                             LeftShift;\r
+  BOOLEAN                             RightShift;  \r
+  BOOLEAN                             LeftLogo;\r
+  BOOLEAN                             RightLogo;\r
+  BOOLEAN                             Menu;\r
+  BOOLEAN                             SysReq;\r
 \r
   BOOLEAN                             Ctrl;\r
   BOOLEAN                             Alt;\r
@@ -81,9 +103,19 @@ typedef struct {
   EFI_UNICODE_STRING_TABLE            *ControllerNameTable;\r
 \r
   EFI_DEVICE_PATH_PROTOCOL            *DevicePath;\r
+  //\r
+  // Notification Function List\r
+  //\r
+  LIST_ENTRY                          NotifyList;\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
+#define TEXT_INPUT_EX_KEYBOARD_CONSOLE_IN_DEV_FROM_THIS(a) \\r
+  CR (a, \\r
+      KEYBOARD_CONSOLE_IN_DEV, \\r
+      ConInEx, \\r
+      KEYBOARD_CONSOLE_IN_DEV_SIGNATURE \\r
+      )\r
 \r
 #define TABLE_END 0x0\r
 \r
@@ -94,31 +126,27 @@ extern EFI_DRIVER_BINDING_PROTOCOL   gKeyboardControllerDriver;
 extern EFI_COMPONENT_NAME_PROTOCOL   gPs2KeyboardComponentName;\r
 extern EFI_COMPONENT_NAME2_PROTOCOL  gPs2KeyboardComponentName2;\r
 \r
+extern EFI_GUID                      gSimpleTextInExNotifyGuid;\r
+\r
 //\r
 // Driver entry point\r
 //\r
+/**\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] SystemTable    A pointer to the EFI System Table.\r
+  \r
+  @retval EFI_SUCCESS       The entry point is executed successfully.\r
+  @retval other             Some error occurs when executing this entry point.\r
+\r
+**/\r
 EFI_STATUS\r
+EFIAPI\r
 InstallPs2KeyboardDriver (\r
   IN EFI_HANDLE           ImageHandle,\r
   IN EFI_SYSTEM_TABLE     *SystemTable\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
-  ImageHandle - GC_TODO: add argument description\r
-  SystemTable - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
-  GC_TODO: add return values\r
-\r
---*/\r
-;\r
+  );\r
 \r
 #define KEYBOARD_8042_DATA_REGISTER     0x60\r
 #define KEYBOARD_8042_STATUS_REGISTER   0x64\r
@@ -144,230 +172,312 @@ Returns:
 #define SCANCODE_CAPS_LOCK_MAKE         0x3A\r
 #define SCANCODE_NUM_LOCK_MAKE          0x45\r
 #define SCANCODE_SCROLL_LOCK_MAKE       0x46\r
-#define SCANCODE_MAX_MAKE               0x59\r
+#define SCANCODE_LEFT_LOGO_MAKE         0x5B //GUI key defined in Keyboard scan code\r
+#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_BREAK             0xDD\r
+#define SCANCODE_SYS_REQ_MAKE           0x37\r
+#define SCANCODE_MAX_MAKE               0x60\r
 \r
 //\r
 // Other functions that are used among .c files\r
 //\r
+/**\r
+  Show keyboard status lights according to\r
+  indicators in ConsoleIn.\r
+\r
+  @param ConsoleIn Pointer to instance of KEYBOARD_CONSOLE_IN_DEV\r
+  \r
+  @return status\r
+\r
+**/\r
 EFI_STATUS\r
-KeyboardRead (\r
-  IN KEYBOARD_CONSOLE_IN_DEV  *ConsoleIn,\r
-  OUT UINT8                   *Data\r
-  )\r
-/*++\r
+UpdateStatusLights (\r
+  IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn\r
+  );\r
 \r
-Routine Description:\r
+/**\r
+  write key to keyboard\r
 \r
-  GC_TODO: Add function description\r
+  @param ConsoleIn Pointer to instance of KEYBOARD_CONSOLE_IN_DEV\r
+  @param Data      value wanted to be written\r
 \r
-Arguments:\r
+  @retval EFI_TIMEOUT - GC_TODO: Add description for return value\r
+  @retval EFI_SUCCESS - GC_TODO: Add description for return value\r
 \r
-  ConsoleIn - GC_TODO: add argument description\r
-  Data      - GC_TODO: add argument description\r
+**/\r
+EFI_STATUS\r
+KeyboardRead (\r
+  IN KEYBOARD_CONSOLE_IN_DEV  *ConsoleIn,\r
+  OUT UINT8                   *Data\r
+  );\r
 \r
-Returns:\r
+/**\r
+  Get scancode from scancode buffer\r
+  and translate into EFI-scancode and unicode defined by EFI spec\r
+  The function is always called in TPL_NOTIFY\r
 \r
-  GC_TODO: add return values\r
+  @param ConsoleIn KEYBOARD_CONSOLE_IN_DEV instance pointer\r
 \r
---*/\r
-;\r
+  @retval EFI_NOT_READY - Input from console not ready yet.\r
+  @retval EFI_SUCCESS   - Function executed successfully.\r
 \r
+**/\r
 EFI_STATUS\r
 KeyGetchar (\r
   IN OUT KEYBOARD_CONSOLE_IN_DEV *ConsoleIn\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  GC_TODO: Add function description\r
+  );\r
 \r
-Arguments:\r
-\r
-  ConsoleIn - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
-  GC_TODO: add return values\r
+/**\r
+  Perform 8042 controller and keyboard Initialization\r
+  If ExtendedVerification is TRUE, do additional test for\r
+  the keyboard interface\r
 \r
---*/\r
-;\r
+  @param ConsoleIn - KEYBOARD_CONSOLE_IN_DEV instance pointer\r
+  @param ExtendedVerification - indicates a thorough initialization\r
 \r
+  @retval EFI_DEVICE_ERROR Fail to init keyboard\r
+  @retval EFI_SUCCESS      Success to init keyboard\r
+**/\r
 EFI_STATUS\r
 InitKeyboard (\r
   IN OUT KEYBOARD_CONSOLE_IN_DEV *ConsoleIn,\r
   IN BOOLEAN                     ExtendedVerification\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  GC_TODO: Add function description\r
-\r
-Arguments:\r
+  );\r
 \r
-  ConsoleIn             - GC_TODO: add argument description\r
-  ExtendedVerification  - GC_TODO: add argument description\r
-\r
-Returns:\r
+/**\r
+  Disable the keyboard interface of the 8042 controller\r
 \r
-  GC_TODO: add return values\r
+  @param ConsoleIn   - the device instance\r
 \r
---*/\r
-;\r
+  @return status of issuing disable command\r
 \r
+**/\r
 EFI_STATUS\r
 DisableKeyboard (\r
   IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
+  );\r
 \r
-  GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
-  ConsoleIn - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
-  GC_TODO: add return values\r
+/**\r
+  Timer event handler: read a series of scancodes from 8042\r
+  and put them into memory scancode buffer.\r
+  it read as much scancodes to either fill\r
+  the memory buffer or empty the keyboard buffer.\r
+  It is registered as running under TPL_NOTIFY\r
 \r
---*/\r
-;\r
+  @param Event - The timer event\r
+  @param Context - A KEYBOARD_CONSOLE_IN_DEV pointer\r
 \r
+**/\r
 VOID\r
 EFIAPI\r
 KeyboardTimerHandler (\r
   IN EFI_EVENT    Event,\r
   IN VOID         *Context\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  GC_TODO: Add function description\r
+  );\r
 \r
-Arguments:\r
-\r
-  Event   - GC_TODO: add argument description\r
-  Context - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
-  GC_TODO: add return values\r
+/**\r
+  logic reset keyboard\r
+  Implement SIMPLE_TEXT_IN.Reset()\r
+  Perform 8042 controller and keyboard initialization\r
 \r
---*/\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
 \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 KeyboardEfiReset (\r
   IN  EFI_SIMPLE_TEXT_INPUT_PROTOCOL  *This,\r
   IN  BOOLEAN                         ExtendedVerification\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  GC_TODO: Add function description\r
-\r
-Arguments:\r
+  );\r
 \r
-  This                  - GC_TODO: add argument description\r
-  ExtendedVerification  - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
-  GC_TODO: add return values\r
+/**\r
+  Implement SIMPLE_TEXT_IN.ReadKeyStroke().\r
+  Retrieve key values for driver user.\r
 \r
---*/\r
-;\r
+  @param This    Pointer to instance of EFI_SIMPLE_TEXT_INPUT_PROTOCOL\r
+  @param Key     The output buffer for key value \r
 \r
+  @retval EFI_SUCCESS success to read key stroke\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 KeyboardReadKeyStroke (\r
   IN  EFI_SIMPLE_TEXT_INPUT_PROTOCOL  *This,\r
   OUT EFI_INPUT_KEY                   *Key\r
-  )\r
-/*++\r
+  );\r
+\r
+/**\r
+  Event notification function for SIMPLE_TEXT_IN.WaitForKey event\r
+  Signal the event if there is key available\r
+\r
+  @param Event    the event object\r
+  @param Context  waitting context\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+KeyboardWaitForKey (\r
+  IN  EFI_EVENT               Event,\r
+  IN  VOID                    *Context\r
+  );\r
+\r
+/**\r
+  Read status register\r
 \r
-Routine Description:\r
+  @param ConsoleIn  Pointer to instance of KEYBOARD_CONSOLE_IN_DEV\r
 \r
-  GC_TODO: Add function description\r
+  @return value in status register\r
 \r
-Arguments:\r
+**/\r
+UINT8\r
+KeyReadStatusRegister (\r
+  IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn\r
+  );\r
+\r
+/**\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
 \r
-  This  - GC_TODO: add argument description\r
-  Key   - GC_TODO: add argument description\r
+  @param[in]  BiosKeyboardPrivate   Keyboard Private Data Structure\r
 \r
-Returns:\r
+  @retval     TRUE                  Keyboard in System.\r
+  @retval     FALSE                 Keyboard not in System.\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+CheckKeyboardConnect (\r
+  IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn\r
+  );\r
 \r
-  GC_TODO: add return values\r
+/**\r
+  Event notification function for SIMPLE_TEXT_INPUT_EX_PROTOCOL.WaitForKeyEx event\r
+  Signal the event if there is key available\r
 \r
---*/\r
-;\r
+  @param Event    event object\r
+  @param Context  waiting context\r
 \r
+**/\r
 VOID\r
 EFIAPI\r
-KeyboardWaitForKey (\r
+KeyboardWaitForKeyEx (\r
   IN  EFI_EVENT               Event,\r
   IN  VOID                    *Context\r
-  )\r
-/*++\r
+  );  \r
 \r
-Routine Description:\r
+//\r
+// Simple Text Input Ex protocol function prototypes\r
+//\r
 \r
-  GC_TODO: Add function description\r
+/**\r
+  Reset the input device and optionaly run diagnostics\r
 \r
-Arguments:\r
+  @param This                 - Protocol instance pointer.\r
+  @param ExtendedVerification - Driver may perform diagnostics on reset.\r
 \r
-  Event   - GC_TODO: add argument description\r
-  Context - GC_TODO: add argument description\r
+  @retval EFI_SUCCESS           - The device was reset.\r
+  @retval EFI_DEVICE_ERROR      - The device is not functioning properly and could \r
+                                  not be reset.\r
 \r
-Returns:\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+KeyboardEfiResetEx (\r
+  IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL  *This,\r
+  IN BOOLEAN                            ExtendedVerification\r
+  );\r
 \r
-  GC_TODO: add return values\r
+/**\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
-;\r
 \r
-UINT8\r
-KeyReadStatusRegister (\r
-  IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn\r
-  )\r
-/*++\r
+    @param This       - Protocol instance pointer.\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
-Routine Description:\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
+                            hardware errors.\r
+    @retval EFI_INVALID_PARAMETER - KeyData is NULL.                        \r
 \r
-  GC_TODO: Add function description\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+KeyboardReadKeyStrokeEx (\r
+  IN  EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
+  OUT EFI_KEY_DATA                      *KeyData\r
+  );\r
 \r
-Arguments:\r
+/**\r
+  Set certain state for the input device.\r
 \r
-  ConsoleIn - GC_TODO: add argument description\r
+  @param This              - Protocol instance pointer.\r
+  @param KeyToggleState    - A pointer to the EFI_KEY_TOGGLE_STATE to set the \r
+                        state for the input device.\r
 \r
-Returns:\r
+  @retval EFI_SUCCESS           - The device state was set successfully.\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
 \r
-  GC_TODO: add return values\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+KeyboardSetState (\r
+  IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL  *This,\r
+  IN EFI_KEY_TOGGLE_STATE               *KeyToggleState\r
+  );\r
 \r
---*/\r
-;\r
+/**\r
+    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
+\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
+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
+  );\r
 \r
 /**\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
+    Remove a registered notification function from a particular keystroke.\r
 \r
-  @param[in]  BiosKeyboardPrivate   Keyboard Private Data Structure\r
+    @param This                    - Protocol instance pointer.    \r
+    @param NotificationHandle      - The handle of the notification function being unregistered.\r
 \r
-  @retval              TRUE                                                            Keyboard in System.\r
-  @retval              FALSE                                                           Keyboard not in System.\r
-**/\r
-BOOLEAN\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
+EFI_STATUS\r
 EFIAPI\r
-CheckKeyboardConnect (\r
-  IN KEYBOARD_CONSOLE_IN_DEV *ConsoleIn\r
-  )\r
-;\r
+KeyboardUnregisterKeyNotify (\r
+  IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL  *This,\r
+  IN EFI_HANDLE                         NotificationHandle\r
+  );\r
+\r
 #endif\r