2 Main file for stall shell level 1 function.
4 (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
5 Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include "UefiShellLevel1CommandsLib.h"
19 Function for 'stall' command.
21 @param[in] ImageHandle Handle to the Image (NULL if Internal).
22 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
26 ShellCommandRunStall (
27 IN EFI_HANDLE ImageHandle
,
28 IN EFI_SYSTEM_TABLE
*SystemTable
34 SHELL_STATUS ShellStatus
;
37 ShellStatus
= SHELL_SUCCESS
;
40 // initialize the shell lib (we must be in non-auto-init...)
42 Status
= ShellInitialize();
43 ASSERT_EFI_ERROR(Status
);
45 Status
= CommandInit();
46 ASSERT_EFI_ERROR(Status
);
49 // parse the command line
51 Status
= ShellCommandLineParse (EmptyParamList
, &Package
, &ProblemParam
, TRUE
);
52 if (EFI_ERROR(Status
)) {
53 if (Status
== EFI_VOLUME_CORRUPTED
&& ProblemParam
!= NULL
) {
54 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_GEN_PROBLEM
), gShellLevel1HiiHandle
, L
"stall", ProblemParam
);
55 FreePool(ProblemParam
);
56 ShellStatus
= SHELL_INVALID_PARAMETER
;
61 if (ShellCommandLineGetRawValue(Package
, 2) != NULL
) {
62 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_GEN_TOO_MANY
), gShellLevel1HiiHandle
, L
"stall");
63 ShellStatus
= SHELL_INVALID_PARAMETER
;
64 } else if (ShellCommandLineGetRawValue(Package
, 1) == NULL
) {
65 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_GEN_TOO_FEW
), gShellLevel1HiiHandle
, L
"stall");
66 ShellStatus
= SHELL_INVALID_PARAMETER
;
68 Status
= ShellConvertStringToUint64(ShellCommandLineGetRawValue(Package
, 1), &Intermediate
, FALSE
, FALSE
);
69 if (EFI_ERROR(Status
) || ((UINT64
)(UINTN
)(Intermediate
)) != Intermediate
) {
70 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_GEN_PARAM_INV
), gShellLevel1HiiHandle
, L
"stall", ShellCommandLineGetRawValue(Package
, 1));
71 ShellStatus
= SHELL_INVALID_PARAMETER
;
73 Status
= gBS
->Stall((UINTN
)Intermediate
);
74 if (EFI_ERROR(Status
)) {
75 ShellPrintHiiEx(-1, -1, NULL
, STRING_TOKEN (STR_STALL_FAILED
), gShellLevel1HiiHandle
, L
"stall");
76 ShellStatus
= SHELL_DEVICE_ERROR
;
80 ShellCommandLineFreeVarList (Package
);