EDK2 doxygen online documents - Firmware Encoding Index 1
EDK2 doxygen online documents - Firmware Encoding Index
Functions | Variables

IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BBSsupport.c File Reference

#include "BBSsupport.h"

Go to the source code of this file.

Functions

VOID AsciiToUnicodeSize (IN UINT8 *AStr, IN UINTN Size, OUT UINT16 *UStr)
VOID BdsBuildLegacyDevNameString (IN BBS_TABLE *CurBBSEntry, IN UINTN Index, IN UINTN BufSize, OUT CHAR16 *BootString)
EFI_STATUS BdsCreateLegacyBootOption (IN BBS_TABLE *CurrentBbsEntry, IN EFI_DEVICE_PATH_PROTOCOL *CurrentBbsDevPath, IN UINTN Index, IN OUT UINT16 **BootOrderList, IN OUT UINTN *BootOrderListSize)
BOOLEAN BdsIsLegacyBootOption (IN UINT8 *BootOptionVar, OUT BBS_TABLE **BbsEntry, OUT UINT16 *BbsIndex)
VOID OrderLegacyBootOption4SameType (UINT16 *BootOption, UINTN BootOptionCount, UINT16 *DevOrder, UINTN DevOrderCount, UINT16 *EnBootOption, UINTN *EnBootOptionCount, UINT16 *DisBootOption, UINTN *DisBootOptionCount)
VOID GroupMultipleLegacyBootOption4SameType (UINT16 *BootOption, UINTN BootOptionCount)
EFI_STATUS EFIAPI BdsDeleteAllInvalidLegacyBootOptions (VOID)
BOOLEAN BdsFindLegacyBootOptionByDevTypeAndName (IN UINT16 *BootOrder, IN UINTN BootOptionNum, IN UINT16 DevType, IN CHAR16 *DevName, OUT UINT32 *Attribute, OUT UINT16 *BbsIndex, OUT UINT16 *OptionNumber)
EFI_STATUS BdsCreateOneLegacyBootOption (IN BBS_TABLE *BbsItem, IN UINTN Index, IN OUT UINT16 **BootOrderList, IN OUT UINTN *BootOrderListSize)
EFI_STATUS EFIAPI BdsAddNonExistingLegacyBootOptions (VOID)
UINT16BdsFillDevOrderBuf (IN BBS_TABLE *BbsTable, IN BBS_TYPE BbsType, IN UINTN BbsCount, OUT UINT16 *Buf)
EFI_STATUS BdsCreateDevOrder (IN BBS_TABLE *BbsTable, IN UINT16 BbsCount)
EFI_STATUS EFIAPI BdsUpdateLegacyDevOrder (VOID)
EFI_STATUS BdsSetBootPriority4SameTypeDev (IN UINT16 DeviceType, IN UINTN BbsIndex, IN OUT BBS_TABLE *LocalBbsTable, IN OUT UINT16 *Priority)
VOID PrintBbsTable (IN BBS_TABLE *LocalBbsTable, IN UINT16 BbsCount)
EFI_STATUS EFIAPI BdsRefreshBbsTableForBoot (IN BDS_COMMON_OPTION *Entry)

Variables

BOOT_OPTION_BBS_MAPPINGmBootOptionBbsMapping = NULL
UINTN mBootOptionBbsMappingCount = 0

Detailed Description

This function deal with the legacy boot option, it create, delete and manage the legacy boot option, all legacy boot option is getting from the legacy BBS table.

Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

Definition in file BBSsupport.c.


Function Documentation

VOID AsciiToUnicodeSize ( IN UINT8 AStr,
IN UINTN  Size,
OUT UINT16 UStr 
)

Translate the first n characters of an Ascii string to Unicode characters. The count n is indicated by parameter Size. If Size is greater than the length of string, then the entire string is translated.

Parameters:
AStrPointer to input Ascii string.
SizeThe number of characters to translate.
UStrPointer to output Unicode string buffer.

Definition at line 36 of file BBSsupport.c.

EFI_STATUS EFIAPI BdsAddNonExistingLegacyBootOptions ( VOID  )

Add the legacy boot options from BBS table if they do not exist.

Return values:
EFI_SUCCESSThe boot options are added successfully or they are already in boot options.
EFI_NOT_FOUNDNo legacy boot options is found.
EFI_OUT_OF_RESOURCENo enough memory.
Returns:
Other value LegacyBoot options are not added.

Definition at line 873 of file BBSsupport.c.

VOID BdsBuildLegacyDevNameString ( IN BBS_TABLE CurBBSEntry,
IN UINTN  Index,
IN UINTN  BufSize,
OUT CHAR16 BootString 
)

