• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** @file
2   Main file for NULL named library for level 1 shell command functions.
3 
4   Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
5   This program and the accompanying materials
6   are licensed and made available under the terms and conditions of the BSD License
7   which accompanies this distribution.  The full text of the license may be found at
8   http://opensource.org/licenses/bsd-license.php
9 
10   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 
13 **/
14 
15 #ifndef _UEFI_SHELL_LEVEL1_COMMANDS_LIB_H_
16 #define _UEFI_SHELL_LEVEL1_COMMANDS_LIB_H_
17 
18 #include <Uefi.h>
19 
20 #include <Guid/ShellLibHiiGuid.h>
21 
22 #include <Protocol/Shell.h>
23 #include <Protocol/ShellParameters.h>
24 #include <Protocol/DevicePath.h>
25 #include <Protocol/LoadedImage.h>
26 #include <Protocol/UnicodeCollation.h>
27 
28 #include <Library/BaseLib.h>
29 #include <Library/BaseMemoryLib.h>
30 #include <Library/DebugLib.h>
31 #include <Library/MemoryAllocationLib.h>
32 #include <Library/PcdLib.h>
33 #include <Library/ShellCommandLib.h>
34 #include <Library/ShellLib.h>
35 #include <Library/SortLib.h>
36 #include <Library/UefiLib.h>
37 #include <Library/UefiRuntimeServicesTableLib.h>
38 #include <Library/UefiBootServicesTableLib.h>
39 #include <Library/HiiLib.h>
40 #include <Library/FileHandleLib.h>
41 
42 extern        EFI_HANDLE                        gShellLevel1HiiHandle;
43 
44 /**
45   Function for 'stall' command.
46 
47   @param[in] ImageHandle  Handle to the Image (NULL if Internal).
48   @param[in] SystemTable  Pointer to the System Table (NULL if Internal).
49 **/
50 SHELL_STATUS
51 EFIAPI
52 ShellCommandRunStall (
53   IN EFI_HANDLE        ImageHandle,
54   IN EFI_SYSTEM_TABLE  *SystemTable
55   );
56 
57 /**
58   Function for 'exit' command.
59 
60   @param[in] ImageHandle  Handle to the Image (NULL if Internal).
61   @param[in] SystemTable  Pointer to the System Table (NULL if Internal).
62 **/
63 SHELL_STATUS
64 EFIAPI
65 ShellCommandRunExit (
66   IN EFI_HANDLE        ImageHandle,
67   IN EFI_SYSTEM_TABLE  *SystemTable
68   );
69 
70 /**
71   Function for 'endif' command.
72 
73   @param[in] ImageHandle  Handle to the Image (NULL if Internal).
74   @param[in] SystemTable  Pointer to the System Table (NULL if Internal).
75 **/
76 SHELL_STATUS
77 EFIAPI
78 ShellCommandRunEndIf (
79   IN EFI_HANDLE        ImageHandle,
80   IN EFI_SYSTEM_TABLE  *SystemTable
81   );
82 
83 /**
84   Function for 'for' command.
85 
86   @param[in] ImageHandle  Handle to the Image (NULL if Internal).
87   @param[in] SystemTable  Pointer to the System Table (NULL if Internal).
88 **/
89 SHELL_STATUS
90 EFIAPI
91 ShellCommandRunFor (
92   IN EFI_HANDLE        ImageHandle,
93   IN EFI_SYSTEM_TABLE  *SystemTable
94   );
95 
96 /**
97   Function for 'endfor' command.
98 
99   @param[in] ImageHandle  Handle to the Image (NULL if Internal).
100   @param[in] SystemTable  Pointer to the System Table (NULL if Internal).
101 **/
102 SHELL_STATUS
103 EFIAPI
104 ShellCommandRunEndFor (
105   IN EFI_HANDLE        ImageHandle,
106   IN EFI_SYSTEM_TABLE  *SystemTable
107   );
108 
109 /**
110   Function for 'if' command.
111 
112   @param[in] ImageHandle  Handle to the Image (NULL if Internal).
113   @param[in] SystemTable  Pointer to the System Table (NULL if Internal).
114 **/
115 SHELL_STATUS
116 EFIAPI
117 ShellCommandRunIf (
118   IN EFI_HANDLE        ImageHandle,
119   IN EFI_SYSTEM_TABLE  *SystemTable
120   );
121 
122 /**
123   Function for 'goto' command.
124 
125   @param[in] ImageHandle  Handle to the Image (NULL if Internal).
126   @param[in] SystemTable  Pointer to the System Table (NULL if Internal).
127 **/
128 SHELL_STATUS
129 EFIAPI
130 ShellCommandRunGoto (
131   IN EFI_HANDLE        ImageHandle,
132   IN EFI_SYSTEM_TABLE  *SystemTable
133   );
134 
135 /**
136   Function for 'shift' command.
137 
138   @param[in] ImageHandle  Handle to the Image (NULL if Internal).
139   @param[in] SystemTable  Pointer to the System Table (NULL if Internal).
140 **/
141 SHELL_STATUS
142 EFIAPI
143 ShellCommandRunShift (
144   IN EFI_HANDLE        ImageHandle,
145   IN EFI_SYSTEM_TABLE  *SystemTable
146   );
147 
148 
149 /**
150   Function for 'else' command.
151 
152   @param[in] ImageHandle  Handle to the Image (NULL if Internal).
153   @param[in] SystemTable  Pointer to the System Table (NULL if Internal).
154 **/
155 SHELL_STATUS
156 EFIAPI
157 ShellCommandRunElse (
158   IN EFI_HANDLE        ImageHandle,
159   IN EFI_SYSTEM_TABLE  *SystemTable
160   );
161 
162 ///
163 /// Function prototype for BOTH GetNextNode and GetPreviousNode...
164 /// This is used to control the MoveToTag function direction...
165 ///
166 typedef
167 LIST_ENTRY *
168 (EFIAPI *LIST_MANIP_FUNC)(
169   IN CONST LIST_ENTRY *List,
170   IN CONST LIST_ENTRY *Node
171   );
172 
173 /**
174   Move the script pointer from 1 tag (line) to another.
175 
176   It functions so that count starts at 1 and it increases or decreases when it
177   hits the specified tags.  when it hits zero the location has been found.
178 
179   DecrementerTag and IncrementerTag are used to get around for/endfor and
180   similar paired types where the entire middle should be ignored.
181 
182   If label is used it will be used instead of the count.
183 
184   @param[in] Function          The function to use to enumerate through the
185                                list.  Normally GetNextNode or GetPreviousNode.
186   @param[in] DecrementerTag    The tag to decrement the count at.
187   @param[in] IncrementerTag    The tag to increment the count at.
188   @param[in] Label             A label to look for.
189   @param[in, out] ScriptFile   The pointer to the current script file structure.
190   @param[in] MovePast          TRUE makes function return 1 past the found
191                                location.
192   @param[in] FindOnly          TRUE to not change the ScriptFile.
193   @param[in] WrapAroundScript  TRUE to wrap end-to-begining or vise versa in
194                                searching.
195 **/
196 BOOLEAN
197 MoveToTag (
198   IN CONST LIST_MANIP_FUNC      Function,
199   IN CONST CHAR16               *DecrementerTag,
200   IN CONST CHAR16               *IncrementerTag,
201   IN CONST CHAR16               *Label OPTIONAL,
202   IN OUT SCRIPT_FILE            *ScriptFile,
203   IN CONST BOOLEAN              MovePast,
204   IN CONST BOOLEAN              FindOnly,
205   IN CONST BOOLEAN              WrapAroundScript
206   );
207 
208 #endif
209 
210