]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
Report the setting variable failure to platform through the status code when core...
[mirror_edk2.git] / MdeModulePkg / Universal / Console / TerminalDxe / Terminal.h
index af3afecd1538b46d5a0d5699b5848fed5464885c..d393acbc2073e1b7d9408058dd6676e95595b066 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   Header file for Terminal driver.\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2014, 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
@@ -20,9 +20,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include <Guid/GlobalVariable.h>\r
 #include <Guid/PcAnsi.h>\r
+#include <Guid/StatusCodeDataTypeVariable.h>\r
 \r
-#include <Protocol/SimpleTextInExNotify.h>\r
-#include <Protocol/HotPlugDevice.h>\r
 #include <Protocol/SimpleTextOut.h>\r
 #include <Protocol/SerialIo.h>\r
 #include <Protocol/DevicePath.h>\r
@@ -63,13 +62,19 @@ typedef struct {
   EFI_INPUT_KEY Data[FIFO_MAX_NUMBER + 1];\r
 } EFI_KEY_FIFO;\r
 \r
+typedef struct {\r
+  UINTN   Columns;\r
+  UINTN   Rows;\r
+} TERMINAL_CONSOLE_MODE_DATA;\r
+\r
+#define KEYBOARD_TIMER_INTERVAL         200000  // 0.02s\r
+\r
 #define TERMINAL_DEV_SIGNATURE  SIGNATURE_32 ('t', 'm', 'n', 'l')\r
 \r
 #define TERMINAL_CONSOLE_IN_EX_NOTIFY_SIGNATURE SIGNATURE_32 ('t', 'm', 'e', 'n')\r
 \r
 typedef struct _TERMINAL_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
