TianoCore EDK2 master
Loading...
Searching...
No Matches
InternalBm.h File Reference
#include <PiDxe.h>
#include <IndustryStandard/Pci.h>
#include <IndustryStandard/PeImage.h>
#include <IndustryStandard/Atapi.h>
#include <IndustryStandard/Scsi.h>
#include <IndustryStandard/Nvme.h>
#include <IndustryStandard/Sd.h>
#include <IndustryStandard/Emmc.h>
#include <Protocol/PciRootBridgeIo.h>
#include <Protocol/BlockIo.h>
#include <Protocol/LoadedImage.h>
#include <Protocol/SimpleFileSystem.h>
#include <Protocol/LoadFile.h>
#include <Protocol/DevicePath.h>
#include <Protocol/SimpleTextIn.h>
#include <Protocol/SimpleTextInEx.h>
#include <Protocol/SimpleTextOut.h>
#include <Protocol/SimpleNetwork.h>
#include <Protocol/FirmwareVolume2.h>
#include <Protocol/PciIo.h>
#include <Protocol/GraphicsOutput.h>
#include <Protocol/UsbIo.h>
#include <Protocol/DiskInfo.h>
#include <Protocol/NvmExpressPassthru.h>
#include <Protocol/IdeControllerInit.h>
#include <Protocol/BootLogo.h>
#include <Protocol/DriverHealth.h>
#include <Protocol/FormBrowser2.h>
#include <Protocol/RamDisk.h>
#include <Protocol/DeferredImageLoad.h>
#include <Protocol/PlatformBootManager.h>
#include <Guid/MemoryTypeInformation.h>
#include <Guid/FileInfo.h>
#include <Guid/GlobalVariable.h>
#include <Guid/StatusCodeDataTypeId.h>
#include <Guid/StatusCodeDataTypeVariable.h>
#include <Library/PrintLib.h>
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/UefiLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/DxeServicesTableLib.h>
#include <Library/HobLib.h>
#include <Library/BaseLib.h>
#include <Library/DevicePathLib.h>
#include <Library/PerformanceLib.h>
#include <Library/PcdLib.h>
#include <Library/PeCoffGetEntryPointLib.h>
#include <Library/UefiBootManagerLib.h>
#include <Library/DxeServicesLib.h>
#include <Library/ReportStatusCodeLib.h>
#include <Library/CapsuleLib.h>
#include <Library/HiiLib.h>

Go to the source code of this file.

Data Structures

struct  BM_BOOT_DESCRIPTION_ENTRY
 
struct  BM_HOTKEY
 

Macros

#define BM_OPTION_NAME_LEN   sizeof ("PlatformRecovery####")
 
#define MAX_RECONNECT_REPAIR   10
 
#define BM_BOOT_DESCRIPTION_ENTRY_SIGNATURE   SIGNATURE_32 ('b', 'm', 'd', 'h')
 
#define BM_HOTKEY_SIGNATURE   SIGNATURE_32 ('b', 'm', 'h', 'k')
 
#define BM_HOTKEY_FROM_LINK(a)   CR (a, BM_HOTKEY, Link, BM_HOTKEY_SIGNATURE)
 

Typedefs

typedef CHAR16 *(* BM_GET_BOOT_DESCRIPTION) (IN EFI_HANDLE Handle)
 
typedef VOID(* BM_VARIABLE_VISITOR) (CHAR16 *Name, EFI_GUID *Guid, VOID *Context)
 

Enumerations

enum  BM_BOOT_TYPE {
  BmAcpiFloppyBoot , BmHardwareDeviceBoot , BmMessageAtapiBoot , BmMessageSataBoot ,
  BmMessageUsbBoot , BmMessageScsiBoot , BmMiscBoot
}
 

Functions

VOID BmForEachVariable (BM_VARIABLE_VISITOR Visitor, VOID *Context)
 
VOID BmRepairAllControllers (UINTN ReconnectRepairCount)
 
EFI_STATUS BmGetFreeOptionNumber (IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE LoadOptionType, OUT UINT16 *FreeOptionNumber)
 
VOID BmSetMemoryTypeInformationVariable (IN BOOLEAN Boot)
 
