]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkModulePkg/Include/Library/GenericBdsLib.h
Update comments for PeiReportStatusCodeLib.
[mirror_edk2.git] / IntelFrameworkModulePkg / Include / Library / GenericBdsLib.h
CommitLineData
ddac74d1 1/** @file\r
2 Generic BDS library definition, include the data structure and function.\r
3\r
4Copyright (c) 2004 - 2008, Intel Corporation. <BR>\r
5All rights reserved. This 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 _GENERIC_BDS_LIB_H_\r
16#define _GENERIC_BDS_LIB_H_\r
17\r
ddac74d1 18extern EFI_HANDLE mBdsImageHandle;\r
19\r
20//\r
21// Constants which are variable names used to access variables\r
22//\r
23#define VAR_LEGACY_DEV_ORDER L"LegacyDevOrder"\r
24\r
25//\r
26// Data structures and defines\r
27//\r
28#define FRONT_PAGE_QUESTION_ID 0x0000\r
29#define FRONT_PAGE_DATA_WIDTH 0x01\r
30\r
31//\r
32// ConnectType\r
33//\r
34#define CONSOLE_OUT 0x00000001\r
35#define STD_ERROR 0x00000002\r
36#define CONSOLE_IN 0x00000004\r
37#define CONSOLE_ALL (CONSOLE_OUT | CONSOLE_IN | STD_ERROR)\r
38\r
39//\r
40// Load Option Attributes defined in EFI Specification\r
41//\r
42#define LOAD_OPTION_ACTIVE 0x00000001\r
43#define LOAD_OPTION_FORCE_RECONNECT 0x00000002\r
44\r
45#define LOAD_OPTION_HIDDEN 0x00000008\r
46#define LOAD_OPTION_CATEGORY 0x00001F00\r
47\r
48#define LOAD_OPTION_CATEGORY_BOOT 0x00000000\r
49#define LOAD_OPTION_CATEGORY_APP 0x00000100\r
50\r
51#define EFI_BOOT_OPTION_SUPPORT_KEY 0x00000001\r
52#define EFI_BOOT_OPTION_SUPPORT_APP 0x00000002\r
53\r
54#define IS_LOAD_OPTION_TYPE(_c, _Mask) (BOOLEAN) (((_c) & (_Mask)) != 0)\r
55\r
56//\r
57// Define Maxmim characters that will be accepted\r
58//\r
59#define MAX_CHAR 480\r
60#define MAX_CHAR_SIZE (MAX_CHAR * 2)\r
61\r
62#define MIN_ALIGNMENT_SIZE 4\r
63#define ALIGN_SIZE(a) ((a % MIN_ALIGNMENT_SIZE) ? MIN_ALIGNMENT_SIZE - (a % MIN_ALIGNMENT_SIZE) : 0)\r
64\r
65//\r
66// Define maximum characters for boot option variable "BootXXXX"\r
67//\r
68#define BOOT_OPTION_MAX_CHAR 10\r
69\r
70//\r
71// This data structure is the part of BDS_CONNECT_ENTRY that we can hard code.\r
72//\r
73#define BDS_LOAD_OPTION_SIGNATURE SIGNATURE_32 ('B', 'd', 'C', 'O')\r
74\r
75typedef struct {\r
76\r
77 UINTN Signature;\r
78 LIST_ENTRY Link;\r
79\r
80 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
81\r
82 CHAR16 *OptionName;\r
83 UINTN OptionNumber;\r
84 UINT16 BootCurrent;\r
85 UINT32 Attribute;\r
86 CHAR16 *Description;\r
87 VOID *LoadOptions;\r
88 UINT32 LoadOptionsSize;\r
89 CHAR16 *StatusString;\r
90\r
91} BDS_COMMON_OPTION;\r
92\r
93typedef struct {\r
94 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
95 UINTN ConnectType;\r
96} BDS_CONSOLE_CONNECT_ENTRY;\r
97\r
98//\r
99// Lib Functions\r
100//\r
101\r
102//\r
103// Bds boot related lib functions\r
104//\r
105/**\r
106 Boot from the UEFI spec defined "BootNext" variable.\r
107\r
108**/\r
109VOID\r
110EFIAPI\r
111BdsLibBootNext (\r
112 VOID\r
113 );\r
114\r
115/**\r
116 Process the boot option follow the UEFI specification and\r
117 special treat the legacy boot option with BBS_DEVICE_PATH.\r
118\r
119 @param Option The boot option need to be processed\r
120 @param DevicePath The device path which describe where to load the\r
121 boot image or the legcy BBS device path to boot\r
122 the legacy OS\r
123 @param ExitDataSize The size of exit data.\r
124 @param ExitData Data returned when Boot image failed.\r
125\r
126 @retval EFI_SUCCESS Boot from the input boot option successfully.\r
127 @retval EFI_NOT_FOUND If the Device Path is not found in the system\r
128\r
129**/\r
130EFI_STATUS\r
131EFIAPI\r
132BdsLibBootViaBootOption (\r
133 IN BDS_COMMON_OPTION * Option,\r
134 IN EFI_DEVICE_PATH_PROTOCOL * DevicePath,\r
135 OUT UINTN *ExitDataSize,\r
136 OUT CHAR16 **ExitData OPTIONAL\r
137 );\r
138\r
139\r
140/**\r
141 This function will enumerate all possible boot device in the system,\r
142 it will only excute once of every boot.\r
143\r
144 @param BdsBootOptionList The header of the link list which indexed all\r
145 current boot options\r
146\r
147 @retval EFI_SUCCESS Finished all the boot device enumerate and create\r
148 the boot option base on that boot device\r
149\r
150**/\r
151EFI_STATUS\r
152EFIAPI\r
153BdsLibEnumerateAllBootOption (\r
154 IN OUT LIST_ENTRY *BdsBootOptionList\r
155 );\r
156\r
157/**\r
158 Build the boot option with the handle parsed in\r
159\r
160 @param Handle The handle which present the device path to create\r
161 boot option\r
162 @param BdsBootOptionList The header of the link list which indexed all\r
163 current boot options\r
164 @param String The description of the boot option.\r
165\r
166**/\r
167VOID\r
168EFIAPI\r
169BdsLibBuildOptionFromHandle (\r
170 IN EFI_HANDLE Handle,\r
171 IN LIST_ENTRY *BdsBootOptionList,\r
172 IN CHAR16 *String\r
173 );\r
174\r
175\r
176/**\r
177 Build the on flash shell boot option with the handle parsed in.\r
178\r
179 @param Handle The handle which present the device path to create\r
180 on flash shell boot option\r
181 @param BdsBootOptionList The header of the link list which indexed all\r
182 current boot options\r
183\r
184**/\r
185VOID\r
186EFIAPI\r
187BdsLibBuildOptionFromShell (\r
188 IN EFI_HANDLE Handle,\r
189 IN OUT LIST_ENTRY *BdsBootOptionList\r
190 );\r
191\r
192//\r
193// Bds misc lib functions\r
194//\r
ddac74d1 195/**\r
196 Get boot mode by looking up configuration table and parsing HOB list\r
197\r
198 @param BootMode Boot mode from PEI handoff HOB.\r
199\r
200 @retval EFI_SUCCESS Successfully get boot mode\r
201\r
202**/\r
203EFI_STATUS\r
204EFIAPI\r
205BdsLibGetBootMode (\r
206 OUT EFI_BOOT_MODE *BootMode\r
207 );\r
208\r
209\r
210/**\r
211 The function will go through the driver optoin link list, load and start\r
212 every driver the driver optoin device path point to.\r
213\r
214 @param BdsDriverLists The header of the current driver option link list\r
215\r
216**/\r
217VOID\r
218EFIAPI\r
219BdsLibLoadDrivers (\r
220 IN LIST_ENTRY *BdsDriverLists\r
221 );\r
222\r
223\r
224/**\r
225 Process BootOrder, or DriverOrder variables, by calling\r
226 BdsLibVariableToOption () for each UINT16 in the variables.\r
227\r
228 @param BdsCommonOptionList The header of the option list base on variable\r
229 VariableName\r
230 @param VariableName EFI Variable name indicate the BootOrder or\r
231 DriverOrder\r
232\r
233 @retval EFI_SUCCESS Success create the boot option or driver option\r
234 list\r
235 @retval EFI_OUT_OF_RESOURCES Failed to get the boot option or driver option list\r
236\r
237**/\r
238EFI_STATUS\r
239EFIAPI\r
240BdsLibBuildOptionFromVar (\r
241 IN LIST_ENTRY *BdsCommonOptionList,\r
242 IN CHAR16 *VariableName\r
243 );\r
244\r
245/**\r
246 Read the EFI variable (VendorGuid/Name) and return a dynamically allocated\r
247 buffer, and the size of the buffer. If failure return NULL.\r
248\r
249 @param Name String part of EFI variable name\r
250 @param VendorGuid GUID part of EFI variable name\r
251 @param VariableSize Returns the size of the EFI variable that was read\r
252\r
253 @return Dynamically allocated memory that contains a copy of the EFI variable\r
254 Caller is responsible freeing the buffer.\r
255 @retval NULL Variable was not read\r
256\r
257**/\r
258VOID *\r
259EFIAPI\r
260BdsLibGetVariableAndSize (\r
261 IN CHAR16 *Name,\r
262 IN EFI_GUID *VendorGuid,\r
263 OUT UINTN *VariableSize\r
264 );\r
265\r
266\r
267/**\r
268 This function prints a series of strings.\r
269\r
270 @param ConOut Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL\r
271 @param ... A variable argument list containing series of\r
272 strings, the last string must be NULL.\r
273\r
274 @retval EFI_SUCCESS Success print out the string using ConOut.\r
275 @retval EFI_STATUS Return the status of the ConOut->OutputString ().\r
276\r
277**/\r
278EFI_STATUS\r
279EFIAPI\r
280BdsLibOutputStrings (\r
281 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut,\r
282 ...\r
283 );\r
284\r
285/**\r
286 Build the boot#### or driver#### option from the VariableName, the\r
287 build boot#### or driver#### will also be linked to BdsCommonOptionList.\r
288\r
289 @param BdsCommonOptionList The header of the boot#### or driver#### option\r
290 link list\r
291 @param VariableName EFI Variable name indicate if it is boot#### or\r
292 driver####\r
293\r
294 @retval BDS_COMMON_OPTION Get the option just been created\r
295 @retval NULL Failed to get the new option\r
296\r
297**/\r
298BDS_COMMON_OPTION *\r
299EFIAPI\r
300BdsLibVariableToOption (\r
301 IN OUT LIST_ENTRY *BdsCommonOptionList,\r
302 IN CHAR16 *VariableName\r
303 );\r
304\r
305/**\r
306 This function will register the new boot#### or driver#### option base on\r
307 the VariableName. The new registered boot#### or driver#### will be linked\r
308 to BdsOptionList and also update to the VariableName. After the boot#### or\r
309 driver#### updated, the BootOrder or DriverOrder will also be updated.\r
310\r
311 @param BdsOptionList The header of the boot#### or driver#### link list\r
312 @param DevicePath The device path which the boot#### or driver####\r
313 option present\r
314 @param String The description of the boot#### or driver####\r
315 @param VariableName Indicate if the boot#### or driver#### option\r
316\r
317 @retval EFI_SUCCESS The boot#### or driver#### have been success\r
318 registered\r
319 @retval EFI_STATUS Return the status of gRT->SetVariable ().\r
320\r
321**/\r
322EFI_STATUS\r
323EFIAPI\r
324BdsLibRegisterNewOption (\r
325 IN LIST_ENTRY *BdsOptionList,\r
326 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
327 IN CHAR16 *String,\r
328 IN CHAR16 *VariableName\r
329 );\r
330\r
331//\r
332// Bds connect or disconnect driver lib funcion\r
333//\r
334/**\r
335 Connects all drivers to all controllers.\r
336 This function make sure all the current system driver will manage\r
337 the correspoinding controllers if have. And at the same time, make\r
338 sure all the system controllers have driver to manage it if have.\r
339\r
340**/\r
341VOID\r
342EFIAPI\r
343BdsLibConnectAllDriversToAllControllers (\r
344 VOID\r
345 );\r
346\r
347/**\r
348 This function will connect all the system driver to controller\r
349 first, and then special connect the default console, this make\r
350 sure all the system controller available and the platform default\r
351 console connected.\r
352\r
353**/\r
354VOID\r
355EFIAPI\r
356BdsLibConnectAll (\r
357 VOID\r
358 );\r
359\r
360/**\r
361 This function will create all handles associate with every device\r
362 path node. If the handle associate with one device path node can not\r
363 be created success, then still give one chance to do the dispatch,\r
364 which load the missing drivers if possible.\r
365\r
366 @param DevicePathToConnect The device path which will be connected, it can be\r
367 a multi-instance device path\r
368\r
369 @retval EFI_SUCCESS All handles associate with every device path node\r
370 have been created\r
371 @retval EFI_OUT_OF_RESOURCES There is no resource to create new handles\r
372 @retval EFI_NOT_FOUND Create the handle associate with one device path\r
373 node failed\r
374\r
375**/\r
376EFI_STATUS\r
377EFIAPI\r
378BdsLibConnectDevicePath (\r
379 IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect\r
380 );\r
381\r
382/**\r
383 This function will connect all current system handles recursively. The\r
384 connection will finish until every handle's child handle created if it have.\r
385\r
386 @retval EFI_SUCCESS All handles and it's child handle have been\r
387 connected\r
388 @retval EFI_STATUS Return the status of gBS->LocateHandleBuffer().\r
389\r
390**/\r
391EFI_STATUS\r
392EFIAPI\r
393BdsLibConnectAllEfi (\r
394 VOID\r
395 );\r
396\r
397\r
398/**\r
399 This function will disconnect all current system handles. The disconnection\r
400 will finish until every handle have been disconnected.\r
401\r
402 @retval EFI_SUCCESS All handles have been disconnected\r
403 @retval EFI_STATUS Return the status of gBS->LocateHandleBuffer().\r
404\r
405**/\r
406EFI_STATUS\r
407EFIAPI\r
408BdsLibDisconnectAllEfi (\r
409 VOID\r
410 );\r
411\r
412//\r
413// Bds console related lib functions\r
414//\r
415/**\r
416 This function will search every simpletxt devive in current system,\r
417 and make every simpletxt device as pertantial console device.\r
418\r
419**/\r
420VOID\r
421EFIAPI\r
422BdsLibConnectAllConsoles (\r
423 VOID\r
424 );\r
425\r
426\r
427/**\r
428 This function will connect console device base on the console\r
429 device variable ConIn, ConOut and ErrOut.\r
430\r
431 @retval EFI_SUCCESS At least one of the ConIn and ConOut device have\r
432 been connected success.\r
433 @retval EFI_STATUS Return the status of BdsLibConnectConsoleVariable ().\r
434\r
435**/\r
436EFI_STATUS\r
437EFIAPI\r
438BdsLibConnectAllDefaultConsoles (\r
439 VOID\r
440 );\r
441\r
442/**\r
443 This function update console variable based on ConVarName, it can\r
444 add or remove one specific console device path from the variable\r
445\r
446 @param ConVarName Console related variable name, ConIn, ConOut,\r
447 ErrOut.\r
448 @param CustomizedConDevicePath The console device path which will be added to\r
449 the console variable ConVarName, this parameter\r
450 can not be multi-instance.\r
451 @param ExclusiveDevicePath The console device path which will be removed\r
452 from the console variable ConVarName, this\r
453 parameter can not be multi-instance.\r
454\r
455 @retval EFI_UNSUPPORTED The added device path is same to the removed one.\r
456 @retval EFI_SUCCESS Success add or remove the device path from the\r
457 console variable.\r
458\r
459**/\r
460EFI_STATUS\r
461EFIAPI\r
462BdsLibUpdateConsoleVariable (\r
463 IN CHAR16 *ConVarName,\r
464 IN EFI_DEVICE_PATH_PROTOCOL *CustomizedConDevicePath,\r
465 IN EFI_DEVICE_PATH_PROTOCOL *ExclusiveDevicePath\r
466 );\r
467\r
468/**\r
469 Connect the console device base on the variable ConVarName, if\r
470 device path of the ConVarName is multi-instance device path, if\r
471 anyone of the instances is connected success, then this function\r
472 will return success.\r
473\r
474 @param ConVarName Console related variable name, ConIn, ConOut,\r
475 ErrOut.\r
476\r
477 @retval EFI_NOT_FOUND There is not any console devices connected\r
478 success\r
479 @retval EFI_SUCCESS Success connect any one instance of the console\r
480 device path base on the variable ConVarName.\r
481\r
482**/\r
483EFI_STATUS\r
484EFIAPI\r
485BdsLibConnectConsoleVariable (\r
486 IN CHAR16 *ConVarName\r
487 );\r
488\r
489//\r
490// Bds device path related lib functions\r
491//\r
492/**\r
493 Delete the instance in Multi which matches partly with Single instance\r
494\r
495 @param Multi A pointer to a multi-instance device path data\r
496 structure.\r
497 @param Single A pointer to a single-instance device path data\r
498 structure.\r
499\r
500 @return This function will remove the device path instances in Multi which partly\r
501 match with the Single, and return the result device path. If there is no\r
502 remaining device path as a result, this function will return NULL.\r
503\r
504**/\r
505EFI_DEVICE_PATH_PROTOCOL *\r
506EFIAPI\r
507BdsLibDelPartMatchInstance (\r
508 IN EFI_DEVICE_PATH_PROTOCOL *Multi,\r
509 IN EFI_DEVICE_PATH_PROTOCOL *Single\r
510 );\r
511\r
512/**\r
513 Function compares a device path data structure to that of all the nodes of a\r
514 second device path instance.\r
515\r
516 @param Multi A pointer to a multi-instance device path data\r
517 structure.\r
518 @param Single A pointer to a single-instance device path data\r
519 structure.\r
520\r
521 @retval TRUE If the Single device path is contained within Multi device path.\r
522 @retval FALSE The Single device path is not match within Multi device path.\r
523\r
524**/\r
525BOOLEAN\r
526EFIAPI\r
527BdsLibMatchDevicePaths (\r
528 IN EFI_DEVICE_PATH_PROTOCOL *Multi,\r
529 IN EFI_DEVICE_PATH_PROTOCOL *Single\r
530 );\r
531\r
532/**\r
533 This function converts an input device structure to a Unicode string.\r
534\r
535 @param DevPath A pointer to the device path structure.\r
536\r
537 @return A new allocated Unicode string that represents the device path.\r
538\r
539**/\r
540CHAR16 *\r
541EFIAPI\r
542DevicePathToStr (\r
543 IN EFI_DEVICE_PATH_PROTOCOL *DevPath\r
544 );\r
545\r
546\r
547//\r
548// Internal definitions\r
549//\r
550typedef struct {\r
551 CHAR16 *str;\r
552 UINTN len;\r
553 UINTN maxlen;\r
554} POOL_PRINT;\r
555\r
556typedef struct {\r
557 UINT8 Type;\r
558 UINT8 SubType;\r
559 VOID (*Function) (POOL_PRINT *, VOID *);\r
560} DEVICE_PATH_STRING_TABLE;\r
561\r
562extern EFI_GUID mEfiDevicePathMessagingUartFlowControlGuid;\r
563\r
564typedef struct {\r
565 EFI_DEVICE_PATH_PROTOCOL Header;\r
566 EFI_GUID Guid;\r
567 UINT8 VendorDefinedData[1];\r
568} VENDOR_DEVICE_PATH_WITH_DATA;\r
569\r
570\r
571extern EFI_GUID mEfiDevicePathMessagingSASGuid;\r
572\r
573typedef struct {\r
574 EFI_DEVICE_PATH_PROTOCOL Header;\r
575 UINT16 NetworkProtocol;\r
576 UINT16 LoginOption;\r
577 UINT64 Lun;\r
578 UINT16 TargetPortalGroupTag;\r
579 CHAR16 iSCSITargetName[1];\r
580} ISCSI_DEVICE_PATH_WITH_NAME;\r
581\r
582\r
583//\r
584// Notes: EFI 64 shadow all option rom\r
585//\r
586#if defined (MDE_CPU_IPF)\r
587#define EFI64_SHADOW_ALL_LEGACY_ROM() ShadowAllOptionRom ();\r
588#else\r
589#define EFI64_SHADOW_ALL_LEGACY_ROM()\r
590#endif\r
591\r
592/**\r
593 Shadow all Legacy OptionRom. \r
594\r
595**/\r
596VOID\r
597EFIAPI\r
598ShadowAllOptionRom (\r
599 VOID\r
600 );\r
601\r
602//\r
603// BBS support macros and functions\r
604//\r
605\r
606#if defined(MDE_CPU_IA32) || defined(MDE_CPU_X64)\r
607#define REFRESH_LEGACY_BOOT_OPTIONS \\r
608 BdsDeleteAllInvalidLegacyBootOptions ();\\r
609 BdsAddNonExistingLegacyBootOptions (); \\r
610 BdsUpdateLegacyDevOrder ()\r
611#else\r
612#define REFRESH_LEGACY_BOOT_OPTIONS\r
613#endif\r
614\r
615/**\r
616 Delete all the invalid legacy boot options.\r
617\r
618 @retval EFI_SUCCESS All invalide legacy boot options are deleted.\r
619 @retval EFI_OUT_OF_RESOURCES Fail to allocate necessary memory.\r
620 @retval EFI_NOT_FOUND Fail to retrive variable of boot order.\r
621\r
622**/\r
623EFI_STATUS\r
624EFIAPI\r
625BdsDeleteAllInvalidLegacyBootOptions (\r
626 VOID\r
627 );\r
628\r
629/**\r
630\r
631 Add the legacy boot options from BBS table if they do not exist.\r
632\r
633 @retval EFI_SUCCESS The boot options are added successfully \r
634 or they are already in boot options.\r
635\r
636**/\r
637EFI_STATUS\r
638EFIAPI\r
639BdsAddNonExistingLegacyBootOptions (\r
640 VOID\r
641 );\r
642\r
643/**\r
644\r
645 Add the legacy boot devices from BBS table into \r
646 the legacy device boot order.\r
647\r
648 @retval EFI_SUCCESS The boot devices are added successfully.\r
649\r
650**/\r
651EFI_STATUS\r
652EFIAPI\r
653BdsUpdateLegacyDevOrder (\r
654 VOID\r
655 );\r
656\r
657/**\r
658\r
659 Set the boot priority for BBS entries based on boot option entry and boot order.\r
660\r
661 @param Entry The boot option is to be checked for refresh BBS table.\r
662 \r
663 @retval EFI_SUCCESS The boot priority for BBS entries is refreshed successfully.\r
664\r
665**/\r
666EFI_STATUS\r
667EFIAPI\r
668BdsRefreshBbsTableForBoot (\r
669 IN BDS_COMMON_OPTION *Entry\r
670 );\r
671\r
672/**\r
673\r
674 Delete boot option specified by OptionNumber and adjust the boot order.\r
675\r
676 @param OptionNumber The boot option to be deleted.\r
677 @param BootOrder Boot order list to be adjusted by remove this boot option.\r
678 @param BootOrderSize The size of Boot order list will be modified.\r
679 \r
680 @retval EFI_SUCCESS The boot option is deleted successfully.\r
681\r
682**/\r
683EFI_STATUS\r
684EFIAPI\r
685BdsDeleteBootOption (\r
686 IN UINTN OptionNumber,\r
687 IN OUT UINT16 *BootOrder,\r
688 IN OUT UINTN *BootOrderSize\r
689 );\r
690\r
691//\r
692//The interface functions relate with Setup Browser Reset Reminder feature\r
693//\r
694/**\r
695 Enable the setup browser reset reminder feature.\r
696 This routine is used in platform tip. If the platform policy need the feature, use the routine to enable it.\r
697\r
698**/\r
699VOID\r
700EFIAPI\r
701EnableResetReminderFeature (\r
702 VOID\r
703 );\r
704\r
705/**\r
706 Disable the setup browser reset reminder feature.\r
707 This routine is used in platform tip. If the platform policy do not want the feature, use the routine to disable it.\r
708\r
709**/\r
710VOID\r
711EFIAPI\r
712DisableResetReminderFeature (\r
713 VOID\r
714 );\r
715\r
716/**\r
717 Record the info that a reset is required.\r
718 A module boolean variable is used to record whether a reset is required.\r
719\r
720**/\r
721VOID\r
722EFIAPI\r
723EnableResetRequired (\r
724 VOID\r
725 );\r
726\r
727\r
728/**\r
729 Record the info that no reset is required.\r
730 A module boolean variable is used to record whether a reset is required.\r
731\r
732**/\r
733VOID\r
734EFIAPI\r
735DisableResetRequired (\r
736 VOID\r
737 );\r
738\r
739/**\r
740 Check whether platform policy enable the reset reminder feature. The default is enabled.\r
741\r
742**/\r
743BOOLEAN\r
744EFIAPI\r
745IsResetReminderFeatureEnable (\r
746 VOID\r
747 );\r
748\r
749/**\r
750 Check if user changed any option setting which needs a system reset to be effective.\r
751\r
752**/\r
753BOOLEAN\r
754EFIAPI\r
755IsResetRequired (\r
756 VOID\r
757 );\r
758\r
759/**\r
760 Check whether a reset is needed, and finish the reset reminder feature.\r
761 If a reset is needed, Popup a menu to notice user, and finish the feature\r
762 according to the user selection.\r
763\r
764**/\r
765VOID\r
766EFIAPI\r
767SetupResetReminder (\r
768 VOID\r
769 );\r
770\r
ddac74d1 771//\r
772// Define the boot type which to classify the boot option type\r
773// Different boot option type could have different boot behavior\r
774// Use their device path node (Type + SubType) as type value\r
775// The boot type here can be added according to requirement\r
776//\r
777//\r
778// ACPI boot type. For ACPI device, cannot use sub-type to distinguish device, so hardcode their value\r
779//\r
780#define BDS_EFI_ACPI_FLOPPY_BOOT 0x0201\r
781//\r
782// Message boot type\r
783// If a device path of boot option only point to a message node, the boot option is message boot type\r
784//\r
785#define BDS_EFI_MESSAGE_ATAPI_BOOT 0x0301 // Type 03; Sub-Type 01\r
786#define BDS_EFI_MESSAGE_SCSI_BOOT 0x0302 // Type 03; Sub-Type 02\r
787#define BDS_EFI_MESSAGE_USB_DEVICE_BOOT 0x0305 // Type 03; Sub-Type 05\r
788#define BDS_EFI_MESSAGE_MISC_BOOT 0x03FF\r
789//\r
790// Media boot type\r
791// If a device path of boot option contain a media node, the boot option is media boot type\r
792//\r
793#define BDS_EFI_MEDIA_HD_BOOT 0x0401 // Type 04; Sub-Type 01\r
794#define BDS_EFI_MEDIA_CDROM_BOOT 0x0402 // Type 04; Sub-Type 02\r
795//\r
796// BBS boot type\r
797// If a device path of boot option contain a BBS node, the boot option is BBS boot type\r
798//\r
799#define BDS_LEGACY_BBS_BOOT 0x0501 // Type 05; Sub-Type 01\r
800\r
801#define BDS_EFI_UNSUPPORT 0xFFFF\r
802\r
803//\r
804// USB host controller Programming Interface.\r
805//\r
806#define PCI_CLASSC_PI_UHCI 0x00\r
807#define PCI_CLASSC_PI_EHCI 0x20\r
808\r
809/**\r
810 Check whether there is a instance in BlockIoDevicePath, which contain multi device path\r
811 instances, has the same partition node with HardDriveDevicePath device path\r
812\r
813 @param BlockIoDevicePath Multi device path instances which need to check\r
814 @param HardDriveDevicePath A device path which starts with a hard drive media\r
815 device path.\r
816\r
817 @retval TRUE There is a matched device path instance.\r
818 @retval FALSE There is no matched device path instance.\r
819\r
820**/\r
821BOOLEAN\r
822EFIAPI\r
823MatchPartitionDevicePathNode (\r
824 IN EFI_DEVICE_PATH_PROTOCOL *BlockIoDevicePath,\r
825 IN HARDDRIVE_DEVICE_PATH *HardDriveDevicePath\r
826 );\r
827\r
828\r
829/**\r
830 Expand a device path that starts with a hard drive media device path node to be a\r
831 full device path that includes the full hardware path to the device. We need\r
832 to do this so it can be booted. As an optimizaiton the front match (the part point\r
833 to the partition node. E.g. ACPI() /PCI()/ATA()/Partition() ) is saved in a variable\r
834 so a connect all is not required on every boot. All successful history device path\r
835 which point to partition node (the front part) will be saved.\r
836\r
837 @param HardDriveDevicePath EFI Device Path to boot, if it starts with a hard\r
838 drive media device path.\r
839 @return A Pointer to the full device path or NULL if a valid Hard Drive devic path\r
840 cannot be found.\r
841\r
842**/\r
843EFI_DEVICE_PATH_PROTOCOL *\r
844EFIAPI\r
845BdsExpandPartitionPartialDevicePathToFull (\r
846 IN HARDDRIVE_DEVICE_PATH *HardDriveDevicePath\r
847 );\r
848 \r
849/**\r
850 Return the bootable media handle.\r
851 First, check the device is connected\r
852 Second, check whether the device path point to a device which support SimpleFileSystemProtocol,\r
853 Third, detect the the default boot file in the Media, and return the removable Media handle.\r
854\r
855 @param DevicePath Device Path to a bootable device\r
856\r
857 @retval NULL The media on the DevicePath is not bootable\r
858\r
859**/\r
860EFI_HANDLE\r
861EFIAPI\r
862BdsLibGetBootableHandle (\r
863 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
864 );\r
865 \r
866\r
867/**\r
868 Check whether the Device path in a boot option point to a valide bootable device,\r
869 And if CheckMedia is true, check the device is ready to boot now.\r
870\r
871 @param DevPath the Device path in a boot option\r
872 @param CheckMedia if true, check the device is ready to boot now.\r
873\r
874 @retval TRUE the Device path is valide\r
875 @retval FALSE the Device path is invalide .\r
876\r
877**/\r
878BOOLEAN\r
879EFIAPI\r
880BdsLibIsValidEFIBootOptDevicePath (\r
881 IN EFI_DEVICE_PATH_PROTOCOL *DevPath,\r
882 IN BOOLEAN CheckMedia\r
883 );\r
884 \r
885/**\r
886 For a bootable Device path, return its boot type.\r
887\r
888 @param DevicePath The bootable device Path to check\r
889\r
890 @retval BDS_EFI_MEDIA_HD_BOOT If the device path contains any media deviec path node, it is media boot type\r
891 For the floppy node, handle it as media node\r
892 @retval BDS_EFI_MEDIA_CDROM_BOOT If the device path contains any media deviec path node, it is media boot type\r
893 For the floppy node, handle it as media node\r
894 @retval BDS_EFI_ACPI_FLOPPY_BOOT If the device path contains any media deviec path node, it is media boot type\r
895 For the floppy node, handle it as media node\r
896 @retval BDS_EFI_MESSAGE_ATAPI_BOOT If the device path not contains any media deviec path node, and\r
897 its last device path node point to a message device path node, it is\r
898 \r
899 @retval BDS_EFI_MESSAGE_SCSI_BOOT If the device path not contains any media deviec path node, and\r
900 its last device path node point to a message device path node, it is\r
901 @retval BDS_EFI_MESSAGE_USB_DEVICE_BOOT If the device path not contains any media deviec path node, and\r
902 its last device path node point to a message device path node, it is\r
903 @retval BDS_EFI_MESSAGE_MISC_BOOT If the device path not contains any media deviec path node, and\r
904 its last device path node point to a message device path node, it is\r
905 @retval BDS_LEGACY_BBS_BOOT Legacy boot type\r
906 @retval BDS_EFI_UNSUPPORT An EFI Removable BlockIO device path not point to a media and message devie, \r
907\r
908**/\r
909UINT32\r
910EFIAPI\r
911BdsGetBootTypeFromDevicePath (\r
912 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
913 );\r
914\r
915\r
916/**\r
917 This routine register a function to adjust the different type memory page number\r
918 just before booting and save the updated info into the variable for next boot to use.\r
919\r
920**/\r
921VOID\r
922EFIAPI\r
923BdsLibSaveMemoryTypeInformation (\r
924 VOID\r
925 );\r
926 \r
927\r
928/**\r
929 According to a file guild, check a Fv file device path is valid. If it is invalid,\r
930 try to return the valid device path.\r
931 FV address maybe changes for memory layout adjust from time to time, use this funciton\r
932 could promise the Fv file device path is right.\r
933\r
934 @param DevicePath on input, the Fv file device path need to check on\r
935 output, the updated valid Fv file device path\r
936 @param FileGuid the Fv file guild\r
937\r
938 @retval EFI_INVALID_PARAMETER the input DevicePath or FileGuid is invalid\r
939 parameter\r
940 @retval EFI_UNSUPPORTED the input DevicePath does not contain Fv file\r
941 guild at all\r
942 @retval EFI_ALREADY_STARTED the input DevicePath has pointed to Fv file, it is\r
943 valid\r
944 @retval EFI_SUCCESS has successfully updated the invalid DevicePath,\r
945 and return the updated device path in DevicePath\r
946\r
947**/\r
948EFI_STATUS\r
949EFIAPI\r
950BdsLibUpdateFvFileDevicePath (\r
951 IN OUT EFI_DEVICE_PATH_PROTOCOL ** DevicePath,\r
952 IN EFI_GUID *FileGuid\r
953 );\r
954\r
955\r
956/**\r
957 Connect the specific Usb device which match the short form device path,\r
958 and whose bus is determined by Host Controller (Uhci or Ehci)\r
959\r
960 @param HostControllerPI Uhci (0x00) or Ehci (0x20) or Both uhci and ehci\r
961 (0xFF)\r
962 @param RemainingDevicePath a short-form device path that starts with the first\r
963 element being a USB WWID or a USB Class device\r
964 path\r
965\r
966 @retval EFI_SUCCESS The specific Usb device is connected successfully.\r
967 @retval EFI_INVALID_PARAMETER Invalid HostControllerPi (not 0x00, 0x20 or 0xFF) \r
968 or RemainingDevicePath is not the USB class device path.\r
969 @retval EFI_NOT_FOUND The device specified by device path is not found.\r
970\r
971**/\r
972EFI_STATUS\r
973EFIAPI\r
974BdsLibConnectUsbDevByShortFormDP(\r
975 IN UINT8 HostControllerPI,\r
976 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
977 );\r
978 \r
979\r
980//\r
981// The implementation of this function is provided by Platform code.\r
982//\r
983/**\r
984 Convert Vendor device path to device name.\r
985\r
986 @param Str The buffer store device name\r
987 @param DevPath Pointer to vendor device path\r
988\r
989**/\r
990VOID\r
ddac74d1 991DevPathVendor (\r
992 IN OUT POOL_PRINT *Str,\r
993 IN VOID *DevPath\r
994 );\r
995\r
996/**\r
997 Concatenates a formatted unicode string to allocated pool.\r
998 The caller must free the resulting buffer.\r
999\r
1000 @param Str Tracks the allocated pool, size in use, and amount of pool allocated.\r
1001 @param fmt The format string\r
1002 @param ... The data will be printed.\r
1003\r
1004 @return Allocated buffer with the formatted string printed in it.\r
1005 The caller must free the allocated buffer.\r
1006 The buffer allocation is not packed.\r
1007\r
1008**/\r
1009CHAR16 *\r
1010EFIAPI\r
1011CatPrint (\r
1012 IN OUT POOL_PRINT *Str,\r
1013 IN CHAR16 *fmt,\r
1014 ...\r
1015 );\r
1016\r
1017/**\r
1018 Use Console Control to turn off UGA based Simple Text Out consoles from going\r
1019 to the UGA device. Put up LogoFile on every UGA device that is a console\r
1020\r
1021 @param[in] LogoFile File name of logo to display on the center of the screen.\r
1022\r
1023 @retval EFI_SUCCESS ConsoleControl has been flipped to graphics and logo displayed.\r
1024 @retval EFI_UNSUPPORTED Logo not found\r
1025\r
1026**/\r
1027EFI_STATUS\r
1028EFIAPI\r
1029EnableQuietBoot (\r
1030 IN EFI_GUID *LogoFile\r
1031 );\r
1032\r
1033\r
1034/**\r
1035 Use Console Control to turn on UGA based Simple Text Out consoles. The UGA \r
1036 Simple Text Out screens will now be synced up with all non UGA output devices\r
1037\r
1038 @retval EFI_SUCCESS UGA devices are back in text mode and synced up.\r
1039\r
1040**/\r
1041EFI_STATUS\r
1042EFIAPI\r
1043DisableQuietBoot (\r
1044 VOID\r
1045 );\r
1046\r
1047/**\r
1048 Use Console Control Protocol to lock the Console In Spliter virtual handle. \r
1049 This is the ConInHandle and ConIn handle in the EFI system table. All key\r
1050 presses will be ignored until the Password is typed in. The only way to\r
1051 disable the password is to type it in to a ConIn device.\r
1052\r
1053 @param Password Password used to lock ConIn device.\r
1054\r
1055 @retval EFI_SUCCESS lock the Console In Spliter virtual handle successfully.\r
1056 @retval EFI_UNSUPPORTED Password not found\r
1057\r
1058**/\r
1059EFI_STATUS\r
1060EFIAPI\r
1061LockKeyboards (\r
1062 IN CHAR16 *Password\r
1063 );\r
1064\r
1065#endif\r
1066\r