]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
Update the copyright notice format
[mirror_edk2.git] / MdeModulePkg / Universal / Console / TerminalDxe / TerminalConIn.c
index 4aa8c73f061b68673bac71084e1bf4c527148284..1c5fd7be4731804f5cdb96808cd6ddfc8228b586 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   Implementation for EFI_SIMPLE_TEXT_INPUT_PROTOCOL protocol.\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2010, 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
 http://opensource.org/licenses/bsd-license.php\r
@@ -113,7 +113,7 @@ TerminalConInReset (
   //\r
   REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
     EFI_PROGRESS_CODE,\r
-    PcdGet32 (PcdStatusCodeValueRemoteConsoleReset),\r
+    (EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_PC_RESET),\r
     TerminalDevice->DevicePath\r
     );\r
 \r
@@ -129,7 +129,7 @@ TerminalConInReset (
   if (EFI_ERROR (Status)) {\r
     REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
       EFI_ERROR_CODE | EFI_ERROR_MINOR,\r
-      PcdGet32 (PcdStatusCodeValueRemoteConsoleError),\r
+      (EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_CONTROLLER_ERROR),\r
       TerminalDevice->DevicePath\r
       );\r
   }\r
@@ -365,7 +365,6 @@ TerminalConInRegisterKeyNotify (
   OUT EFI_HANDLE                        *NotifyHandle\r
   )\r
 {\r
-  EFI_STATUS                      Status;\r
   TERMINAL_DEV                    *TerminalDevice;\r
   TERMINAL_CONSOLE_IN_EX_NOTIFY   *NewNotify;\r
   LIST_ENTRY                      *Link;\r
@@ -407,18 +406,10 @@ TerminalConInRegisterKeyNotify (
 \r
   NewNotify->Signature         = TERMINAL_CONSOLE_IN_EX_NOTIFY_SIGNATURE;\r
   NewNotify->KeyNotificationFn = KeyNotificationFunction;\r
+  NewNotify->NotifyHandle      = (EFI_HANDLE) NewNotify;\r
   CopyMem (&NewNotify->KeyData, KeyData, sizeof (KeyData));\r
   InsertTailList (&TerminalDevice->NotifyList, &NewNotify->NotifyEntry);\r
-  //\r
-  // Use gSimpleTextInExNotifyGuid to get a valid EFI_HANDLE\r
-  //\r
-  Status = gBS->InstallMultipleProtocolInterfaces (\r
-                  &NewNotify->NotifyHandle,\r
-                  &gSimpleTextInExNotifyGuid,\r
-                  NULL,\r
-                  NULL\r
-                  );\r
-  ASSERT_EFI_ERROR (Status);\r
+\r
   *NotifyHandle                = NewNotify->NotifyHandle;\r
 \r
   return EFI_SUCCESS;\r
@@ -435,7 +426,6 @@ TerminalConInRegisterKeyNotify (
   @retval EFI_SUCCESS              The notification function was unregistered\r
                                    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
@@ -445,7 +435,6 @@ TerminalConInUnregisterKeyNotify (
   IN EFI_HANDLE                         NotificationHandle\r
   )\r
 {\r
-  EFI_STATUS                      Status;\r
   TERMINAL_DEV                    *TerminalDevice;\r
   LIST_ENTRY                      *Link;\r
   TERMINAL_CONSOLE_IN_EX_NOTIFY   *CurrentNotify;\r
@@ -455,18 +444,10 @@ TerminalConInUnregisterKeyNotify (
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  Status = gBS->OpenProtocol (\r
-                  NotificationHandle,\r
-                  &gSimpleTextInExNotifyGuid,\r
-                  NULL,\r
-                  NULL,\r
-                  NULL,\r
-                  EFI_OPEN_PROTOCOL_TEST_PROTOCOL\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
+  if (((TERMINAL_CONSOLE_IN_EX_NOTIFY *) NotificationHandle)->Signature != TERMINAL_CONSOLE_IN_EX_NOTIFY_SIGNATURE) {\r
     return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
+  } \r
+  \r
   TerminalDevice = TERMINAL_CON_IN_EX_DEV_FROM_THIS (This);\r
 \r
   NotifyList = &TerminalDevice->NotifyList;\r
@@ -482,19 +463,16 @@ TerminalConInUnregisterKeyNotify (
       // Remove the notification function from NotifyList and free resources\r
       //\r
       RemoveEntryList (&CurrentNotify->NotifyEntry);\r
-      Status = gBS->UninstallMultipleProtocolInterfaces (\r
-                      CurrentNotify->NotifyHandle,\r
-                      &gSimpleTextInExNotifyGuid,\r
-                      NULL,\r
-                      NULL\r
-                      );\r
-      ASSERT_EFI_ERROR (Status);\r
+\r
       gBS->FreePool (CurrentNotify);\r
       return EFI_SUCCESS;\r
     }\r
   }\r
 \r
-  return EFI_NOT_FOUND;\r
+  //\r
+  // Can not find the matching entry in database.\r
+  //\r
+  return EFI_INVALID_PARAMETER;\r
 }\r
 \r
 /**\r
@@ -658,7 +636,7 @@ TerminalConInCheckForKey (
       if (Status == EFI_DEVICE_ERROR) {\r
         REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
           EFI_ERROR_CODE | EFI_ERROR_MINOR,\r
-          PcdGet32 (PcdStatusCodeValueRemoteConsoleInputError),\r
+          (EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_INPUT_ERROR),\r
           TerminalDevice->DevicePath\r
           );\r
       }\r
@@ -1190,6 +1168,10 @@ UnicodeToEfiKeyFlushState (
   There is one special input sequence that will force the system to reset.\r
   This is ESC R ESC r ESC R.\r
 \r
+  Note: current implementation support terminal types include: PC ANSI, VT100+/VTUTF8, VT100. \r
+        The table below is not same with UEFI Spec 2.3 Appendix B Table 201(not support ANSI X3.64 /\r
+        DEC VT200-500 and extra support PC ANSI, VT100)since UEFI Table 201 is just an example.\r
+        \r
   Symbols used in table below\r
   ===========================\r
     ESC = 0x1B\r
@@ -1364,14 +1346,14 @@ UnicodeToEfiKey (
         if (TerminalDevice->ResetState == RESET_STATE_DEFAULT) {\r
           TerminalDevice->ResetState = RESET_STATE_ESC_R;\r
           SetDefaultResetState = FALSE;\r
-        } else if (TerminalDevice->ResetState == RESET_STATE_ESC_R_ESC_r) {\r
+        } else if (TerminalDevice->ResetState == RESET_STATE_ESC_R_ESC_R) {\r
           gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);\r
         }\r
         Key.ScanCode = SCAN_NULL;\r
         break;\r
       case 'r':\r
         if (TerminalDevice->ResetState == RESET_STATE_ESC_R) {\r
-          TerminalDevice->ResetState = RESET_STATE_ESC_R_ESC_r;\r
+          TerminalDevice->ResetState = RESET_STATE_ESC_R_ESC_R;\r
           SetDefaultResetState = FALSE;\r
         }\r
         Key.ScanCode = SCAN_NULL;\r