]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.h
MdeModulePkg/ConPlatform: Support GOP created as PCI's grandson
[mirror_edk2.git] / MdeModulePkg / Universal / Console / ConPlatformDxe / ConPlatform.h
index d3adcc56a57f22885a1bee02e529ff6b1119c2d0..6d853c136010a1157d541f317a1029b1d23ccb9d 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   Header file for Console Platfrom DXE Driver.\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2017, 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
@@ -12,18 +12,21 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \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 <Protocol/DevicePath.h>\r
+#include <Protocol/SimpleTextIn.h>\r
+#include <Protocol/PciIo.h>\r
+#include <Protocol/GraphicsOutput.h>\r
+\r
 #include <Guid/GlobalVariable.h>\r
 #include <Guid/ConsoleInDevice.h>\r
 #include <Guid/StandardErrorDevice.h>\r
 #include <Guid/ConsoleOutDevice.h>\r
-#include <Protocol/DevicePath.h>\r
-#include <Protocol/SimpleTextIn.h>\r
-#include <Guid/HotPlugDevice.h>\r
 \r
 #include <Library/DebugLib.h>\r
 #include <Library/UefiDriverEntryPoint.h>\r
@@ -33,6 +36,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/UefiRuntimeServicesTableLib.h>\r
 #include <Library/DevicePathLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
+#include <Library/UefiBootManagerLib.h>\r
 \r
 //\r
 // Driver Binding Externs\r
@@ -46,18 +50,16 @@ 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
+  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  RemainingDevicePath Optional parameter use to pick a specific child\r
-                              device to start.\r
   @param  ProtocolGuid        The specfic protocol.\r
 \r
   @retval EFI_SUCCESS         This driver supports this device\r
@@ -68,20 +70,19 @@ EFI_STATUS
 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 Text In Protocol could be supported on the ControllerHandle. \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
+  @retval EFI_SUCCESS         This driver supports this device.\r
+  @retval other               This driver does not support this device.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -89,19 +90,19 @@ EFIAPI
 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 Text Out Protocol could be supported on the ControllerHandle. \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
+  @retval EFI_SUCCESS         This driver supports this device.\r
+  @retval other               This driver does not support this device.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -109,11 +110,13 @@ EFIAPI
 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 ControllerHandle by opening Simple Text In protocol,\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
@@ -126,7 +129,7 @@ ConPlatformTextOutDriverBindingSupported (
 \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
+  @retval other                This driver does not support this device.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -138,8 +141,10 @@ ConPlatformTextInDriverBindingStart (
   );\r
 \r
 /**\r
-  Start this driver on ControllerHandle by opening Simple Text Out protocol,\r
-  reading Device Path, and installing Console Out Devcice GUID, Standard Error\r
+  Start this driver on the device for console output and standard 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
@@ -165,7 +170,7 @@ ConPlatformTextOutDriverBindingStart (
 \r
 /**\r
   Stop this driver on ControllerHandle by removing Console In Devcice GUID \r
-  and closing the Simple Text In protocol on ControllerHandle.\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
@@ -188,7 +193,7 @@ ConPlatformTextInDriverBindingStop (
 \r
 /**\r
   Stop this driver on ControllerHandle by removing Console Out Devcice GUID \r
-  and closing the Simple Text Out protocol on ControllerHandle.\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
@@ -210,13 +215,11 @@ ConPlatformTextOutDriverBindingStop (
   );\r
 \r
 /**\r
-  Unstall the specific protocol.\r
+  Uninstall the specified protocol.\r
 \r
   @param This            Protocol instance pointer.\r
-  @param Handle          Handle of device to unstall protocol on.\r
-  @param ProtocolGuid    The specific protocol need to be uninstalled.\r
-\r
-  @return None.\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
@@ -230,12 +233,11 @@ ConPlatformUnInstallProtocol (
   Read the EFI variable (Name) and return a dynamically allocated\r
   buffer, and the size of the buffer. On failure return NULL.\r
 \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.\r
-          NULL - Variable was not read\r
+          Caller is repsoncible freeing the buffer. Return NULL means Variable \r
+          was not read.\r
 \r
 **/\r
 VOID *\r
@@ -257,25 +259,28 @@ ConPlatformGetVariable (
                          If FALSE, the routine just check whether Single matches\r
                          with any instance in Multi.\r
 \r
-  @return The function returns EFI_SUCCESS if the Single is contained within Multi.\r
-          Otherwise, EFI_NOT_FOUND is returned.\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
+  OUT EFI_DEVICE_PATH_PROTOCOL  **NewDevicePath OPTIONAL,\r
   IN  BOOLEAN                   Delete\r
   );\r
 \r
 /**\r
-  Update console devicein console environment variables. \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, such as APPEND or DELETE.\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
@@ -290,10 +295,12 @@ ConPlatformUpdateDeviceVariable (
   );\r
 \r
 /**\r
-  Check if the device is one hot-plug supported.\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  DriverBindingHandle   Protocol instance pointer.\r
-  @param  ControllerHandle      Handle of device to check.\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
@@ -301,8 +308,7 @@ ConPlatformUpdateDeviceVariable (
 **/\r
 BOOLEAN\r
 IsHotPlugDevice (\r
-  EFI_HANDLE    DriverBindingHandle,\r
-  EFI_HANDLE    ControllerHandle\r
+  IN  EFI_DEVICE_PATH_PROTOCOL    *DevicePath\r
   );\r
 \r
 //\r
@@ -320,7 +326,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
@@ -328,8 +333,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
@@ -338,11 +342,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
@@ -371,12 +372,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
@@ -385,7 +384,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
@@ -393,8 +391,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
@@ -406,20 +403,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 ControllerHandle is NULL.\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
@@ -434,5 +425,19 @@ ConPlatformComponentNameGetControllerName (
   OUT CHAR16                                          **ControllerName\r
   );\r
 \r
+/**\r
+  Update ConOutDev and ErrOutDev variables to add the device path of\r
+  GOP controller itself and the sibling controllers.\r
+\r
+  @param  DevicePath            Pointer to device's device path.\r
+\r
+  @retval TRUE                  The devcie is a GOP device.\r
+  @retval FALSE                 The devcie is not a GOP device.\r
+\r
+**/\r
+BOOLEAN\r
+ConPlatformUpdateGopCandidate (\r
+  IN  EFI_DEVICE_PATH_PROTOCOL    *DevicePath\r
+  );\r
 \r
 #endif\r