+++ /dev/null
-/** @file\r
- The platform device manager reference implement\r
-\r
-Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>\r
-SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-#ifndef _DEVICE_MANAGER_H_\r
-#define _DEVICE_MANAGER_H_\r
-\r
-#include "Bds.h"\r
-#include "FrontPage.h"\r
-#include "DeviceManagerVfr.h"\r
-#include <Protocol/PciIo.h>\r
-\r
-#define DEVICE_MANAGER_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('D', 'M', 'C', 'B')\r
-#define DEVICE_MANAGER_DRIVER_HEALTH_INFO_SIGNATURE SIGNATURE_32 ('D', 'M', 'D', 'H')\r
-\r
-\r
-typedef struct {\r
- UINTN Signature;\r
-\r
- ///\r
- /// Device Manager HII relative handles\r
- ///\r
- EFI_HII_HANDLE HiiHandle;\r
-\r
- ///\r
- /// Driver Health HII relative handles\r
- ///\r
- EFI_HII_HANDLE DriverHealthHiiHandle;\r
-\r
- EFI_HANDLE DriverHandle;\r
- EFI_HANDLE DriverHealthHandle;\r
-\r
- ///\r
- /// Device Manager Produced protocols\r
- ///\r
- EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;\r
-\r
- ///\r
- /// Driver Health Produced protocols\r
- ///\r
- EFI_HII_CONFIG_ACCESS_PROTOCOL DriverHealthConfigAccess;\r
-\r
- ///\r
- /// Configuration data\r
- ///\r
- UINT8 VideoBios;\r
-} DEVICE_MANAGER_CALLBACK_DATA;\r
-\r
-\r
-typedef struct {\r
- UINTN Signature;\r
- LIST_ENTRY Link;\r
-\r
- ///\r
- /// HII relative handles\r
- ///\r
- EFI_HII_HANDLE HiiHandle;\r
-\r
- ///\r
- /// Driver relative handles\r
- ///\r
- EFI_HANDLE DriverHandle;\r
- EFI_HANDLE ControllerHandle;\r
- EFI_HANDLE ChildHandle;\r
-\r
- EFI_DRIVER_HEALTH_PROTOCOL *DriverHealth;\r
- ///\r
- /// Driver health messages of the specify Driver\r
- ///\r
- EFI_DRIVER_HEALTH_HII_MESSAGE *MessageList;\r
-\r
- ///\r
- /// Driver Health status\r
- ///\r
- EFI_DRIVER_HEALTH_STATUS HealthStatus;\r
-} DRIVER_HEALTH_INFO;\r
-\r
-typedef struct {\r
- EFI_STRING_ID PromptId;\r
- EFI_QUESTION_ID QuestionId;\r
-}MENU_INFO_ITEM;\r
-\r
-typedef struct {\r
- UINTN CurListLen;\r
- UINTN MaxListLen;\r
- MENU_INFO_ITEM *NodeList;\r
-} MAC_ADDRESS_NODE_LIST;\r
-\r
-#define DEVICE_MANAGER_HEALTH_INFO_FROM_LINK(a) \\r
- CR (a, \\r
- DRIVER_HEALTH_INFO, \\r
- Link, \\r
- DEVICE_MANAGER_DRIVER_HEALTH_INFO_SIGNATURE \\r
- )\r
-\r
-#define DEVICE_MANAGER_CALLBACK_DATA_FROM_THIS(a) \\r
- CR (a, \\r
- DEVICE_MANAGER_CALLBACK_DATA, \\r
- ConfigAccess, \\r
- DEVICE_MANAGER_CALLBACK_DATA_SIGNATURE \\r
- )\r
-typedef struct {\r
- EFI_STRING_ID StringId;\r
- UINT16 Class;\r
-} DEVICE_MANAGER_MENU_ITEM;\r
-\r
-/**\r
- This function is invoked if user selected a interactive opcode from Device Manager's\r
- Formset. The decision by user is saved to gCallbackKey for later processing. If\r
- user set VBIOS, the new value is saved to EFI variable.\r
-\r
-\r
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
- @param Action Specifies the type of action taken by the browser.\r
- @param QuestionId A unique value which is sent to the original exporting driver\r
- so that it can identify the type of data to expect.\r
- @param Type The type of value for the question.\r
- @param Value A pointer to the data being sent to the original exporting driver.\r
- @param ActionRequest On return, points to the action requested by the callback function.\r
-\r
- @retval EFI_SUCCESS The callback successfully handled the action.\r
- @retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-DeviceManagerCallback (\r
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
- IN EFI_BROWSER_ACTION Action,\r
- IN EFI_QUESTION_ID QuestionId,\r
- IN UINT8 Type,\r
- IN EFI_IFR_TYPE_VALUE *Value,\r
- OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest\r
- );\r
-\r
-/**\r
- This function is invoked if user selected a interactive opcode from Driver Health's\r
- Formset. The decision by user is saved to gCallbackKey for later processing.\r
-\r
-\r
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
- @param Action Specifies the type of action taken by the browser.\r
- @param QuestionId A unique value which is sent to the original exporting driver\r
- so that it can identify the type of data to expect.\r
- @param Type The type of value for the question.\r
- @param Value A pointer to the data being sent to the original exporting driver.\r
- @param ActionRequest On return, points to the action requested by the callback function.\r
-\r
- @retval EFI_SUCCESS The callback successfully handled the action.\r
- @retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-DriverHealthCallback (\r
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
- IN EFI_BROWSER_ACTION Action,\r
- IN EFI_QUESTION_ID QuestionId,\r
- IN UINT8 Type,\r
- IN EFI_IFR_TYPE_VALUE *Value,\r
- OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest\r
- );\r
-\r
-\r
-/**\r
-\r
- This function registers HII packages to HII database.\r
-\r
- @retval EFI_SUCCESS HII packages for the Device Manager were registered successfully.\r
- @retval EFI_OUT_OF_RESOURCES HII packages for the Device Manager failed to be registered.\r
-\r
-**/\r
-EFI_STATUS\r
-InitializeDeviceManager (\r
- VOID\r
- );\r
-\r
-/**\r
-\r
- Call the browser and display the device manager to allow user\r
- to configure the platform.\r
-\r
- This function create the dynamic content for device manager. It includes\r
- section header for all class of devices, one-of opcode to set VBIOS.\r
-\r
- @retval EFI_SUCCESS Operation is successful.\r
- @retval Other values if failed to clean up the dynamic content from HII\r
- database.\r
-\r
-**/\r
-EFI_STATUS\r
-CallDeviceManager (\r
- VOID\r
- );\r
-\r
-\r
-/**\r
- Check the Driver Health status of a single controller and try to process it if not healthy.\r
-\r
- This function called by CheckAllControllersHealthStatus () function in order to process a specify\r
- contoller's health state.\r
-\r
- @param DriverHealthList A Pointer to the list contain all of the platform driver health information.\r
- @param DriverHandle The handle of driver.\r
- @param ControllerHandle The class guid specifies which form set will be displayed.\r
- @param ChildHandle The handle of the child controller to retrieve the health\r
- status on. This is an optional parameter that may be NULL.\r
- @param DriverHealth A pointer to the EFI_DRIVER_HEALTH_PROTOCOL instance.\r
- @param HealthStatus The health status of the controller.\r
-\r
- @retval EFI_INVALID_PARAMETER HealthStatus or DriverHealth is NULL.\r
- @retval HealthStatus The Health status of specify controller.\r
- @retval EFI_OUT_OF_RESOURCES The list of Driver Health Protocol handles can not be retrieved.\r
- @retval EFI_NOT_FOUND No controller in the platform install Driver Health Protocol.\r
- @retval EFI_SUCCESS The Health related operation has been taken successfully.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-GetSingleControllerHealthStatus (\r
- IN OUT LIST_ENTRY *DriverHealthList,\r
- IN EFI_HANDLE DriverHandle,\r
- IN EFI_HANDLE ControllerHandle, OPTIONAL\r
- IN EFI_HANDLE ChildHandle, OPTIONAL\r
- IN EFI_DRIVER_HEALTH_PROTOCOL *DriverHealth,\r
- IN EFI_DRIVER_HEALTH_STATUS *HealthStatus\r
- );\r
-\r
-/**\r
- Collects all the EFI Driver Health Protocols currently present in the EFI Handle Database,\r
- and queries each EFI Driver Health Protocol to determine if one or more of the controllers\r
- managed by each EFI Driver Health Protocol instance are not healthy.\r
-\r
- @param DriverHealthList A Pointer to the list contain all of the platform driver health\r
- information.\r
-\r
- @retval EFI_NOT_FOUND No controller in the platform install Driver Health Protocol.\r
- @retval EFI_SUCCESS All the controllers in the platform are healthy.\r
- @retval EFI_OUT_OF_RESOURCES The list of Driver Health Protocol handles can not be retrieved.\r
-\r
-**/\r
-EFI_STATUS\r
-GetAllControllersHealthStatus (\r
- IN OUT LIST_ENTRY *DriverHealthList\r
- );\r
-\r
-/**\r
- Check the healthy status of the platform, this function will return immediately while found one driver\r
- in the platform are not healthy.\r
-\r
- @retval FALSE at least one driver in the platform are not healthy.\r
- @retval TRUE No controller install Driver Health Protocol,\r
- or all controllers in the platform are in healthy status.\r
-**/\r
-BOOLEAN\r
-PlaformHealthStatusCheck (\r
- VOID\r
- );\r
-\r
-/**\r
- Repair the whole platform.\r
-\r
- This function is the main entry for user choose "Repair All" in the front page.\r
- It will try to do recovery job till all the driver health protocol installed modules\r
- reach a terminal state.\r
-\r
- @param DriverHealthList A Pointer to the list contain all of the platform driver health\r
- information.\r
-\r
-**/\r
-VOID\r
-PlatformRepairAll (\r
- IN LIST_ENTRY *DriverHealthList\r
- );\r
-\r
-/**\r
- Processes a single controller using the EFI Driver Health Protocol associated with\r
- that controller. This algorithm continues to query the GetHealthStatus() service until\r
- one of the legal terminal states of the EFI Driver Health Protocol is reached. This may\r
- require the processing of HII Messages, HII Form, and invocation of repair operations.\r
-\r
- @param DriverHealth A pointer to the EFI_DRIVER_HEALTH_PROTOCOL instance.\r
- @param ControllerHandle The class guid specifies which form set will be displayed.\r
- @param ChildHandle The handle of the child controller to retrieve the health\r
- status on. This is an optional parameter that may be NULL.\r
- @param HealthStatus The health status of the controller.\r
- @param MessageList An array of warning or error messages associated\r
- with the controller specified by ControllerHandle and\r
- ChildHandle. This is an optional parameter that may be NULL.\r
- @param FormHiiHandle The HII handle for an HII form associated with the\r
- controller specified by ControllerHandle and ChildHandle.\r
- @param RebootRequired Indicate whether a reboot is required to repair the controller.\r
-**/\r
-VOID\r
-ProcessSingleControllerHealth (\r
- IN EFI_DRIVER_HEALTH_PROTOCOL *DriverHealth,\r
- IN EFI_HANDLE ControllerHandle, OPTIONAL\r
- IN EFI_HANDLE ChildHandle, OPTIONAL\r
- IN EFI_DRIVER_HEALTH_STATUS HealthStatus,\r
- IN EFI_DRIVER_HEALTH_HII_MESSAGE **MessageList, OPTIONAL\r
- IN EFI_HII_HANDLE FormHiiHandle,\r
- IN OUT BOOLEAN *RebootRequired\r
- );\r
-\r
-/**\r
- Reports the progress of a repair operation.\r
-\r
- @param[in] Value A value between 0 and Limit that identifies the current\r
- progress of the repair operation.\r
-\r
- @param[in] Limit The maximum value of Value for the current repair operation.\r
- For example, a driver that wants to specify progress in\r
- percent would use a Limit value of 100.\r
-\r
- @retval EFI_SUCCESS The progress of a repair operation is reported successfully.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-RepairNotify (\r
- IN UINTN Value,\r
- IN UINTN Limit\r
- );\r
-\r
-/**\r
- Processes a set of messages returned by the GetHealthStatus ()\r
- service of the EFI Driver Health Protocol\r
-\r
- @param MessageList The MessageList point to messages need to processed.\r
-\r
-**/\r
-VOID\r
-ProcessMessages (\r
- IN EFI_DRIVER_HEALTH_HII_MESSAGE *MessageList\r
- );\r
-\r
-\r
-/**\r
- Collect and display the platform's driver health relative information, allow user to do interactive\r
- operation while the platform is unhealthy.\r
-\r
- This function display a form which divided into two parts. The one list all modules which has installed\r
- driver health protocol. The list usually contain driver name, controller name, and it's health info.\r
- While the driver name can't be retrieved, will use device path as backup. The other part of the form provide\r
- a choice to the user to repair all platform.\r
-\r
-**/\r
-VOID\r
-CallDriverHealth (\r
- VOID\r
- );\r
-\r
-/**\r
-\r
- Select the best matching language according to front page policy for best user experience.\r
-\r
- This function supports both ISO 639-2 and RFC 4646 language codes, but language\r
- code types may not be mixed in a single call to this function.\r
-\r
- @param SupportedLanguages A pointer to a Null-terminated ASCII string that\r
- contains a set of language codes in the format\r
- specified by Iso639Language.\r
- @param Iso639Language If TRUE, then all language codes are assumed to be\r
- in ISO 639-2 format. If FALSE, then all language\r
- codes are assumed to be in RFC 4646 language format.\r
-\r
- @retval NULL The best matching language could not be found in SupportedLanguages.\r
- @retval NULL There are not enough resources available to return the best matching\r
- language.\r
- @retval Other A pointer to a Null-terminated ASCII string that is the best matching\r
- language in SupportedLanguages.\r
-**/\r
-CHAR8 *\r
-DriverHealthSelectBestLanguage (\r
- IN CHAR8 *SupportedLanguages,\r
- IN BOOLEAN Iso639Language\r
- );\r
-\r
-/**\r
-\r
- This is an internal worker function to get the Component Name (2) protocol interface\r
- and the language it supports.\r
-\r
- @param ProtocolGuid A pointer to an EFI_GUID. It points to Component Name (2) protocol GUID.\r
- @param DriverBindingHandle The handle on which the Component Name (2) protocol instance is retrieved.\r
- @param ComponentName A pointer to the Component Name (2) protocol interface.\r
- @param SupportedLanguage The best suitable language that matches the SupportedLangues interface for the\r
- located Component Name (2) instance.\r
-\r
- @retval EFI_SUCCESS The Component Name (2) protocol instance is successfully located and we find\r
- the best matching language it support.\r
- @retval EFI_UNSUPPORTED The input Language is not supported by the Component Name (2) protocol.\r
- @retval Other Some error occurs when locating Component Name (2) protocol instance or finding\r
- the supported language.\r
-\r
-**/\r
-EFI_STATUS\r
-GetComponentNameWorker (\r
- IN EFI_GUID *ProtocolGuid,\r
- IN EFI_HANDLE DriverBindingHandle,\r
- OUT EFI_COMPONENT_NAME_PROTOCOL **ComponentName,\r
- OUT CHAR8 **SupportedLanguage\r
- );\r
-\r
-/**\r
-\r
- This is an internal worker function to get driver name from Component Name (2) protocol interface.\r
-\r
-\r
- @param ProtocolGuid A pointer to an EFI_GUID. It points to Component Name (2) protocol GUID.\r
- @param DriverBindingHandle The handle on which the Component Name (2) protocol instance is retrieved.\r
- @param DriverName A pointer to the Unicode string to return. This Unicode string is the name\r
- of the driver specified by This.\r
-\r
- @retval EFI_SUCCESS The driver name is successfully retrieved from Component Name (2) protocol\r
- interface.\r
- @retval Other The driver name cannot be retrieved from Component Name (2) protocol\r
- interface.\r
-\r
-**/\r
-EFI_STATUS\r
-GetDriverNameWorker (\r
- IN EFI_GUID *ProtocolGuid,\r
- IN EFI_HANDLE DriverBindingHandle,\r
- OUT CHAR16 **DriverName\r
- );\r
-\r
-/**\r
-\r
- This function gets driver name from Component Name 2 protocol interface and Component Name protocol interface\r
- in turn. It first tries UEFI 2.0 Component Name 2 protocol interface and try to get the driver name.\r
- If the attempt fails, it then gets the driver name from EFI 1.1 Component Name protocol for backward\r
- compatibility support.\r
-\r
- @param DriverBindingHandle The handle on which the Component Name (2) protocol instance is retrieved.\r
- @param DriverName A pointer to the Unicode string to return. This Unicode string is the name\r
- of the driver specified by This.\r
-\r
- @retval EFI_SUCCESS The driver name is successfully retrieved from Component Name (2) protocol\r
- interface.\r
- @retval Other The driver name cannot be retrieved from Component Name (2) protocol\r
- interface.\r
-\r
-**/\r
-EFI_STATUS\r
-DriverHealthGetDriverName (\r
- IN EFI_HANDLE DriverBindingHandle,\r
- OUT CHAR16 **DriverName\r
- );\r
-\r
-/**\r
- This function gets controller name from Component Name 2 protocol interface and Component Name protocol interface\r
- in turn. It first tries UEFI 2.0 Component Name 2 protocol interface and try to get the controller name.\r
- If the attempt fails, it then gets the controller name from EFI 1.1 Component Name protocol for backward\r
- compatibility support.\r
-\r
- @param ProtocolGuid A pointer to an EFI_GUID. It points to Component Name (2) protocol GUID.\r
- @param DriverBindingHandle The handle on which the Component Name (2) protocol instance is retrieved.\r
- @param ControllerHandle The handle of a controller that the driver specified by This is managing.\r
- This handle specifies the controller whose name is to be returned.\r
- @param ChildHandle The handle of the child controller to retrieve the name of. This is an\r
- optional parameter that may be NULL. It will be NULL for device drivers.\r
- It will also be NULL for bus drivers that attempt to retrieve the name\r
- of the bus controller. It will not be NULL for a bus driver that attempts\r
- to retrieve the name of a child controller.\r
- @param ControllerName A pointer to the Unicode string to return. This Unicode string\r
- is the name of the controller specified by ControllerHandle and ChildHandle.\r
-\r
- @retval EFI_SUCCESS The controller name is successfully retrieved from Component Name (2) protocol\r
- interface.\r
- @retval Other The controller name cannot be retrieved from Component Name (2) protocol.\r
-\r
-**/\r
-EFI_STATUS\r
-GetControllerNameWorker (\r
- IN EFI_GUID *ProtocolGuid,\r
- IN EFI_HANDLE DriverBindingHandle,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_HANDLE ChildHandle,\r
- OUT CHAR16 **ControllerName\r
- );\r
-\r
-/**\r
- This function gets controller name from Component Name 2 protocol interface and Component Name protocol interface\r
- in turn. It first tries UEFI 2.0 Component Name 2 protocol interface and try to get the controller name.\r
- If the attempt fails, it then gets the controller name from EFI 1.1 Component Name protocol for backward\r
- compatibility support.\r
-\r
- @param DriverBindingHandle The handle on which the Component Name (2) protocol instance is retrieved.\r
- @param ControllerHandle The handle of a controller that the driver specified by This is managing.\r
- This handle specifies the controller whose name is to be returned.\r
- @param ChildHandle The handle of the child controller to retrieve the name of. This is an\r
- optional parameter that may be NULL. It will be NULL for device drivers.\r
- It will also be NULL for bus drivers that attempt to retrieve the name\r
- of the bus controller. It will not be NULL for a bus driver that attempts\r
- to retrieve the name of a child controller.\r
- @param ControllerName A pointer to the Unicode string to return. This Unicode string\r
- is the name of the controller specified by ControllerHandle and ChildHandle.\r
-\r
- @retval EFI_SUCCESS The controller name is successfully retrieved from Component Name (2) protocol\r
- interface.\r
- @retval Other The controller name cannot be retrieved from Component Name (2) protocol.\r
-\r
-**/\r
-EFI_STATUS\r
-DriverHealthGetControllerName (\r
- IN EFI_HANDLE DriverBindingHandle,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_HANDLE ChildHandle,\r
- OUT CHAR16 **ControllerName\r
- );\r
-\r
-#endif\r