-/*++\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
//\r
// Driver Binding Externs\r
//\r
-extern EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextInDriverBinding;\r
-extern EFI_COMPONENT_NAME_PROTOCOL gConPlatformComponentName;\r
-extern EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextOutDriverBinding;\r
-extern EFI_COMPONENT_NAME_PROTOCOL gConPlatformComponentName;\r
-\r
-#define VarConsoleInpDev L"ConInDev"\r
-#define VarConsoleInp L"ConIn"\r
-#define VarConsoleOutDev L"ConOutDev"\r
-#define VarConsoleOut L"ConOut"\r
-#define VarErrorOutDev L"ErrOutDev"\r
-#define VarErrorOut L"ErrOut"\r
+extern EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextInDriverBinding;\r
+extern EFI_COMPONENT_NAME_PROTOCOL gConPlatformComponentName;\r
+extern EFI_COMPONENT_NAME2_PROTOCOL gConPlatformComponentName2;\r
+extern EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextOutDriverBinding;\r
+extern EFI_COMPONENT_NAME_PROTOCOL gConPlatformComponentName;\r
+extern EFI_COMPONENT_NAME2_PROTOCOL gConPlatformComponentName2;\r
+\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
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
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
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
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
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
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
// EFI Component Name Functions\r
//\r
+/**\r
+ Retrieves a Unicode string that is the user readable name of the driver.\r
+\r
+ This function retrieves the user readable name of a driver in the form of a\r
+ Unicode string. If the driver specified by This has a user readable name in\r
+ the language specified by Language, then a pointer to the driver name is\r
+ returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
+ by This does not support the language specified by Language,\r
+ then EFI_UNSUPPORTED is returned.\r
+\r
+ @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+ EFI_COMPONENT_NAME_PROTOCOL instance.\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
+ requesting, and it must match one of the\r
+ 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 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
+ specified by Language.\r
+\r
+ @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
+ @retval EFI_INVALID_PARAMETER Language is NULL.\r
+ @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
+ @retval EFI_UNSUPPORTED The driver specified by This does not support\r
+ the language specified by Language.\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
ConPlatformComponentNameGetDriverName (\r
OUT CHAR16 **DriverName\r
);\r
\r
+\r
+/**\r
+ Retrieves a Unicode string that is the user readable name of the controller\r
+ that is being managed by a driver.\r
+\r
+ This function retrieves the user readable name of the controller specified by\r
+ ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
+ driver specified by This has a user readable name in the language specified by\r
+ Language, then a pointer to the controller name is returned in ControllerName,\r
+ and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
+ managing the controller specified by ControllerHandle and ChildHandle,\r
+ then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
+ support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
+\r
+ @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+ EFI_COMPONENT_NAME_PROTOCOL instance.\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
+ @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
+ drivers. It will also be NULL for a bus drivers\r
+ that wish to retrieve the name of the bus\r
+ controller. It will not be NULL for a bus\r
+ driver that wishes to retrieve the name of a\r
+ child controller.\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
+ requesting, and it must match one of the\r
+ 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 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
+ ChildHandle in the language specified by\r
+ Language from the point of view of the driver\r
+ specified by This.\r
+\r
+ @retval EFI_SUCCESS The Unicode string for the user readable name in\r
+ the language specified by Language for the\r
+ driver specified by This was returned in\r
+ DriverName.\r
+ @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
+ @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
+ EFI_HANDLE.\r
+ @retval EFI_INVALID_PARAMETER Language is NULL.\r
+ @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
+ @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
+ managing the controller specified by\r
+ ControllerHandle and ChildHandle.\r
+ @retval EFI_UNSUPPORTED The driver specified by This does not support\r
+ the language specified by Language.\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
ConPlatformComponentNameGetControllerName (\r
OUT CHAR16 **ControllerName\r
);\r
\r
+\r
#endif\r