]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.h
Update the copyright notice format
[mirror_edk2.git] / MdeModulePkg / Universal / Console / ConPlatformDxe / ConPlatform.h
index 231a20c776e3b99eca83b879367e6fd918d3d82a..28261730ab04f9bf94a67582c1c12096389a1ef7 100644 (file)
@@ -1,34 +1,31 @@
-/*++\r
+/** @file\r
+  Header file for Console Platfrom DXE Driver.\r
 \r
-Copyright (c) 2006, Intel Corporation                                                         \r
-All rights reserved. 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
-                                                                                          \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \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
 \r
-Module Name:\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-    ConPlatform.h\r
-    \r
-Abstract:\r
-\r
---*/\r
+**/\r
 \r
-#ifndef CON_MANAGE_H_\r
-#define CON_MANAGE_H_\r
+#ifndef _CON_PLATFORM_H_\r
+#define _CON_PLATFORM_H_\r
 \r
 #include <Uefi.h>\r
+\r
 #include <Protocol/SimpleTextOut.h>\r
-#include <Guid/GlobalVariable.h>\r
-#include <Guid/ConsoleInDevice.h>\r
 #include <Protocol/DevicePath.h>\r
 #include <Protocol/SimpleTextIn.h>\r
-#include <Guid/HotPlugDevice.h>\r
+\r
+#include <Guid/GlobalVariable.h>\r
+#include <Guid/ConsoleInDevice.h>\r
 #include <Guid/StandardErrorDevice.h>\r
 #include <Guid/ConsoleOutDevice.h>\r
+\r
 #include <Library/DebugLib.h>\r
 #include <Library/UefiDriverEntryPoint.h>\r
 #include <Library/UefiLib.h>\r
@@ -50,35 +47,88 @@ extern EFI_COMPONENT_NAME2_PROTOCOL gConPlatformComponentName2;
 \r
 \r
 typedef enum {\r
-  CHECK,\r
-  APPEND,\r
-  DELETE\r
+  Check,\r
+  Append,\r
+  Delete\r
 } CONPLATFORM_VAR_OPERATION;\r
 \r
+/**\r
+  Test to see if specific protocol could be supported on the ControllerHandle. \r
+\r
+  @param  This                Protocol instance pointer.\r
+  @param  ControllerHandle    Handle of device to test.\r
+  @param  ProtocolGuid        The specfic protocol.\r
+\r
+  @retval EFI_SUCCESS         This driver supports this device\r
+  @retval other               This driver does not support this device\r
+\r
+**/\r
 EFI_STATUS\r
 ConPlatformDriverBindingSupported (\r
   IN  EFI_DRIVER_BINDING_PROTOCOL  *This,\r
   IN  EFI_HANDLE                   ControllerHandle,\r
-  IN  EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath,\r
   IN  EFI_GUID                     *ProtocolGuid\r
   );\r
 \r
+/**\r
+  Test to see if EFI_SIMPLE_TEXT_INPUT_PROTOCOL is supported on ControllerHandle. \r
+\r
+  @param  This                Protocol instance pointer.\r
+  @param  ControllerHandle    Handle of device to test.\r
+  @param  RemainingDevicePath Optional parameter use to pick a specific child\r
+                              device to start.\r
+\r
+  @retval EFI_SUCCESS         This driver supports this device.\r
+  @retval other               This driver does not support this device.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ConPlatformTextInDriverBindingSupported (\r
   IN  EFI_DRIVER_BINDING_PROTOCOL  *This,\r
   IN  EFI_HANDLE                   Handle,\r
-  IN  EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
+  IN  EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath  OPTIONAL\r
   );\r
 \r
+/**\r
+  Test to see if EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL is supported on ControllerHandle. \r
+\r
+  @param  This                Protocol instance pointer.\r
+  @param  ControllerHandle    Handle of device to test.\r
+  @param  RemainingDevicePath Optional parameter use to pick a specific child\r
+                              device to start.\r
+\r
+  @retval EFI_SUCCESS         This driver supports this device.\r
+  @retval other               This driver does not support this device.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ConPlatformTextOutDriverBindingSupported (\r
   IN  EFI_DRIVER_BINDING_PROTOCOL  *This,\r
   IN  EFI_HANDLE                   Handle,\r
-  IN  EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
+  IN  EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath  OPTIONAL\r
   );\r
 \r
+/**\r
+  Start this driver on the device for console input.\r
+\r
+  Start this driver on ControllerHandle by opening Simple Text Input Protocol,\r
+  reading Device Path, and installing Console In Devcice GUID on ControllerHandle.\r
+\r
+  If this devcie is not one hot-plug devce, append its device path into the \r
+  console environment variables ConInDev.\r
+  \r
+  @param  This                 Protocol instance pointer.\r
+  @param  ControllerHandle     Handle of device to bind driver to\r
+  @param  RemainingDevicePath  Optional parameter use to pick a specific child\r
+                               device to start.\r
+\r
+  @retval EFI_SUCCESS          This driver is added to ControllerHandle\r
+  @retval EFI_ALREADY_STARTED  This driver is already running on ControllerHandle\r
+  @retval other                This driver does not support this device.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ConPlatformTextInDriverBindingStart (\r
@@ -87,6 +137,26 @@ ConPlatformTextInDriverBindingStart (
   IN  EFI_DEVICE_PATH_PROTOCOL      *RemainingDevicePath\r
   );\r
 \r
+/**\r
+  Start this driver on the device for console output and stardard error output.\r
+\r
+  Start this driver on ControllerHandle by opening Simple Text Output Protocol,\r
+  reading Device Path, and installing Console Out Devcic GUID, Standard Error\r
+  Device GUID on ControllerHandle.\r
+\r
+  If this devcie is not one hot-plug devce, append its device path into the \r
+  console environment variables ConOutDev, StdErrDev.\r
+  \r
+  @param  This                 Protocol instance pointer.\r
+  @param  ControllerHandle     Handle of device to bind driver to\r
+  @param  RemainingDevicePath  Optional parameter use to pick a specific child\r
+                               device to start.\r
+\r
+  @retval EFI_SUCCESS          This driver is added to ControllerHandle\r
+  @retval EFI_ALREADY_STARTED  This driver is already running on ControllerHandle\r
+  @retval other                This driver does not support this device\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ConPlatformTextOutDriverBindingStart (\r
@@ -95,6 +165,20 @@ ConPlatformTextOutDriverBindingStart (
   IN  EFI_DEVICE_PATH_PROTOCOL      *RemainingDevicePath\r
   );\r
 \r
+/**\r
+  Stop this driver on ControllerHandle by removing Console In Devcice GUID \r
+  and closing the Simple Text Input protocol on ControllerHandle.\r
+\r
+  @param  This              Protocol instance pointer.\r
+  @param  ControllerHandle  Handle of device to stop driver on\r
+  @param  NumberOfChildren  Number of Handles in ChildHandleBuffer. If number of\r
+                            children is zero stop the entire bus driver.\r
+  @param  ChildHandleBuffer List of Child Handles to Stop.\r
+\r
+  @retval EFI_SUCCESS       This driver is removed ControllerHandle\r
+  @retval other             This driver was not removed from this device\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ConPlatformTextInDriverBindingStop (\r
@@ -104,6 +188,20 @@ ConPlatformTextInDriverBindingStop (
   IN  EFI_HANDLE                   *ChildHandleBuffer\r
   );\r
 \r
+/**\r
+  Stop this driver on ControllerHandle by removing Console Out Devcice GUID \r
+  and closing the Simple Text Output protocol on ControllerHandle.\r
+\r
+  @param  This              Protocol instance pointer.\r
+  @param  ControllerHandle  Handle of device to stop driver on\r
+  @param  NumberOfChildren  Number of Handles in ChildHandleBuffer. If number of\r
+                            children is zero stop the entire bus driver.\r
+  @param  ChildHandleBuffer List of Child Handles to Stop.\r
+\r
+  @retval EFI_SUCCESS       This driver is removed ControllerHandle\r
+  @retval other             This driver was not removed from this device\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 ConPlatformTextOutDriverBindingStop (\r
@@ -113,6 +211,14 @@ ConPlatformTextOutDriverBindingStop (
   IN  EFI_HANDLE                   *ChildHandleBuffer\r
   );\r
 \r
+/**\r
+  Uninstall the specified protocol.\r
+\r
+  @param This            Protocol instance pointer.\r
+  @param Handle          Handle of device to uninstall protocol on.\r
+  @param ProtocolGuid    The specified protocol need to be uninstalled.\r
+\r
+**/\r
 VOID\r
 ConPlatformUnInstallProtocol (\r
   IN  EFI_DRIVER_BINDING_PROTOCOL  *This,\r
@@ -120,19 +226,64 @@ ConPlatformUnInstallProtocol (
   IN  EFI_GUID                     *ProtocolGuid\r
   );\r
 \r
+/**\r
+  Read the EFI variable (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
+\r
+  @return Dynamically allocated memory that contains a copy of the EFI variable.\r
+          Caller is repsoncible freeing the buffer. Return NULL means Variable \r
+          was not read.\r
+\r
+**/\r
 VOID *\r
 ConPlatformGetVariable (\r
   IN  CHAR16              *Name\r
   );\r
 \r
+/**\r
+  Function compares a device path data structure to that of all the nodes of a\r
+  second device path instance.\r
+\r
+\r
+  @param Multi           A pointer to a multi-instance device path data structure.\r
+  @param Single          A pointer to a single-instance device path data structure.\r
+  @param NewDevicePath   If Delete is TRUE, this parameter must not be null, and it\r
+                         points to the remaining device path data structure.\r
+                         (remaining device path = Multi - Single.)\r
+  @param Delete          If TRUE, means removing Single from Multi.\r
+                         If FALSE, the routine just check whether Single matches\r
+                         with any instance in Multi.\r
+\r
+  @retval EFI_SUCCESS           If the Single is contained within Multi.\r
+  @retval EFI_NOT_FOUND         If the Single is not contained within Multi.\r
+  @retval EFI_INVALID_PARAMETER Multi is NULL.\r
+  @retval EFI_INVALID_PARAMETER Single is NULL.\r
+  @retval EFI_INVALID_PARAMETER NewDevicePath is NULL when Delete is TRUE.\r
+\r
+**/\r
 EFI_STATUS\r
 ConPlatformMatchDevicePaths (\r
-  IN  EFI_DEVICE_PATH_PROTOCOL  * Multi,\r
-  IN  EFI_DEVICE_PATH_PROTOCOL  * Single,\r
-  IN  EFI_DEVICE_PATH_PROTOCOL  **NewDevicePath OPTIONAL,\r
+  IN  EFI_DEVICE_PATH_PROTOCOL  *Multi,\r
+  IN  EFI_DEVICE_PATH_PROTOCOL  *Single,\r
+  OUT EFI_DEVICE_PATH_PROTOCOL  **NewDevicePath OPTIONAL,\r
   IN  BOOLEAN                   Delete\r
   );\r
 \r
+/**\r
+  Update console environment variables.\r
+\r
+  @param  VariableName    Console environment variables, ConOutDev, ConInDev\r
+                          StdErrDev, ConIn or ConOut.\r
+  @param  DevicePath      Console devcie's device path.\r
+  @param  Operation       Variable operations, including APPEND, CHECK and DELETE.\r
+\r
+  @retval EFI_SUCCESS           Variable operates successfully.\r
+  @retval EFI_OUT_OF_RESOURCES  If variable cannot be appended.\r
+  @retval other                 Variable updating failed.\r
+\r
+**/\r
 EFI_STATUS\r
 ConPlatformUpdateDeviceVariable (\r
   IN  CHAR16                    *VariableName,\r
@@ -140,10 +291,21 @@ ConPlatformUpdateDeviceVariable (
   IN  CONPLATFORM_VAR_OPERATION Operation\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
-  EFI_HANDLE    DriverBindingHandle,\r
-  EFI_HANDLE    ControllerHandle\r
+  IN  EFI_DEVICE_PATH_PROTOCOL    *DevicePath\r
   );\r
 \r
 //\r
@@ -161,7 +323,6 @@ IsHotPlugDevice (
 \r
   @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
                                 EFI_COMPONENT_NAME_PROTOCOL instance.\r
-\r
   @param  Language[in]          A pointer to a Null-terminated ASCII string\r
                                 array indicating the language. This is the\r
                                 language of the driver name that the caller is\r
@@ -169,8 +330,7 @@ IsHotPlugDevice (
                                 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
-\r
+                                in RFC 4646 or ISO 639-2 language code format.\r
   @param  DriverName[out]       A pointer to the Unicode string to return.\r
                                 This Unicode string is the name of the\r
                                 driver specified by This in the language\r
@@ -179,11 +339,8 @@ IsHotPlugDevice (
   @retval EFI_SUCCESS           The Unicode string for the Driver specified by\r
                                 This and the language specified by Language was\r
                                 returned in DriverName.\r
-\r
   @retval EFI_INVALID_PARAMETER Language is NULL.\r
-\r
   @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
-\r
   @retval EFI_UNSUPPORTED       The driver specified by This does not support\r
                                 the language specified by Language.\r
 \r
@@ -212,12 +369,10 @@ ConPlatformComponentNameGetDriverName (
 \r
   @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
                                 EFI_COMPONENT_NAME_PROTOCOL instance.\r
-\r
   @param  ControllerHandle[in]  The handle of a controller that the driver\r
                                 specified by This is managing.  This handle\r
                                 specifies the controller whose name is to be\r
                                 returned.\r
-\r
   @param  ChildHandle[in]       The handle of the child controller to retrieve\r
                                 the name of.  This is an optional parameter that\r
                                 may be NULL.  It will be NULL for device\r
@@ -226,7 +381,6 @@ ConPlatformComponentNameGetDriverName (
                                 controller.  It will not be NULL for a bus\r
                                 driver that wishes to retrieve the name of a\r
                                 child controller.\r
-\r
   @param  Language[in]          A pointer to a Null-terminated ASCII string\r
                                 array indicating the language.  This is the\r
                                 language of the driver name that the caller is\r
@@ -234,8 +388,7 @@ ConPlatformComponentNameGetDriverName (
                                 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
-\r
+                                RFC 4646 or ISO 639-2 language code format.\r
   @param  ControllerName[out]   A pointer to the Unicode string to return.\r
                                 This Unicode string is the name of the\r
                                 controller specified by ControllerHandle and\r
@@ -247,20 +400,14 @@ ConPlatformComponentNameGetDriverName (
                                 the language specified by Language for the\r
                                 driver specified by This was returned in\r
                                 DriverName.\r
-\r
   @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
-\r
   @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
                                 EFI_HANDLE.\r
-\r
   @retval EFI_INVALID_PARAMETER Language is NULL.\r
-\r
   @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
-\r
   @retval EFI_UNSUPPORTED       The driver specified by This is not currently\r
                                 managing the controller specified by\r
                                 ControllerHandle and ChildHandle.\r
-\r
   @retval EFI_UNSUPPORTED       The driver specified by This does not support\r
                                 the language specified by Language.\r
 \r