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 This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution.  The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
12 
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 
16 **/
17 
18 #ifndef _DRIVER_HEALTH_MANAGEMENT_DXE_H_
19 #define _DRIVER_HEALTH_MANAGEMENT_DXE_H_
20 
21 #include <Uefi.h>
22 #include <Base.h>
23 #include <Protocol/ComponentName.h>
24 #include <Protocol/DriverHealth.h>
25 #include <Protocol/HiiConfigAccess.h>
26 #include <Protocol/FormBrowser2.h>
27 #include <Protocol/HiiDatabase.h>
28 #include <Guid/MdeModuleHii.h>
29 
30 #include <Library/DebugLib.h>
31 #include <Library/UefiDriverEntryPoint.h>
32 #include <Library/UefiLib.h>
33 #include <Library/BaseLib.h>
34 #include <Library/BaseMemoryLib.h>
35 #include <Library/MemoryAllocationLib.h>
36 #include <Library/UefiBootServicesTableLib.h>
37 #include <Library/UefiRuntimeServicesTableLib.h>
38 #include <Library/UefiBootManagerLib.h>
39 #include <Library/HiiLib.h>
40 #include <Library/PrintLib.h>
41 #include <Library/DevicePathLib.h>
42 #include <Library/PcdLib.h>
43 
44 ///
45 /// HII specific Vendor Device Path definition.
46 ///
47 typedef struct {
48   VENDOR_DEVICE_PATH             VendorDevicePath;
49   EFI_DEVICE_PATH_PROTOCOL       End;
50 } FORM_DEVICE_PATH;
51 
52 /**
53   This function is invoked if user selected a interactive opcode from Driver Health's
54   Formset. The decision by user is saved to gCallbackKey for later processing.
55 
56   @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
57   @param Action          Specifies the type of action taken by the browser.
58   @param QuestionId      A unique value which is sent to the original exporting driver
59                          so that it can identify the type of data to expect.
60   @param Type            The type of value for the question.
61   @param Value           A pointer to the data being sent to the original exporting driver.
62   @param ActionRequest   On return, points to the action requested by the callback function.
63 
64   @retval  EFI_SUCCESS           The callback successfully handled the action.
65   @retval  EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.
66 
67 **/
68 EFI_STATUS
69 EFIAPI
70 DriverHealthManagerCallback (
71   IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,
72   IN  EFI_BROWSER_ACTION                     Action,
73   IN  EFI_QUESTION_ID                        QuestionId,
74   IN  UINT8                                  Type,
75   IN  EFI_IFR_TYPE_VALUE                     *Value,
76   OUT EFI_BROWSER_ACTION_REQUEST             *ActionRequest
77   );
78 
79 /**
80   This function allows a caller to extract the current configuration for one
81   or more named elements from the target driver.
82 
83 
84   @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
85   @param Request         A null-terminated Unicode string in <ConfigRequest> format.
86   @param Progress        On return, points to a character in the Request string.
87                          Points to the string's null terminator if request was successful.
88                          Points to the most recent '&' before the first failing name/value
89                          pair (or the beginning of the string if the failure is in the
90                          first name/value pair) if the request was not successful.
91   @param Results         A null-terminated Unicode string in <ConfigAltResp> format which
92                          has all values filled in for the names in the Request string.
93                          String to be allocated by the called function.
94 
95   @retval  EFI_SUCCESS            The Results is filled with the requested values.
96   @retval  EFI_OUT_OF_RESOURCES   Not enough memory to store the results.
97   @retval  EFI_INVALID_PARAMETER  Request is illegal syntax, or unknown name.
98   @retval  EFI_NOT_FOUND          Routing data doesn't match any storage in this driver.
99 
100 **/
101 EFI_STATUS
102 EFIAPI
103 DriverHealthManagerFakeExtractConfig (
104   IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,
105   IN  CONST EFI_STRING                       Request,
106   OUT EFI_STRING                             *Progress,
107   OUT EFI_STRING                             *Results
108   );
109 
110 /**
111   This function processes the results of changes in configuration.
112 
113 
114   @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
115   @param Configuration   A null-terminated Unicode string in <ConfigResp> format.
116   @param Progress        A pointer to a string filled in with the offset of the most
117                          recent '&' before the first failing name/value pair (or the
118                          beginning of the string if the failure is in the first
119                          name/value pair) or the terminating NULL if all was successful.
120 
121   @retval  EFI_SUCCESS            The Results is processed successfully.
122   @retval  EFI_INVALID_PARAMETER  Configuration is NULL.
123   @retval  EFI_NOT_FOUND          Routing data doesn't match any storage in this driver.
124 
125 **/
126 EFI_STATUS
127 EFIAPI
128 DriverHealthManagerFakeRouteConfig (
129   IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,
130   IN  CONST EFI_STRING                       Configuration,
131   OUT EFI_STRING                             *Progress
132   );
133 #endif
134