1 /** @file
2   This module produces two driver health manager forms.
3   One will be used by BDS core to configure the Configured Required
4   driver health instances, the other will be automatically included by
5   firmware setup (UI).
6 
7 Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR>
8 SPDX-License-Identifier: BSD-2-Clause-Patent
9 
10 **/
11 
12 #ifndef _DRIVER_HEALTH_MANAGEMENT_DXE_H_
13 #define _DRIVER_HEALTH_MANAGEMENT_DXE_H_
14 
15 #include <Uefi.h>
16 #include <Base.h>
17 #include <Protocol/ComponentName.h>
18 #include <Protocol/DriverHealth.h>
19 #include <Protocol/HiiConfigAccess.h>
20 #include <Protocol/FormBrowser2.h>
21 #include <Protocol/HiiDatabase.h>
22 #include <Guid/MdeModuleHii.h>
23 
24 #include <Library/DebugLib.h>
25 #include <Library/UefiDriverEntryPoint.h>
26 #include <Library/UefiLib.h>
27 #include <Library/BaseLib.h>
28 #include <Library/BaseMemoryLib.h>
29 #include <Library/MemoryAllocationLib.h>
30 #include <Library/UefiBootServicesTableLib.h>
31 #include <Library/UefiRuntimeServicesTableLib.h>
32 #include <Library/UefiBootManagerLib.h>
33 #include <Library/HiiLib.h>
34 #include <Library/PrintLib.h>
35 #include <Library/DevicePathLib.h>
36 #include <Library/PcdLib.h>
37 
38 ///
39 /// HII specific Vendor Device Path definition.
40 ///
41 typedef struct {
42   VENDOR_DEVICE_PATH             VendorDevicePath;
43   EFI_DEVICE_PATH_PROTOCOL       End;
44 } FORM_DEVICE_PATH;
45 
46 /**
47   This function is invoked if user selected a interactive opcode from Driver Health's
48   Formset. The decision by user is saved to gCallbackKey for later processing.
49 
50   @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
51   @param Action          Specifies the type of action taken by the browser.
52   @param QuestionId      A unique value which is sent to the original exporting driver
53                          so that it can identify the type of data to expect.
54   @param Type            The type of value for the question.
55   @param Value           A pointer to the data being sent to the original exporting driver.
56   @param ActionRequest   On return, points to the action requested by the callback function.
57 
58   @retval  EFI_SUCCESS           The callback successfully handled the action.
59   @retval  EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.
60 
61 **/
62 EFI_STATUS
63 EFIAPI
64 DriverHealthManagerCallback (
65   IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,
66   IN  EFI_BROWSER_ACTION                     Action,
67   IN  EFI_QUESTION_ID                        QuestionId,
68   IN  UINT8                                  Type,
69   IN  EFI_IFR_TYPE_VALUE                     *Value,
70   OUT EFI_BROWSER_ACTION_REQUEST             *ActionRequest
71   );
72 
73 /**
74   This function allows a caller to extract the current configuration for one
75   or more named elements from the target driver.
76 
77 
78   @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
79   @param Request         A null-terminated Unicode string in <ConfigRequest> format.
80   @param Progress        On return, points to a character in the Request string.
81                          Points to the string's null terminator if request was successful.
82                          Points to the most recent '&' before the first failing name/value
83                          pair (or the beginning of the string if the failure is in the
84                          first name/value pair) if the request was not successful.
85   @param Results         A null-terminated Unicode string in <ConfigAltResp> format which
86                          has all values filled in for the names in the Request string.
87                          String to be allocated by the called function.
88 
89   @retval  EFI_SUCCESS            The Results is filled with the requested values.
90   @retval  EFI_OUT_OF_RESOURCES   Not enough memory to store the results.
91   @retval  EFI_INVALID_PARAMETER  Request is illegal syntax, or unknown name.
92   @retval  EFI_NOT_FOUND          Routing data doesn't match any storage in this driver.
93 
94 **/
95 EFI_STATUS
96 EFIAPI
97 DriverHealthManagerFakeExtractConfig (
98   IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,
99   IN  CONST EFI_STRING                       Request,
100   OUT EFI_STRING                             *Progress,
101   OUT EFI_STRING                             *Results
102   );
103 
104 /**
105   This function processes the results of changes in configuration.
106 
107 
108   @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
109   @param Configuration   A null-terminated Unicode string in <ConfigResp> format.
110   @param Progress        A pointer to a string filled in with the offset of the most
111                          recent '&' before the first failing name/value pair (or the
112                          beginning of the string if the failure is in the first
113                          name/value pair) or the terminating NULL if all was successful.
114 
115   @retval  EFI_SUCCESS            The Results is processed successfully.
116   @retval  EFI_INVALID_PARAMETER  Configuration is NULL.
117   @retval  EFI_NOT_FOUND          Routing data doesn't match any storage in this driver.
118 
119 **/
120 EFI_STATUS
121 EFIAPI
122 DriverHealthManagerFakeRouteConfig (
123   IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,
124   IN  CONST EFI_STRING                       Configuration,
125   OUT EFI_STRING                             *Progress
126   );
127 #endif
128