]> git.proxmox.com Git - mirror_edk2.git/blame - ShellPkg/Library/UefiShellLevel3CommandsLib/GetMtc.c
ShellPkg: Standardized HP Copyright Message String
[mirror_edk2.git] / ShellPkg / Library / UefiShellLevel3CommandsLib / GetMtc.c
CommitLineData
a405b86d 1/** @file\r
2 Main file for GetMtc shell level 3 function.\r
3\r
c011b6c9 4 (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>\r
cbcccd2c 5 Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved. <BR>\r
a405b86d 6 This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#include "UefiShellLevel3CommandsLib.h"\r
17\r
18#include <Library/ShellLib.h>\r
19\r
20/**\r
21 Function for 'getmtc' command.\r
22\r
23 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
24 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
25**/\r
26SHELL_STATUS\r
27EFIAPI\r
28ShellCommandRunGetMtc (\r
29 IN EFI_HANDLE ImageHandle,\r
30 IN EFI_SYSTEM_TABLE *SystemTable\r
31 )\r
32{\r
33 EFI_STATUS Status;\r
34 LIST_ENTRY *Package;\r
35 CHAR16 *ProblemParam;\r
36 SHELL_STATUS ShellStatus;\r
37 UINT64 Mtc;\r
38\r
39 ProblemParam = NULL;\r
40 ShellStatus = SHELL_SUCCESS;\r
41\r
42 //\r
43 // initialize the shell lib (we must be in non-auto-init...)\r
44 //\r
45 Status = ShellInitialize();\r
46 ASSERT_EFI_ERROR(Status);\r
47\r
48 //\r
49 // parse the command line\r
50 //\r
51 Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);\r
52 if (EFI_ERROR(Status)) {\r
53 if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {\r
e54a10bb 54 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"getmtc", ProblemParam); \r
a405b86d 55 FreePool(ProblemParam);\r
56 ShellStatus = SHELL_INVALID_PARAMETER;\r
57 } else {\r
58 ASSERT(FALSE);\r
59 }\r
60 } else {\r
61 //\r
62 // check for "-?"\r
63 //\r
64 if (ShellCommandLineGetFlag(Package, L"-?")) {\r
65 ASSERT(FALSE);\r
66 } else if (ShellCommandLineGetRawValue(Package, 1) != NULL) {\r
e54a10bb 67 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle, L"getmtc"); \r
a405b86d 68 ShellStatus = SHELL_INVALID_PARAMETER;\r
69 } else {\r
70 //\r
71 // Get the monotonic counter count\r
72 //\r
73 Status = gBS->GetNextMonotonicCount(&Mtc);\r
cbcccd2c
LG
74 if (Status == EFI_DEVICE_ERROR) {\r
75 ShellStatus = SHELL_DEVICE_ERROR;\r
76 } else if (Status == EFI_SECURITY_VIOLATION) {\r
77 ShellStatus = SHELL_SECURITY_VIOLATION;\r
78 } else if (EFI_ERROR(Status)) {\r
79 ShellStatus = SHELL_DEVICE_ERROR;\r
a405b86d 80 }\r
81\r
82 //\r
83 // print it...\r
84 //\r
85 if (ShellStatus == SHELL_SUCCESS) {\r
86 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GET_MTC_OUTPUT), gShellLevel3HiiHandle, Mtc);\r
87 }\r
88 }\r
89 //\r
90 // free the command line package\r
91 //\r
92 ShellCommandLineFreeVarList (Package);\r
93 }\r
94\r
95 return (ShellStatus);\r
96}\r
97\r