summaryrefslogtreecommitdiffstats
path: root/ShellPkg/Library/UefiShellCommandLib
diff options
context:
space:
mode:
authorTapan Shah <tapandshah@hpe.com>2016-04-22 09:32:26 -0700
committerJaben Carsey <jaben.carsey@intel.com>2016-04-25 09:08:06 -0700
commitcf6c1550cbf80423a9c058a52f7708db09dd4883 (patch)
treeef1bd4a1ae9083ea613abf986f0fa6903ba5b0b0 /ShellPkg/Library/UefiShellCommandLib
parent599f004b278f597dcfd02a56a72d9393b5f0c55a (diff)
downloadedk2-cf6c1550cbf80423a9c058a52f7708db09dd4883.tar.gz
edk2-cf6c1550cbf80423a9c058a52f7708db09dd4883.tar.bz2
edk2-cf6c1550cbf80423a9c058a52f7708db09dd4883.zip
ShellPkg: Enahance 'dh' command to add more protocols decoding support
Adding EdidDiscovered, EdidActive protocol decode support a in 'dh' command. Extending GraphicsOutput protocol decoding to list all supported GOP resolutions. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Tapan Shah <tapandshah@hpe.com> Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hpe.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Diffstat (limited to 'ShellPkg/Library/UefiShellCommandLib')
-rw-r--r--ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c61
-rw-r--r--ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.h2
2 files changed, 62 insertions, 1 deletions
diff --git a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
index 92a88d18a0..48e4d4af0d 100644
--- a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
+++ b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
@@ -1,8 +1,10 @@
/** @file
Provides interface to shell internal functions for shell commands.
- (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.<BR>
Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
+ (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.<BR>
+ (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
+
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -1742,3 +1744,60 @@ DumpHex (
DataSize -= Size;
}
}
+
+/**
+ Dump HEX data into buffer.
+
+ @param[in] Buffer HEX data to be dumped in Buffer.
+ @param[in] Indent How many spaces to indent the output.
+ @param[in] Offset The offset of the printing.
+ @param[in] DataSize The size in bytes of UserData.
+ @param[in] UserData The data to print out.
+**/
+CHAR16*
+CatSDumpHex (
+ IN CHAR16 *Buffer,
+ IN UINTN Indent,
+ IN UINTN Offset,
+ IN UINTN DataSize,
+ IN VOID *UserData
+ )
+{
+ UINT8 *Data;
+ UINT8 TempByte;
+ UINTN Size;
+ UINTN Index;
+ CHAR8 Val[50];
+ CHAR8 Str[20];
+ CHAR16 *RetVal;
+ CHAR16 *TempRetVal;
+
+ Data = UserData;
+ RetVal = Buffer;
+ while (DataSize != 0) {
+ Size = 16;
+ if (Size > DataSize) {
+ Size = DataSize;
+ }
+
+ for (Index = 0; Index < Size; Index += 1) {
+ TempByte = Data[Index];
+ Val[Index * 3 + 0] = Hex[TempByte >> 4];
+ Val[Index * 3 + 1] = Hex[TempByte & 0xF];
+ Val[Index * 3 + 2] = (CHAR8) ((Index == 7) ? '-' : ' ');
+ Str[Index] = (CHAR8) ((TempByte < ' ' || TempByte > 'z') ? '.' : TempByte);
+ }
+
+ Val[Index * 3] = 0;
+ Str[Index] = 0;
+ TempRetVal = CatSPrint (RetVal, L"%*a%08X: %-48a *%a*\r\n", Indent, "", Offset, Val, Str);
+ SHELL_FREE_NON_NULL (RetVal);
+ RetVal = TempRetVal;
+
+ Data += Size;
+ Offset += Size;
+ DataSize -= Size;
+ }
+
+ return RetVal;
+}
diff --git a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.h b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.h
index 1cfda2cf2d..a096a12098 100644
--- a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.h
+++ b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.h
@@ -2,6 +2,7 @@
Provides interface to shell internal functions for shell commands.
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved. <BR>
+ (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -43,6 +44,7 @@
#include <Library/ShellLib.h>
#include <Library/HiiLib.h>
#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiLib.h>
typedef struct{
LIST_ENTRY Link;