TianoCore EDK2 master
Loading...
Searching...
No Matches
BmBootDescription.c File Reference
#include "InternalBm.h"

Go to the source code of this file.

Data Structures

struct  BM_SDMMC_MANUFACTURER
 

Macros

#define VENDOR_IDENTIFICATION_OFFSET   3
 
#define VENDOR_IDENTIFICATION_LENGTH   8
 
#define PRODUCT_IDENTIFICATION_OFFSET   11
 
#define PRODUCT_IDENTIFICATION_LENGTH   16
 

Functions

BM_BOOT_TYPE BmDevicePathType (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
 
VOID BmEliminateExtraSpaces (IN CHAR16 *Str)
 
VOID BmSwapBytes (IN UINT8 *Source, IN UINTN Length)
 
CHAR16 * BmGetSdMmcManufacturerName (IN UINT8 Id, IN BOOLEAN IsMmc)
 
CHAR16 * BmGetEmmcTypeDescription (CONTROLLER_DEVICE_PATH *DevicePath)
 
CHAR16 * BmGetSdMmcDescription (IN CHAR16 *ManufacturerName, IN UINT8 *ProductName, IN UINT8 ProductNameLength, IN UINT8 SerialNumber[4], IN CHAR16 *DeviceType)
 
CHAR16 * BmGetDescriptionFromDiskInfo (IN EFI_HANDLE Handle)
 
CHAR16 * BmGetUsbDescription (IN EFI_HANDLE Handle)
 
CHAR16 * BmGetNetworkDescription (IN EFI_HANDLE Handle)
 
CHAR16 * BmGetLoadFileDescription (IN EFI_HANDLE Handle)
 
CHAR16 * BmGetNvmeDescription (IN EFI_HANDLE Handle)
 
CHAR16 * BmGetMiscDescription (IN EFI_HANDLE Handle)
 
EFI_STATUS EFIAPI EfiBootManagerRegisterBootDescriptionHandler (IN EFI_BOOT_MANAGER_BOOT_DESCRIPTION_HANDLER Handler)
 
CHAR16 * BmGetBootDescription (IN EFI_HANDLE Handle)
 
VOID BmMakeBootOptionDescriptionUnique (EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions, UINTN BootOptionCount)
 

Variables

CONST UINT16 mBmUsbLangId = 0x0409
 
CHAR16 mBmUefiPrefix [] = L"UEFI "
 
CHAR16 mBootDescGenericManufacturer [] = L"Generic"
 
CHAR16 mBootDescSd [] = L"SD Device"
 
CHAR16 mBootDescEmmc [] = L"eMMC Device"
 
CHAR16 mBootDescEmmcUserData [] = L"eMMC User Data"
 
CHAR16 mBootDescEmmcBoot1 [] = L"eMMC Boot 1"
 
CHAR16 mBootDescEmmcBoot2 [] = L"eMMC Boot 2"
 
CHAR16 mBootDescEmmcGp1 [] = L"eMMC GP 1"
 
CHAR16 mBootDescEmmcGp2 [] = L"eMMC GP 2"
 
CHAR16 mBootDescEmmcGp3 [] = L"eMMC GP 3"
 
CHAR16 mBootDescEmmcGp4 [] = L"eMMC GP 4"
 
BM_SDMMC_MANUFACTURER mSdManufacturers []
 
BM_SDMMC_MANUFACTURER mMmcManufacturers []
 
LIST_ENTRY mPlatformBootDescriptionHandlers = INITIALIZE_LIST_HEAD_VARIABLE (mPlatformBootDescriptionHandlers)
 
BM_GET_BOOT_DESCRIPTION mBmBootDescriptionHandlers []
 

Detailed Description

Library functions which relate with boot option description.

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

Definition in file BmBootDescription.c.

Macro Definition Documentation

◆ PRODUCT_IDENTIFICATION_LENGTH

#define PRODUCT_IDENTIFICATION_LENGTH   16

Definition at line 15 of file BmBootDescription.c.

◆ PRODUCT_IDENTIFICATION_OFFSET

#define PRODUCT_IDENTIFICATION_OFFSET   11

Definition at line 14 of file BmBootDescription.c.

◆ VENDOR_IDENTIFICATION_LENGTH

#define VENDOR_IDENTIFICATION_LENGTH   8

Definition at line 13 of file BmBootDescription.c.

◆ VENDOR_IDENTIFICATION_OFFSET

#define VENDOR_IDENTIFICATION_OFFSET   3

Definition at line 12 of file BmBootDescription.c.

Function Documentation

◆ BmDevicePathType()

BM_BOOT_TYPE BmDevicePathType ( IN EFI_DEVICE_PATH_PROTOCOL DevicePath)

For a bootable Device path, return its boot type.

Parameters
DevicePathThe bootable device Path to check
Return values
AcpiFloppyBootIf given device path contains ACPI_DEVICE_PATH type device path node which HID is floppy device.
MessageAtapiBootIf given device path contains MESSAGING_DEVICE_PATH type device path node and its last device path node's subtype is MSG_ATAPI_DP.
MessageSataBootIf given device path contains MESSAGING_DEVICE_PATH type device path node and its last device path node's subtype is MSG_SATA_DP.
MessageScsiBootIf given device path contains MESSAGING_DEVICE_PATH type device path node and its last device path node's subtype is MSG_SCSI_DP.
MessageUsbBootIf given device path contains MESSAGING_DEVICE_PATH type device path node and its last device path node's subtype is MSG_USB_DP.
BmMiscBootIf tiven device path doesn't match the above condition.

Definition at line 99 of file BmBootDescription.c.

◆ BmEliminateExtraSpaces()

VOID BmEliminateExtraSpaces ( IN CHAR16 *  Str)

Eliminate the extra spaces in the Str to one space.

Parameters
StrInput string info.

Definition at line 172 of file BmBootDescription.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.

◆ BmGetDescriptionFromDiskInfo()

CHAR16 * BmGetDescriptionFromDiskInfo ( IN EFI_HANDLE  Handle)

Try to get the controller's ATA/ATAPI description.

Parameters
HandleController handle.
Returns
The description string.

Definition at line 340 of file BmBootDescription.c.

◆ BmGetEmmcTypeDescription()

CHAR16 * BmGetEmmcTypeDescription ( CONTROLLER_DEVICE_PATH DevicePath)

Get the eMMC partition type from a controller path.

Parameters
DevicePathPointer to a CONTROLLER_DEVICE_PATH.
Returns
The description string.

Definition at line 251 of file BmBootDescription.c.

◆ BmGetLoadFileDescription()

CHAR16 * BmGetLoadFileDescription ( IN EFI_HANDLE  Handle)

Return the boot description for LoadFile

Parameters
HandleController handle.
Returns
The description string.

Definition at line 765 of file BmBootDescription.c.

◆ BmGetMiscDescription()

CHAR16 * BmGetMiscDescription ( IN EFI_HANDLE  Handle)

Return the boot description for the controller based on the type.

Parameters
HandleController handle.
Returns
The description string.

Definition at line 920 of file BmBootDescription.c.

◆ BmGetNetworkDescription()

CHAR16 * BmGetNetworkDescription ( IN EFI_HANDLE  Handle)

Return the description for network boot device.

Parameters
HandleController handle.
Returns
The description string.

Definition at line 608 of file BmBootDescription.c.

◆ BmGetNvmeDescription()

CHAR16 * BmGetNvmeDescription ( IN EFI_HANDLE  Handle)

Return the boot description for NVME boot device.

Parameters
HandleController handle.
Returns
The description string.

Definition at line 812 of file BmBootDescription.c.

◆ BmGetSdMmcDescription()

CHAR16 * BmGetSdMmcDescription ( IN CHAR16 *  ManufacturerName,
IN UINT8 *  ProductName,
IN UINT8  ProductNameLength,
IN UINT8  SerialNumber[4],
IN CHAR16 *  DeviceType 
)

Get an SD/MMC boot description.

Parameters
ManufacturerNameManufacturer name string.
ProductNameProduct name from CID.
ProductNameLengthLength of ProductName.
SerialNumberSerial number from CID.
DeviceTypeDevice type string (e.g. SD or an eMMC partition).
Returns
The description string.

Definition at line 289 of file BmBootDescription.c.

◆ BmGetSdMmcManufacturerName()

CHAR16 * BmGetSdMmcManufacturerName ( IN UINT8  Id,
IN BOOLEAN  IsMmc 
)

Get the SD/MMC manufacturer name from an ID.

Parameters
IdManufacturer ID.
IsMmcBoolean indicating whether the ID is for SD or eMMC.
Returns
The manufacturer string.

Definition at line 221 of file BmBootDescription.c.

◆ BmGetUsbDescription()

CHAR16 * BmGetUsbDescription ( IN EFI_HANDLE  Handle)

Try to get the controller's USB description.

Parameters
HandleController handle.
Returns
The description string.

Definition at line 504 of file BmBootDescription.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.

◆ BmSwapBytes()

VOID BmSwapBytes ( IN UINT8 *  Source,
IN UINTN  Length 
)

Swap a byte array.

Parameters
SourceInput byte array.
LengthThe size of Source in bytes.

Definition at line 195 of file BmBootDescription.c.

◆ EfiBootManagerRegisterBootDescriptionHandler()

EFI_STATUS EFIAPI EfiBootManagerRegisterBootDescriptionHandler ( IN EFI_BOOT_MANAGER_BOOT_DESCRIPTION_HANDLER  Handler)

Register the platform provided boot description handler.

Parameters
HandlerThe platform provided boot description handler
Return values
EFI_SUCCESSThe handler was registered successfully.
EFI_ALREADY_STARTEDThe handler was already registered.
EFI_OUT_OF_RESOURCESThere is not enough resource to perform the registration.

Definition at line 987 of file BmBootDescription.c.

Variable Documentation

◆ mBmBootDescriptionHandlers

BM_GET_BOOT_DESCRIPTION mBmBootDescriptionHandlers[]
Initial value:
= {
}
CHAR16 * BmGetNvmeDescription(IN EFI_HANDLE Handle)
CHAR16 * BmGetLoadFileDescription(IN EFI_HANDLE Handle)
CHAR16 * BmGetNetworkDescription(IN EFI_HANDLE Handle)
CHAR16 * BmGetUsbDescription(IN EFI_HANDLE Handle)
CHAR16 * BmGetDescriptionFromDiskInfo(IN EFI_HANDLE Handle)
CHAR16 * BmGetMiscDescription(IN EFI_HANDLE Handle)

Definition at line 1016 of file BmBootDescription.c.

◆ mBmUefiPrefix

CHAR16 mBmUefiPrefix[] = L"UEFI "

Definition at line 18 of file BmBootDescription.c.

◆ mBmUsbLangId

CONST UINT16 mBmUsbLangId = 0x0409

Definition at line 17 of file BmBootDescription.c.

◆ mBootDescEmmc

CHAR16 mBootDescEmmc[] = L"eMMC Device"

Definition at line 22 of file BmBootDescription.c.

◆ mBootDescEmmcBoot1

CHAR16 mBootDescEmmcBoot1[] = L"eMMC Boot 1"

Definition at line 24 of file BmBootDescription.c.

◆ mBootDescEmmcBoot2

CHAR16 mBootDescEmmcBoot2[] = L"eMMC Boot 2"

Definition at line 25 of file BmBootDescription.c.

◆ mBootDescEmmcGp1

CHAR16 mBootDescEmmcGp1[] = L"eMMC GP 1"

Definition at line 26 of file BmBootDescription.c.

◆ mBootDescEmmcGp2

CHAR16 mBootDescEmmcGp2[] = L"eMMC GP 2"

Definition at line 27 of file BmBootDescription.c.

◆ mBootDescEmmcGp3

CHAR16 mBootDescEmmcGp3[] = L"eMMC GP 3"

Definition at line 28 of file BmBootDescription.c.

◆ mBootDescEmmcGp4

CHAR16 mBootDescEmmcGp4[] = L"eMMC GP 4"

Definition at line 29 of file BmBootDescription.c.

◆ mBootDescEmmcUserData

CHAR16 mBootDescEmmcUserData[] = L"eMMC User Data"

Definition at line 23 of file BmBootDescription.c.

◆ mBootDescGenericManufacturer

CHAR16 mBootDescGenericManufacturer[] = L"Generic"

Definition at line 20 of file BmBootDescription.c.

◆ mBootDescSd

CHAR16 mBootDescSd[] = L"SD Device"

Definition at line 21 of file BmBootDescription.c.

◆ mMmcManufacturers

BM_SDMMC_MANUFACTURER mMmcManufacturers[]
Initial value:
= {
{ 0x00, L"SanDisk" },
{ 0x02, L"Kingston/SanDisk" },
{ 0x03, L"Toshiba" },
{ 0x11, L"Toshiba" },
{ 0x13, L"Micron" },
{ 0x15, L"Samsung" },
{ 0x37, L"KingMax" },
{ 0x44, L"ATP" },
{ 0x45, L"SanDisk" },
{ 0x2c, L"Kingston" },
{ 0x70, L"Kingston" },
{ 0x88, L"Foresee" },
{ 0x9b, L"YMTC" },
{ 0xd6, L"Foresee" },
{ 0xfe, L"Micron" },
}

Definition at line 60 of file BmBootDescription.c.

◆ mPlatformBootDescriptionHandlers

LIST_ENTRY mPlatformBootDescriptionHandlers = INITIALIZE_LIST_HEAD_VARIABLE (mPlatformBootDescriptionHandlers)

Definition at line 78 of file BmBootDescription.c.

◆ mSdManufacturers

BM_SDMMC_MANUFACTURER mSdManufacturers[]
Initial value:
= {
{ 0x01, L"Panasonic" },
{ 0x02, L"Toshiba/Kingston/Viking" },
{ 0x03, L"SanDisk" },
{ 0x08, L"Silicon Power" },
{ 0x18, L"Infineon" },
{ 0x1b, L"Transcend/Samsung" },
{ 0x1c, L"Transcend" },
{ 0x1d, L"Corsair/AData" },
{ 0x1e, L"Transcend" },
{ 0x1f, L"Kingston" },
{ 0x27, L"Delkin/Phison" },
{ 0x28, L"Lexar" },
{ 0x30, L"SanDisk" },
{ 0x31, L"Silicon Power" },
{ 0x33, L"STMicroelectronics" },
{ 0x41, L"Kingston" },
{ 0x6f, L"STMicroelectronics" },
{ 0x74, L"Transcend" },
{ 0x76, L"Patriot" },
{ 0x82, L"Gobe/Sony" },
{ 0x9c, L"Angelbird/Hoodman" },
}

Definition at line 36 of file BmBootDescription.c.