TianoCore EDK2 master
Loading...
Searching...
No Matches
UefiShellBcfgCommandLib.c File Reference

Go to the source code of this file.

Data Structures

struct  BGFG_OPERATION
 

Enumerations

enum  BCFG_OPERATION_TARGET { BcfgTargetBootOrder = 0 , BcfgTargetDriverOrder = 1 , BcfgTargetMax = 2 }
 
enum  BCFG_OPERATION_TYPE {
  BcfgTypeDump = 0 , BcfgTypeAdd = 1 , BcfgTypeAddp = 2 , BcfgTypeAddh = 3 ,
  BcfgTypeRm = 4 , BcfgTypeMv = 5 , BcfgTypeOpt = 6 , BcfgTypeMod = 7 ,
  BcfgTypeModf = 8 , BcfgTypeModp = 9 , BcfgTypeModh = 10 , BcfgTypeMax = 11
}
 

Functions

EFI_STATUS UpdateOptionalData (UINT16 Index, UINTN DataSize, UINT8 *Data, IN CONST BCFG_OPERATION_TARGET Target)
 
EFI_STATUS GetBootOptionCrc (UINT32 *Crc, UINT16 BootIndex)
 
EFI_STATUS GetDevicePathForDriverHandle (IN EFI_HANDLE TheHandle, IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath)
 
SHELL_STATUS GetDevicePathByHandle (IN EFI_HANDLE TheHandle, IN BCFG_OPERATION_TARGET Target, IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath)
 
SHELL_STATUS BcfgMod (IN CONST BGFG_OPERATION *BcfgOperation, IN CONST UINTN OrderCount)
 
SHELL_STATUS BcfgAdd (IN UINTN Position, IN CONST CHAR16 *File, IN CONST CHAR16 *Desc, IN CONST UINT16 *CurrentOrder, IN CONST UINTN OrderCount, IN CONST BCFG_OPERATION_TARGET Target, IN CONST BOOLEAN UseHandle, IN CONST BOOLEAN UsePath, IN CONST UINTN HandleNumber)
 
SHELL_STATUS BcfgRemove (IN CONST BCFG_OPERATION_TARGET Target, IN CONST UINT16 *CurrentOrder, IN CONST UINTN OrderCount, IN CONST UINT16 Location)
 
SHELL_STATUS BcfgMove (IN CONST BCFG_OPERATION_TARGET Target, IN CONST UINT16 *CurrentOrder, IN CONST UINTN OrderCount, IN CONST UINT16 OldLocation, IN UINT16 NewLocation)
 
SHELL_STATUS BcfgAddOpt (IN CONST CHAR16 *OptData, IN CONST UINT16 *CurrentOrder, IN CONST UINTN OrderCount, IN CONST BCFG_OPERATION_TARGET Target)
 
SHELL_STATUS BcfgDisplayDump (IN CONST CHAR16 *Op, IN CONST UINTN OrderCount, IN CONST UINT16 *CurrentOrder, IN CONST BOOLEAN VerboseOutput)
 
VOID InitBcfgStruct (IN BGFG_OPERATION *Struct)
 
