]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Include/Protocol/EfiShell.h
ShellPkg: Standardized HP Copyright Message String
[mirror_edk2.git] / ShellPkg / Include / Protocol / EfiShell.h
index d36c1f6b17da2347c834bb1b53663e7d491e868b..6c1d66a6696d4cbed2436d93b5007aa3fc9166fe 100644 (file)
@@ -1,7 +1,8 @@
 /** @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
+  (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<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 +414,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't exist.  \r
+  @return                       The environment variable's 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 +516,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 +806,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
@@ -950,6 +1052,30 @@ EFI_STATUS
   IN VOID                       *Buffer\r
   );\r
 \r
+//\r
+// EFI_SHELL_PROTOCOL has been updated since UEFI Shell Spec 2.0\r
+// Usage of this protocol will require version checking before attempting\r
+// to use any new members.  There is no need to check the version for\r
+// members that existed in UEFI Shell Spec 2.0.\r
+//\r
+// Update below for any future UEFI Shell spec changes to this protocol.\r
+//\r
+// Check EFI_SHELL_PROTOCOL MajorVersion and MinorVersion:\r
+// if ((2 == gEfiShellProtocol->MajorVersion) &&\r
+//     (0 == gEfiShellProtocol->MinorVersion)) {\r
+//   //\r
+//   // Cannot call:\r
+//   // RegisterGuidName - UEFI Shell 2.1\r
+//   // GetGuidName      - UEFI Shell 2.1\r
+//   // GetGuidFromName  - UEFI Shell 2.1\r
+//   // GetEnvEx         - UEFI Shell 2.1\r
+//   //\r
+// } else {\r
+//   //\r
+//   // Can use all members\r
+//   //\r
+// }\r
+//\r
 typedef struct _EFI_SHELL_PROTOCOL {\r
   EFI_SHELL_EXECUTE                         Execute;\r
   EFI_SHELL_GET_ENV                         GetEnv;\r
@@ -993,13 +1119,18 @@ typedef struct _EFI_SHELL_PROTOCOL {
   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_PROTOCOL;\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