@@ -83,11 +88,13 @@ typedef struct {
   EFI_SIMPLE_TEXT_INPUT_PROTOCOL      SimpleInput;\r
   EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL     SimpleTextOutput;\r
   EFI_SIMPLE_TEXT_OUTPUT_MODE         SimpleTextOutputMode;\r
+  TERMINAL_CONSOLE_MODE_DATA          *TerminalConsoleModeData;\r
   UINTN                               SerialInTimeOut;\r
   RAW_DATA_FIFO                       *RawFiFo;\r
   UNICODE_FIFO                        *UnicodeFiFo;\r
   EFI_KEY_FIFO                        *EfiKeyFiFo;\r
   EFI_UNICODE_STRING_TABLE            *ControllerNameTable;\r
+  EFI_EVENT                           TimerEvent;\r
   EFI_EVENT                           TwoSecondTimeOut;\r
   UINT32                              InputState;\r
   UINT32                              ResetState;\r
@@ -113,7 +120,7 @@ typedef struct {
 \r
 #define RESET_STATE_DEFAULT               0x00\r
 #define RESET_STATE_ESC_R                 0x01\r
-#define RESET_STATE_ESC_R_ESC_r           0x02\r
+#define RESET_STATE_ESC_R_ESC_R           0x02\r
 \r
 #define TERMINAL_CON_IN_DEV_FROM_THIS(a)  CR (a, TERMINAL_DEV, SimpleInput, TERMINAL_DEV_SIGNATURE)\r
 #define TERMINAL_CON_OUT_DEV_FROM_THIS(a) CR (a, TERMINAL_DEV, SimpleTextOutput, TERMINAL_DEV_SIGNATURE)\r
@@ -136,15 +143,6 @@ typedef union {
 #define CCAP                      0x43\r
 #define DCAP                      0x44\r
 \r
-#define MODE0_COLUMN_COUNT        80\r
-#define MODE0_ROW_COUNT           25\r
-\r
-#define MODE1_COLUMN_COUNT        80\r
-#define MODE1_ROW_COUNT           50\r
-\r
-#define MODE2_COLUMN_COUNT        100\r
-#define MODE2_ROW_COUNT           31\r
-\r
 #define BACKSPACE                 8\r
 #define ESC                       27\r
 #define CSI                       0x9B\r
@@ -236,7 +234,7 @@ TerminalConInReadKeyStroke (
                                    pressed.\r
 \r
   @retval TRUE                     Key be pressed matches a registered key.\r
-  @retval FLASE                    Match failed.\r
+  @retval FALSE                    Match failed.\r
 \r
 **/\r
 BOOLEAN\r
@@ -352,7 +350,7 @@ TerminalConInRegisterKeyNotify (
   IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL  *This,\r
   IN EFI_KEY_DATA                       *KeyData,\r
   IN EFI_KEY_NOTIFY_FUNCTION            KeyNotificationFunction,\r
-  OUT EFI_HANDLE                        *NotifyHandle\r
+  OUT VOID                              **NotifyHandle\r
   );\r
 \r
 /**\r
@@ -372,7 +370,7 @@ EFI_STATUS
 EFIAPI\r
 TerminalConInUnregisterKeyNotify (\r
   IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL  *This,\r
-  IN EFI_HANDLE                         NotificationHandle\r
+  IN VOID                               *NotificationHandle\r
   );\r
 \r
 /**\r
@@ -684,7 +682,7 @@ TerminalFreeNotifyList (
                                 languages specified in SupportedLanguages. The\r
                                 number of languages supported by a driver is up\r
                                 to the driver writer. Language is specified\r
-                                in RFC 3066 or ISO 639-2 language code format.\r
+                                in RFC 4646 or ISO 639-2 language code format.\r
 \r
   @param  DriverName[out]       A pointer to the Unicode string to return.\r
                                 This Unicode string is the name of the\r
@@ -749,7 +747,7 @@ TerminalComponentNameGetDriverName (
                                 languages specified in SupportedLanguages. The\r
                                 number of languages supported by a driver is up\r
                                 to the driver writer. Language is specified in\r
-                                RFC 3066 or ISO 639-2 language code format.\r
+                                RFC 4646 or ISO 639-2 language code format.\r
 \r
   @param  ControllerName[out]   A pointer to the Unicode string to return.\r
                                 This Unicode string is the name of the\r
@@ -763,7 +761,7 @@ TerminalComponentNameGetDriverName (
                                 driver specified by This was returned in\r
                                 DriverName.\r
 \r
-  @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
+  @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
 \r
   @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
                                 EFI_HANDLE.\r
@@ -838,26 +836,6 @@ TerminalRemoveConsoleDevVariable (
   IN EFI_DEVICE_PATH_PROTOCOL  *ParentDevicePath\r
   );\r
 \r
-/**\r
-  Read the EFI variable (VendorGuid/Name) and return a dynamically allocated\r
-  buffer, and the size of the buffer. On failure return NULL.\r
-\r
-  @param  Name                   String part of EFI variable name\r
-  @param  VendorGuid             GUID part of EFI variable name\r
-  @param  VariableSize           Returns the size of the EFI variable that was read\r
-\r
-  @return Dynamically allocated memory that contains a copy of the EFI variable.\r
-          Caller is repsoncible freeing the buffer. If variable was not read,\r
-          NULL regturned.\r
-\r
-**/\r
-VOID *\r
-TerminalGetVariableAndSize (\r
-  IN  CHAR16              *Name,\r
-  IN  EFI_GUID            *VendorGuid,\r
-  OUT UINTN               *VariableSize\r
-  );\r
-\r
 /**\r
   Build termial device path according to terminal type.\r
 \r
@@ -902,7 +880,7 @@ GetOneKeyFromSerial (
   @param  Input                The key will be input.\r
 \r
   @retval TRUE                 If insert successfully.\r
-  @retval FLASE                If Raw Data buffer is full before key insertion,\r
+  @retval FALSE                If Raw Data buffer is full before key insertion,\r
                                and the key is lost.\r
 \r
 **/\r
@@ -919,7 +897,7 @@ RawFiFoInsertOneKey (
   @param  Output               The key will be removed.\r
 \r
   @retval TRUE                 If insert successfully.\r
-  @retval FLASE                If Raw Data FIFO buffer is empty before remove operation.\r
+  @retval FALSE                If Raw Data FIFO buffer is empty before remove operation.\r
 \r
 **/\r
 BOOLEAN\r
@@ -934,7 +912,7 @@ RawFiFoRemoveOneKey (
   @param  TerminalDevice       Terminal driver private structure\r
 \r
   @retval TRUE                 If Raw Data FIFO buffer is empty.\r
-  @retval FLASE                If Raw Data FIFO buffer is not empty.\r
+  @retval FALSE                If Raw Data FIFO buffer is not empty.\r
 \r
 **/\r
 BOOLEAN\r
@@ -948,7 +926,7 @@ IsRawFiFoEmpty (
   @param  TerminalDevice       Terminal driver private structure\r
 \r
   @retval TRUE                 If Raw Data FIFO buffer is full.\r
-  @retval FLASE                If Raw Data FIFO buffer is not full.\r
+  @retval FALSE                If Raw Data FIFO buffer is not full.\r
 \r
 **/\r
 BOOLEAN\r
@@ -963,14 +941,14 @@ IsRawFiFoFull (
   @param  Key                  The key will be input.\r
 \r
   @retval TRUE                 If insert successfully.\r
-  @retval FLASE                If FIFO buffer is full before key insertion,\r
+  @retval FALSE                If FIFO buffer is full before key insertion,\r
                                and the key is lost.\r
 \r
 **/\r
 BOOLEAN\r
 EfiKeyFiFoInsertOneKey (\r
   TERMINAL_DEV      *TerminalDevice,\r
-  EFI_INPUT_KEY     Key\r
+  EFI_INPUT_KEY     *Key\r
   );\r
 \r
 /**\r
@@ -980,7 +958,7 @@ EfiKeyFiFoInsertOneKey (
   @param  Output               The key will be removed.\r
 \r
   @retval TRUE                 If insert successfully.\r
-  @retval FLASE                If FIFO buffer is empty before remove operation.\r
+  @retval FALSE                If FIFO buffer is empty before remove operation.\r
 \r
 **/\r
 BOOLEAN\r
@@ -995,7 +973,7 @@ EfiKeyFiFoRemoveOneKey (
   @param  TerminalDevice       Terminal driver private structure\r
 \r
   @retval TRUE                 If FIFO buffer is empty.\r
-  @retval FLASE                If FIFO buffer is not empty.\r
+  @retval FALSE                If FIFO buffer is not empty.\r
 \r
 **/\r
 BOOLEAN\r
@@ -1009,7 +987,7 @@ IsEfiKeyFiFoEmpty (
   @param  TerminalDevice       Terminal driver private structure\r
 \r
   @retval TRUE                 If FIFO buffer is full.\r
-  @retval FLASE                If FIFO buffer is not full.\r
+  @retval FALSE                If FIFO buffer is not full.\r
 \r
 **/\r
 BOOLEAN\r
@@ -1024,7 +1002,7 @@ IsEfiKeyFiFoFull (
   @param  Input                The key will be input.\r
 \r
   @retval TRUE                 If insert successfully.\r
-  @retval FLASE                If Unicode FIFO buffer is full before key insertion,\r
+  @retval FALSE                If Unicode FIFO buffer is full before key insertion,\r
                                and the key is lost.\r
 \r
 **/\r
@@ -1036,15 +1014,14 @@ UnicodeFiFoInsertOneKey (
 \r
 /**\r
   Remove one pre-fetched key out of the Unicode FIFO buffer.\r
+  The caller should guarantee that Unicode FIFO buffer is not empty \r
+  by IsUnicodeFiFoEmpty ().\r
 \r
   @param  TerminalDevice       Terminal driver private structure.\r
   @param  Output               The key will be removed.\r
 \r
-  @retval TRUE                 If insert successfully.\r
-  @retval FLASE                If Unicode FIFO buffer is empty before remove operation.\r
-\r
 **/\r
-BOOLEAN\r
+VOID\r
 UnicodeFiFoRemoveOneKey (\r
   TERMINAL_DEV  *TerminalDevice,\r
   UINT16        *Output\r
@@ -1056,7 +1033,7 @@ UnicodeFiFoRemoveOneKey (
   @param  TerminalDevice       Terminal driver private structure\r
 \r
   @retval TRUE                 If Unicode FIFO buffer is empty.\r
-  @retval FLASE                If Unicode FIFO buffer is not empty.\r
+  @retval FALSE                If Unicode FIFO buffer is not empty.\r
 \r
 **/\r
 BOOLEAN\r
@@ -1070,7 +1047,7 @@ IsUnicodeFiFoEmpty (
   @param  TerminalDevice       Terminal driver private structure\r
 \r
   @retval TRUE                 If Unicode FIFO buffer is full.\r
-  @retval FLASE                If Unicode FIFO buffer is not full.\r
+  @retval FALSE                If Unicode FIFO buffer is not full.\r
 \r
 **/\r
 BOOLEAN\r
@@ -1347,4 +1324,33 @@ TerminalIsValidEfiCntlChar (
   IN  CHAR16  CharC\r
   );\r
 \r
+/**\r
+  Check if the device supports hot-plug through its device path.\r
+\r
+  This function could be updated to check more types of Hot Plug devices.\r
+  Currently, it checks USB and PCCard device.\r
+\r
+  @param  DevicePath            Pointer to device's device path.\r
+\r
+  @retval TRUE                  The devcie is a hot-plug device\r
+  @retval FALSE                 The devcie is not a hot-plug device.\r
+\r
+**/\r
+BOOLEAN\r
+IsHotPlugDevice (\r
+  IN  EFI_DEVICE_PATH_PROTOCOL    *DevicePath\r
+  );\r
+\r
+/**\r
+  Timer handler to poll the key from serial.\r
+\r
+  @param  Event                    Indicates the event that invoke this function.\r
+  @param  Context                  Indicates the calling context.\r
+**/\r
+VOID\r
+EFIAPI\r
+TerminalConInTimerHandler (\r
+  IN EFI_EVENT            Event,\r
+  IN VOID                 *Context\r
+  );\r
 #endif\r