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

Go to the source code of this file.

Data Structures

struct  SINGLE_NODE_VENDOR_MEDIA_DEVPATH
 

Functions

STATIC BOOLEAN IsOtherInitrdDevicePathAlreadyInstalled (VOID)
 
STATIC EFI_STATUS EFIAPI InitrdLoadFile2 (IN EFI_LOAD_FILE2_PROTOCOL *This, IN EFI_DEVICE_PATH_PROTOCOL *FilePath, IN BOOLEAN BootPolicy, IN OUT UINTN *BufferSize, OUT VOID *Buffer OPTIONAL)
 
STATIC EFI_STATUS UninstallLoadFile2Protocol (VOID)
 
STATIC VOID FreeInitrdFile (VOID)
 
STATIC EFI_STATUS CacheInitrdFile (IN SHELL_FILE_HANDLE FileHandle)
 
STATIC SHELL_STATUS EFIAPI RunInitrd (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 
SHELL_STATUS EFIAPI LinuxInitrdCommandHandler (IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This, IN EFI_SYSTEM_TABLE *SystemTable, IN EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters, IN EFI_SHELL_PROTOCOL *Shell)
 
STATIC CHAR16 *EFIAPI LinuxInitrdGetHelp (IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This, IN CONST CHAR8 *Language)
 
STATIC EFI_HII_HANDLE InitializeHiiPackage (EFI_HANDLE ImageHandle)
 
EFI_STATUS EFIAPI LinuxInitrdDynamicShellCommandEntryPoint (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 
EFI_STATUS EFIAPI LinuxInitrdDynamicShellCommandUnload (IN EFI_HANDLE ImageHandle)
 

Variables

STATIC EFI_HII_HANDLE mLinuxInitrdShellCommandHiiHandle
 
STATIC EFI_PHYSICAL_ADDRESS mInitrdFileAddress
 
STATIC UINTN mInitrdFileSize
 
STATIC EFI_HANDLE mInitrdLoadFile2Handle
 
STATIC CONST SHELL_PARAM_ITEM ParamList []
 
STATIC CONST SINGLE_NODE_VENDOR_MEDIA_DEVPATH mInitrdDevicePath
 
STATIC CONST EFI_LOAD_FILE2_PROTOCOL mInitrdLoadFile2
 
STATIC EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mLinuxInitrdDynamicCommand
 

Detailed Description

Provides 'initrd' dynamic UEFI shell command to load a Linux initrd via its GUIDed vendor media path

Copyright (c) 2020, Arm, Ltd. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file LinuxInitrdDynamicShellCommand.c.

Function Documentation

◆ CacheInitrdFile()

STATIC EFI_STATUS CacheInitrdFile ( IN SHELL_FILE_HANDLE  FileHandle)

Definition at line 170 of file LinuxInitrdDynamicShellCommand.c.

◆ FreeInitrdFile()

STATIC VOID FreeInitrdFile ( VOID  )

Definition at line 158 of file LinuxInitrdDynamicShellCommand.c.

◆ InitializeHiiPackage()

STATIC EFI_HII_HANDLE InitializeHiiPackage ( EFI_HANDLE  ImageHandle)

Retrieve HII package list from ImageHandle and publish to HII database.

Parameters
ImageHandleThe image handle of the process.
Returns
HII handle.

Definition at line 440 of file LinuxInitrdDynamicShellCommand.c.

◆ InitrdLoadFile2()

STATIC EFI_STATUS EFIAPI InitrdLoadFile2 ( IN EFI_LOAD_FILE2_PROTOCOL This,
IN EFI_DEVICE_PATH_PROTOCOL FilePath,
IN BOOLEAN  BootPolicy,
IN OUT UINTN BufferSize,
OUT VOID *Buffer  OPTIONAL 
)

Definition at line 90 of file LinuxInitrdDynamicShellCommand.c.

◆ IsOtherInitrdDevicePathAlreadyInstalled()

STATIC BOOLEAN IsOtherInitrdDevicePathAlreadyInstalled ( VOID  )

Definition at line 58 of file LinuxInitrdDynamicShellCommand.c.

◆ LinuxInitrdCommandHandler()

SHELL_STATUS EFIAPI LinuxInitrdCommandHandler ( IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL This,
IN EFI_SYSTEM_TABLE SystemTable,
IN EFI_SHELL_PARAMETERS_PROTOCOL ShellParameters,
IN EFI_SHELL_PROTOCOL Shell 
)

This is the shell command handler function pointer callback type. This function handles the command when it is invoked in the shell.

Parameters
[in]ThisThe instance of the EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.
[in]SystemTableThe pointer to the system table.
[in]ShellParametersThe parameters associated with the command.
[in]ShellThe instance of the shell protocol used in the context of processing this command.
Returns
EFI_SUCCESS the operation was successful
other the operation failed.

Definition at line 385 of file LinuxInitrdDynamicShellCommand.c.

◆ LinuxInitrdDynamicShellCommandEntryPoint()

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

Entry point of Linux Initrd dynamic UEFI Shell command.

Produce the DynamicCommand protocol to handle "initrd" command.

Parameters
ImageHandleThe image handle of the process.
SystemTableThe EFI System Table pointer.
Return values
EFI_SUCCESSInitrd command is executed successfully.
EFI_ABORTEDHII package was failed to initialize.
othersOther errors when executing Initrd command.

Definition at line 495 of file LinuxInitrdDynamicShellCommand.c.

◆ LinuxInitrdDynamicShellCommandUnload()

EFI_STATUS EFIAPI LinuxInitrdDynamicShellCommandUnload ( IN EFI_HANDLE  ImageHandle)

Unload the dynamic UEFI Shell command.

Parameters
ImageHandleThe image handle of the process.
Return values
EFI_SUCCESSThe image is unloaded.
OthersFailed to unload the image.

Definition at line 527 of file LinuxInitrdDynamicShellCommand.c.

◆ LinuxInitrdGetHelp()

STATIC CHAR16 *EFIAPI LinuxInitrdGetHelp ( IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL This,
IN CONST CHAR8 *  Language 
)

This is the command help handler function pointer callback type. This function is responsible for displaying help information for the associated command.

Parameters
[in]ThisThe instance of the EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.
[in]LanguageThe pointer to the language string to use.
Returns
string Pool allocated help string, must be freed by caller

Definition at line 413 of file LinuxInitrdDynamicShellCommand.c.

◆ RunInitrd()

STATIC SHELL_STATUS EFIAPI RunInitrd ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Function for 'initrd' command.

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

Definition at line 244 of file LinuxInitrdDynamicShellCommand.c.

◆ UninstallLoadFile2Protocol()

STATIC EFI_STATUS UninstallLoadFile2Protocol ( VOID  )

Definition at line 131 of file LinuxInitrdDynamicShellCommand.c.

Variable Documentation

◆ mInitrdDevicePath

Initial value:
= {
{
{
MEDIA_DEVICE_PATH, MEDIA_VENDOR_DP,{ sizeof (VENDOR_DEVICE_PATH) }
},
LINUX_EFI_INITRD_MEDIA_GUID
},{
END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE,
}
}
#define MEDIA_VENDOR_DP
Media vendor device path subtype.
Definition: DevicePath.h:1093

Definition at line 44 of file LinuxInitrdDynamicShellCommand.c.

◆ mInitrdFileAddress

STATIC EFI_PHYSICAL_ADDRESS mInitrdFileAddress

Definition at line 35 of file LinuxInitrdDynamicShellCommand.c.

◆ mInitrdFileSize

STATIC UINTN mInitrdFileSize

Definition at line 36 of file LinuxInitrdDynamicShellCommand.c.

◆ mInitrdLoadFile2

Initial value:
= {
InitrdLoadFile2,
}

Definition at line 125 of file LinuxInitrdDynamicShellCommand.c.

◆ mInitrdLoadFile2Handle

STATIC EFI_HANDLE mInitrdLoadFile2Handle

Definition at line 37 of file LinuxInitrdDynamicShellCommand.c.

◆ mLinuxInitrdDynamicCommand

STATIC EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mLinuxInitrdDynamicCommand
Initial value:
= {
L"initrd",
}
SHELL_STATUS EFIAPI LinuxInitrdCommandHandler(IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This, IN EFI_SYSTEM_TABLE *SystemTable, IN EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters, IN EFI_SHELL_PROTOCOL *Shell)
STATIC CHAR16 *EFIAPI LinuxInitrdGetHelp(IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This, IN CONST CHAR8 *Language)

Definition at line 425 of file LinuxInitrdDynamicShellCommand.c.

◆ mLinuxInitrdShellCommandHiiHandle

STATIC EFI_HII_HANDLE mLinuxInitrdShellCommandHiiHandle

Definition at line 34 of file LinuxInitrdDynamicShellCommand.c.

◆ ParamList

Initial value:
= {
{ L"-u", TypeFlag },
{ NULL, TypeMax }
}
#define NULL
Definition: Base.h:319
@ TypeFlag
A flag that is present or not present only (IE "-a").
Definition: ShellLib.h:699

Definition at line 39 of file LinuxInitrdDynamicShellCommand.c.