]>
Commit | Line | Data |
---|---|---|
94b17fa1 | 1 | /** @file\r |
9b3bf083 | 2 | Defines for EFI shell environment 2 ported to EDK II build environment. (no spec)\r |
94b17fa1 | 3 | \r |
1e6e84c7 | 4 | Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r |
56ba3746 | 5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
94b17fa1 | 6 | \r |
7 | **/\r | |
8 | \r | |
a405b86d | 9 | #ifndef _SHELL_ENVIRONMENT_2_PROTOCOL_H_\r |
b3011f40 | 10 | #define _SHELL_ENVIRONMENT_2_PROTOCOL_H_\r |
94b17fa1 | 11 | \r |
47d20b54 MK |
12 | #define DEFAULT_INIT_ROW 1\r |
13 | #define DEFAULT_AUTO_LF FALSE\r | |
94b17fa1 | 14 | \r |
94b17fa1 | 15 | /**\r |
1e6e84c7 | 16 | This function is a prototype for a function that dumps information on a protocol\r |
17 | to a given location. The location is dependant on the implementation. This is\r | |
94b17fa1 | 18 | used when programatically adding shell commands.\r |
19 | \r | |
a405b86d | 20 | @param[in] Handle The handle the protocol is on.\r |
21 | @param[in] Interface The interface to the protocol.\r | |
94b17fa1 | 22 | \r |
23 | **/\r | |
24 | typedef\r | |
25 | VOID\r | |
47d20b54 | 26 | (EFIAPI *SHELLENV_DUMP_PROTOCOL_INFO)(\r |
94b17fa1 | 27 | IN EFI_HANDLE Handle,\r |
28 | IN VOID *Interface\r | |
29 | );\r | |
30 | \r | |
31 | /**\r | |
1e6e84c7 | 32 | This function is a prototype for each command internal to the EFI shell\r |
33 | implementation. The specific command depends on the implementation. This is\r | |
94b17fa1 | 34 | used when programatically adding shell commands.\r |
35 | \r | |
a405b86d | 36 | @param[in] ImageHandle The handle to the binary shell.\r |
37 | @param[in] SystemTable The pointer to the system table.\r | |
94b17fa1 | 38 | \r |
a405b86d | 39 | @retval EFI_SUCCESS The command completed.\r |
40 | @retval other An error occurred. Any error is possible\r | |
1e6e84c7 | 41 | depending on the implementation of the shell\r |
94b17fa1 | 42 | command.\r |
43 | \r | |
44 | **/\r | |
45 | typedef\r | |
46 | EFI_STATUS\r | |
47d20b54 | 47 | (EFIAPI *SHELLENV_INTERNAL_COMMAND)(\r |
94b17fa1 | 48 | IN EFI_HANDLE ImageHandle,\r |
49 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
50 | );\r | |
51 | \r | |
52 | /**\r | |
1e6e84c7 | 53 | This function is a prototype for one that gets a help string for a given command.\r |
54 | This is used when programatically adding shell commands. Upon successful return\r | |
94b17fa1 | 55 | the memory allocated is up to the caller to free.\r |
56 | \r | |
4ff7e37b | 57 | @param[in, out] Str Pointer to pointer to string to display for help.\r |
94b17fa1 | 58 | \r |
b3011f40 | 59 | @retval EFI_SUCCESS The help string is in the parameter Str.\r |
94b17fa1 | 60 | \r |
61 | **/\r | |
62 | typedef\r | |
63 | EFI_STATUS\r | |
47d20b54 | 64 | (EFIAPI *SHELLCMD_GET_LINE_HELP)(\r |
94b17fa1 | 65 | IN OUT CHAR16 **Str\r |
66 | );\r | |
67 | \r | |
68 | /**\r | |
a31bd33c | 69 | Structure returned from functions that open multiple files.\r |
94b17fa1 | 70 | **/\r |
71 | typedef struct {\r | |
47d20b54 MK |
72 | UINT32 Signature; ///< SHELL_FILE_ARG_SIGNATURE.\r |
73 | LIST_ENTRY Link; ///< Linked list helper.\r | |
74 | EFI_STATUS Status; ///< File's status.\r | |
94b17fa1 | 75 | \r |
47d20b54 MK |
76 | EFI_FILE_HANDLE Parent; ///< What is the Parent file of this file.\r |
77 | UINT64 OpenMode; ///< How was the file opened.\r | |
78 | CHAR16 *ParentName; ///< String representation of parent.\r | |
79 | EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath; ///< DevicePath for Parent.\r | |
94b17fa1 | 80 | \r |
47d20b54 MK |
81 | CHAR16 *FullName; ///< Path and file name for this file.\r |
82 | CHAR16 *FileName; ///< File name for this file.\r | |
94b17fa1 | 83 | \r |
47d20b54 MK |
84 | EFI_FILE_HANDLE Handle; ///< Handle to this file.\r |
85 | EFI_FILE_INFO *Info; ///< Pointer to file info for this file.\r | |
94b17fa1 | 86 | } SHELL_FILE_ARG;\r |
87 | \r | |
1e6e84c7 | 88 | /// Signature for SHELL_FILE_ARG.\r |
89 | #define SHELL_FILE_ARG_SIGNATURE SIGNATURE_32 ('g', 'r', 'a', 'f')\r | |
94b17fa1 | 90 | \r |
91 | /**\r | |
b3011f40 | 92 | GUID for the shell environment2 and shell environment.\r |
94b17fa1 | 93 | **/\r |
94 | #define SHELL_ENVIRONMENT_PROTOCOL_GUID \\r | |
95 | { \\r | |
55034088 | 96 | 0x47c7b221, 0xc42a, 0x11d2, {0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} \\r |
94b17fa1 | 97 | }\r |
98 | \r | |
99 | /**\r | |
b3011f40 | 100 | GUID for the shell environment2 extension (main GUID above).\r |
94b17fa1 | 101 | **/\r |
102 | #define EFI_SE_EXT_SIGNATURE_GUID \\r | |
103 | { \\r | |
104 | 0xd2c18636, 0x40e5, 0x4eb5, {0xa3, 0x1b, 0x36, 0x69, 0x5f, 0xd4, 0x2c, 0x87} \\r | |
105 | }\r | |
106 | \r | |
47d20b54 MK |
107 | #define EFI_SHELL_MAJOR_VER 0x00000001 ///< Major version of the EFI_SHELL_ENVIRONMENT2.\r |
108 | #define EFI_SHELL_MINOR_VER 0x00000000 ///< Minor version of the EFI_SHELL_ENVIRONMENT2.\r | |
94b17fa1 | 109 | \r |
110 | /**\r | |
1e6e84c7 | 111 | Execute a command line.\r |
94b17fa1 | 112 | \r |
1e6e84c7 | 113 | This function will run the CommandLine. This includes loading any required images,\r |
114 | parsing any requires scripts, and if DebugOutput is TRUE printing errors\r | |
94b17fa1 | 115 | encountered directly to the screen.\r |
1e6e84c7 | 116 | \r |
a405b86d | 117 | @param[in] ParentImageHandle Handle of the image executing this operation.\r |
118 | @param[in] CommandLine The string command line to execute.\r | |
119 | @param[in] DebugOutput TRUE indicates that errors should be printed directly.\r | |
268d3445 | 120 | FALSE suppresses error messages.\r |
94b17fa1 | 121 | \r |
a31bd33c | 122 | @retval EFI_SUCCESS The command line executed and completed.\r |
a405b86d | 123 | @retval EFI_ABORTED The operation aborted.\r |
94b17fa1 | 124 | @retval EFI_INVALID_PARAMETER A parameter did not have a valid value.\r |
125 | @retval EFI_OUT_OF_RESOURCES A required memory allocation failed.\r | |
126 | \r | |
127 | @sa HandleProtocol\r | |
128 | **/\r | |
129 | typedef\r | |
130 | EFI_STATUS\r | |
47d20b54 | 131 | (EFIAPI *SHELLENV_EXECUTE)(\r |
94b17fa1 | 132 | IN EFI_HANDLE *ParentImageHandle,\r |
133 | IN CHAR16 *CommandLine,\r | |
134 | IN BOOLEAN DebugOutput\r | |
135 | );\r | |
136 | \r | |
137 | /**\r | |
b3011f40 | 138 | This function returns a shell environment variable value.\r |
94b17fa1 | 139 | \r |
a405b86d | 140 | @param[in] Name The pointer to the string with the shell environment\r |
b3011f40 | 141 | variable name.\r |
94b17fa1 | 142 | \r |
b3011f40 | 143 | @retval NULL The shell environment variable's value could not be found.\r |
1e6e84c7 | 144 | @retval !=NULL The value of the shell environment variable Name.\r |
94b17fa1 | 145 | \r |
146 | **/\r | |
1e6e84c7 | 147 | typedef\r |
148 | CHAR16 *\r | |
47d20b54 | 149 | (EFIAPI *SHELLENV_GET_ENV)(\r |
94b17fa1 | 150 | IN CHAR16 *Name\r |
151 | );\r | |
152 | \r | |
153 | /**\r | |
b3011f40 | 154 | This function returns a shell environment map value.\r |
94b17fa1 | 155 | \r |
a405b86d | 156 | @param[in] Name The pointer to the string with the shell environment\r |
b3011f40 | 157 | map name.\r |
94b17fa1 | 158 | \r |
b3011f40 | 159 | @retval NULL The shell environment map's value could not be found.\r |
1e6e84c7 | 160 | @retval !=NULL The value of the shell environment map Name.\r |
94b17fa1 | 161 | \r |
162 | **/\r | |
1e6e84c7 | 163 | typedef\r |
164 | CHAR16 *\r | |
47d20b54 | 165 | (EFIAPI *SHELLENV_GET_MAP)(\r |
94b17fa1 | 166 | IN CHAR16 *Name\r |
167 | );\r | |
168 | \r | |
169 | /**\r | |
170 | This function will add an internal command to the shell interface.\r | |
171 | \r | |
172 | This will allocate all required memory, put the new command on the command\r | |
173 | list in the correct location.\r | |
174 | \r | |
a405b86d | 175 | @param[in] Handler The handler function to call when the command gets called.\r |
176 | @param[in] Cmd The command name.\r | |
177 | @param[in] GetLineHelp The function to call of type "get help" for this command.\r | |
94b17fa1 | 178 | \r |
b3011f40 | 179 | @retval EFI_SUCCESS The command is now part of the command list.\r |
180 | @retval EFI_OUT_OF_RESOURCES A memory allocation failed.\r | |
94b17fa1 | 181 | @sa SHELLENV_INTERNAL_COMMAND\r |
182 | @sa SHELLCMD_GET_LINE_HELP\r | |
183 | **/\r | |
184 | typedef\r | |
185 | EFI_STATUS\r | |
47d20b54 | 186 | (EFIAPI *SHELLENV_ADD_CMD)(\r |
94b17fa1 | 187 | IN SHELLENV_INTERNAL_COMMAND Handler,\r |
188 | IN CHAR16 *Cmd,\r | |
189 | IN SHELLCMD_GET_LINE_HELP GetLineHelp\r | |
190 | );\r | |
191 | \r | |
192 | /**\r | |
193 | Internal interface to add protocol handlers.\r | |
194 | \r | |
195 | This function is for internal shell use only. This is how protocol handlers are added.\r | |
196 | This will get the current protocol info and add the new info or update existing info\r | |
197 | and then resave the info.\r | |
198 | \r | |
a405b86d | 199 | @param[in] Protocol The pointer to the protocol's GUID.\r |
200 | @param[in] DumpToken The function pointer to dump token function or\r | |
b3011f40 | 201 | NULL.\r |
a405b86d | 202 | @param[in] DumpInfo The function pointer to dump infomation function\r |
b3011f40 | 203 | or NULL.\r |
a405b86d | 204 | @param[in] IdString The English name of the protocol.\r |
94b17fa1 | 205 | **/\r |
206 | typedef\r | |
207 | VOID\r | |
47d20b54 | 208 | (EFIAPI *SHELLENV_ADD_PROT)(\r |
94b17fa1 | 209 | IN EFI_GUID *Protocol,\r |
210 | IN SHELLENV_DUMP_PROTOCOL_INFO DumpToken OPTIONAL,\r | |
211 | IN SHELLENV_DUMP_PROTOCOL_INFO DumpInfo OPTIONAL,\r | |
212 | IN CHAR16 *IdString\r | |
213 | );\r | |
214 | \r | |
215 | /**\r | |
1e6e84c7 | 216 | This function finds a protocol handle by a GUID.\r |
94b17fa1 | 217 | \r |
1e6e84c7 | 218 | This function will check for already known protocols by GUID and if one is\r |
219 | found it will return the name of that protocol. If no name is found and\r | |
94b17fa1 | 220 | GenId is TRUE it will generate ths string.\r |
221 | \r | |
a405b86d | 222 | @param[in] Protocol The GUID of the protocol to look for.\r |
223 | @param[in] GenId Whether to generate a name string if it is not found.\r | |
94b17fa1 | 224 | \r |
a405b86d | 225 | @return !NULL The Name of the protocol.\r |
226 | @retval NULL The Name was not found, and GenId was not TRUE.\r | |
94b17fa1 | 227 | **/\r |
1e6e84c7 | 228 | typedef\r |
47d20b54 MK |
229 | CHAR16 *\r |
230 | (EFIAPI *SHELLENV_GET_PROT)(\r | |
1e6e84c7 | 231 | IN EFI_GUID *Protocol,\r |
94b17fa1 | 232 | IN BOOLEAN GenId\r |
233 | );\r | |
234 | \r | |
235 | /**\r | |
1e6e84c7 | 236 | This function returns a string array containing the current directory on\r |
237 | a given device.\r | |
94b17fa1 | 238 | \r |
1e6e84c7 | 239 | If DeviceName is specified, then return the current shell directory on that\r |
240 | device. If DeviceName is NULL, then return the current directory on the\r | |
94b17fa1 | 241 | current device. The caller us responsible to free the returned string when\r |
a405b86d | 242 | no longer required.\r |
94b17fa1 | 243 | \r |
a405b86d | 244 | @param[in] DeviceName The name of the device to get the current\r |
245 | directory on, or NULL for current device.\r | |
94b17fa1 | 246 | \r |
1e6e84c7 | 247 | @return String array with the current directory on the current or specified device.\r |
94b17fa1 | 248 | \r |
249 | **/\r | |
1e6e84c7 | 250 | typedef\r |
47d20b54 MK |
251 | CHAR16 *\r |
252 | (EFIAPI *SHELLENV_CUR_DIR)(\r | |
94b17fa1 | 253 | IN CHAR16 *DeviceName OPTIONAL\r |
254 | );\r | |
255 | \r | |
256 | /**\r | |
1e6e84c7 | 257 | This function will open a group of files that match the Arg path, including\r |
258 | support for wildcard characters ('?' and '*') in the Arg path. If there are\r | |
94b17fa1 | 259 | any wildcard characters in the path this function will find any and all files\r |
1e6e84c7 | 260 | that match the wildcards. It returns a double linked list based on the\r |
261 | LIST_ENTRY linked list structure. Use this in conjunction with the\r | |
94b17fa1 | 262 | SHELL_FILE_ARG_SIGNATURE to get the SHELL_FILE_ARG structures that are returned.\r |
1e6e84c7 | 263 | The memory allocated by the callee for this list is freed by making a call to\r |
94b17fa1 | 264 | SHELLENV_FREE_FILE_LIST.\r |
265 | \r | |
4ff7e37b ED |
266 | @param[in] Arg The pointer Path to files to open.\r |
267 | @param[in, out] ListHead The pointer to the allocated and initialized list head\r | |
268 | upon which to append all opened file structures.\r | |
94b17fa1 | 269 | \r |
a405b86d | 270 | @retval EFI_SUCCESS One or more files was opened and a struct of each file's\r |
94b17fa1 | 271 | information was appended to ListHead.\r |
b3011f40 | 272 | @retval EFI_OUT_OF_RESOURCES A memory allocation failed.\r |
273 | @retval EFI_NOT_FOUND No matching files could be found.\r | |
94b17fa1 | 274 | @sa SHELLENV_FREE_FILE_LIST\r |
275 | **/typedef\r | |
276 | EFI_STATUS\r | |
47d20b54 | 277 | (EFIAPI *SHELLENV_FILE_META_ARG)(\r |
94b17fa1 | 278 | IN CHAR16 *Arg,\r |
d2b4564b | 279 | IN OUT LIST_ENTRY *ListHead\r |
94b17fa1 | 280 | );\r |
281 | \r | |
282 | /**\r | |
b3011f40 | 283 | This frees all of the nodes under the ListHead, but not ListHead itself.\r |
94b17fa1 | 284 | \r |
4ff7e37b | 285 | @param[in, out] ListHead Pointer to list to free all nodes of.\r |
94b17fa1 | 286 | \r |
a405b86d | 287 | @retval EFI_SUCCESS This function always returns EFI_SUCCESS.\r |
94b17fa1 | 288 | **/\r |
289 | typedef\r | |
290 | EFI_STATUS\r | |
47d20b54 | 291 | (EFIAPI *SHELLENV_FREE_FILE_LIST)(\r |
d2b4564b | 292 | IN OUT LIST_ENTRY *ListHead\r |
94b17fa1 | 293 | );\r |
294 | \r | |
295 | /**\r | |
1e6e84c7 | 296 | This function creates a new instance of the ShellInterface protocol for use on\r |
94b17fa1 | 297 | the ImageHandle.\r |
298 | \r | |
1e6e84c7 | 299 | This function is for internal shell usage. This will allocate and then populate\r |
300 | EFI_SHELL_INTERFACE protocol. It is the caller's responsibility to free the\r | |
94b17fa1 | 301 | memory.\r |
302 | \r | |
a405b86d | 303 | @param[in] ImageHandle The handle which will use the new ShellInterface\r |
94b17fa1 | 304 | protocol.\r |
305 | \r | |
a405b86d | 306 | @return The newly allocated shell interface protocol.\r |
94b17fa1 | 307 | \r |
308 | **/\r | |
1e6e84c7 | 309 | typedef\r |
47d20b54 MK |
310 | EFI_SHELL_INTERFACE *\r |
311 | (EFIAPI *SHELLENV_NEW_SHELL)(\r | |
94b17fa1 | 312 | IN EFI_HANDLE ImageHandle\r |
313 | );\r | |
314 | \r | |
315 | /**\r | |
cceb4ebd | 316 | This function determines whether a script file is currently being processed.\r |
94b17fa1 | 317 | \r |
1e6e84c7 | 318 | A script file (.nsh file) can contain a series of commands and this is useful to\r |
319 | know for some shell commands whether they are being run manually or as part of a\r | |
94b17fa1 | 320 | script.\r |
321 | \r | |
b3011f40 | 322 | @retval TRUE A script file is being processed.\r |
323 | @retval FALSE A script file is not being processed.\r | |
94b17fa1 | 324 | **/\r |
325 | typedef\r | |
326 | BOOLEAN\r | |
47d20b54 | 327 | (EFIAPI *SHELLENV_BATCH_IS_ACTIVE)(\r |
a405b86d | 328 | VOID\r |
94b17fa1 | 329 | );\r |
330 | \r | |
331 | /**\r | |
1e6e84c7 | 332 | This is an internal shell function to free any and all allocated resources.\r |
a405b86d | 333 | This should be called immediately prior to closing the shell.\r |
94b17fa1 | 334 | **/\r |
335 | typedef\r | |
336 | VOID\r | |
47d20b54 | 337 | (EFIAPI *SHELLENV_FREE_RESOURCES)(\r |
94b17fa1 | 338 | VOID\r |
339 | );\r | |
340 | \r | |
341 | /**\r | |
342 | This function enables the page break mode.\r | |
343 | \r | |
1e6e84c7 | 344 | This mode causes the output to pause after each complete screen to enable a\r |
a405b86d | 345 | user to more easily read it. If AutoWrap is TRUE, then rows with too many\r |
346 | characters will be chopped and divided into 2 rows. If FALSE, then rows with\r | |
94b17fa1 | 347 | too many characters may not be fully visible to the user on the screen.\r |
348 | \r | |
a405b86d | 349 | @param[in] StartRow The row number to start this on.\r |
350 | @param[in] AutoWrap Whether to auto wrap rows that are too long.\r | |
94b17fa1 | 351 | **/\r |
352 | typedef\r | |
353 | VOID\r | |
47d20b54 | 354 | (EFIAPI *SHELLENV_ENABLE_PAGE_BREAK)(\r |
94b17fa1 | 355 | IN INT32 StartRow,\r |
356 | IN BOOLEAN AutoWrap\r | |
357 | );\r | |
358 | \r | |
359 | /**\r | |
360 | This function disables the page break mode.\r | |
361 | \r | |
a405b86d | 362 | Disabling this causes the output to print out exactly as coded, with no breaks\r |
94b17fa1 | 363 | for readability.\r |
364 | **/\r | |
365 | typedef\r | |
366 | VOID\r | |
47d20b54 | 367 | (EFIAPI *SHELLENV_DISABLE_PAGE_BREAK)(\r |
a405b86d | 368 | VOID\r |
94b17fa1 | 369 | );\r |
370 | \r | |
371 | /**\r | |
372 | Get the status of the page break output mode.\r | |
373 | \r | |
b3011f40 | 374 | @retval FALSE Page break output mode is not enabled.\r |
375 | @retval TRUE Page break output mode is enabled.\r | |
94b17fa1 | 376 | **/\r |
377 | typedef\r | |
378 | BOOLEAN\r | |
47d20b54 | 379 | (EFIAPI *SHELLENV_GET_PAGE_BREAK)(\r |
a405b86d | 380 | VOID\r |
94b17fa1 | 381 | );\r |
382 | \r | |
383 | /**\r | |
1e6e84c7 | 384 | This function sets the keys to filter for for the console in. The valid\r |
94b17fa1 | 385 | values to set are:\r |
386 | \r | |
387 | #define EFI_OUTPUT_SCROLL 0x00000001\r | |
388 | #define EFI_OUTPUT_PAUSE 0x00000002\r | |
389 | #define EFI_EXECUTION_BREAK 0x00000004\r | |
390 | \r | |
a405b86d | 391 | @param[in] KeyFilter The new key filter to use.\r |
94b17fa1 | 392 | **/\r |
393 | typedef\r | |
394 | VOID\r | |
47d20b54 | 395 | (EFIAPI *SHELLENV_SET_KEY_FILTER)(\r |
94b17fa1 | 396 | IN UINT32 KeyFilter\r |
397 | );\r | |
398 | \r | |
399 | /**\r | |
1e6e84c7 | 400 | This function gets the keys to filter for for the console in.\r |
94b17fa1 | 401 | \r |
b3011f40 | 402 | The valid values to get are:\r |
94b17fa1 | 403 | #define EFI_OUTPUT_SCROLL 0x00000001\r |
404 | #define EFI_OUTPUT_PAUSE 0x00000002\r | |
405 | #define EFI_EXECUTION_BREAK 0x00000004\r | |
406 | \r | |
a405b86d | 407 | @retval The current filter mask.\r |
94b17fa1 | 408 | **/\r |
409 | typedef\r | |
410 | UINT32\r | |
47d20b54 | 411 | (EFIAPI *SHELLENV_GET_KEY_FILTER)(\r |
a405b86d | 412 | VOID\r |
94b17fa1 | 413 | );\r |
414 | \r | |
415 | /**\r | |
cceb4ebd | 416 | This function determines if the shell application should break.\r |
94b17fa1 | 417 | \r |
1e6e84c7 | 418 | This is used to inform a shell application that a break condition has been\r |
b3011f40 | 419 | initiated. Long loops should check this to prevent delays to the break.\r |
94b17fa1 | 420 | \r |
a405b86d | 421 | @retval TRUE A break has been signaled. The application\r |
94b17fa1 | 422 | should exit with EFI_ABORTED as soon as possible.\r |
b3011f40 | 423 | @retval FALSE Continue as normal.\r |
94b17fa1 | 424 | **/\r |
425 | typedef\r | |
426 | BOOLEAN\r | |
47d20b54 | 427 | (EFIAPI *SHELLENV_GET_EXECUTION_BREAK)(\r |
a405b86d | 428 | VOID\r |
94b17fa1 | 429 | );\r |
430 | \r | |
431 | /**\r | |
a405b86d | 432 | This is an internal shell function used to increment the shell nesting level.\r |
94b17fa1 | 433 | \r |
434 | **/\r | |
435 | typedef\r | |
436 | VOID\r | |
47d20b54 | 437 | (EFIAPI *SHELLENV_INCREMENT_SHELL_NESTING_LEVEL)(\r |
a405b86d | 438 | VOID\r |
94b17fa1 | 439 | );\r |
440 | \r | |
441 | /**\r | |
a405b86d | 442 | This is an internal shell function used to decrement the shell nesting level.\r |
94b17fa1 | 443 | **/\r |
444 | typedef\r | |
445 | VOID\r | |
47d20b54 | 446 | (EFIAPI *SHELLENV_DECREMENT_SHELL_NESTING_LEVEL)(\r |
a405b86d | 447 | VOID\r |
94b17fa1 | 448 | );\r |
449 | \r | |
450 | /**\r | |
cceb4ebd | 451 | This function determines if the caller is running under the root shell.\r |
94b17fa1 | 452 | \r |
b3011f40 | 453 | @retval TRUE The caller is running under the root shell.\r |
454 | @retval FALSE The caller is not running under the root shell.\r | |
94b17fa1 | 455 | \r |
456 | **/\r | |
457 | typedef\r | |
458 | BOOLEAN\r | |
47d20b54 | 459 | (EFIAPI *SHELLENV_IS_ROOT_SHELL)(\r |
a405b86d | 460 | VOID\r |
94b17fa1 | 461 | );\r |
462 | \r | |
463 | /**\r | |
464 | Close the console proxy to restore the original console.\r | |
465 | \r | |
1e6e84c7 | 466 | This is an internal shell function to handle shell cascading. It restores the\r |
94b17fa1 | 467 | original set of console protocols.\r |
1e6e84c7 | 468 | \r |
4ff7e37b ED |
469 | @param[in] ConInHandle The handle of ConIn.\r |
470 | @param[in, out] ConIn The pointer to the location to return the pointer to\r | |
471 | the original console input.\r | |
472 | @param[in] ConOutHandle The handle of ConOut\r | |
473 | @param[in, out] ConOut The pointer to the location to return the pointer to\r | |
474 | the original console output.\r | |
94b17fa1 | 475 | **/\r |
476 | typedef\r | |
477 | VOID\r | |
47d20b54 | 478 | (EFIAPI *SHELLENV_CLOSE_CONSOLE_PROXY)(\r |
94b17fa1 | 479 | IN EFI_HANDLE ConInHandle,\r |
480 | IN OUT EFI_SIMPLE_TEXT_INPUT_PROTOCOL **ConIn,\r | |
481 | IN EFI_HANDLE ConOutHandle,\r | |
482 | IN OUT EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL **ConOut\r | |
483 | );\r | |
484 | \r | |
485 | //\r | |
486 | // declarations of handle enumerator\r | |
487 | //\r | |
47d20b54 | 488 | \r |
94b17fa1 | 489 | /**\r |
490 | For ease of use the shell maps handle #'s to short numbers.\r | |
1e6e84c7 | 491 | This is only done on request for various internal commands and the references\r |
94b17fa1 | 492 | are immediately freed when the internal command completes.\r |
493 | **/\r | |
494 | typedef\r | |
495 | VOID\r | |
47d20b54 | 496 | (EFIAPI *INIT_HANDLE_ENUMERATOR)(\r |
94b17fa1 | 497 | VOID\r |
498 | );\r | |
499 | \r | |
500 | /**\r | |
b3011f40 | 501 | This is an internal shell function to enumerate the handle database.\r |
94b17fa1 | 502 | \r |
1e6e84c7 | 503 | This function gets the next handle in the handle database. If no handles are\r |
a405b86d | 504 | found, EFI_NOT_FOUND is returned. If the previous Handle was the last handle,\r |
94b17fa1 | 505 | it is set to NULL before returning.\r |
506 | \r | |
b3011f40 | 507 | This must be called after INIT_HANDLE_ENUMERATOR and before CLOSE_HANDLE_ENUMERATOR.\r |
94b17fa1 | 508 | \r |
4ff7e37b ED |
509 | @param[in, out] Handle The pointer to pointer to Handle. It is set\r |
510 | on a sucessful return.\r | |
94b17fa1 | 511 | \r |
b3011f40 | 512 | @retval EFI_SUCCESS The next handle in the handle database is *Handle.\r |
513 | @retval EFI_NOT_FOUND There is not another handle.\r | |
94b17fa1 | 514 | **/\r |
515 | typedef\r | |
516 | EFI_STATUS\r | |
47d20b54 | 517 | (EFIAPI *NEXT_HANDLE)(\r |
94b17fa1 | 518 | IN OUT EFI_HANDLE **Handle\r |
519 | );\r | |
520 | \r | |
521 | /**\r | |
b3011f40 | 522 | This is an internal shell function to enumerate the handle database.\r |
94b17fa1 | 523 | \r |
1e6e84c7 | 524 | This function skips the next SkipNum handles in the handle database. If there\r |
525 | are not enough handles left to skip that many EFI_ACCESS_DENIED is returned and\r | |
94b17fa1 | 526 | no skip is performed.\r |
527 | \r | |
b3011f40 | 528 | This must be called after INIT_HANDLE_ENUMERATOR and before CLOSE_HANDLE_ENUMERATOR.\r |
94b17fa1 | 529 | \r |
a405b86d | 530 | @param[in] SkipNum How many handles to skip\r |
94b17fa1 | 531 | \r |
a405b86d | 532 | @retval EFI_SUCCESS The next handle in the handle database is *Handle\r |
533 | @retval EFI_ACCESS_DENIED There are not SkipNum handles left in the database\r | |
94b17fa1 | 534 | **/\r |
535 | typedef\r | |
536 | EFI_STATUS\r | |
47d20b54 | 537 | (EFIAPI *SKIP_HANDLE)(\r |
94b17fa1 | 538 | IN UINTN SkipNum\r |
539 | );\r | |
540 | \r | |
541 | /**\r | |
b3011f40 | 542 | This is an internal shell function to enumerate the handle database.\r |
94b17fa1 | 543 | \r |
1e6e84c7 | 544 | This function resets the the handle database so that NEXT_HANDLE and SKIP_HANDLE\r |
545 | will start from EnumIndex on the next call.\r | |
546 | \r | |
b3011f40 | 547 | This must be called after INIT_HANDLE_ENUMERATOR and before CLOSE_HANDLE_ENUMERATOR.\r |
94b17fa1 | 548 | \r |
a405b86d | 549 | @param[in] EnumIndex Where to start.\r |
94b17fa1 | 550 | \r |
a405b86d | 551 | @return The number of handles either read out or skipped before this reset.\r |
94b17fa1 | 552 | **/\r |
553 | typedef\r | |
554 | UINTN\r | |
47d20b54 | 555 | (EFIAPI *RESET_HANDLE_ENUMERATOR)(\r |
94b17fa1 | 556 | IN UINTN EnumIndex\r |
557 | );\r | |
558 | \r | |
559 | /**\r | |
b3011f40 | 560 | This is an internal shell function to enumerate the handle database.\r |
1e6e84c7 | 561 | \r |
b3011f40 | 562 | This must be called after INIT_HANDLE_ENUMERATOR.\r |
94b17fa1 | 563 | \r |
b3011f40 | 564 | This function releases all memory and resources associated with the handle database.\r |
a405b86d | 565 | After this no other handle enumerator functions except INIT_HANDLE_ENUMERATOR will\r |
94b17fa1 | 566 | function properly.\r |
567 | **/\r | |
568 | typedef\r | |
569 | VOID\r | |
47d20b54 | 570 | (EFIAPI *CLOSE_HANDLE_ENUMERATOR)(\r |
94b17fa1 | 571 | VOID\r |
572 | );\r | |
573 | \r | |
574 | /**\r | |
b3011f40 | 575 | This is an internal shell function to enumerate the handle database.\r |
94b17fa1 | 576 | \r |
b3011f40 | 577 | This function returns the number of handles in the handle database.\r |
1e6e84c7 | 578 | \r |
b3011f40 | 579 | This must be called after INIT_HANDLE_ENUMERATOR and before CLOSE_HANDLE_ENUMERATOR.\r |
94b17fa1 | 580 | \r |
a405b86d | 581 | @return The number of handles in the handle database.\r |
94b17fa1 | 582 | **/\r |
583 | typedef\r | |
584 | UINTN\r | |
47d20b54 | 585 | (EFIAPI *GET_NUM)(\r |
94b17fa1 | 586 | VOID\r |
587 | );\r | |
588 | \r | |
589 | /**\r | |
b3011f40 | 590 | Handle Enumerator structure.\r |
94b17fa1 | 591 | **/\r |
592 | typedef struct {\r | |
47d20b54 MK |
593 | INIT_HANDLE_ENUMERATOR Init; ///< The pointer to INIT_HANDLE_ENUMERATOR function.\r |
594 | NEXT_HANDLE Next; ///< The pointer to NEXT_HANDLE function.\r | |
595 | SKIP_HANDLE Skip; ///< The pointer to SKIP_HANDLE function.\r | |
596 | RESET_HANDLE_ENUMERATOR Reset; ///< The pointer to RESET_HANDLE_ENUMERATOR function.\r | |
597 | CLOSE_HANDLE_ENUMERATOR Close; ///< The pointer to CLOSE_HANDLE_ENUMERATOR function.\r | |
598 | GET_NUM GetNum; ///< The pointer to GET_NUM function.\r | |
94b17fa1 | 599 | } HANDLE_ENUMERATOR;\r |
b3011f40 | 600 | \r |
94b17fa1 | 601 | /**\r |
b3011f40 | 602 | Signature for the PROTOCOL_INFO structure.\r |
94b17fa1 | 603 | **/\r |
47d20b54 | 604 | #define PROTOCOL_INFO_SIGNATURE SIGNATURE_32 ('s', 'p', 'i', 'n')\r |
b3011f40 | 605 | \r |
94b17fa1 | 606 | /**\r |
607 | PROTOCOL_INFO structure for protocol enumerator functions.\r | |
94b17fa1 | 608 | **/\r |
609 | typedef struct {\r | |
47d20b54 MK |
610 | UINTN Signature; ///< PROTOCOL_INFO_SIGNATURE.\r |
611 | LIST_ENTRY Link; ///< Standard linked list helper member.\r | |
94b17fa1 | 612 | //\r |
b3011f40 | 613 | // The parsing info for the protocol.\r |
94b17fa1 | 614 | //\r |
47d20b54 MK |
615 | EFI_GUID ProtocolId; ///< The GUID for the protocol.\r |
616 | CHAR16 *IdString; ///< The name of the protocol.\r | |
617 | SHELLENV_DUMP_PROTOCOL_INFO DumpToken; ///< The pointer to DumpToken function for the protocol.\r | |
618 | SHELLENV_DUMP_PROTOCOL_INFO DumpInfo; ///< The pointer to DumpInfo function for the protocol.\r | |
94b17fa1 | 619 | //\r |
b3011f40 | 620 | // Patabase info on which handles are supporting this protocol.\r |
94b17fa1 | 621 | //\r |
47d20b54 MK |
622 | UINTN NoHandles; ///< The number of handles producing this protocol.\r |
623 | EFI_HANDLE *Handles; ///< The array of handles.\r | |
94b17fa1 | 624 | } PROTOCOL_INFO;\r |
625 | \r | |
626 | //\r | |
b3011f40 | 627 | // Declarations of protocol info enumerator.\r |
94b17fa1 | 628 | //\r |
47d20b54 | 629 | \r |
94b17fa1 | 630 | /**\r |
b3011f40 | 631 | This is an internal shell function to initialize the protocol enumerator.\r |
94b17fa1 | 632 | \r |
1e6e84c7 | 633 | This must be called before NEXT_PROTOCOL_INFO, SKIP_PROTOCOL_INFO,\r |
94b17fa1 | 634 | RESET_PROTOCOL_INFO_ENUMERATOR, and CLOSE_PROTOCOL_INFO_ENUMERATOR are\r |
635 | called.\r | |
636 | **/\r | |
637 | typedef\r | |
638 | VOID\r | |
47d20b54 | 639 | (EFIAPI *INIT_PROTOCOL_INFO_ENUMERATOR)(\r |
94b17fa1 | 640 | VOID\r |
641 | );\r | |
642 | \r | |
643 | /**\r | |
1e6e84c7 | 644 | This function is an internal shell function for enumeration of protocols.\r |
94b17fa1 | 645 | \r |
a405b86d | 646 | This function returns the next protocol on the list. If this is called\r |
647 | immediately after initialization, it will return the first protocol on the list.\r | |
648 | If this is called immediately after reset, it will return the first protocol again.\r | |
94b17fa1 | 649 | \r |
1e6e84c7 | 650 | This cannot be called after CLOSE_PROTOCOL_INFO_ENUMERATOR, but it must be\r |
94b17fa1 | 651 | called after INIT_PROTOCOL_INFO_ENUMERATOR.\r |
652 | \r | |
4ff7e37b | 653 | @param[in, out] ProtocolInfo The pointer to pointer to protocol information structure.\r |
94b17fa1 | 654 | \r |
b3011f40 | 655 | @retval EFI_SUCCESS The next protocol's information was sucessfully returned.\r |
656 | @retval NULL There are no more protocols.\r | |
94b17fa1 | 657 | **/\r |
658 | typedef\r | |
659 | EFI_STATUS\r | |
47d20b54 | 660 | (EFIAPI *NEXT_PROTOCOL_INFO)(\r |
94b17fa1 | 661 | IN OUT PROTOCOL_INFO **ProtocolInfo\r |
662 | );\r | |
663 | \r | |
664 | /**\r | |
1e6e84c7 | 665 | This function is an internal shell function for enumeration of protocols.\r |
94b17fa1 | 666 | \r |
1e6e84c7 | 667 | This cannot be called after CLOSE_PROTOCOL_INFO_ENUMERATOR, but it must be\r |
94b17fa1 | 668 | called after INIT_PROTOCOL_INFO_ENUMERATOR.\r |
669 | \r | |
b3011f40 | 670 | This function does nothing and always returns EFI_SUCCESS.\r |
94b17fa1 | 671 | \r |
a405b86d | 672 | @retval EFI_SUCCESS Always returned (see above).\r |
94b17fa1 | 673 | **/\r |
674 | typedef\r | |
675 | EFI_STATUS\r | |
47d20b54 | 676 | (EFIAPI *SKIP_PROTOCOL_INFO)(\r |
94b17fa1 | 677 | IN UINTN SkipNum\r |
678 | );\r | |
679 | \r | |
680 | /**\r | |
1e6e84c7 | 681 | This function is an internal shell function for enumeration of protocols.\r |
94b17fa1 | 682 | \r |
1e6e84c7 | 683 | This cannot be called after CLOSE_PROTOCOL_INFO_ENUMERATOR, but it must be\r |
94b17fa1 | 684 | called after INIT_PROTOCOL_INFO_ENUMERATOR.\r |
685 | \r | |
1e6e84c7 | 686 | This function resets the list of protocols such that the next one in the\r |
94b17fa1 | 687 | list is the begining of the list.\r |
688 | **/\r | |
689 | typedef\r | |
690 | VOID\r | |
47d20b54 | 691 | (EFIAPI *RESET_PROTOCOL_INFO_ENUMERATOR)(\r |
94b17fa1 | 692 | VOID\r |
693 | );\r | |
694 | \r | |
94b17fa1 | 695 | /**\r |
1e6e84c7 | 696 | This function is an internal shell function for enumeration of protocols.\r |
94b17fa1 | 697 | \r |
698 | This must be called after INIT_PROTOCOL_INFO_ENUMERATOR. After this call\r | |
699 | no protocol enumerator calls except INIT_PROTOCOL_INFO_ENUMERATOR may be made.\r | |
700 | \r | |
b3011f40 | 701 | This function frees any memory or resources associated with the protocol\r |
94b17fa1 | 702 | enumerator.\r |
703 | **/\r | |
704 | typedef\r | |
705 | VOID\r | |
47d20b54 | 706 | (EFIAPI *CLOSE_PROTOCOL_INFO_ENUMERATOR)(\r |
94b17fa1 | 707 | VOID\r |
708 | );\r | |
709 | \r | |
710 | /**\r | |
b3011f40 | 711 | Protocol enumerator structure of function pointers.\r |
94b17fa1 | 712 | **/\r |
713 | typedef struct {\r | |
47d20b54 MK |
714 | INIT_PROTOCOL_INFO_ENUMERATOR Init; ///< The pointer to INIT_PROTOCOL_INFO_ENUMERATOR function.\r |
715 | NEXT_PROTOCOL_INFO Next; ///< The pointer to NEXT_PROTOCOL_INFO function.\r | |
716 | SKIP_PROTOCOL_INFO Skip; ///< The pointer to SKIP_PROTOCOL_INFO function.\r | |
717 | RESET_PROTOCOL_INFO_ENUMERATOR Reset; ///< The pointer to RESET_PROTOCOL_INFO_ENUMERATOR function.\r | |
718 | CLOSE_PROTOCOL_INFO_ENUMERATOR Close; ///< The pointer to CLOSE_PROTOCOL_INFO_ENUMERATOR function.\r | |
94b17fa1 | 719 | } PROTOCOL_INFO_ENUMERATOR;\r |
720 | \r | |
721 | /**\r | |
1e6e84c7 | 722 | This function is used to retrieve a user-friendly display name for a handle.\r |
94b17fa1 | 723 | \r |
1e6e84c7 | 724 | If UseComponentName is TRUE then the component name protocol for this device\r |
725 | or it's parent device (if required) will be used to obtain the name of the\r | |
94b17fa1 | 726 | device. If UseDevicePath is TRUE it will get the human readable device path\r |
727 | and return that. If both are TRUE it will try to use component name first\r | |
1e6e84c7 | 728 | and device path if that fails.\r |
94b17fa1 | 729 | \r |
1e6e84c7 | 730 | It will use either ComponentName or ComponentName2 protocol, depending on\r |
94b17fa1 | 731 | what is present.\r |
732 | \r | |
733 | This function will furthur verify whether the handle in question produced either\r | |
1e6e84c7 | 734 | EFI_DRIVER_CONFIGRATION_PROTOCOL or EFI_DRIVER_CONFIGURATION2_PROTOCOL and also\r |
735 | whether the handle in question produced either EFI_DRIVER_DIAGNOSTICS_PROTOCOL or\r | |
94b17fa1 | 736 | EFI_DRIVER_DIAGNOSTICS2_PROTOCOL.\r |
1e6e84c7 | 737 | \r |
a405b86d | 738 | Upon successful return, the memory for *BestDeviceName is up to the caller to free.\r |
94b17fa1 | 739 | \r |
4ff7e37b ED |
740 | @param[in] DeviceHandle The device handle whose name is desired.\r |
741 | @param[in] UseComponentName Whether to use the ComponentName protocol at all.\r | |
742 | @param[in] UseDevicePath Whether to use the DevicePath protocol at all.\r | |
743 | @param[in] Language The pointer to the language string to use.\r | |
744 | @param[in, out] BestDeviceName The pointer to pointer to string allocated with the name.\r | |
745 | @param[out] ConfigurationStatus The pointer to status for opening a Configuration protocol.\r | |
746 | @param[out] DiagnosticsStatus The pointer to status for opening a Diagnostics protocol.\r | |
747 | @param[in] Display Whether to Print this out to default Print location.\r | |
748 | @param[in] Indent How many characters to indent the printing.\r | |
94b17fa1 | 749 | \r |
b3011f40 | 750 | @retval EFI_SUCCESS This function always returns EFI_SUCCESS.\r |
94b17fa1 | 751 | **/\r |
752 | typedef\r | |
753 | EFI_STATUS\r | |
47d20b54 | 754 | (EFIAPI *GET_DEVICE_NAME)(\r |
a405b86d | 755 | IN EFI_HANDLE DeviceHandle,\r |
756 | IN BOOLEAN UseComponentName,\r | |
757 | IN BOOLEAN UseDevicePath,\r | |
758 | IN CHAR8 *Language,\r | |
759 | IN OUT CHAR16 **BestDeviceName,\r | |
760 | OUT EFI_STATUS *ConfigurationStatus,\r | |
761 | OUT EFI_STATUS *DiagnosticsStatus,\r | |
762 | IN BOOLEAN Display,\r | |
763 | IN UINTN Indent\r | |
94b17fa1 | 764 | );\r |
765 | \r | |
47d20b54 MK |
766 | #define EFI_SHELL_COMPATIBLE_MODE_VER L"1.1.1" ///< The string for lowest version this shell supports.\r |
767 | #define EFI_SHELL_ENHANCED_MODE_VER L"1.1.2" ///< The string for highest version this shell supports.\r | |
94b17fa1 | 768 | \r |
769 | /**\r | |
1e6e84c7 | 770 | This function gets the shell mode as stored in the shell environment\r |
b3011f40 | 771 | "efishellmode". It will not fail.\r |
94b17fa1 | 772 | \r |
a405b86d | 773 | @param[out] Mode Returns a string representing one of the\r |
94b17fa1 | 774 | 2 supported modes of the shell.\r |
775 | \r | |
b3011f40 | 776 | @retval EFI_SUCCESS This function always returns success.\r |
94b17fa1 | 777 | **/\r |
778 | typedef\r | |
779 | EFI_STATUS\r | |
47d20b54 | 780 | (EFIAPI *GET_SHELL_MODE)(\r |
94b17fa1 | 781 | OUT CHAR16 **Mode\r |
782 | );\r | |
783 | \r | |
784 | /**\r | |
b3011f40 | 785 | Convert a file system style name to a device path.\r |
94b17fa1 | 786 | \r |
787 | This function will convert a shell path name to a Device Path Protocol path.\r | |
1e6e84c7 | 788 | This function will allocate any required memory for this operation and it\r |
94b17fa1 | 789 | is the responsibility of the caller to free that memory when no longer required.\r |
790 | \r | |
1e6e84c7 | 791 | If anything prevents the complete conversion free any allocated memory and\r |
94b17fa1 | 792 | return NULL.\r |
793 | \r | |
a405b86d | 794 | @param[in] Path The path to convert.\r |
795 | \r | |
b3011f40 | 796 | @retval !NULL A pointer to the callee allocated Device Path.\r |
797 | @retval NULL The operation could not be completed.\r | |
94b17fa1 | 798 | **/\r |
1e6e84c7 | 799 | typedef\r |
47d20b54 MK |
800 | EFI_DEVICE_PATH_PROTOCOL *\r |
801 | (EFIAPI *SHELLENV_NAME_TO_PATH)(\r | |
94b17fa1 | 802 | IN CHAR16 *Path\r |
803 | );\r | |
804 | \r | |
805 | /**\r | |
b3011f40 | 806 | Converts a device path into a file system map name.\r |
807 | \r | |
808 | If DevPath is NULL, then ASSERT.\r | |
94b17fa1 | 809 | \r |
94b17fa1 | 810 | This function looks through the shell environment map for a map whose device\r |
1e6e84c7 | 811 | path matches the DevPath parameter. If one is found the Name is returned via\r |
94b17fa1 | 812 | Name parameter. If sucessful the caller must free the memory allocated for\r |
813 | Name.\r | |
814 | \r | |
1e6e84c7 | 815 | This function will use the internal lock to prevent changes to the map during\r |
94b17fa1 | 816 | the lookup operation.\r |
1e6e84c7 | 817 | \r |
a405b86d | 818 | @param[in] DevPath The device path to search for a name for.\r |
819 | @param[in] ConsistMapping What state to verify map flag VAR_ID_CONSIST.\r | |
820 | @param[out] Name On sucessful return the name of that device path.\r | |
94b17fa1 | 821 | \r |
b3011f40 | 822 | @retval EFI_SUCCESS The DevPath was found and the name returned\r |
1e6e84c7 | 823 | in Name.\r |
94b17fa1 | 824 | @retval EFI_OUT_OF_RESOURCES A required memory allocation failed.\r |
b3011f40 | 825 | @retval EFI_UNSUPPORTED The DevPath was not found in the map.\r |
94b17fa1 | 826 | **/\r |
827 | typedef\r | |
828 | EFI_STATUS\r | |
47d20b54 MK |
829 | (EFIAPI *SHELLENV_GET_FS_NAME)(\r |
830 | IN EFI_DEVICE_PATH_PROTOCOL *DevPath,\r | |
94b17fa1 | 831 | IN BOOLEAN ConsistMapping,\r |
832 | OUT CHAR16 **Name\r | |
833 | );\r | |
834 | \r | |
835 | /**\r | |
1e6e84c7 | 836 | This function will open a group of files that match the Arg path, but will not\r |
837 | support the wildcard characters ('?' and '*') in the Arg path. If there are\r | |
838 | any wildcard characters in the path this function will return\r | |
839 | EFI_INVALID_PARAMETER. The return is a double linked list based on the\r | |
840 | LIST_ENTRY linked list structure. Use this in conjunction with the\r | |
94b17fa1 | 841 | SHELL_FILE_ARG_SIGNATURE to get the SHELL_FILE_ARG structures that are returned.\r |
1e6e84c7 | 842 | The memory allocated by the callee for this list is freed by making a call to\r |
94b17fa1 | 843 | SHELLENV_FREE_FILE_LIST.\r |
844 | \r | |
4ff7e37b ED |
845 | @param[in] Arg The pointer to the path of the files to be opened.\r |
846 | @param[in, out] ListHead The pointer to allocated and initialized list head\r | |
847 | upon which to append all the opened file structures.\r | |
94b17fa1 | 848 | \r |
a405b86d | 849 | @retval EFI_SUCCESS One or more files was opened and a struct of each file's\r |
94b17fa1 | 850 | information was appended to ListHead.\r |
b3011f40 | 851 | @retval EFI_OUT_OF_RESOURCES A memory allocation failed.\r |
852 | @retval EFI_NOT_FOUND No matching files could be found.\r | |
94b17fa1 | 853 | @sa SHELLENV_FREE_FILE_LIST\r |
854 | **/\r | |
855 | typedef\r | |
856 | EFI_STATUS\r | |
47d20b54 | 857 | (EFIAPI *SHELLENV_FILE_META_ARG_NO_WILDCARD)(\r |
94b17fa1 | 858 | IN CHAR16 *Arg,\r |
d2b4564b | 859 | IN OUT LIST_ENTRY *ListHead\r |
94b17fa1 | 860 | );\r |
861 | \r | |
862 | /**\r | |
b3011f40 | 863 | This function removes duplicate file listings from lists.\r |
94b17fa1 | 864 | \r |
1e6e84c7 | 865 | This is a function for use with SHELLENV_FILE_META_ARG_NO_WILDCARD and\r |
b3011f40 | 866 | SHELLENV_FILE_META_ARG. This function will verify that there are no duplicate\r |
867 | files in the list of returned files. Any file listed twice will have one of its\r | |
94b17fa1 | 868 | instances removed.\r |
869 | \r | |
a405b86d | 870 | @param[in] ListHead The pointer to linked list head that was returned from\r |
94b17fa1 | 871 | SHELLENV_FILE_META_ARG_NO_WILDCARD or\r |
872 | SHELLENV_FILE_META_ARG.\r | |
873 | \r | |
b3011f40 | 874 | @retval EFI_SUCCESS This function always returns success.\r |
94b17fa1 | 875 | \r |
876 | **/\r | |
877 | typedef\r | |
878 | EFI_STATUS\r | |
47d20b54 MK |
879 | (EFIAPI *SHELLENV_DEL_DUP_FILE)(\r |
880 | IN LIST_ENTRY *ListHead\r | |
94b17fa1 | 881 | );\r |
882 | \r | |
883 | /**\r | |
884 | Converts a File System map name to a device path.\r | |
885 | \r | |
a405b86d | 886 | If DevPath is NULL, then ASSERT().\r |
94b17fa1 | 887 | \r |
1e6e84c7 | 888 | This function looks through the shell environment map for a map whose Name\r |
a405b86d | 889 | matches the Name parameter. If one is found, the device path pointer is\r |
1e6e84c7 | 890 | updated to point to that file systems device path. The caller should not\r |
94b17fa1 | 891 | free the memory from that device path.\r |
892 | \r | |
1e6e84c7 | 893 | This function will use the internal lock to prevent changes to the map during\r |
94b17fa1 | 894 | the lookup operation.\r |
895 | \r | |
a405b86d | 896 | @param[in] Name The pointer to the NULL terminated UNICODE string of the\r |
b3011f40 | 897 | file system name.\r |
a405b86d | 898 | @param[out] DevPath The pointer to pointer to DevicePath. Only valid on\r |
899 | successful return.\r | |
94b17fa1 | 900 | \r |
a405b86d | 901 | @retval EFI_SUCCESS The conversion was successful, and the device\r |
94b17fa1 | 902 | path was returned.\r |
b3011f40 | 903 | @retval EFI_NOT_FOUND The file system could not be found in the map.\r |
94b17fa1 | 904 | **/\r |
905 | typedef\r | |
906 | EFI_STATUS\r | |
47d20b54 | 907 | (EFIAPI *SHELLENV_GET_FS_DEVICE_PATH)(\r |
94b17fa1 | 908 | IN CHAR16 *Name,\r |
909 | OUT EFI_DEVICE_PATH_PROTOCOL **DevPath\r | |
910 | );\r | |
911 | \r | |
b3011f40 | 912 | /// EFI_SHELL_ENVIRONMENT2 protocol structure.\r |
94b17fa1 | 913 | typedef struct {\r |
47d20b54 MK |
914 | SHELLENV_EXECUTE Execute;\r |
915 | SHELLENV_GET_ENV GetEnv;\r | |
916 | SHELLENV_GET_MAP GetMap;\r | |
917 | SHELLENV_ADD_CMD AddCmd;\r | |
918 | SHELLENV_ADD_PROT AddProt;\r | |
919 | SHELLENV_GET_PROT GetProt;\r | |
920 | SHELLENV_CUR_DIR CurDir;\r | |
921 | SHELLENV_FILE_META_ARG FileMetaArg;\r | |
922 | SHELLENV_FREE_FILE_LIST FreeFileList;\r | |
94b17fa1 | 923 | \r |
924 | //\r | |
b3011f40 | 925 | // The following services are only used by the shell itself.\r |
94b17fa1 | 926 | //\r |
47d20b54 MK |
927 | SHELLENV_NEW_SHELL NewShell;\r |
928 | SHELLENV_BATCH_IS_ACTIVE BatchIsActive;\r | |
94b17fa1 | 929 | \r |
47d20b54 | 930 | SHELLENV_FREE_RESOURCES FreeResources;\r |
94b17fa1 | 931 | \r |
932 | //\r | |
b3011f40 | 933 | // GUID to differentiate ShellEnvironment2 from ShellEnvironment.\r |
94b17fa1 | 934 | //\r |
47d20b54 | 935 | EFI_GUID SESGuid;\r |
94b17fa1 | 936 | //\r |
b3011f40 | 937 | // Major Version grows if shell environment interface has been changes.\r |
94b17fa1 | 938 | //\r |
47d20b54 MK |
939 | UINT32 MajorVersion;\r |
940 | UINT32 MinorVersion;\r | |
941 | SHELLENV_ENABLE_PAGE_BREAK EnablePageBreak;\r | |
942 | SHELLENV_DISABLE_PAGE_BREAK DisablePageBreak;\r | |
943 | SHELLENV_GET_PAGE_BREAK GetPageBreak;\r | |
944 | \r | |
945 | SHELLENV_SET_KEY_FILTER SetKeyFilter;\r | |
946 | SHELLENV_GET_KEY_FILTER GetKeyFilter;\r | |
947 | \r | |
948 | SHELLENV_GET_EXECUTION_BREAK GetExecutionBreak;\r | |
949 | SHELLENV_INCREMENT_SHELL_NESTING_LEVEL IncrementShellNestingLevel;\r | |
950 | SHELLENV_DECREMENT_SHELL_NESTING_LEVEL DecrementShellNestingLevel;\r | |
951 | SHELLENV_IS_ROOT_SHELL IsRootShell;\r | |
952 | \r | |
953 | SHELLENV_CLOSE_CONSOLE_PROXY CloseConsoleProxy;\r | |
954 | HANDLE_ENUMERATOR HandleEnumerator;\r | |
955 | PROTOCOL_INFO_ENUMERATOR ProtocolInfoEnumerator;\r | |
956 | GET_DEVICE_NAME GetDeviceName;\r | |
957 | GET_SHELL_MODE GetShellMode;\r | |
958 | SHELLENV_NAME_TO_PATH NameToPath;\r | |
959 | SHELLENV_GET_FS_NAME GetFsName;\r | |
960 | SHELLENV_FILE_META_ARG_NO_WILDCARD FileMetaArgNoWildCard;\r | |
961 | SHELLENV_DEL_DUP_FILE DelDupFileArg;\r | |
962 | SHELLENV_GET_FS_DEVICE_PATH GetFsDevicePath;\r | |
94b17fa1 | 963 | } EFI_SHELL_ENVIRONMENT2;\r |
964 | \r | |
47d20b54 MK |
965 | extern EFI_GUID gEfiShellEnvironment2Guid;\r |
966 | extern EFI_GUID gEfiShellEnvironment2ExtGuid;\r | |
b3011f40 | 967 | \r |
968 | #endif // _SHELL_ENVIRONMENT_2_PROTOCOL_H_\r |