mirror of
https://github.com/tianocore/edk2
synced 2026-08-27 00:23:19 -04:00
ShellPkg/UefiShellDriver1: Extract MainCmdXXX() function
This patch aims to help breaking down the long function 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 No functional change should be induced by this patch. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This commit is contained in:
parent
51cdb08cdb
commit
4de99ebb92
10 changed files with 580 additions and 397 deletions
|
|
@ -480,22 +480,17 @@ ConnectFromEfiVariable (
|
|||
return RetStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'connect' command.
|
||||
/** Main function of the 'Connect' 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
|
||||
ShellCommandRunConnect (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
MainCmdConnect (
|
||||
LIST_ENTRY *Package
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
CONST CHAR16 *Param1;
|
||||
CONST CHAR16 *Param2;
|
||||
|
|
@ -505,30 +500,6 @@ ShellCommandRunConnect (
|
|||
UINT64 Intermediate;
|
||||
|
||||
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), gShellDriver1HiiHandle, L"connect", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
//
|
||||
// if more than 2 'value' parameters (plus the name one) or either -r or -c with any value parameters we have too many parameters
|
||||
|
|
@ -566,12 +537,7 @@ ShellCommandRunConnect (
|
|||
Status = ShellConvertStringToUint64 (Param1, &Intermediate, TRUE, FALSE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, L"connect", Param1);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
if (Package != NULL) {
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
}
|
||||
|
||||
return (ShellStatus);
|
||||
return SHELL_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Handle1 = ConvertHandleIndexToHandle ((UINTN)Intermediate);
|
||||
|
|
@ -611,6 +577,55 @@ ShellCommandRunConnect (
|
|||
}
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'connect' 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
|
||||
ShellCommandRunConnect (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
|
||||
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), gShellDriver1HiiHandle, L"connect", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
ShellStatus = MainCmdConnect (Package);
|
||||
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
|
||||
return (ShellStatus);
|
||||
|
|
|
|||
|
|
@ -131,22 +131,17 @@ DoDevTreeForHandle (
|
|||
return (ShellStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'devtree' command.
|
||||
/** Main function of the 'DevTree' 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
|
||||
ShellCommandRunDevTree (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
MainCmdDevTree (
|
||||
LIST_ENTRY *Package
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
CHAR8 *Language;
|
||||
CONST CHAR16 *Lang;
|
||||
|
|
@ -162,34 +157,8 @@ ShellCommandRunDevTree (
|
|||
Status = EFI_SUCCESS;
|
||||
Language = 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 (ParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"devtree", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
if (ShellCommandLineGetCount (Package) > 2) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"devtree");
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
return (SHELL_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
|
|
@ -198,7 +167,6 @@ ShellCommandRunDevTree (
|
|||
Language = AllocateZeroPool (StrSize (Lang));
|
||||
if (Language == NULL) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_OUT_MEM), gShellDriver1HiiHandle, L"devtree");
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
return (SHELL_OUT_OF_RESOURCES);
|
||||
}
|
||||
|
||||
|
|
@ -210,7 +178,6 @@ ShellCommandRunDevTree (
|
|||
} else {
|
||||
ASSERT (Language == NULL);
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"devtree", L"-l");
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
return (SHELL_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
|
|
@ -222,7 +189,6 @@ ShellCommandRunDevTree (
|
|||
if (HiiString == NULL) {
|
||||
ASSERT (HiiString != NULL);
|
||||
SHELL_FREE_NON_NULL (Language);
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
return (SHELL_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
|
|
@ -282,6 +248,56 @@ ShellCommandRunDevTree (
|
|||
}
|
||||
|
||||
SHELL_FREE_NON_NULL (Language);
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'devtree' 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
|
||||
ShellCommandRunDevTree (
|
||||
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 (ParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"devtree", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
ShellStatus = MainCmdDevTree (Package);
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
|
||||
return (ShellStatus);
|
||||
|
|
|
|||
|
|
@ -118,22 +118,17 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
|||
{ NULL, TypeMax }
|
||||
};
|
||||
|
||||
/**
|
||||
Function for 'devices' command.
|
||||
/** Main function of the 'Ls' 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
|
||||
ShellCommandRunDevices (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
MainCmdDevices (
|
||||
LIST_ENTRY *Package
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
CHAR8 *Language;
|
||||
EFI_HANDLE *HandleList;
|
||||
|
|
@ -152,31 +147,6 @@ ShellCommandRunDevices (
|
|||
Language = NULL;
|
||||
SfoFlag = FALSE;
|
||||
|
||||
//
|
||||
// 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), gShellDriver1HiiHandle, L"devices", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
//
|
||||
// if more than 0 'value' parameters we have too many parameters
|
||||
//
|
||||
|
|
@ -195,7 +165,6 @@ ShellCommandRunDevices (
|
|||
Language = AllocateZeroPool (StrSize (Lang));
|
||||
if (Language == NULL) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_OUT_MEM), gShellDriver1HiiHandle, L"devices");
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
return (SHELL_OUT_OF_RESOURCES);
|
||||
}
|
||||
|
||||
|
|
@ -207,7 +176,6 @@ ShellCommandRunDevices (
|
|||
} else {
|
||||
ASSERT (Language == NULL);
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"devices", L"-l");
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
return (SHELL_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
|
|
@ -271,6 +239,56 @@ ShellCommandRunDevices (
|
|||
}
|
||||
|
||||
SHELL_FREE_NON_NULL (Language);
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'devices' 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
|
||||
ShellCommandRunDevices (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
|
||||
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), gShellDriver1HiiHandle, L"devices", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
ShellStatus = MainCmdDevices (Package);
|
||||
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
|
||||
return (ShellStatus);
|
||||
|
|
|
|||
|
|
@ -1017,22 +1017,17 @@ DoDecodeByProtocol (
|
|||
return SHELL_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'dh' command.
|
||||
/** Main function of the 'Dh' 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
|
||||
ShellCommandRunDh (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
MainCmdDh (
|
||||
LIST_ENTRY *Package
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
CHAR8 *Language;
|
||||
CONST CHAR16 *Lang;
|
||||
|
|
@ -1048,34 +1043,8 @@ ShellCommandRunDh (
|
|||
Status = EFI_SUCCESS;
|
||||
Language = 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 (ParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"dh", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
if (ShellCommandLineGetCount (Package) > 2) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"dh");
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
return (SHELL_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
|
|
@ -1085,7 +1054,6 @@ ShellCommandRunDh (
|
|||
Language = AllocateZeroPool (StrSize (Lang));
|
||||
if (Language == NULL) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_OUT_MEM), gShellDriver1HiiHandle, L"dh");
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
return (SHELL_OUT_OF_RESOURCES);
|
||||
}
|
||||
|
||||
|
|
@ -1093,14 +1061,12 @@ ShellCommandRunDh (
|
|||
} else {
|
||||
ASSERT (Language == NULL);
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"dh", L"-l");
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
return (SHELL_INVALID_PARAMETER);
|
||||
}
|
||||
} else {
|
||||
Language = AllocateZeroPool (10);
|
||||
if (Language == NULL) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_OUT_MEM), gShellDriver1HiiHandle, L"dh");
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
return (SHELL_OUT_OF_RESOURCES);
|
||||
}
|
||||
|
||||
|
|
@ -1159,8 +1125,58 @@ ShellCommandRunDh (
|
|||
}
|
||||
}
|
||||
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
SHELL_FREE_NON_NULL (Language);
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'dh' 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
|
||||
ShellCommandRunDh (
|
||||
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 (ParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"dh", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
ShellStatus = MainCmdDh (Package);
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
|
||||
return (ShellStatus);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,22 +71,17 @@ DisconnectAll (
|
|||
return (EFI_SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'disconnect' command.
|
||||
/** Main function of the 'Disconnect' 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
|
||||
ShellCommandRunDisconnect (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
MainCmdDisconnect (
|
||||
LIST_ENTRY *Package
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
CONST CHAR16 *Param1;
|
||||
CONST CHAR16 *Param2;
|
||||
|
|
@ -102,31 +97,7 @@ ShellCommandRunDisconnect (
|
|||
Intermediate2 = 0;
|
||||
Intermediate3 = 0;
|
||||
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), gShellDriver1HiiHandle, L"disconnect", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
if (ShellCommandLineGetFlag (Package, L"-r")) {
|
||||
if (ShellCommandLineGetCount (Package) > 1) {
|
||||
|
|
@ -206,8 +177,6 @@ ShellCommandRunDisconnect (
|
|||
}
|
||||
}
|
||||
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
|
||||
if (ShellStatus == SHELL_SUCCESS) {
|
||||
if (Status == EFI_SECURITY_VIOLATION) {
|
||||
ShellStatus = SHELL_SECURITY_VIOLATION;
|
||||
|
|
@ -218,5 +187,56 @@ ShellCommandRunDisconnect (
|
|||
}
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'disconnect' 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
|
||||
ShellCommandRunDisconnect (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
|
||||
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), gShellDriver1HiiHandle, L"disconnect", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
ShellStatus = MainCmdDisconnect (Package);
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
|
||||
return (ShellStatus);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -256,22 +256,17 @@ GetImageNameFromHandle (
|
|||
return ImageName;
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'drivers' command.
|
||||
/** Main function of the 'Drivers' 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
|
||||
ShellCommandRunDrivers (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
MainCmdDrivers (
|
||||
LIST_ENTRY *Package
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
CHAR8 *Language;
|
||||
CONST CHAR16 *Lang;
|
||||
|
|
@ -297,31 +292,6 @@ ShellCommandRunDrivers (
|
|||
FormatString = NULL;
|
||||
SfoFlag = FALSE;
|
||||
|
||||
//
|
||||
// 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), gShellDriver1HiiHandle, L"drivers", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
if (ShellCommandLineGetCount (Package) > 1) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"drivers");
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
|
|
@ -332,7 +302,6 @@ ShellCommandRunDrivers (
|
|||
Language = AllocateZeroPool (StrSize (Lang));
|
||||
if (Language == NULL) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_OUT_MEM), gShellDriver1HiiHandle, L"drivers");
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
return (SHELL_OUT_OF_RESOURCES);
|
||||
}
|
||||
|
||||
|
|
@ -340,7 +309,6 @@ ShellCommandRunDrivers (
|
|||
} else {
|
||||
ASSERT (Language == NULL);
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"drivers", L"-l");
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
return (SHELL_INVALID_PARAMETER);
|
||||
}
|
||||
}
|
||||
|
|
@ -376,7 +344,6 @@ ShellCommandRunDrivers (
|
|||
if (FormatString == NULL) {
|
||||
// Assume the string is present because it is hard-coded and report out of memory
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_OUT_MEM), gShellDriver1HiiHandle, L"drivers");
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
return (SHELL_OUT_OF_RESOURCES);
|
||||
}
|
||||
|
||||
|
|
@ -400,7 +367,6 @@ ShellCommandRunDrivers (
|
|||
TruncatedDriverName = AllocateZeroPool ((MAX_LEN_DRIVER_NAME + 1) * sizeof (CHAR16));
|
||||
if (TruncatedDriverName == NULL) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_OUT_MEM), gShellDriver1HiiHandle, L"drivers");
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
return (SHELL_OUT_OF_RESOURCES);
|
||||
}
|
||||
|
||||
|
|
@ -455,8 +421,59 @@ ShellCommandRunDrivers (
|
|||
}
|
||||
|
||||
SHELL_FREE_NON_NULL (Language);
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
SHELL_FREE_NON_NULL (FormatString);
|
||||
|
||||
return (ShellStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'drivers' 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
|
||||
ShellCommandRunDrivers (
|
||||
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 (ParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"drivers", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
ShellStatus = MainCmdDrivers (Package);
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
|
||||
return (ShellStatus);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1145,22 +1145,19 @@ STATIC CONST SHELL_PARAM_ITEM ParamListPreHii[] = {
|
|||
{ NULL, TypeMax }
|
||||
};
|
||||
|
||||
/**
|
||||
Function for 'drvcfg' command.
|
||||
/** Main function of the 'DrvCfg' 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.
|
||||
@param[in] UseHii TRUE to check for Hii and DPC, FALSE for DCP only.
|
||||
**/
|
||||
STATIC
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunDrvCfg (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
MainCmdDrvCfg (
|
||||
LIST_ENTRY *Package,
|
||||
BOOLEAN UseHii
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
CHAR8 *Language;
|
||||
CONST CHAR16 *Lang;
|
||||
|
|
@ -1174,7 +1171,6 @@ ShellCommandRunDrvCfg (
|
|||
BOOLEAN InFromFile;
|
||||
BOOLEAN OutToFile;
|
||||
BOOLEAN AllChildren;
|
||||
BOOLEAN UseHii;
|
||||
UINT32 ForceType;
|
||||
UINT64 Intermediate;
|
||||
EFI_HANDLE Handle1;
|
||||
|
|
@ -1182,64 +1178,26 @@ ShellCommandRunDrvCfg (
|
|||
EFI_HANDLE Handle3;
|
||||
CONST CHAR16 *FileName;
|
||||
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
Status = EFI_SUCCESS;
|
||||
Language = NULL;
|
||||
UseHii = TRUE;
|
||||
ProblemParam = 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 (ParamListHii, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status) || (ShellCommandLineGetCount (Package) > 2)) {
|
||||
UseHii = FALSE;
|
||||
if (Package != NULL) {
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
}
|
||||
|
||||
SHELL_FREE_NON_NULL (ProblemParam);
|
||||
Status = ShellCommandLineParse (ParamListPreHii, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"drvcfg", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
return SHELL_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
ASSERT (FALSE);
|
||||
return ShellStatus;
|
||||
}
|
||||
}
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
Status = EFI_SUCCESS;
|
||||
Language = NULL;
|
||||
|
||||
if (ShellCommandLineGetCount (Package) > 4) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_TOO_MANY), gShellDriver1HiiHandle, L"drvcfg");
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
goto Done;
|
||||
return SHELL_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Lang = ShellCommandLineGetValue (Package, L"-l");
|
||||
if (Lang != NULL) {
|
||||
Language = AllocateZeroPool (StrSize (Lang));
|
||||
if (Language == NULL) {
|
||||
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
||||
goto Done;
|
||||
return SHELL_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
AsciiSPrint (Language, StrSize (Lang), "%S", Lang);
|
||||
} else if (ShellCommandLineGetFlag (Package, L"-l")) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"drvcfg", L"-l");
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
goto Done;
|
||||
return SHELL_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Set = ShellCommandLineGetFlag (Package, L"-s");
|
||||
|
|
@ -1437,7 +1395,69 @@ ShellCommandRunDrvCfg (
|
|||
}
|
||||
|
||||
Done:
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
SHELL_FREE_NON_NULL (Language);
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'drvcfg' 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
|
||||
ShellCommandRunDrvCfg (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
BOOLEAN UseHii;
|
||||
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
Status = EFI_SUCCESS;
|
||||
ProblemParam = NULL;
|
||||
UseHii = TRUE;
|
||||
|
||||
//
|
||||
// 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 (ParamListHii, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status) || (ShellCommandLineGetCount (Package) > 2)) {
|
||||
UseHii = FALSE;
|
||||
if (Package != NULL) {
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
}
|
||||
|
||||
SHELL_FREE_NON_NULL (ProblemParam);
|
||||
Status = ShellCommandLineParse (ParamListPreHii, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"drvcfg", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
return SHELL_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
ASSERT (FALSE);
|
||||
return ShellStatus;
|
||||
}
|
||||
}
|
||||
|
||||
ShellStatus = MainCmdDrvCfg (Package, UseHii);
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
|
||||
return (ShellStatus);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -332,22 +332,17 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
|||
{ NULL, TypeMax }
|
||||
};
|
||||
|
||||
/**
|
||||
Function for 'drvdiag' command.
|
||||
/** Main function of the 'DrvDiag' 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
|
||||
ShellCommandRunDrvDiag (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
MainCmdDrvDiag (
|
||||
LIST_ENTRY *Package
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
DRV_DIAG_TEST_MODE Mode;
|
||||
CHAR8 *Language;
|
||||
|
|
@ -361,34 +356,10 @@ ShellCommandRunDrvDiag (
|
|||
UINT64 Intermediate;
|
||||
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
Status = EFI_SUCCESS;
|
||||
Mode = TestModeMax;
|
||||
Language = 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 (ParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, L"drvdiag", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
//
|
||||
// if more than 3 'value' parameters (plus the name one) or we have any 2 mode flags
|
||||
//
|
||||
|
|
@ -431,13 +402,11 @@ ShellCommandRunDrvDiag (
|
|||
if (ShellCommandLineGetFlag (Package, L"-l") && (Lang == NULL)) {
|
||||
ASSERT (Language == NULL);
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"drvdiag", L"-l");
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
return (SHELL_INVALID_PARAMETER);
|
||||
} else if (Lang != NULL) {
|
||||
Language = AllocateZeroPool (StrSize (Lang));
|
||||
if (Language == NULL) {
|
||||
ShellPrintHiiDefaultEx (STRING_TOKEN (STR_GEN_OUT_MEM), gShellDriver1HiiHandle, L"drvdiag");
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
return (SHELL_OUT_OF_RESOURCES);
|
||||
}
|
||||
|
||||
|
|
@ -475,9 +444,6 @@ ShellCommandRunDrvDiag (
|
|||
Handle3
|
||||
);
|
||||
|
||||
SHELL_FREE_NON_NULL (Language);
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
|
||||
if (ShellStatus == SHELL_SUCCESS) {
|
||||
if (Status == EFI_SECURITY_VIOLATION) {
|
||||
ShellStatus = SHELL_SECURITY_VIOLATION;
|
||||
|
|
@ -490,5 +456,58 @@ ShellCommandRunDrvDiag (
|
|||
}
|
||||
}
|
||||
|
||||
SHELL_FREE_NON_NULL (Language);
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'drvdiag' 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
|
||||
ShellCommandRunDrvDiag (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
|
||||
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), gShellDriver1HiiHandle, L"drvdiag", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
ShellStatus = MainCmdDrvDiag (Package);
|
||||
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
|
||||
return (ShellStatus);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,54 +144,25 @@ TraverseHandleDatabase (
|
|||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'openinfo' command.
|
||||
/** Main function of the 'OpenInfo' 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
|
||||
ShellCommandRunOpenInfo (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
MainCmdOpenInfo (
|
||||
LIST_ENTRY *Package
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
EFI_HANDLE TheHandle;
|
||||
CONST CHAR16 *Param1;
|
||||
UINT64 Intermediate;
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
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), gShellDriver1HiiHandle, L"openinfo", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
if (ShellCommandLineGetCount (Package) > 2) {
|
||||
//
|
||||
// error for too many parameters
|
||||
|
|
@ -229,6 +200,56 @@ ShellCommandRunOpenInfo (
|
|||
}
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'openinfo' 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
|
||||
ShellCommandRunOpenInfo (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
|
||||
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), gShellDriver1HiiHandle, L"openinfo", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
ShellStatus = MainCmdOpenInfo (Package);
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
|
||||
return (ShellStatus);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,22 +43,17 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
|||
{ NULL, TypeMax }
|
||||
};
|
||||
|
||||
/**
|
||||
Function for 'unload' command.
|
||||
/** Main function of the 'Unload' 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
|
||||
ShellCommandRunUnload (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
MainCmdUnload (
|
||||
LIST_ENTRY *Package
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
EFI_HANDLE TheHandle;
|
||||
CONST CHAR16 *Param1;
|
||||
|
|
@ -66,33 +61,11 @@ ShellCommandRunUnload (
|
|||
UINT64 Value;
|
||||
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
Package = NULL;
|
||||
Status = EFI_SUCCESS;
|
||||
Resp = NULL;
|
||||
Value = 0;
|
||||
TheHandle = NULL;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
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), gShellDriver1HiiHandle, L"unload", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
if (ShellCommandLineGetCount (Package) > 2) {
|
||||
//
|
||||
// error for too many parameters
|
||||
|
|
@ -142,6 +115,54 @@ ShellCommandRunUnload (
|
|||
}
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
Function for 'unload' 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
|
||||
ShellCommandRunUnload (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
Package = NULL;
|
||||
|
||||
//
|
||||
// initialize the shell lib (we must be in non-auto-init...)
|
||||
//
|
||||
Status = ShellInitialize ();
|
||||
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), gShellDriver1HiiHandle, L"unload", ProblemParam);
|
||||
FreePool (ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
ShellStatus = MainCmdUnload (Package);
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
|
||||
return (ShellStatus);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue