]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Csm/BiosThunk/KeyboardDxe/BiosKeyboard.c
IntelFrameworkModulePkg: Clean up source files
[mirror_edk2.git] / IntelFrameworkModulePkg / Csm / BiosThunk / KeyboardDxe / BiosKeyboard.c
index ac8e2364c8f48319aa0f782695e894a0db672ee3..63f6303995c7c0ae139ef3bc24ef99d1905e86f7 100644 (file)
@@ -58,7 +58,7 @@ Enqueue (
 \r
 /**\r
   Dequeue the key.\r
-  \r
+\r
   @param  Queue                 The queue to be dequeued.\r
   @param  KeyData               The key data to be dequeued.\r
 \r
@@ -85,7 +85,7 @@ Dequeue (
 \r
 /**\r
   Check whether the queue is empty.\r
-  \r
+\r
   @param  Queue                 The queue to be checked.\r
 \r
   @retval EFI_NOT_READY         The queue is empty.\r
@@ -279,8 +279,8 @@ BiosKeyboardDriverBindingStart (
   BiosKeyboardPrivate->SimpleTextInputEx.Reset               = BiosKeyboardResetEx;\r
   BiosKeyboardPrivate->SimpleTextInputEx.ReadKeyStrokeEx     = BiosKeyboardReadKeyStrokeEx;\r
   BiosKeyboardPrivate->SimpleTextInputEx.SetState            = BiosKeyboardSetState;\r
-  BiosKeyboardPrivate->SimpleTextInputEx.RegisterKeyNotify   = BiosKeyboardRegisterKeyNotify;  \r
-  BiosKeyboardPrivate->SimpleTextInputEx.UnregisterKeyNotify = BiosKeyboardUnregisterKeyNotify;    \r
+  BiosKeyboardPrivate->SimpleTextInputEx.RegisterKeyNotify   = BiosKeyboardRegisterKeyNotify;\r
+  BiosKeyboardPrivate->SimpleTextInputEx.UnregisterKeyNotify = BiosKeyboardUnregisterKeyNotify;\r
   InitializeListHead (&BiosKeyboardPrivate->NotifyList);\r
 \r
   //\r
@@ -315,7 +315,7 @@ BiosKeyboardDriverBindingStart (
   if (EFI_ERROR (Status)) {\r
     BiosKeyboardPrivate->SimpleTextInputEx.WaitForKeyEx = NULL;\r
     goto Done;\r
-  } \r
+  }\r
 \r
   //\r
   // Setup a periodic timer, used for reading keystrokes at a fixed interval\r
@@ -373,7 +373,7 @@ BiosKeyboardDriverBindingStart (
                                                     FeaturePcdGet (PcdPs2KbdExtendedVerification)\r
                                                     );\r
   if (EFI_ERROR (Status)) {\r
-    DEBUG ((EFI_D_ERROR, "[KBD]Reset Failed. Status - %r\n", Status));  \r
+    DEBUG ((EFI_D_ERROR, "[KBD]Reset Failed. Status - %r\n", Status));\r
     StatusCode = EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_NOT_DETECTED;\r
     goto Done;\r
   }\r
@@ -471,13 +471,13 @@ Done:
 \r
   if (EFI_ERROR (Status)) {\r
 \r
-    if (BiosKeyboardPrivate != NULL) {    \r
+    if (BiosKeyboardPrivate != NULL) {\r
       if ((BiosKeyboardPrivate->SimpleTextIn).WaitForKey != NULL) {\r
         gBS->CloseEvent ((BiosKeyboardPrivate->SimpleTextIn).WaitForKey);\r
       }\r
 \r
       if ((BiosKeyboardPrivate->SimpleTextInputEx).WaitForKeyEx != NULL) {\r
-        gBS->CloseEvent ((BiosKeyboardPrivate->SimpleTextInputEx).WaitForKeyEx);    \r
+        gBS->CloseEvent ((BiosKeyboardPrivate->SimpleTextInputEx).WaitForKeyEx);\r
       }\r
 \r
       if (BiosKeyboardPrivate->KeyNotifyProcessEvent != NULL) {\r
@@ -487,7 +487,7 @@ Done:
       BiosKeyboardFreeNotifyList (&BiosKeyboardPrivate->NotifyList);\r
 \r
       if (BiosKeyboardPrivate->TimerEvent != NULL) {\r
-        gBS->CloseEvent (BiosKeyboardPrivate->TimerEvent);    \r
+        gBS->CloseEvent (BiosKeyboardPrivate->TimerEvent);\r
       }\r
 \r
       FreePool (BiosKeyboardPrivate);\r
@@ -558,7 +558,7 @@ BiosKeyboardDriverBindingStop (
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
-  \r
+\r
   BiosKeyboardPrivate = BIOS_KEYBOARD_DEV_FROM_THIS (SimpleTextIn);\r
 \r
   Status = gBS->UninstallMultipleProtocolInterfaces (\r
@@ -930,19 +930,19 @@ KeyboardWaitForValue (
 }\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  BiosKeyboardPrivate   Bioskeyboard driver 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
   @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
 KeyboardReadKeyStrokeWorker (\r
@@ -959,14 +959,14 @@ KeyboardReadKeyStrokeWorker (
   //\r
   // Use TimerEvent callback function to check whether there's any key pressed\r
   //\r
-  \r
+\r
   //\r
   // Stall 1ms to give a chance to let other driver interrupt this routine for their timer event.\r
-  // Csm will be used to check whether there is a key pending, but the csm will disable all \r
+  // Csm will be used to check whether there is a key pending, but the csm will disable all\r
   // interrupt before switch to compatibility16, which mean all the efiCompatibility timer\r
-  // event will stop work during the compatibility16. And If a caller recursivly invoke this function, \r
-  // e.g. OS loader, other drivers which are driven by timer event will have a bad performance during this period, \r
-  // e.g. usb keyboard driver. \r
+  // event will stop work during the compatibility16. And If a caller recursivly invoke this function,\r
+  // e.g. OS loader, other drivers which are driven by timer event will have a bad performance during this period,\r
+  // e.g. usb keyboard driver.\r
   // Add a stall period can greatly increate other driver performance during the WaitForKey is recursivly invoked.\r
   // 1ms delay will make little impact to the thunk keyboard driver, and user can not feel the delay at all when input.\r
   //\r
@@ -1075,17 +1075,17 @@ BiosKeyboardReset (
                  BiosKeyboardPrivate,\r
                  KBC_CMDREG_VIA64_CMDBYTE_R\r
                  );\r
-      \r
+\r
       if (EFI_ERROR (Status)) {\r
         Status    = EFI_DEVICE_ERROR;\r
         goto Exit;\r
       }\r
-      \r
+\r
       Status = KeyboardRead (\r
                  BiosKeyboardPrivate,\r
                  &CommandByte\r
                  );\r
-      \r
+\r
       if (EFI_ERROR (Status)) {\r
         Status    = EFI_DEVICE_ERROR;\r
         goto Exit;\r
@@ -1106,17 +1106,17 @@ BiosKeyboardReset (
                  BiosKeyboardPrivate,\r
                  KBC_CMDREG_VIA64_AUX_DISABLE\r
                  );\r
-      \r
+\r
       if (EFI_ERROR (Status)) {\r
         Status    = EFI_DEVICE_ERROR;\r
         goto Exit;\r
       }\r
-      \r
+\r
       Status = KeyboardCommand (\r
                  BiosKeyboardPrivate,\r
                  KBC_CMDREG_VIA64_KB_DISABLE\r
                  );\r
-      \r
+\r
       if (EFI_ERROR (Status)) {\r
         Status    = EFI_DEVICE_ERROR;\r
         goto Exit;\r
@@ -1128,12 +1128,12 @@ BiosKeyboardReset (
       //\r
       //\r
       // Report a Progress Code for performing a self test on the keyboard controller\r
-      //    \r
+      //\r
       REPORT_STATUS_CODE (\r
         EFI_PROGRESS_CODE,\r
         EFI_PERIPHERAL_KEYBOARD | EFI_P_KEYBOARD_PC_SELF_TEST\r
         );\r
-      \r
+\r
       Status = KeyboardCommand (\r
                  BiosKeyboardPrivate,\r
                  KBC_CMDREG_VIA64_KBC_SLFTEST\r
@@ -1142,7 +1142,7 @@ BiosKeyboardReset (
         Status    = EFI_DEVICE_ERROR;\r
         goto Exit;\r
       }\r
-      \r
+\r
       Status = KeyboardWaitForValue (\r
                  BiosKeyboardPrivate,\r
                  KBC_CMDECHO_KBCSLFTEST_OK,\r
@@ -1352,7 +1352,7 @@ BiosKeyboardReset (
                BiosKeyboardPrivate,\r
                KBC_CMDREG_VIA64_KB_ENABLE\r
                );\r
-    \r
+\r
     if (EFI_ERROR (Status)) {\r
       Status    = EFI_DEVICE_ERROR;\r
       goto Exit;\r
@@ -1425,7 +1425,7 @@ BiosKeyboardReadKeyStroke (
     }\r
   }\r
 \r
-  CopyMem (Key, &KeyData.Key, sizeof (EFI_INPUT_KEY));  \r
+  CopyMem (Key, &KeyData.Key, sizeof (EFI_INPUT_KEY));\r
 \r
   return EFI_SUCCESS;\r
 }\r
@@ -1469,7 +1469,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
@@ -1644,7 +1644,7 @@ CONVERT_TABLE_ENTRY mConvertTable[] = {
   @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
@@ -1682,7 +1682,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
@@ -1738,9 +1738,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
@@ -1785,7 +1785,7 @@ BiosKeyboardTimerHandler (
   if (Regs.X.Flags.ZF != 0) {\r
     gBS->RestoreTPL (OldTpl);\r
     return;\r
-  }  \r
+  }\r
 \r
   //\r
   // Read the key\r
@@ -1810,27 +1810,27 @@ BiosKeyboardTimerHandler (
     KeyData.Key.ScanCode,\r
     KeyData.Key.UnicodeChar\r
     ));\r
-  \r
+\r
   KeyData.KeyState.KeyShiftState  = EFI_SHIFT_STATE_VALID;\r
   KeyData.KeyState.KeyToggleState = EFI_TOGGLE_STATE_VALID;\r
   //\r
-  // Leagcy Bios use Int 9 which is IRQ1 interrupt handler to get keystroke scancode to KB  buffer in BDA (BIOS DATE AREA),  then \r
-  // Int 16 depend  KB buffer and some key bits in BDA to translate the scancode to ASCII code, and  return both the scancode and ASCII \r
-  // code to Int 16 caller. This translation process works well if the Int 9  could response user input in time. But in Tiano enviorment,  the Int 9 \r
-  // will be disabled after the thunk call finish, which means if user crazy input during int 9 being disabled, some keystrokes will be lost when \r
-  // KB device own hardware buffer overflows. And if the lost keystroke code is CTRL or ALT or SHIFT release code, these function key flags bit \r
-  // in BDA will not be updated. So the Int 16 will believe the CTRL or ALT or SHIFT is still pressed, and Int 16 will translate later scancode \r
+  // Leagcy Bios use Int 9 which is IRQ1 interrupt handler to get keystroke scancode to KB  buffer in BDA (BIOS DATE AREA),  then\r
+  // Int 16 depend  KB buffer and some key bits in BDA to translate the scancode to ASCII code, and  return both the scancode and ASCII\r
+  // code to Int 16 caller. This translation process works well if the Int 9  could response user input in time. But in Tiano enviorment,  the Int 9\r
+  // will be disabled after the thunk call finish, which means if user crazy input during int 9 being disabled, some keystrokes will be lost when\r
+  // KB device own hardware buffer overflows. And if the lost keystroke code is CTRL or ALT or SHIFT release code, these function key flags bit\r
+  // in BDA will not be updated. So the Int 16 will believe the CTRL or ALT or SHIFT is still pressed, and Int 16 will translate later scancode\r
   // to wrong ASCII code. We can increase the Thunk frequence to let Int 9 response in time, but this way will much hurt other drivers\r
   // performance, like USB.\r
   //\r
-  // 1. If CTRL or ALT release code is missed,  all later input keys will be translated to wrong ASCII codes which the Tiano cannot support. In \r
-  //     this case, the KB input seems fail to work, and user input is blocked. To solve the problem, we can help to clear the CTRL or ALT flag in BDA \r
-  //    after every Int 16 finish. Thus persist to press CTRL or ALT has same effection as only press one time. It is Ok, since user not often use the \r
+  // 1. If CTRL or ALT release code is missed,  all later input keys will be translated to wrong ASCII codes which the Tiano cannot support. In\r
+  //     this case, the KB input seems fail to work, and user input is blocked. To solve the problem, we can help to clear the CTRL or ALT flag in BDA\r
+  //    after every Int 16 finish. Thus persist to press CTRL or ALT has same effection as only press one time. It is Ok, since user not often use the\r
   //    CTRL and ALT.\r
   //\r
-  // 2. If SHIFT release code is missed, all later lowercase input will become capital. This is ugly, but not block user input. If user press the lost \r
+  // 2. If SHIFT release code is missed, all later lowercase input will become capital. This is ugly, but not block user input. If user press the lost\r
   //     SHIFT again,  the lowercase will come back to normal. Since user often use the SHIFT, it is not reasonable to help to clear the SHIFT flag in BDA,\r
-  //     which will let persist to press SHIFT has same effection as only press one time. \r
+  //     which will let persist to press SHIFT has same effection as only press one time.\r
   //\r
   //0040h:0017h - KEYBOARD - STATUS FLAGS 1\r
   //   7 INSert active\r
@@ -1861,21 +1861,21 @@ BiosKeyboardTimerHandler (
       }\r
       if ((KbFlag1 & KB_SCROLL_LOCK_BIT) == KB_SCROLL_LOCK_BIT) {\r
         DEBUG ((EFI_D_INFO, "[KBD]Scroll Lock Key is pressed.\n"));\r
-      } \r
+      }\r
       if ((KbFlag1 & KB_ALT_PRESSED) == KB_ALT_PRESSED) {\r
         if ((KbFlag2 & KB_LEFT_ALT_PRESSED) == KB_LEFT_ALT_PRESSED) {\r
           DEBUG ((EFI_D_INFO, "[KBD]Left Alt Key is pressed.\n"));\r
         } else {\r
           DEBUG ((EFI_D_INFO, "[KBD]Right Alt Key is pressed.\n"));\r
         }\r
-      }  \r
+      }\r
       if ((KbFlag1 & KB_CTRL_PRESSED) == KB_CTRL_PRESSED) {\r
         if ((KbFlag2 & KB_LEFT_CTRL_PRESSED) == KB_LEFT_CTRL_PRESSED) {\r
           DEBUG ((EFI_D_INFO, "[KBD]Left Ctrl Key is pressed.\n"));\r
         } else {\r
           DEBUG ((EFI_D_INFO, "[KBD]Right Ctrl Key is pressed.\n"));\r
         }\r
-      }  \r
+      }\r
       if ((KbFlag1 & KB_LEFT_SHIFT_PRESSED) == KB_LEFT_SHIFT_PRESSED) {\r
         DEBUG ((EFI_D_INFO, "[KBD]Left Shift Key is pressed.\n"));\r
       }\r
@@ -1900,13 +1900,13 @@ BiosKeyboardTimerHandler (
   //\r
   // Record shift state\r
   // BUGBUG: Need add Menu key and Left/Right Logo key state in the future\r
-  //  \r
+  //\r
   if ((KbFlag1 & KB_ALT_PRESSED) == KB_ALT_PRESSED) {\r
     KeyData.KeyState.KeyShiftState  |= ((KbFlag2 & KB_LEFT_ALT_PRESSED) == KB_LEFT_ALT_PRESSED) ? EFI_LEFT_ALT_PRESSED : EFI_RIGHT_ALT_PRESSED;\r
-  }  \r
+  }\r
   if ((KbFlag1 & KB_CTRL_PRESSED) == KB_CTRL_PRESSED) {\r
     KeyData.KeyState.KeyShiftState  |= ((KbFlag2 & KB_LEFT_CTRL_PRESSED) == KB_LEFT_CTRL_PRESSED) ? EFI_LEFT_CONTROL_PRESSED : EFI_RIGHT_CONTROL_PRESSED;\r
-  }  \r
+  }\r
   if ((KbFlag1 & KB_LEFT_SHIFT_PRESSED) == KB_LEFT_SHIFT_PRESSED) {\r
     KeyData.KeyState.KeyShiftState  |= EFI_LEFT_SHIFT_PRESSED;\r
   }\r
@@ -1923,7 +1923,7 @@ BiosKeyboardTimerHandler (
     KbFlag1 &= ~0x0C;\r
     *((UINT8 *) (UINTN) 0x417) = KbFlag1;\r
   );\r
-  \r
+\r
   //\r
   // Output EFI input key and shift/toggle state\r
   //\r
@@ -1973,9 +1973,9 @@ BiosKeyboardTimerHandler (
   //\r
   for (Link = BiosKeyboardPrivate->NotifyList.ForwardLink; Link != &BiosKeyboardPrivate->NotifyList; Link = Link->ForwardLink) {\r
     CurrentNotify = CR (\r
-                      Link, \r
-                      BIOS_KEYBOARD_CONSOLE_IN_EX_NOTIFY, \r
-                      NotifyEntry, \r
+                      Link,\r
+                      BIOS_KEYBOARD_CONSOLE_IN_EX_NOTIFY,\r
+                      NotifyEntry,\r
                       BIOS_KEYBOARD_CONSOLE_IN_EX_NOTIFY_SIGNATURE\r
                       );\r
     if (IsKeyRegistered (&CurrentNotify->KeyData, &KeyData)) {\r
@@ -2001,7 +2001,7 @@ BiosKeyboardTimerHandler (
   //\r
   gBS->RestoreTPL (OldTpl);\r
 \r
-  return ;  \r
+  return ;\r
 }\r
 \r
 /**\r
@@ -2034,7 +2034,7 @@ KeyNotifyProcessHandler (
   while (TRUE) {\r
     //\r
     // Enter critical section\r
-    //  \r
+    //\r
     OldTpl = gBS->RaiseTPL (TPL_NOTIFY);\r
     Status = Dequeue (&BiosKeyboardPrivate->QueueForNotify, &KeyData);\r
     //\r
@@ -2074,9 +2074,9 @@ BiosKeyboardFreeNotifyList (
   }\r
   while (!IsListEmpty (ListHead)) {\r
     NotifyNode = CR (\r
-                   ListHead->ForwardLink, \r
-                   BIOS_KEYBOARD_CONSOLE_IN_EX_NOTIFY, \r
-                   NotifyEntry, \r
+                   ListHead->ForwardLink,\r
+                   BIOS_KEYBOARD_CONSOLE_IN_EX_NOTIFY,\r
+                   NotifyEntry,\r
                    BIOS_KEYBOARD_CONSOLE_IN_EX_NOTIFY_SIGNATURE\r
                    );\r
     RemoveEntryList (ListHead->ForwardLink);\r
@@ -2089,14 +2089,14 @@ BiosKeyboardFreeNotifyList (
 /**\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
@@ -2105,24 +2105,24 @@ 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
@@ -2132,7 +2132,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
@@ -2140,22 +2140,22 @@ BiosKeyboardWaitForKeyEx (
   IN  EFI_EVENT  Event,\r
   IN  VOID       *Context\r
   )\r
-{  \r
+{\r
   BIOS_KEYBOARD_DEV                     *BiosKeyboardPrivate;\r
-  \r
-  BiosKeyboardPrivate = TEXT_INPUT_EX_BIOS_KEYBOARD_DEV_FROM_THIS (Context); \r
+\r
+  BiosKeyboardPrivate = TEXT_INPUT_EX_BIOS_KEYBOARD_DEV_FROM_THIS (Context);\r
   BiosKeyboardWaitForKey (Event, &BiosKeyboardPrivate->SimpleTextIn);\r
 \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
@@ -2169,11 +2169,11 @@ BiosKeyboardResetEx (
   BIOS_KEYBOARD_DEV                     *BiosKeyboardPrivate;\r
   EFI_STATUS                            Status;\r
   EFI_TPL                               OldTpl;\r
-  \r
-  BiosKeyboardPrivate = TEXT_INPUT_EX_BIOS_KEYBOARD_DEV_FROM_THIS (This); \r
+\r
+  BiosKeyboardPrivate = TEXT_INPUT_EX_BIOS_KEYBOARD_DEV_FROM_THIS (This);\r
 \r
   Status = BiosKeyboardPrivate->SimpleTextIn.Reset (\r
-                                               &BiosKeyboardPrivate->SimpleTextIn, \r
+                                               &BiosKeyboardPrivate->SimpleTextIn,\r
                                                ExtendedVerification\r
                                                );\r
   if (EFI_ERROR (Status)) {\r
@@ -2183,25 +2183,25 @@ BiosKeyboardResetEx (
   OldTpl = gBS->RaiseTPL (TPL_NOTIFY);\r
 \r
   gBS->RestoreTPL (OldTpl);\r
-  \r
+\r
   return EFI_SUCCESS;\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
   @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
@@ -2215,27 +2215,27 @@ BiosKeyboardReadKeyStrokeEx (
   if (KeyData == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
-  \r
+\r
   BiosKeyboardPrivate = TEXT_INPUT_EX_BIOS_KEYBOARD_DEV_FROM_THIS (This);\r
 \r
   return KeyboardReadKeyStrokeWorker (BiosKeyboardPrivate, KeyData);\r
-  \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
 BiosKeyboardSetState (\r
@@ -2293,7 +2293,7 @@ BiosKeyboardSetState (
   if (EFI_ERROR (Status)) {\r
     Status = EFI_DEVICE_ERROR;\r
     goto Exit;\r
-  }  \r
+  }\r
   Status = KeyboardWaitForValue (BiosKeyboardPrivate, 0xfa, KEYBOARD_WAITFORVALUE_TIMEOUT);\r
   if (EFI_ERROR (Status)) {\r
     Status = EFI_DEVICE_ERROR;\r
@@ -2303,7 +2303,7 @@ BiosKeyboardSetState (
   if (EFI_ERROR (Status)) {\r
     Status = EFI_DEVICE_ERROR;\r
     goto Exit;\r
-  }  \r
+  }\r
   //\r
   // Call Legacy BIOS Protocol to set whatever is necessary\r
   //\r
@@ -2325,12 +2325,12 @@ 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. 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
+  @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
@@ -2354,7 +2354,7 @@ BiosKeyboardRegisterKeyNotify (
   EFI_TPL                               OldTpl;\r
   BIOS_KEYBOARD_CONSOLE_IN_EX_NOTIFY    *NewNotify;\r
   LIST_ENTRY                            *Link;\r
-  BIOS_KEYBOARD_CONSOLE_IN_EX_NOTIFY    *CurrentNotify;  \r
+  BIOS_KEYBOARD_CONSOLE_IN_EX_NOTIFY    *CurrentNotify;\r
 \r
   if (KeyData == NULL || NotifyHandle == NULL || KeyNotificationFunction == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
@@ -2372,24 +2372,24 @@ BiosKeyboardRegisterKeyNotify (
   //\r
   for (Link = BiosKeyboardPrivate->NotifyList.ForwardLink; Link != &BiosKeyboardPrivate->NotifyList; Link = Link->ForwardLink) {\r
     CurrentNotify = CR (\r
-                      Link, \r
-                      BIOS_KEYBOARD_CONSOLE_IN_EX_NOTIFY, \r
-                      NotifyEntry, \r
+                      Link,\r
+                      BIOS_KEYBOARD_CONSOLE_IN_EX_NOTIFY,\r
+                      NotifyEntry,\r
                       BIOS_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;\r
         Status = EFI_SUCCESS;\r
         goto Exit;\r
       }\r
-    }  \r
+    }\r
   }\r
 \r
   //\r
   // Allocate resource to save the notification function\r
   //\r
-  \r
+\r
   NewNotify = (BIOS_KEYBOARD_CONSOLE_IN_EX_NOTIFY *) AllocateZeroPool (sizeof (BIOS_KEYBOARD_CONSOLE_IN_EX_NOTIFY));\r
   if (NewNotify == NULL) {\r
     Status = EFI_OUT_OF_RESOURCES;\r
@@ -2403,25 +2403,25 @@ BiosKeyboardRegisterKeyNotify (
 \r
   *NotifyHandle                = NewNotify;\r
   Status                       = EFI_SUCCESS;\r
-  \r
+\r
 Exit:\r
   //\r
   // Leave critical section and return\r
   //\r
   gBS->RestoreTPL (OldTpl);\r
-  return Status;  \r
+  return Status;\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
   @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
@@ -2444,10 +2444,10 @@ BiosKeyboardUnregisterKeyNotify (
 \r
   if (((BIOS_KEYBOARD_CONSOLE_IN_EX_NOTIFY *) NotificationHandle)->Signature != BIOS_KEYBOARD_CONSOLE_IN_EX_NOTIFY_SIGNATURE) {\r
     return EFI_INVALID_PARAMETER;\r
-  } \r
-  \r
+  }\r
+\r
   BiosKeyboardPrivate = TEXT_INPUT_EX_BIOS_KEYBOARD_DEV_FROM_THIS (This);\r
-  \r
+\r
   //\r
   // Enter critical section\r
   //\r
@@ -2455,22 +2455,22 @@ BiosKeyboardUnregisterKeyNotify (
 \r
   for (Link = BiosKeyboardPrivate->NotifyList.ForwardLink; Link != &BiosKeyboardPrivate->NotifyList; Link = Link->ForwardLink) {\r
     CurrentNotify = CR (\r
-                      Link, \r
-                      BIOS_KEYBOARD_CONSOLE_IN_EX_NOTIFY, \r
-                      NotifyEntry, \r
+                      Link,\r
+                      BIOS_KEYBOARD_CONSOLE_IN_EX_NOTIFY,\r
+                      NotifyEntry,\r
                       BIOS_KEYBOARD_CONSOLE_IN_EX_NOTIFY_SIGNATURE\r
-                      );    \r
+                      );\r
     if (CurrentNotify == NotificationHandle) {\r
       //\r
       // Remove the notification function from NotifyList and free resources\r
       //\r
-      RemoveEntryList (&CurrentNotify->NotifyEntry);      \r
+      RemoveEntryList (&CurrentNotify->NotifyEntry);\r
 \r
       Status = EFI_SUCCESS;\r
       goto Exit;\r
     }\r
   }\r
-  \r
+\r
   //\r
   // Can not find the specified Notification Handle\r
   //\r