BOOLEAN BmMatchPartitionDevicePathNode (IN EFI_DEVICE_PATH_PROTOCOL *BlockIoDevicePath, IN HARDDRIVE_DEVICE_PATH *HardDriveDevicePath)
 
EFI_STATUS BmConnectUsbShortFormDevicePath (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
 
VOID EFIAPI BmStopHotkeyService (IN EFI_EVENT Event, IN VOID *Context)
 
EFI_STATUS BmSetVariableAndReportStatusCodeOnError (IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, IN UINT32 Attributes, IN UINTN DataSize, IN VOID *Data)
 
BOOLEAN BmMatchDevicePaths (IN EFI_DEVICE_PATH_PROTOCOL *Multi, IN EFI_DEVICE_PATH_PROTOCOL *Single)
 
EFI_DEVICE_PATH_PROTOCOLBmDelPartMatchInstance (IN EFI_DEVICE_PATH_PROTOCOL *Multi, IN EFI_DEVICE_PATH_PROTOCOL *Single)
 
VOID BmPrintDp (EFI_DEVICE_PATH_PROTOCOL *DevicePath)
 
UINTN BmCharToUint (IN CHAR16 Char)
 
CHAR16 * BmGetBootDescription (IN EFI_HANDLE Handle)
 
VOID BmMakeBootOptionDescriptionUnique (EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions, UINTN BootOptionCount)
 
EFI_DEVICE_PATH_PROTOCOLBmExpandLoadFile (IN EFI_HANDLE LoadFileHandle, IN EFI_DEVICE_PATH_PROTOCOL *FilePath)
 
EFI_DEVICE_PATH_PROTOCOLBmGetRamDiskDevicePath (IN EFI_DEVICE_PATH_PROTOCOL *FilePath)
 
VOID BmDestroyRamDisk (IN EFI_DEVICE_PATH_PROTOCOL *RamDiskDevicePath)
 
EFI_DEVICE_PATH_PROTOCOLBmGetNextLoadOptionDevicePath (IN EFI_DEVICE_PATH_PROTOCOL *FilePath, IN EFI_DEVICE_PATH_PROTOCOL *FullPath)
 
VOID * BmGetNextLoadOptionBuffer (IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE Type, IN EFI_DEVICE_PATH_PROTOCOL *FilePath, OUT EFI_DEVICE_PATH_PROTOCOL **FullPath, OUT UINTN *FileSize)
 

Variables

CHAR16 * mBmLoadOptionName []
 

Detailed Description

BDS library definition, include the file and data structure

Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
(C) Copyright 2015 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file InternalBm.h.

Macro Definition Documentation

◆ BM_BOOT_DESCRIPTION_ENTRY_SIGNATURE

#define BM_BOOT_DESCRIPTION_ENTRY_SIGNATURE   SIGNATURE_32 ('b', 'm', 'd', 'h')

Definition at line 143 of file InternalBm.h.

◆ BM_HOTKEY_FROM_LINK

#define BM_HOTKEY_FROM_LINK (   a)    CR (a, BM_HOTKEY, Link, BM_HOTKEY_SIGNATURE)

Definition at line 173 of file InternalBm.h.

◆ BM_HOTKEY_SIGNATURE

#define BM_HOTKEY_SIGNATURE   SIGNATURE_32 ('b', 'm', 'h', 'k')

Definition at line 161 of file InternalBm.h.

◆ BM_OPTION_NAME_LEN

#define BM_OPTION_NAME_LEN   sizeof ("PlatformRecovery####")

Definition at line 106 of file InternalBm.h.

◆ MAX_RECONNECT_REPAIR

#define MAX_RECONNECT_REPAIR   10

Definition at line 113 of file InternalBm.h.

Typedef Documentation

◆ BM_GET_BOOT_DESCRIPTION

typedef CHAR16 *(* BM_GET_BOOT_DESCRIPTION) (IN EFI_HANDLE Handle)

Definition at line 98 of file InternalBm.h.

◆ BM_VARIABLE_VISITOR

typedef VOID(* BM_VARIABLE_VISITOR) (CHAR16 *Name, EFI_GUID *Guid, VOID *Context)

Visitor function to be called by BmForEachVariable for each variable in variable storage.

Parameters
NameVariable name.
GuidVariable GUID.
ContextThe same context passed to BmForEachVariable.

Definition at line 124 of file InternalBm.h.

Enumeration Type Documentation

◆ BM_BOOT_TYPE

enum BM_BOOT_TYPE

Definition at line 87 of file InternalBm.h.

Function Documentation

◆ BmCharToUint()

UINTN BmCharToUint ( IN CHAR16  Char)

Convert a single character to number. It assumes the input Char is in the scope of L'0' ~ L'9' and L'A' ~ L'F'

Parameters
CharThe input char which need to convert to int.
Returns
The converted 8-bit number or (UINTN) -1 if conversion failed.

Definition at line 404 of file BmMisc.c.

◆ BmConnectUsbShortFormDevicePath()

EFI_STATUS BmConnectUsbShortFormDevicePath ( IN EFI_DEVICE_PATH_PROTOCOL DevicePath)

Connect the specific Usb device which match the short form device path.

Parameters
DevicePathA short-form device path that starts with the first element being a USB WWID or a USB Class device path
Returns
EFI_INVALID_PARAMETER DevicePath is NULL pointer. DevicePath is not a USB device path.
EFI_SUCCESS Success to connect USB device
EFI_NOT_FOUND Fail to find handle for USB controller to connect.

Connect the specific Usb device which match the short form device path, and whose bus is determined by Host Controller (Uhci or Ehci).

Parameters
DevicePathA short-form device path that starts with the first element being a USB WWID or a USB Class device path
Returns
EFI_INVALID_PARAMETER DevicePath is NULL pointer. DevicePath is not a USB device path.
EFI_SUCCESS Success to connect USB device
EFI_NOT_FOUND Fail to find handle for USB controller to connect.

Definition at line 245 of file BmConnect.c.

◆ BmDelPartMatchInstance()

EFI_DEVICE_PATH_PROTOCOL * BmDelPartMatchInstance ( IN EFI_DEVICE_PATH_PROTOCOL Multi,
IN EFI_DEVICE_PATH_PROTOCOL Single 
)

Delete the instance in Multi which matches partly with Single instance

Parameters
MultiA pointer to a multi-instance device path data structure.
SingleA pointer to a single-instance device path data structure.
Returns
This function will remove the device path instances in Multi which partly match with the Single, and return the result device path. If there is no remaining device path as a result, this function will return NULL.

Definition at line 26 of file BmMisc.c.

◆ BmDestroyRamDisk()

VOID BmDestroyRamDisk ( IN EFI_DEVICE_PATH_PROTOCOL RamDiskDevicePath)

Destroy the RAM Disk.

The destroy operation includes to call RamDisk.Unregister to unregister the RAM DISK from RAM DISK driver, free the memory allocated for the RAM Disk.

Parameters
RamDiskDevicePathRAM Disk device path.

Definition at line 1385 of file BmBoot.c.

◆ BmExpandLoadFile()

EFI_DEVICE_PATH_PROTOCOL * BmExpandLoadFile ( IN EFI_HANDLE  LoadFileHandle,
IN EFI_DEVICE_PATH_PROTOCOL FilePath 
)

Get the file buffer from the specified Load File instance.

Parameters
LoadFileHandleThe specified Load File instance.
FilePathThe file path which will pass to LoadFile().
Returns
The full device path pointing to the load option buffer.

Definition at line 1419 of file BmBoot.c.

◆ BmForEachVariable()

VOID BmForEachVariable ( BM_VARIABLE_VISITOR  Visitor,
VOID *  Context 
)

Call Visitor function for each variable in variable storage.

Parameters
VisitorVisitor function.
ContextThe context passed to Visitor function.

Definition at line 37 of file BmLoadOption.c.

◆ BmGetBootDescription()

CHAR16 * BmGetBootDescription ( IN EFI_HANDLE  Handle)

Return the boot description for the controller.

Parameters
HandleController handle.
Returns
The description string.

Definition at line 1033 of file BmBootDescription.c.

◆ BmGetFreeOptionNumber()

EFI_STATUS BmGetFreeOptionNumber ( IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE  LoadOptionType,
OUT UINT16 *  FreeOptionNumber 
)

Get the Option Number that wasn't used.

Parameters
LoadOptionTypeLoad option type.
FreeOptionNumberTo receive the minimal free option number.
Return values
EFI_SUCCESSThe option number is found
EFI_OUT_OF_RESOURCESThere is no free option number that can be used.
EFI_INVALID_PARAMETERFreeOptionNumber is NULL

Get the Option Number that wasn't used.

Parameters
LoadOptionTypeThe load option type.
FreeOptionNumberReturn the minimal free option number.
Return values
EFI_SUCCESSThe option number is found and will be returned.
EFI_OUT_OF_RESOURCESThere is no free option number that can be used.
EFI_INVALID_PARAMETERFreeOptionNumber is NULL

Definition at line 85 of file BmLoadOption.c.

◆ BmGetNextLoadOptionBuffer()

VOID * BmGetNextLoadOptionBuffer ( IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE  Type,
IN EFI_DEVICE_PATH_PROTOCOL FilePath,
OUT EFI_DEVICE_PATH_PROTOCOL **  FullPath,
OUT UINTN FileSize 
)

Return the next matched load option buffer. The routine keeps calling BmGetNextLoadOptionDevicePath() until a valid load option is read.

Parameters
TypeThe load option type. It's used to check whether the load option is valid. When it's LoadOptionTypeMax, the routine only guarantees the load option is a valid PE image but doesn't guarantee the PE's subsystem type is valid.
FilePathThe device path pointing to a load option. It could be a short-form device path.
FullPathReturn the next full device path of the load option after short-form device path expanding. Caller is responsible to free it. NULL to return the first matched full device path.
FileSizeReturn the load option size.
Returns
The load option buffer. Caller is responsible to free the memory.

Definition at line 1313 of file BmLoadOption.c.

◆ BmGetNextLoadOptionDevicePath()

EFI_DEVICE_PATH_PROTOCOL * BmGetNextLoadOptionDevicePath ( IN EFI_DEVICE_PATH_PROTOCOL FilePath,
IN EFI_DEVICE_PATH_PROTOCOL FullPath 
)

Get the next possible full path pointing to the load option.

Parameters
FilePathThe device path pointing to a load option. It could be a short-form device path.
FullPathThe full path returned by the routine in last call. Set to NULL in first call.
Returns
The next possible full path pointing to the load option. Caller is responsible to free the memory.

Get the next possible full path pointing to the load option. The routine doesn't guarantee the returned full path points to an existing file, and it also doesn't guarantee the existing file is a valid load option. BmGetNextLoadOptionBuffer() guarantees.

Parameters
FilePathThe device path pointing to a load option. It could be a short-form device path.
FullPathThe full path returned by the routine in last call. Set to NULL in first call.
Returns
The next possible full path pointing to the load option. Caller is responsible to free the memory.

Definition at line 1634 of file BmBoot.c.

◆ BmGetRamDiskDevicePath()

EFI_DEVICE_PATH_PROTOCOL * BmGetRamDiskDevicePath ( IN EFI_DEVICE_PATH_PROTOCOL FilePath)

Return the RAM Disk device path created by LoadFile.

Parameters
FilePathThe source file path.
Returns
Callee-to-free RAM Disk device path

Definition at line 1308 of file BmBoot.c.

◆ BmMakeBootOptionDescriptionUnique()

VOID BmMakeBootOptionDescriptionUnique ( EFI_BOOT_MANAGER_LOAD_OPTION BootOptions,
UINTN  BootOptionCount 
)

Enumerate all boot option descriptions and append " 2"/" 3"/... to make unique description.

Parameters
BootOptionsArray of boot options.
BootOptionCountCount of boot options.

Definition at line 1094 of file BmBootDescription.c.

◆ BmMatchDevicePaths()

BOOLEAN BmMatchDevicePaths ( IN EFI_DEVICE_PATH_PROTOCOL Multi,
IN EFI_DEVICE_PATH_PROTOCOL Single 
)

Function compares a device path data structure to that of all the nodes of a second device path instance.

Parameters
MultiA pointer to a multi-instance device path data structure.
SingleA pointer to a single-instance device path data structure.
Return values
TRUEIf the Single device path is contained within Multi device path.
FALSEThe Single device path is not match within Multi device path.

Definition at line 82 of file BmMisc.c.

◆ BmMatchPartitionDevicePathNode()

BOOLEAN BmMatchPartitionDevicePathNode ( IN EFI_DEVICE_PATH_PROTOCOL BlockIoDevicePath,
IN HARDDRIVE_DEVICE_PATH HardDriveDevicePath 
)

Check whether there is a instance in BlockIoDevicePath, which contain multi device path instances, has the same partition node with HardDriveDevicePath device path

Parameters
BlockIoDevicePathMulti device path instances which need to check
HardDriveDevicePathA device path which starts with a hard drive media device path.
Return values
TRUEThere is a matched device path instance.
FALSEThere is no matched device path instance.

Definition at line 2134 of file BmBoot.c.

◆ BmPrintDp()

VOID BmPrintDp ( EFI_DEVICE_PATH_PROTOCOL DevicePath)

Print the device path info.

Parameters
DevicePathThe device path need to print.

Definition at line 382 of file BmMisc.c.

◆ BmRepairAllControllers()

VOID BmRepairAllControllers ( UINTN  ReconnectRepairCount)

Repair all the controllers according to the Driver Health status queried.

Parameters
ReconnectRepairCountTo record the number of recursive call of this function itself.

Definition at line 429 of file BmDriverHealth.c.

◆ BmSetMemoryTypeInformationVariable()

VOID BmSetMemoryTypeInformationVariable ( IN BOOLEAN  Boot)

This routine adjust the memory information for different memory type and save them into the variables for next boot. It resets the system when memory information is updated and the current boot option belongs to boot category instead of application category. It doesn't count the reserved memory occupied by RAM Disk.

Parameters
BootTRUE if current boot option belongs to boot category instead of application category.

Definition at line 129 of file BmMisc.c.

◆ BmSetVariableAndReportStatusCodeOnError()

EFI_STATUS BmSetVariableAndReportStatusCodeOnError ( IN CHAR16 *  VariableName,
IN EFI_GUID VendorGuid,
IN UINT32  Attributes,
IN UINTN  DataSize,
IN VOID *  Data 
)

Set the variable and report the error through status code upon failure.

Parameters
VariableNameA Null-terminated string that is the name of the vendor's variable. Each VariableName is unique for each VendorGuid. VariableName must contain 1 or more characters. If VariableName is an empty string, then EFI_INVALID_PARAMETER is returned.
VendorGuidA unique identifier for the vendor.
AttributesAttributes bitmask to set for the variable.
DataSizeThe size in bytes of the Data buffer. Unless the EFI_VARIABLE_APPEND_WRITE, or EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS attribute is set, a size of zero causes the variable to be deleted. When the EFI_VARIABLE_APPEND_WRITE attribute is set, then a SetVariable() call with a DataSize of zero will not cause any change to the variable value (the timestamp associated with the variable may be updated however even if no new data value is provided,see the description of the EFI_VARIABLE_AUTHENTICATION_2 descriptor below. In this case the DataSize will not be zero since the EFI_VARIABLE_AUTHENTICATION_2 descriptor will be populated).
DataThe contents for the variable.
Return values
EFI_SUCCESSThe firmware has successfully stored the variable and its data as defined by the Attributes.
EFI_INVALID_PARAMETERAn invalid combination of attribute bits, name, and GUID was supplied, or the DataSize exceeds the maximum allowed.
EFI_INVALID_PARAMETERVariableName is an empty string.
EFI_OUT_OF_RESOURCESNot enough storage is available to hold the variable and its data.
EFI_DEVICE_ERRORThe variable could not be retrieved due to a hardware error.
EFI_WRITE_PROTECTEDThe variable in question is read-only.
EFI_WRITE_PROTECTEDThe variable in question cannot be deleted.
EFI_SECURITY_VIOLATIONThe variable could not be written due to EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACESS being set, but the AuthInfo does NOT pass the validation check carried out by the firmware.
EFI_NOT_FOUNDThe variable trying to be updated or deleted was not found.

Definition at line 328 of file BmMisc.c.

◆ BmStopHotkeyService()

VOID EFIAPI BmStopHotkeyService ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Stop the hotkey processing.

Parameters
EventEvent pointer related to hotkey service.
ContextContext pass to this function.

Definition at line 850 of file BmHotkey.c.

Variable Documentation

◆ mBmLoadOptionName

CHAR16* mBmLoadOptionName[]
extern

Definition at line 15 of file BmLoadOption.c.