/** @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
**/\r
typedef\r
EFI_STATUS\r
-(*EFI_SHELL_GET_DEVICE_NAME) (\r
+(EFIAPI *EFI_SHELL_GET_DEVICE_NAME) (\r
IN EFI_HANDLE DeviceHandle,\r
IN EFI_SHELL_DEVICE_NAME_FLAGS Flags,\r
IN CHAR8 *Language,\r
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
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
If there are multiple map names they will be semi-colon seperated in the\r
NULL-terminated string.\r
\r
- @param[in,out] DevicePath On entry, points to a device path pointer. On\r
- exit, updates the pointer to point to the\r
- portion of the device path after the mapping.\r
+ @param[in, out] DevicePath On entry, points to a device path pointer. On\r
+ exit, updates the pointer to point to the\r
+ portion of the device path after the mapping.\r
\r
@retval NULL No mapping was found.\r
@retval !=NULL Pointer to NULL-terminated mapping. The buffer\r
according to the rules specified in UEFI Shell 2.0 spec section 3.7.1. Each\r
matching file has an EFI_SHELL_FILE_INFO structure created in a linked list.\r
\r
- @param[in] Path A pointer to the path string.\r
- @param[in] OpenMode Specifies the mode used to open each file, EFI_FILE_MODE_READ or\r
- EFI_FILE_MODE_WRITE.\r
- @param[in,out] FileList Points to the start of a list of files opened.\r
+ @param[in] Path A pointer to the path string.\r
+ @param[in] OpenMode Specifies the mode used to open each file, EFI_FILE_MODE_READ or\r
+ EFI_FILE_MODE_WRITE.\r
+ @param[in, out] FileList Points to the start of a list of files opened.\r
\r
@retval EFI_SUCCESS Create the file list successfully.\r
@return Can't create the file list.\r
current position is increased by the number of bytes returned.\r
If FileHandle is a directory, then an error is returned.\r
\r
- @param[in] FileHandle The opened file handle for read.\r
- @param[in] ReadSize On input, the size of Buffer, in bytes. On output, the amount of data read.\r
- @param[in,out] Buffer The buffer in which data is read.\r
+ @param[in] FileHandle The opened file handle for read.\r
+ @param[in] ReadSize On input, the size of Buffer, in bytes. On output, the amount of data read.\r
+ @param[in, out] Buffer The buffer in which data is read.\r
\r
@retval EFI_SUCCESS Data was read.\r
@retval EFI_NO_MEDIA The device has no media.\r
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
\r
Direct writes to opened directories are not supported.\r
\r
- @param[in] FileHandle The opened file handle for writing.\r
- @param[in,out] BufferSize On input, size of Buffer.\r
- @param[in] Buffer The buffer in which data to write.\r
+ @param[in] FileHandle The opened file handle for writing.\r
+ @param[in, out] BufferSize On input, size of Buffer.\r
+ @param[in] Buffer The buffer in which data to write.\r
\r
@retval EFI_SUCCESS Data was written.\r
@retval EFI_UNSUPPORTED Writes to open directory are not supported.\r
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
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