xref: /DragonStub/inc/efishell.h (revision 2a1200f36faf0d67c7150686e44c578c19a897ef)
12b26c811SJiaqing Zhao /**
22b26c811SJiaqing Zhao   EFI Shell protocol as defined in the UEFI Shell Specification 2.2.
32b26c811SJiaqing Zhao 
42b26c811SJiaqing Zhao   (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
52b26c811SJiaqing Zhao   Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
62b26c811SJiaqing Zhao   SPDX-License-Identifier: BSD-2-Clause-Patent
72b26c811SJiaqing Zhao 
82b26c811SJiaqing Zhao   This file is based on MdePkg/Include/Protocol/Shell.h from EDK2
92b26c811SJiaqing Zhao   Ported to gnu-efi by Jiaqing Zhao <jiaqing.zhao@intel.com>
102b26c811SJiaqing Zhao **/
112b26c811SJiaqing Zhao 
122b26c811SJiaqing Zhao #ifndef _EFI_SHELL_H
132b26c811SJiaqing Zhao #define _EFI_SHELL_H
142b26c811SJiaqing Zhao 
152b26c811SJiaqing Zhao #include "efilink.h"
162b26c811SJiaqing Zhao 
172b26c811SJiaqing Zhao #define EFI_SHELL_PROTOCOL_GUID \
182b26c811SJiaqing Zhao     { 0x6302d008, 0x7f9b, 0x4f30, { 0x87, 0xac, 0x60, 0xc9, 0xfe, 0xf5, 0xda, 0x4e } }
192b26c811SJiaqing Zhao 
202b26c811SJiaqing Zhao INTERFACE_DECL(_EFI_SHELL_PROTOCOL);
212b26c811SJiaqing Zhao 
222b26c811SJiaqing Zhao typedef enum {
232b26c811SJiaqing Zhao     SHELL_SUCCESS              = 0,
242b26c811SJiaqing Zhao     SHELL_LOAD_ERROR           = 1,
252b26c811SJiaqing Zhao     SHELL_INVALID_PARAMETER    = 2,
262b26c811SJiaqing Zhao     SHELL_UNSUPPORTED          = 3,
272b26c811SJiaqing Zhao     SHELL_BAD_BUFFER_SIZE      = 4,
282b26c811SJiaqing Zhao     SHELL_BUFFER_TOO_SMALL     = 5,
292b26c811SJiaqing Zhao     SHELL_NOT_READY            = 6,
302b26c811SJiaqing Zhao     SHELL_DEVICE_ERROR         = 7,
312b26c811SJiaqing Zhao     SHELL_WRITE_PROTECTED      = 8,
322b26c811SJiaqing Zhao     SHELL_OUT_OF_RESOURCES     = 9,
332b26c811SJiaqing Zhao     SHELL_VOLUME_CORRUPTED     = 10,
342b26c811SJiaqing Zhao     SHELL_VOLUME_FULL          = 11,
352b26c811SJiaqing Zhao     SHELL_NO_MEDIA             = 12,
362b26c811SJiaqing Zhao     SHELL_MEDIA_CHANGED        = 13,
372b26c811SJiaqing Zhao     SHELL_NOT_FOUND            = 14,
382b26c811SJiaqing Zhao     SHELL_ACCESS_DENIED        = 15,
392b26c811SJiaqing Zhao     SHELL_TIMEOUT              = 18,
402b26c811SJiaqing Zhao     SHELL_NOT_STARTED          = 19,
412b26c811SJiaqing Zhao     SHELL_ALREADY_STARTED      = 20,
422b26c811SJiaqing Zhao     SHELL_ABORTED              = 21,
432b26c811SJiaqing Zhao     SHELL_INCOMPATIBLE_VERSION = 25,
442b26c811SJiaqing Zhao     SHELL_SECURITY_VIOLATION   = 26,
452b26c811SJiaqing Zhao     SHELL_NOT_EQUAL            = 27
462b26c811SJiaqing Zhao } SHELL_STATUS;
472b26c811SJiaqing Zhao 
482b26c811SJiaqing Zhao typedef VOID *SHELL_FILE_HANDLE;
492b26c811SJiaqing Zhao 
502b26c811SJiaqing Zhao typedef struct {
512b26c811SJiaqing Zhao     EFI_LIST_ENTRY    Link;
522b26c811SJiaqing Zhao     EFI_STATUS        Status;
532b26c811SJiaqing Zhao     CONST CHAR16      *FullName;
542b26c811SJiaqing Zhao     CONST CHAR16      *FileName;
552b26c811SJiaqing Zhao     SHELL_FILE_HANDLE Handle;
562b26c811SJiaqing Zhao     EFI_FILE_INFO     *Info;
572b26c811SJiaqing Zhao } EFI_SHELL_FILE_INFO;
582b26c811SJiaqing Zhao 
592b26c811SJiaqing Zhao typedef
602b26c811SJiaqing Zhao BOOLEAN
612b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_BATCH_IS_ACTIVE) (
622b26c811SJiaqing Zhao     VOID
632b26c811SJiaqing Zhao     );
642b26c811SJiaqing Zhao 
652b26c811SJiaqing Zhao typedef
662b26c811SJiaqing Zhao EFI_STATUS
672b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_CLOSE_FILE) (
682b26c811SJiaqing Zhao     IN SHELL_FILE_HANDLE FileHandle
692b26c811SJiaqing Zhao     );
702b26c811SJiaqing Zhao 
712b26c811SJiaqing Zhao typedef
722b26c811SJiaqing Zhao EFI_STATUS
732b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_CREATE_FILE) (
742b26c811SJiaqing Zhao     IN CONST CHAR16       *FileName,
752b26c811SJiaqing Zhao     IN UINT64             FileAttribs,
762b26c811SJiaqing Zhao     OUT SHELL_FILE_HANDLE *FileHandle
772b26c811SJiaqing Zhao     );
782b26c811SJiaqing Zhao 
792b26c811SJiaqing Zhao typedef
802b26c811SJiaqing Zhao EFI_STATUS
812b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_DELETE_FILE) (
822b26c811SJiaqing Zhao     IN SHELL_FILE_HANDLE FileHandle
832b26c811SJiaqing Zhao     );
842b26c811SJiaqing Zhao 
852b26c811SJiaqing Zhao typedef
862b26c811SJiaqing Zhao EFI_STATUS
872b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_DELETE_FILE_BY_NAME) (
882b26c811SJiaqing Zhao     IN CONST CHAR16 *FileName
892b26c811SJiaqing Zhao     );
902b26c811SJiaqing Zhao 
912b26c811SJiaqing Zhao typedef
922b26c811SJiaqing Zhao VOID
932b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_DISABLE_PAGE_BREAK) (
942b26c811SJiaqing Zhao     VOID
952b26c811SJiaqing Zhao     );
962b26c811SJiaqing Zhao 
972b26c811SJiaqing Zhao typedef
982b26c811SJiaqing Zhao VOID
992b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_ENABLE_PAGE_BREAK) (
1002b26c811SJiaqing Zhao     VOID
1012b26c811SJiaqing Zhao     );
1022b26c811SJiaqing Zhao 
1032b26c811SJiaqing Zhao typedef
1042b26c811SJiaqing Zhao EFI_STATUS
1052b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_EXECUTE) (
1062b26c811SJiaqing Zhao     IN EFI_HANDLE  *ParentImageHandle,
1072b26c811SJiaqing Zhao     IN CHAR16      *CommandLine OPTIONAL,
1082b26c811SJiaqing Zhao     IN CHAR16      **Environment OPTIONAL,
1092b26c811SJiaqing Zhao     OUT EFI_STATUS *StatusCode OPTIONAL
1102b26c811SJiaqing Zhao     );
1112b26c811SJiaqing Zhao 
1122b26c811SJiaqing Zhao typedef
1132b26c811SJiaqing Zhao EFI_STATUS
1142b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_FIND_FILES) (
1152b26c811SJiaqing Zhao     IN CONST CHAR16         *FilePattern,
1162b26c811SJiaqing Zhao     OUT EFI_SHELL_FILE_INFO **FileList
1172b26c811SJiaqing Zhao     );
1182b26c811SJiaqing Zhao 
1192b26c811SJiaqing Zhao typedef
1202b26c811SJiaqing Zhao EFI_STATUS
1212b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_FIND_FILES_IN_DIR) (
1222b26c811SJiaqing Zhao     IN SHELL_FILE_HANDLE    FileDirHandle,
1232b26c811SJiaqing Zhao     OUT EFI_SHELL_FILE_INFO **FileList
1242b26c811SJiaqing Zhao     );
1252b26c811SJiaqing Zhao 
1262b26c811SJiaqing Zhao typedef
1272b26c811SJiaqing Zhao EFI_STATUS
1282b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_FLUSH_FILE) (
1292b26c811SJiaqing Zhao     IN SHELL_FILE_HANDLE FileHandle
1302b26c811SJiaqing Zhao     );
1312b26c811SJiaqing Zhao 
1322b26c811SJiaqing Zhao typedef
1332b26c811SJiaqing Zhao EFI_STATUS
1342b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_FREE_FILE_LIST) (
1352b26c811SJiaqing Zhao     IN EFI_SHELL_FILE_INFO **FileList
1362b26c811SJiaqing Zhao     );
1372b26c811SJiaqing Zhao 
1382b26c811SJiaqing Zhao typedef
1392b26c811SJiaqing Zhao CONST CHAR16 *
1402b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_GET_ALIAS) (
1412b26c811SJiaqing Zhao   IN  CONST CHAR16 *Alias,
1422b26c811SJiaqing Zhao   OUT BOOLEAN      *Volatile OPTIONAL
1432b26c811SJiaqing Zhao   );
1442b26c811SJiaqing Zhao 
1452b26c811SJiaqing Zhao typedef
1462b26c811SJiaqing Zhao CONST CHAR16 *
1472b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_GET_CUR_DIR) (
1482b26c811SJiaqing Zhao   IN CONST CHAR16 *FileSystemMapping OPTIONAL
1492b26c811SJiaqing Zhao   );
1502b26c811SJiaqing Zhao 
1512b26c811SJiaqing Zhao typedef UINT32 EFI_SHELL_DEVICE_NAME_FLAGS;
1522b26c811SJiaqing Zhao #define EFI_DEVICE_NAME_USE_COMPONENT_NAME 0x00000001
1532b26c811SJiaqing Zhao #define EFI_DEVICE_NAME_USE_DEVICE_PATH    0x00000002
1542b26c811SJiaqing Zhao 
1552b26c811SJiaqing Zhao typedef
1562b26c811SJiaqing Zhao EFI_STATUS
1572b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_GET_DEVICE_NAME) (
1582b26c811SJiaqing Zhao     IN EFI_HANDLE                   DeviceHandle,
1592b26c811SJiaqing Zhao     IN EFI_SHELL_DEVICE_NAME_FLAGS  Flags,
1602b26c811SJiaqing Zhao     IN CHAR8                        *Language,
1612b26c811SJiaqing Zhao     OUT CHAR16                      **BestDeviceName
1622b26c811SJiaqing Zhao     );
1632b26c811SJiaqing Zhao 
1642b26c811SJiaqing Zhao typedef
1652b26c811SJiaqing Zhao CONST EFI_DEVICE_PATH_PROTOCOL *
1662b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_GET_DEVICE_PATH_FROM_MAP) (
1672b26c811SJiaqing Zhao     IN CONST CHAR16 *Mapping
1682b26c811SJiaqing Zhao     );
1692b26c811SJiaqing Zhao 
1702b26c811SJiaqing Zhao typedef
1712b26c811SJiaqing Zhao EFI_DEVICE_PATH_PROTOCOL *
1722b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_GET_DEVICE_PATH_FROM_FILE_PATH) (
1732b26c811SJiaqing Zhao     IN CONST CHAR16 *Path
1742b26c811SJiaqing Zhao     );
1752b26c811SJiaqing Zhao 
1762b26c811SJiaqing Zhao typedef
1772b26c811SJiaqing Zhao CONST CHAR16 *
1782b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_GET_ENV) (
1792b26c811SJiaqing Zhao     IN CONST CHAR16 *Name
1802b26c811SJiaqing Zhao     );
1812b26c811SJiaqing Zhao 
1822b26c811SJiaqing Zhao typedef
1832b26c811SJiaqing Zhao CONST CHAR16 *
1842b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_GET_ENV_EX) (
1852b26c811SJiaqing Zhao     IN CONST CHAR16 *Name,
1862b26c811SJiaqing Zhao     OUT UINT32      *Attributes OPTIONAL
1872b26c811SJiaqing Zhao     );
1882b26c811SJiaqing Zhao 
1892b26c811SJiaqing Zhao typedef
1902b26c811SJiaqing Zhao EFI_FILE_INFO *
1912b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_GET_FILE_INFO) (
1922b26c811SJiaqing Zhao     IN SHELL_FILE_HANDLE FileHandle
1932b26c811SJiaqing Zhao     );
1942b26c811SJiaqing Zhao 
1952b26c811SJiaqing Zhao typedef
1962b26c811SJiaqing Zhao CHAR16 *
1972b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_GET_FILE_PATH_FROM_DEVICE_PATH) (
1982b26c811SJiaqing Zhao     IN CONST EFI_DEVICE_PATH_PROTOCOL *Path
1992b26c811SJiaqing Zhao     );
2002b26c811SJiaqing Zhao 
2012b26c811SJiaqing Zhao typedef
2022b26c811SJiaqing Zhao EFI_STATUS
2032b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_GET_FILE_POSITION) (
2042b26c811SJiaqing Zhao     IN SHELL_FILE_HANDLE FileHandle,
2052b26c811SJiaqing Zhao     OUT UINT64           *Position
2062b26c811SJiaqing Zhao     );
2072b26c811SJiaqing Zhao 
2082b26c811SJiaqing Zhao typedef
2092b26c811SJiaqing Zhao EFI_STATUS
2102b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_GET_FILE_SIZE) (
2112b26c811SJiaqing Zhao     IN SHELL_FILE_HANDLE FileHandle,
2122b26c811SJiaqing Zhao     OUT UINT64           *Size
2132b26c811SJiaqing Zhao     );
2142b26c811SJiaqing Zhao 
2152b26c811SJiaqing Zhao typedef
2162b26c811SJiaqing Zhao EFI_STATUS
2172b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_GET_GUID_FROM_NAME) (
2182b26c811SJiaqing Zhao     IN CONST CHAR16 *GuidName,
2192b26c811SJiaqing Zhao     OUT EFI_GUID    *Guid
2202b26c811SJiaqing Zhao     );
2212b26c811SJiaqing Zhao 
2222b26c811SJiaqing Zhao typedef
2232b26c811SJiaqing Zhao EFI_STATUS
2242b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_GET_GUID_NAME)(
2252b26c811SJiaqing Zhao     IN CONST EFI_GUID *Guid,
2262b26c811SJiaqing Zhao     OUT CONST CHAR16  **GuidName
2272b26c811SJiaqing Zhao     );
2282b26c811SJiaqing Zhao 
2292b26c811SJiaqing Zhao typedef
2302b26c811SJiaqing Zhao EFI_STATUS
2312b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_GET_HELP_TEXT) (
2322b26c811SJiaqing Zhao     IN CONST CHAR16 *Command,
2332b26c811SJiaqing Zhao     IN CONST CHAR16 *Sections,
2342b26c811SJiaqing Zhao     OUT CHAR16      **HelpText
2352b26c811SJiaqing Zhao     );
2362b26c811SJiaqing Zhao 
2372b26c811SJiaqing Zhao typedef
2382b26c811SJiaqing Zhao CONST CHAR16 *
2392b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_GET_MAP_FROM_DEVICE_PATH) (
2402b26c811SJiaqing Zhao     IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
2412b26c811SJiaqing Zhao     );
2422b26c811SJiaqing Zhao 
2432b26c811SJiaqing Zhao typedef
2442b26c811SJiaqing Zhao BOOLEAN
2452b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_GET_PAGE_BREAK) (
2462b26c811SJiaqing Zhao     VOID
2472b26c811SJiaqing Zhao     );
2482b26c811SJiaqing Zhao 
2492b26c811SJiaqing Zhao typedef
2502b26c811SJiaqing Zhao BOOLEAN
2512b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_IS_ROOT_SHELL) (
2522b26c811SJiaqing Zhao     VOID
2532b26c811SJiaqing Zhao     );
2542b26c811SJiaqing Zhao 
2552b26c811SJiaqing Zhao typedef
2562b26c811SJiaqing Zhao EFI_STATUS
2572b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_OPEN_FILE_BY_NAME) (
2582b26c811SJiaqing Zhao     IN CONST CHAR16       *FileName,
2592b26c811SJiaqing Zhao     OUT SHELL_FILE_HANDLE *FileHandle,
2602b26c811SJiaqing Zhao     IN UINT64             OpenMode
2612b26c811SJiaqing Zhao     );
2622b26c811SJiaqing Zhao 
2632b26c811SJiaqing Zhao typedef
2642b26c811SJiaqing Zhao EFI_STATUS
2652b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_OPEN_FILE_LIST) (
2662b26c811SJiaqing Zhao     IN CHAR16                  *Path,
2672b26c811SJiaqing Zhao     IN UINT64                  OpenMode,
2682b26c811SJiaqing Zhao     IN OUT EFI_SHELL_FILE_INFO **FileList
2692b26c811SJiaqing Zhao     );
2702b26c811SJiaqing Zhao 
2712b26c811SJiaqing Zhao typedef
2722b26c811SJiaqing Zhao EFI_STATUS
2732b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_OPEN_ROOT) (
2742b26c811SJiaqing Zhao     IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
2752b26c811SJiaqing Zhao     OUT SHELL_FILE_HANDLE       *FileHandle
2762b26c811SJiaqing Zhao     );
2772b26c811SJiaqing Zhao 
2782b26c811SJiaqing Zhao typedef
2792b26c811SJiaqing Zhao EFI_STATUS
2802b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_OPEN_ROOT_BY_HANDLE) (
2812b26c811SJiaqing Zhao     IN EFI_HANDLE         DeviceHandle,
2822b26c811SJiaqing Zhao     OUT SHELL_FILE_HANDLE *FileHandle
2832b26c811SJiaqing Zhao     );
2842b26c811SJiaqing Zhao 
2852b26c811SJiaqing Zhao typedef
2862b26c811SJiaqing Zhao EFI_STATUS
2872b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_READ_FILE) (
2882b26c811SJiaqing Zhao     IN SHELL_FILE_HANDLE FileHandle,
2892b26c811SJiaqing Zhao     IN OUT UINTN         *ReadSize,
2902b26c811SJiaqing Zhao     IN OUT VOID          *Buffer
2912b26c811SJiaqing Zhao     );
2922b26c811SJiaqing Zhao 
2932b26c811SJiaqing Zhao typedef
2942b26c811SJiaqing Zhao EFI_STATUS
2952b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_REGISTER_GUID_NAME) (
2962b26c811SJiaqing Zhao     IN CONST EFI_GUID *Guid,
2972b26c811SJiaqing Zhao     IN CONST CHAR16   *GuidName
2982b26c811SJiaqing Zhao     );
2992b26c811SJiaqing Zhao 
3002b26c811SJiaqing Zhao typedef
3012b26c811SJiaqing Zhao EFI_STATUS
3022b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_REMOVE_DUP_IN_FILE_LIST) (
3032b26c811SJiaqing Zhao     IN EFI_SHELL_FILE_INFO **FileList
3042b26c811SJiaqing Zhao     );
3052b26c811SJiaqing Zhao 
3062b26c811SJiaqing Zhao typedef
3072b26c811SJiaqing Zhao EFI_STATUS
3082b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_SET_ALIAS) (
3092b26c811SJiaqing Zhao     IN CONST CHAR16 *Command,
3102b26c811SJiaqing Zhao     IN CONST CHAR16 *Alias,
3112b26c811SJiaqing Zhao     IN BOOLEAN      Replace,
3122b26c811SJiaqing Zhao     IN BOOLEAN      Volatile
3132b26c811SJiaqing Zhao     );
3142b26c811SJiaqing Zhao 
3152b26c811SJiaqing Zhao typedef
3162b26c811SJiaqing Zhao EFI_STATUS
3172b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_SET_CUR_DIR) (
3182b26c811SJiaqing Zhao     IN CONST CHAR16 *FileSystem OPTIONAL,
3192b26c811SJiaqing Zhao     IN CONST CHAR16 *Dir
3202b26c811SJiaqing Zhao     );
3212b26c811SJiaqing Zhao 
3222b26c811SJiaqing Zhao typedef
3232b26c811SJiaqing Zhao EFI_STATUS
3242b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_SET_ENV) (
3252b26c811SJiaqing Zhao     IN CONST CHAR16 *Name,
3262b26c811SJiaqing Zhao     IN CONST CHAR16 *Value,
3272b26c811SJiaqing Zhao     IN BOOLEAN      Volatile
3282b26c811SJiaqing Zhao     );
3292b26c811SJiaqing Zhao 
3302b26c811SJiaqing Zhao typedef
3312b26c811SJiaqing Zhao EFI_STATUS
3322b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_SET_FILE_INFO) (
3332b26c811SJiaqing Zhao     IN SHELL_FILE_HANDLE   FileHandle,
3342b26c811SJiaqing Zhao     IN CONST EFI_FILE_INFO *FileInfo
3352b26c811SJiaqing Zhao     );
3362b26c811SJiaqing Zhao 
3372b26c811SJiaqing Zhao typedef
3382b26c811SJiaqing Zhao EFI_STATUS
3392b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_SET_FILE_POSITION) (
3402b26c811SJiaqing Zhao     IN SHELL_FILE_HANDLE FileHandle,
3412b26c811SJiaqing Zhao     IN UINT64            Position
3422b26c811SJiaqing Zhao     );
3432b26c811SJiaqing Zhao 
3442b26c811SJiaqing Zhao typedef
3452b26c811SJiaqing Zhao EFI_STATUS
3462b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_SET_MAP) (
3472b26c811SJiaqing Zhao     IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
3482b26c811SJiaqing Zhao     IN CONST CHAR16                   *Mapping
3492b26c811SJiaqing Zhao     );
3502b26c811SJiaqing Zhao 
3512b26c811SJiaqing Zhao typedef
3522b26c811SJiaqing Zhao EFI_STATUS
3532b26c811SJiaqing Zhao (EFIAPI *EFI_SHELL_WRITE_FILE) (
3542b26c811SJiaqing Zhao     IN SHELL_FILE_HANDLE FileHandle,
3552b26c811SJiaqing Zhao     IN OUT UINTN         *BufferSize,
3562b26c811SJiaqing Zhao     IN VOID              *Buffer
3572b26c811SJiaqing Zhao     );
3582b26c811SJiaqing Zhao 
3592b26c811SJiaqing Zhao typedef struct _EFI_SHELL_PROTOCOL {
3602b26c811SJiaqing Zhao     EFI_SHELL_EXECUTE                         Execute;
3612b26c811SJiaqing Zhao     EFI_SHELL_GET_ENV                         GetEnv;
3622b26c811SJiaqing Zhao     EFI_SHELL_SET_ENV                         SetEnv;
3632b26c811SJiaqing Zhao     EFI_SHELL_GET_ALIAS                       GetAlias;
3642b26c811SJiaqing Zhao     EFI_SHELL_SET_ALIAS                       SetAlias;
3652b26c811SJiaqing Zhao     EFI_SHELL_GET_HELP_TEXT                   GetHelpText;
3662b26c811SJiaqing Zhao     EFI_SHELL_GET_DEVICE_PATH_FROM_MAP        GetDevicePathFromMap;
3672b26c811SJiaqing Zhao     EFI_SHELL_GET_MAP_FROM_DEVICE_PATH        GetMapFromDevicePath;
3682b26c811SJiaqing Zhao     EFI_SHELL_GET_DEVICE_PATH_FROM_FILE_PATH  GetDevicePathFromFilePath;
3692b26c811SJiaqing Zhao     EFI_SHELL_GET_FILE_PATH_FROM_DEVICE_PATH  GetFilePathFromDevicePath;
3702b26c811SJiaqing Zhao     EFI_SHELL_SET_MAP                         SetMap;
3712b26c811SJiaqing Zhao     EFI_SHELL_GET_CUR_DIR                     GetCurDir;
3722b26c811SJiaqing Zhao     EFI_SHELL_SET_CUR_DIR                     SetCurDir;
3732b26c811SJiaqing Zhao     EFI_SHELL_OPEN_FILE_LIST                  OpenFileList;
3742b26c811SJiaqing Zhao     EFI_SHELL_FREE_FILE_LIST                  FreeFileList;
3752b26c811SJiaqing Zhao     EFI_SHELL_REMOVE_DUP_IN_FILE_LIST         RemoveDupInFileList;
3762b26c811SJiaqing Zhao     EFI_SHELL_BATCH_IS_ACTIVE                 BatchIsActive;
3772b26c811SJiaqing Zhao     EFI_SHELL_IS_ROOT_SHELL                   IsRootShell;
3782b26c811SJiaqing Zhao     EFI_SHELL_ENABLE_PAGE_BREAK               EnablePageBreak;
3792b26c811SJiaqing Zhao     EFI_SHELL_DISABLE_PAGE_BREAK              DisablePageBreak;
3802b26c811SJiaqing Zhao     EFI_SHELL_GET_PAGE_BREAK                  GetPageBreak;
3812b26c811SJiaqing Zhao     EFI_SHELL_GET_DEVICE_NAME                 GetDeviceName;
3822b26c811SJiaqing Zhao     EFI_SHELL_GET_FILE_INFO                   GetFileInfo;
3832b26c811SJiaqing Zhao     EFI_SHELL_SET_FILE_INFO                   SetFileInfo;
3842b26c811SJiaqing Zhao     EFI_SHELL_OPEN_FILE_BY_NAME               OpenFileByName;
3852b26c811SJiaqing Zhao     EFI_SHELL_CLOSE_FILE                      CloseFile;
3862b26c811SJiaqing Zhao     EFI_SHELL_CREATE_FILE                     CreateFile;
3872b26c811SJiaqing Zhao     EFI_SHELL_READ_FILE                       ReadFile;
3882b26c811SJiaqing Zhao     EFI_SHELL_WRITE_FILE                      WriteFile;
3892b26c811SJiaqing Zhao     EFI_SHELL_DELETE_FILE                     DeleteFile;
3902b26c811SJiaqing Zhao     EFI_SHELL_DELETE_FILE_BY_NAME             DeleteFileByName;
3912b26c811SJiaqing Zhao     EFI_SHELL_GET_FILE_POSITION               GetFilePosition;
3922b26c811SJiaqing Zhao     EFI_SHELL_SET_FILE_POSITION               SetFilePosition;
3932b26c811SJiaqing Zhao     EFI_SHELL_FLUSH_FILE                      FlushFile;
3942b26c811SJiaqing Zhao     EFI_SHELL_FIND_FILES                      FindFiles;
3952b26c811SJiaqing Zhao     EFI_SHELL_FIND_FILES_IN_DIR               FindFilesInDir;
3962b26c811SJiaqing Zhao     EFI_SHELL_GET_FILE_SIZE                   GetFileSize;
3972b26c811SJiaqing Zhao     EFI_SHELL_OPEN_ROOT                       OpenRoot;
3982b26c811SJiaqing Zhao     EFI_SHELL_OPEN_ROOT_BY_HANDLE             OpenRootByHandle;
3992b26c811SJiaqing Zhao     EFI_EVENT                                 ExecutionBreak;
4002b26c811SJiaqing Zhao     UINT32                                    MajorVersion;
4012b26c811SJiaqing Zhao     UINT32                                    MinorVersion;
4022b26c811SJiaqing Zhao     // Added for Shell 2.1
4032b26c811SJiaqing Zhao     EFI_SHELL_REGISTER_GUID_NAME              RegisterGuidName;
4042b26c811SJiaqing Zhao     EFI_SHELL_GET_GUID_NAME                   GetGuidName;
4052b26c811SJiaqing Zhao     EFI_SHELL_GET_GUID_FROM_NAME              GetGuidFromName;
4062b26c811SJiaqing Zhao     EFI_SHELL_GET_ENV_EX                      GetEnvEx;
4072b26c811SJiaqing Zhao } EFI_SHELL_PROTOCOL;
4082b26c811SJiaqing Zhao 
409773f30afSJiaqing Zhao #define EFI_SHELL_PARAMETERS_PROTOCOL_GUID \
410773f30afSJiaqing Zhao     { 0x752f3136, 0x4e16, 0x4fdc, { 0xa2, 0x2a, 0xe5, 0xf4, 0x68, 0x12, 0xf4, 0xca } }
411773f30afSJiaqing Zhao 
412773f30afSJiaqing Zhao INTERFACE_DECL(_EFI_SHELL_PARAMETERS_PROTOCOL);
413773f30afSJiaqing Zhao 
414773f30afSJiaqing Zhao typedef struct _EFI_SHELL_PARAMETERS_PROTOCOL {
415773f30afSJiaqing Zhao     CHAR16            **Argv;
416773f30afSJiaqing Zhao     UINTN             Argc;
417773f30afSJiaqing Zhao     SHELL_FILE_HANDLE StdIn;
418773f30afSJiaqing Zhao     SHELL_FILE_HANDLE StdOut;
419773f30afSJiaqing Zhao     SHELL_FILE_HANDLE StdErr;
420773f30afSJiaqing Zhao } EFI_SHELL_PARAMETERS_PROTOCOL;
421773f30afSJiaqing Zhao 
422*6c04004fSJiaqing Zhao #define EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL_GUID \
423*6c04004fSJiaqing Zhao     { 0x3c7200e9, 0x005f, 0x4ea4, { 0x87, 0xde, 0xa3, 0xdf, 0xac, 0x8a, 0x27, 0xc3 } }
424*6c04004fSJiaqing Zhao 
425*6c04004fSJiaqing Zhao INTERFACE_DECL(_EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL);
426*6c04004fSJiaqing Zhao 
427*6c04004fSJiaqing Zhao typedef
428*6c04004fSJiaqing Zhao SHELL_STATUS
429*6c04004fSJiaqing Zhao (EFIAPI *SHELL_COMMAND_HANDLER)(
430*6c04004fSJiaqing Zhao     IN struct _EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,
431*6c04004fSJiaqing Zhao     IN EFI_SYSTEM_TABLE                           *SystemTable,
432*6c04004fSJiaqing Zhao     IN EFI_SHELL_PARAMETERS_PROTOCOL              *ShellParameters,
433*6c04004fSJiaqing Zhao     IN EFI_SHELL_PROTOCOL                         *Shell
434*6c04004fSJiaqing Zhao     );
435*6c04004fSJiaqing Zhao 
436*6c04004fSJiaqing Zhao typedef
437*6c04004fSJiaqing Zhao CHAR16*
438*6c04004fSJiaqing Zhao (EFIAPI *SHELL_COMMAND_GETHELP)(
439*6c04004fSJiaqing Zhao     IN struct _EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,
440*6c04004fSJiaqing Zhao     IN CONST CHAR8                                *Language
441*6c04004fSJiaqing Zhao     );
442*6c04004fSJiaqing Zhao 
443*6c04004fSJiaqing Zhao typedef struct _EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL {
444*6c04004fSJiaqing Zhao     CONST CHAR16          *CommandName;
445*6c04004fSJiaqing Zhao     SHELL_COMMAND_HANDLER Handler;
446*6c04004fSJiaqing Zhao     SHELL_COMMAND_GETHELP GetHelp;
447*6c04004fSJiaqing Zhao } EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL;
448*6c04004fSJiaqing Zhao 
4492b26c811SJiaqing Zhao #endif
450