]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Include/Protocol/EfiShell.h
This adds the new APIs for UEFI Shell 2.1 and makes a new structure for shell impleme...
[mirror_edk2.git] / ShellPkg / Include / Protocol / EfiShell.h
index d36c1f6b17da2347c834bb1b53663e7d491e868b..c39843ea4532ad09c2c8c4364f5dfb7e9895a3ad 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   EFI Shell protocol as defined in the UEFI Shell 2.0 specification including errata.\r
 \r
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -413,6 +413,35 @@ CONST CHAR16 *
   IN CONST CHAR16 *Name OPTIONAL\r
   );\r
 \r
+/**\r
+  Gets the environment variable and Attributes, or list of environment variables.  Can be \r
+  used instead of GetEnv().\r
+\r
+  This function returns the current value of the specified environment variable and\r
+  the Attributes. If no variable name was specified, then all of the known\r
+  variables will be returned.\r
+\r
+  @param[in] Name               A pointer to the environment variable name. If Name is NULL,\r
+                                then the function will return all of the defined shell \r
+                                environment variables. In the case where multiple environment\r
+                                variables are being returned, each variable will be terminated \r
+                                by a NULL, and the list will be terminated by a double NULL.\r
+  @param[out] Attributes        If not NULL, a pointer to the returned attributes bitmask for\r
+                                the environment variable. In the case where Name is NULL, and\r
+                                multiple environment variables are being returned, Attributes\r
+                                is undefined.\r
+\r
+  @retval NULL                  The environment variable doesn\92t exist.  \r
+  @return                       The environment variable\92s value. The returned pointer does not \r
+                                need to be freed by the caller.  \r
+**/\r
+typedef\r
+CONST CHAR16 *\r
+(EFIAPI *EFI_SHELL_GET_ENV_EX) (\r
+  IN  CONST CHAR16 *Name,\r
+  OUT       UINT32 *Attributes OPTIONAL\r
+  );\r
+\r
 /**\r
   Gets the file information from an open file handle.\r
 \r
@@ -486,6 +515,54 @@ EFI_STATUS
   OUT UINT64 *Size\r
   );\r
 \r
+/**\r
+  Get the GUID value from a human readable name.\r
+\r
+  If GuidName is a known GUID name, then update Guid to have the correct value for\r
+  that GUID.\r
+\r
+  This function is only available when the major and minor versions in the\r
+  EfiShellProtocol are greater than or equal to 2 and 1, respectively.\r
+\r
+  @param[in]  GuidName   A pointer to the localized name for the GUID being queried.\r
+  @param[out] Guid       A pointer to the GUID structure to be filled in.\r
+\r
+  @retval EFI_SUCCESS             The operation was successful.\r
+  @retval EFI_INVALID_PARAMETER   Guid was NULL.\r
+  @retval EFI_INVALID_PARAMETER   GuidName was NULL.\r
+  @retval EFI_NOT_FOUND           GuidName is not a known GUID Name.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SHELL_GET_GUID_FROM_NAME)(\r
+  IN  CONST CHAR16   *GuidName,\r
+  OUT       EFI_GUID *Guid\r
+  );\r
+\r
+/**\r
+  Get the human readable name for a GUID from the value.\r
+\r
+  If Guid is assigned a name, then update *GuidName to point to the name. The callee\r
+  should not modify the value.\r
+\r
+  This function is only available when the major and minor versions in the\r
+  EfiShellProtocol are greater than or equal to 2 and 1, respectively.\r
+\r
+  @param[in]  Guid       A pointer to the GUID being queried.\r
+  @param[out] GuidName   A pointer to a pointer the localized to name for the GUID being requested\r
+\r
+  @retval EFI_SUCCESS             The operation was successful.\r
+  @retval EFI_INVALID_PARAMETER   Guid was NULL.\r
+  @retval EFI_INVALID_PARAMETER   GuidName was NULL.\r
+  @retval EFI_NOT_FOUND           Guid is not assigned a name.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SHELL_GET_GUID_NAME)(\r
+  IN  CONST EFI_GUID *Guid,\r
+  OUT CONST CHAR16   **GuidName\r
+  );\r
+\r
 /**\r
   Return help information about a specific command.\r
 \r
@@ -728,6 +805,30 @@ EFI_STATUS
   IN OUT VOID *Buffer\r
   );\r
 \r
+/**\r
+  Register a GUID and a localized human readable name for it.\r
+\r
+  If Guid is not assigned a name, then assign GuidName to Guid.  This list of GUID\r
+  names must be used whenever a shell command outputs GUID information.\r
+\r
+  This function is only available when the major and minor versions in the\r
+  EfiShellProtocol are greater than or equal to 2 and 1, respectively.\r
+\r
+  @param[in] Guid       A pointer to the GUID being registered.\r
+  @param[in] GuidName   A pointer to the localized name for the GUID being registered.\r
+\r
+  @retval EFI_SUCCESS             The operation was successful.\r
+  @retval EFI_INVALID_PARAMETER   Guid was NULL.\r
+  @retval EFI_INVALID_PARAMETER   GuidName was NULL.\r
+  @retval EFI_ACCESS_DENIED       Guid already is assigned a name.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_SHELL_REGISTER_GUID_NAME)(\r
+  IN CONST EFI_GUID *Guid,\r
+  IN CONST CHAR16   *GuidName\r
+  );\r
+\r
 /**\r
   Deletes the duplicate file names files in the given file list.\r
 \r
@@ -995,11 +1096,64 @@ typedef struct _EFI_SHELL_PROTOCOL {
   UINT32                                    MinorVersion;\r
 } EFI_SHELL_PROTOCOL;\r
 \r
+//\r
+// The new structure with extra functions for UEFI Shell Specification 2.1\r
+//\r
+typedef struct _EFI_SHELL_PROTOCOL21 {\r
+  EFI_SHELL_EXECUTE                         Execute;\r
+  EFI_SHELL_GET_ENV                         GetEnv;\r
+  EFI_SHELL_SET_ENV                         SetEnv;\r
+  EFI_SHELL_GET_ALIAS                       GetAlias;\r
+  EFI_SHELL_SET_ALIAS                       SetAlias;\r
+  EFI_SHELL_GET_HELP_TEXT                   GetHelpText;\r
+  EFI_SHELL_GET_DEVICE_PATH_FROM_MAP        GetDevicePathFromMap;\r
+  EFI_SHELL_GET_MAP_FROM_DEVICE_PATH        GetMapFromDevicePath;\r
+  EFI_SHELL_GET_DEVICE_PATH_FROM_FILE_PATH  GetDevicePathFromFilePath;\r
+  EFI_SHELL_GET_FILE_PATH_FROM_DEVICE_PATH  GetFilePathFromDevicePath;\r
+  EFI_SHELL_SET_MAP                         SetMap;\r
+  EFI_SHELL_GET_CUR_DIR                     GetCurDir;\r
+  EFI_SHELL_SET_CUR_DIR                     SetCurDir;\r
+  EFI_SHELL_OPEN_FILE_LIST                  OpenFileList;\r
+  EFI_SHELL_FREE_FILE_LIST                  FreeFileList;\r
+  EFI_SHELL_REMOVE_DUP_IN_FILE_LIST         RemoveDupInFileList;\r
+  EFI_SHELL_BATCH_IS_ACTIVE                 BatchIsActive;\r
+  EFI_SHELL_IS_ROOT_SHELL                   IsRootShell;\r
+  EFI_SHELL_ENABLE_PAGE_BREAK               EnablePageBreak;\r
+  EFI_SHELL_DISABLE_PAGE_BREAK              DisablePageBreak;\r
+  EFI_SHELL_GET_PAGE_BREAK                  GetPageBreak;\r
+  EFI_SHELL_GET_DEVICE_NAME                 GetDeviceName;\r
+  EFI_SHELL_GET_FILE_INFO                   GetFileInfo;\r
+  EFI_SHELL_SET_FILE_INFO                   SetFileInfo;\r
+  EFI_SHELL_OPEN_FILE_BY_NAME               OpenFileByName;\r
+  EFI_SHELL_CLOSE_FILE                      CloseFile;\r
+  EFI_SHELL_CREATE_FILE                     CreateFile;\r
+  EFI_SHELL_READ_FILE                       ReadFile;\r
+  EFI_SHELL_WRITE_FILE                      WriteFile;\r
+  EFI_SHELL_DELETE_FILE                     DeleteFile;\r
+  EFI_SHELL_DELETE_FILE_BY_NAME             DeleteFileByName;\r
+  EFI_SHELL_GET_FILE_POSITION               GetFilePosition;\r
+  EFI_SHELL_SET_FILE_POSITION               SetFilePosition;\r
+  EFI_SHELL_FLUSH_FILE                      FlushFile;\r
+  EFI_SHELL_FIND_FILES                      FindFiles;\r
+  EFI_SHELL_FIND_FILES_IN_DIR               FindFilesInDir;\r
+  EFI_SHELL_GET_FILE_SIZE                   GetFileSize;\r
+  EFI_SHELL_OPEN_ROOT                       OpenRoot;\r
+  EFI_SHELL_OPEN_ROOT_BY_HANDLE             OpenRootByHandle;\r
+  EFI_EVENT                                 ExecutionBreak;\r
+  UINT32                                    MajorVersion;\r
+  UINT32                                    MinorVersion;\r
+  // Added for Shell 2.1\r
+  EFI_SHELL_REGISTER_GUID_NAME             RegisterGuidName;\r
+  EFI_SHELL_GET_GUID_NAME                  GetGuidName;\r
+  EFI_SHELL_GET_GUID_FROM_NAME             GetGuidFromName;\r
+  EFI_SHELL_GET_ENV_EX                     GetEnvEx;\r
+} EFI_SHELL_PROTOCOL21;\r
+\r
 extern EFI_GUID gEfiShellProtocolGuid;\r
 \r
 enum ShellVersion {\r
   SHELL_MAJOR_VERSION = 2,\r
-  SHELL_MINOR_VERSION = 0\r
+  SHELL_MINOR_VERSION = 1\r
 };\r
 \r
 #endif\r