• 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 - 2013, 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 #include <ShellBase.h>
20 
21 #include <Guid/ShellLibHiiGuid.h>
22 
23 #include <Protocol/EfiShell.h>
24 #include <Protocol/EfiShellParameters.h>
25 #include <Protocol/DevicePath.h>
26 #include <Protocol/LoadedImage.h>
27 #include <Protocol/UnicodeCollation.h>
28 
29 #include <Library/BaseLib.h>
30 #include <Library/BaseMemoryLib.h>
31 #include <Library/DebugLib.h>
32 #include <Library/MemoryAllocationLib.h>
33 #include <Library/PcdLib.h>
34 #include <Library/ShellCommandLib.h>
35 #include <Library/ShellLib.h>
36 #include <Library/SortLib.h>
37 #include <Library/UefiLib.h>
38 #include <Library/UefiRuntimeServicesTableLib.h>
39 #include <Library/UefiBootServicesTableLib.h>
40 #include <Library/HiiLib.h>
41 #include <Library/FileHandleLib.h>
42 
43 extern        EFI_HANDLE                        gShellLevel1HiiHandle;
44 
45 /**
46   Function for 'stall' command.
47 
48   @param[in] ImageHandle  Handle to the Image (NULL if Internal).
49   @param[in] SystemTable  Pointer to the System Table (NULL if Internal).
50 **/
51 SHELL_STATUS
52 EFIAPI
53 ShellCommandRunStall (
54   IN EFI_HANDLE        ImageHandle,
55   IN EFI_SYSTEM_TABLE  *SystemTable
56   );
57 
58 /**
59   Function for 'exit' command.
60 
61   @param[in] ImageHandle  Handle to the Image (NULL if Internal).
62   @param[in] SystemTable  Pointer to the System Table (NULL if Internal).
63 **/
64 SHELL_STATUS
65 EFIAPI
66 ShellCommandRunExit (
67   IN EFI_HANDLE        ImageHandle,
68   IN EFI_SYSTEM_TABLE  *SystemTable
69   );
70 
71 /**
72   Function for 'endif' command.
73 
74   @param[in] ImageHandle  Handle to the Image (NULL if Internal).
75   @param[in] SystemTable  Pointer to the System Table (NULL if Internal).
76 **/
77 SHELL_STATUS
78 EFIAPI
79 ShellCommandRunEndIf (
80   IN EFI_HANDLE        ImageHandle,
81   IN EFI_SYSTEM_TABLE  *SystemTable
82   );
83 
84 /**
85   Function for 'for' command.
86 
87   @param[in] ImageHandle  Handle to the Image (NULL if Internal).
88   @param[in] SystemTable  Pointer to the System Table (NULL if Internal).
89 **/
90 SHELL_STATUS
91 EFIAPI
92 ShellCommandRunFor (
93   IN EFI_HANDLE        ImageHandle,
94   IN EFI_SYSTEM_TABLE  *SystemTable
95   );
96 
97 /**
98   Function for 'endfor' command.
99 
100   @param[in] ImageHandle  Handle to the Image (NULL if Internal).
101   @param[in] SystemTable  Pointer to the System Table (NULL if Internal).
102 **/
103 SHELL_STATUS
104 EFIAPI
105 ShellCommandRunEndFor (
106   IN EFI_HANDLE        ImageHandle,
107   IN EFI_SYSTEM_TABLE  *SystemTable
108   );
109 
110 /**
111   Function for 'if' command.
112 
113   @param[in] ImageHandle  Handle to the Image (NULL if Internal).
114   @param[in] SystemTable  Pointer to the System Table (NULL if Internal).
115 **/
116 SHELL_STATUS
117 EFIAPI
118 ShellCommandRunIf (
119   IN EFI_HANDLE        ImageHandle,
120   IN EFI_SYSTEM_TABLE  *SystemTable
121   );
122 
123 /**
124   Function for 'goto' command.
125 
126   @param[in] ImageHandle  Handle to the Image (NULL if Internal).
127   @param[in] SystemTable  Pointer to the System Table (NULL if Internal).
128 **/
129 SHELL_STATUS
130 EFIAPI
131 ShellCommandRunGoto (
132   IN EFI_HANDLE        ImageHandle,
133   IN EFI_SYSTEM_TABLE  *SystemTable
134   );
135 
136 /**
137   Function for 'shift' command.
138 
139   @param[in] ImageHandle  Handle to the Image (NULL if Internal).
140   @param[in] SystemTable  Pointer to the System Table (NULL if Internal).
141 **/
142 SHELL_STATUS
143 EFIAPI
144 ShellCommandRunShift (
145   IN EFI_HANDLE        ImageHandle,
146   IN EFI_SYSTEM_TABLE  *SystemTable
147   );
148 
149 
150 /**
151   Function for 'else' command.
152 
153   @param[in] ImageHandle  Handle to the Image (NULL if Internal).
154   @param[in] SystemTable  Pointer to the System Table (NULL if Internal).
155 **/
156 SHELL_STATUS
157 EFIAPI
158 ShellCommandRunElse (
159   IN EFI_HANDLE        ImageHandle,
160   IN EFI_SYSTEM_TABLE  *SystemTable
161   );
162 
163 ///
164 /// Function prototype for BOTH GetNextNode and GetPreviousNode...
165 /// This is used to control the MoveToTag function direction...
166 ///
167 typedef
168 LIST_ENTRY *
169 (EFIAPI *LIST_MANIP_FUNC)(
170   IN CONST LIST_ENTRY *List,
171   IN CONST LIST_ENTRY *Node
172   );
173 
174 /**
175   Move the script pointer from 1 tag (line) to another.
176 
177   It functions so that count starts at 1 and it increases or decreases when it
178   hits the specified tags.  when it hits zero the location has been found.
179 
180   DecrementerTag and IncrementerTag are used to get around for/endfor and
181   similar paired types where the entire middle should be ignored.
182 
183   If label is used it will be used instead of the count.
184 
185   @param[in] Function          The function to use to enumerate through the
186                                list.  Normally GetNextNode or GetPreviousNode.
187   @param[in] DecrementerTag    The tag to decrement the count at.
188   @param[in] IncrementerTag    The tag to increment the count at.
189   @param[in] Label             A label to look for.
190   @param[in, out] ScriptFile   The pointer to the current script file structure.
191   @param[in] MovePast          TRUE makes function return 1 past the found
192                                location.
193   @param[in] FindOnly          TRUE to not change the ScriptFile.
194   @param[in] WrapAroundScript  TRUE to wrap end-to-begining or vise versa in
195                                searching.
196 **/
197 BOOLEAN
198 EFIAPI
199 MoveToTag (
200   IN CONST LIST_MANIP_FUNC      Function,
201   IN CONST CHAR16               *DecrementerTag,
202   IN CONST CHAR16               *IncrementerTag,
203   IN CONST CHAR16               *Label OPTIONAL,
204   IN OUT SCRIPT_FILE            *ScriptFile,
205   IN CONST BOOLEAN              MovePast,
206   IN CONST BOOLEAN              FindOnly,
207   IN CONST BOOLEAN              WrapAroundScript
208   );
209 
210 #endif
211 
212