]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.h
> When GetHealthStatus() returns NULL FormHiiHandle, DeviceManager shouldn't call...
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / BdsDxe / DeviceMngr / DeviceManager.h
... / ...
CommitLineData
1/** @file\r
2 The platform device manager reference implement\r
3\r
4Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>\r
5This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef _DEVICE_MANAGER_H_\r
16#define _DEVICE_MANAGER_H_\r
17\r
18#include "Bds.h"\r
19#include "FrontPage.h"\r
20#include "DeviceManagerVfr.h"\r
21#include <Protocol/PciIo.h>\r
22\r
23#define DEVICE_MANAGER_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('D', 'M', 'C', 'B')\r
24#define DEVICE_MANAGER_DRIVER_HEALTH_INFO_SIGNATURE SIGNATURE_32 ('D', 'M', 'D', 'H')\r
25\r
26\r
27typedef struct {\r
28 UINTN Signature;\r
29\r
30 ///\r
31 /// Device Manager HII relative handles\r
32 ///\r
33 EFI_HII_HANDLE HiiHandle;\r
34\r
35 ///\r
36 /// Driver Health HII relative handles\r
37 ///\r
38 EFI_HII_HANDLE DriverHealthHiiHandle;\r
39\r
40 EFI_HANDLE DriverHandle;\r
41 EFI_HANDLE DriverHealthHandle;\r
42\r
43 ///\r
44 /// Device Manager Produced protocols\r
45 ///\r
46 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;\r
47\r
48 ///\r
49 /// Driver Health Produced protocols\r
50 ///\r
51 EFI_HII_CONFIG_ACCESS_PROTOCOL DriverHealthConfigAccess;\r
52\r
53 ///\r
54 /// Configuration data\r
55 ///\r
56 UINT8 VideoBios;\r
57} DEVICE_MANAGER_CALLBACK_DATA;\r
58\r
59\r
60typedef struct {\r
61 UINTN Signature;\r
62 LIST_ENTRY Link;\r
63\r
64 ///\r
65 /// HII relative handles\r
66 ///\r
67 EFI_HII_HANDLE HiiHandle;\r
68\r
69 ///\r
70 /// Driver relative handles\r
71 ///\r
72 EFI_HANDLE DriverHandle;\r
73 EFI_HANDLE ControllerHandle;\r
74 EFI_HANDLE ChildHandle;\r
75\r
76 EFI_DRIVER_HEALTH_PROTOCOL *DriverHealth;\r
77 ///\r
78 /// Driver health messages of the specify Driver \r
79 ///\r
80 EFI_DRIVER_HEALTH_HII_MESSAGE *MessageList;\r
81\r
82 ///\r
83 /// Driver Health status\r
84 ///\r
85 EFI_DRIVER_HEALTH_STATUS HealthStatus;\r
86} DRIVER_HEALTH_INFO;\r
87\r
88typedef struct {\r
89 EFI_STRING_ID PromptId;\r
90 EFI_QUESTION_ID QuestionId;\r
91}MENU_INFO_ITEM;\r
92\r
93typedef struct {\r
94 UINTN CurListLen;\r
95 UINTN MaxListLen;\r
96 MENU_INFO_ITEM *NodeList;\r
97} MAC_ADDRESS_NODE_LIST;\r
98\r
99#define DEVICE_MANAGER_HEALTH_INFO_FROM_LINK(a) \\r
100 CR (a, \\r
101 DRIVER_HEALTH_INFO, \\r
102 Link, \\r
103 DEVICE_MANAGER_DRIVER_HEALTH_INFO_SIGNATURE \\r
104 )\r
105\r
106#define DEVICE_MANAGER_CALLBACK_DATA_FROM_THIS(a) \\r
107 CR (a, \\r
108 DEVICE_MANAGER_CALLBACK_DATA, \\r
109 ConfigAccess, \\r
110 DEVICE_MANAGER_CALLBACK_DATA_SIGNATURE \\r
111 )\r
112typedef struct {\r
113 EFI_STRING_ID StringId;\r
114 UINT16 Class;\r
115} DEVICE_MANAGER_MENU_ITEM;\r
116\r
117/**\r
118 This function is invoked if user selected a interactive opcode from Device Manager's\r
119 Formset. The decision by user is saved to gCallbackKey for later processing. If\r
120 user set VBIOS, the new value is saved to EFI variable.\r
121\r
122\r
123 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
124 @param Action Specifies the type of action taken by the browser.\r
125 @param QuestionId A unique value which is sent to the original exporting driver\r
126 so that it can identify the type of data to expect.\r
127 @param Type The type of value for the question.\r
128 @param Value A pointer to the data being sent to the original exporting driver.\r
129 @param ActionRequest On return, points to the action requested by the callback function.\r
130\r
131 @retval EFI_SUCCESS The callback successfully handled the action.\r
132 @retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.\r
133\r
134**/\r
135EFI_STATUS\r
136EFIAPI\r
137DeviceManagerCallback (\r
138 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
139 IN EFI_BROWSER_ACTION Action,\r
140 IN EFI_QUESTION_ID QuestionId,\r
141 IN UINT8 Type,\r
142 IN EFI_IFR_TYPE_VALUE *Value,\r
143 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest\r
144 );\r
145\r
146/**\r
147 This function is invoked if user selected a interactive opcode from Driver Health's\r
148 Formset. The decision by user is saved to gCallbackKey for later processing.\r
149\r
150\r
151 @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
152 @param Action Specifies the type of action taken by the browser.\r
153 @param QuestionId A unique value which is sent to the original exporting driver\r
154 so that it can identify the type of data to expect.\r
155 @param Type The type of value for the question.\r
156 @param Value A pointer to the data being sent to the original exporting driver.\r
157 @param ActionRequest On return, points to the action requested by the callback function.\r
158\r
159 @retval EFI_SUCCESS The callback successfully handled the action.\r
160 @retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.\r
161\r
162**/\r
163EFI_STATUS\r
164EFIAPI\r
165DriverHealthCallback (\r
166 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
167 IN EFI_BROWSER_ACTION Action,\r
168 IN EFI_QUESTION_ID QuestionId,\r
169 IN UINT8 Type,\r
170 IN EFI_IFR_TYPE_VALUE *Value,\r
171 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest\r
172 );\r
173\r
174\r
175/**\r
176\r
177 This function registers HII packages to HII database.\r
178\r
179 @retval EFI_SUCCESS HII packages for the Device Manager were registered successfully.\r
180 @retval EFI_OUT_OF_RESOURCES HII packages for the Device Manager failed to be registered.\r
181\r
182**/\r
183EFI_STATUS\r
184InitializeDeviceManager (\r
185 VOID\r
186 );\r
187\r
188/**\r
189\r
190 Call the browser and display the device manager to allow user\r
191 to configure the platform.\r
192\r
193 This function create the dynamic content for device manager. It includes\r
194 section header for all class of devices, one-of opcode to set VBIOS.\r
195 \r
196 @retval EFI_SUCCESS Operation is successful.\r
197 @retval Other values if failed to clean up the dynamic content from HII\r
198 database.\r
199\r
200**/\r
201EFI_STATUS\r
202CallDeviceManager (\r
203 VOID\r
204 );\r
205\r
206\r
207/**\r
208 Check the Driver Health status of a single controller and try to process it if not healthy.\r
209\r
210 This function called by CheckAllControllersHealthStatus () function in order to process a specify\r
211 contoller's health state.\r
212\r
213 @param DriverHealthList A Pointer to the list contain all of the platform driver health information. \r
214 @param DriverHandle The handle of driver.\r
215 @param ControllerHandle The class guid specifies which form set will be displayed.\r
216 @param ChildHandle The handle of the child controller to retrieve the health \r
217 status on. This is an optional parameter that may be NULL. \r
218 @param DriverHealth A pointer to the EFI_DRIVER_HEALTH_PROTOCOL instance.\r
219 @param HealthStatus The health status of the controller.\r
220\r
221 @retval EFI_INVALID_PARAMETER HealthStatus or DriverHealth is NULL.\r
222 @retval HealthStatus The Health status of specify controller.\r
223 @retval EFI_OUT_OF_RESOURCES The list of Driver Health Protocol handles can not be retrieved.\r
224 @retval EFI_NOT_FOUND No controller in the platform install Driver Health Protocol.\r
225 @retval EFI_SUCCESS The Health related operation has been taken successfully.\r
226\r
227**/\r
228EFI_STATUS\r
229EFIAPI\r
230GetSingleControllerHealthStatus (\r
231 IN OUT LIST_ENTRY *DriverHealthList,\r
232 IN EFI_HANDLE DriverHandle,\r
233 IN EFI_HANDLE ControllerHandle, OPTIONAL\r
234 IN EFI_HANDLE ChildHandle, OPTIONAL\r
235 IN EFI_DRIVER_HEALTH_PROTOCOL *DriverHealth,\r
236 IN EFI_DRIVER_HEALTH_STATUS *HealthStatus\r
237 );\r
238\r
239/**\r
240 Collects all the EFI Driver Health Protocols currently present in the EFI Handle Database, \r
241 and queries each EFI Driver Health Protocol to determine if one or more of the controllers \r
242 managed by each EFI Driver Health Protocol instance are not healthy. \r
243\r
244 @param DriverHealthList A Pointer to the list contain all of the platform driver health\r
245 information.\r
246\r
247 @retval EFI_NOT_FOUND No controller in the platform install Driver Health Protocol.\r
248 @retval EFI_SUCCESS All the controllers in the platform are healthy.\r
249 @retval EFI_OUT_OF_RESOURCES The list of Driver Health Protocol handles can not be retrieved.\r
250\r
251**/\r
252EFI_STATUS\r
253GetAllControllersHealthStatus (\r
254 IN OUT LIST_ENTRY *DriverHealthList\r
255 );\r
256\r
257/**\r
258 Check the healthy status of the platform, this function will return immediately while found one driver \r
259 in the platform are not healthy.\r
260\r
261 @retval FALSE at least one driver in the platform are not healthy.\r
262 @retval TRUE No controller install Driver Health Protocol,\r
263 or all controllers in the platform are in healthy status.\r
264**/\r
265BOOLEAN\r
266PlaformHealthStatusCheck (\r
267 VOID\r
268 );\r
269\r
270/**\r
271 Repair the whole platform.\r
272\r
273 This function is the main entry for user choose "Repair All" in the front page.\r
274 It will try to do recovery job till all the driver health protocol installed modules \r
275 reach a terminal state.\r
276\r
277 @param DriverHealthList A Pointer to the list contain all of the platform driver health\r
278 information.\r
279\r
280**/\r
281VOID\r
282PlatformRepairAll (\r
283 IN LIST_ENTRY *DriverHealthList\r
284 );\r
285\r
286/**\r
287 Processes a single controller using the EFI Driver Health Protocol associated with \r
288 that controller. This algorithm continues to query the GetHealthStatus() service until\r
289 one of the legal terminal states of the EFI Driver Health Protocol is reached. This may \r
290 require the processing of HII Messages, HII Form, and invocation of repair operations.\r
291\r
292 @param DriverHealth A pointer to the EFI_DRIVER_HEALTH_PROTOCOL instance.\r
293 @param ControllerHandle The class guid specifies which form set will be displayed.\r
294 @param ChildHandle The handle of the child controller to retrieve the health \r
295 status on. This is an optional parameter that may be NULL. \r
296 @param HealthStatus The health status of the controller.\r
297 @param MessageList An array of warning or error messages associated \r
298 with the controller specified by ControllerHandle and \r
299 ChildHandle. This is an optional parameter that may be NULL.\r
300 @param FormHiiHandle The HII handle for an HII form associated with the \r
301 controller specified by ControllerHandle and ChildHandle.\r
302 @param RebootRequired Indicate whether a reboot is required to repair the controller.\r
303**/\r
304VOID\r
305ProcessSingleControllerHealth (\r
306 IN EFI_DRIVER_HEALTH_PROTOCOL *DriverHealth,\r
307 IN EFI_HANDLE ControllerHandle, OPTIONAL\r
308 IN EFI_HANDLE ChildHandle, OPTIONAL\r
309 IN EFI_DRIVER_HEALTH_STATUS HealthStatus,\r
310 IN EFI_DRIVER_HEALTH_HII_MESSAGE **MessageList, OPTIONAL\r
311 IN EFI_HII_HANDLE FormHiiHandle,\r
312 IN OUT BOOLEAN *RebootRequired\r
313);\r
314\r
315/**\r
316 Repair notification function, simply print the repair progress.\r
317\r
318 @param Value The value of part has been repaired.\r
319 @param Limit Total value need to be repaired.\r
320\r
321**/\r
322VOID\r
323RepairNotify (\r
324 IN UINTN Value,\r
325 IN UINTN Limit\r
326 );\r
327\r
328/**\r
329 Processes a set of messages returned by the GetHealthStatus ()\r
330 service of the EFI Driver Health Protocol\r
331\r
332 @param MessageList The MessageList point to messages need to processed. \r
333\r
334**/\r
335VOID\r
336ProcessMessages (\r
337 IN EFI_DRIVER_HEALTH_HII_MESSAGE *MessageList\r
338 );\r
339\r
340\r
341/**\r
342 Collect and display the platform's driver health relative information, allow user to do interactive \r
343 operation while the platform is unhealthy.\r
344\r
345 This function display a form which divided into two parts. The one list all modules which has installed \r
346 driver health protocol. The list usually contain driver name, controller name, and it's health info.\r
347 While the driver name can't be retrieved, will use device path as backup. The other part of the form provide\r
348 a choice to the user to repair all platform.\r
349\r
350**/\r
351VOID\r
352CallDriverHealth (\r
353 VOID\r
354 );\r
355\r
356/**\r
357\r
358 Select the best matching language according to front page policy for best user experience. \r
359 \r
360 This function supports both ISO 639-2 and RFC 4646 language codes, but language \r
361 code types may not be mixed in a single call to this function. \r
362\r
363 @param SupportedLanguages A pointer to a Null-terminated ASCII string that\r
364 contains a set of language codes in the format \r
365 specified by Iso639Language.\r
366 @param Iso639Language If TRUE, then all language codes are assumed to be\r
367 in ISO 639-2 format. If FALSE, then all language\r
368 codes are assumed to be in RFC 4646 language format.\r
369\r
370 @retval NULL The best matching language could not be found in SupportedLanguages.\r
371 @retval NULL There are not enough resources available to return the best matching \r
372 language.\r
373 @retval Other A pointer to a Null-terminated ASCII string that is the best matching \r
374 language in SupportedLanguages.\r
375**/\r
376CHAR8 *\r
377DriverHealthSelectBestLanguage (\r
378 IN CHAR8 *SupportedLanguages,\r
379 IN BOOLEAN Iso639Language\r
380 );\r
381\r
382/**\r
383\r
384 This is an internal worker function to get the Component Name (2) protocol interface\r
385 and the language it supports.\r
386\r
387 @param ProtocolGuid A pointer to an EFI_GUID. It points to Component Name (2) protocol GUID.\r
388 @param DriverBindingHandle The handle on which the Component Name (2) protocol instance is retrieved.\r
389 @param ComponentName A pointer to the Component Name (2) protocol interface.\r
390 @param SupportedLanguage The best suitable language that matches the SupportedLangues interface for the \r
391 located Component Name (2) instance.\r
392\r
393 @retval EFI_SUCCESS The Component Name (2) protocol instance is successfully located and we find\r
394 the best matching language it support.\r
395 @retval EFI_UNSUPPORTED The input Language is not supported by the Component Name (2) protocol.\r
396 @retval Other Some error occurs when locating Component Name (2) protocol instance or finding\r
397 the supported language.\r
398\r
399**/\r
400EFI_STATUS\r
401GetComponentNameWorker (\r
402 IN EFI_GUID *ProtocolGuid,\r
403 IN EFI_HANDLE DriverBindingHandle,\r
404 OUT EFI_COMPONENT_NAME_PROTOCOL **ComponentName,\r
405 OUT CHAR8 **SupportedLanguage\r
406 );\r
407\r
408/**\r
409\r
410 This is an internal worker function to get driver name from Component Name (2) protocol interface.\r
411\r
412\r
413 @param ProtocolGuid A pointer to an EFI_GUID. It points to Component Name (2) protocol GUID.\r
414 @param DriverBindingHandle The handle on which the Component Name (2) protocol instance is retrieved.\r
415 @param DriverName A pointer to the Unicode string to return. This Unicode string is the name\r
416 of the driver specified by This.\r
417\r
418 @retval EFI_SUCCESS The driver name is successfully retrieved from Component Name (2) protocol\r
419 interface.\r
420 @retval Other The driver name cannot be retrieved from Component Name (2) protocol\r
421 interface.\r
422\r
423**/\r
424EFI_STATUS\r
425GetDriverNameWorker (\r
426 IN EFI_GUID *ProtocolGuid,\r
427 IN EFI_HANDLE DriverBindingHandle,\r
428 OUT CHAR16 **DriverName\r
429 );\r
430\r
431/**\r
432\r
433 This function gets driver name from Component Name 2 protocol interface and Component Name protocol interface\r
434 in turn. It first tries UEFI 2.0 Component Name 2 protocol interface and try to get the driver name.\r
435 If the attempt fails, it then gets the driver name from EFI 1.1 Component Name protocol for backward\r
436 compatibility support. \r
437\r
438 @param DriverBindingHandle The handle on which the Component Name (2) protocol instance is retrieved.\r
439 @param DriverName A pointer to the Unicode string to return. This Unicode string is the name\r
440 of the driver specified by This.\r
441\r
442 @retval EFI_SUCCESS The driver name is successfully retrieved from Component Name (2) protocol\r
443 interface.\r
444 @retval Other The driver name cannot be retrieved from Component Name (2) protocol\r
445 interface.\r
446\r
447**/\r
448EFI_STATUS\r
449DriverHealthGetDriverName (\r
450 IN EFI_HANDLE DriverBindingHandle,\r
451 OUT CHAR16 **DriverName\r
452 );\r
453\r
454/**\r
455 This function gets controller name from Component Name 2 protocol interface and Component Name protocol interface\r
456 in turn. It first tries UEFI 2.0 Component Name 2 protocol interface and try to get the controller name.\r
457 If the attempt fails, it then gets the controller name from EFI 1.1 Component Name protocol for backward\r
458 compatibility support. \r
459\r
460 @param ProtocolGuid A pointer to an EFI_GUID. It points to Component Name (2) protocol GUID.\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 This 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 @param ControllerName A pointer to the Unicode string to return. This Unicode string\r
470 is the name of the controller specified by ControllerHandle and ChildHandle.\r
471\r
472 @retval EFI_SUCCESS The controller name is successfully retrieved from Component Name (2) protocol\r
473 interface.\r
474 @retval Other The controller name cannot be retrieved from Component Name (2) protocol.\r
475\r
476**/\r
477EFI_STATUS\r
478GetControllerNameWorker (\r
479 IN EFI_GUID *ProtocolGuid,\r
480 IN EFI_HANDLE DriverBindingHandle,\r
481 IN EFI_HANDLE ControllerHandle,\r
482 IN EFI_HANDLE ChildHandle,\r
483 OUT CHAR16 **ControllerName\r
484 );\r
485\r
486/**\r
487 This function gets controller name from Component Name 2 protocol interface and Component Name protocol interface\r
488 in turn. It first tries UEFI 2.0 Component Name 2 protocol interface and try to get the controller name. \r
489 If the attempt fails, it then gets the controller name from EFI 1.1 Component Name protocol for backward\r
490 compatibility support. \r
491\r
492 @param DriverBindingHandle The handle on which the Component Name (2) protocol instance is retrieved.\r
493 @param ControllerHandle The handle of a controller that the driver specified by This is managing.\r
494 This handle specifies the controller whose name is to be returned.\r
495 @param ChildHandle The handle of the child controller to retrieve the name of. This is an\r
496 optional parameter that may be NULL. It will be NULL for device drivers.\r
497 It will also be NULL for bus drivers that attempt to retrieve the name\r
498 of the bus controller. It will not be NULL for a bus driver that attempts\r
499 to retrieve the name of a child controller.\r
500 @param ControllerName A pointer to the Unicode string to return. This Unicode string\r
501 is the name of the controller specified by ControllerHandle and ChildHandle.\r
502\r
503 @retval EFI_SUCCESS The controller name is successfully retrieved from Component Name (2) protocol\r
504 interface.\r
505 @retval Other The controller name cannot be retrieved from Component Name (2) protocol.\r
506\r
507**/\r
508EFI_STATUS\r
509DriverHealthGetControllerName (\r
510 IN EFI_HANDLE DriverBindingHandle,\r
511 IN EFI_HANDLE ControllerHandle,\r
512 IN EFI_HANDLE ChildHandle,\r
513 OUT CHAR16 **ControllerName\r
514 );\r
515\r
516#endif\r