]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.c
ArmPlatformPkg: remove ArmPlatformSysConfigLib library class
[mirror_edk2.git] / ArmPlatformPkg / Library / ArmShellCmdRunAxf / ArmShellCmdRunAxf.c
CommitLineData
ced216f8
HL
1/** @file\r
2*\r
3* Copyright (c) 2014, ARM Ltd. All rights reserved.<BR>\r
4*\r
5* This program and the accompanying materials are licensed and made available\r
6* under the terms and conditions of the BSD License which accompanies this\r
7* distribution. The full text of the license may be found at\r
8* http://opensource.org/licenses/bsd-license.php\r
9*\r
10* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12*\r
13**/\r
14\r
15#include <Uefi.h>\r
16\r
17#include <Library/BaseLib.h>\r
18#include <Library/DebugLib.h>\r
19#include <Library/UefiLib.h>\r
20#include <Library/ArmShellCmdLib.h>\r
21\r
22#include "ArmShellCmdRunAxf.h"\r
23\r
24EFI_HANDLE gRunAxfHiiHandle = NULL;\r
25\r
26#define RUNAXF_HII_GUID \\r
27 { \\r
28 0xf5a6413b, 0x78d5, 0x448e, { 0xa2, 0x15, 0x22, 0x82, 0x8e, 0xbc, 0x61, 0x61 } \\r
29 }\r
30\r
31EFI_GUID gRunAxfHiiGuid = RUNAXF_HII_GUID;\r
32\r
33static EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mShellDynCmdProtocolRunAxf = {\r
34 L"runaxf", // *CommandName\r
35 ShellDynCmdRunAxfHandler, // Handler\r
36 ShellDynCmdRunAxfGetHelp // GetHelp\r
37};\r
38\r
39EFI_STATUS\r
40ShellDynCmdRunAxfInstall (\r
41 IN EFI_HANDLE ImageHandle\r
42 )\r
43{\r
44 EFI_STATUS Status;\r
45\r
46 // Register our shell command\r
47 Status = gBS->InstallMultipleProtocolInterfaces (&ImageHandle,\r
48 &gEfiShellDynamicCommandProtocolGuid,\r
49 &mShellDynCmdProtocolRunAxf,\r
50 NULL);\r
51 if (EFI_ERROR (Status)) {\r
52 return Status;\r
53 }\r
54\r
55 // Load the manual page for our command\r
56 //\r
57 // 3rd parameter 'HII strings array' must be name of .uni strings file\r
58 // followed by 'Strings', e.g. mycommands.uni must be specified as\r
59 // 'mycommandsStrings' because the build Autogen process defines this as a\r
60 // string array for the strings in your .uni file. Examine your Build folder\r
61 // under your package's DEBUG folder and you will find it defined in a\r
62 // xxxStrDefs.h file.\r
63 //\r
64 gRunAxfHiiHandle = HiiAddPackages (&gRunAxfHiiGuid, ImageHandle,\r
65 ArmShellCmdRunAxfStrings, NULL);\r
66 if (gRunAxfHiiHandle == NULL) {\r
67 return EFI_UNSUPPORTED;\r
68 }\r
69\r
70 return EFI_SUCCESS;\r
71}\r
72\r
73\r
74EFI_STATUS\r
75ShellDynCmdRunAxfUninstall (\r
76 IN EFI_HANDLE ImageHandle\r
77 )\r
78{\r
79\r
80 EFI_STATUS Status;\r
81\r
82 if (gRunAxfHiiHandle != NULL) {\r
83 HiiRemovePackages (gRunAxfHiiHandle);\r
84 }\r
85\r
86 Status = gBS->UninstallMultipleProtocolInterfaces (ImageHandle,\r
87 &gEfiShellDynamicCommandProtocolGuid,\r
88 &mShellDynCmdProtocolRunAxf,\r
89 NULL);\r
90 if (EFI_ERROR (Status)) {\r
91 return Status;\r
92 }\r
93\r
94 return EFI_SUCCESS;\r
95}\r