Build Legacy Device Name String according.

Parameters:
CurBBSEntryBBS Table.
IndexIndex.
BufSizeThe buffer size.
BootStringThe output string.

Definition at line 66 of file BBSsupport.c.

EFI_STATUS BdsCreateDevOrder ( IN BBS_TABLE BbsTable,
IN UINT16  BbsCount 
)

Create the device order buffer.

Parameters:
BbsTableThe BBS table.
BbsCountThe BBS Count.
Return values:
EFI_SUCCESThe buffer is created and the EFI variable named VAR_LEGACY_DEV_ORDER and gEfiLegacyDevOrderVariableGuid is set correctly.
EFI_OUT_OF_RESOURCESMemmory or storage is not enough.
EFI_DEVICE_ERRORFail to add the device order into EFI variable fail because of hardware error.

Definition at line 1056 of file BBSsupport.c.

EFI_STATUS BdsCreateLegacyBootOption ( IN BBS_TABLE CurrentBbsEntry,
IN EFI_DEVICE_PATH_PROTOCOL CurrentBbsDevPath,
IN UINTN  Index,
IN OUT UINT16 **  BootOrderList,
IN OUT UINTN BootOrderListSize 
)

Create a legacy boot option for the specified entry of BBS table, save it as variable, and append it to the boot order list.

Parameters:
CurrentBbsEntryPointer to current BBS table.
CurrentBbsDevPathPointer to the Device Path Protocol instance of BBS
IndexIndex of the specified entry in BBS table.
BootOrderListOn input, the original boot order list. On output, the new boot order list attached with the created node.
BootOrderListSizeOn input, the original size of boot order list. On output, the size of new boot order list.
Return values:
EFI_SUCCESSBoot Option successfully created.
EFI_OUT_OF_RESOURCESFail to allocate necessary memory.
OtherError occurs while setting variable.

Definition at line 193 of file BBSsupport.c.

EFI_STATUS BdsCreateOneLegacyBootOption ( IN BBS_TABLE BbsItem,
IN UINTN  Index,
IN OUT UINT16 **  BootOrderList,
IN OUT UINTN BootOrderListSize 
)

Create a legacy boot option.

Parameters:
BbsItemThe BBS Table entry.
IndexIndex of the specified entry in BBS table.
BootOrderListThe boot order list.
BootOrderListSizeThe size of boot order list.
Return values:
EFI_OUT_OF_RESOURCENo enough memory.
EFI_SUCCESSThe function complete successfully.
Returns:
Other value if the legacy boot option is not created.

Definition at line 818 of file BBSsupport.c.

EFI_STATUS EFIAPI BdsDeleteAllInvalidLegacyBootOptions ( VOID  )

Delete all the invalid legacy boot options.

Return values:
EFI_SUCCESSAll invalide legacy boot options are deleted.
EFI_OUT_OF_RESOURCESFail to allocate necessary memory.
EFI_NOT_FOUNDFail to retrive variable of boot order.

Definition at line 568 of file BBSsupport.c.

UINT16* BdsFillDevOrderBuf ( IN BBS_TABLE BbsTable,
IN BBS_TYPE  BbsType,
IN UINTN  BbsCount,
OUT UINT16 Buf 
)

Fill the device order buffer.

Parameters:
BbsTableThe BBS table.
BbsTypeThe BBS Type.
BbsCountThe BBS Count.
Bufdevice order buffer.
Returns:
The device order buffer.

Definition at line 1017 of file BBSsupport.c.

BOOLEAN BdsFindLegacyBootOptionByDevTypeAndName ( IN UINT16 BootOrder,
IN UINTN  BootOptionNum,
IN UINT16  DevType,
IN CHAR16 DevName,
OUT UINT32 Attribute,
OUT UINT16 BbsIndex,
OUT UINT16 OptionNumber 
)

Find all legacy boot option by device type.

Parameters:
BootOrderThe boot order array.
BootOptionNumThe number of boot option.
DevTypeDevice type.
DevNameDevice name.
AttributeThe boot option attribute.
BbsIndexThe BBS table index.
OptionNumberThe boot option index.
Return values:
TRUEThe Legacy boot option is found.
FALSEThe legacy boot option is not found.

Definition at line 740 of file BBSsupport.c.

BOOLEAN BdsIsLegacyBootOption ( IN UINT8 BootOptionVar,
OUT BBS_TABLE **  BbsEntry,
OUT UINT16 BbsIndex 
)

Check if the boot option is a legacy one.

Parameters:
BootOptionVarThe boot option data payload.
BbsEntryThe BBS Table.
BbsIndexThe table index.
Return values:
TRUEIt is a legacy boot option.
FALSEIt is not a legacy boot option.

Definition at line 368 of file BBSsupport.c.

EFI_STATUS EFIAPI BdsRefreshBbsTableForBoot ( IN BDS_COMMON_OPTION Entry)

Set the boot priority for BBS entries based on boot option entry and boot order.

Parameters:
EntryThe boot option is to be checked for refresh BBS table.
Return values:
EFI_SUCCESSThe boot priority for BBS entries is refreshed successfully.
EFI_NOT_FOUNDBBS entries can't be found.
EFI_OUT_OF_RESOURCESFailed to get the legacy device boot order.

Definition at line 1619 of file BBSsupport.c.

EFI_STATUS BdsSetBootPriority4SameTypeDev ( IN UINT16  DeviceType,
IN UINTN  BbsIndex,
IN OUT BBS_TABLE LocalBbsTable,
IN OUT UINT16 Priority 
)

Set Boot Priority for specified device type.

Parameters:
DeviceTypeThe device type.
BbsIndexThe BBS index to set the highest priority. Ignore when -1.
LocalBbsTableThe BBS table.
PriorityThe prority table.
Return values:
EFI_SUCCESSThe function completes successfully.
EFI_NOT_FOUNDFailed to find device.
EFI_OUT_OF_RESOURCESFailed to get the efi variable of device order.

Definition at line 1504 of file BBSsupport.c.

EFI_STATUS EFIAPI BdsUpdateLegacyDevOrder ( VOID  )

Add the legacy boot devices from BBS table into the legacy device boot order.

Return values:
EFI_SUCCESSThe boot devices are added successfully.
EFI_NOT_FOUNDThe legacy boot devices are not found.
EFI_OUT_OF_RESOURCESMemmory or storage is not enough.
EFI_DEVICE_ERRORFail to add the legacy device boot order into EFI variable because of hardware error.

Definition at line 1181 of file BBSsupport.c.

VOID GroupMultipleLegacyBootOption4SameType ( UINT16 BootOption,
UINTN  BootOptionCount 
)

Group the legacy boot options in the BootOption.

The routine assumes the boot options in the beginning that covers all the device types are ordered properly and re-position the following boot options just after the corresponding boot options with the same device type. For example: 1. Input = [Harddisk1 CdRom2 Efi1 Harddisk0 CdRom0 CdRom1 Harddisk2 Efi0] Assuming [Harddisk1 CdRom2 Efi1] is ordered properly Output = [Harddisk1 Harddisk0 Harddisk2 CdRom2 CdRom0 CdRom1 Efi1 Efi0]

2. Input = [Efi1 Efi0 CdRom1 Harddisk0 Harddisk1 Harddisk2 CdRom0 CdRom2] Assuming [Efi1 Efi0 CdRom1 Harddisk0] is ordered properly Output = [Efi1 Efi0 CdRom1 CdRom0 CdRom2 Harddisk0 Harddisk1 Harddisk2]

Parameters:
BootOptionPointer to buffer containing Boot Option Numbers
BootOptionCountCount of the Boot Option Numbers

Definition at line 500 of file BBSsupport.c.

VOID OrderLegacyBootOption4SameType ( UINT16 BootOption,
UINTN  BootOptionCount,
UINT16 DevOrder,
UINTN  DevOrderCount,
UINT16 EnBootOption,
UINTN EnBootOptionCount,
UINT16 DisBootOption,
UINTN DisBootOptionCount 
)

Re-order the Boot Option according to the DevOrder.

The routine re-orders the Boot Option in BootOption array according to the order specified by DevOrder.

Parameters:
BootOptionPointer to buffer containing the Boot Option Numbers
BootOptionCountCount of the Boot Option Numbers
DevOrderPointer to buffer containing the BBS Index, high 8-bit value 0xFF indicating a disabled boot option
DevOrderCountCount of the BBS Index
EnBootOptionPointer to buffer receiving the enabled Boot Option Numbers
EnBootOptionCountCount of the enabled Boot Option Numbers
DisBootOptionPointer to buffer receiving the disabled Boot Option Numbers
DisBootOptionCountCount of the disabled Boot Option Numbers

Definition at line 416 of file BBSsupport.c.

VOID PrintBbsTable ( IN BBS_TABLE LocalBbsTable,
IN UINT16  BbsCount 
)

Print the BBS Table.

Parameters:
LocalBbsTableThe BBS table.
BbsCountThe count of entry in BBS table.

Definition at line 1568 of file BBSsupport.c.


Variable Documentation

Definition at line 19 of file BBSsupport.c.

Definition at line 20 of file BBSsupport.c.

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines