]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.h
Correct a typo: Change the type of the 4th parameter of EFI_DRIVER_HEALTH_PROTOCOL...
[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 - 2013, 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 Reports the progress of a repair operation.\r
317\r
318 @param[in] Value A value between 0 and Limit that identifies the current \r
319 progress of the repair operation.\r
320\r
321 @param[in] Limit The maximum value of Value for the current repair operation.\r
322 For example, a driver that wants to specify progress in \r
323 percent would use a Limit value of 100.\r
324\r
325 @retval EFI_SUCCESS The progress of a repair operation is reported successfully.\r
326\r
327**/\r
328EFI_STATUS\r
329EFIAPI\r
330RepairNotify (\r
331 IN UINTN Value,\r
332 IN UINTN Limit\r
333 );\r
334\r
335/**\r
336 Processes a set of messages returned by the GetHealthStatus ()\r
337 service of the EFI Driver Health Protocol\r
338\r
339 @param MessageList The MessageList point to messages need to processed. \r
340\r
341**/\r
342VOID\r
343ProcessMessages (\r
344 IN EFI_DRIVER_HEALTH_HII_MESSAGE *MessageList\r
345 );\r
346\r
347\r
348/**\r
349 Collect and display the platform's driver health relative information, allow user to do interactive \r
350 operation while the platform is unhealthy.\r
351\r
352 This function display a form which divided into two parts. The one list all modules which has installed \r
353 driver health protocol. The list usually contain driver name, controller name, and it's health info.\r
354 While the driver name can't be retrieved, will use device path as backup. The other part of the form provide\r
355 a choice to the user to repair all platform.\r
356\r
357**/\r
358VOID\r
359CallDriverHealth (\r
360 VOID\r
361 );\r
362\r
363/**\r
364\r
365 Select the best matching language according to front page policy for best user experience. \r
366 \r
367 This function supports both ISO 639-2 and RFC 4646 language codes, but language \r
368 code types may not be mixed in a single call to this function. \r
369\r
370 @param SupportedLanguages A pointer to a Null-terminated ASCII string that\r
371 contains a set of language codes in the format \r
372 specified by Iso639Language.\r
373 @param Iso639Language If TRUE, then all language codes are assumed to be\r
374 in ISO 639-2 format. If FALSE, then all language\r
375 codes are assumed to be in RFC 4646 language format.\r
376\r
377 @retval NULL The best matching language could not be found in SupportedLanguages.\r
378 @retval NULL There are not enough resources available to return the best matching \r
379 language.\r
380 @retval Other A pointer to a Null-terminated ASCII string that is the best matching \r
381 language in SupportedLanguages.\r
382**/\r
383CHAR8 *\r
384DriverHealthSelectBestLanguage (\r
385 IN CHAR8 *SupportedLanguages,\r
386 IN BOOLEAN Iso639Language\r
387 );\r
388\r
389/**\r
390\r
391 This is an internal worker function to get the Component Name (2) protocol interface\r
392 and the language it supports.\r
393\r
394 @param ProtocolGuid A pointer to an EFI_GUID. It points to Component Name (2) protocol GUID.\r
395 @param DriverBindingHandle The handle on which the Component Name (2) protocol instance is retrieved.\r
396 @param ComponentName A pointer to the Component Name (2) protocol interface.\r
397 @param SupportedLanguage The best suitable language that matches the SupportedLangues interface for the \r
398 located Component Name (2) instance.\r
399\r
400 @retval EFI_SUCCESS The Component Name (2) protocol instance is successfully located and we find\r
401 the best matching language it support.\r
402 @retval EFI_UNSUPPORTED The input Language is not supported by the Component Name (2) protocol.\r
403 @retval Other Some error occurs when locating Component Name (2) protocol instance or finding\r
404 the supported language.\r
405\r
406**/\r
407EFI_STATUS\r
408GetComponentNameWorker (\r
409 IN EFI_GUID *ProtocolGuid,\r
410 IN EFI_HANDLE DriverBindingHandle,\r
411 OUT EFI_COMPONENT_NAME_PROTOCOL **ComponentName,\r
412 OUT CHAR8 **SupportedLanguage\r
413 );\r
414\r
415/**\r
416\r
417 This is an internal worker function to get driver name from Component Name (2) protocol interface.\r
418\r
419\r
420 @param ProtocolGuid A pointer to an EFI_GUID. It points to Component Name (2) protocol GUID.\r
421 @param DriverBindingHandle The handle on which the Component Name (2) protocol instance is retrieved.\r
422 @param DriverName A pointer to the Unicode string to return. This Unicode string is the name\r
423 of the driver specified by This.\r
424\r
425 @retval EFI_SUCCESS The driver name is successfully retrieved from Component Name (2) protocol\r
426 interface.\r
427 @retval Other The driver name cannot be retrieved from Component Name (2) protocol\r
428 interface.\r
429\r
430**/\r
431EFI_STATUS\r
432GetDriverNameWorker (\r
433 IN EFI_GUID *ProtocolGuid,\r
434 IN EFI_HANDLE DriverBindingHandle,\r
435 OUT CHAR16 **DriverName\r
436 );\r
437\r
438/**\r
439\r
440 This function gets driver name from Component Name 2 protocol interface and Component Name protocol interface\r
441 in turn. It first tries UEFI 2.0 Component Name 2 protocol interface and try to get the driver name.\r
442 If the attempt fails, it then gets the driver name from EFI 1.1 Component Name protocol for backward\r
443 compatibility support. \r
444\r
445 @param DriverBindingHandle The handle on which the Component Name (2) protocol instance is retrieved.\r
446 @param DriverName A pointer to the Unicode string to return. This Unicode string is the name\r
447 of the driver specified by This.\r
448\r
449 @retval EFI_SUCCESS The driver name is successfully retrieved from Component Name (2) protocol\r
450 interface.\r
451 @retval Other The driver name cannot be retrieved from Component Name (2) protocol\r
452 interface.\r
453\r
454**/\r
455EFI_STATUS\r
456DriverHealthGetDriverName (\r
457 IN EFI_HANDLE DriverBindingHandle,\r
458 OUT CHAR16 **DriverName\r
459 );\r
460\r
461/**\r
462 This function gets controller name from Component Name 2 protocol interface and Component Name protocol interface\r
463 in turn. It first tries UEFI 2.0 Component Name 2 protocol interface and try to get the controller name.\r
464 If the attempt fails, it then gets the controller name from EFI 1.1 Component Name protocol for backward\r
465 compatibility support. \r
466\r
467 @param ProtocolGuid A pointer to an EFI_GUID. It points to Component Name (2) protocol GUID.\r
468 @param DriverBindingHandle The handle on which the Component Name (2) protocol instance is retrieved.\r
469 @param ControllerHandle The handle of a controller that the driver specified by This is managing.\r
470 This handle specifies the controller whose name is to be returned.\r
471 @param ChildHandle The handle of the child controller to retrieve the name of. This is an\r
472 optional parameter that may be NULL. It will be NULL for device drivers.\r
473 It will also be NULL for bus drivers that attempt to retrieve the name\r
474 of the bus controller. It will not be NULL for a bus driver that attempts\r
475 to retrieve the name of a child controller.\r
476 @param ControllerName A pointer to the Unicode string to return. This Unicode string\r
477 is the name of the controller specified by ControllerHandle and ChildHandle.\r
478\r
479 @retval EFI_SUCCESS The controller name is successfully retrieved from Component Name (2) protocol\r
480 interface.\r
481 @retval Other The controller name cannot be retrieved from Component Name (2) protocol.\r
482\r
483**/\r
484EFI_STATUS\r
485GetControllerNameWorker (\r
486 IN EFI_GUID *ProtocolGuid,\r
487 IN EFI_HANDLE DriverBindingHandle,\r
488 IN EFI_HANDLE ControllerHandle,\r
489 IN EFI_HANDLE ChildHandle,\r
490 OUT CHAR16 **ControllerName\r
491 );\r
492\r
493/**\r
494 This function gets controller name from Component Name 2 protocol interface and Component Name protocol interface\r
495 in turn. It first tries UEFI 2.0 Component Name 2 protocol interface and try to get the controller name. \r
496 If the attempt fails, it then gets the controller name from EFI 1.1 Component Name protocol for backward\r
497 compatibility support. \r
498\r
499 @param DriverBindingHandle The handle on which the Component Name (2) protocol instance is retrieved.\r
500 @param ControllerHandle The handle of a controller that the driver specified by This is managing.\r
501 This handle specifies the controller whose name is to be returned.\r
502 @param ChildHandle The handle of the child controller to retrieve the name of. This is an\r
503 optional parameter that may be NULL. It will be NULL for device drivers.\r
504 It will also be NULL for bus drivers that attempt to retrieve the name\r
505 of the bus controller. It will not be NULL for a bus driver that attempts\r
506 to retrieve the name of a child controller.\r
507 @param ControllerName A pointer to the Unicode string to return. This Unicode string\r
508 is the name of the controller specified by ControllerHandle and ChildHandle.\r
509\r
510 @retval EFI_SUCCESS The controller name is successfully retrieved from Component Name (2) protocol\r
511 interface.\r
512 @retval Other The controller name cannot be retrieved from Component Name (2) protocol.\r
513\r
514**/\r
515EFI_STATUS\r
516DriverHealthGetControllerName (\r
517 IN EFI_HANDLE DriverBindingHandle,\r
518 IN EFI_HANDLE ControllerHandle,\r
519 IN EFI_HANDLE ChildHandle,\r
520 OUT CHAR16 **ControllerName\r
521 );\r
522\r
523#endif\r