]>
Commit | Line | Data |
---|---|---|
3bb5c813 RN |
1 | /** @file\r |
2 | This module produces two driver health manager forms.\r | |
3 | One will be used by BDS core to configure the Configured Required\r | |
4 | driver health instances, the other will be automatically included by\r | |
5 | firmware setup (UI).\r | |
6 | \r | |
d1102dba | 7 | Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>\r |
54b7f3cf | 8 | (C) Copyright 2018 Hewlett Packard Enterprise Development LP<BR>\r |
3bb5c813 RN |
9 | This program and the accompanying materials\r |
10 | are licensed and made available under the terms and conditions of the BSD License\r | |
11 | which accompanies this distribution. The full text of the license may be found at\r | |
12 | http://opensource.org/licenses/bsd-license.php\r | |
13 | \r | |
14 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
15 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
16 | \r | |
17 | **/\r | |
18 | \r | |
19 | #include "DriverHealthManagerDxe.h"\r | |
20 | #include "DriverHealthManagerVfr.h"\r | |
21 | \r | |
22 | EFI_HII_CONFIG_ACCESS_PROTOCOL mDriverHealthManagerConfigAccess = {\r | |
23 | DriverHealthManagerFakeExtractConfig,\r | |
24 | DriverHealthManagerFakeRouteConfig,\r | |
25 | DriverHealthManagerCallback\r | |
26 | };\r | |
27 | \r | |
28 | EFI_GUID mDriverHealthManagerForm = DRIVER_HEALTH_MANAGER_FORMSET_GUID;\r | |
29 | \r | |
30 | FORM_DEVICE_PATH mDriverHealthManagerFormDevicePath = {\r | |
31 | {\r | |
32 | {\r | |
33 | HARDWARE_DEVICE_PATH,\r | |
34 | HW_VENDOR_DP,\r | |
35 | {\r | |
36 | (UINT8) (sizeof (VENDOR_DEVICE_PATH)),\r | |
37 | (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)\r | |
38 | }\r | |
39 | },\r | |
40 | EFI_CALLER_ID_GUID\r | |
41 | },\r | |
42 | {\r | |
43 | END_DEVICE_PATH_TYPE,\r | |
44 | END_ENTIRE_DEVICE_PATH_SUBTYPE,\r | |
45 | {\r | |
46 | (UINT8) (END_DEVICE_PATH_LENGTH),\r | |
47 | (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)\r | |
48 | }\r | |
49 | }\r | |
50 | };\r | |
51 | \r | |
52 | EFI_HII_HANDLE mDriverHealthManagerHiiHandle;\r | |
53 | EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO *mDriverHealthManagerHealthInfo = NULL;\r | |
54 | UINTN mDriverHealthManagerHealthInfoCount = 0;\r | |
55 | EFI_HII_DATABASE_PROTOCOL *mDriverHealthManagerDatabase;\r | |
56 | \r | |
57 | \r | |
58 | extern UINT8 DriverHealthManagerVfrBin[];\r | |
59 | extern UINT8 DriverHealthConfigureVfrBin[];\r | |
60 | \r | |
61 | /**\r | |
62 | This function allows a caller to extract the current configuration for one\r | |
63 | or more named elements from the target driver.\r | |
64 | \r | |
65 | \r | |
66 | @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r | |
67 | @param Request A null-terminated Unicode string in <ConfigRequest> format.\r | |
68 | @param Progress On return, points to a character in the Request string.\r | |
69 | Points to the string's null terminator if request was successful.\r | |
70 | Points to the most recent '&' before the first failing name/value\r | |
71 | pair (or the beginning of the string if the failure is in the\r | |
72 | first name/value pair) if the request was not successful.\r | |
73 | @param Results A null-terminated Unicode string in <ConfigAltResp> format which\r | |
74 | has all values filled in for the names in the Request string.\r | |
75 | String to be allocated by the called function.\r | |
76 | \r | |
77 | @retval EFI_SUCCESS The Results is filled with the requested values.\r | |
78 | @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.\r | |
79 | @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name.\r | |
80 | @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.\r | |
81 | \r | |
82 | **/\r | |
83 | EFI_STATUS\r | |
84 | EFIAPI\r | |
85 | DriverHealthManagerFakeExtractConfig (\r | |
86 | IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r | |
87 | IN CONST EFI_STRING Request,\r | |
88 | OUT EFI_STRING *Progress,\r | |
89 | OUT EFI_STRING *Results\r | |
90 | )\r | |
91 | {\r | |
92 | if (Progress == NULL || Results == NULL) {\r | |
93 | return EFI_INVALID_PARAMETER;\r | |
94 | }\r | |
95 | *Progress = Request;\r | |
96 | return EFI_NOT_FOUND;\r | |
97 | }\r | |
98 | \r | |
99 | /**\r | |
100 | This function processes the results of changes in configuration.\r | |
101 | \r | |
102 | \r | |
103 | @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r | |
104 | @param Configuration A null-terminated Unicode string in <ConfigResp> format.\r | |
105 | @param Progress A pointer to a string filled in with the offset of the most\r | |
106 | recent '&' before the first failing name/value pair (or the\r | |
107 | beginning of the string if the failure is in the first\r | |
108 | name/value pair) or the terminating NULL if all was successful.\r | |
109 | \r | |
110 | @retval EFI_SUCCESS The Results is processed successfully.\r | |
111 | @retval EFI_INVALID_PARAMETER Configuration is NULL.\r | |
112 | @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.\r | |
113 | \r | |
114 | **/\r | |
115 | EFI_STATUS\r | |
116 | EFIAPI\r | |
117 | DriverHealthManagerFakeRouteConfig (\r | |
118 | IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r | |
119 | IN CONST EFI_STRING Configuration,\r | |
120 | OUT EFI_STRING *Progress\r | |
121 | )\r | |
122 | {\r | |
123 | if (Configuration == NULL || Progress == NULL) {\r | |
124 | return EFI_INVALID_PARAMETER;\r | |
125 | }\r | |
126 | \r | |
54b7f3cf TP |
127 | *Progress = Configuration;\r |
128 | \r | |
3bb5c813 RN |
129 | return EFI_NOT_FOUND;\r |
130 | }\r | |
131 | \r | |
132 | /**\r | |
133 | \r | |
134 | Install the health manager forms.\r | |
135 | One will be used by BDS core to configure the Configured Required\r | |
136 | driver health instances, the other will be automatically included by\r | |
137 | firmware setup (UI).\r | |
138 | \r | |
139 | @param ImageHandle The image handle.\r | |
140 | @param SystemTable The system table.\r | |
141 | \r | |
142 | @retval EFI_SUCEESS The health manager forms are successfully installed.\r | |
143 | \r | |
144 | **/\r | |
145 | EFI_STATUS\r | |
146 | EFIAPI\r | |
147 | InitializeDriverHealthManager (\r | |
148 | EFI_HANDLE ImageHandle,\r | |
149 | EFI_SYSTEM_TABLE *SystemTable\r | |
150 | )\r | |
151 | {\r | |
152 | EFI_STATUS Status;\r | |
153 | EFI_HANDLE Handle;\r | |
154 | \r | |
155 | Status = gBS->LocateProtocol (\r | |
156 | &gEfiHiiDatabaseProtocolGuid,\r | |
157 | NULL,\r | |
158 | (VOID **) &mDriverHealthManagerDatabase\r | |
159 | );\r | |
160 | ASSERT_EFI_ERROR (Status);\r | |
161 | \r | |
162 | Handle = NULL;\r | |
163 | Status = gBS->InstallMultipleProtocolInterfaces (\r | |
164 | &Handle,\r | |
165 | &gEfiDevicePathProtocolGuid,\r | |
166 | &mDriverHealthManagerFormDevicePath,\r | |
167 | &gEfiHiiConfigAccessProtocolGuid,\r | |
168 | &mDriverHealthManagerConfigAccess,\r | |
169 | NULL\r | |
170 | );\r | |
171 | ASSERT_EFI_ERROR (Status);\r | |
172 | \r | |
173 | \r | |
174 | //\r | |
175 | // Publish Driver Health HII data.\r | |
176 | //\r | |
177 | mDriverHealthManagerHiiHandle = HiiAddPackages (\r | |
178 | &gEfiCallerIdGuid,\r | |
179 | Handle,\r | |
180 | DriverHealthManagerVfrBin,\r | |
181 | DriverHealthConfigureVfrBin,\r | |
182 | STRING_ARRAY_NAME,\r | |
183 | NULL\r | |
184 | );\r | |
185 | ASSERT (mDriverHealthManagerHiiHandle != NULL);\r | |
186 | \r | |
187 | return EFI_SUCCESS;\r | |
188 | }\r | |
189 | \r | |
190 | /**\r | |
191 | \r | |
192 | Select the best matching language according to front page policy for best user experience.\r | |
193 | \r | |
194 | This function supports both ISO 639-2 and RFC 4646 language codes, but language\r | |
195 | code types may not be mixed in a single call to this function.\r | |
196 | \r | |
197 | @param SupportedLanguages A pointer to a Null-terminated ASCII string that\r | |
198 | contains a set of language codes in the format\r | |
199 | specified by Iso639Language.\r | |
200 | @param Iso639Language If TRUE, then all language codes are assumed to be\r | |
201 | in ISO 639-2 format. If FALSE, then all language\r | |
202 | codes are assumed to be in RFC 4646 language format.\r | |
203 | \r | |
204 | @retval NULL The best matching language could not be found in SupportedLanguages.\r | |
205 | @retval NULL There are not enough resources available to return the best matching\r | |
206 | language.\r | |
207 | @retval Other A pointer to a Null-terminated ASCII string that is the best matching\r | |
208 | language in SupportedLanguages.\r | |
209 | **/\r | |
210 | CHAR8 *\r | |
211 | DriverHealthManagerSelectBestLanguage (\r | |
212 | IN CHAR8 *SupportedLanguages,\r | |
213 | IN BOOLEAN Iso639Language\r | |
214 | )\r | |
215 | {\r | |
216 | CHAR8 *LanguageVariable;\r | |
217 | CHAR8 *BestLanguage;\r | |
218 | \r | |
cf34f86b | 219 | GetEfiGlobalVariable2 (Iso639Language ? L"Lang" : L"PlatformLang", (VOID**)&LanguageVariable, NULL);\r |
3bb5c813 RN |
220 | \r |
221 | BestLanguage = GetBestLanguage(\r | |
222 | SupportedLanguages,\r | |
223 | Iso639Language,\r | |
224 | (LanguageVariable != NULL) ? LanguageVariable : "",\r | |
225 | Iso639Language ? "eng" : "en-US",\r | |
226 | NULL\r | |
227 | );\r | |
228 | if (LanguageVariable != NULL) {\r | |
229 | FreePool (LanguageVariable);\r | |
230 | }\r | |
231 | \r | |
232 | return BestLanguage;\r | |
233 | }\r | |
234 | \r | |
235 | \r | |
236 | \r | |
237 | /**\r | |
238 | \r | |
239 | This is an internal worker function to get the Component Name (2) protocol interface\r | |
240 | and the language it supports.\r | |
241 | \r | |
242 | @param ProtocolGuid A pointer to an EFI_GUID. It points to Component Name (2) protocol GUID.\r | |
243 | @param DriverBindingHandle The handle on which the Component Name (2) protocol instance is retrieved.\r | |
244 | @param ComponentName A pointer to the Component Name (2) protocol interface.\r | |
245 | @param SupportedLanguage The best suitable language that matches the SupportedLangues interface for the\r | |
246 | located Component Name (2) instance.\r | |
247 | \r | |
248 | @retval EFI_SUCCESS The Component Name (2) protocol instance is successfully located and we find\r | |
249 | the best matching language it support.\r | |
250 | @retval EFI_UNSUPPORTED The input Language is not supported by the Component Name (2) protocol.\r | |
251 | @retval Other Some error occurs when locating Component Name (2) protocol instance or finding\r | |
252 | the supported language.\r | |
253 | \r | |
254 | **/\r | |
255 | EFI_STATUS\r | |
256 | DriverHealthManagerGetComponentNameWorker (\r | |
257 | IN EFI_GUID *ProtocolGuid,\r | |
258 | IN EFI_HANDLE DriverBindingHandle,\r | |
259 | OUT EFI_COMPONENT_NAME_PROTOCOL **ComponentName,\r | |
260 | OUT CHAR8 **SupportedLanguage\r | |
261 | )\r | |
262 | {\r | |
263 | EFI_STATUS Status;\r | |
264 | \r | |
265 | //\r | |
266 | // Locate Component Name (2) protocol on the driver binging handle.\r | |
267 | //\r | |
268 | Status = gBS->OpenProtocol (\r | |
269 | DriverBindingHandle,\r | |
270 | ProtocolGuid,\r | |
271 | (VOID **) ComponentName,\r | |
272 | NULL,\r | |
273 | NULL,\r | |
274 | EFI_OPEN_PROTOCOL_GET_PROTOCOL\r | |
275 | );\r | |
276 | if (EFI_ERROR (Status)) {\r | |
277 | return Status;\r | |
278 | }\r | |
279 | \r | |
280 | //\r | |
281 | // Apply shell policy to select the best language.\r | |
282 | //\r | |
283 | *SupportedLanguage = DriverHealthManagerSelectBestLanguage (\r | |
284 | (*ComponentName)->SupportedLanguages,\r | |
285 | (BOOLEAN) (ProtocolGuid == &gEfiComponentNameProtocolGuid)\r | |
286 | );\r | |
287 | if (*SupportedLanguage == NULL) {\r | |
288 | Status = EFI_UNSUPPORTED;\r | |
289 | }\r | |
290 | \r | |
291 | return Status;\r | |
292 | }\r | |
293 | \r | |
294 | /**\r | |
295 | \r | |
296 | This is an internal worker function to get driver name from Component Name (2) protocol interface.\r | |
297 | \r | |
298 | @param ProtocolGuid A pointer to an EFI_GUID. It points to Component Name (2) protocol GUID.\r | |
299 | @param DriverBindingHandle The handle on which the Component Name (2) protocol instance is retrieved.\r | |
300 | @param DriverName A pointer to the Unicode string to return. This Unicode string is the name\r | |
301 | of the driver specified by This.\r | |
302 | \r | |
303 | @retval EFI_SUCCESS The driver name is successfully retrieved from Component Name (2) protocol\r | |
304 | interface.\r | |
305 | @retval Other The driver name cannot be retrieved from Component Name (2) protocol\r | |
306 | interface.\r | |
307 | \r | |
308 | **/\r | |
309 | EFI_STATUS\r | |
310 | DriverHealthManagerGetDriverNameWorker (\r | |
311 | IN EFI_GUID *ProtocolGuid,\r | |
312 | IN EFI_HANDLE DriverBindingHandle,\r | |
313 | OUT CHAR16 **DriverName\r | |
314 | )\r | |
315 | {\r | |
316 | EFI_STATUS Status;\r | |
317 | CHAR8 *BestLanguage;\r | |
318 | EFI_COMPONENT_NAME_PROTOCOL *ComponentName;\r | |
319 | \r | |
320 | //\r | |
321 | // Retrieve Component Name (2) protocol instance on the driver binding handle and\r | |
322 | // find the best language this instance supports.\r | |
323 | //\r | |
324 | Status = DriverHealthManagerGetComponentNameWorker (\r | |
325 | ProtocolGuid,\r | |
326 | DriverBindingHandle,\r | |
327 | &ComponentName,\r | |
328 | &BestLanguage\r | |
329 | );\r | |
330 | if (EFI_ERROR (Status)) {\r | |
331 | return Status;\r | |
332 | }\r | |
333 | \r | |
334 | //\r | |
335 | // Get the driver name from Component Name (2) protocol instance on the driver binging handle.\r | |
336 | //\r | |
337 | Status = ComponentName->GetDriverName (\r | |
338 | ComponentName,\r | |
339 | BestLanguage,\r | |
340 | DriverName\r | |
341 | );\r | |
342 | FreePool (BestLanguage);\r | |
343 | \r | |
344 | return Status;\r | |
345 | }\r | |
346 | \r | |
347 | /**\r | |
348 | This function gets driver name from Component Name 2 protocol interface and Component Name protocol interface\r | |
349 | in turn. It first tries UEFI 2.0 Component Name 2 protocol interface and try to get the driver name.\r | |
350 | If the attempt fails, it then gets the driver name from EFI 1.1 Component Name protocol for backward\r | |
351 | compatibility support.\r | |
352 | \r | |
353 | @param DriverBindingHandle The handle on which the Component Name (2) protocol instance is retrieved.\r | |
354 | \r | |
355 | @return A pointer to the Unicode string to return. This Unicode string is the name of the controller\r | |
356 | specified by ControllerHandle and ChildHandle.\r | |
357 | \r | |
358 | \r | |
359 | **/\r | |
360 | CHAR16 *\r | |
361 | DriverHealthManagerGetDriverName (\r | |
362 | IN EFI_HANDLE DriverBindingHandle\r | |
363 | )\r | |
364 | {\r | |
365 | EFI_STATUS Status;\r | |
366 | CHAR16 *DriverName;\r | |
367 | \r | |
368 | //\r | |
369 | // Get driver name from UEFI 2.0 Component Name 2 protocol interface.\r | |
370 | //\r | |
371 | Status = DriverHealthManagerGetDriverNameWorker (&gEfiComponentName2ProtocolGuid, DriverBindingHandle, &DriverName);\r | |
372 | if (EFI_ERROR (Status)) {\r | |
373 | //\r | |
374 | // If it fails to get the driver name from Component Name protocol interface, we should fall back on\r | |
375 | // EFI 1.1 Component Name protocol interface.\r | |
376 | //\r | |
377 | Status = DriverHealthManagerGetDriverNameWorker (&gEfiComponentNameProtocolGuid, DriverBindingHandle, &DriverName);\r | |
378 | }\r | |
379 | \r | |
380 | if (!EFI_ERROR (Status)) {\r | |
381 | return AllocateCopyPool (StrSize (DriverName), DriverName);\r | |
382 | } else {\r | |
383 | return ConvertDevicePathToText (DevicePathFromHandle (DriverBindingHandle), FALSE, TRUE);\r | |
384 | }\r | |
385 | }\r | |
386 | \r | |
387 | \r | |
388 | \r | |
389 | /**\r | |
390 | This function gets controller name from Component Name 2 protocol interface and Component Name protocol interface\r | |
391 | in turn. It first tries UEFI 2.0 Component Name 2 protocol interface and try to get the controller name.\r | |
392 | If the attempt fails, it then gets the controller name from EFI 1.1 Component Name protocol for backward\r | |
393 | compatibility support.\r | |
394 | \r | |
395 | @param ProtocolGuid A pointer to an EFI_GUID. It points to Component Name (2) protocol GUID.\r | |
396 | @param DriverBindingHandle The handle on which the Component Name (2) protocol instance is retrieved.\r | |
397 | @param ControllerHandle The handle of a controller that the driver specified by This is managing.\r | |
398 | This handle specifies the controller whose name is to be returned.\r | |
399 | @param ChildHandle The handle of the child controller to retrieve the name of. This is an\r | |
400 | optional parameter that may be NULL. It will be NULL for device drivers.\r | |
401 | It will also be NULL for bus drivers that attempt to retrieve the name\r | |
402 | of the bus controller. It will not be NULL for a bus driver that attempts\r | |
403 | to retrieve the name of a child controller.\r | |
404 | @param ControllerName A pointer to the Unicode string to return. This Unicode string\r | |
405 | is the name of the controller specified by ControllerHandle and ChildHandle.\r | |
406 | \r | |
407 | @retval EFI_SUCCESS The controller name is successfully retrieved from Component Name (2) protocol\r | |
408 | interface.\r | |
409 | @retval Other The controller name cannot be retrieved from Component Name (2) protocol.\r | |
410 | \r | |
411 | **/\r | |
412 | EFI_STATUS\r | |
413 | DriverHealthManagerGetControllerNameWorker (\r | |
414 | IN EFI_GUID *ProtocolGuid,\r | |
415 | IN EFI_HANDLE DriverBindingHandle,\r | |
416 | IN EFI_HANDLE ControllerHandle,\r | |
417 | IN EFI_HANDLE ChildHandle,\r | |
418 | OUT CHAR16 **ControllerName\r | |
419 | )\r | |
420 | {\r | |
421 | EFI_STATUS Status;\r | |
422 | CHAR8 *BestLanguage;\r | |
423 | EFI_COMPONENT_NAME_PROTOCOL *ComponentName;\r | |
424 | \r | |
425 | //\r | |
426 | // Retrieve Component Name (2) protocol instance on the driver binding handle and\r | |
427 | // find the best language this instance supports.\r | |
428 | //\r | |
429 | Status = DriverHealthManagerGetComponentNameWorker (\r | |
430 | ProtocolGuid,\r | |
431 | DriverBindingHandle,\r | |
432 | &ComponentName,\r | |
433 | &BestLanguage\r | |
434 | );\r | |
435 | if (EFI_ERROR (Status)) {\r | |
436 | return Status;\r | |
437 | }\r | |
438 | \r | |
439 | //\r | |
440 | // Get the controller name from Component Name (2) protocol instance on the driver binging handle.\r | |
441 | //\r | |
442 | Status = ComponentName->GetControllerName (\r | |
443 | ComponentName,\r | |
444 | ControllerHandle,\r | |
445 | ChildHandle,\r | |
446 | BestLanguage,\r | |
447 | ControllerName\r | |
448 | );\r | |
449 | FreePool (BestLanguage);\r | |
450 | \r | |
451 | return Status;\r | |
452 | }\r | |
453 | \r | |
454 | /**\r | |
455 | \r | |
456 | This function gets controller name from Component Name 2 protocol interface and Component Name protocol interface\r | |
457 | in turn. It first tries UEFI 2.0 Component Name 2 protocol interface and try to get the controller name.\r | |
458 | If the attempt fails, it then gets the controller name from EFI 1.1 Component Name protocol for backward\r | |
459 | compatibility support.\r | |
460 | \r | |
461 | @param DriverBindingHandle The handle on which the Component Name (2) protocol instance is retrieved.\r | |
462 | @param ControllerHandle The handle of a controller that the driver specified by DriverBindingHandle is managing.\r | |
463 | This handle specifies the controller whose name is to be returned.\r | |
464 | @param ChildHandle The handle of the child controller to retrieve the name of. This is an\r | |
465 | optional parameter that may be NULL. It will be NULL for device drivers.\r | |
466 | It will also be NULL for bus drivers that attempt to retrieve the name\r | |
467 | of the bus controller. It will not be NULL for a bus driver that attempts\r | |
468 | to retrieve the name of a child controller.\r | |
469 | \r | |
470 | @return A pointer to the Unicode string to return. This Unicode string is the name of the controller\r | |
471 | specified by ControllerHandle and ChildHandle.\r | |
472 | **/\r | |
473 | CHAR16 *\r | |
474 | DriverHealthManagerGetControllerName (\r | |
475 | IN EFI_HANDLE DriverBindingHandle,\r | |
476 | IN EFI_HANDLE ControllerHandle,\r | |
477 | IN EFI_HANDLE ChildHandle\r | |
478 | )\r | |
479 | {\r | |
480 | EFI_STATUS Status;\r | |
481 | CHAR16 *ControllerName;\r | |
482 | \r | |
483 | //\r | |
484 | // Get controller name from UEFI 2.0 Component Name 2 protocol interface.\r | |
485 | //\r | |
486 | Status = DriverHealthManagerGetControllerNameWorker (\r | |
487 | &gEfiComponentName2ProtocolGuid,\r | |
488 | DriverBindingHandle,\r | |
489 | ControllerHandle,\r | |
490 | ChildHandle,\r | |
491 | &ControllerName\r | |
492 | );\r | |
493 | if (EFI_ERROR (Status)) {\r | |
494 | //\r | |
495 | // If it fails to get the controller name from Component Name protocol interface, we should fall back on\r | |
496 | // EFI 1.1 Component Name protocol interface.\r | |
497 | //\r | |
498 | Status = DriverHealthManagerGetControllerNameWorker (\r | |
499 | &gEfiComponentNameProtocolGuid,\r | |
500 | DriverBindingHandle,\r | |
501 | ControllerHandle,\r | |
502 | ChildHandle,\r | |
503 | &ControllerName\r | |
504 | );\r | |
505 | }\r | |
506 | \r | |
507 | if (!EFI_ERROR (Status)) {\r | |
508 | return AllocateCopyPool (StrSize (ControllerName), ControllerName);\r | |
509 | } else {\r | |
510 | return ConvertDevicePathToText (DevicePathFromHandle (ChildHandle != NULL ? ChildHandle : ControllerHandle), FALSE, TRUE);\r | |
511 | }\r | |
512 | }\r | |
513 | \r | |
514 | /**\r | |
515 | The repair notify function.\r | |
516 | @param Value A value between 0 and Limit that identifies the current progress\r | |
517 | of the repair operation.\r | |
518 | @param Limit The maximum value of Value for the current repair operation.\r | |
519 | If Limit is 0, then the completion progress is indeterminate.\r | |
520 | For example, a driver that wants to specify progress in percent\r | |
521 | would use a Limit value of 100.\r | |
522 | \r | |
523 | @retval EFI_SUCCESS Successfully return from the notify function.\r | |
524 | **/\r | |
525 | EFI_STATUS\r | |
526 | EFIAPI\r | |
527 | DriverHealthManagerRepairNotify (\r | |
528 | IN UINTN Value,\r | |
529 | IN UINTN Limit\r | |
530 | )\r | |
531 | {\r | |
532 | DEBUG ((EFI_D_INFO, "[DriverHealthManagement]RepairNotify: %d/%d\n", Value, Limit));\r | |
533 | return EFI_SUCCESS;\r | |
534 | }\r | |
535 | \r | |
536 | /**\r | |
537 | Look for the formset GUID which has the gEfiHiiDriverHealthFormsetGuid class GUID in the specified HII package list.\r | |
538 | \r | |
539 | @param Handle Handle to the HII package list.\r | |
540 | @param FormsetGuid Return the formset GUID.\r | |
541 | \r | |
542 | @retval EFI_SUCCESS The formset is found successfully.\r | |
543 | @retval EFI_NOT_FOUND The formset cannot be found.\r | |
544 | **/\r | |
545 | EFI_STATUS\r | |
546 | DriverHealthManagerGetFormsetId (\r | |
547 | IN EFI_HII_HANDLE Handle,\r | |
548 | OUT EFI_GUID *FormsetGuid\r | |
549 | )\r | |
550 | {\r | |
551 | EFI_STATUS Status;\r | |
552 | EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList;\r | |
553 | UINTN BufferSize;\r | |
554 | UINT8 *Package;\r | |
555 | UINT8 *OpCodeData;\r | |
556 | UINT32 Offset;\r | |
557 | UINT32 Offset2;\r | |
558 | EFI_HII_PACKAGE_HEADER PackageHeader;\r | |
559 | UINT8 Index;\r | |
560 | UINT8 NumberOfClassGuid;\r | |
561 | EFI_GUID *ClassGuid;\r | |
562 | \r | |
563 | //\r | |
564 | // Get HII PackageList\r | |
565 | //\r | |
566 | BufferSize = 0;\r | |
567 | HiiPackageList = NULL;\r | |
568 | Status = mDriverHealthManagerDatabase->ExportPackageLists (mDriverHealthManagerDatabase, Handle, &BufferSize, HiiPackageList);\r | |
569 | if (Status == EFI_BUFFER_TOO_SMALL) {\r | |
570 | HiiPackageList = AllocatePool (BufferSize);\r | |
571 | ASSERT (HiiPackageList != NULL);\r | |
572 | \r | |
573 | Status = mDriverHealthManagerDatabase->ExportPackageLists (mDriverHealthManagerDatabase, Handle, &BufferSize, HiiPackageList);\r | |
574 | }\r | |
575 | if (EFI_ERROR (Status)) {\r | |
576 | return Status;\r | |
577 | }\r | |
578 | ASSERT (HiiPackageList != NULL);\r | |
579 | \r | |
580 | //\r | |
581 | // Get Form package from this HII package List\r | |
582 | //\r | |
583 | for (Offset = sizeof (EFI_HII_PACKAGE_LIST_HEADER); Offset < ReadUnaligned32 (&HiiPackageList->PackageLength); Offset += PackageHeader.Length) {\r | |
584 | Package = ((UINT8 *) HiiPackageList) + Offset;\r | |
585 | CopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER));\r | |
586 | \r | |
587 | if (PackageHeader.Type == EFI_HII_PACKAGE_FORMS) {\r | |
588 | //\r | |
589 | // Search FormSet in this Form Package\r | |
590 | //\r | |
d1102dba | 591 | \r |
3bb5c813 RN |
592 | for (Offset2 = sizeof (EFI_HII_PACKAGE_HEADER); Offset2 < PackageHeader.Length; Offset2 += ((EFI_IFR_OP_HEADER *) OpCodeData)->Length) {\r |
593 | OpCodeData = Package + Offset2;\r | |
594 | \r | |
595 | if ((((EFI_IFR_OP_HEADER *) OpCodeData)->OpCode == EFI_IFR_FORM_SET_OP) &&\r | |
596 | (((EFI_IFR_OP_HEADER *) OpCodeData)->Length > OFFSET_OF (EFI_IFR_FORM_SET, Flags))) {\r | |
597 | //\r | |
598 | // Try to compare against formset class GUID\r | |
599 | //\r | |
600 | NumberOfClassGuid = (UINT8) (((EFI_IFR_FORM_SET *) OpCodeData)->Flags & 0x3);\r | |
601 | ClassGuid = (EFI_GUID *) (OpCodeData + sizeof (EFI_IFR_FORM_SET));\r | |
602 | for (Index = 0; Index < NumberOfClassGuid; Index++) {\r | |
603 | if (CompareGuid (&gEfiHiiDriverHealthFormsetGuid, &ClassGuid[Index])) {\r | |
604 | CopyMem (FormsetGuid, &((EFI_IFR_FORM_SET *) OpCodeData)->Guid, sizeof (EFI_GUID));\r | |
605 | FreePool (HiiPackageList);\r | |
606 | return EFI_SUCCESS;\r | |
607 | }\r | |
608 | }\r | |
609 | }\r | |
610 | }\r | |
611 | }\r | |
612 | }\r | |
613 | \r | |
614 | //\r | |
615 | // Form package not found in this Package List\r | |
616 | //\r | |
617 | FreePool (HiiPackageList);\r | |
618 | return EFI_NOT_FOUND;\r | |
619 | }\r | |
620 | \r | |
621 | /**\r | |
622 | Processes a single controller using the EFI Driver Health Protocol associated with\r | |
623 | that controller.\r | |
624 | \r | |
625 | @param DriverHealth A pointer to the EFI_DRIVER_HEALTH_PROTOCOL instance.\r | |
626 | @param ControllerHandle The class guid specifies which form set will be displayed.\r | |
627 | @param ChildHandle The handle of the child controller to retrieve the health\r | |
628 | status on. This is an optional parameter that may be NULL.\r | |
629 | @param HealthStatus The health status of the controller.\r | |
630 | @param MessageList An array of warning or error messages associated\r | |
631 | with the controller specified by ControllerHandle and\r | |
632 | ChildHandle. This is an optional parameter that may be NULL.\r | |
633 | @param FormHiiHandle The HII handle for an HII form associated with the\r | |
634 | controller specified by ControllerHandle and ChildHandle.\r | |
635 | **/\r | |
636 | VOID\r | |
637 | DriverHealthManagerProcessSingleControllerHealth (\r | |
638 | IN EFI_DRIVER_HEALTH_PROTOCOL *DriverHealth,\r | |
639 | IN EFI_HANDLE ControllerHandle, OPTIONAL\r | |
640 | IN EFI_HANDLE ChildHandle, OPTIONAL\r | |
641 | IN EFI_DRIVER_HEALTH_STATUS HealthStatus,\r | |
642 | IN EFI_DRIVER_HEALTH_HII_MESSAGE **MessageList, OPTIONAL\r | |
643 | IN EFI_HII_HANDLE FormHiiHandle\r | |
644 | )\r | |
645 | {\r | |
646 | EFI_STATUS Status;\r | |
647 | \r | |
648 | ASSERT (HealthStatus != EfiDriverHealthStatusConfigurationRequired);\r | |
649 | //\r | |
650 | // If the module need to be repaired or reconfiguration, will process it until\r | |
651 | // reach a terminal status. The status from EfiDriverHealthStatusRepairRequired after repair\r | |
652 | // will be in (Health, Failed, Configuration Required).\r | |
653 | //\r | |
654 | switch (HealthStatus) {\r | |
655 | \r | |
656 | case EfiDriverHealthStatusRepairRequired:\r | |
657 | Status = DriverHealth->Repair (\r | |
658 | DriverHealth,\r | |
659 | ControllerHandle,\r | |
660 | ChildHandle,\r | |
661 | DriverHealthManagerRepairNotify\r | |
662 | );\r | |
663 | break;\r | |
664 | \r | |
665 | case EfiDriverHealthStatusRebootRequired:\r | |
666 | gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);\r | |
667 | break;\r | |
668 | \r | |
669 | case EfiDriverHealthStatusReconnectRequired:\r | |
670 | Status = gBS->DisconnectController (ControllerHandle, NULL, NULL);\r | |
671 | if (EFI_ERROR (Status)) {\r | |
672 | //\r | |
673 | // Disconnect failed. Need to promote reconnect to a reboot.\r | |
674 | //\r | |
675 | gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);\r | |
676 | } else {\r | |
677 | gBS->ConnectController (ControllerHandle, NULL, NULL, TRUE);\r | |
678 | }\r | |
679 | break;\r | |
680 | \r | |
681 | default:\r | |
682 | break;\r | |
683 | }\r | |
684 | }\r | |
685 | \r | |
686 | /**\r | |
687 | Update the form to include the driver health instances.\r | |
688 | \r | |
689 | @param ConfigureOnly Only include the configure required driver health instances\r | |
690 | when TRUE, include all the driver health instances otherwise.\r | |
691 | **/\r | |
692 | VOID\r | |
693 | DriverHealthManagerUpdateForm (\r | |
694 | BOOLEAN ConfigureOnly\r | |
695 | )\r | |
696 | {\r | |
697 | EFI_STATUS Status;\r | |
698 | EFI_IFR_GUID_LABEL *StartLabel;\r | |
699 | EFI_IFR_GUID_LABEL *EndLabel;\r | |
700 | VOID *StartOpCodeHandle;\r | |
701 | VOID *EndOpCodeHandle;\r | |
702 | UINTN Index;\r | |
703 | EFI_STRING_ID Prompt;\r | |
704 | EFI_STRING_ID Help;\r | |
705 | CHAR16 String[512];\r | |
706 | UINTN StringCount;\r | |
707 | EFI_STRING TmpString;\r | |
708 | EFI_STRING DriverName;\r | |
709 | EFI_STRING ControllerName;\r | |
710 | UINTN MessageIndex;\r | |
711 | EFI_HANDLE DriverHandle;\r | |
712 | EFI_STRING_ID DevicePath;\r | |
713 | EFI_GUID FormsetGuid;\r | |
714 | \r | |
715 | EfiBootManagerFreeDriverHealthInfo (mDriverHealthManagerHealthInfo, mDriverHealthManagerHealthInfoCount);\r | |
716 | mDriverHealthManagerHealthInfo = EfiBootManagerGetDriverHealthInfo (&mDriverHealthManagerHealthInfoCount);\r | |
717 | \r | |
718 | //\r | |
719 | // Allocate space for creation of UpdateData Buffer\r | |
720 | //\r | |
721 | StartOpCodeHandle = HiiAllocateOpCodeHandle ();\r | |
722 | ASSERT (StartOpCodeHandle != NULL);\r | |
723 | \r | |
724 | EndOpCodeHandle = HiiAllocateOpCodeHandle ();\r | |
725 | ASSERT (EndOpCodeHandle != NULL);\r | |
726 | \r | |
727 | //\r | |
728 | // Create Hii Extend Label OpCode as the start opcode\r | |
729 | //\r | |
730 | StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));\r | |
731 | StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;\r | |
732 | StartLabel->Number = LABEL_BEGIN;\r | |
733 | \r | |
734 | //\r | |
735 | // Create Hii Extend Label OpCode as the end opcode\r | |
736 | //\r | |
737 | EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));\r | |
738 | EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;\r | |
739 | EndLabel->Number = LABEL_END;\r | |
740 | \r | |
741 | for (Index = 0; Index < mDriverHealthManagerHealthInfoCount; Index++) {\r | |
742 | if (ConfigureOnly && mDriverHealthManagerHealthInfo[Index].HealthStatus != EfiDriverHealthStatusConfigurationRequired) {\r | |
743 | continue;\r | |
744 | }\r | |
745 | DriverName = DriverHealthManagerGetDriverName (mDriverHealthManagerHealthInfo[Index].DriverHealthHandle);\r | |
746 | ASSERT (DriverName != NULL);\r | |
747 | \r | |
748 | if (mDriverHealthManagerHealthInfo[Index].ControllerHandle == NULL) {\r | |
749 | //\r | |
750 | // The ControllerHandle is set to NULL and the HealthStatus is set to EfiDriverHealthStatusHealthy\r | |
751 | // if all the controllers managed by the driver are in healthy state.\r | |
752 | //\r | |
753 | ASSERT (mDriverHealthManagerHealthInfo[Index].HealthStatus == EfiDriverHealthStatusHealthy);\r | |
754 | UnicodeSPrint (String, sizeof (String), L"%s", DriverName);\r | |
755 | } else {\r | |
756 | ControllerName = DriverHealthManagerGetControllerName (\r | |
757 | mDriverHealthManagerHealthInfo[Index].DriverHealthHandle,\r | |
758 | mDriverHealthManagerHealthInfo[Index].ControllerHandle,\r | |
759 | mDriverHealthManagerHealthInfo[Index].ChildHandle\r | |
760 | );\r | |
761 | ASSERT (ControllerName != NULL);\r | |
762 | UnicodeSPrint (String, sizeof (String), L"%s %s", DriverName, ControllerName);\r | |
763 | FreePool (ControllerName);\r | |
764 | }\r | |
765 | FreePool (DriverName);\r | |
766 | \r | |
767 | Prompt = HiiSetString (mDriverHealthManagerHiiHandle, 0, String, NULL);\r | |
768 | \r | |
769 | switch(mDriverHealthManagerHealthInfo[Index].HealthStatus) {\r | |
770 | case EfiDriverHealthStatusRepairRequired:\r | |
771 | TmpString = HiiGetString (mDriverHealthManagerHiiHandle, STRING_TOKEN (STR_REPAIR_REQUIRED), NULL);\r | |
772 | break;\r | |
773 | case EfiDriverHealthStatusConfigurationRequired:\r | |
774 | TmpString = HiiGetString (mDriverHealthManagerHiiHandle, STRING_TOKEN (STR_CONFIGURATION_REQUIRED), NULL);\r | |
775 | break;\r | |
776 | case EfiDriverHealthStatusFailed:\r | |
777 | TmpString = HiiGetString (mDriverHealthManagerHiiHandle, STRING_TOKEN (STR_FAILED), NULL);\r | |
778 | break;\r | |
779 | case EfiDriverHealthStatusReconnectRequired:\r | |
780 | TmpString = HiiGetString (mDriverHealthManagerHiiHandle, STRING_TOKEN (STR_RECONNECT_REQUIRED), NULL);\r | |
781 | break;\r | |
782 | case EfiDriverHealthStatusRebootRequired:\r | |
783 | TmpString = HiiGetString (mDriverHealthManagerHiiHandle, STRING_TOKEN (STR_REBOOT_REQUIRED), NULL);\r | |
784 | break;\r | |
785 | default:\r | |
786 | ASSERT (mDriverHealthManagerHealthInfo[Index].HealthStatus == EfiDriverHealthStatusHealthy);\r | |
787 | TmpString = HiiGetString (mDriverHealthManagerHiiHandle, STRING_TOKEN (STR_HEALTHY), NULL);\r | |
788 | break;\r | |
789 | }\r | |
790 | StringCount = UnicodeSPrint (String, sizeof (String), L"%s\n", TmpString);\r | |
791 | FreePool (TmpString);\r | |
792 | \r | |
793 | //\r | |
794 | // Add the message of the Module itself provided as the help.\r | |
795 | //\r | |
796 | if (mDriverHealthManagerHealthInfo[Index].MessageList != NULL) {\r | |
797 | for (MessageIndex = 0; mDriverHealthManagerHealthInfo[Index].MessageList[MessageIndex].HiiHandle != NULL; MessageIndex++) {\r | |
798 | TmpString = HiiGetString (\r | |
799 | mDriverHealthManagerHealthInfo[Index].MessageList[MessageIndex].HiiHandle,\r | |
800 | mDriverHealthManagerHealthInfo[Index].MessageList[MessageIndex].StringId,\r | |
801 | NULL\r | |
802 | );\r | |
803 | StringCount += UnicodeSPrint (String + StringCount, sizeof (String) - sizeof (String[0]) * StringCount, L"\n%s", TmpString);\r | |
804 | FreePool (TmpString);\r | |
805 | }\r | |
806 | }\r | |
807 | Help = HiiSetString (mDriverHealthManagerHiiHandle, 0, String, NULL);\r | |
808 | \r | |
809 | switch (mDriverHealthManagerHealthInfo[Index].HealthStatus) {\r | |
810 | case EfiDriverHealthStatusConfigurationRequired:\r | |
811 | Status = mDriverHealthManagerDatabase->GetPackageListHandle (\r | |
812 | mDriverHealthManagerDatabase,\r | |
813 | mDriverHealthManagerHealthInfo[Index].HiiHandle,\r | |
814 | &DriverHandle\r | |
815 | );\r | |
816 | ASSERT_EFI_ERROR (Status);\r | |
817 | TmpString = ConvertDevicePathToText (DevicePathFromHandle (DriverHandle), FALSE, TRUE);\r | |
818 | DevicePath = HiiSetString (mDriverHealthManagerHiiHandle, 0, TmpString, NULL);\r | |
819 | FreePool (TmpString);\r | |
820 | \r | |
821 | Status = DriverHealthManagerGetFormsetId (mDriverHealthManagerHealthInfo[Index].HiiHandle, &FormsetGuid);\r | |
822 | ASSERT_EFI_ERROR (Status);\r | |
823 | \r | |
824 | HiiCreateGotoExOpCode (\r | |
825 | StartOpCodeHandle,\r | |
826 | 0,\r | |
827 | Prompt,\r | |
828 | Help,\r | |
829 | 0,\r | |
830 | 0,\r | |
831 | 0,\r | |
832 | &FormsetGuid,\r | |
833 | DevicePath\r | |
834 | );\r | |
835 | break;\r | |
836 | \r | |
837 | case EfiDriverHealthStatusRepairRequired:\r | |
838 | case EfiDriverHealthStatusReconnectRequired:\r | |
839 | case EfiDriverHealthStatusRebootRequired:\r | |
840 | HiiCreateActionOpCode (\r | |
841 | StartOpCodeHandle,\r | |
842 | (EFI_QUESTION_ID) (Index + QUESTION_ID_DRIVER_HEALTH_BASE),\r | |
843 | Prompt,\r | |
844 | Help,\r | |
845 | EFI_IFR_FLAG_CALLBACK,\r | |
846 | 0\r | |
847 | );\r | |
848 | break;\r | |
849 | \r | |
850 | default:\r | |
851 | ASSERT (mDriverHealthManagerHealthInfo[Index].HealthStatus == EfiDriverHealthStatusHealthy ||\r | |
852 | mDriverHealthManagerHealthInfo[Index].HealthStatus == EfiDriverHealthStatusFailed);\r | |
853 | HiiCreateTextOpCode (\r | |
854 | StartOpCodeHandle,\r | |
855 | Prompt,\r | |
856 | Help,\r | |
857 | 0\r | |
858 | );\r | |
859 | break;\r | |
860 | }\r | |
861 | }\r | |
862 | \r | |
863 | Status = HiiUpdateForm (\r | |
864 | mDriverHealthManagerHiiHandle,\r | |
865 | ConfigureOnly ? PcdGetPtr (PcdDriverHealthConfigureForm) : &mDriverHealthManagerForm,\r | |
866 | DRIVER_HEALTH_FORM_ID,\r | |
867 | StartOpCodeHandle,\r | |
868 | EndOpCodeHandle\r | |
869 | );\r | |
870 | ASSERT_EFI_ERROR (Status);\r | |
871 | \r | |
872 | HiiFreeOpCodeHandle (StartOpCodeHandle);\r | |
873 | HiiFreeOpCodeHandle (EndOpCodeHandle);\r | |
874 | }\r | |
875 | \r | |
876 | /**\r | |
877 | Called when the form is closing to remove the dynamicly added string from the HII package list.\r | |
878 | **/\r | |
879 | VOID\r | |
880 | DriverHealthManagerCleanDynamicString (\r | |
881 | VOID\r | |
882 | )\r | |
883 | {\r | |
884 | EFI_STATUS Status;\r | |
885 | EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList;\r | |
886 | UINTN BufferSize;\r | |
887 | EFI_HII_PACKAGE_HEADER *PackageHeader;\r | |
888 | UINT32 FixedStringSize;\r | |
889 | \r | |
890 | FixedStringSize = *(UINT32 *) &STRING_ARRAY_NAME - sizeof (UINT32);\r | |
891 | BufferSize = sizeof (EFI_HII_PACKAGE_LIST_HEADER) + FixedStringSize + sizeof (EFI_HII_PACKAGE_HEADER);\r | |
892 | HiiPackageList = AllocatePool (BufferSize);\r | |
893 | ASSERT (HiiPackageList != NULL);\r | |
894 | \r | |
895 | HiiPackageList->PackageLength = (UINT32) BufferSize;\r | |
896 | CopyMem (&HiiPackageList->PackageListGuid, &gEfiCallerIdGuid, sizeof (EFI_GUID));\r | |
897 | \r | |
898 | PackageHeader = (EFI_HII_PACKAGE_HEADER *) (HiiPackageList + 1);\r | |
899 | CopyMem (PackageHeader, STRING_ARRAY_NAME + sizeof (UINT32), FixedStringSize);\r | |
900 | \r | |
901 | PackageHeader = (EFI_HII_PACKAGE_HEADER *) ((UINT8 *) PackageHeader + PackageHeader->Length);\r | |
902 | PackageHeader->Type = EFI_HII_PACKAGE_END;\r | |
903 | PackageHeader->Length = sizeof (EFI_HII_PACKAGE_HEADER);\r | |
904 | \r | |
905 | Status = mDriverHealthManagerDatabase->UpdatePackageList (\r | |
906 | mDriverHealthManagerDatabase,\r | |
907 | mDriverHealthManagerHiiHandle,\r | |
908 | HiiPackageList\r | |
909 | );\r | |
910 | ASSERT_EFI_ERROR (Status);\r | |
911 | \r | |
912 | //\r | |
913 | // Form package not found in this Package List\r | |
914 | //\r | |
915 | FreePool (HiiPackageList);\r | |
916 | }\r | |
917 | \r | |
918 | /**\r | |
919 | This function is invoked if user selected a interactive opcode from Driver Health's\r | |
920 | Formset.\r | |
921 | \r | |
922 | @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r | |
923 | @param Action Specifies the type of action taken by the browser.\r | |
924 | @param QuestionId A unique value which is sent to the original exporting driver\r | |
925 | so that it can identify the type of data to expect.\r | |
926 | @param Type The type of value for the question.\r | |
927 | @param Value A pointer to the data being sent to the original exporting driver.\r | |
928 | @param ActionRequest On return, points to the action requested by the callback function.\r | |
929 | \r | |
930 | @retval EFI_SUCCESS The callback successfully handled the action.\r | |
931 | @retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.\r | |
932 | \r | |
933 | **/\r | |
934 | EFI_STATUS\r | |
935 | EFIAPI\r | |
936 | DriverHealthManagerCallback (\r | |
937 | IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r | |
938 | IN EFI_BROWSER_ACTION Action,\r | |
939 | IN EFI_QUESTION_ID QuestionId,\r | |
940 | IN UINT8 Type,\r | |
941 | IN EFI_IFR_TYPE_VALUE *Value,\r | |
942 | OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest\r | |
943 | )\r | |
944 | {\r | |
945 | UINTN Index;\r | |
946 | \r | |
947 | if (QuestionId == QUESTION_ID_REFRESH_MANAGER || QuestionId == QUESTION_ID_REFRESH_CONFIGURE) {\r | |
948 | if (Action == EFI_BROWSER_ACTION_FORM_OPEN) {\r | |
949 | DriverHealthManagerUpdateForm ((BOOLEAN) (QuestionId == QUESTION_ID_REFRESH_CONFIGURE));\r | |
950 | } else if (Action == EFI_BROWSER_ACTION_FORM_CLOSE) {\r | |
951 | DriverHealthManagerCleanDynamicString ();\r | |
952 | }\r | |
953 | return EFI_SUCCESS;\r | |
954 | }\r | |
955 | \r | |
956 | if (Action != EFI_BROWSER_ACTION_CHANGED) {\r | |
957 | //\r | |
958 | // Do nothing for other UEFI Action. Only do call back when data is changed.\r | |
959 | //\r | |
960 | return EFI_UNSUPPORTED;\r | |
961 | }\r | |
962 | \r | |
963 | if ((Value == NULL) || (ActionRequest == NULL)) {\r | |
964 | return EFI_INVALID_PARAMETER;\r | |
965 | }\r | |
966 | \r | |
967 | DEBUG ((EFI_D_ERROR, "QuestionId = %x\n", QuestionId));\r | |
968 | \r | |
969 | //\r | |
970 | // We will have returned from processing a callback - user either hit ESC to exit, or selected\r | |
971 | // a target to display.\r | |
972 | // Process the diver health status states here.\r | |
973 | //\r | |
974 | Index = QuestionId - QUESTION_ID_DRIVER_HEALTH_BASE;\r | |
975 | ASSERT (Index < mDriverHealthManagerHealthInfoCount);\r | |
976 | //\r | |
977 | // Process the driver's healthy status for the specify module\r | |
978 | //\r | |
979 | DriverHealthManagerProcessSingleControllerHealth (\r | |
980 | mDriverHealthManagerHealthInfo[Index].DriverHealth,\r | |
981 | mDriverHealthManagerHealthInfo[Index].ControllerHandle,\r | |
982 | mDriverHealthManagerHealthInfo[Index].ChildHandle,\r | |
983 | mDriverHealthManagerHealthInfo[Index].HealthStatus,\r | |
984 | &(mDriverHealthManagerHealthInfo[Index].MessageList),\r | |
985 | mDriverHealthManagerHealthInfo[Index].HiiHandle\r | |
986 | );\r | |
987 | \r | |
988 | DriverHealthManagerUpdateForm ((BOOLEAN) (QuestionId == QUESTION_ID_REFRESH_CONFIGURE));\r | |
989 | \r | |
990 | return EFI_SUCCESS;\r | |
991 | }\r | |
992 | \r | |
993 | \r |