2 Generic BDS library defines general interfaces for a BDS driver, including:
3 1) BDS boot policy interface.
4 2) BDS boot device connect interface.
5 3) BDS Misc interfaces for mainting boot variable, ouput string.
7 Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
8 This program and the accompanying materials are licensed and made available under
9 the terms and conditions of the BSD License that accompanies this distribution.
10 The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php.
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 #ifndef _GENERIC_BDS_LIB_H_
19 #define _GENERIC_BDS_LIB_H_
21 #include <Protocol/UserManager.h>
24 /// Constants which are variable names used to access variables.
26 #define VAR_LEGACY_DEV_ORDER L"LegacyDevOrder"
29 /// Data structures and defines.
31 #define FRONT_PAGE_QUESTION_ID 0x0000
32 #define FRONT_PAGE_DATA_WIDTH 0x01
37 #define CONSOLE_OUT 0x00000001
38 #define STD_ERROR 0x00000002
39 #define CONSOLE_IN 0x00000004
40 #define CONSOLE_ALL (CONSOLE_OUT | CONSOLE_IN | STD_ERROR)
43 /// Load Option Attributes
45 #define LOAD_OPTION_ACTIVE 0x00000001
46 #define LOAD_OPTION_FORCE_RECONNECT 0x00000002
48 #define LOAD_OPTION_HIDDEN 0x00000008
49 #define LOAD_OPTION_CATEGORY 0x00001F00
51 #define LOAD_OPTION_CATEGORY_BOOT 0x00000000
52 #define LOAD_OPTION_CATEGORY_APP 0x00000100
54 #define EFI_BOOT_OPTION_SUPPORT_KEY 0x00000001
55 #define EFI_BOOT_OPTION_SUPPORT_APP 0x00000002
57 #define IS_LOAD_OPTION_TYPE(_c, _Mask) (BOOLEAN) (((_c) & (_Mask)) != 0)
60 /// Define the maximum characters that will be accepted.
63 #define MAX_CHAR_SIZE (MAX_CHAR * 2)
66 /// Define maximum characters for boot option variable "BootXXXX".
68 #define BOOT_OPTION_MAX_CHAR 10
71 // This data structure is the part of BDS_CONNECT_ENTRY
73 #define BDS_LOAD_OPTION_SIGNATURE SIGNATURE_32 ('B', 'd', 'C', 'O')
80 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
88 UINT32 LoadOptionsSize
;
94 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
96 } BDS_CONSOLE_CONNECT_ENTRY
;
99 // Bds boot related lib functions
102 Boot from the UEFI spec defined "BootNext" variable.
112 Process the boot option according to the UEFI specification. The legacy boot option device path includes BBS_DEVICE_PATH.
114 @param Option The boot option to be processed.
115 @param DevicePath The device path describing where to load the
116 boot image or the legcy BBS device path to boot
118 @param ExitDataSize The size of exit data.
119 @param ExitData Data returned when Boot image failed.
121 @retval EFI_SUCCESS Boot from the input boot option succeeded.
122 @retval EFI_NOT_FOUND The Device Path is not found in the system.
127 BdsLibBootViaBootOption (
128 IN BDS_COMMON_OPTION
* Option
,
129 IN EFI_DEVICE_PATH_PROTOCOL
* DevicePath
,
130 OUT UINTN
*ExitDataSize
,
131 OUT CHAR16
**ExitData OPTIONAL
136 This function will enumerate all possible boot devices in the system, and
137 automatically create boot options for Network, Shell, Removable BlockIo,
138 and Non-BlockIo Simplefile devices.
140 BDS separates EFI boot options into six types:
141 1. Network - The boot option points to the SimpleNetworkProtocol device.
142 Bds will try to automatically create this type of boot option during enumeration.
143 2. Shell - The boot option points to internal flash shell.
144 Bds will try to automatically create this type of boot option during enumeration.
145 3. Removable BlockIo - The boot option points to a removable media
146 device, such as a USB flash drive or DVD drive.
147 These devices should contain a *removable* blockIo
148 protocol in their device handle.
149 Bds will try to automatically create this type boot option
151 4. Fixed BlockIo - The boot option points to a Fixed blockIo device,
153 These devices should contain a *fixed* blockIo
154 protocol in their device handle.
155 BDS will skip fixed blockIo devices, and not
156 automatically create boot option for them. But BDS
157 will help to delete those fixed blockIo boot options,
158 whose description rules conflict with other auto-created
160 5. Non-BlockIo Simplefile - The boot option points to a device whose handle
161 has SimpleFileSystem Protocol, but has no blockio
162 protocol. These devices do not offer blockIo
163 protocol, but BDS still can get the
164 \EFI\BOOT\boot{machinename}.EFI by SimpleFileSystem
166 6. File - The boot option points to a file. These boot options are usually
167 created by the user, either manually or with an OS loader. BDS will not delete or modify
170 This function will enumerate all possible boot devices in the system, and
171 automatically create boot options for Network, Shell, Removable BlockIo,
172 and Non-BlockIo Simplefile devices.
173 It will excute once every boot.
175 @param BdsBootOptionList The header of the linked list that indexed all
176 current boot options.
178 @retval EFI_SUCCESS Finished all the boot device enumerations and
179 created the boot option based on the boot device.
181 @retval EFI_OUT_OF_RESOURCES Failed to enumerate the boot device and create
182 the boot option list.
186 BdsLibEnumerateAllBootOption (
187 IN OUT LIST_ENTRY
*BdsBootOptionList
191 Build the boot option with the handle parsed in.
193 @param Handle The handle representing the device path for which
194 to create a boot option.
195 @param BdsBootOptionList The header of the link list that indexed all
196 current boot options.
197 @param String The description of the boot option.
202 BdsLibBuildOptionFromHandle (
203 IN EFI_HANDLE Handle
,
204 IN LIST_ENTRY
*BdsBootOptionList
,
210 Build the on flash shell boot option with the handle parsed in.
212 @param Handle The handle which present the device path to create
213 the on flash shell boot option.
214 @param BdsBootOptionList The header of the link list that indexed all
215 current boot options.
220 BdsLibBuildOptionFromShell (
221 IN EFI_HANDLE Handle
,
222 IN OUT LIST_ENTRY
*BdsBootOptionList
226 // Bds misc lib functions
229 Get boot mode by looking up the configuration table and parsing the HOB list.
231 @param BootMode The boot mode from PEI handoff HOB.
233 @retval EFI_SUCCESS Successfully got boot mode.
239 OUT EFI_BOOT_MODE
*BootMode
244 The function will go through the driver option link list, and then load and start
245 every driver to which the driver option device path points.
247 @param BdsDriverLists The header of the current driver option link list.
253 IN LIST_ENTRY
*BdsDriverLists
258 This function processes BootOrder or DriverOrder variables, by calling
260 BdsLibVariableToOption () for each UINT16 in the variables.
262 @param BdsCommonOptionList The header of the option list base on the variable
264 @param VariableName An EFI Variable name indicate the BootOrder or
267 @retval EFI_SUCCESS Successfully created the boot option or driver option
269 @retval EFI_OUT_OF_RESOURCES Failed to get the boot option or the driver option list.
273 BdsLibBuildOptionFromVar (
274 IN LIST_ENTRY
*BdsCommonOptionList
,
275 IN CHAR16
*VariableName
279 This function reads the EFI variable (VendorGuid/Name) and returns a dynamically allocated
280 buffer and the size of the buffer. If it fails, return NULL.
282 @param Name The string part of the EFI variable name.
283 @param VendorGuid The GUID part of the EFI variable name.
284 @param VariableSize Returns the size of the EFI variable that was read.
286 @return Dynamically allocated memory that contains a copy
287 of the EFI variable. The caller is responsible for
289 @retval NULL The variable was not read.
294 BdsLibGetVariableAndSize (
296 IN EFI_GUID
*VendorGuid
,
297 OUT UINTN
*VariableSize
302 This function prints a series of strings.
304 @param ConOut A pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.
305 @param ... A variable argument list containing a series of
306 strings, the last string must be NULL.
308 @retval EFI_SUCCESS Successfully printed out the string using ConOut.
309 @retval EFI_STATUS Return the status of the ConOut->OutputString ().
314 BdsLibOutputStrings (
315 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*ConOut
,
320 Build the boot#### or driver#### option from the VariableName. The
321 build boot#### or driver#### will also be linked to BdsCommonOptionList.
323 @param BdsCommonOptionList The header of the boot#### or driver#### option
325 @param VariableName EFI Variable name, indicates if it is boot#### or
328 @retval BDS_COMMON_OPTION The option that was created.
329 @retval NULL Failed to get the new option.
334 BdsLibVariableToOption (
335 IN OUT LIST_ENTRY
*BdsCommonOptionList
,
336 IN CHAR16
*VariableName
340 This function registers the new boot#### or driver#### option based on
341 the VariableName. The new registered boot#### or driver#### will be linked
342 to BdsOptionList and also update to the VariableName. After the boot#### or
343 driver#### updated, the BootOrder or DriverOrder will also be updated.
345 @param BdsOptionList The header of the boot#### or driver#### link list.
346 @param DevicePath The device path that the boot#### or driver####
348 @param String The description of the boot#### or driver####.
349 @param VariableName Indicate if the boot#### or driver#### option.
351 @retval EFI_SUCCESS The boot#### or driver#### have been successfully
353 @retval EFI_STATUS Return the status of gRT->SetVariable ().
358 BdsLibRegisterNewOption (
359 IN LIST_ENTRY
*BdsOptionList
,
360 IN EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
362 IN CHAR16
*VariableName
366 // Bds connect and disconnect driver lib funcions
369 This function connects all system drivers with the corresponding controllers.
374 BdsLibConnectAllDriversToAllControllers (
379 This function connects all system drivers to controllers.
389 This function will create all handles associate with every device
390 path node. If the handle associate with one device path node can not
391 be created successfully, then still give chance to do the dispatch,
392 which load the missing drivers if possible.
394 @param DevicePathToConnect The device path to be connected. Can be
395 a multi-instance device path.
397 @retval EFI_SUCCESS All handles associates with every device path node
399 @retval EFI_OUT_OF_RESOURCES Not enough resources to create new handles.
400 @retval EFI_NOT_FOUND At least one handle could not be created.
405 BdsLibConnectDevicePath (
406 IN EFI_DEVICE_PATH_PROTOCOL
*DevicePathToConnect
410 This function will connect all current system handles recursively.
411 gBS->ConnectController() service is invoked for each handle exist in system handler buffer.
412 If the handle is bus type handler, all childrens also will be connected recursively by gBS->ConnectController().
414 @retval EFI_SUCCESS All handles and child handles have been
416 @retval EFI_STATUS Return the status of gBS->LocateHandleBuffer().
420 BdsLibConnectAllEfi (
425 This function will disconnect all current system handles.
426 gBS->DisconnectController() is invoked for each handle exists in system handle buffer.
427 If handle is a bus type handle, all childrens also are disconnected recursively by gBS->DisconnectController().
429 @retval EFI_SUCCESS All handles have been disconnected.
430 @retval EFI_STATUS Error status returned by of gBS->LocateHandleBuffer().
435 BdsLibDisconnectAllEfi (
440 // Bds console related lib functions
443 This function will search every simpletxt device in the current system,
444 and make every simpletxt device a potential console device.
449 BdsLibConnectAllConsoles (
455 This function will connect console device based on the console
456 device variable ConIn, ConOut and ErrOut.
458 @retval EFI_SUCCESS At least one of the ConIn and ConOut devices have
460 @retval EFI_STATUS Return the status of BdsLibConnectConsoleVariable ().
465 BdsLibConnectAllDefaultConsoles (
471 This function will connect console device except ConIn base on the console
472 device variable ConOut and ErrOut.
474 @retval EFI_SUCCESS At least one of the ConOut device have
475 been connected success.
476 @retval EFI_STATUS Return the status of BdsLibConnectConsoleVariable ().
481 BdsLibConnectAllDefaultConsolesWithOutConIn (
487 This function updates the console variable based on ConVarName. It can
488 add or remove one specific console device path from the variable
490 @param ConVarName The console-related variable name: ConIn, ConOut,
492 @param CustomizedConDevicePath The console device path to be added to
493 the console variable ConVarName. Cannot be multi-instance.
494 @param ExclusiveDevicePath The console device path to be removed
495 from the console variable ConVarName. Cannot be multi-instance.
497 @retval EFI_UNSUPPORTED The added device path is the same as a removed one.
498 @retval EFI_SUCCESS Successfully added or removed the device path from the
504 BdsLibUpdateConsoleVariable (
505 IN CHAR16
*ConVarName
,
506 IN EFI_DEVICE_PATH_PROTOCOL
*CustomizedConDevicePath
,
507 IN EFI_DEVICE_PATH_PROTOCOL
*ExclusiveDevicePath
511 Connect the console device base on the variable ConVarName, if
512 device path of the ConVarName is multi-instance device path and
513 anyone of the instances is connected success, then this function
515 If the handle associate with one device path node can not
516 be created successfully, then still give chance to do the dispatch,
517 which load the missing drivers if possible.
519 @param ConVarName Console related variable name, ConIn, ConOut,
522 @retval EFI_NOT_FOUND There is not any console devices connected
524 @retval EFI_SUCCESS Success connect any one instance of the console
525 device path base on the variable ConVarName.
530 BdsLibConnectConsoleVariable (
531 IN CHAR16
*ConVarName
535 Connect the console device base on the variable ConVarName, if
536 device path of the ConVarName is multi-instance device path and
537 anyone of the instances is connected success, then this function
539 Dispatch service is not called when the handle associate with one
540 device path node can not be created successfully. Here no driver
541 dependency is assumed exist, so need not to call this service.
543 @param ConVarName Console related variable name, ConIn, ConOut,
546 @retval EFI_NOT_FOUND There is not any console devices connected
548 @retval EFI_SUCCESS Success connect any one instance of the console
549 device path base on the variable ConVarName.
554 BdsLibConnectConsoleVariableWithOutDispatch (
555 IN CHAR16
*ConVarName
559 // Bds device path related lib functions
562 Delete the instance in Multi that overlaps with Single.
564 @param Multi A pointer to a multi-instance device path data
566 @param Single A pointer to a single-instance device path data
569 @return This function removes the device path instances in Multi that overlap
570 Single, and returns the resulting device path. If there is no
571 remaining device path as a result, this function will return NULL.
574 EFI_DEVICE_PATH_PROTOCOL
*
576 BdsLibDelPartMatchInstance (
577 IN EFI_DEVICE_PATH_PROTOCOL
*Multi
,
578 IN EFI_DEVICE_PATH_PROTOCOL
*Single
582 This function compares a device path data structure to that of all the nodes of a
583 second device path instance.
585 @param Multi A pointer to a multi-instance device path data
587 @param Single A pointer to a single-instance device path data
590 @retval TRUE If the Single device path is contained within a
592 @retval FALSE The Single device path is not contained within a
598 BdsLibMatchDevicePaths (
599 IN EFI_DEVICE_PATH_PROTOCOL
*Multi
,
600 IN EFI_DEVICE_PATH_PROTOCOL
*Single
604 This function converts an input device structure to a Unicode string.
606 @param DevPath A pointer to the device path structure.
608 @return A newly allocated Unicode string that represents the device path.
614 IN EFI_DEVICE_PATH_PROTOCOL
*DevPath
618 // Internal definitions
628 (*DEV_PATH_FUNCTION
) (
629 IN OUT POOL_PRINT
*Str
,
636 DEV_PATH_FUNCTION Function
;
637 } DEVICE_PATH_STRING_TABLE
;
640 EFI_DEVICE_PATH_PROTOCOL Header
;
642 UINT8 VendorDefinedData
[1];
643 } VENDOR_DEVICE_PATH_WITH_DATA
;
646 EFI_DEVICE_PATH_PROTOCOL Header
;
647 UINT16 NetworkProtocol
;
650 UINT16 TargetPortalGroupTag
;
651 CHAR16 TargetName
[1];
652 } ISCSI_DEVICE_PATH_WITH_NAME
;
655 // BBS support macros and functions
658 #if defined(MDE_CPU_IA32) || defined(MDE_CPU_X64)
659 #define REFRESH_LEGACY_BOOT_OPTIONS \
660 BdsDeleteAllInvalidLegacyBootOptions ();\
661 BdsAddNonExistingLegacyBootOptions (); \
662 BdsUpdateLegacyDevOrder ()
664 #define REFRESH_LEGACY_BOOT_OPTIONS
668 Delete all the invalid legacy boot options.
670 @retval EFI_SUCCESS All invalid legacy boot options are deleted.
671 @retval EFI_OUT_OF_RESOURCES Failed to allocate necessary memory.
672 @retval EFI_NOT_FOUND Failed to retrieve variable of boot order.
677 BdsDeleteAllInvalidLegacyBootOptions (
682 Add the legacy boot options from BBS table if they do not exist.
684 @retval EFI_SUCCESS The boot options were added successfully,
685 or they are already in boot options.
686 @retval EFI_NOT_FOUND No legacy boot options is found.
687 @retval EFI_OUT_OF_RESOURCE No enough memory.
688 @return Other value LegacyBoot options are not added.
692 BdsAddNonExistingLegacyBootOptions (
697 Add the legacy boot devices from BBS table into
698 the legacy device boot order.
700 @retval EFI_SUCCESS The boot devices were added successfully.
701 @retval EFI_NOT_FOUND The legacy boot devices are not found.
702 @retval EFI_OUT_OF_RESOURCES Memory or storage is not enough.
703 @retval EFI_DEVICE_ERROR Failed to add the legacy device boot order into EFI variable
704 because of a hardware error.
708 BdsUpdateLegacyDevOrder (
713 Refresh the boot priority for BBS entries based on boot option entry and boot order.
715 @param Entry The boot option is to be checked for a refreshed BBS table.
717 @retval EFI_SUCCESS The boot priority for BBS entries refreshed successfully.
718 @retval EFI_NOT_FOUND BBS entries can't be found.
719 @retval EFI_OUT_OF_RESOURCES Failed to get the legacy device boot order.
723 BdsRefreshBbsTableForBoot (
724 IN BDS_COMMON_OPTION
*Entry
728 Delete the Boot Option from EFI Variable. The Boot Order Arrray
731 @param OptionNumber The number of Boot options wanting to be deleted.
732 @param BootOrder The Boot Order array.
733 @param BootOrderSize The size of the Boot Order Array.
735 @retval EFI_SUCCESS The Boot Option Variable was found and removed.
736 @retval EFI_UNSUPPORTED The Boot Option Variable store was inaccessible.
737 @retval EFI_NOT_FOUND The Boot Option Variable was not found.
741 BdsDeleteBootOption (
742 IN UINTN OptionNumber
,
743 IN OUT UINT16
*BootOrder
,
744 IN OUT UINTN
*BootOrderSize
748 //The interface functions related to the Setup Browser Reset Reminder feature
751 Enable the setup browser reset reminder feature.
752 This routine is used in a platform tip. If the platform policy needs the feature, use the routine to enable it.
757 EnableResetReminderFeature (
762 Disable the setup browser reset reminder feature.
763 This routine is used in a platform tip. If the platform policy does not want the feature, use the routine to disable it.
768 DisableResetReminderFeature (
773 Record the info that a reset is required.
774 A module boolean variable is used to record whether a reset is required.
779 EnableResetRequired (
785 Record the info that no reset is required.
786 A module boolean variable is used to record whether a reset is required.
791 DisableResetRequired (
796 Check whether platform policy enables the reset reminder feature. The default is enabled.
801 IsResetReminderFeatureEnable (
806 Check if the user changed any option setting that needs a system reset to be effective.
816 Check whether a reset is needed, and finish the reset reminder feature.
817 If a reset is needed, pop up a menu to notice user, and finish the feature
818 according to the user selection.
829 /// Define the boot type with which to classify the boot option type.
830 /// Different boot option types could have different boot behaviors.
831 /// Use their device path node (Type + SubType) as the type value.
832 /// The boot type here can be added according to requirements.
836 /// ACPI boot type. For ACPI devices, using sub-types to distinguish devices is not allowed, so hardcode their values.
838 #define BDS_EFI_ACPI_FLOPPY_BOOT 0x0201
840 /// Message boot type
841 /// If a device path of boot option only points to a message node, the boot option is a message boot type.
843 #define BDS_EFI_MESSAGE_ATAPI_BOOT 0x0301 // Type 03; Sub-Type 01
844 #define BDS_EFI_MESSAGE_SCSI_BOOT 0x0302 // Type 03; Sub-Type 02
845 #define BDS_EFI_MESSAGE_USB_DEVICE_BOOT 0x0305 // Type 03; Sub-Type 05
846 #define BDS_EFI_MESSAGE_SATA_BOOT 0x0312 // Type 03; Sub-Type 18
847 #define BDS_EFI_MESSAGE_MAC_BOOT 0x030b // Type 03; Sub-Type 11
848 #define BDS_EFI_MESSAGE_MISC_BOOT 0x03FF
852 /// If a device path of boot option contains a media node, the boot option is media boot type.
854 #define BDS_EFI_MEDIA_HD_BOOT 0x0401 // Type 04; Sub-Type 01
855 #define BDS_EFI_MEDIA_CDROM_BOOT 0x0402 // Type 04; Sub-Type 02
858 /// If a device path of boot option contains a BBS node, the boot option is BBS boot type.
860 #define BDS_LEGACY_BBS_BOOT 0x0501 // Type 05; Sub-Type 01
862 #define BDS_EFI_UNSUPPORT 0xFFFF
865 Check whether an instance in BlockIoDevicePath has the same partition node as the HardDriveDevicePath device path.
867 @param BlockIoDevicePath Multi device path instances to check.
868 @param HardDriveDevicePath A device path starting with a hard drive media
871 @retval TRUE There is a matched device path instance.
872 @retval FALSE There is no matched device path instance.
877 MatchPartitionDevicePathNode (
878 IN EFI_DEVICE_PATH_PROTOCOL
*BlockIoDevicePath
,
879 IN HARDDRIVE_DEVICE_PATH
*HardDriveDevicePath
884 Expand a device path that starts with a hard drive media device path node to be a
885 full device path that includes the full hardware path to the device. This function enables the device to boot.
886 To avoid requiring a connect on every boot, the front match is saved in a variable (the part point
887 to the partition node. E.g. ACPI() /PCI()/ATA()/Partition() ).
888 All successful history device paths
889 that point to the front part of the partition node will be saved.
891 @param HardDriveDevicePath EFI Device Path to boot, if it starts with a hard
892 drive media device path.
893 @return A Pointer to the full device path, or NULL if a valid Hard Drive devic path
897 EFI_DEVICE_PATH_PROTOCOL
*
899 BdsExpandPartitionPartialDevicePathToFull (
900 IN HARDDRIVE_DEVICE_PATH
*HardDriveDevicePath
904 Return the bootable media handle.
905 First, check whether the device is connected.
906 Second, check whether the device path points to a device that supports SimpleFileSystemProtocol.
907 Third, detect the the default boot file in the Media, and return the removable Media handle.
909 @param DevicePath The Device Path to a bootable device.
911 @return The bootable media handle. If the media on the DevicePath is not bootable, NULL will return.
916 BdsLibGetBootableHandle (
917 IN EFI_DEVICE_PATH_PROTOCOL
*DevicePath
922 Checks whether the Device path in a boot option points to a valid bootable device, and if the device
923 is ready to boot now.
925 @param DevPath The Device path in a boot option.
926 @param CheckMedia If true, check whether the device is ready to boot now.
928 @retval TRUE The Device path is valid.
929 @retval FALSE The Device path is invalid.
934 BdsLibIsValidEFIBootOptDevicePath (
935 IN EFI_DEVICE_PATH_PROTOCOL
*DevPath
,
936 IN BOOLEAN CheckMedia
940 Checks whether the Device path in a boot option points to a valid bootable device, and if the device
941 is ready to boot now.
942 If Description is not NULL and the device path points to a fixed BlockIo
943 device, this function checks whether the description conflicts with other auto-created
946 @param DevPath The Device path in a boot option.
947 @param CheckMedia If true, checks if the device is ready to boot now.
948 @param Description The description of a boot option.
950 @retval TRUE The Device path is valid.
951 @retval FALSE The Device path is invalid.
956 BdsLibIsValidEFIBootOptDevicePathExt (
957 IN EFI_DEVICE_PATH_PROTOCOL
*DevPath
,
958 IN BOOLEAN CheckMedia
,
959 IN CHAR16
*Description
963 For a bootable Device path, return its boot type.
965 @param DevicePath The bootable device Path to check.
967 @retval BDS_EFI_MEDIA_HD_BOOT The given device path contains MEDIA_DEVICE_PATH type device path node,
968 whose subtype is MEDIA_HARDDRIVE_DP.
969 @retval BDS_EFI_MEDIA_CDROM_BOOT If given device path contains MEDIA_DEVICE_PATH type device path node,
970 whose subtype is MEDIA_CDROM_DP.
971 @retval BDS_EFI_ACPI_FLOPPY_BOOT A given device path contains ACPI_DEVICE_PATH type device path node,
972 whose HID is floppy device.
973 @retval BDS_EFI_MESSAGE_ATAPI_BOOT A given device path contains MESSAGING_DEVICE_PATH type device path node,
974 and its last device path node's subtype is MSG_ATAPI_DP.
975 @retval BDS_EFI_MESSAGE_SCSI_BOOT A given device path contains MESSAGING_DEVICE_PATH type device path node,
976 and its last device path node's subtype is MSG_SCSI_DP.
977 @retval BDS_EFI_MESSAGE_USB_DEVICE_BOOT A given device path contains MESSAGING_DEVICE_PATH type device path node,
978 and its last device path node's subtype is MSG_USB_DP.
979 @retval BDS_EFI_MESSAGE_MISC_BOOT The device path does not contain any media device path node, and
980 its last device path node points to a message device path node.
981 @retval BDS_LEGACY_BBS_BOOT A given device path contains BBS_DEVICE_PATH type device path node.
982 @retval BDS_EFI_UNSUPPORT An EFI Removable BlockIO device path does not point to a media and message device.
987 BdsGetBootTypeFromDevicePath (
988 IN EFI_DEVICE_PATH_PROTOCOL
*DevicePath
993 This routine registers a function to adjust the different types of memory page numbers
994 just before booting, and saves the updated info into the variable for the next boot to use.
999 BdsLibSaveMemoryTypeInformation (
1004 Identify a user and, if authenticated, returns the current user profile handle.
1006 @param[out] User Points to the user profile handle.
1008 @retval EFI_SUCCESS The user is successfully identified, or user identification
1010 @retval EFI_ACCESS_DENIED The user was not successfully identified.
1015 BdsLibUserIdentify (
1016 OUT EFI_USER_PROFILE_HANDLE
*User
1020 This function checks if a Fv file device path is valid, according to a file GUID. If it is invalid,
1021 it tries to return the valid device path.
1022 FV address maybe changes for memory layout adjust from time to time, use this funciton
1023 could promise the Fv file device path is right.
1025 @param DevicePath On input, the Fv file device path to check. On
1026 output, the updated valid Fv file device path
1027 @param FileGuid the Fv file GUID.
1029 @retval EFI_INVALID_PARAMETER The input DevicePath or FileGuid is invalid.
1030 @retval EFI_UNSUPPORTED The input DevicePath does not contain an Fv file
1032 @retval EFI_ALREADY_STARTED The input DevicePath has pointed to the Fv file and is
1034 @retval EFI_SUCCESS Successfully updated the invalid DevicePath
1035 and returned the updated device path in DevicePath.
1040 BdsLibUpdateFvFileDevicePath (
1041 IN OUT EFI_DEVICE_PATH_PROTOCOL
** DevicePath
,
1042 IN EFI_GUID
*FileGuid
1047 Connect the specific USB device that matches the RemainingDevicePath,
1048 and whose bus is determined by Host Controller (Uhci or Ehci).
1050 @param HostControllerPI Uhci (0x00) or Ehci (0x20) or Both uhci and ehci
1052 @param RemainingDevicePath A short-form device path that starts with the first
1053 element being a USB WWID or a USB Class device
1056 @retval EFI_SUCCESS The specific Usb device is connected successfully.
1057 @retval EFI_INVALID_PARAMETER Invalid HostControllerPi (not 0x00, 0x20 or 0xFF)
1058 or RemainingDevicePath is not the USB class device path.
1059 @retval EFI_NOT_FOUND The device specified by device path is not found.
1064 BdsLibConnectUsbDevByShortFormDP(
1065 IN UINT8 HostControllerPI
,
1066 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
1071 // The implementation of this function is provided by Platform code.
1074 Convert Vendor device path to a device name.
1076 @param Str The buffer storing device name.
1077 @param DevPath The pointer to vendor device path.
1082 IN OUT POOL_PRINT
*Str
,
1087 Concatenates a formatted unicode string to an allocated pool.
1088 The caller must free the resulting buffer.
1090 @param Str Tracks the allocated pool, size in use, and amount of pool allocated.
1091 @param Fmt The format string.
1092 @param ... The data will be printed.
1094 @return Allocated buffer with the formatted string printed in it.
1095 The caller must free the allocated buffer.
1096 The buffer allocation is not packed.
1102 IN OUT POOL_PRINT
*Str
,
1108 Use SystemTable ConOut to stop video based Simple Text Out consoles from going
1109 to the video device. Put up LogoFile on every video device that is a console.
1111 @param[in] LogoFile The file name of logo to display on the center of the screen.
1113 @retval EFI_SUCCESS ConsoleControl has been flipped to graphics and logo displayed.
1114 @retval EFI_UNSUPPORTED Logo not found.
1120 IN EFI_GUID
*LogoFile
1125 Use SystemTable ConOut to turn on video based Simple Text Out consoles. The
1126 Simple Text Out screens will now be synced up with all non-video output devices.
1128 @retval EFI_SUCCESS UGA devices are back in text mode and synced up.