]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. Add Partial Keystroke Support in Ps2Kb drivers. See the Uefi2.3.1a chapter 11.2
authorqianouyang <qianouyang@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 30 Sep 2011 07:29:42 +0000 (07:29 +0000)
committerqianouyang <qianouyang@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 30 Sep 2011 07:29:42 +0000 (07:29 +0000)
2. Fix the bug of "In Ps2Keyboard the CAPs LOCK's LED should NOT be light when user press the SysReq key".
3. Fix the bug of "The PS2Keyboard driver outputs wrong EFI_INPUT_KEY value for PrintScr/SysRq keystroke"

Signed-off-by: qianouyang
Reviewed-by: niruiyu vanjeff
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12495 6f19259b-4bc3-4df7-8a09-765794883524

IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c
IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdTextIn.c
IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h
IntelFrameworkModulePkg/Csm/BiosThunk/KeyboardDxe/BiosKeyboard.c

index 2c288d0a7eb9c870e9ebc3e240e82a229f6a655a..e8f474a3268b43f4c36f5c51cd0da77f5909bc0f 100644 (file)
@@ -537,13 +537,13 @@ ConvertKeyboardScanCodeToEfiKey[] = {
     SCAN_NULL,\r
     0x0000,\r
     0x0000\r
-  },  \r
+  },\r
   {\r
     0x5C,  //Right LOGO\r
     SCAN_NULL,\r
     0x0000,\r
     0x0000\r
-  },  \r
+  },\r
   {\r
     0x5D,  //Menu key\r
     SCAN_NULL,\r
@@ -569,7 +569,7 @@ BOOLEAN          mEnableMouseInterface;
 \r
 /**\r
   Return the count of scancode in the queue.\r
-  \r
+\r
   @param Queue     Pointer to instance of SCAN_CODE_QUEUE.\r
 \r
   @return          Count of the scancode.\r
@@ -590,7 +590,7 @@ GetScancodeBufCount (
   Read several bytes from the scancode buffer without removing them.\r
   This function is called to see if there are enough bytes of scancode\r
   representing a single key.\r
-  \r
+\r
   @param Queue     Pointer to instance of SCAN_CODE_QUEUE.\r
   @param Count     Number of bytes to be read\r
   @param Buf       Store the results\r
@@ -624,31 +624,11 @@ GetScancodeBufHead (
   return EFI_SUCCESS;\r
 }\r
 \r
-/**\r
-  Push one byte to the scancode buffer.\r
-\r
-  @param Queue     Pointer to instance of SCAN_CODE_QUEUE.\r
-  @param Scancode  The byte to push.\r
-**/\r
-VOID\r
-PushScancodeBufTail (\r
-  IN  SCAN_CODE_QUEUE       *Queue,\r
-  IN  UINT8                 Scancode\r
-  )\r
-{\r
-  if (GetScancodeBufCount (Queue) == KEYBOARD_SCAN_CODE_MAX_COUNT - 1) {\r
-    return;\r
-  }\r
-\r
-  Queue->Buffer[Queue->Tail] = Scancode;\r
-  Queue->Tail = (Queue->Tail + 1) % KEYBOARD_SCAN_CODE_MAX_COUNT;\r
-}\r
-\r
 /**\r
 \r
   Read & remove several bytes from the scancode buffer.\r
   This function is usually called after GetScancodeBufHead()\r
-  \r
+\r
   @param Queue     Pointer to instance of SCAN_CODE_QUEUE.\r
   @param Count     Number of bytes to be read\r
   @param Buf       Store the results\r
@@ -660,7 +640,7 @@ EFI_STATUS
 PopScancodeBufHead (\r
   IN  SCAN_CODE_QUEUE       *Queue,\r
   IN  UINTN                 Count,\r
-  OUT UINT8                 *Buf\r
+  OUT UINT8                 *Buf OPTIONAL\r
   )\r
 {\r
   UINTN                     Index;\r
@@ -675,18 +655,40 @@ PopScancodeBufHead (
   // Retrieve and remove the values\r
   //\r
   for (Index = 0; Index < Count; Index++, Queue->Head = (Queue->Head + 1) % KEYBOARD_SCAN_CODE_MAX_COUNT) {\r
-    Buf[Index] = Queue->Buffer[Queue->Head];\r
+    if (Buf != NULL) {\r
+      Buf[Index] = Queue->Buffer[Queue->Head];\r
+    }\r
   }\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Push one byte to the scancode buffer.\r
+\r
+  @param Queue     Pointer to instance of SCAN_CODE_QUEUE.\r
+  @param Scancode  The byte to push.\r
+**/\r
+VOID\r
+PushScancodeBufTail (\r
+  IN  SCAN_CODE_QUEUE       *Queue,\r
+  IN  UINT8                 Scancode\r
+  )\r
+{\r
+  if (GetScancodeBufCount (Queue) == KEYBOARD_SCAN_CODE_MAX_COUNT - 1) {\r
+    PopScancodeBufHead (Queue, 1, NULL);\r
+  }\r
+\r
+  Queue->Buffer[Queue->Tail] = Scancode;\r
+  Queue->Tail = (Queue->Tail + 1) % KEYBOARD_SCAN_CODE_MAX_COUNT;\r
+}\r
+\r
 /**\r
   Read data register .\r
 \r
   @param ConsoleIn Pointer to instance of KEYBOARD_CONSOLE_IN_DEV\r
 \r
-  @return return the value \r
+  @return return the value\r
 \r
 **/\r
 UINT8\r
@@ -787,7 +789,7 @@ KeyWriteCommandRegister (
 \r
   @param ConsoleIn Pointer to instance of KEYBOARD_CONSOLE_IN_DEV\r
   @param ErrMsg    Unicode string of error message\r
-  \r
+\r
 **/\r
 VOID\r
 KeyboardError (\r
@@ -953,9 +955,9 @@ KeyboardWrite (
   Issue keyboard command.\r
 \r
   @param ConsoleIn Pointer to instance of KEYBOARD_CONSOLE_IN_DEV\r
-  @param Data      The buff holding the command \r
+  @param Data      The buff holding the command\r
 \r
-  @retval EFI_TIMEOUT Keyboard is not ready to issuing \r
+  @retval EFI_TIMEOUT Keyboard is not ready to issuing\r
   @retval EFI_SUCCESS Success to issue keyboard command\r
 \r
 **/\r
@@ -1021,7 +1023,7 @@ KeyboardCommand (
 \r
   @retval EFI_TIMEOUT Fail to get specific value in given time\r
   @retval EFI_SUCCESS Success to get specific value in given time.\r
-  \r
+\r
 **/\r
 EFI_STATUS\r
 KeyboardWaitForValue (\r
@@ -1090,7 +1092,7 @@ KeyboardWaitForValue (
   indicators in ConsoleIn.\r
 \r
   @param ConsoleIn Pointer to instance of KEYBOARD_CONSOLE_IN_DEV\r
-  \r
+\r
   @return status of updating keyboard register\r
 \r
 **/\r
@@ -1164,7 +1166,7 @@ KeyGetchar (
   //\r
   UINT8                          ScancodeArr[3];\r
   UINT32                         ScancodeArrPos;\r
-  \r
+\r
   //\r
   // Check if there are enough bytes of scancode representing a single key\r
   // available in the buffer\r
@@ -1215,14 +1217,14 @@ KeyGetchar (
       // Check for special keys and update the driver state.\r
       //\r
       switch (ScanCode) {\r
-      \r
+\r
       case SCANCODE_CTRL_MAKE:\r
         if (Extend0) {\r
           ConsoleIn->RightCtrl = TRUE;\r
         } else {\r
           ConsoleIn->LeftCtrl  = TRUE;\r
         }\r
-        break;      \r
+        break;\r
       case SCANCODE_CTRL_BREAK:\r
         if (Extend0) {\r
           ConsoleIn->RightCtrl = FALSE;\r
@@ -1237,7 +1239,7 @@ KeyGetchar (
           } else {\r
             ConsoleIn->LeftAlt  = TRUE;\r
           }\r
-        break;      \r
+        break;\r
       case SCANCODE_ALT_BREAK:\r
           if (Extend0) {\r
             ConsoleIn->RightAlt = FALSE;\r
@@ -1249,12 +1251,15 @@ KeyGetchar (
       case SCANCODE_LEFT_SHIFT_MAKE:\r
         //\r
         // To avoid recognize PRNT_SCRN key as a L_SHIFT key\r
-        // because PRNT_SCRN key generates E0 followed by L_SHIFT scan code\r
+        // because PRNT_SCRN key generates E0 followed by L_SHIFT scan code.\r
+        // If it the second byte of the PRNT_ScRN skip it.\r
         //\r
         if (!Extend0) {\r
           ConsoleIn->LeftShift  = TRUE;\r
+          break;\r
         }\r
-        break;\r
+        continue;\r
+\r
       case SCANCODE_LEFT_SHIFT_BREAK:\r
         if (!Extend0) {\r
           ConsoleIn->LeftShift = FALSE;\r
@@ -1267,7 +1272,7 @@ KeyGetchar (
       case SCANCODE_RIGHT_SHIFT_BREAK:\r
         ConsoleIn->RightShift = FALSE;\r
         break;\r
-      \r
+\r
       case SCANCODE_LEFT_LOGO_MAKE:\r
         ConsoleIn->LeftLogo = TRUE;\r
         break;\r
@@ -1323,7 +1328,7 @@ KeyGetchar (
         break;\r
       }\r
     }\r
-      \r
+\r
     //\r
     // If this is above the valid range, ignore it\r
     //\r
@@ -1358,14 +1363,14 @@ KeyGetchar (
                                  | (ConsoleIn->RightLogo  ? EFI_RIGHT_LOGO_PRESSED    : 0)\r
                                  | (ConsoleIn->Menu       ? EFI_MENU_KEY_PRESSED      : 0)\r
                                  | (ConsoleIn->SysReq     ? EFI_SYS_REQ_PRESSED       : 0)\r
-                                 )\r
-                                 ;\r
+                                 );\r
   KeyData.KeyState.KeyToggleState = (EFI_KEY_TOGGLE_STATE) (EFI_TOGGLE_STATE_VALID\r
                                   | (ConsoleIn->CapsLock   ? EFI_CAPS_LOCK_ACTIVE :   0)\r
                                   | (ConsoleIn->NumLock    ? EFI_NUM_LOCK_ACTIVE :    0)\r
                                   | (ConsoleIn->ScrollLock ? EFI_SCROLL_LOCK_ACTIVE : 0)\r
-                                  )\r
-                                  ;\r
+                                  | (ConsoleIn->IsSupportPartialKey ? EFI_KEY_STATE_EXPOSED : 0)\r
+                                  );\r
+\r
   KeyData.Key.ScanCode            = SCAN_NULL;\r
   KeyData.Key.UnicodeChar         = CHAR_NULL;\r
 \r
@@ -1406,7 +1411,7 @@ KeyGetchar (
         KeyData.Key.ScanCode    = ConvertKeyboardScanCodeToEfiKey[Index].EfiScanCode;\r
         KeyData.Key.UnicodeChar = ConvertKeyboardScanCodeToEfiKey[Index].UnicodeChar;\r
 \r
-        if ((ConsoleIn->LeftShift || ConsoleIn->RightShift) && \r
+        if ((ConsoleIn->LeftShift || ConsoleIn->RightShift) &&\r
             (ConvertKeyboardScanCodeToEfiKey[Index].UnicodeChar != ConvertKeyboardScanCodeToEfiKey[Index].ShiftUnicodeChar)) {\r
           KeyData.Key.UnicodeChar = ConvertKeyboardScanCodeToEfiKey[Index].ShiftUnicodeChar;\r
           //\r
@@ -1440,11 +1445,14 @@ KeyGetchar (
       KeyData.Key.UnicodeChar = CHAR_NULL;\r
     }\r
   }\r
+\r
   //\r
   // If the key can not be converted then just return.\r
   //\r
   if (KeyData.Key.ScanCode == SCAN_NULL && KeyData.Key.UnicodeChar == CHAR_NULL) {\r
-    return ;\r
+    if (!ConsoleIn->IsSupportPartialKey) {\r
+      return ;\r
+    }\r
   }\r
 \r
   //\r
@@ -1452,16 +1460,16 @@ KeyGetchar (
   //\r
   for (Link = GetFirstNode (&ConsoleIn->NotifyList); !IsNull (&ConsoleIn->NotifyList, Link); Link = GetNextNode (&ConsoleIn->NotifyList, Link)) {\r
     CurrentNotify = CR (\r
-                      Link, \r
-                      KEYBOARD_CONSOLE_IN_EX_NOTIFY, \r
-                      NotifyEntry, \r
+                      Link,\r
+                      KEYBOARD_CONSOLE_IN_EX_NOTIFY,\r
+                      NotifyEntry,\r
                       KEYBOARD_CONSOLE_IN_EX_NOTIFY_SIGNATURE\r
                       );\r
-    if (IsKeyRegistered (&CurrentNotify->KeyData, &KeyData)) { \r
+    if (IsKeyRegistered (&CurrentNotify->KeyData, &KeyData)) {\r
       CurrentNotify->KeyNotificationFn (&KeyData);\r
     }\r
   }\r
-  \r
+\r
   //\r
   // Translate the CTRL-Alpha characters to their corresponding control value (ctrl-a = 0x0001 through ctrl-Z = 0x001A)\r
   //\r
@@ -1477,7 +1485,7 @@ KeyGetchar (
 }\r
 \r
 /**\r
-  Perform 8042 controller and keyboard Initialization.  \r
+  Perform 8042 controller and keyboard Initialization.\r
   If ExtendedVerification is TRUE, do additional test for\r
   the keyboard interface\r
 \r
@@ -1671,14 +1679,15 @@ InitKeyboard (
   ConsoleIn->LeftCtrl   = FALSE;\r
   ConsoleIn->RightCtrl  = FALSE;\r
   ConsoleIn->LeftAlt    = FALSE;\r
-  ConsoleIn->RightAlt   = FALSE;  \r
+  ConsoleIn->RightAlt   = FALSE;\r
   ConsoleIn->LeftShift  = FALSE;\r
   ConsoleIn->RightShift = FALSE;\r
   ConsoleIn->LeftLogo   = FALSE;\r
   ConsoleIn->RightLogo  = FALSE;\r
   ConsoleIn->Menu       = FALSE;\r
-  ConsoleIn->SysReq     = FALSE;  \r
+  ConsoleIn->SysReq     = FALSE;\r
 \r
+  ConsoleIn->IsSupportPartialKey = FALSE;\r
   //\r
   // For reseting keyboard is not mandatory before booting OS and sometimes keyboard responses very slow,\r
   // and to support KB hot plug, we need to let the InitKB succeed no matter whether there is a KB device connected\r
index eb3c9338ce80740d2c91f5cdd0f9650046e2393e..a968a3b5f3c36e0adda3893a5c143f5fc27a2351 100644 (file)
@@ -32,31 +32,9 @@ IsEfikeyBufEmpty (
   return (BOOLEAN) (Queue->Head == Queue->Tail);\r
 }\r
 \r
-\r
-\r
-/**\r
-  Push one key data to the EFI key buffer.\r
-\r
-  @param Queue     Pointer to instance of EFI_KEY_QUEUE.\r
-  @param KeyData   The key data to push.\r
-**/\r
-VOID\r
-PushEfikeyBufTail (\r
-  IN  EFI_KEY_QUEUE         *Queue,\r
-  IN  EFI_KEY_DATA          *KeyData\r
-  )\r
-{\r
-  if ((Queue->Tail + 1) % KEYBOARD_EFI_KEY_MAX_COUNT == Queue->Head) {\r
-    return;\r
-  }\r
-  \r
-  CopyMem (&Queue->Buffer[Queue->Tail], KeyData, sizeof (EFI_KEY_DATA));\r
-  Queue->Tail = (Queue->Tail + 1) % KEYBOARD_EFI_KEY_MAX_COUNT;\r
-}\r
-\r
 /**\r
   Read & remove one key data from the EFI key buffer.\r
-  \r
+\r
   @param Queue     Pointer to instance of EFI_KEY_QUEUE.\r
   @param KeyData   Receive the key data.\r
 \r
@@ -66,7 +44,7 @@ PushEfikeyBufTail (
 EFI_STATUS\r
 PopEfikeyBufHead (\r
   IN  EFI_KEY_QUEUE         *Queue,\r
-  OUT EFI_KEY_DATA          *KeyData\r
+  OUT EFI_KEY_DATA          *KeyData OPTIONAL\r
   )\r
 {\r
   if (IsEfikeyBufEmpty (Queue)) {\r
@@ -75,22 +53,46 @@ PopEfikeyBufHead (
   //\r
   // Retrieve and remove the values\r
   //\r
-  CopyMem (KeyData, &Queue->Buffer[Queue->Head], sizeof (EFI_KEY_DATA));\r
+  if (KeyData != NULL) {\r
+    CopyMem (KeyData, &Queue->Buffer[Queue->Head], sizeof (EFI_KEY_DATA));\r
+  }\r
   Queue->Head = (Queue->Head + 1) % KEYBOARD_EFI_KEY_MAX_COUNT;\r
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Push one key data to the EFI key buffer.\r
+\r
+  @param Queue     Pointer to instance of EFI_KEY_QUEUE.\r
+  @param KeyData   The key data to push.\r
+**/\r
+VOID\r
+PushEfikeyBufTail (\r
+  IN  EFI_KEY_QUEUE         *Queue,\r
+  IN  EFI_KEY_DATA          *KeyData\r
+  )\r
+{\r
+  if ((Queue->Tail + 1) % KEYBOARD_EFI_KEY_MAX_COUNT == Queue->Head) {\r
+    //\r
+    // If Queue is full, pop the one from head.\r
+    //\r
+    PopEfikeyBufHead (Queue, NULL);\r
+  }\r
+  CopyMem (&Queue->Buffer[Queue->Tail], KeyData, sizeof (EFI_KEY_DATA));\r
+  Queue->Tail = (Queue->Tail + 1) % KEYBOARD_EFI_KEY_MAX_COUNT;\r
+}\r
+\r
 /**\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
@@ -100,42 +102,42 @@ IsKeyRegistered (
 \r
 {\r
   ASSERT (RegsiteredData != NULL && InputData != NULL);\r
-  \r
+\r
   if ((RegsiteredData->Key.ScanCode    != InputData->Key.ScanCode) ||\r
       (RegsiteredData->Key.UnicodeChar != InputData->Key.UnicodeChar)) {\r
-    return FALSE;  \r
-  }      \r
-  \r
+    return FALSE;\r
+  }\r
+\r
   //\r
   // Assume KeyShiftState/KeyToggleState = 0 in Registered key data means these state could be ignored.\r
   //\r
   if (RegsiteredData->KeyState.KeyShiftState != 0 &&\r
       RegsiteredData->KeyState.KeyShiftState != InputData->KeyState.KeyShiftState) {\r
-    return FALSE;    \r
-  }   \r
+    return FALSE;\r
+  }\r
   if (RegsiteredData->KeyState.KeyToggleState != 0 &&\r
       RegsiteredData->KeyState.KeyToggleState != InputData->KeyState.KeyToggleState) {\r
-    return FALSE;    \r
-  }     \r
-  \r
+    return FALSE;\r
+  }\r
+\r
   return TRUE;\r
 \r
 }\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 ConsoleInDev          Ps2 Keyboard private structure\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
+\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
@@ -147,18 +149,18 @@ KeyboardReadKeyStrokeWorker (
 {\r
   EFI_STATUS                            Status;\r
   EFI_TPL                               OldTpl;\r
-  \r
+\r
   if (KeyData == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
-  \r
+\r
   //\r
   // Enter critical section\r
   //\r
   OldTpl = gBS->RaiseTPL (TPL_NOTIFY);\r
 \r
   KeyboardTimerHandler (NULL, ConsoleInDev);\r
-  \r
+\r
   if (ConsoleInDev->KeyboardErr) {\r
     Status = EFI_DEVICE_ERROR;\r
   } else {\r
@@ -173,9 +175,9 @@ KeyboardReadKeyStrokeWorker (
   Perform 8042 controller and keyboard initialization which implement SIMPLE_TEXT_IN.Reset()\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
@@ -250,7 +252,7 @@ KeyboardEfiReset (
   Retrieve key values for driver user which implement SIMPLE_TEXT_IN.ReadKeyStroke().\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
@@ -266,14 +268,29 @@ KeyboardReadKeyStroke (
   EFI_KEY_DATA            KeyData;\r
 \r
   ConsoleIn = KEYBOARD_CONSOLE_IN_DEV_FROM_THIS (This);\r
-  Status = KeyboardReadKeyStrokeWorker (ConsoleIn, &KeyData);\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-\r
-  CopyMem (Key, &KeyData.Key, sizeof (EFI_INPUT_KEY));\r
-  return EFI_SUCCESS;\r
   \r
+  //\r
+  // Considering if the partial keystroke is enabled, there maybe a partial\r
+  // keystroke in the queue, so here skip the partial keystroke and get the\r
+  // next key from the queue\r
+  //\r
+  while (1) {\r
+    //\r
+    // If there is no pending key, then return.\r
+    //\r
+    Status = KeyboardReadKeyStrokeWorker (ConsoleIn, &KeyData);\r
+    if (EFI_ERROR (Status)) {\r
+      return Status;\r
+    }\r
+    //\r
+    // If it is partial keystroke, skip it.\r
+    //\r
+    if (KeyData.Key.ScanCode == SCAN_NULL && KeyData.Key.UnicodeChar == CHAR_NULL) {\r
+      continue;\r
+    }\r
+    CopyMem (Key, &KeyData.Key, sizeof (EFI_INPUT_KEY));\r
+    return EFI_SUCCESS;\r
+  }\r
 }\r
 \r
 /**\r
@@ -293,6 +310,7 @@ KeyboardWaitForKey (
 {\r
   EFI_TPL                     OldTpl;\r
   KEYBOARD_CONSOLE_IN_DEV     *ConsoleIn;\r
+  EFI_KEY_DATA                KeyData;\r
 \r
   ConsoleIn = (KEYBOARD_CONSOLE_IN_DEV *) Context;\r
 \r
@@ -300,16 +318,31 @@ KeyboardWaitForKey (
   // Enter critical section\r
   //\r
   OldTpl = gBS->RaiseTPL (TPL_NOTIFY);\r
-  \r
+\r
   KeyboardTimerHandler (NULL, ConsoleIn);\r
 \r
   if (!ConsoleIn->KeyboardErr) {\r
     //\r
-    // Someone is waiting on the keyboard event, if there's\r
-    // a key pending, signal the event\r
+    // WaitforKey doesn't suppor the partial key.\r
+    // Considering if the partial keystroke is enabled, there maybe a partial\r
+    // keystroke in the queue, so here skip the partial keystroke and get the\r
+    // next key from the queue\r
     //\r
-    if (!IsEfikeyBufEmpty (&ConsoleIn->EfiKeyQueue)) {\r
+    while (!IsEfikeyBufEmpty (&ConsoleIn->EfiKeyQueue)) {\r
+      CopyMem (\r
+        &KeyData,\r
+        &(ConsoleIn->EfiKeyQueue.Buffer[ConsoleIn->EfiKeyQueue.Head]),\r
+        sizeof (EFI_KEY_DATA)\r
+        );\r
+      if (KeyData.Key.ScanCode == SCAN_NULL && KeyData.Key.UnicodeChar == CHAR_NULL) {\r
+        PopEfikeyBufHead (&ConsoleIn->EfiKeyQueue, &KeyData);\r
+        continue;\r
+      }\r
+      //\r
+      // if there is pending value key, signal the event.\r
+      //\r
       gBS->SignalEvent (Event);\r
+      break;\r
     }\r
   }\r
   //\r
@@ -344,7 +377,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
@@ -358,28 +391,28 @@ KeyboardEfiResetEx (
 {\r
   KEYBOARD_CONSOLE_IN_DEV               *ConsoleInDev;\r
 \r
-  ConsoleInDev = TEXT_INPUT_EX_KEYBOARD_CONSOLE_IN_DEV_FROM_THIS (This); \r
+  ConsoleInDev = TEXT_INPUT_EX_KEYBOARD_CONSOLE_IN_DEV_FROM_THIS (This);\r
 \r
   return ConsoleInDev->ConIn.Reset (\r
-                               &ConsoleInDev->ConIn, \r
+                               &ConsoleInDev->ConIn,\r
                                ExtendedVerification\r
                                );\r
 }\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
@@ -398,23 +431,22 @@ KeyboardReadKeyStrokeEx (
 \r
   ConsoleInDev = TEXT_INPUT_EX_KEYBOARD_CONSOLE_IN_DEV_FROM_THIS (This);\r
   return KeyboardReadKeyStrokeWorker (ConsoleInDev, KeyData);\r
-  \r
 }\r
 \r
 /**\r
   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
 KeyboardSetState (\r
@@ -430,7 +462,7 @@ KeyboardSetState (
   if (KeyToggleState == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
-  \r
+\r
   ConsoleInDev = TEXT_INPUT_EX_KEYBOARD_CONSOLE_IN_DEV_FROM_THIS (This);\r
 \r
   //\r
@@ -447,30 +479,34 @@ KeyboardSetState (
     Status = EFI_UNSUPPORTED;\r
     goto Exit;\r
   }\r
-  \r
+\r
   //\r
   // Update the status light\r
   //\r
-  ConsoleInDev->ScrollLock = FALSE;\r
-  ConsoleInDev->NumLock    = FALSE;\r
-  ConsoleInDev->CapsLock   = FALSE;\r
+  ConsoleInDev->ScrollLock          = FALSE;\r
+  ConsoleInDev->NumLock             = FALSE;\r
+  ConsoleInDev->CapsLock            = FALSE;\r
+  ConsoleInDev->IsSupportPartialKey = FALSE;\r
 \r
   if ((*KeyToggleState & EFI_SCROLL_LOCK_ACTIVE) == EFI_SCROLL_LOCK_ACTIVE) {\r
     ConsoleInDev->ScrollLock = TRUE;\r
-  } \r
+  }\r
   if ((*KeyToggleState & EFI_NUM_LOCK_ACTIVE) == EFI_NUM_LOCK_ACTIVE) {\r
     ConsoleInDev->NumLock = TRUE;\r
   }\r
   if ((*KeyToggleState & EFI_CAPS_LOCK_ACTIVE) == EFI_CAPS_LOCK_ACTIVE) {\r
     ConsoleInDev->CapsLock = TRUE;\r
   }\r
+  if ((*KeyToggleState & EFI_KEY_STATE_EXPOSED) == EFI_KEY_STATE_EXPOSED) {\r
+    ConsoleInDev->IsSupportPartialKey = TRUE;\r
+  }\r
 \r
   Status = UpdateStatusLights (ConsoleInDev);\r
   if (EFI_ERROR (Status)) {\r
-    Status = EFI_DEVICE_ERROR;    \r
+    Status = EFI_DEVICE_ERROR;\r
   }\r
 \r
-Exit:   \r
+Exit:\r
   //\r
   // Leave critical section and return\r
   //\r
@@ -484,17 +520,17 @@ Exit:
     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
+    @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 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 or KeyNotificationFunction is NULL.                       \r
-                              \r
-**/   \r
+    @retval EFI_INVALID_PARAMETER     KeyData or NotifyHandle or KeyNotificationFunction is NULL.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 KeyboardRegisterKeyNotify (\r
@@ -508,13 +544,13 @@ KeyboardRegisterKeyNotify (
   KEYBOARD_CONSOLE_IN_DEV               *ConsoleInDev;\r
   EFI_TPL                               OldTpl;\r
   LIST_ENTRY                            *Link;\r
-  KEYBOARD_CONSOLE_IN_EX_NOTIFY         *CurrentNotify;  \r
+  KEYBOARD_CONSOLE_IN_EX_NOTIFY         *CurrentNotify;\r
   KEYBOARD_CONSOLE_IN_EX_NOTIFY         *NewNotify;\r
 \r
   if (KeyData == NULL || NotifyHandle == NULL || KeyNotificationFunction == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
-  \r
+\r
   ConsoleInDev = TEXT_INPUT_EX_KEYBOARD_CONSOLE_IN_DEV_FROM_THIS (This);\r
 \r
   //\r
@@ -527,36 +563,36 @@ KeyboardRegisterKeyNotify (
   //\r
   for (Link = ConsoleInDev->NotifyList.ForwardLink; Link != &ConsoleInDev->NotifyList; Link = Link->ForwardLink) {\r
     CurrentNotify = CR (\r
-                      Link, \r
-                      KEYBOARD_CONSOLE_IN_EX_NOTIFY, \r
-                      NotifyEntry, \r
+                      Link,\r
+                      KEYBOARD_CONSOLE_IN_EX_NOTIFY,\r
+                      NotifyEntry,\r
                       KEYBOARD_CONSOLE_IN_EX_NOTIFY_SIGNATURE\r
                       );\r
-    if (IsKeyRegistered (&CurrentNotify->KeyData, KeyData)) { \r
+    if (IsKeyRegistered (&CurrentNotify->KeyData, KeyData)) {\r
       if (CurrentNotify->KeyNotificationFn == KeyNotificationFunction) {\r
-        *NotifyHandle = CurrentNotify->NotifyHandle;        \r
+        *NotifyHandle = CurrentNotify->NotifyHandle;\r
         Status = EFI_SUCCESS;\r
         goto Exit;\r
       }\r
     }\r
-  }    \r
-  \r
+  }\r
+\r
   //\r
   // Allocate resource to save the notification function\r
-  //  \r
+  //\r
   NewNotify = (KEYBOARD_CONSOLE_IN_EX_NOTIFY *) AllocateZeroPool (sizeof (KEYBOARD_CONSOLE_IN_EX_NOTIFY));\r
   if (NewNotify == NULL) {\r
     Status = EFI_OUT_OF_RESOURCES;\r
     goto Exit;\r
   }\r
 \r
-  NewNotify->Signature         = KEYBOARD_CONSOLE_IN_EX_NOTIFY_SIGNATURE;     \r
+  NewNotify->Signature         = KEYBOARD_CONSOLE_IN_EX_NOTIFY_SIGNATURE;\r
   NewNotify->KeyNotificationFn = KeyNotificationFunction;\r
   NewNotify->NotifyHandle      = (EFI_HANDLE) NewNotify;\r
   CopyMem (&NewNotify->KeyData, KeyData, sizeof (EFI_KEY_DATA));\r
   InsertTailList (&ConsoleInDev->NotifyList, &NewNotify->NotifyEntry);\r
 \r
-  *NotifyHandle                = NewNotify->NotifyHandle;  \r
+  *NotifyHandle                = NewNotify->NotifyHandle;\r
   Status                       = EFI_SUCCESS;\r
 \r
 Exit:\r
@@ -564,21 +600,21 @@ Exit:
   // Leave critical section and return\r
   //\r
   gBS->RestoreTPL (OldTpl);\r
-  return Status;  \r
+  return Status;\r
 \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
-                              \r
-**/   \r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 KeyboardUnregisterKeyNotify (\r
@@ -590,37 +626,37 @@ KeyboardUnregisterKeyNotify (
   KEYBOARD_CONSOLE_IN_DEV               *ConsoleInDev;\r
   EFI_TPL                               OldTpl;\r
   LIST_ENTRY                            *Link;\r
-  KEYBOARD_CONSOLE_IN_EX_NOTIFY         *CurrentNotify;    \r
+  KEYBOARD_CONSOLE_IN_EX_NOTIFY         *CurrentNotify;\r
 \r
   if (NotificationHandle == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
-  } \r
+  }\r
 \r
   if (((KEYBOARD_CONSOLE_IN_EX_NOTIFY *) NotificationHandle)->Signature != KEYBOARD_CONSOLE_IN_EX_NOTIFY_SIGNATURE) {\r
     return EFI_INVALID_PARAMETER;\r
-  } \r
-   \r
+  }\r
+\r
   ConsoleInDev = TEXT_INPUT_EX_KEYBOARD_CONSOLE_IN_DEV_FROM_THIS (This);\r
-  \r
+\r
   //\r
   // Enter critical section\r
   //\r
-  OldTpl = gBS->RaiseTPL (TPL_NOTIFY);  \r
+  OldTpl = gBS->RaiseTPL (TPL_NOTIFY);\r
 \r
   for (Link = ConsoleInDev->NotifyList.ForwardLink; Link != &ConsoleInDev->NotifyList; Link = Link->ForwardLink) {\r
     CurrentNotify = CR (\r
-                      Link, \r
-                      KEYBOARD_CONSOLE_IN_EX_NOTIFY, \r
-                      NotifyEntry, \r
+                      Link,\r
+                      KEYBOARD_CONSOLE_IN_EX_NOTIFY,\r
+                      NotifyEntry,\r
                       KEYBOARD_CONSOLE_IN_EX_NOTIFY_SIGNATURE\r
-                      );       \r
+                      );\r
     if (CurrentNotify->NotifyHandle == NotificationHandle) {\r
       //\r
       // Remove the notification function from NotifyList and free resources\r
       //\r
-      RemoveEntryList (&CurrentNotify->NotifyEntry);      \r
\r
-      gBS->FreePool (CurrentNotify);            \r
+      RemoveEntryList (&CurrentNotify->NotifyEntry);\r
+\r
+      gBS->FreePool (CurrentNotify);\r
       Status = EFI_SUCCESS;\r
       goto Exit;\r
     }\r
index deeb59b95182e46876c7feaea9cf48cff236103a..704c03618ed6b7cd30d414e563191820ab4ec507 100644 (file)
@@ -89,7 +89,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,6 +99,7 @@ typedef struct {
   BOOLEAN                             NumLock;\r
   BOOLEAN                             ScrollLock;\r
 \r
+  BOOLEAN                             IsSupportPartialKey;\r
   //\r
   // Queue storing key scancodes\r
   //\r
@@ -135,9 +136,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 +180,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 +230,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
@@ -321,9 +322,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 +339,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 +407,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 +420,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 +432,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 +458,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,17 +479,17 @@ 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
+    @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 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
+    @retval EFI_INVALID_PARAMETER   - KeyData or NotifyHandle is NULL.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 KeyboardRegisterKeyNotify (\r
@@ -501,15 +502,15 @@ KeyboardRegisterKeyNotify (
 /**\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
@@ -532,18 +533,19 @@ 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
 #endif\r
index 24578aab8176ae8f8cecfdf4f28ba871abead753..2729d0b4416bf26d1588199dc98ac0731803cfa4 100644 (file)
@@ -2171,7 +2171,12 @@ BiosKeyboardSetState (
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  if ((*KeyToggleState & EFI_TOGGLE_STATE_VALID) != EFI_TOGGLE_STATE_VALID) {\r
+  //\r
+  // Thunk keyboard driver doesn't support partial keystroke.\r
+  //\r
+  if ((*KeyToggleState & EFI_TOGGLE_STATE_VALID) != EFI_TOGGLE_STATE_VALID ||\r
+      (*KeyToggleState & EFI_KEY_STATE_EXPOSED) == EFI_KEY_STATE_EXPOSED\r
+      ) {\r
     return EFI_UNSUPPORTED;\r
   }\r
 \r