2 Main file for stall shell level 1 function.
4 (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
5 Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include "UefiShellLevel1CommandsLib.h"
13 Function for 'stall' command.
15 @param[in] ImageHandle Handle to the Image (NULL if Internal).
16 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
20 ShellCommandRunStall (
21 IN EFI_HANDLE ImageHandle
,
22 IN EFI_SYSTEM_TABLE
*SystemTable
28 SHELL_STATUS ShellStatus
;
31 ShellStatus
= SHELL_SUCCESS
;
34 // initialize the shell lib (we must be in non-auto-init...)
36 Status
= ShellInitialize ();
37 ASSERT_EFI_ERROR (Status
);
39 Status
= CommandInit ();
40 ASSERT_EFI_ERROR (Status
);
43 // parse the command line
45 Status
= ShellCommandLineParse (EmptyParamList
, &Package
, &ProblemParam
, TRUE
);
46 if (EFI_ERROR (Status
)) {
47 if ((Status
== EFI_VOLUME_CORRUPTED
) && (ProblemParam
!= NULL
)) {
48 ShellPrintHiiEx (-1, -1, NULL
, STRING_TOKEN (STR_GEN_PROBLEM
), gShellLevel1HiiHandle
, L
"stall", ProblemParam
);
49 FreePool (ProblemParam
);
50 ShellStatus
= SHELL_INVALID_PARAMETER
;
55 if (ShellCommandLineGetRawValue (Package
, 2) != NULL
) {
56 ShellPrintHiiEx (-1, -1, NULL
, STRING_TOKEN (STR_GEN_TOO_MANY
), gShellLevel1HiiHandle
, L
"stall");
57 ShellStatus
= SHELL_INVALID_PARAMETER
;
58 } else if (ShellCommandLineGetRawValue (Package
, 1) == NULL
) {
59 ShellPrintHiiEx (-1, -1, NULL
, STRING_TOKEN (STR_GEN_TOO_FEW
), gShellLevel1HiiHandle
, L
"stall");
60 ShellStatus
= SHELL_INVALID_PARAMETER
;
62 Status
= ShellConvertStringToUint64 (ShellCommandLineGetRawValue (Package
, 1), &Intermediate
, FALSE
, FALSE
);
63 if (EFI_ERROR (Status
) || (((UINT64
)(UINTN
)(Intermediate
)) != Intermediate
)) {
64 ShellPrintHiiEx (-1, -1, NULL
, STRING_TOKEN (STR_GEN_PARAM_INV
), gShellLevel1HiiHandle
, L
"stall", ShellCommandLineGetRawValue (Package
, 1));
65 ShellStatus
= SHELL_INVALID_PARAMETER
;
67 Status
= gBS
->Stall ((UINTN
)Intermediate
);
68 if (EFI_ERROR (Status
)) {
69 ShellPrintHiiEx (-1, -1, NULL
, STRING_TOKEN (STR_STALL_FAILED
), gShellLevel1HiiHandle
, L
"stall");
70 ShellStatus
= SHELL_DEVICE_ERROR
;
75 ShellCommandLineFreeVarList (Package
);