SHELL_STATUS EFIAPI ShellCommandRunBcfg (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 
CONST CHAR16 *EFIAPI ShellCommandGetManFileNameBcfg (VOID)
 
EFI_STATUS EFIAPI BcfgLibraryRegisterBcfgCommand (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable, IN CONST CHAR16 *Name)
 
EFI_STATUS EFIAPI BcfgLibraryUnregisterBcfgCommand (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Variables

STATIC CONST CHAR16 mFileName [] = L"ShellCommands"
 
STATIC EFI_HII_HANDLE gShellBcfgHiiHandle = NULL
 
STATIC CONST SHELL_PARAM_ITEM ParamList []
 

Detailed Description

Main file for BCFG command.

(C) Copyright 2014-2015 Hewlett-Packard Development Company, L.P.
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file UefiShellBcfgCommandLib.c.

Enumeration Type Documentation

◆ BCFG_OPERATION_TARGET

enum BCFG_OPERATION_TARGET

Definition at line 42 of file UefiShellBcfgCommandLib.c.

◆ BCFG_OPERATION_TYPE

enum BCFG_OPERATION_TYPE

Definition at line 48 of file UefiShellBcfgCommandLib.c.

Function Documentation

◆ BcfgAdd()

SHELL_STATUS BcfgAdd ( IN UINTN  Position,
IN CONST CHAR16 *  File,
IN CONST CHAR16 *  Desc,
IN CONST UINT16 *  CurrentOrder,
IN CONST UINTN  OrderCount,
IN CONST BCFG_OPERATION_TARGET  Target,
IN CONST BOOLEAN  UseHandle,
IN CONST BOOLEAN  UsePath,
IN CONST UINTN  HandleNumber 
)

Function to add a option.

Parameters
[in]PositionThe position to add Target at.
[in]FileThe file to make the target.
[in]DescThe description text.
[in]CurrentOrderThe pointer to the current order of items.
[in]OrderCountThe number if items in CurrentOrder.
[in]TargetThe info on the option to add.
[in]UseHandleTRUE to use HandleNumber, FALSE to use File and Desc.
[in]UsePathTRUE to convert to devicepath.
[in]HandleNumberThe handle number to add.
Return values
SHELL_SUCCESSThe operation was successful.
SHELL_INVALID_PARAMETERA parameter was invalid.

Definition at line 569 of file UefiShellBcfgCommandLib.c.

◆ BcfgAddOpt()

SHELL_STATUS BcfgAddOpt ( IN CONST CHAR16 *  OptData,
IN CONST UINT16 *  CurrentOrder,
IN CONST UINTN  OrderCount,
IN CONST BCFG_OPERATION_TARGET  Target 
)

Function to add optional data to an option.

Parameters
[in]OptDataThe optional data to add.
[in]CurrentOrderThe pointer to the current order of items.
[in]OrderCountThe number if items in CurrentOrder.
[in]TargetThe target of the operation.
Return values
SHELL_SUCCESSThe operation was succesful.

Definition at line 1038 of file UefiShellBcfgCommandLib.c.

◆ BcfgDisplayDump()

SHELL_STATUS BcfgDisplayDump ( IN CONST CHAR16 *  Op,
IN CONST UINTN  OrderCount,
IN CONST UINT16 *  CurrentOrder,
IN CONST BOOLEAN  VerboseOutput 
)

Function to dump the Bcfg information.

Parameters
[in]OpThe operation.
[in]OrderCountHow many to dump.
[in]CurrentOrderThe pointer to the current order of items.
[in]VerboseOutputTRUE for extra output. FALSE otherwise.
Return values
SHELL_SUCCESSThe dump was successful.
SHELL_INVALID_PARAMETERA parameter was invalid.

Definition at line 1352 of file UefiShellBcfgCommandLib.c.

◆ BcfgLibraryRegisterBcfgCommand()

EFI_STATUS EFIAPI BcfgLibraryRegisterBcfgCommand ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable,
IN CONST CHAR16 *  Name 
)

"Constructor" for the library.

This will register the handler for the bcfg command.

Parameters
[in]ImageHandlethe image handle of the process
[in]SystemTablethe EFI System Table pointer
[in]Namethe profile name to use
Return values
EFI_SUCCESSthe shell command handlers were installed successfully
EFI_UNSUPPORTEDthe shell level required was not found.

Definition at line 1981 of file UefiShellBcfgCommandLib.c.

◆ BcfgLibraryUnregisterBcfgCommand()

EFI_STATUS EFIAPI BcfgLibraryUnregisterBcfgCommand ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Destructor for the library. free any resources.

Parameters
ImageHandleThe image handle of the process.
SystemTableThe EFI System Table pointer.

Definition at line 2012 of file UefiShellBcfgCommandLib.c.

◆ BcfgMod()

SHELL_STATUS BcfgMod ( IN CONST BGFG_OPERATION BcfgOperation,
IN CONST UINTN  OrderCount 
)

Function to modify an option.

Parameters
[in]BcfgOperationPointer to BCFG operation.
[in]OrderCountThe number if items in CurrentOrder.
Return values
SHELL_SUCCESSThe operation was successful.
SHELL_INVALID_PARAMETERA parameter was invalid.
SHELL_OUT_OF_RESOUCESA memory allocation failed.

Definition at line 400 of file UefiShellBcfgCommandLib.c.

◆ BcfgMove()

SHELL_STATUS BcfgMove ( IN CONST BCFG_OPERATION_TARGET  Target,
IN CONST UINT16 *  CurrentOrder,
IN CONST UINTN  OrderCount,
IN CONST UINT16  OldLocation,
IN UINT16  NewLocation 
)

Function to move a item to another location.

Parameters
[in]TargetThe target item to move.
[in]CurrentOrderThe pointer to the current order of items.
[in]OrderCountThe number if items in CurrentOrder.
[in]OldLocationThe current location of the Target.
[in]NewLocationThe desired location of the Target.
Return values
SHELL_SUCCESSThe operation was successful.
SHELL_INVALID_PARAMETERA parameter was invalid.

Definition at line 976 of file UefiShellBcfgCommandLib.c.

◆ BcfgRemove()

SHELL_STATUS BcfgRemove ( IN CONST BCFG_OPERATION_TARGET  Target,
IN CONST UINT16 *  CurrentOrder,
IN CONST UINTN  OrderCount,
IN CONST UINT16  Location 
)

Function to remove an item.

Parameters
[in]TargetThe target item to move.
[in]CurrentOrderThe pointer to the current order of items.
[in]OrderCountThe number if items in CurrentOrder.
[in]LocationThe current location of the Target.
Return values
SHELL_SUCCESSThe operation was successful.
SHELL_INVALID_PARAMETERA parameter was invalid.

Definition at line 911 of file UefiShellBcfgCommandLib.c.

◆ GetBootOptionCrc()

EFI_STATUS GetBootOptionCrc ( UINT32 *  Crc,
UINT16  BootIndex 
)

This function will get a CRC for a boot option.

Parameters
[in,out]CrcThe CRC value to return.
[in]BootIndexThe boot option index to CRC.
Return values
EFI_SUCCESSThe CRC was successfully returned.
otherA error occurred.

Definition at line 183 of file UefiShellBcfgCommandLib.c.

◆ GetDevicePathByHandle()

SHELL_STATUS GetDevicePathByHandle ( IN EFI_HANDLE  TheHandle,
IN BCFG_OPERATION_TARGET  Target,
IN OUT EFI_DEVICE_PATH_PROTOCOL **  DevicePath 
)

Function to get Device Path by a handle.

Parameters
[in]TheHandleUse it to get DevicePath.
[in]TargetBoot option target.
[in,out]DevicePathOn a successful return the device path to the handle.
Return values
SHELL_INVALID_PARAMETERThe handle was NULL.
SHELL_NOT_FOUNDNot found device path by handle.
SHELL_SUCCESSGet device path successfully.

Definition at line 306 of file UefiShellBcfgCommandLib.c.

◆ GetDevicePathForDriverHandle()

EFI_STATUS GetDevicePathForDriverHandle ( IN EFI_HANDLE  TheHandle,
IN OUT EFI_DEVICE_PATH_PROTOCOL **  FilePath 
)

This function will populate the device path protocol parameter based on TheHandle.

Parameters
[in]TheHandleDriver handle.
[in,out]FilePathOn a successful return the device path to the handle.
Return values
EFI_SUCCESSThe device path was successfully returned.
otherA error from gBS->HandleProtocol.
See also
HandleProtocol

Definition at line 245 of file UefiShellBcfgCommandLib.c.

◆ InitBcfgStruct()

VOID InitBcfgStruct ( IN BGFG_OPERATION Struct)

Function to initialize the BCFG operation structure.

Parameters
[in]StructThe stuct to initialize.

Definition at line 1491 of file UefiShellBcfgCommandLib.c.

◆ ShellCommandGetManFileNameBcfg()

CONST CHAR16 *EFIAPI ShellCommandGetManFileNameBcfg ( VOID  )

Function to get the filename with help context if HII will not be used.

Returns
The filename with help text in it.

Definition at line 1960 of file UefiShellBcfgCommandLib.c.

◆ ShellCommandRunBcfg()

SHELL_STATUS EFIAPI ShellCommandRunBcfg ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Function for 'bcfg' command.

Parameters
[in]ImageHandleHandle to the Image (NULL if Internal).
[in]SystemTablePointer to the System Table (NULL if Internal).

Definition at line 1521 of file UefiShellBcfgCommandLib.c.

◆ UpdateOptionalData()

EFI_STATUS UpdateOptionalData ( UINT16  Index,
UINTN  DataSize,
UINT8 *  Data,
IN CONST BCFG_OPERATION_TARGET  Target 
)

Update the optional data for a boot or driver option.

If optional data exists it will be changed.

Parameters
[in]IndexThe boot or driver option index update.
[in]DataSizeThe size in bytes of Data.
[in]DataThe buffer for the optional data.
[in]TargetThe target of the operation.
Return values
EFI_SUCCESSThe data was successfully updated.
otherA error occurred.

Definition at line 89 of file UefiShellBcfgCommandLib.c.

Variable Documentation

◆ gShellBcfgHiiHandle

STATIC EFI_HII_HANDLE gShellBcfgHiiHandle = NULL

Definition at line 40 of file UefiShellBcfgCommandLib.c.

◆ mFileName

STATIC CONST CHAR16 mFileName[] = L"ShellCommands"

Definition at line 39 of file UefiShellBcfgCommandLib.c.

◆ ParamList

Initial value:
= {
{ L"-v", TypeFlag },
{ L"-opt", TypeMaxValue },
{ NULL, TypeMax }
}
#define NULL
Definition: Base.h:319
@ TypeMaxValue
A flag followed by all the command line data before the next flag.
Definition: ShellLib.h:704
@ TypeFlag
A flag that is present or not present only (IE "-a").
Definition: ShellLib.h:699

Definition at line 1507 of file UefiShellBcfgCommandLib.c.