1 | /** @file
|
---|
2 | EFI Shell protocol as defined in the UEFI Shell 2.0 specification including errata.
|
---|
3 |
|
---|
4 | (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
|
---|
5 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
---|
6 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
7 |
|
---|
8 | **/
|
---|
9 |
|
---|
10 | #ifndef __EFI_SHELL_PROTOCOL_H__
|
---|
11 | #define __EFI_SHELL_PROTOCOL_H__
|
---|
12 |
|
---|
13 | #include <Guid/FileInfo.h>
|
---|
14 |
|
---|
15 | #define EFI_SHELL_PROTOCOL_GUID \
|
---|
16 | { \
|
---|
17 | 0x6302d008, 0x7f9b, 0x4f30, { 0x87, 0xac, 0x60, 0xc9, 0xfe, 0xf5, 0xda, 0x4e } \
|
---|
18 | }
|
---|
19 | typedef VOID *SHELL_FILE_HANDLE;
|
---|
20 |
|
---|
21 | typedef enum {
|
---|
22 | ///
|
---|
23 | /// The operation completed successfully.
|
---|
24 | ///
|
---|
25 | SHELL_SUCCESS = 0,
|
---|
26 |
|
---|
27 | ///
|
---|
28 | /// The image failed to load.
|
---|
29 | ///
|
---|
30 | SHELL_LOAD_ERROR = 1,
|
---|
31 |
|
---|
32 | ///
|
---|
33 | /// The parameter was incorrect.
|
---|
34 | ///
|
---|
35 | SHELL_INVALID_PARAMETER = 2,
|
---|
36 |
|
---|
37 | ///
|
---|
38 | /// The operation is not supported.
|
---|
39 | ///
|
---|
40 | SHELL_UNSUPPORTED = 3,
|
---|
41 |
|
---|
42 | ///
|
---|
43 | /// The buffer was not the proper size for the request.
|
---|
44 | ///
|
---|
45 | SHELL_BAD_BUFFER_SIZE = 4,
|
---|
46 |
|
---|
47 | ///
|
---|
48 | /// The buffer was not large enough to hold the requested data.
|
---|
49 | /// The required buffer size is returned in the appropriate
|
---|
50 | /// parameter when this error occurs.
|
---|
51 | ///
|
---|
52 | SHELL_BUFFER_TOO_SMALL = 5,
|
---|
53 |
|
---|
54 | ///
|
---|
55 | /// There is no data pending upon return.
|
---|
56 | ///
|
---|
57 | SHELL_NOT_READY = 6,
|
---|
58 |
|
---|
59 | ///
|
---|
60 | /// The physical device reported an error while attempting the
|
---|
61 | /// operation.
|
---|
62 | ///
|
---|
63 | SHELL_DEVICE_ERROR = 7,
|
---|
64 |
|
---|
65 | ///
|
---|
66 | /// The device cannot be written to.
|
---|
67 | ///
|
---|
68 | SHELL_WRITE_PROTECTED = 8,
|
---|
69 |
|
---|
70 | ///
|
---|
71 | /// The resource has run out.
|
---|
72 | ///
|
---|
73 | SHELL_OUT_OF_RESOURCES = 9,
|
---|
74 |
|
---|
75 | ///
|
---|
76 | /// An inconsistency was detected on the file system causing the
|
---|
77 | /// operation to fail.
|
---|
78 | ///
|
---|
79 | SHELL_VOLUME_CORRUPTED = 10,
|
---|
80 |
|
---|
81 | ///
|
---|
82 | /// There is no more space on the file system.
|
---|
83 | ///
|
---|
84 | SHELL_VOLUME_FULL = 11,
|
---|
85 |
|
---|
86 | ///
|
---|
87 | /// The device does not contain any medium to perform the
|
---|
88 | /// operation.
|
---|
89 | ///
|
---|
90 | SHELL_NO_MEDIA = 12,
|
---|
91 |
|
---|
92 | ///
|
---|
93 | /// The medium in the device has changed since the last
|
---|
94 | /// access.
|
---|
95 | ///
|
---|
96 | SHELL_MEDIA_CHANGED = 13,
|
---|
97 |
|
---|
98 | ///
|
---|
99 | /// The item was not found.
|
---|
100 | ///
|
---|
101 | SHELL_NOT_FOUND = 14,
|
---|
102 |
|
---|
103 | ///
|
---|
104 | /// Access was denied.
|
---|
105 | ///
|
---|
106 | SHELL_ACCESS_DENIED = 15,
|
---|
107 |
|
---|
108 | // note the skipping of 16 and 17
|
---|
109 |
|
---|
110 | ///
|
---|
111 | /// A timeout time expired.
|
---|
112 | ///
|
---|
113 | SHELL_TIMEOUT = 18,
|
---|
114 |
|
---|
115 | ///
|
---|
116 | /// The protocol has not been started.
|
---|
117 | ///
|
---|
118 | SHELL_NOT_STARTED = 19,
|
---|
119 |
|
---|
120 | ///
|
---|
121 | /// The protocol has already been started.
|
---|
122 | ///
|
---|
123 | SHELL_ALREADY_STARTED = 20,
|
---|
124 |
|
---|
125 | ///
|
---|
126 | /// The operation was aborted.
|
---|
127 | ///
|
---|
128 | SHELL_ABORTED = 21,
|
---|
129 |
|
---|
130 | // note the skipping of 22, 23, and 24
|
---|
131 |
|
---|
132 | ///
|
---|
133 | /// A function encountered an internal version that was
|
---|
134 | /// incompatible with a version requested by the caller.
|
---|
135 | ///
|
---|
136 | SHELL_INCOMPATIBLE_VERSION = 25,
|
---|
137 |
|
---|
138 | ///
|
---|
139 | /// The function was not performed due to a security violation.
|
---|
140 | ///
|
---|
141 | SHELL_SECURITY_VIOLATION = 26,
|
---|
142 |
|
---|
143 | ///
|
---|
144 | /// The function was performed and resulted in an unequal
|
---|
145 | /// comparison..
|
---|
146 | ///
|
---|
147 | SHELL_NOT_EQUAL = 27
|
---|
148 | } SHELL_STATUS;
|
---|
149 |
|
---|
150 |
|
---|
151 | // replaced EFI_LIST_ENTRY with LIST_ENTRY for simplicity.
|
---|
152 | // they are identical outside of the name.
|
---|
153 | typedef struct {
|
---|
154 | LIST_ENTRY Link; ///< Linked list members.
|
---|
155 | EFI_STATUS Status; ///< Status of opening the file. Valid only if Handle != NULL.
|
---|
156 | CONST CHAR16 *FullName; ///< Fully qualified filename.
|
---|
157 | CONST CHAR16 *FileName; ///< name of this file.
|
---|
158 | SHELL_FILE_HANDLE Handle; ///< Handle for interacting with the opened file or NULL if closed.
|
---|
159 | EFI_FILE_INFO *Info; ///< Pointer to the FileInfo struct for this file or NULL.
|
---|
160 | } EFI_SHELL_FILE_INFO;
|
---|
161 |
|
---|
162 | /**
|
---|
163 | Returns whether any script files are currently being processed.
|
---|
164 |
|
---|
165 | @retval TRUE There is at least one script file active.
|
---|
166 | @retval FALSE No script files are active now.
|
---|
167 |
|
---|
168 | **/
|
---|
169 | typedef
|
---|
170 | BOOLEAN
|
---|
171 | (EFIAPI *EFI_SHELL_BATCH_IS_ACTIVE) (
|
---|
172 | VOID
|
---|
173 | );
|
---|
174 |
|
---|
175 | /**
|
---|
176 | Closes the file handle.
|
---|
177 |
|
---|
178 | This function closes a specified file handle. All 'dirty' cached file data is
|
---|
179 | flushed to the device, and the file is closed. In all cases, the handle is
|
---|
180 | closed.
|
---|
181 |
|
---|
182 | @param[in] FileHandle The file handle to be closed.
|
---|
183 |
|
---|
184 | @retval EFI_SUCCESS The file closed sucessfully.
|
---|
185 | **/
|
---|
186 | typedef
|
---|
187 | EFI_STATUS
|
---|
188 | (EFIAPI *EFI_SHELL_CLOSE_FILE)(
|
---|
189 | IN SHELL_FILE_HANDLE FileHandle
|
---|
190 | );
|
---|
191 |
|
---|
192 | /**
|
---|
193 | Creates a file or directory by name.
|
---|
194 |
|
---|
195 | This function creates an empty new file or directory with the specified attributes and
|
---|
196 | returns the new file's handle. If the file already exists and is read-only, then
|
---|
197 | EFI_INVALID_PARAMETER will be returned.
|
---|
198 |
|
---|
199 | If the file already existed, it is truncated and its attributes updated. If the file is
|
---|
200 | created successfully, the FileHandle is the file's handle, else, the FileHandle is NULL.
|
---|
201 |
|
---|
202 | If the file name begins with >v, then the file handle which is returned refers to the
|
---|
203 | shell environment variable with the specified name. If the shell environment variable
|
---|
204 | already exists and is non-volatile then EFI_INVALID_PARAMETER is returned.
|
---|
205 |
|
---|
206 | @param[in] FileName Pointer to NULL-terminated file path.
|
---|
207 | @param[in] FileAttribs The new file's attrbiutes. The different attributes are
|
---|
208 | described in EFI_FILE_PROTOCOL.Open().
|
---|
209 | @param[out] FileHandle On return, points to the created file handle or directory's handle.
|
---|
210 |
|
---|
211 | @retval EFI_SUCCESS The file was opened. FileHandle points to the new file's handle.
|
---|
212 | @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
|
---|
213 | @retval EFI_UNSUPPORTED The file path could not be opened.
|
---|
214 | @retval EFI_NOT_FOUND The specified file could not be found on the device, or could not
|
---|
215 | file the file system on the device.
|
---|
216 | @retval EFI_NO_MEDIA The device has no medium.
|
---|
217 | @retval EFI_MEDIA_CHANGED The device has a different medium in it or the medium is no
|
---|
218 | longer supported.
|
---|
219 | @retval EFI_DEVICE_ERROR The device reported an error or can't get the file path according
|
---|
220 | the DirName.
|
---|
221 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
|
---|
222 | @retval EFI_WRITE_PROTECTED An attempt was made to create a file, or open a file for write
|
---|
223 | when the media is write-protected.
|
---|
224 | @retval EFI_ACCESS_DENIED The service denied access to the file.
|
---|
225 | @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the file.
|
---|
226 | @retval EFI_VOLUME_FULL The volume is full.
|
---|
227 | **/
|
---|
228 | typedef
|
---|
229 | EFI_STATUS
|
---|
230 | (EFIAPI *EFI_SHELL_CREATE_FILE)(
|
---|
231 | IN CONST CHAR16 *FileName,
|
---|
232 | IN UINT64 FileAttribs,
|
---|
233 | OUT SHELL_FILE_HANDLE *FileHandle
|
---|
234 | );
|
---|
235 |
|
---|
236 | /**
|
---|
237 | Deletes the file specified by the file handle.
|
---|
238 |
|
---|
239 | This function closes and deletes a file. In all cases, the file handle is closed. If the file
|
---|
240 | cannot be deleted, the warning code EFI_WARN_DELETE_FAILURE is returned, but the
|
---|
241 | handle is still closed.
|
---|
242 |
|
---|
243 | @param[in] FileHandle The file handle to delete.
|
---|
244 |
|
---|
245 | @retval EFI_SUCCESS The file was closed and deleted and the handle was closed.
|
---|
246 | @retval EFI_WARN_DELETE_FAILURE The handle was closed but the file was not deleted.
|
---|
247 | **/
|
---|
248 | typedef
|
---|
249 | EFI_STATUS
|
---|
250 | (EFIAPI *EFI_SHELL_DELETE_FILE)(
|
---|
251 | IN SHELL_FILE_HANDLE FileHandle
|
---|
252 | );
|
---|
253 |
|
---|
254 | /**
|
---|
255 | Deletes the file specified by the file name.
|
---|
256 |
|
---|
257 | This function deletes a file.
|
---|
258 |
|
---|
259 | @param[in] FileName Points to the NULL-terminated file name.
|
---|
260 |
|
---|
261 | @retval EFI_SUCCESS The file was deleted.
|
---|
262 | @retval EFI_WARN_DELETE_FAILURE The handle was closed but the file was not deleted.
|
---|
263 | **/
|
---|
264 | typedef
|
---|
265 | EFI_STATUS
|
---|
266 | (EFIAPI *EFI_SHELL_DELETE_FILE_BY_NAME)(
|
---|
267 | IN CONST CHAR16 *FileName
|
---|
268 | );
|
---|
269 |
|
---|
270 | /**
|
---|
271 | Disables the page break output mode.
|
---|
272 | **/
|
---|
273 | typedef
|
---|
274 | VOID
|
---|
275 | (EFIAPI *EFI_SHELL_DISABLE_PAGE_BREAK) (
|
---|
276 | VOID
|
---|
277 | );
|
---|
278 |
|
---|
279 | /**
|
---|
280 | Enables the page break output mode.
|
---|
281 | **/
|
---|
282 | typedef
|
---|
283 | VOID
|
---|
284 | (EFIAPI *EFI_SHELL_ENABLE_PAGE_BREAK) (
|
---|
285 | VOID
|
---|
286 | );
|
---|
287 |
|
---|
288 | /**
|
---|
289 | Execute the command line.
|
---|
290 |
|
---|
291 | This function creates a nested instance of the shell and executes the specified
|
---|
292 | command (CommandLine) with the specified environment (Environment). Upon return,
|
---|
293 | the status code returned by the specified command is placed in StatusCode.
|
---|
294 |
|
---|
295 | If Environment is NULL, then the current environment is used and all changes made
|
---|
296 | by the commands executed will be reflected in the current environment. If the
|
---|
297 | Environment is non-NULL, then the changes made will be discarded.
|
---|
298 |
|
---|
299 | The CommandLine is executed from the current working directory on the current
|
---|
300 | device.
|
---|
301 |
|
---|
302 | @param[in] ParentImageHandle A handle of the image that is executing the specified
|
---|
303 | command line.
|
---|
304 | @param[in] CommandLine Points to the NULL-terminated UCS-2 encoded string
|
---|
305 | containing the command line. If NULL then the command-
|
---|
306 | line will be empty.
|
---|
307 | @param[in] Environment Points to a NULL-terminated array of environment
|
---|
308 | variables with the format 'x=y', where x is the
|
---|
309 | environment variable name and y is the value. If this
|
---|
310 | is NULL, then the current shell environment is used.
|
---|
311 | @param[out] ErrorCode Points to the status code returned by the command.
|
---|
312 |
|
---|
313 | @retval EFI_SUCCESS The command executed successfully. The status code
|
---|
314 | returned by the command is pointed to by StatusCode.
|
---|
315 | @retval EFI_INVALID_PARAMETER The parameters are invalid.
|
---|
316 | @retval EFI_OUT_OF_RESOURCES Out of resources.
|
---|
317 | @retval EFI_UNSUPPORTED Nested shell invocations are not allowed.
|
---|
318 | **/
|
---|
319 | typedef
|
---|
320 | EFI_STATUS
|
---|
321 | (EFIAPI *EFI_SHELL_EXECUTE) (
|
---|
322 | IN EFI_HANDLE *ParentImageHandle,
|
---|
323 | IN CHAR16 *CommandLine OPTIONAL,
|
---|
324 | IN CHAR16 **Environment OPTIONAL,
|
---|
325 | OUT EFI_STATUS *StatusCode OPTIONAL
|
---|
326 | );
|
---|
327 |
|
---|
328 | /**
|
---|
329 | Find files that match a specified pattern.
|
---|
330 |
|
---|
331 | This function searches for all files and directories that match the specified
|
---|
332 | FilePattern. The FilePattern can contain wild-card characters. The resulting file
|
---|
333 | information is placed in the file list FileList.
|
---|
334 |
|
---|
335 | The files in the file list are not opened. The OpenMode field is set to 0 and the FileInfo
|
---|
336 | field is set to NULL.
|
---|
337 |
|
---|
338 | @param[in] FilePattern Points to a NULL-terminated shell file path, including wildcards.
|
---|
339 | @param[out] FileList On return, points to the start of a file list containing the names
|
---|
340 | of all matching files or else points to NULL if no matching files
|
---|
341 | were found.
|
---|
342 |
|
---|
343 | @retval EFI_SUCCESS Files found.
|
---|
344 | @retval EFI_NOT_FOUND No files found.
|
---|
345 | @retval EFI_NO_MEDIA The device has no media.
|
---|
346 | @retval EFI_DEVICE_ERROR The device reported an error.
|
---|
347 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
|
---|
348 | **/
|
---|
349 | typedef
|
---|
350 | EFI_STATUS
|
---|
351 | (EFIAPI *EFI_SHELL_FIND_FILES)(
|
---|
352 | IN CONST CHAR16 *FilePattern,
|
---|
353 | OUT EFI_SHELL_FILE_INFO **FileList
|
---|
354 | );
|
---|
355 |
|
---|
356 | /**
|
---|
357 | Find all files in a specified directory.
|
---|
358 |
|
---|
359 | @param[in] FileDirHandle Handle of the directory to search.
|
---|
360 | @param[out] FileList On return, points to the list of files in the directory
|
---|
361 | or NULL if there are no files in the directory.
|
---|
362 |
|
---|
363 | @retval EFI_SUCCESS File information was returned successfully.
|
---|
364 | @retval EFI_VOLUME_CORRUPTED The file system structures have been corrupted.
|
---|
365 | @retval EFI_DEVICE_ERROR The device reported an error.
|
---|
366 | @retval EFI_NO_MEDIA The device media is not present.
|
---|
367 | **/
|
---|
368 | typedef
|
---|
369 | EFI_STATUS
|
---|
370 | (EFIAPI *EFI_SHELL_FIND_FILES_IN_DIR)(
|
---|
371 | IN SHELL_FILE_HANDLE FileDirHandle,
|
---|
372 | OUT EFI_SHELL_FILE_INFO **FileList
|
---|
373 | );
|
---|
374 |
|
---|
375 | /**
|
---|
376 | Flushes data back to a device.
|
---|
377 |
|
---|
378 | This function flushes all modified data associated with a file to a device.
|
---|
379 |
|
---|
380 | @param[in] FileHandle The handle of the file to flush.
|
---|
381 |
|
---|
382 | @retval EFI_SUCCESS The data was flushed.
|
---|
383 | @retval EFI_NO_MEDIA The device has no medium.
|
---|
384 | @retval EFI_DEVICE_ERROR The device reported an error.
|
---|
385 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
|
---|
386 | @retval EFI_WRITE_PROTECTED The file or medium is write-protected.
|
---|
387 | @retval EFI_ACCESS_DENIED The file was opened read-only.
|
---|
388 | @retval EFI_VOLUME_FULL The volume is full.
|
---|
389 | **/
|
---|
390 | typedef
|
---|
391 | EFI_STATUS
|
---|
392 | (EFIAPI *EFI_SHELL_FLUSH_FILE)(
|
---|
393 | IN SHELL_FILE_HANDLE FileHandle
|
---|
394 | );
|
---|
395 |
|
---|
396 | /**
|
---|
397 | Frees the file list.
|
---|
398 |
|
---|
399 | This function cleans up the file list and any related data structures. It has no
|
---|
400 | impact on the files themselves.
|
---|
401 |
|
---|
402 | @param[in] FileList The file list to free. Type EFI_SHELL_FILE_INFO is
|
---|
403 | defined in OpenFileList().
|
---|
404 |
|
---|
405 | @retval EFI_SUCCESS Free the file list successfully.
|
---|
406 | **/
|
---|
407 | typedef
|
---|
408 | EFI_STATUS
|
---|
409 | (EFIAPI *EFI_SHELL_FREE_FILE_LIST) (
|
---|
410 | IN EFI_SHELL_FILE_INFO **FileList
|
---|
411 | );
|
---|
412 |
|
---|
413 | /**
|
---|
414 | Returns the current directory on the specified device.
|
---|
415 |
|
---|
416 | If FileSystemMapping is NULL, it returns the current working directory. If the
|
---|
417 | FileSystemMapping is not NULL, it returns the current directory associated with the
|
---|
418 | FileSystemMapping. In both cases, the returned name includes the file system
|
---|
419 | mapping (i.e. fs0:\current-dir).
|
---|
420 |
|
---|
421 | Note that the current directory string should exclude the tailing backslash character.
|
---|
422 |
|
---|
423 | @param[in] FileSystemMapping A pointer to the file system mapping. If NULL,
|
---|
424 | then the current working directory is returned.
|
---|
425 |
|
---|
426 | @retval !=NULL The current directory.
|
---|
427 | @retval NULL Current directory does not exist.
|
---|
428 | **/
|
---|
429 | typedef
|
---|
430 | CONST CHAR16 *
|
---|
431 | (EFIAPI *EFI_SHELL_GET_CUR_DIR) (
|
---|
432 | IN CONST CHAR16 *FileSystemMapping OPTIONAL
|
---|
433 | );
|
---|
434 |
|
---|
435 | typedef UINT32 EFI_SHELL_DEVICE_NAME_FLAGS;
|
---|
436 | #define EFI_DEVICE_NAME_USE_COMPONENT_NAME 0x00000001
|
---|
437 | #define EFI_DEVICE_NAME_USE_DEVICE_PATH 0x00000002
|
---|
438 |
|
---|
439 | /**
|
---|
440 | Gets the name of the device specified by the device handle.
|
---|
441 |
|
---|
442 | This function gets the user-readable name of the device specified by the device
|
---|
443 | handle. If no user-readable name could be generated, then *BestDeviceName will be
|
---|
444 | NULL and EFI_NOT_FOUND will be returned.
|
---|
445 |
|
---|
446 | If EFI_DEVICE_NAME_USE_COMPONENT_NAME is set, then the function will return the
|
---|
447 | device's name using the EFI_COMPONENT_NAME2_PROTOCOL, if present on
|
---|
448 | DeviceHandle.
|
---|
449 |
|
---|
450 | If EFI_DEVICE_NAME_USE_DEVICE_PATH is set, then the function will return the
|
---|
451 | device's name using the EFI_DEVICE_PATH_PROTOCOL, if present on DeviceHandle.
|
---|
452 | If both EFI_DEVICE_NAME_USE_COMPONENT_NAME and
|
---|
453 | EFI_DEVICE_NAME_USE_DEVICE_PATH are set, then
|
---|
454 | EFI_DEVICE_NAME_USE_COMPONENT_NAME will have higher priority.
|
---|
455 |
|
---|
456 | @param[in] DeviceHandle The handle of the device.
|
---|
457 | @param[in] Flags Determines the possible sources of component names.
|
---|
458 | @param[in] Language A pointer to the language specified for the device
|
---|
459 | name, in the same format as described in the UEFI
|
---|
460 | specification, Appendix M.
|
---|
461 | @param[out] BestDeviceName On return, points to the callee-allocated NULL-
|
---|
462 | terminated name of the device. If no device name
|
---|
463 | could be found, points to NULL. The name must be
|
---|
464 | freed by the caller...
|
---|
465 |
|
---|
466 | @retval EFI_SUCCESS Get the name successfully.
|
---|
467 | @retval EFI_NOT_FOUND Fail to get the device name.
|
---|
468 | **/
|
---|
469 | typedef
|
---|
470 | EFI_STATUS
|
---|
471 | (EFIAPI *EFI_SHELL_GET_DEVICE_NAME) (
|
---|
472 | IN EFI_HANDLE DeviceHandle,
|
---|
473 | IN EFI_SHELL_DEVICE_NAME_FLAGS Flags,
|
---|
474 | IN CHAR8 *Language,
|
---|
475 | OUT CHAR16 **BestDeviceName
|
---|
476 | );
|
---|
477 |
|
---|
478 | /**
|
---|
479 | Gets the device path from the mapping.
|
---|
480 |
|
---|
481 | This function gets the device path associated with a mapping.
|
---|
482 |
|
---|
483 | @param[in] Mapping A pointer to the mapping
|
---|
484 |
|
---|
485 | @retval !=NULL Pointer to the device path that corresponds to the
|
---|
486 | device mapping. The returned pointer does not need
|
---|
487 | to be freed.
|
---|
488 | @retval NULL There is no device path associated with the
|
---|
489 | specified mapping.
|
---|
490 | **/
|
---|
491 | typedef
|
---|
492 | CONST EFI_DEVICE_PATH_PROTOCOL *
|
---|
493 | (EFIAPI *EFI_SHELL_GET_DEVICE_PATH_FROM_MAP) (
|
---|
494 | IN CONST CHAR16 *Mapping
|
---|
495 | );
|
---|
496 |
|
---|
497 | /**
|
---|
498 | Converts a file system style name to a device path.
|
---|
499 |
|
---|
500 | This function converts a file system style name to a device path, by replacing any
|
---|
501 | mapping references to the associated device path.
|
---|
502 |
|
---|
503 | @param[in] Path The pointer to the path.
|
---|
504 |
|
---|
505 | @return The pointer of the file path. The file path is callee
|
---|
506 | allocated and should be freed by the caller.
|
---|
507 | **/
|
---|
508 | typedef
|
---|
509 | EFI_DEVICE_PATH_PROTOCOL *
|
---|
510 | (EFIAPI *EFI_SHELL_GET_DEVICE_PATH_FROM_FILE_PATH) (
|
---|
511 | IN CONST CHAR16 *Path
|
---|
512 | );
|
---|
513 |
|
---|
514 | /**
|
---|
515 | Gets either a single or list of environment variables.
|
---|
516 |
|
---|
517 | If name is not NULL then this function returns the current value of the specified
|
---|
518 | environment variable.
|
---|
519 |
|
---|
520 | If Name is NULL than a list of all environment variable names is returned. Each a
|
---|
521 | NULL terminated string with a double NULL terminating the list.
|
---|
522 |
|
---|
523 | @param[in] Name A pointer to the environment variable name. If
|
---|
524 | Name is NULL, then the function will return all
|
---|
525 | of the defined shell environment variables. In
|
---|
526 | the case where multiple environment variables are
|
---|
527 | being returned, each variable will be terminated by
|
---|
528 | a NULL, and the list will be terminated by a double
|
---|
529 | NULL.
|
---|
530 |
|
---|
531 | @return A pointer to the returned string.
|
---|
532 | The returned pointer does not need to be freed by the caller.
|
---|
533 |
|
---|
534 | @retval NULL The environment variable doesn't exist or there are
|
---|
535 | no environment variables.
|
---|
536 | **/
|
---|
537 | typedef
|
---|
538 | CONST CHAR16 *
|
---|
539 | (EFIAPI *EFI_SHELL_GET_ENV) (
|
---|
540 | IN CONST CHAR16 *Name OPTIONAL
|
---|
541 | );
|
---|
542 |
|
---|
543 | /**
|
---|
544 | Gets the environment variable and Attributes, or list of environment variables. Can be
|
---|
545 | used instead of GetEnv().
|
---|
546 |
|
---|
547 | This function returns the current value of the specified environment variable and
|
---|
548 | the Attributes. If no variable name was specified, then all of the known
|
---|
549 | variables will be returned.
|
---|
550 |
|
---|
551 | @param[in] Name A pointer to the environment variable name. If Name is NULL,
|
---|
552 | then the function will return all of the defined shell
|
---|
553 | environment variables. In the case where multiple environment
|
---|
554 | variables are being returned, each variable will be terminated
|
---|
555 | by a NULL, and the list will be terminated by a double NULL.
|
---|
556 | @param[out] Attributes If not NULL, a pointer to the returned attributes bitmask for
|
---|
557 | the environment variable. In the case where Name is NULL, and
|
---|
558 | multiple environment variables are being returned, Attributes
|
---|
559 | is undefined.
|
---|
560 |
|
---|
561 | @retval NULL The environment variable doesn't exist.
|
---|
562 | @return The environment variable's value. The returned pointer does not
|
---|
563 | need to be freed by the caller.
|
---|
564 | **/
|
---|
565 | typedef
|
---|
566 | CONST CHAR16 *
|
---|
567 | (EFIAPI *EFI_SHELL_GET_ENV_EX) (
|
---|
568 | IN CONST CHAR16 *Name,
|
---|
569 | OUT UINT32 *Attributes OPTIONAL
|
---|
570 | );
|
---|
571 |
|
---|
572 | /**
|
---|
573 | Gets the file information from an open file handle.
|
---|
574 |
|
---|
575 | This function allocates a buffer to store the file's information. It's the caller's
|
---|
576 | responsibility to free the buffer.
|
---|
577 |
|
---|
578 | @param[in] FileHandle A File Handle.
|
---|
579 |
|
---|
580 | @retval NULL Cannot get the file info.
|
---|
581 | @return A pointer to a buffer with file information.
|
---|
582 | **/
|
---|
583 | typedef
|
---|
584 | EFI_FILE_INFO *
|
---|
585 | (EFIAPI *EFI_SHELL_GET_FILE_INFO)(
|
---|
586 | IN SHELL_FILE_HANDLE FileHandle
|
---|
587 | );
|
---|
588 |
|
---|
589 | /**
|
---|
590 | Converts a device path to a file system-style path.
|
---|
591 |
|
---|
592 | This function converts a device path to a file system path by replacing part, or all, of
|
---|
593 | the device path with the file-system mapping. If there are more than one application
|
---|
594 | file system mappings, the one that most closely matches Path will be used.
|
---|
595 |
|
---|
596 | @param[in] Path The pointer to the device path.
|
---|
597 |
|
---|
598 | @return The pointer of the NULL-terminated file path. The path
|
---|
599 | is callee-allocated and should be freed by the caller.
|
---|
600 | **/
|
---|
601 | typedef
|
---|
602 | CHAR16 *
|
---|
603 | (EFIAPI *EFI_SHELL_GET_FILE_PATH_FROM_DEVICE_PATH) (
|
---|
604 | IN CONST EFI_DEVICE_PATH_PROTOCOL *Path
|
---|
605 | );
|
---|
606 |
|
---|
607 | /**
|
---|
608 | Gets a file's current position.
|
---|
609 |
|
---|
610 | This function returns the current file position for the file handle. For directories, the
|
---|
611 | current file position has no meaning outside of the file system driver and as such, the
|
---|
612 | operation is not supported.
|
---|
613 |
|
---|
614 | @param[in] FileHandle The file handle on which to get the current position.
|
---|
615 | @param[out] Position Byte position from the start of the file.
|
---|
616 |
|
---|
617 | @retval EFI_SUCCESS Data was accessed.
|
---|
618 | @retval EFI_UNSUPPORTED The request is not valid on open directories.
|
---|
619 | **/
|
---|
620 | typedef
|
---|
621 | EFI_STATUS
|
---|
622 | (EFIAPI *EFI_SHELL_GET_FILE_POSITION)(
|
---|
623 | IN SHELL_FILE_HANDLE FileHandle,
|
---|
624 | OUT UINT64 *Position
|
---|
625 | );
|
---|
626 |
|
---|
627 | /**
|
---|
628 | Gets the size of a file.
|
---|
629 |
|
---|
630 | This function returns the size of the file specified by FileHandle.
|
---|
631 |
|
---|
632 | @param[in] FileHandle The handle of the file.
|
---|
633 | @param[out] Size The size of this file.
|
---|
634 |
|
---|
635 | @retval EFI_SUCCESS Get the file's size.
|
---|
636 | @retval EFI_DEVICE_ERROR Can't access the file.
|
---|
637 | **/
|
---|
638 | typedef
|
---|
639 | EFI_STATUS
|
---|
640 | (EFIAPI *EFI_SHELL_GET_FILE_SIZE)(
|
---|
641 | IN SHELL_FILE_HANDLE FileHandle,
|
---|
642 | OUT UINT64 *Size
|
---|
643 | );
|
---|
644 |
|
---|
645 | /**
|
---|
646 | Get the GUID value from a human readable name.
|
---|
647 |
|
---|
648 | If GuidName is a known GUID name, then update Guid to have the correct value for
|
---|
649 | that GUID.
|
---|
650 |
|
---|
651 | This function is only available when the major and minor versions in the
|
---|
652 | EfiShellProtocol are greater than or equal to 2 and 1, respectively.
|
---|
653 |
|
---|
654 | @param[in] GuidName A pointer to the localized name for the GUID being queried.
|
---|
655 | @param[out] Guid A pointer to the GUID structure to be filled in.
|
---|
656 |
|
---|
657 | @retval EFI_SUCCESS The operation was successful.
|
---|
658 | @retval EFI_INVALID_PARAMETER Guid was NULL.
|
---|
659 | @retval EFI_INVALID_PARAMETER GuidName was NULL.
|
---|
660 | @retval EFI_NOT_FOUND GuidName is not a known GUID Name.
|
---|
661 | **/
|
---|
662 | typedef
|
---|
663 | EFI_STATUS
|
---|
664 | (EFIAPI *EFI_SHELL_GET_GUID_FROM_NAME)(
|
---|
665 | IN CONST CHAR16 *GuidName,
|
---|
666 | OUT EFI_GUID *Guid
|
---|
667 | );
|
---|
668 |
|
---|
669 | /**
|
---|
670 | Get the human readable name for a GUID from the value.
|
---|
671 |
|
---|
672 | If Guid is assigned a name, then update *GuidName to point to the name. The callee
|
---|
673 | should not modify the value.
|
---|
674 |
|
---|
675 | This function is only available when the major and minor versions in the
|
---|
676 | EfiShellProtocol are greater than or equal to 2 and 1, respectively.
|
---|
677 |
|
---|
678 | @param[in] Guid A pointer to the GUID being queried.
|
---|
679 | @param[out] GuidName A pointer to a pointer the localized to name for the GUID being requested
|
---|
680 |
|
---|
681 | @retval EFI_SUCCESS The operation was successful.
|
---|
682 | @retval EFI_INVALID_PARAMETER Guid was NULL.
|
---|
683 | @retval EFI_INVALID_PARAMETER GuidName was NULL.
|
---|
684 | @retval EFI_NOT_FOUND Guid is not assigned a name.
|
---|
685 | **/
|
---|
686 | typedef
|
---|
687 | EFI_STATUS
|
---|
688 | (EFIAPI *EFI_SHELL_GET_GUID_NAME)(
|
---|
689 | IN CONST EFI_GUID *Guid,
|
---|
690 | OUT CONST CHAR16 **GuidName
|
---|
691 | );
|
---|
692 |
|
---|
693 | /**
|
---|
694 | Return help information about a specific command.
|
---|
695 |
|
---|
696 | This function returns the help information for the specified command. The help text
|
---|
697 | can be internal to the shell or can be from a UEFI Shell manual page.
|
---|
698 |
|
---|
699 | If Sections is specified, then each section name listed will be compared in a casesensitive
|
---|
700 | manner, to the section names described in Appendix B. If the section exists,
|
---|
701 | it will be appended to the returned help text. If the section does not exist, no
|
---|
702 | information will be returned. If Sections is NULL, then all help text information
|
---|
703 | available will be returned.
|
---|
704 |
|
---|
705 | @param[in] Command Points to the NULL-terminated UEFI Shell command name.
|
---|
706 | @param[in] Sections Points to the NULL-terminated comma-delimited
|
---|
707 | section names to return. If NULL, then all
|
---|
708 | sections will be returned.
|
---|
709 | @param[out] HelpText On return, points to a callee-allocated buffer
|
---|
710 | containing all specified help text.
|
---|
711 |
|
---|
712 | @retval EFI_SUCCESS The help text was returned.
|
---|
713 | @retval EFI_OUT_OF_RESOURCES The necessary buffer could not be allocated to hold the
|
---|
714 | returned help text.
|
---|
715 | @retval EFI_INVALID_PARAMETER HelpText is NULL.
|
---|
716 | @retval EFI_NOT_FOUND There is no help text available for Command.
|
---|
717 | **/
|
---|
718 | typedef
|
---|
719 | EFI_STATUS
|
---|
720 | (EFIAPI *EFI_SHELL_GET_HELP_TEXT) (
|
---|
721 | IN CONST CHAR16 *Command,
|
---|
722 | IN CONST CHAR16 *Sections OPTIONAL,
|
---|
723 | OUT CHAR16 **HelpText
|
---|
724 | );
|
---|
725 |
|
---|
726 | /**
|
---|
727 | Gets the mapping(s) that most closely matches the device path.
|
---|
728 |
|
---|
729 | This function gets the mapping which corresponds to the device path *DevicePath. If
|
---|
730 | there is no exact match, then the mapping which most closely matches *DevicePath
|
---|
731 | is returned, and *DevicePath is updated to point to the remaining portion of the
|
---|
732 | device path. If there is an exact match, the mapping is returned and *DevicePath
|
---|
733 | points to the end-of-device-path node.
|
---|
734 |
|
---|
735 | If there are multiple map names they will be semi-colon seperated in the
|
---|
736 | NULL-terminated string.
|
---|
737 |
|
---|
738 | @param[in, out] DevicePath On entry, points to a device path pointer. On
|
---|
739 | exit, updates the pointer to point to the
|
---|
740 | portion of the device path after the mapping.
|
---|
741 |
|
---|
742 | @retval NULL No mapping was found.
|
---|
743 | @retval !=NULL Pointer to NULL-terminated mapping. The buffer
|
---|
744 | is callee allocated and should be freed by the caller.
|
---|
745 | **/
|
---|
746 | typedef
|
---|
747 | CONST CHAR16 *
|
---|
748 | (EFIAPI *EFI_SHELL_GET_MAP_FROM_DEVICE_PATH) (
|
---|
749 | IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
|
---|
750 | );
|
---|
751 |
|
---|
752 | /**
|
---|
753 | Gets the enable status of the page break output mode.
|
---|
754 |
|
---|
755 | User can use this function to determine current page break mode.
|
---|
756 |
|
---|
757 | @retval TRUE The page break output mode is enabled.
|
---|
758 | @retval FALSE The page break output mode is disabled.
|
---|
759 | **/
|
---|
760 | typedef
|
---|
761 | BOOLEAN
|
---|
762 | (EFIAPI *EFI_SHELL_GET_PAGE_BREAK) (
|
---|
763 | VOID
|
---|
764 | );
|
---|
765 |
|
---|
766 | /**
|
---|
767 | Judges whether the active shell is the root shell.
|
---|
768 |
|
---|
769 | This function makes the user to know that whether the active Shell is the root shell.
|
---|
770 |
|
---|
771 | @retval TRUE The active Shell is the root Shell.
|
---|
772 | @retval FALSE The active Shell is NOT the root Shell.
|
---|
773 | **/
|
---|
774 | typedef
|
---|
775 | BOOLEAN
|
---|
776 | (EFIAPI *EFI_SHELL_IS_ROOT_SHELL) (
|
---|
777 | VOID
|
---|
778 | );
|
---|
779 |
|
---|
780 | /**
|
---|
781 | Opens a file or a directory by file name.
|
---|
782 |
|
---|
783 | This function opens the specified file in the specified OpenMode and returns a file
|
---|
784 | handle.
|
---|
785 | If the file name begins with '>v', then the file handle which is returned refers to the
|
---|
786 | shell environment variable with the specified name. If the shell environment variable
|
---|
787 | exists, is non-volatile and the OpenMode indicates EFI_FILE_MODE_WRITE, then
|
---|
788 | EFI_INVALID_PARAMETER is returned.
|
---|
789 |
|
---|
790 | If the file name is '>i', then the file handle which is returned refers to the standard
|
---|
791 | input. If the OpenMode indicates EFI_FILE_MODE_WRITE, then EFI_INVALID_PARAMETER
|
---|
792 | is returned.
|
---|
793 |
|
---|
794 | If the file name is '>o', then the file handle which is returned refers to the standard
|
---|
795 | output. If the OpenMode indicates EFI_FILE_MODE_READ, then EFI_INVALID_PARAMETER
|
---|
796 | is returned.
|
---|
797 |
|
---|
798 | If the file name is '>e', then the file handle which is returned refers to the standard
|
---|
799 | error. If the OpenMode indicates EFI_FILE_MODE_READ, then EFI_INVALID_PARAMETER
|
---|
800 | is returned.
|
---|
801 |
|
---|
802 | If the file name is 'NUL', then the file handle that is returned refers to the standard NUL
|
---|
803 | file. If the OpenMode indicates EFI_FILE_MODE_READ, then EFI_INVALID_PARAMETER is
|
---|
804 | returned.
|
---|
805 |
|
---|
806 | If return EFI_SUCCESS, the FileHandle is the opened file's handle, else, the
|
---|
807 | FileHandle is NULL.
|
---|
808 |
|
---|
809 | @param[in] FileName Points to the NULL-terminated UCS-2 encoded file name.
|
---|
810 | @param[out] FileHandle On return, points to the file handle.
|
---|
811 | @param[in] OpenMode File open mode. Either EFI_FILE_MODE_READ or
|
---|
812 | EFI_FILE_MODE_WRITE from section 12.4 of the UEFI
|
---|
813 | Specification.
|
---|
814 | @retval EFI_SUCCESS The file was opened. FileHandle has the opened file's handle.
|
---|
815 | @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. FileHandle is NULL.
|
---|
816 | @retval EFI_UNSUPPORTED Could not open the file path. FileHandle is NULL.
|
---|
817 | @retval EFI_NOT_FOUND The specified file could not be found on the device or the file
|
---|
818 | system could not be found on the device. FileHandle is NULL.
|
---|
819 | @retval EFI_NO_MEDIA The device has no medium. FileHandle is NULL.
|
---|
820 | @retval EFI_MEDIA_CHANGED The device has a different medium in it or the medium is no
|
---|
821 | longer supported. FileHandle is NULL.
|
---|
822 | @retval EFI_DEVICE_ERROR The device reported an error or can't get the file path according
|
---|
823 | the FileName. FileHandle is NULL.
|
---|
824 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. FileHandle is NULL.
|
---|
825 | @retval EFI_WRITE_PROTECTED An attempt was made to create a file, or open a file for write
|
---|
826 | when the media is write-protected. FileHandle is NULL.
|
---|
827 | @retval EFI_ACCESS_DENIED The service denied access to the file. FileHandle is NULL.
|
---|
828 | @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the file. FileHandle
|
---|
829 | is NULL.
|
---|
830 | @retval EFI_VOLUME_FULL The volume is full. FileHandle is NULL.
|
---|
831 | **/
|
---|
832 | typedef
|
---|
833 | EFI_STATUS
|
---|
834 | (EFIAPI *EFI_SHELL_OPEN_FILE_BY_NAME) (
|
---|
835 | IN CONST CHAR16 *FileName,
|
---|
836 | OUT SHELL_FILE_HANDLE *FileHandle,
|
---|
837 | IN UINT64 OpenMode
|
---|
838 | );
|
---|
839 |
|
---|
840 | /**
|
---|
841 | Opens the files that match the path specified.
|
---|
842 |
|
---|
843 | This function opens all of the files specified by Path. Wildcards are processed
|
---|
844 | according to the rules specified in UEFI Shell 2.0 spec section 3.7.1. Each
|
---|
845 | matching file has an EFI_SHELL_FILE_INFO structure created in a linked list.
|
---|
846 |
|
---|
847 | @param[in] Path A pointer to the path string.
|
---|
848 | @param[in] OpenMode Specifies the mode used to open each file, EFI_FILE_MODE_READ or
|
---|
849 | EFI_FILE_MODE_WRITE.
|
---|
850 | @param[in, out] FileList Points to the start of a list of files opened.
|
---|
851 |
|
---|
852 | @retval EFI_SUCCESS Create the file list successfully.
|
---|
853 | @return Can't create the file list.
|
---|
854 | **/
|
---|
855 | typedef
|
---|
856 | EFI_STATUS
|
---|
857 | (EFIAPI *EFI_SHELL_OPEN_FILE_LIST) (
|
---|
858 | IN CHAR16 *Path,
|
---|
859 | IN UINT64 OpenMode,
|
---|
860 | IN OUT EFI_SHELL_FILE_INFO **FileList
|
---|
861 | );
|
---|
862 |
|
---|
863 | /**
|
---|
864 | Opens the root directory of a device.
|
---|
865 |
|
---|
866 | This function opens the root directory of a device and returns a file handle to it.
|
---|
867 |
|
---|
868 | @param[in] DevicePath Points to the device path corresponding to the device where the
|
---|
869 | EFI_SIMPLE_FILE_SYSTEM_PROTOCOL is installed.
|
---|
870 | @param[out] FileHandle On exit, points to the file handle corresponding to the root directory on the
|
---|
871 | device.
|
---|
872 |
|
---|
873 | @retval EFI_SUCCESS Root opened successfully.
|
---|
874 | @retval EFI_NOT_FOUND EFI_SIMPLE_FILE_SYSTEM could not be found or the root directory
|
---|
875 | could not be opened.
|
---|
876 | @retval EFI_VOLUME_CORRUPTED The data structures in the volume were corrupted.
|
---|
877 | @retval EFI_DEVICE_ERROR The device had an error.
|
---|
878 | **/
|
---|
879 | typedef
|
---|
880 | EFI_STATUS
|
---|
881 | (EFIAPI *EFI_SHELL_OPEN_ROOT)(
|
---|
882 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
---|
883 | OUT SHELL_FILE_HANDLE *FileHandle
|
---|
884 | );
|
---|
885 |
|
---|
886 | /**
|
---|
887 | Opens the root directory of a device on a handle.
|
---|
888 |
|
---|
889 | This function opens the root directory of a device and returns a file handle to it.
|
---|
890 |
|
---|
891 | @param[in] DeviceHandle The handle of the device that contains the volume.
|
---|
892 | @param[out] FileHandle On exit, points to the file handle corresponding to the root directory on the
|
---|
893 | device.
|
---|
894 |
|
---|
895 | @retval EFI_SUCCESS Root opened successfully.
|
---|
896 | @retval EFI_NOT_FOUND EFI_SIMPLE_FILE_SYSTEM could not be found or the root directory
|
---|
897 | could not be opened.
|
---|
898 | @retval EFI_VOLUME_CORRUPTED The data structures in the volume were corrupted.
|
---|
899 | @retval EFI_DEVICE_ERROR The device had an error.
|
---|
900 | **/
|
---|
901 | typedef
|
---|
902 | EFI_STATUS
|
---|
903 | (EFIAPI *EFI_SHELL_OPEN_ROOT_BY_HANDLE)(
|
---|
904 | IN EFI_HANDLE DeviceHandle,
|
---|
905 | OUT SHELL_FILE_HANDLE *FileHandle
|
---|
906 | );
|
---|
907 |
|
---|
908 | /**
|
---|
909 | Reads data from the file.
|
---|
910 |
|
---|
911 | If FileHandle is not a directory, the function reads the requested number of bytes
|
---|
912 | from the file at the file's current position and returns them in Buffer. If the read goes
|
---|
913 | beyond the end of the file, the read length is truncated to the end of the file. The file's
|
---|
914 | current position is increased by the number of bytes returned.
|
---|
915 | If FileHandle is a directory, then an error is returned.
|
---|
916 |
|
---|
917 | @param[in] FileHandle The opened file handle for read.
|
---|
918 | @param[in] ReadSize On input, the size of Buffer, in bytes. On output, the amount of data read.
|
---|
919 | @param[in, out] Buffer The buffer in which data is read.
|
---|
920 |
|
---|
921 | @retval EFI_SUCCESS Data was read.
|
---|
922 | @retval EFI_NO_MEDIA The device has no media.
|
---|
923 | @retval EFI_DEVICE_ERROR The device reported an error.
|
---|
924 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
|
---|
925 | @retval EFI_BUFFER_TO_SMALL Buffer is too small. ReadSize contains required size.
|
---|
926 | **/
|
---|
927 | typedef
|
---|
928 | EFI_STATUS
|
---|
929 | (EFIAPI *EFI_SHELL_READ_FILE) (
|
---|
930 | IN SHELL_FILE_HANDLE FileHandle,
|
---|
931 | IN OUT UINTN *ReadSize,
|
---|
932 | IN OUT VOID *Buffer
|
---|
933 | );
|
---|
934 |
|
---|
935 | /**
|
---|
936 | Register a GUID and a localized human readable name for it.
|
---|
937 |
|
---|
938 | If Guid is not assigned a name, then assign GuidName to Guid. This list of GUID
|
---|
939 | names must be used whenever a shell command outputs GUID information.
|
---|
940 |
|
---|
941 | This function is only available when the major and minor versions in the
|
---|
942 | EfiShellProtocol are greater than or equal to 2 and 1, respectively.
|
---|
943 |
|
---|
944 | @param[in] Guid A pointer to the GUID being registered.
|
---|
945 | @param[in] GuidName A pointer to the localized name for the GUID being registered.
|
---|
946 |
|
---|
947 | @retval EFI_SUCCESS The operation was successful.
|
---|
948 | @retval EFI_INVALID_PARAMETER Guid was NULL.
|
---|
949 | @retval EFI_INVALID_PARAMETER GuidName was NULL.
|
---|
950 | @retval EFI_ACCESS_DENIED Guid already is assigned a name.
|
---|
951 | **/
|
---|
952 | typedef
|
---|
953 | EFI_STATUS
|
---|
954 | (EFIAPI *EFI_SHELL_REGISTER_GUID_NAME)(
|
---|
955 | IN CONST EFI_GUID *Guid,
|
---|
956 | IN CONST CHAR16 *GuidName
|
---|
957 | );
|
---|
958 |
|
---|
959 | /**
|
---|
960 | Deletes the duplicate file names files in the given file list.
|
---|
961 |
|
---|
962 | @param[in] FileList A pointer to the first entry in the file list.
|
---|
963 |
|
---|
964 | @retval EFI_SUCCESS Always success.
|
---|
965 | **/
|
---|
966 | typedef
|
---|
967 | EFI_STATUS
|
---|
968 | (EFIAPI *EFI_SHELL_REMOVE_DUP_IN_FILE_LIST) (
|
---|
969 | IN EFI_SHELL_FILE_INFO **FileList
|
---|
970 | );
|
---|
971 |
|
---|
972 | /**
|
---|
973 | Changes a shell command alias.
|
---|
974 |
|
---|
975 | This function creates an alias for a shell command.
|
---|
976 |
|
---|
977 | @param[in] Command Points to the NULL-terminated shell command or existing alias.
|
---|
978 | @param[in] Alias Points to the NULL-terminated alias for the shell command. If this is NULL, and
|
---|
979 | Command refers to an alias, that alias will be deleted.
|
---|
980 | @param[in] Replace If TRUE and the alias already exists, then the existing alias will be replaced. If
|
---|
981 | FALSE and the alias already exists, then the existing alias is unchanged and
|
---|
982 | EFI_ACCESS_DENIED is returned.
|
---|
983 | @param[in] Volatile if TRUE the Alias being set will be stored in a volatile fashion. if FALSE the
|
---|
984 | Alias being set will be stored in a non-volatile fashion.
|
---|
985 |
|
---|
986 | @retval EFI_SUCCESS Alias created or deleted successfully.
|
---|
987 | @retval EFI_ACCESS_DENIED The alias is a built-in alias or already existed and Replace was set to
|
---|
988 | FALSE.
|
---|
989 | **/
|
---|
990 | typedef
|
---|
991 | EFI_STATUS
|
---|
992 | (EFIAPI *EFI_SHELL_SET_ALIAS)(
|
---|
993 | IN CONST CHAR16 *Command,
|
---|
994 | IN CONST CHAR16 *Alias,
|
---|
995 | IN BOOLEAN Replace,
|
---|
996 | IN BOOLEAN Volatile
|
---|
997 | );
|
---|
998 |
|
---|
999 | /**
|
---|
1000 | This function returns the command associated with a alias or a list of all
|
---|
1001 | alias'.
|
---|
1002 |
|
---|
1003 | @param[in] Alias Points to the NULL-terminated shell alias.
|
---|
1004 | If this parameter is NULL, then all
|
---|
1005 | aliases will be returned in ReturnedData.
|
---|
1006 | @param[out] Volatile Upon return of a single command if TRUE indicates
|
---|
1007 | this is stored in a volatile fashion. FALSE otherwise.
|
---|
1008 | @return If Alias is not NULL, it will return a pointer to
|
---|
1009 | the NULL-terminated command for that alias.
|
---|
1010 | If Alias is NULL, ReturnedData points to a ';'
|
---|
1011 | delimited list of alias (e.g.
|
---|
1012 | ReturnedData = "dir;del;copy;mfp") that is NULL-terminated.
|
---|
1013 | @retval NULL An error ocurred.
|
---|
1014 | @retval NULL Alias was not a valid Alias.
|
---|
1015 | **/
|
---|
1016 | typedef
|
---|
1017 | CONST CHAR16 *
|
---|
1018 | (EFIAPI *EFI_SHELL_GET_ALIAS)(
|
---|
1019 | IN CONST CHAR16 *Alias,
|
---|
1020 | OUT BOOLEAN *Volatile OPTIONAL
|
---|
1021 | );
|
---|
1022 |
|
---|
1023 | /**
|
---|
1024 | Changes the current directory on the specified device.
|
---|
1025 |
|
---|
1026 | If the FileSystem is NULL, and the directory Dir does not contain a file system's
|
---|
1027 | mapped name, this function changes the current working directory. If FileSystem is
|
---|
1028 | NULL and the directory Dir contains a mapped name, then the current file system and
|
---|
1029 | the current directory on that file system are changed.
|
---|
1030 |
|
---|
1031 | If FileSystem is not NULL, and Dir is NULL, then this changes the current working file
|
---|
1032 | system.
|
---|
1033 |
|
---|
1034 | If FileSystem is not NULL and Dir is not NULL, then this function changes the current
|
---|
1035 | directory on the specified file system.
|
---|
1036 |
|
---|
1037 | If the current working directory or the current working file system is changed then the
|
---|
1038 | %cwd% environment variable will be updated.
|
---|
1039 |
|
---|
1040 | @param[in] FileSystem A pointer to the file system's mapped name. If NULL, then the current working
|
---|
1041 | directory is changed.
|
---|
1042 | @param[in] Dir Points to the NULL-terminated directory on the device specified by FileSystem.
|
---|
1043 |
|
---|
1044 | @retval NULL Current directory does not exist.
|
---|
1045 | @return The current directory.
|
---|
1046 | **/
|
---|
1047 | typedef
|
---|
1048 | EFI_STATUS
|
---|
1049 | (EFIAPI *EFI_SHELL_SET_CUR_DIR) (
|
---|
1050 | IN CONST CHAR16 *FileSystem OPTIONAL,
|
---|
1051 | IN CONST CHAR16 *Dir
|
---|
1052 | );
|
---|
1053 |
|
---|
1054 | /**
|
---|
1055 | Sets the environment variable.
|
---|
1056 |
|
---|
1057 | This function changes the current value of the specified environment variable. If the
|
---|
1058 | environment variable exists and the Value is an empty string, then the environment
|
---|
1059 | variable is deleted. If the environment variable exists and the Value is not an empty
|
---|
1060 | string, then the value of the environment variable is changed. If the environment
|
---|
1061 | variable does not exist and the Value is an empty string, there is no action. If the
|
---|
1062 | environment variable does not exist and the Value is a non-empty string, then the
|
---|
1063 | environment variable is created and assigned the specified value.
|
---|
1064 |
|
---|
1065 | For a description of volatile and non-volatile environment variables, see UEFI Shell
|
---|
1066 | 2.0 specification section 3.6.1.
|
---|
1067 |
|
---|
1068 | @param[in] Name Points to the NULL-terminated environment variable name.
|
---|
1069 | @param[in] Value Points to the NULL-terminated environment variable value. If the value is an
|
---|
1070 | empty string then the environment variable is deleted.
|
---|
1071 | @param[in] Volatile Indicates whether the variable is non-volatile (FALSE) or volatile (TRUE).
|
---|
1072 |
|
---|
1073 | @retval EFI_SUCCESS The environment variable was successfully updated.
|
---|
1074 | **/
|
---|
1075 | typedef
|
---|
1076 | EFI_STATUS
|
---|
1077 | (EFIAPI *EFI_SHELL_SET_ENV) (
|
---|
1078 | IN CONST CHAR16 *Name,
|
---|
1079 | IN CONST CHAR16 *Value,
|
---|
1080 | IN BOOLEAN Volatile
|
---|
1081 | );
|
---|
1082 |
|
---|
1083 | /**
|
---|
1084 | Sets the file information to an opened file handle.
|
---|
1085 |
|
---|
1086 | This function changes file information. All file information in the EFI_FILE_INFO
|
---|
1087 | struct will be updated to the passed in data.
|
---|
1088 |
|
---|
1089 | @param[in] FileHandle A file handle.
|
---|
1090 | @param[in] FileInfo Points to new file information.
|
---|
1091 |
|
---|
1092 | @retval EFI_SUCCESS The information was set.
|
---|
1093 | @retval EFI_NO_MEDIA The device has no medium.
|
---|
1094 | @retval EFI_DEVICE_ERROR The device reported an error.
|
---|
1095 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
|
---|
1096 | @retval EFI_WRITE_PROTECTED The file or medium is write-protected.
|
---|
1097 | @retval EFI_ACCESS_DENIED The file was opened read-only.
|
---|
1098 | @retval EFI_VOLUME_FULL The volume is full.
|
---|
1099 | @retval EFI_BAD_BUFFER_SIZE BufferSize is smaller than the size of EFI_FILE_INFO.
|
---|
1100 | **/
|
---|
1101 | typedef
|
---|
1102 | EFI_STATUS
|
---|
1103 | (EFIAPI *EFI_SHELL_SET_FILE_INFO)(
|
---|
1104 | IN SHELL_FILE_HANDLE FileHandle,
|
---|
1105 | IN CONST EFI_FILE_INFO *FileInfo
|
---|
1106 | );
|
---|
1107 |
|
---|
1108 | /**
|
---|
1109 | Sets a file's current position.
|
---|
1110 |
|
---|
1111 | This function sets the current file position for the handle to the position supplied. With
|
---|
1112 | the exception of seeking to position 0xFFFFFFFFFFFFFFFF, only absolute positioning is
|
---|
1113 | supported, and seeking past the end of the file is allowed (a subsequent write would
|
---|
1114 | grow the file). Seeking to position 0xFFFFFFFFFFFFFFFF causes the current position
|
---|
1115 | to be set to the end of the file.
|
---|
1116 |
|
---|
1117 | @param[in] FileHandle The file handle on which requested position will be set.
|
---|
1118 | @param[in] Position Byte position from the start of the file.
|
---|
1119 |
|
---|
1120 | @retval EFI_SUCCESS Data was written.
|
---|
1121 | @retval EFI_UNSUPPORTED The seek request for nonzero is not valid on open directories.
|
---|
1122 | **/
|
---|
1123 | typedef
|
---|
1124 | EFI_STATUS
|
---|
1125 | (EFIAPI *EFI_SHELL_SET_FILE_POSITION)(
|
---|
1126 | IN SHELL_FILE_HANDLE FileHandle,
|
---|
1127 | IN UINT64 Position
|
---|
1128 | );
|
---|
1129 |
|
---|
1130 | /**
|
---|
1131 | This function creates a mapping for a device path.
|
---|
1132 |
|
---|
1133 | @param[in] DevicePath Points to the device path. If this is NULL and Mapping points to a valid mapping,
|
---|
1134 | then the mapping will be deleted.
|
---|
1135 | @param[in] Mapping Points to the NULL-terminated mapping for the device path.
|
---|
1136 |
|
---|
1137 | @retval EFI_SUCCESS Mapping created or deleted successfully.
|
---|
1138 | @retval EFI_NO_MAPPING There is no handle that corresponds exactly to DevicePath. See the
|
---|
1139 | boot service function LocateDevicePath().
|
---|
1140 | @retval EFI_ACCESS_DENIED The mapping is a built-in alias.
|
---|
1141 | **/
|
---|
1142 | typedef
|
---|
1143 | EFI_STATUS
|
---|
1144 | (EFIAPI *EFI_SHELL_SET_MAP)(
|
---|
1145 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
---|
1146 | IN CONST CHAR16 *Mapping
|
---|
1147 | );
|
---|
1148 |
|
---|
1149 | /**
|
---|
1150 | Writes data to the file.
|
---|
1151 |
|
---|
1152 | This function writes the specified number of bytes to the file at the current file position.
|
---|
1153 | The current file position is advanced the actual number of bytes written, which is
|
---|
1154 | returned in BufferSize. Partial writes only occur when there has been a data error
|
---|
1155 | during the write attempt (such as "volume space full"). The file automatically grows to
|
---|
1156 | hold the data, if required.
|
---|
1157 |
|
---|
1158 | Direct writes to opened directories are not supported.
|
---|
1159 |
|
---|
1160 | @param[in] FileHandle The opened file handle for writing.
|
---|
1161 | @param[in, out] BufferSize On input, size of Buffer.
|
---|
1162 | @param[in] Buffer The buffer in which data to write.
|
---|
1163 |
|
---|
1164 | @retval EFI_SUCCESS Data was written.
|
---|
1165 | @retval EFI_UNSUPPORTED Writes to open directory are not supported.
|
---|
1166 | @retval EFI_NO_MEDIA The device has no media.
|
---|
1167 | @retval EFI_DEVICE_ERROR The device reported an error.
|
---|
1168 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
|
---|
1169 | @retval EFI_WRITE_PROTECTED The device is write-protected.
|
---|
1170 | @retval EFI_ACCESS_DENIED The file was open for read only.
|
---|
1171 | @retval EFI_VOLUME_FULL The volume is full.
|
---|
1172 | **/
|
---|
1173 | typedef
|
---|
1174 | EFI_STATUS
|
---|
1175 | (EFIAPI *EFI_SHELL_WRITE_FILE)(
|
---|
1176 | IN SHELL_FILE_HANDLE FileHandle,
|
---|
1177 | IN OUT UINTN *BufferSize,
|
---|
1178 | IN VOID *Buffer
|
---|
1179 | );
|
---|
1180 |
|
---|
1181 | //
|
---|
1182 | // EFI_SHELL_PROTOCOL has been updated since UEFI Shell Spec 2.0
|
---|
1183 | // Usage of this protocol will require version checking before attempting
|
---|
1184 | // to use any new members. There is no need to check the version for
|
---|
1185 | // members that existed in UEFI Shell Spec 2.0.
|
---|
1186 | //
|
---|
1187 | // Update below for any future UEFI Shell spec changes to this protocol.
|
---|
1188 | //
|
---|
1189 | // Check EFI_SHELL_PROTOCOL MajorVersion and MinorVersion:
|
---|
1190 | // if ((2 == gEfiShellProtocol->MajorVersion) &&
|
---|
1191 | // (0 == gEfiShellProtocol->MinorVersion)) {
|
---|
1192 | // //
|
---|
1193 | // // Cannot call:
|
---|
1194 | // // RegisterGuidName - UEFI Shell 2.1
|
---|
1195 | // // GetGuidName - UEFI Shell 2.1
|
---|
1196 | // // GetGuidFromName - UEFI Shell 2.1
|
---|
1197 | // // GetEnvEx - UEFI Shell 2.1
|
---|
1198 | // //
|
---|
1199 | // } else {
|
---|
1200 | // //
|
---|
1201 | // // Can use all members
|
---|
1202 | // //
|
---|
1203 | // }
|
---|
1204 | //
|
---|
1205 | typedef struct _EFI_SHELL_PROTOCOL {
|
---|
1206 | EFI_SHELL_EXECUTE Execute;
|
---|
1207 | EFI_SHELL_GET_ENV GetEnv;
|
---|
1208 | EFI_SHELL_SET_ENV SetEnv;
|
---|
1209 | EFI_SHELL_GET_ALIAS GetAlias;
|
---|
1210 | EFI_SHELL_SET_ALIAS SetAlias;
|
---|
1211 | EFI_SHELL_GET_HELP_TEXT GetHelpText;
|
---|
1212 | EFI_SHELL_GET_DEVICE_PATH_FROM_MAP GetDevicePathFromMap;
|
---|
1213 | EFI_SHELL_GET_MAP_FROM_DEVICE_PATH GetMapFromDevicePath;
|
---|
1214 | EFI_SHELL_GET_DEVICE_PATH_FROM_FILE_PATH GetDevicePathFromFilePath;
|
---|
1215 | EFI_SHELL_GET_FILE_PATH_FROM_DEVICE_PATH GetFilePathFromDevicePath;
|
---|
1216 | EFI_SHELL_SET_MAP SetMap;
|
---|
1217 | EFI_SHELL_GET_CUR_DIR GetCurDir;
|
---|
1218 | EFI_SHELL_SET_CUR_DIR SetCurDir;
|
---|
1219 | EFI_SHELL_OPEN_FILE_LIST OpenFileList;
|
---|
1220 | EFI_SHELL_FREE_FILE_LIST FreeFileList;
|
---|
1221 | EFI_SHELL_REMOVE_DUP_IN_FILE_LIST RemoveDupInFileList;
|
---|
1222 | EFI_SHELL_BATCH_IS_ACTIVE BatchIsActive;
|
---|
1223 | EFI_SHELL_IS_ROOT_SHELL IsRootShell;
|
---|
1224 | EFI_SHELL_ENABLE_PAGE_BREAK EnablePageBreak;
|
---|
1225 | EFI_SHELL_DISABLE_PAGE_BREAK DisablePageBreak;
|
---|
1226 | EFI_SHELL_GET_PAGE_BREAK GetPageBreak;
|
---|
1227 | EFI_SHELL_GET_DEVICE_NAME GetDeviceName;
|
---|
1228 | EFI_SHELL_GET_FILE_INFO GetFileInfo;
|
---|
1229 | EFI_SHELL_SET_FILE_INFO SetFileInfo;
|
---|
1230 | EFI_SHELL_OPEN_FILE_BY_NAME OpenFileByName;
|
---|
1231 | EFI_SHELL_CLOSE_FILE CloseFile;
|
---|
1232 | EFI_SHELL_CREATE_FILE CreateFile;
|
---|
1233 | EFI_SHELL_READ_FILE ReadFile;
|
---|
1234 | EFI_SHELL_WRITE_FILE WriteFile;
|
---|
1235 | EFI_SHELL_DELETE_FILE DeleteFile;
|
---|
1236 | EFI_SHELL_DELETE_FILE_BY_NAME DeleteFileByName;
|
---|
1237 | EFI_SHELL_GET_FILE_POSITION GetFilePosition;
|
---|
1238 | EFI_SHELL_SET_FILE_POSITION SetFilePosition;
|
---|
1239 | EFI_SHELL_FLUSH_FILE FlushFile;
|
---|
1240 | EFI_SHELL_FIND_FILES FindFiles;
|
---|
1241 | EFI_SHELL_FIND_FILES_IN_DIR FindFilesInDir;
|
---|
1242 | EFI_SHELL_GET_FILE_SIZE GetFileSize;
|
---|
1243 | EFI_SHELL_OPEN_ROOT OpenRoot;
|
---|
1244 | EFI_SHELL_OPEN_ROOT_BY_HANDLE OpenRootByHandle;
|
---|
1245 | EFI_EVENT ExecutionBreak;
|
---|
1246 | UINT32 MajorVersion;
|
---|
1247 | UINT32 MinorVersion;
|
---|
1248 | // Added for Shell 2.1
|
---|
1249 | EFI_SHELL_REGISTER_GUID_NAME RegisterGuidName;
|
---|
1250 | EFI_SHELL_GET_GUID_NAME GetGuidName;
|
---|
1251 | EFI_SHELL_GET_GUID_FROM_NAME GetGuidFromName;
|
---|
1252 | EFI_SHELL_GET_ENV_EX GetEnvEx;
|
---|
1253 | } EFI_SHELL_PROTOCOL;
|
---|
1254 |
|
---|
1255 | extern EFI_GUID gEfiShellProtocolGuid;
|
---|
1256 |
|
---|
1257 | enum ShellVersion {
|
---|
1258 | SHELL_MAJOR_VERSION = 2,
|
---|
1259 | SHELL_MINOR_VERSION = 2
|
---|
1260 | };
|
---|
1261 |
|
---|
1262 | #endif
|
---|