mirror of
https://github.com/tianocore/edk2
synced 2026-08-27 00:23:19 -04:00
ShellPkg/UefiShellDebug1: Extract MainCmdXXX() function (2/4)
This patch aims to help breaking down the long functions present in the ShellPkg and reduce complexity/nested code and conditions. Extract a MainCmdXXX() function for each shell command. This command contains the possible operations the command aims to operate. The ShellCommandRunXXX() function from which it is extracted is only responsible of: - initializing the shell/command environment - parsing the command parameter and creating a Package - freeing the Package For the MemMap and SetVar commands, ShellCommandLineFreeVarList() calls are removed as the Package is now freed in the caller function: ShellCommandRunXXX(). To avoid having one large commit updating all the UefiShellDebug1 commands, only update these files: - Edit/Edit.c - EfiCompress.c - EfiDecompress.c - HexEdit/HexEdit.c - LoadPciRom.c No functional change should be induced by this patch. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This commit is contained in:
parent
6d0ef532c6
commit
5bdbf4462b
5 changed files with 286 additions and 177 deletions
|
|
@ -10,24 +10,19 @@
|
|||
#include "UefiShellDebug1CommandsLib.h"
|
||||
#include "TextEditor.h"
|
||||
|
||||
/**
|
||||
Function for 'edit' command.
|
||||
/** Main function of the 'Edit' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
@param[in] Package List of input parameter for the command.
|
||||
**/
|
||||
STATIC
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunEdit (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
MainCmdEdit (
|
||||
LIST_ENTRY *Package
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
CHAR16 *Buffer;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
LIST_ENTRY *Package;
|
||||
CONST CHAR16 *Cwd;
|
||||
CHAR16 *Nfs;
|
||||
CHAR16 *Spot;
|
||||
|
|
@ -37,31 +32,6 @@ ShellCommandRunEdit (
|
|||
ShellStatus = SHELL_SUCCESS;
|
||||
Nfs = NULL;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = CommandInit ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"edit", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
if (ShellCommandLineGetCount (Package) > 2) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"edit");
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
|
|
@ -154,6 +124,58 @@ ShellCommandRunEdit (
|
|||
}
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'edit' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
**/
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunEdit (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
LIST_ENTRY *Package;
|
||||
|
||||
// SHELL_FILE_HANDLE TempHandle;
|
||||
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = CommandInit ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"edit", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
ShellStatus = MainCmdEdit (Package);
|
||||
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
|
||||
return ShellStatus;
|
||||
|
|
|
|||
|
|
@ -10,22 +10,17 @@
|
|||
#include "UefiShellDebug1CommandsLib.h"
|
||||
#include "Compress.h"
|
||||
|
||||
/**
|
||||
Function for 'compress' command.
|
||||
/** Main function of the 'EfiCompress' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
@param[in] Package List of input parameter for the command.
|
||||
**/
|
||||
STATIC
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunEfiCompress (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
MainCmdEfiCompress (
|
||||
LIST_ENTRY *Package
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
SHELL_FILE_HANDLE InShellFileHandle;
|
||||
SHELL_FILE_HANDLE OutShellFileHandle;
|
||||
|
|
@ -49,31 +44,6 @@ ShellCommandRunEfiCompress (
|
|||
OutShellFileHandle = NULL;
|
||||
InBuffer = NULL;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = CommandInit ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"eficompress", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
if (ShellCommandLineGetCount (Package) > 3) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"eficompress");
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
|
|
@ -157,8 +127,6 @@ ShellCommandRunEfiCompress (
|
|||
}
|
||||
|
||||
Exit:
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
|
||||
if (InShellFileHandle != NULL) {
|
||||
gEfiShellProtocol->CloseFile (InShellFileHandle);
|
||||
}
|
||||
|
|
@ -171,5 +139,59 @@ Exit:
|
|||
SHELL_FREE_NON_NULL (InBuffer);
|
||||
SHELL_FREE_NON_NULL (OutBuffer);
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'compress' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
**/
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunEfiCompress (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
Status = EFI_SUCCESS;
|
||||
Package = NULL;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = CommandInit ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"eficompress", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
ShellStatus = MainCmdEfiCompress (Package);
|
||||
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
|
||||
return (ShellStatus);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,22 +10,17 @@
|
|||
#include "UefiShellDebug1CommandsLib.h"
|
||||
#include <Protocol/Decompress.h>
|
||||
|
||||
/**
|
||||
Function for 'decompress' command.
|
||||
/** Main function of the 'EfiDecompress' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
@param[in] Package List of input parameter for the command.
|
||||
**/
|
||||
STATIC
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunEfiDecompress (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
MainCmdEfiDecompress (
|
||||
LIST_ENTRY *Package
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
SHELL_FILE_HANDLE InFileHandle;
|
||||
SHELL_FILE_HANDLE OutFileHandle;
|
||||
|
|
@ -55,31 +50,6 @@ ShellCommandRunEfiDecompress (
|
|||
OutFileHandle = NULL;
|
||||
Decompress = NULL;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = CommandInit ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"efidecompress", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
if (ShellCommandLineGetCount (Package) > 3) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"efidecompress");
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
|
|
@ -188,8 +158,6 @@ ShellCommandRunEfiDecompress (
|
|||
}
|
||||
|
||||
Done:
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
|
||||
if (InFileHandle != NULL) {
|
||||
gEfiShellProtocol->CloseFile (InFileHandle);
|
||||
}
|
||||
|
|
@ -203,5 +171,58 @@ Done:
|
|||
SHELL_FREE_NON_NULL (OutBuffer);
|
||||
SHELL_FREE_NON_NULL (ScratchBuffer);
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'decompress' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
**/
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunEfiDecompress (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = CommandInit ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"efidecompress", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
ShellStatus = MainCmdEfiDecompress (Package);
|
||||
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
|
||||
return (ShellStatus);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,24 +20,19 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
|||
{ NULL, TypeMax }
|
||||
};
|
||||
|
||||
/**
|
||||
Function for 'hexedit' command.
|
||||
/** Main function of the 'HexEdit' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
@param[in] Package List of input parameter for the command.
|
||||
**/
|
||||
STATIC
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunHexEdit (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
MainCmdHexEdit (
|
||||
LIST_ENTRY *Package
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
CHAR16 *Buffer;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *NewName;
|
||||
CONST CHAR16 *Name;
|
||||
UINTN Offset;
|
||||
|
|
@ -53,31 +48,6 @@ ShellCommandRunHexEdit (
|
|||
Size = 0;
|
||||
WhatToDo = FileTypeNone;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = CommandInit ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"hexedit", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
//
|
||||
// Check for -d
|
||||
//
|
||||
|
|
@ -270,9 +240,60 @@ ShellCommandRunHexEdit (
|
|||
}
|
||||
}
|
||||
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
|
||||
SHELL_FREE_NON_NULL (Buffer);
|
||||
SHELL_FREE_NON_NULL (NewName);
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'hexedit' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
**/
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunHexEdit (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
LIST_ENTRY *Package;
|
||||
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = CommandInit ();
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// parse the command line
|
||||
//
|
||||
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"hexedit", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
ShellStatus = MainCmdHexEdit (Package);
|
||||
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,30 +44,20 @@ LoadEfiDriversFromRomImage (
|
|||
CONST CHAR16 *FileName
|
||||
);
|
||||
|
||||
STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
||||
{ L"-nc", TypeFlag },
|
||||
{ NULL, TypeMax }
|
||||
};
|
||||
/** Main function of the 'LoadPciRom' command.
|
||||
|
||||
/**
|
||||
Function for 'loadpcirom' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
@param[in] Package List of input parameter for the command.
|
||||
**/
|
||||
STATIC
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunLoadPciRom (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
MainCmdLoadPciRom (
|
||||
LIST_ENTRY *Package
|
||||
)
|
||||
{
|
||||
EFI_SHELL_FILE_INFO *FileList;
|
||||
UINTN SourceSize;
|
||||
UINT8 *File1Buffer;
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
BOOLEAN Connect;
|
||||
CONST CHAR16 *Param;
|
||||
|
|
@ -81,22 +71,6 @@ ShellCommandRunLoadPciRom (
|
|||
ShellStatus = SHELL_SUCCESS;
|
||||
FileList = NULL;
|
||||
|
||||
//
|
||||
// verify number of arguments
|
||||
//
|
||||
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"loadpcirom", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
if (ShellCommandLineGetCount (Package) < 2) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"loadpcirom");
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
|
|
@ -185,6 +159,55 @@ ShellCommandRunLoadPciRom (
|
|||
}
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
||||
{ L"-nc", TypeFlag },
|
||||
{ NULL, TypeMax }
|
||||
};
|
||||
|
||||
/**
|
||||
Function for 'loadpcirom' command.
|
||||
|
||||
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
||||
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
||||
**/
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunLoadPciRom (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
|
||||
//
|
||||
// Local variable initializations
|
||||
//
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
|
||||
//
|
||||
// verify number of arguments
|
||||
//
|
||||
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"loadpcirom", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
ShellStatus = MainCmdLoadPciRom (Package);
|
||||
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
|
||||
return (ShellStatus);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue